Commit 4709dc30 authored by claes's avatar claes

*** empty log message ***

parent a2237ffd
ifndef link_rule_mk
link_rule_mk := 1
......@@ -6,7 +7,7 @@ link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib\
-lpwr_wb -lpwr_ge -lpwr_rt -lpwr_co -lpwr_flow -lpwr_glow\
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp -ldb_cxx-4.0\
-lSM -lICE\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -lposix1b -lrt
endif
......@@ -536,12 +536,13 @@ void wb_erep::loadMeta( pwr_tStatus *status)
// Load db for this volume
strcpy( vname, "$pwrp_db/");
strcat( vname, vol_array[0]);
cdh_ToLower( vname, vname);
strcat( vname, ".db");
dcli_translate_filename( vname, vname);
wb_vrepdb *vrepdb = new wb_vrepdb( this, vname);
vrepdb->name(vol_array[0]);
addDbs( &sts, vrepdb);
addDb( &sts, vrepdb);
vol_cnt++;
}
}
......
......@@ -39,6 +39,9 @@ This module contains the API-routines to the Local Data Handler, LDH. */
#include "wb_volume.h"
#include "wb_error.h"
#include "wb_vrepmem.h"
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
#include "wb_db.h"
#include "wb_print_wbl.h"
#include "pwr_baseclasses.h"
#include <X11/Intrinsic.h>
......@@ -1383,9 +1386,13 @@ ldh_SyntaxCheck(ldh_tSession session, int *errorcount, int *warningcount)
pwr_tStatus
ldh_CopyObjectTrees(ldh_tSession session, pwr_sAttrRef *arp, pwr_tOid doid, ldh_eDest dest, pwr_tBoolean self)
{
//wb_session *sp = (wb_session*)session;
pwr_tStatus sts;
return LDH__NYI;
sts = ldh_Copy( session, arp, 0);
if (EVEN(sts)) return sts;
sts = ldh_Paste( session, doid, dest, 0, 0);
return sts;
}
......@@ -1456,15 +1463,15 @@ ldh_CreateLoadFile(ldh_tSession session)
}
pwr_tStatus
ldh_WbDump (
ldh_tSession session,
char *objname,
char *dumpfile
)
ldh_WbDump( ldh_tSession session, char *objname, char *dumpfile)
{
wb_session *sp = (wb_session*)session;
char fname[200];
if ( sp->type() == ldh_eVolRep_Wbl ||
sp->cid() == pwr_eClass_ClassVolume)
return LDH__NYI;
dcli_translate_filename( fname, dumpfile);
ofstream fp( fname);
if ( !fp) return LDH__FILEOPEN;
......@@ -1484,6 +1491,73 @@ ldh_WbDump (
return LDH__SUCCESS;
}
pwr_tStatus
ldh_WbLoad( ldh_tSession session, char *loadfile)
{
wb_session *sp = (wb_session*)session;
wb_erep *erep = sp->env();
char fname[200];
char db_name[200];
char vname[32];
if ( strstr( loadfile, ".dbs")) {
// Load vrepdbs
try {
dcli_translate_filename( fname, loadfile);
wb_vrepdbs *vdbs = new wb_vrepdbs( erep, fname);
vdbs->load();
wb_db db( vdbs->vid());
cdh_ToLower( vname, vdbs->name());
strcpy( db_name, "$pwrp_db/");
strcat( db_name, vname);
strcat( db_name, ".db");
dcli_translate_filename( db_name, db_name);
db.create( vdbs->vid(), vdbs->cid(), vdbs->name(), db_name);
db.importVolume( *vdbs);
db.close();
delete vdbs;
}
catch ( wb_error& e) {
return e.sts();
}
}
else if ( strstr( loadfile, ".wb_load") || strstr( loadfile, ".wb_dmp")) {
// load vrepwbl
try {
dcli_translate_filename( fname, loadfile);
wb_vrepwbl *vwbl = new wb_vrepwbl( erep);
vwbl->load( fname);
wb_db db( vwbl->vid());
cdh_ToLower( vname, vwbl->name());
strcpy( db_name, "$pwrp_db/");
strcat( db_name, vname);
strcat( db_name, ".db");
dcli_translate_filename( db_name, db_name);
db.create( vwbl->vid(), vwbl->cid(), vwbl->name(), db_name);
db.importVolume( *vwbl);
db.close();
delete vwbl;
}
catch ( wb_error& e) {
return e.sts();
}
}
else
return LDH__NYI;
return LDH__SUCCESS;
}
ldh_eVolRep
ldh_VolRepType( ldh_tSession session)
{
return ((wb_session*)session)->type();
}
#endif
......
......@@ -63,6 +63,13 @@ typedef pwr_tStatus (*ldh_tSessionCb) (void *, ldh_sEvent *);
typedef union ldh_m_MenuFlags ldh_mMenuFlags;
typedef enum {
ldh_eVolRep_Db,
ldh_eVolRep_Dbs,
ldh_eVolRep_Wbl,
ldh_eVolRep_Mem
} ldh_eVolRep;
typedef enum {
ldh_eAccess__ = 0,
ldh_eAccess_ReadOnly,
......@@ -442,11 +449,7 @@ pwr_tStatus ldh_CopyObject (
pwr_tStatus ldh_CopyObjectTrees (
ldh_tSession Session,
#if 0 // def __cplusplus
pwr_sAttrRef (*AttrRef)[1],
#else
pwr_sAttrRef *AttrRef,
#endif
pwr_tObjid destobject,
ldh_eDest dest,
pwr_tBoolean Self
......@@ -956,11 +959,22 @@ ldh_CreateLoadFile(
pwr_tStatus
ldh_WbDump(
ldh_tSesContext ldhses,
ldh_tSession session,
char *objname,
char *dumpfile
);
pwr_tStatus
ldh_WbLoad(
ldh_tSession session,
char *loadfile
);
ldh_eVolRep
ldh_VolRepType(
ldh_tSession session
);
#ifdef __cplusplus
}
#endif
......
......@@ -43,6 +43,7 @@ public:
pwr_tVid vid() const { return m_vrep->vid();}
pwr_tCid cid() const { return m_vrep->cid();}
const char *name() const { return m_vrep->name();}
ldh_eVolRep type() const { return m_vrep->type();}
wb_volume next() const;
......
......@@ -43,6 +43,7 @@ public:
virtual void unref() = 0;
virtual wb_vrep *ref() = 0;
virtual ldh_eVolRep type() const = 0;
virtual wb_erep *erep() = 0;
virtual wb_vrep *next() = 0;
......
......@@ -42,7 +42,9 @@ wb_erep *wb_vrepdb::erep()
wb_vrep *wb_vrepdb::next()
{
return 0;
pwr_tStatus sts;
return m_erep->nextVolume( &sts, m_db->vid());
}
wb_merep *wb_vrepdb::merep() const
......
......@@ -27,6 +27,7 @@ public:
virtual void unref();
virtual wb_vrep *ref();
virtual ldh_eVolRep type() const { return ldh_eVolRep_Db;}
virtual wb_erep *erep();
virtual wb_merep *merep() const;
......
......@@ -30,6 +30,7 @@ public:
virtual void unref();
virtual wb_vrep *ref();
virtual ldh_eVolRep type() const { return ldh_eVolRep_Dbs;}
virtual wb_erep *erep() ;
virtual pwr_tOid oid(pwr_tStatus *sts, const wb_orep *o) { return pwr_cNOid;}
......
......@@ -117,6 +117,7 @@ public:
wb_vrepmem( wb_erep *erep, pwr_tVid vid);
~wb_vrepmem();
virtual ldh_eVolRep type() const { return ldh_eVolRep_Mem;}
pwr_tVid vid() const { return m_vid;}
pwr_tCid cid() const { return m_cid;}
......
......@@ -42,6 +42,7 @@ public:
wb_vrep(vid), m_erep(erep), m_merep(erep->merep()), m_nRef(0), root_object(0),error_cnt(0), file_cnt(0), next_oix(0), volume_node(0) {}
~wb_vrepwbl();
virtual ldh_eVolRep type() const { return ldh_eVolRep_Wbl;}
pwr_tVid vid() const { return m_vid;}
pwr_tCid cid() const { return m_cid;}
......
......@@ -1761,7 +1761,7 @@ static int wnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
0, classid, ((WItemObject *)item)->objid,
destcode);
if (EVEN(sts))
wnav->message('E', wnav_get_message(sts));
wnav->message(' ', wnav_get_message(sts));
break;
default:
;
......@@ -1772,7 +1772,7 @@ static int wnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
sts = ldh_CreateObject( wnav->ldhses, &objid,
0, classid, pwr_cNObjid, ldh_eDest_IntoLast);
if (EVEN(sts))
wnav->message('E', wnav_get_message(sts));
wnav->message(' ', wnav_get_message(sts));
}
}
else
......@@ -1794,7 +1794,7 @@ static int wnav_brow_cb( FlowCtx *ctx, flow_tEvent event)
sts = ldh_MoveObject( wnav->ldhses, sel_list->Objid,
item->objid, destcode);
if ( EVEN(sts)) {
wnav->message('E', wnav_get_message(sts));
wnav->message(' ', wnav_get_message(sts));
return sts;
}
// Unselect moved object
......
......@@ -273,7 +273,7 @@ dcli_tCmdTable wnav_command_table[] = {
{
"WB",
&wnav_wb_func,
{ "dcli_arg1", "/OUTPUT", "/HIERARCHY",
{ "dcli_arg1", "/OUTPUT", "/HIERARCHY", "/LOADFILE",
""}
},
{
......@@ -3916,8 +3916,19 @@ static int wnav_wb_func( void *client_data,
}
else if ( strncmp( arg1_str, "LOAD", strlen( arg1_str)) == 0)
{
wnav->message('E', "Not yet implemented");
return LDH__NYI;
pwr_tStatus sts;
char loadfilestr[80];
if ( EVEN( dcli_get_qualifier( "/LOADFILE" , loadfilestr)))
{
wnav->message('E', "Qualifer required");
return WNAV__QUAL;
}
sts = ldh_WbLoad( wnav->ldhses, loadfilestr);
if ( EVEN(sts))
wnav->message(' ', wnav_get_message(sts));
return sts;
}
else
{
......
......@@ -295,6 +295,9 @@ void Wtt::menu_setup()
XtSetValues( menu_utilities_w, sensitive, 1);
XtSetValues( menu_openplc_w, sensitive, 1);
XtSetValues( menu_compile_w, sensitive, 1);
if ( ldh_VolRepType( ldhses) == ldh_eVolRep_Dbs)
XtSetValues( menu_createload_w, nosensitive, 1);
else
XtSetValues( menu_createload_w, sensitive, 1);
XtSetValues( menu_createboot_w, sensitive, 1);
XtSetValues( menu_distribute_w, sensitive, 1);
......@@ -333,6 +336,9 @@ void Wtt::menu_setup()
XtSetValues( menu_utilities_w, sensitive, 1);
XtSetValues( menu_openplc_w, nosensitive, 1);
XtSetValues( menu_compile_w, nosensitive, 1);
if ( ldh_VolRepType( ldhses) == ldh_eVolRep_Dbs)
XtSetValues( menu_createload_w, nosensitive, 1);
else
XtSetValues( menu_createload_w, sensitive, 1);
XtSetValues( menu_createboot_w, sensitive, 1);
XtSetValues( menu_distribute_w, sensitive, 1);
......
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