summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/ZText.h4
-rw-r--r--noncore/apps/opie-reader/plucker.h24
-rw-r--r--noncore/apps/opie-reader/ztxt.h32
3 files changed, 30 insertions, 30 deletions
diff --git a/noncore/apps/opie-reader/ZText.h b/noncore/apps/opie-reader/ZText.h
index 9e72161..debfe8c 100644
--- a/noncore/apps/opie-reader/ZText.h
+++ b/noncore/apps/opie-reader/ZText.h
@@ -1,39 +1,39 @@
1#ifndef __Text_h 1#ifndef __Text_h
2#define __Text_h 2#define __Text_h
3#include <stdio.h> 3#include <stdio.h>
4#include <zlib.h> 4#include "zlib/zlib.h"
5#include <sys/stat.h> 5#include <sys/stat.h>
6 6
7#include "CExpander.h" 7#include "CExpander.h"
8 8
9class Text: public CExpander { 9class Text: public CExpander {
10 gzFile file; 10 gzFile file;
11 unsigned long fsize; 11 unsigned long fsize;
12public: 12public:
13 Text() : file(NULL) {}; 13 Text() : file(NULL) {};
14 virtual ~Text() 14 virtual ~Text()
15 { 15 {
16 if (file != NULL) gzclose(file); 16 if (file != NULL) gzclose(file);
17 } 17 }
18 virtual int openfile(const char *src) 18 virtual int openfile(const char *src)
19 { 19 {
20 if (file != NULL) gzclose(file); 20 if (file != NULL) gzclose(file);
21 struct stat _stat; 21 struct stat _stat;
22 stat(src,&_stat); 22 stat(src,&_stat);
23 fsize = _stat.st_size; 23 fsize = _stat.st_size;
24 return ((file = gzopen(src,"rb")) == NULL); 24 return ((file = gzopen(src,"rb")) == NULL);
25 } 25 }
26 virtual int getch() { return gzgetc(file); } 26 virtual int getch() { return gzgetc(file); }
27 virtual unsigned int locate() { return gztell(file); } 27 virtual unsigned int locate() { return gztell(file); }
28 virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); } 28 virtual void locate(unsigned int n) { gzseek(file,n,SEEK_SET); }
29 virtual bool hasrandomaccess() { return true; } 29 virtual bool hasrandomaccess() { return true; }
30 virtual void sizes(unsigned long& _file, unsigned long& _text) 30 virtual void sizes(unsigned long& _file, unsigned long& _text)
31 { 31 {
32 _text = _file = fsize; 32 _text = _file = fsize;
33 } 33 }
34 virtual MarkupType PreferredMarkup() 34 virtual MarkupType PreferredMarkup()
35 { 35 {
36 return cTEXT; 36 return cTEXT;
37 } 37 }
38}; 38};
39#endif 39#endif
diff --git a/noncore/apps/opie-reader/plucker.h b/noncore/apps/opie-reader/plucker.h
index 84e855c..d3ca732 100644
--- a/noncore/apps/opie-reader/plucker.h
+++ b/noncore/apps/opie-reader/plucker.h
@@ -1,86 +1,86 @@
1#ifndef __plucker_h 1#ifndef __plucker_h
2#define __plucker_h 2#define __plucker_h
3 3
4#include "CExpander.h" 4#include "CExpander.h"
5#include <zlib.h> 5#include "zlib/zlib.h"
6#include "ztxt.h" 6#include "ztxt.h"
7#include "pdb.h" 7#include "pdb.h"
8#include "CBuffer.h" 8#include "CBuffer.h"
9 9
10struct CPlucker_dataRecord 10struct CPlucker_dataRecord
11{ 11{
12 UInt16 uid; 12 UInt16 uid;
13 UInt16 nParagraphs; 13 UInt16 nParagraphs;
14 UInt16 size; 14 UInt16 size;
15 UInt8 type; 15 UInt8 type;
16 UInt8 reserved; 16 UInt8 reserved;
17}; 17};
18 18
19struct CPlucker_record0 19struct CPlucker_record0
20{ 20{
21 UInt16 uid; 21 UInt16 uid;
22 UInt16 version; 22 UInt16 version;
23 UInt16 nRecords; 23 UInt16 nRecords;
24}; 24};
25 25
26struct CPluckerbkmk 26struct CPluckerbkmk
27{ 27{
28 UInt32 offset; 28 UInt32 offset;
29 tchar title[MAX_BMRK_LENGTH]; 29 tchar title[MAX_BMRK_LENGTH];
30}; 30};
31 31
32 32
33const UInt32 CPLUCKER_ID = 0x5458547a; 33const UInt32 CPLUCKER_ID = 0x5458547a;
34 34
35class CPlucker : public CExpander, Cpdb 35class CPlucker : public CExpander, Cpdb
36{ 36{
37 size_t textlength; 37 size_t textlength;
38 UInt16 uid; 38 UInt16 uid;
39 int m_nextPara, m_nextParaIndex; 39 int m_nextPara, m_nextParaIndex;
40 CBufferFace<UInt16> m_ParaOffsets; 40 CBufferFace<UInt16> m_ParaOffsets;
41 CBufferFace<UInt16> m_ParaAttrs; 41 CBufferFace<UInt16> m_ParaAttrs;
42 UInt16 m_nParas; 42 UInt16 m_nParas;
43 CStyle mystyle; 43 CStyle mystyle;
44// bool bInit; 44// bool bInit;
45 UInt32 buffersize; 45 UInt32 buffersize;
46 UInt32 buffercontent; 46 UInt32 buffercontent;
47 UInt8* expandedtextbuffer; 47 UInt8* expandedtextbuffer;
48 UInt8* compressedtextbuffer; 48 UInt8* compressedtextbuffer;
49 size_t bufferpos; 49 size_t bufferpos;
50 UInt16 bufferrec; 50 UInt16 bufferrec;
51 CPlucker_record0 hdr0; 51 CPlucker_record0 hdr0;
52 size_t currentpos; 52 size_t currentpos;
53 bool expand(int); 53 bool expand(int);
54 void UnZip(size_t, UInt8*, UInt16); 54 void UnZip(size_t, UInt8*, UInt16);
55 void UnDoc(size_t, UInt8*, UInt16); 55 void UnDoc(size_t, UInt8*, UInt16);
56 void expandimg(UInt16 tgt); 56 void expandimg(UInt16 tgt);
57 void home(); 57 void home();
58 int bgetch(); 58 int bgetch();
59 public: 59 public:
60 virtual void sizes(unsigned long& _file, unsigned long& _text) 60 virtual void sizes(unsigned long& _file, unsigned long& _text)
61 { 61 {
62 _file = file_length; 62 _file = file_length;
63 _text = textlength; 63 _text = textlength;
64//ntohl(hdr0.size); 64//ntohl(hdr0.size);
65 } 65 }
66 virtual bool hasrandomaccess() { return true; } 66 virtual bool hasrandomaccess() { return true; }
67 virtual ~CPlucker() 67 virtual ~CPlucker()
68 { 68 {
69 if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; 69 if (expandedtextbuffer != NULL) delete [] expandedtextbuffer;
70 if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; 70 if (compressedtextbuffer != NULL) delete [] compressedtextbuffer;
71 } 71 }
72 CPlucker(); 72 CPlucker();
73 virtual int openfile(const char *src); 73 virtual int openfile(const char *src);
74 virtual int getch(); 74 virtual int getch();
75 virtual void getch(int&, CStyle&); 75 virtual void getch(int&, CStyle&);
76 virtual unsigned int locate(); 76 virtual unsigned int locate();
77 virtual void locate(unsigned int n); 77 virtual void locate(unsigned int n);
78 virtual CList<Bkmk>* getbkmklist(); 78 virtual CList<Bkmk>* getbkmklist();
79 virtual bool hyperlink(unsigned int n); 79 virtual bool hyperlink(unsigned int n);
80 virtual MarkupType PreferredMarkup() 80 virtual MarkupType PreferredMarkup()
81 { 81 {
82 return cNONE; 82 return cNONE;
83 } 83 }
84}; 84};
85 85
86#endif 86#endif
diff --git a/noncore/apps/opie-reader/ztxt.h b/noncore/apps/opie-reader/ztxt.h
index 7be45c0..20558a6 100644
--- a/noncore/apps/opie-reader/ztxt.h
+++ b/noncore/apps/opie-reader/ztxt.h
@@ -1,105 +1,105 @@
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.h> 5#include "zlib/zlib.h"
6#include "pdb.h" 6#include "pdb.h"
7/* 7/*
8 * Stuff common to both Weasel Reader and makeztxt 8 * Stuff common to both Weasel Reader and makeztxt
9 * 9 *
10 * $Id$ 10 * $Id$
11 * 11 *
12 */ 12 */
13 13
14#ifndef _WEASEL_COMMON_H_ 14#ifndef _WEASEL_COMMON_H_
15#define _WEASEL_COMMON_H_ 1 15#define _WEASEL_COMMON_H_ 1
16 16
17 17
18/* Padding is no good */ 18/* Padding is no good */
19#if defined(__GNUC__) && defined(__UNIX__) 19#if defined(__GNUC__) && defined(__UNIX__)
20# pragma pack(2) 20# pragma pack(2)
21#endif 21#endif
22 22
23/* The default creator is Weasel Reader 'GPlm' */ 23/* The default creator is Weasel Reader 'GPlm' */
24#define GPLM_CREATOR_ID "GPlm" 24#define GPLM_CREATOR_ID "GPlm"
25/* Databases of type 'zTXT' */ 25/* Databases of type 'zTXT' */
26#define ZTXT_TYPE_ID "zTXT" 26#define ZTXT_TYPE_ID "zTXT"
27/* Size of one database record */ 27/* Size of one database record */
28#define RECORD_SIZE 8192 28#define RECORD_SIZE 8192
29/* Allow largest WBIT size for data. Lower with command line options 29/* Allow largest WBIT size for data. Lower with command line options
30 in makeztxt */ 30 in makeztxt */
31#define MAXWBITS 15 31#define MAXWBITS 15
32/* Max length for a bookmark/annotation title */ 32/* Max length for a bookmark/annotation title */
33#define MAX_BMRK_LENGTH 20 33#define MAX_BMRK_LENGTH 20
34 34
35 35
36/***************************************************** 36/*****************************************************
37 * This is the zTXT document header (record #0) * 37 * This is the zTXT document header (record #0) *
38 * ----zTXT version 1.42---- * 38 * ----zTXT version 1.42---- *
39 *****************************************************/ 39 *****************************************************/
40typedef struct zTXT_record0Type { 40typedef struct zTXT_record0Type {
41 UInt16 version; /* zTXT format version */ 41 UInt16 version; /* zTXT format version */
42 UInt16 numRecords; /* Number of data (TEXT) records */ 42 UInt16 numRecords; /* Number of data (TEXT) records */
43 UInt32 size; /* Size in bytes of uncomp. data */ 43 UInt32 size; /* Size in bytes of uncomp. data */
44 UInt16 recordSize; /* Size of a single data record */ 44 UInt16 recordSize; /* Size of a single data record */
45 UInt16 numBookmarks; /* Number of bookmarks in DB */ 45 UInt16 numBookmarks; /* Number of bookmarks in DB */
46 UInt16 bookmarkRecord; /* Record containing bookmarks */ 46 UInt16 bookmarkRecord; /* Record containing bookmarks */
47 UInt16 numAnnotations; /* Number of annotation records */ 47 UInt16 numAnnotations; /* Number of annotation records */
48 UInt16 annotationRecord; /* Record # of annotation index */ 48 UInt16 annotationRecord; /* Record # of annotation index */
49 UInt8 randomAccess; /* 1 if compressed w/Z_FULL_FLUSH */ 49 UInt8 randomAccess; /* 1 if compressed w/Z_FULL_FLUSH */
50 UInt8 padding[0x20 - 19]; /* Pad to a size of 0x20 bytes */ 50 UInt8 padding[0x20 - 19]; /* Pad to a size of 0x20 bytes */
51} zTXT_record0; 51} zTXT_record0;
52 52
53struct zTXTbkmk 53struct zTXTbkmk
54{ 54{
55 UInt32 offset; 55 UInt32 offset;
56 tchar title[MAX_BMRK_LENGTH]; 56 tchar title[MAX_BMRK_LENGTH];
57}; 57};
58 58
59#endif 59#endif
60 60
61 61
62const UInt32 ZTXT_ID = 0x5458547a; 62const UInt32 ZTXT_ID = 0x5458547a;
63 63
64class ztxt : public CExpander, Cpdb 64class ztxt : public CExpander, Cpdb
65{ 65{
66 bool bInit; 66 bool bInit;
67 UInt32 buffersize; 67 UInt32 buffersize;
68 UInt32 buffercontent; 68 UInt32 buffercontent;
69 UInt8* expandedtextbuffer; 69 UInt8* expandedtextbuffer;
70 UInt8* compressedtextbuffer; 70 UInt8* compressedtextbuffer;
71 z_stream zstream; 71 z_stream zstream;
72 size_t bufferpos; 72 size_t bufferpos;
73 UInt16 bufferrec; 73 UInt16 bufferrec;
74 zTXT_record0 hdr0; 74 zTXT_record0 hdr0;
75 size_t currentpos; 75 size_t currentpos;
76 void home(); 76 void home();
77 public: 77 public:
78 virtual void sizes(unsigned long& _file, unsigned long& _text) 78 virtual void sizes(unsigned long& _file, unsigned long& _text)
79 { 79 {
80 _file = file_length; 80 _file = file_length;
81 _text = ntohl(hdr0.size); 81 _text = ntohl(hdr0.size);
82 } 82 }
83 virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); } 83 virtual bool hasrandomaccess() { return (hdr0.randomAccess != 0); }
84 virtual ~ztxt() 84 virtual ~ztxt()
85 { 85 {
86 if (expandedtextbuffer != NULL) delete [] expandedtextbuffer; 86 if (expandedtextbuffer != NULL) delete [] expandedtextbuffer;
87 if (compressedtextbuffer != NULL) delete [] compressedtextbuffer; 87 if (compressedtextbuffer != NULL) delete [] compressedtextbuffer;
88 if (bInit) 88 if (bInit)
89 { 89 {
90 inflateEnd(&zstream); 90 inflateEnd(&zstream);
91 } 91 }
92 } 92 }
93 ztxt(); 93 ztxt();
94 virtual int openfile(const char *src); 94 virtual int openfile(const char *src);
95 virtual int getch(); 95 virtual int getch();
96 virtual unsigned int locate(); 96 virtual unsigned int locate();
97 virtual void locate(unsigned int n); 97 virtual void locate(unsigned int n);
98 virtual CList<Bkmk>* getbkmklist(); 98 virtual CList<Bkmk>* getbkmklist();
99 virtual MarkupType PreferredMarkup() 99 virtual MarkupType PreferredMarkup()
100 { 100 {
101 return cTEXT; 101 return cTEXT;
102 } 102 }
103}; 103};
104 104
105#endif 105#endif