[sword-svn] r2318 - in trunk: include utilities
scribe at crosswire.org
scribe at crosswire.org
Fri Apr 10 14:22:16 MST 2009
Author: scribe
Date: 2009-04-10 14:22:16 -0700 (Fri, 10 Apr 2009)
New Revision: 2318
Modified:
trunk/include/swmodule.h
trunk/utilities/mod2zmod.cpp
trunk/utilities/osis2mod.cpp
Log:
fixed fallback SWModule::hasEntry behaviour
added av11n support to mod2zmod and osis2mod
Modified: trunk/include/swmodule.h
===================================================================
--- trunk/include/swmodule.h 2009-04-10 17:59:52 UTC (rev 2317)
+++ trunk/include/swmodule.h 2009-04-10 21:22:16 UTC (rev 2318)
@@ -641,7 +641,7 @@
virtual bool getSkipConsecutiveLinks() { return skipConsecutiveLinks; }
virtual bool isLinked(const SWKey *k1, const SWKey *k2) const { return false; }
- virtual bool hasEntry(const SWKey *k) const { return getEntrySize(); }
+ virtual bool hasEntry(const SWKey *k) const { return false; }
/** Entry Attributes are special data pertaining to the current entry.
* To see what Entry Attributes exists for a specific entry of a module,
Modified: trunk/utilities/mod2zmod.cpp
===================================================================
--- trunk/utilities/mod2zmod.cpp 2009-04-10 17:59:52 UTC (rev 2317)
+++ trunk/utilities/mod2zmod.cpp 2009-04-10 21:22:16 UTC (rev 2318)
@@ -31,6 +31,7 @@
#include <ztext.h>
#include <zld.h>
#include <zcom.h>
+#include <swtext.h>
#include <swmgr.h>
#include <lzsscomprs.h>
#include <zipcomprs.h>
@@ -40,20 +41,7 @@
#ifndef NO_SWORD_NAMESPACE
-using sword::SWCompress;
-using sword::CipherFilter;
-using sword::SWModule;
-using sword::SWMgr;
-using sword::ModMap;
-using sword::zText;
-using sword::zLD;
-using sword::zCom;
-using sword::SWFilter;
-using sword::VerseKey;
-using sword::SWKey;
-using sword::SW_POSITION;
-using sword::ZipCompress;
-using sword::LZSSCompress;
+using namespace sword;
#endif
using std::cerr;
@@ -130,9 +118,12 @@
int result = 0;
switch (modType) {
case BIBLE:
- case COM:
- result = zText::createModule(argv[2], iType);
+ case COM: {
+ SWKey *k = inModule->getKey();
+ VerseKey *vk = SWDYNAMIC_CAST(VerseKey, k);
+ result = zText::createModule(argv[2], iType, vk->getVersificationSystem());
break;
+ }
case LEX:
result = zLD::createModule(argv[2]);
break;
@@ -145,10 +136,15 @@
switch (modType) {
case BIBLE:
- case COM:
- outModule = new zText(argv[2], 0, 0, iType, compressor); // open our datapath with our RawText driver.
+ case COM: {
+ SWKey *k = inModule->getKey();
+ VerseKey *vk = SWDYNAMIC_CAST(VerseKey, k);
+ outModule = new zText(argv[2], 0, 0, iType, compressor,
+ 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0,
+ vk->getVersificationSystem()); // open our datapath with our RawText driver.
((VerseKey *)(SWKey *)(*inModule))->Headings(1);
break;
+ }
case LEX:
outModule = new zLD(argv[2], 0, 0, iType, compressor); // open our datapath with our RawText driver.
break;
Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp 2009-04-10 17:59:52 UTC (rev 2317)
+++ trunk/utilities/osis2mod.cpp 2009-04-10 21:22:16 UTC (rev 2318)
@@ -1195,6 +1195,7 @@
fprintf(stderr, " -N\t\t\t Do not convert UTF-8 or normalize UTF-8 to NFC\n");
fprintf(stderr, "\t\t\t\t (default is to convert to UTF-8, if needed, and then normalize to NFC");
fprintf(stderr, "\t\t\t\t Note: all UTF-8 texts should be normalized to NFC\n");
+ fprintf(stderr, " -v <v11n> use versification scheme other than KJV.\n\n");
exit(-1);
}
@@ -1215,6 +1216,7 @@
int compType = 0;
int iType = 4;
SWBuf cipherKey = "";
+ SWBuf v11n = "KJV";
SWCompress *compressor = 0;
@@ -1244,6 +1246,10 @@
if (i+1 < argc) cipherKey = argv[++i];
else usage(*argv, "-c requires <cipher_key>");
}
+ else if (!strcmp(argv[i], "-v")) {
+ if (i+1 < argc) v11n = argv[++i];
+ else usage(*argv, "-v requires <v11n>");
+ }
else usage(*argv, (((SWBuf)"Unknown argument: ")+ argv[i]).c_str());
}
@@ -1270,12 +1276,12 @@
// Try to initialize a default set of datafiles and indicies at our
// datapath location passed to us from the user.
if ( compressor ) {
- if ( zText::createModule(path, iType) ) {
+ if ( zText::createModule(path, iType, v11n) ) {
fprintf(stderr, "error: %s: couldn't create module at path: %s \n", program, path);
exit(-3);
}
}
- else if (RawText::createModule(path)) {
+ else if (RawText::createModule(path, v11n)) {
fprintf(stderr, "error: %s: couldn't create module at path: %s \n", program, path);
exit(-3);
}
@@ -1290,10 +1296,12 @@
// Do some initialization stuff
if (compressor) {
- module = new zText(path, 0, 0, iType, compressor);
+ module = new zText(path, 0, 0, iType, compressor,
+ 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0,
+ v11n); // open our datapath with our RawText driver.
}
else{
- module = new RawText(path); // open our datapath with our RawText driver.
+ module = new RawText(path, 0, 0, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, v11n); // open our datapath with our RawText driver.
}
SWFilter *cipherFilter = 0;
More information about the sword-cvs
mailing list