From d6e78505f4bbc8dc4c5b5127655c374a16663d3b Mon Sep 17 00:00:00 2001 From: danglassey Date: Tue, 10 Sep 2002 13:01:46 +0000 Subject: sync with crosswire 20020910-1300 --- src/keys/versekey.cpp | 4 +- src/modules/filters/thmlosis.cpp | 2 +- utilities/bcppmake/libsword.bpf | 4 + utilities/bcppmake/libsword.bpr | 23 ++- utilities/bcppmake/utilities.bpg | 6 +- utilities/mod2osis.cpp | 362 +++++++++++++++++++-------------------- 6 files changed, 207 insertions(+), 194 deletions(-) diff --git a/src/keys/versekey.cpp b/src/keys/versekey.cpp index 3b8da18..bab3c09 100644 --- a/src/keys/versekey.cpp +++ b/src/keys/versekey.cpp @@ -370,8 +370,8 @@ int VerseKey::getBookAbbrev(const char *iabbr) ListKey VerseKey::ParseVerseList(const char *buf, const char *defaultKey, bool expandRange) { SWKey textkey; - char book[255]; - char number[255]; + char book[2048]; + char number[2048]; int tobook = 0; int tonumber = 0; int chap = -1, verse = -1; diff --git a/src/modules/filters/thmlosis.cpp b/src/modules/filters/thmlosis.cpp index 10f5892..57d48d2 100644 --- a/src/modules/filters/thmlosis.cpp +++ b/src/modules/filters/thmlosis.cpp @@ -313,7 +313,7 @@ const char *ThMLOSIS::convertToOSIS(const char *inRef, const SWKey *key) { for (int i = 0; i < verses.Count(); i++) { VerseKey *element = SWDYNAMIC_CAST(VerseKey, verses.GetElement(i)); char buf[5120]; - char frag[800]; + char frag[5120]; if (element) { memmove(frag, startFrag, ((const char *)element->userData - startFrag) + 1); frag[((const char *)element->userData - startFrag) + 1] = 0; diff --git a/utilities/bcppmake/libsword.bpf b/utilities/bcppmake/libsword.bpf index 60bbcc0..62bc2d7 100644 --- a/utilities/bcppmake/libsword.bpf +++ b/utilities/bcppmake/libsword.bpf @@ -108,6 +108,10 @@ USEUNIT("..\..\src\utilfuns\zlib\untgz.c"); USEUNIT("..\..\src\utilfuns\zlib\adler32.c"); USEUNIT("..\..\src\modules\filters\greeklexattribs.cpp"); USEUNIT("..\..\src\mgr\swcacher.cpp"); +USEUNIT("..\..\src\modules\filters\gbfosis.cpp"); +USEUNIT("..\..\src\modules\filters\thmlosis.cpp"); +USEUNIT("..\..\src\mgr\encfiltmgr.cpp"); +USEUNIT("..\..\src\mgr\markupfiltmgr.cpp"); //--------------------------------------------------------------------------- #define Library diff --git a/utilities/bcppmake/libsword.bpr b/utilities/bcppmake/libsword.bpr index ee9f4c1..4fad418 100644 --- a/utilities/bcppmake/libsword.bpr +++ b/utilities/bcppmake/libsword.bpr @@ -82,7 +82,10 @@ ..\..\src\utilfuns\zlib\inftrees.obj ..\..\src\utilfuns\zlib\infutil.obj ..\..\src\utilfuns\zlib\trees.obj ..\..\src\utilfuns\zlib\uncompr.obj ..\..\src\utilfuns\zlib\untgz.obj ..\..\src\utilfuns\zlib\adler32.obj - ..\..\src\modules\filters\greeklexattribs.obj ..\..\src\mgr\swcacher.obj"/> + ..\..\src\modules\filters\greeklexattribs.obj ..\..\src\mgr\swcacher.obj + ..\..\src\modules\filters\gbfosis.obj + ..\..\src\modules\filters\thmlosis.obj ..\..\src\mgr\encfiltmgr.obj + ..\..\src\mgr\markupfiltmgr.obj"/> @@ -96,7 +99,7 @@ - + @@ -105,9 +108,10 @@ - - - + + + @@ -164,9 +168,10 @@ Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] -Count=2 -Item0=_ICU_;_ICUSWORD_ -Item1=_DEBUG +Count=3 +Item0=_ICU_;_ICUSWORD_;_DEBUG +Item1=_ICU_;_ICUSWORD_ +Item2=_DEBUG [HistoryLists\hlTlibPageSize] Count=5 @@ -189,7 +194,7 @@ RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 -LinkCGLIB=0 +LinkCGLIB=1 [Language] ActiveLang= diff --git a/utilities/bcppmake/utilities.bpg b/utilities/bcppmake/utilities.bpg index 9e36582..1fcc1c1 100644 --- a/utilities/bcppmake/utilities.bpg +++ b/utilities/bcppmake/utilities.bpg @@ -11,7 +11,7 @@ BRCC = $(ROOT)\bin\brcc32.exe $** #------------------------------------------------------------------------------ PROJECTS = libsword.lib mod2vpl.exe vpl2mod.exe mkfastmod.exe imp2gbs.exe \ imp2ld.exe imp2vs.exe thml2gbs.exe mod2zmod.exe mod2imp.exe cipherraw.exe \ - stepdump.exe step2vpl.exe + stepdump.exe step2vpl.exe mod2osis.exe #------------------------------------------------------------------------------ default: $(PROJECTS) #------------------------------------------------------------------------------ @@ -68,4 +68,8 @@ step2vpl.exe: step2vpl.bpr $(ROOT)\bin\bpr2mak $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak +mod2osis.exe: mod2osis.bpr + $(ROOT)\bin\bpr2mak $** + $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak + diff --git a/utilities/mod2osis.cpp b/utilities/mod2osis.cpp index 79cec14..ff8c9d8 100644 --- a/utilities/mod2osis.cpp +++ b/utilities/mod2osis.cpp @@ -1,182 +1,182 @@ // Compression on variable granularity - -#include -#include -#include -#include - -#ifndef __GNUC__ -#include -#else -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void errorOutHelp(char *appName) { - cerr << appName << " - a tool to output a Sword module in OSIS format\n"; - cerr << "usage: "<< appName << " \n"; - cerr << "\n\n"; - exit(-1); -} - - -int main(int argc, char **argv) -{ - SWModule *inModule = 0; - ThMLOSIS filter; - - if ((argc != 2)) { - errorOutHelp(argv[0]); - } - - if ((!strcmp(argv[1], "-h")) || (!strcmp(argv[1], "--help")) || (!strcmp(argv[1], "/?")) || (!strcmp(argv[1], "-?")) || (!strcmp(argv[1], "-help"))) { - errorOutHelp(argv[0]); - } - - SWMgr mgr(new MarkupFilterMgr(FMT_OSIS)); - OptionsList options = mgr.getGlobalOptions(); - for (OptionsList::iterator it = options.begin(); it != options.end(); it++) { - OptionsList values = mgr.getGlobalOptionValues(it->c_str()); - if (find(values.begin(), values.end(), "On") != values.end()) { - mgr.setGlobalOption(it->c_str(), "On"); - } - } - - - ModMap::iterator it = mgr.Modules.find(argv[1]); - if (it == mgr.Modules.end()) { - fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]); - exit(-2); - } - - inModule = it->second; -// inModule->AddRenderFilter(&filter); - - SWKey *key = (SWKey *)*inModule; - VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); - - char *buf; - bool opentest = false; - bool openbook = false; - bool openchap = false; - VerseKey lastHeading; - lastHeading.Headings(1); - lastHeading.AutoNormalize(0); - lastHeading.Testament(5); - lastHeading = BOTTOM; - - if (!vkey) { - cerr << "Currently mod2zmod only works with verse keyed modules\n\n"; - exit(-1); - } - - vkey->Headings(1); - - cout << "getConfigEntry("Encoding")) { - if (*(inModule->getConfigEntry("Encoding"))) - cout << "encoding=\"" << inModule->getConfigEntry("Encoding") << "\" "; - else cout << "encoding=\"UTF-8\" "; - } - else cout << "encoding=\"UTF-8\" "; - cout << "?>\n\n"; - - cout << "\n\n"; - cout << "Name() << "\""; - cout << " osisRefWork=\"defaultReferenceScheme\""; - cout << ">\n\n"; - - cout << "\t
\n"; - cout << "\t\tName() << "\">\n"; - cout << "\t\t\t" << inModule->Name() << "\n"; - cout << "\t\t\t" << inModule->Description() << "\n"; - if (inModule->Lang()) { - if (strlen(inModule->Lang())) - cout << "\t\t\t" << inModule->Lang() << "\n"; - } - cout << "\t\t\tBible.KJV\n"; - cout << "\t\t\n"; - cout << "\t\t\n"; - cout << "\t\t\tBible.KJV\n"; - cout << "\t\t\n"; - cout << "\t
\n\n"; - - - (*inModule) = TOP; - int testament = vkey->Testament(); -// for ((*inModule) = TOP; (inModule->Key() < (VerseKey)"Mat 2:1"); (*inModule)++) { - for ((*inModule) = TOP; !inModule->Error(); (*inModule)++) { -// for ((*vkey) = "Mark6:29"; !inModule->Error(); (*inModule)++) { - if (vkey->Testament() != lastHeading.Testament()) { - if (opentest) - cout << "\t\n"; - cout << "\t
"; - lastHeading = *vkey; - lastHeading.Book(0); - lastHeading.Chapter(0); - lastHeading.Verse(0); - opentest = true; - } - if (vkey->Book() != lastHeading.Book()) { - if (openbook) - cout << "\t
\n"; - buf = new char [205]; - lastHeading = *vkey; - lastHeading.Chapter(0); - lastHeading.Verse(0); - *buf = 0; - filter.ProcessText(buf, 200 - 3, &lastHeading, inModule); - cout << "" << buf << endl; - delete [] buf; - openbook = true; - } - if (vkey->Chapter() != lastHeading.Chapter()) { - if (openchap) - cout << "\t\n"; - buf = new char [205]; - lastHeading = *vkey; - lastHeading.Verse(0); - *buf = 0; - filter.ProcessText(buf, 200 - 3, &lastHeading, inModule); - cout << "" << buf; - delete [] buf; - openbook = true; - } - /* - char *text = inModule->getRawEntry(); - int len = (inModule->getEntrySize() + 1) * 15; - buf = new char [ len ]; - memset(buf, 0, len); - memcpy(buf, inModule->getRawEntry(), inModule->getEntrySize()); - filter.ProcessText(buf, len - 3, vkey, inModule); - cout << buf << endl; - */ - cout << inModule->RenderText() << endl; - } - if (openchap) - cout << "\t\n"; - if (openbook) - cout << "\t\n"; - if (opentest) - cout << "\t\n"; - cout << "\t\n"; - cout << "\n"; - return 0; -} - + #include +#include +#include +#include + +#ifndef __GNUC__ +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void errorOutHelp(char *appName) { + cerr << appName << " - a tool to output a Sword module in OSIS format\n"; + cerr << "usage: "<< appName << " \n"; + cerr << "\n\n"; + exit(-1); +} + + +int main(int argc, char **argv) +{ + SWModule *inModule = 0; + ThMLOSIS filter; + + if ((argc != 2)) { + errorOutHelp(argv[0]); + } + + if ((!strcmp(argv[1], "-h")) || (!strcmp(argv[1], "--help")) || (!strcmp(argv[1], "/?")) || (!strcmp(argv[1], "-?")) || (!strcmp(argv[1], "-help"))) { + errorOutHelp(argv[0]); + } + + SWMgr mgr(new MarkupFilterMgr(FMT_OSIS)); + OptionsList options = mgr.getGlobalOptions(); + for (OptionsList::iterator it = options.begin(); it != options.end(); it++) { + OptionsList values = mgr.getGlobalOptionValues(it->c_str()); + if (find(values.begin(), values.end(), "On") != values.end()) { + mgr.setGlobalOption(it->c_str(), "On"); + } + } + + + ModMap::iterator it = mgr.Modules.find(argv[1]); + if (it == mgr.Modules.end()) { + fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]); + exit(-2); + } + + inModule = it->second; +// inModule->AddRenderFilter(&filter); + + SWKey *key = (SWKey *)*inModule; + VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); + + char *buf; + bool opentest = false; + bool openbook = false; + bool openchap = false; + VerseKey lastHeading; + lastHeading.Headings(1); + lastHeading.AutoNormalize(0); + lastHeading.Testament(5); + lastHeading = BOTTOM; + + if (!vkey) { + cerr << "Currently mod2zmod only works with verse keyed modules\n\n"; + exit(-1); + } + + vkey->Headings(1); + + cout << "getConfigEntry("Encoding")) { + if (*(inModule->getConfigEntry("Encoding"))) + cout << "encoding=\"" << inModule->getConfigEntry("Encoding") << "\" "; + else cout << "encoding=\"UTF-8\" "; + } + else cout << "encoding=\"UTF-8\" "; + cout << "?>\n\n"; + + cout << "\n\n"; + cout << "Name() << "\""; + cout << " osisRefWork=\"defaultReferenceScheme\""; + cout << ">\n\n"; + + cout << "\t
\n"; + cout << "\t\tName() << "\">\n"; + cout << "\t\t\t" << inModule->Name() << "\n"; + cout << "\t\t\t" << inModule->Description() << "\n"; + if (inModule->Lang()) { + if (strlen(inModule->Lang())) + cout << "\t\t\t" << inModule->Lang() << "\n"; + } + cout << "\t\t\tBible.KJV\n"; + cout << "\t\t\n"; + cout << "\t\t\n"; + cout << "\t\t\tBible.KJV\n"; + cout << "\t\t\n"; + cout << "\t
\n\n"; + + + (*inModule) = TOP; + int testament = vkey->Testament(); +// for ((*inModule) = TOP; (inModule->Key() < (VerseKey)"Mat 2:1"); (*inModule)++) { + for ((*inModule) = TOP; !inModule->Error(); (*inModule)++) { +// for ((*vkey) = "Mark6:29"; !inModule->Error(); (*inModule)++) { + if (vkey->Testament() != lastHeading.Testament()) { + if (opentest) + cout << "\t\n"; + cout << "\t
"; + lastHeading = *vkey; + lastHeading.Book(0); + lastHeading.Chapter(0); + lastHeading.Verse(0); + opentest = true; + } + if (vkey->Book() != lastHeading.Book()) { + if (openbook) + cout << "\t
\n"; + buf = new char [205]; + lastHeading = *vkey; + lastHeading.Chapter(0); + lastHeading.Verse(0); + *buf = 0; + filter.ProcessText(buf, 200 - 3, &lastHeading, inModule); + cout << "" << buf << endl; + delete [] buf; + openbook = true; + } + if (vkey->Chapter() != lastHeading.Chapter()) { + if (openchap) + cout << "\t\n"; + buf = new char [205]; + lastHeading = *vkey; + lastHeading.Verse(0); + *buf = 0; + filter.ProcessText(buf, 200 - 3, &lastHeading, inModule); + cout << "" << buf; + delete [] buf; + openbook = true; + } + /* + char *text = inModule->getRawEntry(); + int len = (inModule->getEntrySize() + 1) * 15; + buf = new char [ len ]; + memset(buf, 0, len); + memcpy(buf, inModule->getRawEntry(), inModule->getEntrySize()); + filter.ProcessText(buf, len - 3, vkey, inModule); + cout << buf << endl; + */ + cout << inModule->RenderText() << endl; + } + if (openchap) + cout << "\t\n"; + if (openbook) + cout << "\t\n"; + if (opentest) + cout << "\t\n"; + cout << "\t\n"; + cout << "\n"; + return 0; +} + + -- cgit