summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/Aportis.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/Aportis.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Aportis.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/Aportis.h b/noncore/apps/opie-reader/Aportis.h
index 1ca5e73..af1fd3b 100644
--- a/noncore/apps/opie-reader/Aportis.h
+++ b/noncore/apps/opie-reader/Aportis.h
@@ -30,71 +30,79 @@ struct tDocHeader {
30 DWORD dwUnknown3; 30 DWORD dwUnknown3;
31 WORD wNumRecs; 31 WORD wNumRecs;
32}; 32};
33*/ 33*/
34struct tDocRecord0 { 34struct tDocRecord0 {
35 WORD wVersion;// 1=plain text, 2=compressed 35 WORD wVersion;// 1=plain text, 2=compressed
36 WORD wSpare; 36 WORD wSpare;
37 DWORD dwStoryLen; // in chars, when decompressed 37 DWORD dwStoryLen; // in chars, when decompressed
38 WORD wNumRecs; // text records only; equals tDocHeader.wNumRecs-1 38 WORD wNumRecs; // text records only; equals tDocHeader.wNumRecs-1
39 WORD wRecSize; // usually 0x1000 39 WORD wRecSize; // usually 0x1000
40 DWORD dwSpare2; 40 DWORD dwSpare2;
41}; 41};
42 42
43struct PeanutHeader 43struct PeanutHeader
44{ 44{
45 UInt16 Version; 45 UInt16 Version;
46 UInt8 Junk1[6]; 46 UInt8 Junk1[6];
47 UInt16 Records; 47 UInt16 Records;
48 UInt8 Junk2[106]; 48 UInt8 Junk2[106];
49}; 49};
50 50
51////////////// utilities ////////////////////////////////////// 51////////////// utilities //////////////////////////////////////
52 52
53inline WORD SwapWord(WORD r) 53inline WORD SwapWord(WORD r)
54{ 54{
55 return (r>>8) + (r<<8); 55 return (r>>8) + (r<<8);
56} 56}
57 57
58inline DWORD SwapLong(DWORD r) 58inline DWORD SwapLong(DWORD r)
59{ 59{
60 return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000); 60 return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000);
61} 61}
62 62
63class Aportis : public CExpander, Cpdb { 63class Aportis : public CExpander, Cpdb {
64 bool peanutfile; 64 bool peanutfile;
65 void dePeanut(int&); 65 void dePeanut(int&);
66 DWORD dwLen; 66 DWORD dwLen;
67 WORD nRecs2; 67 WORD nRecs2;
68 DWORD dwTLen; 68 DWORD dwTLen;
69 WORD nRecs; 69 WORD nRecs;
70 WORD BlockSize; 70 WORD BlockSize;
71 DWORD dwRecLen; 71 DWORD dwRecLen;
72 int currentrec, currentpos; 72 int currentrec, currentpos;
73 unsigned int cbptr; 73 unsigned int cbptr;
74 unsigned int outptr; 74 unsigned int outptr;
75 unsigned char circbuf[2048]; 75 unsigned char circbuf[2048];
76 char bCompressed; 76 char bCompressed;
77public: 77public:
78 virtual void suspend()
79 {
80 CExpander::suspend(fin);
81 }
82 virtual void unsuspend()
83 {
84 CExpander::unsuspend(fin);
85 }
78 virtual void sizes(unsigned long& _file, unsigned long& _text) 86 virtual void sizes(unsigned long& _file, unsigned long& _text)
79 { 87 {
80 _file = dwLen; 88 _file = dwLen;
81 _text = dwTLen; 89 _text = dwTLen;
82 } 90 }
83 virtual bool hasrandomaccess() { return true; } 91 virtual bool hasrandomaccess() { return true; }
84 virtual ~Aportis() {} 92 virtual ~Aportis() {}
85 Aportis(); 93 Aportis();
86 virtual int openfile(const char *src); 94 virtual int OpenFile(const char *src);
87 virtual int getch(); 95 virtual int getch();
88 virtual unsigned int locate(); 96 virtual unsigned int locate();
89 virtual void locate(unsigned int n); 97 virtual void locate(unsigned int n);
90 virtual CList<Bkmk>* getbkmklist(); 98 virtual CList<Bkmk>* getbkmklist();
91 virtual MarkupType PreferredMarkup() 99 virtual MarkupType PreferredMarkup()
92 { 100 {
93 return (peanutfile) ? cPML : cTEXT; 101 return (peanutfile) ? cPML : cTEXT;
94 } 102 }
95private: 103private:
96 bool refreshbuffer(); 104 bool refreshbuffer();
97 unsigned int GetBS(unsigned int bn); 105 unsigned int GetBS(unsigned int bn);
98}; 106};
99 107
100#endif 108#endif