summaryrefslogtreecommitdiffstats
path: root/modules/nasb/cutil
diff options
context:
space:
mode:
authorTroy A. Griffitts <scribe@crosswire.org>2011-05-11 22:45:53 +0000
committerTroy A. Griffitts <scribe@crosswire.org>2011-05-11 22:45:53 +0000
commit2960c50d0d3a8a6b596fe6a466b36d6926d266b7 (patch)
treefe931f7fde279abf537e74316e1b578eab3cd75a /modules/nasb/cutil
parenta7d0bd22660fbb1ce744f0678d9311519ce48362 (diff)
downloadsword-tools-2960c50d0d3a8a6b596fe6a466b36d6926d266b7.tar.gz
updated to handle lbla
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@323 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'modules/nasb/cutil')
-rw-r--r--modules/nasb/cutil/nasbosis.cpp69
1 files changed, 50 insertions, 19 deletions
diff --git a/modules/nasb/cutil/nasbosis.cpp b/modules/nasb/cutil/nasbosis.cpp
index 9d3d188..ed80c2c 100644
--- a/modules/nasb/cutil/nasbosis.cpp
+++ b/modules/nasb/cutil/nasbosis.cpp
@@ -47,18 +47,34 @@ static const char **osisBooks[] = { osisOTBooks, osisNTBooks };
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 @@ int main(int argc, char **argv) {
// 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 main(int argc, char **argv) {
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 @@ int main(int argc, char **argv) {
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 @@ void prepLine(string &outstring, int currentTestament, bool note) {
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 @@ void prepLine(string &outstring, int currentTestament, bool note) {
if (start > -1) {
for (;start;start--) {
if ((!isupper(outstring[start])) &&
- (!strchr("\\/ ", outstring[start]))) {
+ (!strchr("\\/ ~", outstring[start]))) {
break;
}
}
@@ -1041,13 +1065,20 @@ void prepLine(string &outstring, int currentTestament, bool note) {
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, "}}");