changes for long being 64 bits

This commit is contained in:
Marty Kraimer
2002-12-06 14:13:36 +00:00
parent 6f8cadf2d2
commit 54ee23afb9
9 changed files with 363 additions and 692 deletions
+4 -1
View File
@@ -60,6 +60,7 @@ typedef epicsUInt16 dbr_put_ackt_t;
typedef epicsUInt16 dbr_put_acks_t;
typedef epicsOldString dbr_class_name_t;
#ifndef db_accessHFORdb_accessC
/* database field types */
#define DBF_STRING 0
#define DBF_INT 1
@@ -177,7 +178,7 @@ epicsShareExtern READONLY epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1];
* DBR_CTRL_LONG returns a control long structure (dbr_ctrl_long)
* DBR_CTRL_DOUBLE returns a control double structure (dbr_ctrl_double)
*/
#endif /*db_accessHFORdb_accessC*/
/* VALUES WITH STATUS STRUCTURES */
@@ -524,6 +525,7 @@ struct dbr_ctrl_double{
dbr_double_t value; /* current value */
};
#ifndef db_accessHFORdb_accessC
#define dbr_size_n(TYPE,COUNT)\
((unsigned)((COUNT)<=0?dbr_size[TYPE]:dbr_size[TYPE]+((COUNT)-1)*dbr_value_size[TYPE]))
@@ -730,6 +732,7 @@ epicsShareExtern READONLY char *dbf_text_invalid;
epicsShareExtern READONLY char *dbr_text[LAST_BUFFER_TYPE+1];
epicsShareExtern READONLY short dbr_text_dim;
epicsShareExtern READONLY char *dbr_text_invalid;
#endif /*db_accessHFORdb_accessC*/
#ifdef __cplusplus
}
+38 -27
View File
@@ -13,8 +13,19 @@
#ifndef INCdbAccessDefsh
#define INCdbAccessDefsh
#ifdef epicsExportSharedSymbols
# define INCLdb_accessh_epicsExportSharedSymbols
# undef epicsExportSharedSymbols
#endif
#include "epicsTypes.h"
#include "epicsTime.h"
#include "shareLib.h"
#ifdef INCLdb_accessh_epicsExportSharedSymbols
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
@@ -45,7 +56,7 @@ epicsShareExtern volatile int interruptAccept;
* struct {
* DBRstatus
* DBRtime
* float value[10]
* epicsFloat32 value[10]
* } buffer;
*
* IMPORTANT!! The DBRoptions must be given in the order that they
@@ -78,7 +89,7 @@ epicsShareExtern volatile int interruptAccept;
* typedef struct {
* DBRstatus
* DBRtime
* float value[10]
* epicsFloat32 value[10]
* } MYBUFFER;
*
* With this definition you can give definitions such as the following:
@@ -89,44 +100,44 @@ epicsShareExtern volatile int interruptAccept;
/* Macros for defining each option */
#define DBRstatus \
unsigned short status; /* alarm status */\
unsigned short severity; /* alarm severity*/\
unsigned short acks; /* alarm ack severity*/\
unsigned short ackt; /* Acknowledge transient alarms?*/
epicsUInt16 status; /* alarm status */\
epicsUInt16 severity; /* alarm severity*/\
epicsUInt16 acks; /* alarm ack severity*/\
epicsUInt16 ackt; /* Acknowledge transient alarms?*/
#define DB_UNITS_SIZE 16
#define DBRunits \
char units[DB_UNITS_SIZE]; /* units */
#define DBRprecision \
long precision; /* number of decimal places*/\
long field_width; /* field width */
epicsInt32 precision; /* number of decimal places*/\
epicsInt32 field_width; /* field width */
#define DBRtime \
epicsTimeStamp time; /* time stamp*/
#define DBRenumStrs \
unsigned long no_str; /* number of strings*/\
long padenumStrs; /*padding to force 8 byte align*/\
epicsUInt32 no_str; /* number of strings*/\
epicsInt32 padenumStrs; /*padding to force 8 byte align*/\
char strs[DB_MAX_CHOICES][MAX_STRING_SIZE]; /* string values */
#define DBRgrLong \
long upper_disp_limit; /*upper limit of graph*/\
long lower_disp_limit; /*lower limit of graph*/
epicsInt32 upper_disp_limit; /*upper limit of graph*/\
epicsInt32 lower_disp_limit; /*lower limit of graph*/
#define DBRgrDouble \
double upper_disp_limit; /*upper limit of graph*/\
double lower_disp_limit; /*lower limit of graph*/
epicsFloat64 upper_disp_limit; /*upper limit of graph*/\
epicsFloat64 lower_disp_limit; /*lower limit of graph*/
#define DBRctrlLong \
long upper_ctrl_limit; /*upper limit of graph*/\
long lower_ctrl_limit; /*lower limit of graph*/
epicsInt32 upper_ctrl_limit; /*upper limit of graph*/\
epicsInt32 lower_ctrl_limit; /*lower limit of graph*/
#define DBRctrlDouble \
double upper_ctrl_limit; /*upper limit of graph*/\
double lower_ctrl_limit; /*lower limit of graph*/
epicsFloat64 upper_ctrl_limit; /*upper limit of graph*/\
epicsFloat64 lower_ctrl_limit; /*lower limit of graph*/
#define DBRalLong \
long upper_alarm_limit;\
long upper_warning_limit;\
long lower_warning_limit;\
long lower_alarm_limit;
epicsInt32 upper_alarm_limit;\
epicsInt32 upper_warning_limit;\
epicsInt32 lower_warning_limit;\
epicsInt32 lower_alarm_limit;
#define DBRalDouble \
double upper_alarm_limit;\
double upper_warning_limit;\
double lower_warning_limit;\
double lower_alarm_limit;
epicsFloat64 upper_alarm_limit;\
epicsFloat64 upper_warning_limit;\
epicsFloat64 lower_warning_limit;\
epicsFloat64 lower_alarm_limit;
/* structures for each option type */
struct dbr_status {DBRstatus};
+171 -171
View File
File diff suppressed because it is too large Load Diff
+68 -68
View File
@@ -168,12 +168,12 @@ static long cvt_st_us(
/* Convert String to Long */
static long cvt_st_l(
char *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{
long value;
epicsInt32 value;
if (sscanf(from, "%ld", &value) == 1) {
if (sscanf(from, "%d", &value) == 1) {
*to = value;
return(0);
}
@@ -188,7 +188,7 @@ static long cvt_st_l(
/* Convert String to Unsigned Long */
static long cvt_st_ul(
char *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{
double value;
@@ -196,7 +196,7 @@ static long cvt_st_ul(
/*Convert to double first so that numbers like 1.0e3 convert properly*/
/*Problem was old database access said to get unsigned long as double*/
if (sscanf(from, "%lf", &value) == 1) {
*to = (unsigned long)value;
*to = (epicsUInt32)value;
return(0);
}
if(strlen(from) == 0) {
@@ -250,12 +250,12 @@ static long cvt_st_d(
/* Convert String to Enumerated */
static long cvt_st_e(
char *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{
struct rset *prset = 0;
long status;
unsigned short *pfield= (unsigned short*)(paddr->pfield);
epicsEnum16 *pfield= (epicsEnum16*)(paddr->pfield);
unsigned int nchoices,ind;
int nargs,nchars;
struct dbr_enumStrs enumStrs;
@@ -292,7 +292,7 @@ static long cvt_st_e(
/* Convert String to Menu */
static long cvt_st_menu(
char *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{
dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes;
@@ -324,7 +324,7 @@ static long cvt_st_menu(
/* Convert String to Device */
static long cvt_st_device(
char *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{
dbFldDes *pdbFldDes = (dbFldDes *)paddr->pfldDes;
@@ -391,14 +391,14 @@ static long cvt_c_us(
/* Convert Char to Long */
static long cvt_c_l(
char *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Char to Unsigned Long */
static long cvt_c_ul(
char *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -419,7 +419,7 @@ static long cvt_c_d(
/* Convert Char to Enumerated */
static long cvt_c_e(
char *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -461,14 +461,14 @@ static long cvt_uc_us(
/* Convert Unsigned Char to Long */
static long cvt_uc_l(
unsigned char *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Char to Unsigned Long */
static long cvt_uc_ul(
unsigned char *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -489,7 +489,7 @@ static long cvt_uc_d(
/* Convert Unsigned Char to Enumerated */
static long cvt_uc_e(
unsigned char *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -531,14 +531,14 @@ static long cvt_s_us(
/* Convert Short to Long */
static long cvt_s_l(
short *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Short to Unsigned Long */
static long cvt_s_ul(
short *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -559,7 +559,7 @@ static long cvt_s_d(
/* Convert Short to Enumerated */
static long cvt_s_e(
short *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -601,14 +601,14 @@ static long cvt_us_us(
/* Convert Unsigned Short to Long */
static long cvt_us_l(
unsigned short *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Short to Unsigned Long */
static long cvt_us_ul(
unsigned short *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -635,141 +635,141 @@ static long cvt_us_e(
/* Convert Long to String */
static long cvt_l_st(
long *from,
epicsInt32 *from,
char *to,
struct dbAddr *paddr)
{ cvtLongToString(*from, to); return(0); }
/* Convert Long to Char */
static long cvt_l_c(
long *from,
epicsInt32 *from,
char *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Unsigned Char */
static long cvt_l_uc(
long *from,
epicsInt32 *from,
unsigned char *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Short */
static long cvt_l_s(
long *from,
epicsInt32 *from,
short *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Unsigned Short */
static long cvt_l_us(
long *from,
epicsInt32 *from,
unsigned short *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Long */
static long cvt_l_l(
long *from,
long *to,
epicsInt32 *from,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Unsigned Long */
static long cvt_l_ul(
long *from,
unsigned long *to,
epicsInt32 *from,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Float */
static long cvt_l_f(
long *from,
epicsInt32 *from,
float *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Double */
static long cvt_l_d(
long *from,
epicsInt32 *from,
double *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Long to Enumerated */
static long cvt_l_e(
long *from,
unsigned short *to,
epicsInt32 *from,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to String */
static long cvt_ul_st(
unsigned long *from,
epicsUInt32 *from,
char *to,
struct dbAddr *paddr)
{ cvtUlongToString(*from, to); return(0); }
/* Convert Unsigned Long to Char */
static long cvt_ul_c(
unsigned long *from,
epicsUInt32 *from,
char *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Unsigned Char */
static long cvt_ul_uc(
unsigned long *from,
epicsUInt32 *from,
unsigned char *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Short */
static long cvt_ul_s(
unsigned long *from,
epicsUInt32 *from,
short *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Unsigned Short */
static long cvt_ul_us(
unsigned long *from,
epicsUInt32 *from,
unsigned short *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Long */
static long cvt_ul_l(
unsigned long *from,
long *to,
epicsUInt32 *from,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Unsigned Long */
static long cvt_ul_ul(
unsigned long *from,
unsigned long *to,
epicsUInt32 *from,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Float */
static long cvt_ul_f(
unsigned long *from,
epicsUInt32 *from,
float *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Double */
static long cvt_ul_d(
unsigned long *from,
epicsUInt32 *from,
double *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Unsigned Long to Enumerated */
static long cvt_ul_e(
unsigned long *from,
unsigned short *to,
epicsUInt32 *from,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -822,14 +822,14 @@ static long cvt_f_us(
/* Convert Float to Long */
static long cvt_f_l(
float *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Float to Unsigned Long */
static long cvt_f_ul(
float *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -850,7 +850,7 @@ static long cvt_f_d(
/* Convert Float to Enumerated */
static long cvt_f_e(
float *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -903,14 +903,14 @@ static long cvt_d_us(
/* Convert Double to Long */
static long cvt_d_l(
double *from,
long *to,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Double to Unsigned Long */
static long cvt_d_ul(
double *from,
unsigned long *to,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -943,70 +943,70 @@ static long cvt_d_d(
/* Convert Double to Enumerated */
static long cvt_d_e(
double *from,
unsigned short *to,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Char */
static long cvt_e_c(
unsigned short *from,
epicsEnum16 *from,
char *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Unsigned Char */
static long cvt_e_uc(
unsigned short *from,
epicsEnum16 *from,
unsigned char *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Short */
static long cvt_e_s(
unsigned short *from,
epicsEnum16 *from,
short *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Unsigned Short */
static long cvt_e_us(
unsigned short *from,
epicsEnum16 *from,
unsigned short *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Long */
static long cvt_e_l(
unsigned short *from,
long *to,
epicsEnum16 *from,
epicsInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Unsigned Long */
static long cvt_e_ul(
unsigned short *from,
unsigned long *to,
epicsEnum16 *from,
epicsUInt32 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Float */
static long cvt_e_f(
unsigned short *from,
epicsEnum16 *from,
float *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Double */
static long cvt_e_d(
unsigned short *from,
epicsEnum16 *from,
double *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
/* Convert Enumerated to Enumerated */
static long cvt_e_e(
unsigned short *from,
unsigned short *to,
epicsEnum16 *from,
epicsEnum16 *to,
struct dbAddr *paddr)
{ *to=*from; return(0); }
@@ -1014,7 +1014,7 @@ static long cvt_e_e(
/* Get Enumerated to String */
static long cvt_e_st_get(
unsigned short *from,
epicsEnum16 *from,
char *to,
struct dbAddr *paddr)
{
@@ -1034,14 +1034,14 @@ static long cvt_e_st_get(
/* Put Enumerated to String */
static long cvt_e_st_put(
unsigned short *from,
epicsEnum16 *from,
char *to,
struct dbAddr *paddr)
{ cvtUshortToString(*from, to); return(0); }
/* Get Menu to String */
static long cvt_menu_st(
unsigned short *from,
epicsEnum16 *from,
char *to,
struct dbAddr *paddr)
{
@@ -1066,7 +1066,7 @@ static long cvt_menu_st(
/* Get Device to String */
static long cvt_device_st(
unsigned short *from,
epicsEnum16 *from,
char *to,
struct dbAddr *paddr)
{
+5 -5
View File
@@ -799,7 +799,7 @@ static void printBuffer(
if (retOptions & DBR_PRECISION){
struct dbr_precision *pdbr_precision = (void *)pbuffer;
printf("precision=%ld\n", pdbr_precision->precision);
printf("precision=%d\n", pdbr_precision->precision);
}else{
printf("precision not returned\n");
}
@@ -820,7 +820,7 @@ static void printBuffer(
if (retOptions & DBR_ENUM_STRS) {
struct dbr_enumStrs *pdbr_enumStrs = (void *)pbuffer;
printf("no_strs=%lu\n", pdbr_enumStrs->no_str);
printf("no_strs=%u\n", pdbr_enumStrs->no_str);
for (i = 0; i <pdbr_enumStrs->no_str; i++)
printf("%s\n",&pdbr_enumStrs->strs[i][0]);
} else
@@ -831,7 +831,7 @@ static void printBuffer(
if (retOptions & DBR_GR_LONG) {
struct dbr_grLong *pdbr_grLong = (void *)pbuffer;
printf("grLong: %ld %ld\n",pdbr_grLong->upper_disp_limit,
printf("grLong: %d %d\n",pdbr_grLong->upper_disp_limit,
pdbr_grLong->lower_disp_limit);
}else{
printf("DBRgrLong not returned\n");
@@ -853,7 +853,7 @@ static void printBuffer(
if (retOptions & DBR_CTRL_LONG){
struct dbr_ctrlLong *pdbr_ctrlLong = (void *)pbuffer;
printf("ctrlLong: %ld %ld\n",pdbr_ctrlLong->upper_ctrl_limit,
printf("ctrlLong: %d %d\n",pdbr_ctrlLong->upper_ctrl_limit,
pdbr_ctrlLong->lower_ctrl_limit);
}else{
printf("DBRctrlLong not returned\n");
@@ -875,7 +875,7 @@ static void printBuffer(
if (retOptions & DBR_AL_LONG) {
struct dbr_alLong *pdbr_alLong = (void *)pbuffer;
printf("alLong: %ld %ld %ld %ld\n",
printf("alLong: %d %d %d %d\n",
pdbr_alLong->upper_alarm_limit,pdbr_alLong->upper_warning_limit,
pdbr_alLong->lower_warning_limit,pdbr_alLong->lower_alarm_limit);
}else{
+33 -378
View File
@@ -39,6 +39,9 @@
#include "errMdef.h"
#include "recSup.h"
#include "alarm.h"
#define db_accessHFORdb_accessC
#include "db_access.h"
#undef db_accessHFORdb_accessC
#define epicsExportSharedSymbols
#include "dbNotify.h"
#include "dbAccessDefs.h"
@@ -105,7 +108,7 @@
#define oldDBR_STSACK_STRING oldDBR_PUT_ACKS + 1
#define oldDBR_CLASS_NAME oldDBR_STSACK_STRING + 1
/*Following is defined in db_access.h*/
/*Following is defined in dbConvert.h*/
extern unsigned short dbDBRnewToDBRold[DBR_ENUM+1];
@@ -115,354 +118,6 @@ extern unsigned short dbDBRnewToDBRold[DBR_ENUM+1];
#define MAX_STRING_SIZE 40
#endif
#ifndef MAX_UNITS_SIZE
#define MAX_UNITS_SIZE 8
#endif
/* VALUES WITH STATUS STRUCTURES */
/* structure for a string status field */
struct dbr_sts_string{
short status; /* status of value */
short severity; /* severity of alarm */
char value[MAX_STRING_SIZE]; /* current value */
};
/* structure for a string status field */
struct dbr_stsack_string{
unsigned short status; /* status of value */
unsigned short severity; /* severity of alarm */
unsigned short ackt; /* ack transient? */
unsigned short acks; /* ack severity */
char value[MAX_STRING_SIZE]; /* current value */
};
/* structure for an short status field */
struct dbr_sts_int{
short status; /* status of value */
short severity; /* severity of alarm */
short value; /* current value */
};
struct dbr_sts_short{
short status; /* status of value */
short severity; /* severity of alarm */
short value; /* current value */
};
/* structure for a float status field */
struct dbr_sts_float{
short status; /* status of value */
short severity; /* severity of alarm */
float value; /* current value */
};
/* structure for a enum status field */
struct dbr_sts_enum{
short status; /* status of value */
short severity; /* severity of alarm */
short value; /* current value */
};
/* structure for a char status field */
struct dbr_sts_char{
short status; /* status of value */
short severity; /* severity of alarm */
char RISC_pad; /* RISC alignment */
unsigned char value; /* current value */
};
/* structure for a long status field */
struct dbr_sts_long{
short status; /* status of value */
short severity; /* severity of alarm */
long value; /* current value */
};
/* structure for a double status field */
struct dbr_sts_double{
short status; /* status of value */
short severity; /* severity of alarm */
long RISC_pad; /* RISC alignment */
double value; /* current value */
};
/* VALUES WITH STATUS AND TIME STRUCTURES */
/* structure for a string time field */
struct dbr_time_string{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
char value[MAX_STRING_SIZE]; /* current value */
};
/* structure for an short time field */
struct dbr_time_short{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
short RISC_pad; /* RISC alignment */
short value; /* current value */
};
/* structure for a float time field */
struct dbr_time_float{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
float value; /* current value */
};
/* structure for a enum time field */
struct dbr_time_enum{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
short RISC_pad; /* RISC alignment */
short value; /* current value */
};
/* structure for a char time field */
struct dbr_time_char{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
short RISC_pad0; /* RISC alignment */
char RISC_pad1; /* RISC alignment */
unsigned char value; /* current value */
};
/* structure for a long time field */
struct dbr_time_long{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
long value; /* current value */
};
/* structure for a double time field */
struct dbr_time_double{
short status; /* status of value */
short severity; /* severity of alarm */
epicsTimeStamp stamp; /* time stamp */
long RISC_pad; /* RISC alignment */
double value; /* current value */
};
/* VALUES WITH STATUS AND GRAPHIC STRUCTURES */
/* structure for a graphic string */
/* not implemented; use struct_dbr_sts_string */
/* structure for a graphic short field */
struct dbr_gr_int{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
short upper_disp_limit; /* upper limit of graph */
short lower_disp_limit; /* lower limit of graph */
short upper_alarm_limit;
short upper_warning_limit;
short lower_warning_limit;
short lower_alarm_limit;
short value; /* current value */
};
struct dbr_gr_short{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
short upper_disp_limit; /* upper limit of graph */
short lower_disp_limit; /* lower limit of graph */
short upper_alarm_limit;
short upper_warning_limit;
short lower_warning_limit;
short lower_alarm_limit;
short value; /* current value */
};
/* structure for a graphic floating point field */
struct dbr_gr_float{
short status; /* status of value */
short severity; /* severity of alarm */
short precision; /* number of decimal places */
short RISC_pad0; /* RISC alignment */
char units[MAX_UNITS_SIZE]; /* units of value */
float upper_disp_limit; /* upper limit of graph */
float lower_disp_limit; /* lower limit of graph */
float upper_alarm_limit;
float upper_warning_limit;
float lower_warning_limit;
float lower_alarm_limit;
float value; /* current value */
};
/* structure for a graphic enumeration field */
struct dbr_gr_enum{
short status; /* status of value */
short severity; /* severity of alarm */
short no_str; /* number of strings */
char strs[16][26]; /* state strings */
short value; /* current value */
};
/* structure for a graphic char field */
struct dbr_gr_char{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
unsigned char upper_disp_limit; /* upper limit of graph */
unsigned char lower_disp_limit; /* lower limit of graph */
unsigned char upper_alarm_limit;
unsigned char upper_warning_limit;
unsigned char lower_warning_limit;
unsigned char lower_alarm_limit;
char RISC_pad; /* RISC alignment */
unsigned char value; /* current value */
};
/* structure for a graphic long field */
struct dbr_gr_long{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
long upper_disp_limit; /* upper limit of graph */
long lower_disp_limit; /* lower limit of graph */
long upper_alarm_limit;
long upper_warning_limit;
long lower_warning_limit;
long lower_alarm_limit;
long value; /* current value */
};
/* structure for a graphic double field */
struct dbr_gr_double{
short status; /* status of value */
short severity; /* severity of alarm */
short precision; /* number of decimal places */
short RISC_pad0; /* RISC alignment */
char units[MAX_UNITS_SIZE]; /* units of value */
double upper_disp_limit; /* upper limit of graph */
double lower_disp_limit; /* lower limit of graph */
double upper_alarm_limit;
double upper_warning_limit;
double lower_warning_limit;
double lower_alarm_limit;
double value; /* current value */
};
/* VALUES WITH STATUS, GRAPHIC and CONTROL STRUCTURES */
/* structure for a control string */
/* not implemented; use struct_dbr_sts_string */
/* structure for a control integer */
struct dbr_ctrl_int{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
short upper_disp_limit; /* upper limit of graph */
short lower_disp_limit; /* lower limit of graph */
short upper_alarm_limit;
short upper_warning_limit;
short lower_warning_limit;
short lower_alarm_limit;
short upper_ctrl_limit; /* upper control limit */
short lower_ctrl_limit; /* lower control limit */
short value; /* current value */
};
struct dbr_ctrl_short{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
short upper_disp_limit; /* upper limit of graph */
short lower_disp_limit; /* lower limit of graph */
short upper_alarm_limit;
short upper_warning_limit;
short lower_warning_limit;
short lower_alarm_limit;
short upper_ctrl_limit; /* upper control limit */
short lower_ctrl_limit; /* lower control limit */
short value; /* current value */
};
/* structure for a control floating point field */
struct dbr_ctrl_float{
short status; /* status of value */
short severity; /* severity of alarm */
short precision; /* number of decimal places */
short RISC_pad; /* RISC alignment */
char units[MAX_UNITS_SIZE]; /* units of value */
float upper_disp_limit; /* upper limit of graph */
float lower_disp_limit; /* lower limit of graph */
float upper_alarm_limit;
float upper_warning_limit;
float lower_warning_limit;
float lower_alarm_limit;
float upper_ctrl_limit; /* upper control limit */
float lower_ctrl_limit; /* lower control limit */
float value; /* current value */
};
/* structure for a control enumeration field */
struct dbr_ctrl_enum{
short status; /* status of value */
short severity; /* severity of alarm */
short no_str; /* number of strings */
char strs[16][26]; /* state strings */
short value; /* current value */
};
/* structure for a control char field */
struct dbr_ctrl_char{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
unsigned char upper_disp_limit; /* upper limit of graph */
unsigned char lower_disp_limit; /* lower limit of graph */
unsigned char upper_alarm_limit;
unsigned char upper_warning_limit;
unsigned char lower_warning_limit;
unsigned char lower_alarm_limit;
unsigned char upper_ctrl_limit; /* upper control limit */
unsigned char lower_ctrl_limit; /* lower control limit */
char RISC_pad; /* RISC alignment */
unsigned char value; /* current value */
};
/* structure for a control long field */
struct dbr_ctrl_long{
short status; /* status of value */
short severity; /* severity of alarm */
char units[MAX_UNITS_SIZE]; /* units of value */
long upper_disp_limit; /* upper limit of graph */
long lower_disp_limit; /* lower limit of graph */
long upper_alarm_limit;
long upper_warning_limit;
long lower_warning_limit;
long lower_alarm_limit;
long upper_ctrl_limit; /* upper control limit */
long lower_ctrl_limit; /* lower control limit */
long value; /* current value */
};
/* structure for a control double field */
struct dbr_ctrl_double{
short status; /* status of value */
short severity; /* severity of alarm */
short precision; /* number of decimal places */
short RISC_pad0; /* RISC alignment */
char units[MAX_UNITS_SIZE]; /* units of value */
double upper_disp_limit; /* upper limit of graph */
double lower_disp_limit; /* lower limit of graph */
double upper_alarm_limit;
double upper_warning_limit;
double lower_warning_limit;
double lower_alarm_limit;
double upper_ctrl_limit; /* upper control limit */
double lower_ctrl_limit; /* lower control limit */
double value; /* current value */
};
/*safe double to float conversion*/
static void safeDoubleToFloat(double *pd,float *pf)
{
@@ -616,7 +271,7 @@ void *pfl
/* case(oldDBR_INT): */
case(oldDBR_SHORT):
{
short *pvalue = (short *)pbuffer;
dbr_short_t *pvalue = (dbr_short_t *)pbuffer;
options=0;
nRequest=no_elements;
@@ -627,7 +282,7 @@ void *pfl
break;
case(oldDBR_FLOAT):
{
float *pvalue = (float *)pbuffer;
dbr_float_t *pvalue = (dbr_float_t *)pbuffer;
options=0;
nRequest=no_elements;
@@ -638,7 +293,7 @@ void *pfl
break;
case(oldDBR_ENUM):
{
short *pvalue = (short *)pbuffer;
dbr_enum_t *pvalue = (dbr_enum_t *)pbuffer;
options=0;
nRequest=no_elements;
@@ -649,7 +304,7 @@ void *pfl
break;
case(oldDBR_CHAR):
{
char *pvalue = (char *)pbuffer;
dbr_char_t *pvalue = (dbr_char_t *)pbuffer;
options=0;
nRequest=no_elements;
@@ -660,7 +315,7 @@ void *pfl
break;
case(oldDBR_LONG):
{
long *pvalue = (long *)pbuffer;
dbr_long_t *pvalue = (dbr_long_t *)pbuffer;
options=0;
nRequest=no_elements;
@@ -671,7 +326,7 @@ void *pfl
break;
case(oldDBR_DOUBLE):
{
double *pvalue = (double *)pbuffer;
dbr_double_t *pvalue = (dbr_double_t *)pbuffer;
options=0;
nRequest=no_elements;
@@ -710,7 +365,7 @@ void *pfl
struct {
DBRstatus
} new;
short *pvalue = &pold->value;
dbr_short_t *pvalue = &pold->value;
options=DBR_STATUS;
nRequest=0;
@@ -731,7 +386,7 @@ void *pfl
struct {
DBRstatus
} new;
float *pvalue = &pold->value;
dbr_float_t *pvalue = &pold->value;
options=DBR_STATUS;
nRequest=0;
@@ -752,7 +407,7 @@ void *pfl
struct {
DBRstatus
} new;
short *pvalue = &pold->value;
dbr_enum_t *pvalue = &pold->value;
options=DBR_STATUS;
nRequest=0;
@@ -773,7 +428,7 @@ void *pfl
struct {
DBRstatus
} new;
unsigned char *pvalue = &pold->value;
dbr_char_t *pvalue = &pold->value;
options=DBR_STATUS;
nRequest=0;
@@ -794,7 +449,7 @@ void *pfl
struct {
DBRstatus
} new;
long *pvalue = &pold->value;
dbr_long_t *pvalue = &pold->value;
options=DBR_STATUS;
nRequest=0;
@@ -815,7 +470,7 @@ void *pfl
struct {
DBRstatus
} new;
double *pvalue = &pold->value;
dbr_double_t *pvalue = &pold->value;
options=DBR_STATUS;
nRequest=0;
@@ -861,7 +516,7 @@ void *pfl
DBRstatus
DBRtime
} new;
short *pvalue = &pold->value;
dbr_short_t *pvalue = &pold->value;
options=DBR_STATUS | DBR_TIME;
nRequest=0;
@@ -884,7 +539,7 @@ void *pfl
DBRstatus
DBRtime
} new;
float *pvalue = &pold->value;
dbr_float_t *pvalue = &pold->value;
options=DBR_STATUS | DBR_TIME;
nRequest=0;
@@ -907,7 +562,7 @@ void *pfl
DBRstatus
DBRtime
} new;
short *pvalue = &pold->value;
dbr_enum_t *pvalue = &pold->value;
options=DBR_STATUS | DBR_TIME;
nRequest=0;
@@ -930,7 +585,7 @@ void *pfl
DBRstatus
DBRtime
} new;
unsigned char *pvalue = &pold->value;
dbr_char_t *pvalue = &pold->value;
options=DBR_STATUS | DBR_TIME;
nRequest=0;
@@ -953,7 +608,7 @@ void *pfl
DBRstatus
DBRtime
} new;
long *pvalue = &pold->value;
dbr_long_t *pvalue = &pold->value;
options=DBR_STATUS | DBR_TIME;
nRequest=0;
@@ -976,7 +631,7 @@ void *pfl
DBRstatus
DBRtime
} new;
double *pvalue = &pold->value;
dbr_double_t *pvalue = &pold->value;
options=DBR_STATUS | DBR_TIME;
nRequest=0;
@@ -1003,7 +658,7 @@ void *pfl
DBRgrLong
DBRalLong
} new;
short *pvalue = &pold->value;
dbr_short_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_AL_LONG;
nRequest=0;
@@ -1036,7 +691,7 @@ void *pfl
DBRgrDouble
DBRalDouble
} new;
float *pvalue = &pold->value;
dbr_float_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE
|DBR_AL_DOUBLE;
@@ -1071,7 +726,7 @@ void *pfl
DBRgrLong
DBRalLong
} new;
unsigned char *pvalue = &pold->value;
dbr_char_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_AL_LONG;
nRequest=0;
@@ -1103,7 +758,7 @@ void *pfl
DBRgrLong
DBRalLong
} new;
long *pvalue = &pold->value;
dbr_long_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_AL_LONG;
nRequest=0;
@@ -1136,7 +791,7 @@ void *pfl
DBRgrDouble
DBRalDouble
} new;
double *pvalue = &pold->value;
dbr_double_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE
|DBR_AL_DOUBLE;
@@ -1172,7 +827,7 @@ void *pfl
DBRctrlLong
DBRalLong
} new;
short *pvalue = &pold->value;
dbr_short_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_CTRL_LONG
|DBR_AL_LONG;
@@ -1209,7 +864,7 @@ void *pfl
DBRctrlDouble
DBRalDouble
} new;
float *pvalue = &pold->value;
dbr_float_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE
|DBR_CTRL_DOUBLE|DBR_AL_DOUBLE;
@@ -1245,7 +900,7 @@ void *pfl
DBRenumStrs
} new;
short no_str;
short *pvalue = &pold->value;
dbr_enum_t *pvalue = &pold->value;
memset(pold,'\0',sizeof(struct dbr_ctrl_enum));
/* first get status and severity */
@@ -1278,7 +933,7 @@ void *pfl
DBRctrlLong
DBRalLong
} new;
unsigned char *pvalue = &pold->value;
dbr_char_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_CTRL_LONG
|DBR_AL_LONG;
@@ -1314,7 +969,7 @@ void *pfl
DBRctrlLong
DBRalLong
} new;
long *pvalue = &pold->value;
dbr_long_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_GR_LONG|DBR_CTRL_LONG
|DBR_AL_LONG;
@@ -1350,7 +1005,7 @@ void *pfl
DBRctrlDouble
DBRalDouble
} new;
double *pvalue = &pold->value;
dbr_double_t *pvalue = &pold->value;
options=DBR_STATUS|DBR_UNITS|DBR_PRECISION|DBR_GR_DOUBLE
|DBR_CTRL_DOUBLE|DBR_AL_DOUBLE;
+3 -2
View File
@@ -121,6 +121,7 @@ int main(int argc,char **argv)
fprintf(outFile,"#include \"epicsMutex.h\"\n");
fprintf(outFile,"#include \"link.h\"\n");
fprintf(outFile,"#include \"epicsTime.h\"\n");
fprintf(outFile,"#include \"epicsTypes.h\"\n");
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
while(pdbMenu) {
fprintf(outFile,"\n#ifndef INC%sH\n",pdbMenu->name);
@@ -172,7 +173,7 @@ int main(int argc,char **argv)
name,pdbFldDes->prompt);
break;
case DBF_LONG :
fprintf(outFile,"\tlong\t\t%s;\t/*%s*/\n",
fprintf(outFile,"\tepicsInt32\t\t%s;\t/*%s*/\n",
name,pdbFldDes->prompt);
break;
case DBF_ULONG :
@@ -190,7 +191,7 @@ int main(int argc,char **argv)
case DBF_ENUM :
case DBF_MENU :
case DBF_DEVICE :
fprintf(outFile,"\tunsigned short\t%s;\t/*%s*/\n",
fprintf(outFile,"\tepicsEnum16\t%s;\t/*%s*/\n",
name,pdbFldDes->prompt);
break;
case DBF_INLINK :
+31 -31
View File
@@ -35,7 +35,7 @@
* This routine converts numbers less than 10,000,000. It defers to f_to_str for
* numbers requiring more than 8 places of precision. There are only eight decimal
*/
static long frac_multiplier[] =
static epicsInt32 frac_multiplier[] =
{1,10,100,1000,10000,100000,1000000,10000000,100000000};
int epicsShareAPI cvtFloatToString(
@@ -44,7 +44,7 @@ int epicsShareAPI cvtFloatToString(
unsigned short precision)
{
unsigned short got_one,i;
long whole,iplace,number,fraction,fplace;
epicsInt32 whole,iplace,number,fraction,fplace;
float ftemp;
char *startAddr;
@@ -62,12 +62,12 @@ int epicsShareAPI cvtFloatToString(
};
/* remove the whole number portion */
whole = (long)flt_value;
whole = (epicsInt32)flt_value;
ftemp = flt_value - whole;
/* multiplier to convert fractional portion to integer */
fplace = frac_multiplier[precision];
fraction = (long)(ftemp * fplace * 10);
fraction = (epicsInt32)(ftemp * fplace * 10);
fraction = (fraction + 5) / 10; /* round up */
/* determine rounding into the whole number portion */
@@ -118,7 +118,7 @@ int epicsShareAPI cvtDoubleToString(
unsigned short precision)
{
unsigned short got_one,i;
long whole,iplace,number,fraction,fplace;
epicsInt32 whole,iplace,number,fraction,fplace;
double ftemp;
char *startAddr;
@@ -143,12 +143,12 @@ int epicsShareAPI cvtDoubleToString(
};
/* remove the whole number portion */
whole = (long)flt_value;
whole = (epicsInt32)flt_value;
ftemp = flt_value - whole;
/* multiplier to convert fractional portion to integer */
fplace = frac_multiplier[precision];
fraction = (long)(ftemp * fplace * 10);
fraction = (epicsInt32)(ftemp * fplace * 10);
fraction = (fraction + 5) / 10; /* round up */
/* determine rounding into the whole number portion */
@@ -401,10 +401,10 @@ int epicsShareAPI cvtUshortToString(
int epicsShareAPI cvtLongToString(
long source,
epicsInt32 source,
char *pdest)
{
long val,temp;
epicsInt32 val,temp;
char digit[11];
int i,j;
char *startAddr = pdest;
@@ -415,8 +415,8 @@ int epicsShareAPI cvtLongToString(
return((int)(pdest-startAddr));
}
if(source<0) {
if(source == LONG_MIN) {
sprintf(pdest,"%ld",source);
if(source == INT_MIN) {
sprintf(pdest,"%d",source);
return((int)strlen(pdest));
}
*pdest++ = '-';
@@ -437,10 +437,10 @@ int epicsShareAPI cvtLongToString(
int epicsShareAPI cvtUlongToString(
unsigned long source,
epicsUInt32 source,
char *pdest)
{
unsigned long val,temp;
epicsUInt32 val,temp;
char digit[10];
int i,j;
char *startAddr = pdest;
@@ -471,10 +471,10 @@ static char hex_digit_to_ascii[16]={'0','1','2','3','4','5','6','7','8','9',
int epicsShareAPI cvtLongToHexString(
long source,
epicsInt32 source,
char *pdest)
{
long val,temp;
epicsInt32 val,temp;
char digit[10];
int i,j;
char *startAddr = pdest;
@@ -485,8 +485,8 @@ int epicsShareAPI cvtLongToHexString(
return((int)(pdest-startAddr));
}
if(source<0) {
if(source == LONG_MIN) {
sprintf(pdest,"-0x%lx",source);
if(source == INT_MIN) {
sprintf(pdest,"-0x%x",source);
return((int)strlen(pdest));
}
*pdest++ = '-';
@@ -508,10 +508,10 @@ int epicsShareAPI cvtLongToHexString(
int epicsShareAPI cvtLongToOctalString(
long source,
epicsInt32 source,
char *pdest)
{
long val,temp;
epicsInt32 val,temp;
char digit[16];
int i,j;
char *startAddr = pdest;
@@ -522,8 +522,8 @@ int epicsShareAPI cvtLongToOctalString(
return((int)(pdest-startAddr));
}
if(source<0) {
if(source == LONG_MIN) {
sprintf(pdest,"-0%lo",source);
if(source == INT_MIN) {
sprintf(pdest,"-0%o",source);
return((int)strlen(pdest));
}
*pdest++ = '-';
@@ -551,14 +551,14 @@ int epicsShareAPI cvtLongToOctalString(
*
* cvtBitsToUlong()
*
* extract a bit field from the source unsigend long
* extract a bit field from the source epicsUInt32
*/
unsigned long epicsShareAPI cvtBitsToUlong(
unsigned long src,
epicsUInt32 epicsShareAPI cvtBitsToUlong(
epicsUInt32 src,
unsigned bitFieldOffset,
unsigned bitFieldLength)
{
unsigned long mask;
epicsUInt32 mask;
src = src >> bitFieldOffset;
@@ -575,16 +575,16 @@ unsigned bitFieldLength)
*
* cvtUlongToBits()
*
* insert a bit field from the source unsigend long
* into the destination unsigned long
* insert a bit field from the source epicsUInt32
* into the destination epicsUInt32
*/
unsigned long epicsShareAPI cvtUlongToBits(
unsigned long src,
unsigned long dest,
epicsUInt32 epicsShareAPI cvtUlongToBits(
epicsUInt32 src,
epicsUInt32 dest,
unsigned bitFieldOffset,
unsigned bitFieldLength)
{
unsigned long mask;
epicsUInt32 mask;
mask = (1<<bitFieldLength)-1;
mask = mask << bitFieldOffset;
+10 -9
View File
@@ -26,6 +26,7 @@
#include <string.h>
#include "epicsTypes.h"
#include "shareLib.h"
#ifdef __cplusplus
@@ -57,20 +58,20 @@ epicsShareFunc int epicsShareAPI
epicsShareFunc int epicsShareAPI
cvtUshortToString(unsigned short value, char *pstring);
epicsShareFunc int epicsShareAPI
cvtLongToString(long value, char *pstring);
cvtLongToString(epicsInt32 value, char *pstring);
epicsShareFunc int epicsShareAPI
cvtUlongToString(unsigned long value, char *pstring);
cvtUlongToString(epicsUInt32 value, char *pstring);
epicsShareFunc int epicsShareAPI
cvtLongToHexString(long value, char *pstring);
cvtLongToHexString(epicsInt32 value, char *pstring);
epicsShareFunc int epicsShareAPI
cvtLongToOctalString(long value, char *pstring);
epicsShareFunc unsigned long epicsShareAPI cvtBitsToUlong(
unsigned long src,
cvtLongToOctalString(epicsInt32 value, char *pstring);
epicsShareFunc epicsUInt32 epicsShareAPI cvtBitsToUlong(
epicsUInt32 src,
unsigned bitFieldOffset,
unsigned bitFieldLength);
epicsShareFunc unsigned long epicsShareAPI cvtUlongToBits(
unsigned long src,
unsigned long dest,
epicsShareFunc epicsUInt32 epicsShareAPI cvtUlongToBits(
epicsUInt32 src,
epicsUInt32 dest,
unsigned bitFieldOffset,
unsigned bitFieldLength);