[sword-svn] r3672 - in trunk: bindings bindings/cordova/cordova-plugin-crosswire-sword bindings/cordova/cordova-plugin-crosswire-sword/src/android bindings/cordova/cordova-plugin-crosswire-sword/src/ios bindings/cordova/cordova-plugin-crosswire-sword/www bindings/java-jni/jni bindings/java-jni/src/org/crosswire/android/sword include

scribe at crosswire.org scribe at crosswire.org
Sat Jul 6 15:34:35 MST 2019


Author: scribe
Date: 2019-07-06 15:34:35 -0700 (Sat, 06 Jul 2019)
New Revision: 3672

Modified:
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/package.json
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/plugin.xml
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift
   trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js
   trunk/bindings/flatapi.cpp
   trunk/bindings/java-jni/jni/swordstub.cpp
   trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
   trunk/include/flatapi.h
Log:
updated cordova, java, an swift plugin to support osisBookName

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/package.json
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/package.json	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/package.json	2019-07-06 22:34:35 UTC (rev 3672)
@@ -1,6 +1,6 @@
 {
   "name": "cordova-plugin-crosswire-sword",
-  "version": "0.1.4",
+  "version": "0.1.7",
   "description": "The SWORD Project Plugin",
   "cordova": {
     "id": "cordova-plugin-crosswire-sword",

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/plugin.xml
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/plugin.xml	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/plugin.xml	2019-07-06 22:34:35 UTC (rev 3672)
@@ -4,7 +4,7 @@
     xmlns:rim="http://www.blackberry.com/ns/widgets"
     xmlns:android="http://schemas.android.com/apk/res/android"
     id="cordova-plugin-crosswire-sword"
-    version="0.1.4">
+    version="0.1.7">
     <name>cordova-plugin-crosswire-sword</name>
     <description>The SWORD Project Plugin</description>
     <license>GNU 2.0</license>

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/android/SWORD.java	2019-07-06 22:34:35 UTC (rev 3672)
@@ -528,8 +528,14 @@
 			SWModule mod = mgr.getModuleByName(args.getString(0));
 			if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
 			JSONArray r = new JSONArray();
-			for (String b : getBookNames(mod)) {
-				r.put(b);
+			for (mod.begin(); mod.error() == 0; mod.setKeyText("+book")) {
+				String vkInfo[] = mod.getKeyChildren();
+				JSONObject bookInfo = new JSONObject();
+				bookInfo.put("name",   vkInfo[SWModule.VERSEKEY_BOOKNAME]);
+				bookInfo.put("abbrev", vkInfo[SWModule.VERSEKEY_BOOKABBREV]);
+				bookInfo.put("osisName",    vkInfo[SWModule.VERSEKEY_OSISBOOKNAME]);
+				bookInfo.put("chapterMax", Integer.parseInt(vkInfo[SWModule.VERSEKEY_CHAPTERMAX]));
+				r.put(bookInfo);
 			}
 			callbackContext.success(r);
 		}
@@ -636,13 +642,6 @@
 	}
 
 
-	public Vector<String> getBookNames(SWModule mod) {
-		Vector<String> books = new Vector<String>();
-		for (mod.begin(); mod.error() == 0; mod.setKeyText("+book")) {
-			books.add(mod.getKeyChildren()[9]);
-		}
-		return books;
-	}
 
 	//--------------------------------------------------------------------------
 	// LOCAL METHODS

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/src/ios/SWORD.swift	2019-07-06 22:34:35 UTC (rev 3672)
@@ -2,10 +2,23 @@
 
 var mySWORDPlugin:SWORD? = nil
 
+
 @objc(SWORD) class SWORD : CDVPlugin, MFMessageComposeViewControllerDelegate {
 	var mgr = 0;
 	var installMgr = 0
 	var disclaimerConfirmed = false;
+
+	var VERSEKEY_BOOK = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOK);
+	var VERSEKEY_CHAPTER = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPTER);
+	var VERSEKEY_VERSE = Int(org_crosswire_sword_SWModule_VERSEKEY_VERSE);
+	var VERSEKEY_TESTAMENT = Int(org_crosswire_sword_SWModule_VERSEKEY_TESTAMENT);
+	var VERSEKEY_OSISREF = Int(org_crosswire_sword_SWModule_VERSEKEY_OSISREF);
+	var VERSEKEY_CHAPTERMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPTERMAX);
+	var VERSEKEY_VERSEMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_VERSEMAX);
+	var VERSEKEY_BOOKNAME = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKNAME);
+	var VERSEKEY_SHORTTEXT = Int(org_crosswire_sword_SWModule_VERSEKEY_SHORTTEXT);
+	var VERSEKEY_BOOKABBREV = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKABBREV);
+	var VERSEKEY_OSISBOOKNAME = Int(org_crosswire_sword_SWModule_VERSEKEY_OSISBOOKNAME);
     
 	@objc(initSWORD:)
 	func initSWORD(command: CDVInvokedUrlCommand) {
@@ -13,16 +26,17 @@
 		installMgr = 0
 		disclaimerConfirmed = false
 		mySWORDPlugin = nil
-		VERSEKEY_BOOKABBREV = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKABBREV);
 		VERSEKEY_BOOK = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOK);
 		VERSEKEY_CHAPTER = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPTER);
 		VERSEKEY_VERSE = Int(org_crosswire_sword_SWModule_VERSEKEY_VERSE);
 		VERSEKEY_TESTAMENT = Int(org_crosswire_sword_SWModule_VERSEKEY_TESTAMENT);
 		VERSEKEY_OSISREF = Int(org_crosswire_sword_SWModule_VERSEKEY_OSISREF);
-		VERSEKEY_CHAPMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPMAX);
+		VERSEKEY_CHAPTERMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPTERMAX);
 		VERSEKEY_VERSEMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_VERSEMAX);
 		VERSEKEY_BOOKNAME = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKNAME);
 		VERSEKEY_SHORTTEXT = Int(org_crosswire_sword_SWModule_VERSEKEY_SHORTTEXT);
+		VERSEKEY_BOOKABBREV = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKABBREV);
+		VERSEKEY_OSISBOOKNAME = Int(org_crosswire_sword_SWModule_VERSEKEY_OSISBOOKNAME);
 
 		org_crosswire_sword_StringMgr_setToUpper({ (text: Optional<UnsafePointer<Int8>>, maxBytes: u_long) in
 			let lower = String(cString: text!)
@@ -303,10 +317,18 @@
     func SWModule_getBookNames(command: CDVInvokedUrlCommand) {
         initMgr()
         let mod = getModule(command: command)
-        var retVal = [String]()
+        var retVal = [[AnyHashable : Any]]()
         org_crosswire_sword_SWModule_begin(mod)
         while (org_crosswire_sword_SWModule_popError(mod) == 0) {
-            retVal.append(getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(mod))[VERSEKEY_BOOKABBREV])
+            let vkInfo = getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(mod));
+            var bookInfo = [
+                "name": vkInfo[VERSEKEY_BOOKNAME],
+                "abbrev": vkInfo[VERSEKEY_BOOKABBREV],
+                "osisName": vkInfo[VERSEKEY_OSISBOOKNAME],
+                "chapterMax": vkInfo[VERSEKEY_CHAPTERMAX],
+            ] as [AnyHashable : Any]
+            retVal.append(bookInfo)
+
             org_crosswire_sword_SWModule_setKeyText(mod, "+book")
         }
         self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
@@ -573,17 +595,6 @@
 */
     }
 
-    var VERSEKEY_BOOK = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOK);
-    var VERSEKEY_CHAPTER = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPTER);
-    var VERSEKEY_VERSE = Int(org_crosswire_sword_SWModule_VERSEKEY_VERSE);
-    var VERSEKEY_TESTAMENT = Int(org_crosswire_sword_SWModule_VERSEKEY_TESTAMENT);
-    var VERSEKEY_OSISREF = Int(org_crosswire_sword_SWModule_VERSEKEY_OSISREF);
-    var VERSEKEY_CHAPMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_CHAPMAX);
-    var VERSEKEY_VERSEMAX = Int(org_crosswire_sword_SWModule_VERSEKEY_VERSEMAX);
-    var VERSEKEY_BOOKNAME = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKNAME);
-    var VERSEKEY_SHORTTEXT = Int(org_crosswire_sword_SWModule_VERSEKEY_SHORTTEXT);
-    var VERSEKEY_BOOKABBREV = Int(org_crosswire_sword_SWModule_VERSEKEY_BOOKABBREV);
-
     func renderChapter(masterMod: Int, mod: Int) -> [[String: Any]] {
         let saveMasterKey = String(cString: org_crosswire_sword_SWModule_getKeyText(masterMod))
         let saveKey = String(cString: org_crosswire_sword_SWModule_getKeyText(mod))
@@ -630,12 +641,13 @@
             retVal["book"]        = Int(keyChildren[VERSEKEY_BOOK]);
             retVal["chapter"]     = Int(keyChildren[VERSEKEY_CHAPTER]);
             retVal["verse"]       = Int(keyChildren[VERSEKEY_VERSE]);
-            retVal["chapterMax"]  = Int(keyChildren[VERSEKEY_CHAPMAX]);
+            retVal["chapterMax"]  = Int(keyChildren[VERSEKEY_CHAPTERMAX]);
             retVal["verseMax"]    = Int(keyChildren[VERSEKEY_VERSEMAX]);
             retVal["bookName"]    = keyChildren[VERSEKEY_BOOKNAME];
             retVal["osisRef"]     = keyChildren[VERSEKEY_OSISREF];
             retVal["shortText"]   = keyChildren[VERSEKEY_SHORTTEXT];
             retVal["bookAbbrev"]  = keyChildren[VERSEKEY_BOOKABBREV];
+            retVal["osisBookName"]= keyChildren[VERSEKEY_OSISBOOKNAME];
         }
         return retVal;
     }
@@ -671,7 +683,6 @@
                     "percent": 100
                 ] as [String : Any]
 
-                //UnsafeMutablePointer<UnsafePointer<Int8>?>!) -> [String] {
                 var b = buffer
                 var count = 0
                 while let i = b?.pointee {
@@ -967,9 +978,4 @@
         }
         self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: mods), callbackId: command.callbackId)
     }
-/*
-SWMgr_startBibleSync
-SWMgr_stopBibleSync		
-SWMgr_sendBibleSyncMessage		
-*/
 }

Modified: trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js
===================================================================
--- trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/cordova/cordova-plugin-crosswire-sword/www/SWORD.js	2019-07-06 22:34:35 UTC (rev 3672)
@@ -444,6 +444,8 @@
 SWORD.prototype.CATEGORY_LEXDICTS     = "Lexicons / Dictionaries";
 SWORD.prototype.CATEGORY_GENBOOKS     = "Generic Books";
 SWORD.prototype.CATEGORY_DAILYDEVOS   = "Daily Devotional";
+SWORD.prototype.osisOT                = ['Gen', 'Exod', 'Lev', 'Num', 'Deut', 'Josh', 'Judg', 'Ruth', '1Sam', '2Sam', '1Kgs', '2Kgs', '1Chr', '2Chr', 'Ezra', 'Neh', 'Esth', 'Job', 'Ps', 'Prov', 'Eccl', 'Song', 'Isa', 'Jer', 'Lam', 'Ezek', 'Dan', 'Hos', 'Joel', 'Amos', 'Obad', 'Jonah', 'Mic', 'Nah', 'Hab', 'Zeph', 'Hag', 'Zech', 'Mal'];
+SWORD.prototype.osisNT                = ['Matt', 'Mark', 'Luke', 'John', 'Acts', 'Rom', '1Cor', '2Cor', 'Gal', 'Eph', 'Phil', 'Col', '1Thess', '2Thess', '1Tim', '2Tim', 'Titus', 'Phlm', 'Heb', 'Jas', '1Pet', '2Pet', '1John', '2John', '3John', 'Jude', 'Rev'];
 
 
 SWORD.prototype.init = function(successCallback, errorCallback) {

Modified: trunk/bindings/flatapi.cpp
===================================================================
--- trunk/bindings/flatapi.cpp	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/flatapi.cpp	2019-07-06 22:34:35 UTC (rev 3672)
@@ -722,7 +722,7 @@
 
 // This method returns child nodes for a genbook,
 // but has special handling if called on a VerseKey module:
-//  [0..7] [testament, book, chapter, verse, chapterMax, verseMax, bookName, osisRef]
+//  [0..] [org_crosswire_sword_SWModule_VERSEKEY_TESTAMENT, VERSEKEY_BOOK, VERSEKEY_CHAPTER, VERSEKEY_VERSE, VERSEKEY_CHAPTERMAX, ... ]
 const char ** SWDLLEXPORT org_crosswire_sword_SWModule_getKeyChildren
   (SWHANDLE hSWModule) {
 
@@ -736,7 +736,7 @@
 
 	sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
 	if (vkey) {
-		retVal = (const char **)calloc(11, sizeof(const char *));
+		retVal = (const char **)calloc(12, sizeof(const char *));
 		SWBuf num;
 		num.appendFormatted("%d", vkey->getTestament());
 		stdstr((char **)&(retVal[0]), num.c_str());
@@ -759,6 +759,7 @@
 		stdstr((char **)&(retVal[7]), vkey->getOSISRef());
 		stdstr((char **)&(retVal[8]), vkey->getShortText());
 		stdstr((char **)&(retVal[9]), vkey->getBookAbbrev());
+		stdstr((char **)&(retVal[10]), vkey->getOSISBookName());
 	}
 	else {
 		TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);

Modified: trunk/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- trunk/bindings/java-jni/jni/swordstub.cpp	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/java-jni/jni/swordstub.cpp	2019-07-06 22:34:35 UTC (rev 3672)
@@ -1431,7 +1431,7 @@
 
 		sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
 		if (vkey) {
-			ret = (jobjectArray) env->NewObjectArray(10, clazzString, NULL);
+			ret = (jobjectArray) env->NewObjectArray(11, clazzString, NULL);
 			SWBuf num;
 			num.appendFormatted("%d", vkey->getTestament());
 			env->SetObjectArrayElement(ret, 0, strToUTF8Java(env, assureValidUTF8(num.c_str())));
@@ -1454,6 +1454,7 @@
 			env->SetObjectArrayElement(ret, 7, strToUTF8Java(env, assureValidUTF8(vkey->getOSISRef())));
 			env->SetObjectArrayElement(ret, 8, strToUTF8Java(env, assureValidUTF8(vkey->getShortText())));
 			env->SetObjectArrayElement(ret, 9, strToUTF8Java(env, assureValidUTF8(vkey->getBookAbbrev())));
+			env->SetObjectArrayElement(ret, 10, strToUTF8Java(env, assureValidUTF8(vkey->getOSISBookName())));
 		}
 		else {
 			TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);

Modified: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java	2019-07-06 22:34:35 UTC (rev 3672)
@@ -38,16 +38,17 @@
 	public static final int SEARCHTYPE_ENTRYATTR = -3;
 	public static final int SEARCHTYPE_LUCENE    = -4;
 
-	public static final int VERSEKEY_TESTAMENT  = 0;
-	public static final int VERSEKEY_BOOK       = 1;
-	public static final int VERSEKEY_CHAPTER    = 2;
-	public static final int VERSEKEY_VERSE      = 3;
-	public static final int VERSEKEY_CHAPTERMAX = 4;
-	public static final int VERSEKEY_VERSEMAX   = 5;
-	public static final int VERSEKEY_BOOKNAME   = 6;
-	public static final int VERSEKEY_OSISREF    = 7;
-	public static final int VERSEKEY_SHORTTEXT  = 8;
-	public static final int VERSEKEY_BOOKABBREV = 9;
+	public static final int VERSEKEY_TESTAMENT    =  0;
+	public static final int VERSEKEY_BOOK         =  1;
+	public static final int VERSEKEY_CHAPTER      =  2;
+	public static final int VERSEKEY_VERSE        =  3;
+	public static final int VERSEKEY_CHAPTERMAX   =  4;
+	public static final int VERSEKEY_VERSEMAX     =  5;
+	public static final int VERSEKEY_BOOKNAME     =  6;
+	public static final int VERSEKEY_OSISREF      =  7;
+	public static final int VERSEKEY_SHORTTEXT    =  8;
+	public static final int VERSEKEY_BOOKABBREV   =  9;
+	public static final int VERSEKEY_OSISBOOKNAME = 10;
 
 	private SWModule() {}	// don't allow allocation, instead use factory method SWMgr.getModuleByName to retrieve an instance
 	public SWModule(String name, String remoteSourceName) { this.name = name; this.remoteSourceName = remoteSourceName; }	// ok, well, our stub can create a shell with name and remoteSourceName
@@ -79,7 +80,7 @@
 
 	// 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]
+	//  [0..] [VERSEKEY_TESTAMENT, VERSEKEY_BOOK, VERSEKEY_CHAPTER, VERSEKEY_VERSE, VERSEKEY_CHAPTERMAX, ... ]
 	public native String[]      getKeyChildren();
 
 	public native String        getKeyParent();

Modified: trunk/include/flatapi.h
===================================================================
--- trunk/include/flatapi.h	2019-07-04 18:25:00 UTC (rev 3671)
+++ trunk/include/flatapi.h	2019-07-06 22:34:35 UTC (rev 3672)
@@ -66,12 +66,15 @@
     const int org_crosswire_sword_SWModule_VERSEKEY_BOOK = 1;
     const int org_crosswire_sword_SWModule_VERSEKEY_CHAPTER = 2;
     const int org_crosswire_sword_SWModule_VERSEKEY_VERSE = 3;
-    const int org_crosswire_sword_SWModule_VERSEKEY_CHAPMAX = 4;
+    const int org_crosswire_sword_SWModule_VERSEKEY_CHAPTERMAX = 4;
     const int org_crosswire_sword_SWModule_VERSEKEY_VERSEMAX = 5;
     const int org_crosswire_sword_SWModule_VERSEKEY_BOOKNAME = 6;
     const int org_crosswire_sword_SWModule_VERSEKEY_OSISREF = 7;
     const int org_crosswire_sword_SWModule_VERSEKEY_SHORTTEXT = 8;
     const int org_crosswire_sword_SWModule_VERSEKEY_BOOKABBREV = 9;
+    const int org_crosswire_sword_SWModule_VERSEKEY_OSISBOOKNAME = 10;
+	// for backward compat.  Remove
+    const int org_crosswire_sword_SWModule_VERSEKEY_CHAPMAX = 4;
 
     
     




More information about the sword-cvs mailing list