fixes for converting aitString to aitInt8* and back
fixes for managing the units field for the dbr types
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.5 1996/08/12 15:37:46 jbk
|
||||
* Re-added the installString() function I took out.
|
||||
*
|
||||
* Revision 1.4 1996/08/09 02:28:09 jbk
|
||||
* rewrite of aitString class - more intuitive now, I think
|
||||
*
|
||||
@@ -162,7 +165,7 @@ public:
|
||||
operator aitInt32(void) const { return (aitInt32)len; }
|
||||
operator const char*(void) const { return str; }
|
||||
operator char*(void) const { return str; }
|
||||
int isConstant(void) const { return (getType()==aitStrConst)?1:0; }
|
||||
int isConstant(void) const;
|
||||
|
||||
aitUint32 length(void) const { return (aitUint32)len; }
|
||||
const char* string(void) const { return str; }
|
||||
@@ -216,6 +219,11 @@ private:
|
||||
aitStrType getType(void) const { return (aitStrType)type; }
|
||||
};
|
||||
|
||||
inline int aitString::isConstant(void) const
|
||||
{
|
||||
return (getType()==aitStrConst && str)?1:0;
|
||||
}
|
||||
|
||||
inline void aitString::clear(void)
|
||||
{
|
||||
if(str && type==aitStrMalloc) delete [] str;
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.10 1996/08/13 15:07:45 jbk
|
||||
// changes for better string manipulation and fixes for the units field
|
||||
//
|
||||
// Revision 1.9 1996/08/06 19:14:10 jbk
|
||||
// Fixes to the string class.
|
||||
// Changes units field to a aitString instead of aitInt8.
|
||||
@@ -705,7 +708,7 @@ static int mapGraphicGddToShort(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_short_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) 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];
|
||||
@@ -733,7 +736,7 @@ static int mapControlGddToShort(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_short_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) 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];
|
||||
@@ -832,7 +835,7 @@ static int mapGraphicGddToFloat(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_float_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_gr_float_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_float_graphicLow];
|
||||
@@ -861,7 +864,7 @@ static int mapControlGddToFloat(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_float_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_ctrl_float_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_float_graphicLow];
|
||||
@@ -1048,7 +1051,7 @@ static int mapGraphicGddToChar(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_char_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) 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];
|
||||
@@ -1076,7 +1079,7 @@ static int mapControlGddToChar(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_char_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) 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];
|
||||
@@ -1173,7 +1176,7 @@ static int mapGraphicGddToLong(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_long_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) 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];
|
||||
@@ -1201,7 +1204,7 @@ static int mapControlGddToLong(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_long_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) 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];
|
||||
@@ -1300,7 +1303,7 @@ static int mapGraphicGddToDouble(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_gr_double_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_gr_double_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_gr_double_graphicLow];
|
||||
@@ -1329,7 +1332,7 @@ static int mapControlGddToDouble(void* v, gdd* dd)
|
||||
|
||||
aitString* str;
|
||||
dd[gddAppTypeIndex_dbr_ctrl_double_units].getRef(str);
|
||||
strcpy(db->units,str->string());
|
||||
if(str->string()) strcpy(db->units,str->string());
|
||||
|
||||
db->precision=dd[gddAppTypeIndex_dbr_ctrl_double_precision];
|
||||
db->lower_disp_limit=dd[gddAppTypeIndex_dbr_ctrl_double_graphicLow];
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
// $Id$
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.7 1996/08/13 15:07:46 jbk
|
||||
// changes for better string manipulation and fixes for the units field
|
||||
//
|
||||
// Revision 1.6 1996/08/06 19:14:11 jbk
|
||||
// Fixes to the string class.
|
||||
// Changes units field to a aitString instead of aitInt8.
|
||||
@@ -1155,6 +1158,31 @@ gddStatus gdd::put(const gdd* dd)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if((primitiveType()==aitEnumString ||
|
||||
primitiveType()==aitEnumFixedString) &&
|
||||
dd->primitiveType()==aitEnumInt8 &&
|
||||
isScalar() && dd->isAtomic())
|
||||
{
|
||||
// special case for aitInt8--->aitString (hate this)
|
||||
aitInt8* i1=(aitInt8*)dd->dataPointer();
|
||||
put(i1);
|
||||
}
|
||||
else if(primitiveType()==aitEnumInt8 &&
|
||||
dd->primitiveType()==aitEnumString &&
|
||||
dd->isScalar() && isAtomic())
|
||||
{
|
||||
// special case for aitString--->aitInt8
|
||||
aitString* s1=(aitString*)dd->dataAddress();
|
||||
put(*s1);
|
||||
}
|
||||
else if(primitiveType()==aitEnumInt8 &&
|
||||
dd->primitiveType()==aitEnumFixedString &&
|
||||
dd->isScalar() && isAtomic())
|
||||
{
|
||||
// special case for aitFixedString--->aitInt8
|
||||
aitFixedString* s2=data.FString;
|
||||
if(s2) put(*s2);
|
||||
}
|
||||
else if(isScalar())
|
||||
{
|
||||
// just put first element of dd into this scaler - sucks
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
* $Id$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.8 1996/08/13 15:07:48 jbk
|
||||
* changes for better string manipulation and fixes for the units field
|
||||
*
|
||||
* Revision 1.7 1996/08/09 02:29:16 jbk
|
||||
* fix getRef(aitString*&) to return the correct value if gdd is scalar
|
||||
*
|
||||
@@ -840,9 +843,9 @@ inline gddStatus gdd::put(const aitInt8* const d)
|
||||
{
|
||||
aitString* p = (aitString*)dataAddress();
|
||||
if(isConstant())
|
||||
p->copy((char*)d);
|
||||
else
|
||||
p->replaceData((char*)d);
|
||||
else
|
||||
p->copy((char*)d);
|
||||
}
|
||||
else if(primitiveType()==aitEnumFixedString && dim==0)
|
||||
strcpy(data.FString->fixed_string,(char*)d);
|
||||
|
||||
Reference in New Issue
Block a user