[sword-svn] r3524 - in branches/sword-1-8-x: . bindings/Android bindings/cordova/org.crosswire.sword.cordova.SWORD/www bindings/java-jni/jni include src/keys src/mgr src/modules/common src/modules/filters
scribe at crosswire.org
scribe at crosswire.org
Mon Nov 6 20:08:50 MST 2017
Author: scribe
Date: 2017-11-06 20:08:49 -0700 (Mon, 06 Nov 2017)
New Revision: 3524
Modified:
branches/sword-1-8-x/
branches/sword-1-8-x/bindings/Android/Makefile
branches/sword-1-8-x/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js
branches/sword-1-8-x/bindings/java-jni/jni/swordstub.cpp
branches/sword-1-8-x/configure.ac
branches/sword-1-8-x/include/osisplain.h
branches/sword-1-8-x/include/swversion.h
branches/sword-1-8-x/src/keys/treekeyidx.cpp
branches/sword-1-8-x/src/mgr/swmgr.cpp
branches/sword-1-8-x/src/modules/common/rawstr.cpp
branches/sword-1-8-x/src/modules/common/rawstr4.cpp
branches/sword-1-8-x/src/modules/common/zstr.cpp
branches/sword-1-8-x/src/modules/filters/osisplain.cpp
Log:
merged fixes from trunk in preparation for 1.8.0RC5
Property changes on: branches/sword-1-8-x
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:3459-3471,3473,3475,3477-3482,3485-3514,3516
+ /trunk:3459-3471,3473,3475,3477-3482,3485-3514,3516,3518-3523
Modified: branches/sword-1-8-x/bindings/Android/Makefile
===================================================================
--- branches/sword-1-8-x/bindings/Android/Makefile 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/bindings/Android/Makefile 2017-11-07 03:08:49 UTC (rev 3524)
@@ -2,7 +2,7 @@
cp -a SWORD/app/build/intermediates/cmake/debug/obj/* ../cordova/org.crosswire.sword.cordova.SWORD/libs/android/
release: javawrapper
- cp -a SWORD/app/build/intermediates/cmake/release/obj/* ../cordova/org.crosswire.sword.cordova.SWORD/libs/android/
+ cp -a SWORD/app/build/intermediates/transforms/stripDebugSymbol/release/0/lib/* ../cordova/org.crosswire.sword.cordova.SWORD/libs/android/
javawrapper:
cp -a SWORD/app/src/main/java/org/crosswire/android/sword/* ../cordova/org.crosswire.sword.cordova.SWORD/src/android/
Modified: branches/sword-1-8-x/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js
===================================================================
--- branches/sword-1-8-x/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js 2017-11-07 03:08:49 UTC (rev 3524)
@@ -255,12 +255,12 @@
SWMgr.prototype.getModInfoList = function(callback) {
- var retVal = [];
- exec(callback?callback:function(m) { if (m && m.length > 0) retVal = m; },
+ if (!this.hasOwnProperty('_lastModInfoList')) this._lastModInfoList = [];
+ exec(function(m) { if (m && m.length > 0) this._lastModInfoList = m; if (callback) callback(m); },
function(err) { utils.alert('[ERROR] problem: ' + err); },
"SWORD", "SWMgr.getModInfoList", []
);
- return retVal;
+ return this._lastModInfoList;
}
SWMgr.prototype.getModuleByName = function(modName, callback) {
Modified: branches/sword-1-8-x/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- branches/sword-1-8-x/bindings/java-jni/jni/swordstub.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/bindings/java-jni/jni/swordstub.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -38,6 +38,7 @@
#include <treekeyidx.h>
#include <installmgr.h>
#include <remotetrans.h>
+#include <rtfhtml.h>
//#include <android/native_activity.h>
@@ -77,13 +78,18 @@
JNIEnv *env;
jobject callback;
unsigned long last;
+
+ InstallStatusReporter() : env(0), callback(0), last(0) {
+ }
+
void init(JNIEnv *env, jobject callback) {
this->env = env;
this->callback = callback;
last = 0xffffffff;
}
- virtual void update(unsigned long totalBytes, unsigned long completedBytes) {
+ virtual void update(unsigned long totalBytes, unsigned long completedBytes) {
+
// assert we have a callback
if (!callback) return;
@@ -96,24 +102,10 @@
}
env->DeleteLocalRef(cls);
}
-
-/*
- int p = (totalBytes > 0) ? (int)(74.0 * ((double)completedBytes / (double)totalBytes)) : 0;
- for (;last < p; ++last) {
- if (!last) {
- SWBuf output;
- output.setFormatted("[ File Bytes: %ld", totalBytes);
- while (output.size() < 75) output += " ";
- output += "]";
- cout << output.c_str() << "\n ";
- }
- cout << "-";
- }
- cout.flush();
-*/
}
- virtual void preStatus(long totalBytes, long completedBytes, const char *message) {
+ virtual void preStatus(long totalBytes, long completedBytes, const char *message) {
+
// assert we have a callback
if (!callback) return;
@@ -125,17 +117,6 @@
env->DeleteLocalRef(msg);
}
env->DeleteLocalRef(cls);
-/*
- SWBuf output;
- output.setFormatted("[ Total Bytes: %ld; Completed Bytes: %ld", totalBytes, completedBytes);
- while (output.size() < 75) output += " ";
- output += "]";
- cout << "\n" << output.c_str() << "\n ";
- int p = (int)(74.0 * (double)completedBytes/totalBytes);
- for (int i = 0; i < p; ++i) { cout << "="; }
- cout << "\n\n" << message << "\n";
- last = 0;
-*/
}
} *installStatusReporter = 0;
bool disclaimerConfirmed = false;
@@ -202,11 +183,12 @@
}
}
-static void initInstall() {
+static void initInstall(JNIEnv *env, jobject progressReporter = 0) {
if (!installStatusReporter) {
installStatusReporter = new InstallStatusReporter();
}
+ installStatusReporter->init(env, progressReporter);
if (!installMgr) {
SWLog::getSystemLog()->logDebug("initInstall: installMgr is null");
SWBuf baseDir = SWORD_PATH;
@@ -289,7 +271,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -304,7 +286,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_reInit
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
jclass swmgrClass = env->GetObjectClass(me);
jmethodID getStorageBasePath = env->GetMethodID(swmgrClass, "getStorageBasePath", "()Ljava/lang/String;");
@@ -320,7 +302,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getPrefixPath
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -328,7 +310,7 @@
}
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getConfigPath
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -337,7 +319,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
- (JNIEnv *env, jobject) {
+ (JNIEnv *env, jobject) {
init(env);
@@ -394,15 +376,15 @@
* 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) {
+ (JNIEnv *env, jobject me, jstring modNameJS) {
init(env);
jobject retVal = 0;
- const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+ const char *modName = env->GetStringUTFChars(modNameJS, NULL);
sword::SWModule *module = mgr->getModule(modName);
- env->ReleaseStringUTFChars(modNameJS, modName);
+ env->ReleaseStringUTFChars(modNameJS, modName);
if (module) {
SWBuf type = module->getType();
@@ -425,17 +407,17 @@
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setGlobalOption
- (JNIEnv *env, jobject me, jstring optionJS, jstring valueJS) {
+ (JNIEnv *env, jobject me, jstring optionJS, jstring valueJS) {
init(env);
- const char *option = env->GetStringUTFChars(optionJS, NULL);
- const char *value = env->GetStringUTFChars(valueJS, NULL);
+ const char *option = env->GetStringUTFChars(optionJS, NULL);
+ const char *value = env->GetStringUTFChars(valueJS, NULL);
mgr->setGlobalOption(option, value);
- env->ReleaseStringUTFChars(valueJS, value);
- env->ReleaseStringUTFChars(optionJS, option);
+ env->ReleaseStringUTFChars(valueJS, value);
+ env->ReleaseStringUTFChars(optionJS, option);
}
@@ -445,15 +427,15 @@
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
- (JNIEnv *env, jobject me, jstring optionJS) {
+ (JNIEnv *env, jobject me, jstring optionJS) {
init(env);
- const char *option = env->GetStringUTFChars(optionJS, NULL);
+ const char *option = env->GetStringUTFChars(optionJS, NULL);
SWBuf value = mgr->getGlobalOption(option);
- env->ReleaseStringUTFChars(optionJS, option);
+ env->ReleaseStringUTFChars(optionJS, option);
return env->NewStringUTF(assureValidUTF8(value));
}
@@ -465,15 +447,15 @@
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionTip
- (JNIEnv *env, jobject me, jstring optionJS) {
+ (JNIEnv *env, jobject me, jstring optionJS) {
init(env);
- const char *option = env->GetStringUTFChars(optionJS, NULL);
+ const char *option = env->GetStringUTFChars(optionJS, NULL);
SWBuf value = mgr->getGlobalOptionTip(option);
- env->ReleaseStringUTFChars(optionJS, option);
+ env->ReleaseStringUTFChars(optionJS, option);
return env->NewStringUTF(assureValidUTF8(value));
}
@@ -485,20 +467,20 @@
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_filterText
- (JNIEnv *env, jobject me, jstring filterNameJS, jstring textJS) {
+ (JNIEnv *env, jobject me, jstring filterNameJS, jstring textJS) {
init(env);
- const char *filterName = env->GetStringUTFChars(filterNameJS, NULL);
- const char *text = env->GetStringUTFChars(textJS, NULL);
+ const char *filterName = env->GetStringUTFChars(filterNameJS, NULL);
+ const char *text = env->GetStringUTFChars(textJS, NULL);
SWBuf buf = text;
// hmmm, in the future, provide a param to specify filter value maybe?
mgr->setGlobalOption("Greek Accents", "Off");
char errStatus = mgr->filterText(filterName, buf);
- env->ReleaseStringUTFChars(textJS, text);
- env->ReleaseStringUTFChars(filterNameJS, filterName);
+ env->ReleaseStringUTFChars(textJS, text);
+ env->ReleaseStringUTFChars(filterNameJS, filterName);
return env->NewStringUTF(assureValidUTF8(buf));
}
@@ -758,15 +740,15 @@
* Signature: (Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionValues
- (JNIEnv *env, jobject me, jstring optionJS) {
+ (JNIEnv *env, jobject me, jstring optionJS) {
init(env);
- const char *option = env->GetStringUTFChars(optionJS, NULL);
+ const char *option = env->GetStringUTFChars(optionJS, NULL);
sword::StringList options = mgr->getGlobalOptionValues(option);
- env->ReleaseStringUTFChars(optionJS, option);
+ env->ReleaseStringUTFChars(optionJS, option);
int count = 0;
for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) {
@@ -790,17 +772,17 @@
* Signature: (Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setCipherKey
- (JNIEnv *env, jobject me , jstring modNameJS, jstring keyJS) {
+ (JNIEnv *env, jobject me , jstring modNameJS, jstring keyJS) {
init(env);
- const char *modName = env->GetStringUTFChars(modNameJS, NULL);
- const char *key = env->GetStringUTFChars(keyJS, NULL);
+ const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+ const char *key = env->GetStringUTFChars(keyJS, NULL);
mgr->setCipherKey(modName, key);
- env->ReleaseStringUTFChars(keyJS, key);
- env->ReleaseStringUTFChars(modNameJS, modName);
+ env->ReleaseStringUTFChars(keyJS, key);
+ env->ReleaseStringUTFChars(modNameJS, modName);
}
@@ -810,7 +792,7 @@
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setJavascript
- (JNIEnv *env, jobject me, jboolean val) {
+ (JNIEnv *env, jobject me, jboolean val) {
init(env);
@@ -824,7 +806,7 @@
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailableLocales
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -851,15 +833,15 @@
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setDefaultLocale
- (JNIEnv *env, jobject me, jstring localeNameJS) {
+ (JNIEnv *env, jobject me, jstring localeNameJS) {
init(env);
- const char *localeName = env->GetStringUTFChars(localeNameJS, NULL);
+ const char *localeName = env->GetStringUTFChars(localeNameJS, NULL);
LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(localeName);
- env->ReleaseStringUTFChars(localeNameJS, localeName);
+ env->ReleaseStringUTFChars(localeNameJS, localeName);
}
@@ -867,7 +849,8 @@
// SWModule methods ----------------------------------------------------------------------------------
-SWModule *getModule(JNIEnv *env, jobject me) {
+SWModule *getModule
+ (JNIEnv *env, jobject me) {
init(env);
@@ -877,10 +860,10 @@
jfieldID sourceFieldID = env->GetFieldID(clazzSWModule, "remoteSourceName", "Ljava/lang/String;");
jstring modNameJS = (jstring)env->GetObjectField(me, fieldID);
jstring sourceNameJS = (jstring)env->GetObjectField(me, sourceFieldID);
- const char *modName = (modNameJS?env->GetStringUTFChars(modNameJS, NULL):0);
- const char *sourceName = (sourceNameJS?env->GetStringUTFChars(sourceNameJS, NULL):0);
+ const char *modName = (modNameJS?env->GetStringUTFChars(modNameJS, NULL):0);
+ const char *sourceName = (sourceNameJS?env->GetStringUTFChars(sourceNameJS, NULL):0);
if (sourceName && *sourceName) {
- initInstall();
+ initInstall(env);
InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
if (source == installMgr->sources.end()) {
SWMgr *mgr = source->second->getMgr();
@@ -888,8 +871,8 @@
}
}
else module = mgr->getModule(modName);
- if (modName) env->ReleaseStringUTFChars(modNameJS, modName);
- if (sourceName) env->ReleaseStringUTFChars(sourceNameJS, sourceName);
+ if (modName) env->ReleaseStringUTFChars(modNameJS, modName);
+ if (sourceName) env->ReleaseStringUTFChars(sourceNameJS, sourceName);
return module;
}
@@ -899,7 +882,7 @@
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setKeyText
- (JNIEnv *env, jobject me, jstring keyTextJS) {
+ (JNIEnv *env, jobject me, jstring keyTextJS) {
init(env);
@@ -937,7 +920,7 @@
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -957,7 +940,7 @@
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -977,7 +960,7 @@
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderHeader
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -997,7 +980,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1015,7 +998,7 @@
* Signature: ()C
*/
JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1032,7 +1015,7 @@
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1048,7 +1031,7 @@
* 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 *env, jobject me, jstring level1JS, jstring level2JS, jstring level3JS, jboolean filteredJS) {
+ (JNIEnv *env, jobject me, jstring level1JS, jstring level2JS, jstring level3JS, jboolean filteredJS) {
init(env);
@@ -1102,7 +1085,8 @@
results.push_back(i2Start->first);
}
else {
- if (level3 && *level3 && *level3 != '-') {
+ // allow '-' to get all keys; allow '*' to get all key=value
+ if (level3 && *level3 && *level3 != '-' && *level3 != '*') {
i3Start = i2Start->second.find(level3);
i3End = i3Start;
if (i3End != i2Start->second.end())
@@ -1116,6 +1100,9 @@
if (level3 && *level3 && *level3 == '-') {
results.push_back(i3Start->first);
}
+ else if (level3 && *level3 && *level3 == '*') {
+ results.push_back(i3Start->first + "=" + i3Start->second);
+ }
else {
results.push_back(i3Start->second);
}
@@ -1157,7 +1144,7 @@
* Signature: (Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_parseKeyList
- (JNIEnv *env, jobject me, jstring keyListTextJS) {
+ (JNIEnv *env, jobject me, jstring keyListTextJS) {
init(env);
@@ -1202,7 +1189,7 @@
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1227,7 +1214,7 @@
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyChildren
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1299,7 +1286,7 @@
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1329,7 +1316,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1348,7 +1335,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1367,7 +1354,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_begin
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1386,7 +1373,7 @@
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getStripText
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1409,7 +1396,7 @@
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRawEntry
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1432,7 +1419,7 @@
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setRawEntry
- (JNIEnv *env, jobject me, jstring newEntryTextJS) {
+ (JNIEnv *env, jobject me, jstring newEntryTextJS) {
init(env);
@@ -1449,32 +1436,13 @@
}
-jstring newBigString(JNIEnv *env, const char *buf) {
- SWBuf str = assureValidUTF8(buf);
- jclass stringClass = env->FindClass("java/lang/String");
- jmethodID ctorID = env->GetMethodID(stringClass, "<init>", "([B)V");
-
- jstring result;
-SWLog::getSystemLog()->logDebug("newBigString: making byte array size: %d", str.size());
- jbyteArray bytes = env->NewByteArray(str.size());
-SWLog::getSystemLog()->logDebug("newBigString: setting array region");
-
- env->SetByteArrayRegion(bytes, 0, str.size(), (jbyte *)str.c_str());
-SWLog::getSystemLog()->logDebug("newBigString: newing string");
- result = (jstring)env->NewObject(stringClass, ctorID, bytes);
- env->DeleteLocalRef(bytes);
-SWLog::getSystemLog()->logDebug("newBigString: returning");
- return result;
-}
-
-
/*
* 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 *env, jobject me, jstring configKeyJS) {
+ (JNIEnv *env, jobject me, jstring configKeyJS) {
init(env);
@@ -1487,8 +1455,12 @@
SWModule *module = getModule(env, me);
if (module) {
- SWBuf about = module->getConfigEntry(configKey);
- SWBuf assuredBuf = assureValidUTF8(about.c_str());
+ SWBuf confValue = module->getConfigEntry(configKey);
+ // special processing if we're requesting About-- kindof cheese
+ if (!strcmp("About", configKey)) {
+ RTFHTML().processText(confValue);
+ }
+ SWBuf assuredBuf = assureValidUTF8(confValue.c_str());
retVal = env->NewStringUTF(assuredBuf.c_str());
}
@@ -1504,7 +1476,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_deleteSearchFramework
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1523,7 +1495,7 @@
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasSearchFramework
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
init(env);
@@ -1566,7 +1538,7 @@
* Signature: (Ljava/lang/String;IJLjava/lang/String;Lorg/crosswire/android/sword/SWModule/SearchProgressReporter;)[Lorg/crosswire/android/sword/SWModule/SearchHit;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_search
- (JNIEnv *env, jobject me, jstring expressionJS, jint srchType, jlong flags, jstring scopeJS, jobject progressReporter) {
+ (JNIEnv *env, jobject me, jstring expressionJS, jint srchType, jlong flags, jstring scopeJS, jobject progressReporter) {
init(env);
@@ -1581,7 +1553,7 @@
SWModule *module = getModule(env, me);
// TODO: remove this from the stack
- struct pu peeuuu(env, progressReporter);
+ pu *peeuuu = new pu(env, progressReporter);
if (module) {
sword::ListKey lscope;
@@ -1596,11 +1568,13 @@
}
*parser = module->getKeyText();
lscope = parser->parseVerseList(scope, *parser, true);
- result = module->search(expression, srchType, flags, &lscope, 0, &percentUpdate, &peeuuu);
+ result = module->search(expression, srchType, flags, &lscope, 0, &percentUpdate, peeuuu);
delete parser;
}
- else result = module->search(expression, srchType, flags, 0, 0, &percentUpdate, &peeuuu);
+ else result = module->search(expression, srchType, flags, 0, 0, &percentUpdate, peeuuu);
+ delete peeuuu;
+
int count = 0;
for (result = sword::TOP; !result.popError(); result++) count++;
@@ -1652,7 +1626,7 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_InstallMgr_reInit
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
delete installMgr;
installMgr = 0;
@@ -1665,9 +1639,9 @@
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_syncConfig
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- initInstall();
+ initInstall(env);
return installMgr->refreshRemoteSourceConfiguration();
}
@@ -1679,10 +1653,10 @@
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_uninstallModule
- (JNIEnv *env, jobject me, jstring modNameJS) {
+ (JNIEnv *env, jobject me, jstring modNameJS) {
init(env);
- initInstall();
+ initInstall(env);
const char *modName = env->GetStringUTFChars(modNameJS, NULL);
@@ -1708,9 +1682,9 @@
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteSources
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- initInstall();
+ initInstall(env);
jclass clazzString = env->FindClass("java/lang/String");
jobjectArray ret;
@@ -1736,9 +1710,9 @@
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_refreshRemoteSource
- (JNIEnv *env, jobject me, jstring sourceNameJS) {
+ (JNIEnv *env, jobject me, jstring sourceNameJS) {
- initInstall();
+ initInstall(env);
const char *sourceName = env->GetStringUTFChars(sourceNameJS, NULL);
@@ -1759,11 +1733,11 @@
* Signature: (Ljava/lang/String;)[Lorg/crosswire/android/sword/SWMgr/ModInfo;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteModInfoList
- (JNIEnv *env, jobject me, jstring sourceNameJS) {
+ (JNIEnv *env, jobject me, jstring sourceNameJS) {
SWLog::getSystemLog()->logDebug("getRemoteModInfoList\n");
init(env);
- initInstall();
+ initInstall(env);
const char *sourceName = env->GetStringUTFChars(sourceNameJS, NULL);
SWLog::getSystemLog()->logDebug("sourceName: %s\n", sourceName);
@@ -1833,13 +1807,11 @@
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_remoteInstallModule
- (JNIEnv *env, jobject me, jstring sourceNameJS, jstring modNameJS, jobject progressReporter) {
+ (JNIEnv *env, jobject me, jstring sourceNameJS, jstring modNameJS, jobject progressReporter) {
init(env);
- initInstall();
+ initInstall(env, progressReporter);
- installStatusReporter->init(env, progressReporter);
-
const char *sourceName = env->GetStringUTFChars(sourceNameJS, NULL);
SWLog::getSystemLog()->logDebug("remoteInstallModule: sourceName: %s\n", sourceName);
InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
@@ -1887,11 +1859,11 @@
* Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/crosswire/android/sword/SWModule;
*/
JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteModuleByName
- (JNIEnv *env, jobject me, jstring sourceNameJS, jstring modNameJS) {
+ (JNIEnv *env, jobject me, jstring sourceNameJS, jstring modNameJS) {
jobject retVal = 0;
- initInstall();
+ initInstall(env);
const char *sourceName = env->GetStringUTFChars(sourceNameJS, NULL);
SWLog::getSystemLog()->logDebug("getRemoteModuleByName: sourceName: %s\n", sourceName);
@@ -1905,9 +1877,9 @@
SWMgr *mgr = source->second->getMgr();
- const char *modName = env->GetStringUTFChars(modNameJS, NULL);
+ const char *modName = env->GetStringUTFChars(modNameJS, NULL);
sword::SWModule *module = mgr->getModule(modName);
- env->ReleaseStringUTFChars(modNameJS, modName);
+ env->ReleaseStringUTFChars(modNameJS, modName);
if (module) {
SWBuf type = module->getType();
@@ -1933,9 +1905,9 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_InstallMgr_setUserDisclaimerConfirmed
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- initInstall();
+ initInstall(env);
disclaimerConfirmed = true;
installMgr->setUserDisclaimerConfirmed(true);
@@ -1948,7 +1920,8 @@
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_sendBibleSyncMessage
- (JNIEnv *env, jobject me, jstring osisRefJS) {
+ (JNIEnv *env, jobject me, jstring osisRefJS) {
+
initBibleSync();
const char *osisRef = env->GetStringUTFChars(osisRefJS, NULL);
@@ -1967,7 +1940,7 @@
* Signature: (Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_registerBibleSyncListener
- (JNIEnv *env, jobject me, jobject bibleSyncListener) {
+ (JNIEnv *env, jobject me, jobject bibleSyncListener) {
#ifdef BIBLESYNC
SWLog::getSystemLog()->logDebug("registerBibleSyncListener");
Modified: branches/sword-1-8-x/configure.ac
===================================================================
--- branches/sword-1-8-x/configure.ac 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/configure.ac 2017-11-07 03:08:49 UTC (rev 3524)
@@ -5,7 +5,7 @@
# Version change: Change line 8 only !
# Change it immediately after a release
-AC_INIT(sword, 1.7.904, sword-bugs at crosswire.org, sword, http://crosswire.org/sword)
+AC_INIT(sword, 1.7.905, sword-bugs at crosswire.org, sword, http://crosswire.org/sword)
AC_CONFIG_SRCDIR(sword.bmp)
AC_PREREQ(2.52)
AC_REVISION($Revision: 1.45 $)
Modified: branches/sword-1-8-x/include/osisplain.h
===================================================================
--- branches/sword-1-8-x/include/osisplain.h 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/include/osisplain.h 2017-11-07 03:08:49 UTC (rev 3524)
@@ -35,6 +35,7 @@
protected:
virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key);
virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ virtual bool processStage(char stage, SWBuf &text, char *&from, BasicFilterUserData *userData);
public:
OSISPlain();
};
Modified: branches/sword-1-8-x/include/swversion.h
===================================================================
--- branches/sword-1-8-x/include/swversion.h 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/include/swversion.h 2017-11-07 03:08:49 UTC (rev 3524)
@@ -24,11 +24,11 @@
#ifndef SWVERSION_H
#define SWVERSION_H
-#define SWORD_VERSION_NUM 107904000
-#define SWORD_VERSION_STR "1.7.904"
+#define SWORD_VERSION_NUM 107905000
+#define SWORD_VERSION_STR "1.7.905"
#define SWORD_VERSION_MAJOR 1
#define SWORD_VERSION_MINOR 7
-#define SWORD_VERSION_MICRO 904
+#define SWORD_VERSION_MICRO 905
#define SWORD_VERSION_NANO 0
#include <defs.h>
Modified: branches/sword-1-8-x/src/keys/treekeyidx.cpp
===================================================================
--- branches/sword-1-8-x/src/keys/treekeyidx.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/src/keys/treekeyidx.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -63,7 +63,9 @@
datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
if (!datfd || datfd->getFd() < 0) {
- SWLog::getSystemLog()->logError("%d", errno);
+ // couldn't find datafile but this might be fine if we're
+ // merely instantiating a remote InstallMgr SWMgr
+ SWLog::getSystemLog()->logDebug("Couldn't open file: %s. errno: %d", buf.c_str(), errno);
error = errno;
}
else {
Modified: branches/sword-1-8-x/src/mgr/swmgr.cpp
===================================================================
--- branches/sword-1-8-x/src/mgr/swmgr.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/src/mgr/swmgr.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -132,6 +132,32 @@
const char *SWMgr::MODTYPE_GENBOOKS = "Generic Books";
const char *SWMgr::MODTYPE_DAILYDEVOS = "Daily Devotional";
+namespace {
+ void setSystemLogLevel(SWConfig *sysConf, const char *logLevel = 0) {
+ SWBuf logLevelString = logLevel;
+ // kindof cheese. we should probably pass this in.
+ SWBuf logLocation = (sysConf ? "[SWORD] section of sword.conf" : "SWORD_LOGLEVEL");
+ if (sysConf) {
+ ConfigEntMap::iterator entry;
+ if ((entry = sysConf->getSection("SWORD").find("LogLevel")) != sysConf->getSection("SWORD").end()) {
+ logLevelString = entry->second;
+ }
+ }
+ if (logLevelString.length()) {
+ int logLevel = logLevelString == "ERROR" ? SWLog::LOG_ERROR:
+ logLevelString == "WARN" ? SWLog::LOG_WARN:
+ logLevelString == "INFO" ? SWLog::LOG_INFO:
+ logLevelString == "TIMEDINFO" ? SWLog::LOG_TIMEDINFO:
+ logLevelString == "DEBUG" ? SWLog::LOG_DEBUG:
+ -1;
+ if (logLevel < 0) SWLog::getSystemLog()->logError("Invalid LogLevel found in %s: LogLevel: %s", logLocation.c_str(), logLevelString.c_str());
+ else {
+ SWLog::getSystemLog()->setLogLevel(logLevel);
+ SWLog::getSystemLog()->logInformation("Setting log level from %s to %s", logLocation.c_str(), logLevelString.c_str());
+ }
+ }
+ }
+}
void SWMgr::init() {
SWOptionFilter *tmpFilter = 0;
@@ -418,11 +444,20 @@
void SWMgr::findConfig(char *configType, char **prefixPath, char **configPath, std::list<SWBuf> *augPaths, SWConfig **providedSysConf) {
+ static bool setLogLevel = false;
SWBuf path;
SWBuf sysConfPath;
ConfigEntMap::iterator entry;
ConfigEntMap::iterator lastEntry;
+ if (!setLogLevel) {
+ SWBuf envLogLevel = getenv("SWORD_LOGLEVEL");
+ if (envLogLevel.length()) {
+ setSystemLogLevel(0, envLogLevel);
+ setLogLevel = true;
+ }
+ }
+
SWConfig *sysConf = 0;
SWBuf sysConfDataPath = "";
@@ -435,6 +470,7 @@
if (providedSysConf && *providedSysConf) {
sysConf = *providedSysConf;
SWLog::getSystemLog()->logDebug("found.");
+ if (!setLogLevel) { setSystemLogLevel(sysConf); setLogLevel = true; }
}
// if we haven't been given our datapath in a sysconf, we need to track it down
@@ -448,6 +484,7 @@
if ((entry = sysConf->getSection("Install").find("DataPath")) != sysConf->getSection("Install").end()) {
sysConfDataPath = (*entry).second;
}
+ if (!setLogLevel) { setSystemLogLevel(sysConf); setLogLevel = true; }
if (providedSysConf) {
*providedSysConf = sysConf;
}
@@ -557,6 +594,7 @@
}
if (sysConf) {
+ if (!setLogLevel) { setSystemLogLevel(sysConf); setLogLevel = true; }
if ((entry = sysConf->getSection("Install").find("DataPath")) != sysConf->getSection("Install").end()) {
sysConfDataPath = (*entry).second;
}
@@ -590,6 +628,7 @@
// do some extra processing of sysConf if we have one
if (sysConf) {
+ if (!setLogLevel) { setSystemLogLevel(sysConf); setLogLevel = true; }
if (augPaths) {
augPaths->clear();
entry = sysConf->getSection("Install").lower_bound("AugmentPath");
Modified: branches/sword-1-8-x/src/modules/common/rawstr.cpp
===================================================================
--- branches/sword-1-8-x/src/modules/common/rawstr.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/src/modules/common/rawstr.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -75,7 +75,9 @@
datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
if (!datfd || datfd->getFd() < 0) {
- SWLog::getSystemLog()->logError("%d", errno);
+ // couldn't find datafile but this might be fine if we're
+ // merely instantiating a remote InstallMgr SWMgr
+ SWLog::getSystemLog()->logDebug("Couldn't open file: %s. errno: %d", buf.c_str(), errno);
}
instance++;
Modified: branches/sword-1-8-x/src/modules/common/rawstr4.cpp
===================================================================
--- branches/sword-1-8-x/src/modules/common/rawstr4.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/src/modules/common/rawstr4.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -75,7 +75,9 @@
datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
if (!datfd || datfd->getFd() < 0) {
- SWLog::getSystemLog()->logError("%d", errno);
+ // couldn't find datafile but this might be fine if we're
+ // merely instantiating a remote InstallMgr SWMgr
+ SWLog::getSystemLog()->logDebug("Couldn't open file: %s. errno: %d", buf.c_str(), errno);
}
instance++;
Modified: branches/sword-1-8-x/src/modules/common/zstr.cpp
===================================================================
--- branches/sword-1-8-x/src/modules/common/zstr.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/src/modules/common/zstr.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -83,8 +83,10 @@
buf.setFormatted("%s.zdt", path);
zdtfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
- if (!datfd || datfd->getFd() < 0) {
- SWLog::getSystemLog()->logError("%d", errno);
+ if (!zdtfd || zdtfd->getFd() < 0) {
+ // couldn't find datafile but this might be fine if we're
+ // merely instantiating a remote InstallMgr SWMgr
+ SWLog::getSystemLog()->logDebug("Couldn't open file: %s. errno: %d", buf.c_str(), errno);
}
cacheBlock = 0;
Modified: branches/sword-1-8-x/src/modules/filters/osisplain.cpp
===================================================================
--- branches/sword-1-8-x/src/modules/filters/osisplain.cpp 2017-11-07 03:04:52 UTC (rev 3523)
+++ branches/sword-1-8-x/src/modules/filters/osisplain.cpp 2017-11-07 03:08:49 UTC (rev 3524)
@@ -60,14 +60,17 @@
addEscapeStringSubstitute("gt", ">");
addEscapeStringSubstitute("quot", "\"");
- setTokenCaseSensitive(true);
- addTokenSubstitute("title", "\n");
- addTokenSubstitute("/title", "\n");
- addTokenSubstitute("/l", "\n");
- addTokenSubstitute("lg", "\n");
- addTokenSubstitute("/lg", "\n");
+ setTokenCaseSensitive(true);
+ addTokenSubstitute("title", "\n");
+ addTokenSubstitute("/title", "\n");
+ addTokenSubstitute("/l", "\n");
+ addTokenSubstitute("lg", "\n");
+ addTokenSubstitute("/lg", "\n");
+
+ setStageProcessing(PRECHAR);
}
+
BasicFilterUserData *OSISPlain::createUserData(const SWModule *module, const SWKey *key) {
MyUserData *u = new MyUserData(module, key);
u->vk = SWDYNAMIC_CAST(VerseKey, u->key);
@@ -76,6 +79,17 @@
}
+bool OSISPlain::processStage(char stage, SWBuf &text, char *&from, BasicFilterUserData *userData) {
+ // this is a strip filter so we want to do this as optimized as possible. Avoid calling
+ // getUniCharFromUTF8 for slight speed improvement
+
+ if (stage == PRECHAR) {
+ if (from[0] == 0xC2 && from[1] == 0xAD) return true; // skip soft hyphens
+ }
+ return false;
+}
+
+
bool OSISPlain::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
// manually process if it wasn't a simple substitution
if (!substituteToken(buf, token)) {
More information about the sword-cvs
mailing list