diff --git a/amorset.c b/amorset.c index e382e9e..32a9478 100644 --- a/amorset.c +++ b/amorset.c @@ -416,7 +416,7 @@ static int amorSetSave(void *data, char *name, FILE * fd) saveAmorComp(fd, name, "chopper", &self->chopper); saveAmorComp(fd, name, "mono", &self->M); saveAmorComp(fd, name, "ds", &self->DS); - saveAmorComp(fd, name, "slit1", &self->D2); + saveAmorComp(fd, name, "slit1", &self->D1); saveAmorComp(fd, name, "slit2", &self->D2); saveAmorComp(fd, name, "slit3", &self->D3); saveAmorComp(fd, name, "sample", &self->S); diff --git a/amorstat.c b/amorstat.c index 439a391..87b7080 100644 --- a/amorstat.c +++ b/amorstat.c @@ -23,6 +23,10 @@ Support for new HTTP HM added Mark Koennecke, July 2006 + + Lightly ammended for the new second generation HM module. + + Mark koennecke, May 2009 --------------------------------------------------------------------------*/ #include #include @@ -41,6 +45,7 @@ #include "lld.h" #include "amorstat.i" #include "amorstat.h" +#include "sicshipadaba.h" /*------------------------------------------------------------------- Manually from SinqHM_def.h --------------------------------------------------------------------*/ @@ -60,7 +65,8 @@ static int HMCountStartCallback(int iEvent, void *pEvent, void *pUser) const float *fTime = NULL; int *iTime = NULL; int iLength, iRet, i; - + pHdb tbin = NULL; + /* check kill condition */ if (pCon == NULL || !SCisConnected(pCon)) { return -1; @@ -69,14 +75,28 @@ static int HMCountStartCallback(int iEvent, void *pEvent, void *pUser) if (iEvent == COUNTSTART) { /* send current time binning */ iTOF = 1; - fTime = GetHistTimeBin(pHMHM, &iLength); - iTime = (int *) malloc((iLength + 1) * sizeof(int)); - if ((!fTime) || (!iTime)) { - return 0; - } - iTime[0] = htonl(iLength); - for (i = 0; i < iLength; i++) { - iTime[i + 1] = htonl((int) ((fTime[i] / 10.) * 65536.)); + if(pHMHM->pDes->parNode != NULL){ + tbin = GetHipadabaNode(pHMHM->pDes->parNode,"time_binning"); + assert(tbin != NULL); + iLength = tbin->value.arrayLength; + iTime = (int *) malloc((iLength + 1) * sizeof(int)); + if ((!iTime)) { + return 0; + } + iTime[0] = htonl(iLength); + for (i = 0; i < iLength; i++) { + iTime[i + 1] = htonl( (int) ( (tbin->value.v.floatArray[i]) / 10.) * 65536.) ; + } + } else { + fTime = GetHistTimeBin(pHMHM, &iLength); + iTime = (int *) malloc((iLength + 1) * sizeof(int)); + if ((!fTime) || (!iTime)) { + return 0; + } + iTime[0] = htonl(iLength); + for (i = 0; i < iLength; i++) { + iTime[i + 1] = htonl((int) ((fTime[i] / 10.) * 65536.)); + } } /* send new time binning to all clients */ SCWrite(pCon, "TOFClear", eError); @@ -681,7 +701,7 @@ static int projectYTOF(pAmorStat self, SConnection * pCon) /*----------------------------------------------------------------- SendSingleTOF sends single detector data for TOF mode -*/ +--------------------------------------------------------------------*/ static int SendSingleTOF(pAmorStat self, SConnection * pCon) { @@ -753,7 +773,7 @@ static int SendSingleTOF(pAmorStat self, SConnection * pCon) /*------------------------------------------------------------------- SubSample sums histogram data in the area defined by the rectangle x1,y1 x2, y2. Summing is along the time axis. -*/ +----------------------------------------------------------------------*/ static int SubSample(pAmorStat self, SConnection * pCon, char *name, int x1, int x2, int y1, int y2) { diff --git a/make_gen b/make_gen index c480b99..1c670d0 100644 --- a/make_gen +++ b/make_gen @@ -23,7 +23,7 @@ OBJ=psi.o buffer.o ruli.o dmc.o nxsans.o nextrics.o sps.o pimotor.o \ dgrambroadcast.o sinq.o tabledrive.o tcpdocho.o julcho.o \ ritastorage.o poldizug.o audinelib.o delcam.o el737hpdrivsps.o \ rebin.o sanslirebin.o lmd200.o slsvme.o julprot.o sinqhttpprot.o \ - pmacprot.o pfeifferprot.o + pmacprot.o pfeifferprot.o termprot.o .SECONDARY.: sanslirebin.c diff --git a/poldizug.c b/poldizug.c index 98d0ee4..a41a28a 100644 --- a/poldizug.c +++ b/poldizug.c @@ -23,7 +23,6 @@ typedef struct { pIDrivable pDriv; prs232 controller; int iMode; - int state; float maxForce, minForce; float maxPos, minPos; int velocity; @@ -149,7 +148,6 @@ static long PZRSetValue(void *data, SConnection * pCon, float val) switch (self->iMode) { case FORCE: - if (self->state == OFF) { snprintf(command, 79, "wr vel %d\r\n", self->velocity); status = PZRCommand(self->controller, pCon, command, reply, 79); if (status != 1) { @@ -165,19 +163,9 @@ static long PZRSetValue(void *data, SConnection * pCon, float val) if (status != 1) { return HWFault; } - self->state = REGEL; return OKOK; - } else { - snprintf(command, 79, "wr force %f\r\n", val); - status = PZRCommand(self->controller, pCon, command, reply, 79); - if (status != 1) { - return HWFault; - } - return OKOK; - } break; case ZUGPOS: - self->state = OFF; snprintf(command, 79, "wr vel %d\r\n", self->velocity); status = PZRCommand(self->controller, pCon, command, reply, 79); if (status != 1) { @@ -325,7 +313,6 @@ static int PZRConnect(pPZR self, SConnection * pCon) int status; closeRS232(self->controller); - self->state = OFF; status = initRS232(self->controller); if (status < 0) { getRS232Error(status, error, 131); @@ -451,7 +438,6 @@ static int PoldiReissAction(SConnection * pCon, SicsInterp * pSics, } else if (strcmp(argv[1], "off") == 0) { status = PZRCommand(self->controller, pCon, "wr mode 0\r\n", reply, 79); - self->state = OFF; if (status == 1) { SCSendOK(pCon); return 1; @@ -519,7 +505,6 @@ int MakePoldiReiss(SConnection * pCon, SicsInterp * pSics, self->minPos = atof(argv[6]); self->maxPos = atof(argv[7]); self->iMode = FORCE; - self->state = OFF; self->velocity = 2; PZRCommand(self->controller, pCon, "wr mode 0\r\n", reply, 79); diff --git a/polterwrite.c b/polterwrite.c index 3db6b1d..4b175e3 100644 --- a/polterwrite.c +++ b/polterwrite.c @@ -230,6 +230,7 @@ static void PoldiStart(pPolterdi self, SConnection * pCon) pMotor sa; HistInt *lData = NULL; long lVal; + pCounter pCount; /* create filename */ self->pFile = SNXMakeFileName(pServ->pSics, pCon); @@ -255,7 +256,7 @@ static void PoldiStart(pPolterdi self, SConnection * pCon) } if (scancheck == 0) { sprintf(pBueffel, "Writing %s ......", self->pFile); - SCWrite(pCon, pBueffel, eWarning); + SCWrite(pCon, pBueffel, eLog); } @@ -406,19 +407,24 @@ static void PoldiStart(pPolterdi self, SConnection * pCon) /* write counting data */ - fVal = GetHistCountTime(self->pHist, pCon); - NXDputalias(hfil, hdict, "cntime", &fVal); - lVal = GetHistMonitor(self->pHist, 1, pCon); - NXDputalias(hfil, hdict, "cnmon1", &lVal); - eMode = GetHistCountMode(self->pHist); - if (eMode == eTimer) { - strcpy(pBueffel, "timer"); + pCount = (pCounter)FindCommandData(pServ->pSics,"counter","SingleCounter"); + if(pCount){ + fVal = GetCountTime(pCount, pCon); + NXDputalias(hfil, hdict, "cntime", &fVal); + lVal = GetMonitor(pCount, 1, pCon); + NXDputalias(hfil, hdict, "cnmon1", &lVal); + eMode = GetCounterMode(pCount); + if (eMode == eTimer) { + strcpy(pBueffel, "timer"); + } else { + strcpy(pBueffel, "monitor"); + } + NXDputalias(hfil, hdict, "cnmode", pBueffel); + fVal = GetCounterPreset(pCount); + NXDputalias(hfil, hdict, "cnpreset", &fVal); } else { - strcpy(pBueffel, "monitor"); + SCWrite(pCon,"ERROR: counter not found writing data file", eLogError); } - NXDputalias(hfil, hdict, "cnmode", pBueffel); - fVal = GetHistPreset(self->pHist); - NXDputalias(hfil, hdict, "cnpreset", &fVal); /* close everything */ NXclose(&hfil); @@ -446,6 +452,7 @@ static void PoldiUpdate(pPolterdi self, SConnection * pCon) HistInt *lData = NULL; long lVal; time_t zeit; + pCounter pCount = NULL; /* open everything again */ status = NXopen(self->pFile, NXACC_RDWR, &hfil); @@ -513,21 +520,24 @@ static void PoldiUpdate(pPolterdi self, SConnection * pCon) /* write counting data */ - fVal = GetHistCountTime(self->pHist, pCon); - NXDputalias(hfil, hdict, "cntime", &fVal); - lVal = GetHistMonitor(self->pHist, 1, pCon); - NXDputalias(hfil, hdict, "cnmon1", &lVal); - lVal = GetHistMonitor(self->pHist, 4, pCon); - NXDputalias(hfil, hdict, "cnprot", &lVal); - eMode = GetHistCountMode(self->pHist); - if (eMode == eTimer) { - strcpy(pBueffel, "timer"); + pCount = (pCounter)FindCommandData(pServ->pSics,"counter","SingleCounter"); + if(pCount){ + fVal = GetCountTime(pCount, pCon); + NXDputalias(hfil, hdict, "cntime", &fVal); + lVal = GetMonitor(pCount, 1, pCon); + NXDputalias(hfil, hdict, "cnmon1", &lVal); + eMode = GetCounterMode(pCount); + if (eMode == eTimer) { + strcpy(pBueffel, "timer"); + } else { + strcpy(pBueffel, "monitor"); + } + NXDputalias(hfil, hdict, "cnmode", pBueffel); + fVal = GetCounterPreset(pCount); + NXDputalias(hfil, hdict, "cnpreset", &fVal); } else { - strcpy(pBueffel, "monitor"); + SCWrite(pCon,"ERROR: counter not found writing data file", eLogError); } - NXDputalias(hfil, hdict, "cnmode", pBueffel); - fVal = GetHistPreset(self->pHist); - NXDputalias(hfil, hdict, "cnpreset", &fVal); /* close everything */ diff --git a/psi.c b/psi.c index 107cf14..c65db6d 100644 --- a/psi.c +++ b/psi.c @@ -83,6 +83,8 @@ extern void AddHttpProtocoll(); extern void AddPMACProtocoll(); /* from pfeifferprot.c */ extern void AddPfeifferProtocoll(); +/* from termprot.c */ +extern void AddTermProtocoll(); /*--------------------------------------------------------------------------*/ void SiteInit(void) @@ -111,6 +113,7 @@ void SiteInit(void) AddHttpProtocoll(); AddPMACProtocoll(); AddPfeifferProtocoll(); + AddTermProtocoll(); } diff --git a/sanslirebin.c b/sanslirebin.c index e6da2a9..9878f89 100644 --- a/sanslirebin.c +++ b/sanslirebin.c @@ -72,6 +72,26 @@ static double sansround(double d) } } /*---------------------------------------------------------------------------*/ +typedef struct { + int idx; + double frac; +}MediSort; +/*---------------------------------------------------------------------------*/ +static int MediCompare(const void *v1, const void *v2) +{ + MediSort *m1, *m2; + + m1 = (MediSort *)v1; + m2 = (MediSort *)v2; + if(m1->frac > m2->frac){ + return -1; + } else if (m1->frac == m2->frac ){ + return 0; + } else { + return 1; + } +} +/*---------------------------------------------------------------------------*/ int SansliRebin(SConnection * pCon, SicsInterp * pSics, void *pData, int argc, char *argv[]) { @@ -80,9 +100,11 @@ int SansliRebin(SConnection * pCon, SicsInterp * pSics, void *pData, int iDim[2], ix, iy, pos, ival, xDetDim[2], yDetDim[2], nDetX, nDetY, posIdx; long totalCounts = 0; - double x, y, val, *xPos = NULL, *yPos = NULL, corrSum = .0, doubleCounts; + double x, y, val, *xPos = NULL, *yPos = NULL, corrSum = .0, doubleCounts, sumFrac; + double low, frac; float detectorDistance; - + MediSort *sortData; + if (argc < 2) { SCWrite(pCon, "ERROR: Not enough arguments", eError); return 0; @@ -111,7 +133,8 @@ int SansliRebin(SConnection * pCon, SicsInterp * pSics, void *pData, weights = createNXDataset(2, NX_FLOAT64, iDim); xPos = malloc(nDetX * nDetY * sizeof(double)); yPos = malloc(nDetX * nDetY * sizeof(double)); - if (dataset == NULL || weights == NULL || xPos == NULL || yPos == NULL) { + sortData = malloc(iDim[0]*iDim[1]*sizeof(MediSort)); + if (dataset == NULL || weights == NULL || xPos == NULL || yPos == NULL || sortData == NULL) { SCWrite(pCon, "ERROR: out of memory allocating temporary data", eError); return 0; @@ -156,18 +179,43 @@ int SansliRebin(SConnection * pCon, SicsInterp * pSics, void *pData, corrSum += dataset->u.dPtr[ix]; } doubleCounts = (double) totalCounts; + + /* + * distribute counts + */ + sumFrac = .0; for (ix = 0; ix < 128 * 128; ix++, pos++) { if (corrSum > .01) { - val = sansround(dataset->u.dPtr[ix] * doubleCounts / corrSum); + val = dataset->u.dPtr[ix] * doubleCounts / corrSum; + low = floor(val); + frac = val - low; + sumFrac += frac; + val = low; + sortData[ix].idx = pos; + sortData[ix].frac = frac; } else { val = .0; } setSICSDataInt(target, pos, (int) val); } + /* + * apply median correction + */ + qsort(sortData, iDim[0]*iDim[1], sizeof(MediSort), MediCompare); + ix = 0; + while(sumFrac > .0){ + pos = sortData[ix].idx; + getSICSDataInt(target,pos,&ival); + setSICSDataInt(target,pos,ival+1); + ix++; + sumFrac -= 1.; + } + dropNXDataset(dataset); dropNXDataset(weights); free(xPos); free(yPos); + free(sortData); SCSendOK(pCon); return 1; } diff --git a/sanswave.c b/sanswave.c index 990f2ef..f2ba265 100644 --- a/sanswave.c +++ b/sanswave.c @@ -16,14 +16,32 @@ #include "motor.h" #include "velo.h" #include "sanswave.h" +#include "sicshipadaba.h" #define NOTILT 801 +static int SWGetTilt(void *data, float *fTilt) +{ + pDummy pDum = (pDummy)data; + pHdb node = NULL; + + if(strcmp(pDum->pDescriptor->name,"VelocitySelector") == 0) { + return VSGetTilt((pVelSel)data, fTilt); + } else if(strcmp(pDum->pDescriptor->name,"NVS") == 0){ + node = GetHipadabaNode(pDum->pDescriptor->parNode,"tilt"); + assert(node != NULL); + *fTilt = (float)node->value.v.doubleValue; + return 1; + } else { + assert(0); + } + return 0; +} /*-----------------------------------------------------------------------*/ typedef struct __SANSwave { pObjectDescriptor pDes; pIDrivable pDrivInt; - pVelSel pSelector; + void *pSelector; } SANSWave; /*-----------------------------------------------------------------------*/ @@ -89,7 +107,7 @@ static int SWLimits(void *pData, float fVal, char *error, int iErrLen) assert(pDriv); /* get tilt */ - iRet = VSGetTilt(self->pSelector, &fTilt); + iRet = SWGetTilt(self->pSelector, &fTilt); if (!iRet) { strncpy(error, "Failed to obtain tilt angle", iErrLen); return 0; @@ -119,7 +137,7 @@ static long SWSet(void *pData, SConnection * pCon, float fVal) /* get tilt */ fTilt = -910; for (i = 0; i < 3; i++) { - iRet = VSGetTilt(self->pSelector, &fTilt); + iRet = SWGetTilt(self->pSelector, &fTilt); if (iRet) { break; } else { @@ -169,7 +187,7 @@ static float SWGetValue(void *pData, SConnection * pCon) /* get tilt */ fTilt = -910; for (i = 0; i < 3; i++) { - iRet = VSGetTilt(self->pSelector, &fTilt); + iRet = SWGetTilt(self->pSelector, &fTilt); if (iRet) { break; } else { @@ -182,8 +200,8 @@ static float SWGetValue(void *pData, SConnection * pCon) } /* get rotation speed */ - iRet = VSGetRotation(self->pSelector, &fRot); - if (!iRet) { + fRot = pDriv->GetValue(self->pSelector, pCon); + if (fRot < -9999.) { SCWrite(pCon, "ERROR: cannot reading rotation speed", eError); return -99999.99; } @@ -262,7 +280,7 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData, KillSANSWave(pNew); return 0; } - pNew->pSelector = (pVelSel) pCom->pData; + pNew->pSelector = pCom->pData; if (!pNew->pSelector) { sprintf(pBueffel, "ERROR: velocity selector %s is invalid", argv[2]); SCWrite(pCon, pBueffel, eError); @@ -270,7 +288,8 @@ int MakeSANSWave(SConnection * pCon, SicsInterp * pSics, void *pData, return 0; } pDum = (pDummy) pNew->pSelector; - if (strcmp(pDum->pDescriptor->name, "VelocitySelector") != 0) { + if (strcmp(pDum->pDescriptor->name, "VelocitySelector") != 0 + && strcmp(pDum->pDescriptor->name,"NVS") == 0) { sprintf(pBueffel, "ERROR: velocity selector %s is invalid", argv[2]); SCWrite(pCon, pBueffel, eError); KillSANSWave(pNew); @@ -322,7 +341,7 @@ int SANSWaveAction(SConnection * pCon, SicsInterp * pSics, void *pData, if (argc > 2) { strtolower(argv[1]); /* whatever we are asked to do, we need the current tilt angle */ - iRet = VSGetTilt(self->pSelector, &fTilt); + iRet = SWGetTilt(self->pSelector, &fTilt); if (!iRet) { SCWrite(pCon, "ERROR: failed to read tilt angle", eError); return 0; diff --git a/sinqhttpprot.c b/sinqhttpprot.c index 8f29080..7df89a5 100644 --- a/sinqhttpprot.c +++ b/sinqhttpprot.c @@ -7,6 +7,11 @@ * copyright: see file COPYRIGHT * * Mark Koennecke, June 2008 + * + * Expanded to handle post:url:data style and node:path:data syntax + * in preparation for a full second generation HM object. + * + * Mark Koennecke, May 2009 */ #include #include @@ -15,12 +20,14 @@ #include #include #include "uselect.h" +#include "sicshipadaba.h" /*---------------------------------------------------------------------*/ typedef struct { ghttp_request *request; char *userName; char *password; pSICSData binData; + pHdb node; } HttpProt, *pHttpProt; /*---------------------------------------------------------------------*/ static int configRequest(Ascon * a) @@ -28,6 +35,11 @@ static int configRequest(Ascon * a) pHttpProt pHttp = (pHttpProt) a->private; pDynString request; char *uri = NULL; + char *data, *pPtr, *path; + + pHttp->node = NULL; + ghttp_clean(pHttp->request); + ghttp_set_header(pHttp->request, "connection", "keep-alive"); request = CreateDynString(64, 64); if (request == NULL) { @@ -37,12 +49,29 @@ static int configRequest(Ascon * a) DynStringConcat(request, "http://"); DynStringConcat(request, a->hostport); DynStringConcatChar(request, '/'); - DynStringConcat(request, GetCharArray(a->wrBuffer)); + data = GetCharArray(a->wrBuffer); + if(strstr(data,"node:") == data){ + path = strchr(data,':')+1; + uri = strchr(path,':'); + *uri = '\0'; + uri++; + pHttp->node = FindHdbNode(NULL,path,pServ->dummyCon); + DynStringConcat(request,uri); + ghttp_set_type(pHttp->request, ghttp_type_get); + } else if(strstr(data,"post:") == data){ + uri = strchr(data,':') + 1; + pPtr = strchr(uri,':'); + *pPtr = '\0'; + ghttp_set_type(pHttp->request, ghttp_type_post); + DynStringConcat(request,uri); + pPtr++; + ghttp_set_body(pHttp->request,pPtr, strlen(pPtr)); + } else { + ghttp_set_type(pHttp->request, ghttp_type_get); + DynStringConcat(request, GetCharArray(a->wrBuffer)); + } uri = GetCharArray(request); - - ghttp_clean(pHttp->request); - ghttp_set_type(pHttp->request, ghttp_type_get); - ghttp_set_header(pHttp->request, "connection", "keep-alive"); + if (ghttp_set_uri(pHttp->request, uri) < 0) { AsconError(a, "Bad URL", 0); return 0; @@ -82,14 +111,31 @@ static void handleReply(Ascon * a) } } else { hmData = (HistInt *) pPtr; - clearSICSData(pHttp->binData); len = len / sizeof(HistInt); - dataPtr = getSICSDataPointer(pHttp->binData, 0, len); - for (i = 0; i < len; i++) { - dataPtr[i] = htonl(hmData[i]); + if(pHttp->node == NULL){ + clearSICSData(pHttp->binData); + dataPtr = getSICSDataPointer(pHttp->binData, 0, len); + for (i = 0; i < len; i++) { + dataPtr[i] = htonl(hmData[i]); + } + assignSICSType(pHttp->binData, 0, len, INTTYPE); + DynStringCopy(a->rdBuffer, "SICSDATA"); + } else { + if(pHttp->node->value.arrayLength != len){ + if(pHttp->node->value.v.intArray != NULL){ + free(pHttp->node->value.v.intArray); + } + pHttp->node->value.v.intArray = malloc(len*sizeof(int)); + if(pHttp->node->value.v.intArray == NULL){ + AsconError(a,"Out of memory ",0); + return; + } + pHttp->node->value.arrayLength = len; + } + for(i = 0; i < len; i++){ + pHttp->node->value.v.intArray[i] = htonl(hmData[i]); + } } - assignSICSType(pHttp->binData, 0, len, INTTYPE); - DynStringCopy(a->rdBuffer, "SICSDATA"); } } } @@ -133,7 +179,7 @@ static int HttpHandler(Ascon * a) procStatus = ghttp_get_status(pHttp->request); if (procStatus.proc == ghttp_proc_response_hdrs || procStatus.proc == ghttp_proc_response) { - a->state = AsconWriteDone; + a->state = AsconWriteDone; } } a->start = DoubleTime(); @@ -159,12 +205,14 @@ static int HttpHandler(Ascon * a) break; case AsconReading: socke = ghttp_get_socket(pHttp->request); + /* FD_ZERO(&rmask); FD_SET(socke, &rmask); - selStat = select(socke + 1, &rmask, NULL, NULL, &tmo); + selStat = uselect(socke + 1, &rmask, NULL, NULL, &tmo); if (selStat == 0) { return 1; } + */ status = ghttp_process(pHttp->request); switch (status) { case ghttp_not_done: diff --git a/slsvme.c b/slsvme.c index bb0fe61..73315e1 100644 --- a/slsvme.c +++ b/slsvme.c @@ -68,12 +68,12 @@ static int communicateSLS(pSLSDriv self, char *command, if (strstr(reply, "ERROR") != NULL) { pPtr = reply; /* jump over error */ - pPtr = stptok(pPtr, "text", 80, ":"); + pPtr = stptok(pPtr, text, 80, ":"); /* read error number */ - pPtr = stptok(pPtr, "text", 80, ":"); + pPtr = stptok(pPtr, text, 80, ":"); self->iError = atoi(trim(text)); /* read error description */ - pPtr = stptok(pPtr, "text", 80, ":"); + pPtr = stptok(pPtr, text, 80, ":"); strncpy(self->errorText, text, 80); return DEVERR; } diff --git a/tabledrive.c b/tabledrive.c index b037bbc..8f08981 100644 --- a/tabledrive.c +++ b/tabledrive.c @@ -908,8 +908,13 @@ int TableDriveAction(SConnection * pCon, SicsInterp * pSics, void *pData, } return status; } else if (strcmp(argv[1], "show") == 0) { + SCStartBuffering(pCon); showPositions(self, pCon, pBueffel, 1023); SCWrite(pCon, pBueffel, eValue); + print = SCEndBuffering(pCon); + if(print != NULL){ + SCWrite(pCon,GetCharArray(print), eValue); + } return 1; } else if (strcmp(argv[1], "info") == 0) { SCStartBuffering(pCon); diff --git a/tasscan.c b/tasscan.c index 21b1a73..73ee611 100644 --- a/tasscan.c +++ b/tasscan.c @@ -1414,7 +1414,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData, snprintf(pLine, 1023, "%8s %3d Points Scan %3d Scanned Variable(s) %s", pTAS->tasPar[INST]->text, pTAS->pScan->iNP, pTAS->pScan->iScanVar, pWork); - SCWrite(pCon, pLine, eWarning); + SCWrite(pCon, pLine, eLog); if (GetCounterMode(pTAS->pScan->pCounterData) == eTimer) { sprintf(pLine, " %8f Seconds per point", GetCounterPreset(pTAS->pScan->pCounterData)); @@ -1423,7 +1423,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData, GetCounterPreset(pTAS->pScan->pCounterData)); } - SCWrite(pCon, pLine, eWarning); + SCWrite(pCon, pLine, eLog); SCWrite(pCon, " ", eWarning); SCWrite(pCon, " ", eWarning); sprintf(pLine, @@ -1440,7 +1440,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData, (pTAS->pScan->iNP / 2) * pTAS->tasPar[DEN]->fVal, pTAS->tasPar[DQH]->fVal, pTAS->tasPar[DQK]->fVal, pTAS->tasPar[DQL]->fVal, pTAS->tasPar[DEN]->fVal); - SCWrite(pCon, pLine, eWarning); + SCWrite(pCon, pLine, eLog); if (iTas > 0) { if (pTAS->tasPar[FX]->iVal == 1) { sprintf(pLine, " Constant KI Scan: KI= %7.4f Angs-1; EI= %9.4f", @@ -1449,7 +1449,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData, sprintf(pLine, " Constant KF Scan: KF= %7.4f Angs-1; EF= %9.4f", pTAS->tasPar[KF]->fVal, pTAS->tasPar[EF]->fVal); } - SCWrite(pCon, pLine, eWarning); + SCWrite(pCon, pLine, eLog); } /* @@ -1474,7 +1474,7 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData, print a message for Severian Gvassilja */ sprintf(pLine, "Scan finished, data saved to %s", pTAS->pScan->pFile); - SCWrite(pCon, pLine, eWarning); + SCWrite(pCon, pLine, eLog); return status; }