[sword-svn] r3455 - in trunk: examples/cmdline include src/keys

scribe at crosswire.org scribe at crosswire.org
Mon Apr 24 01:50:32 MST 2017


Author: scribe
Date: 2017-04-24 01:50:31 -0700 (Mon, 24 Apr 2017)
New Revision: 3455

Modified:
   trunk/examples/cmdline/search.cpp
   trunk/include/sysdata.h
   trunk/src/keys/treekeyidx.cpp
   trunk/src/keys/versetreekey.cpp
Log:
small changes for Android NDK compile
updated search example with better comments


Modified: trunk/examples/cmdline/search.cpp
===================================================================
--- trunk/examples/cmdline/search.cpp	2017-04-23 23:00:11 UTC (rev 3454)
+++ trunk/examples/cmdline/search.cpp	2017-04-24 08:50:31 UTC (rev 3455)
@@ -38,7 +38,7 @@
 
 // FROM swmodule.h
 	/*
-	 *			>=0 - regex
+	 *			>=0 - regex; (for backward compat, if > 0 then used as additional REGEX FLAGS)
 	 *			-1  - phrase
 	 *			-2  - multiword
 	 *			-3  - entryAttrib (eg. Word//Lemma./G1234/)	 (Lemma with dot means check components (Lemma.[1-9]) also)
@@ -46,7 +46,13 @@
 	 *			-5  - multilemma window; set 'flags' param to window size (NOT DONE)
 	 */
 
-char SEARCH_TYPE=-2;
+char SEARCH_TYPE=0;
+int flags = 0
+// for case insensitivity
+| REG_ICASE
+// for use with entryAttrib search type to match whole entry to value, e.g., G1234 and not G12345
+//| SEARCHFLAG_MATCHWHOLEENTRY
+;
 
 char printed = 0;
 void percentUpdate(char percent, void *userData) {
@@ -110,13 +116,13 @@
 
 	std::cerr << "[0=================================50===============================100]\n ";
 	char lineLen = 70;
-	listkey = target->search(searchTerm.c_str(), SEARCH_TYPE, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, scope, 0, &percentUpdate, &lineLen);
+	listkey = target->search(searchTerm.c_str(), SEARCH_TYPE, flags, scope, 0, &percentUpdate, &lineLen);
 	std::cerr << std::endl;
 	if (argc > 4) {			// example: if a second search term is supplied, search again for a second search term, limiting to previous results
 		scope = &listkey;
 		printed = 0;
 		std::cerr << " ";
-		listkey = target->search(argv[4], SEARCH_TYPE, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, scope, 0, &percentUpdate, &lineLen);
+		listkey = target->search(argv[4], SEARCH_TYPE, flags, scope, 0, &percentUpdate, &lineLen);
 		std::cerr << std::endl;
 	}
 // we don't want to sort by verse if we've been given scores

Modified: trunk/include/sysdata.h
===================================================================
--- trunk/include/sysdata.h	2017-04-23 23:00:11 UTC (rev 3454)
+++ trunk/include/sysdata.h	2017-04-24 08:50:31 UTC (rev 3455)
@@ -40,7 +40,8 @@
 typedef signed int __s32;
 typedef unsigned int __u32;
 
-#ifdef __GNUC__
+#ifdef OS_ANDROID
+#elif defined(__GNUC__)
 __extension__ typedef __signed__ long long __s64;
 __extension__ typedef unsigned long long __u64;
 #elif defined(__BORLANDC__)

Modified: trunk/src/keys/treekeyidx.cpp
===================================================================
--- trunk/src/keys/treekeyidx.cpp	2017-04-23 23:00:11 UTC (rev 3454)
+++ trunk/src/keys/treekeyidx.cpp	2017-04-24 08:50:31 UTC (rev 3455)
@@ -33,6 +33,7 @@
 
 SWORD_NAMESPACE_START
 
+
 static const char *classes[] = {"TreeKeyIdx", "TreeKey", "SWKey", "SWObject", 0};
 SWClass TreeKeyIdx::classdef(classes);
 
@@ -305,7 +306,6 @@
 	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
-
 	TreeKeyIdx newTree(path);
 	TreeKeyIdx::TreeNode root;
 	stdstr(&(root.name), "");
@@ -588,7 +588,7 @@
 void TreeKeyIdx::increment(int steps) {
 	error = getTreeNodeFromIdxOffset(currentNode.offset + (4*steps), &currentNode);
 	if (error) {
-//		SWLog::getSystemLog()->logError("error: %d", error);
+		SWLog::getSystemLog(); // strange fix for android // ->logError("error: %d", error);
 	}
 	positionChanged();
 
@@ -612,7 +612,6 @@
 }
 
 
-
 const char *TreeKeyIdx::getText() const {
 	TreeNode parent;
 	static SWBuf fullPath;
@@ -656,6 +655,7 @@
 }
 
 
+
 TreeKeyIdx::TreeNode::~TreeNode() {
 	if (name)
 		delete [] name;

Modified: trunk/src/keys/versetreekey.cpp
===================================================================
--- trunk/src/keys/versetreekey.cpp	2017-04-23 23:00:11 UTC (rev 3454)
+++ trunk/src/keys/versetreekey.cpp	2017-04-24 08:50:31 UTC (rev 3455)
@@ -24,6 +24,7 @@
 
 #include <versetreekey.h>
 #include <ctype.h>
+#include <swlog.h>
 
 SWORD_NAMESPACE_START
 
@@ -92,6 +93,7 @@
 {
 	int bookno = VerseKey::getBookFromAbbrev(iabbr);
 	if (bookno < 0) {
+		SWLog::getSystemLog();  // TODO fix for odd android bug
 /*
 		vector<struct sbook>::iterator it = find(books, iabbr);
 		if (it == books.end()) {




More information about the sword-cvs mailing list