Commit eeec0970 authored by lw's avatar lw

*** empty log message ***

parent 4e76c27e
...@@ -228,7 +228,7 @@ typedef union { ...@@ -228,7 +228,7 @@ typedef union {
typedef struct { typedef struct {
pwr_tOid Objid; pwr_tOid Objid;
pwr_tClassId Body; pwr_tCid Body;
pwr_tUInt32 Offset; pwr_tUInt32 Offset;
pwr_tUInt32 Size; pwr_tUInt32 Size;
pwr_mAttrRef Flags; pwr_mAttrRef Flags;
...@@ -250,6 +250,10 @@ static const pwr_tClassId pwr_cNClassId = 0; ...@@ -250,6 +250,10 @@ static const pwr_tClassId pwr_cNClassId = 0;
static const pwr_tTypeId pwr_cNTypeId = 0; static const pwr_tTypeId pwr_cNTypeId = 0;
static const pwr_tVolumeId pwr_cNVolumeId = 0; static const pwr_tVolumeId pwr_cNVolumeId = 0;
static const pwr_tNodeId pwr_cNNodeId = 0; static const pwr_tNodeId pwr_cNNodeId = 0;
static const pwr_tCid pwr_cNCid = 0;
static const pwr_tTid pwr_cNTid = 0;
static const pwr_tVid pwr_cNVid = 0;
static const pwr_tNid pwr_cNNid = 0;
/* Gereral macro definitions */ /* Gereral macro definitions */
......
...@@ -68,8 +68,9 @@ typedef struct { ...@@ -68,8 +68,9 @@ typedef struct {
unsigned int vid_3 : 8; unsigned int vid_3 : 8;
#endif #endif
} cdh_mObjid; } cdh_mOid;
typedef cdh_mOid cdh_mObjid;
typedef struct { typedef struct {
unsigned int rix : 32; unsigned int rix : 32;
...@@ -88,7 +89,8 @@ typedef struct { ...@@ -88,7 +89,8 @@ typedef struct {
unsigned int vid_3 : 8; unsigned int vid_3 : 8;
#endif #endif
} cdh_mRefId; } cdh_mRid;
typedef cdh_mRid cdh_mRefId;
typedef struct { typedef struct {
#if (pwr_dHost_byteOrder == pwr_dBigEndian) #if (pwr_dHost_byteOrder == pwr_dBigEndian)
...@@ -106,7 +108,8 @@ typedef struct { ...@@ -106,7 +108,8 @@ typedef struct {
unsigned int vid_3 : 8; unsigned int vid_3 : 8;
#endif #endif
} cdh_mVolumeId; } cdh_mVid;
typedef cdh_mVid cdh_mVolumeId;
typedef struct { typedef struct {
#if (pwr_dHost_byteOrder == pwr_dBigEndian) #if (pwr_dHost_byteOrder == pwr_dBigEndian)
...@@ -124,29 +127,30 @@ typedef struct { ...@@ -124,29 +127,30 @@ typedef struct {
unsigned int nid_3 : 8; unsigned int nid_3 : 8;
#endif #endif
} cdh_mNodeId; } cdh_mNid;
typedef cdh_mNid cdh_mNodeId;
typedef struct { typedef struct {
#if (pwr_dHost_byteOrder == pwr_dBigEndian) #if (pwr_dHost_byteOrder == pwr_dBigEndian)
unsigned int must_be_two : 2; unsigned int must_be_two : 2;
unsigned int cix : 12; unsigned int cix : 12;
unsigned int bix : 3; unsigned int bix : 3;
unsigned int reserved : 3; unsigned int reserved : 3;
unsigned int aix : 12; unsigned int aix : 12;
unsigned int vid_3 : 8; unsigned int vid_3 : 8;
unsigned int vid_2 : 8; unsigned int vid_2 : 8;
unsigned int vid_1 : 8; unsigned int vid_1 : 8;
unsigned int vid_0 : 8; unsigned int vid_0 : 8;
#elif (pwr_dHost_byteOrder == pwr_dLittleEndian) #elif (pwr_dHost_byteOrder == pwr_dLittleEndian)
unsigned int aix : 12; unsigned int aix : 12;
unsigned int reserved : 3; unsigned int reserved : 3;
unsigned int bix : 3; unsigned int bix : 3;
unsigned int cix : 12; unsigned int cix : 12;
unsigned int must_be_two : 2; unsigned int must_be_two : 2;
unsigned int vid_0 : 8; unsigned int vid_0 : 8;
unsigned int vid_1 : 8; unsigned int vid_1 : 8;
...@@ -176,7 +180,8 @@ typedef struct { ...@@ -176,7 +180,8 @@ typedef struct {
unsigned int vid_1 : 8; unsigned int vid_1 : 8;
#endif #endif
} cdh_mClassId; } cdh_mCid;
typedef cdh_mCid cdh_mClassId;
typedef struct { typedef struct {
#if (pwr_dHost_byteOrder == pwr_dBigEndian) #if (pwr_dHost_byteOrder == pwr_dBigEndian)
...@@ -228,35 +233,41 @@ typedef struct { ...@@ -228,35 +233,41 @@ typedef struct {
unsigned int vid_1 : 8; unsigned int vid_1 : 8;
#endif #endif
} cdh_mTypeId; } cdh_mTid;
typedef cdh_mTid cdh_mTypeId;
typedef union { typedef union {
pwr_tObjid pwr; pwr_tOid pwr;
cdh_mObjid o; cdh_mObjid o;
cdh_mClassObjid c; cdh_mClassObjid c;
cdh_mTypeObjid t; cdh_mTypeObjid t;
} cdh_uObjid; } cdh_uOid;
typedef cdh_uOid cdh_uObjid;
typedef union { typedef union {
pwr_tRefId pwr; pwr_tRid pwr;
cdh_mRefId r; cdh_mRid r;
} cdh_uRefId; } cdh_uRid;
typedef cdh_uRid cdh_uRefId;
typedef union { typedef union {
pwr_tClassId pwr; pwr_tCid pwr;
cdh_mClassId c; cdh_mCid c;
cdh_mTypeId t; cdh_mTid t;
} cdh_uTypeId; } cdh_uTid;
typedef cdh_uTid cdh_uTypeId;
typedef union { typedef union {
pwr_tVolumeId pwr; pwr_tVid pwr;
cdh_mVolumeId v; cdh_mVid v;
} cdh_uVolumeId; } cdh_uVid;
typedef cdh_uVid cdh_uVolumeId;
typedef union { typedef union {
pwr_tNodeId pwr; pwr_tNid pwr;
cdh_mNodeId n; cdh_mNid n;
} cdh_uNodeId; } cdh_uNid;
typedef cdh_uNid cdh_uNodeId;
typedef enum { typedef enum {
cdh_eId__ = 0, cdh_eId__ = 0,
...@@ -272,14 +283,14 @@ typedef enum { ...@@ -272,14 +283,14 @@ typedef enum {
} cdh_eId; } cdh_eId;
typedef union { typedef union {
pwr_tObjectIx oix; pwr_tOix oix;
pwr_tObjid oid; pwr_tOid oid;
pwr_tClassId cid; pwr_tCid cid;
pwr_tVolumeId vid; pwr_tVid vid;
pwr_tTypeId tid; pwr_tTid tid;
pwr_tSubid sid; pwr_tSubid sid;
pwr_tDlid did; pwr_tDlid did;
pwr_sAttrRef aref; pwr_sAttrRef aref;
} cdh_uId; } cdh_uId;
typedef union { typedef union {
...@@ -311,7 +322,7 @@ typedef struct { ...@@ -311,7 +322,7 @@ typedef struct {
typedef struct { typedef struct {
cdh_sObjName name; cdh_sObjName name;
pwr_tObjid poid; pwr_tOid poid;
} cdh_sFamily; } cdh_sFamily;
typedef union { typedef union {
...@@ -527,170 +538,170 @@ typedef union { ...@@ -527,170 +538,170 @@ typedef union {
} cdh_mName; } cdh_mName;
typedef struct { typedef struct {
pwr_tObjid poid; /* Parent objid, or NOBJID */ pwr_tOid poid; /* Parent objid, or NOBJID */
cdh_mParseName parseFlags; cdh_mParseName parseFlags;
cdh_mName flags; cdh_mName flags;
void *ohp; void *ohp;
cdh_eId eId; cdh_eId eId;
cdh_uId uId; cdh_uId uId;
pwr_tTypeId bid; pwr_tTid bid;
pwr_tUInt32 index; pwr_tUInt32 index;
pwr_tUInt32 offset; pwr_tUInt32 offset;
pwr_tUInt32 size; pwr_tUInt32 size;
pwr_tUInt32 nObject; pwr_tUInt32 nObject;
pwr_tUInt32 nBody; pwr_tUInt32 nBody;
cdh_sFamily volume; cdh_sFamily volume;
cdh_sFamily object[20]; cdh_sFamily object[20];
cdh_sFamily body[10]; cdh_sFamily body[10];
cdh_sFamily attribute; cdh_sFamily attribute;
} cdh_sParseName; } cdh_sParseName;
/* Function prototypes to exported functions. */ /* Function prototypes to exported functions. */
int int
cdh_ObjidCompare ( cdh_ObjidCompare (
pwr_tObjid Object_1, pwr_tOid Object_1,
pwr_tObjid Object_2 pwr_tOid Object_2
); );
int int
cdh_ObjidIsEqual ( cdh_ObjidIsEqual (
pwr_tObjid Object_1, pwr_tOid Object_1,
pwr_tObjid Object_2 pwr_tOid Object_2
); );
int int
cdh_ObjidIsNotEqual ( cdh_ObjidIsNotEqual (
pwr_tObjid Object_1, pwr_tOid Object_1,
pwr_tObjid Object_2 pwr_tOid Object_2
); );
int int
cdh_ObjidIsNull ( cdh_ObjidIsNull (
pwr_tObjid Object pwr_tOid Object
); );
int int
cdh_ObjidIsNotNull ( cdh_ObjidIsNotNull (
pwr_tObjid Object pwr_tOid Object
); );
int int
cdh_SubidCompare ( cdh_SubidCompare (
pwr_tSubid Subscription_1, pwr_tSubid Subscription_1,
pwr_tSubid Subscription_2 pwr_tSubid Subscription_2
); );
int int
cdh_SubidIsEqual ( cdh_SubidIsEqual (
pwr_tSubid Subscription_1, pwr_tSubid Subscription_1,
pwr_tSubid Subscription_2 pwr_tSubid Subscription_2
); );
int int
cdh_SubidIsNotEqual ( cdh_SubidIsNotEqual (
pwr_tSubid Subscription_1, pwr_tSubid Subscription_1,
pwr_tSubid Subscription_2 pwr_tSubid Subscription_2
); );
int int
cdh_SubidIsNull ( cdh_SubidIsNull (
pwr_tSubid Subscription pwr_tSubid Subscription
); );
int int
cdh_SubidIsNotNull ( cdh_SubidIsNotNull (
pwr_tSubid Subscription pwr_tSubid Subscription
); );
int int
cdh_RefIdCompare ( cdh_RefIdCompare (
pwr_tRefId Reference_1, pwr_tRefId Reference_1,
pwr_tRefId Reference_2 pwr_tRefId Reference_2
); );
int int
cdh_RefIdIsEqual ( cdh_RefIdIsEqual (
pwr_tRefId Reference_1, pwr_tRefId Reference_1,
pwr_tRefId Reference_2 pwr_tRefId Reference_2
); );
int int
cdh_RefIdIsNotEqual ( cdh_RefIdIsNotEqual (
pwr_tRefId Reference_1, pwr_tRefId Reference_1,
pwr_tRefId Reference_2 pwr_tRefId Reference_2
); );
int int
cdh_RefIdIsNull ( cdh_RefIdIsNull (
pwr_tRefId Reference pwr_tRefId Reference
); );
int int
cdh_RefIdIsNotNull ( cdh_RefIdIsNotNull (
pwr_tRefId Reference pwr_tRefId Reference
); );
int int
cdh_DlidCompare ( cdh_DlidCompare (
pwr_tDlid DirectLink_1, pwr_tDlid DirectLink_1,
pwr_tDlid DirectLink_2 pwr_tDlid DirectLink_2
); );
int int
cdh_DlidIsEqual ( cdh_DlidIsEqual (
pwr_tDlid DirectLink_1, pwr_tDlid DirectLink_1,
pwr_tDlid DirectLink_2 pwr_tDlid DirectLink_2
); );
int int
cdh_DlidIsNotEqual ( cdh_DlidIsNotEqual (
pwr_tDlid DirectLink_1, pwr_tDlid DirectLink_1,
pwr_tDlid DirectLink_2 pwr_tDlid DirectLink_2
); );
int int
cdh_DlidIsNull ( cdh_DlidIsNull (
pwr_tDlid DirectLink pwr_tDlid DirectLink
); );
int int
cdh_DlidIsNotNull ( cdh_DlidIsNotNull (
pwr_tDlid DirectLink pwr_tDlid DirectLink
); );
pwr_tClassId pwr_tCid
cdh_ClassObjidToId ( cdh_ClassObjidToId (
pwr_tObjid Object pwr_tOid Object
); );
pwr_tObjid pwr_tOid
cdh_ClassIdToObjid ( cdh_ClassIdToObjid (
pwr_tClassId Class pwr_tCid Class
); );
pwr_tTypeId pwr_tTid
cdh_TypeObjidToId ( cdh_TypeObjidToId (
pwr_tObjid Object pwr_tOid Object
); );
int int
cdh_TypeIdToIndex ( cdh_TypeIdToIndex (
pwr_tTypeId Type pwr_tTid Type
); );
pwr_tObjid pwr_tOid
cdh_TypeIdToObjid ( cdh_TypeIdToObjid (
pwr_tTypeId Type pwr_tTid Type
); );
pwr_tStatus pwr_tStatus
cdh_AttrValueToString ( cdh_AttrValueToString (
pwr_eType Type, pwr_eType Type,
void *Value, void *Value,
char *String, char *String,
int MaxSize int MaxSize
); );
pwr_tStatus pwr_tStatus
...@@ -703,31 +714,31 @@ cdh_StringToAttrValue ( ...@@ -703,31 +714,31 @@ cdh_StringToAttrValue (
pwr_tStatus pwr_tStatus
cdh_StringToClassId ( cdh_StringToClassId (
const char *s, const char *s,
pwr_tClassId *cid pwr_tCid *cid
); );
pwr_tStatus pwr_tStatus
cdh_StringToTypeId ( cdh_StringToTypeId (
const char *s, const char *s,
pwr_tTypeId *tid pwr_tTid *tid
); );
pwr_tStatus pwr_tStatus
cdh_StringToVolumeId ( cdh_StringToVolumeId (
const char *s, const char *s,
pwr_tVolumeId *tid pwr_tVid *tid
); );
pwr_tStatus pwr_tStatus
cdh_StringToObjectIx ( cdh_StringToObjectIx (
const char *s, const char *s,
pwr_tObjectIx *oix pwr_tOix *oix
); );
pwr_tStatus pwr_tStatus
cdh_StringToObjid ( cdh_StringToObjid (
const char *s, const char *s,
pwr_tObjid *oix pwr_tOid *oid
); );
pwr_tStatus pwr_tStatus
...@@ -738,65 +749,61 @@ cdh_StringToSubid ( ...@@ -738,65 +749,61 @@ cdh_StringToSubid (
pwr_tStatus pwr_tStatus
cdh_StringToDlid ( cdh_StringToDlid (
const char *s, const char *s,
pwr_tDlid *did pwr_tDlid *did
); );
char * char *
cdh_ClassIdToString ( cdh_ClassIdToString (
char *s, char *s,
pwr_tClassId cid, pwr_tCid cid,
int prefix int prefix
); );
char * char *
cdh_ObjectIxToString ( cdh_ObjectIxToString (
char *s, char *s,
pwr_tObjectIx oix, pwr_tOix oix,
int prefix int prefix
); );
char * char *
cdh_ObjidToString ( cdh_ObjidToString (
char *s, char *s,
pwr_tObjid oid, pwr_tOid oid,
int prefix int prefix
); );
char * char *
cdh_ArefToString ( cdh_ArefToString (
char *s, char *s,
pwr_sAttrRef *aref, pwr_sAttrRef *aref,
int prefix int prefix
); );
char * char *
cdh_NodeIdToString ( cdh_NodeIdToString (
char *s, char *s,
pwr_tNodeId nid, pwr_tNid nid,
int prefix, int prefix,
int suffix int suffix
); );
char * char *
cdh_TypeIdToString ( cdh_TypeIdToString(char *s, pwr_tTid tid, int prefix);
char *s,
pwr_tTypeId tid,
int prefix
);
char * char *
cdh_VolumeIdToString ( cdh_VolumeIdToString (
char *s, char *s,
pwr_tVolumeId vid, pwr_tVid vid,
int prefix, int prefix,
int suffix int suffix
); );
char * char *
cdh_SubidToString ( cdh_SubidToString (
char *s, char *s,
pwr_tSubid sid, pwr_tSubid sid,
int prefix int prefix
); );
...@@ -811,7 +818,7 @@ cdh_sFamily * ...@@ -811,7 +818,7 @@ cdh_sFamily *
cdh_Family ( cdh_Family (
cdh_sFamily *f, cdh_sFamily *f,
const char *name, const char *name,
pwr_tObjid poid pwr_tOid poid
); );
cdh_sObjName * cdh_sObjName *
...@@ -829,7 +836,7 @@ cdh_sParseName * ...@@ -829,7 +836,7 @@ cdh_sParseName *
cdh_ParseName ( cdh_ParseName (
pwr_tStatus *sts, pwr_tStatus *sts,
cdh_sParseName *pn, cdh_sParseName *pn,
pwr_tObjid poid, pwr_tOid poid,
const char *name, const char *name,
pwr_tUInt32 flags pwr_tUInt32 flags
); );
......
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include "pwr.h" #include "pwr.h"
#include "co_dbs.h" #include "co_dbs.h"
...@@ -15,23 +21,76 @@ ...@@ -15,23 +21,76 @@
#include "co_platform.h" #include "co_platform.h"
static pwr_tBoolean
checkQ(const dbs_sEnv *ep, dbs_sQlink *item)
{
dbs_sQlink *link;
if (item == NULL) {
printf("checkQ in volume: %s, item == NULL", "not known");
return NO;
}
if (item->self == dbs_cNref) {
printf("checkQ in volume: %s, item->self == dbs_cNref, item: %u", "not known", (unsigned int)item);
return NO;
}
link = dbs_Address(NULL, ep, item->self);
if (item != link) {
printf("checkQ in volume: %s, item != dbs_Address(NULL, ep, item->self),\n item: %u != %u",
"not known", (unsigned int)item, (unsigned int)link);
return NO;
}
return YES;
}
void * void *
dbs_Address(pwr_tStatus *sts, dbs_sEnv *ep, dbs_tRef r) dbs_Address(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_tRef r)
{ {
#if 0 dbs_uRefBits bits;
if (r == dbs_cNRef)
return NULL; if (r == dbs_cNref)
return NULL;
if (!ep->flags.b.isMapped) if (!ep->flags.b.isMapped)
pwr_ReturnOrBugcheck(NULL, sts, DBS__NOTMAPPED, ""); pwr_Return(NULL, sts, DBS__NOTMAPPED);
if (r < ep->size) { bits.m = r;
return (void *)(ep->base + r);
} if (bits.b.sect > dbs_eSect_)
pwr_ReturnOrBugcheck(NULL, sts, DBS__BADOFFS, ""); pwr_Return(NULL, sts, DBS__BADSECT);
#endif
return NULL; if (bits.b.offs >= ep->sect[bits.b.sect].size)
pwr_Return(NULL, sts, DBS__BADOFFS);
return (void *)(ep->base + ep->sect[bits.b.sect].offset + bits.b.offs);
}
void *dbs_Bfind(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sBintab *tp, void *key, int (comp)(void *key, void *record))
{
char *p;
int c;
char *start = dbs_Address(sts, ep, tp->start);
char *end = dbs_Address(sts, ep, tp->end);
int rsize = tp->rsize;
while (start <= end) {
p = start + ((end - start) / (2*rsize)) * rsize;
c = comp(key, p);
if (c > 0) {
start = p + rsize;
} else if (c < 0) {
end = p - rsize;
} else {
return p;
}
}
return 0;
} }
#if 0 #if 0
...@@ -65,29 +124,6 @@ dbs_ItemReference(pwr_tStatus*, dbs_sEnv*, void*) ...@@ -65,29 +124,6 @@ dbs_ItemReference(pwr_tStatus*, dbs_sEnv*, void*)
{ {
} }
void *dbs_Bfind(pwr_tStatus *sts, dbs_sEnv *ep, dbs_sBintab *tp, void *key, int (comp)(void *key, void *record))
{
void *p;
int c;
void *start = dbs_Address(sts, ep, tp->start);
void *end = dbs_Address(sts, ep, tp->end);
int rsize = tp->rsize;
while (start < end) {
p = start + ((end - start) / (2*rsize)) * rsize;
c = comp(key, p);
if (c < 0) {
start = p + rsize;
} else if (c > 0) {
end = p - rsize;
} else {
return p;
}
}
return 0;
}
dbs_sQlink * dbs_sQlink *
...@@ -95,27 +131,27 @@ dbs_Qalloc(pwr_tStatus*, dbs_sEnv*) ...@@ -95,27 +131,27 @@ dbs_Qalloc(pwr_tStatus*, dbs_sEnv*)
{ {
} }
#endif
pwr_tBoolean pwr_tBoolean
dbs_QhasOne(pwr_tStatus *sts, dbs_sEnv *ep, dbs_sQlink *item) dbs_QhasOne(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sQlink *item)
{ {
dbs_sQlink *pred; dbs_sQlink *pred;
dbs_sQlink *succ; dbs_sQlink *succ;
pwr_Assert(checkQ(ep, item)); pwr_Assert(checkQ(ep, item));
pred = dbs_Address(sts, ep, item->blink); pred = dbs_Address(sts, ep, item->pred);
succ = dbs_Address(sts, ep, item->flink); succ = dbs_Address(sts, ep, item->succ);
pwr_Assert(checkQ(ep, succ)); pwr_Assert(checkQ(ep, succ));
pwr_Assert(checkQ(ep, pred)); pwr_Assert(checkQ(ep, pred));
pwr_Assert(item->blink == pred->self); pwr_Assert(item->pred == pred->self);
pwr_Assert(item->flink == succ->self); pwr_Assert(item->succ == succ->self);
pwr_Assert(pred->flink == item->self); pwr_Assert(pred->succ == item->self);
pwr_Assert(succ->blink == item->self); pwr_Assert(succ->pred == item->self);
return item->flink == item->blink; return item->succ == item->pred;
} }
#endif
/* Initialize a queue item. */ /* Initialize a queue item. */
...@@ -146,124 +182,124 @@ dbs_Qinsert(pwr_tStatus *sts, dbs_sQlink *pred, dbs_sQlink *item, dbs_sQlink *su ...@@ -146,124 +182,124 @@ dbs_Qinsert(pwr_tStatus *sts, dbs_sQlink *pred, dbs_sQlink *item, dbs_sQlink *su
#if 0 #if 0
dbs_sQlink *dbs_QinsertPred(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*); dbs_sQlink *dbs_QinsertPred(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*);
dbs_sQlink *dbs_QinsertSucc(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*); dbs_sQlink *dbs_QinsertSucc(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*);
#endif
#if 1
pwr_tBoolean pwr_tBoolean
dbs_QisEmpty(pwr_tStatus *sts, dbs_sEnv *cp, dbs_sQlink *item) dbs_QisEmpty(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sQlink *item)
{ {
dbs_sQlink *pred; dbs_sQlink *pred;
dbs_sQlink *succ; dbs_sQlink *succ;
pwr_Assert(checkQ(php, item)); pwr_Assert(checkQ(ep, item));
pred = dbs_Address(sts, cp, item->blink); pred = dbs_Address(sts, ep, item->pred);
succ = dbs_Address(sts, cp, item->flink); succ = dbs_Address(sts, ep, item->succ);
pwr_Assert(checkQ(cp, succ)); pwr_Assert(checkQ(ep, succ));
pwr_Assert(checkQ(cp, pred)); pwr_Assert(checkQ(ep, pred));
pwr_Assert(item->blink == pred->self); pwr_Assert(item->pred == pred->self);
pwr_Assert(item->flink == succ->self); pwr_Assert(item->succ == succ->self);
pwr_Assert(pred->flink == item->self); pwr_Assert(pred->succ == item->self);
pwr_Assert(succ->blink == item->self); pwr_Assert(succ->pred == item->self);
return item->flink == item->self; return item->succ == item->self;
} }
pwr_tBoolean pwr_tBoolean
dbs_QisLinked(pwr_tStatus *sts, dbs_sEnv *cp, dbs_sQlink *item) dbs_QisLinked(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sQlink *item)
{ {
dbs_sQlink *pred; dbs_sQlink *pred;
dbs_sQlink *succ; dbs_sQlink *succ;
pwr_Assert(checkQ(cp, item)); pwr_Assert(checkQ(ep, item));
pred = dbs_Address(sts, cp, item->blink); pred = dbs_Address(sts, ep, item->pred);
succ = dbs_Address(sts, cp, item->flink); succ = dbs_Address(sts, ep, item->succ);
pwr_Assert(checkQ(cp, succ)); pwr_Assert(checkQ(ep, succ));
pwr_Assert(checkQ(cp, pred)); pwr_Assert(checkQ(ep, pred));
pwr_Assert(item->blink == pred->self); pwr_Assert(item->pred == pred->self);
pwr_Assert(item->flink == succ->self); pwr_Assert(item->succ == succ->self);
pwr_Assert(pred->flink == item->self); pwr_Assert(pred->succ == item->self);
pwr_Assert(succ->blink == item->self); pwr_Assert(succ->pred == item->self);
return item->flink != item->self; return item->succ != item->self;
} }
pwr_tBoolean pwr_tBoolean
dbs_QisNull(pwr_tStatus *sts, dbs_sEnv *cp, dbs_sQlink *item) dbs_QisNull(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sQlink *item)
{ {
pwr_tBoolean nullQ; pwr_tBoolean nullQ;
nullQ = (item->self == dbs_cNRef) nullQ = (item->self == dbs_cNref)
|| (item->blink == dbs_cNRef) || (item->pred == dbs_cNref)
|| (item->flink == dbs_cNRef); || (item->succ == dbs_cNref);
pwr_Assert(item->blink == dbs_cNRef); pwr_Assert(item->pred == dbs_cNref);
pwr_Assert(item->flink == dbs_cNRef); pwr_Assert(item->succ == dbs_cNref);
pwr_Assert(item->self == dbs_cNRef); pwr_Assert(item->self == dbs_cNref);
return nullQ; return nullQ;
} }
dbs_sQlink * dbs_sQlink *
dbs_Qpred(pwr_tStatus *sts, dbs_sEnv *cp, dbs_sQlink *item) dbs_Qpred(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sQlink *item)
{ {
dbs_sQlink *pred; dbs_sQlink *pred;
pwr_Assert(checkQ(cp, item)); pwr_Assert(checkQ(ep, item));
pred = dbs_Address(NULL, cp, item->blink); pred = dbs_Address(NULL, ep, item->pred);
if (pred != NULL) { if (pred != NULL) {
pwr_Assert(checkQ(cp, pred)); pwr_Assert(checkQ(ep, pred));
pwr_Assert(pred->flink == item->self); pwr_Assert(pred->succ == item->self);
pwr_Assert(pred->self == item->blink); pwr_Assert(pred->self == item->pred);
} }
return pred; return pred;
} }
dbs_sQlink * dbs_sQlink *
dbs_Qsucc(pwr_tStatus *sts, dbs_sEnv *cp, dbs_sQlink *item); dbs_Qsucc(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sQlink *item)
{ {
pool_sQlink *succ; dbs_sQlink *succ;
pwr_Assert(checkQ(cp, item)); pwr_Assert(checkQ(ep, item));
succ = dbs_Address(NULL, cp, item->flink); succ = dbs_Address(NULL, ep, item->succ);
if (succ != NULL) { if (succ != NULL) {
pwr_Assert(checkQ(cp, succ)); pwr_Assert(checkQ(ep, succ));
pwr_Assert(succ->blink == item->self); pwr_Assert(succ->pred == item->self);
pwr_Assert(item->flink == succ->self); pwr_Assert(item->succ == succ->self);
} }
return succ; return succ;
} }
dbs_tRef dbs_RefAlloc(pwr_tStatus*, dbs_sEnv*, pwr_tUInt32); /* Translate a virtual address to a reference.
Return a dbs_tRef, and signals errors. */
/* Translate a virtual address to a pool reference.
Return a pool_tRef, and signals errors. */
dbs_tRef dbs_tRef
dbs_Reference(pwr_tStatus sts*, dbs_sEnv *ep, void *adrs) dbs_Reference(pwr_tStatus *sts, const dbs_sEnv *ep, void *adrs)
{ {
long iadrs = (long)adrs; long iadrs = (long)adrs;
long ofs; long ofs;
long sect = //long base = ep->sect[]
long base = cp->sect[]
if (iadrs < (long)cp->base) if (iadrs < (long)ep->base)
return dbs_cNRef; return dbs_cNref;
ofs = iadrs - (long)ep->base; ofs = iadrs - (long)ep->base;
if (ofs >= ep->size) if (ofs >= ep->size)
return dbs_cNRef; return dbs_cNref;
return (dbs_tRef)ofs; return (dbs_tRef)ofs;
} }
#endif #endif
pwr_tBoolean pwr_tBoolean
dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep) dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep)
{ {
...@@ -318,58 +354,464 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename) ...@@ -318,58 +354,464 @@ dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
return ep; return ep;
} }
pwr_tBoolean dbs_sEnv *
dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, dbs_sEnv *ep) dbs_Map(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
{ {
int offset; struct stat sb;
*sts = DBS__SUCCESS; int ret, i;
int fd;
//char *buf;
//int c;
dbs_sFile *fp;
dbs_sSect *sp;
dbs_sVolume *vp;
dbs_sObject *op, *eop;
dbs_sName *np, *enp;
dbs_sOid *oidp, *eoidp;
dbs_uRefBits nf, nl, cf, cl, of, ol;
dbs_sClass *cp, *ecp;
if ((ret = stat(filename, &sb)) != 0) {
perror("stat");
return NULL;
}
if (fread(buf, size, 1, ep->f) == 0) *sts = DBS__SUCCESS;
pwr_Return(NO, sts, errno_GetStatus()); memset(ep, 0, sizeof(*ep));
*sts = errno_GetStatus();
printf("st_dev....: %d\t\t%s\n", (int)sb.st_dev, "device");
printf("st_ino....: %d\t%s\n", sb.st_ino, "inode");
printf("st_mode...: %d\t%s\n", sb.st_mode, "protection");
printf("st_nlink..: %d\t\t%s\n", sb.st_nlink, "number of hard links");
printf("st_uid....: %d\t%s\n", sb.st_uid, "user ID of owner");
printf("st_gid....: %d\t\t%s\n", sb.st_gid, "group ID of owner");
printf("st_redv...: %d\t\t%s\n", (int)sb.st_rdev, "device type (if inode device)");
printf("st_size...: %d\t\t%s\n", sb.st_size, "total size, in bytes");
printf("st_blksize: %d\t%s\n", sb.st_blksize, "blocksize for filesystem I/O");
printf("st_blocks.: %d\t\t%s\n", sb.st_blocks, "number of blocks allocated");
printf("st_atime..: %d\t%s\n", sb.st_atime, "time of last access");
printf("st_mtime..: %d\t%s\n", sb.st_mtime, "time of last modification");
printf("st_ctime..: %d\t%s\n", sb.st_ctime, "time of last change");
printf("st_mode...: %d\t%s\n", sb.st_mode, "mode");
if ((offset = dbs_dPadding(size)) > 0) fd = open(filename, O_RDWR);
if(fseek(ep->f, offset, SEEK_CUR)) printf("open fd: %d\n", fd);
pwr_Return(NO, sts, errno_GetStatus());
errno = 0;
ep->base = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
perror("mmap");
printf("mmap buf: %d\n", ret);
ret = close(fd);
printf("close ret: %d\n", ret);
return YES; ep->flags.b.isMapped = 1;
fp = (dbs_sFile*)ep->base;
printf("format.......: %d\n", fp->format.m);
printf("cookie.......: %d\n", fp->cookie);
printf("size.........: %d\n", fp->size);
printf("offset.......: %d\n", fp->offset);
printf("formatVersion: %d\n", fp->formatVersion);
printf("version......: %d\n", fp->version);
printf("sectVersion..: %d\n", fp->sectVersion);
printf("pwrVersion...: %d\n", fp->pwrVersion);
printf("time.........: %ld\n", fp->time.tv_sec);
printf("fileType.....: %d\n", fp->fileType);
printf("userName.....: %s\n", fp->userName);
sp = (dbs_sSect*)((char *)fp + dbs_dAlign(sizeof(dbs_sFile)));
vp = (dbs_sVolume*)((char *)fp + sp[dbs_eSect_volume].offset);
printf("vid........: %d\n", vp->vid);
printf("name.......: %s\n", vp->name);
printf("cid........: %d\n", vp->cid);
printf("className..: %s\n", vp->className);
printf("time.......: %ld\n", vp->time.tv_sec);
printf("cardinality: %d\n", vp->cardinality);
printf("rbodysize..: %d\n", vp->rbodySize);
nf.m = vp->name_bt.start;
nl.m = vp->name_bt.end;
cf.m = vp->class_bt.start;
cl.m = vp->class_bt.end;
of.m = vp->oid_bt.start;
ol.m = vp->oid_bt.end;
printf("name_bt....: %d.%d -> %d.%d %d\n", nf.b.sect, nf.b.offs, nl.b.sect, nl.b.offs, vp->name_bt.rsize);
printf("class_bt...: %d.%d -> %d.%d %d\n", cf.b.sect, cf.b.offs, cl.b.sect, cl.b.offs, vp->class_bt.rsize);
printf("oid_bt.....: %d.%d -> %d.%d %d\n", of.b.sect, of.b.offs, ol.b.sect, ol.b.offs, vp->oid_bt.rsize);
ep->sect = (dbs_sSect*)((char *)fp + dbs_dAlign(sizeof(dbs_sFile)));
sp = (dbs_sSect*)((char *)fp + dbs_dAlign(sizeof(dbs_sFile)));
for (i = 0; i < dbs_eSect_; i++, sp++) {
printf("sect: i:%d, version:%d, type:%d, size:%d, offset:%d\n", i, sp->version,
sp->type, sp->size, sp->offset);
}
sp = (dbs_sSect*)((char *)fp + dbs_dAlign(sizeof(dbs_sFile)));
op = (dbs_sObject*)((char *)fp + sp[dbs_eSect_object].offset);
eop = (dbs_sObject*)((char *)op + sp[dbs_eSect_object].size);
for (; op < eop; op = (dbs_sObject*)((char *)op + dbs_dAlign(sizeof(dbs_sObject)))) {
dbs_uRefBits r, p, s, bf, bl;
r.m = op->rbody.ref;
p.m = op->pref;
s.m = op->sib_ll.self;
bf.m = op->name_bt.start;
bl.m = op->name_bt.end;
printf("O %s, %d.%d, %d r[%d.%d] p[%d.%d] s[%d.%d] bs[%d.%d] be[%d.%d] %d\n",
op->name, op->oid.vid, op->oid.oix, op->rbody.size, r.b.sect, r.b.offs,
p.b.sect, p.b.offs, s.b.sect, s.b.offs, bf.b.sect, bf.b.offs, bl.b.sect, bl.b.offs, op->name_bt.rsize);
}
oidp = (dbs_sOid*)((char *)fp + sp[dbs_eSect_oid].offset);
eoidp = (dbs_sOid*)((char *)oidp + sp[dbs_eSect_oid].size);
for (; oidp < eoidp; oidp = (dbs_sOid*)((char *)oidp + dbs_dAlign(sizeof(dbs_sOid)))) {
dbs_uRefBits s;
dbs_sObject *op, *oop, *aop;
pwr_tStatus sts;
s.m = oidp->ref;
op = dbs_Address(&sts, ep, oidp->ref);
oop = dbs_OidToObject(&sts, ep, op->oid);
aop = dbs_After(&sts, ep, op);
printf("Oid %d.%d, [%d.%d] -> %s %d.%d ", oidp->oid.vid, oidp->oid.oix, s.b.sect, s.b.offs,
op->name, op->oid.vid, op->oid.oix);
if (oop == NULL)
printf(" NULL");
else
printf("(%d.%d)", oop->oid.vid, oop->oid.oix);
if (aop == NULL)
printf(" NULL\n");
else
printf(" (%s)\n", aop->name);
}
np = (dbs_sName*)((char *)fp + sp[dbs_eSect_name].offset);
enp = (dbs_sName*)((char *)np + sp[dbs_eSect_name].size);
for (; np < enp; np = (dbs_sName*)((char *)np + dbs_dAlign(sizeof(dbs_sName)))) {
dbs_uRefBits r;
dbs_sObject *op, *oop, *nop;
pwr_tStatus sts;
r.m = np->ref;
op = dbs_Address(&sts, ep, np->ref);
oop = dbs_OidToObject(&sts, ep, op->oid);
nop = dbs_NameToObject(&sts, ep, op->poid, op->normname);
printf("N %d %s, [%d.%d] -> %s %d.%d ", np->poix, np->normname, r.b.sect, r.b.offs,
op->name, op->oid.vid, op->oid.oix);
if (oop == NULL)
printf("NULL");
else
printf("(%d.%d)", oop->oid.vid, oop->oid.oix);
if (oop == NULL)
printf(" NULL\n");
else
printf(" (%d.%d)\n", nop->oid.vid, nop->oid.oix);
}
cp = (dbs_sClass*)((char *)fp + sp[dbs_eSect_class].offset);
ecp = (dbs_sClass*)((char *)np + sp[dbs_eSect_class].size);
for (; cp < ecp; cp = (dbs_sClass*)((char *)cp + dbs_dAlign(sizeof(dbs_sClass)))) {
dbs_sObject *op;
pwr_tStatus sts;
printf("C %d\n", cp->cid);
op = dbs_ClassToObject(&sts, ep, cp->cid);
while (op != NULL) {
printf(" %d %d.%d %s\n", op->cid, op->oid.vid, op->oid.oix, op->name);
op = dbs_Next(&sts, ep, op);
}
}
return ep;
} }
static int
comp_oid(void *key, void *record)
{
pwr_tOid *k = (pwr_tOid *) key;
dbs_sOid *o = (dbs_sOid *) record;
if (k->vid == o->oid.vid) {
if (k->oix == o->oid.oix)
return 0;
else if (k->oix < o->oid.oix)
return -1;
else
return 1;
} else if (k->vid < o->oid.vid)
return -1;
else
return 1;
#if 0 }
dbs_sFile *
dbsdr_sFile(void *s, dbs_sFile *t) static int
comp_cid(void *key, void *record)
{
pwr_tCid *k = (pwr_tCid *) key;
dbs_sClass *c = (dbs_sClass *) record;
if (*k == c->cid)
return 0;
else if (*k < c->cid)
return -1;
else
return 1;
}
static int
comp_name(void *key, void *record)
{
dbs_sName *k = (dbs_sName *) key;
dbs_sName *n = (dbs_sName *) record;
if (k->poix < n->poix)
return -1;
else if (k->poix == n->poix)
return strcmp(k->normname, n->normname);
else
return 1;
}
dbs_sObject *
dbs_OidToObject(pwr_tStatus *sts, const dbs_sEnv *ep, pwr_tOid oid)
{
dbs_sOid *oidp;
dbs_sObject *op;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
oidp = (dbs_sOid *)dbs_Bfind(sts, ep, &vp->oid_bt, &oid, comp_oid);
if (oidp == NULL)
return NULL;
op = dbs_Address(sts, ep, oidp->ref);
return op;
}
dbs_sObject *
dbs_After(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{
dbs_sOid *oidp;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
dbs_sQlink *ol;
dbs_sObject *pop;
oidp = (dbs_sOid *)dbs_Bfind(sts, ep, &vp->oid_bt, &op->poid, comp_oid);
if (oidp == NULL)
return NULL;
pop = dbs_Address(sts, ep, oidp->ref);
ol = dbs_Qsucc(sts, ep, &op->sib_ll);
if (ol == &pop->sib_lh)
return NULL;
return dbs_Qitem(ol, dbs_sObject, sib_ll);
}
dbs_sObject *
dbs_Before(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{
dbs_sOid *oidp;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
dbs_sQlink *ol;
dbs_sObject *pop;
oidp = (dbs_sOid *)dbs_Bfind(sts, ep, &vp->oid_bt, &op->poid, comp_oid);
if (oidp == NULL)
return NULL;
pop = dbs_Address(sts, ep, oidp->ref);
ol = dbs_Qpred(sts, ep, &op->sib_ll);
if (ol == &pop->sib_lh)
return NULL;
return dbs_Qitem(ol, dbs_sObject, sib_ll);
}
dbs_sObject *
dbs_First(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{ {
encode_oid(); dbs_sQlink *ol;
encode_int();
encode_time();
if (dbs_QisEmpty(sts, ep, &op->sib_lh))
return NULL;
ol = dbs_Qsucc(sts, ep, &op->sib_lh);
return dbs_Qitem(ol, dbs_sObject, sib_ll);
} }
dbs_sSect * dbs_sObject *
dbsdr_sSect(void *s, dbs_sFile *t) dbs_Last(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{ {
dbs_sQlink *ol;
if (dbs_QisEmpty(sts, ep, &op->sib_lh))
return NULL;
ol = dbs_Qpred(sts, ep, &op->sib_lh);
return dbs_Qitem(ol, dbs_sObject, sib_ll);
}
dbs_sObject *
dbs_NameToObject(pwr_tStatus *sts, const dbs_sEnv *ep, pwr_tOid oid, char *name)
{
dbs_sOid *oidp;
dbs_sObject *op;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
dbs_sName n;
dbs_sName *np;
oidp = (dbs_sOid *)dbs_Bfind(sts, ep, &vp->oid_bt, &oid, comp_oid);
if (oidp == NULL)
return NULL;
op = dbs_Address(sts, ep, oidp->ref);
if (op == NULL)
return NULL;
n.poix = oid.oix;
strcpy(n.normname, name);
np = (dbs_sName *)dbs_Bfind(sts, ep, &vp->name_bt, &n, comp_name);
if (np == NULL)
return NULL;
op = dbs_Address(sts, ep, np->ref);
return op;
} }
dbs_sVolume * dbs_sObject *
dbsdr_sVolume(void *s, dbs_sVolume *t) dbs_Child(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, char *name)
{ {
dbs_sName n;
dbs_sName *np;
n.poix = op->oid.oix;
strcpy(n.normname, name);
np = (dbs_sName *)dbs_Bfind(sts, ep, &op->name_bt, &n, comp_name);
if (np == NULL)
return NULL;
op = dbs_Address(sts, ep, np->ref);
return op;
} }
dbs_sVolRef * dbs_sObject *
dbsdr_sVolRef(void *s, dbs_sVolRef *t) dbs_ClassToObject(pwr_tStatus *sts, const dbs_sEnv *ep, pwr_tCid cid)
{ {
dbs_sClass *cp;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
dbs_sQlink *ol;
cp = (dbs_sClass *)dbs_Bfind(sts, ep, &vp->class_bt, &cid, comp_cid);
if (cp == NULL)
return NULL;
if (dbs_QisEmpty(sts, ep, &cp->o_lh))
return NULL;
ol = dbs_Qsucc(sts, ep, &cp->o_lh);
return dbs_Qitem(ol, dbs_sObject, o_ll);
} }
dbs_sObject *
dbs_Next(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{
dbs_sClass *cp;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
dbs_sQlink *ol;
cp = (dbs_sClass *)dbs_Bfind(sts, ep, &vp->class_bt, &op->cid, comp_cid);
if (cp == NULL)
return NULL;
ol = dbs_Qsucc(sts, ep, &op->o_ll);
if (ol == &cp->o_lh)
return NULL;
return dbs_Qitem(ol, dbs_sObject, o_ll);
}
dbs_sObject * dbs_sObject *
dbsdr_sObject(void *s, dbs_sObject *t) dbs_Previous(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{ {
dbs_sClass *cp;
dbs_sVolume *vp = (dbs_sVolume *)(ep->base + ep->sect[dbs_eSect_volume].offset);
dbs_sQlink *ol;
cp = (dbs_sClass *)dbs_Bfind(sts, ep, &vp->class_bt, &op->cid, comp_cid);
if (cp == NULL)
return NULL;
ol = dbs_Qpred(sts, ep, &op->o_ll);
if (ol == &cp->o_lh)
return NULL;
return dbs_Qitem(ol, dbs_sObject, o_ll);
} }
dbs_sBody * dbs_sObject *
dbsdr_sBody(void *s, dbs_sBody *t) dbs_Ancestor(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
{ {
while (op != NULL) {
if (op->oid.oix == 1)
return NULL;
if (op->poid.oix == 1)
return op;
op = dbs_Address(sts, ep, op->pref);
}
return op;
} }
#endif pwr_tBoolean
dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, const dbs_sEnv *ep)
{
int offset;
*sts = DBS__SUCCESS;
if (fread(buf, size, 1, ep->f) == 0)
pwr_Return(NO, sts, errno_GetStatus());
if ((offset = dbs_dPadding(size)) > 0)
if(fseek(ep->f, offset, SEEK_CUR))
pwr_Return(NO, sts, errno_GetStatus());
return YES;
}
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
% | Information about volumes mounted in this volume. | % | Information about volumes mounted in this volume. |
% | | % | |
% +====================================================+ % +====================================================+
% | Oix (Object index) Section | % | Oid (Object identity) Section |
% +----------------------------------------------------+ % +----------------------------------------------------+
% | | % | |
% | | % | |
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
%#define dbs_cAlignInc 7 %#define dbs_cAlignInc 7
%#define dbs_dAlign(size) (((size) + dbs_cAlignInc) & ~dbs_cAlignInc) %#define dbs_dAlign(size) (((size) + dbs_cAlignInc) & ~dbs_cAlignInc)
%#define dbs_dPadding(size) ((((size) + dbs_cAlignInc) & ~dbs_cAlignInc) - (size)) %#define dbs_dPadding(size) ((((size) + dbs_cAlignInc) & ~dbs_cAlignInc) - (size))
%#define dbs_dMakeRef(sect, offset) (0 & ((sect) << dbs_cOffsBits) & (offset)) %#define dbs_dMakeRef(sect, offset) (0 | ((sect) << dbs_cOffsBits) | (offset))
% %
%typedef union { %typedef union {
% struct { % struct {
...@@ -175,6 +175,7 @@ ...@@ -175,6 +175,7 @@
%pwr_tBoolean %pwr_tBoolean
%pdr_dbs_uRefBits(PDR *pdrs, dbs_uRefBits *objp); %pdr_dbs_uRefBits(PDR *pdrs, dbs_uRefBits *objp);
% %
%
#endif #endif
struct dbs_sQlink { struct dbs_sQlink {
...@@ -189,9 +190,9 @@ enum dbs_eSect { ...@@ -189,9 +190,9 @@ enum dbs_eSect {
dbs_eSect_dir = 0, dbs_eSect_dir = 0,
dbs_eSect_volume = 1, dbs_eSect_volume = 1,
dbs_eSect_volref = 2, dbs_eSect_volref = 2,
dbs_eSect_oid = 3,
dbs_eSect_object = 4, dbs_eSect_object = 4,
dbs_eSect_rbody = 5, dbs_eSect_rbody = 5,
dbs_eSect_oix = 3,
dbs_eSect_name = 6, dbs_eSect_name = 6,
dbs_eSect_dbody = 8, dbs_eSect_dbody = 8,
dbs_eSect_class = 10, dbs_eSect_class = 10,
...@@ -202,7 +203,7 @@ enum dbs_eSect { ...@@ -202,7 +203,7 @@ enum dbs_eSect {
#ifdef PDR_HDR #ifdef PDR_HDR
%#define dbs_mSect_volume pwr_Bit(dbs_eSect_volume) %#define dbs_mSect_volume pwr_Bit(dbs_eSect_volume)
%#define dbs_mSect_volref pwr_Bit(dbs_eSect_volref) %#define dbs_mSect_volref pwr_Bit(dbs_eSect_volref)
%#define dbs_mSect_oix pwr_Bit(dbs_eSect_oix) %#define dbs_mSect_oid pwr_Bit(dbs_eSect_oid)
%#define dbs_mSect_object pwr_Bit(dbs_eSect_object) %#define dbs_mSect_object pwr_Bit(dbs_eSect_object)
%#define dbs_mSect_rbody pwr_Bit(dbs_eSect_rbody) %#define dbs_mSect_rbody pwr_Bit(dbs_eSect_rbody)
%#define dbs_mSect_name pwr_Bit(dbs_eSect_name) %#define dbs_mSect_name pwr_Bit(dbs_eSect_name)
...@@ -285,6 +286,12 @@ enum dbs_eFile { ...@@ -285,6 +286,12 @@ enum dbs_eFile {
% %
#endif #endif
struct dbs_sBintab {
dbs_tRef start;
dbs_tRef end;
pwr_tUInt32 rsize;
};
#ifdef PDR_HDR #ifdef PDR_HDR
%/** %/**
% * @note You can't use pdr_dbs_sFile directly due to the format member. % * @note You can't use pdr_dbs_sFile directly due to the format member.
...@@ -342,6 +349,10 @@ struct dbs_sVolume { ...@@ -342,6 +349,10 @@ struct dbs_sVolume {
pwr_tTime time; /**< time at which this load file was created */ pwr_tTime time; /**< time at which this load file was created */
pwr_tUInt32 cardinality; /**< number objects in this volume */ pwr_tUInt32 cardinality; /**< number objects in this volume */
pwr_tUInt32 rbodySize; pwr_tUInt32 rbodySize;
dbs_sBintab name_bt; /**< search for object with parent and name */
dbs_sBintab oid_bt; /**< search for object with identity */
dbs_sBintab class_bt; /**< search for object with class */
}; };
/** /**
...@@ -364,19 +375,19 @@ struct dbs_sVolRef { ...@@ -364,19 +375,19 @@ struct dbs_sVolRef {
/** /**
* Object Index (oix) Section. * Object Identity (oid) Section.
* *
* Layout of an object index table entry. * Layout of an object identity table entry.
* Oix entries are stored in oix-sect. * Oid entries are stored in oid-sect.
* Used to find an object with object index as key. * Used to find an object with object identity as key.
* Table lookup mechanism is binary lookup. * Table lookup mechanism is binary lookup.
*/ */
#ifdef PDR_HDR #ifdef PDR_HDR
%#define dbs_cVersionOix 1 %#define dbs_cVersionOid 1
#endif #endif
struct dbs_sOix { struct dbs_sOid {
pwr_tOix oix; /**< Object index */ pwr_tOid oid; /**< Object identity */
dbs_tRef ref; /**< Address, section relative, to object in object section */ dbs_tRef ref; /**< Address, section relative, to object in object section */
}; };
...@@ -400,12 +411,6 @@ struct dbs_sOlink { ...@@ -400,12 +411,6 @@ struct dbs_sOlink {
pwr_tOix succ; pwr_tOix succ;
}; };
struct dbs_sBintab {
dbs_tRef start;
dbs_tRef end;
pwr_tUInt32 rsize;
};
struct dbs_sObject { struct dbs_sObject {
pwr_tOid oid; /**< object identifier */ pwr_tOid oid; /**< object identifier */
pwr_tCid cid; /**< class identifier */ pwr_tCid cid; /**< class identifier */
...@@ -442,6 +447,7 @@ struct dbs_sObject { ...@@ -442,6 +447,7 @@ struct dbs_sObject {
struct dbs_sClass { struct dbs_sClass {
pwr_tCid cid; /**< class identifier */ pwr_tCid cid; /**< class identifier */
pwr_tUInt32 nObjects;
dbs_sQlink o_lh; /**< root of list of all object dbs_sQlink o_lh; /**< root of list of all object
of this class within this volume */ of this class within this volume */
}; };
...@@ -506,7 +512,7 @@ struct dbs_sName { ...@@ -506,7 +512,7 @@ struct dbs_sName {
% FILE *f; % FILE *f;
% dbs_sFile file; % dbs_sFile file;
% pwr_tUInt32 nSect; % pwr_tUInt32 nSect;
% dbs_sSect sect[dbs_eSect_]; % dbs_sSect *sect;
% %
% /* the rest is used only if mapped */ % /* the rest is used only if mapped */
% pwr_tUInt32 size; /**< size of mapped file */ % pwr_tUInt32 size; /**< size of mapped file */
...@@ -518,37 +524,51 @@ struct dbs_sName { ...@@ -518,37 +524,51 @@ struct dbs_sName {
%#define dbs_Qitem(a, b, c) ((b *)((char *)a - offsetof(b, c))) %#define dbs_Qitem(a, b, c) ((b *)((char *)a - offsetof(b, c)))
%#define dbs_Qlink(a, b, c) ((dbs_sQlink *)((char *)a + offsetof(b, c))) %#define dbs_Qlink(a, b, c) ((dbs_sQlink *)((char *)a + offsetof(b, c)))
% %
%void *dbs_Address(pwr_tStatus*, dbs_sEnv*, dbs_tRef); %void *dbs_Address(pwr_tStatus*, const dbs_sEnv*, dbs_tRef);
%void *dbs_Alloc(pwr_tStatus*, dbs_sEnv*, pwr_tUInt32); %void *dbs_Alloc(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32);
%pwr_tBoolean dbs_AllocLookasideSegment(pwr_tStatus*, dbs_sEnv*, pwr_tUInt32, pwr_tUInt32); %pwr_tBoolean dbs_AllocLookasideSegment(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32, pwr_tUInt32);
%void *dbs_AllocNamedSegment(pwr_tStatus*, dbs_sEnv*, pwr_tUInt32, char*); %void *dbs_AllocNamedSegment(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32, char*);
%dbs_sEnv *dbs_Create(pwr_tStatus*, dbs_sEnv*, char*, pwr_tUInt32, pwr_tUInt32); %dbs_sEnv *dbs_Create(pwr_tStatus*, dbs_sEnv*, char*, pwr_tUInt32, pwr_tUInt32);
%void dbs_Dump(pwr_tStatus*, dbs_sEnv*); %void dbs_Dump(pwr_tStatus*, const dbs_sEnv*);
%pwr_tBoolean dbs_Free(pwr_tStatus*, dbs_sEnv*, void*); %pwr_tBoolean dbs_Free(pwr_tStatus*, const dbs_sEnv*, void*);
%pwr_tBoolean dbs_FreeReference(pwr_tStatus*, dbs_sEnv*, dbs_tRef); %pwr_tBoolean dbs_FreeReference(pwr_tStatus*, const dbs_sEnv*, dbs_tRef);
%dbs_tRef dbs_InDbs(pwr_tStatus*, dbs_sEnv*, void*, pwr_tUInt32); %dbs_tRef dbs_InDbs(pwr_tStatus*, const dbs_sEnv*, void*, pwr_tUInt32);
%dbs_tRef dbs_ItemReference(pwr_tStatus*, dbs_sEnv*, void*); %dbs_tRef dbs_ItemReference(pwr_tStatus*, const dbs_sEnv*, void*);
%dbs_sQlink *dbs_Qalloc(pwr_tStatus*, dbs_sEnv*); %dbs_sQlink *dbs_Qalloc(pwr_tStatus*, const dbs_sEnv*);
%pwr_tBoolean dbs_QhasOne(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %pwr_tBoolean dbs_QhasOne(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_tRef dbs_Qinit(pwr_tStatus*, dbs_sQlink*, dbs_tRef); %dbs_tRef dbs_Qinit(pwr_tStatus*, dbs_sQlink*, dbs_tRef);
%dbs_sQlink *dbs_Qinsert(pwr_tStatus*, dbs_sQlink*, dbs_sQlink*, dbs_sQlink*); %dbs_sQlink *dbs_Qinsert(pwr_tStatus*, dbs_sQlink*, dbs_sQlink*, dbs_sQlink*);
%dbs_sQlink *dbs_QinsertPred(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*); %dbs_sQlink *dbs_QinsertPred(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*, dbs_sQlink*);
%dbs_sQlink *dbs_QinsertSucc(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*); %dbs_sQlink *dbs_QinsertSucc(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*, dbs_sQlink*);
%pwr_tBoolean dbs_QisEmpty(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %pwr_tBoolean dbs_QisEmpty(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%pwr_tBoolean dbs_QisLinked(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %pwr_tBoolean dbs_QisLinked(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%pwr_tBoolean dbs_QisNull(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %pwr_tBoolean dbs_QisNull(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_sQlink *dbs_Qmove(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*, dbs_sQlink*); %dbs_sQlink *dbs_Qmove(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*, dbs_sQlink*);
%dbs_sQlink *dbs_Qpred(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %dbs_sQlink *dbs_Qpred(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_sQlink *dbs_Qremove(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %dbs_sQlink *dbs_Qremove(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_sQlink *dbs_QremovePred(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %dbs_sQlink *dbs_QremovePred(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_sQlink *dbs_QremoveSucc(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %dbs_sQlink *dbs_QremoveSucc(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_sQlink *dbs_Qsucc(pwr_tStatus*, dbs_sEnv*, dbs_sQlink*); %dbs_sQlink *dbs_Qsucc(pwr_tStatus*, const dbs_sEnv*, dbs_sQlink*);
%dbs_tRef dbs_RefAlloc(pwr_tStatus*, dbs_sEnv*, pwr_tUInt32); %dbs_tRef dbs_RefAlloc(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32);
%dbs_tRef dbs_Reference(pwr_tStatus*, dbs_sEnv*, void*); %dbs_tRef dbs_Reference(pwr_tStatus*, const dbs_sEnv*, void*);
% %
%pwr_tBoolean dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, dbs_sEnv *ep); %pwr_tBoolean dbs_AlignedRead(pwr_tStatus *sts, void *buf, pwr_tUInt32 size, const dbs_sEnv *ep);
%pwr_tBoolean dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep); %pwr_tBoolean dbs_Close(pwr_tStatus *sts, dbs_sEnv *ep);
%dbs_sEnv *dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename); %dbs_sEnv *dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename);
%dbs_sEnv *dbs_Map(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename);
%
%dbs_sObject *dbs_OidToObject(pwr_tStatus *sts, const dbs_sEnv *ep, pwr_tOid oid);
%dbs_sObject *dbs_NameToObject(pwr_tStatus *sts, const dbs_sEnv *ep, pwr_tOid oid, char *name);
%dbs_sObject *dbs_Parent(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_After(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_Before(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_First(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_Last(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_ClassToObject(pwr_tStatus *sts, const dbs_sEnv *ep, pwr_tCid cid);
%dbs_sObject *dbs_Next(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_Previous(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sObject *dbs_Child(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, char *name);
%dbs_sObject *dbs_Ancestor(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
% %
% %
%#ifdef __cplusplus %#ifdef __cplusplus
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "pwr.h" #include "pwr.h"
#include "wb_orep.h" #include "wb_orep.h"
#include "wb_object.h" #include "wb_object.h"
#include "co_dbs.h"
#include "wb_name.h" #include "wb_name.h"
class wb_adef; class wb_adef;
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "pwr.h" #include "pwr.h"
#include "pwr_class.h" #include "pwr_class.h"
#include "co_dbs.h"
#include "wb_name.h" #include "wb_name.h"
#include "wb_orep.h" #include "wb_orep.h"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#endif #endif
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
#include <assert.h>
#include "pwr.h" #include "pwr.h"
#include "co_cdh.h" #include "co_cdh.h"
...@@ -35,10 +36,18 @@ ...@@ -35,10 +36,18 @@
static int comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y); static int comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y);
wb_dbs::wb_dbs(wb_vrep *v) wb_dbs::wb_dbs(wb_vrep *v) :
m_oid(pwr_cNOid), 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)
{ {
pwr_tStatus sts; pwr_tStatus sts;
memset(m_name, 0, sizeof(m_name));
memset(&m_volume, 0, sizeof(m_volume));
memset(m_sect, 0, sizeof(m_sect));
clock_gettime(CLOCK_REALTIME, &m_volume.time); clock_gettime(CLOCK_REALTIME, &m_volume.time);
m_v = v; m_v = v;
...@@ -52,10 +61,10 @@ wb_dbs::wb_dbs(wb_vrep *v) ...@@ -52,10 +61,10 @@ wb_dbs::wb_dbs(wb_vrep *v)
sprintf(m_name, dbs_cNameVolume, dbs_cDirectory, m_v->name()); sprintf(m_name, dbs_cNameVolume, dbs_cDirectory, m_v->name());
dcli_translate_filename(m_name, m_name); dcli_translate_filename(m_name, m_name);
m_oix_th = tree_CreateTable(&sts, sizeof(pwr_tOid), offsetof(sOentry, o.oid), m_oid_th = tree_CreateTable(&sts, sizeof(pwr_tOid), offsetof(sOentry, o.oid),
sizeof(sOentry), 1000, tree_Comp_oid); sizeof(sOentry), 1000, tree_Comp_oid);
m_name_th = tree_CreateTable(&sts, sizeof(dbs_sName), offsetof(sNentry, n.poix), m_name_th = tree_CreateTable(&sts, sizeof(dbs_sName), offsetof(sNentry, n),
sizeof(sNentry), 1000, comp_dbs_name); sizeof(sNentry), 1000, comp_dbs_name);
m_class_th = tree_CreateTable(&sts, sizeof(pwr_tCid), offsetof(sCentry, c), m_class_th = tree_CreateTable(&sts, sizeof(pwr_tCid), offsetof(sCentry, c),
...@@ -66,7 +75,15 @@ wb_dbs::~wb_dbs() ...@@ -66,7 +75,15 @@ wb_dbs::~wb_dbs()
{ {
pwr_tStatus sts; pwr_tStatus sts;
tree_DeleteTable(&sts, m_oix_th);
printf("m_nObjects: %d\n", m_nObjects);
printf("m_nTreeObjects: %d\n", m_nTreeObjects);
printf("m_nClassObjects: %d\n", m_nClassObjects);
printf("m_nNameObjects: %d\n", m_nNameObjects);
printf("m_nRbodyObjects: %d\n", m_nRbodyObjects);
printf("m_nDbodyObjects: %d\n", m_nDbodyObjects);
tree_DeleteTable(&sts, m_oid_th);
tree_DeleteTable(&sts, m_name_th); tree_DeleteTable(&sts, m_name_th);
tree_DeleteTable(&sts, m_class_th); tree_DeleteTable(&sts, m_class_th);
} }
...@@ -75,19 +92,19 @@ wb_dbs::~wb_dbs() ...@@ -75,19 +92,19 @@ wb_dbs::~wb_dbs()
static int static int
comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y) comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y)
{ {
sNentry *xKey = (sNentry *) (tp->keyOffset + (char *) x); dbs_sName *xKey = (dbs_sName *) (tp->keyOffset + (char *) x);
sNentry *yKey = (sNentry *) (tp->keyOffset + (char *) y); dbs_sName *yKey = (dbs_sName *) (tp->keyOffset + (char *) y);
int comp; int comp;
if (xKey->n.poix < yKey->n.poix) if (xKey->poix < yKey->poix)
comp = -1; comp = -1;
else if (xKey->n.poix == yKey->n.poix) else if (xKey->poix == yKey->poix)
comp = strcmp(xKey->n.normname, yKey->n.normname); comp = strcmp(xKey->normname, yKey->normname);
else else
comp = 1; comp = 1;
// printf("%d:%s %c %d:%s\n", xKey->poix, xKey->normname, (comp == 1 ? '>' : (comp == -1 ? '<' : '=')), yKey->poix, yKey->normname); //printf("%d:%s %c %d:%s\n", xKey->poix, xKey->normname, (comp == 1 ? '>' : (comp == -1 ? '<' : '=')), yKey->poix, yKey->normname);
return comp; return comp;
} }
...@@ -98,6 +115,7 @@ wb_dbs::buildFile() ...@@ -98,6 +115,7 @@ wb_dbs::buildFile()
m_v->iterObject(this); m_v->iterObject(this);
buildSectName(); buildSectName();
checkObject(m_oep); checkObject(m_oep);
buildSectOid();
buildSectClass(); buildSectClass();
createFile(); createFile();
} }
...@@ -110,17 +128,19 @@ wb_dbs::checkObject(sOentry *oep) ...@@ -110,17 +128,19 @@ wb_dbs::checkObject(sOentry *oep)
dbs_sQlink *sib_lh; dbs_sQlink *sib_lh;
dbs_sQlink *sib_ll; dbs_sQlink *sib_ll;
sOentry *sep; sOentry *sep;
sNentry ne; dbs_sName n;
sNentry *nep; sNentry *nep;
// Check object // Check object
if (!oep->flags.b.exist) { if (!oep->flags.b.exist) {
printf("Object does not exist!\n"); printf("Object does not exist!\n");
} else {
m_volume.cardinality++;
} }
m_nTreeObjects++;
//printf("tree: %s\n", oep->o.name);
oep->ref = dbs_dMakeRef(dbs_eSect_object, m_sect[dbs_eSect_object].size); oep->ref = dbs_dMakeRef(dbs_eSect_object, m_sect[dbs_eSect_object].size);
m_sect[dbs_eSect_object].size += dbs_dAlign(sizeof(dbs_sObject)); m_sect[dbs_eSect_object].size += dbs_dAlign(sizeof(dbs_sObject));
dbs_Qinit(&sts, &oep->o.sib_lh, oep->ref + offsetof(dbs_sObject, sib_lh)); dbs_Qinit(&sts, &oep->o.sib_lh, oep->ref + offsetof(dbs_sObject, sib_lh));
...@@ -145,26 +165,27 @@ wb_dbs::checkObject(sOentry *oep) ...@@ -145,26 +165,27 @@ wb_dbs::checkObject(sOentry *oep)
} }
/* Check name table, get reference to first and last child in name order. */ /* Check name table, get reference to first and last child in name order. */
memset(&ne, 0, sizeof(ne)); memset(&n, 0, sizeof(n));
ne.n.poix = oep->o.oid.oix; n.poix = oep->o.oid.oix;
nep = (sNentry*)tree_FindSuccessor(&sts, m_name_th, &ne); nep = (sNentry*)tree_FindSuccessor(&sts, m_name_th, &n);
if (nep != NULL && nep->n.poix == oep->o.oid.oix) { if (nep != NULL && nep->n.poix == oep->o.oid.oix) {
oep->o.name_bt.start = nep->n.ref; oep->o.name_bt.start = nep->ref;
} }
ne.n.poix += 1; n.poix += 1;
nep = (sNentry*)tree_FindPredecessor(&sts, m_name_th, &ne); nep = (sNentry*)tree_FindPredecessor(&sts, m_name_th, &n);
if (nep != NULL && nep->n.poix == oep->o.oid.oix) { if (nep != NULL && nep->n.poix == oep->o.oid.oix) {
oep->o.name_bt.end = nep->n.ref; oep->o.name_bt.end = nep->ref;
} }
oep->o.name_bt.rsize = dbs_dAlign(sizeof(dbs_sName));
} }
pwr_tStatus pwr_tStatus
wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid, pwr_tOid boid, pwr_tOid foid,
pwr_tOid loid, pwr_tObjName name, pwr_tObjName normname, pwr_tTime time, pwr_tOid loid, pwr_tObjName name, pwr_tObjName normname, pwr_tTime time,
pwr_tTime rbTime, pwr_tTime dbTime, size_t rbSize, size_t dbSize) pwr_tTime rbTime, pwr_tTime dbTime, size_t rbSize, size_t dbSize)
{ {
sNentry ne;
sNentry *nep; sNentry *nep;
sOentry *oep; sOentry *oep;
pwr_tStatus sts; pwr_tStatus sts;
...@@ -172,10 +193,12 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, ...@@ -172,10 +193,12 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid,
if (cdh_ObjidIsNull(oid)) if (cdh_ObjidIsNull(oid))
printf("Error: object is null!\n"); printf("Error: object is null!\n");
oep = (sOentry *)tree_Insert(&sts, m_oix_th, &oid); //printf("install: %s o:%d.%d p:%d.%d b:%d.%d a:%d.%d f:%d.%d l:%d.%d \n", name, oid.vid, oid.oix, poid.vid, poid.oix, boid.vid, boid.oix, aoid.vid, aoid.oix, foid.vid, foid.oix, loid.vid, loid.oix);
oep = (sOentry *)tree_Insert(&sts, m_oid_th, &oid);
if (sts == TREE__INSERTED) { if (sts == TREE__INSERTED) {
} else { } else if (oep->flags.b.exist) {
printf("Error: object is already inserted!\n"); printf("*** Error: object is already inserted!\n");
} }
if (oid.oix == pwr_cNOix) { if (oid.oix == pwr_cNOix) {
...@@ -187,16 +210,17 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, ...@@ -187,16 +210,17 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid,
// Link objects to its relatives // Link objects to its relatives
if (cdh_ObjidIsNotNull(poid)) if (cdh_ObjidIsNotNull(poid))
oep->poep = (sOentry *)tree_Insert(&sts, m_oix_th, &poid); oep->poep = (sOentry *)tree_Insert(&sts, m_oid_th, &poid);
if (cdh_ObjidIsNotNull(boid)) if (cdh_ObjidIsNotNull(boid))
oep->boep = (sOentry *)tree_Insert(&sts, m_oix_th, &boid); oep->boep = (sOentry *)tree_Insert(&sts, m_oid_th, &boid);
if (cdh_ObjidIsNotNull(aoid)) if (cdh_ObjidIsNotNull(aoid))
oep->aoep = (sOentry *)tree_Insert(&sts, m_oix_th, &aoid); oep->aoep = (sOentry *)tree_Insert(&sts, m_oid_th, &aoid);
if (cdh_ObjidIsNotNull(foid)) if (cdh_ObjidIsNotNull(foid))
oep->foep = (sOentry *)tree_Insert(&sts, m_oix_th, &foid); oep->foep = (sOentry *)tree_Insert(&sts, m_oid_th, &foid);
if (cdh_ObjidIsNotNull(loid)) if (cdh_ObjidIsNotNull(loid))
oep->loep = (sOentry *)tree_Insert(&sts, m_oix_th, &loid); oep->loep = (sOentry *)tree_Insert(&sts, m_oid_th, &loid);
m_nObjects++;
m_volume.cardinality++; m_volume.cardinality++;
#if 0 #if 0
...@@ -214,12 +238,16 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, ...@@ -214,12 +238,16 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid,
oep->o.time = time; oep->o.time = time;
/* insert into name table */ if (cdh_ObjidIsNotNull(poid)) {
memset(&ne, 0, sizeof(ne)); dbs_sName n;
ne.n.poix = poid.oix;
strcpy(ne.n.normname, normname); /* insert into name table */
nep = (sNentry*)tree_Insert(&sts, m_name_th, &ne); memset(&n, 0, sizeof(n));
nep->oep = oep; n.poix = poid.oix;
strcpy(n.normname, normname);
nep = (sNentry*)tree_Insert(&sts, m_name_th, &n);
nep->oep = oep;
}
classInsert(oep); classInsert(oep);
...@@ -264,6 +292,15 @@ wb_dbs::createFile() ...@@ -264,6 +292,15 @@ wb_dbs::createFile()
printf("\n-- Working with load file volume '%s'...\n", m_v->name()); printf("\n-- Working with load file volume '%s'...\n", m_v->name());
/*{
unsigned int i;
for (i = 0; i < (sizeof(m_sect)/sizeof(m_sect[0])); i++) {
printf("sect[%d]: version: %d, type: %d, size: %d, offset: %d\n", i, m_sect[i].version,
m_sect[i].type, m_sect[i].size, m_sect[i].offset);
}
}*/
printf("-- Open file...\n"); printf("-- Open file...\n");
sts = openFile(); sts = openFile();
if (EVEN(sts)) goto error_handler; if (EVEN(sts)) goto error_handler;
...@@ -293,13 +330,13 @@ wb_dbs::createFile() ...@@ -293,13 +330,13 @@ wb_dbs::createFile()
if (EVEN(sts)) goto error_handler; if (EVEN(sts)) goto error_handler;
size += m_sect[dbs_eSect_volref].size; size += m_sect[dbs_eSect_volref].size;
m_sect[dbs_eSect_oix].offset = size; m_sect[dbs_eSect_oid].offset = size;
printf("-- Writing oix section...\n"); printf("-- Writing oid section...\n");
sts = writeSectOix(); sts = writeSectOid();
if (EVEN(sts)) goto error_handler; if (EVEN(sts)) goto error_handler;
size += m_sect[dbs_eSect_oix].size; size += m_sect[dbs_eSect_oid].size;
m_sect[dbs_eSect_rbody].offset = size; m_sect[dbs_eSect_rbody].offset = size;
printf("-- Writing rbody section...\n"); printf("-- Writing rbody section...\n");
...@@ -423,7 +460,7 @@ wb_dbs::writeSectDirectory() ...@@ -423,7 +460,7 @@ wb_dbs::writeSectDirectory()
m_sect[dbs_eSect_dir].version = dbs_cVersionDirectory; m_sect[dbs_eSect_dir].version = dbs_cVersionDirectory;
m_sect[dbs_eSect_volume].version = dbs_cVersionVolume; m_sect[dbs_eSect_volume].version = dbs_cVersionVolume;
m_sect[dbs_eSect_volref].version = dbs_cVersionVolRef; m_sect[dbs_eSect_volref].version = dbs_cVersionVolRef;
m_sect[dbs_eSect_oix].version = dbs_cVersionOix; m_sect[dbs_eSect_oid].version = dbs_cVersionOid;
m_sect[dbs_eSect_object].version = dbs_cVersionObject; m_sect[dbs_eSect_object].version = dbs_cVersionObject;
m_sect[dbs_eSect_rbody].version = dbs_cVersionRbody; m_sect[dbs_eSect_rbody].version = dbs_cVersionRbody;
m_sect[dbs_eSect_name].version = dbs_cVersionName; m_sect[dbs_eSect_name].version = dbs_cVersionName;
...@@ -433,7 +470,7 @@ wb_dbs::writeSectDirectory() ...@@ -433,7 +470,7 @@ wb_dbs::writeSectDirectory()
m_sect[dbs_eSect_dir].type = dbs_eSect_dir; m_sect[dbs_eSect_dir].type = dbs_eSect_dir;
m_sect[dbs_eSect_volume].type = dbs_eSect_volume; m_sect[dbs_eSect_volume].type = dbs_eSect_volume;
m_sect[dbs_eSect_volref].type = dbs_eSect_volref; m_sect[dbs_eSect_volref].type = dbs_eSect_volref;
m_sect[dbs_eSect_oix].type = dbs_eSect_oix; m_sect[dbs_eSect_oid].type = dbs_eSect_oid;
m_sect[dbs_eSect_object].type = dbs_eSect_object; m_sect[dbs_eSect_object].type = dbs_eSect_object;
m_sect[dbs_eSect_rbody].type = dbs_eSect_rbody; m_sect[dbs_eSect_rbody].type = dbs_eSect_rbody;
m_sect[dbs_eSect_name].type = dbs_eSect_name; m_sect[dbs_eSect_name].type = dbs_eSect_name;
...@@ -445,10 +482,21 @@ wb_dbs::writeSectDirectory() ...@@ -445,10 +482,21 @@ wb_dbs::writeSectDirectory()
if (fseek(m_fp, m_sect[dbs_eSect_dir].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_dir].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
/*{
unsigned int i;
for (i = 0; i < (sizeof(m_sect)/sizeof(m_sect[0])); i++) {
printf("sect[%d]: version: %d, type: %d, size: %d, offset: %d\n", i, m_sect[i].version,
m_sect[i].type, m_sect[i].size, m_sect[i].offset);
}
}*/
if (fwrite(&m_sect, sizeof(m_sect), 1, m_fp) < 1) if (fwrite(&m_sect, sizeof(m_sect), 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_dir].offset + m_sect[dbs_eSect_dir].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
...@@ -459,9 +507,6 @@ wb_dbs::writeSectVolume() ...@@ -459,9 +507,6 @@ wb_dbs::writeSectVolume()
dbs_sVolume *vp = (dbs_sVolume *)v; dbs_sVolume *vp = (dbs_sVolume *)v;
if (m_sect[dbs_eSect_volume].size == 0)
return LDH__SUCCESS;
if (fseek(m_fp, m_sect[dbs_eSect_volume].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_volume].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
...@@ -479,6 +524,8 @@ wb_dbs::writeSectVolume() ...@@ -479,6 +524,8 @@ wb_dbs::writeSectVolume()
if (fwrite(v, sizeof(v), 1, m_fp) < 1) if (fwrite(v, sizeof(v), 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_volume].offset + m_sect[dbs_eSect_volume].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
...@@ -486,48 +533,47 @@ wb_dbs::writeSectVolume() ...@@ -486,48 +533,47 @@ wb_dbs::writeSectVolume()
pwr_tStatus pwr_tStatus
wb_dbs::writeSectVolref() wb_dbs::writeSectVolref()
{ {
//dbs_sVolRef volref; dbs_sVolRef volref;
cdh_uTid cid;
if (m_sect[dbs_eSect_volref].size == 0) sCentry *cep;
return LDH__SUCCESS; pwr_tStatus sts;
if (fseek(m_fp, m_sect[dbs_eSect_volref].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_volref].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
#if 0
memset(&volref, 0, sizeof(volref)); memset(&volref, 0, sizeof(volref));
cid.pwr = pwr_cNCid;
cep = (sCentry*)tree_FindSuccessor(&sts, m_class_th, &cid.pwr);
memset(&ce, 0, sizeof(ce));
ce.c.cid = 0;
cep = (sCentry*)tree_FindSuccessor(&sts, m_class_th, &ce.c.cid);
while (cep) { while (cep) {
cdh_uTypeId cid; cdh_uVid vid;
cdh_uVolumeId vid;
vid.pwr = pwr_cNVid;
cid.pwr = cep->c.cid; cid.pwr = cep->c.cid;
vid.pwr = pwr_cNvid;
vid.v.vid_0 = cid.c.vid_0; vid.v.vid_0 = cid.c.vid_0;
vid.v.vid_1 = cid.c.vid_1; vid.v.vid_1 = cid.c.vid_1;
vp->vid = vid.pwr; if (vid.pwr != m_volume.vid) {
vp->cid = pwr_eClass_ClassVolume; printf("volref: %d.%d.%d.%d\n", vid.v.vid_0, vid.v.vid_1, vid.v.vid_2, vid.v.vid_3);
//vp->time = ?; volref.vid = vid.pwr;
//volref.name = ?;
volref.cid = pwr_eClass_ClassVolume;
//vp->time = ?;
//volref.size = ?;
//volref.offset = ?;
if (fwrite(&volref, sizeof(volref), 1, m_fp) < 1)
return LDH__FILEWRITE;
m_sect[dbs_eSect_volref].size += sizeof(volref);
}
vid.pwr++;
cid.pwr = pwr_cNCid;
cid.c.vid_0 = vid.v.vid_0;
cid.c.vid_1 = vid.v.vid_1;
cep = (sCentry*)tree_FindSuccessor(&sts, m_class_th, &cid.pwr);
} }
if (nep != NULL && nep->n.poix == oep->o.oid.oix) {
oep->o.name_bt.start = nep->n.ref;
}
ce.c.cid = 0;
nep = (sNentry*)tree_FindPredecessor(&sts, m_name_th, &ne);
if (nep != NULL && nep->n.poix == oep->o.oid.oix) {
oep->o.name_bt.end = nep->n.ref;
}
#endif
#if 0 #if 0
sts = OpenSect(dbs_eSect_volref); sts = OpenSect(dbs_eSect_volref);
if (EVEN(sts)) return sts; if (EVEN(sts)) return sts;
...@@ -561,8 +607,6 @@ wb_dbs::writeSectVolref() ...@@ -561,8 +607,6 @@ wb_dbs::writeSectVolref()
// xdrmem_create(&xdrs, (char *) &VolRef, sizeof(VolRef), XDR_ENCODE); // xdrmem_create(&xdrs, (char *) &VolRef, sizeof(VolRef), XDR_ENCODE);
// if(!xdr_dbs_sVolRef(&xdrs, &VolRef)) return LDH__XDR; // if(!xdr_dbs_sVolRef(&xdrs, &VolRef)) return LDH__XDR;
if (fwrite(&VolRef, sizeof(volRef), 1, m_fp) < 1) return LDH__FILEWRITE;
// m_head.SectSize += sizeof(volRef);
} }
} }
#endif #endif
...@@ -571,38 +615,62 @@ wb_dbs::writeSectVolref() ...@@ -571,38 +615,62 @@ wb_dbs::writeSectVolref()
} }
pwr_tStatus pwr_tStatus
wb_dbs::writeSectOix() wb_dbs::writeSectOid()
{ {
sOentry *oep; sOentry *oep;
char o[dbs_dAlign(sizeof(dbs_sOix))]; char o[dbs_dAlign(sizeof(dbs_sOid))];
dbs_sOix *op = (dbs_sOix*)o; dbs_sOid *op = (dbs_sOid*)o;
if (m_sect[dbs_eSect_oix].size == 0) if (m_sect[dbs_eSect_oid].size == 0)
return LDH__SUCCESS; return LDH__SUCCESS;
if (fseek(m_fp, m_sect[dbs_eSect_oix].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_oid].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
memset(o, 0, sizeof(o)); memset(o, 0, sizeof(o));
oep = (sOentry*)tree_Minimum(NULL, m_oix_th); oep = (sOentry*)tree_Minimum(NULL, m_oid_th);
while (oep != NULL) { while (oep != NULL) {
op->oix = oep->o.oid.oix; op->oid = oep->o.oid;
op->ref = oep->ref; op->ref = oep->ref;
if (fwrite(o, sizeof(o), 1, m_fp) < 1) if (fwrite(o, sizeof(o), 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
oep = (sOentry*)tree_Successor(NULL, m_oix_th, (tree_sNode*)oep); oep = (sOentry*)tree_Successor(NULL, m_oid_th, (tree_sNode*)oep);
} }
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_oid].offset + m_sect[dbs_eSect_oid].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
static pwr_tStatus
writeTree(sOentry *oep, FILE *fp)
{
pwr_tStatus sts;
if (!oep)
return 1;
if (fwrite(&oep->o, dbs_dAlign(sizeof(oep->o)), 1, fp) < 1)
return LDH__FILEWRITE;
sts = writeTree(oep->foep, fp);
if (EVEN(sts))
return sts;
sts = writeTree(oep->aoep, fp);
if (EVEN(sts))
return sts;
return 1;
}
pwr_tStatus pwr_tStatus
wb_dbs::writeSectObject() wb_dbs::writeSectObject()
{ {
sOentry *oep; //sOentry *oep;
if (m_sect[dbs_eSect_object].size == 0) if (m_sect[dbs_eSect_object].size == 0)
return LDH__SUCCESS; return LDH__SUCCESS;
...@@ -610,15 +678,9 @@ wb_dbs::writeSectObject() ...@@ -610,15 +678,9 @@ wb_dbs::writeSectObject()
if (fseek(m_fp, m_sect[dbs_eSect_object].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_object].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
// @todo change to tree-order writeTree(m_oep, m_fp);
oep = (sOentry*)tree_Minimum(NULL, m_oix_th);
while (oep != NULL) {
//printf("o.rsize[%s]: %d\n", oep->o.name, oep->rbody.size);
if (fwrite(&oep->o, dbs_dAlign(sizeof(oep->o)), 1, m_fp) < 1)
return LDH__FILEWRITE;
oep = (sOentry*)tree_Successor(NULL, m_oix_th, (tree_sNode*)oep); assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_object].offset + m_sect[dbs_eSect_object].size));
}
return LDH__SUCCESS; return LDH__SUCCESS;
} }
...@@ -631,12 +693,19 @@ wb_dbs::installDbody(pwr_tOid oid, void *body) ...@@ -631,12 +693,19 @@ wb_dbs::installDbody(pwr_tOid oid, void *body)
sOentry *oep; sOentry *oep;
char b[dbs_dAlign(sizeof(dbs_sBody))]; char b[dbs_dAlign(sizeof(dbs_sBody))];
m_nDbodyObjects++;
memset(b, 0, sizeof(b)); memset(b, 0, sizeof(b));
oep = (sOentry *)tree_Find(&sts, m_oix_th, &oid); oep = (sOentry *)tree_Find(&sts, m_oid_th, &oid);
if (EVEN(sts)) { if (EVEN(sts)) {
} }
if (oep->dbody.size == 0) {
if (body != 0) printf("error body size\n");
return 1;
}
oep->o.dbody.ref = dbs_dMakeRef(dbs_eSect_dbody, m_sect[dbs_eSect_dbody].size + dbs_dAlign(sizeof(dbs_sBody))); oep->o.dbody.ref = dbs_dMakeRef(dbs_eSect_dbody, m_sect[dbs_eSect_dbody].size + dbs_dAlign(sizeof(dbs_sBody)));
m_sect[dbs_eSect_dbody].size += oep->dbody.size + sizeof(b); m_sect[dbs_eSect_dbody].size += oep->dbody.size + sizeof(b);
...@@ -658,14 +727,13 @@ pwr_tStatus ...@@ -658,14 +727,13 @@ pwr_tStatus
wb_dbs::writeSectDbody() wb_dbs::writeSectDbody()
{ {
if (m_sect[dbs_eSect_dbody].size == 0)
return LDH__SUCCESS;
if (fseek(m_fp, m_sect[dbs_eSect_dbody].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_dbody].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
m_v->iterDbody(this); m_v->iterDbody(this);
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_dbody].offset + m_sect[dbs_eSect_dbody].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
...@@ -677,13 +745,22 @@ wb_dbs::installRbody(pwr_tOid oid, void *body) ...@@ -677,13 +745,22 @@ wb_dbs::installRbody(pwr_tOid oid, void *body)
sOentry *oep; sOentry *oep;
char b[dbs_dAlign(sizeof(dbs_sBody))]; char b[dbs_dAlign(sizeof(dbs_sBody))];
m_nRbodyObjects++;
memset(b, 0, sizeof(b)); memset(b, 0, sizeof(b));
oep = (sOentry *)tree_Find(&sts, m_oix_th, &oid); oep = (sOentry *)tree_Find(&sts, m_oid_th, &oid);
if (EVEN(sts)) { if (EVEN(sts)) {
} }
//printf("install body: %u\n", (unsigned int)body);
oep->o.rbody.ref = dbs_dMakeRef(dbs_eSect_rbody, m_sect[dbs_eSect_rbody].size + dbs_dAlign(sizeof(dbs_sBody))); //printf(" 1 install Rbody %s, bsize: %d, ssize: %d\n", oep->o.name, oep->rbody.size, m_sect[dbs_eSect_rbody].size);
if (oep->rbody.size == 0) {
if (body != 0) printf("error body size\n");
return 1;
}
oep->o.rbody.ref = dbs_dMakeRef(dbs_eSect_rbody, m_sect[dbs_eSect_rbody].size + sizeof(b));
m_sect[dbs_eSect_rbody].size += oep->rbody.size + sizeof(b); m_sect[dbs_eSect_rbody].size += oep->rbody.size + sizeof(b);
memcpy(b, &oep->rbody, sizeof(oep->rbody)); memcpy(b, &oep->rbody, sizeof(oep->rbody));
...@@ -691,11 +768,13 @@ wb_dbs::installRbody(pwr_tOid oid, void *body) ...@@ -691,11 +768,13 @@ wb_dbs::installRbody(pwr_tOid oid, void *body)
if (fwrite(b, sizeof(b), 1, m_fp) < 1) if (fwrite(b, sizeof(b), 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
//printf(" 2 install Rbody %s, bsize: %d, ssize: %d\n", oep->o.name, oep->rbody.size, m_sect[dbs_eSect_rbody].size);
/* @todo!!! objdid_self */ /* @todo!!! objdid_self */
if (fwrite(body, oep->rbody.size, 1, m_fp) < 1) if (fwrite(body, oep->rbody.size, 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
//printf(" 3 install Rbody %s, bsize: %d, ssize: %d\n", oep->o.name, oep->rbody.size, m_sect[dbs_eSect_rbody].size);
return sts; return sts;
} }
...@@ -704,14 +783,13 @@ pwr_tStatus ...@@ -704,14 +783,13 @@ pwr_tStatus
wb_dbs::writeSectRbody() wb_dbs::writeSectRbody()
{ {
if (m_sect[dbs_eSect_rbody].size == 0)
return LDH__SUCCESS;
if (fseek(m_fp, m_sect[dbs_eSect_rbody].offset, SEEK_SET) != 0) if (fseek(m_fp, m_sect[dbs_eSect_rbody].offset, SEEK_SET) != 0)
return LDH__FILEPOS; return LDH__FILEPOS;
m_v->iterRbody(this); m_v->iterRbody(this);
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_rbody].offset + m_sect[dbs_eSect_rbody].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
...@@ -728,12 +806,17 @@ wb_dbs::writeSectName() ...@@ -728,12 +806,17 @@ wb_dbs::writeSectName()
nep = (sNentry*)tree_Minimum(NULL, m_name_th); nep = (sNentry*)tree_Minimum(NULL, m_name_th);
while (nep != NULL) { while (nep != NULL) {
//printf("name: %s, poix: %d\n", nep->n.normname, nep->n.poix);
nep->n.ref = nep->oep->ref;
if (fwrite(&nep->n, dbs_dAlign(sizeof(nep->n)), 1, m_fp) < 1) if (fwrite(&nep->n, dbs_dAlign(sizeof(nep->n)), 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
nep = (sNentry*)tree_Successor(NULL, m_name_th, (tree_sNode*)nep); nep = (sNentry*)tree_Successor(NULL, m_name_th, (tree_sNode*)nep);
} }
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_name].offset + m_sect[dbs_eSect_name].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
...@@ -751,15 +834,40 @@ wb_dbs::writeSectClass() ...@@ -751,15 +834,40 @@ wb_dbs::writeSectClass()
cep = (sCentry*)tree_Minimum(NULL, m_class_th); cep = (sCentry*)tree_Minimum(NULL, m_class_th);
while (cep != NULL) { while (cep != NULL) {
//printf("class: %d, nObjects: %d\n", cep->c.cid, cep->c.nObjects);
if (fwrite(&cep->c, dbs_dAlign(sizeof(cep->c)), 1, m_fp) < 1) if (fwrite(&cep->c, dbs_dAlign(sizeof(cep->c)), 1, m_fp) < 1)
return LDH__FILEWRITE; return LDH__FILEWRITE;
cep = (sCentry*)tree_Successor(NULL, m_class_th, (tree_sNode*)cep); cep = (sCentry*)tree_Successor(NULL, m_class_th, (tree_sNode*)cep);
} }
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_class].offset + m_sect[dbs_eSect_class].size));
return LDH__SUCCESS; return LDH__SUCCESS;
} }
void
wb_dbs::buildSectOid()
{
sOentry *oep;
oep = (sOentry*)tree_Minimum(NULL, m_oid_th);
while (oep != NULL) {
oep->oidref = dbs_dMakeRef(dbs_eSect_oid, m_sect[dbs_eSect_oid].size);
m_sect[dbs_eSect_oid].size += dbs_dAlign(sizeof(dbs_sOid));
oep = (sOentry*)tree_Successor(NULL, m_oid_th, (tree_sNode*)oep);
}
oep = (sOentry*)tree_Minimum(NULL, m_oid_th);
if (oep != NULL) {
m_volume.oid_bt.start = oep->oidref;
oep = (sOentry*)tree_Maximum(NULL, m_oid_th);
m_volume.oid_bt.end = oep->oidref;
m_volume.oid_bt.rsize = dbs_dAlign(sizeof(dbs_sOid));
}
}
void void
wb_dbs::buildSectName() wb_dbs::buildSectName()
{ {
...@@ -769,11 +877,21 @@ wb_dbs::buildSectName() ...@@ -769,11 +877,21 @@ wb_dbs::buildSectName()
nep = (sNentry*)tree_Minimum(NULL, m_name_th); nep = (sNentry*)tree_Minimum(NULL, m_name_th);
while (nep != NULL) { while (nep != NULL) {
nep->n.ref = dbs_dMakeRef(dbs_eSect_name, m_sect[dbs_eSect_name].size); nep->ref = dbs_dMakeRef(dbs_eSect_name, m_sect[dbs_eSect_name].size);
m_sect[dbs_eSect_name].size += dbs_dAlign(sizeof(dbs_sName)); m_sect[dbs_eSect_name].size += dbs_dAlign(sizeof(dbs_sName));
m_nNameObjects++;
nep = (sNentry*)tree_Successor(NULL, m_name_th, (tree_sNode*)nep); nep = (sNentry*)tree_Successor(NULL, m_name_th, (tree_sNode*)nep);
} }
nep = (sNentry*)tree_Minimum(NULL, m_name_th);
if (nep != NULL) {
m_volume.name_bt.start = nep->ref;
nep = (sNentry*)tree_Maximum(NULL, m_name_th);
m_volume.name_bt.end = nep->ref;
m_volume.name_bt.rsize = dbs_dAlign(sizeof(dbs_sName));
}
} }
void void
...@@ -790,19 +908,30 @@ wb_dbs::buildSectClass() ...@@ -790,19 +908,30 @@ wb_dbs::buildSectClass()
cep = (sCentry*)tree_Minimum(NULL, m_class_th); cep = (sCentry*)tree_Minimum(NULL, m_class_th);
while (cep != NULL) { while (cep != NULL) {
ref = dbs_dMakeRef(dbs_eSect_class, m_sect[dbs_eSect_class].size);
ref = cep->ref = dbs_dMakeRef(dbs_eSect_class, m_sect[dbs_eSect_class].size);
m_sect[dbs_eSect_class].size += dbs_dAlign(sizeof(dbs_sClass)); m_sect[dbs_eSect_class].size += dbs_dAlign(sizeof(dbs_sClass));
dbs_Qinit(&sts, &cep->c.o_lh, ref + offsetof(dbs_sClass, o_lh)); dbs_Qinit(&sts, &cep->c.o_lh, ref + offsetof(dbs_sClass, o_lh));
// Link all object instances to this class // Link all object instances to this class
o_lh = o_ll = &cep->c.o_lh; o_lh = o_ll = &cep->c.o_lh;
for (oep = cep->o_lh; oep != 0; oep = oep->o_ll) { for (oep = cep->o_lh; oep != 0; oep = oep->o_ll) {
cep->c.nObjects++;
m_nClassObjects++;
dbs_Qinsert(&sts, o_ll, &oep->o.o_ll, o_lh); dbs_Qinsert(&sts, o_ll, &oep->o.o_ll, o_lh);
o_ll = &oep->o.o_ll; o_ll = &oep->o.o_ll;
} }
cep = (sCentry*)tree_Successor(NULL, m_class_th, (tree_sNode*)cep); cep = (sCentry*)tree_Successor(NULL, m_class_th, (tree_sNode*)cep);
} }
cep = (sCentry*)tree_Minimum(NULL, m_class_th);
if (cep != NULL) {
m_volume.class_bt.start = cep->ref;
cep = (sCentry*)tree_Maximum(NULL, m_class_th);
m_volume.class_bt.end = cep->ref;
m_volume.class_bt.rsize = dbs_dAlign(sizeof(dbs_sClass));
}
} }
void void
......
...@@ -31,6 +31,7 @@ struct sOentry { ...@@ -31,6 +31,7 @@ struct sOentry {
dbs_sBody dbody; dbs_sBody dbody;
mOentry flags; mOentry flags;
dbs_tRef ref; dbs_tRef ref;
dbs_tRef oidref;
sOentry *poep; sOentry *poep;
sOentry *boep; sOentry *boep;
...@@ -46,12 +47,14 @@ struct sOentry { ...@@ -46,12 +47,14 @@ struct sOentry {
struct sNentry { struct sNentry {
tree_sNode node; tree_sNode node;
dbs_sName n; dbs_sName n;
dbs_tRef ref;
sOentry *oep; sOentry *oep;
}; };
struct sCentry { struct sCentry {
tree_sNode node; tree_sNode node;
dbs_sClass c; dbs_sClass c;
dbs_tRef ref;
sOentry *o_lh; // Header of object list sOentry *o_lh; // Header of object list
sOentry *o_lt; // Tail of object list sOentry *o_lt; // Tail of object list
}; };
...@@ -73,9 +76,16 @@ public: ...@@ -73,9 +76,16 @@ public:
unsigned int m_warnings; unsigned int m_warnings;
unsigned int m_errors; unsigned int m_errors;
unsigned int m_nObjects;
unsigned int m_nTreeObjects;
unsigned int m_nClassObjects;
unsigned int m_nNameObjects;
unsigned int m_nRbodyObjects;
unsigned int m_nDbodyObjects;
sOentry *m_oep; /* object entry of volume object */ sOentry *m_oep; /* object entry of volume object */
tree_sTable *m_oix_th; tree_sTable *m_oid_th;
tree_sTable *m_name_th; tree_sTable *m_name_th;
tree_sTable *m_class_th; tree_sTable *m_class_th;
...@@ -92,6 +102,7 @@ public: ...@@ -92,6 +102,7 @@ public:
void buildFile(); void buildFile();
void buildSectName(); void buildSectName();
void buildSectOid();
void buildSectClass(); void buildSectClass();
void checkObject(sOentry *oep); void checkObject(sOentry *oep);
pwr_tStatus closeFile(pwr_tBoolean doDelete); pwr_tStatus closeFile(pwr_tBoolean doDelete);
...@@ -110,7 +121,7 @@ public: ...@@ -110,7 +121,7 @@ public:
pwr_tStatus writeSectDirectory(); pwr_tStatus writeSectDirectory();
pwr_tStatus writeSectVolume(); pwr_tStatus writeSectVolume();
pwr_tStatus writeSectVolref(); pwr_tStatus writeSectVolref();
pwr_tStatus writeSectOix(); pwr_tStatus writeSectOid();
pwr_tStatus writeSectObject(); pwr_tStatus writeSectObject();
pwr_tStatus writeSectRbody(); pwr_tStatus writeSectRbody();
pwr_tStatus writeSectName(); pwr_tStatus writeSectName();
......
...@@ -3,17 +3,18 @@ ...@@ -3,17 +3,18 @@
#include "wb_ldh_msg.h" #include "wb_ldh_msg.h"
#include "wb_error.h" #include "wb_error.h"
/* void *
void * wb_orepdbs::operator new(size_t size, wb_vrepdbs *v) wb_orepdbs::operator new(size_t size, wb_vrepdbs *v)
{ {
return v->newOrepDbs(size); return (void *)v->new_wb_repdbs(size);
} }
void wb_orepdbs::operator delete(size_t size, void *p, wb_vrepdbs *v) void
wb_orepdbs::operator delete(void *p, size_t size, wb_vrepdbs *v)
{ {
v->deleteOrepDbs(size, p); v->delete_wb_orepdbs(size, p);
} }
*/
wb_orepdbs::wb_orepdbs(dbs_sObject *o) wb_orepdbs::wb_orepdbs(dbs_sObject *o)
{ {
...@@ -74,44 +75,50 @@ char * const wb_orepdbs::name() ...@@ -74,44 +75,50 @@ char * const wb_orepdbs::name()
wb_orep *wb_orepdbs::after(pwr_tStatus *sts) const wb_orep *wb_orepdbs::after(pwr_tStatus *sts) const
{ {
dbs_sQlink *succ = dbs_Qsucc(sts, m_vrep->m_dbsenv, &m_o->sib_ll); return m_vrep->after(sts, (wb_orep*)this);
if (succ == 0)
return 0;
return new (m_vrep) wb_orepdbs(dbs_Qitem(succ, dbs_sObject, sib_ll));
} }
wb_orep *wb_orepdbs::before(pwr_tStatus *sts) const wb_orep *wb_orepdbs::before(pwr_tStatus *sts) const
{ {
dbs_sQlink *pred = dbs_Qpred(sts, m_vrep->m_dbsenv, &m_o->sib_ll); return m_vrep->before(sts, (wb_orep*)this);
if (pred == 0)
return 0;
return new (m_vrep) wb_orepdbs(dbs_Qitem(pred, dbs_sObject, sib_ll));
} }
wb_orep *wb_orepdbs::parent(pwr_tStatus *sts) const wb_orep *wb_orepdbs::parent(pwr_tStatus *sts) const
{ {
if (m_o->pref == dbs_cNref) { return m_vrep->parent(sts, (wb_orep*)this);
*sts = LDH__NO_PARENT; }
return 0;
} wb_orep *wb_orepdbs::first(pwr_tStatus *sts) const
{
dbs_sObject *dbs_o = (dbs_sObject*)dbs_Address(sts, m_vrep->m_dbsenv, m_o->pref); return m_vrep->first(sts, (wb_orep*)this);
if (dbs_o == 0) { }
return 0;
}
return new (m_vrep) wb_orepdbs(dbs_o); wb_orep *wb_orepdbs::child(pwr_tStatus *sts, char *name) const
{
return m_vrep->child(sts, (wb_orep*)this, name);
}
wb_orep *wb_orepdbs::last(pwr_tStatus *sts) const
{
return m_vrep->last(sts, (wb_orep*)this);
}
wb_orep *wb_orepdbs::next(pwr_tStatus *sts) const
{
return m_vrep->next(sts, (wb_orep*)this);
}
wb_orep *wb_orepdbs::previous(pwr_tStatus *sts) const
{
return m_vrep->previous(sts, (wb_orep*)this);
} }
wb_adrep *attribute(pwr_tStatus *sts) wb_adrep *wb_orepdbs::attribute(pwr_tStatus *sts)
{ {
return 0;; return 0;;
} }
wb_adrep *attribute(pwr_tStatus *sts, const char *name) wb_adrep *wb_orepdbs::attribute(pwr_tStatus *sts, const char *name)
{ {
return 0;//m_vrep->attribute(sts, cid(), name); return 0;//m_vrep->attribute(sts, cid(), name);
} }
...@@ -22,8 +22,8 @@ public: ...@@ -22,8 +22,8 @@ public:
wb_orepdbs(dbs_sObject *o); wb_orepdbs(dbs_sObject *o);
~wb_orepdbs(); ~wb_orepdbs();
// void* operator new(size_t size, wb_vrepdbs *v); void* operator new(size_t size, wb_vrepdbs *v);
// void operator delete(void *p, size_t size, wb_vrepdbs *v); void operator delete(void *p, size_t size, wb_vrepdbs *v);
virtual pwr_tOid oid() const; virtual pwr_tOid oid() const;
virtual pwr_tVid vid() const; virtual pwr_tVid vid() const;
...@@ -63,6 +63,8 @@ public: ...@@ -63,6 +63,8 @@ public:
wb_erep *erep() const { return m_vrep->erep();} wb_erep *erep() const { return m_vrep->erep();}
wb_vrep *vrep() const { return m_vrep;} wb_vrep *vrep() const { return m_vrep;}
dbs_sObject *o() const { return m_o;}
}; };
#endif #endif
...@@ -62,23 +62,23 @@ public: ...@@ -62,23 +62,23 @@ public:
virtual bool writeBody() = 0; virtual bool writeBody() = 0;
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *parent(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *parent(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *after(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *after(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *before(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *before(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *first(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *first(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *child(pwr_tStatus *sts, wb_orep *o, char *name) const = 0; virtual wb_orep *child(pwr_tStatus *sts, wb_orep *o, char *name) = 0;
virtual wb_orep *last(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *last(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *next(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *next(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_orep *previous(pwr_tStatus *sts, wb_orep *o) const = 0; virtual wb_orep *previous(pwr_tStatus *sts, wb_orep *o) = 0;
virtual wb_srep *newSession() = 0; virtual wb_srep *newSession() = 0;
......
...@@ -13,18 +13,44 @@ wb_vrep *wb_vrepdbs::ref() ...@@ -13,18 +13,44 @@ wb_vrep *wb_vrepdbs::ref()
return this; return this;
} }
wb_vrepdbs::wb_vrepdbs() #if 1
wb_vrepdbs::wb_vrepdbs(const char *fileName)
{ {
pwr_tStatus sts;
dbs_sEnv *ep =dbs_Map(&sts, &m_dbsenv, fileName);
if (!ep)
ep = 0;
} }
wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, pwr_tOid oid) wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, pwr_tOid oid)
{ {
//wb_orepdbs *o = new wb_orepdbs(); dbs_sObject *op = dbs_OidToObject(sts, &m_dbsenv, oid);
return 0; if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, wb_orep *parent, wb_name name) wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, wb_orep *parent, wb_name name)
{ {
#if 0
dbs_sName n;
n.poix = parent->oix();
strcpy(n.normname, name.normName(cdh_mName_object));
dbs_sName *nrp = dbs_Bfind(&sts, &m_dbsenv, m_dbs.name_bt, &n, dbs_CompName);
if (!nrp)
return 0;
dbs_Object *o = dbs_Address(&sts, &m_dbsenv, nrp->ref);
if (!o)
return 0;
return new (this) orepdbs(o);
#endif
return 0; return 0;
} }
...@@ -108,57 +134,93 @@ bool wb_vrepdbs::writeBody() ...@@ -108,57 +134,93 @@ bool wb_vrepdbs::writeBody()
} }
wb_orep *wb_vrepdbs::ancestor(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::ancestor(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_Ancestor(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::parent(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::parent(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_Parent(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::after(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::after(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_After(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::before(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::before(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_Before(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::first(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::first(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_First(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::child(pwr_tStatus *sts, wb_orep *o, char *name) const wb_orep *wb_vrepdbs::child(pwr_tStatus *sts, wb_orep *o, char *name)
{ {
return 0; dbs_sObject *op = dbs_Child(sts, &m_dbsenv, ((wb_orepdbs *)o)->o(), name);
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::last(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::last(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_Last(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::next(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::next(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_Next(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
wb_orep *wb_vrepdbs::previous(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepdbs::previous(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; dbs_sObject *op = dbs_Previous(sts, &m_dbsenv, ((wb_orepdbs *)o)->o());
if (op == 0)
return 0;
return new (this) wb_orepdbs(op);
} }
...@@ -166,3 +228,4 @@ wb_srep *wb_vrepdbs::newSession() ...@@ -166,3 +228,4 @@ wb_srep *wb_vrepdbs::newSession()
{ {
return (wb_srep*)0; return (wb_srep*)0;
} }
#endif
...@@ -16,10 +16,10 @@ public: ...@@ -16,10 +16,10 @@ public:
unsigned int m_nSession; unsigned int m_nSession;
unsigned int m_nRef; unsigned int m_nRef;
dbs_sEnv *m_dbsenv; dbs_sEnv m_dbsenv;
wb_vrepdbs(); wb_vrepdbs(const char *fileName);
virtual void unref(); virtual void unref();
virtual wb_vrep *ref(); virtual wb_vrep *ref();
...@@ -54,28 +54,31 @@ public: ...@@ -54,28 +54,31 @@ public:
virtual bool writeBody(); virtual bool writeBody();
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *parent(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *parent(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *after(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *after(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *before(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *before(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *first(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *first(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *child(pwr_tStatus *sts, wb_orep *o, char *name) const; virtual wb_orep *child(pwr_tStatus *sts, wb_orep *o, char *name);
virtual wb_orep *last(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *last(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *next(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *next(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *previous(pwr_tStatus *sts, wb_orep *o) const; virtual wb_orep *previous(pwr_tStatus *sts, wb_orep *o);
virtual wb_srep *newSession(); virtual wb_srep *newSession();
virtual bool isLocal(wb_orep *o) const; virtual bool isLocal(wb_orep *o);
virtual pwr_tVid vid() const; virtual pwr_tVid vid() const;
wb_orepdbs *new_wb_repdbs(size_t size);
void delete_wb_orepdbs(size_t size, void *p);
}; };
#endif #endif
...@@ -927,7 +927,7 @@ wb_orep *wb_vrepwbl::object(pwr_tStatus *sts) ...@@ -927,7 +927,7 @@ wb_orep *wb_vrepwbl::object(pwr_tStatus *sts)
return orep; return orep;
} }
wb_orep *wb_vrepwbl::ancestor(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::ancestor(pwr_tStatus *sts, wb_orep *o)
{ {
wb_orepwbl *orep = 0; wb_orepwbl *orep = 0;
...@@ -941,7 +941,7 @@ wb_orep *wb_vrepwbl::ancestor(pwr_tStatus *sts, wb_orep *o) const ...@@ -941,7 +941,7 @@ wb_orep *wb_vrepwbl::ancestor(pwr_tStatus *sts, wb_orep *o) const
return orep; return orep;
} }
wb_orep *wb_vrepwbl::parent(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::parent(pwr_tStatus *sts, wb_orep *o)
{ {
wb_orepwbl *orep = 0; wb_orepwbl *orep = 0;
...@@ -955,7 +955,7 @@ wb_orep *wb_vrepwbl::parent(pwr_tStatus *sts, wb_orep *o) const ...@@ -955,7 +955,7 @@ wb_orep *wb_vrepwbl::parent(pwr_tStatus *sts, wb_orep *o) const
return orep; return orep;
} }
wb_orep *wb_vrepwbl::after(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::after(pwr_tStatus *sts, wb_orep *o)
{ {
wb_orepwbl *orep = 0; wb_orepwbl *orep = 0;
...@@ -968,7 +968,7 @@ wb_orep *wb_vrepwbl::after(pwr_tStatus *sts, wb_orep *o) const ...@@ -968,7 +968,7 @@ wb_orep *wb_vrepwbl::after(pwr_tStatus *sts, wb_orep *o) const
return orep; return orep;
} }
wb_orep *wb_vrepwbl::before(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::before(pwr_tStatus *sts, wb_orep *o)
{ {
wb_orepwbl *orep = 0; wb_orepwbl *orep = 0;
...@@ -982,7 +982,7 @@ wb_orep *wb_vrepwbl::before(pwr_tStatus *sts, wb_orep *o) const ...@@ -982,7 +982,7 @@ wb_orep *wb_vrepwbl::before(pwr_tStatus *sts, wb_orep *o) const
return orep; return orep;
} }
wb_orep *wb_vrepwbl::first(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::first(pwr_tStatus *sts, wb_orep *o)
{ {
wb_orepwbl *orep = 0; wb_orepwbl *orep = 0;
...@@ -996,12 +996,12 @@ wb_orep *wb_vrepwbl::first(pwr_tStatus *sts, wb_orep *o) const ...@@ -996,12 +996,12 @@ wb_orep *wb_vrepwbl::first(pwr_tStatus *sts, wb_orep *o) const
return orep; return orep;
} }
wb_orep *wb_vrepwbl::child(pwr_tStatus *sts, wb_orep *o, char *name) const wb_orep *wb_vrepwbl::child(pwr_tStatus *sts, wb_orep *o, char *name)
{ {
return 0; return 0;
} }
wb_orep *wb_vrepwbl::last(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::last(pwr_tStatus *sts, wb_orep *o)
{ {
wb_orepwbl *orep = 0; wb_orepwbl *orep = 0;
...@@ -1017,12 +1017,12 @@ wb_orep *wb_vrepwbl::last(pwr_tStatus *sts, wb_orep *o) const ...@@ -1017,12 +1017,12 @@ wb_orep *wb_vrepwbl::last(pwr_tStatus *sts, wb_orep *o) const
return orep; return orep;
} }
wb_orep *wb_vrepwbl::next(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::next(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; return 0;
} }
wb_orep *wb_vrepwbl::previous(pwr_tStatus *sts, wb_orep *o) const wb_orep *wb_vrepwbl::previous(pwr_tStatus *sts, wb_orep *o)
{ {
return 0; return 0;
} }
......
...@@ -150,23 +150,23 @@ public: ...@@ -150,23 +150,23 @@ public:
bool writeBody() {return false;}; bool writeBody() {return false;};
wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) const; wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o);
wb_orep *parent(pwr_tStatus *sts, wb_orep *o) const; wb_orep *parent(pwr_tStatus *sts, wb_orep *o);
wb_orep *after(pwr_tStatus *sts, wb_orep *o) const; wb_orep *after(pwr_tStatus *sts, wb_orep *o);
wb_orep *before(pwr_tStatus *sts, wb_orep *o) const; wb_orep *before(pwr_tStatus *sts, wb_orep *o);
wb_orep *first(pwr_tStatus *sts, wb_orep *o) const; wb_orep *first(pwr_tStatus *sts, wb_orep *o);
wb_orep *child(pwr_tStatus *sts, wb_orep *o, char *name) const; wb_orep *child(pwr_tStatus *sts, wb_orep *o, char *name);
wb_orep *last(pwr_tStatus *sts, wb_orep *o) const; wb_orep *last(pwr_tStatus *sts, wb_orep *o);
wb_orep *next(pwr_tStatus *sts, wb_orep *o) const; wb_orep *next(pwr_tStatus *sts, wb_orep *o);
wb_orep *previous(pwr_tStatus *sts, wb_orep *o) const; wb_orep *previous(pwr_tStatus *sts, wb_orep *o);
wb_srep *newSession() {return 0;}; wb_srep *newSession() {return 0;};
......
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