From b870684d1219dc0484ee0363b38bae90eef76692 Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Fri, 11 Jun 2021 13:17:56 -0500 Subject: [PATCH 1/3] Simplify now that windows-x64 and windows-x64-static are separate. Remove caget and caput, they were not being built but can cause confusion with base. --- Makefile | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Makefile b/Makefile index 973b5fc..7f9f9df 100755 --- a/Makefile +++ b/Makefile @@ -15,31 +15,12 @@ INC += EzcaScan.h USR_CFLAGS = -DACCESS_SECURITY -ifdef WIN32 -# Use the following line if building ezca to be called from -# Visual Basic or other languages -#SHARED_LIBRARIES=YES -# Use the following line to build EzcaScan and ezcaIDL as -# standlone DLLs, i.e. without the need for ezca.dll in the path. -SHARED_LIBRARIES=NO -else -SHARED_LIBRARIES=YES -endif - LIBRARY_HOST := EzcaScan EzcaScan_SRCS = EzcaFunc.c EzcaHash.c EzcaArray.c EzcaUtil.c \ EzcaMonitor.c EzcaScan.c EzcaQueue.c -EzcaFunc_CPPFLAGS += -DBASE_3_14 - EzcaScan_LIBS += ezca ca Com EzcaScan_SYS_LIBS_WIN32 = ws2_32 advapi32 user32 -#PROD_LIBS += EzcaScan ezca ca Com - -#PROD_HOST = caget caput -#caget_SRCS = caget.c -#caput_SRCS = caput.c - include $(TOP)/configure/RULES From 723a1a65cb03737f09c46fc87b00ace6cd36ee0f Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Fri, 11 Jun 2021 13:19:27 -0500 Subject: [PATCH 2/3] Clean up and fix compiler warnings --- EzcaArray.c | 3 +-- EzcaFunc.c | 27 ++------------------------- EzcaHash.c | 2 +- EzcaMonitor.c | 6 ++---- EzcaQueue.c | 6 ++---- EzcaScan.c | 10 ++++++---- 6 files changed, 14 insertions(+), 40 deletions(-) diff --git a/EzcaArray.c b/EzcaArray.c index c34cb0c..cbf61ff 100644 --- a/EzcaArray.c +++ b/EzcaArray.c @@ -584,7 +584,6 @@ struct event_handler_args args; /* int *pint; */ short *ps; long *plong; - int count; chandata *pchandata; struct dbrtemp { chandata *pchan; int rtype; @@ -593,7 +592,7 @@ struct event_handler_args args; temparg = (struct dbrtemp *)args.usr; pchandata = (chandata *)ca_puser(args.chid); - count = ca_element_count(pchandata->chid); + ca_element_count(pchandata->chid); #ifdef ACCESS_SECURITY if (args.status == ECA_NORMAL) { diff --git a/EzcaFunc.c b/EzcaFunc.c index 318bbc6..4a14f51 100644 --- a/EzcaFunc.c +++ b/EzcaFunc.c @@ -48,30 +48,7 @@ epicsShareDef struct caGlobals epicsShareFunc CA = { void epicsShareAPI Ezca_sleep_time(t) double t; /* wait in seconds can be decimal*/ { -#ifdef BASE_3_14 epicsThreadSleep(t); -#else - -/* usleep isn't ANSI-C/POSIX -*/ -unsigned u; -#if defined(HP_UX) - sleep((unsigned int)t); -#elif defined(VMS) - LIB$WAIT(t); -#elif defined(SGI) - sleep((unsigned int)t); -#elif defined(SOLARIS) - usleep((unsigned int)t); -#elif defined(_WIN32) - u = 1000 * t; - Sleep(u); -#else - u = 1000000 * t; - usleep(u); -#endif - -#endif } @@ -83,7 +60,7 @@ int epicsShareAPI Ezca_find_dev(name,pchandata) char *name; chandata **pchandata; { -int status,command_error; +int command_error; /* populate hash table here return the address */ @@ -98,7 +75,7 @@ int status,command_error; if ((*pchandata)->type != TYPENOTCONN) return (CA_SUCCESS); - status = ca_pend_io(CA.PEND_IO_TIME); + ca_pend_io(CA.PEND_IO_TIME); (*pchandata)->type = ca_field_type((*pchandata)->chid); (*pchandata)->state = ca_state((*pchandata)->chid); diff --git a/EzcaHash.c b/EzcaHash.c index 7b39db0..7c1b804 100644 --- a/EzcaHash.c +++ b/EzcaHash.c @@ -99,7 +99,7 @@ static int TT[256] = { static int hash7(s) char *s; { - int i,len; + size_t i,len; int h,h0,h1; char *str; diff --git a/EzcaMonitor.c b/EzcaMonitor.c index 3cf9c69..7323509 100644 --- a/EzcaMonitor.c +++ b/EzcaMonitor.c @@ -164,7 +164,6 @@ void Ezca_monitorValueChangeEvent(args) struct event_handler_args args; { chandata *pchandata; - double time; pchandata = (chandata *)args.usr; @@ -185,7 +184,7 @@ struct event_handler_args args; pchandata->event = 1; pchandata->stamp = ((struct dbr_time_double *)args.dbr)->stamp; if (CA.devprflag > 1) { - time = Ezca_iocClockTime(&pchandata->stamp); + Ezca_iocClockTime(&pchandata->stamp); fprintf(stderr,"New: name=%s, value=%f, stat=%d, sevr=%d, event=%d\n", ca_name(pchandata->chid), pchandata->value, pchandata->status, @@ -209,7 +208,6 @@ void Ezca_monitorStringChangeEvent(args) struct event_handler_args args; { chandata *pchandata; - double time; pchandata = (chandata *)args.usr; @@ -230,7 +228,7 @@ struct event_handler_args args; pchandata->event = 1; pchandata->stamp = ((struct dbr_time_string *)args.dbr)->stamp; if (CA.devprflag > 1) { - time = Ezca_iocClockTime(&pchandata->stamp); + Ezca_iocClockTime(&pchandata->stamp); fprintf(stderr,"NewString: name=%s, value=%s, stat=%d, sevr=%d, event=%d\n", ca_name(pchandata->chid), pchandata->string, pchandata->status, diff --git a/EzcaQueue.c b/EzcaQueue.c index c149def..e1538c3 100644 --- a/EzcaQueue.c +++ b/EzcaQueue.c @@ -63,7 +63,6 @@ void Ezca_queueValueChangeCallback(args) struct event_handler_args args; { chandata *pchandata; - double time; pchandata = (chandata *)args.usr; @@ -85,7 +84,7 @@ struct event_handler_args args; pchandata->stamp = ((struct dbr_time_double *)args.dbr)->stamp; if (CA.devprflag > 1) { - time = Ezca_iocClockTime(&pchandata->stamp); + Ezca_iocClockTime(&pchandata->stamp); fprintf(stderr,"New: name=%s, value=%f, stat=%d, sevr=%d, event=%d\n", ca_name(pchandata->chid), pchandata->value, pchandata->status, @@ -118,7 +117,6 @@ struct event_handler_args args; { chandata *pchandata; int ne; - double time; pchandata = (chandata *)args.usr; @@ -140,7 +138,7 @@ struct event_handler_args args; pchandata->stamp = ((struct dbr_time_double *)args.dbr)->stamp; if (CA.devprflag > 1) { - time = Ezca_iocClockTime(&pchandata->stamp); + Ezca_iocClockTime(&pchandata->stamp); fprintf(stderr,"New: name=%s, value=%f, stat=%d, sevr=%d, event=%d\n", ca_name(pchandata->chid), pchandata->value, pchandata->status, diff --git a/EzcaScan.c b/EzcaScan.c index cb04fa1..d65d53d 100644 --- a/EzcaScan.c +++ b/EzcaScan.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -65,7 +66,6 @@ void Ezca_scanValueChangeCallback(struct event_handler_args args) { chandata *pchan; chandata *pchandata; - double time; int num,nonames,i; pchan = (chandata *)args.usr; @@ -89,7 +89,7 @@ void Ezca_scanValueChangeCallback(struct event_handler_args args) pchan->stamp = ((struct dbr_time_double *)args.dbr)->stamp; if (CA.devprflag > 1) { - time = Ezca_iocClockTime(&pchan->stamp); + Ezca_iocClockTime(&pchan->stamp); fprintf(stderr,"New: name=%s, value=%f, stat=%d, sevr=%d, event=%d\n", ca_name(pchan->chid), pchan->value, pchan->status, @@ -148,6 +148,7 @@ int epicsShareAPI Ezca_scanAdd(int npts,int nonames,char *pv,char **pvnames) } else return(1); /* already monitored return 1 */ } + return command_error; } /****************************************************** @@ -267,7 +268,7 @@ scan process ******************************************************/ int epicsShareAPI Ezca_scanGetMonitor(char *pvName,double *vals) { - int i,command_error=0,num,ii=0; + int i,num,ii=0; evid temp_evid; chandata *pchan; chandata *pchandata; @@ -289,7 +290,8 @@ int epicsShareAPI Ezca_scanGetMonitor(char *pvName,double *vals) temp_evid = pchan->evid; if (pchan->state != cs_conn) { - command_error = CA_FAIL; + epicsMutexUnlock(pchan->mutexId); + return CA_FAIL; } else if (temp_evid ) { From 9c3e65617654b560b6cfd058e6c0d5b4605ffb6f Mon Sep 17 00:00:00 2001 From: Mark Rivers Date: Fri, 11 Jun 2021 14:29:21 -0500 Subject: [PATCH 3/3] Obsolete files --- EzcaScan.def | 36 ----- caget.c | 292 ---------------------------------- caput.c | 440 --------------------------------------------------- 3 files changed, 768 deletions(-) delete mode 100644 EzcaScan.def delete mode 100644 caget.c delete mode 100644 caput.c diff --git a/EzcaScan.def b/EzcaScan.def deleted file mode 100644 index e5e2371..0000000 --- a/EzcaScan.def +++ /dev/null @@ -1,36 +0,0 @@ -LIBRARY EzcaScan - -EXPORTS - -Ezca_check_hash_table -Ezca_debug -Ezca_find_dev -Ezca_getArray -Ezca_getArrayEvent -Ezca_getTypeCount -Ezca_get_error_array -Ezca_init -Ezca_iocClockTime -Ezca_monitorArrayAdd -Ezca_monitorArrayCheck -Ezca_monitorArrayClear -Ezca_monitorArrayGet -Ezca_putArray -Ezca_putArrayEvent -Ezca_pvlist_search -Ezca_queueAdd -Ezca_queueAlloc -Ezca_queueClear -Ezca_queueGet -Ezca_queueZero -Ezca_scanAdd -Ezca_scanAddMonitor -Ezca_scanAlloc -Ezca_scanClearMonitor -Ezca_scanGetMonitor -Ezca_scanZeroMonitor -Ezca_search_list -Ezca_setPendTime -Ezca_sleep_time -Ezca_timeStamp -Ezca_version diff --git a/caget.c b/caget.c deleted file mode 100644 index 351d0c5..0000000 --- a/caget.c +++ /dev/null @@ -1,292 +0,0 @@ -/*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* This file is distributed subject to a Software License Agreement found -* in the file LICENSE that is included with this distribution. -\*************************************************************************/ -/* - $Id$ - * Modification Log: - * ----------------- - * .03 09-24-2002 bkc Remove check pv NAME_LENGTH restriction - * .04 04-28-2003 bkc Fix the problem with -w time out second -*/ - -#ifdef _WIN32 -#include "windows.h" -#endif - -#include -#include -#include -#include -#include -#ifdef EZCA - #include -#endif - -#include "EzcaScan.h" -#include "epicsGetopt.h" - -extern chandata **chanlist,*pchandata; - -#if !defined(_WIN32) && !defined(LINUX) && !defined(SOLARIS) -extern double atof(); -#endif -int no_elements(char *); -int data_array(char *,char **); - -extern char *optarg; -extern int optind; -int TERSE=0,ENUM=0,FORMAT=0,WAVEFORM=0; - -int main(int argc,char **argv) -{ -char **Names,*pvName,*string_value; -char *buff; -void *value; -char f_fmt[15],e_fmt[15]; -int c,rtype,len; -int req_no=0,sp_no=0,noName=1,found=-1,type[1],count[1],i,ret; -int j,nNums,Nums; -unsigned long offset; - -char **pv; -short *sv; -dbr_char_t *cv; -int *iv; -float *fv; -double *dv; -int first=1; - - CA.PEND_IOLIST_TIME = 1.0; -if (argc < 2) { - printf("\nUsage: caget [-n] [-t] [-f n] [-e n] [-w sec] pv_name\n\n"); - printf("This command read a value or array of values from one or more IOC channels.\n\n"); - printf(" -n returns numerical value instead of string for DBR_ENUM field\n"); - printf(" -t Terse mode, process variable name not returned\n"); - printf(" -f n Use f format, n specifies number of digits after the decimal point\n"); - printf(" -e n Use e format, n specifies number of digits after the decimal point\n"); - printf(" -w sec Wait time, specifies bigger time out, default is 1.0 second\n"); - printf(" -# no The number 'no' specifies the number of values to be returned for\n"); - printf(" an array record. If this option is not used then the whole array\n"); - printf(" is returned. The first returned number is the size of the array ,\n"); - printf(" then it is followed with the array of values obtained.\n"); - printf(" pv_name a single or a list of PV names from IOC\n\n"); - printf(" Examples: caget pv_name\n"); - printf(" caget pv_name1 pv_name2 pv_name3\n\n"); - return(1); /*exit(1); */ - } - -while ((c = getopt(argc,argv,"ntf:e:w:#:")) != -1) - switch (c) { - case 'n': - ENUM = 1; - break; - case 't': - TERSE = 1; - break; - case 'f': - FORMAT = 1; - sprintf(f_fmt,"%c-.%sf ",37,optarg); - break; - case 'e': - FORMAT = 2; - sprintf(e_fmt,"%c-.%se ",37,optarg); - break; - case 'w': - CA.PEND_IOLIST_TIME = atof(optarg); - if (CA.PEND_IOLIST_TIME < 1.0) CA.PEND_IOLIST_TIME = 1.0; - break; - case '#': - WAVEFORM = 1; - sp_no = atoi(optarg); - break; - } - - first = optind; - - ca_task_initialize(); - - Nums = argc - first; - Names = (char **)calloc(Nums,sizeof(char *)); - - if (Nums > 1 ) { - for (j=0;j 1) { - free(Names); - Names = (char **)calloc(nNums,sizeof(char *)); - len = strlen(argv[first]); - Nums = data_array(argv[first],Names); - } else { - Names[0] = argv[first]; - } - } - - - for (j=0;j count[0]) req_no = count[0]; - buff = (char *)calloc(count[0],MAX_STRING_SIZE); - - - if (count[0] > 0) { - offset = count[0]*dbr_value_size[rtype]; - value = (void *)buff; - ret = Ezca_getArray(noName,&pvName,rtype,count[0],value); - - if (!TERSE) { - if (count[0] > 1) printf("%s",pvName); - else printf("%-30s",pvName); - } - if (count[0] > 1) printf(" %d ",req_no); - - switch (rtype) { - case DBR_INT: /* DBR_SHORT */ - sv = (short *)value; - for (i=0;i 1) { - for (i=0;i 0 ) - printf("%s ",string_value); - else printf("%d ",sv[0]); - - free(string_value); - } - break; - case DBR_FLOAT: - fv = (float *)value; - for (i=0;i -#include -#include -#include -#include -#ifdef EZCA - #include -#endif - -#include "EzcaScan.h" -#include "epicsGetopt.h" -extern chandata **chanlist,*pchandata; -#if !defined(_WIN32) && !defined(LINUX) && !defined(SOLARIS) -extern double atof(); -int getopt(); -#endif -int print_caget(void); -int no_elements(char *); -int data_array(char *,char **); - -extern char *optarg; -extern int optind; -int TERSE=0,ENUM_V=1,FORMAT=0,VECTOR=0,INITIAL=0; - -char *pvName,f_fmt[15],e_fmt[15]; -int noName,req_no=1,rtype,type[1],count[1]; -void *value; -char *buff; - -int main(argc,argv) -int argc; -char **argv; -{ -int c,found,ret,i,len,first=1; -char **pv,**dataArray; -short *sv; -dbr_char_t *cv; -int *iv; -float *fv; -double *dv; -char *tempValue,*tempName,**pvNames; -int noName,noData; - -CA.PEND_IOLIST_TIME = 1.; - -if (argc < 3) { - printf("\nUsage: caput [-t] [-s] [-w sec] [-m] [-z] [--] pv_name pv_value\n\n"); - printf("This command writes a value or array of values to a channel.\n"); - printf("It can also write an array of single values to an array of channels.\n\n"); - printf(" -t Terse mode, only the successfully put value is returned\n"); - printf(" -s pv_value entered as database defined enumeral string\n"); - printf(" -w sec Wait time, specifies bigger time out, default is 1 second\n"); - printf(" -m this option specified the input value string is \n"); - printf(" a comma separated values for a waveform record \n"); - printf(" -z zero remaining undefined waveform record fields with 0\n"); - printf(" pv_name requested database process variable name\n"); - printf(" (multiple PV names must be seperated by comma no space)\n"); - printf(" pv_value new value to put to IOC\n"); - printf(" (multiple PV values must be seperated by comma no space)\n\n"); - printf(" Examples: caput pv_name pv_value\n"); - printf(" caput pv_name1,pv_name2 pv_value1,pv_value2\n\n"); - printf(" caput -m wf_name v1,v2,v3,...\n"); - printf(" caput -z wf_name v1,v2,v3,...\n"); - printf(" caput -z wf_name 0\n\n"); - - exit(1); - } - -while ((c = getopt(argc-2,argv,"tsmzw:")) != -1) - switch (c) { - case 't': - TERSE = 1; - break; - case 's': - ENUM_V = 0; - break; - case 'm': - VECTOR = 1; - break; - case 'z': - VECTOR = 1; - INITIAL = 1; - break; - case 'w': - CA.PEND_IOLIST_TIME = atof(optarg); - if (CA.PEND_IOLIST_TIME < 1.) CA.PEND_IOLIST_TIME = 1.; - break; - } - -/* -if (argv[optind] == NULL || strlen(argv[optind]) > NAME_LENGTH) { - printf(" %s is an invalid channel name\n", argv[optind]); - return(1); - } -*/ - - first = optind; - - ca_task_initialize(); - - noName = 1; - pvName = argv[first]; - -/* check for pv list */ - noName = no_elements(argv[first]); - - len = strlen(argv[first]); - tempName = (char *)calloc(1,len+1); - strcpy(tempName,argv[first]); - - if (noName > 1 ) { - pvNames = (char **)calloc(noName,sizeof(char *)); - noName = data_array(tempName,pvNames); - - noData = no_elements(argv[first+1]); - - if (noData > 1 ) { - dataArray = (char **)calloc(noData,sizeof(char *)); - if (VECTOR==1 || noData == noName) { - len = strlen(argv[first+1]); - tempValue = (char *)calloc(1,len+1); - strcpy(tempValue,argv[first+1]); - - if (argc == first+2) - req_no = data_array(tempValue,dataArray); - else { printf("Syntax error in data elements!! \n"); - return(-1); } - } else { - printf("Error: Inconsistant data elements entered!! \n"); - return(-1); - } - - found = Ezca_getTypeCount(noName,pvNames,type,count); - - buff = (char *)calloc(noData,MAX_STRING_SIZE); - value = (void *)buff; - pv = (char **)calloc(noName,sizeof(char *)); - for (i=0;i count[0]) req_no = count[0]; - - buff = (char *)calloc(count[0],MAX_STRING_SIZE); - value = (void *)buff; - -/* get old value */ - - ret = Ezca_getArray(noName,&pvName,rtype,count[0],value); - - -/* put value as default except -s for DBR_ENUM */ - - dataArray = (char **)calloc(count[0],sizeof(char *)); - if (VECTOR==1) { - if (argc == first+2) - req_no = data_array(argv[first+1],dataArray); - else { printf("Syntax error in data elements!! \n"); - return(-1); } - } else { - for (i=0;i 1) printf("Old : %s %d ",pvName,req_no); - else printf("Old : %-30s ",pvName); - print_caget(); - } - - switch(rtype) { - case DBR_ENUM: - if (ENUM_V == 0) { - if (INITIAL == 1) { - for (i=0;i 1) printf("New : %s %d ",pvName,req_no); - else printf("New : %-30s ",pvName); - } - print_caget(); - } - -end_task: - ca_task_exit(); - - free(dataArray); - free(tempName); - free(buff); - return(0); -} - - -int print_caget(void) -{ -int i; -char **pv; -short *sv; -dbr_char_t *cv; -int *iv; -float *fv; -double *dv; - - switch (rtype) { - case DBR_INT: /* DBR_SHORT */ - sv = (short *)value; - for (i=0;i 1) { - for (i=0;i 0 ) - printf("%s ",(char *)value); - else printf("%d ",sv[0]); - } - break; - case DBR_FLOAT: - fv = (float *)value; - for (i=0;i