Commit 2fbf2c86 authored by claes's avatar claes

*** empty log message ***

parent e5b50bc9
...@@ -103,7 +103,7 @@ wb_name wb_cdef::name(ldh_eName type) ...@@ -103,7 +103,7 @@ wb_name wb_cdef::name(ldh_eName type)
return m_cdrep->name(type); return m_cdrep->name(type);
} }
wb_bdef wb_cdef::bdef( char *bname) // Fix wb_bdef wb_cdef::bdef( char *bname)
{ {
check(); check();
pwr_tStatus sts; pwr_tStatus sts;
...@@ -111,10 +111,20 @@ wb_bdef wb_cdef::bdef( char *bname) // Fix ...@@ -111,10 +111,20 @@ wb_bdef wb_cdef::bdef( char *bname) // Fix
wb_bdrep *bdrep = m_cdrep->bdrep( &sts, bname); wb_bdrep *bdrep = m_cdrep->bdrep( &sts, bname);
if ( ODD(sts)) if ( ODD(sts))
return wb_bdef( bdrep); return wb_bdef( bdrep);
else { else
delete bdrep; return wb_bdef();
}
wb_bdef wb_cdef::bdef( pwr_tOix bix)
{
check();
pwr_tStatus sts;
wb_bdrep *bdrep = m_cdrep->bdrep( &sts, bix);
if ( ODD(sts))
return wb_bdef( bdrep);
else
return wb_bdef(); return wb_bdef();
}
} }
......
...@@ -90,6 +90,26 @@ wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, char *bname) ...@@ -90,6 +90,26 @@ wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, char *bname)
return bdrep; return bdrep;
} }
wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, int bix)
{
wb_orepdbs *orep = (wb_orepdbs *)m_orep->m_vrep->first( sts, m_orep);
wb_orepdbs *old;
while ( ODD(*sts)) {
if ( orep->cid() == pwr_eClass_ObjBodyDef &&
cdh_oixToBix( orep->oid().oix) == (unsigned int) bix) {
wb_bdrep *bdrep = new wb_bdrep( *orep);
return bdrep;
}
old = orep;
orep = (wb_orepdbs *)m_orep->m_vrep->next( sts, orep);
// Delete
old->ref();
old->unref();
}
return 0;
}
wb_adrep *wb_cdrep::adrep( pwr_tStatus *sts, char *aname) wb_adrep *wb_cdrep::adrep( pwr_tStatus *sts, char *aname)
{ {
wb_orepdbs *orep_attr; wb_orepdbs *orep_attr;
......
...@@ -41,6 +41,7 @@ class wb_cdrep ...@@ -41,6 +41,7 @@ class wb_cdrep
void name(const char *name); void name(const char *name);
void name(wb_name *name); void name(wb_name *name);
wb_bdrep *bdrep( pwr_tStatus *sts, int bix);
wb_bdrep *bdrep( pwr_tStatus *sts, char *bname); wb_bdrep *bdrep( pwr_tStatus *sts, char *bname);
wb_adrep *adrep( pwr_tStatus *sts, char *aname); wb_adrep *adrep( pwr_tStatus *sts, char *aname);
......
...@@ -918,6 +918,23 @@ ldh_ObjidToName(ldh_tSession session, pwr_tOid oid, ldh_eName type, char *buf, i ...@@ -918,6 +918,23 @@ ldh_ObjidToName(ldh_tSession session, pwr_tOid oid, ldh_eName type, char *buf, i
switch ( type) { switch ( type) {
case ldh_eName_Object: case ldh_eName_Object:
{
wb_object o = sp->object(oid);
if (!o) return o.sts();
try {
char name[200];
strcpy( name, o.name());
*size = strlen( name);
if ( *size > maxsize - 1)
return LDH__NAMEBUF;
strcpy( buf, name);
}
catch ( wb_error& e) {
return e.sts();
}
break;
}
case ldh_eName_Hierarchy: case ldh_eName_Hierarchy:
case ldh_eName_Path: case ldh_eName_Path:
case ldh_eName_VolPath: case ldh_eName_VolPath:
......
...@@ -315,6 +315,7 @@ int wb_vrepwbl::getTypeInfo( char *name, pwr_tTid *tid, pwr_eType *type, int *si ...@@ -315,6 +315,7 @@ int wb_vrepwbl::getTypeInfo( char *name, pwr_tTid *tid, pwr_eType *type, int *si
} }
} }
if ( type_extern) { if ( type_extern) {
// Fetch from other volume
pwr_tStatus sts; pwr_tStatus sts;
wb_tdrep *tdrep = m_merep->tdrep( &sts, wname); wb_tdrep *tdrep = m_merep->tdrep( &sts, wname);
...@@ -324,7 +325,7 @@ int wb_vrepwbl::getTypeInfo( char *name, pwr_tTid *tid, pwr_eType *type, int *si ...@@ -324,7 +325,7 @@ int wb_vrepwbl::getTypeInfo( char *name, pwr_tTid *tid, pwr_eType *type, int *si
*type = tdrep->type(); *type = tdrep->type();
*size = tdrep->size(); *size = tdrep->size();
*elements = tdrep->nElement(); *elements = tdrep->nElement();
return 1; delete tdrep;
} }
return 1; return 1;
} }
...@@ -455,8 +456,16 @@ int wb_vrepwbl::getTypeInfo( pwr_tTid tid, pwr_eType *type, int *size, ...@@ -455,8 +456,16 @@ int wb_vrepwbl::getTypeInfo( pwr_tTid tid, pwr_eType *type, int *size,
*elements = 1; *elements = 1;
} }
else { else {
// Search type in other volumes TODO... // Search type in other volumes
return 0; pwr_tStatus sts;
wb_tdrep *tdrep = m_merep->tdrep( &sts, tid);
if ( EVEN(sts)) return 0;
*type = tdrep->type();
*size = tdrep->size();
*elements = tdrep->nElement();
delete tdrep;
} }
} }
} }
...@@ -487,7 +496,29 @@ int wb_vrepwbl::getClassInfo( pwr_tCid cid, int *rsize, int *dsize) ...@@ -487,7 +496,29 @@ int wb_vrepwbl::getClassInfo( pwr_tCid cid, int *rsize, int *dsize)
} }
else { else {
// Search type in other volumes TODO... // Search type in other volumes TODO...
return 0; pwr_tStatus sts;
wb_cdrep *cdrep = m_merep->cdrep( &sts, cid);
if ( EVEN(sts)) return 0;
wb_bdrep *bdrep = cdrep->bdrep( &sts, cdh_eBix_RtBody);
if ( ODD(sts)) {
*rsize = bdrep->size();
delete bdrep;
}
else
*rsize = 0;
bdrep = cdrep->bdrep( &sts, cdh_eBix_DevBody);
if ( ODD(sts)) {
*dsize = bdrep->size();
delete bdrep;
}
else
*dsize = 0;
delete cdrep;
return 1;
} }
return 0; return 0;
} }
...@@ -535,7 +566,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size, ...@@ -535,7 +566,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size,
{ {
pwr_sType o; pwr_sType o;
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
if ( attr->attributeIsEqual("Type", level)) { if ( attr->attributeIsEqual("Type", level)) {
*size = sizeof( o.Type); *size = sizeof( o.Type);
...@@ -555,7 +586,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size, ...@@ -555,7 +586,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size,
{ {
pwr_sTypeDef o; pwr_sTypeDef o;
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
IF_ATTR( Type, pwr_eType_UInt32, 1, level) IF_ATTR( Type, pwr_eType_UInt32, 1, level)
else IF_ATTR( Size, pwr_eType_Int32, 1, level) else IF_ATTR( Size, pwr_eType_Int32, 1, level)
...@@ -567,7 +598,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size, ...@@ -567,7 +598,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size,
{ {
pwr_sClassDef o; pwr_sClassDef o;
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
IF_ATTR( Editor, pwr_eType_UInt32, 1, level) IF_ATTR( Editor, pwr_eType_UInt32, 1, level)
else IF_ATTR( Method, pwr_eType_UInt32, 1, level) else IF_ATTR( Method, pwr_eType_UInt32, 1, level)
...@@ -580,7 +611,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size, ...@@ -580,7 +611,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size,
{ {
pwr_sClassVolume o; pwr_sClassVolume o;
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
IF_ATTR( Description, pwr_eType_String, 1, level) IF_ATTR( Description, pwr_eType_String, 1, level)
else IF_ATTR( NextOix, pwr_eType_ObjectIx, 1, level) else IF_ATTR( NextOix, pwr_eType_ObjectIx, 1, level)
...@@ -599,7 +630,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size, ...@@ -599,7 +630,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size,
{ {
pwr_sObjBodyDef o; pwr_sObjBodyDef o;
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
IF_ATTR( StructName, pwr_eType_String, 1, level) IF_ATTR( StructName, pwr_eType_String, 1, level)
else IF_ATTR( NumOfParams, pwr_eType_UInt32, 1, level) else IF_ATTR( NumOfParams, pwr_eType_UInt32, 1, level)
...@@ -612,7 +643,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size, ...@@ -612,7 +643,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_name *attr, int bix, pwr_tCid cid, int *size,
{ {
pwr_sParam o; pwr_sParam o;
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
if ( attr->attributeIsEqual( "PgmName", level)) { if ( attr->attributeIsEqual( "PgmName", level)) {
*size = sizeof( o.Info.PgmName); *size = sizeof( o.Info.PgmName);
...@@ -731,49 +762,49 @@ int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body) ...@@ -731,49 +762,49 @@ int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body)
{ {
switch ( cid) { switch ( cid) {
case pwr_eClass_Type: case pwr_eClass_Type:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = sizeof( pwr_sType); *size = sizeof( pwr_sType);
*body = calloc( 1, *size); *body = calloc( 1, *size);
return 1; return 1;
case pwr_eClass_TypeDef: case pwr_eClass_TypeDef:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = sizeof( pwr_sTypeDef); *size = sizeof( pwr_sTypeDef);
*body = calloc( 1, *size); *body = calloc( 1, *size);
return 1; return 1;
case pwr_eClass_ClassDef: case pwr_eClass_ClassDef:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = sizeof( pwr_sClassDef); *size = sizeof( pwr_sClassDef);
*body = calloc( 1, *size); *body = calloc( 1, *size);
return 1; return 1;
case pwr_eClass_ClassVolume: case pwr_eClass_ClassVolume:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = sizeof( pwr_sClassVolume); *size = sizeof( pwr_sClassVolume);
*body = calloc( 1, *size); *body = calloc( 1, *size);
return 1; return 1;
case pwr_eClass_ClassHier: case pwr_eClass_ClassHier:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = 0; *size = 0;
*body = 0; *body = 0;
return 1; return 1;
case pwr_eClass_TypeHier: case pwr_eClass_TypeHier:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = 0; *size = 0;
*body = 0; *body = 0;
return 1; return 1;
case pwr_eClass_ObjBodyDef: case pwr_eClass_ObjBodyDef:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = sizeof( pwr_sObjBodyDef); *size = sizeof( pwr_sObjBodyDef);
*body = calloc( 1, *size); *body = calloc( 1, *size);
return 1; return 1;
case pwr_eClass_Param: case pwr_eClass_Param:
if ( bix != wbl_eBix_SysBody) if ( bix != cdh_eBix_SysBody)
return 0; return 0;
*size = sizeof( pwr_sParam); *size = sizeof( pwr_sParam);
*body = calloc( 1, *size); *body = calloc( 1, *size);
...@@ -789,14 +820,14 @@ int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body) ...@@ -789,14 +820,14 @@ int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body)
if ( !n->c_template) if ( !n->c_template)
return 0; return 0;
if ( bix == wbl_eBix_SysBody || bix == wbl_eBix_RtBody) { if ( bix == cdh_eBix_SysBody || bix == cdh_eBix_RtBody) {
*size = n->c_template->rbody_size; *size = n->c_template->rbody_size;
if ( *size) { if ( *size) {
*body = calloc( 1, *size); *body = calloc( 1, *size);
memcpy( *body, n->c_template->rbody, *size); memcpy( *body, n->c_template->rbody, *size);
} }
} }
else if ( bix == wbl_eBix_DevBody) { else if ( bix == cdh_eBix_DevBody) {
*size = n->c_template->dbody_size; *size = n->c_template->dbody_size;
if ( *size) { if ( *size) {
*body = calloc( 1, *size); *body = calloc( 1, *size);
......
...@@ -378,10 +378,10 @@ void wb_wblnode::build( bool recursive) ...@@ -378,10 +378,10 @@ void wb_wblnode::build( bool recursive)
m_oid.vid = m_vrep->vid(); m_oid.vid = m_vrep->vid();
if ( isClassDef()) { if ( isClassDef()) {
m_vrep->getTemplateBody( m_cid, wbl_eBix_SysBody, &rbody_size, &rbody); m_vrep->getTemplateBody( m_cid, cdh_eBix_SysBody, &rbody_size, &rbody);
} }
else if ( isType() || isTypeDef()) { else if ( isType() || isTypeDef()) {
m_vrep->getTemplateBody( m_cid, wbl_eBix_SysBody, &rbody_size, &rbody); m_vrep->getTemplateBody( m_cid, cdh_eBix_SysBody, &rbody_size, &rbody);
} }
else if ( isTemplate()) { else if ( isTemplate()) {
// Build later by classdef // Build later by classdef
...@@ -390,8 +390,8 @@ void wb_wblnode::build( bool recursive) ...@@ -390,8 +390,8 @@ void wb_wblnode::build( bool recursive)
return; return;
} }
else { else {
m_vrep->getTemplateBody( m_cid, wbl_eBix_RtBody, &rbody_size, &rbody); m_vrep->getTemplateBody( m_cid, cdh_eBix_RtBody, &rbody_size, &rbody);
m_vrep->getTemplateBody( m_cid, wbl_eBix_DevBody, &dbody_size, &dbody); m_vrep->getTemplateBody( m_cid, cdh_eBix_DevBody, &dbody_size, &dbody);
} }
ref_wblnode first_child; ref_wblnode first_child;
...@@ -404,7 +404,7 @@ void wb_wblnode::build( bool recursive) ...@@ -404,7 +404,7 @@ void wb_wblnode::build( bool recursive)
o_fch->build( 1); o_fch->build( 1);
if ( isClassDef()) { if ( isClassDef()) {
m_oid.oix = wbl_cixToOix( m_oid.oix, 0, 0); m_oid.oix = cdh_cixToOix( m_oid.oix, 0, 0);
if ( !m_vrep->registerObject( m_oid.oix, this)) if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate class index", getFileName(), line_number); m_vrep->error( "Duplicate class index", getFileName(), line_number);
...@@ -421,7 +421,7 @@ void wb_wblnode::build( bool recursive) ...@@ -421,7 +421,7 @@ void wb_wblnode::build( bool recursive)
c_template->buildTemplate( this); c_template->buildTemplate( this);
} }
else if ( isType()) { else if ( isType()) {
m_oid.oix = wbl_tixToOix( 0, m_oid.oix); m_oid.oix = cdh_tixToOix( 0, m_oid.oix);
if ( !m_vrep->registerObject( m_oid.oix, this)) if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate type index", getFileName(), line_number); m_vrep->error( "Duplicate type index", getFileName(), line_number);
...@@ -430,7 +430,7 @@ void wb_wblnode::build( bool recursive) ...@@ -430,7 +430,7 @@ void wb_wblnode::build( bool recursive)
ty_elements = 1; ty_elements = 1;
} }
else if ( isTypeDef()) { else if ( isTypeDef()) {
m_oid.oix = wbl_tixToOix( 1, m_oid.oix); m_oid.oix = cdh_tixToOix( 1, m_oid.oix);
if ( !m_vrep->registerObject( m_oid.oix, this)) if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate type index", getFileName(), line_number); m_vrep->error( "Duplicate type index", getFileName(), line_number);
...@@ -459,7 +459,7 @@ void wb_wblnode::build( bool recursive) ...@@ -459,7 +459,7 @@ void wb_wblnode::build( bool recursive)
void wb_wblnode::buildObjBodyDef( ref_wblnode classdef) void wb_wblnode::buildObjBodyDef( ref_wblnode classdef)
{ {
m_oid.oix = wbl_cixToOix( classdef->c_cix, m_oid.oix, 0); m_oid.oix = cdh_cixToOix( classdef->c_cix, m_oid.oix, 0);
if ( !m_vrep->registerObject( m_oid.oix, this)) if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate objbodydef index", getFileName(), line_number); m_vrep->error( "Duplicate objbodydef index", getFileName(), line_number);
...@@ -482,7 +482,7 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef, ...@@ -482,7 +482,7 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef,
int size; int size;
int elements; int elements;
m_oid.oix = wbl_cixToOix( classdef->c_cix, objbodydef->b_bix, m_oid.oix); m_oid.oix = cdh_cixToOix( classdef->c_cix, objbodydef->b_bix, m_oid.oix);
if ( !m_vrep->registerObject( m_oid.oix, this)) if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate attribute index", getFileName(), line_number); m_vrep->error( "Duplicate attribute index", getFileName(), line_number);
...@@ -524,7 +524,7 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef, ...@@ -524,7 +524,7 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef,
{ {
int rsize, dsize; int rsize, dsize;
m_oid.oix = wbl_cixToOix( classdef->c_cix, objbodydef->b_bix, m_oid.oix); m_oid.oix = cdh_cixToOix( classdef->c_cix, objbodydef->b_bix, m_oid.oix);
if ( !m_vrep->registerObject( m_oid.oix, this)) if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate buffer index", getFileName(), line_number); m_vrep->error( "Duplicate buffer index", getFileName(), line_number);
...@@ -558,17 +558,20 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef, ...@@ -558,17 +558,20 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef,
void wb_wblnode::buildTemplate( ref_wblnode classdef) void wb_wblnode::buildTemplate( ref_wblnode classdef)
{ {
wb_wblnode *objbodydef = classdef->o_fch; wb_wblnode *objbodydef = classdef->o_fch;
m_oid.oix = cdh_cixToOix( classdef->c_cix, 7, 0);
if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate template oix", getFileName(), line_number);
while ( objbodydef) { while ( objbodydef) {
if ( objbodydef->isObjBodyDef()) { if ( objbodydef->isObjBodyDef()) {
if ( objbodydef->b_bix == wbl_eBix_SysBody || if ( objbodydef->b_bix == cdh_eBix_SysBody ||
objbodydef->b_bix == wbl_eBix_RtBody) { objbodydef->b_bix == cdh_eBix_RtBody) {
rbody_size = objbodydef->b_size; rbody_size = objbodydef->b_size;
if ( rbody_size) { if ( rbody_size) {
rbody = calloc( 1, rbody_size); rbody = calloc( 1, rbody_size);
} }
} }
if ( objbodydef->b_bix == wbl_eBix_DevBody) { if ( objbodydef->b_bix == cdh_eBix_DevBody) {
dbody_size = objbodydef->b_size; dbody_size = objbodydef->b_size;
if ( dbody_size) if ( dbody_size)
dbody = calloc( 1, dbody_size); dbody = calloc( 1, dbody_size);
...@@ -591,11 +594,11 @@ void wb_wblnode::buildBody( ref_wblnode object) ...@@ -591,11 +594,11 @@ void wb_wblnode::buildBody( ref_wblnode object)
switch ( getType()) { switch ( getType()) {
case tokens.BODY: case tokens.BODY:
if ( strcmp( name, "SysBody") == 0) if ( strcmp( name, "SysBody") == 0)
bix = wbl_eBix_SysBody; bix = cdh_eBix_SysBody;
else if ( strcmp( name, "RtBody") == 0) else if ( strcmp( name, "RtBody") == 0)
bix = wbl_eBix_RtBody; bix = cdh_eBix_RtBody;
else if ( strcmp( name, "DevBody") == 0) else if ( strcmp( name, "DevBody") == 0)
bix = wbl_eBix_SysBody; bix = cdh_eBix_SysBody;
else { else {
// Body exception // Body exception
m_vrep->error( "Bad body name", getFileName(), line_number); m_vrep->error( "Bad body name", getFileName(), line_number);
...@@ -649,16 +652,16 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix) ...@@ -649,16 +652,16 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
m_vrep->error( "Attribute syntax", getFileName(), line_number); m_vrep->error( "Attribute syntax", getFileName(), line_number);
} }
else { else {
if ( ((bix == wbl_eBix_RtBody || bix == wbl_eBix_SysBody) && if ( ((bix == cdh_eBix_RtBody || bix == cdh_eBix_SysBody) &&
object->rbody_size == 0) || object->rbody_size == 0) ||
(bix == wbl_eBix_DevBody && object->dbody_size == 0)) { (bix == cdh_eBix_DevBody && object->dbody_size == 0)) {
m_vrep->error( "Attribute body", getFileName(), line_number); m_vrep->error( "Attribute body", getFileName(), line_number);
return; return;
} }
if ( ((bix == wbl_eBix_RtBody || bix == wbl_eBix_SysBody) && if ( ((bix == cdh_eBix_RtBody || bix == cdh_eBix_SysBody) &&
offset + size/elements > object->rbody_size) || offset + size/elements > object->rbody_size) ||
( bix == wbl_eBix_RtBody && ( bix == cdh_eBix_RtBody &&
offset + size/elements > object->rbody_size)) { offset + size/elements > object->rbody_size)) {
m_vrep->error( "Mismatch in attribute offset", getFileName(), line_number); m_vrep->error( "Mismatch in attribute offset", getFileName(), line_number);
return; return;
...@@ -667,21 +670,21 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix) ...@@ -667,21 +670,21 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
// printf( "Attr %s %s %d %d %s\n", object->name, name, size, offset, value); // printf( "Attr %s %s %d %d %s\n", object->name, name, size, offset, value);
if ( size/elements == sizeof(int_val) && convconst( &int_val, value)) { if ( size/elements == sizeof(int_val) && convconst( &int_val, value)) {
if ( oper == tokens.EQ) { if ( oper == tokens.EQ) {
if ( bix == wbl_eBix_RtBody || bix == wbl_eBix_SysBody) if ( bix == cdh_eBix_RtBody || bix == cdh_eBix_SysBody)
memcpy( (char *)((unsigned int) object->rbody + offset), memcpy( (char *)((unsigned int) object->rbody + offset),
&int_val, size/elements); &int_val, size/elements);
else if ( bix == wbl_eBix_DevBody) else if ( bix == cdh_eBix_DevBody)
memcpy( (char *)((unsigned int) object->dbody + offset), memcpy( (char *)((unsigned int) object->dbody + offset),
&int_val, size/elements); &int_val, size/elements);
} }
else if ( oper == tokens.OREQ) { else if ( oper == tokens.OREQ) {
if ( bix == wbl_eBix_RtBody || bix == wbl_eBix_SysBody) { if ( bix == cdh_eBix_RtBody || bix == cdh_eBix_SysBody) {
current_int_val = *(int *) ((unsigned int) object->rbody + offset); current_int_val = *(int *) ((unsigned int) object->rbody + offset);
int_val |= current_int_val; int_val |= current_int_val;
memcpy( (char *)((unsigned int) object->rbody + offset), memcpy( (char *)((unsigned int) object->rbody + offset),
&int_val, size/elements); &int_val, size/elements);
} }
else if ( bix == wbl_eBix_DevBody) { else if ( bix == cdh_eBix_DevBody) {
current_int_val = *(int *) ((unsigned int) object->dbody + offset); current_int_val = *(int *) ((unsigned int) object->dbody + offset);
int_val |= current_int_val; int_val |= current_int_val;
memcpy( (char *)((unsigned int) object->dbody + offset), memcpy( (char *)((unsigned int) object->dbody + offset),
...@@ -690,10 +693,10 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix) ...@@ -690,10 +693,10 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
} }
} }
else if ( attrStringToValue( tid, value, buf, sizeof( buf), size)) { else if ( attrStringToValue( tid, value, buf, sizeof( buf), size)) {
if ( bix == wbl_eBix_RtBody || bix == wbl_eBix_SysBody) if ( bix == cdh_eBix_RtBody || bix == cdh_eBix_SysBody)
memcpy( (char *)((unsigned int) object->rbody + offset), memcpy( (char *)((unsigned int) object->rbody + offset),
buf, size/elements); buf, size/elements);
else if ( bix == wbl_eBix_DevBody) else if ( bix == cdh_eBix_DevBody)
memcpy( (char *)((unsigned int) object->dbody + offset), memcpy( (char *)((unsigned int) object->dbody + offset),
buf, size/elements); buf, size/elements);
} }
...@@ -869,7 +872,8 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol) ...@@ -869,7 +872,8 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
m_vrep->error( "Missing index", getFileName(), line_number); m_vrep->error( "Missing index", getFileName(), line_number);
} }
else { else {
m_oid.oix = m_vrep->nextOix(); if ( !isTemplate())
m_oid.oix = m_vrep->nextOix();
} }
} }
} }
...@@ -882,7 +886,7 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol) ...@@ -882,7 +886,7 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
} }
if ( isClassDef()) { if ( isClassDef()) {
c_cid = wbl_cixToCid( m_vrep->vid(), m_oid.oix); c_cid = cdh_cixToCid( m_vrep->vid(), m_oid.oix);
c_cix = m_oid.oix; c_cix = m_oid.oix;
m_vrep->registerClass( name, c_cid, this); m_vrep->registerClass( name, c_cid, this);
...@@ -913,17 +917,17 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol) ...@@ -913,17 +917,17 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
else else
setFirstChild( (RefAST)c_template); setFirstChild( (RefAST)c_template);
strcpy( c_template->cname, name); strcpy( c_template->cname, name);
c_template->m_oid.oix = m_vrep->nextOix(); // c_template->m_oid.oix = m_vrep->nextOix();
c_template->m_cid = c_cid; c_template->m_cid = c_cid;
c_template->node_type = wbl_eNodeType_Template; c_template->node_type = wbl_eNodeType_Template;
} }
} }
else if ( isType()) { else if ( isType()) {
m_tid = wbl_tixToTid( m_vrep->vid(), 0, m_oid.oix); m_tid = cdh_tixToTid( m_vrep->vid(), 0, m_oid.oix);
m_vrep->registerType( name, m_tid, this); m_vrep->registerType( name, m_tid, this);
} }
else if ( isTypeDef()) { else if ( isTypeDef()) {
m_tid = wbl_tixToTid( m_vrep->vid(), 1, m_oid.oix); m_tid = cdh_tixToTid( m_vrep->vid(), 1, m_oid.oix);
m_vrep->registerType( name, m_tid, this); m_vrep->registerType( name, m_tid, this);
} }
else if ( isObjBodyDef()) { else if ( isObjBodyDef()) {
......
...@@ -15,11 +15,6 @@ class wb_wblnode; ...@@ -15,11 +15,6 @@ class wb_wblnode;
class wb_vrepwbl; class wb_vrepwbl;
class wb_dbs; class wb_dbs;
#define wbl_cixToCid( Vid, Cix) (0 + (Vid << 16) + (Cix << 3))
#define wbl_tixToTid( Vid, Tyg, Tix) (0 + (Vid << 16) + (1 << 15) + (Tyg << 11) + Tix)
#define wbl_cixToOix( Cix, Bix, Aix) (0 + (1 << 31) + (Cix << 18) + (Bix << 15) + Aix)
#define wbl_tixToOix( Tyg, Tix) (0 + (1 << 31) + (1 << 30) + (Tyg << 26) + (Tix << 15))
typedef enum { typedef enum {
wbl_eNodeType_No, wbl_eNodeType_No,
wbl_eNodeType_Type, wbl_eNodeType_Type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment