Commit 9fe4f874 authored by Claes Sjofors's avatar Claes Sjofors

Wb generation of size optimized loadfile for runtime

parent 49db4250
#!/bin/bash
source $pwre_bin/pwre_function
targetdir=$pwre_broot/$pwre_os/$pwre_hw/exp/rtload
if [ ! -e $targetdir ]; then
mkdir $targetdir
fi
pwre module
target="$targetdir/pwrs.dbs"
wb_cmd -q -i create snapshot /rtonly /file=\"$pwre_sroot/wbl/pwrs/src/\"/out=\"$target\"
target="$targetdir/pwrb.dbs"
wb_cmd -q -i create snapshot /rtonly /file=\"$pwre_sroot/wbl/pwrb/src/\"/out=\"$target\"
target="$targetdir/rt.dbs"
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/rt/src/rt.wb_load\"/out=\"$target\"
pwre merge
pwre module nmps
target="$targetdir/nmps.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/nmps/src/\"/out=\"$target\"
pwre merge
pwre module remote
target="$targetdir/remote.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/remote/src/\"/out=\"$target\"
pwre merge
pwre module tlog
target="$targetdir/tlog.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/tlog/src/\"/out=\"$target\"
pwre merge
pwre module profibus
target="$targetdir/profibus.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/profibus.wb_load\"/out=\"$target\"
pwre merge
pwre module bcomp
target="$targetdir/basecomponent.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/bcomp/src/basecomponent.wb_load\"/out=\"$target\"
pwre merge
pwre module opc
target="$targetdir/opc.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/opc.wb_load\"/out=\"$target\"
pwre merge
pwre module ssabox
target="$targetdir/ssabox.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/ssabox.wb_load\"/out=\"$target\"
pwre merge
pwre module misc
target="$targetdir/miscellaneous.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/misc/src/miscellaneous.wb_load\"/out=\"$target\"
pwre merge
pwre module siemens
target="$targetdir/siemens.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/siemens.wb_load\"/out=\"$target\"
pwre merge
pwre module otherio
target="$targetdir/otherio.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/otherio.wb_load\"/out=\"$target\"
pwre merge
pwre module othermanu
target="$targetdir/othermanufacturer.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/othermanufacturer.wb_load\"/out=\"$target\"
pwre merge
pwre module abb
target="$targetdir/abb.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/abb.wb_load\"/out=\"$target\"
pwre merge
pwre module inor
target="$targetdir/inor.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/inor.wb_load\"/out=\"$target\"
pwre merge
pwre module klocknermoeller
target="$targetdir/klocknermoeller.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/klocknermoeller.wb_load\"/out=\"$target\"
pwre merge
pwre module telemecanique
target="$targetdir/opc.dbs"
export pwr_load=$pwr_eload
wb_cmd -i -q create snapshot /rtonly /file=\"$pwre_sroot/wbl/mcomp/src/telemecanique.wb_load\"/out=\"$target\"
pwre merge
......@@ -64,7 +64,7 @@
static int comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y);
wb_dbs::wb_dbs(wb_vrep *v) :
m_oid(pwr_cNOid), m_warnings(0), m_errors(0),
m_oid(pwr_cNOid), m_rtonly(0), m_warnings(0), m_errors(0),
m_nObjects(0), m_nTreeObjects(0), m_nClassObjects(0),
m_nNameObjects(0), m_nRbodyObjects(0), m_nDbodyObjects(0), m_oep(0)
{
......@@ -396,11 +396,13 @@ wb_dbs::createFile()
size += m_sect[dbs_eSect_rbody].size;
m_sect[dbs_eSect_dbody].offset = size;
sts = writeSectDbody();
if (EVEN(sts)) goto error_handler;
// if ( !m_rtonly) {
sts = writeSectDbody();
if (EVEN(sts)) goto error_handler;
size += m_sect[dbs_eSect_dbody].size;
m_sect[dbs_eSect_object].offset = size;
size += m_sect[dbs_eSect_dbody].size;
m_sect[dbs_eSect_object].offset = size;
// }
sts = writeSectObject();
if (EVEN(sts)) goto error_handler;
......@@ -428,8 +430,10 @@ wb_dbs::createFile()
sts = writeSectVolref(size);
if (EVEN(sts)) goto error_handler;
sts = writeReferencedVolumes();
if (EVEN(sts)) goto error_handler;
if ( !m_rtonly) {
sts = writeReferencedVolumes();
if (EVEN(sts)) goto error_handler;
}
sts = closeFile(0);
if (EVEN(sts)) goto error_handler;
......
......@@ -118,6 +118,7 @@ public:
pwr_tOid m_oid;
pwr_tUInt32 m_dvVersion;
dbs_sSect m_sect[dbs_eSect_]; /**< section header */
int m_rtonly;
unsigned int m_warnings;
unsigned int m_errors;
......@@ -149,6 +150,7 @@ public:
void setFileName(const char *name);
void setTime(const pwr_tTime t);
void setRtonly( const int rtonly) { m_rtonly = rtonly;}
void getAliasServer(sOentry *oep, void *p);
char *pathName(sOentry *oep);
......
......@@ -193,7 +193,7 @@ ldh_CreatVolumeSnapshot(ldh_tWorkbench workbench, char *name, ldh_tVolume *volum
//wb_env *wb = (wb_env *)workbench;
wb_volume *v = (wb_volume *)volume;
v->createSnapshot(name, 0);
v->createSnapshot(name, 0, 0);
return LDH__SUCCESS;
}
......@@ -1862,7 +1862,7 @@ ldh_CreateLoadFile(ldh_tSession session)
wb_session *sp = (wb_session*)session;
try {
sp->createSnapshot( 0, 0);
sp->createSnapshot( 0, 0, 0);
}
catch (wb_error& e) {
return e.sts();
......
......@@ -115,8 +115,8 @@ public:
bool isLocal(wb_object &o) const;
bool createSnapshot(const char *fileName, const pwr_tTime *time)
{ return m_vrep->createSnapshot(fileName, time);}
bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly)
{ return m_vrep->createSnapshot(fileName, time, rtonly);}
bool exportTree( wb_volume &import, pwr_tOid oid);
pwr_tStatus syntaxCheck( int *errorcount, int *warningcount);
......
......@@ -171,7 +171,7 @@ public:
virtual const char *name() { return m_name;}
virtual wb_merep *merep() const = 0;
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time) = 0;
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly) = 0;
virtual pwr_tStatus updateMeta() { return 0;};
virtual void objectName(const wb_orep *o, char *str) = 0;
......
......@@ -287,9 +287,9 @@ bool wb_vrepced::writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
return m_vrep->writeBody( sts, o, bix, p);
}
bool wb_vrepced::createSnapshot(const char *fileName, const pwr_tTime *time)
bool wb_vrepced::createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly)
{
return m_vrep->createSnapshot( fileName, time);
return m_vrep->createSnapshot( fileName, time, rtonly);
}
bool wb_vrepced::commit(pwr_tStatus *sts)
......@@ -360,7 +360,7 @@ bool wb_vrepced::commit(pwr_tStatus *sts)
printStructFile( true);
printPaletteFile();
createSnapshot( 0, 0);
createSnapshot( 0, 0, 0);
// Replace new dbs-file in global merep
wb_mvrep *mv = m_erep->merep()->volume( sts, m_vrep->vid());
......@@ -414,7 +414,7 @@ bool wb_vrepced::commit(pwr_tStatus *sts)
// Create new dbs with new templatevalues
m_vrep->commit( sts);
createSnapshot( 0, 0);
createSnapshot( 0, 0, 0);
// Replace new dbs-file in global merep
mv = m_erep->merep()->volume( sts, m_vrep->vid());
......
......@@ -76,7 +76,7 @@ public:
wb_vrep *next() { return m_vrep->next();}
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly);
virtual pwr_tStatus updateMeta() { return m_vrep->updateMeta();}
virtual void unref();
......
......@@ -227,7 +227,7 @@ bool wb_vrepdb::isLocal(const wb_orep *o)
return false;
}
bool wb_vrepdb::createSnapshot(const char *fileName, const pwr_tTime *time)
bool wb_vrepdb::createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly)
{
try {
wb_dbs dbs(this);
......
......@@ -202,7 +202,7 @@ public:
virtual bool isLocal(const wb_orep *o);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly);
virtual void objectName(const wb_orep *o, char *str);
......
......@@ -230,7 +230,7 @@ bool wb_vrepdbms::isLocal(const wb_orep *o)
return false;
}
bool wb_vrepdbms::createSnapshot(const char *fileName, const pwr_tTime *time)
bool wb_vrepdbms::createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly)
{
try {
wb_dbs dbs(this);
......
......@@ -203,7 +203,7 @@ public:
virtual bool isLocal(const wb_orep *o);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly);
virtual void objectName(const wb_orep *o, char *str);
......
......@@ -567,7 +567,7 @@ wb_merep *wb_vrepdbs::merep() const
return m_merep;
}
bool wb_vrepdbs::createSnapshot(const char *, const pwr_tTime *)
bool wb_vrepdbs::createSnapshot(const char *, const pwr_tTime *, const int rtonly)
{
return false;
}
......
......@@ -165,7 +165,7 @@ public:
virtual bool isLocal (const wb_orep *);
virtual pwr_tCid cid () const;
virtual wb_merep *merep () const;
virtual bool createSnapshot (const char *, const pwr_tTime *);
virtual bool createSnapshot (const char *, const pwr_tTime *, const int);
virtual pwr_tStatus updateMeta() {return 0;}
virtual bool isCommonMeta() const { return false;}
......
......@@ -180,7 +180,7 @@ public:
wb_vrep *next();
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time) { return false;}
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly) { return false;}
virtual pwr_tStatus updateMeta() { return 0;}
char volume_class[32];
......
......@@ -218,7 +218,7 @@ void wb_vrepmem::info()
}
bool
wb_vrepmem::createSnapshot(const char *fileName, const pwr_tTime *time)
wb_vrepmem::createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly)
{
try {
wb_dbs dbs(this);
......
......@@ -267,7 +267,7 @@ public:
wb_vrep *next();
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly);
virtual pwr_tStatus updateMeta() {return 0;}
char volume_class[32];
......
......@@ -93,7 +93,7 @@ public:
wb_erep *erep() {return m_erep;}
wb_merep *merep() const { return m_merep;}
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time) { return false;}
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly) { return false;}
virtual pwr_tStatus updateMeta() {return 0;}
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;}
......
......@@ -144,7 +144,7 @@ void wb_vrepwbl::info()
}
bool
wb_vrepwbl::createSnapshot(const char *fileName, const pwr_tTime *time)
wb_vrepwbl::createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly)
{
try {
wb_dbs dbs(this);
......@@ -153,6 +153,7 @@ wb_vrepwbl::createSnapshot(const char *fileName, const pwr_tTime *time)
dbs.setFileName( fileName);
if ( time)
dbs.setTime( *time);
dbs.setRtonly( rtonly);
dbs.importVolume(*this);
......
......@@ -84,7 +84,7 @@ public:
wb_vrep *next();
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time);
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time, const int rtonly);
virtual pwr_tStatus updateMeta() {return 0;}
int load( const char *fname);
......
......@@ -292,7 +292,7 @@ dcli_tCmdTable wnav_command_table[] = {
"/NAME", "/IDENTITY", "/FILES", "/OUT", "/IGNORE",
"/DIRECTORY", "/DATABASE", "/SERVER",
"/PLCPGM", "/HIERARCHY", "/FROM_PLCPGM", "/TEMPLATE",
"/SIMULATION", ""}
"/SIMULATION", "/RTONLY", ""}
},
{
"NEW",
......@@ -4035,6 +4035,7 @@ static int wnav_create_func( void *client_data,
pwr_tFileName outstr;
char *outstr_p;
int ignore;
int rtonly;
pwr_tStatus sts;
pwr_tTime buildtime, *timep;
char *s;
......@@ -4053,6 +4054,7 @@ static int wnav_create_func( void *client_data,
outstr_p = 0;
ignore = ODD( dcli_get_qualifier( "/IGNORE", 0, 0));
rtonly = ODD( dcli_get_qualifier( "/RTONLY", 0, 0));
if ( (s = getenv( "PWRE_CONF_BUILDVERSION"))) {
if ( strcmp( s, "") == 0 ||
......@@ -4079,7 +4081,7 @@ static int wnav_create_func( void *client_data,
wbl->ref();
sts = wbl->load( filestr);
if ( ODD(sts) || ignore)
wbl->createSnapshot( outstr_p, timep);
wbl->createSnapshot( outstr_p, timep, rtonly);
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