diff options
-rw-r--r-- | src/keys/versekey.cpp | 4 | ||||
-rw-r--r-- | src/modules/filters/thmlosis.cpp | 2 | ||||
-rw-r--r-- | utilities/bcppmake/libsword.bpf | 4 | ||||
-rw-r--r-- | utilities/bcppmake/libsword.bpr | 23 | ||||
-rw-r--r-- | utilities/bcppmake/utilities.bpg | 6 | ||||
-rw-r--r-- | 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"/> <RESFILES value=""/> <IDLFILES value=""/> <IDLGENFILES value=""/> @@ -96,7 +99,7 @@ <PATHRC value=".;"/> <PATHASM value=".;"/> <LINKER value="TLib"/> - <USERDEFINES value="_ICU_;_ICUSWORD_"/> + <USERDEFINES value="_ICU_;_ICUSWORD_;_DEBUG"/> <SYSDEFINES value="NO_STRICT"/> <MAINSOURCE value="libsword.bpf"/> <INCLUDEPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\common;..\..\..\icu-sword\source\i18n"/> @@ -105,9 +108,10 @@ <LISTFILE value=""/> </MACROS> <OPTIONS> - <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/> - <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/> - <AFLAGS value="/mx /w2 /zn"/> + <CFLAG1 value="-vGc -vGt -vGd -Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k + -y -v -vi- -c -tW -tWM"/> + <PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/> + <AFLAGS value="/mx /w2 /zi"/> <LFLAGS value="/P512"/> </OPTIONS> <LINKER> @@ -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 <fcntl.h>
-#include <iostream>
-#include <fstream>
-#include <string>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <ztext.h>
-#include <zld.h>
-#include <zcom.h>
-#include <swmgr.h>
-#include <lzsscomprs.h>
-#include <zipcomprs.h>
-#include <versekey.h>
-#include <thmlosis.h>
-#include <stdio.h>
-#include <markupfiltmgr.h>
-#include <algorithm>
-
-void errorOutHelp(char *appName) {
- cerr << appName << " - a tool to output a Sword module in OSIS format\n";
- cerr << "usage: "<< appName << " <modname> \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 << "<?xml version=\"1.0\" ";
- if (inModule->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 << "<osis";
- cout << " xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\"";
- cout << " xsi:noNamespaceSchemaLocation=\"osisCore.1.1.xsd\">\n\n";
- cout << "<osisText";
- cout << " osisIDWork=\"";
- cout << inModule->Name() << "\"";
- cout << " osisRefWork=\"defaultReferenceScheme\"";
- cout << ">\n\n";
-
- cout << "\t<header>\n";
- cout << "\t\t<work osisWork=\"";
- cout << inModule->Name() << "\">\n";
- cout << "\t\t\t<identifier type=\"OSIS\">" << inModule->Name() << "</identifier>\n";
- cout << "\t\t\t<title>" << inModule->Description() << "</title>\n";
- if (inModule->Lang()) {
- if (strlen(inModule->Lang()))
- cout << "\t\t\t<language>" << inModule->Lang() << "</language>\n";
- }
- cout << "\t\t\t<refSystem>Bible.KJV</title>\n";
- cout << "\t\t</work>\n";
- cout << "\t\t<work osisWork=\"defaultReferenceScheme\">\n";
- cout << "\t\t\t<identifier type=\"OSIS\">Bible.KJV</identifier>\n";
- cout << "\t\t</work>\n";
- cout << "\t</header>\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</div>\n";
- cout << "\t<div type=\"testament\">";
- lastHeading = *vkey;
- lastHeading.Book(0);
- lastHeading.Chapter(0);
- lastHeading.Verse(0);
- opentest = true;
- }
- if (vkey->Book() != lastHeading.Book()) {
- if (openbook)
- cout << "\t</div>\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</div>\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</div>\n";
- if (openbook)
- cout << "\t</div>\n";
- if (opentest)
- cout << "\t</div>\n";
- cout << "\t</osisText>\n";
- cout << "</osis>\n";
- return 0;
-}
-
+
#include <fcntl.h> +#include <iostream> +#include <fstream> +#include <string> + +#ifndef __GNUC__ +#include <io.h> +#else +#include <unistd.h> +#endif + +#include <ztext.h> +#include <zld.h> +#include <zcom.h> +#include <swmgr.h> +#include <lzsscomprs.h> +#include <zipcomprs.h> +#include <versekey.h> +#include <thmlosis.h> +#include <stdio.h> +#include <markupfiltmgr.h> +#include <algorithm> + +void errorOutHelp(char *appName) { + cerr << appName << " - a tool to output a Sword module in OSIS format\n"; + cerr << "usage: "<< appName << " <modname> \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 << "<?xml version=\"1.0\" "; + if (inModule->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 << "<osis"; + cout << " xmlns:xsi=\"http://www.w3.org/2000/10/XMLSchema-instance\""; + cout << " xsi:noNamespaceSchemaLocation=\"osisCore.1.1.xsd\">\n\n"; + cout << "<osisText"; + cout << " osisIDWork=\""; + cout << inModule->Name() << "\""; + cout << " osisRefWork=\"defaultReferenceScheme\""; + cout << ">\n\n"; + + cout << "\t<header>\n"; + cout << "\t\t<work osisWork=\""; + cout << inModule->Name() << "\">\n"; + cout << "\t\t\t<identifier type=\"OSIS\">" << inModule->Name() << "</identifier>\n"; + cout << "\t\t\t<title>" << inModule->Description() << "</title>\n"; + if (inModule->Lang()) { + if (strlen(inModule->Lang())) + cout << "\t\t\t<language>" << inModule->Lang() << "</language>\n"; + } + cout << "\t\t\t<refSystem>Bible.KJV</title>\n"; + cout << "\t\t</work>\n"; + cout << "\t\t<work osisWork=\"defaultReferenceScheme\">\n"; + cout << "\t\t\t<identifier type=\"OSIS\">Bible.KJV</identifier>\n"; + cout << "\t\t</work>\n"; + cout << "\t</header>\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</div>\n"; + cout << "\t<div type=\"testament\">"; + lastHeading = *vkey; + lastHeading.Book(0); + lastHeading.Chapter(0); + lastHeading.Verse(0); + opentest = true; + } + if (vkey->Book() != lastHeading.Book()) { + if (openbook) + cout << "\t</div>\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</div>\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</div>\n"; + if (openbook) + cout << "\t</div>\n"; + if (opentest) + cout << "\t</div>\n"; + cout << "\t</osisText>\n"; + cout << "</osis>\n"; + return 0; +} + + |