24 #pragma warning( disable: 4251 )
25 #pragma warning( disable: 4996 )
45 #ifndef NO_SWORD_NAMESPACE
46 using namespace sword;
142 int main(
int argc,
char **argv) {
154 cerr <<
"usage: "<< *argv <<
" <database to step module>\n";
158 string bookpath = argv[1];
161 if ((argv[1][strlen(argv[1])-1] !=
'/') &&
162 (argv[1][strlen(argv[1])-1] !=
'\\'))
165 fileName = bookpath +
"Book.dat";
169 cerr <<
"error, couldn't open file: " << fileName <<
"\n";
178 fileName = bookpath +
"Viewable.idx";
181 if (fdviewable < 1) {
182 cerr <<
"error, couldn't open file: " << fileName <<
"\n";
193 fileName = bookpath +
"Vsync.idx";
197 cerr <<
"error, couldn't open file: " << fileName <<
"\n";
201 fileName = bookpath +
"Sections.idx";
204 if (fdsections < 1) {
205 cerr <<
"error, couldn't open file: " << fileName <<
"\n";
217 for (
int i = 0; i <= bookCount; i++) {
218 displayBook(fdbook, fdviewable, fdvsync, fdsections, &vSyncBooksInfo[i]);
234 read(fd, &(versionRecord->
bookID), 2);
235 read(fd, &(versionRecord->
setID), 2);
241 read(fd, &(versionRecord->
editionID), 1);
247 char *skipbuf =
new char[skip];
248 read(fd, skipbuf, skip);
260 read(fd, &(sectionsHeaderRecord->
reserved), 4);
265 char *skipbuf =
new char[skip];
266 read(fd, skipbuf, skip);
278 read(fd, &(viewableHeaderRecord->
reserved1), 1);
280 read(fd, &(viewableHeaderRecord->
reserved2), 2);
285 char *skipbuf =
new char[skip];
286 read(fd, skipbuf, skip);
305 char *skipbuf =
new char[skip];
306 read(fd, skipbuf, skip);
317 read(fd, *buf, vb->
size);
326 read(fd, &(vb->
offset), 4);
328 read(fd, &(vb->
size), 4);
333 long headerControlWordAreaSize;
334 read(fd, &headerControlWordAreaSize, 4);
336 *buf =
new char [headerControlWordAreaSize + 1];
338 read(fd, *buf, headerControlWordAreaSize);
339 (*buf)[headerControlWordAreaSize] = 0;
347 for (
int i = 0; i <= bookCount; i++) {
348 read(fd, &(*vSyncBooksInfo)[i].offset, 4);
349 read(fd, &(*vSyncBooksInfo)[i].count, 2);
358 for (
int i = 0; i < vSyncBooksInfo->
count; i++) {
364 read(fdvsync, &(vSyncPoint.
chapter), 2);
365 read(fdvsync, &(vSyncPoint.
verse), 2);
366 read(fdvsync, &(vSyncPoint.
offset), 4);
371 cout << sectionName <<
" ";
372 delete [] sectionName;
375 cout << verseText <<
"\n";
386 static long lastEntryOffset = -1;
387 static class FreeCachedEntryText {
390 FreeCachedEntryText() { entryText = 0; }
391 ~FreeCachedEntryText() {
if (entryText)
delete [] entryText; }
392 } _freeCachedEntryText;
395 if (_freeCachedEntryText.entryText)
396 delete [] _freeCachedEntryText.entryText;
403 sprintf(numberBuf,
"%d", sectionLevelInfo->
startLevel);
404 startToken =
"\\stepstartlevel";
405 startToken += numberBuf;
406 char *start = strstr(_freeCachedEntryText.entryText, startToken.c_str());
408 start += strlen(startToken.c_str());
409 char *end = strstr(start,
"\\stepstartlevel");
412 else len = strlen(start);
414 *verseText =
new char [ len + 1 ];
415 strncpy(*verseText, start, len);
416 (*verseText)[len] = 0;
424 *name =
new char [ size + 1 ];
425 read(fd, *name, size);
437 read(fd, &(sli->
level), 1);
448 if ((*from != 10) && (*from != 13)) {
void readViewableBlockText(int fd, ViewableBlock *vb, char **buf)
static int openFileReadOnly(const char *fName)
virtual void setCompressedBuf(unsigned long *len, char *buf=0)
void readVSyncBooksInfo(int fd, VSyncHeader *, VSyncBooksInfo **vSyncBooksInfo)
void readSectionName(int fd, SectionLevelInfo *sli, char **name)
virtual char * getUncompressedBuf(unsigned long *len=0)
char leastCompatSTEPVerMajor
char conversionProgramVerMinor
char leastCompatSTEPVerMinor
void readSectionsHeader(int fd, SectionsHeader *sectionsHeaderRecord)
void readViewableBlock(int fd, ViewableBlock *vb)
void extractVerseText(int fdviewable, int fdbook, SectionLevelInfo *sectionLevelInfo, char **verseText)
void readVersion(int fd, Version *versionRecord)
void displayBook(int fdbook, int fdviewable, int fdvsync, int fdsections, VSyncBooksInfo *vSyncBooksInfo)
char conversionProgramVerMajor
void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord)
void readSectionLevelInfo(int fd, SectionLevelInfo *sli)
void readHeaderControlWordAreaText(int fd, char **buf)
void readVSyncHeader(int fd, VSyncHeader *vSyncHeaderRecord)