From 0915491925ce4d8d33551b5bb059e583a30f6c4c Mon Sep 17 00:00:00 2001 From: koennecke Date: Mon, 9 Jun 2008 08:57:53 +0000 Subject: [PATCH] - Scriptcontext debugged to be working - Added a drivable adapter to scriptcontext nodes - Added subsampling to simulated histograms (and as a general option) in order to support Gumtree testing. --- HistDriv.i | 8 +- HistMem.h | 16 +- HistMem.i | 6 +- SCinter.c | 4 + ascon.c | 33 +- ascon.i | 9 +- devser.c | 15 +- errormsg.c | 98 ++++-- errormsg.h | 3 +- fomerge.c | 255 ++++++++++++++++ histmem.c | 4 +- histogram.tex | 28 +- histogram.w | 2 + histsim.c | 16 + hmdata.c | 153 ++++++++++ hmdata.h | 2 + make_gen | 3 +- nxdataset.c | 135 +++++++++ nxdataset.h | 3 + polldriv.c | 61 +++- polldriv.h | 2 + scriptcontext.c | 201 +++++++++++- sctdriveadapter.c | 266 ++++++++++++++++ sicsdata.c | 3 +- sicshdbadapter.c | 51 ++++ sicshdbadapter.h | 2 + sicshdbfactory.c | 4 +- sicshipadaba.c | 35 ++- sicsobj.c | 6 +- sicspoll.c | 2 +- status.c | 2 +- stringdict.c | 2 +- val.lis | 755 +++++++++++++++++++++++++++++++++++++--------- 33 files changed, 1938 insertions(+), 247 deletions(-) create mode 100644 sctdriveadapter.c diff --git a/HistDriv.i b/HistDriv.i index 1e033d86..b9fad721 100644 --- a/HistDriv.i +++ b/HistDriv.i @@ -1,5 +1,5 @@ -#line 465 "histogram.w" +#line 467 "histogram.w" /*--------------------------------------------------------------------------- H I S T D R I V @@ -72,7 +72,7 @@ void *pPriv; } HistDriver; -#line 477 "histogram.w" +#line 479 "histogram.w" #line 232 "histogram.w" @@ -81,8 +81,10 @@ void DeleteHistDriver(pHistDriver self); int HistDriverConfig(pHistDriver self, pStringDict pOpt, SConnection *pCon); + HistInt *DefaultSubSample(pHistDriver self, SConnection *pCon, + int bank, char *command); -#line 478 "histogram.w" +#line 480 "histogram.w" #endif diff --git a/HistMem.h b/HistMem.h index b0872505..6ffc568b 100644 --- a/HistMem.h +++ b/HistMem.h @@ -1,5 +1,5 @@ -#line 438 "histogram.w" +#line 440 "histogram.w" /*-------------------------------------------------------------------------- H I S T M E M @@ -42,22 +42,22 @@ eReflect } OverFlowMode; -#line 458 "histogram.w" +#line 460 "histogram.w" /*--------------------------------------------------------------------------*/ -#line 290 "histogram.w" +#line 292 "histogram.w" pHistMem CreateHistMemory(char *drivername); void DeleteHistMemory(void *self); -#line 306 "histogram.w" +#line 308 "histogram.w" int HistGetOption(pHistMem self, char *name, char *result, int iResultLen); int HistSetOption(pHistMem self, char *name, char *value); int HistConfigure(pHistMem self, SConnection *pCon, SicsInterp *pSics); -#line 334 "histogram.w" +#line 336 "histogram.w" float GetHistPreset(pHistMem self); int SetHistPreset(pHistMem self, float fVal); @@ -73,7 +73,7 @@ void HistDirty(pHistMem self); -#line 364 "histogram.w" +#line 366 "histogram.w" int SetHistogram(pHistMem self, SConnection *pCon, int i,int iStart, int iEnd, HistInt *lData); @@ -85,7 +85,7 @@ HistInt *lData, int iDataLen); int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal); -#line 407 "histogram.w" +#line 409 "histogram.w" int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]); @@ -94,7 +94,7 @@ int argc, char *argv[]); -#line 460 "histogram.w" +#line 462 "histogram.w" #endif diff --git a/HistMem.i b/HistMem.i index 8ff674ed..5c6b98d0 100644 --- a/HistMem.i +++ b/HistMem.i @@ -1,5 +1,5 @@ -#line 483 "histogram.w" +#line 485 "histogram.w" /*--------------------------------------------------------------------------- H I S T M E M -- Internal @@ -11,7 +11,7 @@ #ifndef SICSHISTMEMINT #define SICSHISTMEMINT -#line 254 "histogram.w" +#line 256 "histogram.w" typedef struct __HistMem { pObjectDescriptor pDes; @@ -23,7 +23,7 @@ pICallBack pCall; } HistMem; -#line 493 "histogram.w" +#line 495 "histogram.w" #endif diff --git a/SCinter.c b/SCinter.c index 38880894..07f770fb 100644 --- a/SCinter.c +++ b/SCinter.c @@ -478,6 +478,10 @@ extern char *SkipSpace(char *pPtr); pCurrent = tail; while(pCurrent) { + /* the line below fixes problems with kill functions + * traversing the command list + */ + pCurrent->pNext = NULL; if(pCurrent->KFunc) { pCurrent->KFunc(pCurrent->pData); diff --git a/ascon.c b/ascon.c index a60b3fcd..57aa1c3d 100644 --- a/ascon.c +++ b/ascon.c @@ -75,9 +75,9 @@ static void AsconError(Ascon *a, char *msg, int errorno) { state = stateText[a->state]; } if (errorno != 0) { - ErrPutMsg(a->errList, "%s %s (during %s)", msg, strerror(errorno), state); + a->errList = ErrPutMsg(a->errList, &a->curError, "ASCERR: %s %s (during %s)", msg, strerror(errorno), state); } else { - ErrPutMsg(a->errList, "%s (during %s)", msg, state); + a->errList = ErrPutMsg(a->errList, &a->curError, "ASCERR: %s (during %s)", msg, state); } a->state |= AsconFailed; } @@ -126,12 +126,21 @@ static void AsconConnect(Ascon *a) { return; } -void AsconStdInit(Ascon *a, char *hostport) { +void AsconStdInit(Ascon *a, int argc, char *argv[]) { a->fd = -1; a->state = AsconConnectStart; - a->timeout = 2.0; /* sec */ a->reconnectInterval = 10; - a->hostport = strdup(hostport); + a->hostport = strdup(argv[1]); + if(argc < 2){ + a->sendTerminator = strdup(argv[2]); + } else { + a->sendTerminator = strdup("\n"); + } + if(argc > 3){ + a->timeout = atof(argv[3]); + } else { + a->timeout = 2.0; /* sec */ + } } int AsconReadGarbage(int fd) { @@ -276,7 +285,7 @@ int AsconStdHandler(Ascon *a) { } break; case AsconWriteStart: - DynStringConcatChar(a->wrBuffer, '\r'); + DynStringConcat(a->wrBuffer, a->sendTerminator); a->wrPos = 0; a->state = AsconWriting; break; @@ -337,6 +346,7 @@ int AsconStdHandler(Ascon *a) { if (a->timeout > 0) { if (DoubleTime() - a->start > a->timeout) { AsconError(a, "read timeout", 0); + a->state = AsconTimeout; } } } @@ -363,7 +373,7 @@ AsconHandler AsconSetHandler(Ascon *a, int argc, char *argv[]) { if (argc < 1) return NULL; if (strcasecmp(argv[0], "std") == 0) { if (argc != 2) return NULL; - AsconStdInit(a, argv[1]); + AsconStdInit(a, argc, argv); return AsconStdHandler; } for (p = protocols.head; p!= NULL; p=p->next) { @@ -402,7 +412,6 @@ Ascon *AsconMake(SConnection *con, int argc, char *argv[]) { a->wrBuffer = CreateDynString(60, 63); a->errList = NULL; a->responseValid = 0; - a->timeout = 2.0; a->reconnectInterval = 10; a->lastReconnect = 0; return a; @@ -419,6 +428,9 @@ void AsconKill(Ascon *a) { if (a->hostport) { free(a->hostport); } + if(a->sendTerminator){ + free(a->sendTerminator); + } free(a); } @@ -454,13 +466,12 @@ AsconStatus AsconTask(Ascon *a) { case AsconStart: return AsconPending; case AsconFailed: - if (a->state <= AsconConnectFailed) { + if (a->state != AsconTimeout) { now = DoubleTime(); if (now > a->lastReconnect + a->reconnectInterval) { a->lastReconnect = now; a->state = AsconConnectStart; } - return AsconUnconnected; } return AsconFailure; case AsconFinished: @@ -501,5 +512,5 @@ char *AsconRead(Ascon *a) { } ErrMsg *AsconGetErrList(Ascon *a) { - return a->errList; + return a->curError; } diff --git a/ascon.i b/ascon.i index 0d0f6f38..a86a792b 100644 --- a/ascon.i +++ b/ascon.i @@ -9,7 +9,7 @@ * \brief Asynchronous connection handling for devices controlled over tcp-ip * connections. Interface for the implementation of custom protocols. * - * For the implmentation of a custom protocol, hou have to implement + * For the implementation of a custom protocol, you have to implement * the handler function and the init function, declare the protocol * of type AsconProtocol and call AsconInsertProtocol on startup. * The handler and init functions are normally be a wrapper around AsconStdHandler @@ -43,7 +43,8 @@ typedef enum { AsconReading=12+AsconOnTheWay, AsconReadStart=AsconReading+AsconStart, AsconReadDone=AsconReading+AsconFinished, - AsconIdle=16+AsconFinished + AsconIdle=16+AsconFinished, + AsconTimeout=20 + AsconFailed } AsconState; /** \brief the task handler function prototype @@ -63,8 +64,10 @@ struct Ascon { pDynString wrBuffer;/**< write buffer */ int wrPos; /**< write buffer position */ double timeout; /**< read timeout (sec) */ + char *sendTerminator; /**< terminator for sending messages */ char *hostport; /**< host:port to connect */ ErrMsg *errList; /**< error message list */ + ErrMsg *curError; /**< the currently active error */ double start; /**< unix time when read was started */ void *private; /**< private data of protocol */ int noResponse; /**< no response expected */ @@ -93,7 +96,7 @@ int AsconStdHandler(Ascon *a); * * In most cases a custom init function may be a wrapper around AsconStdInit */ -void AsconStdInit(Ascon *a, char *hostport); +void AsconStdInit(Ascon *a, int argc, char *argv[]); /** The Ascon Protocol */ diff --git a/devser.c b/devser.c index f0d30a92..7e21b2b2 100644 --- a/devser.c +++ b/devser.c @@ -60,7 +60,9 @@ static void DevFreeActionList(DevAction *actions) { } static void DevKillTask(void *devser) { - free(devser); + if(devser != NULL){ + DevKill(devser); + } } DevAction *DevNextAction(DevSer *devser) { @@ -119,14 +121,17 @@ int DevQueueTask(void *ds) { status = AsconTask(devser->asyncConn); if (status == AsconFailure) { devser->errmsg = AsconGetErrList(devser->asyncConn); - return 1; } else if (status != AsconReady) { return 1; } if (devser->steps > 0) { /* debugging mode */ devser->steps--; } - replyData = AsconRead(devser->asyncConn); + if(status == AsconFailure){ + replyData = devser->errmsg->text; + } else { + replyData = AsconRead(devser->asyncConn); + } sendData = action->hdl(action->data, replyData); if (sendData != NULL) { AsconWrite(devser->asyncConn, sendData, 0); @@ -144,8 +149,8 @@ int DevQueueTask(void *ds) { } DevSer *DevMake(SConnection *con, int argc, char *argv[]) { - DevSer *devser; - Ascon *asyncConn; + DevSer *devser = NULL; + Ascon *asyncConn = NULL; asyncConn = AsconMake(con, argc, argv); if (!asyncConn) { diff --git a/errormsg.c b/errormsg.c index 9ed2222e..88f9d36d 100644 --- a/errormsg.c +++ b/errormsg.c @@ -18,51 +18,91 @@ int ErrEqual(char *str1, char *str2) { if (str1 == NULL || str2 == NULL) { return str1 == str2; } + str1++; + str2++; + } else { + str1++; + str2++; } - str1++; - str2++; } return 1; } -ErrMsg *ErrPutMsg(ErrMsg *dump, char *fmt, ...) { - ErrMsg *m; - ErrMsg **last; - va_list ap; - char buf[256]; - char *text; - int l; - - va_start(ap, fmt); - l = vsnprintf(buf, sizeof buf, fmt, ap); - va_end(ap); - if (l < sizeof buf) { - text = buf; - } else { - /* assuming we have a C99 conforming snprintf and need a larger buffer */ - text = calloc(l, 1); - va_start(ap, fmt); - vsnprintf(text, l, fmt, ap); - va_end(ap); - } - last = &dump; - for (m = dump; m != NULL; m = m->next) { +ErrMsg *ErrFind(ErrMsg *dump, char *message){ + ErrMsg *cur = dump; + while(cur != NULL){ + if(ErrEqual(message,cur->text)){ + break; + } + cur = cur->next; + } + return cur; +} + +ErrMsg *ErrPutMsg(ErrMsg *dump, ErrMsg **current, char *fmt, ...){ + ErrMsg *m = NULL; + va_list ap; + char buf[1024]; + + /* format message */ + va_start(ap, fmt); + memset(buf,0,1024*sizeof(char)); + vsnprintf(buf, sizeof buf, fmt, ap); + va_end(ap); + + m = ErrFind(dump, buf); + if(m == NULL){ + m = calloc(1, sizeof(*m)); + m->text = strdup(buf); + m->cnt = 1; + m->next = dump; + *current = m; + return m; + } else { + *current = m; + return dump; + } +} + +ErrMsg *ErrOldPutMsg(ErrMsg *dump, char *fmt, ...) { + ErrMsg *m = NULL; + ErrMsg **last = NULL; + va_list ap; + char buf[256]; + char *text = NULL; + int l; + + va_start(ap, fmt); + l = vsnprintf(buf, sizeof buf, fmt, ap); + va_end(ap); + if (l < sizeof buf) { + text = buf; + } else { + /* assuming we have a C99 conforming snprintf and need a larger buffer */ + text = calloc(l, 1); + va_start(ap, fmt); + vsnprintf(text, l, fmt, ap); + va_end(ap); + } + for (last = &dump; *last != NULL; last = &m->next) { + m = *last; if (ErrEqual(text, m->text)) { - *last = m->next; /* remove found item from the list */ + *last = m->next; break; } - last = &m->next; } - if (m == NULL) { /* make a fresh list item m */ + if (m == NULL) { if (text == buf) text = strdup(buf); m = calloc(1, sizeof(*m)); m->text = text; m->cnt = 1; - } else { /* take the found item m */ + } else { if (text != buf) free(text); m->cnt++; } - m->next = dump; /* add the new item to the head of the list */ + if(m != dump){ + m->next = dump; + } time(&m->last); return m; } diff --git a/errormsg.h b/errormsg.h index 9e66c847..64868647 100644 --- a/errormsg.h +++ b/errormsg.h @@ -24,9 +24,10 @@ typedef struct ErrMsg { * The newset message is always at the head of the list. * * \param dump the error message list + * \param current The currently active error message * \param fmt the format for the message * \return the new error message list head */ -ErrMsg *ErrPutMsg(ErrMsg *dump, char *fmt, ...); +ErrMsg *ErrPutMsg(ErrMsg *dump, ErrMsg **current, char *fmt, ...); #endif diff --git a/fomerge.c b/fomerge.c index eaedb483..df88dc38 100644 --- a/fomerge.c +++ b/fomerge.c @@ -17,6 +17,8 @@ Mark Koennecke, March 2000 extended to support nxscripted file writing: Mark Koennecke, May 2004 + + extended to support GTSE, Mark Koennecke, May 2008 --------------------------------------------------------------------------*/ #include #include @@ -27,6 +29,7 @@ #include "fortify.h" #include "scan.h" #include "fitcenter.h" +#include "sicsdata.h" static pFit fitter = NULL; @@ -594,6 +597,98 @@ static int putSum(SicsInterp *pSics, SConnection *pCon, return status; } /*---------------------------------------------------------------------*/ +static int TOFLambda(SicsInterp *pSics, SConnection *pCon, + int argc, char *argv[]){ + int status, iTime, iDet, i; + const float *fTimeBin = NULL; + int *sum = NULL; + long *lSum = NULL; + pHistMem pMem = NULL; + float fCenter, fFWHM, fStdDev, fVal; + float fMon, fData, distMonoDet, distFermiDet, tdiff, lambda; + + pMem = (pHistMem)FindCommandData(pSics,"hm1","HistMem"); + if(pMem == NULL) + { + SCWrite(pCon, + "ERROR: need lower detector bank for lambda calculation", + eError); + return 0; + } + + /** + * locate elastic position in data + */ + fTimeBin = GetHistTimeBin(pMem,&iTime); + iDet = getFMdim(LOWER); + sum = calculateTimeSum(GetHistogramPointer(pMem,pCon),iDet,iTime); + if(!sum) + { + SCWrite(pCon,"ERROR: out of memory calculating lambda", + eError); + return 0; + } + if(fitter == NULL) + { + fitter = CreateFitCenter(NULL); + if(!fitter) + { + SCWrite(pCon,"ERROR: cannot allocate fitting structure",eError); + return 0; + } + } + /* + copy sum to make compiler happy + */ + lSum = (long *)malloc(iTime*sizeof(long)); + if(lSum == NULL) + { + SCWrite(pCon,"ERROR: out of memory in TOFLambda",eError); + free(sum); + return 0; + } + for(i = 0; i < iTime; i++) + { + lSum[i] = sum[i]; + } + status = CalculateFitFromData(fitter,(float *)fTimeBin,lSum,iTime); + if(status < 0) + { + SCWrite(pCon,"ERROR: no peak in data",eError); + free(sum); + free(lSum); + return 0; + } + GetFitResults(fitter,&fCenter,&fStdDev,&fFWHM,&fVal); + fData = fCenter; + + /* + * locate elastic position in tofmon + */ + GetHistogram(pMem, pCon, 0, iTime*iDet, iTime*(iDet+1), + sum, iTime*sizeof(HistInt)); + for(i = 0; i < iTime; i++) + { + lSum[i] = sum[i]; + } + status = CalculateFitFromData(fitter,(float *)fTimeBin,lSum,iTime); + GetFitResults(fitter,&fCenter,&fStdDev,&fFWHM,&fVal); + fMon = fCenter; + free(sum); + free(lSum); + + /* + * calculate + */ + distFermiDet = 3000.; + distMonoDet = distFermiDet - 215.7; + tdiff = fData - fMon; + lambda = tdiff/(252.78*distMonoDet*.001); + SCPrintf(pCon,eValue, "toflambda = %f", lambda); + + return 1; +} +/*---------------------------------------------------------------------*/ static int putElastic(SicsInterp *pSics, SConnection *pCon, pNXScript pNexus, char *alias, float fElastic) { @@ -663,12 +758,157 @@ static int putElastic(SicsInterp *pSics, SConnection *pCon, return status; } +/*----------------------------------------------------------------------*/ +static int FMputTTH(SConnection *pCon, int argc, char *argv[]){ + pSICSData data = NULL; + int length = -1, i; + float *tthData = NULL; + + if(argc < 4){ + SCWrite(pCon,"ERROR: insufficient no of arguments to FMputTTH", + eError); + return 0; + } + + data = (pSICSData)FindCommandData(pServ->pSics,argv[3],"SICSData"); + if(data == NULL){ + SCWrite(pCon,"ERROR: SICSData object not found", eError); + return 0; + } + if(strcmp(argv[2],"upper") == 0) + { + length = getFMdim(UPPER); + tthData = getFMBankTheta(UPPER); + } + else if(strcmp(argv[2],"middle") == 0) + { + length = getFMdim(MIDDLE); + tthData = getFMBankTheta(MIDDLE); + } + else if(strcmp(argv[2],"lower") == 0) + { + length = getFMdim(LOWER); + tthData = getFMBankTheta(LOWER); + } + else if(strcmp(argv[2],"merged") == 0) + { + length = getFMdim(MERGED); + tthData = getFMBankTheta(MERGED); + } + else + { + SCWrite(pCon,"ERROR: requested two_theta for invalid detector bank", + eError); + return 0; + } + if(length < 0 || tthData == NULL){ + SCWrite(pCon,"ERROR: requested two_theta for invalid detector bank", + eError); + return 0; + } + clearSICSData(data); + for(i = 0; i < length; i++){ + setSICSDataFloat(data,i,tthData[i]); + } + SCSendOK(pCon); + return 1; +} +/*---------------------------------------------------------------------*/ +static int FMcopyMerged(SConnection *pCon, int argc, char *argv[]){ + pSICSData data = NULL; + int i, length; + HistInt *hmData = NULL; + + if(argc < 3){ + SCWrite(pCon,"ERROR: insufficient no of arguments to FMcopyMerged", + eError); + return 0; + } + + data = (pSICSData)FindCommandData(pServ->pSics,argv[2],"SICSData"); + if(data == NULL){ + SCWrite(pCon,"ERROR: SICSData object not found", eError); + return 0; + } + if(!updateHMFMData(pServ->pSics, pCon)){ + SCWrite(pCon,"ERROR: not enough HM's to merge or bad names in fomerge.c", + eError); + return 0; + } + + clearSICSData(data); + length = getFMdim(MERGED)*getFMdim(TIMEBIN); + hmData = getFMBankPointer(MERGED); + if(hmData == NULL){ + SCWrite(pCon,"ERROR: merged data not available", eError); + return 0; + } + for(i = 0; i < length; i++){ + setSICSDataInt(data,i,hmData[i]); + } + SCSendOK(pCon); + return 1; +} +/*---------------------------------------------------------------------*/ +static int FMcopyMergedSum(SConnection *pCon, int argc, char *argv[]){ + pSICSData data = NULL; + int i, length, tbin, j, row; + HistInt *hmData = NULL, *sumData = NULL; + + if(argc < 3){ + SCWrite(pCon,"ERROR: insufficient no of arguments to FMcopyMerged", + eError); + return 0; + } + + data = (pSICSData)FindCommandData(pServ->pSics,argv[2],"SICSData"); + if(data == NULL){ + SCWrite(pCon,"ERROR: SICSData object not found", eError); + return 0; + } + if(!updateHMFMData(pServ->pSics, pCon)){ + SCWrite(pCon,"ERROR: not enough HM's to merge or bad names in fomerge.c", + eError); + return 0; + } + + clearSICSData(data); + length = getFMdim(MERGED); + tbin = getFMdim(TIMEBIN); + hmData = getFMBankPointer(MERGED); + if(hmData == NULL){ + SCWrite(pCon,"ERROR: merged data not available", eError); + return 0; + } + sumData = malloc(tbin*sizeof(int)); + if(sumData == NULL){ + SCWrite(pCon,"ERROR: out-of-memory in FMcopyMergedSum", eError); + return 0; + } + memset(sumData,0,tbin*sizeof(int)); + for(j = 0; j < length; j++){ + row = j*tbin; + for(i = 0; i < tbin; i++){ + sumData[i] += hmData[row+i]; + } + } + for(i = 0; i < tbin; i++){ + setSICSDataInt(data,i,sumData[i]); + } + free(sumData); + SCSendOK(pCon); + return 1; +} /*----------------------------------------------------------------------- Usage: focusmerge puttwotheta nxscriptmod bankname alias + focusmerge puttth bankname sicsdataname + focusmerge copymerged sicsdataname + focusmerge copymergedsum sicsdataname focusmerge putmerged nxscriptmod alias focusmerge putsum nxscriptmod bankname alias focusmerge putelastic nxscriptmod alias theoelastic + focusmerge toflambda nxscriptmod = name of the nxscript module used for writing, must be open alias = The alias under which to write the data item @@ -690,6 +930,21 @@ int FocusMergeAction(SConnection *pCon, SicsInterp *pSics, void *pData, } strtolower(argv[1]); + + if(strcmp(argv[1],"puttth") == 0){ + return FMputTTH(pCon,argc,argv); + } + + if(strcmp(argv[1],"copymerged") == 0){ + return FMcopyMerged(pCon,argc,argv); + } + if(strcmp(argv[1],"copymergedsum") == 0){ + return FMcopyMergedSum(pCon,argc,argv); + } + if(strcmp(argv[1],"toflambda") == 0){ + return TOFLambda(pSics, pCon,argc,argv); + } + if(strcmp(argv[1],"puttwotheta") == 0) { if(argc < 4) diff --git a/histmem.c b/histmem.c index 1b2575ef..ebf09b14 100644 --- a/histmem.c +++ b/histmem.c @@ -834,7 +834,7 @@ void HistDirty(pHistMem self) return 0; } - if(iEnd > iDataLen/sizeof(HistInt)) + if( (iEnd -iStart) > iDataLen/sizeof(HistInt)) { SCWrite(pCon,"WARNING: truncating request to fit data space",eWarning); iEnd = (iDataLen/sizeof(HistInt)) - 1; @@ -1138,7 +1138,7 @@ static int checkHMEnd(pHistMem self, char *text){ return 0; } memset(pBuf,0,iRet+60); - HistGetOption(self,argv[2],pBuf,iRet); + HistGetOption(self,argv[2],pBuf,iRet+60); sprintf(pBueffel,"%s.%s = %s",argv[0],argv[2],pBuf); SCWrite(pCon,pBueffel,eValue); free(pBuf); diff --git a/histogram.tex b/histogram.tex index ce8e30ab..564af499 100644 --- a/histogram.tex +++ b/histogram.tex @@ -21,7 +21,7 @@ $\langle$Modes {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ ePSD,@\\ \mbox{}\verb@ eSANSTOF@\\ \mbox{}\verb@ } HistMode;@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -59,7 +59,7 @@ $\langle$Modes {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ eOCount,@\\ \mbox{}\verb@ eReflect@\\ \mbox{}\verb@ } OverFlowMode;@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -176,7 +176,7 @@ $\langle$HistType {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int (*FreePrivate)(pHistDriver self);@\\ \mbox{}\verb@ void *pPriv;@\\ \mbox{}\verb@ } HistDriver;@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -279,7 +279,9 @@ $\langle$HistDrivProt {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ void DeleteHistDriver(pHistDriver self);@\\ \mbox{}\verb@ int HistDriverConfig(pHistDriver self, pStringDict pOpt,@\\ \mbox{}\verb@ SConnection *pCon);@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@ HistInt *DefaultSubSample(pHistDriver self, SConnection *pCon, @\\ +\mbox{}\verb@ int bank, char *command); @\\ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -318,7 +320,7 @@ $\langle$HistST {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ pICountable pCountInt;@\\ \mbox{}\verb@ pICallBack pCall;@\\ \mbox{}\verb@ } HistMem;@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -360,7 +362,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@@\\ \mbox{}\verb@ pHistMem CreateHistMemory(char *drivername);@\\ \mbox{}\verb@ void DeleteHistMemory(void *self);@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -390,7 +392,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int HistGetOption(pHistMem self, char *name, char *result, int iResultLen);@\\ \mbox{}\verb@ int HistSetOption(pHistMem self, char *name, char *value);@\\ \mbox{}\verb@ int HistConfigure(pHistMem self, SConnection *pCon, SicsInterp *pSics);@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -441,7 +443,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int HistBlockCount(pHistMem self, SConnection *pCon);@\\ \mbox{}\verb@ void HistDirty(pHistMem self); @\\ \mbox{}\verb@@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -481,7 +483,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int i, int iStart, int iEnd, @\\ \mbox{}\verb@ HistInt *lData, int iDataLen);@\\ \mbox{}\verb@ int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -535,7 +537,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int HistAction(SConnection *pCon, SicsInterp *pSics, void *pData,@\\ \mbox{}\verb@ int argc, char *argv[]);@\\ \mbox{}\verb@ @\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-1ex} \footnotesize\addtolength{\baselineskip}{-1ex} @@ -597,7 +599,7 @@ following. \mbox{}\verb@@$\langle$Protos {\footnotesize ?, \ldots\ }$\rangle$\verb@@\\ \mbox{}\verb@@\\ \mbox{}\verb@#endif@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-2ex} \end{minipage}\\[4ex] @@ -623,7 +625,7 @@ following. \mbox{}\verb@@$\langle$HistDrivProt {\footnotesize ?}$\rangle$\verb@@\\ \mbox{}\verb@@\\ \mbox{}\verb@#endif@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-2ex} \end{minipage}\\[4ex] @@ -646,7 +648,7 @@ following. \mbox{}\verb@@$\langle$HistST {\footnotesize ?}$\rangle$\verb@@\\ \mbox{}\verb@@\\ \mbox{}\verb@#endif@\\ -\mbox{}\verb@@$\diamond$ +\mbox{}\verb@@$\Diamond$ \end{list} \vspace{-2ex} \end{minipage}\\[4ex] diff --git a/histogram.w b/histogram.w index d59edabf..a5bed0e9 100644 --- a/histogram.w +++ b/histogram.w @@ -234,6 +234,8 @@ only these few functions operate on histogram memory drivers in general: void DeleteHistDriver(pHistDriver self); int HistDriverConfig(pHistDriver self, pStringDict pOpt, SConnection *pCon); + HistInt *DefaultSubSample(pHistDriver self, SConnection *pCon, + int bank, char *command); @} CreateHistDriver creates a new HistDriver data structure and returns it. Or diff --git a/histsim.c b/histsim.c index 11e6b5bc..98eab3df 100644 --- a/histsim.c +++ b/histsim.c @@ -250,6 +250,21 @@ return pDriv->fTime; } +/*-------------------------------------------------------------------------*/ +HistInt *DefaultSubSample(pHistDriver self, SConnection *pCon, + int bank, char *command){ + HistInt *data = NULL; + char error[132]; + + assert(bank == 0); /* no bank handling yet.. */ + + memset(error,0,132*sizeof(char)); + data = subSample(self->data, command, error, 132); + if(data == NULL){ + SCWrite(pCon,error,eError); + } + return data; +} /*-------------------------------------------------------------------------*/ pHistDriver CreateSIMHM(pStringDict pOpt) { @@ -286,6 +301,7 @@ pNew->FreePrivate = SimFreePrivate; pNew->Pause = SimPause; pNew->Continue = SimContinue; + pNew->SubSample = DefaultSubSample; StringDictAddPair(pOpt,"failrate","-1"); return pNew; diff --git a/hmdata.c b/hmdata.c index bd514289..627fae56 100644 --- a/hmdata.c +++ b/hmdata.c @@ -16,10 +16,12 @@ #include "splitter.h" #include "fortify.h" #include "hmdata.h" +#include #include "HistMem.h" #include "HistMem.i" #include "HistDriv.i" #include "countdriv.h" +#include "stptok.h" /*----------------------------------------------------------------------*/ pHMdata makeHMData(void) { pHMdata self = NULL; @@ -484,4 +486,155 @@ int loadHMData(pHMdata self, SConnection *pCon, char *filename){ fclose(fd); return 1; } +/*========================================================================== + * subsampling was stolen from the SinqHTTP histogram memory code and + * thus contains some additional indirections. + * =========================================================================*/ +static pNXDS hmDataToNXDataset(pHMdata self){ + pNXDS result = NULL; + int i; + + result = malloc(sizeof(NXDS)); + if(result == NULL){ + return NULL; + } + memset(result,0,sizeof(NXDS)); + result->magic = MAGIC; + result->type = NX_INT32; + result->rank = self->rank; + if(isInTOFMode(self)){ + result->rank++; + } + result->dim = malloc(self->rank*sizeof(int)); + if(result->dim == NULL){ + free(result); + return NULL; + } + for(i = 0; i < self->rank; i++){ + result->dim[i] = self->iDim[i]; + } + if(isInTOFMode(self)){ + result->dim[result->rank-1] = getNoOfTimebins(self); + } + if(self->localBuffer == NULL){ + resizeBuffer(self); + } + result->u.iPtr = self->localBuffer; + return result; +} +/*---------------------------------------------------------------------------*/ +static pNXDS subSampleCommand(pNXDS source, char *command, + char *error, int errLen){ + int startDim[NX_MAXRANK], endDim[NX_MAXRANK]; + int dim = 0, start = 0, i; + char *pPtr = NULL, token[80]; + + pPtr = stptok(command,token,79,":\0"); + while((pPtr = stptok(pPtr,token,79,":\0")) != NULL){ + if(start == 0){ + startDim[dim] = atoi(token); + start = 1; + } else { + endDim[dim] = atoi(token); + start = 0; + dim++; + } + } + + if(dim < source->rank - 1){ + strncpy(error,"ERROR: Not enough border values specified for subsampling",errLen); + return NULL; + } + for(i = 0; i < source->rank; i++){ + if(startDim[i] < 0 || startDim[i] >= source->dim[i]){ + snprintf(error,errLen,"ERROR: invalid start value %d for dimension %d", startDim[1], i); + return NULL; + } + if(endDim[i] < startDim[i] || endDim[i] >= source->dim[i]){ + snprintf(error,errLen,"ERROR: invalid end value %d for dimension %d", endDim[1], i); + return NULL; + } + } + + return cutNXDataset(source,startDim,endDim); +} +/*-----------------------------------------------------------------------------*/ +static pNXDS sumCommand(pNXDS source, char *command, char *error, int errlen){ + int dimNo = -1, start = -1, end = -1; + char *pPtr = NULL; + char token[80]; + + pPtr = stptok(command,token,79,":\0"); + pPtr = stptok(pPtr,token,79,":\0"); + if(pPtr != NULL){ + dimNo = atoi(token); + } + pPtr = stptok(pPtr,token,79,":\0"); + if(pPtr != NULL){ + start = atoi(token); + } + pPtr = stptok(pPtr,token,79,":\0"); + if(pPtr != NULL){ + end = atoi(token); + } + if(dimNo < 0 || dimNo > source->rank - 1){ + snprintf(error,errlen,"ERROR: invalid dimension %d requestd to sum", dimNo); + return NULL; + } + if(end < 0 || end > source->dim[dimNo] || start < 0 || start > end){ + snprintf(error,errlen,"ERROR: invalid summing limits %d to %d requested", start,end); + return NULL; + } + + return sumNXDataset(source,dimNo, start, end); + } +/*--------------------------------------------------------------------------*/ +HistInt *subSample(pHMdata self, char *command, + char *error, int errLen){ + pNXDS source = NULL, start = NULL; + pNXDS result = NULL; + char *pPtr = NULL; + char subCommand[132]; + HistInt *data = NULL; + int length; + + + start = hmDataToNXDataset(self); + if(start == NULL){ + strncpy(error,"Out-Of-Memory or no data while subsampling ", + errLen); + return NULL; + } + + source = start; + pPtr = command; + while((pPtr = stptok(pPtr,subCommand,131,";\0\r\n")) != NULL){ + if(strstr(subCommand,"sample") != NULL){ + result = subSampleCommand(source,subCommand,error, errLen); + } else if(strstr(subCommand,"sum") != NULL){ + result = sumCommand(source,subCommand,error, errLen); + } else { + strncpy(error,"ERROR: invalid subcommand to process requested",errLen); + return NULL; + } + if(result == NULL){ + return NULL; + } + if(source != start){ + dropNXDataset(source); + } + source = result; + } + length = getNXDatasetLength(result); + data = malloc((length+1)*sizeof(int)); + if(data == NULL){ + strncpy(error,"Out-Of-Mmeory in Subsample", errLen); + dropNXDataset(result); + return NULL; + } + data[0] = length; + memcpy(data+1,result->u.iPtr, length*sizeof(int)); + dropNXDataset(result); + return data; +} diff --git a/hmdata.h b/hmdata.h index 2352b407..ebacd051 100644 --- a/hmdata.h +++ b/hmdata.h @@ -60,6 +60,8 @@ int start[MAXDIM], int end[MAXDIM]); int loadHMData(pHMdata self, SConnection *pCon, char *filename); + HistInt *subSample(pHMdata self, char *command, + char *error, int errLen); #endif diff --git a/make_gen b/make_gen index 4417649d..b34b8ad6 100644 --- a/make_gen +++ b/make_gen @@ -36,7 +36,8 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ moregress.o multicounter.o regresscter.o histregress.o \ sicshdbadapter.o polldriv.o sicspoll.o statemon.o hmslave.o \ nwatch.o asyncqueue.o asyncprotocol.o sicsobj.o \ - nxcopy.o nxinterhelper.o nxinter_wrap.o genericcontroller.o nxstack.o + nxcopy.o nxinterhelper.o nxinter_wrap.o genericcontroller.o nxstack.o \ + sctdriveadapter.o MOTOROBJ = motor.o simdriv.o COUNTEROBJ = countdriv.o simcter.o counter.o diff --git a/nxdataset.c b/nxdataset.c index 90e47fe3..6d419196 100644 --- a/nxdataset.c +++ b/nxdataset.c @@ -7,6 +7,7 @@ Mark Koennecke, October 2002 */ #include +#include #include #include "nxdataset.h" @@ -306,6 +307,140 @@ int putNXDatasetValueAt(pNXDS dataset, int address, double value){ } return 1; } +/*---------------------------------------------------------------------- + This is working recursively through the dimensions. When at the last: + actual copying takes place. + -----------------------------------------------------------------------*/ +static void copyCutData(pNXDS source, pNXDS target, int sourceDim[], + int targetDim[], int start[], int end[], + int dim){ + int i, length; + double val; + targetDim[dim] = 0; + length = end[dim] - start[dim]; + if(dim == source->rank -1){ + for(i = 0; i < length; i++){ + sourceDim[dim] = start[dim] + i; + val = getNXDatasetValue(source,sourceDim); + targetDim[dim] = i; + putNXDatasetValue(target, targetDim, val); + } + } else { + for(i = 0; i < length; i++){ + sourceDim[dim] = start[dim] + i; + targetDim[dim] = i; + copyCutData(source,target, sourceDim, targetDim, start, end, dim+1); + } + } +} +/*-----------------------------------------------------------------------*/ +pNXDS cutNXDataset(pNXDS source, int start[], int end[]){ + pNXDS result = NULL; + int newDim[NX_MAXRANK], i; + int sourceDim[NX_MAXRANK], targetDim[NX_MAXRANK]; + for(i = 0; i < source->rank; i++){ + if(start[i] < 0 || end[i] > source->dim[i]){ + fprintf(stderr,"ERROR: invalid boundaries specified for cutting"); + return NULL; + } + newDim[i] = end[i] - start[i]; + if(newDim[i] <= 0){ + fprintf(stderr,"ERROR: invalid cut limits specified for cutting dataset"); + return NULL; + } + } + result = createNXDataset(source->rank, source->type, newDim); + if(result == NULL){ + fprintf(stderr,"ERROR: out of memory creating result dataset"); + return NULL; + } + + copyCutData(source, result, sourceDim, targetDim, start, end, 0); + return result; +} +/*---------------------------------------------------------------------- + This recurses through all dimesnions, thereby skipping the summed one. + At the end of the rescusion the actual summing is performed. + ----------------------------------------------------------------------*/ +static void sumData(pNXDS source, pNXDS target, int sourceDim[], + int targetDim[], int targetDimCount, int dimNo, + int start, int end, int currentDim){ + int i, length; + double val, sumVal; + + /* + when we have recursed through all dimensions + we actually do the sums... + */ + if(currentDim == source->rank){ + length = end - start; + sumVal = getNXDatasetValue(target, targetDim); + for(i = 0; i < length; i++){ + sourceDim[dimNo] = start + i; + val = getNXDatasetValue(source,sourceDim); + sumVal += val; + } + putNXDatasetValue(target, targetDim, sumVal); + } else { + /* + jump over the summed dimension while recursing + through the dimensions + */ + if(currentDim == dimNo){ + sumData(source,target,sourceDim, + targetDim,targetDimCount, + dimNo,start,end,currentDim+1); + } else { + /* + loop over all values of the non summed dimension + */ + for(i = 0; i < source->dim[currentDim]; i++){ + /* + the problem here is that we have to jump over the summed + dimension here. This why we have to maintain a separate + dimension count for the target array. Jumping is done + above. + */ + targetDim[targetDimCount] = i; + targetDimCount++; + + sourceDim[currentDim] = i; + sumData(source,target,sourceDim,targetDim,targetDimCount, + dimNo,start,end,currentDim+1); + targetDimCount--; + } + } + } +} +/*-----------------------------------------------------------------------*/ +pNXDS sumNXDataset(pNXDS source, int dimNo, int start, int end){ + int newDim[NX_MAXRANK], targetDim[NX_MAXRANK], sourceDim[NX_MAXRANK]; + pNXDS result = NULL; + int i, count; + + if(dimNo < 0 || dimNo > source->rank-1) { + fprintf(stderr,"ERROR: invalid dimension for summing requested"); + return NULL; + } + + /* + make result dataset with missing summed dimension + */ + for(i = 0, count = 0; i < source->rank; i++){ + if(i != dimNo){ + newDim[count] = source->dim[i]; + count++; + } + } + result = createNXDataset(source->rank-1, source->type, newDim); + if(result == NULL){ + fprintf(stderr,"ERROR: out of memory creating result dataset"); + return NULL; + } + sumData(source,result,sourceDim,targetDim,0, + dimNo, start, end, 0); + return result; +} diff --git a/nxdataset.h b/nxdataset.h index 3a2d2734..ab5d33a9 100644 --- a/nxdataset.h +++ b/nxdataset.h @@ -71,4 +71,7 @@ char *getNXDatasetText(pNXDS dataset); int putNXDatasetValue(pNXDS dataset, int pos[], double value); int putNXDatasetValueAt(pNXDS dataset, int address, double value); +pNXDS cutNXDataset(pNXDS source, int start[], int end[]); +pNXDS sumNXDataset(pNXDS source, int dimNo, int start, int end); + #endif diff --git a/polldriv.c b/polldriv.c index a5dc8fdc..da2f5119 100644 --- a/polldriv.c +++ b/polldriv.c @@ -13,7 +13,7 @@ #include #include "polldriv.h" -#include "splitter.h" +#include "macro.h" #include "sicshipadaba.h" /*================ actual driver implementation =========================*/ static int timeDue(struct __POLLDRIV *self, time_t now, SConnection *pCon){ @@ -73,6 +73,58 @@ static pPollDriv makeHdbDriver(SConnection *pCon, char *objectIdentifier, pNew->pollIntervall = 10; } + return pNew; +} +/*==================== script poll driver ========================*/ +static int pollScript(struct __POLLDRIV *self, SConnection *pCon){ + int status; + Tcl_Interp *pTcl = InterpGetTcl(pServ->pSics); + + self->nextPoll = time(NULL) + self->pollIntervall; + + MacroPush(pCon); + status = Tcl_Eval(pTcl,(char *)self->objPointer); + MacroPop(); + if(status == 0){ + return 1; + } else { + return 0; + } +} +/*-----------------------------------------------------------------------*/ +static void killScriptObj(void *data){ + if(data != NULL){ + free(data); + } +} +/*-----------------------------------------------------------------------*/ +static pPollDriv makeScriptDriver(SConnection *pCon, char *objectIdentifier, + int argc, char *argv[]){ + pPollDriv pNew = NULL; + char scriptBuffer[512]; + + if(argc < 2){ + SCWrite(pCon, + "ERROR: need intervall and script parameter for script polling driver", eError); + return NULL; + } + + pNew = malloc(sizeof(PollDriv)); + if(pNew == NULL){ + return NULL; + } + memset(pNew,0,sizeof(PollDriv)); + + pNew->pollIntervall = atoi(argv[0]); + memset(scriptBuffer,0,512); + Arg2Text(argc-1, &argv[1],scriptBuffer,511); + + pNew->objectIdentifier = strdup(objectIdentifier); + pNew->objPointer = strdup(scriptBuffer); + pNew->isDue = timeDue; + pNew->poll = pollScript; + pNew->killObjPointer = killScriptObj; + return pNew; } /*================ external interface ====================================*/ @@ -81,7 +133,9 @@ pPollDriv makePollDriver(SConnection *pCon, char *driver, strtolower(driver); if(strcmp(driver,"hdb") == 0) { - return makeHdbDriver(pCon,objectIdentifier, argc, argv); + return makeHdbDriver(pCon,objectIdentifier, argc, argv); + } else if(strcmp(driver,"script") == 0){ + return makeScriptDriver(pCon,objectIdentifier, argc, argv); } else { SCWrite(pCon,"ERROR: polling driver type unknown",eError); return NULL; @@ -92,5 +146,8 @@ void deletePollDriv(pPollDriv self){ if(self->objectIdentifier != NULL){ free(self->objectIdentifier); } + if(self->objPointer != NULL && self->killObjPointer != NULL){ + self->killObjPointer(self->objPointer); + } free(self); } diff --git a/polldriv.h b/polldriv.h index c5a22f13..409afb2d 100644 --- a/polldriv.h +++ b/polldriv.h @@ -20,6 +20,8 @@ typedef struct __POLLDRIV{ /* function called to determine if this object must be polled */ int (*poll)(struct __POLLDRIV *self, SConnection *pCon); /* the actual polling function */ + void (*killObjPointer)(void *data); + /* a function to possibly kill the objPointer. Can be NULL */ }PollDriv, *pPollDriv; /*==================== the interface =====================================*/ /* diff --git a/scriptcontext.c b/scriptcontext.c index a827f25e..da237dc1 100644 --- a/scriptcontext.c +++ b/scriptcontext.c @@ -11,6 +11,9 @@ #include "sicshipadaba.h" #include "dynstring.h" #include "devser.h" +#include "ascon.h" +#include "macro.h" + #define MAX_HDB_PATH 1024 @@ -128,12 +131,18 @@ static char *GetProp(Hdb *node, Hdb *cNode, char *key) { return val; } +/* + * This is the actual sct command available in scripts. + */ int SctCommand(SConnection *con, SicsInterp *sics, void *object, int argc, char *argv[]) { static char value[1024]; char *val; + char error[512]; Hdb *node = sct->nodes->node; Hdb *cNode = sct->nodes->controllerNode; + hdbValue v; + double dtime; assert(sct == object); if (node == NULL && cNode == NULL) { @@ -146,6 +155,49 @@ int SctCommand(SConnection *con, SicsInterp *sics, void *object, SCWrite(con, value, eValue); return 1; } + + /* + * update command + */ + if(strcmp(argv[1],"update") == 0){ + cloneHdbValue(&node->value, &v); + Arg2Text(argc-2, argv+2, value, sizeof value); + if(!readHdbValue(&v, value, error, 512)){ + SCWrite(con, error, eError); + return 0; + } + UpdateHipadabaPar(node,v,con); + SetHdbProperty(node,"geterror", NULL); + return 1; + } + + /* + * print + */ + if(strcmp(argv[1],"print") == 0){ + Arg2Text(argc-2, argv+2, value, sizeof value); + SCWrite(con,value,eWarning); + return 1; + } + + /* + * time stamping + */ + if(strcmp(argv[1],"utime") == 0){ + if(argc < 3){ + SCWrite(con,"ERROR: need property to write time stamp too", + eError); + return 0; + } + dtime = DoubleTime(); + snprintf(value,1024,"%ld",(long)dtime); + SetHdbProperty(node,argv[2], value); + return 1; + } + + /* + * property handling + */ if (argc == 2) { /* get case */ val = GetProp(node, cNode, argv[1]); if (val == NULL) { @@ -154,9 +206,9 @@ int SctCommand(SConnection *con, SicsInterp *sics, void *object, } SCWrite(con, val, eValue); } else { /* set case */ - val = Arg2Tcl(argc-2, argv+2, value, sizeof value); - SetProp(node, cNode, argv[1], val); - if (val != NULL && val != value) free(val); + val = Arg2Tcl(argc-2, argv+2, value, sizeof value); + SetProp(node, cNode, argv[1], val); + if (val != NULL && val != value) free(val); } return 1; } @@ -174,6 +226,7 @@ int SctCallInContext(SConnection *con, char *script, Hdb *node, SCPrintf(con, eInError, "\nscript: %s\n", script); } + MacroPush(con); l = strlen(script); ret = Tcl_EvalEx(pTcl, script, l, 0); result = (char *)Tcl_GetStringResult(pTcl); @@ -185,7 +238,7 @@ int SctCallInContext(SConnection *con, char *script, Hdb *node, } *resPtr = result; - PopContext(); + MacroPop(); PopContext(); return iRet; } @@ -359,19 +412,21 @@ static hdbCallbackReturn SctActionCallback(Hdb *node, void *userData, mm = GetHdbSetMessage(msg); if (mm != NULL && data->writable) { con = mm->callData; + + /* set target value */ + text = formatValue(*(mm->v), node); + SetHdbProperty(node, "target", GetCharArray(text)); /* call check script, if available */ script = GetProp(node, data->controller->node, "check"); if (script != NULL) { if (SctCallInContext(con, script, node, data->controller, &error) == 0) { SCPrintf(con, eError, "ERROR: %s", error); + SetHdbProperty(node,"target", NULL); return hdbAbort; } } - /* set target value */ - text = formatValue(*(mm->v), node); - SetHdbProperty(node, "target", GetCharArray(text)); /* enqueue write action */ writeprio = GetProp(node, data->controller->node, "writeprio"); @@ -494,6 +549,7 @@ static int SctPollCmd(pSICSOBJ ccmd, SConnection *con, SCPrintf(con, eError, "ERROR: %s not found", path); return 0; } + SetHdbProperty(node,"geterror","Not read yet"); interval = ParValue(cmdNode, "interval"); prio = DevText2Prio(ParText(cmdNode, "prio")); action = ParText(cmdNode, "action"); @@ -505,6 +561,36 @@ static int SctPollCmd(pSICSOBJ ccmd, SConnection *con, return 1; } +static int SctConnectCmd(pSICSOBJ ccmd, SConnection *con, + Hdb *cmdNode, Hdb *par[], int nPar) { + Hdb *node; + SctController *controller; + char *path; + hdbCallback *cb; + + if(nPar < 1){ + SCPrintf(con,eError, + "ERROR: should be: %s connect ", + ccmd->objectNode->name); + return 0; + } + controller = ccmd->pPrivate; + path = ParText(cmdNode, "node"); + node = FindHdbNode(NULL, path, con); + if (node == NULL) { + SCPrintf(con, eError, "ERROR: %s not found", path); + return 0; + } + + if (! FindHdbCallbackData(node, controller)) { + cb = MakeHipadabaCallback(SctMainCallback, controller, NULL); + assert(cb); + AppendHipadabaCallback(node, cb); + } + SCSendOK(con); + return 1; +} + int SctAddWriteNode(SctController *controller, Hdb *node) { hdbCallback *cb; SctData *data; @@ -619,6 +705,87 @@ static int SctQueueCmd(pSICSOBJ ccmd, SConnection *con, return 1; } +typedef struct SctTransact { + char *command; + int sent; + SConnection *con; +}SctTransact, *pSctTransact; + +static void KillSctTransact(void *data){ + pSctTransact self = (pSctTransact)data; + if(self == NULL){ + return; + } + if(self->command){ + free(self->command); + } + free(self); +} + +static char *TransactionHandler(void *actionData, char *lastReply){ + pSctTransact st = (pSctTransact)actionData; + + if(st->sent == 0){ + st->sent = 1; + return st->command; + } else { + st->sent = 2; + SCWrite(st->con,lastReply, eValue); + return NULL; + } +} +static int SctTransactMatch(void *d1, void *d2){ + return d1 == d2; +} + +static int SctTransactCmd(pSICSOBJ ccmd, SConnection *con, + Hdb *cmdNode, Hdb *par[], int nPar) { + pSctTransact st = NULL; + SctController *c; + + c = (SctController *)ccmd->pPrivate; + + st = calloc(sizeof(SctTransact),1); + if(st == NULL){ + SCWrite(con,"ERROR: out of memory in SctTransactCommand", eError); + return 0; + } + st->con = con; + st->command = strdup(par[0]->value.v.text); + + DevQueue(c->devser, st, WritePRIO, + TransactionHandler, SctTransactMatch, NULL); + while(st->sent != 2){ + TaskYield(pServ->pTasker); + if(SCGetInterrupt(con) != eContinue){ + break; + } + } + KillSctTransact(st); + return 1; +} + +static int SctQueueComCmd(pSICSOBJ ccmd, SConnection *con, + Hdb *cmdNode, Hdb *par[], int nPar) { + pSctTransact st = NULL; + SctController *c; + + c = (SctController *)ccmd->pPrivate; + + st = calloc(sizeof(SctTransact),1); + if(st == NULL){ + SCWrite(con,"ERROR: out of memory in SctTransactCommand", eError); + return 0; + } + st->con = con; + st->command = strdup(par[0]->value.v.text); + + DevQueue(c->devser, st, WritePRIO, + TransactionHandler, SctTransactMatch, KillSctTransact); + return 1; +} + + static hdbCallbackReturn SctDebugCallback(Hdb *node, void *userData, hdbMessage *msg) { hdbDataMessage *mm; @@ -648,7 +815,7 @@ static void SctKillController(void *c) { CleanStack(controller->node); RemoveSICSInternalCallback(controller); - DevKill(controller->devser); + /* devser is killed by task function */ } static int SctMakeController(SConnection *con, SicsInterp *sics, @@ -696,6 +863,10 @@ static int SctMakeController(SConnection *con, SicsInterp *sics, AddSICSHdbPar(cmd, "interval", usMugger, MakeHdbFloat(5.0)); AddSICSHdbPar(cmd, "prio", usMugger, MakeHdbText("read")); AddSICSHdbPar(cmd, "action", usMugger, MakeHdbText("read")); + + cmd = AddSICSHdbPar(controller->node, + "connect", usMugger, MakeSICSFunc(SctConnectCmd)); + AddSICSHdbPar(cmd, "node", usMugger, MakeHdbText("")); cmd = AddSICSHdbPar(controller->node, "write", usMugger, MakeSICSFunc(SctWriteCmd)); @@ -708,6 +879,15 @@ static int SctMakeController(SConnection *con, SicsInterp *sics, AddSICSHdbPar(cmd, "prio", usMugger, MakeHdbText("write")); AddSICSHdbPar(cmd, "action", usMugger, MakeHdbText("write")); + cmd = AddSICSHdbPar(controller->node, + "transact", usMugger, MakeSICSFunc(SctTransactCmd)); + AddSICSHdbPar(cmd, "data", usMugger, MakeHdbText("")); + + cmd = AddSICSHdbPar(controller->node, + "queuecom", usMugger, MakeSICSFunc(SctQueueComCmd)); + AddSICSHdbPar(cmd, "data", usMugger, MakeHdbText("")); + + par = AddSICSHdbPar(controller->node, "debug", usUser, MakeHdbInt(0)); cb = MakeHipadabaCallback(SctDebugCallback, controller, NULL); @@ -738,6 +918,10 @@ void SctKill(void *object) { sct = NULL; } +/* from sctdriveadapter.c */ +int SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object, + int argc, char *argv[]); + void SctInit(void) { if (sct) return; sct = calloc(1, sizeof(*sct)); @@ -747,4 +931,5 @@ void SctInit(void) { sct->base = sct->nodes; AddCommand(pServ->pSics, "sct", SctCommand, SctKill, sct); AddCmd("makesctcontroller", SctMakeController); + AddCmd("makesctdrive", SctMakeDriveAdapter); } diff --git a/sctdriveadapter.c b/sctdriveadapter.c new file mode 100644 index 00000000..af209ae6 --- /dev/null +++ b/sctdriveadapter.c @@ -0,0 +1,266 @@ +/** + * This is an adapter to a node under the control of the new + * scriptcontext generic device model. This is a wrapper around + * such a node which implements the drivable interface. + * + * Soem cooperation from the node is required: It has to provide + * certain properties the value of which define scripts which + * have to be called at various stages. These are: + * + * checklimits, for limits checking + * checkstatus, for evaluating progress + * halt , for halting things + * + * copyright: see file COPYRIGHT + * + * Mark Koennecke, June 2008 + * --------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include +/*------------- Some things from scriptcontext.c ----------------*/ +typedef struct SctController SctController; +typedef struct SctData SctData; +SctData *SctQueueNode(SctController *controller, pHdb node, + DevPrio prio, char *action); +int SctCallInContext(SConnection *con, char *script, Hdb *node, + SctController *controller, char **resPtr); +/*---------------------------------------------------------------*/ +typedef struct { + pObjectDescriptor pDes; + pIDrivable pDriv; + pHdb node; + SctController *c; +}SctDrive, *pSctDrive; +/*---------------------------------------------------------------*/ +static void *SCTDRIVGetInterface(void *data, int iD){ + pSctDrive self = NULL; + + self = (pSctDrive)data; + if(self != NULL && iD == DRIVEID){ + return self->pDriv; + } else { + return NULL; + } + return NULL; +} +/*---------------------------------------------------------------- + This routine can return either OKOK or HWFault when thing + go wrong. However, the return value of Halt is usually ignored! +------------------------------------------------------------------*/ +static int SCTDRIVHalt(void *data) { + pSctDrive self = NULL; + + self = (pSctDrive)data; + SctQueueNode(self->c, self->node, HaltPRIO, "halt"); + /* + * SctQueueNode returns a dynamically allocated SctData + * structure. I am not sure if this is not really a memory + * leak + */ + return OKOK; +} +/*---------------------------------------------------------------- + This routine can return either 1 or 0. 1 means the position can + be reached, 0 NOT + If 0, error shall contain up to errlen characters of information + about which limit was violated +------------------------------------------------------------------*/ +static int SCTDRIVCheckLimits(void *data, float val, + char *error, int errlen){ + pSctDrive self = NULL; + char script[1024]; + int status; + Tcl_Interp *pTcl = NULL; + char *result; + + self = (pSctDrive)data; + snprintf(script,1024,"%f", val); + SetHdbProperty(self->node,"target", script); + if(GetHdbProperty(self->node,"checklimits",script,1024)){ + status = SctCallInContext(pServ->dummyCon, script, + self->node, self->c, &result); + if(status == 0){ + strncpy(error,result,errlen); + } + } + return 1; +} +/*---------------------------------------------------------------- + This routine can return 0 when a limit problem occurred + OKOK when the motor was successfully started + HWFault when a problem occured starting the device + Possible errors shall be printed to pCon + For real motors, this is supposed to try at least three times + to start the motor in question + val is the value to drive the motor too +------------------------------------------------------------------*/ +static long SCTDRIVSetValue(void *data, SConnection *pCon, float val){ + pSctDrive self = NULL; + int status; + hdbValue v; + + self = (pSctDrive)data; + v.dataType = HIPFLOAT; + v.v.doubleValue = (double)val; + status = SetHipadabaPar(self->node, v, pCon); + if(status == 1){ + return OKOK; + } else { + return HWFault; + } +} +/*---------------------------------------------------------------- + Checks the status of a running motor. Possible return values + HWBusy The motor is still running + OKOK or HWIdle when the motor finished driving + HWFault when a hardware problem ocurred + HWPosFault when the hardware cannot reach a position + Errors are duly to be printed to pCon + For real motors CheckStatus again shall try hard to fix any + issues with the motor +------------------------------------------------------------------*/ +static int SCTDRIVCheckStatus(void *data, SConnection *pCon){ + pSctDrive self = NULL; + char script[1024]; + int status; + Tcl_Interp *pTcl = NULL; + char *result; + + self = (pSctDrive)data; + + if(GetHdbProperty(self->node,"checkstatus",script,1024)){ + status = SctCallInContext(pCon,script, self->node, + self->c, &result); + if(status == 1){ + if(strstr(result,"busy") != NULL){ + return HWBusy; + } else if(strstr(result,"posfault") != NULL){ + return HWPosFault; + } else if(strstr(result,"fault") != NULL){ + return HWFault; + } else if(strstr(result,"idle") != NULL){ + return HWIdle; + } else { + SCPrintf(pCon,eError,"ERROR: invalid status code %s returned from checkstatus script", + result); + return HWFault; + } + } else { + SCWrite(pCon,result, eError); + return HWFault; + } + } else { + SCWrite(pCon, + "ERROR: configuration problem: no checkstatus script!", eError); + return HWFault; + } + return HWFault; +} +/*---------------------------------------------------------------- + GetValue is supposed to read a motor position + On errors, -99999999.99 is returned and messages printed to pCon +------------------------------------------------------------------*/ +static float SCTDRIVGetValue(void *data, SConnection *pCon){ + pSctDrive self = NULL; + float val = -99999999.99; + int status; + char error[256]; + hdbValue v; + + self = (pSctDrive)data; + if(GetHdbProperty(self->node,"geterror", error, 256)){ + SCWrite(pCon,error, eError); + return val; + } + return (float)self->node->value.v.doubleValue; +} +/*---------------------------------------------------------------- + returns NULL on failure, a new datastructure else +------------------------------------------------------------------*/ +static pSctDrive SCTDRIVMakeObject(){ + pSctDrive self = NULL; + + self = calloc(sizeof(SctDrive),1); + if(self == NULL){ + return NULL; + } + self->pDes = CreateDescriptor("SctDriveAdapter"); + self->pDriv = CreateDrivableInterface(); + if(self->pDes == NULL || self->pDriv == NULL){ + free(self); + return NULL; + } + + self->pDes->GetInterface = SCTDRIVGetInterface; + self->pDriv->Halt = SCTDRIVHalt; + self->pDriv->CheckLimits = SCTDRIVCheckLimits; + self->pDriv->SetValue = SCTDRIVSetValue; + self->pDriv->CheckStatus = SCTDRIVCheckStatus; + self->pDriv->GetValue = SCTDRIVGetValue; + + return self; +} +/*-----------------------------------------------------------------*/ +static int SctDriveCommand(SConnection *pCon, SicsInterp *sics, void *object, + int argc, char *argv[]) { + pSctDrive self = (pSctDrive)object; + float val; + + assert(self != NULL); + + /* + * only action: print value + */ + val = self->pDriv->GetValue(self,pCon); + SCPrintf(pCon,eValue,"%s = %f", argv[0], val); + return 1; +} +/*----------------------------------------------------------------*/ +static void SctDriveKill(void *data){ + pSctDrive self = (pSctDrive)data; + + if(self == NULL){ + return; + } + if(self->pDriv != NULL){ + free(self->pDriv); + } + if(self->pDes != NULL){ + DeleteDescriptor(self->pDes); + } + free(self); +} +/*---------------------------------------------------------------*/ +int SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object, + int argc, char *argv[]) { + pSctDrive pNew = NULL; + pSICSOBJ obj = NULL; + + pNew = SCTDRIVMakeObject(); + if(pNew == NULL){ + SCWrite(pCon,"ERROR: out of memory in SctmakeDriveAdapter", + eError); + return 0; + } + + if(argc < 4){ + SCWrite(pCon,"ERROR: not enough arguments for SctMakeDriveAdapter", eError); + return 0; + } + + pNew->node = FindHdbNode(NULL,argv[2], pCon); + obj = FindCommandData(pSics,argv[3], "SctController"); + if(pNew->node == NULL || obj == NULL){ + SCWrite(pCon,"ERROR: node or controller not found", eError); + SctDriveKill(pNew); + return 0; + } + pNew->c =(SctController *)obj->pPrivate; + AddCommand(pSics, argv[1], SctDriveCommand, SctDriveKill, pNew); + SetHdbProperty(pNew->node,"sicsdev",argv[1]); + return 1; +} diff --git a/sicsdata.c b/sicsdata.c index beb5c7b7..6c1d12a9 100644 --- a/sicsdata.c +++ b/sicsdata.c @@ -577,8 +577,7 @@ static int copyTimeBin(pSICSData self, int argc, char *argv[], return 0; } for(i = 0; i < noTimeBin; i++){ - memcpy(iData + pos + i, fTimeBin + i, sizeof(float)); - self->dataType[pos+i] = FLOATTYPE; + setSICSDataInt(self,pos+i,(int)(fTimeBin[i])); } SCSendOK(pCon); return 1; diff --git a/sicshdbadapter.c b/sicshdbadapter.c index 6fd8169f..5ab6dfb6 100644 --- a/sicshdbadapter.c +++ b/sicshdbadapter.c @@ -20,6 +20,8 @@ #include "stptok.h" #include "motor.h" #include "HistMem.h" +#include "HistMem.i" +#include "HistDriv.i" #include "sicsvar.h" #include "counter.h" #include "lld.h" @@ -770,3 +772,52 @@ int SICSHdbAdapter(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon,buffer,eError); return 0; } +/*====================== SubSample =========================================*/ +int HdbSubSample(SConnection *pCon, SicsInterp *pSics, void *pData, + int argc, char *argv[]){ + pHistMem pHM = NULL; + pHdb node = NULL; + int bank = 0, length = -1, status; + HistInt *data = NULL; + char *pPtr = NULL; + hdbValue v; + + if(argc < 4){ + SCWrite(pCon,"ERROR: insufficient number of arguments to HdbSubSample", + eError); + return 0; + } + + pPtr = strchr(argv[1],':'); + if(pPtr != NULL){ + *pPtr = '\0'; + pPtr++; + sscanf(pPtr,"%d",&bank); + } + pHM = (pHistMem)FindCommandData(pSics,argv[1],"HistMem"); + node = FindHdbNode(NULL,argv[2], pCon); + if(pHM == NULL || node == NULL){ + SCWrite(pCon,"ERROR: either histogram memory or node not found!", + eError); + return 0; + } + + if(pHM->pDriv->SubSample == NULL){ + SCWrite(pCon,"ERROR: hm does not support subsampling", eError); + return 0; + } + data = pHM->pDriv->SubSample(pHM->pDriv, pCon, bank, argv[3]); + if(data == NULL){ + SCWrite(pCon,"ERROR: sub sampling failed", eError); + return 0; + } + + v.dataType = HIPINTVARAR; + v.arrayLength = data[0]; + v.v.intArray = data+1; + + UpdateHipadabaPar(node,v,pCon); + free(data); + SCSendOK(pCon); + return 1; +} diff --git a/sicshdbadapter.h b/sicshdbadapter.h index 9b8e54d2..563b95f9 100644 --- a/sicshdbadapter.h +++ b/sicshdbadapter.h @@ -19,5 +19,7 @@ int SICSHdbAdapter(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]); +int HdbSubSample(SConnection *pCon, SicsInterp *pSics, void *pData, + int argc, char *argv[]); #endif /*SICSHDBADAPTER_H_*/ diff --git a/sicshdbfactory.c b/sicshdbfactory.c index c7066aa5..aca0ed08 100644 --- a/sicshdbfactory.c +++ b/sicshdbfactory.c @@ -268,8 +268,8 @@ static hdbCallbackReturn CommandGetCallback(pHdb node, void *userData, return hdbContinue; } - hdbValue v2 = MakeHdbText("Nothing to get"); - copyHdbValue(&v2, mm->v); /* MakeHdbText makes no strdup ! */ + hdbValue v2 = MakeHdbText(strdup("Nothing to get")); + copyHdbValue(&v2, mm->v); return hdbContinue; } /*--------------------------------------------------------------------------*/ diff --git a/sicshipadaba.c b/sicshipadaba.c index 6483176e..9bff97d9 100644 --- a/sicshipadaba.c +++ b/sicshipadaba.c @@ -715,6 +715,17 @@ static hdbCallbackReturn SICSScriptReadCallback(pHdb node, void *userData, } return hdbAbort; } + + /* + * do we need to copy? + */ + if(strstr(data,"@@NOCOPY@@") != NULL){ + return hdbContinue; + } + + /* + * we need to copy: do it + */ equal = strchr(data,'='); if(equal != NULL){ data = equal + 1; @@ -1412,7 +1423,7 @@ void RemoveSICSInternalCallback(void *internalID) { m.type = killPtr; m.pPtr = internalID; RecurseCallbackChains(GetHipadabaRoot(),(pHdbMessage)&m); - ForEachCommand(RemoveParNodeCallback, internalID); + ForEachCommand(RemoveParNodeCallback, internalID); } /*--------------------------------------------------------------------------*/ int SICSHdbGetPar(void *obj, SConnection *pCon, char *path, hdbValue *v){ @@ -2951,7 +2962,25 @@ static int SetSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData, SCSendOK(pCon); return 1; } - /*--------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------------------*/ +static int DelSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData, + int argc, char *argv[]){ + pHdb targetNode = NULL; + + if(argc < 3) { + SCWrite(pCon,"ERROR: need path key as parameters",eError); + return 0; + } + targetNode = FindHdbNode(NULL,argv[1],pCon); + if(targetNode == NULL){ + SCWrite(pCon,"ERROR: node not found",eError); + return 0; + } + SetHdbProperty(targetNode,argv[2], NULL); + SCSendOK(pCon); + return 1; + } +/*--------------------------------------------------------------------------*/ static int GetSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]){ pHdb targetNode = NULL; @@ -3106,6 +3135,7 @@ int InstallSICSHipadaba(SConnection *pCon, SicsInterp *pSics, void *pData, AddCommand(pSics,"hfactory", HdbNodeFactory, NULL, NULL); AddCommand(pSics,"hmakescript", MakeHdbScriptNode, NULL, NULL); AddCommand(pSics,"hattach", SICSHdbAdapter, NULL, NULL); + AddCommand(pSics,"hsubsamplehm", HdbSubSample, NULL, NULL); AddCommand(pSics,"hdel", DeleteHdbNode, NULL, NULL); AddCommand(pSics,"hset", SetHdbNode, NULL, NULL); AddCommand(pSics,"hupdate", UpdateHdbNode, NULL, NULL); @@ -3121,6 +3151,7 @@ int InstallSICSHipadaba(SConnection *pCon, SicsInterp *pSics, void *pData, AddCommand(pSics,"hchain", ChainHdbNode, NULL, NULL); AddCommand(pSics,"hcommand",SicsCommandNode, NULL, NULL); AddCommand(pSics,"hsetprop",SetSICSHdbProperty, NULL, NULL); + AddCommand(pSics,"hdelprop",DelSICSHdbProperty, NULL, NULL); AddCommand(pSics,"hgetprop",GetSICSHdbProperty, NULL, NULL); AddCommand(pSics,"hgetpropval",GetSICSHdbPropertyVal, NULL, NULL); AddCommand(pSics,"hmatchprop",MatchHdbProperty, NULL, NULL); diff --git a/sicsobj.c b/sicsobj.c index cfadc3c1..c4e0796d 100644 --- a/sicsobj.c +++ b/sicsobj.c @@ -57,13 +57,13 @@ void KillSICSOBJ(void *data){ if(self == NULL){ return; } + if(self->KillPrivate != NULL && self->pPrivate != NULL){ + self->KillPrivate(self->pPrivate); + } RemoveHdbNodeFromParent(self->objectNode, pServ->dummyCon); if(self->pDes != NULL){ DeleteDescriptor(self->pDes); /* kill descriptor including node */ } - if(self->KillPrivate != NULL && self->pPrivate != NULL){ - self->KillPrivate(self->pPrivate); - } free(self); } /*===========================================================================*/ diff --git a/sicspoll.c b/sicspoll.c index d02783e6..fe798bbb 100644 --- a/sicspoll.c +++ b/sicspoll.c @@ -229,7 +229,7 @@ int SICSPollWrapper(SConnection *pCon,SicsInterp *pSics, void *pData, } driv = makePollDriver(pCon,argv[3], argv[2], - argc-3, &argv[4]); + argc-4, &argv[4]); if(driv != NULL){ LLDnodeAppend(self->pollList,&driv); SCSendOK(pCon); diff --git a/status.c b/status.c index ca7b15d9..64f2eda4 100644 --- a/status.c +++ b/status.c @@ -210,7 +210,7 @@ assert(pUser); node = (pHdb)pUser; - v = MakeHdbText(pText[eCode]); + v = MakeHdbText(strdup(pText[eCode])); if(node != NULL && iEvent == VALUECHANGE){ UpdateHipadabaPar(node,v,NULL); } diff --git a/stringdict.c b/stringdict.c index 1ee5553f..16767163 100644 --- a/stringdict.c +++ b/stringdict.c @@ -174,7 +174,7 @@ { if(pResult == NULL) { - return strlen(sVal.value); + return strlen(sVal.value) + 1; /* for \0 */ } else { diff --git a/val.lis b/val.lis index ccc214ad..97b040dd 100644 --- a/val.lis +++ b/val.lis @@ -1,148 +1,611 @@ +==23429== Memcheck, a memory error detector. +==23429== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. +==23429== Using LibVEX rev 1658, a library for dynamic binary translation. +==23429== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. +==23429== Using valgrind-3.2.1, a dynamic binary instrumentation framework. +==23429== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. +==23429== For more details, rerun with: -v +==23429== WARNING: Cannot log(Accepted dummy connection ) -sim/topsi/morpheus.tcl:0>> ServerOption ReadTimeOut 10 -sim/topsi/morpheus.tcl:1>> ServerOption AcceptTimeOut 50 -sim/topsi/morpheus.tcl:2>> ServerOption ReadUserPasswdTimeout 500000 -sim/topsi/morpheus.tcl:3>> ServerOption LogFileBaseName $loghome/morpheus -sim/topsi/morpheus.tcl:4>> ServerOption TecsPort 9753 -sim/topsi/morpheus.tcl:5>> ServerOption ServerPort 2911 -sim/topsi/morpheus.tcl:6>> ServerOption InterruptPort 9709 -sim/topsi/morpheus.tcl:7>> ServerOption statusfile $datahome/morpheusstatus.tcl -sim/topsi/morpheus.tcl:8>> ServerOption TelnetPort 1301 -sim/topsi/morpheus.tcl:9>> ServerOption TelWord sicslogin -sim/topsi/morpheus.tcl:10>> ServerOption QuieckPort 2108 -sim/topsi/morpheus.tcl:11>> TokenInit connan -sim/topsi/morpheus.tcl:12>> ServerOption LogFileDir $loghome -sim/topsi/morpheus.tcl:13>> commandlog auto -sim/topsi/morpheus.tcl:14>> ServerOption RedirectFile $loghome/mostdout -sim/topsi/morpheus.tcl:15>> MakeDataNumber SicsDataNumber $datahome/DataNumber -sim/topsi/morpheus.tcl:16>> VarMake SicsDataPath Text Mugger -sim/topsi/morpheus.tcl:17>> SicsDataPath $datahome/ -sim/topsi/morpheus.tcl:18>> SicsDataPath lock -sim/topsi/morpheus.tcl:19>> VarMake SicsDataPrefix Text Mugger -sim/topsi/morpheus.tcl:20>> SicsDataPrefix lock -sim/topsi/morpheus.tcl:21>> VarMake SicsDataPostFix Text Mugger -sim/topsi/morpheus.tcl:22>> SicsDataPostFix .dat -sim/topsi/morpheus.tcl:23>> SicsDataPostFix lock -sim/topsi/morpheus.tcl:24>> SicsUser lnsmanager lnsSICSlns 1 -sim/topsi/morpheus.tcl:25>> SicsUser morpheususer 07lns1 2 -sim/topsi/morpheus.tcl:26>> SicsUser mu 07lns1 2 -sim/topsi/morpheus.tcl:27>> SicsUser User 07lns1 2 -sim/topsi/morpheus.tcl:28>> VarMake Instrument Text Internal -sim/topsi/morpheus.tcl:29>> VarMake sample Text User -sim/topsi/morpheus.tcl:30>> sample " " -sim/topsi/morpheus.tcl:31>> VarMake Title Text User -sim/topsi/morpheus.tcl:32>> Title "morpheus" -sim/topsi/morpheus.tcl:33>> VarMake User Text User -sim/topsi/morpheus.tcl:34>> User "unknown" -sim/topsi/morpheus.tcl:35>> VarMake email Text User -sim/topsi/morpheus.tcl:36>> email "unknown" -sim/topsi/morpheus.tcl:37>> VarMake adress Text User -sim/topsi/morpheus.tcl:38>> adress "unknown" -sim/topsi/morpheus.tcl:39>> VarMake fax Text User -sim/topsi/morpheus.tcl:40>> fax "unknown" -sim/topsi/morpheus.tcl:41>> VarMake phone Text User -sim/topsi/morpheus.tcl:42>> phone "unknown" -sim/topsi/morpheus.tcl:43>> VarMake BatchRoot text User -sim/topsi/morpheus.tcl:44>> VarMake lastscancommand Text User -sim/topsi/morpheus.tcl:45>> lastscancommand "unknown scan" -sim/topsi/morpheus.tcl:46>> VarMake window Text User -sim/topsi/morpheus.tcl:47>> window 0:256:0:256 -sim/topsi/morpheus.tcl:48>> Publish savemotorpar Mugger -sim/topsi/morpheus.tcl:49>> SicsAlias STH A3 -sim/topsi/morpheus.tcl:50>> SicsAlias STH SOM -sim/topsi/morpheus.tcl:51>> SicsAlias STH TH -sim/topsi/morpheus.tcl:52>> SicsAlias STH OM -sim/topsi/morpheus.tcl:53>> SicsAlias STT A4 -sim/topsi/morpheus.tcl:54>> SicsAlias STT S2T -sim/topsi/morpheus.tcl:55>> SicsAlias STT TTH -sim/topsi/morpheus.tcl:56>> SicsAlias STT 2T -sim/topsi/morpheus.tcl:57>> SicsAlias SCX SCH -sim/topsi/morpheus.tcl:58>> SicsAlias SCX CHI -sim/topsi/morpheus.tcl:59>> SicsAlias SCY SPH -sim/topsi/morpheus.tcl:60>> SicsAlias SCY PHI -sim/topsi/morpheus.tcl:61>> SicsAlias SCY ATX -sim/topsi/morpheus.tcl:62>> SicsAlias PO1 POL -sim/topsi/morpheus.tcl:63>> SicsAlias PO2 ANA -sim/topsi/morpheus.tcl:64>> SicsAlias MTH A1 -sim/topsi/morpheus.tcl:65>> SicsAlias MTH MOM -sim/topsi/morpheus.tcl:66>> SicsAlias MTT A2 -sim/topsi/morpheus.tcl:67>> SicsAlias MTT M2T -sim/topsi/morpheus.tcl:68>> SicsAlias MFV MCV -sim/topsi/morpheus.tcl:69>> MakeLin2Ang sttl utt -sim/topsi/morpheus.tcl:70>> sttl length 2110 -sim/topsi/morpheus.tcl:71>> SicsAlias sttl u2t -sim/topsi/morpheus.tcl:72>> Publish motransfer Spy -sim/topsi/morpheus.tcl:73>> MakeO2T O2T sth stt -sim/topsi/morpheus.tcl:74>> MakeO2T O2TL sth sttl -sim/topsi/morpheus.tcl:75>> MakeO2T O2U sth sttl -sim/topsi/morpheus.tcl:76>> MakeProxy ptt temperature float -sim/topsi/morpheus.tcl:77>> ptt map upperlimit upperlimit float user -ERROR: not enough arguments to MapFunc -sim/topsi/morpheus.tcl:78>> ptt map lowerlimit lowerlimit float user -ERROR: not enough arguments to MapFunc -sim/topsi/morpheus.tcl:79>> MakeScanCommand xxxscan counter $scripthome/morpheus.hdd \ - $loghome/recover.bin -sim/topsi/morpheus.tcl:80>> MakePeakCenter xxxscan -sim/topsi/morpheus.tcl:81>> MakeOptimise opti counter -sim/topsi/morpheus.tcl:82>> SicsAlias drive dr -sim/topsi/morpheus.tcl:83>> MakeHKL stt sth sch sph -sim/topsi/morpheus.tcl:84>> MakeHKLMot hkl -sim/topsi/morpheus.tcl:85>> MakeUBCalc ubcalc hkl -sim/topsi/morpheus.tcl:86>> MakeCone cone ubcalc -sim/topsi/morpheus.tcl:87>> hkl lambdavar lambda -sim/topsi/morpheus.tcl:88>> MakeXYTable table -sim/topsi/morpheus.tcl:89>> MakeConfigurableMotor two -sim/topsi/morpheus.tcl:90>> two drivescript twoscript -sim/topsi/morpheus.tcl:91>> fileeval $scripthome/morpheuscom.tcl -ERROR: new SICSData not created due to name collision -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:92>> hfactory /instrument plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:93>> hsetprop /instrument type instrument -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:94>> hfactory /instrument/experiment/filemode script filemode filemode text -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:95>> hsetprop /instrument/experiment/filemode values prehistoric,nexus,4circle,2circleub -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:96>> hfactory /instrument/monochromator plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:97>> hsetprop /instrument/monochromator type part -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:98>> hattach /instrument/monochromator lambda wavelength -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:99>> hchain /instrument/monochromator/wavelength /instrument/monochromator/two_theta -ERROR: master /instrument/monochromator/wavelength not found -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:100>> hattach /instrument/monochromator mth theta -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:101>> hattach /instrument/monochromator mtt two_theta -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:102>> hattach /instrument/monochromator mtx x_translation -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:103>> hattach /instrument/monochromator mty y_translation -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:104>> hattach /instrument/monochromator mfv vertical_focusing -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:105>> hsetprop /instrument/slit1/upper sicsdev d1t -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:106>> hsetprop /instrument/slit1/bottom sicsdev d1b -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:107>> hsetprop /instrument/slit2/upper sicsdev d2t -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:108>> hsetprop /instrument/slit2/bottom sicsdev d2b -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:109>> hfactory /instrument/sample plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:110>> hsetprop /instrument/sample type part -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:111>> hattach /instrument/sample sample name -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:112>> hattach /instrument/sample sth omega -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:113>> hattach /instrument/sample stt two_theta -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:114>> hattach /instrument/sample stx x_translation -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:115>> hattach /instrument/sample sty y_translation -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:116>> hattach /instrument/sample sgy y_goniometer -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:117>> hattach /instrument/sample sgx x_goniometer -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:118>> hattach /imstrument/sample scx chi -ERROR: path to attach object too not found -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:119>> hattach /imstrument/sample scy phi -ERROR: path to attach object too not found -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:120>> hfactory /instrument/monitor plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:121>> hsetprop /instrument/monitor type part -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:122>> hfactory /instrument/monitor/counts plain internal int -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:123>> hattach /instrument/monitor/counts counter 1 -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:124>> hsetprop /instrument/monitor/counts priv internal -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:125>> hsetprop /instrument/monitor/counts sicsdev counter -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:126>> hfactory /instrument/monitor/preset script "counter getpreset" "counter setpreset" float -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:127>> hfactory /instrument/monitor/countmode script "counter getmode" "counter setmode" text -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:128>> hfactory /instrument/counter plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:129>> hsetprop /instrument/counter type part -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:130>> hfactory /instrument/counter/counts plain internal int -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:131>> hattach /instrument/counter/counts counter 0 -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:132>> hsetprop /instrument/counter/counts priv internal -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:133>> hfactory /graphics plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:134>> hsetprop /graphics type graphset -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:135>> hfactory /instrument/commands plain spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:136>> hsetprop /instrument/commands type commandset -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:137>> hmake /quickview spy none -/afs/psi.ch/user/k/koennecke/src/workspace/sics/sim/topsi/morpheuscom.tcl:138>> __filemode prehistoric +sim/powder/hrpt.tcl:0>> ServerOption RedirectFile $loghome/stdhrpt +sim/powder/hrpt.tcl:1>> ServerOption ReadTimeOut 10 +sim/powder/hrpt.tcl:2>> ServerOption AcceptTimeOut 10 +sim/powder/hrpt.tcl:3>> ServerOption ReadUserPasswdTimeout 500000 +sim/powder/hrpt.tcl:4>> ServerOption LogFileBaseName "$loghome/hrptlog" +sim/powder/hrpt.tcl:5>> ServerOption LogFileDir $loghome +sim/powder/hrpt.tcl:6>> ServerOption TecsPort 9753 +sim/powder/hrpt.tcl:7>> ServerOption ServerPort 2911 +sim/powder/hrpt.tcl:8>> ServerOption statusfile $datahome/hrptstatus.tcl +sim/powder/hrpt.tcl:9>> ServerOption InterruptPort 3007 +sim/powder/hrpt.tcl:10>> ServerOption TelnetPort 1301 +sim/powder/hrpt.tcl:11>> ServerOption TelWord sicslogin +sim/powder/hrpt.tcl:12>> ServerOption QuieckPort 2108 +sim/powder/hrpt.tcl:13>> TokenInit connan +sim/powder/hrpt.tcl:14>> SicsUser lnsmanager lnsSICSlns 1 +sim/powder/hrpt.tcl:15>> SicsUser Manager lnsSICSlns 1 +sim/powder/hrpt.tcl:16>> SicsUser User 07lns1 2 +sim/powder/hrpt.tcl:17>> SicsUser hrptuser 08lns1 2 +sim/powder/hrpt.tcl:18>> SicsUser user 08lns1 2 +sim/powder/hrpt.tcl:19>> SicsUser manager lnsSICSlns 1 +sim/powder/hrpt.tcl:20>> ClientPut "Initialising Elephant" +Initialising Elephant +sim/powder/hrpt.tcl:21>> ClientPut "Initialising Sample Table Motors" +Initialising Sample Table Motors +sim/powder/hrpt.tcl:22>> SicsAlias MOMU A1 +sim/powder/hrpt.tcl:23>> SicsAlias SOM A3 +sim/powder/hrpt.tcl:24>> SicsAlias SOM OM +sim/powder/hrpt.tcl:25>> SicsAlias SOM OMEGA +sim/powder/hrpt.tcl:26>> SicsAlias STT A4 +sim/powder/hrpt.tcl:27>> SicsAlias STT TH +sim/powder/hrpt.tcl:28>> SicsAlias MOML B1 +sim/powder/hrpt.tcl:29>> SicsAlias CEX1 A17 +sim/powder/hrpt.tcl:30>> SicsAlias CEX2 A18 +sim/powder/hrpt.tcl:31>> SicsAlias MTVU A12 +sim/powder/hrpt.tcl:32>> SicsAlias MTPU A13 +sim/powder/hrpt.tcl:33>> SicsAlias MGVU A14 +sim/powder/hrpt.tcl:34>> SicsAlias MGPU A15 +sim/powder/hrpt.tcl:35>> SicsAlias MCVU A16 +sim/powder/hrpt.tcl:36>> SicsAlias MEXZ A37 +sim/powder/hrpt.tcl:37>> SicsAlias MTVL A22 +sim/powder/hrpt.tcl:38>> SicsAlias MTPL A23 +sim/powder/hrpt.tcl:39>> SicsAlias MGVL A24 +sim/powder/hrpt.tcl:40>> SicsAlias MGPL A25 +sim/powder/hrpt.tcl:41>> SicsAlias MCVL A26 +sim/powder/hrpt.tcl:42>> DefineAlias TT temperature +sim/powder/hrpt.tcl:43>> VarMake MTT Float User +sim/powder/hrpt.tcl:44>> MTT 90. +sim/powder/hrpt.tcl:45>> SicsAlias MTT A2 +sim/powder/hrpt.tcl:46>> VarMake typename Text Mugger +sim/powder/hrpt.tcl:47>> typename Pyrolithic Graphite +sim/powder/hrpt.tcl:48>> VarMake radcol Text Mugger +sim/powder/hrpt.tcl:49>> MakeConfigurableMotor D1W +sim/powder/hrpt.tcl:50>> D1W drivescript widthscript +sim/powder/hrpt.tcl:51>> D1W readscript readwidth +sim/powder/hrpt.tcl:52>> ClientPut "Installing counters" +Installing counters +sim/powder/hrpt.tcl:53>> banana configure HistMode hrpt +sim/powder/hrpt.tcl:54>> banana configure OverFlowMode reflect +sim/powder/hrpt.tcl:55>> banana configure Rank 1 +sim/powder/hrpt.tcl:56>> banana configure dim0 1600 +sim/powder/hrpt.tcl:57>> banana configure BinWidth 4 +sim/powder/hrpt.tcl:58>> banana preset 100. +sim/powder/hrpt.tcl:59>> banana CountMode Timer +sim/powder/hrpt.tcl:60>> banana configure HMComputer lnse03.psi.ch +sim/powder/hrpt.tcl:61>> banana configure HMPort 2400 +sim/powder/hrpt.tcl:62>> banana configure Counter counter +sim/powder/hrpt.tcl:63>> banana init +Receive on port 0xABCB=43979, use multicast group="226.129.151.54" addr=INADDR_ANY +sim/powder/hrpt.tcl:64>> VarMake SicsDataPath Text Internal +sim/powder/hrpt.tcl:65>> SicsDataPath "$datahome/" +sim/powder/hrpt.tcl:66>> SicsDataPath lock +sim/powder/hrpt.tcl:67>> VarMake DetStepWidth Float Internal +sim/powder/hrpt.tcl:68>> DetStepWidth 0.1 +sim/powder/hrpt.tcl:69>> DetStepWidth lock +sim/powder/hrpt.tcl:70>> VarMake Instrument Text Internal +sim/powder/hrpt.tcl:71>> Instrument lock +sim/powder/hrpt.tcl:72>> VarMake Title Text User +sim/powder/hrpt.tcl:73>> VarMake User Text User +sim/powder/hrpt.tcl:74>> VarMake Collimation Text User +sim/powder/hrpt.tcl:75>> VarMake Sample Text User +sim/powder/hrpt.tcl:76>> Sample Fischerit +sim/powder/hrpt.tcl:77>> VarMake comment1 Text User +sim/powder/hrpt.tcl:78>> VarMake comment2 Text User +sim/powder/hrpt.tcl:79>> VarMake comment3 Text User +sim/powder/hrpt.tcl:80>> VarMake starttime Text User +sim/powder/hrpt.tcl:81>> starttime "" +sim/powder/hrpt.tcl:82>> VarMake SicsDataPrefix Text Internal +sim/powder/hrpt.tcl:83>> SicsDataPrefix hrpt +sim/powder/hrpt.tcl:84>> SicsDataPrefix lock +sim/powder/hrpt.tcl:85>> MakeDataNumber SicsDataNumber $datahome/DataNumber +sim/powder/hrpt.tcl:86>> VarMake SicsDataPostFix Text Internal +sim/powder/hrpt.tcl:87>> SicsDataPostFix ".hdf" +sim/powder/hrpt.tcl:88>> SicsDataPostFix lock +sim/powder/hrpt.tcl:89>> VarMake Adress Text User +sim/powder/hrpt.tcl:90>> VarMake phone Text User +sim/powder/hrpt.tcl:91>> VarMake fax Text User +sim/powder/hrpt.tcl:92>> VarMake email Text User +sim/powder/hrpt.tcl:93>> VarMake sample_mur Float User +sim/powder/hrpt.tcl:94>> VarMake BatchRoot Text User +sim/powder/hrpt.tcl:95>> VarMake lambda Float User +sim/powder/hrpt.tcl:96>> hfactory /instrument plain spy none +sim/powder/hrpt.tcl:97>> hsetprop /instrument type instrument +sim/powder/hrpt.tcl:98>> hmake /instrument/sinq spy none +sim/powder/hrpt.tcl:99>> hfactory /instrument/sinq/counts plain internal int +sim/powder/hrpt.tcl:100>> hattach /instrument/sinq/counts counter 4 +sim/powder/hrpt.tcl:101>> hfactory /instrument/sinq/ring_current script "sinq ring" hdbReadOnly int +sim/powder/hrpt.tcl:102>> hfactory /instrument/sinq/sinq_current script "sinq beam" hdbReadOnly int +sim/powder/hrpt.tcl:103>> sicspoll add /instrument/sinq/ring_current hdb 5 +sim/powder/hrpt.tcl:104>> sicspoll add /instrument/sinq/beam_current hdb 5 +ERROR: node /instrument/sinq/beam_current not found +ERROR: object to poll not found +sim/powder/hrpt.tcl:105>> hfactory $path plain spy none +sim/powder/hrpt.tcl:106>> hattach $path cex1 drum1 +sim/powder/hrpt.tcl:107>> hattach $path cex2 drum2 +sim/powder/hrpt.tcl:108>> hfactory $path plain spy none +sim/powder/hrpt.tcl:109>> hfactory $path/upper plain spy none +sim/powder/hrpt.tcl:110>> hfactory $path/lower plain spy none +sim/powder/hrpt.tcl:111>> hattach $path/upper mtvu vertical_translation +sim/powder/hrpt.tcl:112>> hattach $path/upper mtpu paralell_translation +sim/powder/hrpt.tcl:113>> hattach $path/upper mgvu vertical_tilt +sim/powder/hrpt.tcl:114>> hattach $path/upper mgpu paralell_tilt +sim/powder/hrpt.tcl:115>> hattach $path/upper momu omega +sim/powder/hrpt.tcl:116>> hattach $path/lower mtvl vertical_translation +sim/powder/hrpt.tcl:117>> hattach $path/lower mtpl paralell_translation +sim/powder/hrpt.tcl:118>> hattach $path/lower mgvl vertical_tilt +sim/powder/hrpt.tcl:119>> hattach $path/lower mgpl paralell_tilt +sim/powder/hrpt.tcl:120>> hattach $path/lower moml omega +sim/powder/hrpt.tcl:121>> hattach $path mexz lift +sim/powder/hrpt.tcl:122>> hattach $path lambda wavelength +sim/powder/hrpt.tcl:123>> hattach $path/lower mcvl curvature +sim/powder/hrpt.tcl:124>> hattach /instrument/slit d1w width +sim/powder/hrpt.tcl:125>> hchain /instrument/slit/d1r /instrument/slit/width +ERROR: slave /instrument/slit/d1r not found +sim/powder/hrpt.tcl:126>> hfactory $path plain spy none +sim/powder/hrpt.tcl:127>> hattach $path sample name +sim/powder/hrpt.tcl:128>> hattach $path som omega +sim/powder/hrpt.tcl:129>> hfactory $path/monitor plain internal int +sim/powder/hrpt.tcl:130>> hattach $path/monitor counter 1 +sim/powder/hrpt.tcl:131>> hfactory $path/changer plain spy none +sim/powder/hrpt.tcl:132>> hfactory $path/changer/rotation script sarot sarot text +sim/powder/hrpt.tcl:133>> hsetprop $path/changer/rotation values on,off +sim/powder/hrpt.tcl:134>> hattach $path/changer chpos position +sim/powder/hrpt.tcl:135>> hfactory /instrument/radial_collimator plain spy none +sim/powder/hrpt.tcl:136>> hfactory /instrument/radial_collimator/status script radial hdbradial text +sim/powder/hrpt.tcl:137>> hsetprop /instrument/radial_collimator values start,stop +sim/powder/hrpt.tcl:138>> sicspoll /instrument/radial_collimator/status hdb 60 +sim/powder/hrpt.tcl:139>> hattach /instrument/radial_collimator radcol type +sim/powder/hrpt.tcl:140>> hfactory $path plain spy none +sim/powder/hrpt.tcl:141>> hattach $path stt two_theta +sim/powder/hrpt.tcl:142>> hfactory /instrument/detector/preset script "banana preset" hdbReadOnly float +sim/powder/hrpt.tcl:143>> hsetprop /instrument/detector/preset priv internal +sim/powder/hrpt.tcl:144>> hfactory /instrument/detector/countmode script "banana countmode" hdbReadOnly text +sim/powder/hrpt.tcl:145>> hsetprop /instrument/detector/countmode priv internal +sim/powder/hrpt.tcl:146>> sicspoll add /instrument/detector/preset hdb 30 +sim/powder/hrpt.tcl:147>> sicspoll add /instrument/detector/countmode hdb 30 +sim/powder/hrpt.tcl:148>> hfactory /instrument/detector/count_time plain internal float +sim/powder/hrpt.tcl:149>> hattach /instrument/detector/count_time counter -1 +sim/powder/hrpt.tcl:150>> hfactory /instrument/commands plain spy none +sim/powder/hrpt.tcl:151>> hfactory /graphics plain spy none +sim/powder/hrpt.tcl:152>> hfactory /graphics/powder_diagram plain spy none +sim/powder/hrpt.tcl:153>> hattach /graphics/powder_diagram title title +sim/powder/hrpt.tcl:154>> hsetprop /graphics/powder_diagram type graphdata +sim/powder/hrpt.tcl:155>> hsetprop /graphics/powder_diagram viewer default +sim/powder/hrpt.tcl:156>> hfactory /graphics/powder_diagram/rank plain internal int +sim/powder/hrpt.tcl:157>> hset /graphics/powder_diagram/rank 1 +sim/powder/hrpt.tcl:158>> hfactory /graphics/powder_diagram/dim plain internal intar 1 +sim/powder/hrpt.tcl:159>> hset /graphics/powder_diagram/dim 1600 +sim/powder/hrpt.tcl:160>> hfactory /graphics/powder_diagram/two_theta script maketwotheta hdbReadOnly floatar 1600 +sim/powder/hrpt.tcl:161>> hchain /graphics/powder_diagram/two_theta /instrument/detector/two_theta +sim/powder/hrpt.tcl:162>> hsetprop /graphics/powder_diagram/two_theta type axis +sim/powder/hrpt.tcl:163>> hsetprop /graphics/powder_diagram/two_theta transfer zip +sim/powder/hrpt.tcl:164>> hsetprop /graphics/powder_diagram/two_theta dim 0 +sim/powder/hrpt.tcl:165>> hattach /graphics/powder_diagram banana counts +sim/powder/hrpt.tcl:166>> hsetprop /graphics/powder_diagram/counts type data +sim/powder/hrpt.tcl:167>> hsetprop /graphics/powder_diagram/counts transfer zip +sim/powder/hrpt.tcl:168>> hsetprop /graphics/powder_diagram/counts priv internal +sim/powder/hrpt.tcl:169>> sicspoll add /graphics/powder_diagram/counts hdb 60 +sim/powder/hrpt.tcl:170>> hfactory /quickview plain spy none +ERROR: duplicate exe manager not created +sim/powder/hrpt.tcl:171>> sicsdatafactory new hmdata +sim/powder/hrpt.tcl:172>> sicsdatafactory new effdata +sim/powder/hrpt.tcl:173>> MakeOscillator a3osc som +sim/powder/hrpt.tcl:174>> commandlog auto +sim/powder/hrpt.tcl:175>> MakeScanCommand xxxscan counter $scripthome/hrpt.hdd recover.bin +sim/powder/hrpt.tcl:176>> MakePeakCenter xxxscan +sim/powder/hrpt.tcl:177>> sicscron 10 backupCron $datahome/statusHistory +sim/powder/hrpt.tcl:178>> clientput "Finished initializing HRPT" +Finished initializing HRPT OK +==23429== Invalid read of size 1 +==23429== at 0x400630E: strcmp (mc_replace_strmem.c:341) +==23429== by 0x80FEED0: compareHdbValue (hipadaba.c:430) +==23429== by 0x8115EDC: pollHdb (polldriv.c:38) +==23429== by 0x81165EA: PollTask (sicspoll.c:135) +==23429== by 0x8058CEA: TaskSchedule (task.c:211) +==23429== by 0x80576F9: RunServer (nserver.c:406) +==23429== by 0x8057BFB: main (SICSmain.c:62) +==23429== Address 0x42B6E08 is 0 bytes inside a block of size 8 free'd +==23429== at 0x4004FDA: free (vg_replace_malloc.c:233) +==23429== by 0x8104291: readHdbValue (sicshipadaba.c:1829) +==23429== by 0x8101A71: SICSScriptReadCallback (sicshipadaba.c:734) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFD3B: GetHipadabaPar (hipadaba.c:895) +==23429== by 0x8115E89: pollHdb (polldriv.c:37) +==23429== by 0x81165EA: PollTask (sicspoll.c:135) +==23429== by 0x8058CEA: TaskSchedule (task.c:211) +==23429== by 0x80576F9: RunServer (nserver.c:406) +==23429== by 0x8057BFB: main (SICSmain.c:62) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0x8105700: HdbNodeInfo (sicshipadaba.c:2356) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x30DF60: (within /usr/lib/libtcl8.4.so) +==23429== by 0x311D9B: TclCompEvalObj (in /usr/lib/libtcl8.4.so) +==23429== by 0x33E86B: TclObjInterpProc (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x30DF60: (within /usr/lib/libtcl8.4.so) +==23429== by 0x311D9B: TclCompEvalObj (in /usr/lib/libtcl8.4.so) +==23429== by 0x33E86B: TclObjInterpProc (in /usr/lib/libtcl8.4.so) +==23429== +==23429== Invalid read of size 1 +==23429== at 0x400632E: strcmp (mc_replace_strmem.c:341) +==23429== by 0x80FEED0: compareHdbValue (hipadaba.c:430) +==23429== by 0x8115EDC: pollHdb (polldriv.c:38) +==23429== by 0x81165EA: PollTask (sicspoll.c:135) +==23429== by 0x8058CEA: TaskSchedule (task.c:211) +==23429== by 0x80576F9: RunServer (nserver.c:406) +==23429== by 0x8057BFB: main (SICSmain.c:62) +==23429== Address 0x45BC419 is 1 bytes inside a block of size 7 free'd +==23429== at 0x4004FDA: free (vg_replace_malloc.c:233) +==23429== by 0x8104291: readHdbValue (sicshipadaba.c:1829) +==23429== by 0x8101A71: SICSScriptReadCallback (sicshipadaba.c:734) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFD3B: GetHipadabaPar (hipadaba.c:895) +==23429== by 0x8115E89: pollHdb (polldriv.c:37) +==23429== by 0x81165EA: PollTask (sicspoll.c:135) +==23429== by 0x8058CEA: TaskSchedule (task.c:211) +==23429== by 0x80576F9: RunServer (nserver.c:406) +==23429== by 0x8057BFB: main (SICSmain.c:62) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27CE9: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F511: SCWriteZipped (conman.c:1231) +==23429== by 0x8100C1B: sendZippedNodeData (sicshipadaba.c:414) +==23429== by 0x81051D8: ZipGetHdbNode (sicshipadaba.c:2229) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x80F7C2D: ContextDo (protocol.c:200) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x804FF53: SCInvoke (conman.c:1604) +==23429== by 0x8051333: SCTaskFunction (conman.c:2097) +==23429== by 0x8058CEA: TaskSchedule (task.c:211) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27CE9: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100C1B: sendZippedNodeData (sicshipadaba.c:414) +==23429== by 0x81051D8: ZipGetHdbNode (sicshipadaba.c:2229) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x80F7C2D: ContextDo (protocol.c:200) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x804FF53: SCInvoke (conman.c:1604) +==23429== by 0x8051333: SCTaskFunction (conman.c:2097) +==23429== by 0x8058CEA: TaskSchedule (task.c:211) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D70: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D82: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D91: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27DA3: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27DB2: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D3C: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D4F: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D61: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0xD25B91: compress2 (in /usr/lib/libz.so.1.2.3) +==23429== by 0x82B37D7: H5Z_filter_deflate (in /afs/psi.ch/user/k/koennecke/src/workspace/sics/SICServer) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D70: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F511: SCWriteZipped (conman.c:1231) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D70: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D82: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D91: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27DA3: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27DB2: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D3C: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D4F: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== Conditional jump or move depends on uninitialised value(s) +==23429== at 0xD27D61: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD28EA0: (within /usr/lib/libz.so.1.2.3) +==23429== by 0xD282D6: deflate (in /usr/lib/libz.so.1.2.3) +==23429== by 0x804F7C6: SCWriteZipped (conman.c:1287) +==23429== by 0x8100B0F: sendZippedNodeData (sicshipadaba.c:394) +==23429== by 0x8100EE0: SICSNotifyCallback (sicshipadaba.c:494) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFC67: UpdateHipadabaPar (hipadaba.c:876) +==23429== by 0x81146E7: HMDataGetCallback (sicshdbadapter.c:339) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== +==23429== ERROR SUMMARY: 59345 errors from 22 contexts (suppressed: 17 from 1) +==23429== malloc/free: in use at exit: 247,513 bytes in 3,132 blocks. +==23429== malloc/free: 8,290,472 allocs, 8,287,340 frees, 310,185,272 bytes allocated. +==23429== For counts of detected errors, rerun with: -v +==23429== searching for pointers to 3,132 not-freed blocks. +==23429== checked 566,520 bytes. +==23429== +==23429== +==23429== 8 bytes in 1 blocks are definitely lost in loss record 2 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x80FF25C: MakeHipadabaNode (hipadaba.c:546) +==23429== by 0x8114732: MakeHMDataNode (sicshdbadapter.c:350) +==23429== by 0x8115658: SICSHdbAdapter (sicshdbadapter.c:701) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E18C6: Tcl_EvalEx (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E1BAB: Tcl_Eval (in /usr/lib/libtcl8.4.so) +==23429== by 0x8059FE8: MacroFileEval (macro.c:540) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== +==23429== +==23429== 8 bytes in 1 blocks are definitely lost in loss record 3 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x8082E96: CreateCallBackInterface (callback.c:85) +==23429== by 0x80B0E03: MakeConfigurableVirtualMotor (confvirtualmot.c:470) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E18C6: Tcl_EvalEx (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E1BAB: Tcl_Eval (in /usr/lib/libtcl8.4.so) +==23429== by 0x8059FE8: MacroFileEval (macro.c:540) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x805CD19: InitObjectCommands (ofac.c:481) +==23429== +==23429== +==23429== 32 bytes in 1 blocks are definitely lost in loss record 11 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x8082BBD: CreateDrivableInterface (interface.c:74) +==23429== by 0x80B0D4E: MakeConfigurableVirtualMotor (confvirtualmot.c:451) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E18C6: Tcl_EvalEx (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E1BAB: Tcl_Eval (in /usr/lib/libtcl8.4.so) +==23429== by 0x8059FE8: MacroFileEval (macro.c:540) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x805CD19: InitObjectCommands (ofac.c:481) +==23429== +==23429== +==23429== 36 bytes in 3 blocks are definitely lost in loss record 13 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x812D4E1: NewSIMCounter (simcter.c:331) +==23429== by 0x812E721: MakeCounter (counter.c:528) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x30DF60: (within /usr/lib/libtcl8.4.so) +==23429== by 0x311D9B: TclCompEvalObj (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E2454: Tcl_EvalObjEx (in /usr/lib/libtcl8.4.so) +==23429== by 0x2EEF46: Tcl_IfObjCmd (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== +==23429== +==23429== 45 bytes in 6 blocks are definitely lost in loss record 15 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x16DB7F: strdup (in /lib/libc-2.5.so) +==23429== by 0x812CBDA: CreateCounterDriver (countdriv.c:59) +==23429== by 0x812D4BD: NewSIMCounter (simcter.c:325) +==23429== by 0x8082A3D: CreateSIMHM (histsim.c:281) +==23429== by 0x807E3ED: CreateHistMemory (histmem.c:459) +==23429== by 0x807E647: MakeHistMemory (histmem.c:545) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x30DF60: (within /usr/lib/libtcl8.4.so) +==23429== +==23429== +==23429== 192 (60 direct, 132 indirect) bytes in 5 blocks are definitely lost in loss record 18 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x8068F92: ListInit (lld.c:76) +==23429== by 0x8069352: LLDcreate (lld.c:196) +==23429== by 0x8082EBD: CreateCallBackInterface (callback.c:92) +==23429== by 0x80B0E03: MakeConfigurableVirtualMotor (confvirtualmot.c:470) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E18C6: Tcl_EvalEx (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E1BAB: Tcl_Eval (in /usr/lib/libtcl8.4.so) +==23429== by 0x8059FE8: MacroFileEval (macro.c:540) +==23429== +==23429== +==23429== 137 (36 direct, 101 indirect) bytes in 1 blocks are definitely lost in loss record 20 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x80BF1F6: MakeExeManager (exeman.c:81) +==23429== by 0x8059600: SicsUnknownProc (macro.c:185) +==23429== by 0x2DF95D: TclInvokeStringCommand (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E130A: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E13FA: TclEvalObjvInternal (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E18C6: Tcl_EvalEx (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E1BAB: Tcl_Eval (in /usr/lib/libtcl8.4.so) +==23429== by 0x8059FE8: MacroFileEval (macro.c:540) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x805CD19: InitObjectCommands (ofac.c:481) +==23429== by 0x8056F1E: InitServer (nserver.c:128) +==23429== +==23429== +==23429== 48 (24 direct, 24 indirect) bytes in 2 blocks are definitely lost in loss record 21 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x8068FEE: ListInit (lld.c:87) +==23429== by 0x8069352: LLDcreate (lld.c:196) +==23429== by 0x804D8A3: CreateConnection (conman.c:175) +==23429== by 0x804DACB: SCCreateDummyConnection (conman.c:241) +==23429== by 0x8100482: SICSReadDriveCallback (sicshipadaba.c:230) +==23429== by 0x80FE75D: InvokeCallbackChain (hipadaba.c:155) +==23429== by 0x80FFBDD: SendDataMessage (hipadaba.c:866) +==23429== by 0x80FFD3B: GetHipadabaPar (hipadaba.c:895) +==23429== by 0x8105349: GetHdbNode (sicshipadaba.c:2268) +==23429== by 0x805248A: InterpExecute (SCinter.c:322) +==23429== by 0x80F7C2D: ContextDo (protocol.c:200) +==23429== +==23429== +==23429== 8,000 bytes in 1 blocks are possibly lost in loss record 24 of 26 +==23429== at 0x40053C0: malloc (vg_replace_malloc.c:149) +==23429== by 0x2DEECC: TclpAlloc (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E68B4: Tcl_Alloc (in /usr/lib/libtcl8.4.so) +==23429== by 0x311F7C: TclCreateExecEnv (in /usr/lib/libtcl8.4.so) +==23429== by 0x2E3F42: Tcl_CreateInterp (in /usr/lib/libtcl8.4.so) +==23429== by 0x8059930: MacroInit (macro.c:321) +==23429== by 0x8051D8D: InitInterp (SCinter.c:101) +==23429== by 0x8056E3B: InitServer (nserver.c:109) +==23429== by 0x8057BCD: main (SICSmain.c:54) +==23429== +==23429== LEAK SUMMARY: +==23429== definitely lost: 249 bytes in 20 blocks. +==23429== indirectly lost: 257 bytes in 17 blocks. +==23429== possibly lost: 8,000 bytes in 1 blocks. +==23429== still reachable: 239,007 bytes in 3,094 blocks. +==23429== suppressed: 0 bytes in 0 blocks. +==23429== Reachable blocks (those to which a pointer was found) are not shown. +==23429== To see them, rerun with: --show-reachable=yes