Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
7db51896
Commit
7db51896
authored
Feb 24, 2003
by
lw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
1fd73444
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
38 deletions
+159
-38
src/lib/co/src/co_dbs.c
src/lib/co/src/co_dbs.c
+50
-0
src/lib/co/src/co_dbs.pdr
src/lib/co/src/co_dbs.pdr
+7
-0
src/lib/co/src/co_dcli.h
src/lib/co/src/co_dcli.h
+1
-1
src/lib/co/src/co_dcli_file.c
src/lib/co/src/co_dcli_file.c
+3
-2
wb/lib/wb/src/wb_dbs.cpp
wb/lib/wb/src/wb_dbs.cpp
+41
-28
wb/lib/wb/src/wb_dbs.h
wb/lib/wb/src/wb_dbs.h
+3
-2
wb/lib/wb/src/wb_vrepdbs.cpp
wb/lib/wb/src/wb_vrepdbs.cpp
+49
-0
wb/lib/wb/src/wb_vrepdbs.h
wb/lib/wb/src/wb_vrepdbs.h
+5
-5
No files found.
src/lib/co/src/co_dbs.c
View file @
7db51896
...
...
@@ -936,3 +936,53 @@ dbs_Body(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, pwr_eBix bix)
return
p
;
}
dbs_sObject
*
dbs_NextHead
(
pwr_tStatus
*
sts
,
const
dbs_sEnv
*
ep
,
dbs_sObject
*
op
)
{
dbs_sObject
*
eop
=
(
dbs_sObject
*
)(
ep
->
base
+
ep
->
sect
[
dbs_eSect_object
].
offset
+
ep
->
sect
[
dbs_eSect_object
].
size
);
if
(
op
==
NULL
)
op
=
(
dbs_sObject
*
)(
ep
->
base
+
ep
->
sect
[
dbs_eSect_object
].
offset
);
else
op
=
(
dbs_sObject
*
)((
char
*
)
op
+
dbs_dAlign
(
sizeof
(
dbs_sObject
)));
if
(
op
>=
eop
)
return
NULL
;
return
op
;
}
dbs_sBody
*
dbs_NextRbody
(
pwr_tStatus
*
sts
,
const
dbs_sEnv
*
ep
,
dbs_sBody
*
bp
)
{
dbs_sBody
*
ebp
=
(
dbs_sBody
*
)(
ep
->
base
+
ep
->
sect
[
dbs_eSect_rbody
].
offset
+
ep
->
sect
[
dbs_eSect_rbody
].
size
);
if
(
bp
==
NULL
)
bp
=
(
dbs_sBody
*
)(
ep
->
base
+
ep
->
sect
[
dbs_eSect_rbody
].
offset
);
else
bp
=
(
dbs_sBody
*
)((
char
*
)
bp
+
dbs_dAlign
(
sizeof
(
dbs_sBody
))
+
dbs_dAlign
(
bp
->
size
));
if
(
bp
>=
ebp
)
return
NULL
;
return
bp
;
}
dbs_sBody
*
dbs_NextDbody
(
pwr_tStatus
*
sts
,
const
dbs_sEnv
*
ep
,
dbs_sBody
*
bp
)
{
dbs_sBody
*
ebp
=
(
dbs_sBody
*
)(
ep
->
base
+
ep
->
sect
[
dbs_eSect_dbody
].
offset
+
ep
->
sect
[
dbs_eSect_dbody
].
size
);
if
(
bp
==
NULL
)
bp
=
(
dbs_sBody
*
)(
ep
->
base
+
ep
->
sect
[
dbs_eSect_dbody
].
offset
);
else
bp
=
(
dbs_sBody
*
)((
char
*
)
bp
+
dbs_dAlign
(
sizeof
(
dbs_sBody
))
+
dbs_dAlign
(
bp
->
size
));
if
(
bp
>=
ebp
)
return
NULL
;
return
bp
;
}
src/lib/co/src/co_dbs.pdr
View file @
7db51896
...
...
@@ -428,6 +428,10 @@ struct dbs_sObject {
pwr_tObjName normname; /**< normalized object name. */
pwr_tTime time; /**< time of last change in object header */
pwr_tOid soid; /**< object identifier of server object. */
pwr_tOid boid; /**< object identifier of sibling object before this object. */
pwr_tOid aoid; /**< object identifier of sibling object after this object. */
pwr_tOid foid; /**< object identifier of first child object. */
pwr_tOid loid; /**< object identifier of last child object. */
dbs_mFlags flags;
dbs_sBodyRef rbody; /**< runtime body */
...
...
@@ -608,6 +612,9 @@ struct dbs_sScObject {
%dbs_sObject *dbs_Object(pwr_tStatus *sts, const dbs_sEnv *ep);
%void dbs_ObjectToName(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, char *name);
%void *dbs_Body(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op, pwr_eBix bix);
%dbs_sObject *dbs_NextHead(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op);
%dbs_sBody *dbs_NextRbody(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sBody *bp);
%dbs_sBody *dbs_NextDbody(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sBody *bp);
%
%
%#ifdef __cplusplus
...
...
src/lib/co/src/co_dcli.h
View file @
7db51896
...
...
@@ -59,7 +59,7 @@ int dcli_get_defaultfilename(
int
dcli_replace_env
(
char
*
str
,
char
*
newstr
);
#endif
char
*
dcli_fgetname
(
FILE
*
fp
,
char
*
name
,
char
*
def_name
);
int
dcli_translate_filename
(
char
*
out
,
char
*
in
);
int
dcli_translate_filename
(
char
*
out
,
c
onst
c
har
*
in
);
/* Functions in module co_dcli_dir */
...
...
src/lib/co/src/co_dcli_file.c
View file @
7db51896
...
...
@@ -259,10 +259,11 @@ char *dcli_fgetname( FILE *fp, char *name, char *def_name)
*
**************************************************************************/
int
dcli_translate_filename
(
char
*
out
,
char
*
in
)
int
dcli_translate_filename
(
char
*
out
,
c
onst
c
har
*
in
)
{
char
out_name
[
200
];
char
*
s
,
*
t
;
const
char
*
s
;
char
*
t
;
int
i
;
int
state
;
...
...
wb/lib/wb/src/wb_dbs.cpp
View file @
7db51896
...
...
@@ -29,7 +29,7 @@ wb_dbs::wb_dbs(wb_vrep *v) :
{
pwr_tStatus
sts
;
memset
(
m_
name
,
0
,
sizeof
(
m_n
ame
));
memset
(
m_
fileName
,
0
,
sizeof
(
m_fileN
ame
));
memset
(
&
m_volume
,
0
,
sizeof
(
m_volume
));
memset
(
m_sect
,
0
,
sizeof
(
m_sect
));
...
...
@@ -44,8 +44,8 @@ wb_dbs::wb_dbs(wb_vrep *v) :
//@todo strcpy(m_volume.className, m_ohp->chp->db.name.data);
sprintf
(
m_
n
ame
,
dbs_cNameVolume
,
dbs_cDirectory
,
m_v
->
name
());
dcli_translate_filename
(
m_
name
,
m_n
ame
);
sprintf
(
m_
fileN
ame
,
dbs_cNameVolume
,
dbs_cDirectory
,
m_v
->
name
());
dcli_translate_filename
(
m_
fileName
,
m_fileN
ame
);
m_oid_th
=
tree_CreateTable
(
&
sts
,
sizeof
(
pwr_tOid
),
offsetof
(
sOentry
,
o
.
oid
),
sizeof
(
sOentry
),
1000
,
tree_Comp_oid
);
...
...
@@ -73,6 +73,11 @@ wb_dbs::~wb_dbs()
tree_DeleteTable
(
&
sts
,
m_class_th
);
}
void
wb_dbs
::
setFileName
(
const
char
*
name
)
{
dcli_translate_filename
(
m_fileName
,
name
);
}
static
int
comp_dbs_name
(
tree_sTable
*
tp
,
tree_sNode
*
x
,
tree_sNode
*
y
)
...
...
@@ -221,6 +226,10 @@ wb_dbs::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid, pwr
oep
->
o
.
oid
=
oid
;
oep
->
o
.
cid
=
cid
;
oep
->
o
.
poid
=
poid
;
oep
->
o
.
boid
=
boid
;
oep
->
o
.
aoid
=
aoid
;
oep
->
o
.
foid
=
foid
;
oep
->
o
.
loid
=
loid
;
strcpy
(
oep
->
o
.
name
,
name
);
strcpy
(
oep
->
o
.
normname
,
normname
);
...
...
@@ -264,9 +273,9 @@ wb_dbs::closeFile(pwr_tBoolean doDelete)
if
(
m_fp
!=
NULL
)
fclose
(
m_fp
);
if
(
doDelete
&&
*
m_
n
ame
!=
'\0'
)
{
if
(
remove
(
m_
n
ame
)
==
0
)
printf
(
"-- Deleted file: %s
\n
"
,
m_
n
ame
);
if
(
doDelete
&&
*
m_
fileN
ame
!=
'\0'
)
{
if
(
remove
(
m_
fileN
ame
)
==
0
)
printf
(
"-- Deleted file: %s
\n
"
,
m_
fileN
ame
);
}
return
LDH__SUCCESS
;
...
...
@@ -385,17 +394,17 @@ wb_dbs::openFile()
{
char
*
fn
;
cdh_ToLower
(
m_
name
,
m_n
ame
);
cdh_ToLower
(
m_
fileName
,
m_fileN
ame
);
m_fp
=
fopen
(
m_
n
ame
,
"w+b"
);
m_fp
=
fopen
(
m_
fileN
ame
,
"w+b"
);
if
(
m_fp
==
NULL
)
{
printf
(
"** Cannot open file: %s
\n
"
,
m_
n
ame
);
printf
(
"** Cannot open file: %s
\n
"
,
m_
fileN
ame
);
perror
(
" Reason"
);
return
LDH__FILEOPEN
;
}
fn
=
dcli_fgetname
(
m_fp
,
m_
name
,
m_n
ame
);
fn
=
dcli_fgetname
(
m_fp
,
m_
fileName
,
m_fileN
ame
);
if
(
fn
!=
NULL
)
printf
(
"-- Opened load file: %s
\n
"
,
m_
n
ame
);
printf
(
"-- Opened load file: %s
\n
"
,
m_
fileN
ame
);
return
LDH__SUCCESS
;
}
...
...
@@ -408,8 +417,8 @@ wb_dbs::writeSectFile()
PDR
pdrs
;
co_GetOwnFormat
(
&
fp
->
format
);
fp
->
cookie
=
550715339
;
//file.size
;
fp
->
cookie
=
dbs_cMagicCookie
;
fp
->
size
=
0
;
fp
->
offset
=
dbs_dAlign
(
sizeof
(
*
fp
));
fp
->
formatVersion
=
dbs_cVersionFormat
;
fp
->
version
=
dbs_cVersionFile
;
...
...
@@ -418,8 +427,8 @@ wb_dbs::writeSectFile()
fp
->
time
=
m_volume
.
time
;
fp
->
fileType
=
dbs_eFile_volume
;
//file.userName
;
//file.comment
;
strcpy
(
fp
->
userName
,
""
)
;
strcpy
(
fp
->
comment
,
""
)
;
printf
(
"format.......: %d
\n
"
,
fp
->
format
.
m
);
printf
(
"cookie.......: %d
\n
"
,
fp
->
cookie
);
printf
(
"size.........: %d
\n
"
,
fp
->
size
);
...
...
@@ -450,6 +459,7 @@ wb_dbs::writeSectDirectory()
m_sect
[
dbs_eSect_volref
].
version
=
dbs_cVersionVolRef
;
m_sect
[
dbs_eSect_oid
].
version
=
dbs_cVersionOid
;
m_sect
[
dbs_eSect_object
].
version
=
dbs_cVersionObject
;
m_sect
[
dbs_eSect_scobject
].
version
=
dbs_cVersionScObject
;
m_sect
[
dbs_eSect_rbody
].
version
=
dbs_cVersionRbody
;
m_sect
[
dbs_eSect_name
].
version
=
dbs_cVersionName
;
m_sect
[
dbs_eSect_class
].
version
=
dbs_cVersionClass
;
...
...
@@ -460,6 +470,7 @@ wb_dbs::writeSectDirectory()
m_sect
[
dbs_eSect_volref
].
type
=
dbs_eSect_volref
;
m_sect
[
dbs_eSect_oid
].
type
=
dbs_eSect_oid
;
m_sect
[
dbs_eSect_object
].
type
=
dbs_eSect_object
;
m_sect
[
dbs_eSect_scobject
].
type
=
dbs_eSect_scobject
;
m_sect
[
dbs_eSect_rbody
].
type
=
dbs_eSect_rbody
;
m_sect
[
dbs_eSect_name
].
type
=
dbs_eSect_name
;
m_sect
[
dbs_eSect_class
].
type
=
dbs_eSect_class
;
...
...
@@ -521,7 +532,8 @@ wb_dbs::writeSectVolume()
pwr_tStatus
wb_dbs
::
writeSectVolref
()
{
dbs_sVolRef
volref
;
char
v
[
dbs_dAlign
(
sizeof
(
dbs_sVolRef
))];
dbs_sVolRef
*
vp
=
(
dbs_sVolRef
*
)
v
;
cdh_uTid
cid
;
sCentry
*
cep
;
pwr_tStatus
sts
;
...
...
@@ -529,10 +541,10 @@ wb_dbs::writeSectVolref()
if
(
fseek
(
m_fp
,
m_sect
[
dbs_eSect_volref
].
offset
,
SEEK_SET
)
!=
0
)
return
LDH__FILEPOS
;
memset
(
&
volref
,
0
,
sizeof
(
volref
));
memset
(
v
,
0
,
sizeof
(
v
));
cid
.
pwr
=
pwr_cNCid
;
cep
=
(
sCentry
*
)
tree_FindSuccessor
(
&
sts
,
m_class_th
,
&
cid
.
pwr
);
cep
=
(
sCentry
*
)
tree_FindSuccessor
(
&
sts
,
m_class_th
,
&
cid
.
pwr
);
while
(
cep
)
{
cdh_uVid
vid
;
...
...
@@ -542,17 +554,18 @@ wb_dbs::writeSectVolref()
vid
.
v
.
vid_1
=
cid
.
c
.
vid_1
;
if
(
vid
.
pwr
!=
m_volume
.
vid
)
{
printf
(
"volref: %d.%d.%d.%d
\n
"
,
vid
.
v
.
vid_0
,
vid
.
v
.
vid_1
,
vid
.
v
.
vid_2
,
vid
.
v
.
vid_3
);
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
)
printf
(
"volref: %d.%d.%d.%d
\n
"
,
vid
.
v
.
vid_3
,
vid
.
v
.
vid_2
,
vid
.
v
.
vid_1
,
vid
.
v
.
vid_0
);
vp
->
vid
=
vid
.
pwr
;
strcpy
(
vp
->
name
,
"not_yet_known"
);
vp
->
cid
=
0
;
vp
->
time
.
tv_sec
=
0
;
vp
->
time
.
tv_nsec
=
0
;
vp
->
size
=
0
;
vp
->
offset
=
0
;
if
(
fwrite
(
v
,
sizeof
(
v
),
1
,
m_fp
)
<
1
)
return
LDH__FILEWRITE
;
m_sect
[
dbs_eSect_volref
].
size
+=
sizeof
(
v
olref
);
m_sect
[
dbs_eSect_volref
].
size
+=
sizeof
(
v
);
}
vid
.
pwr
++
;
cid
.
pwr
=
pwr_cNCid
;
...
...
wb/lib/wb/src/wb_dbs.h
View file @
7db51896
...
...
@@ -68,7 +68,7 @@ public:
};
FILE
*
m_fp
;
/**< file pointer */
char
m_
name
[
100
];
/**< name of load file */
char
m_
fileName
[
512
];
/**< name of load file */
// wb_object *m_o; /* Volume object header. */
wb_vrep
*
m_v
;
dbs_sVolume
m_volume
;
...
...
@@ -102,7 +102,8 @@ public:
bool
operator
==
(
wb_dbs
&
);
// void buildFile();
void
setFileName
(
const
char
*
name
);
void
buildSectName
();
void
buildSectOid
();
void
buildSectClass
();
...
...
wb/lib/wb/src/wb_vrepdbs.cpp
View file @
7db51896
...
...
@@ -2,6 +2,7 @@
#include "wb_orepdbs.h"
#include "wb_erep.h"
#include "wb_merep.h"
#include "wb_import.h"
void
wb_vrepdbs
::
unref
()
{
...
...
@@ -432,3 +433,51 @@ void wb_vrepdbs::objectName(wb_orep *o, char *str)
dbs_ObjectToName
(
&
sts
,
dbsenv
(),
((
wb_orepdbs
*
)
o
)
->
o
(),
str
);
}
bool
wb_vrepdbs
::
exportVolume
(
wb_import
&
i
)
{
return
i
.
importVolume
(
*
this
);
}
bool
wb_vrepdbs
::
exportHead
(
wb_import
&
i
)
{
dbs_sObject
*
op
=
0
;
pwr_tStatus
sts
;
while
((
op
=
dbs_NextHead
(
&
sts
,
dbsenv
(),
op
)))
{
i
.
importHead
(
op
->
oid
,
op
->
cid
,
op
->
poid
,
op
->
aoid
,
op
->
boid
,
op
->
foid
,
op
->
loid
,
op
->
name
,
op
->
normname
,
op
->
time
,
op
->
rbody
.
time
,
op
->
dbody
.
time
,
op
->
rbody
.
size
,
op
->
dbody
.
size
);
}
return
true
;
}
bool
wb_vrepdbs
::
exportRbody
(
wb_import
&
i
)
{
dbs_sBody
*
bp
=
0
;
pwr_tStatus
sts
;
while
((
bp
=
dbs_NextRbody
(
&
sts
,
dbsenv
(),
bp
)))
{
i
.
importRbody
(
bp
->
oid
,
bp
->
size
,
(
void
*
)(
bp
+
1
));
}
return
true
;
}
bool
wb_vrepdbs
::
exportDbody
(
wb_import
&
i
)
{
dbs_sBody
*
bp
=
0
;
pwr_tStatus
sts
;
while
((
bp
=
dbs_NextDbody
(
&
sts
,
dbsenv
(),
bp
)))
{
i
.
importDbody
(
bp
->
oid
,
bp
->
size
,
(
void
*
)(
bp
+
1
));
}
return
true
;
}
bool
wb_vrepdbs
::
exportMeta
(
wb_import
&
i
)
{
return
false
;
}
wb/lib/wb/src/wb_vrepdbs.h
View file @
7db51896
...
...
@@ -128,11 +128,11 @@ public:
virtual
bool
isMeta
()
const
{
return
(
cid
()
==
pwr_eClass_ClassVolume
);}
virtual
bool
exportVolume
(
wb_import
&
e
)
{
return
false
;}
virtual
bool
exportHead
(
wb_import
&
e
)
{
return
false
;}
virtual
bool
exportRbody
(
wb_import
&
e
)
{
return
false
;}
virtual
bool
exportDbody
(
wb_import
&
e
)
{
return
false
;}
virtual
bool
exportMeta
(
wb_import
&
e
)
{
return
false
;}
virtual
bool
exportVolume
(
wb_import
&
e
)
;
virtual
bool
exportHead
(
wb_import
&
e
)
;
virtual
bool
exportRbody
(
wb_import
&
e
)
;
virtual
bool
exportDbody
(
wb_import
&
e
)
;
virtual
bool
exportMeta
(
wb_import
&
e
)
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment