summaryrefslogtreecommitdiff
path: root/utilities/mod2osis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/mod2osis.cpp')
-rw-r--r--utilities/mod2osis.cpp73
1 files changed, 48 insertions, 25 deletions
diff --git a/utilities/mod2osis.cpp b/utilities/mod2osis.cpp
index ef71704..40305c2 100644
--- a/utilities/mod2osis.cpp
+++ b/utilities/mod2osis.cpp
@@ -1,5 +1,10 @@
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+/******************************************************************************
+ *
+ * mod2osis.cpp - Exports a module as an OSIS doc
+ *
+ * $Id: mod2osis.cpp 2972 2013-08-26 22:17:02Z scribe $
+ *
+ * Copyright 2002-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -24,6 +29,7 @@
#include <fstream>
#include <string>
+#include <swbuf.h>
#include <ztext.h>
#include <zld.h>
#include <zcom.h>
@@ -44,7 +50,7 @@ using std::cerr;
using std::cout;
void errorOutHelp(char *appName) {
- cerr << appName << " - a tool to output a Sword module in OSIS format\n";
+ cerr << appName << " - a tool to output a SWORD module in OSIS format\n";
cerr << "usage: "<< appName << " <modname> \n";
cerr << "\n\n";
exit(-1);
@@ -55,6 +61,23 @@ int main(int argc, char **argv)
{
SWModule *inModule = 0;
ThMLOSIS filter;
+
+ cerr << "\n\n*** Don't use this utility *** \n\n";
+ cerr << "Its purpose is to prove the engine can do\n";
+ cerr << "lossless import / export, but we are not there yet. \n\n";
+ cerr << "This utility is done, in fact it is already too complex.\n";
+ cerr << "The ENGINE needs more work to assure export as OSIS works\n";
+ cerr << "This utility only gives us occasion to improve the engine.\n";
+ cerr << "Our goal is not to produce an export tool.\n\n";
+ cerr << "In fact, you should never export SWORD modules.\n";
+ cerr << "Many CrossWire modules are licensed for use from publishers\n";
+ cerr << "and you will need to obtain your own permissions.\n";
+ cerr << "We also do not encourage propogating encoding errors\n";
+ cerr << "which you will avoid by obtaining text data from the source.\n\n";
+ cerr << "Please see the TextSource entry in the module's .conf file\n";
+ cerr << "for information where to obtain module data from our source.\n\n";
+ cerr << "If you still must export SWORD module data, use mod2imp.\n";
+ cerr << "It is more lossless; or less lossful, and easier to read.\n\n";
if ((argc != 2)) {
errorOutHelp(argv[0]);
@@ -103,7 +126,7 @@ int main(int argc, char **argv)
exit(-1);
}
- vkey->Headings(0);
+ vkey->setIntros(false);
cout << "<?xml version=\"1.0\" ";
if (inModule->getConfigEntry("Encoding")) {
@@ -121,19 +144,19 @@ int main(int argc, char **argv)
cout << " xsi:schemaLocation=\"http://www.bibletechnologies.net/2003/OSIS/namespace http://www.bibletechnologies.net/osisCore.2.1.1.xsd\">\n\n";
cout << "<osisText";
cout << " osisIDWork=\"";
- cout << inModule->Name() << "\"";
+ cout << inModule->getName() << "\"";
cout << " osisRefWork=\"defaultReferenceScheme\"";
- if (inModule->Lang()) {
- if (strlen(inModule->Lang()))
- cout << " xml:lang=\"" << inModule->Lang() << "\"";
+ if (inModule->getLanguage()) {
+ if (strlen(inModule->getLanguage()))
+ cout << " xml:lang=\"" << inModule->getLanguage() << "\"";
}
cout << ">\n\n";
cout << "\t<header>\n";
cout << "\t\t<work osisWork=\"";
- cout << inModule->Name() << "\">\n";
- cout << "\t\t\t<title>" << inModule->Description() << "</title>\n";
- cout << "\t\t\t<identifier type=\"OSIS\">Bible." << inModule->Name() << "</identifier>\n";
+ cout << inModule->getName() << "\">\n";
+ cout << "\t\t\t<title>" << inModule->getDescription() << "</title>\n";
+ cout << "\t\t\t<identifier type=\"OSIS\">Bible." << inModule->getName() << "</identifier>\n";
cout << "\t\t\t<refSystem>Bible.KJV</refSystem>\n";
cout << "\t\t</work>\n";
cout << "\t\t<work osisWork=\"defaultReferenceScheme\">\n";
@@ -144,7 +167,7 @@ int main(int argc, char **argv)
(*inModule) = TOP;
- SWKey *p = inModule->CreateKey();
+ SWKey *p = inModule->createKey();
VerseKey *tmpKey = SWDYNAMIC_CAST(VerseKey, p);
if (!tmpKey) {
delete p;
@@ -152,18 +175,18 @@ int main(int argc, char **argv)
}
*tmpKey = inModule->getKeyText();
- tmpKey->Headings(1);
- tmpKey->AutoNormalize(0);
+ tmpKey->setIntros(true);
+ tmpKey->setAutoNormalize(false);
- for ((*inModule) = TOP; !inModule->Error(); (*inModule)++) {
+ for ((*inModule) = TOP; !inModule->popError(); (*inModule)++) {
bool newTest = false;
bool newBook = false;
- if (!strlen(inModule->RenderText())) {
+ if (!strlen(inModule->renderText())) {
continue;
}
- if ((vkey->Testament() != lastTest)) {
+ if ((vkey->getTestament() != lastTest)) {
if (openchap)
cout << "\t</chapter>\n";
if (openbook)
@@ -174,7 +197,7 @@ int main(int argc, char **argv)
opentest = true;
newTest = true;
}
- if ((vkey->Book() != lastBook) || newTest) {
+ if ((vkey->getBook() != lastBook) || newTest) {
if (!newTest) {
if (openchap)
cout << "\t</chapter>\n";
@@ -183,22 +206,22 @@ int main(int argc, char **argv)
}
*buf = 0;
*tmpKey = *vkey;
- tmpKey->Chapter(0);
- tmpKey->Verse(0);
+ tmpKey->setChapter(0);
+ tmpKey->setVerse(0);
sprintf(buf, "\t<div type=\"book\" osisID=\"%s\">\n", tmpKey->getOSISRef());
// filter.ProcessText(buf, 200 - 3, &lastHeading, inModule);
cout << "" << buf << endl;
openbook = true;
newBook = true;
}
- if ((vkey->Chapter() != lastChap) || newBook) {
+ if ((vkey->getChapter() != lastChap) || newBook) {
if (!newBook) {
if (openchap)
cout << "\t</chapter>\n";
}
*buf = 0;
*tmpKey = *vkey;
- tmpKey->Verse(0);
+ tmpKey->setVerse(0);
sprintf(buf, "\t<chapter osisID=\"%s\">\n", tmpKey->getOSISRef());
// filter.ProcessText(buf, 200 - 3, &lastHeading, inModule);
cout << "" << buf;
@@ -207,9 +230,9 @@ int main(int argc, char **argv)
SWBuf verseText = inModule->getRawEntry();
sprintf(buf, "\t\t<verse osisID=\"%s\">", vkey->getOSISRef());
cout << buf << verseText.c_str() << "</verse>\n" << endl;
- lastChap = vkey->Chapter();
- lastBook = vkey->Book();
- lastTest = vkey->Testament();
+ lastChap = vkey->getChapter();
+ lastBook = vkey->getBook();
+ lastTest = vkey->getTestament();
}
if (openchap)
cout << "\t</chapter>\n";