- allow scriptcontext objects to be dynamic
- enhancements in scriptcontext (error messages stored as properties)
This commit is contained in:
@@ -1346,6 +1346,7 @@ static void SICSDeleteNodeData(pHdb node)
|
||||
}
|
||||
|
||||
removeNodeFromUpdateList(node);
|
||||
DeleteCallbackChain(node);
|
||||
while (node->child != NULL) {
|
||||
tmp = node->child;
|
||||
node->child = node->child->next;
|
||||
@@ -1354,7 +1355,6 @@ static void SICSDeleteNodeData(pHdb node)
|
||||
if (node->properties != NULL) {
|
||||
DeleteStringDict(node->properties);
|
||||
}
|
||||
DeleteCallbackChain(node);
|
||||
|
||||
if (node->name != NULL) {
|
||||
free(node->name);
|
||||
@@ -1616,7 +1616,7 @@ static int RemoveParNodeCallback(char *name, pDummy object,
|
||||
|
||||
m.type = killPtr;
|
||||
m.pPtr = internalID;
|
||||
if (object->pDescriptor->parNode) {
|
||||
if (object && object->pDescriptor->parNode) {
|
||||
RecurseCallbackChains(object->pDescriptor->parNode, (pHdbMessage) & m);
|
||||
}
|
||||
return 1;
|
||||
@@ -1805,7 +1805,8 @@ int ProcessSICSHdbPar(pHdb root, SConnection * pCon,
|
||||
SCWrite(pCon, "ERROR: out of memory processing parameter", eError);
|
||||
return 0;
|
||||
}
|
||||
for (i = 1; i < argc; i++) {
|
||||
DynStringConcat(parData, argv[1]);
|
||||
for (i = 2; i < argc; i++) {
|
||||
DynStringConcat(parData, " ");
|
||||
DynStringConcat(parData, argv[i]);
|
||||
}
|
||||
@@ -2048,7 +2049,7 @@ int readHdbValue(hdbValue * v, char *data, char *error, int errlen)
|
||||
getNextHdbNumber(data, number);
|
||||
status = sscanf(number, "%d", &v->v.intValue);
|
||||
if (status != 1) {
|
||||
snprintf(error, errlen, "Failed to convert %s to integer", data);
|
||||
snprintf(error, errlen, "Failed to convert [%.32s] to integer", data);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -2056,7 +2057,7 @@ int readHdbValue(hdbValue * v, char *data, char *error, int errlen)
|
||||
getNextHdbNumber(data, number);
|
||||
status = sscanf(number, "%lf", &v->v.doubleValue);
|
||||
if (status != 1) {
|
||||
snprintf(error, errlen, "Failed to convert %s to double", data);
|
||||
snprintf(error, errlen, "Failed to convert [%.32s] to double", data);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -2082,7 +2083,7 @@ int readHdbValue(hdbValue * v, char *data, char *error, int errlen)
|
||||
}
|
||||
status = sscanf(number, "%d", &lValue);
|
||||
if (status != 1) {
|
||||
snprintf(error, errlen, "Failed to convert %s to integer", data);
|
||||
snprintf(error, errlen, "Failed to convert [%.32s] to integer", data);
|
||||
return 0;
|
||||
}
|
||||
v->v.intArray[i] = lValue;
|
||||
@@ -2104,7 +2105,7 @@ int readHdbValue(hdbValue * v, char *data, char *error, int errlen)
|
||||
}
|
||||
status = sscanf(number, "%lf", &dValue);
|
||||
if (status != 1) {
|
||||
snprintf(error, errlen, "Failed to convert %s to double", data);
|
||||
snprintf(error, errlen, "Failed to convert [%.32s] to double", data);
|
||||
return 0;
|
||||
}
|
||||
v->v.floatArray[i] = dValue;
|
||||
@@ -2154,7 +2155,7 @@ int convertHdbType(char *text)
|
||||
|
||||
type = 0;
|
||||
while (hdbTypes[type] != NULL) {
|
||||
if (strcmp(hdbTypes[type], text) == 0) {
|
||||
if (strcasecmp(hdbTypes[type], text) == 0) {
|
||||
break;
|
||||
}
|
||||
type++;
|
||||
@@ -2196,7 +2197,6 @@ static int MakeHdbNode(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
/*
|
||||
* convert datatype
|
||||
*/
|
||||
strtolower(argv[3]);
|
||||
type = convertHdbType(argv[3]);
|
||||
if (type > HIPFLOATVARAR) {
|
||||
SCWrite(pCon,
|
||||
@@ -2210,7 +2210,7 @@ static int MakeHdbNode(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
eError);
|
||||
return 0;
|
||||
} else {
|
||||
length = atoi(argv[3]);
|
||||
length = atoi(argv[4]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2439,7 +2439,8 @@ static int UpdateHdbNode(SConnection * pCon, SicsInterp * pSics,
|
||||
SCWrite(pCon, "ERROR: out of memory reading parameter", eError);
|
||||
return 0;
|
||||
}
|
||||
for (i = 2; i < argc; i++) {
|
||||
DynStringConcat(parData, argv[2]);
|
||||
for (i = 3; i < argc; i++) {
|
||||
DynStringConcat(parData, " ");
|
||||
DynStringConcat(parData, argv[i]);
|
||||
}
|
||||
@@ -3310,7 +3311,7 @@ static int GetSICSHdbProperty(SConnection * pCon, SicsInterp * pSics,
|
||||
}
|
||||
status = GetHdbProperty(targetNode, argv[2], buffer, 511);
|
||||
if (status != 1) {
|
||||
SCPrintf(pCon, eError, "ERROR: property %s not found", argv[2]);
|
||||
SCPrintf(pCon, eError, "ERROR: %s has no property %s", argv[1], argv[2]);
|
||||
return 0;
|
||||
}
|
||||
SCPrintf(pCon, eValue, "%s.%s = %s", argv[1], argv[2], buffer);
|
||||
@@ -3331,12 +3332,12 @@ static int GetSICSHdbPropertyVal(SConnection * pCon, SicsInterp * pSics,
|
||||
}
|
||||
targetNode = FindHdbNode(NULL, argv[1], pCon);
|
||||
if (targetNode == NULL) {
|
||||
SCWrite(pCon, "ERROR: node not found", eValue);
|
||||
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", eValue);
|
||||
SCPrintf(pCon, eError, "ERROR: %s has no property %s", argv[1], argv[2]);
|
||||
return 0;
|
||||
}
|
||||
SCPrintf(pCon, eValue, "%s", buffer);
|
||||
|
||||
Reference in New Issue
Block a user