Commit 404cf92a authored by claes's avatar claes

*** empty log message ***

parent 473cd6e1
...@@ -94,7 +94,7 @@ nobase <no base system> /error ...@@ -94,7 +94,7 @@ nobase <no base system> /error
projconfig <project is not configured> /info projconfig <project is not configured> /info
wblparse <error when parsing wb_load file> /error wblparse <error when parsing wb_load file> /error
nomethod <no such method> /error nomethod <no such method> /error
volvolatilemax <max number of volatile volumes exceeded> /error
......
...@@ -82,12 +82,6 @@ void wb_cdef::check() const ...@@ -82,12 +82,6 @@ void wb_cdef::check() const
throw wb_error(m_sts); throw wb_error(m_sts);
} }
size_t wb_cdef::size()
{
check();
return m_cdrep->size();
}
pwr_tCid wb_cdef::cid() pwr_tCid wb_cdef::cid()
{ {
check(); check();
...@@ -142,7 +136,17 @@ wb_object wb_cdef::classBody( const char *bname) ...@@ -142,7 +136,17 @@ wb_object wb_cdef::classBody( const char *bname)
return wb_object(); return wb_object();
} }
void wb_cdef::templateBody( pwr_tStatus *sts, pwr_eBix bix, void *p)
{
check();
m_cdrep->templateBody( sts, bix, p);
}
size_t wb_cdef::size( pwr_eBix bix)
{
check();
return m_cdrep->size( bix);
}
......
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
bool operator==(wb_cdef&); bool operator==(wb_cdef&);
size_t size(); // get objects runtime body size size_t size( pwr_eBix bix);
pwr_tCid cid(); pwr_tCid cid();
pwr_tOid oid() { pwr_tOid oid = pwr_cNOid; return oid;} // Fix pwr_tOid oid() { pwr_tOid oid = pwr_cNOid; return oid;} // Fix
...@@ -44,6 +44,7 @@ public: ...@@ -44,6 +44,7 @@ public:
wb_bdef bdef(const char *bname); wb_bdef bdef(const char *bname);
wb_bdef bdef(wb_name bname); wb_bdef bdef(wb_name bname);
void templateBody( pwr_tStatus *sts, pwr_eBix bix, void *p);
wb_object classBody( const char *bname); wb_object classBody( const char *bname);
private: private:
......
...@@ -44,6 +44,12 @@ wb_cdrep::wb_cdrep() : m_nRef(0), m_orep(0), m_sts(LDH__NOCLASS) ...@@ -44,6 +44,12 @@ wb_cdrep::wb_cdrep() : m_nRef(0), m_orep(0), m_sts(LDH__NOCLASS)
{ {
} }
wb_cdrep::~wb_cdrep()
{
if ( m_orep)
m_orep->unref();
}
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, pwr_tCid cid) : m_nRef(0) wb_cdrep::wb_cdrep( wb_mvrep *mvrep, pwr_tCid cid) : m_nRef(0)
{ {
pwr_tOid oid = cdh_ClassIdToObjid( cid); pwr_tOid oid = cdh_ClassIdToObjid( cid);
...@@ -223,6 +229,19 @@ pwr_mClassDef wb_cdrep::flags() ...@@ -223,6 +229,19 @@ pwr_mClassDef wb_cdrep::flags()
return classdef->Flags; return classdef->Flags;
} }
size_t wb_cdrep::size( pwr_eBix bix)
{
size_t size;
pwr_tStatus sts;
wb_bdrep *bd = bdrep( &sts, bix);
if ( EVEN(sts)) return 0;
size = bd->size();
delete bd;
return size;
}
const char *wb_cdrep::name() const const char *wb_cdrep::name() const
{ {
return m_orep->name(); return m_orep->name();
......
...@@ -26,13 +26,14 @@ public: ...@@ -26,13 +26,14 @@ public:
wb_cdrep(wb_mvrep *, const wb_orep&); wb_cdrep(wb_mvrep *, const wb_orep&);
wb_cdrep(wb_mvrep *, pwr_tCid); wb_cdrep(wb_mvrep *, pwr_tCid);
wb_cdrep(wb_mvrep *, wb_name); wb_cdrep(wb_mvrep *, wb_name);
~wb_cdrep();
void unref(); void unref();
wb_cdrep *ref(); wb_cdrep *ref();
//wb_object& operator=(const wb_orep&); //wb_object& operator=(const wb_orep&);
size_t size() { return 0;} // Fix get objects runtime body size size_t size( pwr_eBix bix);
pwr_mClassDef flags(); pwr_mClassDef flags();
pwr_tCid cid(); pwr_tCid cid();
......
...@@ -24,7 +24,7 @@ extern "C" { ...@@ -24,7 +24,7 @@ extern "C" {
pwr_dImport pwr_BindClasses(System); pwr_dImport pwr_BindClasses(System);
pwr_dImport pwr_BindClasses(Base); pwr_dImport pwr_BindClasses(Base);
wb_erep::wb_erep() : m_dir_cnt(0) wb_erep::wb_erep() : m_dir_cnt(0), m_volatile_idx(0)
{ {
m_merep = new wb_merep(0); m_merep = new wb_merep(0);
} }
...@@ -79,7 +79,7 @@ wb_vrep *wb_erep::volume(pwr_tStatus *sts, pwr_tVid vid) ...@@ -79,7 +79,7 @@ wb_vrep *wb_erep::volume(pwr_tStatus *sts, pwr_tVid vid)
return it->second; return it->second;
} }
wb_vrep *wb_erep::volume(pwr_tStatus *sts, const char *name) // Fix wb_vrep *wb_erep::volume(pwr_tStatus *sts, const char *name)
{ {
vrep_iterator it; vrep_iterator it;
for ( it = m_vrepdb.begin(); it != m_vrepdb.end(); it++) { for ( it = m_vrepdb.begin(); it != m_vrepdb.end(); it++) {
...@@ -582,6 +582,15 @@ void wb_erep::bindMethods() ...@@ -582,6 +582,15 @@ void wb_erep::bindMethods()
#endif #endif
} }
int wb_erep::nextVolatileVid( pwr_tStatus *sts)
{
pwr_tVid vid = ldh_cVolatileVolMin + m_volatile_idx++;
if ( vid > ldh_cVolatileVolMax) {
*sts = LDH__VOLVOLATILEMAX;
return 0;
}
return vid;
}
......
...@@ -29,6 +29,7 @@ class wb_erep ...@@ -29,6 +29,7 @@ class wb_erep
char m_dir_list[10][200]; char m_dir_list[10][200];
int m_dir_cnt; int m_dir_cnt;
int m_volatile_idx;
public: public:
wb_erep(); wb_erep();
...@@ -58,6 +59,7 @@ public: ...@@ -58,6 +59,7 @@ public:
wb_cdrep *cdrep( pwr_tStatus *sts, const wb_orep& o); wb_cdrep *cdrep( pwr_tStatus *sts, const wb_orep& o);
wb_tdrep *tdrep( pwr_tStatus *sts, const wb_adrep& a); wb_tdrep *tdrep( pwr_tStatus *sts, const wb_adrep& a);
void method( pwr_tStatus *sts, char *methodName, wb_tMethod *method); void method( pwr_tStatus *sts, char *methodName, wb_tMethod *method);
int nextVolatileVid( pwr_tStatus *sts);
private: private:
void loadDirList( pwr_tStatus *status); void loadDirList( pwr_tStatus *status);
...@@ -74,3 +76,4 @@ private: ...@@ -74,3 +76,4 @@ private:
...@@ -339,13 +339,24 @@ ldh_CreateObject(ldh_tSession session, pwr_tOid *oid, char *name, pwr_tCid cid, ...@@ -339,13 +339,24 @@ ldh_CreateObject(ldh_tSession session, pwr_tOid *oid, char *name, pwr_tCid cid,
wb_cdef cdef = sp->cdef(cid); wb_cdef cdef = sp->cdef(cid);
wb_object d_o = sp->object(doid); if ( cdh_ObjidIsNull(doid)) {
wb_destination d = d_o.destination(dest); wb_object d_o = wb_object();
wb_object o = sp->createObject(cdef, d, n); wb_destination d = wb_destination( doid, dest);
if (!o) return o.sts(); wb_object o = sp->createObject(cdef, d, n);
if (!o) return o.sts();
*oid = o.oid();
return o.sts(); *oid = o.oid();
return o.sts();
}
else {
wb_object d_o = sp->object(doid);
wb_destination d = d_o.destination(dest);
wb_object o = sp->createObject(cdef, d, n);
if (!o) return o.sts();
*oid = o.oid();
return o.sts();
}
} }
catch (wb_error& e) { catch (wb_error& e) {
return e.sts(); return e.sts();
...@@ -1002,7 +1013,8 @@ ldh_ClassIdToName(ldh_tSession session, pwr_tCid cid, char *buff, int maxsize, i ...@@ -1002,7 +1013,8 @@ ldh_ClassIdToName(ldh_tSession session, pwr_tCid cid, char *buff, int maxsize, i
wb_cdef c = sp->cdef(cid); wb_cdef c = sp->cdef(cid);
if (!c) return c.sts(); if (!c) return c.sts();
//buff = c.name(); strncpy( buff, c.name(), maxsize);
*size = strlen( buff);
return c.sts(); return c.sts();
} }
......
...@@ -25,6 +25,8 @@ extern "C" { ...@@ -25,6 +25,8 @@ extern "C" {
#define ldh_cWBVol (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 254) #define ldh_cWBVol (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 254)
#define ldh_cWBVolLocal (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 252) #define ldh_cWBVolLocal (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 252)
#define ldh_cProjectVolume (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 253) #define ldh_cProjectVolume (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 253)
#define ldh_cVolatileVolMin (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 0)
#define ldh_cVolatileVolMax (0 + ((pwr_tVolumeId)254 << 24) + (254 << 16) + (254 << 8) + 100)
#if 0 #if 0
#ifndef 0 #ifndef 0
......
...@@ -32,6 +32,19 @@ wb_mvrep *wb_merep::volume(pwr_tStatus *sts, pwr_tVid vid) ...@@ -32,6 +32,19 @@ wb_mvrep *wb_merep::volume(pwr_tStatus *sts, pwr_tVid vid)
return it->second; return it->second;
} }
wb_mvrep *wb_merep::volume(pwr_tStatus *sts, const char *name)
{
mvrep_iterator it;
for ( it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
if ( cdh_NoCaseStrcmp( it->second->name(), name) == 0) {
*sts = LDH__SUCCESS;
return it->second;
}
}
*sts = LDH__NOSUCHVOL;
return 0;
}
void wb_merep::addDbs( pwr_tStatus *sts, wb_mvrep *mvrep) void wb_merep::addDbs( pwr_tStatus *sts, wb_mvrep *mvrep)
{ {
mvrep_iterator it = m_mvrepdbs.find( mvrep->vid()); mvrep_iterator it = m_mvrepdbs.find( mvrep->vid());
...@@ -96,18 +109,32 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, wb_name name) ...@@ -96,18 +109,32 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, wb_name name)
{ {
wb_cdrep *cdrep; wb_cdrep *cdrep;
for ( mvrep_iterator it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) { if ( name.hasVolume()) {
wb_mvrep *mvrep = volume( sts, name.volume());
if ( EVEN( *sts)) return 0;
try { try {
cdrep = new wb_cdrep( it->second, name); cdrep = new wb_cdrep( mvrep, name);
*sts = LDH__SUCCESS; *sts = LDH__SUCCESS;
return cdrep; return cdrep;
} }
catch ( wb_error& e) { catch ( wb_error& e) {
// Not found in this volume, try next *sts = e.sts();
continue; return 0;
}
}
else {
for ( mvrep_iterator it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
try {
cdrep = new wb_cdrep( it->second, name);
*sts = LDH__SUCCESS;
return cdrep;
}
catch ( wb_error& e) {
// Not found in this volume, try next
continue;
}
} }
} }
// Not found // Not found
*sts = LDH__NOCLASS; *sts = LDH__NOCLASS;
return 0; return 0;
...@@ -143,14 +170,30 @@ wb_tdrep *wb_merep::tdrep( pwr_tStatus *sts, wb_name name) ...@@ -143,14 +170,30 @@ wb_tdrep *wb_merep::tdrep( pwr_tStatus *sts, wb_name name)
{ {
wb_tdrep *tdrep; wb_tdrep *tdrep;
for ( mvrep_iterator it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) { if ( name.hasVolume()) {
wb_mvrep *mvrep = volume( sts, name.volume());
if ( EVEN( *sts)) return 0;
try { try {
tdrep = new wb_tdrep( it->second, name); tdrep = new wb_tdrep( mvrep, name);
*sts = LDH__SUCCESS; *sts = LDH__SUCCESS;
return tdrep; return tdrep;
} }
catch ( wb_error& e) { catch ( wb_error& e) {
// Not found in this volume, try next *sts = e.sts();
return 0;
}
}
else {
for ( mvrep_iterator it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
try {
tdrep = new wb_tdrep( it->second, name);
*sts = LDH__SUCCESS;
return tdrep;
}
catch ( wb_error& e) {
// Not found in this volume, try next
}
} }
} }
......
...@@ -24,6 +24,7 @@ public: ...@@ -24,6 +24,7 @@ public:
wb_merep( wb_erep *erep, wb_vrep *vrep = 0) : m_erep(erep), m_vrep(vrep) {} wb_merep( wb_erep *erep, wb_vrep *vrep = 0) : m_erep(erep), m_vrep(vrep) {}
wb_mvrep *volume(pwr_tStatus *sts); wb_mvrep *volume(pwr_tStatus *sts);
wb_mvrep *volume(pwr_tStatus *sts, pwr_tVid vid); wb_mvrep *volume(pwr_tStatus *sts, pwr_tVid vid);
wb_mvrep *volume(pwr_tStatus *sts, const char *name);
void addDbs( pwr_tStatus *sts, wb_mvrep *mvrep); void addDbs( pwr_tStatus *sts, wb_mvrep *mvrep);
void removeDbs( pwr_tStatus *sts, wb_mvrep *mvrep); void removeDbs( pwr_tStatus *sts, wb_mvrep *mvrep);
......
...@@ -6,6 +6,12 @@ const char* wb_name::m_emptyString = ""; ...@@ -6,6 +6,12 @@ const char* wb_name::m_emptyString = "";
wb_name::wb_name( const char *name) wb_name::wb_name( const char *name)
{ {
if ( name == 0) {
m_sts = LDH__NONAME;
m_nrep = 0;
return;
}
try { try {
m_nrep = new wb_nrep( name); m_nrep = new wb_nrep( name);
m_sts = LDH__SUCCESS; m_sts = LDH__SUCCESS;
......
#include "wb_orepmem.h"
wb_orepmem::wb_orepmem( wb_vrepmem *v, mem_object *n): m_vrep(v), m_memobject(n)
{}
wb_orepmem::~wb_orepmem()
{
}
//
// Operations declared in wb_Orep
//
pwr_tOid wb_orepmem::oid() const
{
return m_memobject->m_oid;
}
pwr_tVid wb_orepmem::vid() const
{
return m_memobject->m_oid.vid;
}
pwr_tOix wb_orepmem::oix() const
{
return m_memobject->m_oid.oix;
}
pwr_tOix wb_orepmem::cid() const
{
return m_memobject->m_cid;
}
pwr_tOid wb_orepmem::poid() const
{
if ( m_memobject->fth)
return m_memobject->fth->m_oid;
return pwr_cNOid;
}
pwr_tOid wb_orepmem::foid() const
{
if ( m_memobject->fch)
return m_memobject->fch->m_oid;
return pwr_cNOid;
}
pwr_tOid wb_orepmem::loid() const
{
mem_object *n = m_memobject->get_lch();
if ( n)
return n->m_oid;
return pwr_cNOid;
}
pwr_tOid wb_orepmem::boid() const
{
if ( m_memobject->bws)
return m_memobject->bws->m_oid;
return pwr_cNOid;
}
pwr_tOid wb_orepmem::aoid() const
{
if ( m_memobject->fws)
return m_memobject->fws->m_oid;
return pwr_cNOid;
}
const char * wb_orepmem::name() const
{
return m_memobject->name();
}
wb_name wb_orepmem::longName()
{
char str[200];
m_vrep->objectName( this, str);
return wb_name( str);
}
pwr_tTime wb_orepmem::ohTime() const
{
pwr_tTime t = {0,0};
return t;
}
bool wb_orepmem::isOffspringOf(const wb_orep *o) const
{
return true;
}
wb_orep *wb_orepmem::ancestor(pwr_tStatus *sts)
{
return m_vrep->ancestor(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::parent(pwr_tStatus *sts)
{
return m_vrep->parent(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::after(pwr_tStatus *sts)
{
return m_vrep->after(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::before(pwr_tStatus *sts)
{
return m_vrep->before(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::first(pwr_tStatus *sts)
{
return m_vrep->first(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::child(pwr_tStatus *sts, wb_name &name)
{
return m_vrep->child(sts, (wb_orep *)this, name);
}
wb_orep *wb_orepmem::last(pwr_tStatus *sts)
{
return m_vrep->last(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::next(pwr_tStatus *sts)
{
return m_vrep->next(sts, (wb_orep *)this);
}
wb_orep *wb_orepmem::previous(pwr_tStatus *sts)
{
return m_vrep->previous(sts, (wb_orep *)this);
}
wb_adrep *wb_orepmem::attribute(pwr_tStatus*, const char *aname)
{
return 0;
}
wb_adrep *wb_orepmem::attribute(pwr_tStatus*)
{
return 0;
}
#ifndef wb_orepmem_h
#define wb_orepmem_h
#include "wb_orep.h"
#include "wb_vrepmem.h"
#include "pwr.h"
class wb_orepmem : public wb_orep
{
wb_vrepmem *m_vrep;
unsigned int m_refCount;
mem_object *m_memobject;
public:
wb_orepmem(int oix);
wb_orepmem( wb_vrepmem *v, mem_object *n);
~wb_orepmem();
// void* operator new(size_t size, wb_vrepmem *v);
// void operator delete(void *p, size_t size, wb_vrepmem *v);
virtual pwr_tOid oid() const;
virtual pwr_tVid vid() const;
virtual pwr_tOix oix() const;
virtual pwr_tCid cid() const;
virtual pwr_tOid poid() const;
virtual pwr_tOid foid() const;
virtual pwr_tOid loid() const;
virtual pwr_tOid boid() const;
virtual pwr_tOid aoid() const;
virtual const char * name() const;
virtual wb_name longName();
virtual pwr_tTime ohTime() const;
virtual bool isOffspringOf(const wb_orep *o) const;
// Navigational operations
wb_orep *ancestor(pwr_tStatus *sts); //< get object at top of hierarchy
wb_orep *parent(pwr_tStatus *sts);
wb_orep *after(pwr_tStatus *sts); //< get next sibling
wb_orep *before(pwr_tStatus *sts); //< get previous sibling
wb_orep *first(pwr_tStatus *sts); //< get first child
wb_orep *child(pwr_tStatus *sts, wb_name &name); //< get named child
wb_orep *last(pwr_tStatus *sts); //< get last child
wb_orep *next(pwr_tStatus *sts); //< get next in list of objects of same class in one volume
wb_orep *previous(pwr_tStatus *sts); //< get previous in list of objects of same class in one volume
virtual wb_adrep *attribute(pwr_tStatus*, const char *name);
virtual wb_adrep *attribute(pwr_tStatus*);
mem_object *memobject() { return m_memobject;}
wb_erep *erep() const { return m_vrep->erep();}
wb_vrep *vrep() const { return m_vrep;}
};
#endif
...@@ -14,35 +14,35 @@ wb_orepwbl::~wb_orepwbl() ...@@ -14,35 +14,35 @@ wb_orepwbl::~wb_orepwbl()
pwr_tOid wb_orepwbl::oid() const pwr_tOid wb_orepwbl::oid() const
{ {
return m_wblnode->m_oid; return m_wblnode->o->m_oid;
} }
pwr_tVid wb_orepwbl::vid() const pwr_tVid wb_orepwbl::vid() const
{ {
return m_wblnode->m_oid.vid; return m_wblnode->o->m_oid.vid;
} }
pwr_tOix wb_orepwbl::oix() const pwr_tOix wb_orepwbl::oix() const
{ {
return m_wblnode->m_oid.oix; return m_wblnode->o->m_oid.oix;
} }
pwr_tOix wb_orepwbl::cid() const pwr_tOix wb_orepwbl::cid() const
{ {
return m_wblnode->m_cid; return m_wblnode->o->m_cid;
} }
pwr_tOid wb_orepwbl::poid() const pwr_tOid wb_orepwbl::poid() const
{ {
if ( m_wblnode->o_fth) if ( m_wblnode->o->fth)
return m_wblnode->o_fth->m_oid; return m_wblnode->o->fth->o->m_oid;
return pwr_cNOid; return pwr_cNOid;
} }
pwr_tOid wb_orepwbl::foid() const pwr_tOid wb_orepwbl::foid() const
{ {
if ( m_wblnode->o_fch) if ( m_wblnode->o->fch)
return m_wblnode->o_fch->m_oid; return m_wblnode->o->fch->o->m_oid;
return pwr_cNOid; return pwr_cNOid;
} }
...@@ -50,21 +50,21 @@ pwr_tOid wb_orepwbl::loid() const ...@@ -50,21 +50,21 @@ pwr_tOid wb_orepwbl::loid() const
{ {
ref_wblnode n = m_wblnode->get_o_lch(); ref_wblnode n = m_wblnode->get_o_lch();
if ( n) if ( n)
return n->m_oid; return n->o->m_oid;
return pwr_cNOid; return pwr_cNOid;
} }
pwr_tOid wb_orepwbl::boid() const pwr_tOid wb_orepwbl::boid() const
{ {
if ( m_wblnode->o_bws) if ( m_wblnode->o->bws)
return m_wblnode->o_bws->m_oid; return m_wblnode->o->bws->o->m_oid;
return pwr_cNOid; return pwr_cNOid;
} }
pwr_tOid wb_orepwbl::aoid() const pwr_tOid wb_orepwbl::aoid() const
{ {
if ( m_wblnode->o_fws) if ( m_wblnode->o->fws)
return m_wblnode->o_fws->m_oid; return m_wblnode->o->fws->o->m_oid;
return pwr_cNOid; return pwr_cNOid;
} }
......
This diff is collapsed.
#ifndef wb_vrepmem_h
#define wb_vrepmem_h
#include <string>
#include "wb_vrep.h"
#include "wb_erep.h"
#include "wb_attrname.h"
class wb_vrepmem;
class mem_object
{
friend class wb_vrepmem;
public:
mem_object() : rbody_size(0), dbody_size(0), rbody(0), dbody(0),
m_cid(0), m_tid(0), fth(0), bws(0), fws(0), fch(0),
is_built(0)
{
strcpy( m_name, "");
strcpy( cname, "");
m_flags.m = 0;
m_oid.oix = 0;
m_oid.vid = 0;
}
~mem_object() {
if ( rbody_size) free( rbody);
if ( dbody_size) free( dbody);
}
char *name() { return m_name; }
mem_object *get_lch() {
mem_object *c = fch;
if ( c)
while ( c->fws) ;
return c;
}
bool exportHead(wb_import &i) { return false;}
bool exportDbody(wb_import &i) { return false;}
bool exportRbody(wb_import &i) { return false;}
mem_object *find( wb_name *oname, int level);
size_t rbody_size;
size_t dbody_size;
void *rbody;
void *dbody;
pwr_tCid m_cid;
pwr_tTid m_tid;
pwr_tOid m_oid;
char cname[32];
char m_name[32];
pwr_mClassDef m_flags;
mem_object *fth;
mem_object *bws;
mem_object *fws;
mem_object *fch;
int is_built;
};
class wb_orepmem;
class wb_vrepmem : public wb_vrep
{
map<int, wb_srep*> m_srep;
//wb_session m_wsession;
wb_erep *m_erep;
wb_merep *m_merep;
unsigned int m_nSession;
unsigned int m_nRef;
mem_object *root_object;
int m_nextOix;
map<pwr_tOix, mem_object *> m_oix_list;
typedef map<pwr_tOix, mem_object *>::iterator iterator_oix_list;
public:
wb_vrepmem( wb_erep *erep) :
m_erep(erep), m_merep(erep->merep()), root_object(0), m_nextOix(0) {}
wb_vrepmem( wb_erep *erep, pwr_tVid vid);
~wb_vrepmem();
pwr_tVid vid() const { return m_vid;}
pwr_tCid cid() const { return m_cid;}
wb_vrep *next();
virtual bool createSnapshot(const char *fileName);
char volume_class[32];
char volume_name[32];
virtual void unref();
virtual wb_vrep *ref();
wb_erep *erep() {return m_erep;}
wb_merep *merep() const { return m_merep;}
mem_object *findObject( pwr_tOix oix);
mem_object *find( const char *name);
int nameToOid( const char *name, pwr_tOid *oid);
bool registerObject( pwr_tOix oix, mem_object *node);
void registerVolume( const char *name, pwr_tCid cid, pwr_tVid vid, mem_object *node);
void info();
virtual pwr_tOid oid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
virtual pwr_tVid vid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNVid;}
virtual pwr_tOix oix(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOix;}
virtual pwr_tCid cid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNCid;}
virtual pwr_tOid poid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
virtual pwr_tOid foid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
virtual pwr_tOid loid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
virtual pwr_tOid boid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
virtual pwr_tOid aoid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
virtual const char * objectName(pwr_tStatus *sts, const wb_orep *o) { return "";}
virtual wb_name longName(pwr_tStatus *sts, const wb_orep *o) { return wb_name();}
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o) { pwr_tTime t = {0, 0}; return t;}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) { return false;}
wb_orep *object(pwr_tStatus *sts);
wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) {return 0;}
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name);
wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name) {return 0;}
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d) {return false;}
bool moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination &d) {return false;}
bool deleteObject(pwr_tStatus *sts, wb_orep *orep) {return false;}
bool deleteFamily(pwr_tStatus *sts, wb_orep *orep) {return false;}
bool deleteOset(pwr_tStatus *sts, wb_oset *oset) {return false;}
bool renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name &name) { return false;}
bool commit(pwr_tStatus *sts) {return false;}
bool abort(pwr_tStatus *sts) {return false;}
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p) {return false;}
virtual void *readAttribute(pwr_tStatus *sts, const wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p);
virtual void *readBody(pwr_tStatus *sts, const wb_orep *o, pwr_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) {return false;};
wb_orep *ancestor(pwr_tStatus *sts, const wb_orep *o);
wb_orep *parent(pwr_tStatus *sts, const wb_orep *o);
wb_orep *after(pwr_tStatus *sts, const wb_orep *o);
wb_orep *before(pwr_tStatus *sts, const wb_orep *o);
wb_orep *first(pwr_tStatus *sts, const wb_orep *o);
wb_orep *child(pwr_tStatus *sts, const wb_orep *o, wb_name &name);
wb_orep *last(pwr_tStatus *sts, const wb_orep *o);
wb_orep *next(pwr_tStatus *sts, const wb_orep *o);
wb_orep *previous(pwr_tStatus *sts, const wb_orep *o);
wb_srep *newSession() {return 0;}
bool isLocal(const wb_orep *o) {return false;}
void objectName(const wb_orep *o, char *str);
virtual bool exportVolume(wb_import &i);
virtual bool exportHead(wb_import &i);
virtual bool exportRbody(wb_import &i);
virtual bool exportDbody(wb_import &i);
virtual bool exportMeta(wb_import &i);
};
#endif
This diff is collapsed.
...@@ -18,6 +18,7 @@ class wb_orepwbl; ...@@ -18,6 +18,7 @@ class wb_orepwbl;
class wb_vrepwbl : public wb_vrep class wb_vrepwbl : public wb_vrep
{ {
map<int, wb_srep*> m_srep; map<int, wb_srep*> m_srep;
//wb_session m_wsession; //wb_session m_wsession;
......
...@@ -2278,16 +2278,30 @@ void wb_wbllexer::mSTRING_LITERAL(bool _createToken) { ...@@ -2278,16 +2278,30 @@ void wb_wbllexer::mSTRING_LITERAL(bool _createToken) {
match(static_cast<unsigned char>('"')); match(static_cast<unsigned char>('"'));
{ {
for (;;) { for (;;) {
if ((LA(1)==static_cast<unsigned char>('\\'))) { switch ( LA(1)) {
case static_cast<unsigned char>('\\'):
{
mESC(false); mESC(false);
break;
} }
else if ((_tokenSet_4.member(LA(1)))) { case static_cast<unsigned char>('\n'):
matchNot(static_cast<unsigned char>('"')); {
match(static_cast<unsigned char>('\n'));
if ( inputState->guessing==0 ) {
#line 122 "wb_wbllexer.g"
newline();
#line 2294 "wb_wbllexer.cpp"
}
break;
} }
default:
if ((_tokenSet_4.member(LA(1)))) {
matchNot(static_cast<unsigned char>('"'));
}
else { else {
goto _loop89; goto _loop89;
} }
}
} }
_loop89:; _loop89:;
} }
...@@ -2309,6 +2323,6 @@ const unsigned long wb_wbllexer::_tokenSet_2_data_[] = { 0UL, 16UL, 2281701374UL ...@@ -2309,6 +2323,6 @@ const unsigned long wb_wbllexer::_tokenSet_2_data_[] = { 0UL, 16UL, 2281701374UL
const ANTLR_USE_NAMESPACE(antlr)BitSet wb_wbllexer::_tokenSet_2(_tokenSet_2_data_,16); const ANTLR_USE_NAMESPACE(antlr)BitSet wb_wbllexer::_tokenSet_2(_tokenSet_2_data_,16);
const unsigned long wb_wbllexer::_tokenSet_3_data_[] = { 4294967288UL, 4294967167UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; const unsigned long wb_wbllexer::_tokenSet_3_data_[] = { 4294967288UL, 4294967167UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
const ANTLR_USE_NAMESPACE(antlr)BitSet wb_wbllexer::_tokenSet_3(_tokenSet_3_data_,16); const ANTLR_USE_NAMESPACE(antlr)BitSet wb_wbllexer::_tokenSet_3(_tokenSet_3_data_,16);
const unsigned long wb_wbllexer::_tokenSet_4_data_[] = { 4294967288UL, 4294967291UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; const unsigned long wb_wbllexer::_tokenSet_4_data_[] = { 4294966264UL, 4294967291UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
const ANTLR_USE_NAMESPACE(antlr)BitSet wb_wbllexer::_tokenSet_4(_tokenSet_4_data_,16); const ANTLR_USE_NAMESPACE(antlr)BitSet wb_wbllexer::_tokenSet_4(_tokenSet_4_data_,16);
...@@ -119,7 +119,7 @@ CHAR_LITERAL ...@@ -119,7 +119,7 @@ CHAR_LITERAL
; ;
STRING_LITERAL STRING_LITERAL
: '"' (ESC|~'"')* '"' : '"' (ESC|'\n' {newline();} |~'"')* '"'
; ;
protected protected
......
This diff is collapsed.
...@@ -38,6 +38,80 @@ typedef struct { ...@@ -38,6 +38,80 @@ typedef struct {
int value; int value;
} wbl_sSym; } wbl_sSym;
class wbl_class {
public:
wbl_class() : cid(0), cix(0), templ(0) {};
pwr_tCid cid;
int cix;
ref_wblnode templ;
};
class wbl_type {
public:
wbl_type() : tid(0), type(pwr_eType_), elements(0), size(0) {};
pwr_tTid tid;
pwr_eType type;
int elements;
size_t size;
};
class wbl_body {
public:
wbl_body() : bix(pwr_eBix__), size(0) {};
pwr_eBix bix;
size_t size;
};
class wbl_attribute {
public:
wbl_attribute() : tid(0), size(0), offset(0), elements(0), flags(0),
index(0) {};
pwr_tTid tid;
size_t size;
size_t offset;
int elements;
int flags;
int index;
pwr_eType type;
};
class wbl_object {
public:
wbl_object() : rbody_size(0), dbody_size(0), rbody(0), dbody(0),
m_cid(0), m_tid(0), fth(0), bws(0), fws(0), fch(0),
is_built(0)
{
strcpy( cname, "");
m_flags.m = 0;
m_oid.oix = 0;
m_oid.vid = 0;
};
~wbl_object() {
if ( rbody_size) free( rbody);
if ( dbody_size) free( dbody);
}
size_t rbody_size;
size_t dbody_size;
void *rbody;
void *dbody;
pwr_tCid m_cid;
pwr_tTid m_tid;
pwr_tOid m_oid;
char cname[32];
pwr_mClassDef m_flags;
wb_wblnode *fth;
wb_wblnode *bws;
wb_wblnode *fws;
wb_wblnode *fch;
int is_built;
wbl_class c;
wbl_type ty;
wbl_body b;
wbl_attribute a;
};
class wb_wblnode : public CommonAST { class wb_wblnode : public CommonAST {
friend class wb_vrepwbl; friend class wb_vrepwbl;
...@@ -45,29 +119,20 @@ class wb_wblnode : public CommonAST { ...@@ -45,29 +119,20 @@ class wb_wblnode : public CommonAST {
public: public:
wb_wblnode() : wb_wblnode() :
node_type(wbl_eNodeType_No), node_type(wbl_eNodeType_No),
rbody_size(0), dbody_size(0), rbody(0), dbody(0), m_cid(0), line_number(0), file(0), o(0)
m_tid(0), m_oid(pwr_cNOid), m_vrep(0), o_fth(0), o_bws(0), o_fws(0), o_fch(0),
line_number(0), file(0), is_built(0), c_cid(0), c_cix(0), c_template(0),
b_bix(pwr_eBix__), a_tid(0), a_size(0), a_offset(0), a_elements(0), a_flags(0)
{ {
m_flags.m = 0;
strcpy( cname, "");
} }
wb_wblnode(antlr::RefToken t) : wb_wblnode(antlr::RefToken t) :
node_type(wbl_eNodeType_No), node_type(wbl_eNodeType_No),
rbody_size(0), dbody_size(0), rbody(0), dbody(0), m_cid(0), line_number(0), file(0), o(0)
m_tid(0), m_oid(pwr_cNOid), m_vrep(0), o_fth(0), o_bws(0), o_fws(0), o_fch(0),
line_number(0), file(0), is_built(0), c_cid(0), c_cix(0), c_template(0),
b_bix(pwr_eBix__), a_tid(0), a_size(0), a_offset(0), a_elements(0), a_flags(0)
{ {
m_flags.m = 0;
CommonAST::setType(t->getType()); CommonAST::setType(t->getType());
CommonAST::setText(t->getText()); CommonAST::setText(t->getText());
} }
~wb_wblnode() ~wb_wblnode()
{ {
if ( rbody_size) free( rbody); if ( o)
if ( dbody_size) free( dbody); delete o;
} }
void initialize(int t, const std::string& txt) void initialize(int t, const std::string& txt)
...@@ -85,19 +150,7 @@ public: ...@@ -85,19 +150,7 @@ public:
{ {
CommonAST::initialize(t); CommonAST::initialize(t);
} }
void initialize( antlr::RefToken t ) void initialize( antlr::RefToken t);
{
CommonAST::initialize(t);
line_number = t->getLine();
// Test
static int last = 0;
if ( (line_number % 1000) == 0 && line_number != last) {
printf( "-- Processing line: %d\r", line_number);
fflush(stdout);
last = line_number;
}
}
void setText(const std::string& txt) void setText(const std::string& txt)
{ {
...@@ -183,7 +236,7 @@ public: ...@@ -183,7 +236,7 @@ public:
ref_wblnode get_o_lch(); ref_wblnode get_o_lch();
int classNameToCid( char *cname, pwr_tCid *cid); int classNameToCid( char *cname, pwr_tCid *cid);
int stringToOix( const char *buf, pwr_tOix *oix) const; int stringToOix( const char *buf, pwr_tOix *oix) const;
pwr_tCid Cid() { return c_cid;} pwr_tCid Cid() { return o->c.cid;}
int attrStringToValue( int type_id, char *value_str, int attrStringToValue( int type_id, char *value_str,
void *buffer_ptr, size_t buff_size, size_t attr_size); void *buffer_ptr, size_t buff_size, size_t attr_size);
...@@ -206,53 +259,15 @@ public: ...@@ -206,53 +259,15 @@ public:
static int lookup( int *type, const char *keyword, wbl_sSym *table); static int lookup( int *type, const char *keyword, wbl_sSym *table);
static int convconst( int *val, char *str); static int convconst( int *val, char *str);
const char *name() { return getText().c_str();}
wbl_eNodeType node_type; wbl_eNodeType node_type;
size_t rbody_size;
size_t dbody_size;
void *rbody;
void *dbody;
pwr_tCid m_cid;
pwr_tTid m_tid;
pwr_tOid m_oid;
const char *name() { return getText().c_str();}
char cname[32];
wb_vrepwbl *m_vrep; wb_vrepwbl *m_vrep;
pwr_mClassDef m_flags;
wb_wblnode *o_fth;
wb_wblnode *o_bws;
wb_wblnode *o_fws;
wb_wblnode *o_fch;
int line_number; int line_number;
wb_wblfile *file; wb_wblfile *file;
int is_built;
wbl_object *o;
// Classdef stuff
pwr_tCid c_cid;
int c_cix;
ref_wblnode c_template;
// Type and Typedef stuff
pwr_tTid ty_tid;
pwr_eType ty_type;
int ty_elements;
size_t ty_size;
// ObjBodyDef stuff
pwr_eBix b_bix;
size_t b_size;
// Attribute stuff
pwr_tTid a_tid;
size_t a_size;
size_t a_offset;
int a_elements;
int a_flags;
int a_index;
pwr_eType a_type;
// Template object stuff
}; };
......
...@@ -64,6 +64,7 @@ extern "C" { ...@@ -64,6 +64,7 @@ extern "C" {
#include "wb_env.h" #include "wb_env.h"
#include "wb_erep.h" #include "wb_erep.h"
#include "wb_vrepwbl.h" #include "wb_vrepwbl.h"
#include "wb_vrepmem.h"
#define WNAV_MENU_CREATE 0 #define WNAV_MENU_CREATE 0
#define WNAV_MENU_ADD 1 #define WNAV_MENU_ADD 1
...@@ -115,6 +116,8 @@ static int wnav_open_func( void *client_data, ...@@ -115,6 +116,8 @@ static int wnav_open_func( void *client_data,
void *client_flag); void *client_flag);
static int wnav_create_func( void *client_data, static int wnav_create_func( void *client_data,
void *client_flag); void *client_flag);
static int wnav_new_func( void *client_data,
void *client_flag);
static int wnav_delete_func( void *client_data, static int wnav_delete_func( void *client_data,
void *client_flag); void *client_flag);
static int wnav_connect_func( void *client_data, static int wnav_connect_func( void *client_data,
...@@ -230,6 +233,11 @@ dcli_tCmdTable wnav_command_table[] = { ...@@ -230,6 +233,11 @@ dcli_tCmdTable wnav_command_table[] = {
"/NAME", "/IDENTITY", "/FILES", "/OUT", "/IGNORE", "/NAME", "/IDENTITY", "/FILES", "/OUT", "/IGNORE",
""} ""}
}, },
{
"NEW",
&wnav_new_func,
{ "dcli_arg1", "/NAME", ""}
},
{ {
"DELETE", "DELETE",
&wnav_delete_func, &wnav_delete_func,
...@@ -3428,6 +3436,7 @@ static int wnav_create_func( void *client_data, ...@@ -3428,6 +3436,7 @@ static int wnav_create_func( void *client_data,
{ {
char filestr[80]; char filestr[80];
char outstr[80]; char outstr[80];
char *outstr_p;
int ignore; int ignore;
pwr_tStatus sts; pwr_tStatus sts;
...@@ -3439,11 +3448,10 @@ static int wnav_create_func( void *client_data, ...@@ -3439,11 +3448,10 @@ static int wnav_create_func( void *client_data,
return WNAV__QUAL; return WNAV__QUAL;
} }
if ( EVEN( dcli_get_qualifier( "/OUT", outstr))) if ( ODD( dcli_get_qualifier( "/OUT", outstr)))
{ outstr_p = outstr;
wnav->message('E', "Qualifer required"); else
return WNAV__QUAL; outstr_p = 0;
}
ignore = ODD( dcli_get_qualifier( "/IGNORE", NULL)); ignore = ODD( dcli_get_qualifier( "/IGNORE", NULL));
...@@ -3456,7 +3464,7 @@ static int wnav_create_func( void *client_data, ...@@ -3456,7 +3464,7 @@ static int wnav_create_func( void *client_data,
wb_vrepwbl *wbl = new wb_vrepwbl(erep); wb_vrepwbl *wbl = new wb_vrepwbl(erep);
sts = wbl->load( filestr); sts = wbl->load( filestr);
if ( ODD(sts) || ignore) if ( ODD(sts) || ignore)
wbl->createSnapshot( outstr); wbl->createSnapshot( outstr_p);
delete wbl; delete wbl;
} }
catch ( wb_error &e) { catch ( wb_error &e) {
...@@ -3475,6 +3483,60 @@ static int wnav_create_func( void *client_data, ...@@ -3475,6 +3483,60 @@ static int wnav_create_func( void *client_data,
return WNAV__SUCCESS; return WNAV__SUCCESS;
} }
static int wnav_new_func( void *client_data,
void *client_flag)
{
WNav *wnav = (WNav *)client_data;
int sts;
char arg1_str[80];
int arg1_sts;
arg1_sts = dcli_get_qualifier( "dcli_arg1", arg1_str);
if ( strncmp( arg1_str, "VOLUME", strlen( arg1_str)) == 0)
{
char name_str[80];
sts = wnav_wccm_get_wbctx_cb( wnav, &wnav->wbctx);
if ( EVEN(sts)) return sts;
// Command is "NEW VOLUME"
if ( ODD( dcli_get_qualifier( "dcli_arg2", name_str)))
{
if ( name_str[0] == '/')
{
wnav->message('E', "Syntax error");
return WNAV__SYNTAX;
}
}
else if ( EVEN( dcli_get_qualifier( "/NAME", name_str)))
{
wnav->message('E',"Enter name");
return WNAV__QUAL;
}
wb_erep *erep = *(wb_env *)wnav->wbctx;
pwr_tVid vid = erep->nextVolatileVid( &sts);
if ( EVEN(sts)) {
wnav->message(' ', wnav_get_message(sts));
return sts;
}
wb_vrepmem *mem = new wb_vrepmem(erep, vid);
mem->name( name_str);
erep->addDbs( &sts, mem);
return sts;
}
else
{
wnav->message('E',"Syntax error");
return WNAV__SYNTAX;
}
return WNAV__SUCCESS;
}
static int wnav_delete_func( void *client_data, static int wnav_delete_func( void *client_data,
void *client_flag) void *client_flag)
{ {
......
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