- Implemented tcl: prefix which allows to execute a command in Tcl directly

- Fixed a stack overrun bug in macro.c
- Fixed a killing bug in devser.c
- Added node writing with offset to nxscript.c
- Wrote a simulation driver for second generation HM's
- Readded devexec commands to  SICS
- Readded Hipadaba initialisation to SICS
- Fixed a bug in sinqhttprot.c which is triggered when a reconnect happens
  during a node based download of data.


SKIPPED:
	psi/sinqhttpprot.c
This commit is contained in:
koennecke
2010-02-02 12:38:10 +00:00
parent 1dff223146
commit 09cc25ec5b
15 changed files with 282 additions and 212 deletions

View File

@@ -513,7 +513,71 @@ static void putHdb(SConnection * pCon, SicsInterp * pSics, pNXScript self,
}
ReleaseHdbValue(&v);
}
/*----------------------------------------------------------------------*/
static void putHdbOff(SConnection * pCon, SicsInterp * pSics, pNXScript self,
int argc, char *argv[])
{
pHdb node = NULL;
char alias[512];
hdbValue v;
float fVal, *floatAr = NULL;
int i, offset;
if (argc < 4) {
SCWrite(pCon, "ERROR: putHdbOff needs at least a node name and an offset", eLogError);
return;
}
node = FindHdbNode(NULL, argv[2], pCon);
if (node == NULL) {
SCPrintf(pCon, eLogError, "ERROR: node %s not found", argv[2]);
return;
}
memset(alias, 0, 512 * sizeof(char));
if (!GetHdbProperty(node, "nxalias", alias, 512)) {
if (argc < 5) {
SCPrintf(pCon, eLogError,
"ERROR: neither nxalias property nor alias on command line found for %s",
argv[2]);
return;
} else {
strncpy(alias, argv[4], 512);
}
}
offset = atoi(argv[3]);
GetHipadabaPar(node, &v, pCon);
if(offset < 0 || offset > v.arrayLength){
SCPrintf(pCon,eLogError,"ERROR: invalid offset %d speicified", offset );
return;
}
switch (v.dataType) {
case HIPNONE:
return;
break;
case HIPINTAR:
case HIPINTVARAR:
NXDputalias(self->fileHandle, self->dictHandle, alias, v.v.intArray+offset);
break;
case HIPFLOATAR:
case HIPFLOATVARAR:
floatAr = malloc(v.arrayLength * sizeof(float));
if (floatAr == NULL) {
SCPrintf(pCon, eLogError, "ERROR: out of memory writing %s",
node->name);
return;
}
for (i = 0; i < v.arrayLength; i++) {
floatAr[i] = v.v.floatArray[i];
}
NXDputalias(self->fileHandle, self->dictHandle, alias, floatAr+offset);
free(floatAr);
break;
default:
SCPrintf(pCon,eLogError,"ERROR: offsets can only be used with array data types");
return;
}
ReleaseHdbValue(&v);
}
/*----------------------------------------------------------------------*/
static void putHdbSlab(SConnection * pCon, SicsInterp * pSics,
pNXScript self, int argc, char *argv[])
@@ -1283,6 +1347,10 @@ static int handlePut(SConnection * pCon, SicsInterp * pSics,
/* ================ */
putHdb(pCon, pSics, self, argc, argv);
return 1;
} else if (strcmp(argv[1], "puthdboff") == 0) {
/* ================ */
putHdbOff(pCon, pSics, self, argc, argv);
return 1;
} else if (strcmp(argv[1], "puthdbslab") == 0) {
/* ================ */
putHdbSlab(pCon, pSics, self, argc, argv);
@@ -1313,7 +1381,7 @@ static int handlePut(SConnection * pCon, SicsInterp * pSics,
/*===============*/
putSlab(pCon, pSics, self, argc, argv);
} else {
SCWrite(pCon, "ERROR: put command not recognised", eLogError);
SCPrintf(pCon, eLogError, "ERROR: put command %s not recognised", argv[1] );
}
return 1;
}