Commit d346aed5 authored by ml's avatar ml

*** empty log message ***

parent 38ad685d
......@@ -111,6 +111,15 @@ typedef pwr_tOix pwr_tObjectIx;
typedef unsigned int pwr_tMask;
typedef unsigned int pwr_tEnum;
typedef enum {
pwr_eBix__ = 0,
pwr_eBix_sys = 1,
pwr_eBix_rt = 1,
pwr_eBix_dev = 2,
pwr_eBix_template = 7,
pwr_eBix_
} pwr_eBix;
typedef struct {
pwr_tOix oix;
pwr_tVid vid;
......
......@@ -582,7 +582,10 @@ union pwr_m_Adef {
pwr_Bits( rtdbref , 1),
pwr_Bits( privatepointer , 1),
pwr_Bits( fill_0 , 7),,,,,,,
pwr_Bits( isclass , 1), /* class is a reserved word */
pwr_Bits( subclass , 1),
pwr_Bits( buffer , 1),
pwr_Bits( fill_0 , 4),,,,
pwr_Bits( fill_1 , 8),,,,,,,
) b;
......@@ -604,6 +607,9 @@ union pwr_m_Adef {
#define pwr_mAdef_noremove pwr_Bit(14) /* 16384 Cannot be removed, no used chkbx */
#define pwr_mAdef_rtdbref pwr_Bit(15) /* 32768 */
#define pwr_mAdef_private pwr_Bit(16) /* 65536 Private pointer, not to be displayed */
#define pwr_mAdef_class pwr_Bit(17)
#define pwr_mAdef_subclass pwr_Bit(18)
#define pwr_mAdef_buffer pwr_Bit(19)
};
#define PWR_MASK_POINTER pwr_mAdef_pointer
......@@ -624,6 +630,9 @@ union pwr_m_Adef {
#define PWR_MASK_NOREMOVE pwr_mAdef_noremove
#define PWR_MASK_RTDBREF pwr_mAdef_rtdbref
#define PWR_MASK_PRIVATE pwr_mAdef_private
#define PWR_MASK_CLASS pwr_mAdef_class
#define PWR_MASK_SUBCLASS pwr_mAdef_subclass
#define PWR_MASK_BUFFER pwr_mAdef_buffer
struct pwr_s_Param
{
......
......@@ -38,14 +38,6 @@ typedef enum {
cdh_eVid3_qid = 130
} cdh_eVId3;
typedef enum {
cdh_eBix__ = 0,
cdh_eBix_sys = 1,
cdh_eBix_rt = 1,
cdh_eBix_dev = 2,
cdh_eBix_template = 7,
cdh_eBix_
} cdh_eBix;
#define cdh_CidToVid(cid) ((cid) >> 16)
#define cdh_TidToVid(tid) ((tid) >> 16)
......@@ -53,7 +45,7 @@ typedef enum {
#define cdh_tixToTid( Vid, Tyg, Tix) (0 + (Vid << 16) + (1 << 15) + (Tyg << 11) + Tix)
#define cdh_cixToOix( Cix, Bix, Aix) (0 + (1 << 31) + (Cix << 18) + (Bix << 15) + Aix)
#define cdh_tixToOix( Tyg, Tix) (0 + (1 << 31) + (1 << 30) + (Tyg << 26) + (Tix << 15))
#define cdh_oixToBix( Oix) ((Oix >> 15) & 7)
#define cdh_oixToBix( Oix) ((pwr_eBix)((Oix >> 15) & 7))
#define cdh_oixToCix( Oix) ((Oix >> 18) & 0xfff)
#define cdh_oixToAix( Oix) (Oix & 0xfff)
......
......@@ -918,15 +918,15 @@ dbs_Object(pwr_tStatus *sts, const dbs_sEnv *ep)
}
void *
dbs_Body(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, cdh_eBix bix)
dbs_Body(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, pwr_eBix bix)
{
char *p = NULL;
switch (bix) {
case cdh_eBix_rt:
case pwr_eBix_rt:
p = dbs_Address(sts, ep, op->rbody.ref);
break;
case cdh_eBix_dev:
case pwr_eBix_dev:
p = dbs_Address(sts, ep, op->dbody.ref);
break;
default:
......
......@@ -606,7 +606,7 @@ struct dbs_sScObject {
%dbs_sObject *dbs_VolumeObject(pwr_tStatus *sts, const dbs_sEnv *ep);
%dbs_sObject *dbs_Object(pwr_tStatus *sts, const dbs_sEnv *ep);
%void dbs_ObjectToName(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, char *name);
%void *dbs_Body(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, cdh_eBix bix);
%void *dbs_Body(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, pwr_eBix bix);
%
%
%#ifdef __cplusplus
......
......@@ -113,7 +113,7 @@ pwr_tCid wb_adef::cid()
return m_adrep->cid();
}
pwr_tOix wb_adef::bix()
pwr_eBix wb_adef::bix()
{
check();
return m_adrep->bix();
......
......@@ -42,7 +42,7 @@ public:
pwr_tOid aoid();
pwr_tAix aix();
pwr_tCid cid();
pwr_tOix bix();
pwr_eBix bix();
pwr_tOid boid();
wb_adef next();
......
......@@ -26,7 +26,7 @@ wb_adrep::wb_adrep( wb_orepdbs& o): m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS),
{
pwr_sParam attr;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &attr);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &attr);
if ( EVEN(sts)) throw wb_error(sts);
strcpy( m_pgmname, attr.Info.PgmName);
......@@ -45,7 +45,7 @@ wb_adrep::wb_adrep( wb_orepdbs& o): m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS),
{
pwr_sIntern attr;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &attr);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &attr);
if ( EVEN(sts)) throw wb_error(sts);
strcpy( m_pgmname, attr.Info.PgmName);
......@@ -64,7 +64,7 @@ wb_adrep::wb_adrep( wb_orepdbs& o): m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS),
{
pwr_sObjXRef attr;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &attr);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &attr);
if ( EVEN(sts)) throw wb_error(sts);
strcpy( m_pgmname, attr.Info.PgmName);
......@@ -82,7 +82,7 @@ wb_adrep::wb_adrep( wb_orepdbs& o): m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS),
{
pwr_sAttrXRef attr;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &attr);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &attr);
if ( EVEN(sts)) throw wb_error(sts);
strcpy( m_pgmname, attr.Info.PgmName);
......@@ -100,7 +100,7 @@ wb_adrep::wb_adrep( wb_orepdbs& o): m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS),
{
pwr_sBuffer attr;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &attr);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &attr);
if ( EVEN(sts)) throw wb_error(sts);
strcpy( m_pgmname, attr.Info.PgmName);
......@@ -110,6 +110,7 @@ wb_adrep::wb_adrep( wb_orepdbs& o): m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS),
m_elements = attr.Info.Elements;
m_paramindex = attr.Info.ParamIndex;
m_flags = attr.Info.Flags;
m_flags |= PWR_MASK_BUFFER;
m_tid = 0;
m_bufferClass = attr.Class;
......@@ -165,9 +166,9 @@ int wb_adrep::aix()
return cdh_oixToAix( m_orep->oid().oix);
}
cdh_eBix wb_adrep::bix()
pwr_eBix wb_adrep::bix()
{
return (cdh_eBix) cdh_oixToBix( m_orep->oid().oix);
return (pwr_eBix) cdh_oixToBix( m_orep->oid().oix);
}
pwr_sAttrRef wb_adrep::aref()
......@@ -247,5 +248,5 @@ void *wb_adrep::body( void *p)
throw wb_error(LDH__NYI);
}
return m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, p);
return m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, p);
}
#ifndef wb_adrep_h
#define wb_adrep_h
#include "pwr.h"
#include "wb_cdrep.h"
#include "wb_bdrep.h"
#include "pwr_class.h"
#include "co_cdh.h"
#include "wb_name.h"
class wb_bdrep;
class wb_cdrep;
class wb_orepdbs;
class wb_vrep;
......@@ -49,7 +52,7 @@ class wb_adrep
pwr_tOid aoid();
int aix();
pwr_tCid cid();
cdh_eBix bix();
pwr_eBix bix();
int flags() {return m_flags;}
pwr_tOid boid();
pwr_eClass bufferClass() { return m_bufferClass;}
......
......@@ -8,14 +8,14 @@
wb_attribute::wb_attribute() : wb_status(LDH__NOSUCHATTR), m_orep(0), m_adrep(0),
m_size(0), m_offset(0), m_tid(0), m_elements(0),
m_type(pwr_eType_), m_flags(0)
m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
}
wb_attribute::wb_attribute(const wb_attribute& x) :
wb_status(x.m_sts),m_orep(x.m_orep), m_adrep( x.m_adrep), m_size(x.m_size),
m_offset(x.m_offset), m_tid(x.m_tid), m_elements(x.m_elements), m_type(x.m_type),
m_flags(x.m_flags)
m_flags(x.m_flags), m_bix(x.m_bix)
{
if ( m_orep)
m_orep->ref();
......@@ -23,9 +23,9 @@ wb_attribute::wb_attribute(const wb_attribute& x) :
m_adrep->ref();
}
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep) :
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * orep) :
wb_status(sts), m_orep(orep), m_adrep(0), m_size(0), m_offset(0), m_tid(0),
m_elements(0), m_type(pwr_eType_), m_flags(0)
m_elements(0), m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
if ( orep == 0)
m_sts = LDH__NOSUCHATTR;
......@@ -36,9 +36,9 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep) :
}
}
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep, wb_adrep * const adrep) :
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, wb_adrep* adrep) :
wb_status(sts), m_orep(orep), m_adrep(adrep), m_size(0), m_offset(0), m_tid(0),
m_elements(0), m_type(pwr_eType_), m_flags(0)
m_elements(0), m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
if ( orep == 0)
m_sts = LDH__NOSUCHATTR;
......@@ -60,9 +60,9 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep, wb_adrep * con
}
}
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep, const char *bname) :
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char* bname) :
wb_status(sts), m_orep(orep), m_adrep(0), m_size(0), m_offset(0), m_tid(0),
m_elements(0), m_type(pwr_eType_), m_flags(0)
m_elements(0), m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
if ( orep == 0)
m_sts = LDH__NOSUCHATTR;
......@@ -81,9 +81,9 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep, const char *bn
}
}
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep, char const *bname, const char *aname) :
wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, char const* bname, const char* aname) :
wb_status(sts), m_orep(orep), m_adrep(0), m_size(0), m_offset(0), m_tid(0),
m_elements(0), m_type(pwr_eType_), m_flags(0)
m_elements(0), m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
if ( orep == 0)
m_sts = LDH__NOSUCHATTR;
......@@ -120,6 +120,76 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * const orep, char const *bn
}
}
wb_attribute::wb_attribute(wb_attribute& pa, int idx, const char* aname) :
wb_status(LDH__NOSUCHATTR), m_orep(0), m_adrep(0), m_size(0), m_offset(0), m_tid(0),
m_elements(0), m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
pwr_tCid cid;
wb_attrname n;
if (!pa.isClass() || pa.m_orep == 0)
return;
if (idx < 0 || idx >= pa.m_elements)
throw wb_error_str("Invalid subscript");
if (!(pa.m_flags & PWR_MASK_BUFFER))
throw wb_error_str("Only $Buffer is supported as sub class");
cid = pa.bufferClass();
m_orep = pa.m_orep;
wb_cdrep *cd = m_orep->vrep()->merep()->cdrep(&m_sts, cid);
if (oddSts()) {
wb_bdrep* bd = cd->bdrep(&m_sts, pwr_eBix_sys);
if (oddSts()) {
if (aname != 0){
n = aname;
m_adrep = bd->adrep(&m_sts, n.attribute(0));
} else {
m_adrep = bd->adrep(&m_sts);
if (oddSts())
n = m_adrep->name();
}
if (oddSts()) {
m_adrep->ref();
if (!m_orep->vrep()->merep()->getAttrInfoRec( &n, m_adrep->bix(),
cid, (int *) &m_size,
&m_offset, &m_tid, &m_elements,
&m_type,
&m_flags, 0)) {
m_adrep->unref();
m_sts = LDH__NOSUCHATTR;
} else {
m_offset = pa.m_offset + idx * pa.m_size/pa.m_elements;
}
}
}
if (bd)
delete bd;
delete cd;
}
if (oddSts()) {
m_orep->ref();
m_flags |= PWR_MASK_SUBCLASS;
if (pa.m_flags & PWR_MASK_SUBCLASS)
m_bix = pa.m_bix;
else
m_bix = pa.m_adrep->bix();
}
else {
m_adrep = 0;
m_orep = 0;
}
}
wb_attribute::~wb_attribute()
{
if ( m_orep)
......@@ -147,6 +217,8 @@ wb_attribute& wb_attribute::operator=(const wb_attribute& x)
m_elements = x.m_elements;
m_type = x.m_type;
m_flags = x.m_flags;
m_bix = x.m_bix;
return *this;
}
......@@ -219,9 +291,11 @@ pwr_tCid wb_attribute::cid()
return m_orep->cid();
}
pwr_tAix wb_attribute::bix()
pwr_eBix wb_attribute::bix()
{
return 0; // Fix
throw wb_error_str("wb_attribute::bix() NYI");
return pwr_eBix__; // Fix
}
pwr_tOid wb_attribute::boid()
......@@ -255,14 +329,20 @@ pwr_sObjXRef *wb_attribute::oxref()
void *wb_attribute::value( void *p)
{
pwr_eBix bix;
pwr_tStatus sts;
check();
if ( m_adrep == 0) {
return m_orep->vrep()->readBody( &sts, m_orep, cdh_eBix_rt, p);
return m_orep->vrep()->readBody( &sts, m_orep, pwr_eBix_rt, p);
}
return m_orep->vrep()->readAttribute( &sts, m_orep, (cdh_eBix) m_adrep->bix(), m_offset,
m_size, p);
if (m_flags & PWR_MASK_SUBCLASS)
bix = m_bix;
else
bix = m_adrep->bix();
return m_orep->vrep()->readAttribute( &sts, m_orep, bix, m_offset, m_size, p);
}
void *wb_attribute::value(void *vp, size_t size, pwr_tStatus *sts)
......@@ -290,18 +370,57 @@ pwr_tStatus wb_attribute::fromString(char *)
return sts;
}
wb_attribute wb_attribute::next()
wb_attribute wb_attribute::after()
{
wb_attribute a;
return a;
pwr_tStatus sts;
check();
if (m_adrep == 0)
return wb_attribute();
wb_adrep* adrep = m_adrep->next(&sts);
if (evenSts())
return wb_attribute();
wb_attribute a(LDH__SUCCESS, m_orep, adrep);
// Fix for sub classes
if (m_flags & PWR_MASK_SUBCLASS) {
a.m_flags |= PWR_MASK_SUBCLASS;
a.m_bix = m_bix;
a.m_offset = m_offset + m_size;
}
return a;
}
wb_attribute wb_attribute::prev()
wb_attribute wb_attribute::before()
{
wb_attribute a;
return a;
}
wb_attribute wb_attribute::first(int idx)
{
if (!isClass())
return wb_attribute();
return wb_attribute(*this, idx, NULL);
}
wb_attribute wb_attribute::child(int idx, const char* name)
{
if (!isClass())
return wb_attribute();
return wb_attribute(*this, idx, name);
}
const char *wb_attribute::name() const
{
check();
......
......@@ -36,14 +36,17 @@ class wb_attribute : public wb_status
int m_elements;
pwr_eType m_type;
int m_flags;
pwr_eBix m_bix; // Used when sub class
public:
wb_attribute();
wb_attribute(const wb_attribute&);
wb_attribute(pwr_tStatus, wb_orep* const );
wb_attribute(pwr_tStatus, wb_orep* const, wb_adrep* const);
wb_attribute(pwr_tStatus, wb_orep* const, const char* bname);
wb_attribute(pwr_tStatus, wb_orep* const, const char* aname, const char* bname);
wb_attribute(pwr_tStatus, wb_orep*);
wb_attribute(pwr_tStatus, wb_orep*, wb_adrep*);
wb_attribute(pwr_tStatus, wb_orep*, const char* bname);
wb_attribute(pwr_tStatus, wb_orep*, const char* bname, const char* aname);
wb_attribute(wb_attribute& pa, int idx, const char* aname);
~wb_attribute();
wb_attribute& operator=(const wb_attribute&);
......@@ -53,6 +56,10 @@ public:
//wb_object& operator=(const wb_orep&);
bool isClass() const {return (m_flags & PWR_MASK_CLASS || m_flags & PWR_MASK_BUFFER);}
bool isArray() const {return (m_flags & PWR_MASK_ARRAY);}
pwr_tOid aoid(); // get objects object id
pwr_sAttrRef aref();
pwr_sAttrRef *aref(pwr_sAttrRef *arp);
......@@ -65,7 +72,7 @@ public:
pwr_tAix aix();
// Class of attribute object
pwr_tCid cid();
pwr_tAix bix();
pwr_eBix bix();
pwr_tOid boid();
bool checkXref();
pwr_sAttrXRef *xref();
......@@ -80,8 +87,11 @@ public:
pwr_tStatus fromString(char *);
wb_attribute next();
wb_attribute prev();
wb_attribute after();
wb_attribute before();
wb_attribute first(int idx);
wb_attribute child(int idx, const char* name);
const char *name() const;
......
......@@ -35,7 +35,7 @@ wb_bdef::wb_bdef(const wb_adef *a)
{
}
wb_bdef::wb_bdef(const wb_orep *o, pwr_tOix bix)
wb_bdef::wb_bdef(const wb_orep *o, pwr_eBix bix)
{
}
......@@ -44,7 +44,7 @@ pwr_tOid wb_bdef::boid()
return m_bdrep->boid();
}
pwr_tOix wb_bdef::bix()
pwr_eBix wb_bdef::bix()
{
return m_bdrep->bix();
}
......@@ -59,14 +59,14 @@ int wb_bdef::nAttribute()
return m_bdrep->nAttribute();
}
wb_name wb_bdef::name()
const char* wb_bdef::name() const
{
return m_bdrep->name();
}
wb_name wb_bdef::name(ldh_eName type)
wb_name wb_bdef::longName() const
{
return m_bdrep->name(type);
return m_bdrep->longName();
}
pwr_sAttrRef wb_bdef::aref()
......
......@@ -3,7 +3,6 @@
#include "pwr.h"
#include "wb_bdrep.h"
#include "wb_object.h"
#include "wb_name.h"
class wb_orep;
......@@ -22,7 +21,7 @@ public:
wb_bdef& operator=(const wb_bdef&);
wb_bdef(const wb_adef *a);
wb_bdef(const wb_orep *o, pwr_tAix bix);
wb_bdef(const wb_orep *o, pwr_eBix bix);
~wb_bdef() {}; // Fix
......@@ -31,12 +30,12 @@ public:
bool operator==(wb_bdef&);
pwr_tOid boid();
pwr_tOix bix();
pwr_eBix bix();
size_t size();
int nAttribute();
wb_name name(); // get attribute name
wb_name name(ldh_eName type);
const char* name() const; // get body name
wb_name longName() const;
pwr_sAttrRef aref();
......
......@@ -50,9 +50,9 @@ wb_adrep *wb_bdrep::adrep( pwr_tStatus *sts, const char *aname)
return adrep;
}
cdh_eBix wb_bdrep::bix()
pwr_eBix wb_bdrep::bix()
{
return (cdh_eBix) cdh_oixToBix( m_orep->oid().oix);
return cdh_oixToBix( m_orep->oid().oix);
}
size_t wb_bdrep::size()
......@@ -60,7 +60,7 @@ size_t wb_bdrep::size()
pwr_tStatus sts;
pwr_sObjBodyDef body;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &body);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &body);
if ( EVEN(sts)) throw wb_error(sts);
return body.Size;
......@@ -99,3 +99,14 @@ pwr_tOid wb_bdrep::boid()
{
return m_orep->oid();
}
const char* wb_bdrep::name() const
{
return m_orep->name();
}
wb_name wb_bdrep::longName() const
{
return m_orep->longName();
}
......@@ -2,11 +2,9 @@
#define wb_bdrep_h
#include "pwr.h"
#include "wb_orep.h"
#include "wb_object.h"
#include "wb_ldh.h"
#include "wb_name.h"
class wb_adef;
class wb_adrep;
class wb_orepdbs;
......@@ -28,12 +26,13 @@ public:
pwr_sAttrRef aref() { pwr_sAttrRef a; return a;} // Fix
size_t size();
int nAttribute();
cdh_eBix bix();
pwr_eBix bix();
pwr_tOid boid();
wb_name name() { wb_name n; return n;} // Fix // get attribute name
wb_name name(ldh_eName type) { wb_name n; return n;} // Fix
const char* name() const; // get body name
wb_name longName() const;
wb_adrep *adrep( pwr_tStatus *sts); // Get first attribute
wb_adrep *adrep( pwr_tStatus *sts, const char *aname);
......
#include "wb_cdef.h"
#include "wb_adef.h"
#include "wb_object.h"
wb_cdef::wb_cdef() : wb_status(LDH__NOCLASS), m_cdrep(0)
{
......@@ -116,7 +116,7 @@ wb_bdef wb_cdef::bdef( const char *bname)
return wb_bdef();
}
wb_bdef wb_cdef::bdef( pwr_tOix bix)
wb_bdef wb_cdef::bdef( pwr_eBix bix)
{
check();
pwr_tStatus sts;
......
......@@ -42,7 +42,7 @@ class wb_cdef : public wb_status
const char *name() const;
wb_name longName();
wb_bdef bdef(pwr_tOix bix);
wb_bdef bdef(pwr_eBix bix);
wb_bdef bdef(const char *bname);
wb_bdef bdef(wb_name bname);
......
......@@ -91,13 +91,13 @@ wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, const char *bname)
return bdrep;
}
wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, int bix)
wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, pwr_eBix 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) {
cdh_oixToBix( orep->oid().oix) == bix) {
wb_bdrep *bdrep = new wb_bdrep( *orep);
return bdrep;
}
......@@ -152,13 +152,13 @@ pwr_tCid wb_cdrep::cid()
return cdh_ClassObjidToId( m_orep->oid());
}
void wb_cdrep::templateBody( pwr_tStatus *sts, cdh_eBix bix, void *p)
void wb_cdrep::templateBody( pwr_tStatus *sts, pwr_eBix bix, void *p)
{
// Get objid for template object
pwr_tOid oid;
int cix = cdh_oixToCix( m_orep->oid().oix);
oid.vid = m_orep->oid().vid;
oid.oix = cdh_cixToOix( cix, cdh_eBix_template, 0);
oid.oix = cdh_cixToOix( cix, pwr_eBix_template, 0);
wb_orepdbs *orep = (wb_orepdbs *)m_orep->m_vrep->object( sts, oid);
if ( EVEN(*sts)) return;
......
......@@ -4,14 +4,13 @@
#include "pwr.h"
#include "pwr_class.h"
#include "wb_name.h"
#include "wb_orep.h"
class wb_adef;
class wb_orep;
class wb_mvrep;
class wb_adrep;
class wb_bdrep;
class wb_mvrep;
class wb_orep;
class wb_orepdbs;
class wb_adrep;
class wb_cdrep
{
......@@ -41,12 +40,12 @@ class wb_cdrep
void name(const char *name);
void name(wb_name *name);
wb_bdrep *bdrep( pwr_tStatus *sts, int bix);
wb_bdrep *bdrep( pwr_tStatus *sts, pwr_eBix bix);
wb_bdrep *bdrep( pwr_tStatus *sts, const char *bname);
wb_adrep *adrep( pwr_tStatus *sts, const char *aname);
wb_orep *classBody( pwr_tStatus *sts, const char *bname);
void templateBody( pwr_tStatus *sts, cdh_eBix bix, void *p);
void templateBody( pwr_tStatus *sts, pwr_eBix bix, void *p);
pwr_tStatus sts() { return m_sts;}
};
......
......@@ -2,8 +2,6 @@
#define wb_destination_h
#include "pwr.h"
#include "wb_object.h"
#include "wb_orep.h"
#include "wb_ldh.h"
class wb_orep;
......
......@@ -2,6 +2,7 @@
#include "wb_merep.h"
#include "wb_erep.h"
#include "wb_tdrep.h"
#include "wb_attrname.h"
#include "wb_ldh_msg.h"
......@@ -156,14 +157,14 @@ wb_tdrep *wb_merep::tdrep( pwr_tStatus *sts, wb_name name)
return 0;
}
int wb_merep::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, int *size,
int wb_merep::getAttrInfoRec( wb_attrname *attr, pwr_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements,
pwr_eType *type, int *flags, int level)
{
pwr_tStatus sts;
if ( level > 0)
bix = cdh_eBix_rt;
bix = pwr_eBix_rt;
wb_cdrep *cd = cdrep( &sts, cid);
if ( EVEN(sts)) return 0;
......
......@@ -34,7 +34,7 @@ class wb_merep {
wb_tdrep *tdrep( pwr_tStatus *sts, pwr_tTid tid);
wb_tdrep *tdrep( pwr_tStatus *sts, wb_name name);
int getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, int *size,
int getAttrInfoRec( wb_attrname *attr, pwr_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements,
pwr_eType *type, int *flags, int level);
......
#include "wb_mvrep.h"
#include "wb_tdrep.h"
wb_cdrep *wb_mvrep::cdrep( pwr_tCid cid)
{
......
......@@ -2,10 +2,12 @@
#define wb_mvrep_h
#include "wb_vrep.h"
#include "wb_cdrep.h"
#include "wb_tdrep.h"
#include "wb_bdrep.h"
#include "wb_adrep.h"
class wb_adrep;
class wb_cdrep;
class wb_orep;
class wb_tdrep;
class wb_mvrep : public wb_vrep {
public:
......
......@@ -319,7 +319,7 @@ size_t wb_object::rbSize()
check();
wb_cdef c = wb_cdef( *m_orep);
wb_bdef b = c.bdef( cdh_eBix_rt);
wb_bdef b = c.bdef( pwr_eBix_rt);
if ( !b)
return 0;
......@@ -329,7 +329,7 @@ size_t wb_object::rbSize()
size_t wb_object::dbSize()
{
wb_cdef c = wb_cdef( *m_orep);
wb_bdef b = c.bdef( cdh_eBix_dev);
wb_bdef b = c.bdef( pwr_eBix_dev);
if ( !b)
return 0;
......@@ -337,6 +337,22 @@ size_t wb_object::dbSize()
}
wb_bdef wb_object::bdef(const char* bname)
{
check();
wb_cdef cdef(*m_orep);
return cdef.bdef(bname);
}
wb_bdef wb_object::bdef(pwr_eBix bix)
{
check();
wb_cdef cdef(*m_orep);
return cdef.bdef(bix);
}
/* Object SigChanCon $ObjXRef 2
Body SysBody
......
......@@ -9,6 +9,7 @@
#include "wb_location.h"
#include "wb_attribute.h"
class wb_bdef;
class wb_orep;
class wb_location;
class wb_attribute;
......@@ -70,6 +71,9 @@ public:
size_t rbSize(); //< size of run time body
size_t dbSize(); //< size of development body
wb_bdef bdef(const char* bname);
wb_bdef bdef(pwr_eBix bix);
wb_attribute attribute();
wb_attribute attribute(const char *aname);
wb_attribute attribute(const char *bname, const char *aname);
......
......@@ -86,7 +86,7 @@ void wb_tdrep::init()
{
pwr_sTypeDef body;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &body);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &body);
if ( EVEN(sts)) throw wb_error(sts);
m_size = body.Size;
......@@ -99,7 +99,7 @@ void wb_tdrep::init()
{
pwr_sTypeDef body;
m_orep->m_vrep->readBody( &sts, m_orep, cdh_eBix_sys, (void *) &body);
m_orep->m_vrep->readBody( &sts, m_orep, pwr_eBix_sys, (void *) &body);
if ( EVEN(sts)) throw wb_error(sts);
m_size = body.Size;
......
......@@ -149,18 +149,6 @@ wb_adef wb_volume::adef( pwr_tCid cid, const char *bname, const char *aname)
return bdef.adef( aname);
}
wb_bdef wb_volume::bdef(wb_cdef cdef, const char *bname)
{
return cdef.bdef( bname);
}
wb_bdef wb_volume::bdef(wb_object o, const char *bname)
{
wb_orep *orep = o;
wb_cdef cdef = wb_cdef(*orep);
return cdef.bdef( bname);
}
wb_cdef wb_volume::cdef(wb_object o)
{
......
......@@ -61,9 +61,6 @@ public:
wb_adef adef(pwr_sAttrRef *arp) { wb_adef a; return a;}; // Fix
wb_adef adef(pwr_tCid cid, const char *bname, const char *aname);
wb_bdef bdef(wb_cdef cdef, const char *bname);
wb_bdef bdef(wb_object o, const char *bname);
wb_cdef cdef(wb_object o);
wb_cdef cdef(pwr_tCid cid);
......
......@@ -55,13 +55,13 @@ public:
virtual bool commit(pwr_tStatus *sts) = 0;
virtual bool abort(pwr_tStatus *sts) = 0;
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) = 0;
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) = 0;
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) = 0;
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) = 0;
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) = 0;
......
......@@ -40,7 +40,7 @@ typedef struct {
typedef struct {
struct {
pwr_tOix oix;
pwr_tBix bix;
pwr_eBix bix;
} key;
void *data;
} ldh_sDbBody;
......@@ -105,7 +105,7 @@ wb_vrepdb::oh_d::oh_d(wb_orepdb *o)
wb_vrepdb::ob_k::ob_k()
{
m_data.oix = 0;
m_data.bix = 0;
m_data.bix = pwr_eBix__;
set_data(&m_data);
set_size(sizeof(m_data));
......@@ -114,7 +114,7 @@ wb_vrepdb::ob_k::ob_k()
wb_vrepdb::ob_k::ob_k(pwr_tOix oix)
{
m_data.oix = oix;
m_data.bix = 0;
m_data.bix = pwr_eBix__;
set_data(&m_data);
set_size(sizeof(m_data));
......@@ -123,13 +123,13 @@ wb_vrepdb::ob_k::ob_k(pwr_tOix oix)
wb_vrepdb::ob_k::ob_k(wb_orepdb *o)
{
m_data.oix = o->oix();
m_data.bix = 0;
m_data.bix = pwr_eBix__;
set_data(&m_data);
set_size(sizeof(m_data));
}
wb_vrepdb::ob_k::ob_k(wb_orepdb *o, pwr_tOix bix)
wb_vrepdb::ob_k::ob_k(wb_orepdb *o, pwr_eBix bix)
{
m_data.oix = o->oix();
m_data.bix = bix;
......@@ -803,7 +803,7 @@ bool wb_vrepdb::renameObject(pwr_tStatus *sts, wb_orep *o, wb_name name)
return true;
}
bool wb_vrepdb::writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p)
bool wb_vrepdb::writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p)
{
//body.oix = ?;
//body.bix = ?;
......@@ -820,7 +820,7 @@ bool wb_vrepdb::writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsig
}
void *
wb_vrepdb::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p)
wb_vrepdb::readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p)
{
ob_k obk(o->oix(), bix);
//ob_d obd;
......@@ -857,13 +857,13 @@ wb_vrepdb::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned in
}
void *
wb_vrepdb::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
wb_vrepdb::readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
{
return 0;
}
bool
wb_vrepdb::writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
wb_vrepdb::writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
{
return true;
}
......
......@@ -54,15 +54,15 @@ protected:
struct {
pwr_tOix oix;
pwr_tOix bix;
pwr_eBix bix;
} m_data;
ob_k();
ob_k(wb_orepdb *o);
ob_k(wb_orepdb *o, pwr_tOix bix);
ob_k(wb_orepdb *o, pwr_eBix bix);
ob_k(pwr_tOix oix);
ob_k(pwr_tOix oix, pwr_tOix bix);
ob_k(pwr_tOix oix, pwr_eBix bix);
};
......@@ -149,13 +149,13 @@ public:
virtual bool commit(pwr_tStatus *sts);
virtual bool abort(pwr_tStatus *sts);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) const;
......
......@@ -182,7 +182,7 @@ wb_vrepdbs::abort(pwr_tStatus *sts)
bool
wb_vrepdbs::writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p)
wb_vrepdbs::writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p)
{
*sts = LDH__NYI;
return false;
......@@ -190,7 +190,7 @@ wb_vrepdbs::writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned
void *
wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p)
wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p)
{
*sts = LDH__SUCCESS;
......@@ -204,10 +204,10 @@ wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned i
if (p) {
switch (bix) {
case cdh_eBix_rt:
case pwr_eBix_rt:
memcpy(p, (char *)bp + offset, MIN(op->rbody.size - offset, size));
break;
case cdh_eBix_dev:
case pwr_eBix_dev:
memcpy(p, (char *)bp + offset, MIN(op->dbody.size - offset, size));
break;
default:
......@@ -222,7 +222,7 @@ wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned i
void *
wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
{
*sts = LDH__SUCCESS;
......@@ -236,10 +236,10 @@ wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
if (p) {
switch (bix) {
case cdh_eBix_rt:
case pwr_eBix_rt:
memcpy(p, bp, op->rbody.size);
break;
case cdh_eBix_dev:
case pwr_eBix_dev:
memcpy(p, bp, op->dbody.size);
break;
default:
......@@ -254,7 +254,7 @@ wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
bool
wb_vrepdbs::writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
wb_vrepdbs::writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
{
*sts = LDH__NYI;
return false;
......
......@@ -57,13 +57,13 @@ public:
virtual bool commit(pwr_tStatus *sts);
virtual bool abort(pwr_tStatus *sts);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o);
......
......@@ -500,9 +500,9 @@ int wb_vrepwbl::getClassInfo( pwr_tCid cid, int *rsize, int *dsize)
wb_wblnode *n_body = n->o_fch;
while( n_body) {
if ( n_body->isObjBodyDef() &&
(n_body->b_bix == wbl_eBix_SysBody || n_body->b_bix == wbl_eBix_RtBody))
(n_body->b_bix == pwr_eBix_sys || n_body->b_bix == pwr_eBix_rt))
*rsize = n_body->b_size;
else if ( n_body->isObjBodyDef() && n_body->b_bix == wbl_eBix_DevBody)
else if ( n_body->isObjBodyDef() && n_body->b_bix == pwr_eBix_dev)
*dsize = n_body->b_size;
n_body = n_body->o_fws;
}
......@@ -515,7 +515,7 @@ int wb_vrepwbl::getClassInfo( pwr_tCid cid, int *rsize, int *dsize)
wb_cdrep *cdrep = m_merep->cdrep( &sts, cid);
if ( EVEN(sts)) return 0;
wb_bdrep *bdrep = cdrep->bdrep( &sts, cdh_eBix_rt);
wb_bdrep *bdrep = cdrep->bdrep( &sts, pwr_eBix_rt);
if ( ODD(sts)) {
*rsize = bdrep->size();
delete bdrep;
......@@ -523,7 +523,7 @@ int wb_vrepwbl::getClassInfo( pwr_tCid cid, int *rsize, int *dsize)
else
*rsize = 0;
bdrep = cdrep->bdrep( &sts, cdh_eBix_dev);
bdrep = cdrep->bdrep( &sts, pwr_eBix_dev);
if ( ODD(sts)) {
*dsize = bdrep->size();
delete bdrep;
......@@ -546,7 +546,7 @@ int wb_vrepwbl::getClassInfo( pwr_tCid cid, int *rsize, int *dsize)
*elements = elem; }
int wb_vrepwbl::getAttrInfo( const char *attr, cdh_eBix bix, pwr_tCid cid, int *size,
int wb_vrepwbl::getAttrInfo( const char *attr, pwr_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements, pwr_eType *type)
{
int a_size;
......@@ -571,19 +571,19 @@ int wb_vrepwbl::getAttrInfo( const char *attr, cdh_eBix bix, pwr_tCid cid, int *
return 0;
}
int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, int *size,
int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, pwr_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements, pwr_eType *type,
int level)
{
if ( level > 0)
bix = cdh_eBix_rt;
bix = pwr_eBix_rt;
switch( cid) {
case pwr_eClass_Type:
{
pwr_sType o;
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
if ( attr->attributeIsEqual("Type", level)) {
*size = sizeof( o.Type);
......@@ -603,7 +603,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, i
{
pwr_sTypeDef o;
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
IF_ATTR( Type, pwr_eType_UInt32, 1, level)
else IF_ATTR( Size, pwr_eType_Int32, 1, level)
......@@ -615,7 +615,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, i
{
pwr_sClassDef o;
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
IF_ATTR( Editor, pwr_eType_UInt32, 1, level)
else IF_ATTR( Method, pwr_eType_UInt32, 1, level)
......@@ -628,7 +628,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, i
{
pwr_sClassVolume o;
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
IF_ATTR( Description, pwr_eType_String, 1, level)
else IF_ATTR( NextOix, pwr_eType_ObjectIx, 1, level)
......@@ -647,7 +647,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, i
{
pwr_sObjBodyDef o;
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
IF_ATTR( StructName, pwr_eType_String, 1, level)
else IF_ATTR( NumOfParams, pwr_eType_UInt32, 1, level)
......@@ -660,7 +660,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, i
{
pwr_sParam o;
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
if ( attr->attributeIsEqual( "PgmName", level)) {
*size = sizeof( o.Info.PgmName);
......@@ -812,7 +812,7 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
pwr_tTid a_tid;
int a_elements;
pwr_eType a_type;
cdh_eBix bix;
pwr_eBix bix;
pwr_tCid cid;
if ( strncmp( name, "_A", 2) == 0) {
......@@ -853,7 +853,7 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
wb_cdrep *cdrep = m_merep->cdrep( &sts, cid);
if ( EVEN(sts)) return sts;
wb_bdrep *bdrep = cdrep->bdrep( &sts, cdh_eBix_rt);
wb_bdrep *bdrep = cdrep->bdrep( &sts, pwr_eBix_rt);
if ( EVEN(sts)) return sts;
attrref->Objid = oid;
......@@ -869,13 +869,13 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
if ( an.evenSts()) return an.sts();
// Try rtbody
bix = cdh_eBix_rt;
bix = pwr_eBix_rt;
sts = getAttrInfo( an.name(), bix, cid, &a_size,
&a_offset, &a_tid, &a_elements, &a_type);
if ( EVEN(sts)) {
// Try devbody
bix = cdh_eBix_dev;
sts = getAttrInfo( an.name(), cdh_eBix_dev, cid, &a_size,
bix = pwr_eBix_dev;
sts = getAttrInfo( an.name(), pwr_eBix_dev, cid, &a_size,
&a_offset, &a_tid, &a_elements, &a_type);
if ( EVEN(sts)) return sts;
}
......@@ -887,53 +887,53 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
return LDH__SUCCESS;
}
int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body)
int wb_vrepwbl::getTemplateBody( pwr_tCid cid, pwr_eBix bix, int *size, void **body)
{
switch ( cid) {
case pwr_eClass_Type:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = sizeof( pwr_sType);
*body = calloc( 1, *size);
return 1;
case pwr_eClass_TypeDef:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = sizeof( pwr_sTypeDef);
*body = calloc( 1, *size);
return 1;
case pwr_eClass_ClassDef:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = sizeof( pwr_sClassDef);
*body = calloc( 1, *size);
return 1;
case pwr_eClass_ClassVolume:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = sizeof( pwr_sClassVolume);
*body = calloc( 1, *size);
return 1;
case pwr_eClass_ClassHier:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = 0;
*body = 0;
return 1;
case pwr_eClass_TypeHier:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = 0;
*body = 0;
return 1;
case pwr_eClass_ObjBodyDef:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = sizeof( pwr_sObjBodyDef);
*body = calloc( 1, *size);
return 1;
case pwr_eClass_Param:
if ( bix != cdh_eBix_sys)
if ( bix != pwr_eBix_sys)
return 0;
*size = sizeof( pwr_sParam);
*body = calloc( 1, *size);
......@@ -949,14 +949,14 @@ int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body)
if ( !n->c_template)
return 0;
if ( bix == cdh_eBix_sys || bix == cdh_eBix_rt) {
if ( bix == pwr_eBix_sys || bix == pwr_eBix_rt) {
*size = n->c_template->rbody_size;
if ( *size) {
*body = calloc( 1, *size);
memcpy( *body, n->c_template->rbody, *size);
}
}
else if ( bix == cdh_eBix_dev) {
else if ( bix == pwr_eBix_dev) {
*size = n->c_template->dbody_size;
if ( *size) {
*body = calloc( 1, *size);
......@@ -980,7 +980,7 @@ int wb_vrepwbl::getTemplateBody( pwr_tCid cid, int bix, int *size, void **body)
if ( *size) {
*body = calloc( 1, *size);
cdrep->templateBody( &sts, (cdh_eBix) bix, *body);
cdrep->templateBody( &sts, (pwr_eBix) bix, *body);
if ( EVEN(sts)) {
free( body);
delete cdrep;
......@@ -1261,7 +1261,7 @@ void wb_vrepwbl::objectName(wb_orep *o, char *str)
free( vect);
}
void *wb_vrepwbl::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix,
void *wb_vrepwbl::readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix,
unsigned int offset, unsigned int size, void *p)
{
*sts = LDH__SUCCESS;
......@@ -1269,7 +1269,7 @@ void *wb_vrepwbl::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix,
wb_wblnode *n = ((wb_orepwbl *) o)->wblNode();
switch ( bix) {
case cdh_eBix_rt:
case pwr_eBix_rt:
if ( n->rbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
......@@ -1279,7 +1279,7 @@ void *wb_vrepwbl::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix,
return p;
}
return (void *)((char *)n->rbody + offset);
case cdh_eBix_dev:
case pwr_eBix_dev:
if ( n->dbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
......@@ -1295,14 +1295,14 @@ void *wb_vrepwbl::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix,
}
}
void *wb_vrepwbl::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
void *wb_vrepwbl::readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
{
*sts = LDH__SUCCESS;
wb_wblnode *n = ((wb_orepwbl *) o)->wblNode();
switch ( bix) {
case cdh_eBix_rt:
case pwr_eBix_rt:
if ( n->rbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
......@@ -1312,7 +1312,7 @@ void *wb_vrepwbl::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
return p;
}
return n->rbody;
case cdh_eBix_dev:
case pwr_eBix_dev:
if ( n->dbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
......
......@@ -14,9 +14,6 @@
#include "wb_attrname.h"
#define WBL_FILEMAX 500
#define wbl_eBix_SysBody 1
#define wbl_eBix_RtBody 1
#define wbl_eBix_DevBody 2
class wb_orepwbl;
......@@ -65,11 +62,11 @@ public:
virtual void iterDbody(wb_dbs *);
#if 0
void iterObject( void *udata,
pwr_tStatus (*bc)(void *,pwr_tOid, pwr_tCid, pwr_tOid, pwr_tOid,
pwr_tOid, pwr_tOid, pwr_tOid, const char *,
pwr_tTime, int, int));
pwr_tStatus (*bc)(void *,pwr_tOid, pwr_tCid, pwr_tOid, pwr_tOid,
pwr_tOid, pwr_tOid, pwr_tOid, const char *,
pwr_tTime, int, int));
void iterBody( void *udata,
pwr_tStatus (*bc)(void *,pwr_tOid, void *, void *));
pwr_tStatus (*bc)(void *,pwr_tOid, void *, void *));
#endif
int load( const char *fname);
int load_files( const char *file_spec);
......@@ -86,17 +83,17 @@ public:
bool registerObject( pwr_tOix oix, ref_wblnode node);
int nextOix() { return ++next_oix; }
int classNameToCid( const char *name, pwr_tCid *cid);
int getTemplateBody( pwr_tCid cid, int bix, int *size, void **body);
int getTemplateBody( pwr_tCid cid, pwr_eBix bix, int *size, void **body);
int getTypeInfo( pwr_tTid tid, pwr_eType *type, int *size,
int *elements);
int *elements);
int getTypeInfo( const char *type, pwr_tTid *tid, pwr_eType *type, int *size,
int *elements);
int *elements);
int getClassInfo( pwr_tCid cid, int *rsize, int *dsize);
int getAttrInfo( const char *attr, cdh_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements, pwr_eType *type);
int getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements,
pwr_eType *type, int level);
int getAttrInfo( const char *attr, pwr_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements, pwr_eType *type);
int getAttrInfoRec( wb_attrname *attr, pwr_eBix bix, pwr_tCid cid, int *size,
int *offset, pwr_tTid *tid, int *elements,
pwr_eType *type, int level);
ref_wblnode findObject( pwr_tOix oix);
ref_wblnode findClass( const char *name);
ref_wblnode findType( const char *name);
......@@ -145,13 +142,13 @@ public:
bool commit(pwr_tStatus *sts) {return false;};
bool abort(pwr_tStatus *sts) {return false;};
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p) {return false;};
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) {return false;};
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) {return false;};
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) {return false;};
wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o);
......
......@@ -384,10 +384,10 @@ void wb_wblnode::build( bool recursive)
m_oid.vid = m_vrep->vid();
if ( isClassDef()) {
m_vrep->getTemplateBody( m_cid, cdh_eBix_sys, &rbody_size, &rbody);
m_vrep->getTemplateBody( m_cid, pwr_eBix_sys, &rbody_size, &rbody);
}
else if ( isType() || isTypeDef()) {
m_vrep->getTemplateBody( m_cid, cdh_eBix_sys, &rbody_size, &rbody);
m_vrep->getTemplateBody( m_cid, pwr_eBix_sys, &rbody_size, &rbody);
}
else if ( isTemplate()) {
// Build later by classdef
......@@ -400,8 +400,8 @@ void wb_wblnode::build( bool recursive)
tot_size += rbody_size + dbody_size;
// cout << name() << ": " << tot_size << " " << rbody_size << " " << dbody_size << endl;
m_vrep->getTemplateBody( m_cid, cdh_eBix_rt, &rbody_size, &rbody);
m_vrep->getTemplateBody( m_cid, cdh_eBix_dev, &dbody_size, &dbody);
m_vrep->getTemplateBody( m_cid, pwr_eBix_rt, &rbody_size, &rbody);
m_vrep->getTemplateBody( m_cid, pwr_eBix_dev, &dbody_size, &dbody);
}
ref_wblnode first_child;
......@@ -434,7 +434,7 @@ void wb_wblnode::build( bool recursive)
child->buildObjBodyDef( this);
((pwr_sClassDef *)rbody)->NumOfObjBodies++;
if ( cdh_oixToBix( child->m_oid.oix) == cdh_eBix_rt)
if ( cdh_oixToBix( child->m_oid.oix) == pwr_eBix_rt)
((pwr_sClassDef *)rbody)->Flags.b.RtBody = 1;
wb_wblnode *attr = child->o_fch;
......@@ -633,20 +633,20 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef,
void wb_wblnode::buildTemplate( ref_wblnode classdef)
{
wb_wblnode *objbodydef = classdef->o_fch;
m_oid.oix = cdh_cixToOix( classdef->c_cix, cdh_eBix_template, 0);
m_oid.oix = cdh_cixToOix( classdef->c_cix, pwr_eBix_template, 0);
if ( !m_vrep->registerObject( m_oid.oix, this))
m_vrep->error( "Duplicate template oix", getFileName(), line_number);
while ( objbodydef) {
if ( objbodydef->isObjBodyDef()) {
if ( objbodydef->b_bix == cdh_eBix_sys ||
objbodydef->b_bix == cdh_eBix_rt) {
if ( objbodydef->b_bix == pwr_eBix_sys ||
objbodydef->b_bix == pwr_eBix_rt) {
rbody_size = objbodydef->b_size;
if ( rbody_size) {
rbody = calloc( 1, rbody_size);
}
}
if ( objbodydef->b_bix == cdh_eBix_dev) {
if ( objbodydef->b_bix == pwr_eBix_dev) {
dbody_size = objbodydef->b_size;
if ( dbody_size)
dbody = calloc( 1, dbody_size);
......@@ -669,11 +669,11 @@ void wb_wblnode::buildBody( ref_wblnode object)
switch ( getType()) {
case tokens.BODY:
if ( cdh_NoCaseStrcmp( name(), "SysBody") == 0)
bix = cdh_eBix_sys;
bix = pwr_eBix_sys;
else if ( cdh_NoCaseStrcmp( name(), "RtBody") == 0)
bix = cdh_eBix_rt;
bix = pwr_eBix_rt;
else if ( cdh_NoCaseStrcmp( name(), "DevBody") == 0)
bix = cdh_eBix_dev;
bix = pwr_eBix_dev;
else {
// Body exception
m_vrep->error( "Bad body name", getFileName(), line_number);
......@@ -729,12 +729,12 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
}
if ( !m_vrep->getAttrInfo( name(), (cdh_eBix) bix, object->m_cid, &size, &offset,
if ( !m_vrep->getAttrInfo( name(), (pwr_eBix) bix, object->m_cid, &size, &offset,
&tid, &elements, &type)) {
// This might be string special syntax
wb_attrname n = wb_attrname( name());
if ( n.hasAttrIndex() &&
m_vrep->getAttrInfo( n.attribute(), (cdh_eBix) bix, object->m_cid, &size,
m_vrep->getAttrInfo( n.attribute(), (pwr_eBix) bix, object->m_cid, &size,
&offset, &tid, &elements, &type) &&
elements == 1 &&
(type == pwr_eType_String || type == pwr_eType_Text)) {
......@@ -761,16 +761,16 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
goto error_continue;
}
if ( ((bix == cdh_eBix_rt || bix == cdh_eBix_sys) &&
if ( ((bix == pwr_eBix_rt || bix == pwr_eBix_sys) &&
object->rbody_size == 0) ||
(bix == cdh_eBix_dev && object->dbody_size == 0)) {
(bix == pwr_eBix_dev && object->dbody_size == 0)) {
m_vrep->error( "Attribute body", getFileName(), line_number);
return;
}
if ( ((bix == cdh_eBix_rt || bix == cdh_eBix_sys) &&
if ( ((bix == pwr_eBix_rt || bix == pwr_eBix_sys) &&
offset + size > object->rbody_size) ||
( bix == cdh_eBix_rt &&
( bix == pwr_eBix_rt &&
offset + size > object->rbody_size)) {
m_vrep->error( "Mismatch in attribute offset", getFileName(), line_number);
return;
......@@ -786,21 +786,21 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
// printf( "Attr %s %s %d %d %s\n", object->name, name, size, offset, value);
if ( size == sizeof(int_val) && convconst( &int_val, value)) {
if ( oper == tokens.EQ) {
if ( bix == cdh_eBix_rt || bix == cdh_eBix_sys)
if ( bix == pwr_eBix_rt || bix == pwr_eBix_sys)
memcpy( (char *)((unsigned int) object->rbody + offset),
&int_val, size);
else if ( bix == cdh_eBix_dev)
else if ( bix == pwr_eBix_dev)
memcpy( (char *)((unsigned int) object->dbody + offset),
&int_val, size);
}
else if ( oper == tokens.OREQ) {
if ( bix == cdh_eBix_rt || bix == cdh_eBix_sys) {
if ( bix == pwr_eBix_rt || bix == pwr_eBix_sys) {
current_int_val = *(int *) ((unsigned int) object->rbody + offset);
int_val |= current_int_val;
memcpy( (char *)((unsigned int) object->rbody + offset),
&int_val, size);
}
else if ( bix == cdh_eBix_dev) {
else if ( bix == pwr_eBix_dev) {
current_int_val = *(int *) ((unsigned int) object->dbody + offset);
int_val |= current_int_val;
memcpy( (char *)((unsigned int) object->dbody + offset),
......@@ -809,10 +809,10 @@ void wb_wblnode::buildAttr( ref_wblnode object, int bix)
}
}
else if ( attrStringToValue( type, value, buf, sizeof( buf), size)) {
if ( bix == cdh_eBix_rt || bix == cdh_eBix_sys)
if ( bix == pwr_eBix_rt || bix == pwr_eBix_sys)
memcpy( (char *)((unsigned int) object->rbody + offset),
buf, size);
else if ( bix == cdh_eBix_dev)
else if ( bix == pwr_eBix_dev)
memcpy( (char *)((unsigned int) object->dbody + offset),
buf, size);
}
......@@ -981,16 +981,16 @@ void wb_wblnode::buildBuffAttr( ref_wblnode object, int bix, pwr_tCid buffer_cid
goto error_continue;
}
if ( ((bix == cdh_eBix_rt || bix == cdh_eBix_sys) &&
if ( ((bix == pwr_eBix_rt || bix == pwr_eBix_sys) &&
object->rbody_size == 0) ||
(bix == cdh_eBix_dev && object->dbody_size == 0)) {
(bix == pwr_eBix_dev && object->dbody_size == 0)) {
m_vrep->error( "Attribute body", getFileName(), line_number);
return;
}
if ( ((bix == cdh_eBix_rt || bix == cdh_eBix_sys) &&
if ( ((bix == pwr_eBix_rt || bix == pwr_eBix_sys) &&
offset + size/elements > object->rbody_size) ||
( bix == cdh_eBix_rt &&
( bix == pwr_eBix_rt &&
offset + size/elements > object->rbody_size)) {
m_vrep->error( "Mismatch in attribute offset", getFileName(), line_number);
return;
......@@ -1001,21 +1001,21 @@ void wb_wblnode::buildBuffAttr( ref_wblnode object, int bix, pwr_tCid buffer_cid
// 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 ( oper == tokens.EQ) {
if ( bix == cdh_eBix_rt || bix == cdh_eBix_sys)
if ( bix == pwr_eBix_rt || bix == pwr_eBix_sys)
memcpy( (char *)((unsigned int) object->rbody + offset),
&int_val, size/elements);
else if ( bix == cdh_eBix_dev)
else if ( bix == pwr_eBix_dev)
memcpy( (char *)((unsigned int) object->dbody + offset),
&int_val, size/elements);
}
else if ( oper == tokens.OREQ) {
if ( bix == cdh_eBix_rt || bix == cdh_eBix_sys) {
if ( bix == pwr_eBix_rt || bix == pwr_eBix_sys) {
current_int_val = *(int *) ((unsigned int) object->rbody + offset);
int_val |= current_int_val;
memcpy( (char *)((unsigned int) object->rbody + offset),
&int_val, size/elements);
}
else if ( bix == cdh_eBix_dev) {
else if ( bix == pwr_eBix_dev) {
current_int_val = *(int *) ((unsigned int) object->dbody + offset);
int_val |= current_int_val;
memcpy( (char *)((unsigned int) object->dbody + offset),
......@@ -1024,10 +1024,10 @@ void wb_wblnode::buildBuffAttr( ref_wblnode object, int bix, pwr_tCid buffer_cid
}
}
else if ( attrStringToValue( type, value, buf, sizeof( buf), size)) {
if ( bix == cdh_eBix_rt || bix == cdh_eBix_sys)
if ( bix == pwr_eBix_rt || bix == pwr_eBix_sys)
memcpy( (char *)((unsigned int) object->rbody + offset),
buf, size/elements);
else if ( bix == cdh_eBix_dev)
else if ( bix == pwr_eBix_dev)
memcpy( (char *)((unsigned int) object->dbody + offset),
buf, size/elements);
}
......@@ -1262,7 +1262,7 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
}
else if ( isObjBodyDef()) {
b_bix = m_oid.oix;
if ( !(b_bix == cdh_eBix_rt || b_bix == cdh_eBix_sys || b_bix == cdh_eBix_dev))
if ( !(b_bix == pwr_eBix_rt || b_bix == pwr_eBix_sys || b_bix == pwr_eBix_dev))
m_vrep->error( "Bad body index", getFileName(), line_number);
}
break;
......
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