summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/Aportis.h
authorllornkcor <llornkcor>2002-07-01 23:24:08 (UTC)
committer llornkcor <llornkcor>2002-07-01 23:24:08 (UTC)
commit59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2 (patch) (side-by-side diff)
treef148d4858859dac3b413e675c760acfdab24b8e6 /noncore/apps/opie-reader/Aportis.h
parentc08be8ae22dcc1bfb83cfdec807149b161d770f5 (diff)
downloadopie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.zip
opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.tar.gz
opie-59222a752fa4c8a1e8c2a00ee2f9e22855f12bb2.tar.bz2
initial
Diffstat (limited to 'noncore/apps/opie-reader/Aportis.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Aportis.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/Aportis.h b/noncore/apps/opie-reader/Aportis.h
new file mode 100644
index 0000000..08016f4
--- a/dev/null
+++ b/noncore/apps/opie-reader/Aportis.h
@@ -0,0 +1,86 @@
+/*
+ Derived from makedoc9 by Pat Beirne
+*/
+
+#ifndef __Aportis_h
+#define __Aportis_h
+
+#include "CExpander.h"
+#include "pdb.h"
+
+typedef UInt32 DWORD;
+typedef UInt16 WORD;
+
+#define DISP_BITS 11
+#define COUNT_BITS 3
+/*
+// all numbers in these structs are big-endian, MAC format
+struct tDocHeader {
+ char sName[32];
+ DWORD dwUnknown1;
+ DWORD dwTime1;
+ DWORD dwTime2;
+ DWORD dwTime3;
+ DWORD dwLastSync;
+ DWORD ofsSort;
+ DWORD ofsCatagories;
+ DWORD dwCreator;
+ DWORD dwType;
+ DWORD dwUnknown2;
+ DWORD dwUnknown3;
+ WORD wNumRecs;
+};
+*/
+struct tDocRecord0 {
+ WORD wVersion; // 1=plain text, 2=compressed
+ WORD wSpare;
+ DWORD dwStoryLen; // in chars, when decompressed
+ WORD wNumRecs; // text records only; equals tDocHeader.wNumRecs-1
+ WORD wRecSize; // usually 0x1000
+ DWORD dwSpare2;
+};
+
+////////////// utilities //////////////////////////////////////
+
+inline WORD SwapWord(WORD r)
+{
+ return (r>>8) + (r<<8);
+}
+
+inline DWORD SwapLong(DWORD r)
+{
+ return ((r>>24) & 0xFF) + (r<<24) + ((r>>8) & 0xFF00) + ((r<<8) & 0xFF0000);
+}
+
+class Aportis : public CExpander, Cpdb {
+ DWORD dwLen;
+ WORD nRecs2;
+ DWORD dwTLen;
+ WORD nRecs;
+ WORD BlockSize;
+ DWORD dwRecLen;
+ int currentrec, currentpos;
+ unsigned int cbptr;
+ unsigned int outptr;
+ unsigned char circbuf[2048];
+ char bCompressed;
+public:
+ virtual void sizes(unsigned long& _file, unsigned long& _text)
+ {
+ _file = dwLen;
+ _text = dwTLen;
+ }
+ virtual bool hasrandomaccess() { return true; }
+ virtual ~Aportis() {}
+ Aportis();
+ virtual int openfile(const char *src);
+ virtual int getch();
+ virtual unsigned int locate();
+ virtual void locate(unsigned int n);
+ virtual CList<Bkmk>* getbkmklist();
+private:
+ bool refreshbuffer();
+ unsigned int GetBS(unsigned int bn);
+};
+
+#endif