Fixed a bug in sicshipadaba which would not cause bin transfer mode properly honoured on hget

Added a total feature to histmemsec
This commit is contained in:
2014-06-03 12:01:52 +02:00
parent dc3a3c39c0
commit f1e3ae7c0b
2 changed files with 21 additions and 3 deletions

View File

@ -262,6 +262,22 @@ static int SumCmd(pSICSOBJ ccmd, SConnection * pCon,
} }
return 1; return 1;
} }
/*-------------------------------------------------------------------------*/
static int TotalCmd(pSICSOBJ ccmd, SConnection * pCon,
Hdb * cmdNode, Hdb * par[], int nPar)
{
pHdb dataNode = NULL;
long lSum = 0;
int i;
dataNode = GetHipadabaNode(ccmd->objectNode,"data");
assert(dataNode != NULL);
for(i = 0, lSum = 0; i < dataNode->value.arrayLength; i++){
lSum += dataNode->value.v.intArray[i];
}
SCPrintf(pCon,eValue,"%s.total = %ld", ccmd->objectNode->name, lSum);
return 1;
}
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
static int InitCmd(pSICSOBJ ccmd, SConnection * con, static int InitCmd(pSICSOBJ ccmd, SConnection * con,
Hdb * cmdNode, Hdb * par[], int nPar) Hdb * cmdNode, Hdb * par[], int nPar)
@ -382,6 +398,8 @@ int MakeSecHM(SConnection * pCon, SicsInterp * pSics, void *pData,
AddSICSHdbPar(child, "ystart", usSpy, MakeHdbInt(0)); AddSICSHdbPar(child, "ystart", usSpy, MakeHdbInt(0));
AddSICSHdbPar(child, "yend", usSpy, MakeHdbInt(0)); AddSICSHdbPar(child, "yend", usSpy, MakeHdbInt(0));
child = AddSICSHdbPar(node,"total", usSpy, MakeSICSFunc(TotalCmd));
/* /*
* test TOF option * test TOF option
*/ */

View File

@ -693,7 +693,7 @@ static hdbCallbackReturn SICSNotifyCallback(pHdb node, void *userData,
SCPureSockWrite(cbInfo->pCon, GetCharArray(result), outCode); SCPureSockWrite(cbInfo->pCon, GetCharArray(result), outCode);
DeleteDynString(printedData); DeleteDynString(printedData);
} else { } else {
formatNameValue(protocol, pPath, "!!datachange!!", result, HIPTEXT); formatNameValue(protocol, updatePath, "!!datachange!!", result, HIPTEXT);
SCWrite(cbInfo->pCon, GetCharArray(result), outCode); SCWrite(cbInfo->pCon, GetCharArray(result), outCode);
} }
DeleteDynString(result); DeleteDynString(result);
@ -2708,10 +2708,10 @@ static int GetHdbNode(SConnection * pCon, SicsInterp * pSics, void *pData,
return 0; return 0;
} }
/* /*
* if transfer = zip, redirect to zip * if transfer = zip or bin, redirect to zip
*/ */
if (GetHdbProperty(targetNode, "transfer", value, 80) == 1) { if (GetHdbProperty(targetNode, "transfer", value, 80) == 1) {
if (strstr(value, "zip") != NULL) { if (strstr(value, "zip") != NULL || strstr(value,"bin") != NULL) {
return ZipGetHdbNode(pCon, pSics, pData, argc, argv); return ZipGetHdbNode(pCon, pSics, pData, argc, argv);
} }
} }