[sword-svn] r323 - trunk/modules/nasb/cutil

scribe at crosswire.org scribe at crosswire.org
Wed May 11 15:45:54 MST 2011


Author: scribe
Date: 2011-05-11 15:45:53 -0700 (Wed, 11 May 2011)
New Revision: 323

Modified:
   trunk/modules/nasb/cutil/nasbosis.cpp
Log:
updated to handle lbla


Modified: trunk/modules/nasb/cutil/nasbosis.cpp
===================================================================
--- trunk/modules/nasb/cutil/nasbosis.cpp	2011-04-20 07:49:43 UTC (rev 322)
+++ trunk/modules/nasb/cutil/nasbosis.cpp	2011-05-11 22:45:53 UTC (rev 323)
@@ -47,18 +47,34 @@
 const char osisMax[2] = {57, 27};
 
 static const char *nasbOTBooks[] = {
+
+"GENESIS", "EXODO", "LEVITICO", "NUMEROS", "DEUTERONOMIO", "JOSUE", "JUECES", 
+"RUT", "1 SAMUEL", "2 SAMUEL", "1 REYES", "2 REYES", "1 CRONICAS", "2 CRONICAS", 
+"ESDRAS", "NEHEMIAS", "ESTER", "JOB", "LOS SALMOS", "LOS PROVERBIOS", "ECLESIASTES", 
+"CANTARES", "ISAIAS", "JEREMIAS", "LAMENTACIONES", "EZEQUIEL", "DANIEL", "OSEAS", 
+"JOEL", "AMOS", "ABDIAS", "JONAS", "MIQUEAS", "NAHUM", "HABACUC", 
+"SOFONIAS", "HAGEO", "ZACARIAS", "MALAQUIAS" 
+/*
 	"GENESIS", "EXODUS", "LEVITICUS", "NUMBERS", "DEUTERONOMY", "JOSHUA", "JUDGES",
-	"RUTH", "1 SAMUEL", "2 SAMUEL", "1 KINGS", "2 KINGS", "1 CHRONICLES",
-	"2 CHRONICLES", "EZRA", "NEHEMIAH", "ESTHER", "JOB", "PSALMS", "PROVERBS",
-	"ECCLESIASTES", "SONG OF SOLOMON", "ISAIAH", "JEREMIAH", "LAMENTATIONS",
-	"EZEKIEL", "DANIEL", "HOSEA", "JOEL", "AMOS", "OBADIAH", "JONAH", "MICAH",
-	"NAHUM", "HABAKKUK", "ZEPHANIAH", "HAGGAI", "ZECHARIAH", "MALACHI"};
+	"RUTH", "1 SAMUEL", "2 SAMUEL", "1 KINGS", "2 KINGS", "1 CHRONICLES", "2 CHRONICLES",
+	"EZRA", "NEHEMIAH", "ESTHER", "JOB", "PSALMS", "PROVERBS", "ECCLESIASTES",
+	"SONG OF SOLOMON", "ISAIAH", "JEREMIAH", "LAMENTATIONS", "EZEKIEL", "DANIEL", "HOSEA",
+	"JOEL", "AMOS", "OBADIAH", "JONAH", "MICAH", "NAHUM", "HABAKKUK",
+	"ZEPHANIAH", "HAGGAI", "ZECHARIAH", "MALACHI"
+*/
+};
 static const char *nasbNTBooks[] = {
+"SAN MATEO", "SAN MARCOS", "SAN LUCAS", "SAN JUAN", "HECHOS", "ROMANOS", "1 CORINTIOS", 
+"2 CORINTIOS", "GALATAS", "EFESIOS", "FILIPENSES", "COLOSENSES", "1 TESALONICENSES", "2 TESALONICENSES", 
+"1 TIMOTEO", "2 TIMOTEO", "TITO", "FILEMON", "HEBREOS", "SANTIAGO", "1 SAN PEDRO", 
+"2 SAN PEDRO", "1 SAN JUAN", "2 SAN JUAN", "3 SAN JUAN", "SAN JUDAS", "EL APOCALIPSIS"
+/*
 	"MATTHEW", "MARK", "LUKE", "JOHN", "ACTS", "ROMANS", "1 CORINTHIANS",
-	"2 CORINTHIANS", "GALATIANS", "EPHESIANS", "PHILIPPIANS", "COLOSSIANS",
-	"1 THESSALONIANS", "2 THESSALONIANS", "1 TIMOTHY", "2 TIMOTHY", "TITUS",
-	"PHILEMON", "HEBREWS", "JAMES", "1 PETER", "2 PETER", "1 JOHN", "2 JOHN",
-	"3 JOHN", "JUDE", "REVELATION"};
+	"2 CORINTHIANS", "GALATIANS", "EPHESIANS", "PHILIPPIANS", "COLOSSIANS", "1 THESSALONIANS", "2 THESSALONIANS",
+	"1 TIMOTHY", "2 TIMOTHY", "TITUS", "PHILEMON", "HEBREWS", "JAMES", "1 PETER",
+	"2 PETER", "1 JOHN", "2 JOHN", "3 JOHN", "JUDE", "REVELATION"
+*/
+};
 static const char **nasbBooks[] = { nasbOTBooks, nasbNTBooks };
 const char nasbMax[2] = {39, 27};
 
@@ -235,10 +251,10 @@
 
 		// CHAPTERS
 		//<SN>PSALM
-		if ((!strncmp(outstring.c_str(), "<CN>CHAPTER", 11)) || (!strncmp(outstring.c_str(), "<SN>PSALM", 9))) {
+		if ((!strncmp(outstring.c_str(), "<CN>", 4)) || (!strncmp(outstring.c_str(), "<SN>", 4))) {
 			string chapterTitle = outstring.c_str()+4;
 			chapterTitle = chapterTitle.substr(0, chapterTitle.find_first_of("<"));
-			string chapter = chapterTitle.substr((chapterTitle[0] == 'C')?8:6);
+			string chapter = chapterTitle.substr(chapterTitle.find_first_of(" ")+1);
 			outstring = "";
 			if (inVerse) {
 				outstring += "</verse>";
@@ -315,6 +331,7 @@
 			int testmt = 0, book, chap;
 			string bkch = outstring.substr(start+2, end-start-2);
 			sscanf(bkch.c_str(), "%d:%d", &book, &chap);
+			currentChapter = chap;
 			int vNumEnd = outstring.find_first_of(" ", end);
 			currentVerse = atoi(outstring.substr(end+1, vNumEnd-end-1).c_str());
 			currentBookNo = book;
@@ -323,7 +340,7 @@
 				book -= nasbMax[0];
 			}
 			if (currentBook != osisBooks[testmt][book-1]) {
-				fprintf(stderr, "error: %s: Found a book/chapter identifier out of place: {{%d:%d}} in book %s, chapter %d\n", argv[0], book, chap, currentBook.c_str(), currentChapter);
+				fprintf(stderr, "error: %s: Found a book/chapter identifier out of place: {{%d:%d}} in book %s, chapter %d; bkch = %s; outstring = %s\n", argv[0], book, chap, currentBook.c_str(), currentChapter, bkch.c_str(), outstring.c_str());
 				exit(-3);
 			}
 			char chapString[20], verseString[20];
@@ -894,6 +911,13 @@
 				continue;
 			}
 			outstr = outstring.c_str();
+			found = strstr(outstr, "S\\{EN~OR}/");
+			start = (found) ? (found - outstr) : -1;
+			if (start > -1) {
+				outstring.replace(start, 10, "<seg><divineName>Sen~or</divineName></seg>");
+				continue;
+			}
+			outstr = outstring.c_str();
 			found = strstr(outstr, "Y\\{AH,}/");
 			start = (found) ? (found - outstr) : -1;
 			if (start > -1) {
@@ -952,7 +976,7 @@
 			if (start > -1) {
 				for (;start;start--) {
 					if ((!isupper(outstring[start])) &&
-							(!strchr("\\/ ", outstring[start]))) {
+							(!strchr("\\/ ~", outstring[start]))) {
 						break;
 					}
 				}
@@ -1041,13 +1065,20 @@
 
 string getNoteBody(int fdn, string &noteLine, string osisID, int currentBookNo, int currentChapter, int currentVerse, string nStr, const char *nx) {
 	char *nbuffer = 0;
-	if (!noteLine.length() && fdn > -1) {
-		readline(fdn, &nbuffer);
-		noteLine = nbuffer;
+	int start = -1;
+	const char *found = (const char *)-1;
+	const char *outstr = (const char *)-1;
+
+	while (start == -1) {
+		if (!noteLine.length() && fdn > -1) {
+			if (readline(fdn, &nbuffer)) return "";	// eof
+			noteLine = nbuffer;
+		}
+		outstr = noteLine.c_str();
+		found = strstr(outstr, "{{");
+		start = (found) ? (found - outstr) : -1;
+		if (start == -1) noteLine = "";
 	}
-	const char *outstr = noteLine.c_str();
-	const char *found = strstr(outstr, "{{");
-	int start = (found) ? (found - outstr) : -1;
 
 	if (start > -1) {
 		found = strstr(outstr, "}}");




More information about the sword-cvs mailing list