[sword-svn] r3148 - in trunk/bindings: corba/omniorbcpp java-jni/jni java-jni/src/org/crosswire/android/sword

scribe at crosswire.org scribe at crosswire.org
Wed Mar 26 00:55:04 MST 2014


Author: scribe
Date: 2014-03-26 00:55:03 -0700 (Wed, 26 Mar 2014)
New Revision: 3148

Modified:
   trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp
   trunk/bindings/java-jni/jni/Android.mk
   trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
   trunk/bindings/java-jni/jni/swordstub.cpp
   trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
Log:
added new method getRenderHeader to bindings
Added new special VerseKey key children: OSISRef, BookAbbrev, ShortText

Modified: trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp
===================================================================
--- trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp	2014-03-26 07:54:35 UTC (rev 3147)
+++ trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp	2014-03-26 07:55:03 UTC (rev 3148)
@@ -242,7 +242,7 @@
 
 	sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
 	if (vkey) {
-		retVal->length(8);
+		retVal->length(10);
 		SWBuf num;
 		num.appendFormatted("%d", vkey->getTestament());
 		(*retVal)[0] = CORBA::string_dup(num.c_str());
@@ -263,6 +263,8 @@
 		(*retVal)[5] = CORBA::string_dup(num.c_str());
 		(*retVal)[6] = CORBA::string_dup(vkey->getBookName());
 		(*retVal)[7] = CORBA::string_dup(vkey->getOSISRef());
+		(*retVal)[8] = CORBA::string_dup(vkey->getShortText());
+		(*retVal)[9] = CORBA::string_dup(vkey->getBookAbbrev());
 	}
 	else {
 		TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);

Modified: trunk/bindings/java-jni/jni/Android.mk
===================================================================
--- trunk/bindings/java-jni/jni/Android.mk	2014-03-26 07:54:35 UTC (rev 3147)
+++ trunk/bindings/java-jni/jni/Android.mk	2014-03-26 07:55:03 UTC (rev 3148)
@@ -28,10 +28,13 @@
 LOCAL_MODULE    := libswordcore
 LOCAL_C_INCLUDES := ../sword/include ../sword/include/internal/regex
 LOCAL_CFLAGS	+= -D__unix__ \
+		   -fvisibility=hidden \
 		   -DSTDC_HEADERS \
 	 	   -Dunix \
 		   -D_FTPLIB_NO_COMPAT \
 		   -DANDROID \
+		   -DEXCLUDEBZIP2 \
+		   -DEXCLUDEXZ \
 		   -DOS_ANDROID
 LOCAL_SRC_FILES := ../../../src/modules/comments/zcom/zcom.cpp \
 ../../../src/modules/comments/rawfiles/rawfiles.cpp \
@@ -54,8 +57,6 @@
 ../../../src/modules/common/rawstr4.cpp \
 ../../../src/modules/common/lzsscomprs.cpp \
 ../../../src/modules/common/zipcomprs.cpp \
-../../../src/modules/common/bz2comprs.cpp \
-../../../src/modules/common/xzcomprs.cpp \
 ../../../src/modules/common/rawverse4.cpp \
 ../../../src/modules/common/swcipher.cpp \
 ../../../src/modules/common/swcomprs.cpp \
@@ -144,6 +145,7 @@
 ../../../src/modules/filters/scsuutf8.cpp \
 ../../../src/modules/filters/gbflatex.cpp \
 ../../../src/modules/filters/thmllatex.cpp \
+../../../src/modules/filters/teilatex.cpp \
 ../../../src/modules/filters/osislatex.cpp \
 ../../../src/mgr/stringmgr.cpp \
 ../../../src/mgr/swmgr.cpp \
@@ -181,6 +183,8 @@
 ../../../src/frontend/swlog.cpp \
 ../../../src/utilfuns/zlib/untgz.c
 
+#../../../src/modules/common/bz2comprs.cpp \
+#../../../src/modules/common/xzcomprs.cpp \
 #../../../../../sword/src/mgr/curlftpt.cpp \
 #../../../../../sword/src/mgr/curlhttpt.cpp \
 #../../../../../sword/src/utilfuns/win32/dirent.cpp \

Modified: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h	2014-03-26 07:54:35 UTC (rev 3147)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h	2014-03-26 07:55:03 UTC (rev 3148)
@@ -139,6 +139,14 @@
 
 /*
  * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getRenderHeader
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderHeader
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
  * Method:    getRenderText
  * Signature: ()Ljava/lang/String;
  */

Modified: trunk/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- trunk/bindings/java-jni/jni/swordstub.cpp	2014-03-26 07:54:35 UTC (rev 3147)
+++ trunk/bindings/java-jni/jni/swordstub.cpp	2014-03-26 07:55:03 UTC (rev 3148)
@@ -50,9 +50,10 @@
 
 using namespace sword;
 
-
+namespace {
 WebMgr *mgr = 0;
 InstallMgr *installMgr = 0;
+bool disclaimerConfirmed = false;
 
 class AndroidLogger : public SWLog {
 	vector<int> levelMapping;
@@ -96,21 +97,25 @@
 static void initInstall() {
 
 	if (!installMgr) {
+SWLog::getSystemLog()->logDebug("initInstall: installMgr is null");
 		SWBuf baseDir  = "/sdcard/sword/InstallMgr";
 		SWBuf confPath = baseDir + "/InstallMgr.conf";
 		// be sure we have at least some config file already out there
+SWLog::getSystemLog()->logDebug("initInstall: confPath: %s", confPath.c_str());
 		if (!FileMgr::existsFile(confPath.c_str())) {
+SWLog::getSystemLog()->logDebug("initInstall: file doesn't exist: %s", confPath.c_str());
 			FileMgr::createParent(confPath.c_str());
-			remove(confPath.c_str());
-
 			SWConfig config(confPath.c_str());
 			config["General"]["PassiveFTP"] = "true";
 			config.Save();
 		}
 		installMgr = new InstallMgr(baseDir);
+		if (disclaimerConfirmed) installMgr->setUserDisclaimerConfirmed(true);
+SWLog::getSystemLog()->logDebug("initInstall: instantiated InstallMgr with baseDir: %s", baseDir.c_str());
 	}
 }
 
+}
 
 
 JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
@@ -509,7 +514,9 @@
 		sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
 		if (vkey && (*keyText=='+' ||*keyText=='-')) {
 			if (!stricmp(keyText+1, "book")) {
-				vkey->setBook(vkey->getBook() + ((*keyText=='+')?1:-1));
+				int newBook = vkey->getBook() + ((*keyText=='+')?1:-1);
+SWLog::getSystemLog()->logDebug("setting book to %d", newBook);
+				vkey->setBook(newBook);
 				env->ReleaseStringUTFChars(keyTextJS, keyText);
 				return;
 			}
@@ -568,6 +575,26 @@
 
 /*
  * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getRenderHeader
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderHeader
+  (JNIEnv *env, jobject me) {
+
+	init();
+
+	SWModule *module = getModule(env, me);
+
+	jstring retVal = 0;
+	if (module) {
+		retVal = env->NewStringUTF(assureValidUTF8(((const char *)(module->getRenderHeader() ? module->getRenderHeader():""))));
+	}
+	return retVal;
+}
+
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
  * Method:    terminateSearch
  * Signature: ()V
  */
@@ -802,7 +829,7 @@
 
 		sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
 		if (vkey) {
-			ret = (jobjectArray) env->NewObjectArray(7, clazzString, NULL);
+			ret = (jobjectArray) env->NewObjectArray(10, clazzString, NULL);
 			SWBuf num;
 			num.appendFormatted("%d", vkey->getTestament());
 			env->SetObjectArrayElement(ret, 0, env->NewStringUTF(assureValidUTF8(num.c_str())));
@@ -822,6 +849,9 @@
 			num.appendFormatted("%d", vkey->getVerseMax());
 			env->SetObjectArrayElement(ret, 5, env->NewStringUTF(assureValidUTF8(num.c_str())));
 			env->SetObjectArrayElement(ret, 6, env->NewStringUTF(assureValidUTF8(vkey->getBookName())));
+			env->SetObjectArrayElement(ret, 7, env->NewStringUTF(assureValidUTF8(vkey->getOSISRef())));
+			env->SetObjectArrayElement(ret, 8, env->NewStringUTF(assureValidUTF8(vkey->getShortText())));
+			env->SetObjectArrayElement(ret, 9, env->NewStringUTF(assureValidUTF8(vkey->getBookAbbrev())));
 		}
 		else {
 			TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);
@@ -1271,6 +1301,7 @@
 	for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) {
 		count++;
 	}
+SWLog::getSystemLog()->logDebug("getRemoteSources: count: %d\n", count);
 	ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
 	count = 0;
 	for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) {
@@ -1475,6 +1506,7 @@
 
 	initInstall();
 
+	disclaimerConfirmed = true;
 	installMgr->setUserDisclaimerConfirmed(true);
 }
 

Modified: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java	2014-03-26 07:54:35 UTC (rev 3147)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java	2014-03-26 07:55:03 UTC (rev 3148)
@@ -78,6 +78,7 @@
 	public native void          next();
 	public native void          begin();
 	public native String        getStripText();
+	public native String        getRenderHeader();
 	public native String        getRenderText();
 	public native String        getRawEntry();
 	public native void          setRawEntry(String entryBuffer);




More information about the sword-cvs mailing list