24 #pragma warning( disable: 4251 )
25 #pragma warning( disable: 4996 )
45 #ifndef NO_SWORD_NAMESPACE
46 using namespace sword;
50 short versionRecordSize;
54 char conversionProgramVerMajor;
55 char conversionProgramVerMinor;
56 char leastCompatSTEPVerMajor;
57 char leastCompatSTEPVerMinor;
64 short viewableHeaderRecordSize;
65 long viewableBlocksCount;
66 long glossBlocksCount;
69 short blockEntriesSize;
75 long uncompressedSize;
87 int main(
int argc,
char **argv) {
95 cerr <<
"usage: "<< *argv <<
" <database to step module>\n";
99 string bookpath = argv[1];
102 if ((argv[1][strlen(argv[1])-1] !=
'/') &&
103 (argv[1][strlen(argv[1])-1] !=
'\\'))
106 fileName = bookpath +
"Book.dat";
110 cerr <<
"error, couldn't open file: " << fileName <<
"\n";
119 fileName = bookpath +
"Viewable.idx";
123 cerr <<
"error, couldn't open file: " << fileName <<
"\n";
132 cout <<
"\n\nReading special preface viewable BLOCK 0";
141 cout <<
"\n\nReading " << nonGlossBlocksCount <<
" non-glossary viewable blocks";
143 for (
int i = 1; i < nonGlossBlocksCount; i++) {
144 cout <<
"\nNon-Glossary viewable block: " << i;
150 cout <<
"\n\nReading " << viewableHeaderRecord.
glossBlocksCount <<
" glossary viewable blocks";
152 cout <<
"\nGlossary viewable block: " << i;
167 cout <<
"\n\nReading Version Record (" << 16 <<
" bytes)\n\n";
171 cout <<
"Version Record Information\n";
175 cout <<
"\tpublisherID: " << versionRecord->
publisherID <<
"\n";
176 read(fd, &(versionRecord->
bookID), 2);
177 cout <<
"\tbookID: " << versionRecord->
bookID <<
"\n";
178 read(fd, &(versionRecord->
setID), 2);
179 cout <<
"\tsetID: " << versionRecord->
setID <<
"\n";
189 cout <<
"\tencryptionType: " << (int)versionRecord->
encryptionType <<
"\n";
190 read(fd, &(versionRecord->
editionID), 1);
191 cout <<
"\teditionID: " << (int)versionRecord->
editionID <<
"\n";
193 cout <<
"\tmodifiedBy: " << versionRecord->
modifiedBy <<
"\n";
198 cout <<
"\nSkipping " << skip <<
" unknown bytes.\n";
199 char *skipbuf =
new char[skip];
200 read(fd, skipbuf, skip);
208 cout <<
"\n\nReading Viewable Header Record (" << 16 <<
" bytes)\n\n";
213 cout <<
"Viewable Header Record Information\n";
219 cout <<
"\tglossBlocksCount: " << viewableHeaderRecord->
glossBlocksCount <<
"\n";
221 cout <<
"\tcompressionType: " << (int)viewableHeaderRecord->
compressionType <<
"(0 - none; 1 - LZSS)\n";
222 read(fd, &(viewableHeaderRecord->
reserved1), 1);
223 cout <<
"\treserved1: " << (int)viewableHeaderRecord->
reserved1 <<
"\n";
225 cout <<
"\tblockEntriesSize: " << viewableHeaderRecord->
blockEntriesSize <<
"\n";
226 read(fd, &(viewableHeaderRecord->
reserved2), 2);
227 cout <<
"\treserved2: " << viewableHeaderRecord->
reserved2 <<
"\n";
232 cout <<
"\nSkipping " << skip <<
" unknown bytes.\n";
233 char *skipbuf =
new char[skip];
234 read(fd, skipbuf, skip);
245 read(fd, *buf, vb->size);
249 cout <<
"Viewable Block Text:\n";
250 cout << *buf <<
"\n\n";
256 cout <<
"\n\nReading Viewable Block (" << 12 <<
" bytes)\n\n";
261 cout <<
"Viewable Block Information\n";
262 read(fd, &(vb->
offset), 4);
263 cout <<
"\toffset: " << vb->
offset <<
"\n";
266 read(fd, &(vb->
size), 4);
267 cout <<
"\tsize: " << vb->
size <<
"\n";
272 long headerControlWordAreaSize;
273 read(fd, &headerControlWordAreaSize, 4);
274 cout <<
"Reading Header Control Word Area (" << headerControlWordAreaSize <<
" bytes)\n\n";
276 *buf =
new char [headerControlWordAreaSize + 1];
278 read(fd, *buf, headerControlWordAreaSize);
279 (*buf)[headerControlWordAreaSize] = 0;
281 cout <<
"headerControlWordArea:\n" << *buf <<
"\n";
void readViewableBlockText(int fd, ViewableBlock *vb, char **buf)
static int openFileReadOnly(const char *fName)
virtual void setCompressedBuf(unsigned long *len, char *buf=0)
virtual char * getUncompressedBuf(unsigned long *len=0)
char leastCompatSTEPVerMajor
char conversionProgramVerMinor
char leastCompatSTEPVerMinor
void readViewableBlock(int fd, ViewableBlock *vb)
void readVersion(int fd, Version *versionRecord)
char conversionProgramVerMajor
void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord)
void readHeaderControlWordAreaText(int fd, char **buf)