diff --git a/src/db/db_access.c b/src/db/db_access.c index 439d8cadc..1a326bac8 100644 --- a/src/db/db_access.c +++ b/src/db/db_access.c @@ -30,6 +30,7 @@ * Modification Log: * ----------------- * .01 06-25-91 joh inserted the RISC aligned db_access.h structures + * .02 08-06-91 mrk Make extra values 0 */ @@ -572,7 +573,7 @@ db_name_to_addr(pname,paddr) return(-1); } -/* DB_GET_FIELD get a field and convert it to the desired type */ +typedef char DBSTRING[MAX_STRING_SIZE]; db_get_field(paddr,buffer_type,pbuffer,no_elements) struct dbAddr *paddr; @@ -585,44 +586,80 @@ unsigned short no_elements; long nRequest; long precision; short severity; + long i; switch(buffer_type) { case(oldDBR_STRING): - options=0; - nRequest=no_elements; - status = dbGetField(paddr,DBR_STRING,pbuffer,&options,&nRequest); + { + DBSTRING *pvalue = (DBSTRING *)pbuffer; + + options=0; + nRequest=no_elements; + status = dbGetField(paddr,DBR_STRING,pbuffer,&options,&nRequest); + for(i=nRequest; ivalue); options=DBR_STATUS; nRequest=0; @@ -642,6 +680,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_STRING,&(pold->value[0]), &options,&nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS; nRequest=0; @@ -661,6 +701,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_SHORT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS; nRequest=0; @@ -679,6 +721,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_FLOAT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS; nRequest=0; @@ -697,6 +741,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_ENUM,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS; nRequest=0; @@ -715,6 +761,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_UCHAR,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS; nRequest=0; @@ -733,6 +781,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_LONG,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS; nRequest=0; @@ -751,6 +801,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_DOUBLE,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue); options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -771,6 +823,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_STRING,pold->value,&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -792,6 +846,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_SHORT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -812,6 +868,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_FLOAT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -832,6 +890,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_ENUM,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -852,6 +912,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_CHAR,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -872,6 +934,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_LONG,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS | DBR_TIME; nRequest=0; @@ -892,6 +956,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_DOUBLE,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_AL_LONG; nRequest=0; @@ -922,6 +988,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_SHORT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE |DBR_AL_DOUBLE; @@ -953,6 +1021,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_FLOAT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_AL_LONG; nRequest=0; @@ -982,6 +1052,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_UCHAR,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_AL_LONG; nRequest=0; @@ -1010,6 +1082,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_LONG,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE |DBR_AL_DOUBLE; @@ -1041,6 +1115,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_DOUBLE,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_CTRL_LONG |DBR_AL_LONG; @@ -1074,6 +1150,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_SHORT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE |DBR_CTRL_DOUBLE|DBR_AL_DOUBLE; @@ -1108,6 +1186,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_FLOAT,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; bzero(pold,sizeof(struct dbr_ctrl_enum)); /* first get status and severity */ @@ -1138,6 +1218,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_ENUM,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_CTRL_LONG |DBR_AL_LONG; @@ -1170,6 +1252,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_UCHAR,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_CTRL_LONG |DBR_AL_LONG; @@ -1202,6 +1286,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_LONG,&(pold->value),&options, &nRequest); + for(i=nRequest; ivalue; options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE |DBR_CTRL_DOUBLE|DBR_AL_DOUBLE; @@ -1236,6 +1322,7 @@ unsigned short no_elements; nRequest=no_elements; status = dbGetField(paddr,DBR_DOUBLE,&(pold->value),&options, &nRequest); + for(i=nRequest; i @@ -197,7 +198,11 @@ static print_returned(type,pbuffer,count) printf("%s\t",dbr_text[type]); switch(type){ case (DBR_STRING): - printf("%s\t",pbuffer); + for(i=0; i +#endif +#ifndef ERROR +#define ERROR -1 +#endif +#ifndef OK +#define OK 0 +#endif + #include #include -#define ERROR -1 -#define OK 0 - void printit(); void verify(); @@ -49,7 +56,12 @@ char **argv; { if(argc < 2 || argc > 3){ - printf("usage: cagft \n"); + printf("usage: ca_test channel_name <\"put value\">\n"); + printf("the following arguments were received\n"); + while(argc>0) { + printf("%s\n",argv[0]); + argv++; argc--; + } return ERROR; } @@ -210,6 +222,8 @@ char *pvalue; SEVCHK(status, NULL); verify(chan_id, DBR_STRING); + if(ca_field_type(chan_id)==0)goto skip_rest; + if(sscanf(pvalue,"%hd",&shortvalue)==1) { status = ca_put( DBR_SHORT, @@ -256,6 +270,8 @@ char *pvalue; verify(chan_id, DBR_DOUBLE); } +skip_rest: + while(ntries){ ca_pend_event(1.0); @@ -308,7 +324,11 @@ static print_returned(type,pbuffer,count) printf("%s\t",dbr_text[type]); switch(type){ case (DBR_STRING): - printf("%s\t",pbuffer); + for(i=0; i