- Fixed a couple of Hipadaba Issues
- Added properties to Hipadaba Nodes - Made Morpheus Hipadaba aware and implemented scans for Morpheus and Hipadaba SKIPPED: psi/tecs/make_crv
This commit is contained in:
34
.cdtproject
34
.cdtproject
@ -7,8 +7,8 @@
|
|||||||
<attribute key="ctagslocation" value=""/>
|
<attribute key="ctagslocation" value=""/>
|
||||||
<attribute key="ctagfiletype" value="ctags_internal"/>
|
<attribute key="ctagfiletype" value="ctags_internal"/>
|
||||||
<attribute key="ctagsindexincludes" value="false"/>
|
<attribute key="ctagsindexincludes" value="false"/>
|
||||||
<attribute key="ctagfilelocation" value=""/>
|
|
||||||
<attribute key="ctagslocationtype" value="ctags_path_default"/>
|
<attribute key="ctagslocationtype" value="ctags_path_default"/>
|
||||||
|
<attribute key="ctagfilelocation" value=""/>
|
||||||
</extension>
|
</extension>
|
||||||
<data>
|
<data>
|
||||||
<item id="org.eclipse.cdt.core.pathentry">
|
<item id="org.eclipse.cdt.core.pathentry">
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<autodiscovery enabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile" problemReportingEnabled="true"/>
|
<autodiscovery enabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile" problemReportingEnabled="true"/>
|
||||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
<buildOutputProvider>
|
<buildOutputProvider>
|
||||||
<openAction enabled="false" filePath=""/>
|
<openAction enabled="true" filePath=""/>
|
||||||
<parser enabled="true"/>
|
<parser enabled="true"/>
|
||||||
</buildOutputProvider>
|
</buildOutputProvider>
|
||||||
<scannerInfoProvider id="specsFile">
|
<scannerInfoProvider id="specsFile">
|
||||||
@ -32,6 +32,36 @@
|
|||||||
<parser enabled="true"/>
|
<parser enabled="true"/>
|
||||||
</scannerInfoProvider>
|
</scannerInfoProvider>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="false" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction useDefault="true" command="make" arguments="-f ${project_name}_scd.mk"/>
|
||||||
|
<parser enabled="false"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="false" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction useDefault="true" command="gcc" arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}"/>
|
||||||
|
<parser enabled="false"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="false" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction useDefault="true" command="gcc" arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}"/>
|
||||||
|
<parser enabled="false"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
</item>
|
</item>
|
||||||
</data>
|
</data>
|
||||||
</cdtproject>
|
</cdtproject>
|
||||||
|
35
.project
35
.project
@ -7,7 +7,12 @@
|
|||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.cdt.make.core.makeBuilder</name>
|
<name>org.eclipse.cdt.make.core.makeBuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
<arguments>
|
<arguments>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.build.arguments</key>
|
||||||
|
<value>-f makefile_linux</value>
|
||||||
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.core.errorOutputParser</key>
|
<key>org.eclipse.cdt.core.errorOutputParser</key>
|
||||||
<value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
|
<value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
|
||||||
@ -20,22 +25,42 @@
|
|||||||
<key>org.eclipse.cdt.make.core.incrementalBuildTarget</key>
|
<key>org.eclipse.cdt.make.core.incrementalBuildTarget</key>
|
||||||
<value>all</value>
|
<value>all</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||||
|
<value></value>
|
||||||
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
<key>org.eclipse.cdt.make.core.environment</key>
|
||||||
<value></value>
|
<value></value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||||
<value>true</value>
|
<value>true</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.build.target.inc</key>
|
||||||
|
<value>all</value>
|
||||||
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
|
<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
|
||||||
<value>true</value>
|
<value>true</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.build.location</key>
|
||||||
|
<value></value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.build.command</key>
|
||||||
|
<value>make</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.build.target.clean</key>
|
||||||
|
<value>clean</value>
|
||||||
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||||
<value>true</value>
|
<value>true</value>
|
||||||
@ -44,6 +69,10 @@
|
|||||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||||
<value>clean</value>
|
<value>clean</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
@ -64,6 +93,10 @@
|
|||||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||||
<value>false</value>
|
<value>false</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.build.target.auto</key>
|
||||||
|
<value>all</value>
|
||||||
|
</dictionary>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
|
3
.settings/org.eclipse.cdt.core.prefs
Normal file
3
.settings/org.eclipse.cdt.core.prefs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#Thu Jan 11 14:43:46 CET 2007
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
indexerId=org.eclipse.cdt.core.fastIndexer
|
41
hipadaba.c
41
hipadaba.c
@ -39,6 +39,9 @@ static void DeleteNodeData(pHdb node){
|
|||||||
DeleteCallbackChain(node->updateCallbacks);
|
DeleteCallbackChain(node->updateCallbacks);
|
||||||
DeleteCallbackChain(node->readCallbacks);
|
DeleteCallbackChain(node->readCallbacks);
|
||||||
DeleteCallbackChain(node->treeChangeCallbacks);
|
DeleteCallbackChain(node->treeChangeCallbacks);
|
||||||
|
if(node->properties != NULL){
|
||||||
|
DeleteStringDict(node->properties);
|
||||||
|
}
|
||||||
|
|
||||||
if(node->name != NULL){
|
if(node->name != NULL){
|
||||||
free(node->name);
|
free(node->name);
|
||||||
@ -352,6 +355,7 @@ hdbValue MakeHdbInt(int initValue){
|
|||||||
hdbValue result;
|
hdbValue result;
|
||||||
|
|
||||||
result.dataType = HIPINT;
|
result.dataType = HIPINT;
|
||||||
|
result.arrayLength = 1;
|
||||||
result.v.intValue = initValue;
|
result.v.intValue = initValue;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -360,6 +364,7 @@ hdbValue MakeHdbFloat(double initValue){
|
|||||||
hdbValue result;
|
hdbValue result;
|
||||||
|
|
||||||
result.dataType = HIPFLOAT;
|
result.dataType = HIPFLOAT;
|
||||||
|
result.arrayLength = 1;
|
||||||
result.v.doubleValue = initValue;
|
result.v.doubleValue = initValue;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -529,6 +534,10 @@ pHdb MakeHipadabaNode(char *name, int datatype, int length){
|
|||||||
pNew->magic = HDBMAGICK;
|
pNew->magic = HDBMAGICK;
|
||||||
pNew->name = strdup(name);
|
pNew->name = strdup(name);
|
||||||
pNew->value.dataType = datatype;
|
pNew->value.dataType = datatype;
|
||||||
|
pNew->properties = CreateStringDict();
|
||||||
|
if(pNew->properties == NULL || pNew->name == NULL){
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
switch(datatype){
|
switch(datatype){
|
||||||
case HIPINTAR:
|
case HIPINTAR:
|
||||||
case HIPINTVARAR:
|
case HIPINTVARAR:
|
||||||
@ -1049,3 +1058,35 @@ int GetHdbPar(pHdb node, int dataType, void *data, int length,
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*============================= Property Functions ==========================*/
|
||||||
|
void SetHdbProperty(pHdb node, char *key, char *value){
|
||||||
|
if(node != NULL && key != NULL && node->properties != NULL){
|
||||||
|
if(StringDictExists(node->properties, key)){
|
||||||
|
StringDictUpdate(node->properties,key,value);
|
||||||
|
} else {
|
||||||
|
StringDictAddPair(node->properties,key,value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
int GetHdbProperty(pHdb node, char *key, char *value, int len){
|
||||||
|
if(node != NULL && node->properties != NULL){
|
||||||
|
return StringDictGet(node->properties,key,value,len);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void InitHdbPropertySearch(pHdb node){
|
||||||
|
if(node != NULL && node->properties != NULL){
|
||||||
|
StringDictKillScan(node->properties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
const char *GetNextHdbProperty(pHdb node, char *value ,int len){
|
||||||
|
if(node != NULL && node->properties != NULL) {
|
||||||
|
return StringDictGetNext(node->properties, value, len);
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
35
hipadaba.h
35
hipadaba.h
@ -22,9 +22,12 @@
|
|||||||
* Mark Koennecke, June 2006
|
* Mark Koennecke, June 2006
|
||||||
*
|
*
|
||||||
* Added treeChange callback, Mark Koennecke, November 2006
|
* Added treeChange callback, Mark Koennecke, November 2006
|
||||||
|
*
|
||||||
|
* Added support for properties, Mark Koennecke, January 2007
|
||||||
*/
|
*/
|
||||||
#ifndef HIPADABA
|
#ifndef HIPADABA
|
||||||
#define HIPADABA
|
#define HIPADABA
|
||||||
|
#include <stringdict.h>
|
||||||
|
|
||||||
/*------- datatypes */
|
/*------- datatypes */
|
||||||
#define HIPNONE -1
|
#define HIPNONE -1
|
||||||
@ -70,6 +73,7 @@ typedef struct __hipadaba {
|
|||||||
char *name;
|
char *name;
|
||||||
hdbValue value;
|
hdbValue value;
|
||||||
int protected;
|
int protected;
|
||||||
|
pStringDict properties;
|
||||||
}Hdb, *pHdb;
|
}Hdb, *pHdb;
|
||||||
/*-------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------*/
|
||||||
typedef int (*hdbCallbackFunction)(void *userData, void *callData,
|
typedef int (*hdbCallbackFunction)(void *userData, void *callData,
|
||||||
@ -330,5 +334,34 @@ int UpdateHdbPar(pHdb node, int dataType, void *data, int length,
|
|||||||
*/
|
*/
|
||||||
int GetHdbPar(pHdb node, int dataType, void *data, int length,
|
int GetHdbPar(pHdb node, int dataType, void *data, int length,
|
||||||
void *callData);
|
void *callData);
|
||||||
|
/*================================ Property Interface ==============================================*/
|
||||||
|
/**
|
||||||
|
* set a property
|
||||||
|
* @param node The node to set the property for
|
||||||
|
* @param key The key for the property
|
||||||
|
* @param value The value of the property
|
||||||
|
*/
|
||||||
|
void SetHdbProperty(pHdb node, char *key, char *value);
|
||||||
|
/**
|
||||||
|
* get the value of a property
|
||||||
|
* @param node The node to get the property from
|
||||||
|
* @param key The properties key
|
||||||
|
* @param value The area to which to copy the property
|
||||||
|
* @param len The length of value
|
||||||
|
* @return 0 on failure, 1 on success
|
||||||
|
*/
|
||||||
|
int GetHdbProperty(pHdb node, char *key, char *value, int len);
|
||||||
|
/**
|
||||||
|
* initialize a property scan on this node
|
||||||
|
* @param node The node for which to scan properties
|
||||||
|
*/
|
||||||
|
void InitHdbPropertySearch(pHdb node);
|
||||||
|
/**
|
||||||
|
* get the next property in a search
|
||||||
|
* @param node The node for which to search properties
|
||||||
|
* @param value An area where to copy the value of the property
|
||||||
|
* @param len The length of value
|
||||||
|
* @return The key of the property or NULL when the property list is exhausted
|
||||||
|
*/
|
||||||
|
const char *GetNextHdbProperty(pHdb node, char *value ,int len);
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
MFLAGS=-f makefile_linux$(DUMMY)
|
MFLAGS=-f makefile_linux$(DUMMY)
|
||||||
|
|
||||||
HDFROOT=/afs/psi.ch/project/sinq/sl-linux
|
HDFROOT=/usr/local
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
# Markus Zolliker, March 2003
|
# Markus Zolliker, March 2003
|
||||||
#==========================================================================
|
#==========================================================================
|
||||||
# assign if the National Instrument GPIB driver is available
|
# assign if the National Instrument GPIB driver is available
|
||||||
SINQDIR=/afs/psi.ch/project/sinq
|
SINQDIR=/usr/local
|
||||||
NI=
|
#NI=
|
||||||
#NI= -DHAVENI
|
NI= -DHAVENI
|
||||||
#NIOBJ= nigpib.o
|
NIOBJ= nigpib.o
|
||||||
#NILIB=$(SINQDIR)/linux/lib/cib.o
|
NILIB=$(SINQDIR)/lib/cib.o
|
||||||
|
|
||||||
include linux_def
|
include linux_def
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ SUBLIBS = psi/libpsi.a psi/hardsup/libhlib.a matrix/libmatrix.a \
|
|||||||
LIBS = -L$(HDFROOT)/lib $(SUBLIBS) $(NILIB)\
|
LIBS = -L$(HDFROOT)/lib $(SUBLIBS) $(NILIB)\
|
||||||
-ltcl8.4 -lmxml $(HDFROOT)/lib/libhdf5.a \
|
-ltcl8.4 -lmxml $(HDFROOT)/lib/libhdf5.a \
|
||||||
$(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
|
$(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
|
||||||
-ljpeg -ldl -lz -lm -lc
|
-lmxml -lghttp -ljpeg -ldl -lz -lsz -lm -lc
|
||||||
|
|
||||||
include make_gen
|
include make_gen
|
||||||
|
|
||||||
|
@ -399,13 +399,13 @@
|
|||||||
*/
|
*/
|
||||||
killTclDrivable();
|
killTclDrivable();
|
||||||
|
|
||||||
/* close the List system */
|
|
||||||
LLDsystemClose();
|
|
||||||
|
|
||||||
KillFreeConnections();
|
KillFreeConnections();
|
||||||
|
|
||||||
killSICSHipadaba();
|
killSICSHipadaba();
|
||||||
|
|
||||||
|
/* close the List system */
|
||||||
|
LLDsystemClose();
|
||||||
|
|
||||||
/* make fortify print his findings */
|
/* make fortify print his findings */
|
||||||
Fortify_DumpAllMemory(iFortifyScope);
|
Fortify_DumpAllMemory(iFortifyScope);
|
||||||
Fortify_LeaveScope();
|
Fortify_LeaveScope();
|
||||||
|
@ -23,6 +23,30 @@
|
|||||||
#include "sicsvar.h"
|
#include "sicsvar.h"
|
||||||
#include "sicshipadaba.h"
|
#include "sicshipadaba.h"
|
||||||
#include "sicshdbadapter.h"
|
#include "sicshdbadapter.h"
|
||||||
|
|
||||||
|
#define PRIVNAM "priv"
|
||||||
|
/*==================== support code ====================================*/
|
||||||
|
static void AddPrivProperty(pHdb node, int priv){
|
||||||
|
char pPriv[80];
|
||||||
|
switch(priv){
|
||||||
|
case usInternal:
|
||||||
|
strcpy(pPriv,"internal");
|
||||||
|
break;
|
||||||
|
case usMugger:
|
||||||
|
strcpy(pPriv,"manager");
|
||||||
|
break;
|
||||||
|
case usUser:
|
||||||
|
strcpy(pPriv,"user");
|
||||||
|
break;
|
||||||
|
case usSpy:
|
||||||
|
strcpy(pPriv,"spy");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SetHdbProperty(node,PRIVNAM,pPriv);
|
||||||
|
}
|
||||||
/*=================== motor code =======================================*/
|
/*=================== motor code =======================================*/
|
||||||
static int MoveCallback(int iEvent, void *eventData, void *userData,
|
static int MoveCallback(int iEvent, void *eventData, void *userData,
|
||||||
commandContext cc){
|
commandContext cc){
|
||||||
@ -122,6 +146,7 @@ static int AddStdMotorPar(pHdb motorNode, pMotor pMot){
|
|||||||
i = 0;
|
i = 0;
|
||||||
while(addPar[i] != NULL){
|
while(addPar[i] != NULL){
|
||||||
parNode = MakeMotParNode(addPar[i],pMot);
|
parNode = MakeMotParNode(addPar[i],pMot);
|
||||||
|
SetHdbProperty(parNode,PRIVNAM,"internal");
|
||||||
if(parNode == NULL){
|
if(parNode == NULL){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -138,6 +163,7 @@ static int AddStdMotorPar(pHdb motorNode, pMotor pMot){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AddHipadabaChild(motorNode,parNode, NULL);
|
AddHipadabaChild(motorNode,parNode, NULL);
|
||||||
|
AddPrivProperty(parNode,pMot->ParArray[i].iCode);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -197,6 +223,7 @@ static int CreateDriverParameters(pMotor pM, pHdb parent){
|
|||||||
while((pPtr = stptok(pPtr,line,79,"\n")) != NULL){
|
while((pPtr = stptok(pPtr,line,79,"\n")) != NULL){
|
||||||
name = extractName(line);
|
name = extractName(line);
|
||||||
node = MakeMotParNode(name,pM);
|
node = MakeMotParNode(name,pM);
|
||||||
|
SetHdbProperty(node,PRIVNAM,"manager");
|
||||||
if(node != NULL){
|
if(node != NULL){
|
||||||
AddHipadabaChild(parent,node,NULL);
|
AddHipadabaChild(parent,node,NULL);
|
||||||
}
|
}
|
||||||
@ -208,6 +235,7 @@ static int CreateDriverParameters(pMotor pM, pHdb parent){
|
|||||||
static pHdb CreateMotorAdapter(char *name, pMotor pMot){
|
static pHdb CreateMotorAdapter(char *name, pMotor pMot){
|
||||||
pHdb result = NULL;
|
pHdb result = NULL;
|
||||||
commandContext comCom;
|
commandContext comCom;
|
||||||
|
float access;
|
||||||
|
|
||||||
assert(pMot != NULL);
|
assert(pMot != NULL);
|
||||||
|
|
||||||
@ -215,6 +243,9 @@ static pHdb CreateMotorAdapter(char *name, pMotor pMot){
|
|||||||
if(result == NULL){
|
if(result == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
MotorGetPar(pMot,"accesscode",&access);
|
||||||
|
AddPrivProperty(result,(int)access);
|
||||||
|
SetHdbProperty(result,"type","Motor");
|
||||||
/*
|
/*
|
||||||
* We want to be notified when this motor drives around. Or
|
* We want to be notified when this motor drives around. Or
|
||||||
* its parameters change.
|
* its parameters change.
|
||||||
@ -359,6 +390,7 @@ static pHdb MakeSicsVarNode(pSicsVariable pVar, char *name){
|
|||||||
if(node == NULL){
|
if(node == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
AddPrivProperty(node,pVar->iAccessCode);
|
||||||
pCall = MakeHipadabaCallback(SicsVarSetCallback,pVar,NULL,-1,-1);
|
pCall = MakeHipadabaCallback(SicsVarSetCallback,pVar,NULL,-1,-1);
|
||||||
if(pCall == NULL){
|
if(pCall == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -427,6 +459,8 @@ int SICSHdbAdapter(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
SCWrite(pCon,"ERROR: out of memory creating drivable node",eError);
|
SCWrite(pCon,"ERROR: out of memory creating drivable node",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
SetHdbProperty(node,PRIVNAM,"user");
|
||||||
|
SetHdbProperty(node,"type","drivable");
|
||||||
AddHipadabaChild(path,node,pCon);
|
AddHipadabaChild(path,node,pCon);
|
||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
|
136
sicshipadaba.c
136
sicshipadaba.c
@ -8,6 +8,11 @@
|
|||||||
* Mark Koennecke, June 2006
|
* Mark Koennecke, June 2006
|
||||||
*
|
*
|
||||||
* Introduced notification on tree changes, Mark Koennecke, November 2006
|
* Introduced notification on tree changes, Mark Koennecke, November 2006
|
||||||
|
*
|
||||||
|
* Added Property functions, Mark Koennecke, January 2007
|
||||||
|
*
|
||||||
|
* TODO: separate this into two modules: sicshipadaba proper and sicshipadabaint for the
|
||||||
|
* interpreter interface.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -745,6 +750,9 @@ static void SICSDeleteNodeData(pHdb node){
|
|||||||
node->child = node->child->next;
|
node->child = node->child->next;
|
||||||
SICSDeleteNodeData(tmp);
|
SICSDeleteNodeData(tmp);
|
||||||
}
|
}
|
||||||
|
if(node->properties != NULL){
|
||||||
|
DeleteStringDict(node->properties);
|
||||||
|
}
|
||||||
DeleteCallbackChain(node->writeCallbacks);
|
DeleteCallbackChain(node->writeCallbacks);
|
||||||
DeleteCallbackChain(node->updateCallbacks);
|
DeleteCallbackChain(node->updateCallbacks);
|
||||||
DeleteCallbackChain(node->readCallbacks);
|
DeleteCallbackChain(node->readCallbacks);
|
||||||
@ -1611,7 +1619,7 @@ static int UpdateHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc < 3) {
|
if(argc < 2) {
|
||||||
SCWrite(pCon,"ERROR: insufficient number of arguments to UpdateHdbNode",
|
SCWrite(pCon,"ERROR: insufficient number of arguments to UpdateHdbNode",
|
||||||
eError);
|
eError);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1621,26 +1629,30 @@ static int UpdateHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
if(targetNode == NULL){
|
if(targetNode == NULL){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(!cloneHdbValue(&targetNode->value,&newValue)){
|
if(argc > 2){
|
||||||
SCWrite(pCon,"ERROR: out of mmeory cloning node",
|
if(!cloneHdbValue(&targetNode->value,&newValue)){
|
||||||
eError);
|
SCWrite(pCon,"ERROR: out of mmeory cloning node",
|
||||||
return 0;
|
eError);
|
||||||
}
|
return 0;
|
||||||
parData = CreateDynString(64,64);
|
}
|
||||||
if(parData == NULL){
|
parData = CreateDynString(64,64);
|
||||||
SCWrite(pCon,"ERROR: out of memory reading parameter",eError);
|
if(parData == NULL){
|
||||||
return 0;
|
SCWrite(pCon,"ERROR: out of memory reading parameter",eError);
|
||||||
}
|
return 0;
|
||||||
for(i = 2; i < argc; i++){
|
}
|
||||||
DynStringConcat(parData," ");
|
for(i = 2; i < argc; i++){
|
||||||
DynStringConcat(parData, argv[i]);
|
DynStringConcat(parData," ");
|
||||||
}
|
DynStringConcat(parData, argv[i]);
|
||||||
strcpy(error,"ERROR: ");
|
}
|
||||||
if(!readHdbValue(&newValue, GetCharArray(parData),
|
strcpy(error,"ERROR: ");
|
||||||
error+7,512-7)){
|
if(!readHdbValue(&newValue, GetCharArray(parData),
|
||||||
SCWrite(pCon,error, eError);
|
error+7,512-7)){
|
||||||
return 0;
|
SCWrite(pCon,error, eError);
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GetHipadabaPar(targetNode,&newValue,pCon);
|
||||||
|
}
|
||||||
status = UpdateHipadabaPar(targetNode,newValue,pCon);
|
status = UpdateHipadabaPar(targetNode,newValue,pCon);
|
||||||
ReleaseHdbValue(&newValue);
|
ReleaseHdbValue(&newValue);
|
||||||
if(status == 1){
|
if(status == 1){
|
||||||
@ -2243,7 +2255,84 @@ static int SicsCommandNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
SCSendOK(pCon);
|
SCSendOK(pCon);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*======================= Property Functions ================================*/
|
||||||
|
static int SetSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pHdb targetNode = NULL;
|
||||||
|
char buffer[512];
|
||||||
|
|
||||||
|
if(argc < 4) {
|
||||||
|
SCWrite(pCon,"ERROR: need path key value as parameters",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
targetNode = locateSICSNode(pSics,pCon,argv[1]);
|
||||||
|
if(targetNode == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: node not found",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Arg2Text(argc-3, &argv[3], buffer,512);
|
||||||
|
SetHdbProperty(targetNode,argv[2], buffer);
|
||||||
|
SCSendOK(pCon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
static int GetSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pHdb targetNode = NULL;
|
||||||
|
char buffer[512];
|
||||||
|
int status;
|
||||||
|
|
||||||
|
if(argc < 3) {
|
||||||
|
SCWrite(pCon,"ERROR: need path key as parameters",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
targetNode = locateSICSNode(pSics,pCon,argv[1]);
|
||||||
|
if(targetNode == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: node not found",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
status = GetHdbProperty(targetNode,argv[2],buffer,511);
|
||||||
|
if(status != 1){
|
||||||
|
SCWrite(pCon,"ERROR: attribute not found",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
SCPrintf(pCon,eValue,"%s.%s = %s", argv[1], argv[2], buffer);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
static int ListSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pHdb targetNode = NULL;
|
||||||
|
char buffer[512];
|
||||||
|
const char *pKey = NULL;
|
||||||
|
pDynString data = NULL;
|
||||||
|
|
||||||
|
if(argc < 2) {
|
||||||
|
SCWrite(pCon,"ERROR: need path as parameter",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
targetNode = locateSICSNode(pSics,pCon,argv[1]);
|
||||||
|
if(targetNode == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: node not found",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
data = CreateDynString(64,64);
|
||||||
|
if(data == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: out of memory in ListSICSHdbProperty",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
InitHdbPropertySearch(targetNode);
|
||||||
|
while((pKey = GetNextHdbProperty(targetNode, buffer, 511)) != NULL){
|
||||||
|
DynStringConcat(data,(char *)pKey);
|
||||||
|
DynStringConcat(data,"=");
|
||||||
|
DynStringConcat(data,buffer);
|
||||||
|
DynStringConcat(data,"\n");
|
||||||
|
}
|
||||||
|
SCWrite(pCon,GetCharArray(data), eValue);
|
||||||
|
DeleteDynString(data);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*======================= Factory Functions =================================*/
|
||||||
void killSICSHipadaba(){
|
void killSICSHipadaba(){
|
||||||
if(root != NULL){
|
if(root != NULL){
|
||||||
DeleteHipadabaNode(root,NULL);
|
DeleteHipadabaNode(root,NULL);
|
||||||
@ -2271,6 +2360,9 @@ int InstallSICSHipadaba(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
AddCommand(pSics,"hval", HdbNodeVal, NULL, NULL);
|
AddCommand(pSics,"hval", HdbNodeVal, NULL, NULL);
|
||||||
AddCommand(pSics,"hchain", ChainHdbNode, NULL, NULL);
|
AddCommand(pSics,"hchain", ChainHdbNode, NULL, NULL);
|
||||||
AddCommand(pSics,"hcommand",SicsCommandNode, NULL, NULL);
|
AddCommand(pSics,"hcommand",SicsCommandNode, NULL, NULL);
|
||||||
|
AddCommand(pSics,"hsetprop",SetSICSHdbProperty, NULL, NULL);
|
||||||
|
AddCommand(pSics,"hgetprop",GetSICSHdbProperty, NULL, NULL);
|
||||||
|
AddCommand(pSics,"hlistprop",ListSICSHdbProperty, NULL, NULL);
|
||||||
|
|
||||||
InstallSICSPoll(pCon,pSics,pData,argc,argv);
|
InstallSICSPoll(pCon,pSics,pData,argc,argv);
|
||||||
poller = (pSicsPoll)FindCommandData(pSics,"sicspoll","SicsPoll");
|
poller = (pSicsPoll)FindCommandData(pSics,"sicspoll","SicsPoll");
|
||||||
|
@ -75,12 +75,13 @@
|
|||||||
return pNew;
|
return pNew;
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
void DeleteStringDict(pStringDict self)
|
void DeleteStringDict(pStringDict self)
|
||||||
{
|
{
|
||||||
int iRet;
|
int iRet;
|
||||||
SDE sVal;
|
SDE sVal;
|
||||||
|
|
||||||
assert(self);
|
assert(self);
|
||||||
|
|
||||||
iRet = LLDnodePtr2First(self->iList);
|
iRet = LLDnodePtr2First(self->iList);
|
||||||
while(iRet != 0)
|
while(iRet != 0)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,9 @@ proc unknown args {
|
|||||||
return $reply
|
return $reply
|
||||||
} else {
|
} else {
|
||||||
append reply $line
|
append reply $line
|
||||||
|
if {[string first "\n" $line] < 0} {
|
||||||
|
append reply \n
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user