Diffstat (limited to 'noncore/apps/opie-reader/pdb.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/pdb.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/noncore/apps/opie-reader/pdb.h b/noncore/apps/opie-reader/pdb.h index eac3ae6..7a6580d 100644 --- a/noncore/apps/opie-reader/pdb.h +++ b/noncore/apps/opie-reader/pdb.h | |||
@@ -1,41 +1,43 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * This header file defines some structures and types normally found in the | 3 | * This header file defines some structures and types normally found in the |
4 | * Palm SDK. However, I don't want to require the presense of the SDK for a | 4 | * Palm SDK. However, I don't want to require the presense of the SDK for a |
5 | * small utility since most Palm owners won't have it. | 5 | * small utility since most Palm owners won't have it. |
6 | * | 6 | * |
7 | * $Id$ | 7 | * $Id$ |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __PDB_H__ | 11 | #ifndef __PDB_H__ |
12 | #define __PDB_H__ | 12 | #define __PDB_H__ |
13 | 13 | ||
14 | #ifndef _WINDOWS | 14 | #ifndef _WINDOWS |
15 | #include <netinet/in.h> | 15 | #include <netinet/in.h> |
16 | #endif | 16 | #endif |
17 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | #include "useqpe.h" | ||
19 | #include "CExpander.h" | ||
18 | 20 | ||
19 | /* Normal Palm typedefs */ | 21 | /* Normal Palm typedefs */ |
20 | typedef unsigned char UInt8; | 22 | typedef unsigned char UInt8; |
21 | typedef unsigned short UInt16; | 23 | typedef unsigned short UInt16; |
22 | typedef signed short Int16; | 24 | typedef signed short Int16; |
23 | typedef unsigned long UInt32; | 25 | typedef unsigned long UInt32; |
24 | typedef UInt32 LocalID; | 26 | typedef UInt32 LocalID; |
25 | 27 | ||
26 | /* Max length of DB name */ | 28 | /* Max length of DB name */ |
27 | #define dmDBNameLength 0x20 | 29 | #define dmDBNameLength 0x20 |
28 | 30 | ||
29 | 31 | ||
30 | /************************************************************ | 32 | /************************************************************ |
31 | * Structure of a Record entry | 33 | * Structure of a Record entry |
32 | *************************************************************/ | 34 | *************************************************************/ |
33 | typedef struct { | 35 | typedef struct { |
34 | LocalID localChunkID; // local chunkID of a record | 36 | LocalID localChunkID; // local chunkID of a record |
35 | UInt8 attributes; // record attributes; | 37 | UInt8 attributes; // record attributes; |
36 | UInt8 uniqueID[3]; // unique ID of record; should | 38 | UInt8 uniqueID[3]; // unique ID of record; should |
37 | // not be 0 for a legal record. | 39 | // not be 0 for a legal record. |
38 | } RecordEntryType; | 40 | } RecordEntryType; |
39 | 41 | ||
40 | 42 | ||
41 | /************************************************************ | 43 | /************************************************************ |
@@ -55,39 +57,45 @@ typedef struct { | |||
55 | * Structure of a Database Header | 57 | * Structure of a Database Header |
56 | *************************************************************/ | 58 | *************************************************************/ |
57 | typedef struct { | 59 | typedef struct { |
58 | UInt8 name[dmDBNameLength]; // name of database | 60 | UInt8 name[dmDBNameLength]; // name of database |
59 | UInt16 attributes; // database attributes | 61 | UInt16 attributes; // database attributes |
60 | UInt16 version; // version of database | 62 | UInt16 version; // version of database |
61 | UInt32 creationDate; // creation date of database | 63 | UInt32 creationDate; // creation date of database |
62 | UInt32 modificationDate; // latest modification date | 64 | UInt32 modificationDate; // latest modification date |
63 | UInt32 lastBackupDate; // latest backup date | 65 | UInt32 lastBackupDate; // latest backup date |
64 | UInt32 modificationNumber; // modification number of database | 66 | UInt32 modificationNumber; // modification number of database |
65 | LocalID appInfoID; // application specific info | 67 | LocalID appInfoID; // application specific info |
66 | LocalID sortInfoID; // app specific sorting info | 68 | LocalID sortInfoID; // app specific sorting info |
67 | UInt32 type; // database type | 69 | UInt32 type; // database type |
68 | UInt32 creator; // database creator | 70 | UInt32 creator; // database creator |
69 | UInt32 uniqueIDSeed; // used to generate unique IDs. | 71 | UInt32 uniqueIDSeed; // used to generate unique IDs. |
70 | // Note that only the low order | 72 | // Note that only the low order |
71 | // 3 bytes of this is used (in | 73 | // 3 bytes of this is used (in |
72 | // RecordEntryType.uniqueID). | 74 | // RecordEntryType.uniqueID). |
73 | // We are keeping 4 bytes for | 75 | // We are keeping 4 bytes for |
74 | // alignment purposes. | 76 | // alignment purposes. |
75 | RecordListType recordList; // first record list | 77 | RecordListType recordList; // first record list |
76 | } DatabaseHdrType; | 78 | } DatabaseHdrType; |
77 | 79 | ||
78 | 80 | ||
79 | class Cpdb | 81 | class Cpdb : public CExpander |
80 | { | 82 | { |
81 | protected: | 83 | protected: |
82 | size_t file_length; | 84 | size_t file_length; |
83 | FILE* fin; | 85 | FILE* fin; |
84 | size_t recordpos(int); | 86 | size_t recordpos(int); |
85 | size_t recordlength(int); | 87 | size_t recordlength(int); |
86 | void gotorecordnumber(int); | 88 | void gotorecordnumber(int); |
87 | DatabaseHdrType head; | 89 | DatabaseHdrType head; |
88 | bool openfile(const char* src); | 90 | bool openpdbfile(const char* src); |
89 | Cpdb() : fin(NULL) {} | 91 | Cpdb() : fin(NULL) {} |
90 | ~Cpdb() { if (fin != NULL) fclose(fin); } | 92 | ~Cpdb(); |
93 | #ifdef USEQPE | ||
94 | void suspend(); | ||
95 | void unsuspend(); | ||
96 | #endif | ||
97 | public: | ||
98 | virtual void sizes(unsigned long& _file, unsigned long& _text) = 0; | ||
91 | }; | 99 | }; |
92 | #endif | 100 | #endif |
93 | 101 | ||