From 5411e171bb4e231317dc8181d8a5db1c92d7a38f Mon Sep 17 00:00:00 2001 From: danglassey Date: Mon, 9 Sep 2002 13:01:42 +0000 Subject: sync with crosswire 20020909-1300 --- src/modules/filters/gbfosis.cpp | 20 ++++----- src/modules/filters/thmlosis.cpp | 22 +++++----- utilities/mod2osis.cpp | 88 +++++++++++++++++++++++++--------------- 3 files changed, 77 insertions(+), 53 deletions(-) diff --git a/src/modules/filters/gbfosis.cpp b/src/modules/filters/gbfosis.cpp index 43161d4..ec20675 100644 --- a/src/modules/filters/gbfosis.cpp +++ b/src/modules/filters/gbfosis.cpp @@ -228,11 +228,11 @@ char GBFOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWModu if (vkey) { char ref[254]; if (vkey->Verse()) - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t\t", vkey->getOSISRef()); else if (vkey->Chapter()) - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t
", vkey->getOSISRef()); else if (vkey->Book()) - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t
", vkey->getOSISRef()); else *ref = 0; if (*ref) { memmove(text+strlen(ref), text, maxlen-strlen(ref)-1); @@ -243,27 +243,27 @@ char GBFOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWModu tmp = *vkey; tmp.AutoNormalize(0); tmp.Headings(1); - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, ""); pushString(&to, ref); tmp = MAXVERSE; if (*vkey == tmp) { tmp.Verse(0); - sprintf(ref, "", tmp.getOSISRef()); + sprintf(ref, "\t
"); pushString(&to, ref); tmp = MAXCHAPTER; tmp = MAXVERSE; if (*vkey == tmp) { tmp.Chapter(0); tmp.Verse(0); - sprintf(ref, "", tmp.getOSISRef()); + sprintf(ref, "\t
"); pushString(&to, ref); } } } else if (vkey->Chapter()) - sprintf(ref, "", vkey->getOSISRef()); - else sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t
", vkey->getOSISRef()); + else sprintf(ref, "\t
", vkey->getOSISRef()); } } *to++ = 0; @@ -299,13 +299,13 @@ const char *GBFOSIS::convertToOSIS(const char *inRef, const SWKey *key) { memmove(frag, startFrag, ((const char *)element->userData - startFrag) + 1); frag[((const char *)element->userData - startFrag) + 1] = 0; startFrag = (const char *)element->userData + 1; - sprintf(buf, "%s", element->LowerBound().getOSISRef(), element->UpperBound().getOSISRef(), frag); + sprintf(buf, "%s", element->LowerBound().getOSISRef(), element->UpperBound().getOSISRef(), frag); } else { memmove(frag, startFrag, ((const char *)verses.GetElement(i)->userData - startFrag) + 1); frag[((const char *)verses.GetElement(i)->userData - startFrag) + 1] = 0; startFrag = (const char *)verses.GetElement(i)->userData + 1; - sprintf(buf, "%s", VerseKey(*verses.GetElement(i)).getOSISRef(), frag); + sprintf(buf, "%s", VerseKey(*verses.GetElement(i)).getOSISRef(), frag); } outRef+=buf; } diff --git a/src/modules/filters/thmlosis.cpp b/src/modules/filters/thmlosis.cpp index 54cd002..10f5892 100644 --- a/src/modules/filters/thmlosis.cpp +++ b/src/modules/filters/thmlosis.cpp @@ -92,7 +92,7 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod // Scripture Reference if (!strncmp(token, "scripRef", 8)) { - // pushString(buf, "Verse()) - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t\t", vkey->getOSISRef()); else if (vkey->Chapter()) - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t
", vkey->getOSISRef()); else if (vkey->Book()) - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t
", vkey->getOSISRef()); else *ref = 0; if (*ref) { memmove(text+strlen(ref), text, maxlen-strlen(ref)-1); @@ -262,27 +262,27 @@ char ThMLOSIS::ProcessText(char *text, int maxlen, const SWKey *key, const SWMod tmp = *vkey; tmp.AutoNormalize(0); tmp.Headings(1); - sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, ""); pushString(&to, ref); tmp = MAXVERSE; if (*vkey == tmp) { tmp.Verse(0); - sprintf(ref, "", tmp.getOSISRef()); + sprintf(ref, "\t
"); pushString(&to, ref); tmp = MAXCHAPTER; tmp = MAXVERSE; if (*vkey == tmp) { tmp.Chapter(0); tmp.Verse(0); - sprintf(ref, "", tmp.getOSISRef()); + sprintf(ref, "\t
"); pushString(&to, ref); } } } else if (vkey->Chapter()) - sprintf(ref, "", vkey->getOSISRef()); - else sprintf(ref, "", vkey->getOSISRef()); + sprintf(ref, "\t
", vkey->getOSISRef()); + else sprintf(ref, "\t
", vkey->getOSISRef()); } } *to++ = 0; @@ -318,13 +318,13 @@ const char *ThMLOSIS::convertToOSIS(const char *inRef, const SWKey *key) { memmove(frag, startFrag, ((const char *)element->userData - startFrag) + 1); frag[((const char *)element->userData - startFrag) + 1] = 0; startFrag = (const char *)element->userData + 1; - sprintf(buf, "%s", element->LowerBound().getOSISRef(), element->UpperBound().getOSISRef(), frag); + sprintf(buf, "%s", element->LowerBound().getOSISRef(), element->UpperBound().getOSISRef(), frag); } else { memmove(frag, startFrag, ((const char *)verses.GetElement(i)->userData - startFrag) + 1); frag[((const char *)verses.GetElement(i)->userData - startFrag) + 1] = 0; startFrag = (const char *)verses.GetElement(i)->userData + 1; - sprintf(buf, "%s", VerseKey(*verses.GetElement(i)).getOSISRef(), frag); + sprintf(buf, "%s", VerseKey(*verses.GetElement(i)).getOSISRef(), frag); } outRef+=buf; } diff --git a/utilities/mod2osis.cpp b/utilities/mod2osis.cpp index ac42be4..79cec14 100644 --- a/utilities/mod2osis.cpp +++ b/utilities/mod2osis.cpp @@ -67,15 +67,21 @@ int main(int argc, char **argv) VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); char *buf; - bool opendiv = false; + bool opentest = false; + bool openbook = false; + bool openchap = false; VerseKey lastHeading; lastHeading.Headings(1); lastHeading.AutoNormalize(0); lastHeading.Testament(5); lastHeading = BOTTOM; - if (vkey) - vkey->Headings(1); + if (!vkey) { + cerr << "Currently mod2zmod only works with verse keyed modules\n\n"; + exit(-1); + } + + vkey->Headings(1); cout << "getConfigEntry("Encoding")) { @@ -86,57 +92,71 @@ int main(int argc, char **argv) else cout << "encoding=\"UTF-8\" "; cout << "?>\n\n"; - cout << "Name() << "\" "; - if (inModule->Lang()) { - if (strlen(inModule->Lang())) - cout << "lang=\"" << inModule->Lang() << "\" "; - } - cout << "xsi:noNamespaceSchemaLocation=\"OSISCore_1.0.2.xsd\" "; - cout << " >\n\n"; - - cout << "\t\n"; - cout << "\t\t\n"; - cout << "\t\t\t<titlePart>" << inModule->Description() << "</titlePart>\n"; - cout << "\t\t\n"; - cout << "\t\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"; - cout << "\t
\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 (opendiv) + if (opentest) cout << "\t
\n"; - cout << "\t
"; - opendiv = true; + 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.Testament(vkey->Testament()); - lastHeading.Book(vkey->Book()); + 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.Testament(vkey->Testament()); - lastHeading.Book(vkey->Book()); - lastHeading.Chapter(vkey->Chapter()); + lastHeading = *vkey; lastHeading.Verse(0); *buf = 0; filter.ProcessText(buf, 200 - 3, &lastHeading, inModule); cout << "" << buf; delete [] buf; + openbook = true; } /* char *text = inModule->getRawEntry(); @@ -149,10 +169,14 @@ int main(int argc, char **argv) */ cout << inModule->RenderText() << endl; } - if (opendiv) + if (openchap) + cout << "\t
\n"; + if (openbook) + cout << "\t
\n"; + if (opentest) cout << "\t
\n"; - cout << "\t
\n"; - cout << "\t\n"; + cout << "\t\n"; + cout << "\n"; return 0; } -- cgit