Merge branch 'develop' of ssh://gitorious.psi.ch/sinqdev/sics into develop

Conflicts:
	fourmess.c
This commit is contained in:
2016-01-29 08:53:00 +01:00
50 changed files with 183 additions and 201 deletions

View File

@ -91,9 +91,10 @@ int main(int argc, char *argv[])
printf("Unrecoverable error on server startup, exiting.........\n"); printf("Unrecoverable error on server startup, exiting.........\n");
exit(1); exit(1);
} }
/*
if (daemonize == 1) if (daemonize == 1)
daemon(1, 1); daemon(1, 1);
*/
RunServer(pServ); RunServer(pServ);

View File

@ -40,7 +40,7 @@ static int CreateSocketAdress(struct sockaddr_in *sockaddrPtr, /* Socket addres
(char *) hostent->h_addr_list[0], (size_t) hostent->h_length); (char *) hostent->h_addr_list[0], (size_t) hostent->h_length);
} else { } else {
addr.s_addr = inet_addr(host); addr.s_addr = inet_addr(host);
if (addr.s_addr == (unsigned long) -1) { if (addr.s_addr == (unsigned int) -1) {
return 0; /* error */ return 0; /* error */
} }
} }
@ -73,7 +73,7 @@ void AsconError(Ascon *a, char *msg, int errorno)
char *state; char *state;
char num[8]; char num[8];
if (a->state < 0 || a->state >= AsconMaxState) { if ( a->state >= AsconMaxState) {
state = "bad state"; state = "bad state";
} else { } else {
state = stateText[a->state]; state = stateText[a->state];

View File

@ -146,7 +146,7 @@ static int CreateSocketAdress(struct sockaddr_in *sockaddrPtr, /* Socket addres
(char *) hostent->h_addr_list[0], (size_t) hostent->h_length); (char *) hostent->h_addr_list[0], (size_t) hostent->h_length);
} else { } else {
addr.s_addr = inet_addr(host); addr.s_addr = inet_addr(host);
if (addr.s_addr == (unsigned long) -1) { if (addr.s_addr == (unsigned int) -1) {
return 0; /* error */ return 0; /* error */
} }
} }

View File

@ -238,7 +238,7 @@ int ANETconnect(char *name, int iPort)
} else { } else {
/* check for aaa.bbbb.ccc.dddd */ /* check for aaa.bbbb.ccc.dddd */
addr.s_addr = inet_addr(name); addr.s_addr = inet_addr(name);
if(addr.s_addr == (unsigned long) -1) { if(addr.s_addr == (unsigned int) -1) {
anetLog(ANETERROR, "Failed to locate host: %s", name); anetLog(ANETERROR, "Failed to locate host: %s", name);
return ANETOPENFAIL; return ANETOPENFAIL;
} }

View File

@ -174,8 +174,9 @@ static void KillAdapter(void *pData)
if (self->pInt) if (self->pInt)
free(self->pInt); free(self->pInt);
if (self->pParName) if (self->pParName){
free(self->pParName); free(self->pParName);
}
free(self); free(self);
} }

View File

@ -709,7 +709,7 @@ int ConfigurableVirtualMotorAction(SConnection * pCon, SicsInterp * pSics,
SCSendOK(pCon); SCSendOK(pCon);
return 1; return 1;
} else { } else {
snprintf(pBueffel, 5120, "ERROR: subcommand %s to %s unknown", snprintf(pBueffel, sizeof(pBueffel), "ERROR: subcommand %s to %s unknown",
argv[1], argv[0]); argv[1], argv[0]);
SCWrite(pCon, pBueffel, eError); SCWrite(pCon, pBueffel, eError);
return 0; return 0;

View File

@ -496,7 +496,7 @@ int StopExe(pExeList self, char *name)
assert(self); assert(self);
/* if not active, nothing to do */ /* if not active, nothing to do */
if ((self->pOwner == NULL) ) { if (self->pOwner == NULL ) {
self->iRun = 0; self->iRun = 0;
return 1; return 1;
} }

View File

@ -118,6 +118,8 @@ $\langle$devcheck {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ int DevExecTask(void *pEL);@\\ \mbox{}\verb@ int DevExecTask(void *pEL);@\\
\mbox{}\verb@ void DevExecSignal(void *pEL, int iSignal, void *pSigData);@\\ \mbox{}\verb@ void DevExecSignal(void *pEL, int iSignal, void *pSigData);@\\
\mbox{}\verb@@\\ \mbox{}\verb@@\\
\mbox{}\verb@ int GetDevExecInstStatus(pExeList self);@\\
\mbox{}\verb@@\\
\mbox{}\verb@@$\Diamond$ \mbox{}\verb@@$\Diamond$
\end{list} \end{list}
\vspace{-1ex} \vspace{-1ex}

View File

@ -361,7 +361,7 @@ int DriveWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
ClearExecutor(GetExecutor()); ClearExecutor(GetExecutor());
return 0; return 0;
} }
SCWrite(pCon, "Driving finished sucessfully", eValue); SCWrite(pCon, "Driving finished successfully", eValue);
return 1; return 1;
} }
@ -398,7 +398,7 @@ int RunWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
return 0; return 0;
} }
/* interprete arguments as pairs name value and try to start */ /* interpret arguments as pairs name value and try to start */
for (i = 1; i < argc; i += 2) { for (i = 1; i < argc; i += 2) {
if (argv[i + 1] == NULL) { if (argv[i + 1] == NULL) {
snprintf(pBueffel,511, "ERROR: no value found for driving %s", argv[i]); snprintf(pBueffel,511, "ERROR: no value found for driving %s", argv[i]);

View File

@ -393,7 +393,7 @@ static int FourMessStoreIntern(pSICSOBJ self, SConnection * pCon,
double fHkl[3], double fPosition[4], char *extra) double fHkl[3], double fPosition[4], char *extra)
{ {
pFourMess priv = self->pPrivate; pFourMess priv = self->pPrivate;
float fSum, fSigma, fTemp, fMF, fStep, fPreset; float fSum, fSigma, fTemp, fStep = .0, fPreset =.0, fMF;
int i, iLF, iRet, iNP, ii; int i, iLF, iRet, iNP, ii;
long *lCounts = NULL; long *lCounts = NULL;
pEVControl pEva = NULL; pEVControl pEva = NULL;

View File

@ -19,8 +19,8 @@
#include "HistMem.h" #include "HistMem.h"
#include "HistMem.i" #include "HistMem.i"
#include "HistDriv.i" #include "HistDriv.i"
#include "sicspsi/hardsup/sinqhm.h" #include <hardsup/sinqhm.h>
#include "sicspsi/sinqhmdriv.i" #include <sinqhmdriv.i>
#include "nxdict.h" #include "nxdict.h"
#include "frame.h" #include "frame.h"

View File

@ -1129,7 +1129,7 @@ void HMListOption(pHistMem self, SConnection * pCon)
static pDynString formatTOF(pHistMem self) static pDynString formatTOF(pHistMem self)
{ {
const float *timebin; const float *timebin;
int iLength, i, delay, delta; int iLength, i, delay, delta = .0;
char number[20]; char number[20];
pDynString result = NULL; pDynString result = NULL;

View File

@ -469,9 +469,6 @@ long sumHMDataRectangle(pHistMem hist, SConnection * pCon,
return -1; return -1;
break; break;
} }
if (lSum < 0) {
lSum = -lSum;
}
return lSum; return lSum;
} }

View File

@ -162,7 +162,7 @@ static int RemoveObject(SConnection * con, SicsInterp * sics,
p = strchr(className, ' '); p = strchr(className, ' ');
if (p) { if (p) {
snprintf(shortClassName, sizeof shortClassName, "%.*s", snprintf(shortClassName, sizeof shortClassName, "%.*s",
p - className, className); (int)(p - className), className);
cmdin = (CmdInitializer) GetInitializer("Object", shortClassName); cmdin = (CmdInitializer) GetInitializer("Object", shortClassName);
} }
} }

View File

@ -211,7 +211,7 @@ static int FindLimit(pIntegData self, int iStart, int iSign)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
static int DoIntegrate(pIntegData self, float *fSum, float *fVariance) static int DoIntegrate(pIntegData self, float *fSum, float *fVariance)
{ {
long lLeftBack, lRightBack, lBackMean; long lLeftBack = 0, lRightBack, lBackMean;
int i, iRes = 1; int i, iRes = 1;
float fScan, fBackVar, fLeft, fRight, fN, fNP, fNB, fSumm; float fScan, fBackVar, fLeft, fRight, fN, fNP, fNB, fSumm;
float fMLeft, fMRight; float fMLeft, fMRight;
@ -224,13 +224,11 @@ static int DoIntegrate(pIntegData self, float *fSum, float *fVariance)
for (i = 0, lLeftBack = 0; i < self->iLeft; i++) { for (i = 0, lLeftBack = 0; i < self->iLeft; i++) {
lLeftBack += self->lCounts[i]; lLeftBack += self->lCounts[i];
} }
lLeftBack = lLeftBack;
/* sum the right background */ /* sum the right background */
for (i = self->iRight, lRightBack = 0; i < self->iCounts; i++) { for (i = self->iRight, lRightBack = 0; i < self->iCounts; i++) {
lRightBack += self->lCounts[i]; lRightBack += self->lCounts[i];
} }
lRightBack = lRightBack;
/* sum all of it */ /* sum all of it */

View File

@ -11,3 +11,4 @@ MFLAGS=-f makefile_linux$(DUMMY)
HDFROOT=/usr/local HDFROOT=/usr/local
TCLINC=/usr/include/tcl TCLINC=/usr/include/tcl
EPICS=/usr/local/epics

View File

@ -8,6 +8,9 @@
#FORTIFYOBJ= fortify.o strdup.o #FORTIFYOBJ= fortify.o strdup.o
#DFORTIFY= -pg #DFORTIFY= -pg
MFLAGS=-f makefile_linux$(DUMMY) MFLAGS=-f makefile_macosx
HDFROOT=/usr/pkg
EPICS=/usr/local/epics
EPICSLIBS=-L$(EPICS)/lib/darwin-x86 -lca -lCom
HDFROOT=/Users/Shared

View File

@ -5,8 +5,8 @@
# Markus Zolliker March 2003 # Markus Zolliker March 2003
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
EPICSOBJ=epicsmotor.o #EPICSOBJ=epicsmotor.o
#EPICSOBJ= EPICSOBJ=
COBJ = Sclient.o network.o ifile.o intcli.o $(FORTIFYOBJ) COBJ = Sclient.o network.o ifile.o intcli.o $(FORTIFYOBJ)
SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
@ -70,7 +70,7 @@ all: libmat libhlib libpsi SICServer
full: purge all full: purge all
SICServer: $(OBJ) $(SUBLIBS) SICServer: $(OBJ) $(SUBLIBS)
g++ $(DBG) -o SICServer $(OBJ) $(LIBS) $(CC) $(DBG) -o SICServer $(OBJ) $(LIBS)
matrix/libmatrix.a: libmat matrix/libmatrix.a: libmat

View File

@ -14,7 +14,7 @@ NI=
#NIOBJ= nigpib.o #NIOBJ= nigpib.o
#NILIB=$(SINQDIR)/lib/cib.o #NILIB=$(SINQDIR)/lib/cib.o
include linux_def include $(SICSROOT)/sics/linux_def
CC = gcc CC = gcc
CFLAGS = -I$(HDFROOT)/include -I/usr/include/hdf -I$(TCLINC) -DHDF4 -DHDF5 \ CFLAGS = -I$(HDFROOT)/include -I/usr/include/hdf -I$(TCLINC) -DHDF4 -DHDF5 \

View File

@ -5,6 +5,7 @@
# Mark Koennecke 1996-2001 # Mark Koennecke 1996-2001
# Markus Zolliker, March 2003 # Markus Zolliker, March 2003
# Mark Koennecke, July 2008 # Mark Koennecke, July 2008
# Mark Koennecke, March 2014 for Maverick
#========================================================================== #==========================================================================
# assign if the National Instrument GPIB driver is available # assign if the National Instrument GPIB driver is available
SINQDIR=/Users/Shared SINQDIR=/Users/Shared
@ -12,22 +13,21 @@ SINQDIR=/Users/Shared
#NIOBJ= nigpib.o #NIOBJ= nigpib.o
#NILIB=$(SINQDIR)/sl5/lib/cib.o #NILIB=$(SINQDIR)/sl5/lib/cib.o
SICSROOT=/Users/konnecke/src
include macosx_def include macosx_def
CC = gcc CC = clang
CFLAGS = -I$(HDFROOT)/include -I/sw/include -DNXXML -DHDF5 -DHDF4 $(NI) -DMACOSX \ CFLAGS = -I$(HDFROOT)/include -I/usr/local/include -DNXXML -DHDF5 $(NI) -DMACOSX \
-Ipsi/hardsup -I. \ -I$(SICSROOT)/psi/hardsup -I$(SICSROOT)/sicspsi -I. -I/usr/pkg/include \
-Werror -DNONINTF -g $(DFORTIFY) \ -Werror -DNONINTF -g $(DFORTIFY) \
-Wall -Wno-unused -Wno-comment -Wno-switch -Wall -Wno-unused -Wno-comment -Wno-switch
BINTARGET = bin BINTARGET = bin
EXTRA=nintf.o EXTRA=nintf.o
SUBLIBS = psi/libpsi.a psi/hardsup/libhlib.a matrix/libmatrix.a SUBLIBS = $(SICSROOT)/sicspsi/libpsi.a $(SICSROOT)/sicspsi/hardsup/libhlib.a matrix/libmatrix.a \
LIBS = -L$(HDFROOT)/lib -L/sw/lib $(SUBLIBS) $(NILIB)\ $(SICSROOT)/sicspsi/tecs/libtecsl.a
-ltcl $(HDFROOT)/lib/libhdf5.a -lmfhdf -ldf \ LIBS = -L$(HDFROOT)/lib -L/usr/local/lib $(SUBLIBS) $(NILIB) -L$(EPICS)/lib/darwin-x86 \
$(HDFROOT)/lib/libsz.a \ -ltcl -lhdf5 -lNeXus -ljson -lghttp $(EPICSLIBS) -ldl -lz -lmxml -lm -lc
$(HDFROOT)/lib/libjson.a -ljpeg \
-ldl -lz -lmxml $(HDFROOT)/lib/libghttp.a -lm -lc
include make_gen include make_gen

View File

@ -13,15 +13,15 @@ NIOBJ= nigpib.o
NILIB=$(SINQDIR)/sl6/lib/cib.o NILIB=$(SINQDIR)/sl6/lib/cib.o
EPICSDIR=$(SINQDIR)/sl6/lib/linux-x86 EPICSDIR=$(SINQDIR)/sl6/lib/linux-x86
EPICSLIBS=$(EPICSDIR)/libezca.a $(EPICSDIR)/libca.a $(EPICSDIR)/libCom.a -lreadline -lhistory #EPICSLIBS=$(EPICSDIR)/libezca.a $(EPICSDIR)/libca.a $(EPICSDIR)/libCom.a -lreadline -lhistory
#EPICSLIBS=-L$(EPICSDIR) -lezca -lca -lCom EPICSLIBS=-L$(EPICSDIR) -lezca -lca -lCom
include sllinux_def include sllinux_def
CC = gcc CC = gcc
CFLAGS = -I$(HDFROOT)/include -DNXXML -DHDF5 $(NI) \ CFLAGS = -I$(HDFROOT)/include -DNXXML -DHDF5 $(NI) \
-I$(SICSROOT)/sicspsi/hardsup -I$(SICSROOT) -I. -MMD \ -I$(SICSROOT)/sicspsi -I$(SICSROOT) -I. -MMD \
-Werror -DCYGNUS -DNONINTF $(DBG) $(DFORTIFY) \ -Werror -DCYGNUS -DNONINTF $(DBG) $(DFORTIFY) \
-Wall -Wno-unused -Wunused-value -Wno-comment -Wno-switch -Wall -Wno-unused -Wunused-value -Wno-comment -Wno-switch

View File

@ -1,34 +0,0 @@
#---------------------------------------------------------------------------
# Makefile for the Matrix library
#
# Mark Koennecke, November 1996
#--------------------------------------------------------------------------
OBJ= matadd.o matcreat.o matdet.o matdump.o matdurbn.o materr.o \
matinv.o matmul.o matsolve.o matsub.o matsubx.o mattoepz.o \
mattran.o
#---------- for Redhat linux
#CC= gcc
#CFLAGS= -I/usr/local/include -I. -I../ -DLINUX -g -c
#------------ for DigitalUnix
CC=cc
CFLAGS= -I/data/koenneck/include -I. -I../ -std1 -g -c
#------------ for DigitalUnix with Fortify
#CFLAGS= -I/data/koenneck/include -DFORTIFY -I. -I../ -std1 -g -c
#------------ for CYGNUS toolchain on Win32
#CC=gcc
#CFLAGS= -I. -I../ -DCYGNUS -g -c
.c.o:
$(CC) $(CFLAGS) $*.c
matrix: $(OBJ)
- rm -f libmatrix.a
ar cr libmatrix.a $(OBJ)
ranlib libmatrix.a
clean:
rm -f *.o
rm -f *.a

View File

@ -1,21 +1,34 @@
# M. Zolliker 03.2005 #---------------------------------------------------------------------------
# Makefile for the Matrix library
#
# Mark Koennecke, November 1996
#--------------------------------------------------------------------------
OBJ= matadd.o matcreat.o matdet.o matdump.o matdurbn.o materr.o \
matinv.o matmul.o matsolve.o matsub.o matsubx.o mattoepz.o \
mattran.o
%: usage #---------- for Redhat linux
@echo #CC= gcc
#CFLAGS= -I/usr/local/include -I. -I../ -DLINUX -g -c
%.o: usage #------------ for DigitalUnix
@echo CC=cc
CFLAGS= -I/data/koenneck/include -I. -I../ -std1 -g -c
#------------ for DigitalUnix with Fortify
#CFLAGS= -I/data/koenneck/include -DFORTIFY -I. -I../ -std1 -g -c
default: usage #------------ for CYGNUS toolchain on Win32
#CC=gcc
#CFLAGS= -I. -I../ -DCYGNUS -g -c
usage: .c.o:
@ echo "" $(CC) $(CFLAGS) $*.c
@ echo "Usage:"
@ echo ""
@ echo " make -f makefile_xxx [target]"
@ echo ""
@ echo ' where makefile_xxx is one of'
@ echo ""
@ ls -1 makefile_* | pr -t -o 4
matrix: $(OBJ)
- rm -f libmatrix.a
ar cr libmatrix.a $(OBJ)
ranlib libmatrix.a
clean:
rm -f *.o
rm -f *.a

16
matrix/makefile_macosx Normal file
View File

@ -0,0 +1,16 @@
#---------------------------------------------------------------------------
# Makefile for the Matrix library
#
# Mark Koennecke, November 1996
# Markus Zolliker, March 2003
#--------------------------------------------------------------------------
include ../linux_def
CC = clang
CFLAGS = -g $(DFORTIFY) -MMD
include make_gen
-include $(OBJ:.o=.d)

16
motor.c
View File

@ -1076,22 +1076,6 @@ int MotorCreate(SConnection * pCon, SicsInterp * pSics, void *pData,
SCWrite(pCon, pBueffel, eLogError); SCWrite(pCon, pBueffel, eLogError);
return 0; return 0;
} }
} else if (strcmp(argv[2], "epics") == 0) {
if(argc > 3){
pDriver = epicsMakeMotorDriver(argv[3]);
if (!pDriver) {
return 0;
}
pNew = MotorInit("epics", argv[1], pDriver);
if (!pNew) {
snprintf(pBueffel,sizeof(pBueffel)-1, "Failure to create motor %s", argv[1]);
SCWrite(pCon, pBueffel, eLogError);
return 0;
}
} else {
SCWrite(pCon,"ERROR: missing basename argument to create EPICS motor",eError);
return 0;
}
} else { } else {
site = getSite(); site = getSite();
if (site != NULL) { if (site != NULL) {

View File

@ -123,7 +123,7 @@ static int MMCCStart(void *pData, SConnection * pCon)
static int MMCCStatus(void *pData, SConnection * pCon) static int MMCCStatus(void *pData, SConnection * pCon)
{ {
int status, i; int status = HWIdle, i;
pCounter pCount = NULL, pMaster = NULL;; pCounter pCount = NULL, pMaster = NULL;;
pMultiCounter self = NULL; pMultiCounter self = NULL;
pDummy pDum = NULL; pDummy pDum = NULL;

2
mumo.c
View File

@ -396,7 +396,7 @@ static int ParseAlias(psParser pParse, SConnection * pCon, pMulMot self)
return 1; return 1;
break; break;
default: default:
snprintf(pBueffel,1024, "ERROR: Unexpected symbol %s", pParse->Token); snprintf(pBueffel,sizeof(pBueffel), "ERROR: Unexpected symbol %s", pParse->Token);
SCWrite(pCon, pBueffel, eError); SCWrite(pCon, pBueffel, eError);
return 0; return 0;
} }

View File

@ -98,7 +98,7 @@ static int CreateSocketAdress(struct sockaddr_in *sockaddrPtr, /* Socket addres
(char *) hostent->h_addr_list[0], (size_t) hostent->h_length); (char *) hostent->h_addr_list[0], (size_t) hostent->h_length);
} else { } else {
addr.s_addr = inet_addr(host); addr.s_addr = inet_addr(host);
if (addr.s_addr == (unsigned long) -1) { if (addr.s_addr == (unsigned int) -1) {
return 0; /* error */ return 0; /* error */
} }
} }

View File

@ -1355,7 +1355,7 @@ static int TelnetAcceptCB(int handle, void *userData)
/*------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------*/
static void NREADlog(int level, char *txt, void *userData) static void NREADlog(int level, char *txt, void *userData)
{ {
traceSys("anet",txt); traceSys("anet","%s",txt);
SICSLogWrite(txt, (level == ANETERROR) ? eLogError : eLog); SICSLogWrite(txt, (level == ANETERROR) ? eLogError : eLog);
} }

View File

@ -3829,7 +3829,6 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
swig_module_info *module_head, *iter; swig_module_info *module_head, *iter;
int found; int found;
clientdata = clientdata;
/* check to see if the circular list has been setup, if not, set it up */ /* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next == 0) { if (swig_module.next == 0) {

View File

@ -149,13 +149,12 @@ void DeleteProtocol(void *self)
if (pOld->version) { if (pOld->version) {
free(pOld->version); free(pOld->version);
} }
if (pOld->pProList) { i = 0;
i = 0; while (NULL != pOld->pProList[i]) {
while (NULL != pOld->pProList[i]) {
free(pOld->pProList[i]); free(pOld->pProList[i]);
i++; i++;
}
} }
free(pOld); free(pOld);
} }

View File

@ -1019,7 +1019,7 @@ int RemobCreate(SConnection * pCon, SicsInterp * pSics, void *pData,
SCPrintf(pCon, eError, "ERROR: illegal host:port"); SCPrintf(pCon, eError, "ERROR: illegal host:port");
return 0; return 0;
} }
snprintf(host, sizeof host, "%.*s", p - argv[3], argv[3]); snprintf(host, sizeof host, "%.*s", (int)(p - argv[3]), argv[3]);
remserver = RemServerInit(argv[2], host, atoi(p + 1)); remserver = RemServerInit(argv[2], host, atoi(p + 1));
} }
if (!remserver) { if (!remserver) {

View File

@ -188,7 +188,7 @@ static int StatCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
return 0; return 0;
} }
max = -9999; max = -9999;
min = 99999.99; min = 99999;
length = dim[0]*dim[1]; length = dim[0]*dim[1];
for(i = 0, sum = 0; i < length; i++){ for(i = 0, sum = 0; i < length; i++){
sum += data[i]; sum += data[i];

8
scan.c
View File

@ -152,6 +152,8 @@ pScanData CreateScanObject(char *pRecover, char *pHeader, pCounter pCount,
/* assign various things */ /* assign various things */
if (pRecover) { if (pRecover) {
strlcpy(pNew->pRecover, pRecover,1024); strlcpy(pNew->pRecover, pRecover,1024);
} else {
memset(pNew->pRecover,0,sizeof(pNew->pRecover));
} }
if (pHeader) { if (pHeader) {
strlcpy(pNew->pHeaderFile, pHeader,1024); strlcpy(pNew->pHeaderFile, pHeader,1024);
@ -597,7 +599,7 @@ static int ScanLoop(pScanData self)
InvokeCallBack(self->pCall, SCANPOINT, self); InvokeCallBack(self->pCall, SCANPOINT, self);
self->WriteScanPoints(self, i); self->WriteScanPoints(self, i);
if (self->pRecover) { if (strlen(self->pRecover) > 10) {
WriteRecover(self); WriteRecover(self);
} }
} }
@ -1281,7 +1283,7 @@ static int ScanDynInterest(int iEvent, void *pEventData, void *pUser)
if (pCount != NULL) { if (pCount != NULL) {
lVal = pCount->lCount; lVal = pCount->lCount;
} else { } else {
lVal = -9999.99; lVal = -9999;
} }
snprintf(pBueffel, 255, "%s.scanpoint = {%d %f %ld}", snprintf(pBueffel, 255, "%s.scanpoint = {%d %f %ld}",
self->objectName, i, fVal, lVal); self->objectName, i, fVal, lVal);
@ -1628,7 +1630,7 @@ int ScanWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
float *fData = NULL; float *fData = NULL;
int lNP; int lNP;
int iChannel; int iChannel;
int iRet, iMode, i; int iRet = 0, iMode, i;
char *pPtr = NULL, pItem[20]; char *pPtr = NULL, pItem[20];
long *lData = NULL, lID; long *lData = NULL, lID;
int *iData; int *iData;

View File

@ -553,7 +553,7 @@ static char *SctActionHandler(void *actionData, char *lastReply,
} else { } else {
l = strlen(origScript); l = strlen(origScript);
} }
snprintf(eprop, sizeof eprop, "error_in_%s", origScript); snprintf(eprop, sizeof eprop, "error_in_%.*s", (int)l, origScript);
emsg = GetHdbProp(node, eprop); emsg = GetHdbProp(node, eprop);
cnt = 0; cnt = 0;
if (emsg != NULL) { if (emsg != NULL) {

View File

@ -27,7 +27,7 @@
#include "sicsutil.h" #include "sicsutil.h"
#include "sicshipadaba.h" #include "sicshipadaba.h"
static unsigned int mamaID = 0L; static int mamaID = 0L;
extern char *ParText(Hdb * cmdNode, char *name, extern char *ParText(Hdb * cmdNode, char *name,
int nPar, char *defaultValue); int nPar, char *defaultValue);

View File

@ -376,7 +376,7 @@ int MonoAction(SConnection * pCon, SicsInterp * pSics, void *pData,
pSicsSelector pSelf = NULL; pSicsSelector pSelf = NULL;
TokenList *pList = NULL; TokenList *pList = NULL;
TokenList *pCurrent; TokenList *pCurrent;
int iRet; int iRet = 0;
char pBueffel[132]; char pBueffel[132];
char pName[132]; char pName[132];
float fVal; float fVal;

View File

@ -90,7 +90,7 @@ static int SICSGetCommand(SConnection * pCon, SicsInterp * pSics, void *pData,
} }
} else { } else {
if(v.dataType == HIPTEXT && strstr(v.v.text,"ERROR") != NULL){ if(v.dataType == HIPTEXT && strstr(v.v.text,"ERROR") != NULL){
SCPrintf(pCon,eError,v.v.text); SCPrintf(pCon,eError,"%s",v.v.text);
} else { } else {
SCPrintf(pCon,eError,"ERROR: value for %s not found", argv[1]); SCPrintf(pCon,eError,"ERROR: value for %s not found", argv[1]);
} }

View File

@ -108,7 +108,7 @@ static int MakePlainNode(pHdb parent, char *name, SConnection * pCon,
static int MakeScriptNode(pHdb parent, char *name, SConnection * pCon, static int MakeScriptNode(pHdb parent, char *name, SConnection * pCon,
int argc, char *argv[]) int argc, char *argv[])
{ {
int type, length; int type, length = 0;
pHdb child = NULL; pHdb child = NULL;
hdbValue v; hdbValue v;

View File

@ -2603,7 +2603,7 @@ static int ZipGetHdbNode(SConnection * pCon, SicsInterp * pSics,
{ {
pHdb targetNode = NULL; pHdb targetNode = NULL;
char error[512], oriPath[512]; char error[512], oriPath[512];
int status; int status = 0;
hdbValue newValue; hdbValue newValue;
pDynString parData = NULL, result= NULL; pDynString parData = NULL, result= NULL;
Protocol protocol = normal_protocol; Protocol protocol = normal_protocol;
@ -2651,7 +2651,7 @@ static int ZipReadHdbNode(SConnection * pCon, SicsInterp * pSics,
{ {
pHdb targetNode = NULL; pHdb targetNode = NULL;
char error[512], oriPath[512]; char error[512], oriPath[512];
int status; int status = 0;
pDynString parData = NULL, result= NULL; pDynString parData = NULL, result= NULL;
Protocol protocol = normal_protocol; Protocol protocol = normal_protocol;
OutCode outCode; OutCode outCode;

View File

@ -70,7 +70,7 @@ static MotorFunction TextToFunc(char *txt)
} }
count++; count++;
} }
return -1; return None;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -112,7 +112,7 @@ static int ConfigureCmd(pSICSOBJ self, SConnection * pCon,
} }
mf = TextToFunc(v.v.text); mf = TextToFunc(v.v.text);
if (mf < 0) { if (mf == None) {
SCPrintf(pCon, eError, SCPrintf(pCon, eError,
"ERROR: failed to map %s to configuration parameter", "ERROR: failed to map %s to configuration parameter",
v.v.text); v.v.text);
@ -167,7 +167,7 @@ static int MotorCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
} }
mf = TextToFunc(par[0]->value.v.text); mf = TextToFunc(par[0]->value.v.text);
if (mf < 0) { if (mf == None) {
SCPrintf(pCon, eError, "ERROR: %s is not a four circle motor", SCPrintf(pCon, eError, "ERROR: %s is not a four circle motor",
par[0]->value.v.text); par[0]->value.v.text);
return 0; return 0;
@ -198,7 +198,7 @@ static int MotorNamCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
} }
mf = TextToFunc(par[0]->value.v.text); mf = TextToFunc(par[0]->value.v.text);
if (mf < 0) { if (mf == None) {
SCPrintf(pCon, eError, "ERROR: %s is not a four circle motor", SCPrintf(pCon, eError, "ERROR: %s is not a four circle motor",
par[0]->value.v.text); par[0]->value.v.text);
return 0; return 0;
@ -450,7 +450,7 @@ static int SymRefCmd(pSICSOBJ self, SConnection * pCon, pHdb commandNode,
hkl[2] = equiv.l[i]; hkl[2] = equiv.l[i];
if (priv->diffractometer-> if (priv->diffractometer->
calculateSettings(priv->diffractometer, hkl, settings) == 1) { calculateSettings(priv->diffractometer, hkl, settings) == 1) {
snprintf(buffer, 512, "%d,%d,%d", equiv.h[i], equiv.k[i], snprintf(buffer, sizeof(buffer), "%d,%d,%d", equiv.h[i], equiv.k[i],
equiv.l[i]); equiv.l[i]);
SCWrite(pCon, buffer, eValue); SCWrite(pCon, buffer, eValue);
return 1; return 1;

View File

@ -16,7 +16,7 @@
#include "singlediff.h" #include "singlediff.h"
typedef enum { typedef enum {
TwoTheta, Omega, Chi, Phi, Nu, Sgu, Sgl TwoTheta, Omega, Chi, Phi, Nu, Sgu, Sgl, None
} MotorFunction; } MotorFunction;
pMotor SXGetMotor(MotorFunction m); pMotor SXGetMotor(MotorFunction m);
const char *SXGetMotorName(MotorFunction m); const char *SXGetMotorName(MotorFunction m);

View File

@ -56,7 +56,7 @@ static TokenList *CreateToken(TokenList * pN, TokenList * pP)
static CharType CheckSpecial(char *pWord) static CharType CheckSpecial(char *pWord)
{ {
CharType eRes = eText; CharType eRes = eeText;
int iFlag = 0; int iFlag = 0;
if (isspace(pWord[0])) if (isspace(pWord[0]))

View File

@ -498,11 +498,11 @@ int WriteScanPoints(pScanData self, int iPoint)
strlcat(pSteps, pItem,255); strlcat(pSteps, pItem,255);
} }
} }
strlcat(pLine, " Counts ",1024); strlcat(pLine, " Counts ",sizeof(pLine));
strlcat(pLine, "Monitor1 ",1024); strlcat(pLine, "Monitor1 ",sizeof(pLine));
strlcat(pLine, "Monitor2 ",1024); strlcat(pLine, "Monitor2 ",sizeof(pLine));
strlcat(pLine, "Monitor3 ",1024); strlcat(pLine, "Monitor3 ",sizeof(pLine));
strlcat(pLine, "Time ",1024); strlcat(pLine, "Time ",sizeof(pLine));
strlcat(pInfo, pSteps,1024); strlcat(pInfo, pSteps,1024);
snprintf(pItem,sizeof(pItem)-1, "\n%d Points,", self->iNP); snprintf(pItem,sizeof(pItem)-1, "\n%d Points,", self->iNP);
strlcat(pInfo, pItem,1024); strlcat(pInfo, pItem,1024);
@ -525,7 +525,7 @@ int WriteScanPoints(pScanData self, int iPoint)
pVar = (pVarEntry) pPtr; pVar = (pVarEntry) pPtr;
if (pVar) { if (pVar) {
snprintf(pItem,sizeof(pItem)-1, "%-9.4f ", GetScanVarPos(pVar, i)); snprintf(pItem,sizeof(pItem)-1, "%-9.4f ", GetScanVarPos(pVar, i));
strlcat(pLine, pItem,1024); strlcat(pLine, pItem,sizeof(pLine));
} }
} }
/* print Counts & Monitor */ /* print Counts & Monitor */
@ -533,15 +533,15 @@ int WriteScanPoints(pScanData self, int iPoint)
pData = (pCountEntry) pPtr; pData = (pCountEntry) pPtr;
if (pData) { if (pData) {
snprintf(pItem,sizeof(pItem)-1, " %-11ld ", pData->lCount); snprintf(pItem,sizeof(pItem)-1, " %-11ld ", pData->lCount);
strlcat(pLine, pItem,1024); strlcat(pLine, pItem,sizeof(pLine));
snprintf(pItem,sizeof(pItem)-1, "%-11ld ", pData->Monitors[0]); snprintf(pItem,sizeof(pItem)-1, "%-11ld ", pData->Monitors[0]);
strlcat(pLine, pItem,1024); strlcat(pLine, pItem,sizeof(pLine));
snprintf(pItem,sizeof(pItem)-1, "%-11ld ", pData->Monitors[1]); snprintf(pItem,sizeof(pItem)-1, "%-11ld ", pData->Monitors[1]);
strlcat(pLine, pItem,1024); strlcat(pLine, pItem,sizeof(pLine));
snprintf(pItem,sizeof(pItem)-1, "%-11ld ", pData->Monitors[2]); snprintf(pItem,sizeof(pItem)-1, "%-11ld ", pData->Monitors[2]);
strlcat(pLine, pItem,1024); strlcat(pLine, pItem,sizeof(pLine));
snprintf(pItem,sizeof(pItem)-1, "%-8.3f ", pData->fTime); snprintf(pItem,sizeof(pItem)-1, "%-8.3f ", pData->fTime);
strlcat(pLine, pItem,1024); strlcat(pLine, pItem,sizeof(pLine));
} }
fprintf(self->fd, "%s\n", pLine); fprintf(self->fd, "%s\n", pLine);
} }

View File

@ -184,7 +184,7 @@ static float GetVarFloat(char *name)
static int TASUBHeader(pScanData self) static int TASUBHeader(pScanData self)
{ {
pTASdata pTAS = (pTASdata) self->pSpecial; pTASdata pTAS = (pTASdata) self->pSpecial;
int i, iCount, status, iFileNO; int i, iCount, status, iFileNO = 0;
char pBueffel[1024], pHeader[1024], pWork[132], pWork2[60], pTen[12], char pBueffel[1024], pHeader[1024], pWork[132], pWork2[60], pTen[12],
*pcPtr; *pcPtr;
time_t iDate; time_t iDate;
@ -201,7 +201,7 @@ static int TASUBHeader(pScanData self)
tasReflection r; tasReflection r;
double kfix; double kfix;
pSicsVariable sVar = NULL; pSicsVariable sVar = NULL;
float f1, f2, f3, f4; float f1=.0, f2=.0, f3=.0, f4=.0;
assert(self); assert(self);
assert(pTAS); assert(pTAS);

View File

@ -5,7 +5,7 @@
Mark Koennecke, May 2005, using code from an earlier TASAMAD emulation Mark Koennecke, May 2005, using code from an earlier TASAMAD emulation
core. core.
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
#ifndef SICUBSTAS #ifndef SICSUBTAS
#define SICSUBTAS #define SICSUBTAS
#include <sicsvar.h> #include <sicsvar.h>
#include "tasub.h" #include "tasub.h"

View File

@ -163,7 +163,7 @@ double tasAngleBetweenReflections(MATRIX B, tasReflection r1,
tasReflection r2) tasReflection r2)
{ {
MATRIX chi1, chi2, h1, h2; MATRIX chi1, chi2, h1, h2;
double angle; double angle = .0;
h1 = makeVector(); h1 = makeVector();
if (h1 == NULL) { if (h1 == NULL) {

View File

@ -500,12 +500,12 @@ proc schneggestatus {} {
if {$runtime > $starttime} { if {$runtime > $starttime} {
sct writestatus evalcheck sct writestatus evalcheck
} }
return busy return run
} }
evalcheck { evalcheck {
set tst [hval /sics/farm/schneggerunning] set tst [hval /sics/farm/schneggerunning]
if {$tst == 1} { if {$tst == 1} {
return busy return run
} else { } else {
return idle return idle
} }

View File

@ -421,7 +421,7 @@ static int TraceLogTask(void *data)
memset(pBuffer, 0, sizeof(pBuffer)); memset(pBuffer, 0, sizeof(pBuffer));
strftime(pBuffer, sizeof(pBuffer)-1, "%Y-%m-%d@%H-%M-%S", psTime); strftime(pBuffer, sizeof(pBuffer)-1, "%Y-%m-%d@%H-%M-%S", psTime);
lastTen = tenmin; lastTen = tenmin;
traceSys("TIMESTAMP",pBuffer); traceSys("TIMESTAMP","%s",pBuffer);
} }
return 1; return 1;

View File

@ -588,7 +588,7 @@ int searchIndex(lattice direct, double lambda, double two_theta,
double angleBetweenReflections(MATRIX B, reflection r1, reflection r2) double angleBetweenReflections(MATRIX B, reflection r1, reflection r2)
{ {
MATRIX chi1, chi2, h1, h2; MATRIX chi1, chi2, h1, h2;
double angle; double angle = .0;
h1 = makeVector(); h1 = makeVector();
if (h1 == NULL) { if (h1 == NULL) {