[sword-svn] r2796 - in trunk: src/keys tests/testsuite

scribe at crosswire.org scribe at crosswire.org
Thu Apr 11 09:18:45 MST 2013


Author: scribe
Date: 2013-04-11 09:18:45 -0700 (Thu, 11 Apr 2013)
New Revision: 2796

Modified:
   trunk/src/keys/versekey.cpp
   trunk/tests/testsuite/verseparsing.good
   trunk/tests/testsuite/verseparsing.sh
Log:
Fixed parsing of Ps.V
Added parsing of special 'inscriptio' and 'subscriptio' entries to Book 0:0 and Book 1:0 respectively (for INTF)
e.g., Matt.Inscr -> Matt.0.0 and Matt.Subscrip -> Matt.1.0


Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp	2013-04-11 16:16:15 UTC (rev 2795)
+++ trunk/src/keys/versekey.cpp	2013-04-11 16:18:45 UTC (rev 2796)
@@ -566,7 +566,9 @@
 				break;
 			}
 			if (inTerm) {
-				book[tobook++] = ' ';
+				if (tobook < 1 || book[tobook-1] != ' ') {
+					book[tobook++] = ' ';
+				}
 				break;
 			}
 
@@ -633,6 +635,23 @@
 					}
 				}
 
+				// check for special inscriptio and subscriptio which are saved as book intro and chap 1 intro (for INTF)
+				for (loop = strlen(book) - 1; loop+1; loop--) {
+					if (book[loop] == ' ') {
+						if (!strnicmp(&book[loop+1], "inscriptio", strlen(&book[loop+1]))) {
+							book[loop] = 0;
+							verse = 0;
+							chap = 0;
+						}
+						else if (!strnicmp(&book[loop+1], "subscriptio", strlen(&book[loop+1]))) {
+							book[loop] = 0;
+							verse = 0;
+							chap = 1;
+						}
+	        				break;
+					}
+				}
+
 				if ((!stricmp(book, "V")) || (!stricmp(book, "VER"))) {	// Verse abbrev
 					if (verse == -1) {
 						verse = chap;
@@ -797,6 +816,10 @@
 				else	chap  = atoi(number);
 				*number = 0;
 			}
+			else if (chap == -1 && (tobook < 1 || book[tobook-1] != ' ')) {
+				book[tobook++] = ' ';
+			}
+			
 			break;
 
 		default:
@@ -848,11 +871,16 @@
 	if (*book) {
 		loop = strlen(book) - 1;
 
+		// strip trailing spaces
 		for (; loop+1; loop--) { if (book[loop] == ' ') book[loop] = 0; else break; }
 
+		// check if endsWith([0-9][a-z]) and kill the last letter, e.g., ...12a, and chop off the 'a'
+		// why?  What's this for? wouldn't this mess up 2t?
 		if (loop > 0 && isdigit(book[loop-1]) && book[loop] >= 'a' && book[loop] <= 'z') {
 			book[loop--] = 0;
 		}
+
+		// skip trailing spaces and numbers
 		for (; loop+1; loop--) {
 			if ((isdigit(book[loop])) || (book[loop] == ' ')) {
 				book[loop] = 0;
@@ -869,6 +897,7 @@
 			break;
 		}
 
+		// check for roman numeral chapter
 		for (loop = strlen(book) - 1; loop+1; loop--) {
 			if (book[loop] == ' ') {
 				// "PS C" is ok, but "II C" is not ok
@@ -882,6 +911,24 @@
 				break;
 			}
 		}
+		// check for special inscriptio and subscriptio which are saved as book intro and chap 1 intro (for INTF)
+		for (loop = strlen(book) - 1; loop+1; loop--) {
+			if (book[loop] == ' ') {
+				if (!strnicmp(&book[loop+1], "inscriptio", strlen(&book[loop+1]))) {
+					book[loop] = 0;
+					verse = 0;
+					chap = 0;
+					suffix = 0;
+				}
+				else if (!strnicmp(&book[loop+1], "subscriptio", strlen(&book[loop+1]))) {
+					book[loop] = 0;
+					verse = 0;
+					chap = 1;
+						suffix = 0;
+				}
+				break;
+			}
+		}
 
 		if ((!stricmp(book, "V")) || (!stricmp(book, "VER"))) {	// Verse abbrev.
 			if (verse == -1) {

Modified: trunk/tests/testsuite/verseparsing.good
===================================================================
--- trunk/tests/testsuite/verseparsing.good	2013-04-11 16:16:15 UTC (rev 2795)
+++ trunk/tests/testsuite/verseparsing.good	2013-04-11 16:18:45 UTC (rev 2796)
@@ -67,6 +67,11 @@
 Song of 3:5 en KJV ge 1: Song of Solomon 3:5
 Song of Sol 3:5 en KJV ge 1: Song of Solomon 3:5
 Revelation of John 1:1 en KJV ge 1: Revelation of John 1:1
+Matt.Inscriptio en KJV ge 1 0 1: Matthew 0:0
+Matt.Subscriptio en KJV ge 1 0 1: Matthew 1:0
+Matt Inscriptio en KJV ge 1 0 1: Matthew 0:0
+Matt  Inscriptio en KJV ge 1 0 1: Matthew 0:0
+Matt  subsc en KJV ge 1 0 1: Matthew 1:0
 Gen en KJV ge 1: Genesis 1:1-Genesis 50:26
 Genes en KJV ge 1: Genesis 1:1-Genesis 50:26
 Exod en KJV ge 1: Exodus 1:1-Exodus 40:38

Modified: trunk/tests/testsuite/verseparsing.sh
===================================================================
--- trunk/tests/testsuite/verseparsing.sh	2013-04-11 16:16:15 UTC (rev 2795)
+++ trunk/tests/testsuite/verseparsing.sh	2013-04-11 16:18:45 UTC (rev 2796)
@@ -101,6 +101,15 @@
 ../parsekey "Song of Sol 3:5" en KJV ge 1
 ../parsekey "Revelation of John 1:1" en KJV ge 1
 
+### check for 'inscriptio' and 'subscriptio' special chapters which parse to Book 0:0 and Book 1:0 respectively (for INTF)
+../parsekey "Matt.Inscriptio" en KJV ge 1 0 1
+../parsekey "Matt.Subscriptio" en KJV ge 1 0 1
+../parsekey "Matt Inscriptio" en KJV ge 1 0 1
+../parsekey "Matt  Inscriptio" en KJV ge 1 0 1
+../parsekey "Matt  subsc" en KJV ge 1 0 1
+
+
+
 en_abbrevs="
 Gen Genes Exod Ex Exo Lev Le Levi Num Nu Numb Deut Deu De Josh Jos Joshu
 Judg Jdg Judge Ruth Ru Rut 1Sam 1Sa 1Samu 2Sam 2Sa 2Samu 1Kgs 1Ki 1King




More information about the sword-cvs mailing list