[sword-svn] r2348 - trunk/utilities

dmsmith at crosswire.org dmsmith at crosswire.org
Sun Apr 26 21:00:40 MST 2009


Author: dmsmith
Date: 2009-04-26 21:00:40 -0700 (Sun, 26 Apr 2009)
New Revision: 2348

Modified:
   trunk/utilities/Makefile.am
   trunk/utilities/imp2vs.cpp
   trunk/utilities/osis2mod.cpp
Log:
Fixed linking bug in osis2mod introduced by an API change

Modified: trunk/utilities/Makefile.am
===================================================================
--- trunk/utilities/Makefile.am	2009-04-27 02:50:16 UTC (rev 2347)
+++ trunk/utilities/Makefile.am	2009-04-27 04:00:40 UTC (rev 2348)
@@ -6,7 +6,7 @@
 stepdump step2vpl gbfidx modwrite addvs emptyvss \
 addgb genbookutil treeidxutil
 
-bin_PROGRAMS = mod2imp mod2osis osis2mod tei2mod vs2osisref vs2osisreftxt mod2vpl \
+bin_PROGRAMS = mod2imp mod2osis osis2mod tst tei2mod vs2osisref vs2osisreftxt mod2vpl \
 	mkfastmod vpl2mod imp2vs installmgr xml2gbs imp2gbs
 
 #if INSTALLMGR
@@ -56,6 +56,7 @@
 mod2osis_SOURCES = mod2osis.cpp
 xml2gbs_SOURCES = xml2gbs.cpp
 osis2mod_SOURCES = osis2mod.cpp
+tst_SOURCES = tst.cpp
 tei2mod_SOURCES = tei2mod.cpp
 vs2osisref_SOURCES = vs2osisref.cpp
 vs2osisreftxt_SOURCES = vs2osisreftxt.cpp

Modified: trunk/utilities/imp2vs.cpp
===================================================================
--- trunk/utilities/imp2vs.cpp	2009-04-27 02:50:16 UTC (rev 2347)
+++ trunk/utilities/imp2vs.cpp	2009-04-27 04:00:40 UTC (rev 2348)
@@ -34,12 +34,19 @@
 void usage(const char *progName, const char *error = 0) {
 	if (error) fprintf(stderr, "\n%s: %s\n", progName, error);
 	fprintf(stderr, "\n=== imp2vs (Revision $Rev: 2234 $) SWORD Bible/Commentary importer.\n");
-	fprintf(stderr, "\nusage: %s <imp_file> [options]\n"
-		"\t -a augment module if exists (default is to create new)\n"
-		"\t -o <output_path> where to write data files.\n"
-		"\t -4 use 4 byte size entries (default is 2).\n\n"
-		"\t -v <v11n> use versification scheme other than KJV.\n\n"
-		"'imp' format is a simple standard for importing data into SWORD modules.\n"
+	fprintf(stderr, "\nusage: %s <imp_file> [options]\n", progName);
+	fprintf(stderr, "  -a\t\t\t augment module if exists (default is to create new)\n");
+	fprintf(stderr, "  -o <output_path>\t where to write data files.\n");
+	fprintf(stderr, "  -4\t\t\t use 4 byte size entries (default is 2).\n");
+	fprintf(stderr, "  -v <v11n>\t\t specify a versification scheme to use (default is KJV)\n");
+	fprintf(stderr, "\t\t\t\t Note: The following are valid values for v11n:\n");
+	VerseMgr *vmgr = VerseMgr::getSystemVerseMgr();
+	StringList av11n = vmgr->getVersificationSystems();
+	for (StringList::iterator loop = av11n.begin(); loop != av11n.end(); loop++) {
+		fprintf(stderr, "\t\t\t\t\t%s\n", (*loop).c_str());
+        }
+	fprintf(stderr, "\n");
+	fprintf(stderr, "'imp' format is a simple standard for importing data into SWORD modules.\n"
 		"Required is a plain text file containing $$$key lines followed by content.\n\n"
 		"$$$Gen.1.1\n"
 		"In the beginning God created\n"
@@ -50,8 +57,7 @@
 		"John 1:1-4 might have a key, $$$Jn.1.1-4.  Special keys for intro entries use\n"
 		"standard SWORD notation, e.g. $$$Rom.4.0 for intro of Romans chapter 4,\n"
 		"$$$Rev.0.0 for intro of the Book of Revelation of John.  $$$[ Module Heading ]\n"
-		"for entire module intro.  $$$[ Testament 2 Heading ] for NT intro.\n\n"
-		, progName);
+		"for entire module intro.  $$$[ Testament 2 Heading ] for NT intro.\n\n");
 	exit(-1);
 }
 

Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp	2009-04-27 02:50:16 UTC (rev 2347)
+++ trunk/utilities/osis2mod.cpp	2009-04-27 04:00:40 UTC (rev 2348)
@@ -762,6 +762,9 @@
 				// The osisID or annotateRef can be more than a single verse
 				// The first or only one is the currentVerse
 				prepareSWVerseKey(keyVal);
+
+				// Use the last verse seen (i.e. the currentVerse) as the basis for recovering from bad parsing.
+				// This should never happen if the references are valid OSIS references
 				ListKey verseKeys = currentVerse.ParseVerseList(keyVal, currentVerse, true);
 				int memberKeyCount = verseKeys.Count();
 				if (memberKeyCount) {
@@ -769,7 +772,7 @@
 					// See if this osisID or annotateRef refers to more than one verse.
 					// If it does, save it until all verses have been seen.
 					// At that point we will output links.
-					if (memberKeyCount > 1) {
+					if (verseKeys++ != verseKeys) {
 						linkedVerses.push_back(verseKeys);
 					}
 				}
@@ -1155,21 +1158,16 @@
 	linkKey.AutoNormalize(0);
 	linkKey.Headings(1);
 	for (unsigned int i = 0; i < linkedVerses.size(); i++) {
-		// The verseKeys is an list of verses
+		// The verseKeys is a list of verses
 		// where the first is the real verse
 		// and the others link to it.
 		ListKey verseKeys = linkedVerses[i];
-		for (verseKeys = TOP; !verseKeys.Error(); verseKeys++) {
-			destKey = verseKeys;
-		}
 		verseKeys.setPosition(TOP);
 		destKey = verseKeys.getElement();
-		destKey.ClearBounds();
 		verseKeys.increment(1);
 
 		while (!verseKeys.Error()) {
 			linkKey = verseKeys.getElement();
-			linkKey.ClearBounds();
 			verseKeys.increment(1);
 			linkToEntry(linkKey, destKey);
 		}




More information about the sword-cvs mailing list