[sword-svn] r2161 - in trunk: . src/modules/lexdict/rawld src/modules/lexdict/rawld4 src/modules/lexdict/zld

scribe at www.crosswire.org scribe at www.crosswire.org
Wed May 14 13:01:30 MST 2008


Author: scribe
Date: 2008-05-14 13:01:29 -0700 (Wed, 14 May 2008)
New Revision: 2161

Modified:
   trunk/ChangeLog
   trunk/src/modules/lexdict/rawld/rawld.cpp
   trunk/src/modules/lexdict/rawld4/rawld4.cpp
   trunk/src/modules/lexdict/zld/zld.cpp
Log:
	Added ability for lexicon drivers to accept
		####![a-z] as strong number.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-05-14 19:53:14 UTC (rev 2160)
+++ trunk/ChangeLog	2008-05-14 20:01:29 UTC (rev 2161)
@@ -1,5 +1,9 @@
 API ChangeLog 
 
+14-May-2008	Troy A. Griffitts <scribe at crosswire.org>
+	Added ability for lexicon drivers to accept
+		####![a-z] as strong number.
+
 11-May-2008	Troy A. Griffitts <scribe at crosswire.org>
 	Applied patch to better handle x-refs in notes
 		-Ben Morgan <benpmorgan at gmail dot com>

Modified: trunk/src/modules/lexdict/rawld/rawld.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld/rawld.cpp	2008-05-14 19:53:14 UTC (rev 2160)
+++ trunk/src/modules/lexdict/rawld/rawld.cpp	2008-05-14 20:01:29 UTC (rev 2161)
@@ -56,23 +56,31 @@
 	int size = 0;
 	int len = strlen(buf);
 	char subLet = 0;
-	if ((len < 6) && (len > 0)) {
+	bool bang = false;
+	if ((len < 8) && (len > 0)) {
 		for (check = buf; *(check+1); check++) {
 			if (!isdigit(*check))
 				break;
 			else size++;
 		}
 
-		if ((size == (len-1)) && size) {
+		if (size && ((size == (len-1)) || (size == (len-2)))) {
+			if (*check == '!') {
+				bang = true;
+				check++;
+			}
 			if (isalpha(*check)) {
 				subLet = toupper(*check);
-				*check = 0;
+				*(check-(bang?1:0)) = 0;
 			}
 			sprintf(buf, "%.5d", atoi(buf));
 			if (subLet) {
 				check = buf+(strlen(buf));
-				*check = subLet;
-				*(check+1) = 0;
+				if (bang) {
+					*check++ = '!';
+				}
+				*check++ = subLet;
+				*check = 0;
 			}
 		}
 	}

Modified: trunk/src/modules/lexdict/rawld4/rawld4.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld4/rawld4.cpp	2008-05-14 19:53:14 UTC (rev 2160)
+++ trunk/src/modules/lexdict/rawld4/rawld4.cpp	2008-05-14 20:01:29 UTC (rev 2161)
@@ -56,23 +56,31 @@
 	int size = 0;
 	int len = strlen(buf);
 	char subLet = 0;
-	if ((len < 6) && (len > 0)) {
+	bool bang = false;
+	if ((len < 8) && (len > 0)) {
 		for (check = buf; *(check+1); check++) {
 			if (!isdigit(*check))
 				break;
 			else size++;
 		}
 
-		if ((size == (len-1)) && size) {
+		if (size && ((size == (len-1)) || (size == (len-2)))) {
+			if (*check == '!') {
+				bang = true;
+				check++;
+			}
 			if (isalpha(*check)) {
 				subLet = toupper(*check);
-				*check = 0;
+				*(check-(bang?1:0)) = 0;
 			}
 			sprintf(buf, "%.5d", atoi(buf));
 			if (subLet) {
 				check = buf+(strlen(buf));
-				*check = subLet;
-				*(check+1) = 0;
+				if (bang) {
+					*check++ = '!';
+				}
+				*check++ = subLet;
+				*check = 0;
 			}
 		}
 	}

Modified: trunk/src/modules/lexdict/zld/zld.cpp
===================================================================
--- trunk/src/modules/lexdict/zld/zld.cpp	2008-05-14 19:53:14 UTC (rev 2160)
+++ trunk/src/modules/lexdict/zld/zld.cpp	2008-05-14 20:01:29 UTC (rev 2161)
@@ -50,18 +50,37 @@
  */
 
 void zLD::strongsPad(char *buf) {
-	const char *check;
-	long size = 0;
+	char *check;
+	int size = 0;
 	int len = strlen(buf);
-	if ((len < 5) && (len > 0)) {
-		for (check = buf; *check; check++) {
+	char subLet = 0;
+	bool bang = false;
+	if ((len < 8) && (len > 0)) {
+		for (check = buf; *(check+1); check++) {
 			if (!isdigit(*check))
 				break;
 			else size++;
 		}
 
-		if ((size == len) && size) 
+		if (size && ((size == (len-1)) || (size == (len-2)))) {
+			if (*check == '!') {
+				bang = true;
+				check++;
+			}
+			if (isalpha(*check)) {
+				subLet = toupper(*check);
+				*(check-(bang?1:0)) = 0;
+			}
 			sprintf(buf, "%.5d", atoi(buf));
+			if (subLet) {
+				check = buf+(strlen(buf));
+				if (bang) {
+					*check++ = '!';
+				}
+				*check++ = subLet;
+				*check = 0;
+			}
+		}
 	}
 }
 




More information about the sword-cvs mailing list