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
7d56f504
Commit
7d56f504
authored
Feb 25, 2003
by
lw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
08569a49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
75 deletions
+79
-75
src/lib/co/src/co_dbs.c
src/lib/co/src/co_dbs.c
+74
-71
src/lib/co/src/co_dbs.pdr
src/lib/co/src/co_dbs.pdr
+5
-4
No files found.
src/lib/co/src/co_dbs.c
View file @
7d56f504
...
...
@@ -21,6 +21,79 @@
#include "co_platform.h"
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
;
}
pwr_tBoolean
dbs_Close
(
pwr_tStatus
*
sts
,
dbs_sEnv
*
ep
)
{
*
sts
=
DBS__SUCCESS
;
fclose
(
ep
->
f
);
ep
->
f
=
NULL
;
return
TRUE
;
}
dbs_sEnv
*
dbs_Open
(
pwr_tStatus
*
sts
,
dbs_sEnv
*
ep
,
const
char
*
filename
)
{
FILE
*
f
;
co_mFormat
srcFormat
,
ownFormat
;
PDR
pdrs
;
*
sts
=
DBS__SUCCESS
;
memset
(
ep
,
0
,
sizeof
(
*
ep
));
f
=
fopen
(
filename
,
"r"
);
if
(
f
==
NULL
)
{
*
sts
=
errno_GetStatus
();
return
NULL
;
}
if
(
fread
(
&
ep
->
file
,
sizeof
(
ep
->
file
),
1
,
f
)
==
0
)
{
*
sts
=
errno_GetStatus
();
fclose
(
f
);
return
NULL
;
}
#if 0
srcFormat.m = ntohl(ep->file.format.m);
#else
srcFormat
.
m
=
ep
->
file
.
format
.
m
;
#endif
co_GetOwnFormat
(
&
ownFormat
);
if
(
srcFormat
.
m
!=
ownFormat
.
m
)
{
pdrmem_create
(
&
pdrs
,
&
ep
->
file
,
sizeof
(
ep
->
file
),
PDR_DECODE
,
srcFormat
,
ownFormat
);
if
(
!
pdr_dbs_sFile
(
&
pdrs
,
&
ep
->
file
))
{
*
sts
=
DBS__PDRFILE
;
fclose
(
f
);
return
NULL
;
}
}
fseek
(
f
,
0
,
SEEK_SET
);
ep
->
f
=
f
;
return
ep
;
}
#if defined(OS_LINUX) || defined(OS_LYNX)
static
pwr_tBoolean
checkQ
(
const
dbs_sEnv
*
ep
,
dbs_sQlink
*
item
)
{
...
...
@@ -300,60 +373,6 @@ dbs_Reference(pwr_tStatus *sts, const dbs_sEnv *ep, void *adrs)
#endif
pwr_tBoolean
dbs_Close
(
pwr_tStatus
*
sts
,
dbs_sEnv
*
ep
)
{
*
sts
=
DBS__SUCCESS
;
fclose
(
ep
->
f
);
ep
->
f
=
NULL
;
return
TRUE
;
}
dbs_sEnv
*
dbs_Open
(
pwr_tStatus
*
sts
,
dbs_sEnv
*
ep
,
const
char
*
filename
)
{
FILE
*
f
;
co_mFormat
srcFormat
,
ownFormat
;
PDR
pdrs
;
*
sts
=
DBS__SUCCESS
;
memset
(
ep
,
0
,
sizeof
(
*
ep
));
f
=
fopen
(
filename
,
"r"
);
if
(
f
==
NULL
)
{
*
sts
=
errno_GetStatus
();
return
NULL
;
}
if
(
fread
(
&
ep
->
file
,
sizeof
(
ep
->
file
),
1
,
f
)
==
0
)
{
*
sts
=
errno_GetStatus
();
fclose
(
f
);
return
NULL
;
}
#if 0
srcFormat.m = ntohl(ep->file.format.m);
#else
srcFormat
.
m
=
ep
->
file
.
format
.
m
;
#endif
co_GetOwnFormat
(
&
ownFormat
);
if
(
srcFormat
.
m
!=
ownFormat
.
m
)
{
pdrmem_create
(
&
pdrs
,
&
ep
->
file
,
sizeof
(
ep
->
file
),
PDR_DECODE
,
srcFormat
,
ownFormat
);
if
(
!
pdr_dbs_sFile
(
&
pdrs
,
&
ep
->
file
))
{
*
sts
=
DBS__PDRFILE
;
fclose
(
f
);
return
NULL
;
}
}
fseek
(
f
,
0
,
SEEK_SET
);
ep
->
f
=
f
;
return
ep
;
}
static
void
printTree
(
dbs_sEnv
*
ep
,
dbs_sObject
*
op
,
int
indent
)
{
...
...
@@ -878,23 +897,6 @@ dbs_Ancestor(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sObject *op)
return
op
;
}
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
;
}
void
dbs_GetVolumeName
(
pwr_tStatus
*
sts
,
dbs_sEnv
*
ep
,
char
*
name
)
{
...
...
@@ -986,3 +988,4 @@ dbs_NextDbody(pwr_tStatus *sts, const dbs_sEnv *ep, dbs_sBody *bp)
return
bp
;
}
#endif
src/lib/co/src/co_dbs.pdr
View file @
7d56f504
...
...
@@ -564,6 +564,10 @@ struct dbs_sScObject {
%#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)))
%
%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);
%dbs_sEnv *dbs_Open(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename);
%#if defined(OS_LINUX) || defined(OS_LYNX)
%void *dbs_Address(pwr_tStatus*, const dbs_sEnv*, dbs_tRef);
%void *dbs_Alloc(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32);
%pwr_tBoolean dbs_AllocLookasideSegment(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32, pwr_tUInt32);
...
...
@@ -592,9 +596,6 @@ struct dbs_sScObject {
%dbs_tRef dbs_RefAlloc(pwr_tStatus*, const dbs_sEnv*, pwr_tUInt32);
%dbs_tRef dbs_Reference(pwr_tStatus*, const dbs_sEnv*, void*);
%
%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);
%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);
...
...
@@ -617,7 +618,7 @@ struct dbs_sScObject {
%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);
%
%
#endif
%
%#ifdef __cplusplus
%}
...
...
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