restored Roger Coles data type manipulation macros to their
orignal horrific state
This commit is contained in:
@@ -1088,14 +1088,16 @@ extern "C" epicsShareDef const unsigned short dbr_value_offset[LAST_BUFFER_TYPE+
|
||||
0, /* string */
|
||||
};
|
||||
|
||||
extern "C" epicsShareDef const char *dbf_text[LAST_TYPE+1] = {
|
||||
"DBF_STRING",
|
||||
"DBF_SHORT",
|
||||
"DBF_FLOAT",
|
||||
"DBF_ENUM",
|
||||
"DBF_CHAR",
|
||||
"DBF_LONG",
|
||||
"DBF_DOUBLE"
|
||||
extern "C" epicsShareDef const char *dbf_text[LAST_TYPE+3] = {
|
||||
"TYPENOTCONN",
|
||||
"DBF_STRING",
|
||||
"DBF_SHORT",
|
||||
"DBF_FLOAT",
|
||||
"DBF_ENUM",
|
||||
"DBF_CHAR",
|
||||
"DBF_LONG",
|
||||
"DBF_DOUBLE",
|
||||
"DBF_NO_ACCESS"
|
||||
};
|
||||
|
||||
extern "C" epicsShareDef const char *dbf_text_invalid = "DBF_invalid";
|
||||
|
||||
@@ -1263,18 +1263,28 @@ void caTaskExistTest ()
|
||||
|
||||
verifyDataTypeMacros ()
|
||||
{
|
||||
assert ( dbf_type_to_DBR( DBR_SHORT ) == DBR_SHORT );
|
||||
assert ( dbf_type_to_DBR_STS( DBR_SHORT ) == DBR_STS_SHORT );
|
||||
assert ( dbf_type_to_DBR_TIME( DBR_SHORT ) == DBR_TIME_SHORT );
|
||||
assert ( dbf_type_to_DBR_GR( DBR_SHORT ) == DBR_GR_SHORT );
|
||||
assert ( dbf_type_to_DBR_CTRL( DBR_SHORT ) == DBR_CTRL_SHORT );
|
||||
short type;
|
||||
|
||||
type = dbf_type_to_DBR ( DBF_SHORT );
|
||||
assert ( type == DBR_SHORT );
|
||||
type = dbf_type_to_DBR_STS ( DBF_SHORT );
|
||||
assert ( type == DBR_STS_SHORT );
|
||||
type = dbf_type_to_DBR_GR ( DBF_SHORT );
|
||||
assert ( type == DBR_GR_SHORT );
|
||||
type = dbf_type_to_DBR_CTRL ( DBF_SHORT );
|
||||
assert ( type == DBR_CTRL_SHORT );
|
||||
type = dbf_type_to_DBR_TIME ( DBF_SHORT );
|
||||
assert ( type == DBR_TIME_SHORT );
|
||||
assert ( strcmp ( dbr_type_to_text( DBR_SHORT ), "DBR_SHORT" ) == 0 );
|
||||
assert ( strcmp ( dbf_type_to_text( DBF_SHORT ), "DBF_SHORT" ) == 0 );
|
||||
assert ( dbr_type_is_SHORT ( DBR_SHORT ) );
|
||||
assert ( dbr_type_is_valid ( DBR_SHORT ) );
|
||||
assert ( dbf_type_is_valid ( DBR_SHORT ) );
|
||||
assert ( dbf_type_is_valid ( DBF_SHORT ) );
|
||||
{
|
||||
int dataType;
|
||||
dbf_text_to_type ( "DBR_SHORT", dataType );
|
||||
dbf_text_to_type ( "DBF_SHORT", dataType );
|
||||
assert ( dataType == DBF_SHORT );
|
||||
dbr_text_to_type ( "DBR_SHORT", dataType );
|
||||
assert ( dataType == DBR_SHORT );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,12 +735,12 @@ union db_access_val{
|
||||
(type)%(LAST_TYPE+1) == DBR_DOUBLE)
|
||||
|
||||
#define dbf_type_to_text(type) \
|
||||
( ((type) >= 0 && (type) < dbf_text_dim) ? \
|
||||
dbf_text[type] : dbf_text_invalid )
|
||||
( ((type) >= -1 && (type) < dbf_text_dim-2) ? \
|
||||
dbf_text[type+1] : dbf_text_invalid )
|
||||
|
||||
#define dbf_text_to_type(text, type) \
|
||||
for (type=dbf_text_dim-1; type>=0; type--) { \
|
||||
if (strcmp(text, dbf_text[type]) == 0) \
|
||||
for (type=dbf_text_dim-3; type>=0; type--) { \
|
||||
if (strcmp(text, dbf_text[type+1]) == 0) \
|
||||
break; \
|
||||
}
|
||||
|
||||
@@ -775,7 +775,7 @@ union db_access_val{
|
||||
(type) + 4*(dbf_text_dim-2) : -1 )
|
||||
|
||||
|
||||
epicsShareExtern READONLY char *dbf_text[LAST_TYPE+1];
|
||||
epicsShareExtern READONLY char *dbf_text[LAST_TYPE+3];
|
||||
epicsShareExtern READONLY short dbf_text_dim;
|
||||
epicsShareExtern READONLY char *dbf_text_invalid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user