diff --git a/amorscan.c b/amorscan.c index f581d2a..4d11eeb 100644 --- a/amorscan.c +++ b/amorscan.c @@ -31,6 +31,7 @@ { return WriteAmorScan(self->pFile,self->pCon,self); } + return 1; /* guessed return value M.Z. */ } /*--------------------------------------------------------------------*/ static int AmorCollect(pScanData self, int iP) @@ -60,9 +61,9 @@ { fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon); AppendScanVar(pVar,fVal); - sprintf(pItem,"%-10.10s",pVar->Name); + sprintf(pItem," %-9.9s",pVar->Name); strcat(pHead,pItem); - sprintf(pItem,"%-10.3f",fVal); + sprintf(pItem," %-9.3f",fVal); strcat(pStatus,pItem); } } @@ -83,7 +84,7 @@ /* counter1 */ strcat(pHead,"Counter1 "); sCount.lCount = GetCounts((pCounter)self->pCounterData,self->pCon); - sprintf(pItem,"%-15d",sCount.lCount); + sprintf(pItem," %-14ld",sCount.lCount); strcat(pStatus,pItem); /* @@ -96,7 +97,7 @@ strcat(pHead,"Counter2 "); sCount.Monitors[0] = GetMonitor((pCounter)self->pCounterData, 1,self->pCon); - sprintf(pItem,"%-15d",sCount.Monitors[0]); + sprintf(pItem," %-14ld",sCount.Monitors[0]); strcat(pStatus,pItem); /* monitors */ @@ -109,13 +110,13 @@ sCount.fTime = GetCountTime((pCounter)self->pCounterData, self->pCon); strcat(pHead,"Monitor1 "); - sprintf(pItem,"%-12d",sCount.Monitors[3]); + sprintf(pItem," %-11ld",sCount.Monitors[3]); strcat(pStatus,pItem); strcat(pHead,"Monitor2 "); - sprintf(pItem,"%-12d",sCount.Monitors[4]); + sprintf(pItem," %-11ld",sCount.Monitors[4]); strcat(pStatus,pItem); strcat(pHead,"Time "); - sprintf(pItem,"%-6.1f",sCount.fTime); + sprintf(pItem," %-5.1f",sCount.fTime); strcat(pStatus,pItem); /* write progress */ diff --git a/amorstat.c b/amorstat.c index fb422b9..a201b99 100644 --- a/amorstat.c +++ b/amorstat.c @@ -187,6 +187,7 @@ SCWriteUUencoded(pCon,pBueffel,iData,(ud.iNP*2+1)*sizeof(int)); iRet = LLDnodePtr2Next(self->iUserList); } + return 0; } /*------------------------------------------------------------------------*/ static int LoadCallback(int iEvent, void *pEvent, void *pUser) diff --git a/buffer.c b/buffer.c index 2b25383..5b3771a 100644 --- a/buffer.c +++ b/buffer.c @@ -491,8 +491,7 @@ {"load",1,{FUPATEXT}}, {"subst",2,{FUPATEXT,FUPATEXT}}, {"print",0,{0,0}}, - {"run",0,{0,0}}, - NULL + {"run",0,{0,0}} }; assert(pCon); diff --git a/dornier2.c b/dornier2.c index b2876c8..021f1f0 100644 --- a/dornier2.c +++ b/dornier2.c @@ -45,7 +45,7 @@ typedef struct __VelSelDriv *pVelSelDriv; /*--------- special Dornier conditions*/ #define STARTED -88 #define HALTREQ -77 -#define INVALIDSTATUS -7000 +/* INVALIDSTATUS is defined in velodorn.h */ #define TARGETREJECTED -7001 #define NOSTATUS -7002 diff --git a/ecb.c b/ecb.c index 2ec1cae..8fbbb8e 100644 --- a/ecb.c +++ b/ecb.c @@ -358,6 +358,7 @@ int ECBAction(SConnection *pCon, SicsInterp *pSics, void *pData, }else if(strcmp(argv[1],"toint")== 0){ sprintf(pBuffer,"%d",argv[2][0]); SCWrite(pCon,pBuffer,eValue); + return 1; } else { SCWrite(pCon,"ERROR: ECB does not understand keyword", eError); return 0; diff --git a/ecbdriv.c b/ecbdriv.c index 5a49911..81a34b7 100644 --- a/ecbdriv.c +++ b/ecbdriv.c @@ -526,39 +526,39 @@ static int downloadECBParam(pECBMotDriv self){ We assume that all parameters have useful values. It is the task of SetDriverPar to ensure just that! */ - if(status = loadAcceleration(self) <= 0){ + if((status = loadAcceleration(self) <= 0)){ return 0; } - if(status = loadSpeed(self,ObVal(self->driverPar,STARTSPEED),6) <= 0){ + if((status = loadSpeed(self,ObVal(self->driverPar,STARTSPEED),6) <= 0)){ return 0; } - if(status = loadSpeed(self,ObVal(self->driverPar,MAXSPEED),5) <= 0){ + if((status = loadSpeed(self,ObVal(self->driverPar,MAXSPEED),5) <= 0)){ return 0; } - if(status = loadSpeed(self,ObVal(self->driverPar,SLOWAUTO),4) <= 0){ + if((status = loadSpeed(self,ObVal(self->driverPar,SLOWAUTO),4) <= 0)){ return 0; } - if(status = loadSpeed(self,ObVal(self->driverPar,SLOWMAN),10) <= 0){ + if((status = loadSpeed(self,ObVal(self->driverPar,SLOWMAN),10) <= 0)){ return 0; } - if(status = loadDelay(self) <= 0){ + if((status = loadDelay(self) <= 0)){ return 0; } - if(status = loadMulti(self) <= 0){ + if((status = loadMulti(self) <= 0)){ return 0; } - if(status = ecbLoadEncoder(self->ecb) <= 0){ + if((status = ecbLoadEncoder(self->ecb) <= 0)){ return 0; } - if(status = loadOffset(self,ObVal(self->driverPar,OFFSET)) <= 0){ + if((status = loadOffset(self,ObVal(self->driverPar,OFFSET)) <= 0)){ return 0; } @@ -572,7 +572,7 @@ static int downloadECBParam(pECBMotDriv self){ self->driverPar[MULT].fVal = .0; } - if(status = loadGearing(self) <= 0){ + if((status = loadGearing(self) <= 0)){ return 0; } diff --git a/el737hpdriv.c b/el737hpdriv.c index 41b887f..ded8170 100644 --- a/el737hpdriv.c +++ b/el737hpdriv.c @@ -11,11 +11,13 @@ #include #include #include +#include #include #include #include #include #include +#include #define MONTHRESH 20 @@ -501,6 +503,7 @@ static int EL737FixIt(struct __COUNTER *self, int iCode){ break; case TOMANYCOUNTS: case SYSERROR: + return COTERM; /* guessed return value M.Z. */ break; default: /* diff --git a/el737hpv2driv.c b/el737hpv2driv.c index b940b6f..0f3d651 100644 --- a/el737hpv2driv.c +++ b/el737hpv2driv.c @@ -16,7 +16,7 @@ #include #include #include - +#include #define STATSEND 0 #define STATRECEIVE 2 diff --git a/eve.c b/eve.c index eef58ed..ab2ca2a 100644 --- a/eve.c +++ b/eve.c @@ -172,24 +172,6 @@ void EveMakePar(Eve *eve) { } } /*--------------------------------------------------------------------------*/ -EvePar *EveThisPar(EveParArg *arg, char *name, int flags) { - Eve *eve = arg->evc->pDriv->pPrivate; - EvePar *par; - - if (!eve->par) return NULL; - assert(arg->idx < eve->npar); - par = eve->par + arg->idx; - if (par->name == NULL) { - par->name = name; - if (flags & EVE_LOGPAR) { /* first time: default logger */ - EveSwitchLog(eve, par, 1); - } - } else { - assert(par->name == name); - } - return par; -} -/*--------------------------------------------------------------------------*/ void EveLog(Eve *eve) { EveParArg arg; @@ -232,6 +214,24 @@ int EveSwitchLog(Eve *eve, EvePar *par, int on) { } return 1; } +/*--------------------------------------------------------------------------*/ +EvePar *EveThisPar(EveParArg *arg, char *name, int flags) { + Eve *eve = arg->evc->pDriv->pPrivate; + EvePar *par; + + if (!eve->par) return NULL; + assert(arg->idx < eve->npar); + par = eve->par + arg->idx; + if (par->name == NULL) { + par->name = name; + if (flags & EVE_LOGPAR) { /* first time: default logger */ + EveSwitchLog(eve, par, 1); + } + } else { + assert(par->name == name); + } + return par; +} /*----------------------------------------------------------------------------*/ ArgOp EveOp(EveParArg *arg, char *name, char **fmt, int access, int flags) { static char buf[80]; @@ -381,6 +381,7 @@ void EveOut(EveParArg *arg, char *name, char *buf) { case saveAction: fprintf(arg->fil, "%s %s %s\n", arg->evc->pName, name, buf); break; + default: break; } } /*----------------------------------------------------------------------------*/ @@ -408,6 +409,7 @@ void EveFloatPar(EveParArg *arg, char *name, float *value, char *fmt, snprintf(buf, sizeof buf, fmt, *value); EveOut(arg, name, buf); break; + case noOp: break; } } /*----------------------------------------------------------------------------*/ @@ -434,6 +436,7 @@ void EveIntPar(EveParArg *arg, char *name, int *value, int access, int flags) { snprintf(buf, sizeof buf, "%d", *value); EveOut(arg, name, buf); break; + case noOp: break; } } /*----------------------------------------------------------------------------*/ @@ -454,6 +457,7 @@ void EveStrPar(EveParArg *arg, char *name, char **value, int maxsize, int access if (*value == NULL) value = ∅ EveOut(arg, name, *value); break; + case noOp: break; } } /*----------------------------------------------------------------------------*/ @@ -482,6 +486,7 @@ void EveObPar(EveParArg *arg, int index, char *fmt, int flags) { snprintf(buf, sizeof buf, fmt, arg->evc->pParam[index].fVal); EveOut(arg, name, buf); break; + case noOp: break; } } /*----------------------------------------------------------------------------*/ @@ -511,6 +516,7 @@ void EveObParEnum(EveParArg *arg, int index, char *list[], int flags) { snprintf(buf, sizeof buf, fmt, i, EveInt2Text(list, i)); EveOut(arg, name, buf); break; + case noOp: break; } } /*----------------------------------------------------------------------------*/ @@ -537,6 +543,7 @@ void EveEnumPar(EveParArg *arg, char *name, int *value, char *list[], int access snprintf(buf, sizeof buf, fmt, *value, EveInt2Text(list, *value)); EveOut(arg, name, buf); break; + case noOp: break; } } /*----------------------------------------------------------------------------*/ diff --git a/faverage.c b/faverage.c index 20b4da2..e25d865 100644 --- a/faverage.c +++ b/faverage.c @@ -90,14 +90,14 @@ iRet = Tcl_GetInt(pSics->pTcl,argv[1],&iStart); if(iRet != TCL_OK) { - sprintf(pBueffel,"ERROR: cannot convert %d to integer",argv[1]); + sprintf(pBueffel,"ERROR: cannot convert %s to integer",argv[1]); SCWrite(pCon,pBueffel,eError); return 0; } iRet = Tcl_GetInt(pSics->pTcl,argv[2],&iEnd); if(iRet != TCL_OK) { - sprintf(pBueffel,"ERROR: cannot convert %d to integer",argv[2]); + sprintf(pBueffel,"ERROR: cannot convert %s to integer",argv[2]); SCWrite(pCon,pBueffel,eError); return 0; } @@ -109,7 +109,7 @@ iRet = Tcl_GetInt(pSics->pTcl,argv[3],&iBank); if(iRet != TCL_OK) { - sprintf(pBueffel,"ERROR: cannot convert %d to integer",argv[3]); + sprintf(pBueffel,"ERROR: cannot convert %s to integer",argv[3]); SCWrite(pCon,pBueffel,eError); return 0; } @@ -286,7 +286,7 @@ iRet = Tcl_GetInt(pSics->pTcl,argv[1],&iBank); if(iRet != TCL_OK) { - sprintf(pBueffel,"ERROR: cannot convert %d to integer",argv[1]); + sprintf(pBueffel,"ERROR: cannot convert %s to integer",argv[1]); SCWrite(pCon,pBueffel,eError); return 0; } @@ -554,4 +554,5 @@ HistInt *CheckBank(pFocusAverager self, SConnection *pCon, mergData = getFMBankPointer(4); return mergData; } + return NULL; /* inserted statement, guessed return value M.Z */ } diff --git a/fowrite.c b/fowrite.c index 93e0f45..8582197 100644 --- a/fowrite.c +++ b/fowrite.c @@ -414,7 +414,7 @@ /* close everything */ NXclose(&pFile); NXDclose(pDict,NULL); - + return 0; } /*---------------------------------------------------------------------------*/ static void FoUpdate(pFoWrite self, SConnection *pCon) diff --git a/hardsup/itc4util.c b/hardsup/itc4util.c index 1dce9f7..e34dc30 100644 --- a/hardsup/itc4util.c +++ b/hardsup/itc4util.c @@ -336,7 +336,7 @@ { fSet = fVal; iSet = (int)(fSet*self->fMult); - sprintf(pCommand,"T%05.5d\r\n",iSet); + sprintf(pCommand,"T%5.5d\r\n",iSet); } /* try three times: send, read, test, if OK return, else diff --git a/hardsup/make_gen b/hardsup/make_gen index df50afd..32e8a1f 100644 --- a/hardsup/make_gen +++ b/hardsup/make_gen @@ -8,9 +8,6 @@ .SUFFIXES: .SUFFIXES: .c .o -VPATH=$(SRC) -ROOT=../.. - OBJ= el734_utility.o asynsrv_utility.o stredit.o \ strjoin.o failinet.o geterrno.o el737_utility.o sinqhm.o serialsinq.o \ itc4util.o dillutil.o table.o el755_utility.o el755_errorlog.o \ diff --git a/hardsup/makefile b/hardsup/makefile index 8f5a8eb..66edfc1 100644 --- a/hardsup/makefile +++ b/hardsup/makefile @@ -1,15 +1,6 @@ -# Forwards the execution to a version specific makefile. -# SICS_VERSION must be defined, else usage is printed # M. Zolliker 03.2005 -VERS_UNDEFINED= -VERS_UNDEFINED$(SICS_VERSION)=version_undefined - -INCL_MF=makefile_$(SICS_VERSION) - --include $(INCL_MF) - -version_undefined: +default: @ echo "" @ echo "Usage:" @ echo "" @@ -18,17 +9,4 @@ version_undefined: @ echo ' where makefile_xxx is one of' @ echo "" @ ls -1 makefile_* | pr -t -o 4 - @ echo "" - @ echo "Or, more convenient, define the following in the login script" - @ echo "" - @ echo " setenv SICS_VERSION version_xxx (assume we are using tcsh)" - @ echo "" - @ echo " where version_xxx is one of" - @ echo "" - @ ls -1 makefile_* | cut -b 10-99 | pr -t -o 4 - @ echo "" - @ echo "and then use simply" - @ echo "" - @ echo " make [target]" - @ echo "" diff --git a/hardsup/makefile_alpha b/hardsup/makefile_alpha index f1d40ab..03fe4a4 100644 --- a/hardsup/makefile_alpha +++ b/hardsup/makefile_alpha @@ -9,6 +9,6 @@ include ../../alpha_def CC = cc -CFLAGS = -std1 -g $(DFORTIFY) -I$(SRC). +CFLAGS = -std1 -g $(DFORTIFY) -I. include make_gen diff --git a/hardsup/makefile_linux b/hardsup/makefile_linux index 5af2aac..c381117 100644 --- a/hardsup/makefile_linux +++ b/hardsup/makefile_linux @@ -6,9 +6,9 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -include ../../$(SRC)linux_def +include ../../linux_def CC = gcc -CFLAGS = -g -DLINUX $(DFORTIFY) -I$(SRC). +CFLAGS = -g -DLINUX $(DFORTIFY) -I. -Wall -Wno-unused -include $(SRC)make_gen +include make_gen diff --git a/hardsup/makeprint.c b/hardsup/makeprint.c index b35188e..63f2041 100644 --- a/hardsup/makeprint.c +++ b/hardsup/makeprint.c @@ -194,7 +194,7 @@ case '\015': *pntr++ = '\\'; *pntr++ = 'r'; break; default: if ((in < ' ') || (in > '~')) { - pntr += sprintf (pntr, "\\%03.3o", in); + pntr += sprintf (pntr, "\\%3.3o", in); }else { *pntr++ = in; } diff --git a/hardsup/serialsinq.c b/hardsup/serialsinq.c index 76028ea..5c35846 100644 --- a/hardsup/serialsinq.c +++ b/hardsup/serialsinq.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -371,11 +372,11 @@ info_ptr->msg_id++; /* Set up an incrementing message id */ if (info_ptr->msg_id > 9999) info_ptr->msg_id = 1; - sprintf (info_ptr->to_host.msg_id, "%04.4d", info_ptr->msg_id); + sprintf (info_ptr->to_host.msg_id, "%4.4d", info_ptr->msg_id); memcpy (info_ptr->to_host.c_pcol_lvl, RS__PROTOCOL_ID_V01B, sizeof (info_ptr->to_host.c_pcol_lvl)); - sprintf (info_ptr->to_host.serial_port, "%04.4d", info_ptr->chan); + sprintf (info_ptr->to_host.serial_port, "%4.4d", info_ptr->chan); sprintf (info_ptr->to_host.tmo, "%04d", info_ptr->tmo); strncpy(info_ptr->sAsync.eot,info_ptr->pTerms,4); @@ -407,20 +408,20 @@ { c_len = strlen (txt_ptr); } - sprintf (text, "%04.4d", c_len); + sprintf (text, "%4.4d", c_len); memcpy (cmnd_lst_ptr, text, 4); cmnd_lst_ptr = cmnd_lst_ptr + c_len + 4; ncmnds++; bytes_left = bytes_left - size; } - sprintf (text, "%04.4d", ncmnds); + sprintf (text, "%4.4d", ncmnds); memcpy (info_ptr->to_host.n_cmnds, text, sizeof (info_ptr->to_host.n_cmnds)); size = cmnd_lst_ptr - info_ptr->to_host.msg_id; size = (size + 3) & (~3); /* Round up to multiple of 4 */ - sprintf (text, "%04.4d", size); + sprintf (text, "%4.4d", size); memcpy (info_ptr->to_host.msg_size, text, 4); status = send (info_ptr->skt, (char *) &info_ptr->to_host, size+4, 0); diff --git a/ipsdriv.c b/ipsdriv.c index 03caafb..0042742 100644 --- a/ipsdriv.c +++ b/ipsdriv.c @@ -10,6 +10,7 @@ Markus Zolliker, Sept 2004 #include #include #include +#include #include #include #include diff --git a/logger.c b/logger.c index c57bdc1..4a6781a 100644 --- a/logger.c +++ b/logger.c @@ -12,6 +12,7 @@ Markus Zolliker, Sept 2004 #include #include #include +#include "splitter.h" #include "sics.h" #include "logger.h" diff --git a/make_gen b/make_gen index 010ba97..cc52067 100644 --- a/make_gen +++ b/make_gen @@ -6,9 +6,6 @@ .SUFFIXES: .SUFFIXES: .c .o .f -VPATH=$(SRC) -ROOT=.. - OBJ=psi.o buffer.o ruli.o dmc.o nxsans.o nextrics.o sps.o pimotor.o \ pipiezo.o sanswave.o faverage.o fowrite.o amor2t.o nxamor.o \ amorstat.o tasinit.o tasdrive.o tasutil.o tasscan.o swmotor.o \ diff --git a/makefile b/makefile index 8f5a8eb..66edfc1 100644 --- a/makefile +++ b/makefile @@ -1,15 +1,6 @@ -# Forwards the execution to a version specific makefile. -# SICS_VERSION must be defined, else usage is printed # M. Zolliker 03.2005 -VERS_UNDEFINED= -VERS_UNDEFINED$(SICS_VERSION)=version_undefined - -INCL_MF=makefile_$(SICS_VERSION) - --include $(INCL_MF) - -version_undefined: +default: @ echo "" @ echo "Usage:" @ echo "" @@ -18,17 +9,4 @@ version_undefined: @ echo ' where makefile_xxx is one of' @ echo "" @ ls -1 makefile_* | pr -t -o 4 - @ echo "" - @ echo "Or, more convenient, define the following in the login script" - @ echo "" - @ echo " setenv SICS_VERSION version_xxx (assume we are using tcsh)" - @ echo "" - @ echo " where version_xxx is one of" - @ echo "" - @ ls -1 makefile_* | cut -b 10-99 | pr -t -o 4 - @ echo "" - @ echo "and then use simply" - @ echo "" - @ echo " make [target]" - @ echo "" diff --git a/makefile_alpha b/makefile_alpha index 9a0b7c1..ec5d73e 100644 --- a/makefile_alpha +++ b/makefile_alpha @@ -7,7 +7,7 @@ include ../alpha_def CC = cc -CFLAGS = -std1 -g $(DFORTIFY) -I$(SRC).. -I$(HDFROOT)/include -DHDF5 \ - -I$(SRC)hardsup +CFLAGS = -std1 -g $(DFORTIFY) -I.. -I$(HDFROOT)/include -DHDF5 \ + -Ihardsup include make_gen diff --git a/makefile_linux b/makefile_linux index 538f6b7..918ac2e 100644 --- a/makefile_linux +++ b/makefile_linux @@ -6,13 +6,14 @@ # Markus Zolliker, March 2003 #========================================================================== -include ../$(SRC)linux_def +include ../linux_def CC = gcc -CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(SRC)hardsup \ - -I../$(SRC) -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) +CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ihardsup \ + -I.. -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) \ + -Wall -Wno-unused -Wno-comment -Wno-switch EXTRA=nintf.o -include $(SRC)make_gen +include make_gen diff --git a/oicom.c b/oicom.c index ccabde3..b6bc699 100644 --- a/oicom.c +++ b/oicom.c @@ -119,7 +119,7 @@ void OiSet(Eve *eve, char *cmd, double val, int dig) { if (eve->syntax == 0) { for (;dig>0;dig--) val=val*10; - snprintf(buf, sizeof(buf), "%s%05d", cmd, val); + snprintf(buf, sizeof(buf), "%s%05d", cmd, (int)val); } else { snprintf(buf, sizeof(buf), "%s%f", cmd, val); } diff --git a/psi.c b/psi.c index d88f4fc..a4aef90 100644 --- a/psi.c +++ b/psi.c @@ -113,6 +113,7 @@ static void RemovePsiCommands(SicsInterp *pSics){ MotorDriver *CreateEL734(SConnection *pCon, int argc, char *argv[]); MotorDriver *CreateEL734DC(SConnection *pCon, int argc, char *argv[]); MotorDriver *CreateEL734HP(SConnection *pCon, int argc, char *argv[]); + MotorDriver *MakePiPiezo(Tcl_Interp *pTcl,char *pArray); /*-------------------------------------------------------------------*/ static pMotor CreatePsiMotor(SConnection *pCon, int argc, char *argv[]){ MotorDriver *pDriver = NULL; diff --git a/remob.c b/remob.c index c66a49d..9fdc3b7 100644 --- a/remob.c +++ b/remob.c @@ -121,7 +121,7 @@ static int RemHandle(RemServer *remserver) { for (remob = remserver->objList; remob != NULL; remob = remob->next) { par=StartsWith(line, remob->name); if (par != NULL) { - if (str = StartsWith(par, "finished")) { + if ((str = StartsWith(par, "finished"))) { if (*str == '\0') { remob->status = HWIdle; } else { @@ -130,7 +130,7 @@ static int RemHandle(RemServer *remserver) { line[0]='\0'; return 1; } - if (str = StartsWith(par, "started")) { + if ((str = StartsWith(par, "started"))) { remob->status = HWBusy; line[0]='\0'; return 1; @@ -405,7 +405,7 @@ static long RemobRun(void *self, SConnection *pCon, float fNew) { if (remserver->matchMap & 1) { /* already running, stop first */ remob->status = HWBusy; - snprintf(sBuf, sizeof(sBuf), "stopexe %s", remob->name, fNew); + snprintf(sBuf, sizeof(sBuf), "stopexe %s", remob->name); iRet = RemTransact(remserver, pCon, sBuf, ">", NULL); if (iRet <= 0) return 0; while (remob->status == HWBusy) { @@ -777,8 +777,9 @@ int RemobCreate(SConnection *pCon, SicsInterp *pSics, void *pData, } return 1; } - snprintf(buf, sizeof(buf),"ERROR: illegal arguments for command remob",argv[1]); + snprintf(buf, sizeof(buf),"ERROR: illegal arguments for command remob"); SCWrite(pCon,buf,eError); + return 0; } diff --git a/ruli.c b/ruli.c index 396bb10..a5ce7b0 100644 --- a/ruli.c +++ b/ruli.c @@ -257,7 +257,6 @@ {"list",0,{0,0}}, {"run",0,{0,0}}, {"batch",0,{0,0}}, - NULL }; assert(pCon); diff --git a/tasinit.c b/tasinit.c index dc58681..96ccca5 100644 --- a/tasinit.c +++ b/tasinit.c @@ -31,7 +31,7 @@ extern int getSRO(SConnection *pCon, float *fVal); /* tasutil.c */ As variables may be accessed in storage order, it is necessary to know the order of the motors */ -extern char *tasMotorOrder[] = { "a1", +char *tasMotorOrder[] = { "a1", "a2", "a3", "a4", @@ -70,7 +70,7 @@ extern char *tasMotorOrder[] = { "a1", has to match the order defined in tas.h through the defines. Otherwise quite weird things may happen at runtime. */ -extern char *tasVariableOrder[] = { +char *tasVariableOrder[] = { "wav", "dm", "da", diff --git a/tasscan.c b/tasscan.c index 09aca84..6bfb1bf 100644 --- a/tasscan.c +++ b/tasscan.c @@ -552,7 +552,7 @@ static int TASScanPoint(pScanData self, int iPoint) m3 = GetMonitor(self->pCounterData,3,self->pCon); cnts = GetCounts(self->pCounterData,self->pCon); fVal = GetCountTime(self->pCounterData, self->pCon); - sprintf(pWork,"%8d %8d %9.2f %8d %8d ",m1,m2,fVal, cnts, m3); + sprintf(pWork,"%8ld %8ld %9.2f %8ld %8ld ",m1,m2,fVal, cnts, m3); strcat(pBueffel,pWork); /* @@ -1517,7 +1517,7 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon," ",eWarning); SCWrite(pCon," ",eWarning); sprintf(pLine, - " %12s %6s HKLE: %6.2f%6.2f%6.2f%9.4f%7.3f%7.3f%7.3f", + " %12s %6s HKLE: %5.2f %5.2f %5.2f %8.4f %6.3f %6.3f %6.3f %6.3f", pTAS->tasPar[TIT]->text, pTAS->tasPar[USR]->text, pTAS->tasPar[QH]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQH]->fVal, diff --git a/tasutil.c b/tasutil.c index 4c78c21..4ac2940 100644 --- a/tasutil.c +++ b/tasutil.c @@ -96,7 +96,7 @@ isTASEnergy finds out if a variable is a TAS energy variable. This would require a TAS calculation to take place. If the test is positive then the index of the Variable is returned, else -1 is returned. -------------------------------------------------------------------------*/ -isTASEnergy(char *val) +int isTASEnergy(char *val) { int iPtr; @@ -207,6 +207,7 @@ static int printError(int ier, SConnection *pCon) return 0; break; default: + return 0; break; } } diff --git a/tecs/coc_client.c b/tecs/coc_client.c index 1d34636..faaa5bf 100644 --- a/tecs/coc_client.c +++ b/tecs/coc_client.c @@ -102,7 +102,6 @@ int CocInitClient(CocConn *conn, char *host, int port, char *magic, int bufsize, int CocSendMagic(CocConn *conn, char *magic) { char *err; - int siz, n; StrClear(&conn->resbuf); /* use return buffer for command in order to preserve command buffer */ ERR_I(StrPut(&conn->resbuf, "", COC_MAGIC)); @@ -133,8 +132,8 @@ int CocCheck(CocConn *conn) { /*-------------------------------------------------------------------------*/ int CocTryCmd(CocConn *conn) { - int iret=-1, siz; -int j; + int iret=-1; + signal(SIGPIPE, SIG_IGN); if (conn->fd<0) { ERR_I(iret=CocConnect(conn)); /* was CocOpen earlier */ @@ -221,7 +220,6 @@ int CocPushArg(CocConn *conn, const char *name, void *value, int type, int size) /*-------------------------------------------------------------------------*/ int CocPutStr(CocConn *conn, const char *name, const char *value) { - StrBuf *buf; ERR_I(CocPushArg(conn, name, NULL, ARG_CHAR, 0)); ERR_I(StrPut(&conn->cmdbuf, value, COC_SEP)); @@ -378,7 +376,6 @@ static int interrupt, logFd=0; void CocIntSignal(int sig) { char buf[4]; - int siz; if (logFd) { interrupt=2; @@ -396,10 +393,10 @@ int CocWatchLog(CocConn *conn, char *loglist) { char cbuf[1024]; StrBuf *buf; int fd, iret; - int i, siz, n; - static int init=1; #if __VMS + static int init=1; + if (init) { init=0; DECC$CRTL_INIT(); @@ -450,7 +447,6 @@ int CocShowLog(CocConn *conn, char *loglist, int start, int lines) { char cbuf[1024]; StrBuf *buf; int fd, iret; - int i, siz, n; fd=conn->fd; CocReset(conn); @@ -517,7 +513,6 @@ int CocGetN(CocConn *conn, const char *name, char *value, int reslen) { } int CocSetGetN(CocConn *conn, const char *name, const char *cmd, char *value, int reslen) { - int iret; assert(conn!=NULL); CocReset(conn); diff --git a/tecs/coc_logfile.c b/tecs/coc_logfile.c index b193873..d157fcc 100644 --- a/tecs/coc_logfile.c +++ b/tecs/coc_logfile.c @@ -110,7 +110,7 @@ void logfileStamp(char *text) { } if (text==NULL) { if (stamp>lastStamp+1) { - fprintf(fil, "---\t%02d:%02d:%02d\n", stamp / 60, stamp % 60, time % 60, text); + fprintf(fil, "---\t%02d:%02d:%02d\n", stamp / 60, stamp % 60, time % 60); } } else { fprintf(fil, "\t%02d:%02d:%02d%s", stamp / 60, stamp % 60, time % 60, text); @@ -196,7 +196,7 @@ void logfileWrite0(int mask) { if (dirty) logfileStamp(NULL); /* there was something written since last time */ s=ebuf; - if (writeAll || *s!='\0' && wrtMask & logMask) { + if (writeAll || (*s!='\0' && (wrtMask & logMask))) { next=strchr(s, '\1'); while (next!=NULL) { *next='\0'; diff --git a/tecs/coc_server.c b/tecs/coc_server.c index 505049f..7e3abe8 100644 --- a/tecs/coc_server.c +++ b/tecs/coc_server.c @@ -142,8 +142,6 @@ void *CocChrPtr(char *ptr) { return(ptr); } void *CocDefVar(const char *name, void *var, int type, int size, int access) { CocVar *p; - const char *f; - void *adr; assert(varListHandle!=NULL); p=CocFindVar1(name); @@ -177,7 +175,7 @@ int *CocSizePtr(void) { } void CocDefVarS(const char *name, const char *tname, void *var, int type) { - CocVar *p, *t; + CocVar *p; assert(type==COC_PTR || type==COC_STRUCT); p=CocDefVar(name, var, type, 0, COC_RDONLY); @@ -188,7 +186,6 @@ char err_name[64]; int CocGetThisVar(CocVar *var, void *base, StrBuf *buf, int separator) { void *adr; - int iret; if (base==NULL) { adr=var->var; @@ -215,7 +212,6 @@ int CocGetThisVar(CocVar *var, void *base, StrBuf *buf, int separator) { int CocPutThisVar(CocVar *var, void *base, StrBuf *buf, int separator) { void *adr; - int iret; if (base==NULL) { adr=var->var; @@ -333,7 +329,6 @@ void CocToClients(int mask, char *str) { int CocInitServer(void *(*setDataRtn)(void *), int port) { int i; struct sockaddr_in sadr; - char *err; setData=setDataRtn; /* @@ -494,9 +489,9 @@ int CocHandle1Request(int tmo_msec, int fd) { struct timeval tmo={0,1}; CocClient *cl, *cl0; CocVar *var; - int i, lmask, newfd, n, iret; + int i, lmask, newfd, iret; socklen_type cadrlen; - char *err, *cmd, *arg, *varname; + char *err, *varname; void *base; rmask=mask; diff --git a/tecs/coc_server.h b/tecs/coc_server.h index bf29eee..fb0f831 100644 --- a/tecs/coc_server.h +++ b/tecs/coc_server.h @@ -59,8 +59,8 @@ void CocDefVarS(const char *name, const char *tname, void *var, int type); #define CocDefFlt(V,A) CocDefVar(#V,CocFltPtr(&V),COC_FLT,0,A) #define CocDefStr(V,A) CocDefVar(#V,CocChrPtr(V),COC_CHAR,sizeof(V),A) #define CocDefArr(V,A) CocDefVar(#V,CocFltPtr(V),COC_ARRAY,sizeof(V)/sizeof(float),A) -#define CocDefPtr(V,S) CocDefVarS(#V,#S,&V,(V!=(S *)NULL,0,COC_PTR)); -#define CocDefStruct(V,S) CocDefVarS(#V,#S,&V,(&V!=(S *)NULL,0,COC_STRUCT)); +#define CocDefPtr(V,S) CocDefVarS(#V,#S,&V,((V!=(S *)NULL)*COC_PTR)); +#define CocDefStruct(V,S) CocDefVarS(#V,#S,&V,((&V!=(S *)NULL)*COC_STRUCT)); #define CocIntFld(S,V,A) CocDefVar(#S":"#V,CocIntPtr(&((S *)NULL)->V),COC_INT,0,A); #define CocFltFld(S,V,A) CocDefVar(#S":"#V,CocFltPtr(&((S *)NULL)->V),COC_FLT,0,A); #define CocStrFld(S,V,A) CocDefVar(#S":"#V,CocChrPtr(((S *)NULL)->V),COC_CHAR,sizeof(((S *)NULL)->V),A); diff --git a/tecs/didi b/tecs/didi index 6507b4d..4ab60c5 100755 --- a/tecs/didi +++ b/tecs/didi @@ -4,13 +4,13 @@ set what="$1" set where="$2" set destlist=( type@osf1 \ -AMOR@amor:tecs/ FOCUS@focus:tecs/ TRICS@trics:tecs/ \ +amor@amor:tecs/ focus@focus:tecs/ trics@trics:tecs/ \ alpha=/afs/psi.ch/project/sinq/tru64/stow/tecs/bin/ \ type@linux \ slinux=/afs/psi.ch/project/sinq/sl-linux/stow/tecs/bin/ \ linux=/afs/psi.ch/project/sinq/linux/stow/tecs/bin/ \ -TASP@tasp:tecs/ dmc@dmc:tecs/ HRPT@hrpt:tecs/ \ -MORPHEUS@morpheus:tecs/ SANS@sans:tecs/ SANS2@sans2:tecs/ \ +tasp@tasp:tecs/ dmc@dmc:tecs/ hrpt@hrpt:tecs/ \ +morpheus@morpheus:tecs/ sans@sans:tecs/ sans2@sans2:tecs/ \ type@darwin \ macosx=/afs/psi.ch/project/sinq/mac_os/stow/tecs/bin/ \ ) @@ -43,7 +43,7 @@ foreach dest ($destlist) endif end -set items=(TecsServer TecsClient six keep_running) +set items=(TecsServer TecsClient six) echo "" echo " all $items" @@ -71,14 +71,14 @@ if ($this == $0) then endif cd $this -set obj=../../obj/$SICS_VERSION/psi/tecs +#set obj=../../obj/$SICS_VERSION/psi/tecs foreach dest ($where) alias get 'set d=$'"d_$dest;"'set t=$'"t_$dest" get foreach item ($what) if ("$t" == "$OSTYPE") then echo $item to $d - rsync -e ssh -vt $obj/$item $d + rsync -e ssh -vt $item $d endif end end diff --git a/tecs/keep_running.c b/tecs/keep_running.c index d90d3d5..d4264ad 100644 --- a/tecs/keep_running.c +++ b/tecs/keep_running.c @@ -11,7 +11,7 @@ int main(int argc, char *argv[]) { int cnt, dif; time_t tim1, tim2; pid_t pid; - int status, i; + int status; if (argc<2) return 0; cnt = MAX_CNT; diff --git a/tecs/macosx_def b/tecs/macosx_def index 9f24040..12232cb 100644 --- a/tecs/macosx_def +++ b/tecs/macosx_def @@ -1,7 +1,7 @@ -#DFORTIFY= -DFORTIFY -I$(ROOT)/$(SRC) +#DFORTIFY= -DFORTIFY #FORTIFYOBJ= fortify.o strdup.o -MFLAGS=-f $(SRC)makefile_macosx$(DUMMY) SRC=$(SRC) +MFLAGS=-f makefile_macosx$(DUMMY) #HDFROOT= diff --git a/tecs/make_crv.tcsh b/tecs/make_crv.tcsh index a216fd9..494eac0 100755 --- a/tecs/make_crv.tcsh +++ b/tecs/make_crv.tcsh @@ -1,24 +1,24 @@ #!/bin/tcsh set src=${1:h} set files=($src/*.inp) -echo " " >! src/make_crv +echo " " >! make_crv set cfg="" foreach file ($files) set sens=${file:t:s/.inp//} - echo '$(CFGDIR)'"$sens.crv: ccrv "'$(SRC)'"inp/$sens.inp" >> src/make_crv - echo ' $Q -p$(CFGDIR)' >> src/make_crv - echo '' >> src/make_crv + echo '$(CFGDIR)'"$sens.crv: ccrv inp/$sens.inp" >> make_crv + echo ' $Q -p$(CFGDIR)' >> make_crv + echo '' >> make_crv end -echo "all_crv: dev.list \" >> src/make_crv +echo "all_crv: dev.list \" >> make_crv foreach file ($files) set sens=${file:t:s/.inp//} - echo ' $(CFGDIR)'"$sens.crv \" >> src/make_crv + echo ' $(CFGDIR)'"$sens.crv \" >> make_crv end -echo '' >> src/make_crv -echo "ALLINP= \" >> src/make_crv +echo '' >> make_crv +echo "ALLINP= \" >> make_crv foreach file ($files) set sens=${file:t:s/.inp//} - echo ' $(SRC)'"inp/$sens.inp \" >> src/make_crv + echo "inp/$sens.inp \" >> make_crv end -echo '' >> src/make_crv +echo '' >> make_crv diff --git a/tecs/make_gen b/tecs/make_gen index b9eb4eb..b06a83a 100644 --- a/tecs/make_gen +++ b/tecs/make_gen @@ -8,9 +8,6 @@ .SUFFIXES: .SUFFIXES: .o .c .f -VPATH=$(SRC):$(ROOT)/$(SRC) -ROOT=../.. - LIBR_OBJ =coc_util.o myc_err.o myc_str.o myc_buf.o myc_time.o SERV_OBJ =tecs.o coc_server.o tecs_lsc.o tecs_serial.o coc_logfile.o \ tecs_data.o $(LIBR_OBJ) @@ -35,11 +32,11 @@ CFGDIR=/afs/psi.ch/project/sinq/common/lib/tecs/cfg/ #-include make_crv -$(SRC)make_crv: make_crv.tcsh inp/lsc.codes $(ALLINP) - $(SRC)make_crv.tcsh $(SRC)inp/lsc.codes +make_crv: make_crv.tcsh inp/lsc.codes $(ALLINP) + make_crv.tcsh inp/lsc.codes dev.list: - $(SRC)make_list.tcsh $(CFGDIR)*.cfg > $@ + make_list.tcsh $(CFGDIR)*.cfg > $@ cp $@ $(CFGDIR) # use target all_crv to make all curves in inp directory @@ -66,7 +63,7 @@ ccrv: conv.f sys_cmdpar.o str.o cvt.o # -- needs special include tecs_serial.o: tecs_serial.c - $(CC) $(CFLAGS) -I$(ROOT)/psi/hardsup/$(SRC) -c $Q + $(CC) $(CFLAGS) -I../hardsup -c $Q keep_running: keep_running.c $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) @@ -78,5 +75,8 @@ rexstart: rstart.c myc_str.o myc_err.o instr_hosts.o $(CC) $(CFLAGS) -o $@ $Q $(FORTIFYOBJ) @ echo "$(PWD)/rstart" +pg_plus/libpgplus.a: + cd pg_plus; make $(MFLAGS) + clean: rm -f *.o *.a six keep_running TecsServer TecsClient diff --git a/tecs/makefile b/tecs/makefile index 8f5a8eb..66edfc1 100644 --- a/tecs/makefile +++ b/tecs/makefile @@ -1,15 +1,6 @@ -# Forwards the execution to a version specific makefile. -# SICS_VERSION must be defined, else usage is printed # M. Zolliker 03.2005 -VERS_UNDEFINED= -VERS_UNDEFINED$(SICS_VERSION)=version_undefined - -INCL_MF=makefile_$(SICS_VERSION) - --include $(INCL_MF) - -version_undefined: +default: @ echo "" @ echo "Usage:" @ echo "" @@ -18,17 +9,4 @@ version_undefined: @ echo ' where makefile_xxx is one of' @ echo "" @ ls -1 makefile_* | pr -t -o 4 - @ echo "" - @ echo "Or, more convenient, define the following in the login script" - @ echo "" - @ echo " setenv SICS_VERSION version_xxx (assume we are using tcsh)" - @ echo "" - @ echo " where version_xxx is one of" - @ echo "" - @ ls -1 makefile_* | cut -b 10-99 | pr -t -o 4 - @ echo "" - @ echo "and then use simply" - @ echo "" - @ echo " make [target]" - @ echo "" diff --git a/tecs/makefile_linux b/tecs/makefile_linux index 31e2d3b..c47cbe5 100644 --- a/tecs/makefile_linux +++ b/tecs/makefile_linux @@ -5,14 +5,13 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -include $(SRC)../../linux_def +include ../../linux_def -SICST=.. -SICS=$(SRC).. +SICS=.. CC = gcc FC = g77 -CFLAGS = -DLINUX -g $(DFORTIFY) -I../.. +CFLAGS = -DLINUX -g $(DFORTIFY) -I../.. -I. -Wall -Wno-missing-braces FFLAGS = -Wimplicit -g ARFLAGS = cr @@ -38,4 +37,4 @@ Q=$^ F=$< C=$< -include $(SRC)make_gen +include make_gen diff --git a/tecs/makefile_macosx b/tecs/makefile_macosx index 25c1e91..a6973cc 100644 --- a/tecs/makefile_macosx +++ b/tecs/makefile_macosx @@ -5,7 +5,7 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -include $(SRC)macosx_def +include macosx_def CC = gcc FC = g77 @@ -20,7 +20,7 @@ PGLIB = -L/usr/X11R6/lib -lX11 -L/sw/lib -lpng \ -Wl,-framework -Wl,Foundation -Wl,-framework -Wl,AppKit -lcc_dynamic # -- library for ASYNSRV -HARDSUPLIB=$(SICST)/hardsup/libhlib.a +HARDSUPLIB=../hardsup/libhlib.a # -- readline library RDLIB =-lreadline @@ -36,4 +36,4 @@ Q=$^ F=$< C=$< -include $(SRC)make_gen +include make_gen diff --git a/tecs/myc_buf.c b/tecs/myc_buf.c index 352488b..c3f5767 100644 --- a/tecs/myc_buf.c +++ b/tecs/myc_buf.c @@ -10,7 +10,7 @@ char *StrNGet(StrBuf *buf, char *result, int reslen, int sep) { char *b, *f, *e, quote; - int res, l, ll; + int l; if (buf->rdpos < 0 || buf->rdpos >= buf->dsize || buf->buf==NULL) ERR_MSG("buffer corrupt"); @@ -190,7 +190,6 @@ int StrPutInt(StrBuf *buf, int val, int sep) { int StrPutFloat(StrBuf *buf, float val, int sep) { char num[32]; - int l; if (val == MYC_NAN) { ERR_I(StrPut(buf, "NaN", sep)); diff --git a/tecs/myc_time.c b/tecs/myc_time.c index 3daf100..867d096 100644 --- a/tecs/myc_time.c +++ b/tecs/myc_time.c @@ -67,7 +67,7 @@ int mycDate(int time) { int mycTime(int date) { struct tm tim; - time_t t, now; + time_t now; int y, m, d; if (my_base == 0) initBase(); diff --git a/tecs/six.c b/tecs/six.c index 9059388..8451749 100644 --- a/tecs/six.c +++ b/tecs/six.c @@ -94,7 +94,7 @@ int CocCreateSockAdr( char* readWrite(int fd, int tmo, int skip, char *find) { char msg[256]; - int l, lbuf, pos, i, go, iret, n, ga; + int lbuf, pos, go, iret, n, ga; char *p, chr; static char result[256]; int match; @@ -197,7 +197,7 @@ int sendCmd(int fd, char *cmd) { } int scramble(char *buf) { - int i, n, cnt, chr, new; + int i, n, cnt, chr; int x; /* Scrambles a string. Twice scramble gives original. It does never convert a plain char to a ctrl char @@ -217,12 +217,12 @@ int scramble(char *buf) { return cnt; } -getscrambled(char *buf, int size, FILE *fil) { +void getscrambled(char *buf, int size, FILE *fil) { term_fgets(buf, size, fil); if (scramble(buf) > 0) scramble(buf); } -putscrambled(char *buf, FILE *fil) { +void putscrambled(char *buf, FILE *fil) { char cvt[256]; str_copy(cvt, buf); scramble(cvt); @@ -394,7 +394,7 @@ int setrights(int gotolevel) { int main (int argc, char *argv[]) { int iret, pos; fd_set mask; - int l, i, j, port, skip, gotolevel, sicslogin; + int i, j, port, skip, gotolevel, sicslogin; int savehist = 0; char buf[128], lbuf[16], ilow[64]; char stdPrompt[128], prompt[256]; diff --git a/tecs/sys_select.c b/tecs/sys_select.c index 5c81698..3298978 100644 --- a/tecs/sys_select.c +++ b/tecs/sys_select.c @@ -5,7 +5,7 @@ static int lastFd=-1; static struct termios atts; -static echo=1; +static int echo=1; void sys_keys_on(void) { int iret; @@ -35,7 +35,7 @@ void sys_keys_off(void) { } int sys_select_or_key(fd_set *mask, int msecTmo, char *key) { - int chan, fd, iret, fd1, m, chr; + int fd, iret, fd1, chr; struct timeval tmo, tmo0={0,0}; fd_set rmask; diff --git a/tecs/tecs.c b/tecs/tecs.c index 90d701d..8694199 100644 --- a/tecs/tecs.c +++ b/tecs/tecs.c @@ -147,7 +147,6 @@ static int maxfld, /* last used display field */ busy, /* busy after CRVSAV */ relay, relay0, /* relay status */ - deviceFlag, /* device given via net */ num, /* curve number */ key, /* key status */ serialNo=340000, /* initialize with a valid, but not existing value */ @@ -284,9 +283,8 @@ int InstalCurve(SensorT *sensor, char *devArg) { char *crv, *entry, *points, *start, *s, /* start of found entry */ *e, /* cache part after found entry */ - *res, *t; - int i, n, c1, c2; - char ch; + *t; + int i, n; char used[60]; FILE *fil; @@ -690,7 +688,7 @@ again: s->typ=typ; s->band=10; if (s->scale==0.0) s->scale=1.0; - if (s->alarm==0.0 && typ=='m' || typ=='s') { + if ((s->alarm==0.0 && typ=='m') || typ=='s') { s->alarm=tLimit; s->customAlarm=0; } else { @@ -1017,7 +1015,7 @@ int ReadTemp(void) { } stat=(s->stat1 & s->stat2) & (255-3); /* ignore "old reading" and "invalid reading", error must be on min & max */ - if (stat > s->readStat || stat==0 && s->readStat>0) { + if (stat > s->readStat || (stat==0 && s->readStat>0)) { err=LscReadStat(stat); if (*err=='\0') { logfileOut(LOG_MAIN, "reading o.k. %s\n", s->ch); @@ -1302,8 +1300,8 @@ int SetTemp(int switchOn) { } void CalcMaxPower(void) { - int i, j, vmax; - float pa, pr, pw, quo, p, pl, plim, h; + int i, j; + float pa, pr, pw, quo, p, plim, h; iAmp=1; iRange=0; maxCurrent=0; @@ -1346,7 +1344,6 @@ void CalcMaxPower(void) { int PutFloat(StrBuf *buf, int prec, float f) { char num[32], fmt[32]; - int l; if (f == DATA_UNDEF) { return StrPut(buf, "NaN", StrNONE); @@ -1393,7 +1390,7 @@ int PidSumHdl(int mode, void *base, int fd) { int SetMaxPower(void) { /* static float p0; */ static float lastCurrent, limCurrent, pold; - float plim; + /* float plim; */ if (loop == 1) { if (initMaxPower) { @@ -1719,7 +1716,7 @@ int ConfigByCode(int plugNr) { while (p!=NULL && plug->code != c1 && plug->code != c2) { if (*p != '#') { c1=0; c2=0; - sscanf(buf, "%15s %d %d", &nam, &c1, &c2); + sscanf(buf, "%15s %d %d", nam, &c1, &c2); } p=fgets(buf, sizeof(buf), fil); } @@ -1764,8 +1761,8 @@ int PeriodicTask(void) { static int lastIntTim; char buf[256], lbuf[16]; char *next, *alms; - int i, k, iret, cnt; - float t3[3], p, d, w, t, dif, htr0, mstep, fdif; + int i, k, cnt; + float p, d, w, t, dif, htr0, mstep, fdif; if (nScan==0) { ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;BUSY?>busy")); @@ -1773,7 +1770,7 @@ int PeriodicTask(void) { cod1=0; ERR_P(LscCmd(ser, "BUSY?>busy")); } - if (plug0.codDefined && plug1.codDefined || nScan>0) { + if ((plug0.codDefined && plug1.codDefined) || nScan>0) { per=period; /* no timeout on above command and codes are defined: normal period */ if (per>logPeriod*1000) per=logPeriod*1000; } @@ -1976,8 +1973,8 @@ int PeriodicTask(void) { } fdif=FakeScale(ctlSens, tr)-t; fbuf=htr-mout-prop/6*fdif; /* value of integrator (assume deriv=0) */ - if (fbuf > 99.8 && mout < 0 && fdif > 0 || - fbuf < 0.2 && mout > 0 && fdif < 0) { /* probably integrator overflow */ + if ((fbuf > 99.8 && mout < 0 && fdif > 0) || + (fbuf < 0.2 && mout > 0 && fdif < 0)) { /* probably integrator overflow */ if (lastIntTim > 0) { mout += fdif*prop*integ/3000*(rdTim-lastIntTim); /* use mout for integral */ if (mout < -100) mout=-100; @@ -2105,7 +2102,7 @@ int PeriodicTask(void) { } int DeviceHdl(int mode, void *base, int fd) { - char *t, *res; + char *t; int do0, do1; if (mode==COC_WR) { @@ -2212,7 +2209,7 @@ int SwapHdl(int mode, void *base, int fd) { } int SetPower(float setpower) { - float htr1, htr0, diff, dist; + float htr1, htr0; int cnt; logfileOut(LOG_MAIN,"SetPower\n"); @@ -2401,7 +2398,6 @@ int LogHdl(int mode, void *base, int fd) { data->logpos=logfileGetLines(data->logpos, 25, data->logline, sizeof(data->logline)); } return 0; - OnError: return -1; } int PltHdl(int mode, void *base, int fd) { @@ -2413,8 +2409,7 @@ int PltHdl(int mode, void *base, int fd) { } int GraHdl(int mode, void *base, int fd) { - ClientData *data; - int l, i; + int l; char names[64]; long startTime, endTime, step; @@ -2466,10 +2461,9 @@ int ShowSensor(StrBuf *buf, SensorT *s, char *name, char *units, char lim) { } int StatusHdl(int mode, void *base, int fd) { - int i, stat, typ; + int i; StrBuf buf; float tM, tS; - SensorT *s; char pendAct[256]; char *p; @@ -2654,7 +2648,6 @@ int UpdateHdl(int mode, void *base, int fd) { } } return 0; - OnError: return -1; } int RemoteHdl(int mode, void *base, int fd) { @@ -2726,7 +2719,7 @@ int ExecuteRequest(void) { } int MainBody(void) { - int i, iret, tdif; + int iret, tdif; logfileWrite(logMask); diff --git a/tecs/tecs_cli.c b/tecs/tecs_cli.c index b1be843..d6c5965 100644 --- a/tecs/tecs_cli.c +++ b/tecs/tecs_cli.c @@ -163,7 +163,6 @@ static pTecsClient conn=NULL; int F_FUN(tecs_set_par)(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_len) { char nbuf[64], pbuf[COC_CMD_LEN]; - int iret=-1; STR_TO_C(nbuf, name); STR_TO_C(pbuf, par); @@ -180,7 +179,6 @@ int F_FUN(tecs_set_par)(F_CHAR(name), F_CHAR(par), int *show, int name_len, int int F_FUN(tecs_get_par)(F_CHAR(name), F_CHAR(par), int *show, int name_len, int par_len) { char *b, nbuf[64], pbuf[COC_RES_LEN]; - int iret=-1; STR_TO_C(nbuf, name); CocReset(conn); @@ -204,7 +202,7 @@ int F_FUN(tecs_get_par)(F_CHAR(name), F_CHAR(par), int *show, int name_len, int } int F_FUN(tecs_get_mult)(F_CHAR(names), int *time, int *nvalues, float values[], int names_len) { - char *b, nbuf[64], pbuf[COC_RES_LEN]; + char nbuf[64]; char *nams, nam[32]; int i; diff --git a/tecs/tecs_data.c b/tecs/tecs_data.c index ac37d4b..13f2e89 100644 --- a/tecs/tecs_data.c +++ b/tecs/tecs_data.c @@ -201,7 +201,7 @@ Run *InsertRun(Set *s, int time) { int Put(Set *set, int time, float value) { Run *r; - int t, try = 1; + int t; int size; float last; static int errcnt=0; @@ -325,7 +325,7 @@ void FreeBase(Base *base) { int GetSet(Set *s, int startTime, int endTime, int size, float *data) { Run *r; - int t, tlim, tmin; + int t, tlim; float d; int i, idx; Summary sum; @@ -429,9 +429,8 @@ void Scan(void *sData, char *line) { } void Load(Base *base, int from, int to, int stdStep) { - Set *set; ScanData scanData; - int t, date; + int t; scanData.base = base; scanData.stdStep = stdStep; diff --git a/tecs/tecs_lsc.c b/tecs/tecs_lsc.c index 99097d6..c01bd4a 100644 --- a/tecs/tecs_lsc.c +++ b/tecs/tecs_lsc.c @@ -14,7 +14,7 @@ int LscEqPar(char *par, char *res) { char *p, *r, pbuf[SER_BUF_LEN], rbuf[SER_BUF_LEN]; - int i,n,i1,i2; + int i1,i2; float f1, f2; p=par; @@ -42,7 +42,6 @@ int LscEqPar(char *par, char *res) { #define nLIST 30 char *LscCmd(SerChannel *ser, const char *cmds) { - va_list ap; char *blank, *colon, *qu, *res; const char *p, *this, *next, *cmd_ptr, *retreq; const char *list[nLIST]; @@ -50,7 +49,7 @@ char *LscCmd(SerChannel *ser, const char *cmds) { char cmd[SER_BUF_LEN]; char varname[32]; DeclStrBuf(sbuf, SER_BUF_LEN); - int nres, i, j, response; + int nres, i, response; nres=0; response=0; diff --git a/tecs/tecs_serial.c b/tecs/tecs_serial.c index 0371092..b189fc9 100644 --- a/tecs/tecs_serial.c +++ b/tecs/tecs_serial.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "rs232c_def.h" #include "asynsrv_def.h" @@ -160,7 +161,7 @@ char *SerCmd(SerChannel *serch, char *cmnd) { int l, n; AsynSrvChan *aser; TermSrvChan *tser; - char *result, *pos, *trm; + char *result, *pos; char junk[256]; int iret, incomplete; diff --git a/tecs/term.c b/tecs/term.c index c976a1e..228744a 100644 --- a/tecs/term.c +++ b/tecs/term.c @@ -25,7 +25,6 @@ static char esc_key='\0'; static fd_set regMask; -static int lastFd=-1; void term_reg_socket(int fd) { FD_SET(fd, ®Mask); @@ -151,7 +150,6 @@ static char filehead[256]=""; FILE *term_open_pref(char *head, char *mode) { char buf[PATH_MAX], hom[PATH_MAX]; char *cret, *home, usr[256]; - int i; cret=getenv("USER"); if (cret == NULL || *cret == '\0') return NULL; @@ -265,7 +263,7 @@ void term_off(void) { int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask) { char key, *lin; - int i,j,l,iret,buflen; + int i,l,iret,buflen; char tmp[512]; static char back[128]=""; @@ -320,7 +318,7 @@ int term_get_line(char *buf, int size, int *pos, char *prompt, fd_set *mask) { if (history[hist_end]!=NULL) { FREE(history[hist_end]); /* clear line at end of history */ } - history[hist_end]==NULL; + history[hist_end] = NULL; } hist_pos=hist_end; term_save_hist(0); diff --git a/tricssupport.c b/tricssupport.c index e54f014..4c7df35 100644 --- a/tricssupport.c +++ b/tricssupport.c @@ -198,6 +198,8 @@ int TricsSupportAction(SConnection *pCon, SicsInterp *pSics, void *pData, InvokeCallBack(self->pCall, NEWFRAME,&iFrame); SCSendOK(pCon); return 1; + } else { + return 0; /* guessed return value M.Z. */ } } diff --git a/utils/SerPortServer.c b/utils/SerPortServer.c index 3495163..b6e7b0a 100755 --- a/utils/SerPortServer.c +++ b/utils/SerPortServer.c @@ -141,6 +141,7 @@ #include #include #include +#include #include #include @@ -2381,7 +2382,7 @@ static int RS__MAX_ASYNCH = 20; /* Asynch "ports" 0 - 19 will be allowed */ Ts_info = calloc (RS__MAX_ASYNCH, sizeof (Ts_info[0])); if (Ts_info == NULL) { printf (" Unable to allocate space for Ts_info\n"); - freeAll (Cl_info); exit (EXIT_FAILURE); + freeAll (); exit (EXIT_FAILURE); } for (i = 0; i < RS__MAX_ASYNCH; i++) Ts_info[i].status = TS_SS_IDLE; /*-----------------------------------------------------------------------*/ @@ -2580,7 +2581,8 @@ static int RS__MAX_ASYNCH = 20; /* Asynch "ports" 0 - 19 will be allowed */ &buff[4]); traceWrite (); }else { - printf ("%.15s - USR1 signal detected. There is no trace buffer.\n"); + printf ("%.15s - USR1 signal detected. There is no trace buffer.\n", + &buff[4]); } fflush (NULL); signal (SIGUSR1, USR1_Handler); /* Re-enable USR1 signal */ diff --git a/utils/el734.c b/utils/el734.c index 3f6e32b..b6d86d2 100755 --- a/utils/el734.c +++ b/utils/el734.c @@ -1147,13 +1147,13 @@ switch (Cmnd_fmt[i]) { case ONE_INT: sscanf (rply_ptr->rply, "%d", - ((char *) state) + Offsets[indx]); + (int *)(((char *) state) + Offsets[indx])); indx++; break; case TWO_INT: sscanf (rply_ptr->rply, "%d %d", - ((char *) state) + Offsets[indx], - ((char *) state) + Offsets[indx+1]); + (int *)(((char *) state) + Offsets[indx]), + (int *)(((char *) state) + Offsets[indx+1])); indx++; indx++; break; case ONE_STRING: diff --git a/utils/make_gen b/utils/make_gen index ec322d9..ec7209f 100644 --- a/utils/make_gen +++ b/utils/make_gen @@ -10,8 +10,6 @@ .SUFFIXES: .SUFFIXES: .c .o -VPATH=$(SRC) -ROOT=../.. HLIB=../hardsup/libhlib.a LIBS = -L/usr/X11R6/lib -lX11 #---------------------------------------------------------- diff --git a/utils/makefile b/utils/makefile index 8f5a8eb..66edfc1 100644 --- a/utils/makefile +++ b/utils/makefile @@ -1,15 +1,6 @@ -# Forwards the execution to a version specific makefile. -# SICS_VERSION must be defined, else usage is printed # M. Zolliker 03.2005 -VERS_UNDEFINED= -VERS_UNDEFINED$(SICS_VERSION)=version_undefined - -INCL_MF=makefile_$(SICS_VERSION) - --include $(INCL_MF) - -version_undefined: +default: @ echo "" @ echo "Usage:" @ echo "" @@ -18,17 +9,4 @@ version_undefined: @ echo ' where makefile_xxx is one of' @ echo "" @ ls -1 makefile_* | pr -t -o 4 - @ echo "" - @ echo "Or, more convenient, define the following in the login script" - @ echo "" - @ echo " setenv SICS_VERSION version_xxx (assume we are using tcsh)" - @ echo "" - @ echo " where version_xxx is one of" - @ echo "" - @ ls -1 makefile_* | cut -b 10-99 | pr -t -o 4 - @ echo "" - @ echo "and then use simply" - @ echo "" - @ echo " make [target]" - @ echo "" diff --git a/utils/makefile_alpha b/utils/makefile_alpha index 3866e56..f80138f 100644 --- a/utils/makefile_alpha +++ b/utils/makefile_alpha @@ -9,7 +9,7 @@ include ../../alpha_def CC = cc -CFLAGS = -std1 -g $(DFORTIFY) -I$(SRC). -I$(ROOT)/psi/hardsup/$(SRC) +CFLAGS = -std1 -g $(DFORTIFY) -I../hardsup -I. ALPHA = el737 el734 el734_test # -- the following macros are used as a replacement for some automatic variables diff --git a/utils/makefile_linux b/utils/makefile_linux index 096df50..60a40b6 100644 --- a/utils/makefile_linux +++ b/utils/makefile_linux @@ -6,10 +6,10 @@ # Markus Zolliker, Oct 2003 #-------------------------------------------------------------------------- -include ../../$(SRC)linux_def +include ../../linux_def CC = gcc -CFLAGS = -g -DLINUX $(DFORTIFY) -I$(SRC). -I$(ROOT)/psi/hardsup/$(SRC) +CFLAGS = -g -DLINUX $(DFORTIFY) -I../hardsup -I. # -- the following macros are used as a replacement for some automatic variables # due to different make versions. @@ -22,4 +22,4 @@ Q=$^ F=$< C=$< -include $(SRC)make_gen +include make_gen