Commit 3f706cce authored by claes's avatar claes

*** empty log message ***

parent 617a312c
......@@ -41,6 +41,47 @@ SObject pwrs:Class
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! @Summary A XttGraph object that will open a graph for this hierarchy.
! A XttGraph object that will open a graph that contains data for
! this hierarchy. This graph can be opened from the popup menu for
! this object.
!*/
Object DefGraph $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! @Summary A trend object that displays trends for this hierarchy.
! A DsTrend or PlotGroup object that contains trend for this hierarchy.
! The trend can be opened from the popup menu for this object.
!*/
Object DefTrend $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
!/**
! @Summary A help topic for this hierarchy.
! A help topic in the xtt help file that contains help for this hierarchy.
! The help can be displayed from the popup menu for this object.
!*/
Object HelpTopic $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! @Summary A URL to the data sheet for the equipment in this hierarchy.
! A URL to the data sheet for the equipment in this hierarchy.
! The data sheet can be displayed from the popup menu for this object.
!*/
Object DataSheet $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$URL"
EndBody
EndObject
EndObject
EndObject
EndSObject
......@@ -41,6 +41,7 @@ extern "C" {
#include "wb_env.h"
#include "wb_erep.h"
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
/* Fallback resources */
......@@ -199,8 +200,33 @@ void pwr_wtt_open_volume( void *wttctx, char *filename, wow_eFileSelType file_ty
wtt->time_to_exit_cb = pwr_time_to_exit;
}
}
else if ( file_type == wow_eFileSelType_Dbs)
else if ( file_type == wow_eFileSelType_Dbs) {
printf( "Wb opening loadfile %s...\n", filename);
// Load volume as extern
wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx);
wb_vrepdbs *vrep = new wb_vrepdbs( erep, filename);
try {
vrep->load();
erep->addExtern( &sts, vrep);
}
catch ( wb_error& e) {
cout << "** Error opening volume, " << e.what() << endl;
return;
}
// Attach extern volume
wb_volume *vol = new wb_volume(vrep);
pwr_tVid volume = vrep->vid();
Wtt *wtt = new Wtt( 0, toplevel, filename, "Navigator", wbctx, volume, vol, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit;
}
}
else
printf( "Unknown file type\n");
}
......
......@@ -4,8 +4,6 @@
#include "wb_attrname.h"
#include "pwr.h"
static const char* s_emptyString = "";
wb_attribute::wb_attribute() : wb_status(LDH__NOSUCHATTR), m_orep(0), m_adrep(0),
......@@ -152,7 +150,7 @@ wb_attribute& wb_attribute::operator=(const wb_attribute& x)
return *this;
}
void wb_attribute::check()
void wb_attribute::check() const
{
if ( evenSts())
throw wb_error( m_sts);
......@@ -304,20 +302,28 @@ wb_attribute wb_attribute::prev()
return a;
}
const char* wb_attribute::name() const
const char *wb_attribute::name() const
{
if (m_adrep)
return m_adrep->name();
else
return s_emptyString;
check();
return m_orep->name();
}
// Fix, no index and no subclass !!!
wb_name wb_attribute::longName()
{
if (m_adrep)
return m_adrep->longName();
else
return wb_name();
check();
if ( !m_adrep)
return m_orep->longName();
char str[512];
strcpy( str, m_orep->longName().name());
strcat( str, ".");
strcat( str, m_adrep->name());
wb_name n = wb_name( str);
return n;
}
void wb_attribute::name(const char *name)
......
......@@ -84,7 +84,7 @@ public:
wb_attribute prev();
const char* name() const; // get attribute name
const char *name() const;
wb_name longName();
void name(const char *name);
void name(wb_name *name);
......@@ -93,7 +93,7 @@ public:
pwr_tStatus sts() { return m_sts;}
private:
void check();
void check() const;
void init();
};
......
......@@ -3,9 +3,11 @@
#include "wb_name.h"
class wb_attrname : public wb_name
{
public:
wb_attrname() : wb_name() {}
wb_attrname(const char *);
};
......
......@@ -41,7 +41,8 @@ wb_cdrep::wb_cdrep( wb_mvrep *mvrep, wb_name name) : m_nRef(0)
char str[80];
strcpy( str, "Class-");
strcat( str, name.object());
m_orep = (wb_orepdbs *) mvrep->object( &m_sts, str);
wb_name n = wb_name( str);
m_orep = (wb_orepdbs *) mvrep->object( &m_sts, n);
if ( EVEN(m_sts)) throw wb_error( m_sts);
m_orep->ref();
......@@ -112,18 +113,29 @@ wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, int bix)
wb_adrep *wb_cdrep::adrep( pwr_tStatus *sts, const char *aname)
{
wb_name n = wb_name( aname);
if ( n.evenSts()) {
*sts = n.sts();
return 0;
}
wb_orepdbs *orep_attr;
wb_orepdbs *old;
wb_orepdbs *orep = (wb_orepdbs *)m_orep->first( sts);
while ( ODD(*sts)) {
orep->ref();
if ( orep->cid() == pwr_eClass_ObjBodyDef) {
orep_attr = (wb_orepdbs *)orep->m_vrep->child( sts, orep, aname);
orep_attr = (wb_orepdbs *)orep->m_vrep->child( sts, orep, n);
if ( ODD(*sts)) {
wb_adrep *adrep = new wb_adrep( *orep);
wb_adrep *adrep = new wb_adrep( *orep_attr);
orep->unref();
return adrep;
}
}
orep_attr = (wb_orepdbs *)orep_attr->after( sts);
old = orep;
orep = (wb_orepdbs *)orep->after( sts);
old->unref();
}
*sts = LDH__NOSUCHATTR;
return 0;
}
......
......@@ -443,6 +443,10 @@ wb_orep *wb_erep::object(pwr_tStatus *sts, pwr_tOid oid)
wb_orep *wb_erep::object(pwr_tStatus *sts, const char *name)
{
wb_name n = wb_name(name);
if ( n.evenSts()) {
*sts = n.sts();
return 0;
}
wb_vrep *vrep = volume( sts, n.volume());
if ( EVEN(*sts)) return 0;
......
......@@ -98,6 +98,7 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, wb_name name)
}
catch ( wb_error& e) {
// Not found in this volume, try next
continue;
}
}
......
......@@ -139,7 +139,7 @@ public:
char *normName( int ntype) const throw (wb_error) { check(); return m_nrep->normName( ntype);}
bool volumeIsEqual( const char *n) const throw (wb_error) { check(); return m_nrep->volumeIsEqual( n);}
bool objectIsEqual( const char *n) const throw (wb_error) { check(); return m_nrep->objectIsEqual( n);}
bool segmentIsEqual( char *n, int idx = 0) const throw (wb_error) { check(); return m_nrep->segmentIsEqual( n, idx);}
bool segmentIsEqual( const char *n, int idx = 0) const throw (wb_error) { check(); return m_nrep->segmentIsEqual( n, idx);}
bool attributeIsEqual( const char *n, int idx = 0) const throw (wb_error) { check(); return m_nrep->attributeIsEqual( n, idx);}
// Id representation
......@@ -153,7 +153,7 @@ public:
// bool bodyName();
static char *unatName( char *name) { return wb_nrep::unatName( name);}
static bool checkObjectName( char *name) { return wb_nrep::checkObjectName( name);}
static bool checkObjectName( const char *name) { return wb_nrep::checkObjectName( name);}
private:
void check() const { if ( evenSts()) throw wb_error(m_sts);}
};
......
......@@ -70,7 +70,7 @@ pwr_tOid wb_orepwbl::aoid() const
const char * wb_orepwbl::name() const
{
return m_wblnode->name;
return m_wblnode->name();
}
wb_name wb_orepwbl::longName()
......
......@@ -40,7 +40,8 @@ wb_tdrep::wb_tdrep( wb_mvrep *mvrep, wb_name name) : m_nRef(0)
char str[80];
strcpy( str, "Type-");
strcat( str, name.object());
m_orep = (wb_orepdbs *) mvrep->object( &m_sts, str);
wb_name n = wb_name( str);
m_orep = (wb_orepdbs *) mvrep->object( &m_sts, n);
if ( EVEN(m_sts)) throw wb_error( m_sts);
m_orep->ref();
......
......@@ -82,21 +82,21 @@ void wb_vrepwbl::info()
for ( iterator_tid_list it = m_tid_list.begin();
it != m_tid_list.end(); it++)
cout << "Tid_list : " << it->first << " " << it->second->name <<
cout << "Tid_list : " << it->first << " " << it->second->name() <<
" size: " << it->second->ty_size << " elem: " << it->second->ty_elements << endl;
for ( iterator_class_list it = m_class_list.begin();
it != m_class_list.end(); it++)
cout << "Class_list : " << it->first << " " << it->second->name <<
cout << "Class_list : " << it->first << " " << it->second->name() <<
" line: " << it->second->line_number << endl;
for ( iterator_cid_list it = m_cid_list.begin();
it != m_cid_list.end(); it++)
cout << "Cid_list : " << it->first << " " << it->second->name <<
cout << "Cid_list : " << it->first << " " << it->second->name() <<
" line: " << it->second->line_number << endl;
// for ( int i = 0; i < file_cnt; i++)
// rootAST[i]->info(0);
if ( root_object)
root_object->info(0);
}
bool
......@@ -179,9 +179,11 @@ int wb_vrepwbl::load( const char *fname)
// if ( root_object)
// root_object->info_link( 0);
cout << "-- Starting build pass" << endl;
if ( root_object)
root_object->build( 1);
// info();
return 1;
}
......@@ -216,7 +218,8 @@ ref_wblnode wb_vrepwbl::findClass( const char *name)
ref_wblnode wb_vrepwbl::findType( const char *name)
{
wb_name wname( name);
wb_name wname = wb_name( name);
if ( wname.evenSts()) return 0;
if ( wname.hasVolume() && !wname.volumeIsEqual(volume_name))
return 0;
......@@ -252,7 +255,9 @@ int wb_vrepwbl::getTypeInfo( const char *name, pwr_tTid *tid, pwr_eType *type, i
{
bool type_extern = false;
char tname[80];
wb_name wname( name);
wb_name wname = wb_name(name);
if ( wname.evenSts() || !wname.hasObject())
return 0;
strcpy( tname, wname.object());
......@@ -544,7 +549,8 @@ int wb_vrepwbl::getAttrInfo( const char *attr, cdh_eBix bix, pwr_tCid cid, int *
int a_elements;
pwr_eType a_type;
wb_attrname aname( attr);
wb_attrname aname = wb_attrname(attr);
if ( aname.evenSts()) return 0;
if ( getAttrInfoRec( &aname, bix, cid, &a_size, &a_offset,
......@@ -716,7 +722,7 @@ int wb_vrepwbl::getAttrInfoRec( wb_attrname *attr, cdh_eBix bix, pwr_tCid cid, i
// Find attribute
wb_wblnode *n_attr = n_body->o_fch;
while( n_attr) {
if ( n_attr->isAttribute() && attr->attributeIsEqual( n_attr->name, level))
if ( n_attr->isAttribute() && attr->attributeIsEqual( n_attr->name(), level))
break;
n_attr = n_attr->o_fws;
}
......@@ -793,7 +799,6 @@ int wb_vrepwbl::nameToOid( const char *name, pwr_tOid *oid)
int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
{
wb_name aname = wb_name( name);
pwr_tOid oid;
pwr_tStatus sts;
int a_size;
......@@ -809,6 +814,9 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
return 0;
}
wb_name aname = wb_name(name);
if ( aname.evenSts()) return 0;
ref_wblnode n = find( aname.name( cdh_mName_volume | cdh_mName_path | cdh_mName_object));
if ( n) {
if ( !n->is_built)
......@@ -834,7 +842,25 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
}
}
if ( !aname.hasAttribute()) {
// No attribute given, attrref to whole RtBody
wb_cdrep *cdrep = m_merep->cdrep( &sts, cid);
if ( EVEN(sts)) return sts;
wb_bdrep *bdrep = cdrep->bdrep( &sts, cdh_eBix_rt);
if ( EVEN(sts)) return sts;
attrref->Objid = oid;
attrref->Offset = 0;
attrref->Size = bdrep->size();
attrref->Body = cdh_TypeObjidToId( bdrep->boid());
delete cdrep;
delete bdrep;
}
else {
wb_attrname an = wb_attrname( aname.name( cdh_mName_attribute));
if ( an.evenSts()) return an.sts();
// Try rtbody
bix = cdh_eBix_rt;
......@@ -850,8 +876,8 @@ int wb_vrepwbl::nameToAttrRef( const char *name, pwr_sAttrRef *attrref)
attrref->Objid = oid;
attrref->Offset = a_offset;
attrref->Size = a_size;
attrref->Body = 0; // Fix
attrref->Body = a_tid;
}
return LDH__SUCCESS;
}
......@@ -1019,7 +1045,7 @@ int wb_vrepwbl::load_files( const char *file_spec)
bool wb_vrepwbl::registerObject( pwr_tOix oix, ref_wblnode node)
{
#if 0
cout << "RegObj: " << oix << " " << node->name << endl;
cout << "RegObj: " << oix << " " << node->name() << endl;
ref_wblnode n = findObject( oix);
if ( n)
......@@ -1062,7 +1088,7 @@ void wb_vrepwbl::registerVolume( const char *name, pwr_tCid cid, pwr_tVid vid, r
ref_wblnode wb_vrepwbl::find( const char *name)
{
wb_name oname(name);
wb_name oname = wb_name(name);
if ( oname.evenSts() || (oname.hasVolume() && !oname.volumeIsEqual(volume_name)))
return 0;
......@@ -1219,7 +1245,7 @@ void wb_vrepwbl::objectName(wb_orep *o, char *str)
}
for ( int i = cnt - 1; i >= 0; i--) {
strcat( str, vect[i]->name);
strcat( str, vect[i]->name());
if ( i == cnt - 1)
strcat( str, ":");
else if ( i != 0)
......
This diff is collapsed.
......@@ -48,7 +48,6 @@ public:
line_number(0), file(0), is_built(0), c_cid(0), c_cix(0), c_template(0),
b_bix(0), a_tid(0), a_size(0), a_offset(0), a_elements(0), a_flags(0)
{
strcpy( name, "");
strcpy( cname, "");
}
wb_wblnode(antlr::RefToken t) :
......@@ -90,7 +89,8 @@ public:
// Test
static int last = 0;
if ( (line_number % 1000) == 0 && line_number != last) {
printf( "Line: %d\n", line_number);
printf( "-- Processing line: %d\r", line_number);
fflush(stdout);
last = line_number;
}
}
......@@ -169,6 +169,10 @@ public:
void buildTemplate( ref_wblnode classdef);
void buildBody( ref_wblnode object);
void buildAttr( ref_wblnode object, int bix);
void buildBuff( ref_wblnode object, int bix, pwr_tCid buffer_cid,
int buffer_offset, int buffer_size);
void buildBuffAttr( ref_wblnode object, int bix, pwr_tCid buffer_cid,
int buffer_offset, int buffer_size);
void link( wb_vrepwbl *vol, ref_wblnode father_node);
void info_link( int level);
ref_wblnode find( wb_name *oname, int level);
......@@ -202,8 +206,7 @@ public:
pwr_tCid m_cid;
pwr_tTid m_tid;
pwr_tOid m_oid;
char name[200];
// char *name() { return getText().c_str();}
const char *name() { return getText().c_str();}
char cname[32];
wb_vrepwbl *m_vrep;
wb_wblnode *o_fth;
......
......@@ -3452,6 +3452,7 @@ static int wnav_create_func( void *client_data,
wb_erep *erep = *(wb_env *)wnav->wbctx;
wb_vrepwbl *wbl = new wb_vrepwbl(erep);
wbl->load( filestr);
printf( "-- Loadfile loaded, snapshot creation started...\n");
wbl->createSnapshot( outstr);
delete wbl;
}
......
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