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

scribe at crosswire.org scribe at crosswire.org
Mon Oct 12 10:34:17 MST 2009


Author: scribe
Date: 2009-10-12 10:34:17 -0700 (Mon, 12 Oct 2009)
New Revision: 2460

Added:
   trunk/bindings/java-jni/
   trunk/bindings/java-jni/Makefile
   trunk/bindings/java-jni/jni/
   trunk/bindings/java-jni/jni/Android.mk
   trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h
   trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h
   trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h
   trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
   trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h
   trunk/bindings/java-jni/jni/swordstub.cpp
   trunk/bindings/java-jni/jni/webmgr.hpp
   trunk/bindings/java-jni/src/
   trunk/bindings/java-jni/src/org/
   trunk/bindings/java-jni/src/org/crosswire/
   trunk/bindings/java-jni/src/org/crosswire/android/
   trunk/bindings/java-jni/src/org/crosswire/android/sword/
   trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java
   trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
Modified:
   trunk/ChangeLog
   trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp
Log:
	Added bindings/java-jni for Android development.



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-10-12 17:11:29 UTC (rev 2459)
+++ trunk/ChangeLog	2009-10-12 17:34:17 UTC (rev 2460)
@@ -6,6 +6,7 @@
 		by Nic Carter <niccarter at mac.com>
 	Added initial Android ifdefs to get things compiling
 		under the Android NDK.
+	Added bindings/java-jni for Android development.
 
 09-Aug-2009	Troy A. Griffitts <scribe at crosswire.org>
 	Added checks for Hebrew and Arabic when stripping

Modified: trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp
===================================================================
--- trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp	2009-10-12 17:11:29 UTC (rev 2459)
+++ trunk/bindings/corba/omniorbcpp/swordorb-impl.cpp	2009-10-12 17:34:17 UTC (rev 2460)
@@ -47,7 +47,7 @@
 	delegate->terminateSearch = true;
 }
 
-swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb::SearchType srchType, ::CORBA::Long flags, const char* scope){
+swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb::SearchType srchType, ::CORBA::Long flags, const char* scope) {
 	int stype = 2;
 	sword::ListKey lscope;
 	if (srchType == swordorb::REGEX) stype = 0;

Added: trunk/bindings/java-jni/Makefile
===================================================================
--- trunk/bindings/java-jni/Makefile	                        (rev 0)
+++ trunk/bindings/java-jni/Makefile	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,12 @@
+all:
+	mkdir -p classes
+	javac -d classes src/org/crosswire/android/sword/*.java
+	javah -d jni -classpath classes -jni org.crosswire.android.sword.SWMgr
+	javah -d jni -classpath classes -jni org.crosswire.android.sword.SWModule
+	javap -s -classpath classes/ org.crosswire.android.sword.SWMgr > SWMgr.txt
+	javap -s -classpath classes/ org.crosswire.android.sword.SWMgr.ModInfo > ModInfo.txt
+	javap -s -classpath classes/ org.crosswire.android.sword.SWModule > SWModule.txt
+	javap -s -classpath classes/ org.crosswire.android.sword.SWModule.SearchHit > SearchHit.txt
+	cp src/org/crosswire/android/sword/*.java /home/scribe/workspace/bishop/src/org/crosswire/android/sword/
+
+

Added: trunk/bindings/java-jni/jni/Android.mk
===================================================================
--- trunk/bindings/java-jni/jni/Android.mk	                        (rev 0)
+++ trunk/bindings/java-jni/jni/Android.mk	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,203 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# the purpose of this sample is to demonstrate how one can
+# generate two distinct shared libraries and have them both
+# uploaded in
+#
+
+
+LOCAL_PATH:= $(call my-dir)
+
+# first lib, which will be built statically
+#
+include $(CLEAR_VARS)
+
+STLPORT_BASE	:= $(NDK_WRAPPERS_BASE)/stlport
+
+LOCAL_MODULE    := libswordcore
+LOCAL_C_INCLUDES := ../sword/include
+LOCAL_CFLAGS	+= -I$(STLPORT_BASE)/stlport \
+		   -D__NEW__ \
+		   -D__SGI_STL_INTERNAL_PAIR_H \
+		   -DANDROID \
+		   -DOS_ANDROID
+LOCAL_SRC_FILES := ../../../../../sword/src/modules/comments/zcom/zcom.cpp \
+../../../../../sword/src/modules/comments/rawfiles/rawfiles.cpp \
+../../../../../sword/src/modules/comments/rawcom4/rawcom4.cpp \
+../../../../../sword/src/modules/comments/rawcom/rawcom.cpp \
+../../../../../sword/src/modules/comments/swcom.cpp \
+../../../../../sword/src/modules/comments/hrefcom/hrefcom.cpp \
+../../../../../sword/src/modules/swmodule.cpp \
+../../../../../sword/src/modules/tests/echomod.cpp \
+../../../../../sword/src/modules/genbook/swgenbook.cpp \
+../../../../../sword/src/modules/genbook/rawgenbook/rawgenbook.cpp \
+../../../../../sword/src/modules/lexdict/swld.cpp \
+../../../../../sword/src/modules/lexdict/rawld4/rawld4.cpp \
+../../../../../sword/src/modules/lexdict/zld/zld.cpp \
+../../../../../sword/src/modules/lexdict/rawld/rawld.cpp \
+../../../../../sword/src/modules/texts/rawtext/rawtext.cpp \
+../../../../../sword/src/modules/texts/rawtext4/rawtext4.cpp \
+../../../../../sword/src/modules/texts/swtext.cpp \
+../../../../../sword/src/modules/texts/ztext/ztext.cpp \
+../../../../../sword/src/modules/common/rawstr4.cpp \
+../../../../../sword/src/modules/common/lzsscomprs.cpp \
+../../../../../sword/src/modules/common/zipcomprs.cpp \
+../../../../../sword/src/modules/common/rawverse4.cpp \
+../../../../../sword/src/modules/common/swcipher.cpp \
+../../../../../sword/src/modules/common/swcomprs.cpp \
+../../../../../sword/src/modules/common/rawverse.cpp \
+../../../../../sword/src/modules/common/sapphire.cpp \
+../../../../../sword/src/modules/common/zstr.cpp \
+../../../../../sword/src/modules/common/entriesblk.cpp \
+../../../../../sword/src/modules/common/zverse.cpp \
+../../../../../sword/src/modules/common/rawstr.cpp \
+../../../../../sword/src/modules/filters/gbfwordjs.cpp \
+../../../../../sword/src/modules/filters/utf8latin1.cpp \
+../../../../../sword/src/modules/filters/utf8greekaccents.cpp \
+../../../../../sword/src/modules/filters/utf16utf8.cpp \
+../../../../../sword/src/modules/filters/gbfwebif.cpp \
+../../../../../sword/src/modules/filters/plainfootnotes.cpp \
+../../../../../sword/src/modules/filters/utf8transliterator.cpp \
+../../../../../sword/src/modules/filters/gbfstrongs.cpp \
+../../../../../sword/src/modules/filters/osisplain.cpp \
+../../../../../sword/src/modules/filters/thmlhtmlhref.cpp \
+../../../../../sword/src/modules/filters/thmlgbf.cpp \
+../../../../../sword/src/modules/filters/utf8utf16.cpp \
+../../../../../sword/src/modules/filters/utf8cantillation.cpp \
+../../../../../sword/src/modules/filters/utf8arshaping.cpp \
+../../../../../sword/src/modules/filters/cipherfil.cpp \
+../../../../../sword/src/modules/filters/thmlheadings.cpp \
+../../../../../sword/src/modules/filters/thmlscripref.cpp \
+../../../../../sword/src/modules/filters/latin1utf8.cpp \
+../../../../../sword/src/modules/filters/gbfhtml.cpp \
+../../../../../sword/src/modules/filters/thmlosis.cpp \
+../../../../../sword/src/modules/filters/utf8nfkd.cpp \
+../../../../../sword/src/modules/filters/thmlstrongs.cpp \
+../../../../../sword/src/modules/filters/osisvariants.cpp \
+../../../../../sword/src/modules/filters/thmlmorph.cpp \
+../../../../../sword/src/modules/filters/gbfplain.cpp \
+../../../../../sword/src/modules/filters/gbfhtmlhref.cpp \
+../../../../../sword/src/modules/filters/utf8html.cpp \
+../../../../../sword/src/modules/filters/utf8nfc.cpp \
+../../../../../sword/src/modules/filters/rtfhtml.cpp \
+../../../../../sword/src/modules/filters/gbfredletterwords.cpp \
+../../../../../sword/src/modules/filters/latin1utf16.cpp \
+../../../../../sword/src/modules/filters/osisscripref.cpp \
+../../../../../sword/src/modules/filters/thmlhtml.cpp \
+../../../../../sword/src/modules/filters/gbfthml.cpp \
+../../../../../sword/src/modules/filters/teihtmlhref.cpp \
+../../../../../sword/src/modules/filters/gbfrtf.cpp \
+../../../../../sword/src/modules/filters/gbfosis.cpp \
+../../../../../sword/src/modules/filters/teirtf.cpp \
+../../../../../sword/src/modules/filters/thmlwordjs.cpp \
+../../../../../sword/src/modules/filters/papyriplain.cpp \
+../../../../../sword/src/modules/filters/osisfootnotes.cpp \
+../../../../../sword/src/modules/filters/osiswordjs.cpp \
+../../../../../sword/src/modules/filters/osismorph.cpp \
+../../../../../sword/src/modules/filters/osislemma.cpp \
+../../../../../sword/src/modules/filters/osisredletterwords.cpp \
+../../../../../sword/src/modules/filters/osisrtf.cpp \
+../../../../../sword/src/modules/filters/gbfheadings.cpp \
+../../../../../sword/src/modules/filters/osisruby.cpp \
+../../../../../sword/src/modules/filters/osishtmlhref.cpp \
+../../../../../sword/src/modules/filters/utf8bidireorder.cpp \
+../../../../../sword/src/modules/filters/thmlrtf.cpp \
+../../../../../sword/src/modules/filters/swoptfilter.cpp \
+../../../../../sword/src/modules/filters/utf8arabicpoints.cpp \
+../../../../../sword/src/modules/filters/osisstrongs.cpp \
+../../../../../sword/src/modules/filters/osisheadings.cpp \
+../../../../../sword/src/modules/filters/unicodertf.cpp \
+../../../../../sword/src/modules/filters/gbffootnotes.cpp \
+../../../../../sword/src/modules/filters/greeklexattribs.cpp \
+../../../../../sword/src/modules/filters/osiswebif.cpp \
+../../../../../sword/src/modules/filters/thmlfootnotes.cpp \
+../../../../../sword/src/modules/filters/thmlplain.cpp \
+../../../../../sword/src/modules/filters/osisosis.cpp \
+../../../../../sword/src/modules/filters/utf8hebrewpoints.cpp \
+../../../../../sword/src/modules/filters/osismorphsegmentation.cpp \
+../../../../../sword/src/modules/filters/thmlwebif.cpp \
+../../../../../sword/src/modules/filters/thmlvariants.cpp \
+../../../../../sword/src/modules/filters/plainhtml.cpp \
+../../../../../sword/src/modules/filters/thmllemma.cpp \
+../../../../../sword/src/modules/filters/gbfmorph.cpp \
+../../../../../sword/src/modules/filters/teiplain.cpp \
+../../../../../sword/src/modules/filters/swbasicfilter.cpp \
+../../../../../sword/src/mgr/stringmgr.cpp \
+../../../../../sword/src/mgr/swmgr.cpp \
+../../../../../sword/src/mgr/swsearchable.cpp \
+../../../../../sword/src/mgr/localemgr.cpp \
+../../../../../sword/src/mgr/swconfig.cpp \
+../../../../../sword/src/mgr/markupfiltmgr.cpp \
+../../../../../sword/src/mgr/encfiltmgr.cpp \
+../../../../../sword/src/mgr/swfiltermgr.cpp \
+../../../../../sword/src/mgr/swcacher.cpp \
+../../../../../sword/src/mgr/installmgr.cpp \
+../../../../../sword/src/mgr/swlocale.cpp \
+../../../../../sword/src/mgr/filemgr.cpp \
+../../../../../sword/src/mgr/versemgr.cpp \
+../../../../../sword/src/mgr/ftptrans.cpp \
+../../../../../sword/src/utilfuns/swobject.cpp \
+../../../../../sword/src/utilfuns/roman.cpp \
+../../../../../sword/src/utilfuns/swbuf.cpp \
+../../../../../sword/src/utilfuns/utilstr.cpp \
+../../../../../sword/src/utilfuns/url.cpp \
+../../../../../sword/src/utilfuns/swversion.cpp \
+../../../../../sword/src/utilfuns/utilxml.cpp \
+../../../../../sword/src/utilfuns/swunicod.cpp \
+../../../../../sword/src/utilfuns/regex.c \
+../../../../../sword/src/keys/swkey.cpp \
+../../../../../sword/src/keys/versetreekey.cpp \
+../../../../../sword/src/keys/treekeyidx.cpp \
+../../../../../sword/src/keys/versekey.cpp \
+../../../../../sword/src/keys/strkey.cpp \
+../../../../../sword/src/keys/treekey.cpp \
+../../../../../sword/src/keys/listkey.cpp \
+../../../../../sword/src/frontend/swdisp.cpp \
+../../../../../sword/src/frontend/swlog.cpp
+
+#../../../../../sword/src/mgr/ftplibftpt.cpp \
+#../../../../../sword/src/mgr/curlftpt.cpp \
+#../../../../../sword/src/mgr/curlhttpt.cpp \
+#../../../../../sword/src/utilfuns/win32/dirent.cpp \
+#../../../../../sword/src/frontend/framework/femain.cpp \
+#../../../../../sword/src/frontend/im/nullim.cpp \
+#../../../../../sword/src/frontend/im/swinputmeth.cpp \
+#../../../../../sword/src/frontend/im/hebrewmcim.cpp \
+
+include $(BUILD_STATIC_LIBRARY)
+
+# second lib, which will depend on and include the first one
+#
+include $(CLEAR_VARS)
+
+STLPORT_BASE	:= $(NDK_WRAPPERS_BASE)/stlport
+
+LOCAL_MODULE    := libsword
+LOCAL_C_INCLUDES := ../sword/include
+LOCAL_CFLAGS	+= -I$(STLPORT_BASE)/stlport \
+		   -D__NEW__ \
+		   -D__SGI_STL_INTERNAL_PAIR_H \
+		   -DANDROID \
+		   -DOS_ANDROID
+
+LOCAL_LDLIBS	+= -L$(STLPORT_BASE)/build/lib/obj/arm-linux-gcc/so \
+		   -lstlport -lz
+
+LOCAL_SRC_FILES := swordstub.cpp
+
+LOCAL_STATIC_LIBRARIES := libswordcore
+
+include $(BUILD_SHARED_LIBRARY)

Added: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h	                        (rev 0)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,133 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_crosswire_android_sword_SWMgr */
+
+#ifndef _Included_org_crosswire_android_sword_SWMgr
+#define _Included_org_crosswire_android_sword_SWMgr
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    version
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getModInfoList
+ * Signature: ()[Lorg/crosswire/android/sword/SWMgr/ModInfo;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getModuleByName
+ * Signature: (Ljava/lang/String;)Lorg/crosswire/android/sword/SWModule;
+ */
+JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_SWMgr_getModuleByName
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getPrefixPath
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getPrefixPath
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getConfigPath
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getConfigPath
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setGlobalOption
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setGlobalOption
+  (JNIEnv *, jobject, jstring, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOption
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOptionTip
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionTip
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    filterText
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_filterText
+  (JNIEnv *, jobject, jstring, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOptions
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptions
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOptionValues
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionValues
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setCipherKey
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setCipherKey
+  (JNIEnv *, jobject, jstring, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setJavascript
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setJavascript
+  (JNIEnv *, jobject, jboolean);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getAvailableLocales
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailableLocales
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setDefaultLocale
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setDefaultLocale
+  (JNIEnv *, jobject, jstring);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h	                        (rev 0)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,13 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_crosswire_android_sword_SWMgr_ModInfo */
+
+#ifndef _Included_org_crosswire_android_sword_SWMgr_ModInfo
+#define _Included_org_crosswire_android_sword_SWMgr_ModInfo
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h	                        (rev 0)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,13 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_crosswire_android_sword_SWMgr_SearchHit */
+
+#ifndef _Included_org_crosswire_android_sword_SWMgr_SearchHit
+#define _Included_org_crosswire_android_sword_SWMgr_SearchHit
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h	                        (rev 0)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,181 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_crosswire_android_sword_SWModule */
+
+#ifndef _Included_org_crosswire_android_sword_SWModule
+#define _Included_org_crosswire_android_sword_SWModule
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    terminateSearch
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    search
+ * Signature: (Ljava/lang/String;IJLjava/lang/String;)[Lorg/crosswire/android/sword/SWModule/SearchHit;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_search
+  (JNIEnv *, jobject, jstring, jint, jlong, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    error
+ * Signature: ()C
+ */
+JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getEntrySize
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getEntryAttribute
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getEntryAttribute
+  (JNIEnv *, jobject, jstring, jstring, jstring, jboolean);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    parseKeyList
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_parseKeyList
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    setKeyText
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setKeyText
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getKeyText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    hasKeyChildren
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getKeyChildren
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyChildren
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getKeyParent
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    previous
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    next
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    begin
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_begin
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getStripText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getStripText
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getRenderText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getRawEntry
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRawEntry
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    setRawEntry
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setRawEntry
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getConfigEntry
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getConfigEntry
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    deleteSearchFramework
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_deleteSearchFramework
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    hasSearchFramework
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasSearchFramework
+  (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h	                        (rev 0)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,13 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_crosswire_android_sword_SWModule_SearchHit */
+
+#ifndef _Included_org_crosswire_android_sword_SWModule_SearchHit
+#define _Included_org_crosswire_android_sword_SWModule_SearchHit
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: trunk/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- trunk/bindings/java-jni/jni/swordstub.cpp	                        (rev 0)
+++ trunk/bindings/java-jni/jni/swordstub.cpp	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,446 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+//#include "first.h"
+#include <iostream>
+
+#include <jni.h>
+
+#include <utilstr.h>
+#include <swversion.h>
+#include <swmgr.h>
+#include <swmodule.h>
+#include <versekey.h>
+
+#include "webmgr.hpp"
+#include "org_crosswire_android_sword_SWMgr.h"
+#include "org_crosswire_android_sword_SWModule.h"
+
+
+using std::cerr;
+
+using namespace sword;
+
+WebMgr *mgr;
+
+static void init() {
+	if (!mgr) mgr = new WebMgr("/sdcard/sword");
+}
+
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
+  (JNIEnv *env, jobject me) {
+	SWVersion v;
+	return env->NewStringUTF(v.currentVersion);
+}
+
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getPrefixPath
+  (JNIEnv *env, jobject me) {
+	init();
+	return env->NewStringUTF(mgr->prefixPath);
+}
+
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getConfigPath
+  (JNIEnv *env, jobject me) {
+	init();
+	return env->NewStringUTF(mgr->configPath);
+}
+
+
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
+  (JNIEnv *env, jobject) {
+	init();
+
+	sword::SWModule *module = 0;
+
+	int size = 0;
+	for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); it++) {
+		if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey"))))
+			size++;
+	}
+
+	jclass clazzModInfo = env->FindClass("org/crosswire/android/sword/SWMgr$ModInfo");
+	jobjectArray ret = (jobjectArray) env->NewObjectArray(size, clazzModInfo, NULL);
+
+	int i = 0;
+	for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); it++) {
+		module = it->second;
+		if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) {
+			SWBuf type = module->Type();
+			SWBuf cat = module->getConfigEntry("Category");
+			if (cat.length() > 0) type = cat;
+			jfieldID fieldID;
+			jobject modInfo = env->AllocObject(clazzModInfo); 
+
+			fieldID = env->GetFieldID(clazzModInfo, "name", "Ljava/lang/String;"); env->SetObjectField(modInfo, fieldID, env->NewStringUTF(module->Name()));
+			fieldID = env->GetFieldID(clazzModInfo, "description", "Ljava/lang/String;"); env->SetObjectField(modInfo, fieldID, env->NewStringUTF(module->Description()));
+			fieldID = env->GetFieldID(clazzModInfo, "category", "Ljava/lang/String;"); env->SetObjectField(modInfo, fieldID, env->NewStringUTF(type.c_str()));
+			fieldID = env->GetFieldID(clazzModInfo, "language", "Ljava/lang/String;"); env->SetObjectField(modInfo, fieldID, env->NewStringUTF(module->Lang()));
+			env->SetObjectArrayElement(ret, i++, modInfo);
+		}
+	}
+	return ret;
+}
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getModuleByName
+ * Signature: (Ljava/lang/String;)Lorg/crosswire/android/sword/SWModule;
+ */
+JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_SWMgr_getModuleByName
+  (JNIEnv *env, jobject me, jstring modNameJS) {
+	jobject retVal = 0;
+
+     const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+	sword::SWModule *module = mgr->getModule(modName);
+     env->ReleaseStringUTFChars(modNameJS, modName);
+
+	if (module) {
+		SWBuf type = module->Type();
+		SWBuf cat = module->getConfigEntry("Category");
+		if (cat.length() > 0) type = cat;
+		jfieldID fieldID;
+		jclass clazzSWModule = env->FindClass("org/crosswire/android/sword/SWModule");
+		retVal = env->AllocObject(clazzSWModule); 
+		fieldID = env->GetFieldID(clazzSWModule, "name", "Ljava/lang/String;"); env->SetObjectField(retVal, fieldID, env->NewStringUTF(module->Name()));
+		fieldID = env->GetFieldID(clazzSWModule, "description", "Ljava/lang/String;"); env->SetObjectField(retVal, fieldID, env->NewStringUTF(module->Description()));
+		fieldID = env->GetFieldID(clazzSWModule, "category", "Ljava/lang/String;"); env->SetObjectField(retVal, fieldID, env->NewStringUTF(type.c_str()));
+	}
+	return retVal;
+}
+
+#if 0
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setGlobalOption
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setGlobalOption
+  (JNIEnv *, jobject, jstring, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOption
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOptionTip
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionTip
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    filterText
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_filterText
+  (JNIEnv *, jobject, jstring, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOptions
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptions
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getGlobalOptionValues
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionValues
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setCipherKey
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setCipherKey
+  (JNIEnv *, jobject, jstring, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setJavascript
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setJavascript
+  (JNIEnv *, jobject, jboolean);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    getAvailableLocales
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailableLocales
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWMgr
+ * Method:    setDefaultLocale
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setDefaultLocale
+  (JNIEnv *, jobject, jstring);
+
+#endif
+
+
+
+
+
+
+// SWModule methods ----------------------------------------------------------------------------------
+
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    setKeyText
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setKeyText
+  (JNIEnv *env, jobject me, jstring keyTextJS) {
+
+	jclass clazzSWModule = env->FindClass("org/crosswire/android/sword/SWModule");
+	jfieldID fieldID = env->GetFieldID(clazzSWModule, "name", "Ljava/lang/String;");
+	jstring modNameJS = (jstring)env->GetObjectField(me, fieldID);
+     const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+	sword::SWModule *module = mgr->getModule(modName);
+     env->ReleaseStringUTFChars(modNameJS, modName);
+
+	if (module) {
+		const char *keyText = env->GetStringUTFChars(keyTextJS, NULL);
+		sword::SWKey *key = module->getKey();
+		sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
+		if (vkey && (*keyText=='+' ||*keyText=='-')) {
+			if (!stricmp(keyText+1, "book")) {
+				vkey->setBook(vkey->getBook() + ((*keyText=='+')?1:-1));
+				env->ReleaseStringUTFChars(keyTextJS, keyText);
+				return;
+			}
+			else if (!stricmp(keyText+1, "chapter")) {
+				vkey->setChapter(vkey->getChapter() + ((*keyText=='+')?1:-1));
+				env->ReleaseStringUTFChars(keyTextJS, keyText);
+				return;
+			}
+		}
+
+		module->KeyText(keyText);
+		env->ReleaseStringUTFChars(keyTextJS, keyText);
+	}
+}
+
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getKeyText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
+  (JNIEnv *env, jobject me) {
+	jclass clazzSWModule = env->FindClass("org/crosswire/android/sword/SWModule");
+	jfieldID fieldID = env->GetFieldID(clazzSWModule, "name", "Ljava/lang/String;");
+	jstring modNameJS = (jstring)env->GetObjectField(me, fieldID);
+     const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+	sword::SWModule *module = mgr->getModule(modName);
+     env->ReleaseStringUTFChars(modNameJS, modName);
+
+	jstring retVal = 0;
+	if (module) {
+		retVal = env->NewStringUTF(module->getKeyText());
+	}
+	return retVal;
+}
+
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getRenderText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
+  (JNIEnv *env, jobject me) {
+
+	jclass clazzSWModule = env->FindClass("org/crosswire/android/sword/SWModule");
+	jfieldID fieldID = env->GetFieldID(clazzSWModule, "name", "Ljava/lang/String;");
+	jstring modNameJS = (jstring)env->GetObjectField(me, fieldID);
+     const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+	sword::SWModule *module = mgr->getModule(modName);
+     env->ReleaseStringUTFChars(modNameJS, modName);
+
+	jstring retVal = 0;
+	if (module) {
+		retVal = env->NewStringUTF(module->RenderText());
+	}
+	return retVal;
+}
+
+
+
+
+#if 0
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    terminateSearch
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    search
+ * Signature: (Ljava/lang/String;IJLjava/lang/String;)[Lorg/crosswire/android/sword/SWModule/SearchHit;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_search
+  (JNIEnv *, jobject, jstring, jint, jlong, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    error
+ * Signature: ()C
+ */
+JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getEntrySize
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getEntryAttribute
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getEntryAttribute
+  (JNIEnv *, jobject, jstring, jstring, jstring, jboolean);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    parseKeyList
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_parseKeyList
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    hasKeyChildren
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getKeyChildren
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyChildren
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getKeyParent
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    previous
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    next
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    begin
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_begin
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getStripText
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getStripText
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getRawEntry
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRawEntry
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    setRawEntry
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setRawEntry
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    getConfigEntry
+ * Signature: (Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getConfigEntry
+  (JNIEnv *, jobject, jstring);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    deleteSearchFramework
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_deleteSearchFramework
+  (JNIEnv *, jobject);
+
+/*
+ * Class:     org_crosswire_android_sword_SWModule
+ * Method:    hasSearchFramework
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasSearchFramework
+  (JNIEnv *, jobject);
+
+#endif

Added: trunk/bindings/java-jni/jni/webmgr.hpp
===================================================================
--- trunk/bindings/java-jni/jni/webmgr.hpp	                        (rev 0)
+++ trunk/bindings/java-jni/jni/webmgr.hpp	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef WEBMGR_HPP
+#define WEBMGR_HPP
+
+#include <swmgr.h>
+#include <swmodule.h>
+#include <swfilter.h>
+#include <markupfiltmgr.h>
+#include <osiswordjs.h>
+#include <thmlwordjs.h>
+#include <gbfwordjs.h>
+
+using namespace sword;
+
+class WebMgr : public SWMgr {
+	OSISWordJS *osisWordJS;
+	ThMLWordJS *thmlWordJS;
+	GBFWordJS *gbfWordJS;
+	SWModule *defaultGreekLex;
+	SWModule *defaultHebLex;
+	SWModule *defaultGreekParse;
+	SWModule *defaultHebParse;
+
+public:
+//	WebMgr(SWConfig *sysConf) : SWMgr(0, sysConf, false, new MarkupFilterMgr(FMT_WEBIF)) {
+	WebMgr(const char *path) : SWMgr(path, false, new MarkupFilterMgr(FMT_WEBIF)) {
+		defaultGreekLex   = 0;
+		defaultHebLex     = 0;
+		defaultGreekParse = 0;
+		defaultHebParse   = 0;
+
+		osisWordJS = new OSISWordJS();
+		thmlWordJS = new ThMLWordJS();
+		gbfWordJS = new GBFWordJS();
+		Load();
+		osisWordJS->setDefaultModules(defaultGreekLex, defaultHebLex, defaultGreekParse, defaultHebParse);
+		thmlWordJS->setDefaultModules(defaultGreekLex, defaultHebLex, defaultGreekParse, defaultHebParse);
+		gbfWordJS->setDefaultModules(defaultGreekLex, defaultHebLex, defaultGreekParse, defaultHebParse);
+		osisWordJS->setMgr(this);
+		thmlWordJS->setMgr(this);
+		gbfWordJS->setMgr(this);
+		setGlobalOption("Textual Variants", "Primary Reading");
+	}
+
+	~WebMgr() {
+		delete osisWordJS;
+		delete thmlWordJS;
+		delete gbfWordJS;
+	}
+
+
+	void AddGlobalOptions(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end) {
+
+		// ThML word stuff needs to process before strongs strip
+		if (module->Markup() == FMT_THML) {
+			module->AddOptionFilter(thmlWordJS);
+		}
+
+		if (module->Markup() == FMT_GBF) {
+			module->AddOptionFilter(gbfWordJS);
+		}
+
+		// add other module filters
+		SWMgr::AddGlobalOptions(module, section, start, end);
+
+		// add our special filters
+		if (module->getConfig().has("Feature", "GreekDef")) {
+			defaultGreekLex = module;
+		}
+		if (module->getConfig().has("Feature", "HebrewDef")) {
+			defaultHebLex = module;
+		}
+		if (module->getConfig().has("Feature", "GreekParse")) {
+			defaultGreekParse = module;
+		}
+		if (module->getConfig().has("Feature", "HebrewParse")) {
+			defaultHebParse = module;
+		}
+		if (module->getConfig().has("GlobalOptionFilter", "ThMLVariants")) {
+			OptionFilterMap::iterator it = optionFilters.find("ThMLVariants");
+			if (it != optionFilters.end()) {
+				module->AddOptionFilter((*it).second);	// add filter to module and option as a valid option
+			}
+		}
+
+		if (module->Markup() == FMT_OSIS) {
+			module->AddOptionFilter(osisWordJS);
+		}
+	}
+
+
+	void setJavascript(bool val) {
+		osisWordJS->setOptionValue((val)?"On":"Off");
+		thmlWordJS->setOptionValue((val)?"On":"Off");
+		gbfWordJS->setOptionValue((val)?"On":"Off");
+	}
+};
+
+#endif

Added: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java	                        (rev 0)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,31 @@
+package org.crosswire.android.sword;
+
+public class SWMgr {
+
+	public static class ModInfo {
+		public String name;
+		public String description;
+		public String category;
+		public String language;
+	}
+
+
+	public native String version();
+
+	public native ModInfo[]   getModInfoList();
+	public native SWModule    getModuleByName(String name);
+	public native String      getPrefixPath();
+	public native String      getConfigPath();
+	public native void        setGlobalOption(String option, String value);
+	public native String      getGlobalOption(String option);
+	public native String      getGlobalOptionTip(String option);
+	public native String      filterText(String filterName, String text);
+	public native String[]    getGlobalOptions();
+	public native String[]    getGlobalOptionValues(String option);
+	public native void        setCipherKey(String modName, String key);
+	public native void        setJavascript(boolean val);
+	public native String[]    getAvailableLocales();
+	public native void        setDefaultLocale(String name);
+}
+
+

Added: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java	                        (rev 0)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java	2009-10-12 17:34:17 UTC (rev 2460)
@@ -0,0 +1,56 @@
+package org.crosswire.android.sword;
+
+public class SWModule {
+
+	public final int SEARCHTYPE_REGEX     =  1;
+	public final int SEARCHTYPE_PHRASE    = -1;
+	public final int SEARCHTYPE_MULTIWORD = -2;
+	public final int SEARCHTYPE_ENTRYATTR = -3;
+	public final int SEARCHTYPE_LUCENE    = -4;
+
+	private String name;
+	private String description;
+	private String category;
+
+	private SWModule() {}	// don't allow allocation, instead use factory method SWMgr.getModuleByName to retrieve an instance
+
+	public static class SearchHit {
+		String modName;
+		String key;
+		long   score;
+	}
+
+	public native void          terminateSearch();
+	public native SearchHit[]   search(String istr, int searchType, long flags, String scope);
+	public native char          error();
+	public native long          getEntrySize();
+	public native String[]      getEntryAttribute(String level1, String level2, String level3, boolean filtered);
+	public native String[]      parseKeyList(String keyText);
+
+	// Special values handled for VerseKey modules: [+-][book|chapter]
+	//	(e.g.	"+chapter" will increment the VerseKey 1 chapter)
+	public native void          setKeyText(String key);
+
+	public native String        getKeyText();
+	public native boolean       hasKeyChildren();
+
+	// This method returns child nodes for a genbook,
+	// but has special handling if called on a VerseKey module:
+	//  [0..6] [testament, book, chapter, verse, chapterMax, verseMax, bookName]
+	public native String[]      getKeyChildren();
+
+	public native String        getKeyParent();
+	public String               getName()		{ return name; }
+	public String               getDescription()	{ return description; }
+	public String               getCategory()	{ return category; }
+	public native void          previous();
+	public native void          next();
+	public native void          begin();
+	public native String        getStripText();
+	public native String        getRenderText();
+	public native String        getRawEntry();
+	public native void          setRawEntry(String entryBuffer);
+	public native String        getConfigEntry(String key);
+	public native void          deleteSearchFramework();
+	public native boolean       hasSearchFramework();
+}




More information about the sword-cvs mailing list