final repairs to string functions, put() functions, and error code printing

This commit is contained in:
Jim Kowalkowski
1996-08-27 13:05:10 +00:00
parent 3e26a12948
commit 5819ac0c48
6 changed files with 262 additions and 53 deletions
+122 -6
View File
@@ -4,6 +4,9 @@
// $Id$
//
// $Log$
// Revision 1.10 1996/08/23 20:29:36 jbk
// completed fixes for the aitString and fixed string management
//
// Revision 1.9 1996/08/22 21:05:40 jbk
// More fixes to make strings and fixed string work better.
//
@@ -70,6 +73,23 @@ gdd_NEWDEL_NEW(gdd)
gdd_NEWDEL_DEL(gdd)
gdd_NEWDEL_STAT(gdd)
// -------------------------- Error messages -------------------------
char* gddErrorMessages[]=
{
"Invalid",
"TypeMismatch",
"NotAllowed",
"AlreadyDefined",
"NewFailed",
"OutOfBounds",
"AtLimit",
"NotDefined",
"NotSupported",
"Overflow",
"Underflow"
};
// --------------------------The gddBounds functions-------------------
// gddBounds::gddBounds(void) { first=0; count=0; }
@@ -246,7 +266,10 @@ gddStatus gdd::registerDestructor(gddDestructor* dest)
{
// this is funky, will not register a destructor if one is present
if(destruct)
{
gddAutoPrint("gdd::registerDestructor()",gddErrorAlreadyDefined);
return gddErrorAlreadyDefined;
}
else
return replaceDestructor(dest);
}
@@ -275,7 +298,10 @@ gddStatus gdd::genCopy(aitEnum t, const void* d)
{
sz=describedDataSizeBytes();
if((buf=new aitInt8[sz])==NULL)
{
gddAutoPrint("gdd::genCopy()",gddErrorNewFailed);
rc=gddErrorNewFailed;
}
else
{
setData(buf);
@@ -289,7 +315,10 @@ gddStatus gdd::genCopy(aitEnum t, const void* d)
getDataSizeElements());
}
else
{
gddAutoPrint("gdd::genCopy()",gddErrorTypeMismatch);
rc=gddErrorTypeMismatch;
}
return rc;
}
@@ -308,7 +337,10 @@ gddStatus gdd::changeType(int app,aitEnum prim)
setPrimType(prim);
}
else
{
gddAutoPrint("gdd::changeType()",gddErrorTypeMismatch);
rc=gddErrorTypeMismatch;
}
return rc;
}
@@ -319,7 +351,10 @@ gddStatus gdd::setBound(unsigned index_dim, aitIndex first, aitIndex count)
if(index_dim<dimension())
bounds[index_dim].set(first,count);
else
{
gddAutoPrint("gdd::setBound()",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
return rc;
}
@@ -329,7 +364,10 @@ gddStatus gdd::getBound(unsigned index_dim, aitIndex& first, aitIndex& count)
if(index_dim<dimension())
bounds[index_dim].get(first,count);
else
{
gddAutoPrint("gdd::getBound()",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
return rc;
}
@@ -343,7 +381,10 @@ gddStatus gdd::copyStuff(gdd* dd,int ctype)
// blow me out quickly here
if(isFlat()||isManaged())
{
gddAutoPrint("gdd::copyStuff()",gddErrorNotAllowed);
return gddErrorNotAllowed;
}
clear();
@@ -387,7 +428,10 @@ gddStatus gdd::copyStuff(gdd* dd,int ctype)
setData(array);
}
else
{
gddAutoPrint("gdd::copyStuff()",gddErrorNewFailed);
rc=gddErrorNewFailed;
}
break;
case 2: // Dup()
data=dd->getData(); // copy the data reference
@@ -860,7 +904,10 @@ gddStatus gdd::convertAddressToOffsets(void)
// does not ensure that all the members of a container are flat!
if(!isFlat())
{
gddAutoPrint("gdd::convertAddressToOffsets()",gddErrorNotAllowed);
return gddErrorNotAllowed;
}
if(isContainer())
{
@@ -920,7 +967,10 @@ gddStatus gdd::clearData(void)
gddStatus rc=0;
if(isContainer())
{
gddAutoPrint("gdd::clearData()",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
else
{
if(destruct)
@@ -937,7 +987,10 @@ gddStatus gdd::clearData(void)
gddStatus gdd::clear(void)
{
if(isFlat()||isManaged())
{
gddAutoPrint("gdd::clear()",gddErrorNotAllowed);
return gddErrorNotAllowed;
}
if(isAtomic())
{
@@ -983,7 +1036,10 @@ gddStatus gdd::reset(aitEnum prim, int dimen, aitIndex* cnt)
gddStatus rc;
if(isFlat()||isManaged()||isContainer())
{
gddAutoPrint("gdd::reset()",gddErrorNotAllowed);
return gddErrorNotAllowed;
}
app=applicationType();
@@ -1058,7 +1114,7 @@ void gdd::getConvert(aitFixedString& d)
get(aitEnumFixedString,d.fixed_string);
}
gddStatus gdd::put(aitString d)
gddStatus gdd::put(const aitString& d)
{
gddStatus rc=0;
if(isScalar())
@@ -1068,13 +1124,34 @@ gddStatus gdd::put(aitString d)
setPrimType(aitEnumString);
}
else
{
gddAutoPrint("gdd::put(aitString&)",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
return rc;
}
gddStatus gdd::put(aitString& d)
{
gddStatus rc=0;
if(isScalar())
{
aitString* s=(aitString*)dataAddress();
*s=d;
setPrimType(aitEnumString);
}
else
{
gddAutoPrint("gdd::put(aitString&)",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
return rc;
}
// this is dangerous, should the fixed string be copied here?
gddStatus gdd::put(aitFixedString& d)
gddStatus gdd::put(const aitFixedString& d)
{
gddStatus rc=0;
@@ -1094,7 +1171,7 @@ gddStatus gdd::put(aitFixedString& d)
return rc;
}
void gdd::putConvert(aitString d)
void gdd::putConvert(const aitString& d)
{
if(primitiveType()==aitEnumInt8 && dim==1)
{
@@ -1105,10 +1182,10 @@ void gdd::putConvert(aitString d)
cp[len]='\0';
}
else
set(aitEnumString,&d);
set(aitEnumString,(aitString*)&d);
}
void gdd::putConvert(aitFixedString& d)
void gdd::putConvert(const aitFixedString& d)
{
if(primitiveType()==aitEnumInt8 && dim==1)
{
@@ -1119,7 +1196,7 @@ void gdd::putConvert(aitFixedString& d)
cp[len]='\0';
}
else
set(aitEnumFixedString,d.fixed_string);
set(aitEnumFixedString,(void*)d.fixed_string);
}
// copy each of the strings into this DDs storage area
@@ -1140,7 +1217,10 @@ gddStatus gdd::put(const aitFixedString* const d)
else
genCopy(aitEnumFixedString,d);
else
{
gddAutoPrint("gdd::put(const aitFixedString*const)",gddErrorNotAllowed);
rc=gddErrorTypeMismatch;
}
return rc;
}
@@ -1151,7 +1231,10 @@ gddStatus gdd::put(const gdd* dd)
// bail out quickly is either dd is a container
if(isContainer() || dd->isContainer())
{
gddAutoPrint("gdd::put(const gdd*)",gddErrorNotSupported);
return gddErrorNotSupported;
}
if(!aitConvertValid(primitiveType()))
{
@@ -1221,7 +1304,10 @@ gddStatus gdd::put(const gdd* dd)
// which marks it flat
if(isFlat())
{
gddAutoPrint("gdd::put(const gdd*)",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
else
{
// convert it to a scalar - is this OK to do?
@@ -1240,16 +1326,25 @@ gddStatus gdd::put(const gdd* dd)
if(dataPointer()==NULL)
{
if(destruct)
{
gddAutoPrint("gdd::put(const gdd*)",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
else
rc=copyData(dd); // is this the correct thing to do?
}
else if(dd->getDataSizeElements()>getDataSizeElements())
{
gddAutoPrint("gdd::put(const gdd*)",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
else
{
if(dd->dimension()>1)
{
gddAutoPrint("gdd::put(const gdd*)",gddErrorNotSupported);
rc=gddErrorNotSupported;
}
else
{
aitUint8* arr = (aitUint8*)dataPointer();
@@ -1277,7 +1372,10 @@ gddStatus gdd::copyData(const gdd* dd)
gddStatus rc=0;
if(isFlat() || isManaged() || isContainer())
{
gddAutoPrint("gdd::copyData(const gdd*)",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
else
{
if((rc=clear())==0)
@@ -1296,7 +1394,10 @@ gddStatus gdd::copyData(const gdd* dd)
setData(arr);
}
else
{
gddAutoPrint("gdd::copyData(const gdd*)",gddErrorNewFailed);
rc=gddErrorNewFailed;
}
}
}
return rc;
@@ -1328,7 +1429,10 @@ gddStatus gddAtomic::getBoundingBoxSize(aitUint32* b)
if(dimension()>0)
for(i=0;i<dimension();i++) b[i]=bounds[i].size();
else
{
gddAutoPrint("gddAtomic::getBoundingBoxSize()",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
return rc;
}
@@ -1341,7 +1445,10 @@ gddStatus gddAtomic::setBoundingBoxSize(const aitUint32* const b)
if(dimension()>0)
for(i=0;i<dimension();i++) bounds[i].setSize(b[i]);
else
{
gddAutoPrint("gddAtomic::setBoundingBoxSize()",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
return rc;
}
@@ -1354,7 +1461,10 @@ gddStatus gddAtomic::getBoundingBoxOrigin(aitUint32* b)
if(dimension()>0)
for(i=0;i<dimension();i++) b[i]=bounds[i].first();
else
{
gddAutoPrint("gddAtomic::getBoundingBoxOrigin()",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
return rc;
}
@@ -1367,7 +1477,10 @@ gddStatus gddAtomic::setBoundingBoxOrigin(const aitUint32* const b)
if(dimension()>0)
for(i=0;i<dimension();i++) bounds[i].setSize(b[i]);
else
{
gddAutoPrint("gddAtomic::setBoundingBoxOrigin",gddErrorOutOfBounds);
rc=gddErrorOutOfBounds;
}
return rc;
}
@@ -1467,7 +1580,10 @@ gddStatus gddContainer::remove(aitIndex index)
return 0;
}
else
{
gddAutoPrint("gddContainer::remove()",gddErrorOutOfBounds);
return gddErrorOutOfBounds;
}
}
// ------------------------cursor functions-------------------------------
+62 -28
View File
@@ -8,6 +8,9 @@
* $Id$
*
* $Log$
* Revision 1.11 1996/08/22 21:05:41 jbk
* More fixes to make strings and fixed string work better.
*
* Revision 1.10 1996/08/14 16:29:38 jbk
* fixed a put() function that did not return anything
*
@@ -452,8 +455,8 @@ public:
void putConvert(aitInt16 d);
void putConvert(aitUint8 d);
void putConvert(aitInt8 d);
void putConvert(aitString d);
void putConvert(aitFixedString& d);
void putConvert(const aitString& d);
void putConvert(const aitFixedString& d);
// copy the user data into the already set up DD array
gddStatus put(const aitFloat64* const d);
@@ -477,8 +480,9 @@ public:
gddStatus put(aitInt16 d);
gddStatus put(aitUint8 d);
gddStatus put(aitInt8 d);
gddStatus put(aitString d);
gddStatus put(aitFixedString& d);
gddStatus put(aitString& d);
gddStatus put(const aitString& d);
gddStatus put(const aitFixedString& d);
gddStatus put(aitType* d);
// copy the array data out of the DD
@@ -529,7 +533,8 @@ public:
gdd& operator=(aitInt16 d);
gdd& operator=(aitUint8 d);
gdd& operator=(aitInt8 d);
gdd& operator=(aitString d);
gdd& operator=(aitString& d);
gdd& operator=(const aitString& d);
// gdd& operator=(aitFixedString d); // not present
// Same as getRef() methods
@@ -677,7 +682,11 @@ inline int gdd::isAtomic(void) const
inline gddStatus gdd::noReferencing(void)
{
int rc=0;
if(ref_cnt>1) rc=gddErrorNotAllowed;
if(ref_cnt>1)
{
gddAutoPrint("gdd::noReferencing()",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
else flags|=GDD_NOREF_MASK;
return rc;
}
@@ -685,12 +694,17 @@ inline gddStatus gdd::reference(void)
{
int rc=0;
if(isNoRef()) rc=gddErrorNotAllowed;
if(isNoRef())
{
gddAutoPrint("gdd::reference()",gddErrorNotAllowed);
rc=gddErrorNotAllowed;
}
else ref_cnt++;
if(ref_cnt>((1u<<(sizeof(ref_cnt)*CHAR_BIT))-2u))
{
fprintf(stderr,"gdd reference count overflow!!\n");
gddAutoPrint("gdd::reference()",gddErrorOverflow);
rc=gddErrorOverflow;
}
return rc;
@@ -703,6 +717,7 @@ inline gddStatus gdd::unreference(void)
if(ref_cnt==0u)
{
fprintf(stderr,"gdd reference count underflow!!\n");
gddAutoPrint("gdd::unreference()",gddErrorUnderflow);
rc=gddErrorUnderflow;
}
else if(--ref_cnt<=0u)
@@ -712,6 +727,7 @@ inline gddStatus gdd::unreference(void)
// managed dd always destroys the entire thing
ref_cnt=1;
if(destruct) destruct->run(this);
destruct=NULL;
}
else if(!isFlat())
delete this;
@@ -894,55 +910,55 @@ inline gddStatus gdd::put(const aitInt8* const d)
inline gddStatus gdd::put(aitFloat64 d) {
gddStatus rc=0;
if(isScalar()) { data.Float64=d; setPrimType(aitEnumFloat64); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitFloat32 d) {
gddStatus rc=0;
if(isScalar()) { data.Float32=d;setPrimType(aitEnumFloat32); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitUint32 d) {
gddStatus rc=0;
if(isScalar()) { data.Uint32=d; setPrimType(aitEnumUint32); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitInt32 d) {
gddStatus rc=0;
if(isScalar()) { data.Int32=d; setPrimType(aitEnumInt32); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitUint16 d) {
gddStatus rc=0;
if(isScalar()) { data.Uint16=d; setPrimType(aitEnumUint16); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitInt16 d) {
gddStatus rc=0;
if(isScalar()) { data.Int16=d; setPrimType(aitEnumInt16); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitUint8 d) {
gddStatus rc=0;
if(isScalar()) { data.Uint8=d; setPrimType(aitEnumUint8); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitInt8 d) {
gddStatus rc=0;
if(isScalar()) { data.Int8=d; setPrimType(aitEnumInt8); }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
inline gddStatus gdd::put(aitType* d) {
gddStatus rc=0;
if(isScalar()) { data=*d; }
else rc=gddErrorNotAllowed;
else { rc=gddErrorNotAllowed; gddAutoPrint("gdd:put()",rc); }
return rc;
}
@@ -1072,7 +1088,9 @@ inline gdd& gdd::operator=(aitUint8 d)
{ data.Uint8=d; setPrimType(aitEnumUint8); return *this; }
inline gdd& gdd::operator=(aitInt8 d)
{ data.Int8=d; setPrimType(aitEnumInt8); return *this; }
inline gdd& gdd::operator=(aitString d)
inline gdd& gdd::operator=(aitString& d)
{ put(d); return *this; }
inline gdd& gdd::operator=(const aitString& d)
{ put(d); return *this; }
// ------------- primitive type pointer = gdd x functions --------------
@@ -1177,14 +1195,24 @@ protected:
// disallow
const gddBounds* getBounds(void) { return NULL; }
gddStatus getBoundingBoxSize(aitUint32*) { return gddErrorNotAllowed; }
gddStatus setBoundingBoxSize(const aitUint32* const)
{ return gddErrorNotAllowed; }
gddStatus getBoundingBoxOrigin(aitUint32*) { return gddErrorNotAllowed; }
gddStatus setBoundingBoxOrigin(const aitUint32* const)
{ return gddErrorNotAllowed; }
gddStatus setBound(int,aitIndex,aitIndex) { return gddErrorNotAllowed; }
gddStatus getBound(int,aitIndex&,aitIndex&) { return gddErrorNotAllowed; }
gddStatus getBoundingBoxSize(aitUint32*) {
gddAutoPrint("gddScalar::getBoundingBoxSize()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus setBoundingBoxSize(const aitUint32* const) {
gddAutoPrint("gddScalar::setBoundingBoxSize()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus getBoundingBoxOrigin(aitUint32*) {
gddAutoPrint("gddScalar::getBoundingBoxOrigin()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus setBoundingBoxOrigin(const aitUint32* const) {
gddAutoPrint("gddScalar::setBoundingBoxOrigin()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus setBound(int,aitIndex,aitIndex) {
gddAutoPrint("gddScalar::setBound()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus getBound(int,aitIndex&,aitIndex&) {
gddAutoPrint("gddScalar::getBound()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
// disallow
void adjust(aitFloat64* const, gddDestructor*) { }
@@ -1236,9 +1264,15 @@ protected:
~gddContainer(void) { }
void cInit(int num_things_within);
gddStatus changeType(int,aitEnum) { return gddErrorNotAllowed; }
gddStatus setBound(int,aitIndex,aitIndex) { return gddErrorNotAllowed; }
gddStatus getBound(int,aitIndex&,aitIndex&) { return gddErrorNotAllowed; }
gddStatus changeType(int,aitEnum) {
gddAutoPrint("gddContainer::changeType()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus setBound(int,aitIndex,aitIndex) {
gddAutoPrint("setBound()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus getBound(int,aitIndex&,aitIndex&) {
gddAutoPrint("getBound()",gddErrorNotAllowed);
return gddErrorNotAllowed; }
gddStatus setBound(aitIndex,aitIndex);
private:
+9 -6
View File
@@ -4,6 +4,9 @@
// $Id$
//
// $Log$
// Revision 1.5 1996/08/22 21:05:42 jbk
// More fixes to make strings and fixed string work better.
//
// Revision 1.4 1996/08/06 19:14:13 jbk
// Fixes to the string class.
// Changes units field to a aitString instead of aitInt8.
@@ -51,7 +54,7 @@ void gddApplicationTypeTable::GenerateTypes(void)
// Just describe the menu - allow the block of choiced to be
// referenced in.
gddAtomic* add_enum = new gddAtomic(0,aitEnumFixedString,1,16);
// gddAtomic* add_enum = new gddAtomic(0,aitEnumFixedString,1,16);
// ----------------------------------------------------------------
// register simple types
@@ -86,7 +89,7 @@ void gddApplicationTypeTable::GenerateTypes(void)
int type_units=registerApplicationTypeWithProto(GDD_NAME_UNITS,add_units);
// old menu method
// int type_menu=registerApplicationTypeWithProto(GDD_NAME_ENUM,add_enum);
// int type_menu=registerApplicationType(GDD_NAME_ENUM);
// ----------------------------------------------------------------
// register container types - not as easy
@@ -150,8 +153,8 @@ void gddApplicationTypeTable::GenerateTypes(void)
// DBR_GR_ENUM
gddContainer* cdd_gr_enum=new gddContainer(0);
// old menu method: cdd_gr_enum->insert(getDD(type_menu));
cdd_gr_enum->insert(new gddAtomic(type_menu,aitEnumFixedString,1));
// old: cdd_gr_enum->insert(new gddAtomic(type_menu,aitEnumFixedString,1));
cdd_gr_enum->insert(getDD(type_menu));
cdd_gr_enum->insert(new gddScalar(type_value,aitEnumEnum16));
registerApplicationTypeWithProto("dbr_gr_enum",cdd_gr_enum);
@@ -223,8 +226,8 @@ void gddApplicationTypeTable::GenerateTypes(void)
// DBR_CTRL_ENUM
gddContainer* cdd_ctrl_enum=new gddContainer(0);
// old method: cdd_ctrl_enum->insert(getDD(type_menu));
cdd_ctrl_enum->insert(new gddAtomic(type_menu,aitEnumFixedString,1));
//old:cdd_ctrl_enum->insert(new gddAtomic(type_menu,aitEnumFixedString,1));
cdd_ctrl_enum->insert(getDD(type_menu));
cdd_ctrl_enum->insert(new gddScalar(type_value,aitEnumEnum16));
registerApplicationTypeWithProto("dbr_ctrl_enum",cdd_ctrl_enum);
+35 -12
View File
@@ -4,6 +4,10 @@
// $Id$
//
// $Log$
// Revision 1.2 1996/06/26 21:00:08 jbk
// Fixed up code in aitHelpers, removed unused variables in others
// Fixed potential problem in gddAppTable.cc with the map functions
//
// Revision 1.1 1996/06/25 19:11:41 jbk
// new in EPICS base
//
@@ -215,9 +219,15 @@ gddStatus gddApplicationTypeTable::registerApplicationType(
gddStatus rc;
if(new_app=getApplicationType(name))
{
// gddAutoPrint(gddErrorAlreadyDefined);
return gddErrorAlreadyDefined;
}
if(total_registered>max_allowed)
{
gddAutoPrint("gddAppTable::registerApplicationType()",gddErrorAtLimit);
return gddErrorAtLimit;
}
sem.take();
rapp=total_registered++;
@@ -229,7 +239,10 @@ gddStatus gddApplicationTypeTable::registerApplicationType(
{
// group already allocated - check is app already refined
if(attr_table[group][app].type!=gddApplicationTypeUndefined)
{
// gddAutoPrint(gddErrorAlreadyDefined);
return gddErrorAlreadyDefined;
}
}
else
{
@@ -346,17 +359,21 @@ gddStatus gddApplicationTypeTable::mapAppToIndex(
aitUint32 c_app, aitUint32 m_app, aitUint32& x)
{
aitUint32 group,app;
gddStatus rc;
gddStatus rc=0;
if((rc=splitApplicationType(c_app,group,app))<0) return rc;
if(attr_table[group][app].map && m_app<attr_table[group][app].map_size)
if((rc=splitApplicationType(c_app,group,app))==0)
{
x=attr_table[group][app].map[m_app];
return 0;
if(attr_table[group][app].map && m_app<attr_table[group][app].map_size)
{
x=attr_table[group][app].map[m_app];
if(x==0 && c_app!=m_app)
rc=gddErrorNotDefined;
}
else
rc=gddErrorOutOfBounds;
}
else
return gddErrorOutOfBounds;
gddAutoPrint("gddAppTable::mapAppToIndex()",rc);
return rc;
}
gdd* gddApplicationTypeTable::getDD(aitUint32 rapp)
@@ -433,15 +450,17 @@ gddStatus gddApplicationTypeTable::freeDD(gdd* dd)
gddStatus gddApplicationTypeTable::storeValue(aitUint32 ap, aitUint32 uv)
{
aitUint32 group,app;
gddStatus rc;
gddStatus rc=0;
if((rc=splitApplicationType(ap,group,app))<0) return rc;
if(attr_table[group]==NULL ||
attr_table[group][app].type==gddApplicationTypeUndefined)
return gddErrorNotDefined;
rc=gddErrorNotDefined;
else
attr_table[group][app].user_value=uv;
attr_table[group][app].user_value=uv;
return 0;
gddAutoPrint("gddAppTable::storeValue()",rc);
return rc;
}
aitUint32 gddApplicationTypeTable::getValue(aitUint32 ap)
@@ -522,6 +541,9 @@ gddStatus gddApplicationTypeTable::smartCopy(gdd* dest, gdd* src)
{
gddStatus rc=0;
// only works with managed containers because app table mapping
// feature is used.
if(dest->isContainer() && dest->isManaged())
rc=copyDD_src(dest,src);
else if(src->isContainer() && src->isManaged())
@@ -531,5 +553,6 @@ gddStatus gddApplicationTypeTable::smartCopy(gdd* dest, gdd* src)
else
rc=gddErrorNotAllowed;
gddAutoPrint("gddAppTable::smartCopy()",rc);
return rc;
}
+10 -1
View File
@@ -8,6 +8,9 @@
* $Id$
*
* $Log$
* Revision 1.1 1996/06/25 19:11:42 jbk
* new in EPICS base
*
*
* *Revision 1.3 1996/06/24 03:15:36 jbk
* *name changes and fixes for aitString and fixed string functions
@@ -167,9 +170,15 @@ inline aitUint32 gddApplicationTypeTable::index(aitUint32 rapp) const
inline gddStatus gddApplicationTypeTable::splitApplicationType(aitUint32 rapp,
aitUint32& g, aitUint32& app) const
{
gddStatus rc=0;
g=group(rapp);
app=index(rapp);
if(rapp>=total_registered) return gddErrorOutOfBounds; else return 0;
if(rapp>=total_registered)
{
rc=gddErrorOutOfBounds;
gddAutoPrint("gddAppTable::splitApplicationType()",rc);
}
return rc;
}
inline aitUint32 gddApplicationTypeTable::registerApplicationType(
+24
View File
@@ -8,6 +8,9 @@
* $Id$
*
* $Log$
* Revision 1.1 1996/06/25 19:11:43 jbk
* new in EPICS base
*
*
* *Revision 1.2 1996/06/13 21:32:00 jbk
* *Various fixes and correction - including ref_cnt change to unsigned short
@@ -16,6 +19,11 @@
*
*/
/*
gdd.cc contains a table (gddErrorMessages) that has all the text
strings for each of the error codes
*/
typedef long gddStatus;
#define gddErrorTypeMismatch -1
@@ -29,4 +37,20 @@ typedef long gddStatus;
#define gddErrorOverflow -9
#define gddErrorUnderflow -10
extern char* gddErrorMessages[];
#define gddPrintError(x) \
fprintf(stderr,"gdd Error: %s\n",gddErrorMessages[x*(-1)]);
#define gddPrintErrorWithMessage(msg,x) \
fprintf(stderr,"gdd Error: %s (%s)\n",gddErrorMessages[x*(-1)],msg);
#define gddGetErrorMessage(x) gddErrorMessages[x*(-1)]
#ifdef GDDAUTOPRINT
#define gddAutoPrint(s,x) if(x) gddPrintErrorWithMessage(s,x)
#else
#define gddAutoPrint(s,x) ;
#endif
#endif