Diffstat (limited to 'noncore/apps/opie-reader/pdb.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/pdb.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/pdb.h b/noncore/apps/opie-reader/pdb.h index 7458919..a0abd1b 100644 --- a/noncore/apps/opie-reader/pdb.h +++ b/noncore/apps/opie-reader/pdb.h | |||
@@ -1,56 +1,54 @@ | |||
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 | |||
18 | #include "CExpander.h" | 19 | #include "CExpander.h" |
19 | 20 | ||
20 | /* Normal Palm typedefs */ | 21 | /* Normal Palm typedefs */ |
21 | typedef unsigned char UInt8; | 22 | #include "mytypes.h" |
22 | typedef unsigned short UInt16; | ||
23 | typedef signed short Int16; | ||
24 | typedef unsigned long UInt32; | ||
25 | typedef UInt32 LocalID; | 23 | typedef UInt32 LocalID; |
26 | 24 | ||
27 | /* Max length of DB name */ | 25 | /* Max length of DB name */ |
28 | #define dmDBNameLength 0x20 | 26 | #define dmDBNameLength 0x20 |
29 | 27 | ||
30 | 28 | ||
31 | /************************************************************ | 29 | /************************************************************ |
32 | * Structure of a Record entry | 30 | * Structure of a Record entry |
33 | *************************************************************/ | 31 | *************************************************************/ |
34 | typedef struct { | 32 | typedef struct { |
35 | LocalID localChunkID; // local chunkID of a record | 33 | LocalID localChunkID; // local chunkID of a record |
36 | UInt8 attributes; // record attributes; | 34 | UInt8 attributes; // record attributes; |
37 | UInt8 uniqueID[3]; // unique ID of record; should | 35 | UInt8 uniqueID[3]; // unique ID of record; should |
38 | // not be 0 for a legal record. | 36 | // not be 0 for a legal record. |
39 | } RecordEntryType; | 37 | } RecordEntryType; |
40 | 38 | ||
41 | 39 | ||
42 | /************************************************************ | 40 | /************************************************************ |
43 | * Structure of a record list extension. This is used if all | 41 | * Structure of a record list extension. This is used if all |
44 | * the database record/resource entries of a database can't fit into | 42 | * the database record/resource entries of a database can't fit into |
45 | * the database header. | 43 | * the database header. |
46 | *************************************************************/ | 44 | *************************************************************/ |
47 | typedef struct { | 45 | typedef struct { |
48 | LocalID nextRecordListID; // local chunkID of next list | 46 | LocalID nextRecordListID; // local chunkID of next list |
49 | UInt16 numRecords; // number of records in this list | 47 | UInt16 numRecords; // number of records in this list |
50 | UInt16 firstEntry; // array of Record/Rsrc entries | 48 | UInt16 firstEntry; // array of Record/Rsrc entries |
51 | // starts here | 49 | // starts here |
52 | } RecordListType; | 50 | } RecordListType; |
53 | 51 | ||
54 | 52 | ||
55 | /************************************************************ | 53 | /************************************************************ |
56 | * Structure of a Database Header | 54 | * Structure of a Database Header |
@@ -63,38 +61,41 @@ typedef struct { | |||
63 | UInt32 modificationDate; // latest modification date | 61 | UInt32 modificationDate; // latest modification date |
64 | UInt32 lastBackupDate; // latest backup date | 62 | UInt32 lastBackupDate; // latest backup date |
65 | UInt32 modificationNumber; // modification number of database | 63 | UInt32 modificationNumber; // modification number of database |
66 | LocalID appInfoID; // application specific info | 64 | LocalID appInfoID; // application specific info |
67 | LocalID sortInfoID; // app specific sorting info | 65 | LocalID sortInfoID; // app specific sorting info |
68 | UInt32 type; // database type | 66 | UInt32 type; // database type |
69 | UInt32 creator; // database creator | 67 | UInt32 creator; // database creator |
70 | UInt32 uniqueIDSeed; // used to generate unique IDs. | 68 | UInt32 uniqueIDSeed; // used to generate unique IDs. |
71 | // Note that only the low order | 69 | // Note that only the low order |
72 | // 3 bytes of this is used (in | 70 | // 3 bytes of this is used (in |
73 | // RecordEntryType.uniqueID). | 71 | // RecordEntryType.uniqueID). |
74 | // We are keeping 4 bytes for | 72 | // We are keeping 4 bytes for |
75 | // alignment purposes. | 73 | // alignment purposes. |
76 | RecordListType recordList; // first record list | 74 | RecordListType recordList; // first record list |
77 | } DatabaseHdrType; | 75 | } DatabaseHdrType; |
78 | 76 | ||
79 | 77 | ||
80 | class Cpdb : public CExpander | 78 | class Cpdb : public CExpander |
81 | { | 79 | { |
82 | protected: | 80 | protected: |
83 | size_t file_length; | 81 | size_t file_length; |
84 | FILE* fin; | 82 | FILE* fin; |
85 | size_t recordpos(int); | 83 | size_t recordpos(int); |
86 | size_t recordlength(int); | 84 | size_t recordlength(int); |
87 | void gotorecordnumber(int); | 85 | void gotorecordnumber(int); |
88 | DatabaseHdrType head; | 86 | DatabaseHdrType head; |
89 | bool openpdbfile(const char* src); | 87 | bool openpdbfile(const char* src); |
90 | Cpdb() : fin(NULL) {} | 88 | Cpdb() : fin(NULL) {} |
91 | ~Cpdb(); | 89 | ~Cpdb(); |
92 | #ifdef USEQPE | 90 | #ifdef USEQPE |
93 | void suspend(); | 91 | void suspend(); |
94 | void unsuspend(); | 92 | void unsuspend(); |
93 | #else | ||
94 | void suspend() {} | ||
95 | void unsuspend() {} | ||
95 | #endif | 96 | #endif |
96 | public: | 97 | public: |
97 | virtual void sizes(unsigned long& _file, unsigned long& _text) = 0; | 98 | virtual void sizes(unsigned long& _file, unsigned long& _text) = 0; |
98 | }; | 99 | }; |
99 | #endif | 100 | #endif |
100 | 101 | ||