Commit 2171c166 authored by lw's avatar lw

Added update of classes in a volume database

parent f661868f
/*
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.4 2006-04-12 12:17:45 claes Exp $
* Proview $Id: wb_c_pb_dp_slave.cpp,v 1.5 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -39,14 +39,12 @@
#include "flow_browctx.h"
#include "flow_browapi.h"
extern "C" {
#include "pwr.h"
#include "co_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_wow.h"
#include "wb_nav_macros.h"
}
#include "rt_pb_gsd.h"
#include "rt_pb_gsd_attr.h"
......@@ -62,8 +60,6 @@ extern "C" {
using namespace std;
// #include "wb_api.h"
/*----------------------------------------------------------------------------*\
Configure the slave from gsd file.
......
/*
* Proview $Id: pwr.h,v 1.23 2006-04-28 04:59:58 claes Exp $
* Proview $Id: pwr.h,v 1.24 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -46,6 +46,10 @@
/*! \addtogroup Pwr */
/*@{*/
#if defined __cplusplus
extern "C" {
#endif
#ifdef VAXC
# define pwr_dExport globaldef
# define pwr_dImport globalref
......@@ -679,6 +683,9 @@ static const pwr_tDeltaTime pwr_cNDeltaTime = {0, 0}; //!< Zero deltatime consta
/*@}*/
#if defined __cplusplus
}
#endif
#endif
/*
* Proview $Id: pwr_class.h,v 1.21 2006-04-05 08:41:34 claes Exp $
* Proview $Id: pwr_class.h,v 1.22 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -23,14 +23,14 @@
/* pwr_class.h -- system classes
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef pwr_h
#include "pwr.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define PWR_BREAKPOINTS_MAX 10
#define PWR_OBJTYPES_MAX 300
......
/**
* Proview $Id: co_dbs.c,v 1.25 2005-12-15 07:41:17 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: co_dbs.c,v 1.26 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -34,6 +34,7 @@
#include "pwr.h"
#include "co_dbs.h"
#include "co_time.h"
#include "co_dbs_msg.h"
#include "co_errno.h"
#include "co_platform.h"
......@@ -402,7 +403,6 @@ dbs_Reference(pwr_tStatus *sts, const dbs_sVenv *vep, void *adrs)
{
long iadrs = (long)adrs;
long ofs;
//long base = ep->sect[]
if (iadrs < (long)vep->base)
return dbs_cNref;
......@@ -423,7 +423,6 @@ dbs_Map(pwr_tStatus *sts, const char *filename)
int tfd;
int i;
dbs_sSect *sect;
//dbs_sFile file;
void *base = 0;
int nVolRef;
dbs_sVolRef *vrp;
......@@ -436,13 +435,11 @@ dbs_Map(pwr_tStatus *sts, const char *filename)
if ((ret = stat(filename, &sb)) != 0) {
*sts = errno_GetStatus();
// perror("stat");
return NULL;
}
fd = open(filename, O_RDWR);
tfd = mkstemp(tfname);
//printf("dbs_Map:: %s -> %s\n", filename, tfname);
while (1) {
int count;
......@@ -457,10 +454,6 @@ dbs_Map(pwr_tStatus *sts, const char *filename)
errno = 0;
//ret = read(fd, &file, sizeof(file));
// printf("st_size...: %ld\n", sb.st_size);
// printf("size......: %d\n", file.size);
base = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, tfd, 0);
if (base == NULL) {
*sts = errno_GetStatus();
......@@ -584,8 +577,6 @@ dbs_Split(pwr_tStatus *sts, dbs_sMenv *mep, char *dirName)
fclose(fp);
for (j = 0; j < n; j++, vrp++) {
//vrp->offset = offset;
printf(" %s, size %d, offset %d\n", vrp->name, vrp->size, offset);
offset += vrp->size;
}
}
......
/**
* Proview $Id: co_regex.h,v 1.2 2005-09-01 14:57:52 claes Exp $
* Proview $Id: co_regex.h,v 1.3 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -22,6 +22,10 @@
#include <stddef.h>
#if defined __cplusplus
extern "C" {
#endif
typedef struct regex {
char *buffer;
long allocated;
......@@ -98,4 +102,8 @@ void regfree(regex_t *preg);
char *regerror(int errcode);
#if defined __cplusplus
}
#endif
# endif
/**
* Proview $Id: co_time.c,v 1.9 2006-05-02 07:06:53 claes Exp $
* Proview $Id: co_time.c,v 1.10 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -644,6 +644,8 @@ time_TmToAscii (
buf[i] = toupper(buf[i]);
} else if (format == time_eFormat_ComprDateAndTime) {
strftime(buf, bufsize, "%y-%m-%d %H:%M:%S", tmptr);
} else if (format == time_eFormat_NumDateAndTime) {
strftime(buf, bufsize, "%Y-%m-%d %H:%M:%S", tmptr);
} else {
strftime(buf, bufsize, "%H:%M:%S", tmptr);
}
......
/**
* Proview $Id: co_time.h,v 1.6 2006-01-13 06:41:20 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: co_time.h,v 1.7 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -63,7 +63,8 @@ typedef unsigned int time_tClock;
typedef enum {
time_eFormat_DateAndTime = 0, //!< Display date and time, 01-JAN-1970 01:00:00.00
time_eFormat_Time = 1, //!< Display time only 01:00:00.00
time_eFormat_ComprDateAndTime = 2 //!< Date and time compressed format, 70-01-01 00:00:00
time_eFormat_ComprDateAndTime = 2, //!< Date and time compressed format, 70-01-01 00:00:00
time_eFormat_NumDateAndTime = 3 //!< Date and time format, 2005-01-01 00:00:00
} time_eFormat;
#define SWE 0
......
/**
* Proview $Id: co_wow.h,v 1.9 2006-02-15 14:19:18 claes Exp $
* Proview $Id: co_wow.h,v 1.10 2006-05-21 22:30:49 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -104,10 +104,3 @@ void wow_DisplayLicense( Widget father);
#endif
#endif
......@@ -215,15 +215,15 @@ sub build_all_modules ()
merge();
_module("tlog");
build_all();
merge();
_module("remote");
build_all();
# merge();
# _module("remote");
# build_all();
merge();
_module("bcomp");
build_all();
merge();
_module("java");
build_all();
# merge();
# _module("java");
# build_all();
merge();
_module("profibus");
build_all();
......
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_objs) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o $(pwr_obj)/wb_provider.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib\
ifeq ($(export_type),exp)
link = $(ldxx) $(explinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_provider.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/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\
-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -lrt
-lrpcsvc -lpthread -lm -ldb_cxx -lz
else
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_eobjs) $(rt_msg_eobjs) \
$(pwr_eobj)/rt_io_user.o $(pwr_obj)/wb_provider.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
-L/opt/gnome/lib \
-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx -lz
endif
endif
/*
* Proview $Id: wb_wbltest.cpp,v 1.10 2005-09-01 14:57:49 claes Exp $
* Proview $Id: wb_wbltest.cpp,v 1.11 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -37,12 +37,18 @@
#include "co_dbs.h"
#include "co_time.h"
#if 0
#if 1
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello world\n");
}
#elif 0
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main( int argc, char *argv[])
int main(int argc, char *argv[])
{
struct stat sb;
int ret;
......@@ -71,82 +77,21 @@ int main( int argc, char *argv[])
#elif 0
int main( int argc, char *argv[])
{
int a;
int b;
int i;
int c;
for (i = 0; i < 100; i++) {
if (i % 3 == 0) {
a = rand() % 101;
b = rand() % 101;
printf("[%d] vad blir %d + %d = ", i + 1, a, b);
scanf("%d", &c);
if (c == a + b) {
printf("\nKorrekt!\n");
} else {
printf("Fel\007! Det blir: %d\n", a + b);
}
}
else if (i % 3 == 1) {
int tmp;
a = rand() % 101;
b = rand() % 101;
if (a < b) {
tmp = b;
b = a;
a = tmp;
}
//pwr_tStatus sts;
//dbs_sEnv env;
//dbs_sEnv *ep;
wb_erep *erep = new wb_erep();
printf("[%d] vad blir %d - %d = ", i + 1, a, b);
scanf("%d", &c);
//if (argc <= 2) exit(0);
wb_vrepwbl *vwbl = new wb_vrepwbl(erep);
vwbl->info();
vwbl->load("cvolvhxnu4.wb_load");
vwbl->createSnapshot("cvolvhxnu4.dbs");
if (c == a - b) {
printf("\nKorrekt!\n");
} else {
printf("Fel\007! Det blir %d\n", a - b);
}
}
else if (i % 3 == 2) {
a = rand() % 11;
b = rand() % 11;
printf("[%d] vad blir %d * %d = ", i + 1, a, b);
scanf("%d", &c);
if (c == a * b) {
printf("\nKorrekt!\n");
} else {
printf("Fel\007! Det blir %d\n", a * b);
}
}
}
}
#elif 0
int main( int argc, char *argv[])
{
char namn[50];
char bnamn[50];
int len;
printf("Vad heter du? ");
scanf("%s", namn);
len = strlen(namn);
for (int i = 0; i < len; i++) {
bnamn[len - i -1] = namn[i];
}
bnamn[len+1] = '\0';
printf("\nDitt namn baklnges r: %s\n", bnamn);
}
#elif 1
int main( int argc, char *argv[])
{
//pwr_tStatus sts;
//dbs_sEnv env;
......
/*
* Proview $Id: wb.h,v 1.10 2006-03-31 14:24:34 claes Exp $
* Proview $Id: wb.h,v 1.11 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -22,8 +22,8 @@
/* wb.h -- work bench */
#ifndef pwr_h
#include "pwr.h"
#if defined __cplusplus
extern "C" {
#endif
#define WB_CLASS_NAME "PWR_DEV"
......@@ -47,6 +47,9 @@ typedef enum {
wb_eUtility_WNav = 1005
} wb_eUtility;
#if defined __cplusplus
}
#endif
#endif
......
/*
* Proview $Id: wb_api.h,v 1.7 2006-03-31 14:24:34 claes Exp $
* Proview $Id: wb_api.h,v 1.8 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -26,20 +26,6 @@
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef wb_ldh_h
# include "wb_ldh.h"
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browapi.h"
#endif
#ifndef co_wow_h
#include "co_wow.h"
#endif
......
/*
* Proview $Id: wb_c_xttgraph.cpp,v 1.2 2006-04-24 13:22:24 claes Exp $
* Proview $Id: wb_c_xttgraph.cpp,v 1.3 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -22,17 +22,7 @@
using namespace std;
#include <X11/Intrinsic.h>
#undef Status
#include "wb_pwrs.h"
#include "pwr_baseclasses.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "ge.h"
#include "wb_pwrb_msg.h"
#include "wb_wsx.h"
#include "wb_wsx_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
//#undef Status
#include <Xm/Xm.h>
#include <Xm/XmP.h>
......@@ -41,13 +31,10 @@ using namespace std;
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget.h"
#include "wb_wtt.h"
#include "ge.h"
#include "wb_wnav.h"
#include "wb_pwrb_msg.h"
#include "wb_build.h"
#include "co_msgwindow.h"
/*----------------------------------------------------------------------------*\
......
/*
* Proview $Id: wb_cdrep.cpp,v 1.30 2006-02-01 07:36:23 claes Exp $
* Proview $Id: wb_cdrep.cpp,v 1.31 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -581,7 +581,8 @@ void wb_cdrep::convertObject( wb_merep *merep, void *rbody, void *dbody,
{
pwr_tStatus sts;
wb_cdrep *cdrep_source = merep->cdrep( &sts, cid());
if ( EVEN(sts)) throw wb_error(sts);
if ( EVEN(sts))
throw wb_error(sts);
for ( int i = 0; i < 2; i++) {
int size_target, size_source;
......
/*
* Proview $Id: wb_db.cpp,v 1.33 2006-02-08 08:37:49 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_db.cpp,v 1.34 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -32,7 +32,7 @@
#include "wb_db.h"
#include "wb_name.h"
#include "wb_export.h"
#include "wb_convert_volume.h"
static void printstat(DbEnv *ep, char *s);
......@@ -126,6 +126,27 @@ bool wb_db_class::succ(pwr_tOid oid)
// return false;
}
bool wb_db_class::succClass(pwr_tCid cid)
{
m_k.cid = cid + 1;
m_k.oid = pwr_cNOid;
if (m_dbc)
m_dbc->close();
m_db->m_t_class->cursor(m_db->m_txn, &m_dbc, 0);
int ret = m_dbc->get(&m_key, &m_data, DB_SET_RANGE);
m_dbc->close();
m_dbc = 0;
if ( ret == 0) {
void **data = (void **) &m_key; // A trick to get m_key.data which has the new key
memcpy( &m_k, *data, sizeof(m_k));
}
return ret == 0;
// return false;
}
bool wb_db_class::pred(pwr_tOid oid)
{
m_k.oid = oid;
......@@ -156,25 +177,43 @@ void wb_db_class::iter(void (*print)(pwr_tOid oid, pwr_tCid cid))
/* Initialize the key/data pair so the flags aren't set. */
memset(&m_k, 0, sizeof(m_k));
//printf("sizeof(m_k): %d\n", sizeof(m_k));
m_key.set_data(&m_k);
m_key.set_ulen(sizeof(m_k));
m_key.set_flags(DB_DBT_USERMEM);
/* Walk through the database and print out the key/data pairs. */
//int rc = m_dbc->get(&m_key, &m_data, DB_FIRST);
while ((rc = m_dbc->get(&m_key, &m_data, DB_NEXT)) == 0) {
//printf("k: %d, d: %d\n", (int)m_key.get_size(), (int)m_data.get_size());
//volatile int a = m_key.get_size();
//a = m_data.get_size();
print(m_k.oid, m_k.cid);
}
m_dbc->close();
}
void wb_db_class::iter(wb_convert_volume *cp)
{
int rc = 0;
m_db->m_t_class->cursor(m_db->m_txn, &m_dbc, 0);
/* Initialize the key/data pair so the flags aren't set. */
memset(&m_k, 0, sizeof(m_k));
m_key.set_data(&m_k);
m_key.set_ulen(sizeof(m_k));
m_key.set_flags(DB_DBT_USERMEM);
/* Walk through the database and print out the key/data pairs. */
while ((rc = m_dbc->get(&m_key, &m_data, DB_NEXT)) == 0) {
if (cp->m_update)
cp->updateObject(m_k.oid, m_k.cid);
else
cp->checkObject(m_k.oid, m_k.cid);
}
m_dbc->close();
m_dbc = 0;
}
wb_db_class::~wb_db_class()
......@@ -356,7 +395,6 @@ wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
m_o.body[0].size = rbSize;
m_o.body[1].time = dbTime;
m_o.body[1].size = dbSize;
}
......@@ -767,7 +805,6 @@ void wb_db::copy(wb_export &e, const char *fileName)
//int rc = m_env->txn_begin(0, (DbTxn **)&m_txn, 0);
openDb(false);
importVolume(e);
close();
openDb(true);
......@@ -1211,7 +1248,6 @@ bool wb_db::deleteOset(pwr_tStatus *sts, wb_oset *o)
bool wb_db::importVolume(wb_export &e)
{
// pwr_tStatus sts;
try {
// m_env->txn_begin(0, (DbTxn **)&m_txn, 0);
// m_txn = 0;
......
/*
* Proview $Id: wb_db.h,v 1.19 2005-09-06 10:43:31 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_db.h,v 1.20 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -23,8 +23,11 @@
#include "pwr.h"
#include "db_cxx.h"
#include "wb_import.h"
#include "wb_convert_volume.h"
class wb_name;
class wb_convert_volume;
typedef struct {
pwr_tOid oid; /**< object identifier */
......@@ -120,6 +123,7 @@ public:
bool importMeta(dbs_sMenv *mep);
void checkClassList(pwr_tOid oid, pwr_tCid cid, bool update);
};
......@@ -295,6 +299,7 @@ public:
~wb_db_class();
bool succ(pwr_tOid oid);
bool succClass(pwr_tCid cid);
bool pred(pwr_tOid oid);
int put(wb_db_txn *txn);
int del(wb_db_txn *txn);
......@@ -303,7 +308,7 @@ public:
pwr_tOid oid() { return m_k.oid;}
void iter(void (*print)(pwr_tOid oid, pwr_tCid cid));
void iter(wb_convert_volume *cp);
};
class wb_db_dbody
......
This diff is collapsed.
/*
* Proview $Id: wb_erep.cpp,v 1.44 2006-02-08 13:53:57 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_erep.cpp,v 1.45 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -26,6 +26,7 @@
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
#include "wb_vrepdb.h"
#include "wb_vrepdbms.h"
#include "wb_vrepref.h"
#include "wb_vrepext.h"
#include "wb_cdrep.h"
......@@ -489,13 +490,15 @@ void wb_erep::loadCommonMeta( pwr_tStatus *status)
try {
vrep->load();
addDbs( &sts, vrep);
MsgWindow::message( 'I', "Volume loaded", vname);
char buff[256];
sprintf(buff, "Global class volume \"%s\" loaded from \"%s\"", vrep->dbsenv()->vp->name, vname);
MsgWindow::message( 'I', buff);
}
catch ( wb_error& e) {
if ( m_options & ldh_mWbOption_IgnoreDLoadError)
MsgWindow::message( 'I', "Unable to open volume", vname);
MsgWindow::message( 'I', "Unable to open class volume", vname);
else
MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
MsgWindow::message( 'E', "Unable to open class volume", vname, e.what().c_str());
}
}
fpm.close();
......@@ -533,7 +536,7 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
wb_vrepdb *vrepdb = new wb_vrepdb( this, vname);
vrepdb->name("directory");
addDb( &sts, vrepdb);
MsgWindow::message( 'I', "Database opened", vname);
MsgWindow::message( 'I', "Directory database opened", vname);
}
return;
......@@ -591,14 +594,14 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
vrep = new wb_vrepdbs( this, vname);
vrep->load();
addDbs( &sts, vrep);
MsgWindow::message( 'I', "Volume loaded", vname);
MsgWindow::message( 'I', "Volume loaded from snapshot file", vname);
vol_cnt++;
}
catch ( wb_error& e) {
if ( m_options & ldh_mWbOption_IgnoreDLoadError)
MsgWindow::message( 'I', "Unable to open volume", vname);
MsgWindow::message( 'I', "Unable to open volume snapshot file", vname);
else
MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
MsgWindow::message( 'E', "Unable to open volume snapshot file", vname, e.what().c_str());
}
}
else {
......@@ -616,13 +619,13 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
vrep->load();
// vrep->name( vol_array[0]);
addDbs( &sts, vrep);
MsgWindow::message( 'I', "Volume loaded", vname);
MsgWindow::message( 'I', "Volume loaded from snapshot file", vname);
}
catch ( wb_error& e) {
if ( m_options & ldh_mWbOption_IgnoreDLoadError)
MsgWindow::message( 'I', "Unable to open volume", vname);
MsgWindow::message( 'I', "Unable to open volume snapshot file", vname);
else
MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
MsgWindow::message( 'E', "Unable to open volume snapshot file", vname, e.what().c_str());
}
break;
}
......@@ -652,13 +655,13 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
vrep->load();
// vrep->name( vol_array[0]);
addDbs( &sts, vrep);
MsgWindow::message( 'I', "Volume loaded", vname);
MsgWindow::message( 'I', "Volume loaded from snapshot file", vname);
}
catch ( wb_error& e) {
if ( m_options & ldh_mWbOption_IgnoreDLoadError)
MsgWindow::message( 'I', "Unable to open volume", vname);
MsgWindow::message( 'I', "Unable to open volume snapshot file", vname);
else
MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
MsgWindow::message( 'E', "Unable to open volume snapshot file", vname, e.what().c_str());
}
}
continue;
......@@ -691,14 +694,14 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
vrep = new wb_vrepdbs( this, vname);
vrep->load();
addDbs( &sts, vrep);
MsgWindow::message( 'I', "Volume loaded", vname);
MsgWindow::message( 'I', "Volume loaded from snapshot file", vname);
vol_cnt++;
}
catch ( wb_error& e) {
if ( m_options & ldh_mWbOption_IgnoreDLoadError)
MsgWindow::message( 'I', "Unable to open volume", vname);
MsgWindow::message( 'I', "Unable to open volume snapshot file", vname);
else
MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
MsgWindow::message( 'E', "Unable to open volume snapshot file", vname, e.what().c_str());
}
}
else {
......@@ -755,6 +758,7 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
*status = LDH__PROJCONFIG;
else
*status = LDH__SUCCESS;
}
void wb_erep::loadLocalWb( pwr_tStatus *rsts)
......
/*
* Proview $Id: wb_ldh.cpp,v 1.54 2006-05-11 07:12:19 claes Exp $
* Proview $Id: wb_ldh.cpp,v 1.55 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1307,6 +1307,12 @@ ldh_ObjidToName(ldh_tSession session, pwr_tOid oid, int type, char *buf, int max
{
wb_session *sp = (wb_session *)session;
if (cdh_ObjidIsNull(oid)) {
strncpy( buf, cdh_ObjidToString( NULL, oid, 1), maxsize);
*size = strlen( buf);
return LDH__SUCCESS;
}
switch ( type) {
case ldh_eName_Object:
{
......
/*
* Proview $Id: wb_ldh.h,v 1.35 2006-04-26 04:46:10 claes Exp $
* Proview $Id: wb_ldh.h,v 1.36 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -96,7 +96,8 @@ typedef enum {
ldh_eVolRep_Wbl,
ldh_eVolRep_Mem,
ldh_eVolRep_Ref,
ldh_eVolRep_Ext
ldh_eVolRep_Ext,
ldh_eVolRep_Dbms
} ldh_eVolRep;
typedef enum {
......
/*
* Proview $Id: wb_merep.cpp,v 1.32 2005-10-07 05:57:29 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_merep.cpp,v 1.33 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -25,9 +25,16 @@
#include "wb_bdrep.h"
#include "wb_erep.h"
#include "wb_tdrep.h"
#include "wb_vrepdb.h"
#include "wb_attrname.h"
#include "wb_ldh_msg.h"
#include "co_time.h"
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#include "co_msgwindow.h"
static int compCatt( tree_sTable *tp, tree_sNode *x, tree_sNode *y);
......@@ -51,6 +58,63 @@ wb_merep::~wb_merep()
tree_DeleteTable( &sts, m_catt_tt);
}
wb_merep::wb_merep(const char *dirName, wb_erep *erep, wb_vrep *vrep) :
m_erep(erep), m_vrep(vrep), m_catt_tt(0)
{
DIR *dirp;
struct dirent *dp;
char *pos;
int ipos;
int ilen;
char fileName[255];
dirp = opendir(dirName);
while (dirp) {
errno = 0;
if ((dp = readdir(dirp)) != NULL) {
if ((pos = strstr(dp->d_name, ".dbs")) != 0) {
ipos = (int)(pos - dp->d_name);
ilen = strlen(dp->d_name);
if ((ilen - ipos) == (sizeof(".dbs") - 1)) {
dbs_sEnv env;
dbs_sVolume volume;
pwr_tStatus sts;
char vname[32];
sprintf(fileName, "%s/%s", dirName, dp->d_name);
dbs_sEnv *ep = dbs_Open(&sts, &env, fileName);
dbs_sVolume *vp = dbs_Volume(&sts, &volume, ep);
cdh_ToLower(vname, vp->name);
*rindex(dp->d_name, '.') = '\0';
cdh_ToLower(dp->d_name, dp->d_name);
dbs_Close(&sts, ep);
if (strcmp(dp->d_name, vname) == 0) {
try {
wb_vrepdbs *vrep = new wb_vrepdbs(erep, this, fileName, vp->name, vp->vid, vp->cid);
addDbs(&sts, (wb_mvrep *)vrep);
char buff[256];
sprintf(buff, "Local class volume \"%s\" loaded from \"%s\", in data base %s", vp->name, fileName, dirName);
MsgWindow::message( 'I', buff);
}
catch (wb_error& e) {
MsgWindow::message( 'E', "Unable to open local class volume", fileName, e.what().c_str());
}
}
}
}
} else {
if (errno == 0) {
closedir(dirp);
break;
}
closedir(dirp);
break;
}
}
}
// Get first volume
wb_mvrep *wb_merep::volume( pwr_tStatus *sts)
{
......@@ -87,18 +151,113 @@ wb_mvrep *wb_merep::volume(pwr_tStatus *sts, const char *name)
return 0;
}
void wb_merep:: copyFiles(const char *dirName)
void wb_merep::copyFiles(const char *dirName)
{
mvrep_iterator it;
for ( it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
wb_vrepdbs *dp = (wb_vrepdbs *)it->second;
char cmd[512];
sprintf(cmd, "cp %s %s", dp->fileName(), dirName);
// printf("%s\n", cmd);
system(cmd);
}
}
void wb_merep::copyFiles(const char *dirName, wb_merep *merep)
{
mvrep_iterator it;
for (it = merep->m_mvrepdbs.begin(); it != merep->m_mvrepdbs.end(); it++) {
wb_vrepdbs *e_dp = (wb_vrepdbs *)it->second;
mvrep_iterator i_it = m_mvrepdbs.find(e_dp->vid());
if (i_it == m_mvrepdbs.end()) {
char cmd[512];
sprintf(cmd, "cp %s %s", e_dp->fileName(), dirName);
system(cmd);
char buff[256];
char e_timbuf[32];
time_AtoAscii(&e_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, e_timbuf, sizeof(e_timbuf));
sprintf(buff, "Global class volume \"%s\" [%s](%s), was copied to data base \"%s\"",
e_dp->dbsenv()->vp->name, e_timbuf, e_dp->fileName(), dirName);
MsgWindow::message('I', buff);
continue;
} else {
wb_vrepdbs *i_dp = (wb_vrepdbs *)i_it->second;
if (time_Acomp(&i_dp->dbsenv()->vp->time, &e_dp->dbsenv()->vp->time) == 0)
continue;
char cmd[512];
sprintf(cmd, "cp %s %s", e_dp->fileName(), dirName);
system(cmd);
char buff[256];
char e_timbuf[32];
char i_timbuf[32];
time_AtoAscii(&i_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, i_timbuf, sizeof(i_timbuf));
time_AtoAscii(&e_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, e_timbuf, sizeof(e_timbuf));
sprintf(buff, "Local class volume \"%s\" [%s], in data base \"%s\", was updated [%s]",
i_dp->dbsenv()->vp->name, i_timbuf, dirName, e_timbuf);
MsgWindow::message('I', buff);
}
}
}
bool wb_merep::compareMeta(const char *dbName, wb_merep *merep)
{
mvrep_iterator it;
for (it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
wb_vrepdbs *i_dp = (wb_vrepdbs *)it->second;
char i_timbuf[32];
char e_timbuf[32];
char buff[256];
mvrep_iterator e_it = merep->m_mvrepdbs.find(i_dp->vid());
if (e_it == merep->m_mvrepdbs.end()) {
time_AtoAscii(&i_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, i_timbuf, sizeof(i_timbuf));
sprintf(buff, "Local class volume \"%s\" [%s] (%s), in data base \"%s\", does not exist in global scope",
i_dp->dbsenv()->vp->name, i_timbuf, i_dp->fileName(), dbName);
MsgWindow::message('W', buff);
continue;
}
wb_vrepdbs *e_dp = (wb_vrepdbs *)e_it->second;
if (time_Acomp(&i_dp->dbsenv()->vp->time, &e_dp->dbsenv()->vp->time) == 0)
continue;
time_AtoAscii(&i_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, i_timbuf, sizeof(i_timbuf));
time_AtoAscii(&e_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, e_timbuf, sizeof(e_timbuf));
sprintf(buff, "Local class volume \"%s\" [%s] (%s), in data base \"%s\", can be updated [%s]",
i_dp->dbsenv()->vp->name, i_timbuf, i_dp->fileName(), dbName, e_timbuf);
MsgWindow::message('W', buff);
}
for (it = merep->m_mvrepdbs.begin(); it != merep->m_mvrepdbs.end(); it++) {
wb_vrepdbs *e_dp = (wb_vrepdbs *)it->second;
mvrep_iterator i_it = m_mvrepdbs.find(e_dp->vid());
if (i_it == m_mvrepdbs.end()) {
char buff[256];
char e_timbuf[32];
time_AtoAscii(&e_dp->dbsenv()->vp->time, time_eFormat_NumDateAndTime, e_timbuf, sizeof(e_timbuf));
sprintf(buff, "Global class volume \"%s\" [%s], does not exist in data base \"%s\"", e_dp->dbsenv()->vp->name, e_timbuf, dbName);
MsgWindow::message('W', buff);
}
}
return true;
}
wb_orep *wb_merep::object(pwr_tStatus *sts, pwr_tOid oid)
{
wb_vrep *vrep = volume( sts, oid.vid);
......@@ -109,7 +268,6 @@ wb_orep *wb_merep::object(pwr_tStatus *sts, pwr_tOid oid)
void wb_merep::addDbs( pwr_tStatus *sts, wb_mvrep *mvrep)
{
// printf("wb_merep::addDbs: %d, %s\n", mvrep->vid(), mvrep->name());
mvrep_iterator it = m_mvrepdbs.find( mvrep->vid());
if ( it == m_mvrepdbs.end()) {
// Look for vrep in erep list... TODO
......@@ -120,7 +278,6 @@ void wb_merep::addDbs( pwr_tStatus *sts, wb_mvrep *mvrep)
*sts = LDH__SUCCESS;
}
else {
// printf("wb_merep::addDbs, existed: %d, %s\n", mvrep->vid(), mvrep->name());
*sts = LDH__VOLIDALREXI;
}
......@@ -141,9 +298,6 @@ void wb_merep::removeDbs(pwr_tStatus *sts, wb_mvrep *mvrep)
wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, const wb_orep& o)
{
// if ( m_erep && o.vrep() != m_vrep)
// Fetch from other meta environment
// return m_erep->cdrep( sts, o); ???
pwr_tVid vid = cdh_CidToVid(o.cid());
mvrep_iterator it = m_mvrepdbs.find( vid);
......@@ -645,9 +799,3 @@ void wb_merep::subClass( pwr_tCid supercid, pwr_tCid subcid, pwr_tCid *nextsubci
}
*sts = LDH__NONEXTCLASS;
}
/*
* Proview $Id: wb_merep.h,v 1.21 2005-10-07 05:57:29 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_merep.h,v 1.22 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -31,6 +31,7 @@ using namespace std;
class wb_vrep;
class wb_tdrep;
class wb_adrep;
class wb_vrepdb;
typedef struct {
pwr_tCid subCid; /**< Class Id for class attribute */
......@@ -62,12 +63,16 @@ public:
wb_merep( wb_erep *erep, wb_vrep *vrep = 0) :
m_erep(erep), m_vrep(vrep), m_catt_tt(0) {}
~wb_merep();
wb_merep(const char *dirname, wb_erep *erep, wb_vrep *vrep = 0);
wb_merep( const wb_merep& x, wb_vrep *vrep);
wb_mvrep *volume(pwr_tStatus *sts);
wb_mvrep *volume(pwr_tStatus *sts, pwr_tVid vid);
wb_mvrep *volume(pwr_tStatus *sts, const char *name);
bool compareMeta(const char *dirname, wb_merep *merep);
void copyFiles(const char *dirname);
void copyFiles(const char *dirname, wb_merep *merep);
void checkFiles(wb_vrepdb *db, const char *dirname);
wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
void addDbs( pwr_tStatus *sts, wb_mvrep *mvrep);
......
/*
* Proview $Id: wb_object.h,v 1.14 2005-09-06 10:43:31 claes Exp $
* Proview $Id: wb_object.h,v 1.15 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -25,7 +25,6 @@
#include "wb_orep.h"
#include "wb_ldh.h"
#include "wb_destination.h"
//#include "wb_location.h"
#include "wb_attribute.h"
class wb_bdef;
......
/*
* Proview $Id: wb_pwrs.h,v 1.6 2006-03-31 14:29:39 claes Exp $
* Proview $Id: wb_pwrs.h,v 1.7 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -50,12 +50,13 @@ typedef struct {
pwr_sMethodBinding (*Methods)[];
} pwr_sClassBinding;
#if defined __DECC || OS_LINUX
#if 1 //defined OS_LINUX
#define pwr_BindMethods(Class) pwr_sMethodBinding pwr_g ## Class ## _Methods[]
#define pwr_BindClasses(Type) pwr_sClassBinding pwr_g ## Type ## _ClassMethods[]
#define pwr_BindClass(Class) {#Class, (void *)pwr_g ## Class ## _Methods}
#define pwr_BindMethod(Method) {#Method, (pwr_tStatus (*)())Method}
#else
#error "Wrong OS"
#define pwr_BindMethods(Class) pwr_sMethodBinding pwr_g/**/Class/**/_Methods[]
#define pwr_BindClasses(Type) pwr_sClassBinding pwr_g/**/Type/**/_ClassMethods[]
#define pwr_BindClass(Class) {"Class", pwr_g/**/Class/**/_Methods}
......
/*
* Proview $Id: wb_session.cpp,v 1.20 2006-03-31 14:29:39 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_session.cpp,v 1.21 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -864,12 +864,13 @@ pwr_tStatus wb_session::callMenuMethod( ldh_sMenuCall *mcp, int Index)
bool wb_session::validateDestination( wb_destination d, pwr_tCid cid)
{
wb_object o = object( d.oid());
wb_object parent;
wb_object o = object(d.oid());
// Get parent
wb_object parent = wb_object();
if ( o) {
switch( d.code()) {
if (o) {
switch(d.code()) {
case ldh_eDest_After:
case ldh_eDest_Before:
parent = o.parent();
......@@ -878,17 +879,17 @@ bool wb_session::validateDestination( wb_destination d, pwr_tCid cid)
parent = o;
}
}
if ( !parent) {
if (!parent) {
// No parent, check if valid top object (for vrepmem all objects are valid topobjects)
wb_cdef c = cdef( cid);
if ( !c.flags().b.TopObject && type() != ldh_eVolRep_Mem) {
wb_cdef c = cdef(cid);
if (!c.flags().b.TopObject && type() != ldh_eVolRep_Mem) {
m_sts = LDH__NOTOP;
return false;
}
}
else {
// Check if adoption is legal
if ( parent.flags().b.NoAdopt) {
if (parent.flags().b.NoAdopt) {
m_sts = LDH__NOADOPT;
return false;
}
......
/*
* Proview $Id: wb_session.h,v 1.11 2006-03-31 14:29:39 claes Exp $
* Proview $Id: wb_session.h,v 1.12 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -23,19 +23,15 @@
#define wb_session_h
#ifndef pwr_h
#include "pwr.h"
//#include "wb_vrep.h"
#include "wb_object.h"
#include "wb_attribute.h"
#endif
#include "wb_ldh.h"
//#include "wb_ldhi.h"
//#include "wb_adef.h"
//#include "wb_bdef.h"
#include "wb_object.h"
#include "wb_bdef.h"
#include "wb_cdef.h"
#include "wb_name.h"
#include "wb_destination.h"
#include "wb_oset.h"
#include "wb_srep.h"
#include "wb_volume.h"
class wb_object;
......
/*
* Proview $Id: wb_treeimport.cpp,v 1.5 2005-10-18 05:12:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
* Proview $Id: wb_treeimport.cpp,v 1.6 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
......@@ -162,6 +162,7 @@ bool wb_treeimport::importUpdateObject( wb_orep *o, wb_vrep *vrep)
wb_bdrep *bdrep = cdrep->bdrep( &sts, bix);
if ( EVEN(sts)) continue;
int size = bdrep->size();
char *body = (char *)malloc( bdrep->size());
vrep->readBody( &sts, o, bix, body);
......@@ -172,6 +173,9 @@ bool wb_treeimport::importUpdateObject( wb_orep *o, wb_vrep *vrep)
wb_adrep *adrep = bdrep->adrep( &sts);
while ( ODD(sts)) {
int elements = adrep->isArray() ? adrep->nElement() : 1;
if (adrep->offset() < 0 || (adrep->offset() + adrep->size() > size))
printf("(adrep->offset() < 0 || (adrep->offset() + adrep->size() > size))\n");
if ( adrep->isClass()) {
importUpdateSubClass( adrep, body + adrep->offset(), vrep, &modified);
}
......
/*
* Proview $Id: wb_utl.c,v 1.24 2006-05-18 10:26:10 claes Exp $
* Proview $Id: wb_utl.c,v 1.25 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -3170,6 +3170,9 @@ pwr_tStatus utl_show_volumes(
case ldh_eVolRep_Dbs:
u_print( utlctx, " Dbs");
break;
case ldh_eVolRep_Dbms:
u_print( utlctx, " Dbms");
break;
case ldh_eVolRep_Wbl:
u_print( utlctx, " Wbl");
break;
......@@ -5486,7 +5489,7 @@ int utl_compile (
sts = ldh_GetVidInfo( ldh_SessionToWB( ldhses), vol_id, &volinfo);
if (EVEN(sts)) return sts;
if ( volinfo.VolRep == ldh_eVolRep_Db) {
if ( volinfo.VolRep == ldh_eVolRep_Db) { // Todo!!!! Handle dbms
volume_vect[i] = vol_id;
i++;
if ( i > UTL_INPUTLIST_MAX)
......
This diff is collapsed.
This diff is collapsed.
/*
* Proview $Id: wb_vrepdb.h,v 1.29 2006-05-11 07:12:19 claes Exp $
* Proview $Id: wb_vrepdb.h,v 1.30 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -27,7 +27,7 @@
#include "db_cxx.h"
#include "co_tree.h"
class wb_vrepdb : public wb_vrep
class wb_vrepdb : public wb_vrep, public wb_convert_volume
{
private:
bool deleteFamilyMember(pwr_tOid oid, wb_db_txn *txn);
......@@ -72,6 +72,7 @@ private:
protected:
wb_erep *m_erep;
wb_merep *m_merep;
wb_merep *m_merepCheck;
unsigned int m_nRef;
......@@ -165,6 +166,8 @@ public:
virtual wb_orep *next(pwr_tStatus *sts, const wb_orep *o);
virtual wb_orep *nextClass(pwr_tStatus *sts, const wb_orep *o);
virtual wb_orep *previous(pwr_tStatus *sts, const wb_orep *o);
virtual wb_srep *newSession();
......@@ -179,6 +182,9 @@ public:
void load();
void checkMeta();
void updateMeta();
virtual bool exportVolume(wb_import &e);
virtual bool exportHead(wb_import &e);
......@@ -217,6 +223,12 @@ public:
void delete_wb_orepdb(void *p);
virtual bool accessSupported( ldh_eAccess access) { return true;}
virtual const char *fileName() { return m_fileName;}
// virtual void checkClassList(pwr_tOid oid, pwr_tCid cid, bool update);
virtual void updateObject(pwr_tOid oid, pwr_tCid cid);
virtual void checkObject(pwr_tOid oid, pwr_tCid cid);
};
#endif
/*
* Proview $Id: wb_vrepdbs.cpp,v 1.47 2006-05-11 07:12:19 claes Exp $
* Proview $Id: wb_vrepdbs.cpp,v 1.48 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -26,11 +26,9 @@
void wb_vrepdbs::unref()
{
// printf("wb_vrepdbs::unref\n");
if (--m_nRef == 0) {
pwr_tStatus sts;
printf("wb_vrepdbs::unref::dbs_Unmap\n");
dbs_Unmap(&sts, m_dbsmep);
delete this;
......@@ -43,10 +41,19 @@ wb_vrep *wb_vrepdbs::ref()
return this;
}
wb_vrepdbs::wb_vrepdbs(wb_erep *erep, wb_merep *merep, const char *fileName, const char *name, pwr_tVid vid, pwr_tCid cid) : m_erep(erep), m_merep(merep), m_nRef(0), m_duplicate(false)
{
strcpy(m_fileName, fileName);
strcpy(m_name, name);
m_vid = vid;
m_cid = cid;
m_isDbsenvLoaded = false;
}
wb_vrepdbs::wb_vrepdbs(wb_erep *erep, const char *fileName) : m_erep(erep), m_nRef(0), m_duplicate(false)
{
// printf("wb_vrepdbs(erep, fileName):%s\n", fileName);
strcpy(m_fileName, fileName);
m_isDbsenvLoaded = false;
if (false && isCommonMeta())
m_merep = m_erep->merep();
......@@ -56,12 +63,10 @@ wb_vrepdbs::wb_vrepdbs(wb_erep *erep, const char *fileName) : m_erep(erep), m_nR
wb_vrepdbs::wb_vrepdbs(wb_erep *erep, wb_merep * merep, const char *fileName, dbs_sMenv *mep, dbs_sVenv *vep) : m_erep(erep), m_merep(merep), m_nRef(0), m_dbsmep(mep), m_dbsvep(vep), m_duplicate(false)
{
// printf("wb_vrepdbs(erep, fileName, mep, vep):%d,%s\n", vep->vp->vid, fileName);
strcpy(m_fileName, fileName);
strcpy(m_name, m_dbsvep->vp->name);
m_vid = m_dbsvep->vp->vid;
m_cid = m_dbsvep->vp->cid;
// printf("m_name: %s, m_vid: %d, m_cid: %d\n", m_name, m_vid, m_cid);
m_isDbsenvLoaded = true;
}
......@@ -82,18 +87,12 @@ dbs_sVenv *wb_vrepdbs::dbsenv()
strcpy(m_name, m_dbsvep->vp->name);
m_vid = m_dbsvep->vp->vid;
m_cid = m_dbsvep->vp->cid;
// printf("m_name: %s, m_vid: %d, m_cid: %d\n", m_name, m_vid, m_cid);
for (int i = 0; i < dbs_nVolRef(&sts, m_dbsmep); i++) {
dbs_sVenv *vep = dbs_Vmap(&sts, i + 1, m_dbsmep);
wb_vrepdbs *vp = new wb_vrepdbs(m_erep, m_merep, m_fileName, m_dbsmep, vep);
// printf("before addDbs, i:%d, name: %s, vid: %d\n", i, vep->vp->name, vep->vp->vid);
m_merep->addDbs(&sts, (wb_mvrep *)vp);
}
} else {
if (strstr(m_fileName, "x86")) {
//printf("%s::%s\n", m_dbsvep->vp->name, m_fileName);
}
}
return m_dbsvep;
......@@ -497,8 +496,6 @@ wb_orep *wb_vrepdbs::previous(pwr_tStatus *sts, const wb_orep *o)
wb_srep *wb_vrepdbs::newSession()
{
// *sts = LDH__SUCCESS;
return (wb_srep*)0;
}
......@@ -517,7 +514,6 @@ wb_orep *wb_vrepdbs::object(pwr_tStatus *sts)
bool wb_vrepdbs::isLocal(const wb_orep *)
{
//*sts = LDH__NYI;
return false;
}
......@@ -540,7 +536,7 @@ wb_vrep *wb_vrepdbs::next ()
{
pwr_tStatus sts;
return m_erep->nextVolume( &sts, vid());
return m_erep->nextVolume(&sts, vid());
}
wb_merep *wb_vrepdbs::merep() const
......@@ -633,11 +629,11 @@ bool wb_vrepdbs::exportTree(wb_treeimport &i, pwr_tOid oid)
{
pwr_tStatus sts;
dbs_sObject *op = dbs_OidToObject( &sts, dbsenv(), oid);
dbs_sObject *op = dbs_OidToObject(&sts, dbsenv(), oid);
if (op == 0)
throw wb_error(LDH__NOSUCHOBJ);
exportTreeObject( i, op, true);
exportTreeObject(i, op, true);
return true;
}
......@@ -653,37 +649,32 @@ bool wb_vrepdbs::exportTreeObject(wb_treeimport &i, dbs_sObject *op, bool isRoot
void *rbody = 0;
void *dbody = 0;
if ( parent && !isRoot)
if (parent && !isRoot)
parentoid = parent->oid;
if ( before && !isRoot)
if (before && !isRoot)
beforeoid = before->oid;
if ( op->rbody.size)
if (op->rbody.size)
rbody = dbs_Body(&sts, dbsenv(), op, pwr_eBix_rt);
if ( op->dbody.size)
if (op->dbody.size)
dbody = dbs_Body(&sts, dbsenv(), op, pwr_eBix_dev);
i.importTreeObject( m_merep, op->oid, op->cid, parentoid, beforeoid, op->name, op->ohFlags,
i.importTreeObject(m_merep, op->oid, op->cid, parentoid, beforeoid, op->name, op->ohFlags,
op->rbody.size, op->dbody.size, rbody, dbody);
if ( first)
exportTreeObject( i, first, false);
if (first)
exportTreeObject(i, first, false);
if ( !isRoot && after)
exportTreeObject( i, after, false);
if (!isRoot && after)
exportTreeObject(i, after, false);
return true;
}
bool wb_vrepdbs::time( pwr_tTime *t)
bool wb_vrepdbs::time(pwr_tTime *t)
{
if ( m_dbsmep) {
if (m_dbsmep) {
*t = m_dbsmep->venv->vp->time;
return true;
}
return false;
}
/*
* Proview $Id: wb_vrepwbl.cpp,v 1.50 2006-05-11 07:12:20 claes Exp $
* Proview $Id: wb_vrepwbl.cpp,v 1.51 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -297,7 +297,9 @@ int wb_vrepwbl::load( const char *fname)
cout << "\n-- Building volume " << volume_name << endl;
if ( root_object) {
cout << "\n-- Root object " << volume_name << endl;
root_object->build( 1);
cout << "\n-- post build volume " << volume_name << endl;
root_object->postBuild();
}
// info();
......@@ -1414,7 +1416,7 @@ bool wb_vrepwbl::registerObject( pwr_tOix oix, ref_wblnode node)
void wb_vrepwbl::registerClass( const char *name, pwr_tCid cid, ref_wblnode node)
{
string sname(name);
printf("register class: %s, %d\n", name, cid);
m_cid_list[cid] = node;
m_class_list[sname] = node;
}
......@@ -1422,6 +1424,7 @@ void wb_vrepwbl::registerClass( const char *name, pwr_tCid cid, ref_wblnode node
void wb_vrepwbl::registerType( const char *name, pwr_tTid tid, ref_wblnode node)
{
string sname(name);
printf("register type: %s, %d\n", name, tid);
m_tid_list[tid] = node;
m_type_list[sname] = node;
......@@ -1430,6 +1433,8 @@ void wb_vrepwbl::registerType( const char *name, pwr_tTid tid, ref_wblnode node)
void wb_vrepwbl::registerVolume( const char *name, pwr_tCid cid, pwr_tVid vid, ref_wblnode node)
{
m_vid = vid;
printf("register volume: %s, %d\n", name, vid);
strcpy( volume_name, name);
strcpy( m_name, name);
m_cid = cid;
......
/*
* Proview $Id: wb_vsel.cpp,v 1.13 2005-11-14 16:30:36 claes Exp $
* Proview $Id: wb_vsel.cpp,v 1.14 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -582,6 +582,9 @@ pwr_tStatus WVsel::load_volumelist()
case ldh_eVolRep_Dbs:
strcat( str, "Dbs ");
break;
case ldh_eVolRep_Dbms:
strcat( str, "Dbms ");
break;
case ldh_eVolRep_Wbl:
strcat( str, "Wbl ");
break;
......
/*
* Proview $Id: wb_wblnode.cpp,v 1.55 2006-02-16 13:04:40 claes Exp $
* Proview $Id: wb_wblnode.cpp,v 1.56 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -328,7 +328,7 @@ void wb_wblnode::initialize( antlr::RefToken t )
// Test
static int last = 0;
if ( (line_number % 1000) == 0 && line_number != last) {
if ( /*(line_number % 1000) == 0 &&*/ line_number != last) {
printf( "-- Processing line: %d\r", line_number);
fflush(stdout);
last = line_number;
......
/*
* Proview $Id: wb_wblnode.h,v 1.19 2005-09-06 10:43:32 claes Exp $
* Proview $Id: wb_wblnode.h,v 1.20 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -213,12 +213,12 @@ public:
return ret;
}
ref_wblnode wb_wblnode::getFirstChild()
ref_wblnode getFirstChild()
{
return ref_wblnode(BaseAST::getFirstChild());
}
ref_wblnode wb_wblnode::getNextSibling()
ref_wblnode getNextSibling()
{
return ref_wblnode(BaseAST::getNextSibling());
}
......
/*
* Proview $Id: wb_wnav.h,v 1.13 2006-03-31 14:29:39 claes Exp $
* Proview $Id: wb_wnav.h,v 1.14 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -27,7 +27,7 @@
//#endif
#ifndef pwr_h
# include "pwr.h"
//# include "pwr.h"
#endif
#ifndef co_regex_h
......@@ -35,23 +35,19 @@
#endif
#ifndef co_nav_help_h
# include "co_nav_help.h"
//# include "co_nav_help.h"
#endif
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browapi.h"
//#include "flow.h"
#endif
#ifndef wb_wnav_brow_h
#include "wb_wnav_brow.h"
#endif
#ifndef wb_pal_h
#include "wb_pal.h"
#ifndef wb_palfile_h
# include "wb_palfile.h"
#endif
#ifndef wb_build_opt_h
......@@ -59,12 +55,12 @@
#endif
#ifndef co_wow_h
#include "co_wow.h"
# include "co_wow.h"
#endif
#ifndef co_xhelp_h
#include "co_xhelp.h"
#endif
//#ifndef co_xhelp_h
//#include "co_xhelp.h"
//#endif
#ifndef wb_h
#include "wb.h"
......
/*
* Proview $Id: wb_wnav_brow.h,v 1.6 2005-09-06 10:43:32 claes Exp $
* Proview $Id: wb_wnav_brow.h,v 1.7 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,12 +20,8 @@
#ifndef wb_wnav_brow_h
#define wb_wnav_brow_h
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
//# include "pwr.h"
#endif
#ifndef flow_h
......@@ -33,6 +29,10 @@ extern "C" {
#endif
#ifndef flow_browctx_h
#include "flow_browctx.h"
#endif
#ifndef flow_browapi_h
#include "flow_browapi.h"
#endif
......@@ -110,7 +110,4 @@ class WNavBrow {
void brow_setup();
};
#if defined __cplusplus
}
#endif
#endif
/*
* Proview $Id: flow.h,v 1.9 2005-10-21 16:11:22 claes Exp $
* Proview $Id: flow.h,v 1.10 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......
/*
* Proview $Id: flow_browapi.h,v 1.7 2005-09-01 14:56:12 claes Exp $
* Proview $Id: flow_browapi.h,v 1.8 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,6 +20,14 @@
#ifndef flow_browapi_h
#define flow_browapi_h
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_browctx_h
#include "flow_browctx.h"
#endif
#if defined __cplusplus
extern "C" {
#endif
......@@ -31,8 +39,6 @@ typedef void *FlowCtx;
#endif
#endif
#include "flow.h"
typedef struct {
double base_zoom_factor;
double indentation;
......@@ -43,7 +49,7 @@ typedef enum {
brow_eAttr_base_zoom_factor = 1 << 0,
brow_eAttr_indentation = 1 << 1,
brow_eAttr_annotation_space = 1 << 2
} brow_eAttribute;
} brow_eAttribute;
typedef BrowCtx *brow_tCtx;
......
/*
* Proview $Id: flow_browctx.h,v 1.5 2005-09-01 14:56:12 claes Exp $
* Proview $Id: flow_browctx.h,v 1.6 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,11 +20,16 @@
#ifndef flow_browctx_h
#define flow_browctx_h
#include <iostream.h>
#include <fstream.h>
//#include <iostream.h>
//#include <fstream.h>
#ifndef flow_h
#include "flow.h"
#endif
#ifndef flow_ctx_h
#include "flow_ctx.h"
#endif
class BrowCtx : public FlowCtx {
public:
......
/*
* Proview $Id: ge.h,v 1.3 2005-09-01 14:57:52 claes Exp $
* Proview $Id: ge.h,v 1.4 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,6 +20,10 @@
#ifndef ge_h
#define ge_h
#ifndef wb_ldh_h
#include "wb_ldh.h"
#endif
/* ge.h -- Simple graphic editor */
#if defined __cplusplus
......
/*
* Proview $Id: xtt_audio.h,v 1.2 2005-11-17 09:01:35 claes Exp $
* Proview $Id: xtt_audio.h,v 1.3 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -71,7 +71,7 @@ class XttAudio
int Init_ALSA(char *, unsigned int);
int Init_OSS(char *, int);
double XttAudio::envelope( double time, double endtime, double attack,
double envelope( double time, double endtime, double attack,
double decay, double sustain, double release);
void MakeSine(short *buffer, int buffersize, double time, double starttime, double endtime,
int tone, double volume_ch1, double volume_ch2, double attack, double decay,
......
/*
* Proview $Id: xtt_item.h,v 1.10 2005-12-13 15:11:27 claes Exp $
* Proview $Id: xtt_item.h,v 1.11 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -472,7 +472,7 @@ class ItemPlc : public ItemTable {
class ItemEnum : public ItemBaseAttr {
public:
ItemEnum::ItemEnum(
ItemEnum(
XNavBrow *brow,
pwr_tObjid item_objid,
brow_tNode dest, flow_eDest dest_code,
......@@ -490,7 +490,7 @@ class ItemEnum : public ItemBaseAttr {
class ItemMask : public ItemBaseAttr {
public:
ItemMask::ItemMask(
ItemMask(
XNavBrow *brow,
pwr_tObjid item_objid,
brow_tNode dest, flow_eDest dest_code,
......
/*
* Proview $Id: xtt_menu.h,v 1.9 2006-01-25 14:18:45 claes Exp $
* Proview $Id: xtt_menu.h,v 1.10 2006-05-21 22:30:50 lw Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -126,7 +126,7 @@ typedef struct {
} xtt_sClassBinding;
/* Base methods */
#if defined (OS_LYNX) || defined (OS_LINUX)
#if 1 //defined (OS_LYNX) || defined (OS_LINUX)
# define pwr_BindXttMethods(Class) xtt_sMethodBinding pwr_g ## Class ## _XttMethods[]
# define pwr_BindXttClasses(Type) xtt_sClassBinding pwr_g ## Type ## _XttClassMethods[]
# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
......
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