diff --git a/src/util/ca_test.c b/src/util/ca_test.c index 7943bf001..502f420b6 100644 --- a/src/util/ca_test.c +++ b/src/util/ca_test.c @@ -1,4 +1,5 @@ -/* $Id$ + +/* @(#)ca_test.c $Id$ * Author: Jeff Hill * Date: 07-01-91 * @@ -32,7 +33,9 @@ */ #include -#include +#include +#define ERROR -1 +#define OK 0 void printit(); void verify(); @@ -55,6 +58,11 @@ char **argv; return ca_test(argv[1], NULL); } else if(argc == 3){ + char *pt; + + /* strip leading and trailing quotes*/ + if(argv[2][1]=='"') argv[2]++; + if(pt=strchr(argv[2],'"')) *pt = 0; return ca_test(argv[1], argv[2]); } else{ @@ -63,7 +71,6 @@ char **argv; } #endif - int ca_test(pname, pvalue ) char *pname; @@ -108,6 +115,13 @@ char *pname; * fetch as each type */ for(i=0; i<=LAST_BUFFER_TYPE; i++){ + if(ca_field_type(chan_id)==0) { + if( (i!=DBR_STRING) + && (i!=DBR_STS_STRING) + && (i!=DBR_TIME_STRING) + && (i!=DBR_GR_STRING) + && (i!=DBR_CTRL_STRING)) continue; + } status = ca_array_get_callback( i, ca_element_count(chan_id), @@ -278,7 +292,6 @@ int type; outstanding++; } - /* * PRINT_RETURNED @@ -286,71 +299,62 @@ int type; * print out the values in a database access interface structure */ static print_returned(type,pbuffer,count) -register short type; -register char *pbuffer; -short count; + short type; + char *pbuffer; + short count; { - register short i; + short i; + printf("%s\t",dbr_text[type]); switch(type){ case (DBR_STRING): - printf("\n\tDBR_STRING Value: %s",pbuffer); + printf("%s\t",pbuffer); break; case (DBR_SHORT): + case (DBR_ENUM): { - register short *pvalue = (short *)pbuffer; - printf("\n\tDBR_SHORT "); + short *pvalue = (short *)pbuffer; for (i = 0; i < count; i++,pvalue++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%d ",*(short *)pvalue); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_FLOAT): { - register float *pvalue = (float *)pbuffer; - printf("\n\tDBR_FLOAT "); + float *pvalue = (float *)pbuffer; for (i = 0; i < count; i++,pvalue++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",*(float *)pvalue); - if ((i % 16) == 15) printf("\n\t"); } break; } - case (DBR_ENUM): - { - register short *pvalue = (short *)pbuffer; - printf("\n\tDBR_ENUM %d",*pvalue); - break; - } case (DBR_CHAR): { int value; - printf("\n\tDBR_CHAR "); for (i = 0; i < count; i++,pbuffer++){ + if(count!=1 && (i%10 == 0)) printf("\n"); value = *(unsigned char *)pbuffer; printf("%d ",value); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_LONG): { - register long *pvalue = (long *)pbuffer; - printf("\n\tDBR_LONG "); + long *pvalue = (long *)pbuffer; for (i = 0; i < count; i++,pvalue++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("0x%x ",*pvalue); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_DOUBLE): { - register double *pvalue = (double *)pbuffer; - printf("\n\tDBR_DOUBLE "); + double *pvalue = (double *)pbuffer; for (i = 0; i < count; i++,pvalue++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",(float)(*pvalue)); - if ((i % 16) == 15) printf("\n\t"); } break; } @@ -358,365 +362,384 @@ short count; case (DBR_GR_STRING): case (DBR_CTRL_STRING): { - register struct dbr_sts_string *pvalue + struct dbr_sts_string *pvalue = (struct dbr_sts_string *) pbuffer; - printf("\n\tDBR_STS_STRING %2d %2d",pvalue->status,pvalue->severity); + printf("%2d %2d",pvalue->status,pvalue->severity); printf("\tValue: %s",pvalue->value); break; } + case (DBR_STS_ENUM): case (DBR_STS_SHORT): { - register struct dbr_sts_short *pvalue + struct dbr_sts_short *pvalue = (struct dbr_sts_short *)pbuffer; - register short *pshort = &pvalue->value; - printf("\n\tDBR_STS_SHORT %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: "); + short *pshort = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pshort++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%d ",*pshort); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_STS_FLOAT): { - register struct dbr_sts_float *pvalue + struct dbr_sts_float *pvalue = (struct dbr_sts_float *)pbuffer; - register float *pfloat = &pvalue->value; - printf("\n\tDBR_STS_FLOAT %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: "); + float *pfloat = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pfloat++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",*pfloat); - if ((i % 16) == 15) printf("\n\t"); } break; } - case (DBR_STS_ENUM): - { - register struct dbr_sts_enum *pvalue - = (struct dbr_sts_enum *)pbuffer; - printf("\n\tDBR_STS_ENUM %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %d",pvalue->value); - break; - } case (DBR_STS_CHAR): { - register struct dbr_sts_char *pvalue + struct dbr_sts_char *pvalue = (struct dbr_sts_char *)pbuffer; - register unsigned char *pchar = &pvalue->value; + unsigned char *pchar = &pvalue->value; short value; - printf("\n\tDBR_STS_CHAR %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: "); + printf("%2d %2d",pvalue->status,pvalue->severity); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pchar++){ + if(count!=1 && (i%10 == 0)) printf("\n"); value=*pchar; printf("%d ",value); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_STS_LONG): { - register struct dbr_sts_long *pvalue + struct dbr_sts_long *pvalue = (struct dbr_sts_long *)pbuffer; - register long *plong = &pvalue->value; - printf("\n\tDBR_STS_LONG %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: "); + long *plong = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("0x%lx ",*plong); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_STS_DOUBLE): { - register struct dbr_sts_double *pvalue + struct dbr_sts_double *pvalue = (struct dbr_sts_double *)pbuffer; - register double *pdouble = &pvalue->value; - printf("\n\tDBR_STS_DOUBLE %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: "); + double *pdouble = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pdouble++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",(float)(*pdouble)); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_TIME_STRING): { - register struct dbr_time_string *pvalue + struct dbr_time_string *pvalue = (struct dbr_time_string *) pbuffer; - printf("\n\tDBR_TIME_STRING %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); + printf("%2d %2d",pvalue->status,pvalue->severity); + printf("\tTimeStamp: %lx %lx", + pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); + printf("\tValue: "); + printf("%s",pvalue->value); break; } case (DBR_TIME_SHORT): + case (DBR_TIME_ENUM): { - register struct dbr_time_short *pvalue + struct dbr_time_short *pvalue = (struct dbr_time_short *)pbuffer; - register short *pshort = &pvalue->value; - printf("\n\tDBR_TIME_SHORT %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); + short *pshort = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + printf("\tTimeStamp: %lx %lx", + pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pshort++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%d ",*pshort); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_TIME_FLOAT): { - register struct dbr_time_float *pvalue + struct dbr_time_float *pvalue = (struct dbr_time_float *)pbuffer; - register float *pfloat = &pvalue->value; - printf("\n\tDBR_TIME_FLOAT %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); + float *pfloat = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + printf("\tTimeStamp: %lx %lx", + pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pfloat++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",*pfloat); - if ((i % 16) == 15) printf("\n\t"); } break; } - case (DBR_TIME_ENUM): - { - register struct dbr_time_enum *pvalue - = (struct dbr_time_enum *)pbuffer; - printf("\n\tDBR_TIME_ENUM %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); - break; - } case (DBR_TIME_CHAR): { - register struct dbr_time_char *pvalue + struct dbr_time_char *pvalue = (struct dbr_time_char *)pbuffer; - register unsigned char *pchar = &pvalue->value; - printf("\n\tDBR_TIME_CHAR %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); + unsigned char *pchar = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + printf("\tTimeStamp: %lx %lx", + pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pchar++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%d ",(short)(*pchar)); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_TIME_LONG): { - register struct dbr_time_long *pvalue + struct dbr_time_long *pvalue = (struct dbr_time_long *)pbuffer; - register long *plong = &pvalue->value; - printf("\n\tDBR_TIME_LONG %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); + long *plong = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + printf("\tTimeStamp: %lx %lx", + pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("0x%lx ",*plong); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_TIME_DOUBLE): { - register struct dbr_time_double *pvalue + struct dbr_time_double *pvalue = (struct dbr_time_double *)pbuffer; - register double *pdouble = &pvalue->value; - printf("\n\tDBR_TIME_DOUBLE %2d %2d",pvalue->status,pvalue->severity); - printf("\tValue: %lx %lx ",pvalue->stamp.secPastEpoch,pvalue->stamp.nsec); + double *pdouble = &pvalue->value; + printf("%2d %2d",pvalue->status,pvalue->severity); + printf("\tTimeStamp: %lx %lx", + pvalue->stamp.secPastEpoch, pvalue->stamp.nsec); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pdouble++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",(float)(*pdouble)); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_GR_SHORT): { - register struct dbr_gr_short *pvalue + struct dbr_gr_short *pvalue = (struct dbr_gr_short *)pbuffer; - register short *pshort = &pvalue->value; - printf("\n\tDBR_GR_SHORT %2d %2d",pvalue->status,pvalue->severity); - printf(" %.8s %6d %6d %6d %6d %6d %6d",pvalue->units, + short *pshort = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf("\n\t%8d %8d %8d %8d %8d %8d", pvalue->upper_disp_limit,pvalue->lower_disp_limit, pvalue->upper_alarm_limit,pvalue->upper_warning_limit, pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf("\n\t"); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pshort++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%d ",*pshort); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_GR_FLOAT): { - register struct dbr_gr_float *pvalue + struct dbr_gr_float *pvalue = (struct dbr_gr_float *)pbuffer; - register float *pfloat = &pvalue->value; - printf("\n\tDBR_GR_FLOAT%2d %2d",pvalue->status,pvalue->severity); - printf(" %3d %.8s\n\t%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f", - pvalue->precision, pvalue->units, + float *pfloat = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf(" %3d\n\t%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f", + pvalue->precision, pvalue->upper_disp_limit,pvalue->lower_disp_limit, pvalue->upper_alarm_limit,pvalue->upper_warning_limit, pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf("\n\t"); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pfloat++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",*pfloat); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_GR_ENUM): case (DBR_CTRL_ENUM): { - register struct dbr_gr_enum *pvalue + struct dbr_gr_enum *pvalue = (struct dbr_gr_enum *)pbuffer; - printf("\n\tDBR_GR_ENUM%2d %2d",pvalue->status,pvalue->severity); - printf("\n\t%3d",pvalue->no_str); - for (i = 0; i < pvalue->no_str; i++) - printf("\n\t%.26s",pvalue->strs[i]); - printf("\n\tValue: %d",pvalue->value); + printf("%2d %2d",pvalue->status, + pvalue->severity); + printf("\tValue: %d",pvalue->value); + if(pvalue->no_str>0) { + printf("\n\t%3d",pvalue->no_str); + for (i = 0; i < pvalue->no_str; i++) + printf("\n\t%.26s",pvalue->strs[i]); + } break; } case (DBR_GR_CHAR): { - register struct dbr_gr_char *pvalue + struct dbr_gr_char *pvalue = (struct dbr_gr_char *)pbuffer; - register unsigned char *pchar = &pvalue->value; - printf("\n\tDBR_GR_CHAR%2d %2d",pvalue->status,pvalue->severity); - printf(" %.8s %4d %4d %4d %4d %4d %4d",pvalue->units, + unsigned char *pchar = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf("\n\t%8d %8d %8d %8d %8d %8d", pvalue->upper_disp_limit,pvalue->lower_disp_limit, pvalue->upper_alarm_limit,pvalue->upper_warning_limit, pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf("\tValue: "); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pchar++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%d ",(short)(*pchar)); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_GR_LONG): { - register struct dbr_gr_long *pvalue + struct dbr_gr_long *pvalue = (struct dbr_gr_long *)pbuffer; - register long *plong = &pvalue->value; - printf("\n\tDBR_GR_LONG %2d %2d",pvalue->status,pvalue->severity); - printf("%.8s\n\t%8d %8d %8d %8d %8d %8d",pvalue->units, + long *plong = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf("\n\t%8d %8d %8d %8d %8d %8d", pvalue->upper_disp_limit,pvalue->lower_disp_limit, pvalue->upper_alarm_limit,pvalue->upper_warning_limit, pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf("\n\t"); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("0x%lx ",*plong); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_GR_DOUBLE): { - register struct dbr_gr_double *pvalue + struct dbr_gr_double *pvalue = (struct dbr_gr_double *)pbuffer; - register double *pdouble = &pvalue->value; - printf("\n\tDBR_GR_DOUBLE %2d %2d",pvalue->status,pvalue->severity); - printf(" %3d %.8s\n\t%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f", - pvalue->precision, pvalue->units, - (float)(pvalue->upper_disp_limit),(float)(pvalue->lower_disp_limit), - (float)(pvalue->upper_alarm_limit),(float)(pvalue->upper_warning_limit), - (float)(pvalue->lower_warning_limit),(float)(pvalue->lower_alarm_limit)); - printf("\n\t"); + double *pdouble = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf(" %3d\n\t%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f", + pvalue->precision, + (float)(pvalue->upper_disp_limit), + (float)(pvalue->lower_disp_limit), + (float)(pvalue->upper_alarm_limit), + (float)(pvalue->upper_warning_limit), + (float)(pvalue->lower_warning_limit), + (float)(pvalue->lower_alarm_limit)); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pdouble++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.4f ",(float)(*pdouble)); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_CTRL_SHORT): { - register struct dbr_ctrl_short *pvalue + struct dbr_ctrl_short *pvalue = (struct dbr_ctrl_short *)pbuffer; - register short *pshort = &pvalue->value; - printf("\n\tDBR_CTRL_SHORT %2d %2d",pvalue->status,pvalue->severity); - printf(" %.8s\n\t%6d %6d %6d %6d %6d %6d",pvalue->units, - pvalue->upper_disp_limit,pvalue->lower_disp_limit, - pvalue->upper_alarm_limit,pvalue->upper_warning_limit, - pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf(" %6d %6d", - pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); - printf("\n\t"); - for (i = 0; i < count; i++,pshort++){ - printf("%d ",*pshort); - if ((i % 16) == 15) printf("\n\t"); - } - break; - } - case (DBR_CTRL_FLOAT): - { - register struct dbr_ctrl_float *pvalue - = (struct dbr_ctrl_float *)pbuffer; - register float *pfloat = &pvalue->value; - printf("\n\tDBR_CTRL_FLOAT %2d %2d",pvalue->status,pvalue->severity); - printf(" %3d %.8s\n\t%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f", - pvalue->precision, pvalue->units, - pvalue->upper_disp_limit,pvalue->lower_disp_limit, - pvalue->upper_alarm_limit,pvalue->upper_warning_limit, - pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf(" %6.4f %6.4f", - pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); - printf("\n\t"); - for (i = 0; i < count; i++,pfloat++){ - printf("%6.4f ",*pfloat); - if ((i % 16) == 15) printf("\n\t"); - } - break; - } - case (DBR_CTRL_CHAR): - { - register struct dbr_ctrl_char *pvalue - = (struct dbr_ctrl_char *)pbuffer; - register unsigned char *pchar = &pvalue->value; - printf("\n\tDBR_CTRL_CHAR %2d %2d",pvalue->status,pvalue->severity); - printf(" %.8s %4d %4d %4d %4d %4d %4d",pvalue->units, - pvalue->upper_disp_limit,pvalue->lower_disp_limit, - pvalue->upper_alarm_limit,pvalue->upper_warning_limit, - pvalue->lower_warning_limit,pvalue->lower_alarm_limit); - printf(" %4d %4d", - pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); - printf("\n\t"); - for (i = 0; i < count; i++,pchar++){ - printf("%4d ",(short)(*pchar)); - if ((i % 16) == 15) printf("\n\t"); - } - break; - } - case (DBR_CTRL_LONG): - { - register struct dbr_ctrl_long *pvalue - = (struct dbr_ctrl_long *)pbuffer; - register long *plong = &pvalue->value; - printf("\n\tDBR_CTRL_LONG %2d %2d",pvalue->status,pvalue->severity); - printf(" %.8s %8d %8d\n\t%8d %8d %8d %8d",pvalue->units, + short *pshort = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf("\n\t%8d %8d %8d %8d %8d %8d", pvalue->upper_disp_limit,pvalue->lower_disp_limit, pvalue->upper_alarm_limit,pvalue->upper_warning_limit, pvalue->lower_warning_limit,pvalue->lower_alarm_limit); printf(" %8d %8d", pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); - printf("\n\t"); + if(count==1) printf("\tValue: "); + for (i = 0; i < count; i++,pshort++){ + if(count!=1 && (i%10 == 0)) printf("\n"); + printf("%d ",*pshort); + } + break; + } + case (DBR_CTRL_FLOAT): + { + struct dbr_ctrl_float *pvalue + = (struct dbr_ctrl_float *)pbuffer; + float *pfloat = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf(" %3d\n\t%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f", + pvalue->precision, + pvalue->upper_disp_limit,pvalue->lower_disp_limit, + pvalue->upper_alarm_limit,pvalue->upper_warning_limit, + pvalue->lower_warning_limit,pvalue->lower_alarm_limit); + printf(" %8.3f %8.3f", + pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); + if(count==1) printf("\tValue: "); + for (i = 0; i < count; i++,pfloat++){ + if(count!=1 && (i%10 == 0)) printf("\n"); + printf("%6.4f ",*pfloat); + } + break; + } + case (DBR_CTRL_CHAR): + { + struct dbr_ctrl_char *pvalue + = (struct dbr_ctrl_char *)pbuffer; + unsigned char *pchar = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf("\n\t%8d %8d %8d %8d %8d %8d", + pvalue->upper_disp_limit,pvalue->lower_disp_limit, + pvalue->upper_alarm_limit,pvalue->upper_warning_limit, + pvalue->lower_warning_limit,pvalue->lower_alarm_limit); + printf(" %8d %8d", + pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); + if(count==1) printf("\tValue: "); + for (i = 0; i < count; i++,pchar++){ + if(count!=1 && (i%10 == 0)) printf("\n"); + printf("%4d ",(short)(*pchar)); + } + break; + } + case (DBR_CTRL_LONG): + { + struct dbr_ctrl_long *pvalue + = (struct dbr_ctrl_long *)pbuffer; + long *plong = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf("\n\t%8d %8d %8d %8d %8d %8d", + pvalue->upper_disp_limit,pvalue->lower_disp_limit, + pvalue->upper_alarm_limit,pvalue->upper_warning_limit, + pvalue->lower_warning_limit,pvalue->lower_alarm_limit); + printf(" %8d %8d", + pvalue->upper_ctrl_limit,pvalue->lower_ctrl_limit); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,plong++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("0x%lx ",*plong); - if ((i % 16) == 15) printf("\n\t"); } break; } case (DBR_CTRL_DOUBLE): { - register struct dbr_ctrl_double *pvalue + struct dbr_ctrl_double *pvalue = (struct dbr_ctrl_double *)pbuffer; - register double *pdouble = &pvalue->value; - printf("\n\tDBR_CTRL_DOUBLE%2d %2d",pvalue->status,pvalue->severity); - printf(" %3d %.8s\n\t%6.6f %6.6f %6.6f %6.6f %6.6f %6.6f", - pvalue->precision, pvalue->units, - (float)(pvalue->upper_disp_limit),(float)(pvalue->lower_disp_limit), - (float)(pvalue->upper_alarm_limit),(float)(pvalue->upper_warning_limit), - (float)(pvalue->lower_warning_limit),(float)(pvalue->lower_alarm_limit)); - printf(" %6.6f %6.6f", - (float)(pvalue->upper_ctrl_limit),(float)(pvalue->lower_ctrl_limit)); - printf("\n\t"); + double *pdouble = &pvalue->value; + printf("%2d %2d %.8s",pvalue->status,pvalue->severity, + pvalue->units); + printf(" %3d\n\t%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f", + pvalue->precision, + (float)(pvalue->upper_disp_limit), + (float)(pvalue->lower_disp_limit), + (float)(pvalue->upper_alarm_limit), + (float)(pvalue->upper_warning_limit), + (float)(pvalue->lower_warning_limit), + (float)(pvalue->lower_alarm_limit)); + printf(" %8.3f %8.3f", + (float)(pvalue->upper_ctrl_limit), + (float)(pvalue->lower_ctrl_limit)); + if(count==1) printf("\tValue: "); for (i = 0; i < count; i++,pdouble++){ + if(count!=1 && (i%10 == 0)) printf("\n"); printf("%6.6f ",(float)(*pdouble)); - if ((i % 16) == 15) printf("\n\t"); } break; } } + printf("\n"); } -