Commit 38ad685d authored by claes's avatar claes

*** empty log message ***

parent 3f706cce
......@@ -92,7 +92,7 @@ noname <no name exist> /error
notype <no type exist> /error
nobase <no base system> /error
projconfig <project is not configured> /info
wblparse <error when parsing wb_load file> /error
......
......@@ -91,7 +91,8 @@ init :
copy : $(inc_dir)/pwr_nmpsclasses.h
lib : $(export_wbl)
#lib : $(export_wbl)
lib : $(load_dir)/nmps.dbs
exe : $(doc_dir)/nmps_allclasses.html \
$(exe_dir)/nmps_xtthelp.dat
......@@ -100,6 +101,10 @@ clean :
realclean : clean $(clean_wbl)
$(load_dir)/nmps.dbs :
@ echo "Generating snapshot for nmps"
@ wb_cmd create snapshot /file=\"$(pwre_sroot)/wbl/nmps/src/\"/out=\"$(target)\"
$(inc_dir)/pwr_nmpsclasses.h :
@ echo "Generating struct files for nmps classes..."
@ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/nmps/src/nmps_c_*.wb_load"
......
......@@ -346,7 +346,8 @@ init :
copy : $(inc_dir)/pwr_baseclasses.h
lib : $(export_wbl)
#lib : $(export_wbl)
lib : $(load_dir)/pwrb.dbs
exe : $(doc_dir)/pwrb_allclasses.html \
$(exe_dir)/pwrb_xtthelp.dat
......@@ -355,6 +356,10 @@ clean :
realclean : clean clean_pwrb_xtthelp clean_pwrb_html clean_baseclasses
$(load_dir)/pwrb.dbs :
@ echo "Generating snapshot for pwrb"
@ wb_cmd create snapshot /file=\"$(pwre_sroot)/wbl/pwrb/src/\"/out=\"$(target)\"
$(inc_dir)/pwr_baseclasses.h :
@ echo "Generating struct files for pwrb classes..."
@ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/pwrb/src/pwrb_c_*.wb_load"
......
......@@ -152,7 +152,8 @@ init :
copy : $(inc_dir)/pwr_systemclasses.h
lib : $(export_wbl)
#lib : $(export_wbl)
lib : $(load_dir)/pwrs.dbs
exe : $(doc_dir)/pwrs_allclasses.html \
$(exe_dir)/pwrs_xtthelp.dat
......@@ -161,6 +162,10 @@ clean : $(clean_wbl)
realclean : clean clean_pwrs_xtthelp clean_pwrs_html clean_systemclasses
$(load_dir)/pwrs.dbs :
@ echo "Generating snapshot for pwrs"
@ wb_cmd create snapshot /file=\"$(pwre_sroot)/wbl/pwrs/src/\"/out=\"$(target)\"
$(inc_dir)/pwr_systemclasses.h :
@ echo "Generating struct files for pwrs classes..."
@ co_convert -s -d $(inc_dir) "$(pwre_sroot)/wbl/pwrs/src/pwrs_c_*.wb_load"
......
......@@ -77,7 +77,8 @@ init :
copy : $(inc_dir)/pwr_ssabclasses.h
lib : $(export_wbl)
#lib : $(export_wbl)
lib : $(load_dir)/ssab.dbs
exe : $(doc_dir)/ssab_allclasses.html \
$(exe_dir)/ssab_xtthelp.dat
......@@ -86,6 +87,10 @@ clean :
realclean : clean $(clean_wbl)
$(load_dir)/ssab.dbs :
@ echo "Generating snapshot for ssab"
@ wb_cmd create snapshot /file=\"$(pwre_sroot)/wbl/ssab/src/\"/out=\"$(target)\"
$(inc_dir)/pwr_ssabclasses.h :
@ echo "Generating struct files for ssab classes..."
@ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/ssab/src/ssab_c_*.wb_load"
......
......@@ -70,7 +70,8 @@ init :
copy : $(inc_dir)/pwr_tlogclasses.h
lib : $(export_wbl)
#lib : $(export_wbl)
lib : $(load_dir)/tlog.dbs
exe : $(doc_dir)/tlog_allclasses.html \
$(exe_dir)/tlog_xtthelp.dat
......@@ -79,6 +80,10 @@ clean :
realclean : clean $(clean_wbl)
$(load_dir)/tlog.dbs :
@ echo "Generating snapshot for tlog"
@ wb_cmd create snapshot /file=\"$(pwre_sroot)/wbl/tlog/src/\"/out=\"$(target)\"
$(inc_dir)/pwr_tlogclasses.h :
@ echo "Generating struct files for tlog classes..."
@ co_convert -sv -d $(inc_dir) "$(pwre_sroot)/wbl/tlog/src/tlog_c_*.wb_load"
......
......@@ -366,7 +366,17 @@ void wb_erep::loadMeta( pwr_tStatus *status)
strcat( vname, vol_array[0]);
strcat( vname, ".dbs");
dcli_translate_filename( vname, vname);
vol_cnt++;
cout << "Found: " << found_file << endl;
// Load...
try {
vrep = new wb_vrepdbs( this, vname);
vrep->load();
addDbs( &sts, vrep);
vol_cnt++;
}
catch ( wb_error& e) {
cout << "** Unable to open volume " << vname << " " << e.what() << endl;
}
}
else {
// Imported loadfile
......
#include <iostream>
#include "wb_merep.h"
#include "wb_erep.h"
#include "wb_attrname.h"
......@@ -35,6 +37,7 @@ void wb_merep::addDbs( pwr_tStatus *sts, wb_mvrep *mvrep)
m_mvrepdbs[mvrep->vid()] = mvrep;
mvrep->ref();
cout << "Metavolume " << mvrep->vid() << " inserted\n";
*sts = LDH__SUCCESS;
}
else
......
......@@ -135,40 +135,42 @@ int wb_vrepwbl::load( const char *fname)
{
int i;
char file_spec[200];
pwr_tStatus sts, rsts;
rsts = LDH__SUCCESS;
if ( strstr( fname, ".wb_load") != 0) {
load_files( fname);
sts = load_files( fname);
if ( EVEN(sts)) return sts;
}
else {
// Load all wb_load files in directory
// Load volume
sprintf( file_spec, "%s/*_v.wb_load", fname);
load_files( file_spec);
sts = load_files( file_spec);
if ( EVEN(sts)) rsts = sts;
// Load class hierarchies
sprintf( file_spec, "%s/*_ch_*.wb_load", fname);
load_files( file_spec);
sts = load_files( file_spec);
if ( EVEN(sts)) rsts = sts;
// Load types
sprintf( file_spec, "%s/*_t_*.wb_load", fname);
load_files( file_spec);
sts = load_files( file_spec);
if ( EVEN(sts)) rsts = sts;
// Load types
sprintf( file_spec, "%s/*_td_*.wb_load", fname);
load_files( file_spec);
sts = load_files( file_spec);
if ( EVEN(sts)) rsts = sts;
// Load classes
sprintf( file_spec, "%s/*_c_*.wb_load", fname);
load_files( file_spec);
// Load some baseclasses...
// sprintf( file_spec, "%s/pwrb_c_*.wb_load", fname);
// load_files( file_spec);
sts = load_files( file_spec);
if ( EVEN(sts)) rsts = sts;
// Load classes
// sprintf( file_spec, "%s/*_c*.wb_load", fname);
// load_files( file_spec);
}
for ( i = 0; i < file_cnt; i++)
file[i]->rootAST->registerNode( this);
......@@ -179,12 +181,16 @@ int wb_vrepwbl::load( const char *fname)
// if ( root_object)
// root_object->info_link( 0);
cout << "-- Starting build pass" << endl;
cout << "\n-- Building volume " << volume_name << endl;
if ( root_object)
root_object->build( 1);
// info();
return 1;
if ( error_cnt)
cout << "** Errors when loading volume: " << error_cnt << " errors found" << endl;
else
cout << "-- Volume " << volume_name << " loaded" << endl;
return rsts;
}
int wb_vrepwbl::classNameToCid( const char *name, pwr_tCid *cid)
......@@ -1032,7 +1038,8 @@ int wb_vrepwbl::load_files( const char *file_spec)
catch(exception& e) {
cerr << "exception: " << e.what() << " " << found_file << " line: " <<
file[file_cnt]->lexer->getLine() << endl;
return 0;
error_cnt++;
return LDH__WBLPARSE;
}
file_cnt++;
sts = dcli_search_file( (char *)file_spec, found_file, DCLI_DIR_SEARCH_NEXT);
......@@ -1254,3 +1261,69 @@ void wb_vrepwbl::objectName(wb_orep *o, char *str)
free( vect);
}
void *wb_vrepwbl::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix,
unsigned int offset, unsigned int size, void *p)
{
*sts = LDH__SUCCESS;
wb_wblnode *n = ((wb_orepwbl *) o)->wblNode();
switch ( bix) {
case cdh_eBix_rt:
if ( n->rbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
}
if ( p) {
memcpy( p, (char *)n->rbody + offset, MIN(n->rbody_size - offset, size));
return p;
}
return (void *)((char *)n->rbody + offset);
case cdh_eBix_dev:
if ( n->dbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
}
if ( p) {
memcpy( p, (char *)n->dbody + offset, MIN(n->dbody_size - offset, size));
return p;
}
return (void *)((char *)n->dbody + offset);
default:
*sts = LDH__NOSUCHBODY;
return 0;
}
}
void *wb_vrepwbl::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
{
*sts = LDH__SUCCESS;
wb_wblnode *n = ((wb_orepwbl *) o)->wblNode();
switch ( bix) {
case cdh_eBix_rt:
if ( n->rbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
}
if ( p) {
memcpy( p, n->rbody, n->rbody_size);
return p;
}
return n->rbody;
case cdh_eBix_dev:
if ( n->dbody_size == 0) {
*sts = LDH__NOSUCHBODY;
return 0;
}
if ( p) {
memcpy( p, n->dbody, n->dbody_size);
return p;
}
return n->dbody;
default:
*sts = LDH__NOSUCHBODY;
return 0;
}
}
......@@ -147,9 +147,9 @@ public:
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_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) {return 0;};
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) {return 0;};
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) {return false;};
......
......@@ -2241,6 +2241,11 @@ void wb_wbllexer::mESC(bool _createToken) {
match(static_cast<unsigned char>('"'));
break;
}
case static_cast<unsigned char>('0'):
{
match(static_cast<unsigned char>('0'));
break;
}
case static_cast<unsigned char>('\''):
{
match(static_cast<unsigned char>('\''));
......
......@@ -136,6 +136,7 @@ ESC : '\\'
| 'b'
| 'f'
| '"'
| '0'
| '\''
| '\\'
)
......
......@@ -1325,11 +1325,10 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
{
break;
}
case tokens.STRING_LITERAL:
case tokens.CHAR_LITERAL:
{
// Remove quotes
char str[1032];
char str[10];
string text = getText();
const char *text_p = text.c_str();
strncpy( str, &text_p[1], sizeof(str));
......@@ -1338,6 +1337,30 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
setText(new_text);
break;
}
case tokens.STRING_LITERAL:
{
// Remove quotes and replace \" with "
char str[2048];
const char *s;
char *t;
bool first = true;
t = str;
for ( s = getText().c_str(); *s; s++) {
if ( first) {
first = false;
continue;
}
if ( *s == '"' && *(s-1) == '\\')
t--;
*t = *s;
t++;
}
t--;
*t = 0;
string new_text(str);
setText(new_text);
break;
}
default:
;
}
......
......@@ -227,7 +227,7 @@ dcli_tCmdTable wnav_command_table[] = {
"/COMMAND", "/AFTER", "/BEFORE", "/FIRSTCHILD",
"/LASTCHILD", "/VOLUME", "/ALL",
"/CLASS", "/DEBUG", "/NODECONFIG",
"/NAME", "/IDENTITY", "/FILES", "/OUT",
"/NAME", "/IDENTITY", "/FILES", "/OUT", "/IGNORE",
""}
},
{
......@@ -3428,6 +3428,7 @@ static int wnav_create_func( void *client_data,
{
char filestr[80];
char outstr[80];
int ignore;
pwr_tStatus sts;
// Command is "CREATE SNAPSHOT"
......@@ -3444,6 +3445,8 @@ static int wnav_create_func( void *client_data,
return WNAV__QUAL;
}
ignore = ODD( dcli_get_qualifier( "/IGNORE", NULL));
sts = wnav_wccm_get_wbctx_cb( wnav, &wnav->wbctx);
if ( EVEN(sts)) return sts;
......@@ -3451,9 +3454,9 @@ static int wnav_create_func( void *client_data,
try {
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);
sts = wbl->load( filestr);
if ( ODD(sts) || ignore)
wbl->createSnapshot( outstr);
delete wbl;
}
catch ( wb_error &e) {
......
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