summaryrefslogtreecommitdiff
path: root/utilities/mod2osis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/mod2osis.cpp')
-rw-r--r--utilities/mod2osis.cpp51
1 files changed, 36 insertions, 15 deletions
diff --git a/utilities/mod2osis.cpp b/utilities/mod2osis.cpp
index ee71e25..087300c 100644
--- a/utilities/mod2osis.cpp
+++ b/utilities/mod2osis.cpp
@@ -1,4 +1,20 @@
-// Compression on variable granularity
+/*
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
#include <fcntl.h>
#include <iostream>
#include <fstream>
@@ -79,7 +95,7 @@ int main(int argc, char **argv)
int lastBook = 9999;
int lastChap = 9999;
if (!vkey) {
- cerr << "Currently mod2zmod only works with verse keyed modules\n\n";
+ cerr << "Currently mod2osis only works with verse keyed modules\n\n";
exit(-1);
}
@@ -122,13 +138,18 @@ int main(int argc, char **argv)
cout << "\t</header>\n\n";
- (*inModule) = TOP;
-// for ((*inModule) = TOP; (inModule->Key() < (VerseKey)"Mat 2:1"); (*inModule)++) {
-// for ((*vkey) = "Mark6:29"; !inModule->Error(); (*inModule)++) {
+ (*inModule) = TOP;
+
+ SWKey *p = inModule->CreateKey();
+ VerseKey *tmpKey = SWDYNAMIC_CAST(VerseKey, p);
+ if (!tmpKey) {
+ delete p;
+ tmpKey = new VerseKey();
+ }
+ *tmpKey = inModule->getKeyText();
- VerseKey tmpKey;
- tmpKey.Headings(1);
- tmpKey.AutoNormalize(0);
+ tmpKey->Headings(1);
+ tmpKey->AutoNormalize(0);
for ((*inModule) = TOP; !inModule->Error(); (*inModule)++) {
bool newTest = false;
@@ -157,10 +178,10 @@ int main(int argc, char **argv)
cout << "\t</div>\n";
}
*buf = 0;
- tmpKey = *vkey;
- tmpKey.Chapter(0);
- tmpKey.Verse(0);
- sprintf(buf, "\t<div type=\"book\" osisID=\"%s\">\n", tmpKey.getOSISRef());
+ *tmpKey = *vkey;
+ tmpKey->Chapter(0);
+ tmpKey->Verse(0);
+ sprintf(buf, "\t<div type=\"book\" osisID=\"%s\">\n", tmpKey->getOSISRef());
// filter.ProcessText(buf, 200 - 3, &lastHeading, inModule);
cout << "" << buf << endl;
openbook = true;
@@ -172,9 +193,9 @@ int main(int argc, char **argv)
cout << "\t</chapter>\n";
}
*buf = 0;
- tmpKey = *vkey;
- tmpKey.Verse(0);
- sprintf(buf, "\t<chapter osisID=\"%s\">\n", tmpKey.getOSISRef());
+ *tmpKey = *vkey;
+ tmpKey->Verse(0);
+ sprintf(buf, "\t<chapter osisID=\"%s\">\n", tmpKey->getOSISRef());
// filter.ProcessText(buf, 200 - 3, &lastHeading, inModule);
cout << "" << buf;
openchap = true;