changes for better string manipulation and fixes for the units field
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.1 1996/06/25 19:11:28 jbk
|
||||
// new in EPICS base
|
||||
//
|
||||
//
|
||||
// *Revision 0.4 1996/06/25 18:58:58 jbk
|
||||
// *more fixes for the aitString management functions and mapping menus
|
||||
@@ -69,7 +72,7 @@ static void aitConvertStringFixedString(void* d,const void* s,aitIndex c)
|
||||
aitString* out = (aitString*)d;
|
||||
aitFixedString* in = (aitFixedString*)s;
|
||||
|
||||
for(i=0;i<c;i++) out[i].installString(in[i].fixed_string);
|
||||
for(i=0;i<c;i++) out[i].copy(in[i].fixed_string);
|
||||
}
|
||||
|
||||
static void aitConvertFixedStringString(void* d,const void* s,aitIndex c)
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 1996/06/27 14:33:13 jbk
|
||||
* changes data type to string conversions to use installString(), not copy()
|
||||
*
|
||||
* Revision 1.1 1996/06/25 19:11:30 jbk
|
||||
* new in EPICS base
|
||||
*
|
||||
@@ -159,14 +162,25 @@ void MakeStringFuncFrom(int i,int j,int k)
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
pr(dfd,"\tchar temp[AIT_FIXED_STRING_SIZE];\n");
|
||||
pr(dfd,"\taitString* out=(aitString*)d;\n");
|
||||
pr(dfd,"\t%s* in=(%s*)s;\n",aitName[j],aitName[j]);
|
||||
|
||||
#if 0
|
||||
if(j==aitEnumInt8)
|
||||
{
|
||||
pr(dfd,"\n\t// assume source s is string if count c is 1\n");
|
||||
pr(dfd,"\n\tif(c==1) {\n");
|
||||
pr(dfd,"\t\tout->copy((char*)in);\n");
|
||||
pr(dfd,"\t\treturn;\n");
|
||||
pr(dfd,"\t}\n\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(j==aitEnumInt8)
|
||||
pr(dfd,"\taitInt32 itmp;\n");
|
||||
else if(j==aitEnumUint8)
|
||||
pr(dfd,"\taitUint32 itmp;\n");
|
||||
|
||||
pr(dfd,"\taitString* out=(aitString*)d;\n");
|
||||
pr(dfd,"\t%s* in=(%s*)s;\n",aitName[j],aitName[j]);
|
||||
pr(dfd,"\tfor(i=0;i<c;i++) {\n");
|
||||
|
||||
if(j==aitEnumInt8)
|
||||
@@ -196,15 +210,25 @@ void MakeStringFuncTo(int i,int j,int k)
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
pr(dfd,"\taitString* in=(aitString*)s;\n");
|
||||
pr(dfd,"\t%s* out=(%s*)d;\n",aitName[i],aitName[i]);
|
||||
|
||||
/* I special cased the Int8 and Uint8 - yuck */
|
||||
#if 0
|
||||
if(i==aitEnumInt8)
|
||||
{
|
||||
pr(dfd,"\n\t// assume dest d is string if count c is 1\n");
|
||||
pr(dfd,"\n\tif(c==1) {\n");
|
||||
pr(dfd,"\t\tin->extractString((char*)out);\n");
|
||||
pr(dfd,"\t\treturn;\n");
|
||||
pr(dfd,"\t}\n\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(i==aitEnumInt8)
|
||||
pr(dfd,"\taitInt32 itmp;\n");
|
||||
else if(i==aitEnumUint8)
|
||||
pr(dfd,"\taitUint32 itmp;\n");
|
||||
|
||||
pr(dfd,"\t%s* out=(%s*)d;\n",aitName[i],aitName[i]);
|
||||
pr(dfd,"\tfor(i=0;i<c;i++) {\n");
|
||||
pr(dfd,"\t\tif(in[i].string()) {\n");
|
||||
|
||||
@@ -235,14 +259,25 @@ void MakeFStringFuncFrom(int i,int j,int k)
|
||||
table_type[k],&(aitName[i])[3],&(aitName[j])[3]);
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
pr(dfd,"\taitFixedString* out=(aitFixedString*)d;\n");
|
||||
pr(dfd,"\t%s* in=(%s*)s;\n",aitName[j],aitName[j]);
|
||||
|
||||
#if 0
|
||||
if(j==aitEnumInt8)
|
||||
{
|
||||
pr(dfd,"\n\t// assume source s is string if count c is 1\n");
|
||||
pr(dfd,"\n\tif(c==1) {\n");
|
||||
pr(dfd,"\t\tstrcpy(out->fixed_string,(char*)in);\n");
|
||||
pr(dfd,"\t\treturn;\n");
|
||||
pr(dfd,"\t}\n\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(j==aitEnumInt8)
|
||||
pr(dfd,"\taitInt32 itmp;\n");
|
||||
else if(j==aitEnumUint8)
|
||||
pr(dfd,"\taitUint32 itmp;\n");
|
||||
|
||||
pr(dfd,"\taitFixedString* out=(aitFixedString*)d;\n");
|
||||
pr(dfd,"\t%s* in=(%s*)s;\n",aitName[j],aitName[j]);
|
||||
pr(dfd,"\tfor(i=0;i<c;i++) {\n");
|
||||
|
||||
if(j==aitEnumInt8)
|
||||
@@ -270,15 +305,25 @@ void MakeFStringFuncTo(int i,int j,int k)
|
||||
pr(dfd,"{\n");
|
||||
pr(dfd,"\taitIndex i;\n");
|
||||
pr(dfd,"\taitFixedString* in=(aitFixedString*)s;\n");
|
||||
pr(dfd,"\t%s* out=(%s*)d;\n",aitName[i],aitName[i]);
|
||||
|
||||
/* I special cased the Int8 and Uint8 - yuck */
|
||||
#if 0
|
||||
if(i==aitEnumInt8)
|
||||
{
|
||||
pr(dfd,"\n\t// assume dest d is string if count c is 1\n");
|
||||
pr(dfd,"\n\tif(c==1) {\n");
|
||||
pr(dfd,"\t\tstrcpy((char*)out,in->fixed_string);\n");
|
||||
pr(dfd,"\t\treturn;\n");
|
||||
pr(dfd,"\t}\n\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(i==aitEnumInt8)
|
||||
pr(dfd,"\taitInt32 itmp;\n");
|
||||
else if(i==aitEnumUint8)
|
||||
pr(dfd,"\taitUint32 itmp;\n");
|
||||
|
||||
pr(dfd,"\t%s* out=(%s*)d;\n",aitName[i],aitName[i]);
|
||||
pr(dfd,"\tfor(i=0;i<c;i++) {\n");
|
||||
|
||||
if(i==aitEnumInt8)
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.9 1996/08/06 19:14:10 jbk
|
||||
// Fixes to the string class.
|
||||
// Changes units field to a aitString instead of aitInt8.
|
||||
//
|
||||
// Revision 1.8 1996/07/26 02:23:15 jbk
|
||||
// Fixed the spelling error with Scalar.
|
||||
//
|
||||
@@ -634,9 +638,9 @@ static gdd* mapGraphicShortToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_GR_SHORT].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_short_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_gr_short_units].put(str);
|
||||
aitString* str=NULL;
|
||||
dd[gddAppTypeIndex_dbr_gr_short_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_gr_short_graphicLow]=db->lower_disp_limit;
|
||||
dd[gddAppTypeIndex_dbr_gr_short_graphicHigh]=db->upper_disp_limit;
|
||||
@@ -666,9 +670,9 @@ static gdd* mapControlShortToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_CTRL_SHORT].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_short_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_graphicLow]=db->lower_disp_limit;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_graphicHigh]=db->upper_disp_limit;
|
||||
@@ -699,9 +703,9 @@ static int mapGraphicGddToShort(void* v, gdd* dd)
|
||||
int sz=1;
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_short_value];
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_gr_short_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_short_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_short_graphicLow];
|
||||
db->upper_disp_limit=dd[gddAppTypeIndex_dbr_gr_short_graphicHigh];
|
||||
@@ -727,9 +731,9 @@ static int mapControlGddToShort(void* v, gdd* dd)
|
||||
int sz=1;
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_short_value];
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_short_graphicLow];
|
||||
db->upper_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_short_graphicHigh];
|
||||
@@ -759,9 +763,9 @@ static gdd* mapGraphicFloatToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_GR_FLOAT].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_float_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_gr_float_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_gr_float_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_gr_float_precision]=db->precision;
|
||||
dd[gddAppTypeIndex_dbr_gr_float_graphicLow]=db->lower_disp_limit;
|
||||
@@ -792,9 +796,9 @@ static gdd* mapControlFloatToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_CTRL_FLOAT].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_float_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_precision]=db->precision;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_graphicLow]=db->lower_disp_limit;
|
||||
@@ -826,9 +830,9 @@ static int mapGraphicGddToFloat(void* v, gdd* dd)
|
||||
int sz=1;
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_float_value];
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_gr_float_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_float_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_gr_float_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_float_graphicLow];
|
||||
@@ -855,9 +859,9 @@ static int mapControlGddToFloat(void* v, gdd* dd)
|
||||
int sz=1;
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_float_value];
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_ctrl_float_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_float_graphicLow];
|
||||
@@ -977,9 +981,9 @@ static gdd* mapGraphicCharToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_GR_CHAR].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_char_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_gr_char_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_gr_char_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_gr_char_graphicLow]=db->lower_disp_limit;
|
||||
dd[gddAppTypeIndex_dbr_gr_char_graphicHigh]=db->upper_disp_limit;
|
||||
@@ -1009,9 +1013,9 @@ static gdd* mapControlCharToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_CTRL_CHAR].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_char_value];
|
||||
|
||||
aitString str = db->units;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_graphicLow]=db->lower_disp_limit;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_graphicHigh]=db->upper_disp_limit;
|
||||
@@ -1042,9 +1046,9 @@ static int mapGraphicGddToChar(void* v, gdd* dd)
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_char_value];
|
||||
int sz=1;
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_gr_char_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_char_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_char_graphicLow];
|
||||
db->upper_disp_limit=dd[gddAppTypeIndex_dbr_gr_char_graphicHigh];
|
||||
@@ -1070,9 +1074,9 @@ static int mapControlGddToChar(void* v, gdd* dd)
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_char_value];
|
||||
int sz=1;
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_char_graphicLow];
|
||||
db->upper_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_char_graphicHigh];
|
||||
@@ -1102,9 +1106,9 @@ static gdd* mapGraphicLongToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_GR_LONG].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_long_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_gr_long_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_gr_long_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_gr_long_graphicLow]=db->lower_disp_limit;
|
||||
dd[gddAppTypeIndex_dbr_gr_long_graphicHigh]=db->upper_disp_limit;
|
||||
@@ -1134,9 +1138,9 @@ static gdd* mapControlLongToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_CTRL_LONG].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_long_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_graphicLow]=db->lower_disp_limit;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_graphicHigh]=db->upper_disp_limit;
|
||||
@@ -1167,9 +1171,9 @@ static int mapGraphicGddToLong(void* v, gdd* dd)
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_long_value];
|
||||
int sz=1;
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_gr_long_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_long_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_long_graphicLow];
|
||||
db->upper_disp_limit=dd[gddAppTypeIndex_dbr_gr_long_graphicHigh];
|
||||
@@ -1195,9 +1199,9 @@ static int mapControlGddToLong(void* v, gdd* dd)
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_long_value];
|
||||
int sz=1;
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_long_graphicLow];
|
||||
db->upper_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_long_graphicHigh];
|
||||
@@ -1227,9 +1231,9 @@ static gdd* mapGraphicDoubleToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_GR_DOUBLE].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_double_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_gr_double_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_gr_double_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_gr_double_precision]=db->precision;
|
||||
dd[gddAppTypeIndex_dbr_gr_double_graphicLow]=db->lower_disp_limit;
|
||||
@@ -1260,9 +1264,9 @@ static gdd* mapControlDoubleToGdd(void* v, aitIndex count)
|
||||
gdd* dd = type_table->getDD(gddDbrToAit[DBR_CTRL_DOUBLE].app);
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_double_value];
|
||||
|
||||
aitString str;
|
||||
str.installString(db->units);
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_units].put(str);
|
||||
aitString* str = NULL;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_units].getRef(str);
|
||||
str->copy(db->units);
|
||||
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_precision]=db->precision;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_graphicLow]=db->lower_disp_limit;
|
||||
@@ -1294,9 +1298,9 @@ static int mapGraphicGddToDouble(void* v, gdd* dd)
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_gr_double_value];
|
||||
int sz=1;
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_gr_double_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_double_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_gr_double_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_double_graphicLow];
|
||||
@@ -1323,9 +1327,9 @@ static int mapControlGddToDouble(void* v, gdd* dd)
|
||||
gdd& vdd = dd[gddAppTypeIndex_dbr_ctrl_double_value];
|
||||
int sz=1;
|
||||
|
||||
aitString str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_units].get(str);
|
||||
strcpy(db->units,str.string());
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_ctrl_double_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_double_graphicLow];
|
||||
|
||||
127
src/gdd/gdd.cc
127
src/gdd/gdd.cc
@@ -4,6 +4,10 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.6 1996/08/06 19:14:11 jbk
|
||||
// Fixes to the string class.
|
||||
// Changes units field to a aitString instead of aitInt8.
|
||||
//
|
||||
// Revision 1.5 1996/07/26 02:23:16 jbk
|
||||
// Fixed the spelling error with Scalar.
|
||||
//
|
||||
@@ -110,11 +114,11 @@ void gdd::init(int app, aitEnum prim, int dimen)
|
||||
setApplType(app);
|
||||
setPrimType(prim);
|
||||
dim=(aitUint8)dimen;
|
||||
setData(NULL);
|
||||
destruct=NULL;
|
||||
ref_cnt=1;
|
||||
flags=0;
|
||||
bounds=NULL;
|
||||
setData(NULL);
|
||||
|
||||
if(dim)
|
||||
{
|
||||
@@ -126,6 +130,11 @@ void gdd::init(int app, aitEnum prim, int dimen)
|
||||
default: bounds=(gddBounds*)new gddBounds[dim]; break;
|
||||
}
|
||||
}
|
||||
else if(primitiveType()==aitEnumString)
|
||||
{
|
||||
aitString* str=(aitString*)dataAddress();
|
||||
str->init();
|
||||
}
|
||||
}
|
||||
|
||||
gdd::gdd(gdd* dd)
|
||||
@@ -541,8 +550,10 @@ size_t gdd::flattenWithAddress(void* buf, size_t size, aitIndex* total_dd)
|
||||
if(str->string())
|
||||
{
|
||||
memcpy((char*)&pdd[pos],str->string(),str->length()+1);
|
||||
*str=(char*)&pdd[pos];
|
||||
str->force((char*)&pdd[pos]);
|
||||
}
|
||||
else
|
||||
str->init();
|
||||
}
|
||||
}
|
||||
else if(isContainer())
|
||||
@@ -672,9 +683,11 @@ gddStatus gdd::flattenData(gdd* dd, int tot_dds, void* buf,size_t size)
|
||||
if(str->string())
|
||||
{
|
||||
memcpy(ptr,str->string(),str->length()+1);
|
||||
*str=(char*)ptr;
|
||||
str->force((char*)ptr);
|
||||
ptr+=str->length()+1;
|
||||
}
|
||||
else
|
||||
str->init();
|
||||
}
|
||||
else if(dd[i].primitiveType()==aitEnumFixedString)
|
||||
{
|
||||
@@ -773,6 +786,8 @@ gddStatus gdd::convertOffsetsToAddress(void)
|
||||
cstr=str[i].string();
|
||||
str[i].force(pdd+(unsigned long)cstr);
|
||||
}
|
||||
else
|
||||
str[i].init();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -788,6 +803,8 @@ gddStatus gdd::convertOffsetsToAddress(void)
|
||||
cstr=str->string();
|
||||
str->force(pdd+(unsigned long)cstr);
|
||||
}
|
||||
else
|
||||
str->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -839,6 +856,7 @@ gddStatus gdd::convertAddressToOffsets(void)
|
||||
{
|
||||
cstr=str[i].string();
|
||||
if(cstr) str[i].force(cstr-(const char*)pdd);
|
||||
else str[i].init();
|
||||
}
|
||||
}
|
||||
// bounds and data of atomic to offsets
|
||||
@@ -855,6 +873,7 @@ gddStatus gdd::convertAddressToOffsets(void)
|
||||
str=(aitString*)dataAddress();
|
||||
cstr=str->string();
|
||||
if(cstr) str->force(cstr-(const char*)pdd);
|
||||
else str->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -925,6 +944,108 @@ gddStatus gdd::reset(aitEnum prim, int dimen, aitIndex* cnt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gdd::get(aitString& d)
|
||||
{
|
||||
if(primitiveType()==aitEnumString)
|
||||
{
|
||||
aitString* s=(aitString*)dataAddress();
|
||||
d=*s;
|
||||
}
|
||||
else if(dim==1 && primitiveType()==aitEnumInt8)
|
||||
{
|
||||
if(isConstant())
|
||||
{
|
||||
const char* ci=(const char*)dataPointer();
|
||||
d.copy(ci);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* i=(char*)dataPointer();
|
||||
d.copy(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
get(aitEnumString,&d);
|
||||
}
|
||||
void gdd::get(aitFixedString& d)
|
||||
{
|
||||
if(primitiveType()==aitEnumFixedString)
|
||||
strcpy(d.fixed_string,data.FString->fixed_string);
|
||||
else if(primitiveType()==aitEnumInt8 && dim==1)
|
||||
strcpy(d.fixed_string,(char*)dataPointer());
|
||||
else
|
||||
get(aitEnumFixedString,&d);
|
||||
}
|
||||
|
||||
void gdd::getConvert(aitString& d)
|
||||
{
|
||||
if(primitiveType()==aitEnumInt8 && dim==1)
|
||||
{
|
||||
if(isConstant())
|
||||
{
|
||||
const char* ci=(const char*)dataPointer();
|
||||
d.copy(ci);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* i=(char*)dataPointer();
|
||||
d.copy(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
get(aitEnumString,&d);
|
||||
}
|
||||
|
||||
void gdd::getConvert(aitFixedString& d)
|
||||
{
|
||||
if(primitiveType()==aitEnumInt8 && dim==1)
|
||||
strcpy(d.fixed_string,(char*)dataPointer());
|
||||
else
|
||||
get(aitEnumFixedString,d.fixed_string);
|
||||
}
|
||||
|
||||
void gdd::put(aitString d)
|
||||
{
|
||||
aitString* s=(aitString*)dataAddress();
|
||||
*s=d;
|
||||
setPrimType(aitEnumString);
|
||||
}
|
||||
|
||||
// this is dangerous, should the fixed string be copied here?
|
||||
void gdd::put(aitFixedString& d)
|
||||
{
|
||||
data.FString=&d;
|
||||
setPrimType(aitEnumFixedString);
|
||||
}
|
||||
|
||||
void gdd::putConvert(aitString d)
|
||||
{
|
||||
if(primitiveType()==aitEnumInt8 && dim==1)
|
||||
{
|
||||
aitUint32 len = getDataSizeElements();
|
||||
char* cp = (char*)dataPointer();
|
||||
if(d.length()<len) len=d.length();
|
||||
strncpy(cp,d.string(),len);
|
||||
cp[len]='\0';
|
||||
}
|
||||
else
|
||||
set(aitEnumString,&d);
|
||||
}
|
||||
|
||||
void gdd::putConvert(aitFixedString& d)
|
||||
{
|
||||
if(primitiveType()==aitEnumInt8 && dim==1)
|
||||
{
|
||||
aitUint32 len = getDataSizeElements();
|
||||
char* cp = (char*)dataPointer();
|
||||
if(sizeof(d.fixed_string)<len) len=sizeof(d.fixed_string);
|
||||
strncpy(cp,d.fixed_string,len);
|
||||
cp[len]='\0';
|
||||
}
|
||||
else
|
||||
set(aitEnumFixedString,d.fixed_string);
|
||||
}
|
||||
|
||||
// copy each of the strings into this DDs storage area
|
||||
gddStatus gdd::put(const aitString* const d)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.7 1996/08/09 02:29:16 jbk
|
||||
* fix getRef(aitString*&) to return the correct value if gdd is scalar
|
||||
*
|
||||
* Revision 1.6 1996/08/06 19:14:12 jbk
|
||||
* Fixes to the string class.
|
||||
* Changes units field to a aitString instead of aitInt8.
|
||||
@@ -805,8 +808,6 @@ inline void gdd::getConvert(aitUint16& d) { get(aitEnumUint16,&d); }
|
||||
inline void gdd::getConvert(aitInt16& d) { get(aitEnumInt16,&d); }
|
||||
inline void gdd::getConvert(aitUint8& d) { get(aitEnumUint8,&d); }
|
||||
inline void gdd::getConvert(aitInt8& d) { get(aitEnumInt8,&d); }
|
||||
inline void gdd::getConvert(aitString& d) { get(aitEnumString,&d); }
|
||||
inline void gdd::getConvert(aitFixedString& d){get(aitEnumFixedString,d.fixed_string);}
|
||||
|
||||
inline void gdd::putConvert(aitFloat64 d){ set(aitEnumFloat64,&d); }
|
||||
inline void gdd::putConvert(aitFloat32 d){ set(aitEnumFloat32,&d); }
|
||||
@@ -816,8 +817,6 @@ inline void gdd::putConvert(aitUint16 d) { set(aitEnumUint16,&d); }
|
||||
inline void gdd::putConvert(aitInt16 d) { set(aitEnumInt16,&d); }
|
||||
inline void gdd::putConvert(aitUint8 d) { set(aitEnumUint8,&d); }
|
||||
inline void gdd::putConvert(aitInt8 d) { set(aitEnumInt8,&d); }
|
||||
inline void gdd::putConvert(aitString d) { set(aitEnumString,&d); }
|
||||
inline void gdd::putConvert(aitFixedString& d) { set(aitEnumFixedString,d.fixed_string); }
|
||||
|
||||
inline gddStatus gdd::put(const aitFloat64* const d)
|
||||
{ return genCopy(aitEnumFloat64,d); }
|
||||
@@ -833,8 +832,23 @@ inline gddStatus gdd::put(const aitInt16* const d)
|
||||
{ return genCopy(aitEnumInt16,d); }
|
||||
inline gddStatus gdd::put(const aitUint8* const d)
|
||||
{ return genCopy(aitEnumUint8,d); }
|
||||
|
||||
// special case for aitInt8 array to aitString scalar
|
||||
inline gddStatus gdd::put(const aitInt8* const d)
|
||||
{ return genCopy(aitEnumInt8,d); }
|
||||
{
|
||||
if(primitiveType()==aitEnumString && dim==0)
|
||||
{
|
||||
aitString* p = (aitString*)dataAddress();
|
||||
if(isConstant())
|
||||
p->copy((char*)d);
|
||||
else
|
||||
p->replaceData((char*)d);
|
||||
}
|
||||
else if(primitiveType()==aitEnumFixedString && dim==0)
|
||||
strcpy(data.FString->fixed_string,(char*)d);
|
||||
else
|
||||
return genCopy(aitEnumInt8,d);
|
||||
}
|
||||
|
||||
// currently unprotected from destroying an atomic gdd
|
||||
inline void gdd::put(aitFloat64 d){ data.Float64=d;setPrimType(aitEnumFloat64);}
|
||||
@@ -846,10 +860,6 @@ inline void gdd::put(aitInt16 d) { data.Int16=d; setPrimType(aitEnumInt16); }
|
||||
inline void gdd::put(aitUint8 d) { data.Uint8=d; setPrimType(aitEnumUint8); }
|
||||
inline void gdd::put(aitInt8 d) { data.Int8=d; setPrimType(aitEnumInt8); }
|
||||
inline void gdd::put(aitType* d) { data=*d; }
|
||||
inline void gdd::put(aitString d)
|
||||
{ aitString* s=(aitString*)&data; *s=d; setPrimType(aitEnumString); }
|
||||
inline void gdd::put(aitFixedString& d)
|
||||
{ data.FString=&d; setPrimType(aitEnumFixedString); }
|
||||
|
||||
inline void gdd::get(void* d)
|
||||
{ aitConvert(primitiveType(),d,primitiveType(),voidData(),getDataSizeElements());}
|
||||
@@ -869,13 +879,25 @@ inline void gdd::get(aitInt16* d)
|
||||
{ aitConvert(aitEnumInt16,d,primitiveType(),voidData(),getDataSizeElements()); }
|
||||
inline void gdd::get(aitUint8* d)
|
||||
{ aitConvert(aitEnumUint8,d,primitiveType(),voidData(),getDataSizeElements()); }
|
||||
inline void gdd::get(aitInt8* d)
|
||||
{ aitConvert(aitEnumInt8,d,primitiveType(),voidData(),getDataSizeElements()); }
|
||||
inline void gdd::get(aitString* d)
|
||||
{ aitConvert(aitEnumString,d,primitiveType(),voidData(),getDataSizeElements()); }
|
||||
inline void gdd::get(aitFixedString* d)
|
||||
{ aitConvert(aitEnumFixedString,d,primitiveType(),voidData(),getDataSizeElements()); }
|
||||
|
||||
// special case for string scalar to aitInt8 array!
|
||||
inline void gdd::get(aitInt8* d)
|
||||
{
|
||||
if(primitiveType()==aitEnumString && dim==0)
|
||||
{
|
||||
aitString* str = (aitString*)dataAddress();
|
||||
strcpy((char*)d,str->string());
|
||||
}
|
||||
else if(primitiveType()==aitEnumFixedString && dim==0)
|
||||
strcpy((char*)d,data.FString->fixed_string);
|
||||
else
|
||||
aitConvert(aitEnumInt8,d,primitiveType(),voidData(),getDataSizeElements());
|
||||
}
|
||||
|
||||
inline void gdd::get(aitFloat64& d) {
|
||||
if(primitiveType()==aitEnumFloat64) d=getData().Float64;
|
||||
else get(aitEnumFloat64,&d);
|
||||
@@ -908,14 +930,6 @@ inline void gdd::get(aitInt8& d) {
|
||||
if(primitiveType()==aitEnumInt8) d=getData().Int8;
|
||||
else get(aitEnumInt8,&d);
|
||||
}
|
||||
inline void gdd::get(aitString& d) {
|
||||
if(primitiveType()==aitEnumString) {aitString* s=(aitString*)&data; d=*s; }
|
||||
else get(aitEnumString,&d);
|
||||
}
|
||||
inline void gdd::get(aitFixedString& d) {
|
||||
if(primitiveType()==aitEnumFixedString) { d=*(getData().FString); }
|
||||
else get(aitEnumFixedString,&d);
|
||||
}
|
||||
inline void gdd::get(aitType& d) { d=data; }
|
||||
|
||||
inline gdd& gdd::operator=(aitFloat64* v) { putRef(v); return *this;}
|
||||
|
||||
Reference in New Issue
Block a user