author | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
commit | 2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975 (patch) (unidiff) | |
tree | eeed16b5f80dd5883991a7a06133f5f7a6936256 /noncore/apps/opie-reader/ztxt.h | |
parent | 5a95ed6a000a56849b8f093deea500214856c626 (diff) | |
download | opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.zip opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.gz opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.bz2 |
update by Tim
Diffstat (limited to 'noncore/apps/opie-reader/ztxt.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ztxt.h | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/noncore/apps/opie-reader/ztxt.h b/noncore/apps/opie-reader/ztxt.h index 6352cfc..7be45c0 100644 --- a/noncore/apps/opie-reader/ztxt.h +++ b/noncore/apps/opie-reader/ztxt.h | |||
@@ -1,30 +1,29 @@ | |||
1 | #ifndef __ztxt_h | 1 | #ifndef __ztxt_h |
2 | #define __ztxt_h | 2 | #define __ztxt_h |
3 | 3 | ||
4 | #include "CExpander.h" | 4 | #include "CExpander.h" |
5 | #include "zlib/zlib.h" | 5 | #include <zlib.h> |
6 | //#include <zlib.h> | ||
7 | #include "pdb.h" | 6 | #include "pdb.h" |
8 | /* | 7 | /* |
9 | * Stuff common to both Weasel Reader and makeztxt | 8 | * Stuff common to both Weasel Reader and makeztxt |
10 | * | 9 | * |
11 | * $Id$ | 10 | * $Id$ |
12 | * | 11 | * |
13 | */ | 12 | */ |
14 | 13 | ||
15 | #ifndef _WEASEL_COMMON_H_ | 14 | #ifndef _WEASEL_COMMON_H_ |
16 | #define _WEASEL_COMMON_H_ 1 | 15 | #define _WEASEL_COMMON_H_ 1 |
17 | 16 | ||
18 | 17 | ||
19 | /* Padding is no good */ | 18 | /* Padding is no good */ |
20 | #if defined(__GNUC__) && defined(__UNIX__) | 19 | #if defined(__GNUC__) && defined(__UNIX__) |
21 | # pragma pack(2) | 20 | # pragma pack(2) |
22 | #endif | 21 | #endif |
23 | 22 | ||
24 | /* The default creator is Weasel Reader 'GPlm' */ | 23 | /* The default creator is Weasel Reader 'GPlm' */ |
25 | #define GPLM_CREATOR_ID "GPlm" | 24 | #define GPLM_CREATOR_ID "GPlm" |
26 | /* Databases of type 'zTXT' */ | 25 | /* Databases of type 'zTXT' */ |
27 | #define ZTXT_TYPE_ID "zTXT" | 26 | #define ZTXT_TYPE_ID "zTXT" |
28 | /* Size of one database record */ | 27 | /* Size of one database record */ |
29 | #define RECORD_SIZE 8192 | 28 | #define RECORD_SIZE 8192 |
30 | /* Allow largest WBIT size for data. Lower with command line options | 29 | /* Allow largest WBIT size for data. Lower with command line options |
@@ -56,48 +55,51 @@ struct zTXTbkmk | |||
56 | UInt32 offset; | 55 | UInt32 offset; |
57 | tchar title[MAX_BMRK_LENGTH]; | 56 | tchar title[MAX_BMRK_LENGTH]; |
58 | }; | 57 | }; |
59 | 58 | ||
60 | #endif | 59 | #endif |
61 | 60 | ||
62 | 61 | ||
63 | const UInt32 ZTXT_ID = 0x5458547a; | 62 | const UInt32 ZTXT_ID = 0x5458547a; |
64 | 63 | ||
65 | class ztxt : public CExpander, Cpdb | 64 | class ztxt : public CExpander, Cpdb |
66 | { | 65 | { |
67 | bool bInit; | 66 | bool bInit; |
68 | UInt32 buffersize; | 67 | UInt32 buffersize; |
69 | UInt32 buffercontent; | 68 | UInt32 buffercontent; |
70 | UInt8* expandedtextbuffer; | 69 | UInt8* expandedtextbuffer; |
71 | UInt8* compressedtextbuffer; | 70 | UInt8* compressedtextbuffer; |
72 | z_stream zstream; | 71 | z_stream zstream; |
73 | size_t bufferpos; | 72 | size_t bufferpos; |
74 | UInt16 bufferrec; | 73 | UInt16 bufferrec; |
75 | zTXT_record0 hdr0; | 74 | zTXT_record0 hdr0; |
76 | size_t currentpos; | 75 | size_t currentpos; |
77 | void home(); | 76 | void home(); |
78 | public: | 77 | public: |
79 | virtual void sizes(unsigned long& _file, unsigned long& _text) | 78 | virtual void sizes(unsigned long& _file, unsigned long& _text) |
80 | { | 79 | { |
81 | _file = file_length; | 80 | _file = file_length; |
82 | _text = ntohl(hdr0.size); | 81 | _text = ntohl(hdr0.size); |
83 | } | 82 | } |
84 | virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); } | 83 | virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); } |
85 | virtual ~ztxt() | 84 | virtual ~ztxt() |
86 | { | 85 | { |
87 | if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; | 86 | if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; |
88 | if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; | 87 | if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; |
89 | if (bInit) | 88 | if (bInit) |
90 | { | 89 | { |
91 | inflateEnd(&zstream); | 90 | inflateEnd(&zstream); |
92 | } | 91 | } |
93 | } | 92 | } |
94 | ztxt(); | 93 | ztxt(); |
95 | virtual int openfile(const char *src); | 94 | virtual int openfile(const char *src); |
96 | virtual int getch(); | 95 | virtual int getch(); |
97 | virtual unsigned int locate(); | 96 | virtual unsigned int locate(); |
98 | virtual void locate(unsigned int n); | 97 | virtual void locate(unsigned int n); |
99 | virtual CList<Bkmk>* getbkmklist(); | 98 | virtual CList<Bkmk>* getbkmklist(); |
99 | virtual MarkupType PreferredMarkup() | ||
100 | { | ||
101 | return cTEXT; | ||
102 | } | ||
100 | }; | 103 | }; |
101 | 104 | ||
102 | #endif | 105 | #endif |
103 | |||