summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeus Benschop <teusjannette@gmail.com>2018-11-10 21:10:09 +0700
committerTeus Benschop <teusjannette@gmail.com>2018-11-10 21:10:09 +0700
commit2a58bdf9b682f462b63be719fc441a679f7d52f3 (patch)
tree4b8fce727ab045eef1a846659bb90f18719477e6
parent018216c25c73b221df0810e6c909623abd46c321 (diff)
parent70090da73f95ee90e15650d853744526b5f47e68 (diff)
Record sword (1.8.1+dfsg-7) in archive suite sid
-rw-r--r--.pc/.quilt_patches1
-rw-r--r--.pc/.quilt_series1
-rw-r--r--.pc/.version1
-rw-r--r--.pc/12_fix_compiler_warnings.diff/src/mgr/filemgr.cpp585
-rw-r--r--.pc/12_fix_compiler_warnings.diff/src/utilfuns/zlib/untgz.c421
-rw-r--r--.pc/12_fix_compiler_warnings.diff/tests/testblocks.cpp111
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/cipherraw.cpp131
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/gbfidx.cpp307
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/genbookutil.cpp228
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/installmgr.cpp410
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/lexdump.c78
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/step2vpl.cpp456
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/stepdump.cpp282
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/treeidxutil.cpp171
-rw-r--r--.pc/12_fix_compiler_warnings.diff/utilities/vpl2mod.cpp290
-rw-r--r--.pc/applied-patches5
-rw-r--r--.pc/dso-missing-shared.patch/CMakeLists.txt281
-rw-r--r--.pc/multiarch-clucene.patch/cmake/FindCLucene.cmake122
-rw-r--r--.pc/no-included-zconf.h.diff/cmake/sources.cmake421
-rw-r--r--CMakeLists.txt87
-rw-r--r--ChangeLog56
-rw-r--r--Makefile.am23
-rw-r--r--Makefile.in24
-rw-r--r--aclocal.m415
-rwxr-xr-xarminst.sh2
-rw-r--r--bindings/Android/Makefile14
-rw-r--r--bindings/Android/README25
-rw-r--r--bindings/Android/SWORD/.gitignore9
-rw-r--r--bindings/Android/SWORD/.idea/codeStyleSettings.xml228
-rw-r--r--bindings/Android/SWORD/.idea/compiler.xml22
-rw-r--r--bindings/Android/SWORD/.idea/copyright/profiles_settings.xml3
-rw-r--r--bindings/Android/SWORD/.idea/gradle.xml18
-rw-r--r--bindings/Android/SWORD/.idea/misc.xml52
-rw-r--r--bindings/Android/SWORD/.idea/modules.xml9
-rw-r--r--bindings/Android/SWORD/.idea/runConfigurations.xml12
-rw-r--r--bindings/Android/SWORD/.idea/vcs.xml6
-rw-r--r--bindings/Android/SWORD/app/.gitignore1
-rw-r--r--bindings/Android/SWORD/app/CMakeLists.txt221
-rw-r--r--bindings/Android/SWORD/app/build.gradle41
-rw-r--r--bindings/Android/SWORD/app/proguard-rules.pro25
-rw-r--r--bindings/Android/SWORD/app/src/androidTest/java/org/crosswire/sword/ExampleInstrumentedTest.java26
-rw-r--r--bindings/Android/SWORD/app/src/main/AndroidManifest.xml23
l---------bindings/Android/SWORD/app/src/main/cpp/frontend1
l---------bindings/Android/SWORD/app/src/main/cpp/jni1
l---------bindings/Android/SWORD/app/src/main/cpp/keys1
l---------bindings/Android/SWORD/app/src/main/cpp/mgr1
l---------bindings/Android/SWORD/app/src/main/cpp/modules1
l---------bindings/Android/SWORD/app/src/main/cpp/utilfuns1
-rw-r--r--bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/MainActivity.java121
-rw-r--r--bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/NavigationDrawerFragment.java284
-rw-r--r--bindings/Android/SWORD/app/src/main/java/org/crosswire/android/sword/AndroidMgr.java45
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-hdpi/drawer_shadow.9.pngbin0 -> 161 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-hdpi/ic_drawer.pngbin0 -> 2829 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-mdpi/drawer_shadow.9.pngbin0 -> 142 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-mdpi/ic_drawer.pngbin0 -> 2820 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/drawer_shadow.9.pngbin0 -> 174 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/ic_drawer.pngbin0 -> 2836 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.pngbin0 -> 208 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/ic_drawer.pngbin0 -> 202 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/layout/activity_main.xml26
-rw-r--r--bindings/Android/SWORD/app/src/main/res/layout/drawer_main.xml9
-rw-r--r--bindings/Android/SWORD/app/src/main/res/layout/fragment_main.xml16
-rw-r--r--bindings/Android/SWORD/app/src/main/res/menu/global.xml7
-rw-r--r--bindings/Android/SWORD/app/src/main/res/menu/main.xml13
-rw-r--r--bindings/Android/SWORD/app/src/main/res/menu/menu_swordtest.xml7
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 3418 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher_round.pngbin0 -> 4208 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2206 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher_round.pngbin0 -> 2555 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4842 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.pngbin0 -> 6114 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 7718 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.pngbin0 -> 10056 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.pngbin0 -> 10486 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.pngbin0 -> 14696 bytes
-rw-r--r--bindings/Android/SWORD/app/src/main/res/values-w820dp/dimens.xml6
-rw-r--r--bindings/Android/SWORD/app/src/main/res/values/colors.xml6
-rw-r--r--bindings/Android/SWORD/app/src/main/res/values/dimens.xml10
-rw-r--r--bindings/Android/SWORD/app/src/main/res/values/strings.xml14
-rw-r--r--bindings/Android/SWORD/app/src/main/res/values/styles.xml17
-rw-r--r--bindings/Android/SWORD/app/src/test/java/org/crosswire/sword/ExampleUnitTest.java17
-rw-r--r--bindings/Android/SWORD/build.gradle23
-rw-r--r--bindings/Android/SWORD/gradle.properties17
-rw-r--r--bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.jarbin0 -> 53636 bytes
-rw-r--r--bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xbindings/Android/SWORD/gradlew160
-rw-r--r--bindings/Android/SWORD/gradlew.bat90
-rw-r--r--bindings/Android/SWORD/settings.gradle1
-rw-r--r--bindings/corba/omniorbcpp/Makefile2
-rw-r--r--bindings/corba/omniorbcpp/swordorb-impl.cpp7
-rw-r--r--bindings/corba/orbitcpp/webmgr.hpp27
-rw-r--r--bindings/cordova/Makefile10
-rw-r--r--bindings/cordova/README5
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/LICENSE202
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/README.md22
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/RELEASENOTES.md57
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/doc/index.md213
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/package.json28
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml164
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java660
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/blackberry10/index.js69
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/firefoxos/DeviceProxy.js39
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.h30
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.m90
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD-Bridging-Header.h1
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD.swift805
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/tizen/DeviceProxy.js39
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.cpp64
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.h47
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.js34
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/windows8/DeviceProxy.js50
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/src/wp/Device.cs135
-rw-r--r--bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js414
-rw-r--r--bindings/csharp/NativeMethods.cs36
-rw-r--r--bindings/csharp/tests/ManagerTests.cs15
-rw-r--r--bindings/flatapi.cpp414
-rw-r--r--bindings/java-jni/Makefile5
-rw-r--r--bindings/java-jni/README51
-rw-r--r--bindings/java-jni/jni/Android.mk25
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h85
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h141
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h13
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h13
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h191
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h13
-rw-r--r--bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h13
-rw-r--r--bindings/java-jni/jni/swordstub.cpp858
-rw-r--r--bindings/java-jni/jni/webmgr.hpp120
-rw-r--r--bindings/java-jni/src/org/crosswire/android/sword/InstallMgr.java10
-rw-r--r--bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java33
-rw-r--r--bindings/java-jni/src/org/crosswire/android/sword/SWModule.java14
-rw-r--r--bindings/objc/LongRunningTests/Info.plist24
-rw-r--r--bindings/objc/Makefile21
-rw-r--r--bindings/objc/ObjCSword.h3
-rw-r--r--bindings/objc/ObjCSword.xcodeproj/project.pbxproj6193
-rw-r--r--bindings/objc/ObjCSword_preLion.xcodeproj/project.pbxproj1060
-rw-r--r--bindings/objc/README27
-rw-r--r--bindings/objc/SWORDTests/Info.plist22
-rw-r--r--bindings/objc/SWORDTests/SWORDTests.m38
-rwxr-xr-xbindings/objc/TestResources/TestModules/populate.sh2
-rw-r--r--bindings/objc/build_clucene/Makefile25
-rwxr-xr-xbindings/objc/build_clucene/build_mac_clucene.sh158
-rwxr-xr-xbindings/objc/build_sword/build_mac_sword.sh225
-rwxr-xr-xbindings/objc/build_sword/build_ub_mac_swordutils.sh59
-rw-r--r--bindings/objc/build_sword/readme.txt9
-rw-r--r--bindings/objc/dependencies/Makefile39
-rw-r--r--bindings/objc/dependencies/readme.txt4
-rwxr-xr-xbindings/objc/dependencies/retrieve.sh19
-rwxr-xr-xbindings/objc/dependencies/retrieve_iOS.sh6
-rw-r--r--bindings/objc/src/DefaultFilterProvider.h2
-rw-r--r--bindings/objc/src/DefaultFilterProvider.mm2
-rw-r--r--bindings/objc/src/FilterProviderFactory.mm6
-rw-r--r--bindings/objc/src/Notifications.h6
-rw-r--r--bindings/objc/src/SwordBible.h9
-rw-r--r--bindings/objc/src/SwordBible.mm167
-rw-r--r--bindings/objc/src/SwordBibleBook.h15
-rw-r--r--bindings/objc/src/SwordBibleBook.mm28
-rw-r--r--bindings/objc/src/SwordBibleChapter.h4
-rw-r--r--bindings/objc/src/SwordBibleChapter.m6
-rw-r--r--bindings/objc/src/SwordBibleTextEntry.h2
-rw-r--r--bindings/objc/src/SwordBibleTextEntry.m11
-rw-r--r--bindings/objc/src/SwordBook.h2
-rw-r--r--bindings/objc/src/SwordBook.mm35
-rw-r--r--bindings/objc/src/SwordCommentary.h2
-rw-r--r--bindings/objc/src/SwordCommentary.mm6
-rw-r--r--bindings/objc/src/SwordDictionary.mm37
-rw-r--r--bindings/objc/src/SwordFilter.mm23
-rw-r--r--bindings/objc/src/SwordInstallSource.h11
-rw-r--r--bindings/objc/src/SwordInstallSource.mm115
-rwxr-xr-xbindings/objc/src/SwordInstallSourceManager.h39
-rwxr-xr-xbindings/objc/src/SwordInstallSourceManager.mm336
-rw-r--r--bindings/objc/src/SwordKey.mm30
-rw-r--r--bindings/objc/src/SwordListKey.mm33
-rw-r--r--bindings/objc/src/SwordLocaleManager.h5
-rw-r--r--bindings/objc/src/SwordLocaleManager.mm14
-rw-r--r--bindings/objc/src/SwordManager.h29
-rw-r--r--bindings/objc/src/SwordManager.mm343
-rw-r--r--bindings/objc/src/SwordModule+Index.mm5
-rw-r--r--bindings/objc/src/SwordModule.h74
-rw-r--r--bindings/objc/src/SwordModule.mm299
-rw-r--r--bindings/objc/src/SwordModuleTextEntry.h4
-rw-r--r--bindings/objc/src/SwordModuleTextEntry.m11
-rw-r--r--bindings/objc/src/SwordModuleTreeEntry.h4
-rw-r--r--bindings/objc/src/SwordModuleTreeEntry.m9
-rw-r--r--bindings/objc/src/SwordUtil.h19
-rw-r--r--bindings/objc/src/SwordUtil.m75
-rw-r--r--bindings/objc/src/SwordVerseKey.h4
-rw-r--r--bindings/objc/src/SwordVerseKey.mm44
-rw-r--r--bindings/objc/src/SwordVerseManager.h1
-rw-r--r--bindings/objc/src/SwordVerseManager.mm16
-rw-r--r--bindings/objc/src/VerseEnumerator.mm13
-rw-r--r--bindings/objc/src/services/Configuration.m9
-rw-r--r--bindings/objc/src/services/OSXConfiguration.m32
-rw-r--r--bindings/objc/sword/Info.plist24
-rw-r--r--bindings/objc/sword/SWORD.h12
-rw-r--r--bindings/objc/sword/sword.m12
-rw-r--r--bindings/objc/test/SwordBibleTest.swift28
-rw-r--r--bindings/objc/test/SwordInstallSourceManagerTest.m253
-rw-r--r--bindings/objc/test/SwordListKeyTest.h4
-rw-r--r--bindings/objc/test/SwordListKeyTest.m24
-rw-r--r--bindings/objc/test/SwordLocaleManagerTest.swift30
-rw-r--r--bindings/objc/test/SwordManagerTest.h16
-rw-r--r--bindings/objc/test/SwordManagerTest.m84
-rw-r--r--bindings/objc/test/SwordManagerTest.swift67
-rw-r--r--bindings/objc/test/SwordModuleLongRunTest.h4
-rw-r--r--bindings/objc/test/SwordModuleLongRunTest.mm29
-rw-r--r--bindings/objc/test/SwordModuleTest.h11
-rw-r--r--bindings/objc/test/SwordModuleTest.m200
-rw-r--r--bindings/objc/test/TestGlobals.h12
-rw-r--r--bindings/objc/test/Tests-Bridging-Header.h6
-rw-r--r--bindings/objc/test/Tests-Info.plist2
-rw-r--r--bindings/swig/deprecations.i21
-rw-r--r--bindings/swig/package/aclocal.m415
-rwxr-xr-xbindings/swig/package/config.guess151
-rwxr-xr-xbindings/swig/package/config.sub30
-rwxr-xr-xbindings/swig/package/configure14
-rw-r--r--bindings/swig/package/configure.ac2
-rw-r--r--bindings/swig/package/deprecations.i21
-rw-r--r--bindings/swig/package/m4/libtool.m412
-rwxr-xr-xbindings/swig/package/rendercallback.h6
-rw-r--r--bindings/swig/package/swconfig.i8
-rw-r--r--bindings/swig/package/sword.i4
-rw-r--r--bindings/swig/python/CMakeLists.txt8
-rwxr-xr-xbindings/swig/rendercallback.h6
-rw-r--r--bindings/swig/swconfig.i8
-rw-r--r--bindings/swig/sword.i4
-rw-r--r--bindings/swig/vstudio/SwigSword.csproj184
-rw-r--r--bindings/swig/vstudio/libsword-csharpbindings.sln72
-rw-r--r--bindings/swig/vstudio/libsword_csharpsword.vcproj1932
-rwxr-xr-xbindings/usrinst.sh2
-rw-r--r--cmake/CppcheckTargets.cmake231
-rw-r--r--cmake/FindBZIP2.cmake28
-rw-r--r--cmake/FindCLucene.cmake2
-rw-r--r--cmake/FindICU.cmake17
-rw-r--r--cmake/FindXZ.cmake28
-rw-r--r--cmake/Findcppcheck.cmake167
-rw-r--r--cmake/Findcppcheck.cpp16
-rw-r--r--cmake/install.cmake31
-rw-r--r--cmake/muxsources.cmake30
-rw-r--r--cmake/options.cmake44
-rw-r--r--cmake/sources.cmake73
-rwxr-xr-xconfig.guess151
-rwxr-xr-xconfig.sub30
-rwxr-xr-xconfigure549
-rw-r--r--configure.ac179
-rw-r--r--debian/changelog227
-rw-r--r--debian/compat2
-rw-r--r--debian/control39
-rw-r--r--debian/copyright45
-rw-r--r--debian/libsword-1.8.1.docs (renamed from debian/libsword11.docs)0
-rw-r--r--debian/libsword-1.8.1.install1
-rw-r--r--debian/libsword-common.install2
-rw-r--r--debian/libsword-common.lintian-overrides2
-rw-r--r--debian/libsword-dev.install5
-rw-r--r--debian/libsword-dev.links1
-rw-r--r--debian/libsword-utils.install4
-rw-r--r--debian/libsword-utils.manpages6
-rw-r--r--debian/libsword11.install1
-rw-r--r--debian/man/addld.1.pod2
-rw-r--r--debian/man/emptyvss.1.pod36
-rw-r--r--debian/man/osis2mod.1.pod2
-rw-r--r--debian/man/vpl2mod.1.pod2
-rw-r--r--debian/not-installed2
-rw-r--r--debian/patches/0001-13-curl.diff (renamed from debian/patches/13_curl.diff)16
-rw-r--r--debian/patches/0002-abicompare.patch93
-rw-r--r--debian/patches/0003-use-PKG_PROG_PKG_CONFIG-cross-compilation.patch21
-rw-r--r--debian/patches/0005-untgz-sprintf.patch33
-rw-r--r--debian/patches/0006-powerpc64.patch22
-rw-r--r--debian/patches/0007-gbfwordjs.patch15
-rw-r--r--debian/patches/12_fix_compiler_warnings.diff1083
-rw-r--r--debian/patches/16_gcc4.6_sword.patch339
-rw-r--r--debian/patches/2631_fix_curl.patch30
-rw-r--r--debian/patches/2661.patch102
-rw-r--r--debian/patches/cmake_backport.patch508
-rw-r--r--debian/patches/dso-missing-shared.patch15
-rw-r--r--debian/patches/fix-ftbfs-gcc4.7.diff25
-rw-r--r--debian/patches/fix-ftbfs-icu.patch17
-rw-r--r--debian/patches/icu_in_soname.patch24
-rw-r--r--debian/patches/multiarch-clucene.patch13
-rw-r--r--debian/patches/no-included-zconf.h.diff292
-rw-r--r--debian/patches/series18
-rw-r--r--debian/python-sword.install1
-rwxr-xr-xdebian/rules50
-rw-r--r--debian/watch2
-rw-r--r--doc/Doxyfile4
-rwxr-xr-xdoc/QUICKSTART.ubuntu2
-rw-r--r--examples/Makefile.in2
-rw-r--r--examples/classes/Makefile2
-rw-r--r--examples/classes/flatapiinstallmgr.cpp48
-rw-r--r--examples/classes/flatapilookup.c2
-rw-r--r--examples/classes/flatapiparsekey.c2
-rw-r--r--examples/classes/flatapisearch.c2
-rw-r--r--examples/classes/simplechapter.cpp2
-rw-r--r--examples/classes/versenorm.cpp72
-rw-r--r--examples/cmdline/CMakeLists.txt1
-rw-r--r--examples/cmdline/Makefile.am3
-rw-r--r--examples/cmdline/Makefile.in20
-rw-r--r--examples/cmdline/bcppmake/cmdline.bpg162
-rw-r--r--examples/cmdline/bcppmake/listoptions.bpf20
-rw-r--r--examples/cmdline/bcppmake/listoptions.bpr192
-rw-r--r--examples/cmdline/bcppmake/lookup.bpf20
-rw-r--r--examples/cmdline/bcppmake/lookup.bpr192
-rw-r--r--examples/cmdline/bcppmake/outplain.bpf20
-rw-r--r--examples/cmdline/bcppmake/outplain.bpr192
-rw-r--r--examples/cmdline/bcppmake/outrender.bpf20
-rw-r--r--examples/cmdline/bcppmake/outrender.bpr192
-rw-r--r--examples/cmdline/bcppmake/search.bpf22
-rw-r--r--examples/cmdline/bcppmake/search.bpr192
-rw-r--r--examples/cmdline/bcppmake/threaded_search.bpf20
-rw-r--r--examples/cmdline/bcppmake/threaded_search.bpr192
-rw-r--r--examples/cmdline/bcppmake/verserangeparse.bpf20
-rw-r--r--examples/cmdline/bcppmake/verserangeparse.bpr192
-rw-r--r--examples/cmdline/lookup.cpp16
-rw-r--r--examples/cmdline/search.cpp51
-rw-r--r--examples/cmdline/stripaccents.cpp80
-rw-r--r--examples/tasks/CMakeLists.txt2
-rw-r--r--examples/tasks/Makefile.am5
-rw-r--r--examples/tasks/Makefile.in39
-rw-r--r--examples/tasks/listbiblebooknames.cpp57
-rw-r--r--examples/tasks/parallelbibles.cpp69
-rw-r--r--examples/tasks/simpleverselookup.cpp (renamed from examples/simple.cpp)19
-rw-r--r--include/Makefile.am17
-rw-r--r--include/bz2comprs.h2
-rw-r--r--include/canon_abbrevs.h2
-rw-r--r--include/canon_calvin.h395
-rw-r--r--include/canon_darbyfr.h311
-rw-r--r--include/canon_nrsv.h8
-rw-r--r--include/canon_segond.h390
-rw-r--r--include/canon_synodal.h195
-rw-r--r--include/canon_vulg.h284
-rw-r--r--include/config.h.in9
-rw-r--r--include/defs.h4
-rw-r--r--include/encfiltmgr.h19
-rw-r--r--include/femain.h5
-rw-r--r--include/filemgr.h121
-rw-r--r--include/flatapi.h90
-rw-r--r--include/gbflatex.h52
-rw-r--r--include/gbfredletterwords.h4
-rw-r--r--include/hebrewmcim.h4
-rw-r--r--include/installmgr.h9
-rw-r--r--include/listkey.h7
-rw-r--r--include/osishtmlhref.h4
-rw-r--r--include/osislatex.h77
-rw-r--r--include/osisplain.h3
-rw-r--r--include/osisreferencelinks.h2
-rw-r--r--include/osiswebif.h3
-rw-r--r--include/osisxhtml.h8
-rw-r--r--include/rawstr.h2
-rw-r--r--include/rawstr4.h2
-rw-r--r--include/rawverse.h2
-rw-r--r--include/rawverse4.h2
-rw-r--r--include/remotetrans.h13
-rw-r--r--include/rtranspgdrive.h45
-rw-r--r--include/sapphire.h5
-rw-r--r--include/scsuutf8.h28
-rw-r--r--include/swbasicfilter.h6
-rw-r--r--include/swbuf.h65
-rw-r--r--include/swcomprs.h9
-rw-r--r--include/swconfig.h125
-rw-r--r--include/swkey.h3
-rw-r--r--include/swld.h2
-rw-r--r--include/swmgr.h326
-rw-r--r--include/swmodule.h67
-rw-r--r--include/swobject.h2
-rw-r--r--include/swoptfilter.h4
-rw-r--r--include/swversion.h8
-rw-r--r--include/sysdata.h10
-rw-r--r--include/teihtmlhref.h4
-rw-r--r--include/teilatex.h57
-rw-r--r--include/teirtf.h4
-rw-r--r--include/teixhtml.h5
-rw-r--r--include/thmlhtml.h6
-rw-r--r--include/thmlhtmlhref.h6
-rw-r--r--include/thmllatex.h60
-rw-r--r--include/thmlrtf.h6
-rw-r--r--include/thmlxhtml.h6
-rw-r--r--include/utf8nfc.h2
-rw-r--r--include/utf8scsu.h49
-rw-r--r--include/utilstr.h189
-rw-r--r--include/versekey.h13
-rw-r--r--include/versificationmgr.h7
-rw-r--r--include/xzcomprs.h6
-rw-r--r--include/zcom.h1
-rw-r--r--include/zcom4.h78
-rw-r--r--include/zconf.h (renamed from .pc/no-included-zconf.h.diff/include/zconf.h)0
-rw-r--r--include/ztext.h2
-rw-r--r--include/ztext4.h90
-rw-r--r--include/zverse.h4
-rw-r--r--include/zverse4.h77
-rw-r--r--lib/Makefile.in419
-rw-r--r--lib/bcppmake/libsword.bdsproj1378
-rw-r--r--lib/bcppmake/libsword.bpf10
-rw-r--r--lib/bcppmake/libsword.bpr145
-rw-r--r--lib/vcppmake/libsword.sln40
-rw-r--r--lib/vcppmake/libsword.vcxproj977
-rw-r--r--locales.d/be-utf8.conf185
-rw-r--r--locales.d/fr-utf8.conf882
-rw-r--r--locales.d/fr.conf884
-rw-r--r--locales.d/fr_abbrev-utf8.conf552
-rw-r--r--locales.d/fr_abbrev.conf566
-rw-r--r--locales.d/kpg-utf8.conf158
-rw-r--r--locales.d/lt-utf8.conf71
-rw-r--r--locales.d/lv-utf8.conf315
-rw-r--r--locales.d/pt-utf8.conf87
-rw-r--r--locales.d/ro-utf8.conf205
-rw-r--r--locales.d/tr-utf8.conf163
-rw-r--r--locales.d/zh_CN-utf8.conf76
-rw-r--r--m4/libtool.m412
-rwxr-xr-xscripts/eligible2
-rwxr-xr-xscripts/merge9
-rwxr-xr-xscripts/mkswordtar7
-rw-r--r--src/keys/treekeyidx.cpp75
-rw-r--r--src/keys/versekey.cpp119
-rw-r--r--src/keys/versetreekey.cpp4
-rw-r--r--src/mgr/Makefile.am3
-rw-r--r--src/mgr/curlftpt.cpp8
-rw-r--r--src/mgr/curlhttpt.cpp14
-rw-r--r--src/mgr/encfiltmgr.cpp21
-rw-r--r--src/mgr/filemgr.cpp57
-rw-r--r--src/mgr/ftplibftpt.cpp10
-rw-r--r--src/mgr/installmgr.cpp60
-rw-r--r--src/mgr/localemgr.cpp6
-rw-r--r--src/mgr/markupfiltmgr.cpp16
-rw-r--r--src/mgr/remotetrans.cpp77
-rw-r--r--src/mgr/rtranspgdrive.cpp (renamed from .pc/13_curl.diff/src/mgr/curlftpt.cpp)72
-rw-r--r--src/mgr/stringmgr.cpp4
-rw-r--r--src/mgr/swconfig.cpp77
-rw-r--r--src/mgr/swlocale.cpp24
-rw-r--r--src/mgr/swmgr.cpp380
-rw-r--r--src/mgr/versificationmgr.cpp191
-rw-r--r--src/modules/comments/Makefile.am1
-rw-r--r--src/modules/comments/rawcom4/Makefile10
-rw-r--r--src/modules/comments/rawcom4/rawcom4.cpp4
-rw-r--r--src/modules/comments/zcom/zcom.cpp2
-rw-r--r--src/modules/comments/zcom4/Makefile5
-rw-r--r--src/modules/comments/zcom4/Makefile.am2
-rw-r--r--src/modules/comments/zcom4/zcom4.cpp220
-rw-r--r--src/modules/common/Makefile.am18
-rw-r--r--src/modules/common/bz2comprs.cpp57
-rw-r--r--src/modules/common/entriesblk.cpp6
-rw-r--r--src/modules/common/rawstr.cpp32
-rw-r--r--src/modules/common/rawstr4.cpp36
-rw-r--r--src/modules/common/rawverse.cpp4
-rw-r--r--src/modules/common/rawverse4.cpp6
-rw-r--r--src/modules/common/swcomprs.cpp3
-rw-r--r--src/modules/common/xzcomprs.cpp130
-rw-r--r--src/modules/common/zipcomprs.cpp34
-rw-r--r--src/modules/common/zstr.cpp42
-rw-r--r--src/modules/common/zverse.cpp19
-rw-r--r--src/modules/common/zverse4.cpp516
-rw-r--r--src/modules/filters/Makefile.am5
-rw-r--r--src/modules/filters/gbfheadings.cpp8
-rw-r--r--src/modules/filters/gbfhtmlhref.cpp12
-rw-r--r--src/modules/filters/gbflatex.cpp198
-rw-r--r--src/modules/filters/gbfmorph.cpp8
-rw-r--r--src/modules/filters/gbfplain.cpp6
-rw-r--r--src/modules/filters/gbfredletterwords.cpp7
-rw-r--r--src/modules/filters/gbfrtf.cpp6
-rw-r--r--src/modules/filters/gbfstrongs.cpp16
-rw-r--r--src/modules/filters/gbfthml.cpp13
-rw-r--r--src/modules/filters/gbfwordjs.cpp20
-rw-r--r--src/modules/filters/gbfxhtml.cpp12
-rw-r--r--src/modules/filters/greeklexattribs.cpp4
-rw-r--r--src/modules/filters/osisheadings.cpp11
-rw-r--r--src/modules/filters/osishtmlhref.cpp31
-rw-r--r--src/modules/filters/osislatex.cpp766
-rw-r--r--src/modules/filters/osislemma.cpp12
-rw-r--r--src/modules/filters/osismorph.cpp7
-rw-r--r--src/modules/filters/osismorphsegmentation.cpp2
-rw-r--r--src/modules/filters/osisosis.cpp53
-rw-r--r--src/modules/filters/osisplain.cpp58
-rw-r--r--src/modules/filters/osisreferencelinks.cpp2
-rw-r--r--src/modules/filters/osisrtf.cpp21
-rw-r--r--src/modules/filters/osisscripref.cpp2
-rw-r--r--src/modules/filters/osisstrongs.cpp55
-rw-r--r--src/modules/filters/osiswebif.cpp21
-rw-r--r--src/modules/filters/osiswordjs.cpp11
-rw-r--r--src/modules/filters/osisxhtml.cpp273
-rw-r--r--src/modules/filters/rtfhtml.cpp4
-rw-r--r--src/modules/filters/scsuutf8.cpp381
-rw-r--r--src/modules/filters/swbasicfilter.cpp20
-rw-r--r--src/modules/filters/teihtmlhref.cpp56
-rw-r--r--src/modules/filters/teilatex.cpp326
-rw-r--r--src/modules/filters/teirtf.cpp30
-rw-r--r--src/modules/filters/teixhtml.cpp149
-rw-r--r--src/modules/filters/thmlgbf.cpp6
-rw-r--r--src/modules/filters/thmlheadings.cpp2
-rw-r--r--src/modules/filters/thmlhtml.cpp10
-rw-r--r--src/modules/filters/thmlhtmlhref.cpp39
-rw-r--r--src/modules/filters/thmllatex.cpp396
-rw-r--r--src/modules/filters/thmlplain.cpp10
-rw-r--r--src/modules/filters/thmlrtf.cpp37
-rw-r--r--src/modules/filters/thmlscripref.cpp2
-rw-r--r--src/modules/filters/thmlstrongs.cpp16
-rw-r--r--src/modules/filters/thmlwordjs.cpp18
-rw-r--r--src/modules/filters/thmlxhtml.cpp41
-rw-r--r--src/modules/filters/unicodertf.cpp2
-rw-r--r--src/modules/filters/utf16utf8.cpp2
-rw-r--r--src/modules/filters/utf8arabicpoints.cpp4
-rw-r--r--src/modules/filters/utf8greekaccents.cpp521
-rw-r--r--src/modules/filters/utf8html.cpp2
-rw-r--r--src/modules/filters/utf8latin1.cpp2
-rw-r--r--src/modules/filters/utf8nfc.cpp2
-rw-r--r--src/modules/filters/utf8nfkd.cpp2
-rw-r--r--src/modules/filters/utf8scsu.cpp61
-rw-r--r--src/modules/filters/utf8utf16.cpp2
-rw-r--r--src/modules/genbook/rawgenbook/rawgenbook.cpp6
-rw-r--r--src/modules/lexdict/rawld/rawld.cpp31
-rw-r--r--src/modules/lexdict/rawld4/rawld4.cpp35
-rw-r--r--src/modules/lexdict/swld.cpp6
-rw-r--r--src/modules/lexdict/zld/zld.cpp33
-rw-r--r--src/modules/swmodule.cpp218
-rw-r--r--src/modules/texts/Makefile.am1
-rw-r--r--src/modules/texts/rawtext4/Makefile10
-rw-r--r--src/modules/texts/rawtext4/rawtext4.cpp5
-rw-r--r--src/modules/texts/ztext4/Makefile5
-rw-r--r--src/modules/texts/ztext4/Makefile.am2
-rw-r--r--src/modules/texts/ztext4/ztext4.cpp223
-rw-r--r--src/utilfuns/ftplib.c20
-rw-r--r--src/utilfuns/roman.cpp4
-rw-r--r--src/utilfuns/swbuf.cpp63
-rw-r--r--src/utilfuns/url.cpp8
-rw-r--r--src/utilfuns/utilstr.cpp193
-rw-r--r--src/utilfuns/utilxml.cpp24
-rw-r--r--src/utilfuns/zlib/untgz.c17
-rw-r--r--sword.pc.in4
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/Makefile.am9
-rw-r--r--tests/Makefile.in63
-rw-r--r--tests/configtest.cpp4
-rw-r--r--tests/cppunit/Makefile.in2
-rw-r--r--tests/ldtest.cpp32
-rw-r--r--tests/localetest.cpp2
-rw-r--r--tests/osistest.cpp5
-rw-r--r--tests/testblocks.cpp54
-rw-r--r--tests/testsuite/CMakeLists.txt8
-rw-r--r--tests/testsuite/Makefile.am16
-rw-r--r--tests/testsuite/Makefile.in480
-rw-r--r--tests/testsuite/README24
-rw-r--r--tests/testsuite/UTF-8-test.txt300
-rw-r--r--tests/testsuite/gbsReference.imp42
-rw-r--r--tests/testsuite/gbs_basic.good66
-rwxr-xr-xtests/testsuite/gbs_basic.sh30
-rw-r--r--tests/testsuite/greekaccents.good7
-rwxr-xr-xtests/testsuite/greekaccents.sh8
-rw-r--r--tests/testsuite/greekaccents.txt7
-rw-r--r--tests/testsuite/ldr12n.good24
-rw-r--r--tests/testsuite/ldr12n.imp12
-rwxr-xr-xtests/testsuite/ldr12n.sh31
-rwxr-xr-xtests/testsuite/listtest.sh2
-rw-r--r--tests/testsuite/osis.good106
-rwxr-xr-xtests/testsuite/osis.sh26
-rw-r--r--tests/testsuite/osisReference.xml15
-rw-r--r--tests/testsuite/osis_basic.good186
-rwxr-xr-xtests/testsuite/osis_basic.sh35
-rw-r--r--tests/testsuite/osis_mod2zmod.good186
-rwxr-xr-xtests/testsuite/osis_mod2zmod.sh60
-rw-r--r--tests/testsuite/osis_osis2modcipher.good186
-rwxr-xr-xtests/testsuite/osis_osis2modcipher.sh37
-rwxr-xr-xtests/testsuite/runall.sh2
-rwxr-xr-xtests/testsuite/runtest.sh2
-rw-r--r--tests/testsuite/utf8basic.good300
-rwxr-xr-xtests/testsuite/utf8basic.sh10
-rw-r--r--tests/testsuite/versekeytest.good10
-rwxr-xr-xtests/testsuite/versekeytest.sh2
-rwxr-xr-xtests/testsuite/versemgrtest.sh2
-rwxr-xr-xtests/testsuite/verseparsing-utf8.sh2
-rwxr-xr-xtests/testsuite/verseparsing.sh2
-rw-r--r--tests/testsuite/vs2osisref.good2
-rwxr-xr-xtests/testsuite/vs2osisref.sh22
-rwxr-xr-xtests/testsuite/xmltag.sh2
-rw-r--r--tests/utf8norm.cpp54
-rw-r--r--tests/versekeytest.cpp16
-rwxr-xr-xusrinst.sh22
-rw-r--r--utilities/CMakeLists.txt42
-rw-r--r--utilities/Makefile.am11
-rw-r--r--utilities/Makefile.in64
-rw-r--r--utilities/addcomment.cpp2
-rw-r--r--utilities/addgb.cpp2
-rw-r--r--utilities/addld.cpp6
-rw-r--r--utilities/addvs.cpp2
-rw-r--r--utilities/bcpp6make/cipherraw.bpf4
-rw-r--r--utilities/bcpp6make/cipherraw.bpr288
-rw-r--r--utilities/bcpp6make/diatheke.bpf10
-rw-r--r--utilities/bcpp6make/diatheke.bpr316
-rw-r--r--utilities/bcpp6make/imp2gbs.bpf4
-rw-r--r--utilities/bcpp6make/imp2gbs.bpr288
-rw-r--r--utilities/bcpp6make/imp2ld.bpf4
-rw-r--r--utilities/bcpp6make/imp2ld.bpr288
-rw-r--r--utilities/bcpp6make/imp2vs.bpf4
-rw-r--r--utilities/bcpp6make/imp2vs.bpr288
-rw-r--r--utilities/bcpp6make/mkfastmod.bpf4
-rw-r--r--utilities/bcpp6make/mkfastmod.bpr288
-rw-r--r--utilities/bcpp6make/mod2imp.bpf4
-rw-r--r--utilities/bcpp6make/mod2imp.bpr288
-rw-r--r--utilities/bcpp6make/mod2osis.bpf4
-rw-r--r--utilities/bcpp6make/mod2osis.bpr288
-rw-r--r--utilities/bcpp6make/mod2vpl.bpf4
-rw-r--r--utilities/bcpp6make/mod2vpl.bpr288
-rw-r--r--utilities/bcpp6make/mod2zmod.bpf10
-rw-r--r--utilities/bcpp6make/mod2zmod.bpr288
-rw-r--r--utilities/bcpp6make/osis2mod.bpf10
-rw-r--r--utilities/bcpp6make/osis2mod.bpr290
-rw-r--r--utilities/bcpp6make/step2vpl.bpf10
-rw-r--r--utilities/bcpp6make/step2vpl.bpr288
-rw-r--r--utilities/bcpp6make/stepdump.bpf10
-rw-r--r--utilities/bcpp6make/stepdump.bpr288
-rw-r--r--utilities/bcpp6make/utils.bpg178
-rw-r--r--utilities/bcpp6make/vpl2mod.bpf10
-rw-r--r--utilities/bcpp6make/vpl2mod.bpr288
-rw-r--r--utilities/bcpp6make/vs2osisref.bpf10
-rw-r--r--utilities/bcpp6make/vs2osisref.bpr288
-rw-r--r--utilities/bcpp6make/xml2gbs.bpf10
-rw-r--r--utilities/bcpp6make/xml2gbs.bpr288
-rw-r--r--utilities/bcppmake/addgb.bpf20
-rw-r--r--utilities/bcppmake/addgb.bpr250
-rw-r--r--utilities/bcppmake/addld.bpf20
-rw-r--r--utilities/bcppmake/addld.bpr250
-rw-r--r--utilities/bcppmake/addvs.bpf20
-rw-r--r--utilities/bcppmake/addvs.bpr250
-rw-r--r--utilities/bcppmake/cipherraw.bdsproj644
-rw-r--r--utilities/bcppmake/diatheke.bdsproj612
-rw-r--r--utilities/bcppmake/imp2gbs.bdsproj646
-rw-r--r--utilities/bcppmake/imp2ld.bdsproj628
-rw-r--r--utilities/bcppmake/imp2vs.bdsproj628
-rw-r--r--utilities/bcppmake/installmgr.bdsproj654
-rw-r--r--utilities/bcppmake/installmgr.bpf22
-rw-r--r--utilities/bcppmake/installmgr.bpr246
-rw-r--r--utilities/bcppmake/mkfastmod.bdsproj640
-rw-r--r--utilities/bcppmake/mod2imp.bdsproj622
-rw-r--r--utilities/bcppmake/mod2osis.bdsproj592
-rw-r--r--utilities/bcppmake/mod2vpl.bdsproj622
-rw-r--r--utilities/bcppmake/mod2zmod.bdsproj636
-rw-r--r--utilities/bcppmake/osis2mod.bdsproj612
-rw-r--r--utilities/bcppmake/step2vpl.bdsproj622
-rw-r--r--utilities/bcppmake/stepdump.bdsproj622
-rw-r--r--utilities/bcppmake/tei2mod.bpf20
-rw-r--r--utilities/bcppmake/tei2mod.bpr244
-rw-r--r--utilities/bcppmake/treeidxutil.bpf20
-rw-r--r--utilities/bcppmake/treeidxutil.bpr242
-rw-r--r--utilities/bcppmake/utilities.bdsgroup80
-rw-r--r--utilities/bcppmake/vpl2mod.bdsproj622
-rw-r--r--utilities/bcppmake/vs2osisref.bdsproj592
-rw-r--r--utilities/bcppmake/vs2osisreftxt.bpf20
-rw-r--r--utilities/bcppmake/vs2osisreftxt.bpr242
-rw-r--r--utilities/bcppmake/xml2gbs.bdsproj638
-rw-r--r--utilities/cipherraw.cpp145
-rw-r--r--utilities/diatheke/CMakeLists.txt24
-rw-r--r--utilities/diatheke/Makefile.in2
-rw-r--r--utilities/diatheke/README9
-rw-r--r--utilities/diatheke/corediatheke.cpp533
-rw-r--r--utilities/diatheke/corediatheke.h4
-rw-r--r--utilities/diatheke/diafiltmgr.cpp201
-rw-r--r--utilities/diatheke/diafiltmgr.h4
-rw-r--r--utilities/diatheke/diatheke.cpp155
-rw-r--r--utilities/diatheke/diatheke.sln40
-rw-r--r--utilities/diatheke/diatheke.vcxproj396
-rw-r--r--utilities/diatheke/diathekemgr.cpp18
-rw-r--r--utilities/diatheke/diathekemgr.h8
-rw-r--r--utilities/diatheke/tcl/README106
-rw-r--r--utilities/diatheke/thmlcgi.cpp7
-rw-r--r--utilities/emptyvss.cpp12
-rw-r--r--utilities/gbfidx.cpp73
-rw-r--r--utilities/genbookutil.cpp44
-rw-r--r--utilities/imp2gbs.cpp12
-rw-r--r--utilities/imp2ld.cpp74
-rw-r--r--utilities/imp2vs.cpp117
-rw-r--r--utilities/installmgr.cpp102
-rw-r--r--utilities/lexdump.c14
-rw-r--r--utilities/mkfastmod.cpp2
-rw-r--r--utilities/mod2imp.cpp9
-rw-r--r--utilities/mod2osis.cpp4
-rw-r--r--utilities/mod2vpl.cpp2
-rw-r--r--utilities/mod2zmod.cpp40
-rw-r--r--utilities/modwrite.cpp2
-rw-r--r--utilities/osis2mod.cpp548
-rw-r--r--utilities/step2vpl.cpp250
-rw-r--r--utilities/stepdump.cpp113
-rw-r--r--utilities/stripaccents.cpp79
-rw-r--r--utilities/tei2mod.cpp60
-rw-r--r--utilities/treeidxutil.cpp32
-rw-r--r--utilities/vcppmake/addgb.vcxproj232
-rw-r--r--utilities/vcppmake/addld.vcxproj232
-rw-r--r--utilities/vcppmake/addvs.vcxproj232
-rw-r--r--utilities/vcppmake/cipherraw.vcxproj232
-rw-r--r--utilities/vcppmake/emptyvss.vcxproj232
-rw-r--r--utilities/vcppmake/genbookutil.vcxproj232
-rw-r--r--utilities/vcppmake/imp2gbs.vcxproj232
-rw-r--r--utilities/vcppmake/imp2ld.vcxproj232
-rw-r--r--utilities/vcppmake/imp2vs.vcxproj232
-rw-r--r--utilities/vcppmake/installmgr.vcxproj232
-rw-r--r--utilities/vcppmake/lexdump.vcxproj232
-rw-r--r--utilities/vcppmake/mkfastmod.vcxproj232
-rw-r--r--utilities/vcppmake/mod2imp.vcxproj232
-rw-r--r--utilities/vcppmake/mod2osis.vcxproj232
-rw-r--r--utilities/vcppmake/mod2vpl.vcxproj232
-rw-r--r--utilities/vcppmake/mod2zmod.vcxproj230
-rw-r--r--utilities/vcppmake/modwrite.vcxproj232
-rw-r--r--utilities/vcppmake/osis2mod.vcxproj244
-rw-r--r--utilities/vcppmake/step2vpl.vcxproj232
-rw-r--r--utilities/vcppmake/stepdump.vcxproj232
-rw-r--r--utilities/vcppmake/tei2mod.vcxproj232
-rw-r--r--utilities/vcppmake/treeidxutil.vcxproj232
-rw-r--r--utilities/vcppmake/utilities.sln448
-rw-r--r--utilities/vcppmake/vpl2mod.vcxproj232
-rw-r--r--utilities/vcppmake/vs2osisref.vcxproj232
-rw-r--r--utilities/vcppmake/vs2osisreftxt.vcxproj232
-rw-r--r--utilities/vcppmake/xml2gbs.vcxproj232
-rw-r--r--utilities/vpl2mod.cpp12
-rw-r--r--utilities/vs2osisref.cpp2
-rw-r--r--utilities/vs2osisreftxt.cpp2
-rw-r--r--utilities/xml2gbs.cpp2
712 files changed, 46863 insertions, 32080 deletions
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
deleted file mode 100644
index 6857a8d..0000000
--- a/.pc/.quilt_patches
+++ /dev/null
@@ -1 +0,0 @@
-debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
deleted file mode 100644
index c206706..0000000
--- a/.pc/.quilt_series
+++ /dev/null
@@ -1 +0,0 @@
-series
diff --git a/.pc/.version b/.pc/.version
deleted file mode 100644
index 0cfbf08..0000000
--- a/.pc/.version
+++ /dev/null
@@ -1 +0,0 @@
-2
diff --git a/.pc/12_fix_compiler_warnings.diff/src/mgr/filemgr.cpp b/.pc/12_fix_compiler_warnings.diff/src/mgr/filemgr.cpp
deleted file mode 100644
index d801aaa..0000000
--- a/.pc/12_fix_compiler_warnings.diff/src/mgr/filemgr.cpp
+++ /dev/null
@@ -1,585 +0,0 @@
-/******************************************************************************
- *
- * filemgr.cpp - implementation of class FileMgr used for pooling file
- * handles
- *
- * $Id: filemgr.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 1998-2013 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.
- *
- */
-
-#include <filemgr.h>
-#include <utilstr.h>
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <swbuf.h>
-#if !defined(__GNUC__) && !defined(_WIN32_WCE)
-#include <io.h>
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#ifndef S_IRGRP
-#define S_IRGRP 0
-#endif
-
-#ifndef S_IROTH
-#define S_IROTH 0
-#endif
-
-// Fix for VC6
-#ifndef S_IREAD
-#ifdef _S_IREAD
-#define S_IREAD _S_IREAD
-#define S_IWRITE _S_IWRITE
-#endif
-#endif
-// -----------
-
-// ------- if we still don't have something
-#ifndef S_IREAD
-#define S_IREAD 0400
-#endif
-#ifndef S_IWRITE
-#define S_IWRITE 0200
-#endif
-// -------
-
-
-SWORD_NAMESPACE_START
-
-
-int FileMgr::CREAT = O_CREAT;
-int FileMgr::APPEND = O_APPEND;
-int FileMgr::TRUNC = O_TRUNC;
-int FileMgr::RDONLY = O_RDONLY;
-int FileMgr::RDWR = O_RDWR;
-int FileMgr::WRONLY = O_WRONLY;
-int FileMgr::IREAD = S_IREAD;
-int FileMgr::IWRITE = S_IWRITE;
-
-
-// ---------------- statics -----------------
-FileMgr *FileMgr::systemFileMgr = 0;
-
-class __staticsystemFileMgr {
-public:
- __staticsystemFileMgr() { }
- ~__staticsystemFileMgr() { delete FileMgr::systemFileMgr; }
-} _staticsystemFileMgr;
-
-
-FileMgr *FileMgr::getSystemFileMgr() {
- if (!systemFileMgr)
- systemFileMgr = new FileMgr();
-
- return systemFileMgr;
-}
-
-
-void FileMgr::setSystemFileMgr(FileMgr *newFileMgr) {
- if (systemFileMgr)
- delete systemFileMgr;
- systemFileMgr = newFileMgr;
-}
-
-// --------------- end statics --------------
-
-
-FileDesc::FileDesc(FileMgr *parent, const char *path, int mode, int perms, bool tryDowngrade) {
- this->parent = parent;
- this->path = 0;
- stdstr(&this->path, path);
- this->mode = mode;
- this->perms = perms;
- this->tryDowngrade = tryDowngrade;
- offset = 0;
- fd = -77;
-}
-
-
-FileDesc::~FileDesc() {
- if (fd > 0)
- close(fd);
-
- if (path)
- delete [] path;
-}
-
-
-int FileDesc::getFd() {
- if (fd == -77)
- fd = parent->sysOpen(this);
-// if ((fd < -1) && (fd != -77)) // kludge to hand ce
-// return 777;
- return fd;
-}
-
-
-long FileDesc::seek(long offset, int whence) {
- return lseek(getFd(), offset, whence);
-}
-
-
-long FileDesc::read(void *buf, long count) {
- return ::read(getFd(), buf, count);
-}
-
-
-long FileDesc::write(const void *buf, long count) {
- return ::write(getFd(), buf, count);
-}
-
-
-FileMgr::FileMgr(int maxFiles) {
- this->maxFiles = maxFiles; // must be at least 2
- files = 0;
-}
-
-
-FileMgr::~FileMgr() {
- FileDesc *tmp;
-
- while(files) {
- tmp = files->next;
- delete files;
- files = tmp;
- }
-}
-
-
-FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
- return open(path, mode, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
-}
-
-
-FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
- FileDesc **tmp, *tmp2;
-
- for (tmp = &files; *tmp; tmp = &((*tmp)->next)) {
- if ((*tmp)->fd < 0) // insert as first non-system_open file
- break;
- }
-
- tmp2 = new FileDesc(this, path, mode, perms, tryDowngrade);
- tmp2->next = *tmp;
- *tmp = tmp2;
-
- return tmp2;
-}
-
-
-void FileMgr::close(FileDesc *file) {
- FileDesc **loop;
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if (*loop == file) {
- *loop = (*loop)->next;
- delete file;
- break;
- }
- }
-}
-
-
-int FileMgr::sysOpen(FileDesc *file) {
- FileDesc **loop;
- int openCount = 1; // because we are presently opening 1 file, and we need to be sure to close files to accomodate, if necessary
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
-
- if ((*loop)->fd > 0) {
- if (++openCount > maxFiles) {
- (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
- ::close((*loop)->fd);
- (*loop)->fd = -77;
- }
- }
-
- if (*loop == file) {
- if (*loop != files) {
- *loop = (*loop)->next;
- file->next = files;
- files = file;
- }
- if ((!access(file->path, 04)) || ((file->mode & O_CREAT) == O_CREAT)) { // check for at least file exists / read access before we try to open
- char tries = (((file->mode & O_RDWR) == O_RDWR) && (file->tryDowngrade)) ? 2 : 1; // try read/write if possible
- for (int i = 0; i < tries; i++) {
- if (i > 0) {
- file->mode = (file->mode & ~O_RDWR); // remove write access
- file->mode = (file->mode | O_RDONLY);// add read access
- }
- file->fd = ::open(file->path, file->mode|O_BINARY, file->perms);
-
- if (file->fd >= 0)
- break;
- }
-
- if (file->fd >= 0)
- lseek(file->fd, file->offset, SEEK_SET);
- }
- else file->fd = -1;
- if (!*loop)
- break;
- }
- }
- return file->fd;
-}
-
-
-// to truncate a file at its current position
-// leaving byte at current possition intact
-// deleting everything afterward.
-signed char FileMgr::trunc(FileDesc *file) {
-
- static const char *writeTest = "x";
- long size = file->seek(1, SEEK_CUR);
- if (size == 1) // was empty
- size = 0;
- char nibble [ 32767 ];
- bool writable = file->write(writeTest, 1);
- int bytes = 0;
-
- if (writable) {
- // get tmpfilename
- char *buf = new char [ strlen(file->path) + 10 ];
- int i;
- for (i = 0; i < 9999; i++) {
- sprintf(buf, "%stmp%.4d", file->path, i);
- if (!existsFile(buf))
- break;
- }
- if (i == 9999)
- return -2;
-
- int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- if (fd < 0)
- return -3;
-
- file->seek(0, SEEK_SET);
- while (size > 0) {
- bytes = file->read(nibble, 32767);
- bytes = (bytes < size)?bytes:size;
- if (write(fd, nibble, bytes) != bytes) { break; }
- size -= bytes;
- }
- if (size < 1) {
- // zero out the file
- ::close(file->fd);
- file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- ::close(file->fd);
- file->fd = -77; // force file open by filemgr
- // copy tmp file back (dumb, but must preserve file permissions)
- lseek(fd, 0, SEEK_SET);
- do {
- bytes = read(fd, nibble, 32767);
- file->write(nibble, bytes);
- } while (bytes == 32767);
- }
-
- ::close(fd);
- ::close(file->fd);
- removeFile(buf); // remove our tmp file
- file->fd = -77; // causes file to be swapped out forcing open on next call to getFd()
- }
- else { // put offset back and return failure
- file->seek(-1, SEEK_CUR);
- return -1;
- }
- return 0;
-}
-
-
-signed char FileMgr::existsFile(const char *ipath, const char *ifileName)
-{
- int len = strlen(ipath) + ((ifileName)?strlen(ifileName):0) + 3;
- char *ch;
- char *path = new char [ len ];
- strcpy(path, ipath);
-
- if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
- path[strlen(path)-1] = 0;
-
- if (ifileName) {
- ch = path + strlen(path);
- sprintf(ch, "/%s", ifileName);
- }
- signed char retVal = !access(path, 04);
- delete [] path;
- return retVal;
-}
-
-
-signed char FileMgr::existsDir(const char *ipath, const char *idirName)
-{
- char *ch;
- int len = strlen(ipath) + ((idirName)?strlen(idirName):0) + 1;
- if (idirName)
- len += strlen(idirName);
- char *path = new char [ len ];
- strcpy(path, ipath);
-
- if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
- path[strlen(path)-1] = 0;
-
- if (idirName) {
- ch = path + strlen(path);
- sprintf(ch, "/%s", idirName);
- }
- signed char retVal = !access(path, 04);
- delete [] path;
- return retVal;
-}
-
-
-int FileMgr::createParent(const char *pName) {
- char *buf = new char [ strlen(pName) + 1 ];
- int retCode = 0;
-
- strcpy(buf, pName);
- int end = strlen(buf) - 1;
- while (end) {
- if ((buf[end] == '/') || (buf[end] == '\\'))
- break;
- end--;
- }
- buf[end] = 0;
- if (strlen(buf)>0) {
- if (access(buf, 02)) { // not exists with write access?
- if ((retCode = mkdir(buf
-#ifndef WIN32
- , 0755
-#endif
- ))) {
- createParent(buf);
- retCode = mkdir(buf
-#ifndef WIN32
- , 0755
-#endif
- );
- }
- }
- }
- else retCode = -1;
- delete [] buf;
- return retCode;
-}
-
-
-int FileMgr::openFileReadOnly(const char *fName) {
- int fd = ::open(fName, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- return fd;
-}
-
-
-int FileMgr::createPathAndFile(const char *fName) {
- int fd;
-
- fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- if (fd < 1) {
- createParent(fName);
- fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- }
- return fd;
-}
-
-
-int FileMgr::copyFile(const char *sourceFile, const char *targetFile) {
- int sfd, dfd, len;
- char buf[4096];
-
- if ((sfd = ::open(sourceFile, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH)) < 1)
- return -1;
- if ((dfd = createPathAndFile(targetFile)) < 1)
- return -1;
-
- do {
- len = read(sfd, buf, 4096);
- if (write(dfd, buf, len) != len) break;
- }
- while(len == 4096);
- ::close(dfd);
- ::close(sfd);
-
- return 0;
-}
-
-
-int FileMgr::removeFile(const char *fName) {
- return ::remove(fName);
-}
-
-char FileMgr::getLine(FileDesc *fDesc, SWBuf &line) {
- int len;
- bool more = true;
- char chunk[255];
-
- line = "";
-
- // assert we have a valid file handle
- if (fDesc->getFd() < 1)
- return 0;
-
- while (more) {
- more = false;
- long index = fDesc->seek(0, SEEK_CUR);
- len = fDesc->read(chunk, 254);
-
- // assert we have a readable file (not a directory)
- if (len < 1)
- break;
-
- int start = 0;
- // clean up any preceding white space if we're at the beginning of line
- if (!line.length()) {
- for (;start < len; start++) {
- if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
- break;
- }
- }
-
- // find the end
- int end;
- for (end = start; ((end < (len-1)) && (chunk[end] != 10)); end++);
-
- if ((chunk[end] != 10) && (len == 254)) {
- more = true;
- }
- index += (end + 1);
-
- // reposition to next valid place to read
- fDesc->seek(index, SEEK_SET);
-
- // clean up any trailing junk on line if we're at the end
- if (!more) {
- for (; end > start; end--) {
- if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
- if (chunk[end] == '\\') {
- more = true;
- end--;
- }
- break;
- }
- }
- }
-
- int size = (end - start) + 1;
-
- if (size > 0) {
- // line.appendFormatted("%.*s", size, chunk+start);
- line.append(chunk+start, size);
- }
- }
- return ((len > 0) || line.length());
-}
-
-
-char FileMgr::isDirectory(const char *path) {
- struct stat stats;
- if (stat(path, &stats))
- return 0;
- return ((stats.st_mode & S_IFDIR) == S_IFDIR);
-}
-
-
-int FileMgr::copyDir(const char *srcDir, const char *destDir) {
- DIR *dir;
- struct dirent *ent;
- if ((dir = opendir(srcDir))) {
- rewinddir(dir);
- while ((ent = readdir(dir))) {
- if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- SWBuf srcPath = (SWBuf)srcDir + (SWBuf)"/" + ent->d_name;
- SWBuf destPath = (SWBuf)destDir + (SWBuf)"/" + ent->d_name;
- if (!isDirectory(srcPath.c_str())) {
- copyFile(srcPath.c_str(), destPath.c_str());
- }
- else {
- copyDir(srcPath.c_str(), destPath.c_str());
- }
- }
- }
- closedir(dir);
- }
- return 0;
-}
-
-
-int FileMgr::removeDir(const char *targetDir) {
- DIR *dir = opendir(targetDir);
- struct dirent *ent;
- if (dir) {
- rewinddir(dir);
- while ((ent = readdir(dir))) {
- if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- SWBuf targetPath = (SWBuf)targetDir + (SWBuf)"/" + ent->d_name;
- if (!isDirectory(targetPath.c_str())) {
- FileMgr::removeFile(targetPath.c_str());
- }
- else {
- FileMgr::removeDir(targetPath.c_str());
- }
- }
- }
- closedir(dir);
- FileMgr::removeFile(targetDir);
-/*
- int status = FileMgr::removeFile(targetDir);
- int stuff = errno;
- char *err = strerror(errno);
- int x = stuff;
-*/
- }
- return 0;
-}
-
-
-void FileMgr::flush() {
- FileDesc **loop;
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if ((*loop)->fd > 0) {
- (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
- ::close((*loop)->fd);
- (*loop)->fd = -77;
- }
- }
-}
-
-long FileMgr::resourceConsumption() {
- long count = 0;
- FileDesc **loop;
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if ((*loop)->fd > 0) {
- count++;
- }
- }
- return count;
-}
-
-
-SWORD_NAMESPACE_END
diff --git a/.pc/12_fix_compiler_warnings.diff/src/utilfuns/zlib/untgz.c b/.pc/12_fix_compiler_warnings.diff/src/utilfuns/zlib/untgz.c
deleted file mode 100644
index a7b7164..0000000
--- a/.pc/12_fix_compiler_warnings.diff/src/utilfuns/zlib/untgz.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * untgz.c -- Display contents and/or extract file from
- * a gzip'd TAR file
- * written by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
- * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include <fcntl.h>
-#ifdef unix
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#else
-# include <direct.h>
-# include <io.h>
-#endif
-
-#include "zlib.h"
-
-#ifdef WIN32
-# include <windows.h>
-# ifndef F_OK
-# define F_OK (0)
-# endif
-# ifdef _MSC_VER
-# define mkdir(dirname,mode) _mkdir(dirname)
-# define strdup(str) _strdup(str)
-# define unlink(fn) _unlink(fn)
-# define access(path,mode) _access(path,mode)
-# else
-# define mkdir(dirname,mode) _mkdir(dirname)
-# endif
-#else
-# include <utime.h>
-#endif
-
-
-/* Values used in typeflag field. */
-
-#define REGTYPE '0' /* regular file */
-#define AREGTYPE '\0' /* regular file */
-#define LNKTYPE '1' /* link */
-#define SYMTYPE '2' /* reserved */
-#define CHRTYPE '3' /* character special */
-#define BLKTYPE '4' /* block special */
-#define DIRTYPE '5' /* directory */
-#define FIFOTYPE '6' /* FIFO special */
-#define CONTTYPE '7' /* reserved */
-
-#define BLOCKSIZE 512
-
-struct tar_header
-{ /* byte offset */
- char name[100]; /* 0 */
- char mode[8]; /* 100 */
- char uid[8]; /* 108 */
- char gid[8]; /* 116 */
- char size[12]; /* 124 */
- char mtime[12]; /* 136 */
- char chksum[8]; /* 148 */
- char typeflag; /* 156 */
- char linkname[100]; /* 157 */
- char magic[6]; /* 257 */
- char version[2]; /* 263 */
- char uname[32]; /* 265 */
- char gname[32]; /* 297 */
- char devmajor[8]; /* 329 */
- char devminor[8]; /* 337 */
- char prefix[155]; /* 345 */
- /* 500 */
-};
-
-union tar_buffer {
- char buffer[BLOCKSIZE];
- struct tar_header header;
-};
-
-enum { TGZ_EXTRACT = 0, TGZ_LIST };
-
-void TGZnotfound OF((const char *));
-
-int getoct OF((char *, int));
-char *strtime OF((time_t *));
-int ExprMatch OF((char *,char *));
-
-int makedir OF((char *));
-int matchname OF((int,int,char **,char *));
-
-void error OF((const char *));
-int tar OF((gzFile, int, int, int, char **));
-
-void help OF((int));
-int main OF((int, char **));
-
-char *prog;
-
-/* This will give a benign warning */
-
-static char *TGZprefix[] = { "\0", ".tgz", ".tar.gz", ".tar", NULL };
-
-/* Return the real name of the TGZ archive */
-/* or NULL if it does not exist. */
-
-/* error message for the filename */
-
-void TGZnotfound OF((const char *fname))
-{
- int i;
-
- fprintf(stderr,"%s : couldn't find ",prog);
- for (i=0;TGZprefix[i];i++)
- fprintf(stderr,(TGZprefix[i+1]) ? "%s%s, " : "or %s%s\n",
- fname,
- TGZprefix[i]);
- exit(1);
-}
-
-
-/* help functions */
-
-int getoct(char *p,int width)
-{
- int result = 0;
- char c;
-
- while (width --)
- {
- c = *p++;
- if (c == ' ')
- continue;
- if (c == 0)
- break;
- result = result * 8 + (c - '0');
- }
- return result;
-}
-
-char *strtime (time_t *t)
-{
- struct tm *local;
- static char result[32];
-
- local = localtime(t);
- sprintf(result,"%2d/%02d/%4d %02d:%02d:%02d",
- local->tm_mday, local->tm_mon+1, local->tm_year+1900,
- local->tm_hour, local->tm_min, local->tm_sec);
- return result;
-}
-
-
-/* regular expression matching */
-
-#define ISSPECIAL(c) (((c) == '*') || ((c) == '/'))
-
-int ExprMatch(char *string,char *expr)
-{
- while (1)
- {
- if (ISSPECIAL(*expr))
- {
- if (*expr == '/')
- {
- if (*string != '\\' && *string != '/')
- return 0;
- string ++; expr++;
- }
- else if (*expr == '*')
- {
- if (*expr ++ == 0)
- return 1;
- while (*++string != *expr)
- if (*string == 0)
- return 0;
- }
- }
- else
- {
- if (*string != *expr)
- return 0;
- if (*expr++ == 0)
- return 1;
- string++;
- }
- }
-}
-
-/* recursive make directory */
-/* abort if you get an ENOENT errno somewhere in the middle */
-/* e.g. ignore error "mkdir on existing directory" */
-/* */
-/* return 1 if OK */
-/* 0 on error */
-
-int makedir (char *newdir)
-{
- char *buffer = strdup(newdir);
- char *p;
- int len = strlen(buffer);
-
- if (len <= 0) {
- free(buffer);
- return 0;
- }
- if (buffer[len-1] == '/') {
- buffer[len-1] = '\0';
- }
- if (mkdir(buffer, 0775) == 0)
- {
- free(buffer);
- return 1;
- }
-
- p = buffer+1;
- while (1)
- {
- char hold;
-
- while(*p && *p != '\\' && *p != '/')
- p++;
- hold = *p;
- *p = 0;
- if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT))
- {
- fprintf(stderr,"%s: couldn't create directory %s\n",prog,buffer);
- free(buffer);
- return 0;
- }
- if (hold == 0)
- break;
- *p++ = hold;
- }
- free(buffer);
- return 1;
-}
-
-int matchname (int arg,int argc,char **argv,char *fname)
-{
- if (arg == argc) /* no arguments given (untgz tgzarchive) */
- return 1;
-
- while (arg < argc)
- if (ExprMatch(fname,argv[arg++]))
- return 1;
-
- return 0; /* ignore this for the moment being */
-}
-
-
-/* Tar file list or extract */
-
-int untar (gzFile in, const char *dest) {
- union tar_buffer buffer;
- int len;
- int err;
- int getheader = 1;
- int remaining = 0;
- FILE *outfile = NULL;
- char fname[BLOCKSIZE];
- time_t tartime;
-
- while (1) {
- len = gzread(in, &buffer, BLOCKSIZE);
- if (len < 0)
- error (gzerror(in, &err));
- /*
- * Always expect complete blocks to process
- * the tar information.
- */
- if (len != BLOCKSIZE)
- error("gzread: incomplete block read");
-
- /*
- * If we have to get a tar header
- */
- if (getheader == 1) {
- /*
- * if we met the end of the tar
- * or the end-of-tar block,
- * we are done
- */
- if ((len == 0) || (buffer.header.name[0]== 0)) break;
-
- tartime = (time_t)getoct(buffer.header.mtime,12);
- strcpy(fname, dest);
- if ((fname[strlen(fname)-1] != '/') && (fname[strlen(fname)-1] != '\\'))
- strcat(fname, "/");
- strcat(fname, buffer.header.name);
-
- switch (buffer.header.typeflag) {
- case DIRTYPE:
- makedir(fname);
- break;
- case REGTYPE:
- case AREGTYPE:
- remaining = getoct(buffer.header.size,12);
- if (remaining) {
- outfile = fopen(fname,"wb");
- if (outfile == NULL) {
- // try creating directory
- char *p = strrchr(fname, '/');
- if (p != NULL) {
- *p = '\0';
- makedir(fname);
- *p = '/';
- outfile = fopen(fname,"wb");
- }
- }
-/*
- fprintf(stderr,
- "%s %s\n",
- (outfile) ? "Extracting" : "Couldn't create",
- fname);
-*/
- }
- else
- outfile = NULL;
- /*
- * could have no contents
- */
- getheader = (remaining) ? 0 : 1;
- break;
- default:
- break;
- }
- }
- else {
- unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
-
- if (outfile != NULL) {
- if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes) {
- fprintf(stderr,"%s : error writing %s skipping...\n",prog,fname);
- fclose(outfile);
- unlink(fname);
- }
- }
- remaining -= bytes;
- if (remaining == 0) {
- getheader = 1;
- if (outfile != NULL) {
-#ifdef WIN32
- HANDLE hFile;
- FILETIME ftm,ftLocal;
- SYSTEMTIME st;
- struct tm localt;
-
- fclose(outfile);
-
- localt = *localtime(&tartime);
-
- hFile = CreateFile(fname, GENERIC_READ | GENERIC_WRITE,
- 0, NULL, OPEN_EXISTING, 0, NULL);
-
- st.wYear = (WORD)localt.tm_year+1900;
- st.wMonth = (WORD)localt.tm_mon;
- st.wDayOfWeek = (WORD)localt.tm_wday;
- st.wDay = (WORD)localt.tm_mday;
- st.wHour = (WORD)localt.tm_hour;
- st.wMinute = (WORD)localt.tm_min;
- st.wSecond = (WORD)localt.tm_sec;
- st.wMilliseconds = 0;
- SystemTimeToFileTime(&st,&ftLocal);
- LocalFileTimeToFileTime(&ftLocal,&ftm);
- SetFileTime(hFile,&ftm,NULL,&ftm);
- CloseHandle(hFile);
-
- outfile = NULL;
-#else
- struct utimbuf settime;
-
- settime.actime = settime.modtime = tartime;
-
- fclose(outfile);
- outfile = NULL;
- utime(fname,&settime);
-#endif
- }
- }
- }
- }
- return 0;
-}
-
-
-/* =========================================================== */
-
-void help(int exitval)
-{
- fprintf(stderr,
- "untgz v 0.1\n"
- " an sample application of zlib 1.0.4\n\n"
- "Usage : untgz TGZfile to extract all files\n"
- " untgz TGZfile fname ... to extract selected files\n"
- " untgz -l TGZfile to list archive contents\n"
- " untgz -h to display this help\n\n");
- exit(exitval);
-}
-
-void error(const char *msg)
-{
- fprintf(stderr, "%s: %s\n", prog, msg);
-// exit(1); // don't exit on error
-}
-
-
-int untargz(int fd, const char *dest) {
- gzFile f;
-
- f = gzdopen(fd, "rb");
- if (f == NULL) {
- fprintf(stderr,"%s: Couldn't gzopen file\n", prog);
- return 1;
- }
-
- return untar(f, dest);
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/tests/testblocks.cpp b/.pc/12_fix_compiler_warnings.diff/tests/testblocks.cpp
deleted file mode 100644
index 96e2253..0000000
--- a/.pc/12_fix_compiler_warnings.diff/tests/testblocks.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/******************************************************************************
- *
- * testblocks.cpp -
- *
- * $Id: testblocks.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 2001-2013 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.
- *
- */
-
-#include <entriesblk.h>
-#include <iostream>
-#include <string>
-#include <stdio.h>
-#include <stdlib.h>
-
-using namespace std;
-#ifndef NO_SWORD_NAMESPACE
-using namespace sword;
-#endif
-
-void addEntry(EntriesBlock *eb) {
- string input;
- string body;
- char line[1024];
- std::cout << "\nEnter new Entry's text. '.' on an empty line to finish:\n";
- do {
- std::cout << "> ";
- fgets(line, 1000, stdin);
- input = line;
- if (input.compare("."))
- body.append(input);
- }
- while (input.compare("."));
- std::cout << "Adding new entry. Index is: " << eb->addEntry(body.c_str()) << "\n\n";
-}
-
-
-void printEntry(EntriesBlock *eb, int index) {
- if (index < eb->getCount()) {
- std::cout << "Contents of entry [" << index << "]:\n";
- std::cout << eb->getEntry(index) << "\n";
- }
- else std::cout << "Invalid entry number\n\n";
-}
-
-
-void printSize(EntriesBlock *eb) {
- unsigned long size;
- eb->getRawData(&size);
- std::cout << "Size of raw data: " << size << "\n\n";
-}
-
-
-void removeEntry(EntriesBlock *eb, int index) {
- if (index < eb->getCount()) {
- std::cout << "Removing entry [" << index << "]\n";
- eb->removeEntry(index);
- }
- else std::cout << "Invalid entry number\n\n";
-}
-
-
-int main(int argc, char **argv) {
-
- EntriesBlock *eb = new EntriesBlock();
- string input;
- char line[1024];
-
- std::cout << "Initial entry count should be 0: " << eb->getCount() << "\n";
-
- do {
- std::cout << "[" << eb->getCount() << "] > ";
- fgets(line, 1000, stdin);
- input = line;
- if (input.length() > 0) {
- switch (input[0]) {
- case 'a': addEntry(eb); break;
- case 'p': printEntry(eb, atoi(input.c_str()+1)); break;
- case 'r': removeEntry(eb, atoi(input.c_str()+1)); break;
- case 's': printSize(eb); break;
- case 'q': break;
- case '?':
- default:
- std::cout << "\n a - add a new entry\n";
- std::cout << " p <entry_index> - print entry\n";
- std::cout << " r <entry_index> - remove entry\n";
- std::cout << " s - print size of raw data\n";
- std::cout << " q - quit\n\n";
- break;
- }
- }
- }
- while (input.compare("q"));
-
- delete eb;
-
- return 0;
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/cipherraw.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/cipherraw.cpp
deleted file mode 100644
index a8de3e7..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/cipherraw.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/******************************************************************************
- *
- * cipherraw.cpp - Utility to encipher a raw (uncompressed) module
- *
- * $Id: cipherraw.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 1999-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
- #pragma warning( disable: 4996 )
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <filemgr.h>
-#include <swcipher.h>
-#include <versekey.h>
-#include <rawverse.h>
-#include <swbuf.h>
-
-#ifndef NO_SWORD_NAMESPACE
-using namespace sword;
-#endif
-
-int main(int argc, char **argv) {
- SWCipher *zobj;
- VerseKey key;
- RawVerse *rawdrv;
- int ofd[2], oxfd[2];
- long tmpoff = 0, offset, loffset = 0, lzoffset = 0;
- unsigned short size, lsize = 0, lzsize;
- char *tmpbuf;
-
- if (argc != 3) {
- fprintf(stderr, "usage: %s <datapath> \"<key>\"\n", argv[0]);
- exit(1);
- }
-
- rawdrv = new RawVerse(argv[1]);
- zobj = new SWCipher((unsigned char *)argv[2]);
-
- tmpbuf = new char [ strlen(argv[1]) + 11 ];
- sprintf(tmpbuf, "%sot.zzz", argv[1]);
- ofd[0] = FileMgr::createPathAndFile(tmpbuf);
- sprintf(tmpbuf, "%sot.zzz.vss", argv[1]);
- oxfd[0] = FileMgr::createPathAndFile(tmpbuf);
- sprintf(tmpbuf, "%snt.zzz", argv[1]);
- ofd[1] = FileMgr::createPathAndFile(tmpbuf);
- sprintf(tmpbuf, "%snt.zzz.vss", argv[1]);
- oxfd[1] = FileMgr::createPathAndFile(tmpbuf);
-
- delete [] tmpbuf;
-
- printf("\n");
- write(oxfd[0], &lzoffset, 4);
- write(oxfd[0], &lzsize, 2);
- write(oxfd[1], &lzoffset, 4);
- write(oxfd[1], &lzsize, 2);
-
- key.setAutoNormalize(false);
- key.setIntros(true);
- for (key.setIndex(0); (!key.popError()); key++) {
- rawdrv->findOffset(key.getTestament(), key.getIndex(), &offset, &size);
- printf("%s: OLD offset: %ld; size: %d\n", (const char *)key, offset, size);
-
- if ((offset == loffset) && (size == lsize)) {
- printf("using previous offset,size %d\n", size);
- offset = lseek(oxfd[key.getTestament() - 1], 0, SEEK_CUR);
- printf("%ld %ld %d \n", offset, lzoffset, lzsize);
- write(oxfd[key.getTestament() - 1], &lzoffset, 4);
- write(oxfd[key.getTestament() - 1], &lzsize, 2);
- }
- else {
- lsize = size;
- loffset = offset;
-
- if (size) {
- SWBuf tmpbuf;
- rawdrv->readText(key.getTestament(), offset, size, tmpbuf);
- zobj->Buf(tmpbuf.c_str(), size);
- unsigned long ulSize = size;
- zobj->cipherBuf(&ulSize);
- size = (unsigned int)ulSize;
- }
- offset = lseek(ofd[key.getTestament() - 1], 0, SEEK_CUR);
- tmpoff = lseek(oxfd[key.getTestament() - 1], 0, SEEK_CUR);
- printf("%s: (%ld) NEW offset: %ld; size: %d\n", (const char *)key, tmpoff, offset, size);
- write(oxfd[key.getTestament() - 1], &offset, 4);
- unsigned long ulSize = size;
- if (size)
- write(ofd[key.getTestament() - 1], zobj->cipherBuf(&ulSize), size);
- size = (unsigned int)ulSize;
- lzoffset = offset;
- write(oxfd[key.getTestament() - 1], &size, 2);
- lzsize = size;
- }
- }
- delete zobj;
- close(ofd[0]);
- close(oxfd[0]);
- close(ofd[1]);
- close(oxfd[1]);
- return 0;
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/gbfidx.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/gbfidx.cpp
deleted file mode 100644
index 8b1d1dd..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/gbfidx.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-/*****************************************************************************
- *
- * gbfidx.cpp - This code reeks but works (at least for WEB).
- * Good luck!
- *
- * $Id: gbfidx.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 2002-2013 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.
- *
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-#include <filemgr.h>
-
-using namespace sword;
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles(char *fname);
-void checkparams(int argc, char **argv);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-
-
-int main(int argc, char **argv)
-{
- long pos, offset;
- int num1, num2, rangemax;
- char startflag = 0;
- short size;
-
- checkparams(argc, argv);
-
- openfiles(argv[1]);
-
- testmnt = key1.getTestament();
- num1 = key1.getChapter();
- num2 = key1.getVerse();
- pos = 0;
- write(bfp, &pos, 4); /* Book offset for testament intros */
- pos = 4;
- write(cfp, &pos, 4); /* Chapter offset for testament intro */
-
-
-/* Right now just zero out intros until parsing correctly */
- pos = 0;
- size = 0;
- write(vfp, &pos, 4); /* Module intro */
- write(vfp, &size, 2);
- write(vfp, &pos, 4); /* Testament intro */
- write(vfp, &size, 2);
-
- while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
- if (!startflag) {
- startflag = 1;
- }
- else {
- if (num2 < key2.getVerse()) { // new chapter
- if (num1 <= key2.getChapter()) { // new book
- key2.setVerse(1);
- key2.setChapter(1);
- key2.setBook(key2.getBook()+1);
- }
- printf("Found Chapter Break: %d ('%s')\n", num1, (const char *)key2);
- chapoffset = offset;
- chapsize = size;
-// continue;
- }
- }
- key2.setVerse(1);
- key2.setChapter(num1);
- key2.setVerse(num2);
-
- key3 = key2;
-// key3 += (rangemax - key3.getVerse());
-
- writeidx(key1, key2, key3, offset, size);
- }
- close(vfp);
- close(cfp);
- close(bfp);
- close(fp);
- return 0;
-}
-
-
-/**************************************************************************
- * ENT: key1 - current location of index
- * key2 - minimum keyval for which this offset is valid
- * key3 - maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
- long pos;
- short tmp;
-
- for (; ((key1 <= key3) && (key1.popError() != KEYERR_OUTOFBOUNDS) && (key1.getTestament() == testmnt)); key1+=1) {
- if (key1.getVerse() == 1) { // new chapter
- if (key1.getChapter() == 1) { // new book
- pos = lseek(cfp, 0, SEEK_CUR);
- write(bfp, &pos, 4);
- pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
- write(cfp, &pos, 4);
- write(vfp, &chapoffset, 4); /* Book intro (vss) set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
- write(vfp, &chapsize, 2);
- }
- pos = lseek(vfp, 0, SEEK_CUR);
- write(cfp, &pos, 4);
- write(vfp, &chapoffset, 4); /* Chapter intro */
- write(vfp, &chapsize, 2);
- }
- if (key1 >= key2) {
- write(vfp, &offset, 4);
- write(vfp, &size, 2);
- }
- else {
- pos = 0;
- tmp = 0;
- write(vfp, &pos, 4);
- write(vfp, &tmp, 2);
- }
- }
-}
-
-
-char startchap(char *buf)
-{
- if (buf[0] != '<')
- return 0;
- if (buf[1] != 'S')
- return 0;
- if (buf[2] != 'C')
- return 0;
-/*
- if (!isdigit(buf[2]))
- return 0;
- for (loop = 3; loop < 7; loop++) {
- if (buf[loop] == ' ')
- break;
- if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
- return 0;
- }
-*/
- return 1;
-}
-
-
-char startentry(char *buf)
-{
- if (buf[0] != '<')
- return 0;
- if (buf[1] != 'S')
- return 0;
- if (buf[2] != 'V')
- return 0;
-/*
- if (!isdigit(buf[2]))
- return 0;
- for (loop = 3; loop < 7; loop++) {
- if (buf[loop] == ' ')
- break;
- if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
- return 0;
- }
-*/
- return 1;
-}
-
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
- char buf[7];
- int loop;
- long offset2;
- int ch2, vs2, rm2;
- bool flag;
- long chapstart = 0;
-
- memset(buf, ' ', 7);
-
- while (1) {
- if (startchap(buf)) {
- chapstart = lseek(fp, 0, SEEK_CUR) - 7;
- memset(buf, ' ', 3);
- flag = false;
- for (loop = 3; loop < 6; loop++) {
- if (isdigit(buf[loop]))
- flag = true;
- else {
- buf[loop] = 0;
- break;
- }
- }
- if (flag)
- *num1 = atoi(buf);
- else (*num1)++;
- }
- if (startentry(buf)) {
- memset(buf, ' ', 3);
- flag = false;
- for (loop = 3; loop < 6; loop++) {
- if (isdigit(buf[loop]))
- flag = true;
- else {
- buf[loop] = 0;
- break;
- }
- if (flag)
- *num2 = atoi(buf);
- else (*num2)++;
- }
- loop++;
- if (size)
- *offset = lseek(fp, 0, SEEK_CUR) - (7 - loop);
- else *offset = (chapstart) ? chapstart : lseek(fp, 0, SEEK_CUR) - 7;
- if (size) {
- ch2 = *num1;
- vs2 = *num2;
- if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
- *size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
- }
- else {
- if (vs2) {
- *size = (offset2 - (*offset));
- }
- }
- lseek(fp, *offset, SEEK_SET);
- }
- return 0;
- }
- memmove(buf, &buf[1], 6);
- if (read(fp, &buf[6], 1) != 1)
- return 1;
- }
-}
-
-
-void openfiles(char *fname)
-{
- SWBuf buf;
-
- if ((fp = FileMgr::openFileReadOnly(fname)) < 0) {
- fprintf(stderr, "Couldn't open file: %s\n", fname);
- exit(1);
- }
-
- buf.setFormatted("%s.vss", fname);
- if ((vfp = FileMgr::createPathAndFile(buf.c_str())) < 0) {
- fprintf(stderr, "Couldn't open file: %s\n", buf.c_str());
- exit(1);
- }
-
- buf.setFormatted("%s.cps", fname);
- if ((cfp = FileMgr::createPathAndFile(buf.c_str())) < 0) {
- fprintf(stderr, "Couldn't open file: %s\n", buf.c_str());
- exit(1);
- }
-
- buf.setFormatted("%s.bks", fname);
- if ((bfp = FileMgr::createPathAndFile(buf.c_str())) < 0) {
- fprintf(stderr, "Couldn't open file: %s\n", buf.c_str());
- exit(1);
- }
-}
-
-
-void checkparams(int argc, char **argv)
-{
- if (argc < 2) {
- fprintf(stderr, "usage: %s <file to process> [nt - for new testmt file]\n", argv[0]);
- exit(1);
- }
- if (argc == 3)
- key1 = key2 = key3 = "Matthew 1:1";
- else key1 = key2 = key3 = "Genesis 1:1";
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/genbookutil.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/genbookutil.cpp
deleted file mode 100644
index 71363e3..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/genbookutil.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/******************************************************************************
- *
- * genbookutil.cpp -
- *
- * $Id: genbookutil.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 2002-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
-#endif
-
-#include <entriesblk.h>
-#include <iostream>
-#include <stdio.h>
-#include <treekeyidx.h>
-#include <rawgenbook.h>
-
-#ifndef NO_SWORD_NAMESPACE
-using namespace sword;
-#endif
-
-void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
- if (!target)
- target = &treeKey;
-
- unsigned long currentOffset = target->getOffset();
- std::cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
- for (int i = 0; i < level; i++) std::cout << "\t";
- std::cout << treeKey.getLocalName() << "/\n";
- if (treeKey.firstChild()) {
- printTree(treeKey, target, level+1);
- treeKey.parent();
- }
- if (treeKey.nextSibling())
- printTree(treeKey, target, level);
-
-}
-
-
-void printLocalName(TreeKeyIdx *treeKey) {
- std::cout << "locaName: " << treeKey->getLocalName() << "\n";
-}
-
-
-void setLocalName(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter New Node Name: ";
- fgets(buf, 1000, stdin);
- SWBuf name = buf;
- treeKey->setLocalName(name.trim());
- treeKey->save();
-}
-
-
-void gotoPath(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter Path: ";
- fgets(buf, 1000, stdin);
- SWBuf path = buf;
- (*treeKey) = path.trim();
-}
-
-
-void assurePath(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter Path: ";
- fgets(buf, 1000, stdin);
- SWBuf path = buf;
- treeKey->assureKeyPath(path.trim());
-}
-
-
-void viewEntryText(RawGenBook *book) {
- std::cout << "\n";
- std::cout << book->renderText();
- std::cout << "\n";
-}
-
-
-void setEntryText(RawGenBook *book) {
- SWBuf body;
- TreeKeyIdx *treeKey = (TreeKeyIdx *)(SWKey *)(*book);
- if (treeKey->getOffset()) {
- char buf[1023];
- std::cout << "Enter New Entry Text ('.' on a line by itself to end): \n";
- do {
- fgets(buf, 1000, stdin);
- SWBuf text = buf;
- text.trim();
- if ((text[0] == '.') && (text[1] == 0))
- break;
- body += text;
- body += "\n";
- } while (true);
-
- (*book) << body.c_str();
- }
- else std::cout << "Can't add entry text to root node\n";
-}
-
-
-void appendSibbling(TreeKeyIdx *treeKey) {
- if (treeKey->getOffset()) {
- char buf[1023];
- std::cout << "Enter New Sibbling Name: ";
- fgets(buf, 1000, stdin);
- SWBuf name = buf;
- treeKey->append();
- treeKey->setLocalName(name.trim());
- treeKey->save();
- }
- else std::cout << "Can't add sibling to root node\n";
-}
-
-
-void appendChild(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter New Child Name: ";
- fgets(buf, 1000, stdin);
- SWBuf name = buf;
- treeKey->appendChild();
- treeKey->setLocalName(name.trim());
- treeKey->save();
-}
-
-
-void deleteNode(TreeKeyIdx *treeKey) {
- std::cout << "Removing entry [" << treeKey->getText() << "]\n";
- treeKey->remove();
-}
-
-
-void removeEntry(EntriesBlock *eb, int index) {
- if (index < eb->getCount()) {
- std::cout << "Removing entry [" << index << "]\n";
- eb->removeEntry(index);
- }
- else std::cout << "Invalid entry number\n\n";
-}
-
-
-int main(int argc, char **argv) {
-
- if (argc != 2) {
- fprintf(stderr, "usage: %s <tree/key/data/path>\n", *argv);
- exit(-1);
- }
-
- TreeKeyIdx *treeKey = new TreeKeyIdx(argv[1]);
-
- if (treeKey->popError()) {
- RawGenBook::createModule(argv[1]);
- }
- delete treeKey;
-
- RawGenBook *book = new RawGenBook(argv[1]);
- TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
- treeKey = (TreeKeyIdx *)(SWKey *)(*book);
-
- SWBuf input;
- char line[1024];
-
- do {
- std::cout << "[" << treeKey->getText() << "] > ";
- fgets(line, 1000, stdin);
- input = line;
- input.trim();
- if (input.length() > 0) {
- switch (input[0]) {
- case 'n': printLocalName(treeKey); break;
- case 's': setLocalName(treeKey); break;
- case 'g': gotoPath(treeKey); break;
- case 'G': assurePath(treeKey); break;
- case 'p': root.root(); printTree(root, treeKey); break;
- case 'a': appendSibbling(treeKey); break;
- case 'c': appendChild(treeKey); break;
- case 'd': deleteNode(treeKey); break;
- case 'j': treeKey->nextSibling(); break;
- case 'k': treeKey->previousSibling(); break;
- case 'h': treeKey->parent(); break;
- case 'l': treeKey->firstChild(); break;
- case 'r': treeKey->root(); break;
- case 't': setEntryText(book); break;
- case 'v': viewEntryText(book); break;
- case 'q': break;
- case '?':
- default:
- std::cout << "\n p - print tree\n";
- std::cout << " n - get local name\n";
- std::cout << " s - set local name\n";
- std::cout << " j - next sibbling\n";
- std::cout << " k - previous sibbling\n";
- std::cout << " h - parent\n";
- std::cout << " l - first child\n";
- std::cout << " r - root\n";
- std::cout << " g - goto path\n";
- std::cout << " G goto path; create if it doesn't exist\n";
- std::cout << " a - append sibbling\n";
- std::cout << " c - append child\n";
- std::cout << " d - delete node\n";
- std::cout << " v - view entry text\n";
- std::cout << " t - set entry text\n";
- std::cout << " q - quit\n\n";
- break;
- }
- }
- }
- while (input.compare("q"));
-
- delete treeKey;
-
- return 0;
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/installmgr.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/installmgr.cpp
deleted file mode 100644
index b705c25..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/installmgr.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/******************************************************************************
- *
- * installmgr.cpp - commandline InstallMgr utility
- *
- * $Id: installmgr.cpp 2932 2013-07-31 14:07:01Z scribe $
- *
- * Copyright 2003-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
-#endif
-
-#include <swmgr.h>
-#include <installmgr.h>
-#include <remotetrans.h>
-#include <filemgr.h>
-#include <iostream>
-#include <map>
-#include <swmodule.h>
-#include <stdio.h>
-#include <swlog.h>
-
-using namespace sword;
-using std::cout;
-using std::cerr;
-using std::cin;
-using std::map;
-
-
-SWMgr *mgr = 0;
-InstallMgr *installMgr = 0;
-StatusReporter *statusReporter = 0;
-SWBuf baseDir;
-SWBuf confPath;
-
-void usage(const char *progName = 0, const char *error = 0);
-
-class MyInstallMgr : public InstallMgr {
-public:
- MyInstallMgr(const char *privatePath = "./", StatusReporter *sr = 0) : InstallMgr(privatePath, sr) {}
-
-virtual bool isUserDisclaimerConfirmed() const {
- static bool confirmed = false;
- if (!confirmed) {
- cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
- cout << " -=+* WARNING *+=- -=+* WARNING *+=-\n\n\n";
- cout << "Although Install Manager provides a convenient way for installing\n";
- cout << "and upgrading SWORD components, it also uses a systematic method\n";
- cout << "for accessing sites which gives packet sniffers a target to lock\n";
- cout << "into for singling out users. \n\n\n";
- cout << "IF YOU LIVE IN A PERSECUTED COUNTRY AND DO NOT WISH TO RISK DETECTION,\n";
- cout << "YOU SHOULD *NOT* USE INSTALL MANAGER'S REMOTE SOURCE FEATURES.\n\n\n";
- cout << "Also, Remote Sources other than CrossWire may contain less than\n";
- cout << "quality modules, modules with unorthodox content, or even modules\n";
- cout << "which are not legitimately distributable. Many repositories\n";
- cout << "contain wonderfully useful content. These repositories simply\n";
- cout << "are not reviewed or maintained by CrossWire and CrossWire\n";
- cout << "cannot be held responsible for their content. CAVEAT EMPTOR.\n\n\n";
- cout << "If you understand this and are willing to enable remote source features\n";
- cout << "then type yes at the prompt\n\n";
- cout << "enable? [no] ";
-
- char prompt[10];
- fgets(prompt, 9, stdin);
- confirmed = (!strcmp(prompt, "yes\n"));
- cout << "\n";
- }
- return confirmed;
-}
-
-};
-
-class MyStatusReporter : public StatusReporter {
- int last;
- virtual void update(unsigned long totalBytes, unsigned long completedBytes) {
- 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) {
- 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;
- }
-};
-
-
-void init() {
- if (!mgr) {
- mgr = new SWMgr();
-
- if (!mgr->config)
- usage(0, "ERROR: SWORD configuration not found. Please configure SWORD before using this program.");
-
- SWBuf baseDir = mgr->getHomeDir();
- if (baseDir.length() < 1) baseDir = ".";
- baseDir += "/.sword/InstallMgr";
- confPath = baseDir + "/InstallMgr.conf";
- statusReporter = new MyStatusReporter();
- installMgr = new MyInstallMgr(baseDir, statusReporter);
- }
-}
-
-
-// clean up and exit if status is 0 or negative error code
-void finish(int status) {
- delete statusReporter;
- delete installMgr;
- delete mgr;
-
- installMgr = 0;
- mgr = 0;
-
- if (status < 1) {
- cout << "\n";
- exit(status);
- }
-}
-
-
-void createBasicConfig(bool enableRemote, bool addCrossWire) {
-
- FileMgr::createParent(confPath.c_str());
- remove(confPath.c_str());
-
- InstallSource is("FTP");
- is.caption = "CrossWire";
- is.source = "ftp.crosswire.org";
- is.directory = "/pub/sword/raw";
-
- SWConfig config(confPath.c_str());
- config["General"]["PassiveFTP"] = "true";
- if (enableRemote) {
- config["Sources"]["FTPSource"] = is.getConfEnt();
- }
- config.Save();
-}
-
-
-void initConfig() {
- init();
-
- bool enable = installMgr->isUserDisclaimerConfirmed();
-
- createBasicConfig(enable, true);
-
- cout << "\n\nInitialized basic config file at [" << confPath << "]\n";
- cout << "with remote source features " << ((enable) ? "ENABLED" : "DISABLED") << "\n";
-}
-
-
-void syncConfig() {
- init();
-
- if (!installMgr->isUserDisclaimerConfirmed()) { // assert disclaimer is accepted
- cout << "\n\nDisclaimer not accepted. Aborting.";
- return;
- }
-
- // be sure we have at least some config file already out there
- if (!FileMgr::existsFile(confPath.c_str())) {
- createBasicConfig(true, false);
- finish(1); // cleanup and don't exit
- init(); // re-init with InstallMgr which uses our new config
- }
-
- if (!installMgr->refreshRemoteSourceConfiguration())
- cout << "\nSync'd config file with master remote source list.\n";
- else cout << "\nFailed to sync config file with master remote source list.\n";
-}
-
-
-void uninstallModule(const char *modName) {
- init();
- SWModule *module;
- ModMap::iterator it = mgr->Modules.find(modName);
- if (it == mgr->Modules.end()) {
- fprintf(stderr, "Couldn't find module [%s] to remove\n", modName);
- finish(-2);
- }
- module = it->second;
- installMgr->removeModule(mgr, module->getName());
- cout << "Removed module: [" << modName << "]\n";
-}
-
-
-void listRemoteSources() {
- init();
- cout << "Remote Sources:\n\n";
- for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); it++) {
- cout << "[" << it->second->caption << "]\n";
- cout << "\tType : " << it->second->type << "\n";
- cout << "\tSource : " << it->second->source << "\n";
- cout << "\tDirectory: " << it->second->directory << "\n";
- }
-}
-
-
-void refreshRemoteSource(const char *sourceName) {
- init();
- InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
- if (source == installMgr->sources.end()) {
- fprintf(stderr, "Couldn't find remote source [%s]\n", sourceName);
- finish(-3);
- }
-
- if (!installMgr->refreshRemoteSource(source->second))
- cout << "\nRemote Source Refreshed\n";
- else cerr << "\nError Refreshing Remote Source\n";
-}
-
-
-void listModules(SWMgr *otherMgr = 0, bool onlyNewAndUpdates = false) {
- init();
- SWModule *module;
- if (!otherMgr) otherMgr = mgr;
- std::map<SWModule *, int> mods = InstallMgr::getModuleStatus(*mgr, *otherMgr);
- for (std::map<SWModule *, int>::iterator it = mods.begin(); it != mods.end(); it++) {
- module = it->first;
- SWBuf version = module->getConfigEntry("Version");
- SWBuf status = " ";
- if (it->second & InstallMgr::MODSTAT_NEW) status = "*";
- if (it->second & InstallMgr::MODSTAT_OLDER) status = "-";
- if (it->second & InstallMgr::MODSTAT_UPDATED) status = "+";
-
- if (!onlyNewAndUpdates || status == "*" || status == "+") {
- cout << status << "[" << module->getName() << "] \t(" << version << ") \t- " << module->getDescription() << "\n";
- }
- }
-}
-
-
-void remoteListModules(const char *sourceName, bool onlyNewAndUpdated = false) {
- init();
- cout << "Available Modules:\n(be sure to refresh remote source (-r) first for most current list)\n\n";
- InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
- if (source == installMgr->sources.end()) {
- fprintf(stderr, "Couldn't find remote source [%s]\n", sourceName);
- finish(-3);
- }
- listModules(source->second->getMgr(), onlyNewAndUpdated);
-}
-
-
-void localDirListModules(const char *dir) {
- cout << "Available Modules:\n\n";
- SWMgr mgr(dir);
- listModules(&mgr);
-}
-
-
-void remoteInstallModule(const char *sourceName, const char *modName) {
- init();
- InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
- if (source == installMgr->sources.end()) {
- fprintf(stderr, "Couldn't find remote source [%s]\n", sourceName);
- finish(-3);
- }
- InstallSource *is = source->second;
- SWMgr *rmgr = is->getMgr();
- SWModule *module;
- ModMap::iterator it = rmgr->Modules.find(modName);
- if (it == rmgr->Modules.end()) {
- fprintf(stderr, "Remote source [%s] does not make available module [%s]\n", sourceName, modName);
- finish(-4);
- }
- module = it->second;
-
- int error = installMgr->installModule(mgr, 0, module->getName(), is);
- if (error) {
- cout << "\nError installing module: [" << module->getName() << "] (write permissions?)\n";
- } else cout << "\nInstalled module: [" << module->getName() << "]\n";
-}
-
-
-void localDirInstallModule(const char *dir, const char *modName) {
- init();
- SWMgr lmgr(dir);
- SWModule *module;
- ModMap::iterator it = lmgr.Modules.find(modName);
- if (it == lmgr.Modules.end()) {
- fprintf(stderr, "Module [%s] not available at path [%s]\n", modName, dir);
- finish(-4);
- }
- module = it->second;
- int error = installMgr->installModule(mgr, dir, module->getName());
- if (error) {
- cout << "\nError installing module: [" << module->getName() << "] (write permissions?)\n";
- } else cout << "\nInstalled module: [" << module->getName() << "]\n";
-}
-
-
-void usage(const char *progName, const char *error) {
-
- if (error) fprintf(stderr, "\n%s: %s\n", (progName ? progName : "installmgr"), error);
-
- fprintf(stderr, "\nusage: %s <command> [command ...]\n"
- "\n Commands (run in order they are passed):\n\n"
- "\t-init\t\t\t\tcreate a basic user config file.\n"
- "\t\t\t\t\t\tWARNING: overwrites existing.\n"
- "\t-sc\t\t\t\tsync config with known remote repo list\n"
- "\t\t\t\t\t\tNOTE: also creates if none exists\n"
- "\t-s\t\t\t\tlist remote sources\n"
- "\t-r <remoteSrcName>\t\trefresh remote source\n"
- "\t-rl <remoteSrcName>\t\tlist available modules from remote source\n"
- "\t-rd <remoteSrcName>\t\tlist new/updated modules from remote source\n"
- "\t-ri <remoteSrcName> <modName>\tinstall module from remote source\n"
- "\t-l\t\t\t\tlist installed modules\n"
- "\t-u <modName>\t\t\tuninstall module\n"
- "\t-ll <path>\t\t\tlist available modules at local path\n"
- "\t-li <path> <modName>\t\tinstall module from local path\n"
- "\t-d\t\t\t\tturn debug output on\n"
- , (progName ? progName : "installmgr"));
- finish(-1);
-}
-
-
-int main(int argc, char **argv) {
-
- if (argc < 2) usage(*argv);
-
- for (int i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "-d")) {
- SWLog::getSystemLog()->setLogLevel(SWLog::LOG_DEBUG);
- }
- else if (!strcmp(argv[i], "-init")) {
- initConfig();
- }
- else if (!strcmp(argv[i], "-l")) { // list installed modules
- cout << "Installed Modules:\n\n";
- listModules();
- }
- else if (!strcmp(argv[i], "-ll")) { // list from local directory
- if (i+1 < argc) localDirListModules(argv[++i]);
- else usage(*argv, "-ll requires <path>");
- }
- else if (!strcmp(argv[i], "-li")) { // install from local directory
- if (i+2 < argc) {
- const char *path = argv[++i];
- const char *modName = argv[++i];
- localDirInstallModule(path, modName);
- }
- else usage(*argv, "-li requires <path> <modName>");
- }
- else if (!strcmp(argv[i], "-u")) { // uninstall module
- if (i+1 < argc) uninstallModule(argv[++i]);
- else usage(*argv, "-u requires <modName>");
- }
- else if (!strcmp(argv[i], "-s")) { // list sources
- listRemoteSources();
- }
- else if (!strcmp(argv[i], "-sc")) { // sync config with master
- syncConfig();
- }
- else if (!strcmp(argv[i], "-r")) { // refresh remote source
- if (i+1 < argc) refreshRemoteSource(argv[++i]);
- else usage(*argv, "-r requires <remoteSrcName>");
- }
- else if (!strcmp(argv[i], "-rl")) { // list remote modules
- if (i+1 < argc) remoteListModules(argv[++i]);
- else usage(*argv, "-rl requires <remoteSrcName>");
- }
- else if (!strcmp(argv[i], "-rd")) { // list differences between remote source and installed modules
- if (i+1 < argc) remoteListModules(argv[++i], true);
- else usage(*argv, "-rd requires <remoteSrcName>");
- }
- else if (!strcmp(argv[i], "-ri")) { // install from remote directory
- if (i+2 < argc) {
- const char *source = argv[++i];
- const char *modName = argv[++i];
- remoteInstallModule(source, modName);
- }
- else usage(*argv, "-ri requires <remoteSrcName> <modName>");
- }
- else usage(*argv, (((SWBuf)"Unknown argument: ")+ argv[i]).c_str());
- }
-
- finish(0);
-
- return 0;
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/lexdump.c b/.pc/12_fix_compiler_warnings.diff/utilities/lexdump.c
deleted file mode 100644
index c55176e..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/lexdump.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/******************************************************************************
- *
- * lexdump.c - This utility outputs a specified ordinal entry from a lex
- *
- * $Id: lexdump.c 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 1999-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4996 )
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-int main(int argc, char **argv) {
- char *tmpbuf;
- int idxfd, datfd;
- long offset;
- unsigned int size;
- char datbuf[255];
-
- if (argc != 3) {
- fprintf(stderr, "usage: %s <datapath/datafilebasename> <index>\n", argv[0]);
- exit(1);
- }
-
- tmpbuf = calloc(strlen(argv[1]) + 11,1);
- sprintf(tmpbuf, "%s.idx", argv[1]);
- idxfd = open(tmpbuf, O_RDONLY|O_BINARY);
- sprintf(tmpbuf, "%s.dat", argv[1]);
- datfd = open(tmpbuf, O_RDONLY|O_BINARY);
- free(tmpbuf);
-
- offset = atoi(argv[2]) * 6;
- lseek(idxfd, offset, SEEK_SET);
- read(idxfd, &offset, 4);
- read(idxfd, &size, 2);
- printf("offset: %ld; size: %d\n", offset, size);
- lseek(datfd, offset, SEEK_SET);
- read(datfd, datbuf, 40);
- datbuf[40] = 0;
- printf("%s\n", datbuf);
- close(datfd);
- close(idxfd);
- return 0;
-
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/step2vpl.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/step2vpl.cpp
deleted file mode 100644
index a9c4a6d..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/step2vpl.cpp
+++ /dev/null
@@ -1,456 +0,0 @@
-/******************************************************************************
- *
- * step2vpl.cpp - Utility to export a STEP module as VPL
- *
- * $Id: step2vpl.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 2000-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
- #pragma warning( disable: 4996 )
-#endif
-
-#include <iostream>
-#include <string>
-#include <stdio.h>
-#include <sys/stat.h>
-
-#include <fcntl.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <filemgr.h>
-#include <lzsscomprs.h>
-
-using namespace std;
-#ifndef NO_SWORD_NAMESPACE
-using namespace sword;
-#endif
-
-long SECTIONSLEVELSTART = 38;
-long SECTIONSLEVELSIZE = 29;
-
-long VIEWABLEBLOCKSTART = 0;
-long VIEWABLEBLOCKSIZE = 0;
-
-typedef struct {
- short versionRecordSize;
- short publisherID;
- short bookID;
- short setID;
- char conversionProgramVerMajor;
- char conversionProgramVerMinor;
- char leastCompatSTEPVerMajor;
- char leastCompatSTEPVerMinor;
- char encryptionType;
- char editionID;
- short modifiedBy;
-} Version;
-
-typedef struct {
- short sectionsHeaderRecordSize;
- long levelEntriesCount; // this is listed as nonGlossBlocksCount in spec!
- long glossEntriesCount;
- short levelEntriesSize;
- long reserved;
-} SectionsHeader;
-
-typedef struct {
- short viewableHeaderRecordSize;
- long viewableBlocksCount; // this is listed as nonGlossBlocksCount in spec!
- long glossBlocksCount;
- char compressionType; // 0 - none; 1 - LZSS
- char reserved1;
- short blockEntriesSize;
- short reserved2;
-} ViewableHeader;
-
-typedef struct {
- short vSyncHeaderRecordSize;
- short startBookNumber;
- short endBookNumber;
- short bookPointerEntriesSize;
- short syncPointEntriesSize;
- long reserved1_1;
- short reserved1_2;
-} VSyncHeader;
-
-typedef struct {
- long offset;
- long uncompressedSize;
- long size;
-} ViewableBlock;
-
-typedef struct {
- long offset; // offset into VSYNC.IDX to first VSyncPoint
- short count; // number of VSyncPoints for this book
-} VSyncBooksInfo;
-
-typedef struct {
- short chapter;
- short verse;
- long offset; // offset into SECTIONS.IDX
-} VSyncPoint;
-
-typedef struct {
- long parentOffset; // many of these are 0 if glossary
- long previousOffset;
- long nextOffset;
- long viewableOffset;
- short startLevel;
- char level;
- long nameOffset;
- long outSync_1;
- short outSync_2;
-} SectionLevelInfo;
-
-void readVersion(int fd, Version *versionRecord);
-void readHeaderControlWordAreaText(int fd, char **buf);
-void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord);
-void readVSyncHeader(int fd, VSyncHeader *vSyncHeaderRecord);
-void readVSyncBooksInfo(int fd, VSyncHeader *, VSyncBooksInfo **vSyncBooksInfo);
-void readViewableBlock(int fd, ViewableBlock *vb);
-void readViewableBlockText(int fd, ViewableBlock *vb, char **buf);
-void readSectionsHeader(int fd, SectionsHeader *sectionsHeaderRecord);
-void readSectionLevelInfo(int fd, SectionLevelInfo *sli);
-void readSectionName(int fd, SectionLevelInfo *sli, char **name);
-void displayBook(int fdbook, int fdviewable, int fdvsync, int fdsections, VSyncBooksInfo *vSyncBooksInfo);
-void extractVerseText(int fdviewable, int fdbook, SectionLevelInfo *sectionLevelInfo, char **verseText);
-void cleanBuf(char *buf);
-
-SWCompress *compress = 0;
-
-int main(int argc, char **argv) {
-
- compress = new LZSSCompress();
- char *buf;
- Version versionRecord;
- VSyncHeader vSyncHeaderRecord;
- VSyncBooksInfo *vSyncBooksInfo;
- SectionsHeader sectionsHeaderRecord;
- ViewableHeader viewableHeaderRecord;
-
-
- if (argc < 2) {
- cerr << "usage: "<< *argv << " <database to step module>\n";
- exit (-1);
- }
-
- string bookpath = argv[1];
- string fileName;
-
- if ((argv[1][strlen(argv[1])-1] != '/') &&
- (argv[1][strlen(argv[1])-1] != '\\'))
- bookpath += "/";
-
- fileName = bookpath + "Book.dat";
- int fdbook = FileMgr::openFileReadOnly(fileName.c_str());
-
- if (fdbook < 1) {
- cerr << "error, couldn't open file: " << fileName << "\n";
- exit (-2);
- }
-
- readVersion(fdbook, &versionRecord);
- readHeaderControlWordAreaText(fdbook, &buf);
- delete [] buf;
-
-
- fileName = bookpath + "Viewable.idx";
- int fdviewable = FileMgr::openFileReadOnly(fileName.c_str());
-
- if (fdviewable < 1) {
- cerr << "error, couldn't open file: " << fileName << "\n";
- exit (-3);
- }
-
- readVersion(fdviewable, &versionRecord);
- readViewableHeader(fdviewable, &viewableHeaderRecord);
-
- VIEWABLEBLOCKSTART = lseek(fdviewable, 0, SEEK_CUR);
- VIEWABLEBLOCKSIZE = viewableHeaderRecord.blockEntriesSize;
-
-
- fileName = bookpath + "Vsync.idx";
- int fdvsync = FileMgr::openFileReadOnly(fileName.c_str());
-
- if (fdvsync < 1) {
- cerr << "error, couldn't open file: " << fileName << "\n";
- exit (-4);
- }
-
- fileName = bookpath + "Sections.idx";
- int fdsections = FileMgr::openFileReadOnly(fileName.c_str());
-
- if (fdsections < 1) {
- cerr << "error, couldn't open file: " << fileName << "\n";
- exit (-4);
- }
- readVersion(fdsections, &versionRecord);
- readSectionsHeader(fdsections, &sectionsHeaderRecord);
- SECTIONSLEVELSTART = lseek(fdsections, 0, SEEK_CUR);
- SECTIONSLEVELSIZE = sectionsHeaderRecord.levelEntriesSize;
-
- readVersion(fdvsync, &versionRecord);
- readVSyncHeader(fdvsync, &vSyncHeaderRecord);
- readVSyncBooksInfo(fdvsync, &vSyncHeaderRecord, &vSyncBooksInfo);
- int bookCount = vSyncHeaderRecord.endBookNumber - vSyncHeaderRecord.startBookNumber;
- for (int i = 0; i <= bookCount; i++) {
- displayBook(fdbook, fdviewable, fdvsync, fdsections, &vSyncBooksInfo[i]);
- }
-
- close(fdviewable);
- close(fdvsync);
- close(fdsections);
- close(fdbook);
-
-}
-
-
-
-void readVersion(int fd, Version *versionRecord) {
-
- read(fd, &(versionRecord->versionRecordSize), 2);
- read(fd, &(versionRecord->publisherID), 2);
- read(fd, &(versionRecord->bookID), 2);
- read(fd, &(versionRecord->setID), 2);
- read(fd, &(versionRecord->conversionProgramVerMajor), 1);
- read(fd, &(versionRecord->conversionProgramVerMinor), 1);
- read(fd, &(versionRecord->leastCompatSTEPVerMajor), 1);
- read(fd, &(versionRecord->leastCompatSTEPVerMinor), 1);
- read(fd, &(versionRecord->encryptionType), 1);
- read(fd, &(versionRecord->editionID), 1);
- read(fd, &(versionRecord->modifiedBy), 2);
-
- int skip = versionRecord->versionRecordSize - 16/*sizeof(struct Version*/;
-
- if (skip) {
- char *skipbuf = new char[skip];
- read(fd, skipbuf, skip);
- delete [] skipbuf;
- }
-}
-
-
-void readSectionsHeader(int fd, SectionsHeader *sectionsHeaderRecord) {
-
- read(fd, &(sectionsHeaderRecord->sectionsHeaderRecordSize), 2);
- read(fd, &(sectionsHeaderRecord->levelEntriesCount), 4);
- read(fd, &(sectionsHeaderRecord->glossEntriesCount), 4);
- read(fd, &(sectionsHeaderRecord->levelEntriesSize), 2);
- read(fd, &(sectionsHeaderRecord->reserved), 4);
-
- int skip = sectionsHeaderRecord->sectionsHeaderRecordSize - 16/*sizeof(struct ViewableHeader)*/;
-
- if (skip) {
- char *skipbuf = new char[skip];
- read(fd, skipbuf, skip);
- delete [] skipbuf;
- }
-}
-
-
-void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord) {
-
- read(fd, &(viewableHeaderRecord->viewableHeaderRecordSize), 2);
- read(fd, &(viewableHeaderRecord->viewableBlocksCount), 4);
- read(fd, &(viewableHeaderRecord->glossBlocksCount), 4);
- read(fd, &(viewableHeaderRecord->compressionType), 1);
- read(fd, &(viewableHeaderRecord->reserved1), 1);
- read(fd, &(viewableHeaderRecord->blockEntriesSize), 2);
- read(fd, &(viewableHeaderRecord->reserved2), 2);
-
- int skip = viewableHeaderRecord->viewableHeaderRecordSize - 16/*sizeof(struct ViewableHeader)*/;
-
- if (skip) {
- char *skipbuf = new char[skip];
- read(fd, skipbuf, skip);
- delete [] skipbuf;
- }
-}
-
-
-void readVSyncHeader(int fd, VSyncHeader *vSyncHeaderRecord) {
-
- read(fd, &(vSyncHeaderRecord->vSyncHeaderRecordSize), 2);
- read(fd, &(vSyncHeaderRecord->startBookNumber), 2);
- read(fd, &(vSyncHeaderRecord->endBookNumber), 2);
- read(fd, &(vSyncHeaderRecord->bookPointerEntriesSize), 2);
- read(fd, &(vSyncHeaderRecord->syncPointEntriesSize), 2);
- read(fd, &(vSyncHeaderRecord->reserved1_1), 4);
- read(fd, &(vSyncHeaderRecord->reserved1_2), 2);
-
- int skip = vSyncHeaderRecord->vSyncHeaderRecordSize - 16/*sizeof(VSyncHeader)*/;
-
- if (skip) {
- char *skipbuf = new char[skip];
- read(fd, skipbuf, skip);
- delete [] skipbuf;
- }
-}
-
-
-void readViewableBlockText(int fd, ViewableBlock *vb, char **buf) {
- unsigned long size = vb->size;
-
- *buf = new char [ ((vb->size > vb->uncompressedSize) ? vb->size : vb->uncompressedSize) + 1 ];
- lseek(fd, vb->offset, SEEK_SET);
- read(fd, *buf, vb->size);
-
- compress->zBuf(&size, *buf);
- strcpy(*buf, compress->Buf());
-}
-
-
-void readViewableBlock(int fd, ViewableBlock *vb) {
-
- read(fd, &(vb->offset), 4);
- read(fd, &(vb->uncompressedSize), 4);
- read(fd, &(vb->size), 4);
-}
-
-
-void readHeaderControlWordAreaText(int fd, char **buf) {
- long headerControlWordAreaSize;
- read(fd, &headerControlWordAreaSize, 4);
-
- *buf = new char [headerControlWordAreaSize + 1];
-
- read(fd, *buf, headerControlWordAreaSize);
- (*buf)[headerControlWordAreaSize] = 0;
-
-}
-
-void readVSyncBooksInfo(int fd, VSyncHeader *vSyncHeaderRecord, VSyncBooksInfo **vSyncBooksInfo) {
-
- int bookCount = vSyncHeaderRecord->endBookNumber - vSyncHeaderRecord->startBookNumber;
- *vSyncBooksInfo = new VSyncBooksInfo[bookCount];
- for (int i = 0; i <= bookCount; i++) {
- read(fd, &(*vSyncBooksInfo)[i].offset, 4);
- read(fd, &(*vSyncBooksInfo)[i].count, 2);
- }
-}
-
-void displayBook(int fdbook, int fdviewable, int fdvsync, int fdsections, VSyncBooksInfo *vSyncBooksInfo) {
- VSyncPoint vSyncPoint;
-
- lseek(fdvsync, vSyncBooksInfo->offset, SEEK_SET);
-
- for (int i = 0; i < vSyncBooksInfo->count; i++) {
-
- SectionLevelInfo sectionLevelInfo;
- char *sectionName;
- char *verseText;
-
- read(fdvsync, &(vSyncPoint.chapter), 2);
- read(fdvsync, &(vSyncPoint.verse), 2);
- read(fdvsync, &(vSyncPoint.offset), 4);
- vSyncPoint.offset = SECTIONSLEVELSTART + (vSyncPoint.offset * SECTIONSLEVELSIZE);
- lseek(fdsections, vSyncPoint.offset, SEEK_SET);
- readSectionLevelInfo(fdsections, &sectionLevelInfo);
- readSectionName(fdsections, &sectionLevelInfo, &sectionName);
- cout << sectionName << " ";
- delete [] sectionName;
- extractVerseText(fdviewable, fdbook, &sectionLevelInfo, &verseText);
- cleanBuf(verseText);
- cout << verseText << "\n";
- delete [] verseText;
- }
-}
-
-
-void extractVerseText(int fdviewable, int fdbook, SectionLevelInfo *sectionLevelInfo, char **verseText) {
- char numberBuf[16];
- string startToken;
- ViewableBlock vb;
- int len = 0;
- static long lastEntryOffset = -1;
- static class FreeCachedEntryText {
- public:
- char *entryText;
- FreeCachedEntryText() { entryText = 0; }
- ~FreeCachedEntryText() { if (entryText) delete [] entryText; }
- } _freeCachedEntryText;
-
- if (sectionLevelInfo->viewableOffset != lastEntryOffset) {
- if (_freeCachedEntryText.entryText)
- delete [] _freeCachedEntryText.entryText;
-
- lseek(fdviewable, sectionLevelInfo->viewableOffset, SEEK_SET);
- readViewableBlock(fdviewable, &vb);
- readViewableBlockText(fdbook, &vb, &(_freeCachedEntryText.entryText));
- lastEntryOffset = sectionLevelInfo->viewableOffset;
- }
- sprintf(numberBuf, "%d", sectionLevelInfo->startLevel);
- startToken = "\\stepstartlevel";
- startToken += numberBuf;
- char *start = strstr(_freeCachedEntryText.entryText, startToken.c_str());
- if (start) {
- start += strlen(startToken.c_str());
- char *end = strstr(start, "\\stepstartlevel");
- if (end)
- len = end - start;
- else len = strlen(start);
- }
- *verseText = new char [ len + 1 ];
- strncpy(*verseText, start, len);
- (*verseText)[len] = 0;
-}
-
-
-void readSectionName(int fd, SectionLevelInfo *sli, char **name) {
- short size;
- lseek(fd, sli->nameOffset, SEEK_SET);
- read(fd, &size, 2);
- *name = new char [ size + 1 ];
- read(fd, *name, size);
- (*name)[size] = 0;
-}
-
-void readSectionLevelInfo(int fd, SectionLevelInfo *sli) {
-
- read(fd, &(sli->parentOffset), 4);
- read(fd, &(sli->previousOffset), 4);
- read(fd, &(sli->nextOffset), 4);
- read(fd, &(sli->viewableOffset), 4);
- sli->viewableOffset = VIEWABLEBLOCKSTART + (VIEWABLEBLOCKSIZE * sli->viewableOffset);
- read(fd, &(sli->startLevel), 2);
- read(fd, &(sli->level), 1);
- read(fd, &(sli->nameOffset), 4);
- read(fd, &(sli->outSync_1), 4);
- read(fd, &(sli->outSync_2), 2);
-}
-
-void cleanBuf(char *buf) {
- char *from = buf;
- char *to = buf;
-
- while (*from) {
- if ((*from != 10) && (*from != 13)) {
- *to++ = *from++;
- }
- else {
- from++;
- }
- }
- *to = 0;
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/stepdump.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/stepdump.cpp
deleted file mode 100644
index 3b9892e..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/stepdump.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-/******************************************************************************
- *
- * stepdump.cpp - Utility to dump a STEP module
- *
- * $Id: stepdump.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 2000-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
- #pragma warning( disable: 4996 )
-#endif
-
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#include <iostream>
-#include <string>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <filemgr.h>
-#include <lzsscomprs.h>
-
-using namespace std;
-#ifndef NO_SWORD_NAMESPACE
-using namespace sword;
-#endif
-
-typedef struct {
- short versionRecordSize;
- short publisherID;
- short bookID;
- short setID;
- char conversionProgramVerMajor;
- char conversionProgramVerMinor;
- char leastCompatSTEPVerMajor;
- char leastCompatSTEPVerMinor;
- char encryptionType;
- char editionID;
- short modifiedBy;
-} Version;
-
-typedef struct {
- short viewableHeaderRecordSize;
- long viewableBlocksCount; // this is listed as nonGlossBlocksCount in spec!
- long glossBlocksCount;
- char compressionType; // 0 - none; 1 - LZSS
- char reserved1;
- short blockEntriesSize;
- short reserved2;
-} ViewableHeader;
-
-typedef struct {
- long offset;
- long uncompressedSize;
- long size;
-} ViewableBlock;
-
-void readVersion(int fd, Version *versionRecord);
-void readHeaderControlWordAreaText(int fd, char **buf);
-void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord);
-void readViewableBlock(int fd, ViewableBlock *vb);
-void readViewableBlockText(int fd, ViewableBlock *vb, char **buf);
-
-SWCompress *compress = 0;
-
-int main(int argc, char **argv) {
-
- compress = new LZSSCompress();
- char *buf;
- Version versionRecord;
- ViewableHeader viewableHeaderRecord;
-
- if (argc < 2) {
- cerr << "usage: "<< *argv << " <database to step module>\n";
- exit (-1);
- }
-
- string bookpath = argv[1];
- string fileName;
-
- if ((argv[1][strlen(argv[1])-1] != '/') &&
- (argv[1][strlen(argv[1])-1] != '\\'))
- bookpath += "/";
-
- fileName = bookpath + "Book.dat";
- int fd = FileMgr::openFileReadOnly(fileName.c_str());
-
- if (fd < 1) {
- cerr << "error, couldn't open file: " << fileName << "\n";
- exit (-2);
- }
-
- readVersion(fd, &versionRecord);
- readHeaderControlWordAreaText(fd, &buf);
- delete [] buf;
-
-
- fileName = bookpath + "Viewable.idx";
- int fdv = FileMgr::openFileReadOnly(fileName.c_str());
-
- if (fdv < 1) {
- cerr << "error, couldn't open file: " << fileName << "\n";
- exit (-3);
- }
-
- readVersion(fdv, &versionRecord);
- readViewableHeader(fdv, &viewableHeaderRecord);
-
- ViewableBlock vb;
-
- cout << "\n\nReading special preface viewable BLOCK 0";
-
- readViewableBlock(fdv, &vb);
- readViewableBlockText(fd, &vb, &buf);
- delete [] buf;
-
- int nonGlossBlocksCount = viewableHeaderRecord.viewableBlocksCount
- - viewableHeaderRecord.glossBlocksCount;
-
- cout << "\n\nReading " << nonGlossBlocksCount << " non-glossary viewable blocks";
- // 1 because we already read the first block above
- for (int i = 1; i < nonGlossBlocksCount; i++) {
- cout << "\nNon-Glossary viewable block: " << i;
- readViewableBlock(fdv, &vb);
- readViewableBlockText(fd, &vb, &buf);
- delete [] buf;
- }
-
- cout << "\n\nReading " << viewableHeaderRecord.glossBlocksCount << " glossary viewable blocks";
- for (int i = 0; i < viewableHeaderRecord.glossBlocksCount; i++) {
- cout << "\nGlossary viewable block: " << i;
- readViewableBlock(fdv, &vb);
- readViewableBlockText(fd, &vb, &buf);
- delete [] buf;
- }
-
- close(fdv);
- close(fd);
-
-}
-
-
-
-void readVersion(int fd, Version *versionRecord) {
-
- cout << "\n\nReading Version Record (" << 16/*sizeof(struct Version)*/ << " bytes)\n\n";
-// DO NOT USE BECAUSE OF RECORD BYTE ALIGNMENT PROBLEMS
-// read(fd, &versionRecord, sizeof(struct Version));
-
- cout << "Version Record Information\n";
- read(fd, &(versionRecord->versionRecordSize), 2);
- cout << "\tversionRecordSize: " << versionRecord->versionRecordSize << "\n";
- read(fd, &(versionRecord->publisherID), 2);
- cout << "\tpublisherID: " << versionRecord->publisherID << "\n";
- read(fd, &(versionRecord->bookID), 2);
- cout << "\tbookID: " << versionRecord->bookID << "\n";
- read(fd, &(versionRecord->setID), 2);
- cout << "\tsetID: " << versionRecord->setID << "\n";
- read(fd, &(versionRecord->conversionProgramVerMajor), 1);
- cout << "\tconversionProgramVerMajor: " << (int)versionRecord->conversionProgramVerMajor << "\n";
- read(fd, &(versionRecord->conversionProgramVerMinor), 1);
- cout << "\tconversionProgramVerMinor: " << (int)versionRecord->conversionProgramVerMinor << "\n";
- read(fd, &(versionRecord->leastCompatSTEPVerMajor), 1);
- cout << "\tleastCompatSTEPVerMajor: " << (int)versionRecord->leastCompatSTEPVerMajor << "\n";
- read(fd, &(versionRecord->leastCompatSTEPVerMinor), 1);
- cout << "\tleastCompatSTEPVerMinor: " << (int)versionRecord->leastCompatSTEPVerMinor << "\n";
- read(fd, &(versionRecord->encryptionType), 1);
- cout << "\tencryptionType: " << (int)versionRecord->encryptionType << "\n";
- read(fd, &(versionRecord->editionID), 1);
- cout << "\teditionID: " << (int)versionRecord->editionID << "\n";
- read(fd, &(versionRecord->modifiedBy), 2);
- cout << "\tmodifiedBy: " << versionRecord->modifiedBy << "\n";
-
- int skip = versionRecord->versionRecordSize - 16/*sizeof(struct Version*/;
-
- if (skip) {
- cout << "\nSkipping " << skip << " unknown bytes.\n";
- char *skipbuf = new char[skip];
- read(fd, skipbuf, skip);
- delete [] skipbuf;
- }
-}
-
-
-void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord) {
-
- cout << "\n\nReading Viewable Header Record (" << 16/*sizeof(struct ViewableHeader)*/ << " bytes)\n\n";
-
-// DO NOT USE BECAUSE OF RECORD BYTE ALIGNMENT PROBLEMS
-// read(fd, &viewableHeaderRecord, sizeof(struct ViewableHeader));
-
- cout << "Viewable Header Record Information\n";
- read(fd, &(viewableHeaderRecord->viewableHeaderRecordSize), 2);
- cout << "\tviewableHeaderRecordSize: " << viewableHeaderRecord->viewableHeaderRecordSize << "\n";
- read(fd, &(viewableHeaderRecord->viewableBlocksCount), 4);
- cout << "\tviewableBlocksCount: " << viewableHeaderRecord->viewableBlocksCount << "\n";
- read(fd, &(viewableHeaderRecord->glossBlocksCount), 4);
- cout << "\tglossBlocksCount: " << viewableHeaderRecord->glossBlocksCount << "\n";
- read(fd, &(viewableHeaderRecord->compressionType), 1);
- cout << "\tcompressionType: " << (int)viewableHeaderRecord->compressionType << "(0 - none; 1 - LZSS)\n";
- read(fd, &(viewableHeaderRecord->reserved1), 1);
- cout << "\treserved1: " << (int)viewableHeaderRecord->reserved1 << "\n";
- read(fd, &(viewableHeaderRecord->blockEntriesSize), 2);
- cout << "\tblockEntriesSize: " << viewableHeaderRecord->blockEntriesSize << "\n";
- read(fd, &(viewableHeaderRecord->reserved2), 2);
- cout << "\treserved2: " << viewableHeaderRecord->reserved2 << "\n";
-
- int skip = viewableHeaderRecord->viewableHeaderRecordSize - 16/*sizeof(struct ViewableHeader)*/;
-
- if (skip) {
- cout << "\nSkipping " << skip << " unknown bytes.\n";
- char *skipbuf = new char[skip];
- read(fd, skipbuf, skip);
- delete [] skipbuf;
- }
-}
-
-
-void readViewableBlockText(int fd, ViewableBlock *vb, char **buf) {
- unsigned long size = vb->size;
-
- *buf = new char [ ((vb->size > vb->uncompressedSize) ? vb->size : vb->uncompressedSize) + 1 ];
- lseek(fd, vb->offset, SEEK_SET);
- read(fd, *buf, vb->size);
-
- compress->zBuf(&size, *buf);
- strcpy(*buf, compress->Buf());
- cout << "Viewable Block Text:\n";
- cout << *buf << "\n\n";
-}
-
-
-void readViewableBlock(int fd, ViewableBlock *vb) {
-
- cout << "\n\nReading Viewable Block (" << 12/*sizeof(struct ViewableHeader)*/ << " bytes)\n\n";
-
-// DO NOT USE BECAUSE OF RECORD BYTE ALIGNMENT PROBLEMS
-// read(fd, &vb, sizeof(struct ViewableBlock));
-
- cout << "Viewable Block Information\n";
- read(fd, &(vb->offset), 4);
- cout << "\toffset: " << vb->offset << "\n";
- read(fd, &(vb->uncompressedSize), 4);
- cout << "\tuncompressedSize: " << vb->uncompressedSize << "\n";
- read(fd, &(vb->size), 4);
- cout << "\tsize: " << vb->size << "\n";
-}
-
-
-void readHeaderControlWordAreaText(int fd, char **buf) {
- long headerControlWordAreaSize;
- read(fd, &headerControlWordAreaSize, 4);
- cout << "Reading Header Control Word Area (" << headerControlWordAreaSize << " bytes)\n\n";
-
- *buf = new char [headerControlWordAreaSize + 1];
-
- read(fd, *buf, headerControlWordAreaSize);
- (*buf)[headerControlWordAreaSize] = 0;
-
- cout << "headerControlWordArea:\n" << *buf << "\n";
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/treeidxutil.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/treeidxutil.cpp
deleted file mode 100644
index abb9151..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/treeidxutil.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/******************************************************************************
- *
- * treeidxutil.cpp -
- *
- * $Id: treeidxutil.cpp 2833 2013-06-29 06:40:28Z chrislit $
- *
- * Copyright 2002-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
-#endif
-
-#include <entriesblk.h>
-#include <iostream>
-#include <string>
-#include <stdio.h>
-#include <treekeyidx.h>
-
-#ifndef NO_SWORD_NAMESPACE
-using namespace sword;
-#endif
-
-void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
- if (!target)
- target = &treeKey;
-
- unsigned long currentOffset = target->getOffset();
- std::cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
- for (int i = 0; i < level; i++) std::cout << "\t";
- std::cout << treeKey.getLocalName() << std::endl;
- if (treeKey.firstChild()) {
- printTree(treeKey, target, level+1);
- treeKey.parent();
- }
- if (treeKey.nextSibling())
- printTree(treeKey, target, level);
-
-}
-
-
-void printLocalName(TreeKeyIdx *treeKey) {
- std::cout << "locaName: " << treeKey->getLocalName() << std::endl;
-}
-
-
-void setLocalName(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter New Node Name: ";
- fgets(buf, 1000, stdin);
- treeKey->setLocalName(buf);
- treeKey->save();
-}
-
-
-void assurePath(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter path: ";
- fgets(buf, 1000, stdin);
- treeKey->assureKeyPath(buf);
-}
-
-
-void appendSibbling(TreeKeyIdx *treeKey) {
- if (treeKey->getOffset()) {
- char buf[1023];
- std::cout << "Enter New Sibbling Name: ";
- fgets(buf, 1000, stdin);
- treeKey->append();
- treeKey->setLocalName(buf);
- treeKey->save();
- }
- else std::cout << "Can't add sibling to root node\n";
-}
-
-
-void appendChild(TreeKeyIdx *treeKey) {
- char buf[1023];
- std::cout << "Enter New Child Name: ";
- fgets(buf, 1000, stdin);
- treeKey->appendChild();
- treeKey->setLocalName(buf);
- treeKey->save();
-}
-
-
-void removeEntry(EntriesBlock *eb, int index) {
- if (index < eb->getCount()) {
- std::cout << "Removing entry [" << index << "]\n";
- eb->removeEntry(index);
- }
- else std::cout << "Invalid entry number\n\n";
-}
-
-
-int main(int argc, char **argv) {
-
- if (argc != 2) {
- fprintf(stderr, "usage: %s <tree/key/data/path>\n", *argv);
- exit(-1);
- }
-
- TreeKeyIdx *treeKey = new TreeKeyIdx(argv[1]);
-
- if (treeKey->popError()) {
- treeKey->create(argv[1]);
- delete treeKey;
- treeKey = new TreeKeyIdx(argv[1]);
- }
- TreeKeyIdx root = *treeKey;
-
- std::string input;
- char line[1024];
-
- do {
- std::cout << "[" << treeKey->getText() << "] > ";
- fgets(line, 1000, stdin);
- input = line;
- if (input.length() > 0) {
- switch (input[0]) {
- case 'n': printLocalName(treeKey); break;
- case 's': setLocalName(treeKey); break;
- case 'p': root.root(); printTree(root, treeKey); break;
- case 'a': appendSibbling(treeKey); break;
- case 'c': appendChild(treeKey); break;
- case 'j': treeKey->nextSibling(); break;
- case 'g': assurePath(treeKey); break;
- case 'k': treeKey->previousSibling(); break;
- case 'h': treeKey->parent(); break;
- case 'l': treeKey->firstChild(); break;
- case 'r': treeKey->root(); break;
- case 'q': break;
- case '?':
- default:
- std::cout << "\n p - print tree\n";
- std::cout << " n - get local name\n";
- std::cout << " s - set local name\n";
- std::cout << " j - next sibbling\n";
- std::cout << " k - previous sibbling\n";
- std::cout << " h - parent\n";
- std::cout << " l - first child\n";
- std::cout << " r - root\n";
- std::cout << " a - append sibbling\n";
- std::cout << " c - append child\n";
- std::cout << " u - get user data\n";
- std::cout << " d - set user data\n";
- std::cout << " g - goto path; create if it doesn't exist\n";
- std::cout << " q - quit\n\n";
- break;
- }
- }
- }
- while (input.compare("q"));
-
- delete treeKey;
-
- return 0;
-}
diff --git a/.pc/12_fix_compiler_warnings.diff/utilities/vpl2mod.cpp b/.pc/12_fix_compiler_warnings.diff/utilities/vpl2mod.cpp
deleted file mode 100644
index c696541..0000000
--- a/.pc/12_fix_compiler_warnings.diff/utilities/vpl2mod.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/******************************************************************************
- *
- * vpl2mod.cpp - Utility to import VPL formatted modules
- *
- * $Id: vpl2mod.cpp 2921 2013-07-28 17:21:44Z scribe $
- *
- * Copyright 2000-2013 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.
- *
- */
-
-#ifdef _MSC_VER
- #pragma warning( disable: 4251 )
- #pragma warning( disable: 4996 )
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <filemgr.h>
-#include <swmgr.h>
-#include <rawtext.h>
-#include <swbuf.h>
-#include <versekey.h>
-
-#ifndef NO_SWORD_NAMESPACE
-using sword::FileMgr;
-using sword::SWMgr;
-using sword::RawText;
-using sword::VerseKey;
-using sword::SWBuf;
-using sword::SW_POSITION;
-#endif
-
-
-char readline(int fd, char **buf) {
- char ch;
- if (*buf)
- delete [] *buf;
- *buf = 0;
- int len;
-
-
- long index = lseek(fd, 0, SEEK_CUR);
- // clean up any preceding white space
- while ((len = read(fd, &ch, 1)) == 1) {
- if ((ch != 13) && (ch != ' ') && (ch != '\t'))
- break;
- else index++;
- }
-
-
- while (ch != 10) {
- if ((len = read(fd, &ch, 1)) != 1)
- break;
- }
-
- int size = (lseek(fd, 0, SEEK_CUR) - index) - 1;
-
- *buf = new char [ size + 1 ];
-
- if (size > 0) {
- lseek(fd, index, SEEK_SET);
- read(fd, *buf, size);
- read(fd, &ch, 1); //pop terminating char
- (*buf)[size] = 0;
-
- // clean up any trailing junk on buf
- for (char *it = *buf+(strlen(*buf)-1); it > *buf; it--) {
- if ((*it != 10) && (*it != 13) && (*it != ' ') && (*it != '\t'))
- break;
- else *it = 0;
- }
- }
- else **buf = 0;
- return !len;
-}
-
-
-char *parseVReg(char *buf) {
- char stage = 0;
-
- while (*buf) {
- switch (stage) {
- case 0:
- if (isalpha(*buf))
- stage++;
- break;
- case 1:
- if (isdigit(*buf))
- stage++;
- break;
- case 2:
- if (*buf == ':')
- stage++;
- break;
- case 3:
- if (isdigit(*buf))
- stage++;
- break;
- case 4:
- if (*buf == ' ') {
- *buf = 0;
- return ++buf;
- }
- break;
- }
- buf++;
- }
- return (stage == 4) ? buf : 0; // if we got to stage 4 return after key buf, else return 0;
-}
-
-
-bool isKJVRef(const char *buf) {
- VerseKey vk, test;
- vk.setAutoNormalize(false);
- vk.setIntros(true); // turn on mod/testmnt/book/chap headings
- vk.setPersist(true);
- // lets do some tests on the verse --------------
- vk = buf;
- test = buf;
-
- if (vk.getTestament() && vk.getBook() && vk.getChapter() && vk.getVerse()) { // if we're not a heading
-// std::cerr << (const char*)vk << " == " << (const char*)test << std::endl;
- return (vk == test);
- }
- else return true; // no check if we're a heading... Probably bad.
-}
-
-
-void fixText(char *text) {
- char *to = text;
- while(*text) {
- *to++ = *text++;
- *to++ = *text++;
- if (!*text)
- break;
- if (*text != ' ')
- std::cerr << "problem\n";
- else text++;
- }
- *to = 0;
-}
-
-int main(int argc, char **argv) {
-
- // Let's test our command line arguments
- if (argc < 2) {
-// fprintf(stderr, "usage: %s <vpl_file> </path/to/mod> [0|1 - file includes prepended verse references]\n", argv[0]);
- fprintf(stderr, "usage: %s <source_vpl_file> </path/to/output/mod/> [0|1 - prepended verse refs] [0|1 - NT only]\n\n", argv[0]);
- fprintf(stderr, "\tWARNING: THIS IS CURRENTLY A KJV-VERSIFICATION-ONLY UTILITY\n");
- fprintf(stderr, "\tWith no verse refs, source file must contain exactly 31102 lines.\n");
- fprintf(stderr, "\tThis is KJV verse count plus headings for MODULE,\n");
- fprintf(stderr, "\tTESTAMENT, BOOK, CHAPTER. An example snippet follows:\n\n");
- fprintf(stderr, "\t\tMODULE HEADER\n");
- fprintf(stderr, "\t\tOLD TESTAMENT HEADER\n");
- fprintf(stderr, "\t\tGENESIS HEADER\n");
- fprintf(stderr, "\t\tCHAPTER 1 HEADER\n");
- fprintf(stderr, "\t\tIn the beginning...\n\n");
- fprintf(stderr, "\t... implying there must also be a CHAPTER2 HEADER,\n");
- fprintf(stderr, "\tEXODUS HEADER, NEW TESTAMENT HEADER, etc. If there is no text for\n");
- fprintf(stderr, "\tthe header, a blank line must, at least, hold place.\n\n");
- fprintf(stderr, "\tWith verse refs, source file must simply contain any number of lines,\n");
- fprintf(stderr, "\tthat begin with the verse reference for which it is an entry. e.g.:\n\n");
- fprintf(stderr, "\t\tgen 1:0 CHAPTER 1 HEADER\n");
- fprintf(stderr, "\t\tgen 1:1 In the beginning...\n\n");
- exit(-1);
- }
-
- // Let's see if we can open our input file
- int fd = FileMgr::openFileReadOnly(argv[1]);
- if (fd < 0) {
- fprintf(stderr, "error: %s: couldn't open input file: %s \n", argv[0], argv[1]);
- exit(-2);
- }
-
- // Try to initialize a default set of datafiles and indicies at our
- // datapath location passed to us from the user.
- if (RawText::createModule(argv[2])) {
- fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
- exit(-3);
- }
-
- // not used yet, but for future support of a vpl file with each line
- // prepended with verse reference, eg. "Gen 1:1 In the beginning..."
- bool vref = false;
- if (argc > 3)
- vref = (argv[3][0] == '0') ? false : true;
-
- // if 'nt' is the 4th arg, our vpl file only has the NT
- bool ntonly = false;
- if (argc > 4)
- ntonly = (argv[4][0] == '0') ? false : true;
-
- // Do some initialization stuff
- char *buffer = 0;
- RawText mod(argv[2]); // open our datapath with our RawText driver.
- VerseKey vk;
- vk.setAutoNormalize(false);
- vk.setIntros(true); // turn on mod/testmnt/book/chap headings
- vk.setPersist(true);
-
- mod.setKey(vk);
-
- // Loop through module from TOP to BOTTOM and set next line from
- // input file as text for this entry in the module
- mod = TOP;
- if (ntonly) vk = "Matthew 1:1";
-
- int successive = 0; //part of hack below
- while ((!mod.popError()) && (!readline(fd, &buffer))) {
- if (*buffer == '|') // comments, ignore line
- continue;
- if (vref) {
- const char *verseText = parseVReg(buffer);
- if (!verseText) { // if we didn't find a valid verse ref
- std::cerr << "No valid verse ref found on line: " << buffer << "\n";
- exit(-4);
- }
-
- vk = buffer;
- if (vk.popError()) {
- std::cerr << "Error parsing key: " << buffer << "\n";
- exit(-5);
- }
- SWBuf orig = mod.getRawEntry();
-
- if (!isKJVRef(buffer)) {
- VerseKey origVK = vk;
- /* This block is functioning improperly -- problem with AutoNormalize???
- do {
- vk--;
- }
- while (!vk.popError() && !isKJVRef(vk)); */
- //hack to replace above:
- successive++;
- vk -= successive;
- orig = mod.getRawEntry();
-
- std::cerr << "Not a valid KJV ref: " << origVK << "\n";
- std::cerr << "appending to ref: " << vk << "\n";
- orig += " [ (";
- orig += origVK;
- orig += ") ";
- orig += verseText;
- orig += " ] ";
- verseText = orig;
- }
- else {
- successive = 0;
- }
-
- if (orig.length() > 1)
- std::cerr << "Warning, overwriting verse: " << vk << std::endl;
-
- // ------------- End verse tests -----------------
- mod << verseText; // save text to module at current position
- }
- else {
- fixText(buffer);
- mod << buffer; // save text to module at current position
- mod++; // increment module position
- }
- }
-
- // clear up our buffer that readline might have allocated
- if (buffer)
- delete [] buffer;
-}
diff --git a/.pc/applied-patches b/.pc/applied-patches
deleted file mode 100644
index 6bc1e7e..0000000
--- a/.pc/applied-patches
+++ /dev/null
@@ -1,5 +0,0 @@
-12_fix_compiler_warnings.diff
-13_curl.diff
-multiarch-clucene.patch
-no-included-zconf.h.diff
-dso-missing-shared.patch
diff --git a/.pc/dso-missing-shared.patch/CMakeLists.txt b/.pc/dso-missing-shared.patch/CMakeLists.txt
deleted file mode 100644
index 7d943d5..0000000
--- a/.pc/dso-missing-shared.patch/CMakeLists.txt
+++ /dev/null
@@ -1,281 +0,0 @@
-# TODO: write FindICU (icu-config only for 2.2 and up) -- currently taken from another CMake system
-# limit pkg-config version to >= 0.14, demo, utilities, doc, tests
-#
-# NOTES: Defaults to build type of Shared
-# Forces out-of-source tree build
-#
-#
-# This file started on 18 January 2010 by Gregory Hellings
-# It is ceded to The SWORD Library developers and CrossWire under the terms
-# of their own GPLv2 license and all copyright is transferred to them for
-# all posterity and eternity, wherever such transfer is possible. Where it is
-# not, then this file is released under the GPLv2 by myself.
-#
-#
-# A CMake port of the SWORD build system... we hope
-PROJECT(libsword CXX C)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
-SET(SWORD_VERSION 1.7.3)
-
-# Make sure it's an out-of-stream build
-IF(${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
- MESSAGE(FATAL_ERROR "Please invoke CMake from a different directory than the source.")
-ENDIF(${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
-
-MESSAGE(STATUS "Configuring your system to build libsword.")
-
-###########################################################################################
-# Here are some basic CMake variables we need to setup in order for things to work properly
-#
-# Our include directory, for our own internally created "FIND_PACKAGE" calls, like CLucene
-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-# User options
-INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/options.cmake")
-# Source variables
-INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/sources.cmake")
-# Our local includes
-INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/include") # For swversion.h
-INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include") # For everything else
-
-###########################################################################################
-# This will look for various libraries that libsword builds against. There is no REQUIRED
-# attribute added here, since all of the libraries here are not, in actuality, required.
-#
-MESSAGE(STATUS "\n-- SEARCHING FOR SYTEM PACKAGES")
-# Find our packages
-FIND_PACKAGE(ZLIB QUIET)
-FIND_PACKAGE(ICU QUIET)
-FIND_PACKAGE(CURL QUIET)
-FIND_PACKAGE(CLucene QUIET)
-FIND_PACKAGE(PkgConfig QUIET)
-FIND_PACKAGE(Regex QUIET)
-
-###########################################################################################
-# Based on user input and the results of the above tests, we may need to mux with the source
-# files to use an internal version of ZLib, cURL-like stuff, or CLucene replacements. These
-# lines below will modify the source files directories so that the required files are only
-# included if the option is needed.
-#
-# Modify the source variables and set necessary definitions, this is a rather long segment,
-# so I have sorted it out into its own file
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/muxsources.cmake)
-
-################################################################################################
-# This actually creates the build target that is the libsword building target to be generated.
-# Most of the work for configuration is done above, already.
-#
-# I want to do this manually, there might be reason in the future
-IF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*" OR NOT LIBSWORD_LIBRARY_TYPE)
- ADD_LIBRARY(sword SHARED ${sword_SOURCES})
- MESSAGE(STATUS "Building Shared library.")
- SET(BUILDING_SHARED 1)
- SET(SWORD_LINK_NAME sword)
-ENDIF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*" OR NOT LIBSWORD_LIBRARY_TYPE)
-
-IF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Static.*" OR NOT LIBSWORD_LIBRARY_TYPE)
- ADD_LIBRARY(sword_static STATIC ${sword_SOURCES})
- SET_TARGET_PROPERTIES(sword_static PROPERTIES COMPILE_FLAGS "-fPIC")
- SET(BUILDING_STATIC 1)
- # Defaults to linking against the shared if it is also being built
- IF(NOT BUILDING_SHARED)
- SET(SWORD_LINK_NAME sword_static)
- ENDIF(NOT BUILDING_SHARED)
- # With MSVC, the .dll files also create .lib files of the same name
- # with the exported symbols. Thus, we don't want the two to have the
- # same exact name. In other systems, the .a and .so suffixes suffice
- # to keep them separate
- IF(NOT MSVC OR NOT LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*")
- SET_TARGET_PROPERTIES(sword_static PROPERTIES
- OUTPUT_NAME "sword")
- #MESSAGE(STATUS "Building Static library with name sword")
- ELSE(NOT MSVC OR NOT LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*")
- #MESSAGE(STATUS "Building Static library with name
- #sword_static")
- ENDIF(NOT MSVC OR NOT LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*")
- MESSAGE(STATUS "Building Static library.")
-ENDIF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Static.*" OR NOT LIBSWORD_LIBRARY_TYPE)
-
-################################################################################################
-# Some random user settings
-#
-
-IF(NOT SWORD_GLOBAL_CONF_DIR STREQUAL "")
- ADD_DEFINITIONS(-DGLOBCONFPATH="${SWORD_GLOBAL_CONF_DIR}/sword.conf")
-ENDIF(NOT SWORD_GLOBAL_CONF_DIR STREQUAL "")
-
-
-###############################################################################################
-# This allows the user to set a SONAME for the library. This allows packagers and those who
-# care about that sort of thing to be happy and have all their SONAMES set properly.
-#
-IF(NOT LIBSWORD_SOVERSION AND BUILDING_SHARED)
- SET(SWORD_SOVERSION ${SWORD_VERSION})
-ELSE(NOT LIBSWORD_SOVERSION AND BUILDING_SHARED)
- SET(SWORD_SOVERSION ${LIBSWORD_SOVERSION})
-ENDIF(NOT LIBSWORD_SOVERSION AND BUILDING_SHARED)
-
-IF(BUILDING_SHARED)
- SET_TARGET_PROPERTIES(sword
- PROPERTIES SOVERSION ${SWORD_SOVERSION})
- MESSAGE(STATUS "Setting SOVERSION to ${SWORD_SOVERSION}")
-ENDIF(BUILDING_SHARED)
-
-###############################################################################################
-# The buildflags depend on the CMAKE_BUILD_TYPE supplied at the command line.
-# For a full lists of different flags see http://cmake.org/Wiki/CMake_Useful_Variables
-#
-# Cmake has sane defaults for None aka '', DEBUG, RELEASE, RELWITHDEBINFO for known compilers.
-#
-# You can override these variables on the command-line or here.
-# We provide our own defaults below
-#
-# Note the below two initialisations done for us by cmake:
-#
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" or "$ENV{CFLAGS}" or "" )
-#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" or "$ENV{CXXFLAGS}" or "" )
-
-IF(SWORD_ENABLE_WARNINGS STREQUAL "Yes")
- SET(CMAKE_C_FLAGS "-Werror ${CMAKE_C_FLAGS}")
- SET(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
-ENDIF(SWORD_ENABLE_WARNINGS STREQUAL "Yes")
-
-IF(SWORD_ENABLE_PROFILE STREQUAL "Yes")
- SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
- SET(CMAKE_CXX_FLAGS "-pg ${CMAKE_CXX_FLAGS}")
-ENDIF(SWORD_ENABLE_PROFILE STREQUAL "Yes")
-
-IF(SWORD_ENABLE_PROFILEFN STREQUAL "Yes")
- SET(CMAKE_C_FLAGS "-g -finstrument-functions ${CMAKE_C_FLAGS}")
- SET(CMAKE_CXX_FLAGS "-g -finstrument-functions ${CMAKE_CXX_FLAGS}")
- TARGET_LINK_LIBRARIES(libsword fnccheck)
-ENDIF(SWORD_ENABLE_PROFILEFN STREQUAL "Yes")
-
-SET(CMAKE_C_FLAGS_DEBUG "-g3 -Wall -O0 ${CMAKE_C_FLAGS}")
-SET(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS}")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g ${CMAKE_C_FLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall -O0 ${CMAKE_CXX_FLAGS}")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS}")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ${CMAKE_CXX_FLAGS}")
-
-##############################################################################################
-# Setting libraries and includes
-#
-
-IF(WITH_ZLIB)
- INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ZLIB_LIBRARY})
-ENDIF(WITH_ZLIB)
-IF(WITH_CURL)
- FIND_PROGRAM(CURL_CONFIG curl-config
- DOC "The curl-config executable path, used to determine SFTP support.")
- # If we can find the config script, we will run it and attempt to parse out the
- # availability of SFTP support. Otherwise, we will assume the library was built
- # without it.
- IF(CURL_CONFIG)
- EXECUTE_PROCESS(
- COMMAND ${CURL_CONFIG} --protocols
- COMMAND grep SFTP
- COMMAND wc -l
- OUTPUT_VARIABLE CURL_CONFIG_OUTPUT
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- IF(CURL_CONFIG_OUTPUT STREQUAL "1")
- ADD_DEFINITIONS(-DCURLSFTPAVAILABLE)
- MESSAGE(STATUS "cURL SFTP Support: Yes")
- ELSE(CURL_CONFIG_OUTPUT STREQUAL "1")
- MESSAGE(STATUS "cURL SFTP Support: No")
- ENDIF(CURL_CONFIG_OUTPUT STREQUAL "1")
- ENDIF(CURL_CONFIG)
- INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${CURL_LIBRARY})
-ENDIF(WITH_CURL)
-IF(WITH_CLUCENE)
- INCLUDE_DIRECTORIES(${CLUCENE_INCLUDE_DIR})
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${CLUCENE_LIBRARY})
- LINK_DIRECTORIES(${CLUCENE_LIBRARY_DIR})
- ADD_DEFINITIONS(-DUSELUCENE)
- IF(CLUCENE2)
- ADD_DEFINITIONS(-DCLUCENE2)
- ENDIF(CLUCENE2)
-ENDIF(WITH_CLUCENE)
-IF(WITH_ICU)
- INCLUDE_DIRECTORIES(${ICU_INCLUDE_DIRS})
- ADD_DEFINITIONS(${ICU_DEFINITIONS})
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
-ENDIF(WITH_ICU)
-IF(REGEX_FOUND AND CROSS_COMPILE_MINGW32)
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${REGEX_LIBRARY})
-ENDIF(REGEX_FOUND AND CROSS_COMPILE_MINGW32)
-
-IF(BUILDING_SHARED)
- TARGET_LINK_LIBRARIES(sword ${SWORD_LINK_LIBRARIES})
-ENDIF(BUILDING_SHARED)
-
-IF(BUILDING_STATIC)
- TARGET_LINK_LIBRARIES(sword_static ${SWORD_LINK_LIBRARIES})
-ENDIF(BUILDING_STATIC)
-
-MESSAGE(STATUS "Setting link libraries to ${SWORD_LINK_LIBRARIES}")
-
-##############################################################################################
-#########
-### TODO: Not sure about these...
-#########
-##############################################################################################
-ADD_DEFINITIONS(-D_FTPLIB_NO_COMPAT)
-
-#############################################################################################
-# Platform-specifc bits that I will eventually refactor out into their own files, once I am happy
-# with the stuff that is here.
-#
-IF(APPLE OR iPhone)
- ADD_DEFINITIONS(-Dunix)
-ENDIF(APPLE OR iPhone)
-
-##############################################################################################
-# Our build test
-#
-
-ADD_EXECUTABLE(buildtest buildtest.cpp)
-IF(BUILDING_STATIC)
- TARGET_LINK_LIBRARIES(buildtest sword_static)
-ELSE(BUILDING_STATIC)
- TARGET_LINK_LIBRARIES(buildtest sword)
-ENDIF(BUILDING_STATIC)
-
-##############################################################################################
-# Installing the library, headers, utilies, etc
-#
-
-INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake")
-
-##############################################################################################
-# Bindings are good, right?
-#
-
-IF(NOT SWORD_BINDINGS STREQUAL "" AND SWORD_BINDINGS)
- ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/bindings")
-ENDIF(NOT SWORD_BINDINGS STREQUAL "" AND SWORD_BINDINGS)
-
-##############################################################################################
-# Utilities are hawt
-#
-
-IF(NOT SWORD_BUILD_UTILS STREQUAL "No")
- ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/utilities")
-ENDIF(NOT SWORD_BUILD_UTILS STREQUAL "No")
-
-##############################################################################################
-# Demos are also hawt
-#
-
-IF(SWORD_BUILD_EXAMPLES STREQUAL "Yes")
- ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/examples/cmdline")
- ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/examples/tasks")
-ENDIF(SWORD_BUILD_EXAMPLES STREQUAL "Yes")
-
-##############################################################################################
-# Tests, however, are not
-
-IF(SWORD_BUILD_TESTS STREQUAL "Yes")
- ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/tests")
-ENDIF(SWORD_BUILD_TESTS STREQUAL "Yes")
diff --git a/.pc/multiarch-clucene.patch/cmake/FindCLucene.cmake b/.pc/multiarch-clucene.patch/cmake/FindCLucene.cmake
deleted file mode 100644
index 00d2055..0000000
--- a/.pc/multiarch-clucene.patch/cmake/FindCLucene.cmake
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# SOURCE: http://websvn.kde.org/trunk/kdesupport/strigi/cmake/FindCLucene.cmake?view=log
-#
-# ONE FIX: /usr/lib64 added to work on Fedora
-#
-
-
-#
-# This module looks for clucene (http://clucene.sf.net) support
-# It will define the following values
-#
-# CLUCENE_INCLUDE_DIR = where CLucene/StdHeader.h can be found
-# CLUCENE_LIBRARY_DIR = where CLucene/clucene-config.h can be found
-# CLUCENE_LIBRARY = the library to link against CLucene
-# CLUCENE_VERSION = The CLucene version string
-# CLucene_FOUND = set to 1 if clucene is found
-#
-
-INCLUDE(CheckSymbolExists)
-INCLUDE(FindLibraryWithDebug)
-
-if(NOT CLUCENE_MIN_VERSION)
- set(CLUCENE_MIN_VERSION "0.9.19")
-endif(NOT CLUCENE_MIN_VERSION)
-
-IF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
- INCLUDE(${PROJECT_CMAKE}/CLuceneConfig.cmake)
-ENDIF(EXISTS ${PROJECT_CMAKE}/CLuceneConfig.cmake)
-
-IF(MSVC)
- IF(CMAKE_BUILD_TYPE STREQUAL "Release")
- SET(WIN_CLUCENE_SEARCH_PATH ../clucene-core/src/CLucene/Release)
- ELSE(CMAKE_BUILD_TYPE STREQUAL "Release")
- SET(WIN_CLUCENE_SEARCH_PATH ../clucene-core/src/CLucene/debug)
- ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
- SET(WIN_CLUCENE_INCLUDE_PATH ../clucene-core/src)
-ELSE(MSVC)
- SET(WIN_CLUCENE_SEARCH_PATH "")
- SET(WIN_CLUCENE_INCLUDE_PATH "")
-ENDIF(MSVC)
-
-SET(TRIAL_LIBRARY_PATHS
- $ENV{CLUCENE_HOME}/lib${LIB_SUFFIX}
- ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
- /usr/local/lib${LIB_SUFFIX}
- /opt/local/lib${LIB_SUFFIX}
- /usr/lib${LIB_SUFFIX}
- /usr/lib64
- /sw/lib${LIB_SUFFIX}
- /usr/pkg/lib${LIB_SUFFIX}
- ${WIN_CLUCENE_SEARCH_PATH}
- )
-SET(TRIAL_INCLUDE_PATHS
- $ENV{CLUCENE_HOME}/include
- ${CMAKE_INSTALL_PREFIX}/include
- /usr/local/include
- /usr/include
- /sw/include
- /usr/pkg/include
- ${WIN_CLUCENE_INCLUDE_PATH}
- )
-FIND_LIBRARY_WITH_DEBUG(CLUCENE_LIBRARY
- NAMES clucene clucene-core
- PATHS ${TRIAL_LIBRARY_PATHS})
-FIND_PATH(CLUCENE_INCLUDE_DIR
- NAMES CLucene.h
- PATHS ${TRIAL_INCLUDE_PATHS}
- ONLY_CMAKE_FIND_ROOT_PATH)
-
-IF(WIN32)
- SET(TRIAL_LIBRARY_PATHS ${CLUCENE_INCLUDE_DIR})
-ENDIF(WIN32)
-
-SET(CLUCENE_GOOD_VERSION TRUE)
-
-FIND_PATH(CLUCENE_LIBRARY_DIR
- NAMES CLucene/clucene-config.h PATHS ${TRIAL_LIBRARY_PATHS} ${TRIAL_INCLUDE_PATHS} NO_DEFAULT_PATH)
-IF (CLUCENE_LIBRARY_DIR)
- SET(CLUCENE_INCLUDE_DIR ${CLUCENE_INCLUDE_DIR} ${CLUCENE_LIBRARY_DIR})
- #MESSAGE(STATUS "Found CLucene library dir: ${CLUCENE_LIBRARY_DIR}")
- FILE(READ ${CLUCENE_LIBRARY_DIR}/CLucene/clucene-config.h CLCONTENT)
- STRING(REGEX MATCH "_CL_VERSION +\".*\"" CLMATCH ${CLCONTENT})
- IF (CLMATCH)
- STRING(REGEX REPLACE "_CL_VERSION +\"(.*)\"" "\\1" CLUCENE_VERSION ${CLMATCH})
- IF (CLUCENE_VERSION VERSION_LESS "${CLUCENE_MIN_VERSION}")
- MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
- SET(CLUCENE_GOOD_VERSION FALSE)
- ENDIF (CLUCENE_VERSION VERSION_LESS "${CLUCENE_MIN_VERSION}")
- IF (CLUCENE_VERSION STREQUAL "0.9.17")
- MESSAGE(ERROR "CLucene version 0.9.17 is not supported.")
- SET(CLUCENE_GOOD_VERSION FALSE)
- ENDIF (CLUCENE_VERSION STREQUAL "0.9.17")
- IF (CLUCENE_VERSION VERSION_GREATER "2.0")
- MESSAGE (STATUS "Found CLucene 2, enabling compatibility mode")
- SET(CLUCENE2 TRUE)
- ELSE (CLUCENE_VERSION VERSION_GREATER "2.0")
- SET(CLUCENE2 FALSE)
- ENDIF (CLUCENE_VERSION VERSION_GREATER "2.0")
- ENDIF (CLMATCH)
-ELSE (CLUCENE_LIBRARY_DIR)
- #MESSAGE(STATUS "CLucene library dir not found.")
-ENDIF (CLUCENE_LIBRARY_DIR)
-
-IF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
- SET(CLucene_FOUND TRUE)
-ENDIF(CLUCENE_INCLUDE_DIR AND CLUCENE_LIBRARY AND CLUCENE_LIBRARY_DIR AND CLUCENE_GOOD_VERSION)
-
-IF(CLucene_FOUND)
- IF(NOT CLucene_FIND_QUIETLY)
- MESSAGE(STATUS "CLucene: Yes ${CLUCENE_LIBRARY}")
- ENDIF(NOT CLucene_FIND_QUIETLY)
-ELSE(CLucene_FOUND)
- IF(CLucene_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "CLucene: No")
- ENDIF(CLucene_FIND_REQUIRED)
-ENDIF(CLucene_FOUND)
-
-MARK_AS_ADVANCED(
- CLUCENE_INCLUDE_DIR
- CLUCENE_LIBRARY_DIR
- CLUCENE_LIBRARY
- )
diff --git a/.pc/no-included-zconf.h.diff/cmake/sources.cmake b/.pc/no-included-zconf.h.diff/cmake/sources.cmake
deleted file mode 100644
index 1be2264..0000000
--- a/.pc/no-included-zconf.h.diff/cmake/sources.cmake
+++ /dev/null
@@ -1,421 +0,0 @@
-# This file started on 18 January 2010 by Gregory Hellings
-# It is ceded to The SWORD Library developers and CrossWire under the terms
-# of their own GPLv2 license and all copyright is transferred to them for
-# all posterity and eternity, wherever such transfer is possible. Where it is
-# not, then this file is released under the GPLv2 by myself.
-#
-#
-SET(sword_base_frontend_SOURCES
- src/frontend/swdisp.cpp
- src/frontend/swlog.cpp
-)
-SOURCE_GROUP("src\\frontend" FILES ${sword_base_frontend_SOURCES})
-
-SET(sword_base_keys_SOURCES
- src/keys/swkey.cpp
- src/keys/listkey.cpp
- src/keys/strkey.cpp
- src/keys/treekey.cpp
- src/keys/treekeyidx.cpp
- src/keys/versekey.cpp
- src/keys/versetreekey.cpp
-)
-SOURCE_GROUP("src\\keys" FILES ${sword_base_keys_SOURCES})
-
-SET(sword_base_mgr_SOURCES
- src/mgr/swconfig.cpp
- src/mgr/swmgr.cpp
- src/mgr/swfiltermgr.cpp
- src/mgr/encfiltmgr.cpp
- src/mgr/markupfiltmgr.cpp
- src/mgr/filemgr.cpp
- src/mgr/versificationmgr.cpp
- src/mgr/remotetrans.cpp
- src/mgr/swlocale.cpp
- src/mgr/localemgr.cpp
- src/mgr/swcacher.cpp
- src/mgr/swsearchable.cpp
- src/mgr/installmgr.cpp
- src/mgr/stringmgr.cpp
-)
-SOURCE_GROUP("src\\mgr" FILES ${sword_base_mgr_SOURCES})
-
-SET(sword_base_module_SOURCES
- src/modules/swmodule.cpp
- src/modules/comments/swcom.cpp
- src/modules/comments/hrefcom/hrefcom.cpp
- src/modules/comments/rawcom/rawcom.cpp
- src/modules/comments/rawcom4/rawcom4.cpp
- src/modules/comments/rawfiles/rawfiles.cpp
- src/modules/comments/zcom/zcom.cpp
- src/modules/common/rawstr.cpp
- src/modules/common/rawstr4.cpp
- src/modules/common/swcomprs.cpp
- src/modules/common/lzsscomprs.cpp
- src/modules/common/rawverse.cpp
- src/modules/common/rawverse4.cpp
- src/modules/common/swcipher.cpp
- src/modules/common/zverse.cpp
- src/modules/common/zstr.cpp
- src/modules/common/entriesblk.cpp
- src/modules/common/sapphire.cpp
- src/modules/filters/swbasicfilter.cpp
- src/modules/filters/swoptfilter.cpp
-
- src/modules/filters/gbfhtml.cpp
- src/modules/filters/gbfxhtml.cpp
- src/modules/filters/gbfhtmlhref.cpp
- src/modules/filters/gbfwebif.cpp
- src/modules/filters/gbfplain.cpp
- src/modules/filters/gbfrtf.cpp
- src/modules/filters/gbfstrongs.cpp
- src/modules/filters/gbffootnotes.cpp
- src/modules/filters/gbfheadings.cpp
- src/modules/filters/gbfredletterwords.cpp
- src/modules/filters/gbfmorph.cpp
- src/modules/filters/gbfwordjs.cpp
-
- src/modules/filters/thmlstrongs.cpp
- src/modules/filters/thmlfootnotes.cpp
- src/modules/filters/thmlheadings.cpp
- src/modules/filters/thmlmorph.cpp
- src/modules/filters/thmllemma.cpp
- src/modules/filters/thmlscripref.cpp
- src/modules/filters/thmlvariants.cpp
- src/modules/filters/thmlgbf.cpp
- src/modules/filters/thmlrtf.cpp
- src/modules/filters/thmlhtml.cpp
- src/modules/filters/thmlxhtml.cpp
- src/modules/filters/thmlhtmlhref.cpp
- src/modules/filters/thmlwebif.cpp
- src/modules/filters/thmlwordjs.cpp
-
- src/modules/filters/teiplain.cpp
- src/modules/filters/teirtf.cpp
- src/modules/filters/teixhtml.cpp
- src/modules/filters/teihtmlhref.cpp
-
- src/modules/filters/gbfthml.cpp
- src/modules/filters/gbfosis.cpp
- src/modules/filters/thmlosis.cpp
- src/modules/filters/thmlplain.cpp
- src/modules/filters/osisosis.cpp
-
- src/modules/filters/osisenum.cpp
- src/modules/filters/osisglosses.cpp
- src/modules/filters/osisxlit.cpp
- src/modules/filters/osisheadings.cpp
- src/modules/filters/osisfootnotes.cpp
- src/modules/filters/osishtmlhref.cpp
- src/modules/filters/osisxhtml.cpp
- src/modules/filters/osiswebif.cpp
- src/modules/filters/osismorph.cpp
- src/modules/filters/osisstrongs.cpp
- src/modules/filters/osisplain.cpp
- src/modules/filters/osisrtf.cpp
- src/modules/filters/osislemma.cpp
- src/modules/filters/osisredletterwords.cpp
- src/modules/filters/osisscripref.cpp
- src/modules/filters/osisvariants.cpp
- src/modules/filters/osiswordjs.cpp
- src/modules/filters/osismorphsegmentation.cpp
- src/modules/filters/osisreferencelinks.cpp
-
- src/modules/filters/latin1utf8.cpp
- src/modules/filters/latin1utf16.cpp
- src/modules/filters/utf8utf16.cpp
- src/modules/filters/utf16utf8.cpp
- src/modules/filters/utf8html.cpp
- src/modules/filters/utf8latin1.cpp
- src/modules/filters/unicodertf.cpp
- src/modules/filters/scsuutf8.cpp
-
- src/modules/filters/utf8cantillation.cpp
- src/modules/filters/utf8hebrewpoints.cpp
- src/modules/filters/utf8arabicpoints.cpp
- src/modules/filters/utf8greekaccents.cpp
-
- src/modules/filters/cipherfil.cpp
-
- src/modules/filters/rtfhtml.cpp
- src/modules/filters/greeklexattribs.cpp
- src/modules/filters/papyriplain.cpp
-
- src/modules/genbook/swgenbook.cpp
- src/modules/genbook/rawgenbook/rawgenbook.cpp
-
- src/modules/lexdict/swld.cpp
- src/modules/lexdict/rawld/rawld.cpp
- src/modules/lexdict/rawld4/rawld4.cpp
- src/modules/lexdict/zld/zld.cpp
-
- src/modules/texts/swtext.cpp
- src/modules/texts/rawtext/rawtext.cpp
- src/modules/texts/rawtext4/rawtext4.cpp
- src/modules/texts/ztext/ztext.cpp
-)
-SOURCE_GROUP("src\\modules" FILES ${sword_base_module_SOURCES})
-
-SET(sword_base_utilfns_SOURCES
- src/utilfuns/swobject.cpp
- src/utilfuns/utilstr.cpp
- src/utilfuns/utilxml.cpp
- src/utilfuns/swversion.cpp
- src/utilfuns/swbuf.cpp
- src/utilfuns/ftpparse.c
- src/utilfuns/url.cpp
- src/utilfuns/roman.cpp
-)
-SOURCE_GROUP("src\\utilfns" FILES ${sword_base_utilfns_SOURCES})
-
-SET(sword_base_binding_SOURCES
- bindings/flatapi.cpp
-)
-
-# Universal sources
-SET(sword_base_SOURCES
- ${sword_base_frontend_SOURCES}
- ${sword_base_keys_SOURCES}
- ${sword_base_mgr_SOURCES}
- ${sword_base_module_SOURCES}
- ${sword_base_utilfns_SOURCES}
- ${sword_base_binding_SOURCES}
-)
-
-# Sources relying on ZLib
-SET(sword_zlib_used_SOURCES
- src/modules/common/zipcomprs.cpp
- src/modules/common/bz2comprs.cpp
- src/modules/common/xzcomprs.cpp
- src/utilfuns/zlib/untgz.c
-)
-SET(sword_zlib_nofound_SOURCES
- src/utilfuns/zlib/adler32.c
- src/utilfuns/zlib/compress.c
- src/utilfuns/zlib/crc32.c
- src/utilfuns/zlib/deflate.c
- src/utilfuns/zlib/gzclose.c
- src/utilfuns/zlib/gzlib.c
- src/utilfuns/zlib/gzread.c
- src/utilfuns/zlib/gzwrite.c
- src/utilfuns/zlib/infback.c
- src/utilfuns/zlib/inftrees.c
- src/utilfuns/zlib/inflate.c
- src/utilfuns/zlib/inffast.c
- src/utilfuns/zlib/trees.c
- src/utilfuns/zlib/uncompr.c
- src/utilfuns/zlib/zutil.c
-)
-
-# Sources relying on cURL
-SET(sword_curl_found_SOURCES
- src/mgr/curlftpt.cpp
- src/mgr/curlhttpt.cpp
-)
-SET(sword_curl_nofound_SOURCES
- src/mgr/ftplibftpt.cpp
- src/utilfuns/ftplib.c
-)
-
-# Sources relying on CLucene
-SET(sword_clucene_found_SOURCES)
-SET(sword_clucene_nofound_SOURCES)
-
-# Sources based on the regex stuff
-SET(sword_internal_regex_SOURCES
- src/utilfuns/regex.c
-)
-SET(sword_external_regex_SOURCES)
-
-# Sources based on the ICU status
-SET(sword_icu_found_SOURCES
- src/modules/filters/utf8transliterator.cpp
- src/modules/filters/utf8nfc.cpp
- src/modules/filters/utf8nfkd.cpp
- src/modules/filters/utf8arshaping.cpp
- src/modules/filters/utf8bidireorder.cpp
-)
-
-# Headers
-SET(SWORD_INSTALL_HEADERS
- include/canon.h
- include/canon_abbrevs.h
- include/cipherfil.h
- include/curlftpt.h
- include/curlhttpt.h
- include/defs.h
- include/echomod.h
- include/encfiltmgr.h
- include/entriesblk.h
- include/femain.h
- include/filemgr.h
- include/versificationmgr.h
- include/flatapi.h
- include/ftpparse.h
- include/remotetrans.h
- include/ftplibftpt.h
- include/ftplib.h
-
- include/gbffootnotes.h
- include/gbfheadings.h
- include/gbfhtml.h
- include/gbfxhtml.h
- include/gbfhtmlhref.h
- include/gbfwebif.h
- include/gbfmorph.h
- include/gbfosis.h
- include/gbfplain.h
- include/gbfredletterwords.h
- include/gbfrtf.h
- include/gbfstrongs.h
- include/gbfwordjs.h
- include/gbfthml.h
- include/greeklexattribs.h
-
- include/hebrewmcim.h
- include/hrefcom.h
- include/installmgr.h
- include/latin1utf16.h
- include/latin1utf8.h
- include/listkey.h
- include/localemgr.h
- include/lzsscomprs.h
- include/markupfiltmgr.h
- include/multimapwdef.h
- include/nullim.h
-
- include/osisenum.h
- include/osisglosses.h
- include/osisxlit.h
- include/osisheadings.h
- include/osishtmlhref.h
- include/osisxhtml.h
- include/osiswebif.h
- include/osismorph.h
- include/osismorphsegmentation.h
- include/osisplain.h
- include/osisrtf.h
- include/osisosis.h
- include/osisstrongs.h
- include/osisfootnotes.h
- include/osislemma.h
- include/osisredletterwords.h
- include/osisscripref.h
- include/osiswordjs.h
- include/osisvariants.h
- include/osisreferencelinks.h
-
- include/papyriplain.h
- include/rawcom.h
- include/rawfiles.h
- include/rawgenbook.h
- include/rawld.h
- include/rawld4.h
- include/rawstr.h
- include/rawstr4.h
- include/rawtext.h
- include/rawverse.h
-
- include/roman.h
- include/rtfhtml.h
- include/sapphire.h
- include/scsuutf8.h
- include/strkey.h
- include/swbasicfilter.h
- include/swbuf.h
- include/swcacher.h
- include/swcipher.h
- include/swcom.h
- include/swcomprs.h
- include/swconfig.h
- include/swdisp.h
- include/swfilter.h
- include/swfiltermgr.h
- include/swgenbook.h
- include/swinputmeth.h
- include/swkey.h
- include/swld.h
- include/swlocale.h
- include/swlog.h
- include/swmacs.h
- include/swmgr.h
- include/stringmgr.h
- include/swmodule.h
- include/swoptfilter.h
- include/swobject.h
- include/swsearchable.h
- include/swtext.h
- "${CMAKE_CURRENT_BINARY_DIR}/include/swversion.h"
- include/sysdata.h
-
- include/thmlfootnotes.h
- include/thmlgbf.h
- include/thmlheadings.h
- include/thmlhtml.h
- include/thmlxhtml.h
- include/thmlhtmlhref.h
- include/thmlwebif.h
- include/thmllemma.h
- include/thmlmorph.h
- include/thmlosis.h
- include/thmlplain.h
- include/thmlrtf.h
- include/thmlscripref.h
- include/thmlstrongs.h
- include/thmlvariants.h
- include/thmlwordjs.h
-
- include/teiplain.h
- include/teirtf.h
- include/teixhtml.h
- include/teihtmlhref.h
-
- include/treekey.h
- include/treekeyidx.h
- include/unicodertf.h
- include/url.h
- include/untgz.h
- include/utf16utf8.h
- include/utf8arshaping.h
- include/utf8bidireorder.h
- include/utf8cantillation.h
- include/utf8greekaccents.h
- include/utf8hebrewpoints.h
- include/utf8arabicpoints.h
- include/utf8html.h
- include/utf8latin1.h
- include/utf8nfc.h
- include/utf8nfkd.h
- include/utf8transliterator.h
- include/utf8utf16.h
- include/utilstr.h
- include/utilxml.h
-
- include/versekey.h
- include/versetreekey.h
- include/zcom.h
- include/zconf.h
- include/zipcomprs.h
- include/zld.h
- include/zstr.h
- include/ztext.h
- include/zverse.h
-
- include/canon_kjva.h
- include/canon_leningrad.h
- include/canon_mt.h
- include/canon_nrsv.h
- include/canon_nrsva.h
- include/canon_synodal.h
- include/canon_vulg.h
- include/canon_german.h
- include/canon_luther.h
- include/canon_null.h
- include/canon_lxx.h
- include/canon_orthodox.h
- include/canon_synodalprot.h
-)
-
-SET(INTERNAL_REGEX_HEADER
- include/internal/regex/regex.h
-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40e615a..5cbd06a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,21 +1,20 @@
# TODO: write FindICU (icu-config only for 2.2 and up) -- currently taken from another CMake system
# limit pkg-config version to >= 0.14, demo, utilities, doc, tests
+# use BUILD_SHARED_LIBS
+# convince perl swig bindings to build properly
#
# NOTES: Defaults to build type of Shared
# Forces out-of-source tree build
-#
+#
#
# This file started on 18 January 2010 by Gregory Hellings
# It is ceded to The SWORD Library developers and CrossWire under the terms
# of their own GPLv2 license and all copyright is transferred to them for
# all posterity and eternity, wherever such transfer is possible. Where it is
# not, then this file is released under the GPLv2 by myself.
-#
-#
-# A CMake port of the SWORD build system... we hope
PROJECT(libsword CXX C)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
-SET(SWORD_VERSION 1.7.3)
+SET(SWORD_VERSION 1.8.1)
# Make sure it's an out-of-stream build
IF(${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
@@ -33,9 +32,15 @@ SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/options.cmake")
# Source variables
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/sources.cmake")
+# Cppcheck
+INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CppcheckTargets.cmake")
# Our local includes
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/include") # For swversion.h
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include") # For everything else
+IF(MSVC)
+ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/src/utilfuns/win32/")
+ ADD_DEFINITIONS(-DWIN32 -D_ICUSWORD_ -D_LIB -DREGEX_MALLOC -DSWMAKINGDLL -D_CRT_SECURE_NO_WARNINGS -DCURL_STATICLIB -DUSBINARY -D_CRT_SECURE_NO_DEPRECATE)
+ENDIF(MSVC)
###########################################################################################
# This will look for various libraries that libsword builds against. There is no REQUIRED
@@ -43,10 +48,19 @@ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include") # For everything else
#
MESSAGE(STATUS "\n-- SEARCHING FOR SYTEM PACKAGES")
# Find our packages
-FIND_PACKAGE(ZLIB QUIET)
-FIND_PACKAGE(ICU QUIET)
-FIND_PACKAGE(CURL QUIET)
+IF(MSVC)
+ FIND_PACKAGE(BZIP2 REQUIRED)
+ FIND_PACKAGE(XZ REQUIRED)
+ FIND_PACKAGE(ICU REQUIRED)
+ FIND_PACKAGE(CURL REQUIRED)
+ELSE(MSVC)
+ FIND_PACKAGE(BZIP2 QUIET)
+ FIND_PACKAGE(XZ QUIET)
+ FIND_PACKAGE(ICU QUIET)
+ FIND_PACKAGE(CURL QUIET)
+ENDIF(MSVC)
FIND_PACKAGE(CLucene QUIET)
+FIND_PACKAGE(ZLIB QUIET)
FIND_PACKAGE(PkgConfig QUIET)
FIND_PACKAGE(Regex QUIET)
@@ -65,8 +79,12 @@ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/muxsources.cmake)
# Most of the work for configuration is done above, already.
#
# I want to do this manually, there might be reason in the future
+SET(CPPCHECK_POSSIBLEERROR_ARG "--enable=all")
IF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*" OR NOT LIBSWORD_LIBRARY_TYPE)
ADD_LIBRARY(sword SHARED ${sword_SOURCES})
+ ADD_CPPCHECK(sword
+ POSSIBLE_ERROR TRUE
+ FORCE TRUE)
MESSAGE(STATUS "Building Shared library.")
SET(BUILDING_SHARED 1)
SET(SWORD_LINK_NAME sword)
@@ -74,6 +92,9 @@ ENDIF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*" OR NOT LIBSWORD_LIBRARY_TYPE)
IF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Static.*" OR NOT LIBSWORD_LIBRARY_TYPE)
ADD_LIBRARY(sword_static STATIC ${sword_SOURCES})
+ ADD_CPPCHECK(sword_static
+ POSSIBLE_ERROR TRUE
+ FORCE TRUE)
SET_TARGET_PROPERTIES(sword_static PROPERTIES COMPILE_FLAGS "-fPIC")
SET(BUILDING_STATIC 1)
# Defaults to linking against the shared if it is also being built
@@ -85,7 +106,7 @@ IF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Static.*" OR NOT LIBSWORD_LIBRARY_TYPE)
# same exact name. In other systems, the .a and .so suffixes suffice
# to keep them separate
IF(NOT MSVC OR NOT LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*")
- SET_TARGET_PROPERTIES(sword_static PROPERTIES
+ SET_TARGET_PROPERTIES(sword_static PROPERTIES
OUTPUT_NAME "sword")
#MESSAGE(STATUS "Building Static library with name sword")
ELSE(NOT MSVC OR NOT LIBSWORD_LIBRARY_TYPE MATCHES ".*Shared.*")
@@ -98,10 +119,10 @@ ENDIF(LIBSWORD_LIBRARY_TYPE MATCHES ".*Static.*" OR NOT LIBSWORD_LIBRARY_TYPE)
################################################################################################
# Some random user settings
#
-
-IF(NOT SWORD_GLOBAL_CONF_DIR STREQUAL "")
- ADD_DEFINITIONS(-DGLOBCONFPATH="${SWORD_GLOBAL_CONF_DIR}/sword.conf")
-ENDIF(NOT SWORD_GLOBAL_CONF_DIR STREQUAL "")
+ADD_DEFINITIONS(-DGLOBCONFPATH="${SYSCONF_INSTALL_DIR}/sword.conf")
+SET(CONFFILE "[Install]
+DataPath=${SHARE_INSTALL_PREFIX}/sword")
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sword.conf" "${CONFFILE}")
###############################################################################################
@@ -150,13 +171,21 @@ IF(SWORD_ENABLE_PROFILEFN STREQUAL "Yes")
TARGET_LINK_LIBRARIES(libsword fnccheck)
ENDIF(SWORD_ENABLE_PROFILEFN STREQUAL "Yes")
-SET(CMAKE_C_FLAGS_DEBUG "-g3 -Wall -O0 ${CMAKE_C_FLAGS}")
-SET(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS}")
-SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g ${CMAKE_C_FLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall -O0 ${CMAKE_CXX_FLAGS}")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS}")
-SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ${CMAKE_CXX_FLAGS}")
-
+IF(MSVC)
+ SET(CMAKE_C_FLAGS_DEBUG "/D /O0 /DDEBUG ${CMAKE_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELEASE "/O3 /DNDEBUG ${CMAKE_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/O3 /D /DDEBUG ${CMAKE_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "/D /O0 /DDEBUG ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELEASE "/O3 ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O3 /D /DDEBUG ${CMAKE_CXX_FLAGS}")
+ELSE(MSVC)
+ SET(CMAKE_C_FLAGS_DEBUG "-g3 -Wall -O0 ${CMAKE_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g ${CMAKE_C_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "-g3 -Wall -O0 ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELEASE "-O3 ${CMAKE_CXX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ${CMAKE_CXX_FLAGS}")
+ENDIF(MSVC)
##############################################################################################
# Setting libraries and includes
#
@@ -165,6 +194,14 @@ IF(WITH_ZLIB)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ZLIB_LIBRARY})
ENDIF(WITH_ZLIB)
+IF(WITH_BZIP2)
+ INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
+ SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${BZIP2_LIBRARY})
+ENDIF(WITH_BZIP2)
+IF(WITH_XZ)
+ INCLUDE_DIRECTORIES(${XZ_INCLUDE_DIR})
+ SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${XZ_LIBRARY})
+ENDIF(WITH_XZ)
IF(WITH_CURL)
FIND_PROGRAM(CURL_CONFIG curl-config
DOC "The curl-config executable path, used to determine SFTP support.")
@@ -190,7 +227,7 @@ IF(WITH_CURL)
ENDIF(WITH_CURL)
IF(WITH_CLUCENE)
INCLUDE_DIRECTORIES(${CLUCENE_INCLUDE_DIR})
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${CLUCENE_LIBRARY} -lclucene-shared)
+ SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${CLUCENE_LIBRARY})
LINK_DIRECTORIES(${CLUCENE_LIBRARY_DIR})
ADD_DEFINITIONS(-DUSELUCENE)
IF(CLUCENE2)
@@ -226,7 +263,7 @@ ADD_DEFINITIONS(-D_FTPLIB_NO_COMPAT)
#############################################################################################
# Platform-specifc bits that I will eventually refactor out into their own files, once I am happy
# with the stuff that is here.
-#
+#
IF(APPLE OR iPhone)
ADD_DEFINITIONS(-Dunix)
ENDIF(APPLE OR iPhone)
@@ -244,7 +281,7 @@ ENDIF(BUILDING_STATIC)
##############################################################################################
# Installing the library, headers, utilies, etc
-#
+#
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake")
@@ -258,7 +295,7 @@ ENDIF(NOT SWORD_BINDINGS STREQUAL "" AND SWORD_BINDINGS)
##############################################################################################
# Utilities are hawt
-#
+#
IF(NOT SWORD_BUILD_UTILS STREQUAL "No")
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/utilities")
@@ -266,7 +303,7 @@ ENDIF(NOT SWORD_BUILD_UTILS STREQUAL "No")
##############################################################################################
# Demos are also hawt
-#
+#
IF(SWORD_BUILD_EXAMPLES STREQUAL "Yes")
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/examples/cmdline")
diff --git a/ChangeLog b/ChangeLog
index 18f2a9e..ceaea0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,64 @@
API ChangeLog
+
+01-Nov-2017 Troy A. Griffitts <scribe@crosswire.org>
+ Added bindings: Android and cordova
+
+01-Sep-2017 Troy A. Griffitts <scribe@crosswire.org>
+ Adding French mapping data.
+ Patch submitted by domcox <dominique@corbex.org>
+
+21-May-2017 Troy A. Griffitts <scribe@crosswire.org>
+ Added --with-icuregex option to use ICU regex engine
+
+24-Apr-2017 Troy A. Griffitts <scribe@crosswire.org>
+ Branching 1.8.x
+
+16-Apr-2016 Troy A. Griffitts <scribe@crosswire.org>
+ Added working --chapter --verse decrementors across Testament
+ Added handling of more odd double colon verse reference texts
+ Removed deprecated utility cipherraw; use mod2zmod w/ cipherkey
+ or osis2mod -c instead.
+ Added new tests to testsuite for mod2zmod and osis2mod with cipher
+
+18-Dec-2015 Peter von Kaehne <refdoc@crosswire.org>
+ Added image and table handling to TEI latex
+ Added image handling to TEI RTF
+
+18-Dec-2015 Peter von Kaehne <refdoc@crosswire.org>
+ Added image and table handling to TEI xhtml and htmlhref filters
+ contributed by Dominique Corbex <dominique.corbex@gmail.com>
+
+15-Dec-2014 DM Smith <dmsmith@crosswire.org>
+ Fixed endless loop in osis2mod for some inputs.
+
+15-Dec-2014 DM Smith <dmsmith@crosswire.org>
+ Added support for Psalm Book divisions using <div type=majorSection>
+ from GHellings
+
+03-Dec-2014 Karl Kleinpaste <charcoal@users.sf.net>
+ Corrected anomalous OSIS highlighting output w/GHellings' patches in
+ src/modules/filters/osis{plain,xhtml}.cpp
+
+12-Jul-2014 Костя Маслюк <kostyamaslyuk@gmail.com>
+ Versification mapping implementation and example at
+ examples/tasks/parallelbibles.cpp
+
27-Apr-2014 Troy A. Griffitts <scribe@crosswire.org>
Added C# bindings contributed by Daniel Hughes <trampster@gmail.com>
+17-Mar-2014 Chris Little <chrislit@crosswire.org>
+ Added zVerse4, zText4, & zCom4 classes to support compressed text/
+ commentary modules with entry sizes > 64k
+
+3-Mar-2014 Chris Little <chrislit@crosswire.org>
+ Added support for bzip2 (Burrows-Wheeler) module compression via libbz2
+ Added support for xz (LZMA2) module compression via liblzma
+
+30-Dec-2013 Peter von Kaehne <refdoc@crosswire.org>
+ Added LaTeX output filters
+
+
* Release 1.7.0 *
5-Oct-2013 Troy A. Griffitts <scribe@crosswire.org>
diff --git a/Makefile.am b/Makefile.am
index 5d74eac..d75b351 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -60,18 +60,17 @@ restore:
install: install-recursive
@echo ""
- @echo "sword is installed."
+ @echo "SWORD is installed."
@echo ""
- @echo "if this is your first time, you may need a basic global"
- @echo "configuration file. one can be generated to $(DESTDIR)$(sysconfdir)/sword.conf"
- @echo "by typing: \"make install_config\""
+ @echo "If this is your first time, you may need a basic global"
+ @echo "configuration file. One can be generated to $(DESTDIR)$(sysconfdir)/sword.conf"
+ @echo "by typing: \"sudo make install_config\""
@echo ""
- @echo "modules (Bibles, etc.), may then be unzipped to $(pkgdatadir)/"
+ @echo "Modules (Bibles, etc.), may then be unzipped to $(pkgdatadir)/"
+ @echo "or installed with the command line tool: installmgr"
@echo ""
- @echo "type \"make register\" to help us keep track of how many"
- @echo "people are using sword."
- @echo "(you may consider exiting from 'root', first, to make this"
- @echo "a little more personal)"
+ @echo "Type \"make register\" to help us keep track of how many"
+ @echo "people are using SWORD."
@echo ""
@@ -92,6 +91,12 @@ install_config:
@echo "[Install]" > $(DESTDIR)$(sysconfdir)/sword.conf
@echo "DataPath=$(pkgdatadir)/" >> $(DESTDIR)$(sysconfdir)/sword.conf
@echo "sword.conf generated"
+ @echo ""
+ @echo "You can now try to install modules with installmgr, e.g.,"
+ @echo "sudo installmgr -sc -r CrossWire -ri CrossWire KJV"
+ @echo ""
+ @echo "Run installmgr with no options for help."
+
dist-hook:
diff --git a/Makefile.in b/Makefile.in
index ecd78dd..3083f4c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -416,9 +416,11 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
+with_bzip2 = @with_bzip2@
with_conf = @with_conf@
with_icu = @with_icu@
with_icusword = @with_icusword@
+with_xz = @with_xz@
with_zlib = @with_zlib@
AUTOMAKE_OPTIONS = 1.6
ACLOCAL_AMFLAGS = -I m4
@@ -1074,18 +1076,17 @@ restore:
install: install-recursive
@echo ""
- @echo "sword is installed."
+ @echo "SWORD is installed."
@echo ""
- @echo "if this is your first time, you may need a basic global"
- @echo "configuration file. one can be generated to $(DESTDIR)$(sysconfdir)/sword.conf"
- @echo "by typing: \"make install_config\""
+ @echo "If this is your first time, you may need a basic global"
+ @echo "configuration file. One can be generated to $(DESTDIR)$(sysconfdir)/sword.conf"
+ @echo "by typing: \"sudo make install_config\""
@echo ""
- @echo "modules (Bibles, etc.), may then be unzipped to $(pkgdatadir)/"
+ @echo "Modules (Bibles, etc.), may then be unzipped to $(pkgdatadir)/"
+ @echo "or installed with the command line tool: installmgr"
@echo ""
- @echo "type \"make register\" to help us keep track of how many"
- @echo "people are using sword."
- @echo "(you may consider exiting from 'root', first, to make this"
- @echo "a little more personal)"
+ @echo "Type \"make register\" to help us keep track of how many"
+ @echo "people are using SWORD."
@echo ""
install-data-am: installlocaleDATA installmodsDATA install-pkgconfigDATA
@@ -1104,6 +1105,11 @@ install_config:
@echo "[Install]" > $(DESTDIR)$(sysconfdir)/sword.conf
@echo "DataPath=$(pkgdatadir)/" >> $(DESTDIR)$(sysconfdir)/sword.conf
@echo "sword.conf generated"
+ @echo ""
+ @echo "You can now try to install modules with installmgr, e.g.,"
+ @echo "sudo installmgr -sc -r CrossWire -ri CrossWire KJV"
+ @echo ""
+ @echo "Run installmgr with no options for help."
dist-hook:
(cd $(distdir) && ./autogen.sh)
diff --git a/aclocal.m4 b/aclocal.m4
index 7f0263d..fea5b70 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -220,21 +220,6 @@ m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
-
-# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# -------------------------------------------
-# Retrieves the value of the pkg-config variable for the given module.
-AC_DEFUN([PKG_CHECK_VAR],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
-
-_PKG_CONFIG([$1], [variable="][$3]["], [$2])
-AS_VAR_COPY([$1], [pkg_cv_][$1])
-
-AS_VAR_IF([$1], [""], [$5], [$4])dnl
-])# PKG_CHECK_VAR
-
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
diff --git a/arminst.sh b/arminst.sh
index e3db839..42df5e7 100755
--- a/arminst.sh
+++ b/arminst.sh
@@ -2,7 +2,7 @@
#******************************************************************************
# Convenience script specifying ARM options to ./configure
#
-# $Id: arminst.sh 2327 2009-04-22 11:42:33Z scribe $
+# $Id: arminst.sh 3063 2014-03-04 13:04:11Z chrislit $
#
# Copyright 1998-2009 CrossWire Bible Society (http://www.crosswire.org)
# CrossWire Bible Society
diff --git a/bindings/Android/Makefile b/bindings/Android/Makefile
new file mode 100644
index 0000000..33ccb06
--- /dev/null
+++ b/bindings/Android/Makefile
@@ -0,0 +1,14 @@
+all: javawrapper
+ cp -a SWORD/app/build/intermediates/transforms/stripDebugSymbol/release/0/lib/* ../cordova/org.crosswire.sword.cordova.SWORD/libs/android/
+
+debug: javawrapper
+ cp -a SWORD/app/build/intermediates/cmake/debug/obj/* ../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/
+
+clean:
+ #these are from ../java-jni
+ rm SWORD/app/src/main/java/org/crosswire/android/sword/InstallMgr.java SWORD/app/src/main/java/org/crosswire/android/sword/SWMgr.java SWORD/app/src/main/java/org/crosswire/android/sword/SWModule.java
+
+
diff --git a/bindings/Android/README b/bindings/Android/README
new file mode 100644
index 0000000..2714e53
--- /dev/null
+++ b/bindings/Android/README
@@ -0,0 +1,25 @@
+This folder contains Android bindings based on the java-jni bindings.
+
+The first step to building these bindings is to build the java-jni/
+bindings. These bindings use code generated from there.
+See the ../java-jni README before continuing.
+
+There is an Android Studio project here under SWORD/
+
+This Android Studio project should be used to build the NDK
+native code here.
+
+After that, a make in this folder will copy the native libs
+to the ../cordova/ bindings to produce a working cordova plugin
+
+The steps to build all of this are usually:
+1) make in the ../java-jni bindings folder
+2) build all in SWORD Android Studio project
+3) a make in this folder, which finally copies the binary libs
+ to the ../cordova/ bindings folder to produce a working
+ cordova plugin
+
+Android java bindings can be used after step 2
+cordova javascript bindings can be used after step 3
+
+Hope this helps get you started. Let me know your progress!
diff --git a/bindings/Android/SWORD/.gitignore b/bindings/Android/SWORD/.gitignore
new file mode 100644
index 0000000..39fb081
--- /dev/null
+++ b/bindings/Android/SWORD/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild
diff --git a/bindings/Android/SWORD/.idea/codeStyleSettings.xml b/bindings/Android/SWORD/.idea/codeStyleSettings.xml
new file mode 100644
index 0000000..719bb8b
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/codeStyleSettings.xml
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectCodeStyleSettingsManager">
+ <option name="PER_PROJECT_SETTINGS">
+ <value>
+ <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
+ <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
+ <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
+ <value />
+ </option>
+ <option name="IMPORT_LAYOUT_TABLE">
+ <value>
+ <package name="android" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="com" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="junit" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="net" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="org" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="java" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="javax" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="" withSubpackages="true" static="false" />
+ <emptyLine />
+ <package name="" withSubpackages="true" static="true" />
+ <emptyLine />
+ </value>
+ </option>
+ <option name="RIGHT_MARGIN" value="100" />
+ <AndroidXmlCodeStyleSettings>
+ <option name="USE_CUSTOM_SETTINGS" value="true" />
+ </AndroidXmlCodeStyleSettings>
+ <Objective-C-extensions>
+ <file>
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
+ </file>
+ <class>
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
+ <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
+ </class>
+ <extensions>
+ <pair source="cpp" header="h" />
+ <pair source="c" header="h" />
+ </extensions>
+ </Objective-C-extensions>
+ <XML>
+ <option name="XML_KEEP_LINE_BREAKS" value="false" />
+ <option name="XML_ALIGN_ATTRIBUTES" value="false" />
+ <option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" />
+ </XML>
+ <codeStyleSettings language="XML">
+ <option name="FORCE_REARRANGE_MODE" value="1" />
+ <indentOptions>
+ <option name="CONTINUATION_INDENT_SIZE" value="4" />
+ </indentOptions>
+ <arrangement>
+ <rules>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>xmlns:android</NAME>
+ <XML_NAMESPACE>^$</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>xmlns:.*</NAME>
+ <XML_NAMESPACE>^$</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:id</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:name</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>name</NAME>
+ <XML_NAMESPACE>^$</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>style</NAME>
+ <XML_NAMESPACE>^$</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*</NAME>
+ <XML_NAMESPACE>^$</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:layout_width</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:layout_height</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:layout_.*</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:width</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*:height</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*</NAME>
+ <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ <section>
+ <rule>
+ <match>
+ <AND>
+ <NAME>.*</NAME>
+ <XML_NAMESPACE>.*</XML_NAMESPACE>
+ </AND>
+ </match>
+ <order>BY_NAME</order>
+ </rule>
+ </section>
+ </rules>
+ </arrangement>
+ </codeStyleSettings>
+ </value>
+ </option>
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/compiler.xml b/bindings/Android/SWORD/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/compiler.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ <entry name="!?*.form" />
+ <entry name="!?*.class" />
+ <entry name="!?*.groovy" />
+ <entry name="!?*.scala" />
+ <entry name="!?*.flex" />
+ <entry name="!?*.kt" />
+ <entry name="!?*.clj" />
+ <entry name="!?*.aj" />
+ </wildcardResourcePatterns>
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/copyright/profiles_settings.xml b/bindings/Android/SWORD/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+ <settings default="" />
+</component> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/gradle.xml b/bindings/Android/SWORD/.idea/gradle.xml
new file mode 100644
index 0000000..96b6a99
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/gradle.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="modules">
+ <set>
+ <option value="/data/home/scribe/src/sword/bindings/Android/SWORD" />
+ <option value="/data/home/scribe/src/sword/bindings/Android/SWORD/app" />
+ </set>
+ </option>
+ <option name="resolveModulePerSourceSet" value="false" />
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/misc.xml b/bindings/Android/SWORD/.idea/misc.xml
new file mode 100644
index 0000000..bac5576
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/misc.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="NullableNotNullManager">
+ <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
+ <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
+ <option name="myNullables">
+ <value>
+ <list size="4">
+ <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
+ <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
+ <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
+ <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
+ </list>
+ </value>
+ </option>
+ <option name="myNotNulls">
+ <value>
+ <list size="4">
+ <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
+ <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
+ <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
+ <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
+ </list>
+ </value>
+ </option>
+ </component>
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
+ <component name="ProjectType">
+ <option name="id" value="Android" />
+ </component>
+ <component name="SvnBranchConfigurationManager">
+ <option name="mySupportsUserInfoFilter" value="true" />
+ </component>
+ <component name="masterDetails">
+ <states>
+ <state key="ProjectJDKs.UI">
+ <settings>
+ <last-edited>Android API 24 Platform</last-edited>
+ <splitter-proportions>
+ <option name="proportions">
+ <list>
+ <option value="0.2" />
+ </list>
+ </option>
+ </splitter-proportions>
+ </settings>
+ </state>
+ </states>
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/modules.xml b/bindings/Android/SWORD/.idea/modules.xml
new file mode 100644
index 0000000..8baebac
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file:///data/home/scribe/src/sword/bindings/Android/SWORD/SWORD.iml" filepath="/data/home/scribe/src/sword/bindings/Android/SWORD/SWORD.iml" />
+ <module fileurl="file:///data/home/scribe/src/sword/bindings/Android/SWORD/app/app.iml" filepath="/data/home/scribe/src/sword/bindings/Android/SWORD/app/app.iml" />
+ </modules>
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/runConfigurations.xml b/bindings/Android/SWORD/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="RunConfigurationProducerService">
+ <option name="ignoredProducers">
+ <set>
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
+ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
+ </set>
+ </option>
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/.idea/vcs.xml b/bindings/Android/SWORD/.idea/vcs.xml
new file mode 100644
index 0000000..45cf85c
--- /dev/null
+++ b/bindings/Android/SWORD/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="svn" />
+ </component>
+</project> \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/.gitignore b/bindings/Android/SWORD/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/bindings/Android/SWORD/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/bindings/Android/SWORD/app/CMakeLists.txt b/bindings/Android/SWORD/app/CMakeLists.txt
new file mode 100644
index 0000000..d9625aa
--- /dev/null
+++ b/bindings/Android/SWORD/app/CMakeLists.txt
@@ -0,0 +1,221 @@
+# For more information about using CMake with Android Studio, read the
+# documentation: https://d.android.com/studio/projects/add-native-code.html
+
+# Sets the minimum version of CMake required to build the native library.
+
+cmake_minimum_required(VERSION 3.4.1)
+
+#SET(NDK_DEBUG 0)
+SET(CMAKE_C_FLAGS "-D__unix__ ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-D_FTPLIB_NO_COMPAT ${CMAKE_C_FLAGS}")
+
+SET(CMAKE_C_FLAGS "-Wno-invalid-source-encoding ${CMAKE_C_FLAGS}")
+
+
+SET(CMAKE_C_FLAGS "-DOS_ANDROID ${CMAKE_C_FLAGS}")
+
+SET(CMAKE_C_FLAGS "-fvisibility=hidden ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-DSTDC_HEADERS ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-Dunix ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-DANDROID ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-DEXCLUDEBZIP2 ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-DEXCLUDEXZ ${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS "-DEXCLUDEXZ ${CMAKE_C_FLAGS}")
+
+#SET(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS}")
+#SET(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS}")
+
+# Creates and names a library, sets it as either STATIC
+# or SHARED, and provides the relative paths to its source code.
+# You can define multiple libraries, and CMake builds them for you.
+# Gradle automatically packages shared libraries with your APK.
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
+
+add_library( # Sets the name of the library.
+ sword
+
+ # Sets the library as a shared library.
+ SHARED
+
+ # Provides a relative path to your source file(s).
+ src/main/cpp/jni/swordstub.cpp
+ ../../../../src/utilfuns/swversion.cpp
+ ../../../../src/modules/comments/zcom/zcom.cpp
+ ../../../../src/modules/comments/zcom4/zcom4.cpp
+ ../../../../src/modules/comments/rawfiles/rawfiles.cpp
+ ../../../../src/modules/comments/rawcom4/rawcom4.cpp
+ ../../../../src/modules/comments/rawcom/rawcom.cpp
+ ../../../../src/modules/comments/swcom.cpp
+ ../../../../src/modules/comments/hrefcom/hrefcom.cpp
+ ../../../../src/modules/swmodule.cpp
+ ../../../../src/modules/tests/echomod.cpp
+ ../../../../src/modules/genbook/swgenbook.cpp
+ ../../../../src/modules/genbook/rawgenbook/rawgenbook.cpp
+ ../../../../src/modules/lexdict/swld.cpp
+ ../../../../src/modules/lexdict/rawld4/rawld4.cpp
+ ../../../../src/modules/lexdict/zld/zld.cpp
+ ../../../../src/modules/lexdict/rawld/rawld.cpp
+ ../../../../src/modules/texts/rawtext/rawtext.cpp
+ ../../../../src/modules/texts/rawtext4/rawtext4.cpp
+ ../../../../src/modules/texts/swtext.cpp
+ ../../../../src/modules/texts/ztext/ztext.cpp
+ ../../../../src/modules/texts/ztext4/ztext4.cpp
+ ../../../../src/modules/common/rawstr4.cpp
+ ../../../../src/modules/common/lzsscomprs.cpp
+ ../../../../src/modules/common/zipcomprs.cpp
+ ../../../../src/modules/common/rawverse4.cpp
+ ../../../../src/modules/common/swcipher.cpp
+ ../../../../src/modules/common/swcomprs.cpp
+ ../../../../src/modules/common/rawverse.cpp
+ ../../../../src/modules/common/sapphire.cpp
+ ../../../../src/modules/common/zstr.cpp
+ ../../../../src/modules/common/entriesblk.cpp
+ ../../../../src/modules/common/zverse.cpp
+ ../../../../src/modules/common/zverse4.cpp
+ ../../../../src/modules/common/rawstr.cpp
+ ../../../../src/modules/filters/gbfwordjs.cpp
+ ../../../../src/modules/filters/utf8latin1.cpp
+ ../../../../src/modules/filters/utf8greekaccents.cpp
+ ../../../../src/modules/filters/utf16utf8.cpp
+ ../../../../src/modules/filters/gbfwebif.cpp
+ ../../../../src/modules/filters/utf8transliterator.cpp
+ ../../../../src/modules/filters/gbfstrongs.cpp
+ ../../../../src/modules/filters/thmlhtmlhref.cpp
+ ../../../../src/modules/filters/thmlxhtml.cpp
+ ../../../../src/modules/filters/thmlgbf.cpp
+ ../../../../src/modules/filters/utf8utf16.cpp
+ ../../../../src/modules/filters/utf8cantillation.cpp
+ ../../../../src/modules/filters/utf8arshaping.cpp
+ ../../../../src/modules/filters/cipherfil.cpp
+ ../../../../src/modules/filters/thmlheadings.cpp
+ ../../../../src/modules/filters/thmlscripref.cpp
+ ../../../../src/modules/filters/latin1utf8.cpp
+ ../../../../src/modules/filters/gbfhtml.cpp
+ ../../../../src/modules/filters/thmlosis.cpp
+ ../../../../src/modules/filters/utf8nfkd.cpp
+ ../../../../src/modules/filters/thmlstrongs.cpp
+ ../../../../src/modules/filters/osisenum.cpp
+ ../../../../src/modules/filters/osisfootnotes.cpp
+ ../../../../src/modules/filters/osisglosses.cpp
+ ../../../../src/modules/filters/osisheadings.cpp
+ ../../../../src/modules/filters/osishtmlhref.cpp
+ ../../../../src/modules/filters/osislemma.cpp
+ ../../../../src/modules/filters/osismorph.cpp
+ ../../../../src/modules/filters/osismorphsegmentation.cpp
+ ../../../../src/modules/filters/osisosis.cpp
+ ../../../../src/modules/filters/osisplain.cpp
+ ../../../../src/modules/filters/osisredletterwords.cpp
+ ../../../../src/modules/filters/osisrtf.cpp
+ ../../../../src/modules/filters/osisscripref.cpp
+ ../../../../src/modules/filters/osisstrongs.cpp
+ ../../../../src/modules/filters/osisvariants.cpp
+ ../../../../src/modules/filters/osiswebif.cpp
+ ../../../../src/modules/filters/osiswordjs.cpp
+ ../../../../src/modules/filters/osisxhtml.cpp
+ ../../../../src/modules/filters/osisxlit.cpp
+ ../../../../src/modules/filters/osisreferencelinks.cpp
+ ../../../../src/modules/filters/thmlmorph.cpp
+ ../../../../src/modules/filters/gbfplain.cpp
+ ../../../../src/modules/filters/gbfhtmlhref.cpp
+ ../../../../src/modules/filters/gbfxhtml.cpp
+ ../../../../src/modules/filters/utf8html.cpp
+ ../../../../src/modules/filters/utf8nfc.cpp
+ ../../../../src/modules/filters/rtfhtml.cpp
+ ../../../../src/modules/filters/gbfredletterwords.cpp
+ ../../../../src/modules/filters/latin1utf16.cpp
+ ../../../../src/modules/filters/thmlhtml.cpp
+ ../../../../src/modules/filters/gbfthml.cpp
+ ../../../../src/modules/filters/teihtmlhref.cpp
+ ../../../../src/modules/filters/teixhtml.cpp
+ ../../../../src/modules/filters/gbfrtf.cpp
+ ../../../../src/modules/filters/gbfosis.cpp
+ ../../../../src/modules/filters/teirtf.cpp
+ ../../../../src/modules/filters/thmlwordjs.cpp
+ ../../../../src/modules/filters/papyriplain.cpp
+ ../../../../src/modules/filters/utf8bidireorder.cpp
+ ../../../../src/modules/filters/gbfheadings.cpp
+ ../../../../src/modules/filters/thmlrtf.cpp
+ ../../../../src/modules/filters/swoptfilter.cpp
+ ../../../../src/modules/filters/utf8arabicpoints.cpp
+ ../../../../src/modules/filters/unicodertf.cpp
+ ../../../../src/modules/filters/gbffootnotes.cpp
+ ../../../../src/modules/filters/greeklexattribs.cpp
+ ../../../../src/modules/filters/thmlfootnotes.cpp
+ ../../../../src/modules/filters/thmlplain.cpp
+ ../../../../src/modules/filters/utf8hebrewpoints.cpp
+ ../../../../src/modules/filters/thmlwebif.cpp
+ ../../../../src/modules/filters/thmlvariants.cpp
+ ../../../../src/modules/filters/thmllemma.cpp
+ ../../../../src/modules/filters/gbfmorph.cpp
+ ../../../../src/modules/filters/teiplain.cpp
+ ../../../../src/modules/filters/swbasicfilter.cpp
+ ../../../../src/modules/filters/scsuutf8.cpp
+ ../../../../src/modules/filters/gbflatex.cpp
+ ../../../../src/modules/filters/thmllatex.cpp
+ ../../../../src/modules/filters/teilatex.cpp
+ ../../../../src/modules/filters/osislatex.cpp
+ ../../../../src/mgr/stringmgr.cpp
+ ../../../../src/mgr/swmgr.cpp
+ ../../../../src/mgr/swsearchable.cpp
+ ../../../../src/mgr/localemgr.cpp
+ ../../../../src/mgr/swconfig.cpp
+ ../../../../src/mgr/markupfiltmgr.cpp
+ ../../../../src/mgr/encfiltmgr.cpp
+ ../../../../src/mgr/swfiltermgr.cpp
+ ../../../../src/mgr/swcacher.cpp
+ ../../../../src/mgr/installmgr.cpp
+ ../../../../src/mgr/swlocale.cpp
+ ../../../../src/mgr/filemgr.cpp
+ ../../../../src/mgr/versificationmgr.cpp
+ ../../../../src/mgr/remotetrans.cpp
+ ../../../../src/mgr/ftplibftpt.cpp
+ ../../../../src/utilfuns/swobject.cpp
+ ../../../../src/utilfuns/roman.cpp
+ ../../../../src/utilfuns/swbuf.cpp
+ ../../../../src/utilfuns/utilstr.cpp
+ ../../../../src/utilfuns/ftplib.c
+ ../../../../src/utilfuns/ftpparse.c
+ ../../../../src/utilfuns/url.cpp
+ ../../../../src/utilfuns/utilxml.cpp
+# ../../../../src/utilfuns/regex.c
+ ../../../../src/keys/swkey.cpp
+ ../../../../src/keys/versetreekey.cpp
+ ../../../../src/keys/treekeyidx.cpp
+ ../../../../src/keys/versekey.cpp
+ ../../../../src/keys/strkey.cpp
+ ../../../../src/keys/treekey.cpp
+ ../../../../src/keys/listkey.cpp
+ ../../../../src/frontend/swdisp.cpp
+ ../../../../src/frontend/swlog.cpp
+ ../../../../src/utilfuns/zlib/untgz.c
+
+ )
+
+include_directories(../../../../include)
+# Searches for a specified prebuilt library and stores the path as a
+# variable. Because CMake includes system libraries in the search path by
+# default, you only need to specify the name of the public NDK library
+# you want to add. CMake verifies that the library exists before
+# completing its build.
+
+find_library( # Sets the name of the path variable.
+ log-lib
+
+ # Specifies the name of the NDK library that
+ # you want CMake to locate.
+ log)
+
+# Specifies libraries CMake should link to your target library. You
+# can link multiple libraries, such as libraries you define in this
+# build script, prebuilt third-party libraries, or system libraries.
+
+target_link_libraries( # Specifies the target library.
+ sword
+
+ # Links the target library to the log library
+ # included in the NDK.
+ #${log-lib}
+ log
+ z
+ ) \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/build.gradle b/bindings/Android/SWORD/app/build.gradle
new file mode 100644
index 0000000..38f6a6b
--- /dev/null
+++ b/bindings/Android/SWORD/app/build.gradle
@@ -0,0 +1,41 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion '26.0.2'
+ defaultConfig {
+ applicationId "org.crosswire.sword"
+ minSdkVersion 14
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ externalNativeBuild {
+ cmake {
+ cppFlags "-frtti -fexceptions"
+ }
+ }
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ externalNativeBuild {
+ cmake {
+ path "CMakeLists.txt"
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:appcompat-v7:25.3.0'
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ compile 'com.android.support:design:25.3.0'
+ testCompile 'junit:junit:4.12'
+}
diff --git a/bindings/Android/SWORD/app/proguard-rules.pro b/bindings/Android/SWORD/app/proguard-rules.pro
new file mode 100644
index 0000000..b7161c9
--- /dev/null
+++ b/bindings/Android/SWORD/app/proguard-rules.pro
@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/scribe/Android/Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/bindings/Android/SWORD/app/src/androidTest/java/org/crosswire/sword/ExampleInstrumentedTest.java b/bindings/Android/SWORD/app/src/androidTest/java/org/crosswire/sword/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..88a21a1
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/androidTest/java/org/crosswire/sword/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package org.crosswire.sword;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("org.crosswire.sword", appContext.getPackageName());
+ }
+}
diff --git a/bindings/Android/SWORD/app/src/main/AndroidManifest.xml b/bindings/Android/SWORD/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..8c5ed54
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.crosswire.sword">
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:roundIcon="@mipmap/ic_launcher_round"
+ android:supportsRtl="true"
+ android:theme="@style/AppTheme">
+ <activity
+ android:name="org.crosswire.android.bishop.MainActivity"
+ android:label="@string/title_activity_main">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/cpp/frontend b/bindings/Android/SWORD/app/src/main/cpp/frontend
new file mode 120000
index 0000000..0c85939
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/cpp/frontend
@@ -0,0 +1 @@
+../../../../../../../src/frontend \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/cpp/jni b/bindings/Android/SWORD/app/src/main/cpp/jni
new file mode 120000
index 0000000..2042a86
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/cpp/jni
@@ -0,0 +1 @@
+../../../../../../java-jni/jni/ \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/cpp/keys b/bindings/Android/SWORD/app/src/main/cpp/keys
new file mode 120000
index 0000000..82c5ec9
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/cpp/keys
@@ -0,0 +1 @@
+../../../../../../../src/keys \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/cpp/mgr b/bindings/Android/SWORD/app/src/main/cpp/mgr
new file mode 120000
index 0000000..ff01498
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/cpp/mgr
@@ -0,0 +1 @@
+../../../../../../../src/mgr \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/cpp/modules b/bindings/Android/SWORD/app/src/main/cpp/modules
new file mode 120000
index 0000000..5ce3fc2
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/cpp/modules
@@ -0,0 +1 @@
+../../../../../../../src/modules \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/cpp/utilfuns b/bindings/Android/SWORD/app/src/main/cpp/utilfuns
new file mode 120000
index 0000000..f9cd74a
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/cpp/utilfuns
@@ -0,0 +1 @@
+../../../../../../../src/utilfuns \ No newline at end of file
diff --git a/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/MainActivity.java b/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/MainActivity.java
new file mode 100644
index 0000000..e6626a4
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/MainActivity.java
@@ -0,0 +1,121 @@
+package org.crosswire.android.bishop;
+
+import android.app.Activity;
+
+import android.app.ActionBar;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.content.Context;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.support.v4.widget.DrawerLayout;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import org.crosswire.sword.R;
+
+public class MainActivity extends Activity
+ implements NavigationDrawerFragment.NavigationDrawerCallbacks {
+
+ /**
+ * Fragment managing the behaviors, interactions and presentation of the navigation drawer.
+ */
+ private NavigationDrawerFragment mNavigationDrawerFragment;
+
+ /**
+ * Used to store the last screen title. For use in {@link #restoreActionBar()}.
+ */
+ private CharSequence mTitle;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ mNavigationDrawerFragment = (NavigationDrawerFragment)
+ getFragmentManager().findFragmentById(R.id.navigation_drawer);
+ mTitle = getTitle();
+
+ // Set up the drawer.
+ mNavigationDrawerFragment.setUp(
+ R.id.navigation_drawer,
+ (DrawerLayout) findViewById(R.id.drawer_layout));
+ }
+
+ @Override
+ public void onNavigationDrawerItemSelected(int position) {
+ // update the main content by replacing fragments
+ FragmentManager fragmentManager = getFragmentManager();
+ fragmentManager.beginTransaction()
+ .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
+ .commit();
+ }
+
+ public void onSectionAttached(int number) {
+ switch (number) {
+ case 1:
+ mTitle = getString(R.string.title_section1);
+ break;
+ case 2:
+ mTitle = getString(R.string.title_section2);
+ break;
+ case 3:
+ mTitle = getString(R.string.title_section3);
+ break;
+ }
+ }
+
+ public void restoreActionBar() {
+ ActionBar actionBar = getActionBar();
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ actionBar.setDisplayShowTitleEnabled(true);
+ actionBar.setTitle(mTitle);
+ }
+
+ /**
+ * A placeholder fragment containing a simple view.
+ */
+ public static class PlaceholderFragment extends Fragment {
+ /**
+ * The fragment argument representing the section number for this
+ * fragment.
+ */
+ private static final String ARG_SECTION_NUMBER = "section_number";
+
+ public PlaceholderFragment() {
+ }
+
+ /**
+ * Returns a new instance of this fragment for the given section
+ * number.
+ */
+ public static PlaceholderFragment newInstance(int sectionNumber) {
+ PlaceholderFragment fragment = new PlaceholderFragment();
+ Bundle args = new Bundle();
+ args.putInt(ARG_SECTION_NUMBER, sectionNumber);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_main, container, false);
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ ((MainActivity) activity).onSectionAttached(
+ getArguments().getInt(ARG_SECTION_NUMBER));
+ }
+ }
+
+}
diff --git a/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/NavigationDrawerFragment.java b/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/NavigationDrawerFragment.java
new file mode 100644
index 0000000..29bac37
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/bishop/NavigationDrawerFragment.java
@@ -0,0 +1,284 @@
+package org.crosswire.android.bishop;
+
+
+import android.app.Activity;
+import android.app.ActionBar;
+import android.app.Fragment;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import org.crosswire.sword.R;
+
+/**
+ * Fragment used for managing interactions for and presentation of a navigation drawer.
+ * See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
+ * design guidelines</a> for a complete explanation of the behaviors implemented here.
+ */
+public class NavigationDrawerFragment extends Fragment {
+
+ /**
+ * Remember the position of the selected item.
+ */
+ private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
+
+ /**
+ * Per the design guidelines, you should show the drawer on launch until the user manually
+ * expands it. This shared preference tracks this.
+ */
+ private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
+
+ /**
+ * A pointer to the current callbacks instance (the Activity).
+ */
+ private NavigationDrawerCallbacks mCallbacks;
+
+ /**
+ * Helper component that ties the action bar to the navigation drawer.
+ */
+ private ActionBarDrawerToggle mDrawerToggle;
+
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawerListView;
+ private View mFragmentContainerView;
+
+ private int mCurrentSelectedPosition = 0;
+ private boolean mFromSavedInstanceState;
+ private boolean mUserLearnedDrawer;
+
+ public NavigationDrawerFragment() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Read in the flag indicating whether or not the user has demonstrated awareness of the
+ // drawer. See PREF_USER_LEARNED_DRAWER for details.
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
+ mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
+
+ if (savedInstanceState != null) {
+ mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
+ mFromSavedInstanceState = true;
+ }
+
+ // Select either the default item (0) or the last selected item.
+ selectItem(mCurrentSelectedPosition);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ // Indicate that this fragment would like to influence the set of actions in the action bar.
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ mDrawerListView = (ListView) inflater.inflate(
+ R.layout.drawer_main, container, false);
+ mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ selectItem(position);
+ }
+ });
+ mDrawerListView.setAdapter(new ArrayAdapter<String>(
+ getActionBar().getThemedContext(),
+ android.R.layout.simple_list_item_activated_1,
+ android.R.id.text1,
+ new String[]{
+ getString(R.string.title_section1),
+ getString(R.string.title_section2),
+ getString(R.string.title_section3),
+ }));
+ mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
+ return mDrawerListView;
+ }
+
+ public boolean isDrawerOpen() {
+ return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
+ }
+
+ /**
+ * Users of this fragment must call this method to set up the navigation drawer interactions.
+ *
+ * @param fragmentId The android:id of this fragment in its activity's layout.
+ * @param drawerLayout The DrawerLayout containing this fragment's UI.
+ */
+ public void setUp(int fragmentId, DrawerLayout drawerLayout) {
+ mFragmentContainerView = getActivity().findViewById(fragmentId);
+ mDrawerLayout = drawerLayout;
+
+ // set a custom shadow that overlays the main content when the drawer opens
+ mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+ // set up the drawer's list view with items and click listener
+
+ ActionBar actionBar = getActionBar();
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setHomeButtonEnabled(true);
+
+ // ActionBarDrawerToggle ties together the the proper interactions
+ // between the navigation drawer and the action bar app icon.
+ mDrawerToggle = new ActionBarDrawerToggle(
+ getActivity(), /* host Activity */
+ mDrawerLayout, /* DrawerLayout object */
+ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
+ R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
+ R.string.navigation_drawer_close /* "close drawer" description for accessibility */
+ ) {
+ @Override
+ public void onDrawerClosed(View drawerView) {
+ super.onDrawerClosed(drawerView);
+ if (!isAdded()) {
+ return;
+ }
+
+ getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu()
+ }
+
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ super.onDrawerOpened(drawerView);
+ if (!isAdded()) {
+ return;
+ }
+
+ if (!mUserLearnedDrawer) {
+ // The user manually opened the drawer; store this flag to prevent auto-showing
+ // the navigation drawer automatically in the future.
+ mUserLearnedDrawer = true;
+ SharedPreferences sp = PreferenceManager
+ .getDefaultSharedPreferences(getActivity());
+ sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply();
+ }
+
+ getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu()
+ }
+ };
+
+ // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
+ // per the navigation drawer design guidelines.
+ if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
+ mDrawerLayout.openDrawer(mFragmentContainerView);
+ }
+
+ // Defer code dependent on restoration of previous instance state.
+ mDrawerLayout.post(new Runnable() {
+ @Override
+ public void run() {
+ mDrawerToggle.syncState();
+ }
+ });
+
+ mDrawerLayout.setDrawerListener(mDrawerToggle);
+ }
+
+ private void selectItem(int position) {
+ mCurrentSelectedPosition = position;
+ if (mDrawerListView != null) {
+ mDrawerListView.setItemChecked(position, true);
+ }
+ if (mDrawerLayout != null) {
+ mDrawerLayout.closeDrawer(mFragmentContainerView);
+ }
+ if (mCallbacks != null) {
+ mCallbacks.onNavigationDrawerItemSelected(position);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ try {
+ mCallbacks = (NavigationDrawerCallbacks) activity;
+ } catch (ClassCastException e) {
+ throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mCallbacks = null;
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ // Forward the new configuration the drawer toggle component.
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ // If the drawer is open, show the global app actions in the action bar. See also
+ // showGlobalContextActionBar, which controls the top-left area of the action bar.
+ if (mDrawerLayout != null && isDrawerOpen()) {
+ inflater.inflate(R.menu.global, menu);
+ showGlobalContextActionBar();
+ }
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+
+ if (item.getItemId() == R.id.action_example) {
+ Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ /**
+ * Per the navigation drawer design guidelines, updates the action bar to show the global app
+ * 'context', rather than just what's in the current screen.
+ */
+ private void showGlobalContextActionBar() {
+ ActionBar actionBar = getActionBar();
+ actionBar.setDisplayShowTitleEnabled(true);
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ actionBar.setTitle(R.string.app_name);
+ }
+
+ private ActionBar getActionBar() {
+ return getActivity().getActionBar();
+ }
+
+ /**
+ * Callbacks interface that all activities using this fragment must implement.
+ */
+ public static interface NavigationDrawerCallbacks {
+ /**
+ * Called when an item in the navigation drawer is selected.
+ */
+ void onNavigationDrawerItemSelected(int position);
+ }
+}
diff --git a/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/sword/AndroidMgr.java b/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/sword/AndroidMgr.java
new file mode 100644
index 0000000..61392e6
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/java/org/crosswire/android/sword/AndroidMgr.java
@@ -0,0 +1,45 @@
+/******************************************************************************
+ *
+ * AndroidMgr.java -
+ *
+ * $Id: SWMgr.java 2833 2013-06-29 06:40:28Z chrislit $
+ *
+ * Copyright 2009-2013 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.
+ *
+ */
+
+package org.crosswire.android.sword;
+
+import android.app.Application;
+import android.content.Context;
+
+public class AndroidMgr extends SWMgr {
+
+ private Application app;
+
+ public AndroidMgr(Application app) {
+ super(false);
+ this.app = app;
+ reInit();
+ }
+
+ @Override
+ public String getStorageBasePath() {
+ Context context = app.getApplicationContext();
+ return context.getFilesDir().getAbsolutePath();
+ }
+}
+
+
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-hdpi/drawer_shadow.9.png b/bindings/Android/SWORD/app/src/main/res/drawable-hdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..236bff5
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-hdpi/drawer_shadow.9.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-hdpi/ic_drawer.png b/bindings/Android/SWORD/app/src/main/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 0000000..c59f601
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-hdpi/ic_drawer.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-mdpi/drawer_shadow.9.png b/bindings/Android/SWORD/app/src/main/res/drawable-mdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..ffe3a28
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-mdpi/drawer_shadow.9.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-mdpi/ic_drawer.png b/bindings/Android/SWORD/app/src/main/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 0000000..1ed2c56
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-mdpi/ic_drawer.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png b/bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..fabe9d9
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/ic_drawer.png b/bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 0000000..a5fa74d
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-xhdpi/ic_drawer.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png b/bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
new file mode 100644
index 0000000..b91e9d7
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/ic_drawer.png b/bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/ic_drawer.png
new file mode 100644
index 0000000..9c4685d
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/drawable-xxhdpi/ic_drawer.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/layout/activity_main.xml b/bindings/Android/SWORD/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..0c3c3cc
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,26 @@
+<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
+<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="org.crosswire.android.bishop.MainActivity">
+
+ <!-- As the main content view, the view below consumes the entire
+ space available using match_parent in both dimensions. -->
+ <FrameLayout
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <!-- The drawer is given a fixed width in dp and extends the full height of
+ the container. -->
+ <fragment
+ android:id="@+id/navigation_drawer"
+ android:name="org.crosswire.android.bishop.NavigationDrawerFragment"
+ android:layout_width="@dimen/navigation_drawer_width"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ tools:layout="@layout/drawer_main" />
+
+</android.support.v4.widget.DrawerLayout>
diff --git a/bindings/Android/SWORD/app/src/main/res/layout/drawer_main.xml b/bindings/Android/SWORD/app/src/main/res/layout/drawer_main.xml
new file mode 100644
index 0000000..7a02f93
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/layout/drawer_main.xml
@@ -0,0 +1,9 @@
+<ListView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="#cccc"
+ android:choiceMode="singleChoice"
+ android:divider="@android:color/transparent"
+ android:dividerHeight="0dp"
+ tools:context="org.crosswire.android.bishop.NavigationDrawerFragment" />
diff --git a/bindings/Android/SWORD/app/src/main/res/layout/fragment_main.xml b/bindings/Android/SWORD/app/src/main/res/layout/fragment_main.xml
new file mode 100644
index 0000000..3f80d4e
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/layout/fragment_main.xml
@@ -0,0 +1,16 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context="org.crosswire.android.bishop.MainActivity$PlaceholderFragment">
+
+ <TextView
+ android:id="@+id/section_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+
+</RelativeLayout>
diff --git a/bindings/Android/SWORD/app/src/main/res/menu/global.xml b/bindings/Android/SWORD/app/src/main/res/menu/global.xml
new file mode 100644
index 0000000..e3f1dfa
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/menu/global.xml
@@ -0,0 +1,7 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/action_settings" />
+</menu>
diff --git a/bindings/Android/SWORD/app/src/main/res/menu/main.xml b/bindings/Android/SWORD/app/src/main/res/menu/main.xml
new file mode 100644
index 0000000..037dc19
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/menu/main.xml
@@ -0,0 +1,13 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:context="org.crosswire.android.bishop.MainActivity">
+ <item
+ android:id="@+id/action_example"
+ android:showAsAction="withText|ifRoom"
+ android:title="@string/action_example" />
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/action_settings" />
+</menu>
diff --git a/bindings/Android/SWORD/app/src/main/res/menu/menu_swordtest.xml b/bindings/Android/SWORD/app/src/main/res/menu/menu_swordtest.xml
new file mode 100644
index 0000000..7cb68bd
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/menu/menu_swordtest.xml
@@ -0,0 +1,7 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:context="org.crosswire.sword.SWORDTestActivity">
+ <item android:id="@+id/action_settings" android:orderInCategory="100"
+ android:title="@string/action_settings" app:showAsAction="never" />
+</menu>
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher.png b/bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher.png b/bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..bfa42f0
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..3af2608
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Binary files differ
diff --git a/bindings/Android/SWORD/app/src/main/res/values-w820dp/dimens.xml b/bindings/Android/SWORD/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
diff --git a/bindings/Android/SWORD/app/src/main/res/values/colors.xml b/bindings/Android/SWORD/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..3ab3e9c
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="colorPrimary">#3F51B5</color>
+ <color name="colorPrimaryDark">#303F9F</color>
+ <color name="colorAccent">#FF4081</color>
+</resources>
diff --git a/bindings/Android/SWORD/app/src/main/res/values/dimens.xml b/bindings/Android/SWORD/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..d1c4b97
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/values/dimens.xml
@@ -0,0 +1,10 @@
+<resources>
+ <dimen name="fab_margin">16dp</dimen>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+ <!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
+ https://developer.android.com/design/patterns/navigation-drawer.html -->
+ <dimen name="navigation_drawer_width">240dp</dimen>
+</resources>
diff --git a/bindings/Android/SWORD/app/src/main/res/values/strings.xml b/bindings/Android/SWORD/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..c92ade9
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/values/strings.xml
@@ -0,0 +1,14 @@
+<resources>
+ <string name="app_name">SWORD</string>
+ <string name="action_settings">Settings</string>
+ <string name="title_activity_main">MainActivity</string>
+
+ <string name="title_section1">Section 1</string>
+ <string name="title_section2">Section 2</string>
+ <string name="title_section3">Section 3</string>
+
+ <string name="navigation_drawer_open">Open navigation drawer</string>
+ <string name="navigation_drawer_close">Close navigation drawer</string>
+
+ <string name="action_example">Example action</string>
+</resources>
diff --git a/bindings/Android/SWORD/app/src/main/res/values/styles.xml b/bindings/Android/SWORD/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..3f48db4
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/main/res/values/styles.xml
@@ -0,0 +1,17 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="Theme.AppCompat">
+ <!-- Customize your theme here. -->
+ <item name="colorPrimary">@color/colorPrimary</item>
+ <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+ <item name="colorAccent">@color/colorAccent</item>
+ </style>
+ <style name="AppTheme.NoActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ </style>
+ <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
+ <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
+
+</resources>
diff --git a/bindings/Android/SWORD/app/src/test/java/org/crosswire/sword/ExampleUnitTest.java b/bindings/Android/SWORD/app/src/test/java/org/crosswire/sword/ExampleUnitTest.java
new file mode 100644
index 0000000..5d70b42
--- /dev/null
+++ b/bindings/Android/SWORD/app/src/test/java/org/crosswire/sword/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package org.crosswire.sword;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+} \ No newline at end of file
diff --git a/bindings/Android/SWORD/build.gradle b/bindings/Android/SWORD/build.gradle
new file mode 100644
index 0000000..c33a638
--- /dev/null
+++ b/bindings/Android/SWORD/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.0.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/bindings/Android/SWORD/gradle.properties b/bindings/Android/SWORD/gradle.properties
new file mode 100644
index 0000000..aac7c9b
--- /dev/null
+++ b/bindings/Android/SWORD/gradle.properties
@@ -0,0 +1,17 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.jar b/bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
--- /dev/null
+++ b/bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.properties b/bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..cb0e548
--- /dev/null
+++ b/bindings/Android/SWORD/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Oct 27 12:46:11 MST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/bindings/Android/SWORD/gradlew b/bindings/Android/SWORD/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/bindings/Android/SWORD/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/bindings/Android/SWORD/gradlew.bat b/bindings/Android/SWORD/gradlew.bat
new file mode 100644
index 0000000..aec9973
--- /dev/null
+++ b/bindings/Android/SWORD/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/bindings/Android/SWORD/settings.gradle b/bindings/Android/SWORD/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/bindings/Android/SWORD/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/bindings/corba/omniorbcpp/Makefile b/bindings/corba/omniorbcpp/Makefile
index 5385fb5..24e1220 100644
--- a/bindings/corba/omniorbcpp/Makefile
+++ b/bindings/corba/omniorbcpp/Makefile
@@ -19,6 +19,8 @@ LIBS += -L/usr/lib64
#CXXFLAGS += -g -O0
#CFLAGS += -g -O0
#LDFLAGS += -g -O0
+CXXFLAGS += -O3
+CFLAGS += -O3
#-----------------------------------------------------------------------------
diff --git a/bindings/corba/omniorbcpp/swordorb-impl.cpp b/bindings/corba/omniorbcpp/swordorb-impl.cpp
index a6572ac..01cd169 100644
--- a/bindings/corba/omniorbcpp/swordorb-impl.cpp
+++ b/bindings/corba/omniorbcpp/swordorb-impl.cpp
@@ -2,7 +2,7 @@
*
* swordorb-impl.cpp - omniorb bindings
*
- * $Id: swordorb-impl.cpp 2967 2013-08-18 16:15:46Z scribe $
+ * $Id: swordorb-impl.cpp 3256 2014-09-15 20:03:26Z scribe $
*
* Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -172,6 +172,7 @@ swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1,
swordorb::StringList* swordorb_SWModule_i::parseKeyList(const char* keyText){
sword::VerseKey *parser = dynamic_cast<VerseKey *>(delegate->getKey());
+ parser->setIntros(true);
swordorb::StringList *retVal = new swordorb::StringList;
if (parser) {
sword::ListKey result;
@@ -242,7 +243,7 @@ swordorb::StringList* swordorb_SWModule_i::getKeyChildren(){
sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
if (vkey) {
- retVal->length(8);
+ retVal->length(10);
SWBuf num;
num.appendFormatted("%d", vkey->getTestament());
(*retVal)[0] = CORBA::string_dup(num.c_str());
@@ -263,6 +264,8 @@ swordorb::StringList* swordorb_SWModule_i::getKeyChildren(){
(*retVal)[5] = CORBA::string_dup(num.c_str());
(*retVal)[6] = CORBA::string_dup(vkey->getBookName());
(*retVal)[7] = CORBA::string_dup(vkey->getOSISRef());
+ (*retVal)[8] = CORBA::string_dup(vkey->getShortText());
+ (*retVal)[9] = CORBA::string_dup(vkey->getBookAbbrev());
}
else {
TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);
diff --git a/bindings/corba/orbitcpp/webmgr.hpp b/bindings/corba/orbitcpp/webmgr.hpp
index 048882c..05fa569 100644
--- a/bindings/corba/orbitcpp/webmgr.hpp
+++ b/bindings/corba/orbitcpp/webmgr.hpp
@@ -2,7 +2,7 @@
*
* webmgr.cpp -
*
- * $Id: webmgr.hpp 2833 2013-06-29 06:40:28Z chrislit $
+ * $Id: webmgr.hpp 3548 2017-12-10 05:11:38Z scribe $
*
* Copyright 2005-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -25,6 +25,7 @@
#include <swmgr.h>
#include <swmodule.h>
+#include <filemgr.h>
#include <swfilter.h>
#include <markupfiltmgr.h>
#include <osiswordjs.h>
@@ -41,9 +42,13 @@ class WebMgr : public SWMgr {
SWModule *defaultHebLex;
SWModule *defaultGreekParse;
SWModule *defaultHebParse;
+ char *extraConf;
public:
- WebMgr(SWConfig *sysConf) : SWMgr(0, sysConf, false, new MarkupFilterMgr(FMT_WEBIF)) {
+ WebMgr(const char *path, const char *extraConfPath = 0) : SWMgr(path, false, new MarkupFilterMgr(FMT_WEBIF)) { init(); if (extraConfPath) stdstr(&extraConf, extraConfPath); }
+ WebMgr(SWConfig *sysConf) : SWMgr(0, sysConf, false, new MarkupFilterMgr(FMT_WEBIF)) { init(); }
+ void init() {
+ extraConf = 0;
defaultGreekLex = 0;
defaultHebLex = 0;
defaultGreekParse = 0;
@@ -52,7 +57,7 @@ public:
osisWordJS = new OSISWordJS();
thmlWordJS = new ThMLWordJS();
gbfWordJS = new GBFWordJS();
- Load();
+ load();
osisWordJS->setDefaultModules(defaultGreekLex, defaultHebLex, defaultGreekParse, defaultHebParse);
thmlWordJS->setDefaultModules(defaultGreekLex, defaultHebLex, defaultGreekParse, defaultHebParse);
gbfWordJS->setDefaultModules(defaultGreekLex, defaultHebLex, defaultGreekParse, defaultHebParse);
@@ -66,10 +71,22 @@ public:
delete osisWordJS;
delete thmlWordJS;
delete gbfWordJS;
+ delete extraConf;
}
+ void createAllModules(bool multiMod) {
- void AddGlobalOptions(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end) {
+ if (extraConf) {
+ bool exists = FileMgr::existsFile(extraConf);
+ if (exists) {
+ SWConfig addConfig(extraConf);
+ this->config->augment(addConfig);
+ }
+ }
+ SWMgr::createAllModules(multiMod);
+ }
+
+ void addGlobalOptionFilters(SWModule *module, ConfigEntMap &section) {
// ThML word stuff needs to process before strongs strip
if (module->getMarkup() == FMT_THML) {
@@ -81,7 +98,7 @@ public:
}
// add other module filters
- SWMgr::AddGlobalOptions(module, section, start, end);
+ SWMgr::addGlobalOptionFilters(module, section);
// add our special filters
if (module->getConfig().has("Feature", "GreekDef")) {
diff --git a/bindings/cordova/Makefile b/bindings/cordova/Makefile
new file mode 100644
index 0000000..209287a
--- /dev/null
+++ b/bindings/cordova/Makefile
@@ -0,0 +1,10 @@
+all:
+ @echo
+ @echo "native binary component is built from ../Android/"
+ @echo
+
+clean:
+ # these are from ../Android
+ rm -rf org.crosswire.sword.cordova.SWORD/libs/android/*
+ rm org.crosswire.sword.cordova.SWORD/src/android/AndroidMgr.java org.crosswire.sword.cordova.SWORD/src/android/InstallMgr.java org.crosswire.sword.cordova.SWORD/src/android/SWMgr.java org.crosswire.sword.cordova.SWORD/src/android/SWModule.java
+
diff --git a/bindings/cordova/README b/bindings/cordova/README
new file mode 100644
index 0000000..c59b5c3
--- /dev/null
+++ b/bindings/cordova/README
@@ -0,0 +1,5 @@
+This folder contains a cordova plugin which is based on the
+../Android bindings which is based on the java-jni/ bindings.
+
+Follow the README in the ../java-jni/ bindings folder.
+
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/LICENSE b/bindings/cordova/org.crosswire.sword.cordova.SWORD/LICENSE
new file mode 100644
index 0000000..7a4a3ea
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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. \ No newline at end of file
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/README.md b/bindings/cordova/org.crosswire.sword.cordova.SWORD/README.md
new file mode 100644
index 0000000..5158f6f
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/README.md
@@ -0,0 +1,22 @@
+<!---
+ license: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+# org.apache.cordova.device
+
+Plugin documentation: [doc/index.md](doc/index.md)
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/RELEASENOTES.md b/bindings/cordova/org.crosswire.sword.cordova.SWORD/RELEASENOTES.md
new file mode 100644
index 0000000..a2f41dd
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/RELEASENOTES.md
@@ -0,0 +1,57 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+-->
+# Release Notes
+
+### 0.2.1 (Sept 5, 2013)
+* removed extraneous print statement
+* [CB-4432] copyright notice change
+
+### 0.2.3 (Sept 25, 2013)
+* CB-4889 bumping&resetting version
+* [windows8] commandProxy has moved
+* [BlackBerry10] removed uneeded permission tags in plugin.xml
+* CB-4889 renaming org.apache.cordova.core.device to org.apache.cordova.device
+* Rename CHANGELOG.md -> RELEASENOTES.md
+* updated to use commandProxy for ffos
+* add firefoxos support
+* [CB-4752] Incremented plugin version on dev branch.
+
+### 0.2.4 (Oct 28, 2013)
+* CB-5128: added repo + issue tag in plugin.xml for device plugin
+* CB-5085 device.cordova returning wrong value
+* [CB-4915] Incremented plugin version on dev branch.
+
+### 0.2.5 (Dec 4, 2013)
+* CB-5316 Spell Cordova as a brand unless it's a command or script
+* [ubuntu] use cordova/exec/proxy
+* add ubuntu platform
+* Modify Device.platform logic to use amazon-fireos as the platform for Amazon Devices
+* 1. Added amazon-fireos platform. 2. Change to use cordova-amazon-fireos as the platform if user agent contains 'cordova-amazon-fireos'
+
+### 0.2.6 (Jan 02, 2014)
+* CB-5658 Add doc/index.md for Device plugin
+* CB-5504 Moving Telephony Logic out of Device
+
+### 0.2.7 (Jan 07, 2014)
+* CB-5737 Fix exception on close caused by left over telephony code from CB-5504
+
+### 0.2.8 (Feb 05, 2014)
+* Tizen support added
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/doc/index.md b/bindings/cordova/org.crosswire.sword.cordova.SWORD/doc/index.md
new file mode 100644
index 0000000..9e5c677
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/doc/index.md
@@ -0,0 +1,213 @@
+<!---
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+# org.apache.cordova.device
+
+This plugin defines a global `device` object, which describes the device's hardware and software.
+Although the object is in the global scope, it is not available until after the `deviceready` event.
+
+ document.addEventListener("deviceready", onDeviceReady, false);
+ function onDeviceReady() {
+ console.log(device.cordova);
+ }
+
+## Installation
+
+ cordova plugin add org.apache.cordova.device
+
+## Properties
+
+- device.cordova
+- device.model
+- device.name
+- device.platform
+- device.uuid
+- device.version
+
+## device.cordova
+
+Get the version of Cordova running on the device.
+
+### Supported Platforms
+
+- Amazon Fire OS
+- Android
+- BlackBerry 10
+- Firefox OS
+- iOS
+- Tizen
+- Windows Phone 7 and 8
+- Windows 8
+
+## device.model
+
+The `device.model` returns the name of the device's model or
+product. The value is set by the device manufacturer and may be
+different across versions of the same product.
+
+### Supported Platforms
+
+- Android
+- BlackBerry 10
+- iOS
+- Tizen
+- Windows Phone 7 and 8
+- Windows 8
+
+### Quick Example
+
+ // Android: Nexus One returns "Passion" (Nexus One code name)
+ // Motorola Droid returns "voles"
+ // BlackBerry: Torch 9800 returns "9800"
+ // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models
+ //
+ var model = device.model;
+
+### Android Quirks
+
+- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL), which is often the production code name. For example, the Nexus One returns `Passion`, and Motorola Droid returns `voles`.
+
+### Tizen Quirks
+
+- Returns the device model assigned by the vendor, for example, `TIZEN`
+
+### Windows Phone 7 and 8 Quirks
+
+- Returns the device model specified by the manufacturer. For example, the Samsung Focus returns `SGH-i917`.
+
+## device.name
+
+__WARNING__: `device.name` is deprecated as of version 2.3.0. Use `device.model` instead.
+
+## device.platform
+
+Get the device's operating system name.
+
+ var string = device.platform;
+
+### Supported Platforms
+
+- Android
+- BlackBerry 10
+- Firefox OS
+- iOS
+- Tizen
+- Windows Phone 7 and 8
+- Windows 8
+
+### Quick Example
+
+ // Depending on the device, a few examples are:
+ // - "Android"
+ // - "BlackBerry 10"
+ // - "iOS"
+ // - "WinCE"
+ // - "Tizen"
+ var devicePlatform = device.platform;
+
+### Windows Phone 7 Quirks
+
+Windows Phone 7 devices report the platform as `WinCE`.
+
+### Windows Phone 8 Quirks
+
+Windows Phone 8 devices report the platform as `Win32NT`.
+
+## device.uuid
+
+Get the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)).
+
+ var string = device.uuid;
+
+### Description
+
+The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.
+
+### Supported Platforms
+
+- Android
+- BlackBerry 10
+- iOS
+- Tizen
+- Windows Phone 7 and 8
+- Windows 8
+
+### Quick Example
+
+ // Android: Returns a random 64-bit integer (as a string, again!)
+ // The integer is generated on the device's first boot
+ //
+ // BlackBerry: Returns the PIN number of the device
+ // This is a nine-digit unique integer (as a string, though!)
+ //
+ // iPhone: (Paraphrased from the UIDevice Class documentation)
+ // Returns a string of hash values created from multiple hardware identifies.
+ // It is guaranteed to be unique for every device and can't be tied
+ // to the user account.
+ // Windows Phone 7 : Returns a hash of device+current user,
+ // if the user is not defined, a guid is generated and will persist until the app is uninstalled
+ // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number
+ // unique to every GSM and UMTS mobile phone.
+ var deviceID = device.uuid;
+
+### iOS Quirk
+
+The `uuid` on iOS is not unique to a device, but varies for each
+application, for each installation. It changes if you delete and
+re-install the app, and possibly also when you upgrade iOS, or even
+upgrade the app per version (apparent in iOS 5.1). The `uuid` is not
+a reliable value.
+
+### Windows Phone 7 and 8 Quirks
+
+The `uuid` for Windows Phone 7 requires the permission
+`ID_CAP_IDENTITY_DEVICE`. Microsoft will likely deprecate this
+property soon. If the capability is not available, the application
+generates a persistent guid that is maintained for the duration of the
+application's installation on the device.
+
+## device.version
+
+Get the operating system version.
+
+ var string = device.version;
+
+### Supported Platforms
+
+- Android 2.1+
+- BlackBerry 10
+- iOS
+- Tizen
+- Windows Phone 7 and 8
+- Windows 8
+
+### Quick Example
+
+ // Android: Froyo OS would return "2.2"
+ // Eclair OS would return "2.1", "2.0.1", or "2.0"
+ // Version can also return update level "2.1-update1"
+ //
+ // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600"
+ //
+ // iPhone: iOS 3.2 returns "3.2"
+ //
+ // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720
+ // Tizen: returns "TIZEN_20120425_2"
+ var deviceVersion = device.version;
+
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/package.json b/bindings/cordova/org.crosswire.sword.cordova.SWORD/package.json
new file mode 100644
index 0000000..3be0b9f
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "SWORD",
+ "version": "0.0.1",
+ "description": "The SWORD Project Plugin",
+ "cordova": {
+ "id": "org.crosswire.sword.cordova.SWORD",
+ "platforms": [
+ "android",
+ "amazon-fireos",
+ "ios"
+ ]
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://crosswire.org/svn/sword"
+ },
+ "keywords": [
+ "cordova",
+ "sword",
+ "Bible",
+ "ecosystem:cordova",
+ "cordova-android",
+ "cordova-ios",
+ "cordova-amazon-fireos"
+ ],
+ "author": "CrossWire Bible Society",
+ "license": "GNU 2.0"
+}
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml b/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml
new file mode 100644
index 0000000..33d5c40
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="org.crosswire.sword.cordova.SWORD"
+ version="0.0.1">
+ <name>SWORD</name>
+ <description>The SWORD Project Plugin</description>
+ <license>GNU 2.0</license>
+ <keywords>cordova,sword,Bible</keywords>
+ <repo>https://crosswire.org/svn/sword</repo>
+ <issue>http://crosswire.org/tracker</issue>
+
+ <js-module src="www/SWORD.js" name="SWORD">
+ <clobbers target="SWORD" />
+ </js-module>
+
+ <!-- firefoxos
+ <platform name="firefoxos">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Device">
+ <param name="firefoxos-package" value="Device" />
+ </feature>
+ </config-file>
+
+ <js-module src="src/firefoxos/DeviceProxy.js" name="DeviceProxy">
+ <runs />
+ </js-module>
+ </platform>
+ -->
+ <!-- tizen
+ <platform name="tizen">
+ <js-module src="src/tizen/DeviceProxy.js" name="DeviceProxy">
+ <runs />
+ </js-module>
+ </platform>
+ -->
+ <!-- android -->
+ <platform name="android">
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="SWORD" >
+ <param name="android-package" value="org.crosswire.sword.cordova.SWORD"/>
+ </feature>
+ </config-file>
+ <config-file target="AndroidManifest.xml" parent="/manifest">
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ </config-file>
+
+ <source-file src="src/android/SWORD.java" target-dir="src/org/crosswire/sword/cordova" />
+ <source-file src="src/android/SWMgr.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="src/android/AndroidMgr.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="src/android/SWModule.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="src/android/InstallMgr.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="libs/android/armeabi/libsword.so" target-dir="libs/armeabi" />
+ <source-file src="libs/android/arm64-v8a/libsword.so" target-dir="libs/arm64-v8a" />
+ <source-file src="libs/android/x86/libsword.so" target-dir="libs/x86" />
+ <source-file src="libs/android/mips64/libsword.so" target-dir="libs/mips64" />
+ <source-file src="libs/android/mips/libsword.so" target-dir="libs/mips" />
+ <source-file src="libs/android/armeabi-v7a/libsword.so" target-dir="libs/armeabi-v7a" />
+ <source-file src="libs/android/x86_64/libsword.so" target-dir="libs/x86_64" />
+ </platform>
+
+ <!-- amazon-fireos -->
+ <platform name="amazon-fireos">
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="SWORD" >
+ <param name="android-package" value="org.crosswire.sword.cordova"/>
+ </feature>
+ </config-file>
+
+ <source-file src="src/android/SWORD.java" target-dir="src/org/crosswire/sword/cordova" />
+ <source-file src="src/android/SWMgr.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="src/android/AndroidMgr.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="src/android/SWModule.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="src/android/InstallMgr.java" target-dir="src/org/crosswire/android/sword" />
+ <source-file src="libs/android/armeabi/libsword.so" target-dir="libs/armeabi" />
+ <source-file src="libs/android/arm64-v8a/libsword.so" target-dir="libs/arm64-v8a" />
+ <source-file src="libs/android/x86/libsword.so" target-dir="libs/x86" />
+ <source-file src="libs/android/mips64/libsword.so" target-dir="libs/mips64" />
+ <source-file src="libs/android/mips/libsword.so" target-dir="libs/mips" />
+ <source-file src="libs/android/armeabi-v7a/libsword.so" target-dir="libs/armeabi-v7a" />
+ <source-file src="libs/android/x86_64/libsword.so" target-dir="libs/x86_64" />
+ </platform>
+
+ <!-- ubuntu
+ <platform name="ubuntu">
+ <header-file src="src/ubuntu/device.h" />
+ <source-file src="src/ubuntu/device.cpp" />
+ <js-module src="src/ubuntu/device.js" name="DeviceProxy">
+ <merges target="device" />
+ </js-module>
+ </platform>
+ -->
+ <!-- ios -->
+ <platform name="ios">
+ <config-file target="config.xml" parent="/*">
+ <feature name="SWORD">
+ <param name="ios-package" value="SWORD" />
+ </feature>
+ </config-file>
+ <header-file src="src/ios/flatapi.h" />
+ <header-file src="src/ios/defs.h" />
+ <header-file src="src/ios/SWORD-Bridging-Header.h" />
+ <source-file src="src/ios/SWORD.swift" />
+ <source-file src="libs/ios/libSWORD.a" framework="true" />
+ <source-file src="libs/ios/libcurl.a" framework="true" />
+ <framework src="libstdc++.dylib" />
+ <framework src="libcurl.dylib" />
+
+ <dependency id="cordova-plugin-add-swift-support" />
+
+<!-- <source-file src="lib/ios/libSWORD.a" framework="true" /> -->
+ </platform>
+
+ <!-- blackberry10
+ <platform name="blackberry10">
+ <source-file src="src/blackberry10/index.js" target-dir="Device" />
+ <config-file target="www/config.xml" parent="/widget">
+ <feature name="Device" value="Device"/>
+ </config-file>
+ <config-file target="www/config.xml" parent="/widget/rim:permissions">
+ <rim:permit>read_device_identifying_information</rim:permit>
+ </config-file>
+ </platform>
+ -->
+ <!-- wp7
+ <platform name="wp7">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Device">
+ <param name="wp-package" value="Device"/>
+ </feature>
+ </config-file>
+
+ <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
+ <Capability Name="ID_CAP_IDENTITY_DEVICE" />
+ </config-file>
+
+ <source-file src="src/wp/Device.cs" />
+ </platform>
+ -->
+ <!-- wp8
+ <platform name="wp8">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Device">
+ <param name="wp-package" value="Device"/>
+ </feature>
+ </config-file>
+
+ <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
+ <Capability Name="ID_CAP_IDENTITY_DEVICE" />
+ </config-file>
+
+ <source-file src="src/wp/Device.cs" />
+ </platform>
+ -->
+ <!-- windows8
+ <platform name="windows8">
+ <js-module src="src/windows8/DeviceProxy.js" name="DeviceProxy">
+ <merges target="" />
+ </js-module>
+ </platform>
+ -->
+</plugin>
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java
new file mode 100644
index 0000000..88c4119
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java
@@ -0,0 +1,660 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+*/
+package org.crosswire.sword.cordova;
+
+import java.util.TimeZone;
+import java.util.Vector;
+import java.util.Map;
+import java.util.HashMap;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.PluginResult;
+import org.apache.cordova.CordovaInterface;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import org.crosswire.android.sword.SWMgr;
+import org.crosswire.android.sword.AndroidMgr;
+import org.crosswire.android.sword.SWModule;
+import org.crosswire.android.sword.InstallMgr;
+
+import android.provider.Settings;
+import android.util.Log;
+import android.content.Intent;
+import android.app.Activity;
+
+public class SWORD extends CordovaPlugin {
+ public static final String TAG = "SWORD";
+ public static SWMgr mgr = null;
+ public static InstallMgr installMgr = null;
+ private CallbackContext installReporterContext = null;
+ private CallbackContext searchReporterContext = null;
+ private CallbackContext renderChapterContext = null;
+ private CallbackContext sendContext = null;
+
+ /**
+ * Constructor.
+ */
+ public SWORD() {
+ }
+
+ /**
+ * Sets the context of the Command. This can then be used to do things like
+ * get file paths associated with the Activity.
+ *
+ * @param cordova The context of the main Activity.
+ * @param webView The CordovaWebView Cordova is running in.
+ */
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ super.initialize(cordova, webView);
+ mgr = new AndroidMgr(cordova.getActivity().getApplication());
+ installMgr = new InstallMgr();
+ installReporterContext = null;
+ searchReporterContext = null;
+ renderChapterContext = null;
+ }
+
+ /**
+ * Executes the request and returns PluginResult.
+ *
+ * @param action The action to execute.
+ * @param args JSONArry of arguments for the plugin.
+ * @param callbackContext The callback id used when calling back into JavaScript.
+ * @return True if the action was valid, false if not.
+ */
+ public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException {
+ if (action.equals("initSWORD")) {
+ JSONObject r = new JSONObject();
+ r.put("version", mgr.version());
+ callbackContext.success(r);
+ }
+ else if (action.equals("echo")) {
+ echo(callbackContext, args.getString(0));
+ }
+ else if (action.equals("InstallMgr_setUserDisclaimerConfirmed")) {
+ installMgr.setUserDisclaimerConfirmed();
+ callbackContext.success();
+ }
+ else if (action.equals("InstallMgr_syncConfig")) {
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ installMgr.syncConfig();
+ installMgr.reInit();
+ callbackContext.success();
+ }
+ });
+ }
+ else if (action.equals("InstallMgr_getRemoteSources")) {
+ JSONArray r = new JSONArray();
+ String sources[] = installMgr.getRemoteSources();
+ for (String s : sources) {
+ r.put(s);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("InstallMgr_refreshRemoteSource")) {
+ final String repo = args.getString(0);
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ installMgr.refreshRemoteSource(repo);
+ callbackContext.success();
+ }
+ });
+ }
+ else if (action.equals("InstallMgr_getRemoteModInfoList")) {
+ JSONArray r = new JSONArray();
+ for (SWMgr.ModInfo mi : installMgr.getRemoteModInfoList(args.getString(0))) {
+ JSONObject m = new JSONObject();
+ m.put("name", mi.name);
+ m.put("description", mi.description);
+ m.put("category", mi.category);
+ m.put("language", mi.language);
+ m.put("version", mi.version);
+ m.put("delta", mi.delta);
+ r.put(m);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("InstallMgr_remoteInstallModule")) {
+ this.installReporterContext = callbackContext;
+ final String repo = args.getString(0);
+ final String modName = args.getString(1);
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+
+ installMgr.remoteInstallModule(repo, modName, new InstallMgr.InstallProgressReporter() {
+ public void update(long totalBytes, long completedBytes) {
+ /*
+ // callback({ status : preStatus|update|complete, totalBytes : n, completedBytes : n, message : displayable });
+ */
+ try {
+
+ JSONObject m = new JSONObject();
+ m.put("status", "update");
+ m.put("totalBytes", totalBytes);
+ m.put("completedBytes", completedBytes);
+ if (installReporterContext != null) {
+ PluginResult result = new PluginResult(PluginResult.Status.OK, m);
+ result.setKeepCallback(true);
+ installReporterContext.sendPluginResult(result);
+ }
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ }
+ public void preStatus(long totalBytes, long completedBytes, String message) {
+ try {
+ JSONObject m = new JSONObject();
+ m.put("status", ("Complete".equals(message)) ? "complete" : "preStatus");
+ m.put("totalBytes", totalBytes);
+ m.put("completedBytes", completedBytes);
+ m.put("message", message);
+ if (installReporterContext != null) {
+ PluginResult result = new PluginResult(PluginResult.Status.OK, m);
+ result.setKeepCallback(!"Complete".equals(message));
+ installReporterContext.sendPluginResult(result);
+ }
+ if ("Complete".equals(message)) {
+ // let's be sure we see our new module
+ mgr.reInit();
+ // and clear out context
+ installReporterContext = null;
+ }
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ }
+ });
+
+ }
+ });
+
+ PluginResult result = new PluginResult(PluginResult.Status.OK);
+ result.setKeepCallback(true);
+ callbackContext.sendPluginResult(result);
+ }
+ else if (action.equals("InstallMgr_uninstallModule")) {
+ installMgr.uninstallModule(args.getString(0));
+ callbackContext.success();
+ }
+ else if (action.equals("SWMgr_getExtraConfigSections")) {
+ JSONArray r = new JSONArray();
+ for (String s : mgr.getExtraConfigSections()) {
+ r.put(s);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("SWMgr_getExtraConfigKeys")) {
+ JSONArray r = new JSONArray();
+ for (String s : mgr.getExtraConfigKeys(args.getString(0))) {
+ r.put(s);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("SWMgr_getExtraConfigValue")) {
+ callbackContext.success(mgr.getExtraConfigValue(args.getString(0), args.getString(1)));
+ }
+ else if (action.equals("SWMgr_setExtraConfigValue")) {
+ mgr.setExtraConfigValue(args.getString(0), args.getString(1), args.getString(2));
+ callbackContext.success();
+ }
+ else if (action.equals("SWMgr_addExtraConfig")) {
+ JSONArray r = new JSONArray();
+ for (String s : mgr.addExtraConfig(args.getString(0))) {
+ r.put(s);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("SWMgr_getModInfoList")) {
+ JSONArray r = new JSONArray();
+ for (SWMgr.ModInfo mi : mgr.getModInfoList()) {
+ JSONObject m = new JSONObject();
+ m.put("name", mi.name);
+ m.put("description", mi.description);
+ m.put("category", mi.category);
+ m.put("language", mi.language);
+ m.put("version", mi.version);
+ m.put("delta", mi.delta);
+ r.put(m);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("SWMgr_getModuleByName")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ // didn't find module is not an error
+ if (mod == null) { callbackContext.success(); return true; }
+
+ JSONObject m = new JSONObject();
+ m.put("name", mod.getName());
+ m.put("description", mod.getDescription());
+ m.put("category", mod.getCategory());
+ m.put("direction", mod.getConfigEntry("Direction"));
+ m.put("language", mod.getConfigEntry("Lang"));
+ m.put("font", mod.getConfigEntry("Font"));
+ m.put("shortCopyright", mod.getConfigEntry("ShortCopyright"));
+ m.put("shortPromo", mod.getConfigEntry("ShortPromo"));
+ callbackContext.success(m);
+ }
+ else if (action.equals("SWModule_setKeyText")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ mod.setKeyText(args.getString(1));
+ callbackContext.success();
+ }
+ else if (action.equals("SWModule_getKeyText")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ callbackContext.success(mod.getKeyText());
+ }
+ else if (action.equals("SWModule_search")) {
+ this.searchReporterContext = callbackContext;
+ final SWModule mod = mgr.getModuleByName(args.getString(0));
+ final String expression = args.getString(1);
+ final int searchType = args.getInt(2);
+ final long flags = args.getLong(3);
+ final String scope = JSONObject.NULL.equals(args.getString(4)) || "null".equals(args.getString(4)) ? null : args.getString(4);
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+
+ SWModule.SearchHit[] results = mod.search(expression, searchType, flags, scope, new SWModule.SearchProgressReporter() {
+ public void progressReport(int percent) {
+ try {
+ JSONObject m = new JSONObject();
+ m.put("status", "update");
+ m.put("percent", percent);
+ if (searchReporterContext != null) {
+ PluginResult result = new PluginResult(PluginResult.Status.OK, m);
+ result.setKeepCallback(true);
+ searchReporterContext.sendPluginResult(result);
+ }
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ }
+ });
+ try {
+ JSONObject m = new JSONObject();
+ m.put("status", "complete");
+ m.put("percent", 100);
+ JSONArray r = new JSONArray();
+ for (SWModule.SearchHit s : results) {
+ JSONObject re = new JSONObject();
+ re.put("key", s.key);
+ re.put("score", s.score);
+ r.put(re);
+ }
+ m.put("results", r);
+ if (searchReporterContext != null) {
+ PluginResult result = new PluginResult(PluginResult.Status.OK, m);
+ result.setKeepCallback(false);
+ searchReporterContext.sendPluginResult(result);
+ }
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ searchReporterContext = null;
+ }
+ });
+
+ PluginResult result = new PluginResult(PluginResult.Status.OK);
+ result.setKeepCallback(true);
+ callbackContext.sendPluginResult(result);
+ }
+ else if (action.equals("SWModule_getRenderChapter")) {
+ this.renderChapterContext = callbackContext;
+
+ final SWModule masterMod = mgr.getModuleByName(args.getString(0));
+ final SWModule mod = mgr.getModuleByName(args.getString(1));
+ if (masterMod == null) { callbackContext.error("couldn't find master module: " + args.getString(0)); return true; }
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(1)); return true; }
+
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+
+ JSONArray r = new JSONArray();
+ try {
+ r = getRenderChapter(masterMod, mod);
+ } catch (JSONException e) { e.printStackTrace(); }
+ PluginResult result = new PluginResult(PluginResult.Status.OK, r);
+ result.setKeepCallback(false);
+ if (renderChapterContext != null) {
+ renderChapterContext.sendPluginResult(result);
+ renderChapterContext = null;
+ }
+ }
+ });
+
+ PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+ result.setKeepCallback(true);
+ callbackContext.sendPluginResult(result);
+ }
+ else if (action.equals("SWMgr_registerBibleSyncListener")) {
+ final CallbackContext bibleSyncListener = callbackContext;
+
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ mgr.registerBibleSyncListener(new SWMgr.BibleSyncListener() {
+ public void messageReceived(String message) {
+ PluginResult result = new PluginResult(PluginResult.Status.OK, message);
+ result.setKeepCallback(true);
+ bibleSyncListener.sendPluginResult(result);
+ }
+ });
+ }
+ });
+
+ PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+ result.setKeepCallback(true);
+ callbackContext.sendPluginResult(result);
+ }
+ else if (action.equals("SWMgr_setJavascript")) {
+ boolean val = args.getBoolean(0);
+ mgr.setJavascript(val);
+ callbackContext.success();
+ }
+ else if (action.equals("SWMgr_sendBibleSyncMessage")) {
+ String osisRef = args.getString(0);
+ mgr.sendBibleSyncMessage(osisRef);
+ callbackContext.success();
+ }
+ else if (action.equals("SWModule_getRenderText")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ callbackContext.success(mod.getRenderText());
+ }
+ else if (action.equals("SWModule_sendText")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ this.sendContext = callbackContext;
+ sendVerse(mod, new String[] { mod.getKeyText() }, cordova, this);
+ PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+ result.setKeepCallback(true);
+ callbackContext.sendPluginResult(result);
+ }
+ else if (action.equals("SWModule_getRenderHeader")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ callbackContext.success(mod.getRenderHeader());
+ }
+ else if (action.equals("SWModule_getKeyChildren")) {
+ 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 k : mod.getKeyChildren()) {
+ r.put(k);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("SWModule_getConfigEntry")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ callbackContext.success(mod.getConfigEntry(args.getString(1)));
+ }
+ else if (action.equals("SWModule_getEntryAttribute")) {
+ 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 k : mod.getEntryAttribute(args.getString(1), args.getString(2), args.getString(3), args.getBoolean(4))) {
+ r.put(k);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("SWModule_popError")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ callbackContext.success((int)mod.error());
+ }
+ else if (action.equals("SWModule_next")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ mod.next();
+ callbackContext.success();
+ }
+ else if (action.equals("SWModule_previous")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ mod.previous();
+ callbackContext.success();
+ }
+ else if (action.equals("SWModule_begin")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ mod.begin();
+ callbackContext.success();
+ }
+ else if (action.equals("SWModule_getVerseKey")) {
+ SWModule mod = mgr.getModuleByName(args.getString(0));
+ if (mod == null) { callbackContext.error("couldn't find module: " + args.getString(0)); return true; }
+ callbackContext.success(getVerseKey(mod.getKeyChildren()));
+ }
+ else if (action.equals("SWModule_getBookNames")) {
+ 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);
+ }
+ callbackContext.success(r);
+ }
+ else if (action.equals("HTTPUtils_makeRequest")) {
+ final CallbackContext makeRequestContext = callbackContext;
+
+ final String url = args.getString(0);
+ final String postData = args.getString(1);
+ final int method = args.getInt(2);
+Log.d(TAG, "makeRequest(url: " + url + ", postData: " + postData + ", method: " + method);
+
+ cordova.getThreadPool().execute(new Runnable() {
+ @Override
+ public void run() {
+ String response = makeRequest(url, postData, method, null);
+ PluginResult result = new PluginResult(PluginResult.Status.OK, response);
+ result.setKeepCallback(false);
+ makeRequestContext.sendPluginResult(result);
+ }
+ });
+
+ PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
+ result.setKeepCallback(true);
+ callbackContext.sendPluginResult(result);
+ }
+ else return false;
+
+ return true;
+ }
+
+ JSONObject getVerseKey(String keyChildren[]) throws JSONException {
+ JSONObject retVal = new JSONObject();
+ if (keyChildren != null && keyChildren.length > 9) {
+ retVal.put("testament", Integer.parseInt(keyChildren[SWModule.VERSEKEY_TESTAMENT]));
+ retVal.put("book", Integer.parseInt(keyChildren[SWModule.VERSEKEY_BOOK]));
+ retVal.put("chapter", Integer.parseInt(keyChildren[SWModule.VERSEKEY_CHAPTER]));
+ retVal.put("verse", Integer.parseInt(keyChildren[SWModule.VERSEKEY_VERSE]));
+ retVal.put("chapterMax", Integer.parseInt(keyChildren[SWModule.VERSEKEY_CHAPTERMAX]));
+ retVal.put("verseMax", Integer.parseInt(keyChildren[SWModule.VERSEKEY_VERSEMAX]));
+ retVal.put("bookName", keyChildren[SWModule.VERSEKEY_BOOKNAME]);
+ retVal.put("osisRef", keyChildren[SWModule.VERSEKEY_OSISREF]);
+ retVal.put("shortText", keyChildren[SWModule.VERSEKEY_SHORTTEXT]);
+ retVal.put("bookAbbrev", keyChildren[SWModule.VERSEKEY_BOOKABBREV]);
+ }
+ return retVal;
+ }
+
+ public JSONArray getRenderChapter(SWModule masterMod, SWModule mod) throws JSONException {
+ JSONArray r = new JSONArray();
+
+ // save our current keys so we can set our mods back when we're done
+ String saveMasterKey = masterMod.getKeyText();
+ String saveKey = mod.getKeyText();
+
+ String currentKey[] = masterMod.getKeyChildren();
+
+ masterMod.setKeyText(currentKey[SWModule.VERSEKEY_BOOKABBREV]+"."+currentKey[SWModule.VERSEKEY_CHAPTER]+".1");
+
+ String [] verseKey = masterMod.getKeyChildren();
+ while (
+ masterMod.error() == 0
+ && currentKey[SWModule.VERSEKEY_BOOK].equals(verseKey[SWModule.VERSEKEY_BOOK])
+ && currentKey[SWModule.VERSEKEY_CHAPTER].equals(verseKey[SWModule.VERSEKEY_CHAPTER])) {
+
+ mod.setKeyText(verseKey[SWModule.VERSEKEY_OSISREF]);
+ char error = mod.error();
+ JSONObject v = new JSONObject();
+ if (((int)error) == 0) {
+ v.put("verse", getVerseKey(mod.getKeyChildren()));
+ String preVerse = "";
+ for (String h : mod.getEntryAttribute("Heading", "Preverse", "", true)) {
+ preVerse += h;
+ }
+ v.put("preVerse", preVerse);
+ v.put("text", mod.getRenderText());
+ }
+ else {
+/* null removes entry
+ v.put("verse", null);
+ v.put("preVerse", null);
+ v.put("text", null);
+*/
+ }
+ r.put(v);
+ masterMod.next();
+ verseKey = masterMod.getKeyChildren();
+ }
+
+ masterMod.setKeyText(saveMasterKey);
+ mod.setKeyText(saveKey);
+
+ return r;
+ }
+
+
+ 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
+ //--------------------------------------------------------------------------
+
+ public void echo(CallbackContext callbackContext, String message) {
+ if (message != null && message.length() > 0) {
+ callbackContext.success(message);
+ }
+ else {
+ callbackContext.error("expected 1 arg");
+ }
+ }
+
+ public static final int METHOD_GET = 0;
+ public static final int METHOD_POST = 1;
+ public static final String METHODS_TEXT[] = { "GET", "POST" };
+
+ public static String makeRequest(String url, String postData, int method, Map<String, String> headers) {
+ HttpURLConnection connection = null;
+
+ Map<String, String> defaultHeaders = new HashMap<String, String>();
+ defaultHeaders.put("Accept", "*/*");
+// defaultHeaders.put("Content-Type", "application/xml");
+ defaultHeaders.put("Content-Type", "application/x-www-form-urlencoded");
+ if (method != METHOD_GET && postData != null) defaultHeaders.put("Content-Length", Integer.toString(postData.length()));
+
+ try {
+ if (headers != null) defaultHeaders.putAll(headers);
+
+ if (method == METHOD_GET && postData != null && postData.length() > 0) {
+ // some sanity checks for appending GET params to URL
+ if (url.indexOf("?") < 0) if (!postData.startsWith("?")) url += "?";
+ else if (!url.endsWith("&") && !postData.startsWith("&")) url += "&";
+
+ url += postData;
+ }
+
+ connection = (HttpURLConnection) new URL(url).openConnection();
+ connection.setRequestMethod(METHODS_TEXT[method]);
+ for (String k : defaultHeaders.keySet()) {
+ connection.setRequestProperty(k, defaultHeaders.get(k));
+ }
+ if (method == METHOD_POST) {
+ connection.setDoOutput(true);
+ if (postData != null) {
+ DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
+ dos.writeBytes(postData);
+ dos.flush();
+ dos.close();
+ }
+ }
+ int responseCode = connection.getResponseCode();
+ BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ StringBuilder response = new StringBuilder();
+ String line;
+ while ((line = br.readLine()) != null) {
+ response.append(line);
+ }
+ /* do something special if success code?
+ if (responseCode >= 200 && responseCode < 300) {
+ }
+ else throw new Exception("HTTP Response: " + responseCode);
+ */
+ return response.toString();
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ return null;
+ }
+ public static void sendVerse(final SWModule mod, final String verse[], final CordovaInterface cordova, final CordovaPlugin plugin) {
+ cordova.getThreadPool().execute(new Runnable() {
+ public void run() {
+ String subject = mod.getKeyChildren()[SWModule.VERSEKEY_SHORTTEXT] + " (" + mod.getName() + ")";
+ String message = mod.getStripText() + " --" +subject;
+ final Intent sendIntent = new Intent(Intent.ACTION_SEND);
+ sendIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+
+ sendIntent.setType("text/plain");
+
+ sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
+ sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
+
+ cordova.startActivityForResult(plugin, Intent.createChooser(sendIntent, null), 1);
+ }
+ });
+ }
+
+ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
+ switch (requestCode) {
+ case 1:
+ sendContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, resultCode == Activity.RESULT_OK));
+ }
+ super.onActivityResult(requestCode, resultCode, intent);
+ }
+
+}
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/blackberry10/index.js b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/blackberry10/index.js
new file mode 100644
index 0000000..639ac64
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/blackberry10/index.js
@@ -0,0 +1,69 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+function getModelName () {
+ var modelName = window.qnx.webplatform.device.modelName;
+ //Pre 10.2 (meaning Z10 or Q10)
+ if (typeof modelName === "undefined") {
+ if (window.screen.height === 720 && window.screen.width === 720) {
+ if ( window.matchMedia("(-blackberry-display-technology: -blackberry-display-oled)").matches) {
+ modelName = "Q10";
+ } else {
+ modelName = "Q5";
+ }
+ } else if ((window.screen.height === 1280 && window.screen.width === 768) ||
+ (window.screen.height === 768 && window.screen.width === 1280)) {
+ modelName = "Z10";
+ } else {
+ modelName = window.qnx.webplatform.deviceName;
+ }
+ }
+
+ return modelName;
+}
+
+function getUUID () {
+ var uuid = "";
+ try {
+ //Must surround by try catch because this will throw if the app is missing permissions
+ uuid = window.qnx.webplatform.device.devicePin;
+ } catch (e) {
+ //DO Nothing
+ }
+ return uuid;
+}
+
+module.exports = {
+ getDeviceInfo: function (success, fail, args, env) {
+ var result = new PluginResult(args, env),
+ modelName = getModelName(),
+ uuid = getUUID(),
+ info = {
+ platform: "blackberry10",
+ version: window.qnx.webplatform.device.scmBundle,
+ model: modelName,
+ uuid: uuid,
+ cordova: "dev"
+ };
+
+ result.ok(info);
+ }
+};
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/firefoxos/DeviceProxy.js b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/firefoxos/DeviceProxy.js
new file mode 100644
index 0000000..f37e761
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/firefoxos/DeviceProxy.js
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var firefoxos = require('cordova/platform');
+var cordova = require('cordova');
+
+module.exports = {
+ getDeviceInfo: function(success, error) {
+ setTimeout(function () {
+ success({
+ cordova: firefoxos.cordovaVersion,
+ platform: 'firefoxos',
+ model: null,
+ version: null,
+ uuid: null
+ });
+ }, 0);
+ }
+};
+
+require("cordova/firefoxos/commandProxy").add("Device", module.exports);
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.h b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.h
new file mode 100644
index 0000000..a146d88
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.h
@@ -0,0 +1,30 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ */
+
+#import <UIKit/UIKit.h>
+#import <Cordova/CDVPlugin.h>
+
+@interface CDVDevice : CDVPlugin
+{}
+
++ (NSString*)cordovaVersion;
+
+- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command;
+
+@end
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.m b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.m
new file mode 100644
index 0000000..7e18d92
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/CDVDevice.m
@@ -0,0 +1,90 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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 <sys/types.h>
+#include <sys/sysctl.h>
+
+#import <Cordova/CDV.h>
+#import "CDVDevice.h"
+
+@implementation UIDevice (ModelVersion)
+
+- (NSString*)modelVersion
+{
+ size_t size;
+
+ sysctlbyname("hw.machine", NULL, &size, NULL, 0);
+ char* machine = malloc(size);
+ sysctlbyname("hw.machine", machine, &size, NULL, 0);
+ NSString* platform = [NSString stringWithUTF8String:machine];
+ free(machine);
+
+ return platform;
+}
+
+@end
+
+@interface CDVDevice () {}
+@end
+
+@implementation CDVDevice
+
+- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
+{
+ NSDictionary* deviceProperties = [self deviceProperties];
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties];
+
+ /* Settings.plist
+ * Read the optional Settings.plist file and push these user-defined settings down into the web application.
+ * This can be useful for supplying build-time configuration variables down to the app to change its behavior,
+ * such as specifying Full / Lite version, or localization (English vs German, for instance).
+ */
+ // TODO: turn this into an iOS only plugin
+ NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"];
+
+ if ([temp respondsToSelector:@selector(JSONString)]) {
+ NSLog(@"Deprecation warning: window.Setting will be removed Aug 2013. Refer to https://issues.apache.org/jira/browse/CB-2433");
+ NSString* js = [NSString stringWithFormat:@"window.Settings = %@;", [temp JSONString]];
+ [self.commandDelegate evalJs:js];
+ }
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (NSDictionary*)deviceProperties
+{
+ UIDevice* device = [UIDevice currentDevice];
+ NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4];
+
+ [devProps setObject:[device modelVersion] forKey:@"model"];
+ [devProps setObject:@"iOS" forKey:@"platform"];
+ [devProps setObject:[device systemVersion] forKey:@"version"];
+ [devProps setObject:[device uniqueAppInstanceIdentifier] forKey:@"uuid"];
+ [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"];
+
+ NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps];
+ return devReturn;
+}
+
++ (NSString*)cordovaVersion
+{
+ return CDV_VERSION;
+}
+
+@end
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD-Bridging-Header.h b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD-Bridging-Header.h
new file mode 100644
index 0000000..234ef73
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD-Bridging-Header.h
@@ -0,0 +1 @@
+#import "flatapi.h"
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD.swift b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD.swift
new file mode 100644
index 0000000..1650725
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ios/SWORD.swift
@@ -0,0 +1,805 @@
+import MessageUI
+
+var mySWORDPlugin:SWORD? = nil
+
+@objc(SWORD) class SWORD : CDVPlugin, MFMessageComposeViewControllerDelegate {
+ var mgr = 0;
+ var installMgr = 0
+ var disclaimerConfirmed = false;
+
+ @objc(initSWORD:)
+ func initSWORD(command: CDVInvokedUrlCommand) {
+ mgr = 0
+ 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_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);
+
+ initMgr()
+
+ let libswordVersion = String(cString: org_crosswire_sword_SWMgr_version(mgr))
+ debugPrint("libswordVersion: " + libswordVersion)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "initSWORD; Version: " + libswordVersion), callbackId: command.callbackId)
+ }
+
+
+ func myToast(message: String) {
+ let toastController: UIAlertController = UIAlertController(title: "", message: message, preferredStyle: .alert)
+ self.viewController?.present(toastController, animated: true, completion: nil)
+ DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
+ toastController.dismiss(animated: true, completion: nil)
+ }
+ }
+
+
+ func initMgr() {
+ if (mgr == 0) {
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ mgr = org_crosswire_sword_SWMgr_newWithPath(baseDir)
+debugPrint("initMgr, mgr: " + String(describing: mgr))
+ }
+ }
+
+
+ func reinitMgr() {
+ if (mgr != 0) {
+ org_crosswire_sword_SWMgr_delete(mgr)
+ }
+ mgr = 0
+ initMgr()
+ }
+
+
+ func reinitInstall() {
+ if (installMgr != 0) {
+ org_crosswire_sword_InstallMgr_delete(installMgr)
+ }
+ installMgr = 0
+ initInstall()
+ }
+
+ func logError(message: String) {
+ org_crosswire_sword_SWlog_logError(message)
+ }
+ func logDebug(message: String) {
+ org_crosswire_sword_SWlog_logDebug(message)
+ }
+ func logWarning(message: String) {
+ org_crosswire_sword_SWlog_logWarning(message)
+ }
+ func logInformation(message: String) {
+ org_crosswire_sword_SWlog_logInformation(message)
+ }
+ func logTimedInformation(message: String) {
+ org_crosswire_sword_SWlog_logTimedInformation(message)
+ }
+
+
+ func initInstall() {
+
+ if (installMgr == 0) {
+ logDebug(message: "initInstall: installMgr is null");
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ installMgr = org_crosswire_sword_InstallMgr_new(baseDir, { (message: Optional<UnsafePointer<Int8>>, totalBytes: u_long, completedBytes: u_long) in
+ let msg = String(cString: message!)
+ if (msg == "update") {
+ let response = [
+ "status": "update",
+ "totalBytes": totalBytes,
+ "completedBytes": completedBytes
+ ] as [String : Any]
+ if (mySWORDPlugin != nil && mySWORDPlugin!.callbackID != "") {
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: response)
+ result?.setKeepCallbackAs(true)
+ mySWORDPlugin!.commandDelegate!.send(result, callbackId: mySWORDPlugin!.callbackID)
+ }
+ }
+ else {
+ let response = [
+ "status": "preStatus",
+ "totalBytes": totalBytes,
+ "completedBytes": completedBytes,
+ "message": msg
+ ] as [String : Any]
+ if (mySWORDPlugin != nil && mySWORDPlugin!.callbackID != "") {
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: response)
+ result?.setKeepCallbackAs(true)
+ mySWORDPlugin!.commandDelegate!.send(result, callbackId: mySWORDPlugin!.callbackID)
+ }
+ }
+ })
+ if (disclaimerConfirmed) {
+ org_crosswire_sword_InstallMgr_setUserDisclaimerConfirmed(installMgr)
+ }
+ logDebug(message: "initInstall: instantiated InstallMgr with baseDir: \(baseDir)");
+ }
+ }
+
+ @objc(SWMgr_getModuleByName:)
+ func SWMgr_getModuleByName(command: CDVInvokedUrlCommand) {
+
+ initMgr();
+
+ let modName = command.arguments[0] as? String ?? ""
+ let module = org_crosswire_sword_SWMgr_getModuleByName(mgr, modName)
+
+ if (module == 0) {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK), callbackId: command.callbackId)
+ return
+ }
+
+ let name = org_crosswire_sword_SWModule_getName(module)
+ let description = org_crosswire_sword_SWModule_getDescription(module)
+ let category = org_crosswire_sword_SWModule_getCategory(module)
+ let language = org_crosswire_sword_SWModule_getConfigEntry(module, "Lang")
+ let direction = org_crosswire_sword_SWModule_getConfigEntry(module, "Direction")
+ let font = org_crosswire_sword_SWModule_getConfigEntry(module, "Font")
+ let shortCopyright = org_crosswire_sword_SWModule_getConfigEntry(module, "ShortCopyright")
+ let shortPromo = org_crosswire_sword_SWModule_getConfigEntry(module, "ShortPromo")
+
+ let response = [
+ "name": name == nil ? "" : String(cString: name!),
+ "description": description == nil ? "" : String(cString: description!),
+ "category": category == nil ? "" : String(cString: category!),
+ "language": language == nil ? "" : String(cString: language!),
+ "direction": direction == nil ? "" : String(cString: direction!),
+ "font": font == nil ? "" : String(cString: font!),
+ "shortCopyright": shortCopyright == nil ? "" : String(cString: shortCopyright!),
+ "shortPromo": shortPromo == nil ? "" : String(cString: shortPromo!)
+ ]
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: response), callbackId: command.callbackId)
+ }
+
+
+
+ @objc(SWMgr_addExtraConfig:)
+ func SWMgr_addExtraConfig(command: CDVInvokedUrlCommand) {
+ let blob = command.arguments[0] as? String ?? ""
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ let confPath = baseDir + "/extraConfig.conf";
+ let retVal = getStringArray(buffer: org_crosswire_sword_SWConfig_augmentConfig(confPath, blob))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+
+
+ @objc(SWMgr_setExtraConfigValue:)
+ func SWMgr_setExtraConfigValue(command: CDVInvokedUrlCommand) {
+ let section = command.arguments[0] as? String ?? ""
+ let key = command.arguments[1] as? String ?? ""
+ let val = command.arguments[2] as? String ?? ""
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ let confPath = baseDir + "/extraConfig.conf";
+ org_crosswire_sword_SWConfig_setKeyValue(confPath, section, key, val)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWMgr_setExtraConfigValue"), callbackId: command.callbackId)
+ }
+
+
+ @objc(SWMgr_getExtraConfigValue:)
+ func SWMgr_getExtraConfigValue(command: CDVInvokedUrlCommand) {
+ let section = command.arguments[0] as? String ?? ""
+ let key = command.arguments[1] as? String ?? ""
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ let confPath = baseDir + "/extraConfig.conf";
+ let retVal = String(cString:org_crosswire_sword_SWConfig_getKeyValue(confPath, section, key))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+
+
+ @objc(SWMgr_getExtraConfigKeys:)
+ func SWMgr_getExtraConfigKeys(command: CDVInvokedUrlCommand) {
+ let section = command.arguments[0] as? String ?? ""
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ let confPath = baseDir + "/extraConfig.conf";
+ let retVal = getStringArray(buffer: org_crosswire_sword_SWConfig_getSectionKeys(confPath, section))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+
+
+ @objc(SWMgr_getExtraConfigSections:)
+ func SWMgr_getExtraConfigSections(command: CDVInvokedUrlCommand) {
+ let baseDir = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path)! + "/sword";
+ let confPath = baseDir + "/extraConfig.conf";
+ let retVal = getStringArray(buffer: org_crosswire_sword_SWConfig_getSections(confPath))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+
+
+ @objc(echo:)
+ func echo(command: CDVInvokedUrlCommand) {
+ let msg = command.arguments[0] as? String ?? ""
+ myToast(message: msg)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: msg), callbackId: command.callbackId)
+ }
+
+
+ @objc(HTTPUtils_makeRequest:)
+ func HTTPUtils_makeRequest(command: CDVInvokedUrlCommand) {
+ var url = command.arguments[0] as? String ?? ""
+ let postData = command.arguments[1] as? String ?? ""
+ let method = command.arguments[2] as? Int ?? 1
+
+ if method == 1 {
+ url += "?" + postData
+ }
+ var request = URLRequest(url: URL(string: url)!)
+ request.httpMethod = method == 1 ? "GET" : "POST"
+ if method == 2 {
+ request.httpBody = postData.data(using: .utf8)
+ }
+ let session = URLSession.shared
+ session.dataTask(with: request) {data, response, err in
+ let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: String(data: data!, encoding: String.Encoding.utf8))
+ pluginResult?.setKeepCallbackAs(false)
+ self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)
+ }.resume()
+
+ let pluginResult = CDVPluginResult(status: CDVCommandStatus_NO_RESULT)
+ pluginResult?.setKeepCallbackAs(true)
+ self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)
+ }
+
+
+ @objc(SWModule_getBookNames:)
+ func SWModule_getBookNames(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ var retVal = [String]()
+ 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])
+ org_crosswire_sword_SWModule_setKeyText(mod, "+book")
+ }
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+
+
+ @objc(SWModule_getVerseKey:)
+ func SWModule_getVerseKey(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let module = getModule(command: command)
+ if (module != 0) {
+ let retVal = getVerseKey(keyChildren: getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(module)))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_begin:)
+ func SWModule_begin(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ org_crosswire_sword_SWModule_begin(mod)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWModule_begin"), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_previous:)
+ func SWModule_previous(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ org_crosswire_sword_SWModule_previous(mod)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWModule_previous"), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_next:)
+ func SWModule_next(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ org_crosswire_sword_SWModule_next(mod)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWModule_next"), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_popError:)
+ func SWModule_popError(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let error = Int(org_crosswire_sword_SWModule_popError(mod))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: error), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_getEntryAttribute:)
+ func SWModule_getEntryAttribute(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let retVal = getStringArray(buffer: org_crosswire_sword_SWModule_getEntryAttribute(mod, command.arguments[1] as? String ?? "", command.arguments[2] as? String ?? "", command.arguments[3] as? String ?? "", (command.arguments[4] as? Bool ?? false) ? 1 : 0))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_getConfigEntry:)
+ func SWModule_getConfigEntry(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let val = org_crosswire_sword_SWModule_getConfigEntry(mod, command.arguments[1] as? String ?? "")
+ let retVal = val == nil ? nil : String(cString: val!)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_getKeyChildren:)
+ func SWModule_getKeyChildren(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let retVal = getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(mod))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWModule_getRenderHeader:)
+ func SWModule_getRenderHeader(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let header = String(cString: org_crosswire_sword_SWModule_getRenderHeader(mod))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: header), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+ func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
+ self.webView.inputViewController?.dismiss(animated: true, completion: {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK), callbackId: self.callbackID)
+ })
+ }
+
+ func sendVerse(module: Int, keyText: String) {
+ if MFMessageComposeViewController.canSendText() {
+ let controller = MFMessageComposeViewController()
+ let verseKey = getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(module))
+ let modName = String(cString: org_crosswire_sword_SWModule_getName(module))
+ let verseText = String(cString: org_crosswire_sword_SWModule_stripText(module))
+
+
+ controller.body = verseText + " --" + verseKey[VERSEKEY_SHORTTEXT] + " (" + modName + ")"
+ controller.recipients = [""]
+ controller.messageComposeDelegate = self
+ self.webView.inputViewController?.present(controller, animated: true, completion: nil)
+ }
+ }
+ @objc(SWModule_sendText:)
+ func SWModule_sendText(command: CDVInvokedUrlCommand) {
+ initMgr()
+// Switch this to use cordova social plugin
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ mySWORDPlugin = self
+ callbackID = command.callbackId
+ let keyText = String(cString: org_crosswire_sword_SWModule_getKeyText(mod))
+ sendVerse(module: mod, keyText: keyText)
+ let result = CDVPluginResult(status: CDVCommandStatus_NO_RESULT)
+ result?.setKeepCallbackAs(true)
+ self.commandDelegate!.send(result, callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+ @objc(SWModule_getRenderText:)
+ func SWModule_getRenderText(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let retVal = String(cString: org_crosswire_sword_SWModule_renderText(mod))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(SWMgr_registerBibleSyncListener:)
+ func SWMgr_registerBibleSyncListener(command: CDVInvokedUrlCommand) {
+ let pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWMgr_registerBibleSyncListener")
+ self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)
+ }
+
+
+ @objc(SWModule_getRenderChapter:)
+ func SWModule_getRenderChapter(command: CDVInvokedUrlCommand) {
+ initMgr()
+
+// DispatchQueue.global().async {
+ self.initMgr()
+ let masterMod = self.getModule(command: command, nameArgNumber: 0)
+ let mod = self.getModule(command: command, nameArgNumber: 1)
+ if (masterMod != 0 && mod != 0) {
+ let r = self.renderChapter(masterMod: masterMod, mod: mod)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: r), callbackId: command.callbackId)
+ }
+// }
+/*
+ var pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWModule_getRenderChapter")
+ pluginResult?.setKeepCallbackAs(true)
+ self.commandDelegate!.send(pluginResult, callbackId: command.callbackId)
+*/
+ }
+
+ 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))
+ var r = [[String: Any]]()
+ var currentKey = getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(masterMod))
+ let book = currentKey[VERSEKEY_BOOKABBREV]
+ let chapter = currentKey[VERSEKEY_CHAPTER]
+ org_crosswire_sword_SWModule_setKeyText(masterMod, book + "." + chapter + ".1")
+ var verseKey = getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(masterMod))
+ while (org_crosswire_sword_SWModule_popError(masterMod) == 0
+ && currentKey[VERSEKEY_BOOK] == verseKey[VERSEKEY_BOOK]
+ && currentKey[VERSEKEY_CHAPTER] == verseKey[VERSEKEY_CHAPTER]
+ ) {
+ org_crosswire_sword_SWModule_setKeyText(mod, verseKey[VERSEKEY_OSISREF])
+ let error = org_crosswire_sword_SWModule_popError(mod)
+ var v = [String:Any]()
+ if (error == 0) {
+ v["verse"] = getVerseKey(keyChildren: getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(mod)))
+ var preVerse = ""
+ for i in getStringArray(buffer: org_crosswire_sword_SWModule_getEntryAttribute(mod, "Heading", "Preverse", "", 1)) {
+ preVerse += i
+ }
+ v["preVerse"] = preVerse
+ v["text"] = String(cString: org_crosswire_sword_SWModule_renderText(mod))
+ }
+ else {
+
+ }
+ r.append(v)
+ org_crosswire_sword_SWModule_next(masterMod)
+ verseKey = getStringArray(buffer: org_crosswire_sword_SWModule_getKeyChildren(masterMod))
+ }
+ org_crosswire_sword_SWModule_setKeyText(masterMod, saveMasterKey)
+ org_crosswire_sword_SWModule_setKeyText(mod, saveKey)
+
+ return r
+
+ }
+
+ func getVerseKey(keyChildren:[String]) -> [String:Any] {
+ var retVal = [String:Any]()
+ if (keyChildren.count > 9) {
+ retVal["testament"] = Int(keyChildren[VERSEKEY_TESTAMENT]);
+ 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["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];
+ }
+ return retVal;
+ }
+
+
+ @objc(SWModule_search:)
+ func SWModule_search(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let mod = getModule(command: command)
+ if (mod != 0) {
+ let expression = command.arguments[1] as? String ?? ""
+ let searchType = command.arguments[2] as? Int32 ?? 0
+ let flags = command.arguments[3] as? Int ?? 0
+ let scope = command.arguments.count < 5 ? nil : command.arguments[4] as? String ?? nil
+ callbackID = command.callbackId
+ DispatchQueue.global().async {
+ mySWORDPlugin = self
+ let buffer = org_crosswire_sword_SWModule_search(mod, expression, searchType, flags, scope, { (percent: Int32) in
+ let response = [
+ "status": "update",
+ "percent": percent
+ ] as [String : Any]
+ if (mySWORDPlugin != nil && mySWORDPlugin!.callbackID != "") {
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: response)
+ result?.setKeepCallbackAs(true)
+ mySWORDPlugin!.commandDelegate!.send(result, callbackId: mySWORDPlugin!.callbackID)
+ }
+ });
+
+ self.callbackID = ""
+ var response = [
+ "status": "complete",
+ "percent": 100
+ ] as [String : Any]
+
+ //UnsafeMutablePointer<UnsafePointer<Int8>?>!) -> [String] {
+ var b = buffer
+ var count = 0
+ while let i = b?.pointee {
+ if i.key == nil {
+ break
+ }
+ count = count + 1
+ b = b?.advanced(by: 1)
+ }
+ let searchResults = UnsafeBufferPointer<org_crosswire_sword_SearchHit>(start: buffer, count: count);
+ var results = [[String:Any]]()
+ for i in searchResults {
+ let sr = [
+ "key": String(cString: i.key),
+ "score": Int(i.score)
+ ] as [String : Any]
+ results.append(sr)
+ }
+ response["results"] = results
+
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: response)
+ result?.setKeepCallbackAs(false)
+ self.commandDelegate!.send(result, callbackId: command.callbackId)
+ }
+
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWModule_search")
+ result?.setKeepCallbackAs(true)
+ self.commandDelegate!.send(result, callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR), callbackId: command.callbackId)
+ }
+ }
+
+
+ func getModule(command: CDVInvokedUrlCommand, nameArgNumber: Int = 0) -> Int {
+ initMgr()
+ let modName = command.arguments[nameArgNumber] as? String ?? ""
+ let module = org_crosswire_sword_SWMgr_getModuleByName(mgr, modName)
+ if (module == 0) {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: "couldn't find module \(modName)"), callbackId: command.callbackId)
+ }
+ return module
+ }
+
+
+ @objc(SWModule_getKeyText:)
+ func SWModule_getKeyText(command: CDVInvokedUrlCommand) {
+ let module = getModule(command: command)
+ if (module != 0) {
+ let keyText = org_crosswire_sword_SWModule_getKeyText(module)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: keyText == nil ? "" : String(cString: keyText!)), callbackId: command.callbackId)
+ }
+ }
+
+
+
+ @objc(SWModule_setKeyText:)
+ func SWModule_setKeyText(command: CDVInvokedUrlCommand) {
+ let module = getModule(command: command)
+ let keyText = command.arguments[1] as? String ?? ""
+ if (module != 0) {
+ org_crosswire_sword_SWModule_setKeyText(module, keyText)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWModule_setKeyText"), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(InstallMgr_uninstallModule:)
+ func InstallMgr_uninstallModule(command: CDVInvokedUrlCommand) {
+ initInstall()
+ initMgr()
+ let retVal = org_crosswire_sword_InstallMgr_uninstallModule(installMgr, mgr, command.arguments[0] as? String ?? "")
+ if (retVal == 0) {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: retVal), callbackId: command.callbackId)
+ }
+ else {
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: retVal), callbackId: command.callbackId)
+ }
+ }
+
+ var callbackID:String = ""
+ @objc(InstallMgr_remoteInstallModule:)
+ func InstallMgr_remoteInstallModule(command: CDVInvokedUrlCommand) {
+ initInstall()
+ initMgr()
+ let repo = command.arguments[0] as? String ?? ""
+ let modName = command.arguments[1] as? String ?? ""
+ callbackID = command.callbackId
+ DispatchQueue.global().async {
+ mySWORDPlugin = self
+ org_crosswire_sword_InstallMgr_remoteInstallModule(self.installMgr, self.mgr, repo, modName)
+
+ self.reinitMgr()
+ self.callbackID = ""
+ let response = [
+ "status": "complete",
+ "totalBytes": 0,
+ "completedBytes": 0,
+ "message": "Complete"
+ ] as [String : Any]
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: response)
+ result?.setKeepCallbackAs(false)
+ self.commandDelegate!.send(result, callbackId: command.callbackId)
+ }
+
+ let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "InstallMgr_remoteInstallModule")
+ result?.setKeepCallbackAs(true)
+ self.commandDelegate!.send(result, callbackId: command.callbackId)
+ }
+
+
+ @objc(InstallMgr_getRemoteModInfoList:)
+ func InstallMgr_getRemoteModInfoList(command: CDVInvokedUrlCommand) {
+ initInstall()
+ initMgr()
+ let buffer = org_crosswire_sword_InstallMgr_getRemoteModInfoList(installMgr, mgr, command.arguments[0] as? String ?? "")
+ var count = 0
+ var b = buffer
+ while let i = b?.pointee {
+ if (i.name == nil) {
+ break
+ }
+ count = count + 1
+ b = b?.advanced(by: 1)
+ }
+ let modInfoList = Array(UnsafeBufferPointer<org_crosswire_sword_ModInfo>(start: buffer, count: count));
+ var mods = [[AnyHashable : Any]]()
+ for i in modInfoList {
+ let modInfo = [
+ "name": String(cString: i.name),
+ "description": String(cString: i.description),
+ "category": String(cString: i.category),
+ "language": String(cString: i.language),
+ "delta": String(cString: i.delta),
+ "version": String(cString: i.version)
+ ] as [AnyHashable : Any]
+ mods.append(modInfo)
+ }
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: mods), callbackId: command.callbackId)
+ }
+
+
+ @objc(InstallMgr_refreshRemoteSource:)
+ func InstallMgr_refreshRemoteSource(command: CDVInvokedUrlCommand) {
+ initInstall()
+ DispatchQueue.global().async {
+ mySWORDPlugin = self
+ self.callbackID = ""
+ org_crosswire_sword_InstallMgr_refreshRemoteSource(self.installMgr, command.arguments[0] as? String ?? "")
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "InstallMgr_refreshRemoteSource"), callbackId: command.callbackId)
+ }
+ }
+
+
+ func getStringArray(buffer: UnsafeMutablePointer<UnsafePointer<Int8>?>!) -> [String] {
+ var sources = [String]()
+ var b = buffer
+ while let i = b?.pointee {
+ sources.append(String(cString: i))
+ b = b?.advanced(by: 1)
+ }
+ return sources
+ }
+
+
+ @objc(InstallMgr_getRemoteSources:)
+ func InstallMgr_getRemoteSources(command: CDVInvokedUrlCommand) {
+ initInstall()
+ let sources = getStringArray(buffer: org_crosswire_sword_InstallMgr_getRemoteSources(installMgr))
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: sources), callbackId: command.callbackId)
+ }
+
+
+ @objc(InstallMgr_syncConfig:)
+ func InstallMgr_syncConfig(command: CDVInvokedUrlCommand) {
+
+ initInstall()
+ DispatchQueue.global().async {
+ self.callbackID = ""
+ mySWORDPlugin = self
+ org_crosswire_sword_InstallMgr_syncConfig(self.installMgr)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "InstallMgr_syncConfig"), callbackId: command.callbackId)
+ }
+ }
+
+
+ @objc(InstallMgr_setUserDisclaimerConfirmed:)
+ func InstallMgr_setUserDisclaimerConfirmed(command: CDVInvokedUrlCommand) {
+ initInstall()
+ org_crosswire_sword_InstallMgr_setUserDisclaimerConfirmed(installMgr)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "InstallMgr_setUserDisclaimerConfirmed"), callbackId: command.callbackId)
+ }
+
+
+ @objc(SWMgr_setJavascript:)
+ func SWMgr_setJavascript(command: CDVInvokedUrlCommand) {
+ initMgr()
+ org_crosswire_sword_SWMgr_setJavascript(mgr, command.arguments[0] as? Bool ?? true ? 1 : 0)
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: "SWMgr_setJavascript"), callbackId: command.callbackId)
+ }
+
+ @objc(SWMgr_getModInfoList:)
+ func SWMgr_getModInfoList(command: CDVInvokedUrlCommand) {
+ initMgr()
+ let buffer = org_crosswire_sword_SWMgr_getModInfoList(mgr)
+ var b = buffer
+ var count = 0
+ while let i = b?.pointee {
+ if i.name == nil {
+ break
+ }
+ b = b?.advanced(by: 1)
+ count = count + 1
+ }
+ let modInfoList = Array(UnsafeBufferPointer<org_crosswire_sword_ModInfo>(start: buffer, count: count));
+
+ var mods = [[AnyHashable : Any]]()
+ for i in modInfoList {
+ let modInfo = [
+ "name": String(cString: i.name),
+ "description": String(cString: i.description),
+ "category": String(cString: i.category),
+ "language": String(cString: i.language),
+ "delta": i.delta == nil ? "" : String(cString: i.delta),
+ "version": i.version == nil ? "" : String(cString: i.version)
+ ] as [AnyHashable : Any]
+ mods.append(modInfo)
+ }
+ self.commandDelegate!.send(CDVPluginResult(status: CDVCommandStatus_OK, messageAs: mods), callbackId: command.callbackId)
+ }
+/*
+SWMgr_registerBibleSyncListener
+SWMgr_sendBibleSyncMessage
+*/
+}
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/tizen/DeviceProxy.js b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/tizen/DeviceProxy.js
new file mode 100644
index 0000000..2afc324
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/tizen/DeviceProxy.js
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var tizen = require('cordova/platform');
+var cordova = require('cordova');
+
+module.exports = {
+ getDeviceInfo: function(success, error) {
+ setTimeout(function () {
+ success({
+ cordova: tizen.cordovaVersion,
+ platform: 'tizen',
+ model: null,
+ version: null,
+ uuid: null
+ });
+ }, 0);
+ }
+};
+
+require("cordova/tizen/commandProxy").add("Device", module.exports);
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.cpp b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.cpp
new file mode 100644
index 0000000..eb5a012
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2011 Wolfgang Koller - http://www.gofg.at/
+ *
+ * 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 <QDeviceInfo>
+#include <QtSystemInfo>
+
+#include"device.h"
+
+#define CORDOVA "3.0.0"
+
+Device::Device(Cordova *cordova) : CPlugin(cordova) {
+}
+
+static QString getOSName() {
+#ifdef Q_OS_SYMBIAN
+ QString platform = "Symbian";
+#endif
+#ifdef Q_OS_WIN
+ QString platform = "Windows";
+#endif
+#ifdef Q_OS_WINCE
+ QString platform = "Windows CE";
+#endif
+#ifdef Q_OS_LINUX
+ QString platform = "Linux";
+#endif
+ return platform;
+}
+
+void Device::getInfo(int scId, int ecId) {
+ Q_UNUSED(ecId)
+
+ QDeviceInfo systemDeviceInfo;
+ QDeviceInfo systemInfo;
+
+ QString platform = getOSName();
+
+ QString uuid = systemDeviceInfo.uniqueDeviceID();
+ if (uuid.isEmpty()) {
+ QString deviceDescription = systemInfo.imei(0) + ";" + systemInfo.manufacturer() + ";" + systemInfo.model() + ";" + systemInfo.productName() + ";" + platform;
+ QString user = qgetenv("USER");
+ if (user.isEmpty()) {
+ user = qgetenv("USERNAME");
+ if (user.isEmpty())
+ user = QDir::homePath();
+ }
+ uuid = QString(QCryptographicHash::hash((deviceDescription + ";" + user).toUtf8(), QCryptographicHash::Md5).toHex());
+ }
+
+ this->cb(scId, systemDeviceInfo.model(), CORDOVA, platform, uuid, systemInfo.version(QDeviceInfo::Os));
+}
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.h b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.h
new file mode 100644
index 0000000..91cb937
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2011 Wolfgang Koller - http://www.gofg.at/
+ *
+ * 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.
+ */
+
+#ifndef DEVICE_H_FDSAFAS
+#define DEVICE_H_FDSAFAS
+
+#include <QtCore>
+
+#include <cplugin.h>
+
+class Device: public CPlugin {
+ Q_OBJECT
+public:
+ explicit Device(Cordova *cordova);
+
+ virtual const QString fullName() override {
+ return Device::fullID();
+ }
+
+ virtual const QString shortName() override {
+ return "Device";
+ }
+
+ static const QString fullID() {
+ return "com.cordova.Device";
+ }
+
+signals:
+
+public slots:
+ void getInfo(int scId, int ecId);
+};
+
+#endif
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.js b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.js
new file mode 100644
index 0000000..3adb110
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/ubuntu/device.js
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var cordova = require('cordova');
+var exec = require('cordova/exec');
+
+module.exports = {
+ getInfo:function(win,fail,args) {
+ Cordova.exec(function (model, cordova, platform, uuid, version) {
+ win({name: name, model: model, cordova: cordova,
+ platform: platform, uuid: uuid, version: version});
+ }, null, "com.cordova.Device", "getInfo", []);
+ }
+};
+
+require("cordova/exec/proxy").add("Device", module.exports);
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/windows8/DeviceProxy.js b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/windows8/DeviceProxy.js
new file mode 100644
index 0000000..16145c0
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/windows8/DeviceProxy.js
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+
+var cordova = require('cordova');
+var utils = require('cordova/utils');
+
+module.exports = {
+
+ getDeviceInfo:function(win,fail,args) {
+
+ // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
+ var deviceId;
+
+ var localSettings = Windows.Storage.ApplicationData.current.localSettings;
+
+ if (localSettings.values.deviceId) {
+ deviceId = localSettings.values.deviceId;
+ }
+ else {
+ deviceId = localSettings.values.deviceId = utils.createUUID();
+ }
+
+ setTimeout(function () {
+ win({ platform: "windows8", version: "8", uuid: deviceId, cordova: '0.0.0', model: window.clientInformation.platform });
+ }, 0);
+ }
+
+};
+
+require("cordova/windows8/commandProxy").add("Device", module.exports);
+
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/wp/Device.cs b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/wp/Device.cs
new file mode 100644
index 0000000..0d2576d
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/wp/Device.cs
@@ -0,0 +1,135 @@
+/*
+ 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.
+*/
+
+using System;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Info;
+using System.IO.IsolatedStorage;
+using System.Windows.Resources;
+using System.IO;
+using System.Diagnostics;
+
+namespace WPCordovaClassLib.Cordova.Commands
+{
+ public class Device : BaseCommand
+ {
+ public void getDeviceInfo(string notused)
+ {
+
+ string res = String.Format("\"name\":\"{0}\",\"cordova\":\"{1}\",\"platform\":\"{2}\",\"uuid\":\"{3}\",\"version\":\"{4}\",\"model\":\"{5}\"",
+ this.name,
+ this.cordova,
+ this.platform,
+ this.uuid,
+ this.version,
+ this.model);
+
+
+
+ res = "{" + res + "}";
+ //Debug.WriteLine("Result::" + res);
+ DispatchCommandResult(new PluginResult(PluginResult.Status.OK, res));
+ }
+
+ public string model
+ {
+ get
+ {
+ return DeviceStatus.DeviceName;
+ //return String.Format("{0},{1},{2}", DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceHardwareVersion, DeviceStatus.DeviceFirmwareVersion);
+ }
+ }
+
+ public string name
+ {
+ get
+ {
+ return DeviceStatus.DeviceName;
+
+ }
+ }
+
+ public string cordova
+ {
+ get
+ {
+ // TODO: should be able to dynamically read the Cordova version from somewhere...
+ return "3.0.0";
+ }
+ }
+
+ public string platform
+ {
+ get
+ {
+ return Environment.OSVersion.Platform.ToString();
+ }
+ }
+
+ public string uuid
+ {
+ get
+ {
+ string returnVal = "";
+ object id;
+ UserExtendedProperties.TryGetValue("ANID", out id);
+
+ if (id != null)
+ {
+ returnVal = id.ToString().Substring(2, 32);
+ }
+ else
+ {
+ returnVal = "???unknown???";
+
+ using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication())
+ {
+ try
+ {
+ IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Open, FileAccess.Read, appStorage);
+
+ using (StreamReader reader = new StreamReader(fileStream))
+ {
+ returnVal = reader.ReadLine();
+ }
+ }
+ catch (Exception /*ex*/)
+ {
+
+ }
+ }
+ }
+
+ return returnVal;
+ }
+ }
+
+ public string version
+ {
+ get
+ {
+ return Environment.OSVersion.Version.ToString();
+ }
+ }
+
+ }
+}
diff --git a/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js b/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js
new file mode 100644
index 0000000..3362359
--- /dev/null
+++ b/bindings/cordova/org.crosswire.sword.cordova.SWORD/www/SWORD.js
@@ -0,0 +1,414 @@
+var argscheck = require('cordova/argscheck'),
+ channel = require('cordova/channel'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec'),
+ cordova = require('cordova');
+
+channel.createSticky('onSWORDReady');
+// Tell cordova channel to wait on the CordovaInfoReady event
+channel.waitForInitialization('onSWORDReady');
+
+
+function InstallMgr() {
+}
+
+InstallMgr.prototype.setUserDisclaimerConfirmed = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_setUserDisclaimerConfirmed", []
+ );
+ return retVal;
+}
+
+InstallMgr.prototype.syncConfig = function(callback, progressNotify) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_syncConfig", [progressNotify]
+ );
+ return retVal;
+}
+
+
+InstallMgr.prototype.getRemoteSources = function(callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_getRemoteSources", []
+ );
+ return retVal;
+}
+
+
+InstallMgr.prototype.refreshRemoteSource = function(sourceName, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_refreshRemoteSource", [sourceName]
+ );
+ return retVal;
+}
+
+InstallMgr.prototype.getRemoteModInfoList = function(sourceName, callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_getRemoteModInfoList", [sourceName]
+ );
+ return retVal;
+}
+
+// callback({ status : preStatus|update|complete, totalBytes : n, completedBytes : n, message : displayable });
+InstallMgr.prototype.remoteInstallModule = function(sourceName, modName, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_remoteInstallModule", [sourceName, modName]
+ );
+ return retVal;
+}
+
+InstallMgr.prototype.uninstallModule = function(modName, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "InstallMgr_uninstallModule", [modName]
+ );
+ return retVal;
+}
+
+function SWModule(modInfo) {
+ this.name = modInfo.name;
+ this.description = modInfo.description;
+ this.category = modInfo.category;
+ this.direction = modInfo.direction;
+ this.language = modInfo.language;
+ this.font = modInfo.font;
+ this.shortCopyright = modInfo.shortCopyright;
+ this.shortPromo = modInfo.shortPromo;
+}
+
+SWModule.prototype.SEARCHTYPE_REGEX = 1;
+SWModule.prototype.SEARCHTYPE_PHRASE = -1;
+SWModule.prototype.SEARCHTYPE_MULTIWORD = -2;
+SWModule.prototype.SEARCHTYPE_ENTRYATTR = -3;
+SWModule.prototype.SEARCHTYPE_LUCENE = -4;
+
+SWModule.prototype.SEARCHOPTION_ICASE = 2;
+
+
+SWModule.prototype.setKeyText = function(keyText, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_setKeyText", [this.name, keyText]
+ );
+ return retVal;
+}
+
+SWModule.prototype.search = function(expression, searchType, flags, scope, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_search", [this.name, expression, searchType, flags, scope]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getKeyText = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(m) { retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getKeyText", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getRenderText = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(m) { retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getRenderText", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.shareVerse = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(m) { retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_sendText", [this.name]
+ );
+ return retVal;
+}
+
+/*
+ * masterMod - SWModule to use for traversing chapter; null if self
+ * useful for parallel display with alternate v11ns
+ *
+ * returns [ { verse : verseKey, preVerse : 'text', text : 'text' }, ... }
+ */
+SWModule.prototype.getRenderChapter = function(masterMod, callback) {
+ var retVal = null;
+ if (!masterMod) masterMod = this;
+ exec(callback?callback:function(m) { retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getRenderChapter", [masterMod.name, this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getRenderHeader = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(m) { retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getRenderHeader", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getKeyChildren = function(callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getKeyChildren", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getVerseKey = function(callback) {
+ var retVal = {};
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getVerseKey", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getConfigEntry = function(key, callback) {
+ var retVal = '';
+ exec(callback?callback:function(m) { if (m) retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getConfigEntry", [this.name, key]
+ );
+ return retVal;
+}
+
+
+SWModule.prototype.popError = function(callback) {
+ var retVal = 0;
+ exec(callback?callback:function(m) { retVal = m; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_popError", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getEntryAttribute = function(level1Key, level2Key, level3Key, isFiltered, callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getEntryAttribute", [this.name, level1Key, level2Key, level3Key, isFiltered]
+ );
+ return retVal;
+}
+
+SWModule.prototype.next = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_next", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.previous = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_previous", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.begin = function(callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_begin", [this.name]
+ );
+ return retVal;
+}
+
+SWModule.prototype.getBookNames = function(callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWModule_getBookNames", [this.name]
+ );
+ return retVal;
+}
+
+function SWMgr() {
+}
+
+
+SWMgr.prototype.getModInfoList = function(callback) {
+ 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 this._lastModInfoList;
+}
+
+SWMgr.prototype.getModuleByName = function(modName, callback) {
+ var mod = null;
+ exec(function(m) { if (m.name) mod = new SWModule(m); if (callback) callback(mod); },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_getModuleByName", [modName]
+ );
+ return mod;
+}
+
+SWMgr.prototype.getExtraConfigSections = function(callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_getExtraConfigSections", []
+ );
+ return retVal;
+}
+
+SWMgr.prototype.getExtraConfigKeys = function(section, callback) {
+ var retVal = [];
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_getExtraConfigKeys", [section]
+ );
+ return retVal;
+}
+
+SWMgr.prototype.getExtraConfigValue = function(section, key, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_getExtraConfigValue", [section, key]
+ );
+ return retVal;
+}
+
+SWMgr.prototype.setExtraConfigValue = function(section, key, value, callback) {
+ exec(callback?callback:function() {},
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_setExtraConfigValue", [section, key, value]
+ );
+}
+
+SWMgr.prototype.addExtraConfig = function(confBlob, callback) {
+ var retVal = null;
+ exec(callback?callback:function(r) { retVal = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_addExtraConfig", [confBlob]
+ );
+ return retVal;
+}
+
+SWMgr.prototype.registerBibleSyncListener = function(callback) {
+ exec(callback,
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_registerBibleSyncListener", []
+ );
+}
+
+SWMgr.prototype.sendBibleSyncMessage = function(osisRef, callback) {
+ exec(callback?callback:function() {},
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_sendBibleSyncMessage", [osisRef]
+ );
+}
+
+SWMgr.prototype.setJavascript = function(val, callback) {
+ exec(callback?callback:function() {},
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "SWMgr_setJavascript", [val]
+ );
+}
+
+function HTTPUtils() {}
+
+HTTPUtils.prototype.METHOD_GET = 0;
+HTTPUtils.prototype.METHOD_POST = 1;
+
+HTTPUtils.prototype.makeRequest = function(url, postData, callback, method) {
+ var result = null;
+ if (!method) method = this.METHOD_POST;
+ exec(callback?callback:function(r) { if (r && r.length > 0) result = r; },
+ function(err) { utils.alert('[ERROR] problem: ' + err); },
+ "SWORD", "HTTPUtils_makeRequest", [url, postData, method]
+ );
+ return result;
+}
+
+
+
+/*
+ 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);
+*/
+
+
+/**
+ * This is the SWORD namespace and access to singleton SWMgr, InstallMgr, and HTTPUtils.
+ * @constructor
+ */
+function SWORD() {
+
+ var me = this;
+
+ this.available = false;
+ this.version = null;
+
+ this.installMgr = new InstallMgr();
+ this.mgr = new SWMgr();
+ this.httpUtils = new HTTPUtils();
+
+ channel.onCordovaReady.subscribe(function() {
+ me.init(function(info) {
+ me.available = true;
+ me.version = info.version;
+ channel.onSWORDReady.fire();
+ },function(e) {
+ me.available = false;
+ utils.alert("[ERROR] Error initializing SWORD: " + e);
+ });
+ });
+}
+
+
+SWORD.prototype.CATEGORY_BIBLES = "Biblical Texts";
+SWORD.prototype.CATEGORY_COMMENTARIES = "Commentaries";
+SWORD.prototype.CATEGORY_LEXDICTS = "Lexicons / Dictionaries";
+SWORD.prototype.CATEGORY_GENBOOKS = "Generic Books";
+SWORD.prototype.CATEGORY_DAILYDEVOS = "Daily Devotional";
+
+
+SWORD.prototype.init = function(successCallback, errorCallback) {
+ exec(successCallback, errorCallback, "SWORD", "initSWORD", []);
+};
+
+
+module.exports = new SWORD();
+
+
diff --git a/bindings/csharp/NativeMethods.cs b/bindings/csharp/NativeMethods.cs
index 6a3c911..6ea973b 100644
--- a/bindings/csharp/NativeMethods.cs
+++ b/bindings/csharp/NativeMethods.cs
@@ -33,6 +33,8 @@ namespace Sword
public string Description;
public string Category;
public string Language;
+ public string Version;
+ public string Delta;
};
[StructLayout(LayoutKind.Sequential)]
@@ -73,53 +75,51 @@ namespace Sword
public static class NativeMethods
{
+ public const string DLLNAME = "libsword";
-
- public const string DLLNAME = "libsword.so";
-
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWMgr_new();
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWMgr_newWithPath(string path);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWMgr_getModuleByName(IntPtr hSWMgr, string moduleName);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern void org_crosswire_sword_SWModule_setKeyText(IntPtr hSWModule, string key);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWModule_renderText(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWModule_getRawEntry(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWModule_getKeyText(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern void org_crosswire_sword_SWMgr_delete(IntPtr hSWMgr);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWMgr_getModInfoList(IntPtr hSWMgr);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWModule_stripText(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern void org_crosswire_sword_SWModule_setRawEntry(IntPtr hSWModule, string entryBuffer);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern void org_crosswire_sword_SWModule_terminateSearch(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern char org_crosswire_sword_SWModule_popError(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern long org_crosswire_sword_SWModule_getEntrySize(IntPtr hSWModule);
- [DllImport(DLLNAME)]
+ [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr org_crosswire_sword_SWModule_getEntryAttribute(IntPtr hSWModule, string level1, string level2, string level3, char filteredBool);
[DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
diff --git a/bindings/csharp/tests/ManagerTests.cs b/bindings/csharp/tests/ManagerTests.cs
index 6f71b33..ec7d6cd 100644
--- a/bindings/csharp/tests/ManagerTests.cs
+++ b/bindings/csharp/tests/ManagerTests.cs
@@ -14,6 +14,7 @@
using System;
using NUnit.Framework;
using System.IO;
+using System.Collections.Generic;
using System.Linq;
namespace Sword.Tests
@@ -84,10 +85,20 @@ namespace Sword.Tests
public void AvailableLocales_Get_DoesntCrash()
{
//act
- var availableLocales = _manager.AvailableLocales.ToArray();
+ string[] availableLocales = _manager.AvailableLocales.ToArray();
//Assert
- Assert.That (availableLocales[0].Contains("en"));
+ Assert.That (availableLocales.Length > 0);
+ }
+
+ [Test]
+ public void AvailableLocales_Get_ContainsEnglish()
+ {
+ //act
+ string[] availableLocales = _manager.AvailableLocales.ToArray();
+
+ //Assert
+ Assert.That (availableLocales.Any(locale => locale == "en"));
}
[Test]
diff --git a/bindings/flatapi.cpp b/bindings/flatapi.cpp
index 1c6872c..b41303f 100644
--- a/bindings/flatapi.cpp
+++ b/bindings/flatapi.cpp
@@ -3,7 +3,7 @@
* flatapi.cpp - This file contains an api usable by non-C++
* environments
*
- * $Id: flatapi.cpp 3226 2014-05-02 03:01:35Z greg.hellings $
+ * $Id: flatapi.cpp 3561 2018-01-07 06:45:42Z greg.hellings $
*
* Copyright 2002-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -33,6 +33,7 @@
#include <treekeyidx.h>
#include <filemgr.h>
#include <swbuf.h>
+#include <swlog.h>
#include <localemgr.h>
#include <utilstr.h>
#include "corba/orbitcpp/webmgr.hpp"
@@ -70,7 +71,7 @@ void clearStringArray(const char ***stringArray) {
}
-void clearModInfo(org_crosswire_sword_ModInfo **modInfo) {
+void clearModInfoArray(org_crosswire_sword_ModInfo **modInfo) {
if (*modInfo) {
for (int i = 0; true; ++i) {
if ((*modInfo)[i].name) {
@@ -91,51 +92,43 @@ void clearModInfo(org_crosswire_sword_ModInfo **modInfo) {
struct pu {
char last;
- SWHANDLE progressReporter;
-
- void init(SWHANDLE pr) { progressReporter = pr; last = 0; }
-/*
- pu(JNIEnv *env, jobject pr) : env(env), progressReporter(pr), last(0) {}
- JNIEnv *env;
- jobject progressReporter;
-*/
+ org_crosswire_sword_SWModule_SearchCallback progressReporter;
+ void init(org_crosswire_sword_SWModule_SearchCallback pr) { progressReporter = pr; last = 0; }
};
void percentUpdate(char percent, void *userData) {
struct pu *p = (struct pu *)userData;
if (percent != p->last) {
+ p->progressReporter((int)percent);
p->last = percent;
-/*
- jclass cls = p->env->GetObjectClass(p->progressReporter);
- jmethodID mid = p->env->GetMethodID(cls, "progressReport", "(I)V");
- if (mid != 0) {
- p->env->CallVoidMethod(p->progressReporter, mid, (jint)percent);
- }
-*/
}
}
+
class MyStatusReporter : public StatusReporter {
public:
- int last;
- SWHANDLE statusReporter;
+ unsigned long last;
+ org_crosswire_sword_InstallMgr_StatusCallback statusReporter;
MyStatusReporter() : last(0), statusReporter(0) {}
- void init(SWHANDLE sr) { statusReporter = sr; last = 0; }
- virtual void update(unsigned long totalBytes, unsigned long completedBytes) {
- 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();
+ void init(org_crosswire_sword_InstallMgr_StatusCallback sr) { statusReporter = sr; last = 0xffffffff; }
+
+ virtual void update(unsigned long totalBytes, unsigned long completedBytes) {
+
+ if (!statusReporter) return;
+
+ if (completedBytes != last) {
+ statusReporter("update", totalBytes, completedBytes);
+ last = completedBytes;
+ }
}
- virtual void preStatus(long totalBytes, long completedBytes, const char *message) {
+
+
+ virtual void preStatus(long totalBytes, long completedBytes, const char *message) {
+
+ if (!statusReporter) return;
+
+ statusReporter(message, totalBytes, completedBytes);
+/*
SWBuf output;
output.setFormatted("[ Total Bytes: %ld; Completed Bytes: %ld", totalBytes, completedBytes);
while (output.size() < 75) output += " ";
@@ -145,7 +138,9 @@ public:
// for (int i = 0; i < p; ++i) { cout << "="; }
// cout << "\n\n" << message << "\n";
last = 0;
+*/
}
+
};
class HandleSWModule {
@@ -157,15 +152,12 @@ public:
char *rawEntry;
char *configEntry;
struct pu peeuuu;
- // making searchHits cache static saves memory only having a single
- // outstanding copy, but also is not threadsafe. Remove static here
- // and fix compiling bugs and add clearSearchHits() to d-tor to change
- static org_crosswire_sword_SearchHit *searchHits;
- static const char **entryAttributes;
- static const char **parseKeyList;
- static const char **keyChildren;
-
- HandleSWModule(SWModule *mod) {
+ org_crosswire_sword_SearchHit *searchHits;
+ const char **entryAttributes;
+ const char **parseKeyList;
+ const char **keyChildren;
+
+ HandleSWModule(SWModule *mod) : searchHits(0), entryAttributes(0), parseKeyList(0), keyChildren(0) {
this->mod = mod;
this->renderBuf = 0;
this->stripBuf = 0;
@@ -179,9 +171,13 @@ public:
delete [] renderHeader;
delete [] rawEntry;
delete [] configEntry;
+ clearSearchHits();
+ clearEntryAttributes();
+ clearParseKeyList();
+ clearKeyChildren();
}
- static void clearSearchHits() {
+ void clearSearchHits() {
if (searchHits) {
for (int i = 0; true; ++i) {
if (searchHits[i].modName) {
@@ -193,13 +189,13 @@ public:
searchHits = 0;
}
}
- static void clearEntryAttributes() {
+ void clearEntryAttributes() {
clearStringArray(&entryAttributes);
}
- static void clearParseKeyList() {
+ void clearParseKeyList() {
clearStringArray(&parseKeyList);
}
- static void clearKeyChildren() {
+ void clearKeyChildren() {
clearStringArray(&keyChildren);
}
};
@@ -221,7 +217,7 @@ public:
}
void clearModInfo() {
- ::clearModInfo(&modInfo);
+ clearModInfoArray(&modInfo);
}
~HandleSWMgr() {
@@ -264,7 +260,7 @@ public:
MyStatusReporter statusReporter;
HandleInstMgr() : installMgr(0), modInfo(0) {}
HandleInstMgr(InstallMgr *mgr) {
- this->installMgr = installMgr;
+ this->installMgr = mgr;
this->modInfo = 0;
}
@@ -289,15 +285,11 @@ public:
}
void clearModInfo() {
- ::clearModInfo(&modInfo);
+ clearModInfoArray(&modInfo);
}
};
-org_crosswire_sword_SearchHit *HandleSWModule::searchHits = 0;
-const char **HandleSWModule::entryAttributes = 0;
-const char **HandleSWModule::parseKeyList = 0;
-const char **HandleSWModule::keyChildren = 0;
const char **HandleSWMgr::globalOptions = 0;
const char **HandleSWMgr::globalOptionValues = 0;
@@ -305,14 +297,12 @@ const char **HandleSWMgr::availableLocales = 0;
const char **HandleInstMgr::remoteSources = 0;
+const char **tmpStringArrayRetVal = 0;
+char *tmpStringRetVal = 0;
+
class InitStatics {
public:
InitStatics() {
-// these are redundant with the static declarations above, but ??? doesn't hurt
- HandleSWModule::searchHits = 0;
- HandleSWModule::entryAttributes = 0;
- HandleSWModule::parseKeyList = 0;
- HandleSWModule::keyChildren = 0;
HandleSWMgr::globalOptions = 0;
HandleSWMgr::globalOptionValues = 0;
@@ -321,15 +311,15 @@ public:
HandleInstMgr::remoteSources = 0;
}
~InitStatics() {
- HandleSWModule::clearSearchHits();
- HandleSWModule::clearEntryAttributes();
- HandleSWModule::clearParseKeyList();
- HandleSWModule::clearKeyChildren();
HandleSWMgr::clearGlobalOptions();
HandleSWMgr::clearGlobalOptionValues();
HandleInstMgr::clearRemoteSources();
+
+ clearStringArray(&tmpStringArrayRetVal);
+ sword::stdstr(&tmpStringRetVal, (const char *)0);
+
}
} _initStatics;
@@ -337,7 +327,30 @@ public:
}
+//
+// SWLog methods
+//
+//
+
+void SWDLLEXPORT org_crosswire_sword_SWlog_logError(const char *msg) {
+ SWLog::getSystemLog()->logError(msg);
+}
+
+void SWDLLEXPORT org_crosswire_sword_SWlog_logDebug(const char *msg) {
+ SWLog::getSystemLog()->logDebug(msg);
+}
+
+void SWDLLEXPORT org_crosswire_sword_SWlog_logWarning(const char *msg) {
+ SWLog::getSystemLog()->logWarning(msg);
+}
+
+void SWDLLEXPORT org_crosswire_sword_SWlog_logInformation(const char *msg) {
+ SWLog::getSystemLog()->logInformation(msg);
+}
+void SWDLLEXPORT org_crosswire_sword_SWlog_logTimedInformation(const char *msg) {
+ SWLog::getSystemLog()->logTimedInformation(msg);
+}
//
@@ -364,7 +377,7 @@ void SWDLLEXPORT org_crosswire_sword_SWModule_terminateSearch
* Signature: (Ljava/lang/String;IJLjava/lang/String;Lorg/crosswire/android/sword/SWModule/SearchProgressReporter;)[Lorg/crosswire/android/sword/SWModule/SearchHit;
*/
const struct org_crosswire_sword_SearchHit * SWDLLEXPORT org_crosswire_sword_SWModule_search
- (SWHANDLE hSWModule, const char *searchString, int searchType, long flags, const char *scope, SWHANDLE progressReporter) {
+ (SWHANDLE hSWModule, const char *searchString, int searchType, long flags, const char *scope, org_crosswire_sword_SWModule_SearchCallback progressReporter) {
GETSWMODULE(hSWModule, 0);
@@ -458,7 +471,7 @@ const char ** SWDLLEXPORT org_crosswire_sword_SWModule_getEntryAttribute
sword::AttributeList::iterator i2Start, i2End;
sword::AttributeValue::iterator i3Start, i3End;
- if ((level1) && (*level1)) {
+ if ((level1) && (*level1) && *level1 != '-') {
i1Start = entryAttribs.find(level1);
i1End = i1Start;
if (i1End != entryAttribs.end())
@@ -469,35 +482,54 @@ const char ** SWDLLEXPORT org_crosswire_sword_SWModule_getEntryAttribute
i1End = entryAttribs.end();
}
for (;i1Start != i1End; ++i1Start) {
- if ((level2) && (*level2)) {
- i2Start = i1Start->second.find(level2);
- i2End = i2Start;
- if (i2End != i1Start->second.end())
- ++i2End;
+ if (level1 && *level1 && *level1 == '-') {
+ results.push_back(i1Start->first);
}
else {
- i2Start = i1Start->second.begin();
- i2End = i1Start->second.end();
- }
- for (;i2Start != i2End; ++i2Start) {
- if ((level3) && (*level3)) {
- i3Start = i2Start->second.find(level3);
- i3End = i3Start;
- if (i3End != i2Start->second.end())
- ++i3End;
+ if (level2 && *level2 && *level2 != '-') {
+ i2Start = i1Start->second.find(level2);
+ i2End = i2Start;
+ if (i2End != i1Start->second.end())
+ ++i2End;
}
else {
- i3Start = i2Start->second.begin();
- i3End = i2Start->second.end();
+ i2Start = i1Start->second.begin();
+ i2End = i1Start->second.end();
}
- for (;i3Start != i3End; ++i3Start) {
- results.push_back(i3Start->second);
+ for (;i2Start != i2End; ++i2Start) {
+ if (level2 && *level2 && *level2 == '-') {
+ results.push_back(i2Start->first);
+ }
+ else {
+ // 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())
+ ++i3End;
+ }
+ else {
+ i3Start = i2Start->second.begin();
+ i3End = i2Start->second.end();
+ }
+ for (;i3Start != i3End; ++i3Start) {
+ 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);
+ }
+ }
+ if (i3Start != i3End)
+ break;
+ }
}
- if (i3Start != i3End)
+ if (i2Start != i2End)
break;
}
- if (i2Start != i2End)
- break;
}
const char **retVal = (const char **)calloc(results.size()+1, sizeof(const char *));
@@ -644,7 +676,7 @@ const char ** SWDLLEXPORT org_crosswire_sword_SWModule_getKeyChildren
sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
if (vkey) {
- retVal = (const char **)calloc(9, sizeof(const char *));
+ retVal = (const char **)calloc(11, sizeof(const char *));
SWBuf num;
num.appendFormatted("%d", vkey->getTestament());
stdstr((char **)&(retVal[0]), num.c_str());
@@ -665,6 +697,8 @@ const char ** SWDLLEXPORT org_crosswire_sword_SWModule_getKeyChildren
stdstr((char **)&(retVal[5]), num.c_str());
stdstr((char **)&(retVal[6]), vkey->getBookName());
stdstr((char **)&(retVal[7]), vkey->getOSISRef());
+ stdstr((char **)&(retVal[8]), vkey->getShortText());
+ stdstr((char **)&(retVal[9]), vkey->getBookAbbrev());
}
else {
TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);
@@ -941,6 +975,31 @@ SWHANDLE SWDLLEXPORT org_crosswire_sword_SWMgr_new() {
return (SWHANDLE) new HandleSWMgr(new WebMgr(sysConf));
}
+/*
+ * Class: org_crosswire_sword_SWMgr
+ * Method: new
+ * Signature: ()V
+ */
+SWHANDLE SWDLLEXPORT org_crosswire_sword_SWMgr_newWithPath(const char *path) {
+ SWBuf confPath = path;
+ if (!confPath.endsWith("/")) confPath.append('/');
+ SWBuf modsd = confPath + "mods.d";
+ // be sure we have at least some config file already out there
+ if (!FileMgr::existsFile(modsd.c_str())) {
+ modsd.append("/globals.conf");
+ FileMgr::createParent(modsd.c_str());
+ SWConfig config(modsd.c_str());
+ config["Globals"]["HiAndroid"] = "weeee";
+ config.save();
+ }
+ SWBuf extraPath = confPath + "extraConfig.conf";
+ bool exists = FileMgr::existsFile(extraPath.c_str());
+SWLog::getSystemLog()->logDebug("libsword: extraConfig %s at path: %s", exists?"Exists":"Absent", extraPath.c_str());
+
+SWLog::getSystemLog()->logDebug("libsword: init() creating WebMgr using path: %s", path);
+ return (SWHANDLE) new HandleSWMgr(new WebMgr(confPath.c_str(), exists?extraPath.c_str():0));
+}
+
/*
* Class: org_crosswire_sword_SWMgr
@@ -996,10 +1055,10 @@ const struct org_crosswire_sword_ModInfo * SWDLLEXPORT org_crosswire_sword_SWMgr
stdstr(&(milist[i].name), assureValidUTF8(module->getName()));
stdstr(&(milist[i].description), assureValidUTF8(module->getDescription()));
stdstr(&(milist[i].category), assureValidUTF8(type.c_str()));
- stdstr(&(milist[i++].language), assureValidUTF8(module->getLanguage()));
- stdstr(&(milist[i++].version), assureValidUTF8(version.c_str()));
- stdstr(&(milist[i++].delta), "");
- if (i >= size) break;
+ stdstr(&(milist[i].language), assureValidUTF8(module->getLanguage()));
+ stdstr(&(milist[i].version), assureValidUTF8(version.c_str()));
+ stdstr(&(milist[i].delta), "");
+ if (++i >= size) break;
}
}
hmgr->modInfo = milist;
@@ -1131,6 +1190,164 @@ const char ** SWDLLEXPORT org_crosswire_sword_SWMgr_getGlobalOptions
return retVal;
}
+
+/*
+ * Class: org_crosswire_sword_SWConfig
+ * Method: getSections
+ * Signature: ()[Ljava/lang/String;
+ */
+const char ** SWDLLEXPORT org_crosswire_sword_SWConfig_getSections
+ (const char *confPath) {
+
+ clearStringArray(&tmpStringArrayRetVal);
+ int count = 0;
+ const char **retVal = 0;
+ bool exists = FileMgr::existsFile(confPath);
+SWLog::getSystemLog()->logDebug("libsword: getConfigSections %s at path: %s", exists?"Exists":"Absent", confPath);
+ if (exists) {
+ SWConfig config(confPath);
+ SectionMap::const_iterator sit;
+ for (sit = config.getSections().begin(); sit != config.getSections().end(); ++sit) {
+ count++;
+ }
+ SWLog::getSystemLog()->logDebug("libsword: %d sections found in config", count);
+ retVal = (const char **)calloc(count+1, sizeof(const char *));
+ count = 0;
+ for (sit = config.getSections().begin(); sit != config.getSections().end(); ++sit) {
+ stdstr((char **)&(retVal[count++]), assureValidUTF8(sit->first.c_str()));
+ }
+ }
+ else {
+ retVal = (const char **)calloc(1, sizeof(const char *));
+ }
+
+ tmpStringArrayRetVal = retVal;
+ return retVal;
+}
+
+
+
+/*
+ * Class: org_crosswire_sword_SWConfig
+ * Method: getSectionKeys
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+const char ** SWDLLEXPORT org_crosswire_sword_SWConfig_getSectionKeys
+ (const char *confPath, const char *section) {
+
+ clearStringArray(&tmpStringArrayRetVal);
+ int count = 0;
+ const char **retVal = 0;
+ bool exists = FileMgr::existsFile(confPath);
+ if (exists) {
+ SWConfig config(confPath);
+ SectionMap::const_iterator sit = config.getSections().find(section);
+ if (sit != config.getSections().end()) {
+ ConfigEntMap::const_iterator it;
+ for (it = sit->second.begin(); it != sit->second.end(); ++it) {
+ count++;
+ }
+ retVal = (const char **)calloc(count+1, sizeof(const char *));
+ count = 0;
+ for (it = sit->second.begin(); it != sit->second.end(); ++it) {
+ stdstr((char **)&(retVal[count++]), assureValidUTF8(it->first.c_str()));
+ }
+ }
+ else {
+ retVal = (const char **)calloc(1, sizeof(const char *));
+ }
+ }
+ else {
+ retVal = (const char **)calloc(1, sizeof(const char *));
+ }
+
+ tmpStringArrayRetVal = retVal;
+ return retVal;
+}
+
+
+/*
+ * Class: org_crosswire_sword_SWConfig
+ * Method: getKeyValue
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+const char * SWDLLEXPORT org_crosswire_sword_SWConfig_getKeyValue
+ (const char *confPath, const char *section, const char *key) {
+
+ stdstr(&tmpStringRetVal, 0);
+ bool exists = FileMgr::existsFile(confPath);
+ if (exists) {
+ SWConfig config(confPath);
+ SectionMap::const_iterator sit = config.getSections().find(section);
+ if (sit != config.getSections().end()) {
+ ConfigEntMap::const_iterator it = sit->second.find(key);
+ if (it != sit->second.end()) {
+ stdstr(&tmpStringRetVal, assureValidUTF8(it->second.c_str()));
+ }
+ }
+ }
+
+ return tmpStringRetVal;
+}
+
+
+/*
+ * Class: org_crosswire_sword_SWConfig
+ * Method: setKeyValue
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ */
+void SWDLLEXPORT org_crosswire_sword_SWConfig_setKeyValue
+ (const char *confPath, const char *section, const char *key, const char *value) {
+
+ SWConfig config(confPath);
+ config[section][key] = value;
+ config.save();
+}
+
+
+/*
+ * Class: org_crosswire_sword_SWConfig
+ * Method: augmentConfig
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+const char ** SWDLLEXPORT org_crosswire_sword_SWConfig_augmentConfig
+ (const char *confPath, const char *configBlob) {
+
+
+ clearStringArray(&tmpStringArrayRetVal);
+ const char **retVal = 0;
+ int count = 0;
+
+ SWBuf myBlob = configBlob;
+
+ SWConfig config(confPath);
+
+ FileMgr::removeFile(confPath);
+ FileDesc *fd = FileMgr::getSystemFileMgr()->open(confPath, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
+ fd->getFd();
+ fd->write(myBlob.c_str(), myBlob.size());
+ FileMgr::getSystemFileMgr()->close(fd);
+
+ SWConfig newConfig(confPath);
+
+ config.augment(newConfig);
+ config.save();
+
+ SectionMap::const_iterator sit;
+ for (sit = newConfig.getSections().begin(); sit != newConfig.getSections().end(); ++sit) {
+ count++;
+ }
+ retVal = (const char **)calloc(count+1, sizeof(const char *));
+ count = 0;
+ for (sit = newConfig.getSections().begin(); sit != newConfig.getSections().end(); ++sit) {
+ stdstr((char **)&(retVal[count++]), assureValidUTF8(sit->first.c_str()));
+ }
+
+ tmpStringArrayRetVal = retVal;
+ return retVal;
+}
+
+
/*
* Class: org_crosswire_sword_SWMgr
* Method: getGlobalOptionValues
@@ -1254,7 +1471,7 @@ const char * SWDLLEXPORT org_crosswire_sword_SWMgr_translate
* Signature: (Ljava/lang/String;Lorg/crosswire/android/sword/SWModule/SearchProgressReporter;)V
*/
SWHANDLE SWDLLEXPORT org_crosswire_sword_InstallMgr_new
- (const char *baseDir, SWHANDLE statusReporter) {
+ (const char *baseDir, org_crosswire_sword_InstallMgr_StatusCallback statusReporter) {
SWBuf confPath = SWBuf(baseDir) + "/InstallMgr.conf";
// be sure we have at least some config file already out there
if (!FileMgr::existsFile(confPath.c_str())) {
@@ -1263,7 +1480,7 @@ SWHANDLE SWDLLEXPORT org_crosswire_sword_InstallMgr_new
SWConfig config(confPath.c_str());
config["General"]["PassiveFTP"] = "true";
- config.Save();
+ config.save();
}
HandleInstMgr *hinstmgr = new HandleInstMgr();
hinstmgr->statusReporter.init(statusReporter);
@@ -1273,6 +1490,17 @@ SWHANDLE SWDLLEXPORT org_crosswire_sword_InstallMgr_new
/*
* Class: org_crosswire_sword_InstallMgr
+ * Method: delete
+ * Signature: ()V
+ */
+void SWDLLEXPORT org_crosswire_sword_InstallMgr_delete
+ (SWHANDLE hInstallMgr) {
+ HandleInstMgr *hinstMgr = (HandleInstMgr *)hInstallMgr;
+ if (hinstMgr) delete hinstMgr;
+}
+
+/*
+ * Class: org_crosswire_sword_InstallMgr
* Method: setUserDisclaimerConfirmed
* Signature: ()V
*/
diff --git a/bindings/java-jni/Makefile b/bindings/java-jni/Makefile
index 1fd3743..0059b0e 100644
--- a/bindings/java-jni/Makefile
+++ b/bindings/java-jni/Makefile
@@ -1,4 +1,5 @@
all:
+ cp ../corba/orbitcpp/webmgr.hpp jni/
mkdir -p classes
javac -d classes src/org/crosswire/android/sword/*.java
javah -d jni -classpath classes -jni org.crosswire.android.sword.SWMgr
@@ -10,6 +11,8 @@ all:
javap -s -classpath classes/ org.crosswire.android.sword.SWModule.SearchHit > SearchHit.txt
javap -s -classpath classes/ org.crosswire.android.sword.SWModule.SearchProgressReporter > SearchProgressReporter.txt
javap -s -classpath classes/ org.crosswire.android.sword.InstallMgr > InstallMgr.txt
- cp src/org/crosswire/android/sword/*.java /home/scribe/src/bishop/src/org/crosswire/android/sword/
+ cp src/org/crosswire/android/sword/*.java ../Android/SWORD/app/src/main/java/org/crosswire/android/sword/
+clean:
+ rm -rf classes jni/org_crosswire_android_sword_*.h *.txt
diff --git a/bindings/java-jni/README b/bindings/java-jni/README
index 80c256a..e4b89fb 100644
--- a/bindings/java-jni/README
+++ b/bindings/java-jni/README
@@ -1,27 +1,28 @@
-Android Build Instructions
-
-You'll need the Android NDK.
-
-Then link the sword/bindings/java-jni folder to your project's /jni folder.
-I have a symlink:
-
-~/src/bishop/jni -> ~/src/sword/bindings/java-jni/jni/
-
-~/src/sword is simply a checkout of the current sword svn repository.
-(svn co https://crosswire.org/svn/sword/trunk ~/src/sword)
-
-
-So, since my $HOME directly is /home/scribe, my configuration looks like this:
-
-/home/scribe/src/sword/
-/home/scribe/src/bishop/
-/home/scribe/android-ndk-r8e/
-
-with:
-
-APP_PROJECT_PATH := $(call my-dir)/../../../src/bishop
-APP_MODULES := sword swordcore
-APP_PLATFORM := android-3
-
+This folder contains java-jni bindings. They are 99% generic but have
+some Android-specific code which should eventually be removed. This
+includes setting a SWLog::setSystemLog(new AndroidLogger()) and an
+org.crosswire.android.sword.* package. This was not changed to
+org.crosswire.sword.* because there are conflicting SWMgr, et. al.
+classes from the crosswire-java project and the CORBA bindings.
+org.crosswire.jni.sword.* is an option but exposing the impl in the
+package name is bad practice. More thought needed.
+
+A make in here should produce the JNI wrappers.
+jni/swordstub.cpp is the jni implementation
+
+This make also copies the java src/ files to the ../Android binding folder.
+The ../Android binding folder symlinks to the jni cpp file generated here.
+
+There is an Android Studio project there to build the native libs
+
+The steps to build all of this are usually:
+1) make in this folder
+2) build all in ../Android/SWORD Android Studio project
+3) a make in the ../Android/ folder, which finally copies the binary libs
+ to the ../cordova/ bindings folder to produce a working cordova
+ plugin
+
+Android java bindings can be used after step 2
+cordova javascript bindings can be used after step 3
Hope this helps get you started. Let me know your progress!
diff --git a/bindings/java-jni/jni/Android.mk b/bindings/java-jni/jni/Android.mk
index 5d793a0..5ce1c3c 100644
--- a/bindings/java-jni/jni/Android.mk
+++ b/bindings/java-jni/jni/Android.mk
@@ -28,11 +28,17 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libswordcore
LOCAL_C_INCLUDES := ../sword/include ../sword/include/internal/regex
LOCAL_CFLAGS += -D__unix__ \
+ -fvisibility=hidden \
-DSTDC_HEADERS \
-Dunix \
-D_FTPLIB_NO_COMPAT \
-DANDROID \
+ -DEXCLUDEBZIP2 \
+ -DEXCLUDEXZ \
-DOS_ANDROID
+
+#LOCAL_CFLAGS += -g
+
LOCAL_SRC_FILES := ../../../src/modules/comments/zcom/zcom.cpp \
../../../src/modules/comments/rawfiles/rawfiles.cpp \
../../../src/modules/comments/rawcom4/rawcom4.cpp \
@@ -54,8 +60,6 @@ LOCAL_SRC_FILES := ../../../src/modules/comments/zcom/zcom.cpp \
../../../src/modules/common/rawstr4.cpp \
../../../src/modules/common/lzsscomprs.cpp \
../../../src/modules/common/zipcomprs.cpp \
-../../../src/modules/common/bz2comprs.cpp \
-../../../src/modules/common/xzcomprs.cpp \
../../../src/modules/common/rawverse4.cpp \
../../../src/modules/common/swcipher.cpp \
../../../src/modules/common/swcomprs.cpp \
@@ -142,6 +146,10 @@ LOCAL_SRC_FILES := ../../../src/modules/comments/zcom/zcom.cpp \
../../../src/modules/filters/teiplain.cpp \
../../../src/modules/filters/swbasicfilter.cpp \
../../../src/modules/filters/scsuutf8.cpp \
+../../../src/modules/filters/gbflatex.cpp \
+../../../src/modules/filters/thmllatex.cpp \
+../../../src/modules/filters/teilatex.cpp \
+../../../src/modules/filters/osislatex.cpp \
../../../src/mgr/stringmgr.cpp \
../../../src/mgr/swmgr.cpp \
../../../src/mgr/swsearchable.cpp \
@@ -178,6 +186,15 @@ LOCAL_SRC_FILES := ../../../src/modules/comments/zcom/zcom.cpp \
../../../src/frontend/swlog.cpp \
../../../src/utilfuns/zlib/untgz.c
+# add BibleSync
+LOCAL_C_INCLUDES += ../biblesync/include
+LOCAL_SRC_FILES += \
+ ../../../../biblesync/src/biblesync.cc \
+ ../../../../biblesync/src/ifaddrs.c
+
+
+#../../../src/modules/common/bz2comprs.cpp \
+#../../../src/modules/common/xzcomprs.cpp \
#../../../../../sword/src/mgr/curlftpt.cpp \
#../../../../../sword/src/mgr/curlhttpt.cpp \
#../../../../../sword/src/utilfuns/win32/dirent.cpp \
@@ -194,6 +211,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libsword
LOCAL_C_INCLUDES := ../sword/include ../sword/include/internal/regex
+
+# add BibleSync stuff
+LOCAL_C_INCLUDES += ../biblesync/include
+
LOCAL_CFLAGS += -D__unix__ \
-Dunix \
-D_FTPLIB_NO_COMPAT \
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h b/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h
deleted file mode 100644
index b80243b..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_InstallMgr */
-
-#ifndef _Included_org_crosswire_android_sword_InstallMgr
-#define _Included_org_crosswire_android_sword_InstallMgr
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: reInit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_InstallMgr_reInit
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: setUserDisclaimerConfirmed
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_InstallMgr_setUserDisclaimerConfirmed
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: syncConfig
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_syncConfig
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: uninstallModule
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_uninstallModule
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: getRemoteSources
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteSources
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: refreshRemoteSource
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_refreshRemoteSource
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: getRemoteModInfoList
- * Signature: (Ljava/lang/String;)[Lorg/crosswire/android/sword/SWMgr/ModInfo;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteModInfoList
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: remoteInstallModule
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_remoteInstallModule
- (JNIEnv *, jobject, jstring, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: getRemoteModuleByName
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/crosswire/android/sword/SWModule;
- */
-JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteModuleByName
- (JNIEnv *, jobject, jstring, jstring);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h b/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h
deleted file mode 100644
index a95cf8e..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* 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: reInit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_reInit
- (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
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h b/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h
deleted file mode 100644
index f3b8fd6..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h b/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h
deleted file mode 100644
index 062c579..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h b/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
deleted file mode 100644
index 15b1ad0..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* 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
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_REGEX
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_REGEX 1L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_PHRASE
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_PHRASE -1L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_MULTIWORD
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_MULTIWORD -2L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_ENTRYATTR
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_ENTRYATTR -3L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_LUCENE
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_LUCENE -4L
-/*
- * 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/SearchProgressReporter;)[Lorg/crosswire/android/sword/SWModule/SearchHit;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_search
- (JNIEnv *, jobject, jstring, jint, jlong, jstring, jobject);
-
-/*
- * 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
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h b/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h
deleted file mode 100644
index e79c8fd..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* 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
diff --git a/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h b/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h
deleted file mode 100644
index 1f7de09..0000000
--- a/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWModule_SearchProgressReporter */
-
-#ifndef _Included_org_crosswire_android_sword_SWModule_SearchProgressReporter
-#define _Included_org_crosswire_android_sword_SWModule_SearchProgressReporter
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/bindings/java-jni/jni/swordstub.cpp b/bindings/java-jni/jni/swordstub.cpp
index 435a3f1..8a53f34 100644
--- a/bindings/java-jni/jni/swordstub.cpp
+++ b/bindings/java-jni/jni/swordstub.cpp
@@ -2,7 +2,7 @@
*
* swordstub.cpp - JNI bindings
*
- * $Id: swordstub.cpp 3184 2014-04-17 04:30:54Z greg.hellings $
+ * $Id: swordstub.cpp 3524 2017-11-07 03:08:49Z scribe $
*
* Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -37,6 +37,14 @@
#include <localemgr.h>
#include <treekeyidx.h>
#include <installmgr.h>
+#include <remotetrans.h>
+#include <rtfhtml.h>
+//#include <android/native_activity.h>
+
+
+#ifdef BIBLESYNC
+#include <biblesync.hh>
+#endif
#include "webmgr.hpp"
#include "org_crosswire_android_sword_SWMgr.h"
@@ -50,10 +58,69 @@ using std::vector;
using namespace sword;
-
+namespace {
WebMgr *mgr = 0;
InstallMgr *installMgr = 0;
+#ifdef BIBLESYNC
+BibleSync *bibleSync = 0;
+using std::string;
+jobject bibleSyncListener = 0;
+JNIEnv *bibleSyncListenerEnv = 0;
+#endif
+static SWBuf STORAGE_BASE;
+static char *SWORD_PATH = "/sdcard/sword";
+static char *AND_BIBLE_MODULES_PATH = "/sdcard/Android/data/net.bible.android.activity/files";
+//ANativeActivity *_activity;
+
+class InstallStatusReporter : public StatusReporter {
+public:
+ 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) {
+
+ // assert we have a callback
+ if (!callback) return;
+
+ if (completedBytes != last) {
+ last = completedBytes;
+ jclass cls = env->GetObjectClass(callback);
+ jmethodID mid = env->GetMethodID(cls, "update", "(JJ)V");
+ if (mid != 0) {
+ env->CallVoidMethod(callback, mid, (jlong)totalBytes, (jlong)completedBytes);
+ }
+ env->DeleteLocalRef(cls);
+ }
+ }
+
+ virtual void preStatus(long totalBytes, long completedBytes, const char *message) {
+
+ // assert we have a callback
+ if (!callback) return;
+
+ jclass cls = env->GetObjectClass(callback);
+ jmethodID mid = env->GetMethodID(cls, "preStatus", "(JJLjava/lang/String;)V");
+ if (mid != 0) {
+ jstring msg = env->NewStringUTF(assureValidUTF8((const char *)message));
+ env->CallVoidMethod(callback, mid, (jlong)totalBytes, (jlong)completedBytes, msg);
+ env->DeleteLocalRef(msg);
+ }
+ env->DeleteLocalRef(cls);
+ }
+} *installStatusReporter = 0;
+bool disclaimerConfirmed = false;
+
class AndroidLogger : public SWLog {
vector<int> levelMapping;
public:
@@ -73,50 +140,140 @@ public:
};
-static void init() {
+static void init(JNIEnv *env) {
if (!mgr) {
SWLog::setSystemLog(new AndroidLogger());
SWLog::getSystemLog()->setLogLevel(SWLog::LOG_DEBUG);
- SWBuf baseDir = "/sdcard/sword";
+SWLog::getSystemLog()->logDebug("libsword: init() begin");
+ SWBuf baseDir = SWORD_PATH;
SWBuf confPath = baseDir + "/mods.d/globals.conf";
// be sure we have at least some config file already out there
if (!FileMgr::existsFile(confPath.c_str())) {
+ SWLog::getSystemLog()->logDebug("libsword: init() sword config not found, attempting to create parent of: %s", confPath.c_str());
+ FileMgr::createParent(confPath.c_str());
+ remove(confPath.c_str());
+
+ SWLog::getSystemLog()->logDebug("libsword: init() saving basic: %s", confPath.c_str());
+ SWConfig config(confPath.c_str());
+ config["Globals"]["HiAndroid"] = "weeee";
+ config.save();
+ }
+ if (!FileMgr::existsFile(confPath.c_str())) {
+ baseDir = STORAGE_BASE;
+ confPath = baseDir + "/mods.d/globals.conf";
+SWLog::getSystemLog()->logDebug("libsword: init() sword config STILL not found, attempting to create parent of: %s", confPath.c_str());
FileMgr::createParent(confPath.c_str());
remove(confPath.c_str());
+SWLog::getSystemLog()->logDebug("libsword: init() saving basic: %s", confPath.c_str());
SWConfig config(confPath.c_str());
config["Globals"]["HiAndroid"] = "weeee";
- config.Save();
+ config.save();
}
- mgr = new WebMgr("/sdcard/sword");
+ confPath = STORAGE_BASE + "/extraConfig.conf";
+ bool exists = FileMgr::existsFile(confPath.c_str());
+SWLog::getSystemLog()->logDebug("libsword: extraConfig %s at path: %s", exists?"Exists":"Absent", confPath.c_str());
+
+SWLog::getSystemLog()->logDebug("libsword: init() creating WebMgr using path: %s", baseDir.c_str());
+ mgr = new WebMgr(baseDir, exists?confPath.c_str():0);
+
+SWLog::getSystemLog()->logDebug("libsword: init() augmenting modules from: %s", AND_BIBLE_MODULES_PATH);
+ // for And Bible modules
+ mgr->augmentModules(AND_BIBLE_MODULES_PATH, true);
}
}
+static void initInstall(JNIEnv *env, jobject progressReporter = 0) {
-static void initInstall() {
-
+ if (!installStatusReporter) {
+ installStatusReporter = new InstallStatusReporter();
+ }
+ installStatusReporter->init(env, progressReporter);
if (!installMgr) {
- SWBuf baseDir = "/sdcard/sword/InstallMgr";
+SWLog::getSystemLog()->logDebug("initInstall: installMgr is null");
+ SWBuf baseDir = SWORD_PATH;
+ baseDir += "/InstallMgr";
SWBuf confPath = baseDir + "/InstallMgr.conf";
// be sure we have at least some config file already out there
+SWLog::getSystemLog()->logDebug("initInstall: confPath: %s", confPath.c_str());
if (!FileMgr::existsFile(confPath.c_str())) {
+ SWLog::getSystemLog()->logDebug("initInstall: file doesn't exist: %s", confPath.c_str());
FileMgr::createParent(confPath.c_str());
- remove(confPath.c_str());
-
SWConfig config(confPath.c_str());
config["General"]["PassiveFTP"] = "true";
- config.Save();
+ config.save();
+ }
+ if (!FileMgr::existsFile(confPath.c_str())) {
+ baseDir = STORAGE_BASE;
+ confPath = baseDir + "/InstallMgr.conf";
+ SWLog::getSystemLog()->logDebug("initInstall: file STILL doesn't exist, attempting to create parent of: %s", confPath.c_str());
+ FileMgr::createParent(confPath.c_str());
+ SWConfig config(confPath.c_str());
+ config["General"]["PassiveFTP"] = "true";
+ config.save();
+ }
+ installMgr = new InstallMgr(baseDir, installStatusReporter);
+ if (disclaimerConfirmed) installMgr->setUserDisclaimerConfirmed(true);
+SWLog::getSystemLog()->logDebug("initInstall: instantiated InstallMgr with baseDir: %s", baseDir.c_str());
+ }
+}
+
+#ifdef BIBLESYNC
+void bibleSyncCallback(char cmd, string bible, string ref, string alt, string group, string domain, string info, string dump) {
+SWLog::getSystemLog()->logDebug("bibleSync callback msg: %c; bible: %s; ref: %s; alt: %s; group: %s; domain: %s; info: %s; dump: %s", cmd, bible.c_str(), ref.c_str(), alt.c_str(), group.c_str(), domain.c_str(), info.c_str(), dump.c_str());
+ if (::bibleSyncListener) {
+SWLog::getSystemLog()->logDebug("bibleSync listener is true");
+ jclass cls = bibleSyncListenerEnv->GetObjectClass(::bibleSyncListener);
+ jmethodID mid = bibleSyncListenerEnv->GetMethodID(cls, "messageReceived", "(Ljava/lang/String;)V");
+SWLog::getSystemLog()->logDebug("bibleSync listener mid: %ld", mid);
+ if (mid) {
+SWLog::getSystemLog()->logDebug("bibleSync listener mid is available");
+ switch(cmd) {
+ // error
+ case 'E':
+ // mismatch
+ case 'M':
+ // new speaker
+ case 'S':
+ // dead speaker
+ case 'D':
+ // announce
+ case 'A':
+ break;
+ // navigation
+ case 'N':
+SWLog::getSystemLog()->logDebug("bibleSync Nav Received: %s", ref.c_str());
+ jstring msg = bibleSyncListenerEnv->NewStringUTF(ref.c_str());
+ bibleSyncListenerEnv->CallVoidMethod(::bibleSyncListener, mid, msg);
+ bibleSyncListenerEnv->DeleteLocalRef(msg);
+ break;
+ }
}
- installMgr = new InstallMgr(baseDir);
+SWLog::getSystemLog()->logDebug("bibleSync listener deleting local ref to cls");
+ bibleSyncListenerEnv->DeleteLocalRef(cls);
+ }
+}
+#endif
+
+
+static void initBibleSync() {
+#ifdef BIBLESYNC
+ if (!bibleSync) {
+SWLog::getSystemLog()->logDebug("bibleSync initializing c-tor");
+ bibleSync = new BibleSync("SWORD", (const char *)SWVersion().currentVersion, "SwordUser");
+SWLog::getSystemLog()->logDebug("bibleSync initializing setMode");
+ bibleSync->setMode(BSP_MODE_PERSONAL, bibleSyncCallback, "passphrase");
}
+#endif
}
+}
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWVersion v;
return env->NewStringUTF(v.currentVersion);
@@ -129,7 +286,15 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_reInit
- (JNIEnv *, jobject) {
+ (JNIEnv *env, jobject me) {
+
+ jclass swmgrClass = env->GetObjectClass(me);
+ jmethodID getStorageBasePath = env->GetMethodID(swmgrClass, "getStorageBasePath", "()Ljava/lang/String;");
+ jstring basePathJS = (jstring)env->CallObjectMethod(me, getStorageBasePath, NULL);
+
+ const char *basePath = (basePathJS?env->GetStringUTFChars(basePathJS, NULL):0);
+ STORAGE_BASE = basePath;
+ SWLog::getSystemLog()->logDebug("setting STORAGE_BASE to: %s", STORAGE_BASE.c_str());
delete mgr;
mgr = 0;
@@ -137,26 +302,26 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_reInit
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getPrefixPath
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
return env->NewStringUTF(mgr->prefixPath);
}
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getConfigPath
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
return env->NewStringUTF(mgr->configPath);
}
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
- (JNIEnv *env, jobject) {
+ (JNIEnv *env, jobject) {
- init();
+ init(env);
int size = 0;
for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); ++it) {
@@ -211,15 +376,15 @@ SWLog::getSystemLog()->logDebug("getModInfoList returning %d length array\n", si
* 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();
+ 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();
@@ -242,17 +407,17 @@ JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_SWMgr_getModuleByName
* 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();
+ 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);
}
@@ -262,15 +427,15 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setGlobalOption
* 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();
+ 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));
}
@@ -282,15 +447,15 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
* 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();
+ 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));
}
@@ -302,20 +467,20 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
* 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();
+ 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));
}
@@ -327,9 +492,9 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_filterText
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptions
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
sword::StringList options = mgr->getGlobalOptions();
int count = 0;
@@ -351,19 +516,239 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalO
/*
* Class: org_crosswire_android_sword_SWMgr
+ * Method: getExtraConfigSections
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getExtraConfigSections
+ (JNIEnv *env, jobject me) {
+
+ init(env);
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ int count = 0;
+ bool exists = FileMgr::existsFile(confPath.c_str());
+ jclass clazzString = env->FindClass("java/lang/String");
+ jobjectArray ret;
+ SWLog::getSystemLog()->logDebug("libsword: extraConfig %s at path: %s", exists?"Exists":"Absent", confPath.c_str());
+ if (exists) {
+ SWConfig config(confPath.c_str());
+ SectionMap::const_iterator sit;
+ for (sit = config.getSections().begin(); sit != config.getSections().end(); ++sit) {
+ count++;
+ }
+ SWLog::getSystemLog()->logDebug("libsword: %d sections found in extraConfig", count);
+ ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
+ count = 0;
+ for (sit = config.getSections().begin(); sit != config.getSections().end(); ++sit) {
+ env->SetObjectArrayElement(ret, count++, env->NewStringUTF(assureValidUTF8(sit->first.c_str())));
+ }
+ }
+ else {
+ ret = (jobjectArray) env->NewObjectArray(0, clazzString, NULL);
+ }
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: getExtraConfigKeys
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getExtraConfigKeys
+ (JNIEnv *env, jobject me, jstring section) {
+
+ init(env);
+
+ const char *s = env->GetStringUTFChars(section, NULL);
+
+ SWBuf mySection = s;
+
+ env->ReleaseStringUTFChars(section, s);
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ int count = 0;
+ bool exists = FileMgr::existsFile(confPath.c_str());
+ jclass clazzString = env->FindClass("java/lang/String");
+ jobjectArray ret;
+ if (exists) {
+ SWConfig config(confPath.c_str());
+ SectionMap::const_iterator sit = config.getSections().find(mySection.c_str());
+ if (sit != config.getSections().end()) {
+ ConfigEntMap::const_iterator it;
+ for (it = sit->second.begin(); it != sit->second.end(); ++it) {
+ count++;
+ }
+ ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
+ count = 0;
+ for (it = sit->second.begin(); it != sit->second.end(); ++it) {
+ env->SetObjectArrayElement(ret, count++,
+ env->NewStringUTF(assureValidUTF8(it->first.c_str())));
+ }
+ }
+ else {
+ ret = (jobjectArray) env->NewObjectArray(0, clazzString, NULL);
+ }
+ }
+ else {
+ ret = (jobjectArray) env->NewObjectArray(0, clazzString, NULL);
+ }
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: getExtraConfigValue
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getExtraConfigValue
+ (JNIEnv *env, jobject me, jstring section, jstring key) {
+
+ init(env);
+
+ const char *s = env->GetStringUTFChars(section, NULL);
+
+ SWBuf mySection = s;
+
+ env->ReleaseStringUTFChars(section, s);
+
+ const char *k = env->GetStringUTFChars(key, NULL);
+
+ SWBuf myKey = k;
+
+ env->ReleaseStringUTFChars(key, k);
+
+ jstring ret = 0;
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ bool exists = FileMgr::existsFile(confPath.c_str());
+ if (exists) {
+ SWConfig config(confPath.c_str());
+ SectionMap::const_iterator sit = config.getSections().find(mySection.c_str());
+ if (sit != config.getSections().end()) {
+ ConfigEntMap::const_iterator it = sit->second.find(myKey.c_str());
+ if (it != sit->second.end()) {
+ ret = env->NewStringUTF(assureValidUTF8(it->second.c_str()));
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: setExtraConfigValue
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setExtraConfigValue
+ (JNIEnv *env, jobject me, jstring section, jstring key, jstring value) {
+
+ init(env);
+
+ const char *s = env->GetStringUTFChars(section, NULL);
+
+ SWBuf mySection = s;
+
+ env->ReleaseStringUTFChars(section, s);
+
+ const char *k = env->GetStringUTFChars(key, NULL);
+
+ SWBuf myKey = k;
+
+ env->ReleaseStringUTFChars(key, k);
+
+ const char *v = env->GetStringUTFChars(value, NULL);
+
+ SWBuf myValue = v;
+
+ env->ReleaseStringUTFChars(value, v);
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ SWConfig config(confPath.c_str());
+ config[mySection][myKey] = myValue;
+ config.save();
+
+ Java_org_crosswire_android_sword_SWMgr_reInit(env, me);
+
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: addExtraConfig
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_addExtraConfig
+ (JNIEnv *env, jobject me, jstring blob) {
+
+ init(env);
+
+ const char *b = env->GetStringUTFChars(blob, NULL);
+
+ SWBuf myBlob = b;
+
+ env->ReleaseStringUTFChars(blob, b);
+
+ jobjectArray ret;
+
+ int count = 0;
+ jclass clazzString = env->FindClass("java/lang/String");
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf tmpConfPath = baseDir + "/tmpConfig.conf";
+ FileMgr::removeFile(tmpConfPath.c_str());
+ FileDesc *fd = FileMgr::getSystemFileMgr()->open(tmpConfPath.c_str(), FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
+ fd->getFd();
+ fd->write(myBlob.c_str(), myBlob.size());
+ FileMgr::getSystemFileMgr()->close(fd);
+
+ SWConfig newConfig(tmpConfPath.c_str());
+ FileMgr::removeFile(tmpConfPath.c_str());
+ SectionMap::const_iterator sit;
+ for (sit = newConfig.getSections().begin(); sit != newConfig.getSections().end(); ++sit) {
+ count++;
+ }
+ ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
+ count = 0;
+ for (sit = newConfig.getSections().begin(); sit != newConfig.getSections().end(); ++sit) {
+ env->SetObjectArrayElement(ret, count++, env->NewStringUTF(assureValidUTF8(sit->first.c_str())));
+ }
+
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ SWConfig config(confPath.c_str());
+ config.augment(newConfig);
+ config.save();
+
+ Java_org_crosswire_android_sword_SWMgr_reInit(env, me);
+
+ return ret;
+}
+
+
+/*
+ * 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 *env, jobject me, jstring optionJS) {
+ (JNIEnv *env, jobject me, jstring optionJS) {
- init();
+ 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) {
@@ -387,17 +772,17 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalO
* 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();
+ 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);
}
@@ -407,9 +792,9 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setCipherKey
* 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();
+ init(env);
mgr->setJavascript(val == JNI_TRUE);
}
@@ -421,9 +806,9 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setJavascript
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailableLocales
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
sword::StringList localeNames = LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
int count = 0;
@@ -448,15 +833,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailab
* 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();
+ 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);
}
@@ -464,9 +849,10 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setDefaultLocale
// SWModule methods ----------------------------------------------------------------------------------
-SWModule *getModule(JNIEnv *env, jobject me) {
+SWModule *getModule
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = 0;
jclass clazzSWModule = env->FindClass("org/crosswire/android/sword/SWModule");
@@ -474,10 +860,10 @@ SWModule *getModule(JNIEnv *env, jobject me) {
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();
@@ -485,8 +871,8 @@ SWModule *getModule(JNIEnv *env, jobject me) {
}
}
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;
}
@@ -496,9 +882,9 @@ SWModule *getModule(JNIEnv *env, jobject me) {
* 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();
+ init(env);
SWModule *module = getModule(env, me);
@@ -509,7 +895,9 @@ SWLog::getSystemLog()->logDebug("setKeyText(%s, %s)", module->getName(), keyText
sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
if (vkey && (*keyText=='+' ||*keyText=='-')) {
if (!stricmp(keyText+1, "book")) {
- vkey->setBook(vkey->getBook() + ((*keyText=='+')?1:-1));
+ int newBook = vkey->getBook() + ((*keyText=='+')?1:-1);
+SWLog::getSystemLog()->logDebug("setting book to %d", newBook);
+ vkey->setBook(newBook);
env->ReleaseStringUTFChars(keyTextJS, keyText);
return;
}
@@ -532,9 +920,9 @@ SWLog::getSystemLog()->logDebug("setKeyText(%s, %s)", module->getName(), keyText
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -552,9 +940,9 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -568,13 +956,33 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderTex
/*
* Class: org_crosswire_android_sword_SWModule
+ * Method: getRenderHeader
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderHeader
+ (JNIEnv *env, jobject me) {
+
+ init(env);
+
+ SWModule *module = getModule(env, me);
+
+ jstring retVal = 0;
+ if (module) {
+ retVal = env->NewStringUTF(assureValidUTF8(((const char *)(module->getRenderHeader() ? module->getRenderHeader():""))));
+ }
+ return retVal;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWModule
* Method: terminateSearch
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -590,13 +998,14 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
* Signature: ()C
*/
JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
- return (module) ? module->popError() : -99;
+ int error = (module) ? module->popError() : -99;
+ return error;
}
@@ -606,9 +1015,9 @@ JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -622,9 +1031,9 @@ JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
* 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();
+ init(env);
const char *level1 = env->GetStringUTFChars(level1JS, NULL);
const char *level2 = env->GetStringUTFChars(level2JS, NULL);
@@ -646,7 +1055,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getEntr
sword::AttributeList::iterator i2Start, i2End;
sword::AttributeValue::iterator i3Start, i3End;
- if ((level1) && (*level1)) {
+ if ((level1) && (*level1) && *level1 != '-') {
i1Start = entryAttribs.find(level1);
i1End = i1Start;
if (i1End != entryAttribs.end())
@@ -657,35 +1066,54 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getEntr
i1End = entryAttribs.end();
}
for (;i1Start != i1End; ++i1Start) {
- if ((level2) && (*level2)) {
- i2Start = i1Start->second.find(level2);
- i2End = i2Start;
- if (i2End != i1Start->second.end())
- ++i2End;
+ if (level1 && *level1 && *level1 == '-') {
+ results.push_back(i1Start->first);
}
else {
- i2Start = i1Start->second.begin();
- i2End = i1Start->second.end();
- }
- for (;i2Start != i2End; ++i2Start) {
- if ((level3) && (*level3)) {
- i3Start = i2Start->second.find(level3);
- i3End = i3Start;
- if (i3End != i2Start->second.end())
- ++i3End;
+ if (level2 && *level2 && *level2 != '-') {
+ i2Start = i1Start->second.find(level2);
+ i2End = i2Start;
+ if (i2End != i1Start->second.end())
+ ++i2End;
}
else {
- i3Start = i2Start->second.begin();
- i3End = i2Start->second.end();
+ i2Start = i1Start->second.begin();
+ i2End = i1Start->second.end();
}
- for (;i3Start != i3End; ++i3Start) {
- results.push_back(i3Start->second);
+ for (;i2Start != i2End; ++i2Start) {
+ if (level2 && *level2 && *level2 == '-') {
+ results.push_back(i2Start->first);
+ }
+ else {
+ // 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())
+ ++i3End;
+ }
+ else {
+ i3Start = i2Start->second.begin();
+ i3End = i2Start->second.end();
+ }
+ for (;i3Start != i3End; ++i3Start) {
+ 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);
+ }
+ }
+ if (i3Start != i3End)
+ break;
+ }
}
- if (i3Start != i3End)
+ if (i2Start != i2End)
break;
}
- if (i2Start != i2End)
- break;
}
ret = (jobjectArray) env->NewObjectArray(results.size(), clazzString, NULL);
@@ -716,9 +1144,9 @@ SWLog::getSystemLog()->logDebug("getEntryAttributes: size returned: %d", results
* 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();
+ init(env);
const char *keyListText = env->GetStringUTFChars(keyListTextJS, NULL);
@@ -761,9 +1189,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_parseKe
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -786,9 +1214,9 @@ JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChild
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyChildren
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
jclass clazzString = env->FindClass("java/lang/String");
@@ -802,7 +1230,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyC
sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
if (vkey) {
- ret = (jobjectArray) env->NewObjectArray(7, clazzString, NULL);
+ ret = (jobjectArray) env->NewObjectArray(10, clazzString, NULL);
SWBuf num;
num.appendFormatted("%d", vkey->getTestament());
env->SetObjectArrayElement(ret, 0, env->NewStringUTF(assureValidUTF8(num.c_str())));
@@ -822,6 +1250,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyC
num.appendFormatted("%d", vkey->getVerseMax());
env->SetObjectArrayElement(ret, 5, env->NewStringUTF(assureValidUTF8(num.c_str())));
env->SetObjectArrayElement(ret, 6, env->NewStringUTF(assureValidUTF8(vkey->getBookName())));
+ env->SetObjectArrayElement(ret, 7, env->NewStringUTF(assureValidUTF8(vkey->getOSISRef())));
+ env->SetObjectArrayElement(ret, 8, env->NewStringUTF(assureValidUTF8(vkey->getShortText())));
+ env->SetObjectArrayElement(ret, 9, env->NewStringUTF(assureValidUTF8(vkey->getBookAbbrev())));
}
else {
TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);
@@ -844,8 +1275,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyC
}
}
}
- return ret;
}
+ return ret;
}
@@ -855,9 +1286,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyC
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWBuf retVal = "";
@@ -885,9 +1316,9 @@ JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -904,9 +1335,9 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -923,9 +1354,9 @@ JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
* Signature: ()V
*/
JNIEXP