[sword-svn] r2780 - in trunk: include src/mgr src/modules/lexdict src/modules/lexdict/rawld src/modules/lexdict/rawld4 src/modules/lexdict/zld

scribe at crosswire.org scribe at crosswire.org
Fri Feb 1 02:11:52 MST 2013


Author: scribe
Date: 2013-02-01 02:11:52 -0700 (Fri, 01 Feb 2013)
New Revision: 2780

Modified:
   trunk/include/rawld.h
   trunk/include/rawld4.h
   trunk/include/swld.h
   trunk/include/zld.h
   trunk/src/mgr/swmgr.cpp
   trunk/src/modules/lexdict/rawld/rawld.cpp
   trunk/src/modules/lexdict/rawld4/rawld4.cpp
   trunk/src/modules/lexdict/swld.cpp
   trunk/src/modules/lexdict/zld/zld.cpp
Log:
added ability to turn off logic to detect strongs numbers and add padding.
.conf entry:
StrongsPadding=false


Modified: trunk/include/rawld.h
===================================================================
--- trunk/include/rawld.h	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/include/rawld.h	2013-02-01 09:11:52 UTC (rev 2780)
@@ -39,7 +39,7 @@
 	RawLD(const char *ipath, const char *iname = 0, const char *idesc = 0,
 			SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
 			SWTextDirection dir = DIRECTION_LTR,
-			SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, bool caseSensitive = false);
+			SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, bool caseSensitive = false, bool strongsPadding = true);
 
 	virtual ~RawLD();
 	virtual SWBuf &getRawEntryBuf() const;

Modified: trunk/include/rawld4.h
===================================================================
--- trunk/include/rawld4.h	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/include/rawld4.h	2013-02-01 09:11:52 UTC (rev 2780)
@@ -39,7 +39,7 @@
 	RawLD4(const char *ipath, const char *iname = 0, const char *idesc = 0,
 			SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
 			SWTextDirection dir = DIRECTION_LTR,
-			SWTextMarkup markup = FMT_UNKNOWN, const char *ilang = 0, bool caseSensitive = false);
+			SWTextMarkup markup = FMT_UNKNOWN, const char *ilang = 0, bool caseSensitive = false, bool strongsPadding = true);
 
 	virtual ~RawLD4();
 	virtual SWBuf &getRawEntryBuf() const;

Modified: trunk/include/swld.h
===================================================================
--- trunk/include/swld.h	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/include/swld.h	2013-02-01 09:11:52 UTC (rev 2780)
@@ -36,13 +36,14 @@
 protected:
 	mutable char *entkeytxt;
 	static void strongsPad(char *buf);
+	bool strongsPadding;
 public:
 	/** Initializes data for instance of SWLD
 	*/
 	SWLD(const char *imodname = 0, const char *imoddesc = 0,
 			SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
 			SWTextDirection dir = DIRECTION_LTR,
-			SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+			SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, bool strongsPadding = true);
 	
 	virtual ~SWLD();
 	virtual SWKey *createKey() const;

Modified: trunk/include/zld.h
===================================================================
--- trunk/include/zld.h	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/include/zld.h	2013-02-01 09:11:52 UTC (rev 2780)
@@ -36,7 +36,7 @@
 public:
 
 
-	zLD(const char *ipath, const char *iname = 0, const char *idesc = 0, long blockCount = 200, SWCompress *icomp = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, bool caseSensitive = false);
+	zLD(const char *ipath, const char *iname = 0, const char *idesc = 0, long blockCount = 200, SWCompress *icomp = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, bool caseSensitive = false, bool strongsPadding = true);
 	virtual ~zLD();
 	virtual SWBuf &getRawEntryBuf() const;
 

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/src/mgr/swmgr.cpp	2013-02-01 09:11:52 UTC (rev 2780)
@@ -962,13 +962,15 @@
         int pos = 0;  //used for position of final / in AbsoluteDataPath, but also set to 1 for modules types that need to strip module name
 	if (!stricmp(driver, "RawLD")) {
 		bool caseSensitive = ((entry = section.find("CaseSensitiveKeys")) != section.end()) ? (*entry).second == "true": false;
-		newmod = new RawLD(datapath.c_str(), name, description.c_str(), 0, enc, direction, markup, lang.c_str(), caseSensitive);
+		bool strongsPadding = ((entry = section.find("StrongsPadding")) != section.end()) ? (*entry).second == "true": true;
+		newmod = new RawLD(datapath.c_str(), name, description.c_str(), 0, enc, direction, markup, lang.c_str(), caseSensitive, strongsPadding);
                 pos = 1;
         }
 
 	if (!stricmp(driver, "RawLD4")) {
 		bool caseSensitive = ((entry = section.find("CaseSensitiveKeys")) != section.end()) ? (*entry).second == "true": false;
-		newmod = new RawLD4(datapath.c_str(), name, description.c_str(), 0, enc, direction, markup, lang.c_str(), caseSensitive);
+		bool strongsPadding = ((entry = section.find("StrongsPadding")) != section.end()) ? (*entry).second == "true": true;
+		newmod = new RawLD4(datapath.c_str(), name, description.c_str(), 0, enc, direction, markup, lang.c_str(), caseSensitive, strongsPadding);
                 pos = 1;
         }
 
@@ -976,6 +978,7 @@
 		SWCompress *compress = 0;
 		int blockCount;
 		bool caseSensitive = ((entry = section.find("CaseSensitiveKeys")) != section.end()) ? (*entry).second == "true": false;
+		bool strongsPadding = ((entry = section.find("StrongsPadding")) != section.end()) ? (*entry).second == "true": true;
 		misc1 = ((entry = section.find("BlockCount")) != section.end()) ? (*entry).second : (SWBuf)"200";
 		blockCount = atoi(misc1.c_str());
 		blockCount = (blockCount) ? blockCount : 200;
@@ -990,7 +993,7 @@
 			compress = new LZSSCompress();
 
 		if (compress) {
-			newmod = new zLD(datapath.c_str(), name, description.c_str(), blockCount, compress, 0, enc, direction, markup, lang.c_str(), caseSensitive);
+			newmod = new zLD(datapath.c_str(), name, description.c_str(), blockCount, compress, 0, enc, direction, markup, lang.c_str(), caseSensitive, strongsPadding);
 		}
 		pos = 1;
 	}

Modified: trunk/src/modules/lexdict/rawld/rawld.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld/rawld.cpp	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/src/modules/lexdict/rawld/rawld.cpp	2013-02-01 09:11:52 UTC (rev 2780)
@@ -39,7 +39,7 @@
  *		idisp	- Display object to use for displaying
  */
 
-RawLD::RawLD(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive) : RawStr(ipath, -1, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang)
+RawLD::RawLD(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive, bool strongsPadding) : RawStr(ipath, -1, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang, strongsPadding)
 {
 }
 
@@ -77,7 +77,7 @@
 	char *buf = new char [ strlen(*key) + 6 ];
 	strcpy(buf, *key);
 
-	strongsPad(buf);
+	if (strongsPadding) strongsPad(buf);
 
 	if (!(retval = findOffset(buf, &start, &size, away))) {
 		readText(start, &size, &idxbuf, entryBuf);
@@ -176,7 +176,7 @@
 	char *buf = new char [ strlen(key) + 6 ];
 	strcpy(buf, key);
 
-	strongsPad(buf);
+	if (strongsPadding) strongsPad(buf);
 	
 	findOffset(buf, &start, &size, 0, &offset);
 

Modified: trunk/src/modules/lexdict/rawld4/rawld4.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld4/rawld4.cpp	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/src/modules/lexdict/rawld4/rawld4.cpp	2013-02-01 09:11:52 UTC (rev 2780)
@@ -39,7 +39,7 @@
  *		idisp	- Display object to use for displaying
  */
 
-RawLD4::RawLD4(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive) : RawStr4(ipath, -1, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang)
+RawLD4::RawLD4(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive, bool strongsPadding) : RawStr4(ipath, -1, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang, strongsPadding)
 {
 }
 

Modified: trunk/src/modules/lexdict/swld.cpp
===================================================================
--- trunk/src/modules/lexdict/swld.cpp	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/src/modules/lexdict/swld.cpp	2013-02-01 09:11:52 UTC (rev 2780)
@@ -35,7 +35,7 @@
  *	idisp	 - Display object to use for displaying
  */
 
-SWLD::SWLD(const char *imodname, const char *imoddesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : SWModule(imodname, imoddesc, idisp, (char *)"Lexicons / Dictionaries", enc, dir, mark, ilang)
+SWLD::SWLD(const char *imodname, const char *imoddesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool strongsPadding) : SWModule(imodname, imoddesc, idisp, (char *)"Lexicons / Dictionaries", enc, dir, mark, ilang), strongsPadding(strongsPadding)
 {
 	delete key;
 	key = createKey();
@@ -100,7 +100,7 @@
 	char *buf = new char [ strlen(key_str) + 6 ];
 	strcpy(buf, key_str);
 
-	strongsPad(buf);
+	if (strongsPadding) strongsPad(buf);
 	
 	bool retVal = !strcmp(buf, getKeyForEntry(getEntryForKey(buf)));
 	delete buf;

Modified: trunk/src/modules/lexdict/zld/zld.cpp
===================================================================
--- trunk/src/modules/lexdict/zld/zld.cpp	2013-01-29 00:06:01 UTC (rev 2779)
+++ trunk/src/modules/lexdict/zld/zld.cpp	2013-02-01 09:11:52 UTC (rev 2780)
@@ -38,7 +38,7 @@
  *		idisp	- Display object to use for displaying
  */
 
-zLD::zLD(const char *ipath, const char *iname, const char *idesc, long blockCount, SWCompress *icomp, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive) : zStr(ipath, -1, blockCount, icomp, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang) {
+zLD::zLD(const char *ipath, const char *iname, const char *idesc, long blockCount, SWCompress *icomp, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang, bool caseSensitive, bool strongsPadding) : zStr(ipath, -1, blockCount, icomp, caseSensitive), SWLD(iname, idesc, idisp, enc, dir, mark, ilang, strongsPadding) {
 
 }
 
@@ -75,7 +75,7 @@
 	char *buf = new char [ strlen(*key) + 6 ];
 	strcpy(buf, *key);
 
-	strongsPad(buf);
+	if (strongsPadding) strongsPad(buf);
 
 	entryBuf = "";
 	if (!(retval = findKeyIndex(buf, &index, away))) {
@@ -172,7 +172,7 @@
 	char *buf = new char [ strlen(key) + 6 ];
 	strcpy(buf, key);
 
-	strongsPad(buf);
+	if (strongsPadding) strongsPad(buf);
 	
 	findKeyIndex(buf, &offset);
 




More information about the sword-cvs mailing list