[sword-svn] r2178 - in trunk: . include src/keys src/modules tests
scribe at www.crosswire.org
scribe at www.crosswire.org
Fri Jun 20 08:10:48 MST 2008
Author: scribe
Date: 2008-06-20 08:10:47 -0700 (Fri, 20 Jun 2008)
New Revision: 2178
Modified:
trunk/include/swkey.h
trunk/include/treekey.h
trunk/include/treekeyidx.h
trunk/include/versekey.h
trunk/include/versetreekey.h
trunk/src/keys/treekey.cpp
trunk/src/keys/treekeyidx.cpp
trunk/src/keys/versekey.cpp
trunk/src/keys/versetreekey.cpp
trunk/src/modules/swmodule.cpp
trunk/tests/parsekey.cpp
trunk/usrinst.sh
Log:
More progess on VerseTreeKey. A search of LXXM should complete now
and return references that at least have KJV book names; no errors on the rest
Added support for [a-z] verse suffixes.
Modified: trunk/include/swkey.h
===================================================================
--- trunk/include/swkey.h 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/include/swkey.h 2008-06-20 15:10:47 UTC (rev 2178)
@@ -124,6 +124,7 @@
* @return error status
*/
virtual char Error();
+ virtual void setError(char err) { error = err; }
/** Sets this SWKey with a character string
* @param ikey string used to set this key
Modified: trunk/include/treekey.h
===================================================================
--- trunk/include/treekey.h 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/include/treekey.h 2008-06-20 15:10:47 UTC (rev 2178)
@@ -44,7 +44,23 @@
// This better conforms to the SWORD write methodology: mod.setKey, mod.setEntry
mutable SWBuf unsnappedKeyText;
+ // called whenever position of this key is changed. Should we move this
+ // to a more base class?
+ void positionChanged() { if (posChangeListener) posChangeListener->positionChanged(); }
+
public:
+
+ class PositionChangeListener {
+ TreeKey *treeKey;
+ public:
+ PositionChangeListener() {}
+ virtual void positionChanged() = 0;
+ TreeKey *getTreeKey() { return treeKey; }
+ void setTreeKey(TreeKey *tk) { treeKey = tk; }
+ } *posChangeListener;
+
+ void setPositionChangeListener(PositionChangeListener *pcl) { posChangeListener = pcl; posChangeListener->setTreeKey(this); }
+
// TreeKey (const char *ikey = 0);
// TreeKey (const SWKey * ikey);
// TreeKey (TreeKey const &k);
@@ -55,6 +71,8 @@
virtual const char *getLocalName() = 0;
virtual const char *setLocalName(const char *) = 0;
+ virtual int getLevel() { long bm = getOffset(); int level = 0; do { level++; } while (parent()); setOffset(bm); return level; }
+
virtual const char *getUserData(int *size = 0) = 0;
virtual void setUserData(const char *userData, int size = 0) = 0;
Modified: trunk/include/treekeyidx.h
===================================================================
--- trunk/include/treekeyidx.h 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/include/treekeyidx.h 2008-06-20 15:10:47 UTC (rev 2178)
@@ -35,7 +35,7 @@
* The TreeKey implementation used for all tree-based modules in Sword, such as GenBooks.
*/
class SWDLLEXPORT TreeKeyIdx : public TreeKey {
-
+
class TreeNode {
public:
TreeNode();
@@ -57,16 +57,18 @@
FileDesc *idxfd;
FileDesc *datfd;
+ void init();
+
void getTreeNodeFromDatOffset(long ioffset, TreeNode *buf) const;
char getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const;
void saveTreeNode(TreeNode *node);
void saveTreeNodeOffsets(TreeNode *node);
- void init();
+
public:
TreeKeyIdx(const TreeKeyIdx &ikey);
- TreeKeyIdx (const char *idxPath, int fileMode = -1);
- ~TreeKeyIdx ();
+ TreeKeyIdx(const char *idxPath, int fileMode = -1);
+ virtual ~TreeKeyIdx();
virtual SWKey *clone() const;
@@ -98,7 +100,9 @@
void setOffset(unsigned long offset);
unsigned long getOffset() const;
+ virtual int getLevel();
+
// OPERATORS ------------------------------------------------------------
Modified: trunk/include/versekey.h
===================================================================
--- trunk/include/versekey.h 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/include/versekey.h 2008-06-20 15:10:47 UTC (rev 2178)
@@ -121,6 +121,7 @@
mutable signed char book;
mutable signed int chapter;
mutable signed int verse;
+ mutable char suffix;
/** flag for auto normalization
*/
@@ -227,14 +228,14 @@
* @param lb the new lower boundary for this VerseKey
* @return the lower boundary the key was set to
*/
- VerseKey &LowerBound(const char *lb);
+ VerseKey &LowerBound(const VerseKey &ub);
/** sets the upper boundary for this VerseKey
* and returns the new boundary
* @param ub the new upper boundary for this VerseKey
* @return the upper boundary the key was set to
*/
- VerseKey &UpperBound(const char *ub);
+ VerseKey &UpperBound(const VerseKey &ub);
/** gets the lower boundary of this VerseKey
* @return the lower boundary of this VerseKey
@@ -316,6 +317,12 @@
*/
virtual int Verse() const;
+ /** Gets verse suffix
+ *
+ * @return value of verse suffix
+ */
+ virtual char getSuffix() const;
+
/** Sets/gets testament
*
* @param itestament value which to set testament
@@ -352,6 +359,12 @@
*/
virtual int Verse(int iverse);
+ /** Sets/gets verse suffix
+ *
+ * @param isuffix value which to set verse suffix
+ */
+ virtual void setSuffix(char isuffix);
+
/** checks limits and normalizes if necessary (e.g.
* Matthew 29:47 = Mark 2:2). If last verse is
* exceeded, key is set to last Book CH:VS
Modified: trunk/include/versetreekey.h
===================================================================
--- trunk/include/versetreekey.h 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/include/versetreekey.h 2008-06-20 15:10:47 UTC (rev 2178)
@@ -36,13 +36,14 @@
* Class VerseKey
* The SWKey implementation used for verse based modules like Bibles or commentaries.
*/
-class SWDLLEXPORT VerseTreeKey : public VerseKey {
+class SWDLLEXPORT VerseTreeKey : public VerseKey, public TreeKey::PositionChangeListener {
static SWClass classdef;
TreeKey *treeKey;
void init(TreeKey *treeKey);
void syncVerseToTree();
+ long lastGoodOffset;
public:
@@ -91,7 +92,18 @@
virtual bool isTraversable() const { return true; }
virtual TreeKey *getTreeKey();
+
+ // TreeKey::PositionChangeListener interface
+ virtual void positionChanged();
+ bool internalPosChange;
+
+ virtual void decrement(int steps = 1);
+ virtual void increment(int steps = 1);
+ virtual void Normalize(char autocheck = 0);
+
+ virtual void setPosition(SW_POSITION newpos);
+ virtual long NewIndex() const;
// OPERATORS --------------------------------------------------------------------
Modified: trunk/src/keys/treekey.cpp
===================================================================
--- trunk/src/keys/treekey.cpp 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/src/keys/treekey.cpp 2008-06-20 15:10:47 UTC (rev 2178)
@@ -32,6 +32,7 @@
void TreeKey::init() {
myclass = &classdef;
unsnappedKeyText = "";
+ posChangeListener = 0;
}
Modified: trunk/src/keys/treekeyidx.cpp
===================================================================
--- trunk/src/keys/treekeyidx.cpp 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/src/keys/treekeyidx.cpp 2008-06-20 15:10:47 UTC (rev 2178)
@@ -127,12 +127,25 @@
void TreeKeyIdx::root() {
error = getTreeNodeFromIdxOffset(0, ¤tNode);
+ positionChanged();
}
+int TreeKeyIdx::getLevel() {
+ TreeNode iterator;
+ iterator.parent = currentNode.parent;
+ int level = 0;
+ while (iterator.parent > -1) {
+ level++;
+ getTreeNodeFromIdxOffset(iterator.parent, &iterator);
+ }
+ return level;
+}
+
bool TreeKeyIdx::parent() {
if (currentNode.parent > -1) {
error = getTreeNodeFromIdxOffset(currentNode.parent, ¤tNode);
+ positionChanged();
return true;
}
return false;
@@ -142,6 +155,7 @@
bool TreeKeyIdx::firstChild() {
if (currentNode.firstChild > -1) {
error = getTreeNodeFromIdxOffset(currentNode.firstChild, ¤tNode);
+ positionChanged();
return true;
}
return false;
@@ -151,6 +165,7 @@
bool TreeKeyIdx::nextSibling() {
if (currentNode.next > -1) {
error = getTreeNodeFromIdxOffset(currentNode.next, ¤tNode);
+ positionChanged();
return true;
}
return false;
@@ -168,6 +183,7 @@
getTreeNodeFromIdxOffset(iterator.next, &iterator);
if (iterator.next > -1) {
error = getTreeNodeFromIdxOffset(iterator.offset, ¤tNode);
+ positionChanged();
return true;
}
}
@@ -195,6 +211,7 @@
currentNode.clear();
currentNode.offset = idxOffset;
currentNode.parent = parent;
+ positionChanged();
}
}
@@ -212,6 +229,7 @@
currentNode.offset = idxOffset;
currentNode.parent = parent;
}
+ positionChanged();
}
@@ -253,6 +271,7 @@
}
}
}
+ positionChanged();
}
}
@@ -292,7 +311,7 @@
newTree.saveTreeNode(&root);
delete [] path;
-
+
return 0;
}
@@ -394,6 +413,7 @@
void TreeKeyIdx::setOffset(unsigned long offset) {
error = getTreeNodeFromIdxOffset(offset, ¤tNode);
+ positionChanged();
}
@@ -461,6 +481,7 @@
idxfd = FileMgr::getSystemFileMgr()->open(ikey.idxfd->path, ikey.idxfd->mode, ikey.idxfd->perms);
datfd = FileMgr::getSystemFileMgr()->open(ikey.datfd->path, ikey.datfd->mode, ikey.datfd->perms);
}
+ positionChanged();
}
@@ -520,6 +541,7 @@
error = KEYERR_OUTOFBOUNDS;
delete [] buf;
unsnappedKeyText = ikey;
+ positionChanged();
}
@@ -527,6 +549,7 @@
void TreeKeyIdx::copyFrom(const SWKey &ikey) {
unsnappedKeyText = ikey;
SWKey::copyFrom(ikey);
+ positionChanged();
}
void TreeKeyIdx::setPosition(SW_POSITION p) {
@@ -538,6 +561,7 @@
error = getTreeNodeFromIdxOffset(idxfd->seek(-4, SEEK_END), ¤tNode);
break;
}
+ positionChanged();
Error(); // clear error from normalize
}
@@ -557,10 +581,15 @@
void TreeKeyIdx::decrement(int steps) {
error = getTreeNodeFromIdxOffset(currentNode.offset - (4*steps), ¤tNode);
+ positionChanged();
}
void TreeKeyIdx::increment(int steps) {
error = getTreeNodeFromIdxOffset(currentNode.offset + (4*steps), ¤tNode);
+ if (error) {
+// SWLog::getSystemLog()->logError("error: %d", error);
+ }
+ positionChanged();
/*
// assert positive
Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/src/keys/versekey.cpp 2008-06-20 15:10:47 UTC (rev 2178)
@@ -54,6 +54,7 @@
book = 0;
chapter = 0;
verse = 0;
+ suffix = 0;
locale = 0;
setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
@@ -114,6 +115,7 @@
book = ikey.Book();
chapter = ikey.Chapter();
verse = ikey.Verse();
+ suffix = ikey.getSuffix();
if (ikey.isBoundSet()) {
LowerBound(ikey.LowerBound());
UpperBound(ikey.UpperBound());
@@ -294,13 +296,15 @@
book = BMAX[1];
chapter = 1;
verse = 1;
- int booklen = 0;
+ //int booklen = 0;
int error = 0;
if (keytext) {
ListKey tmpListKey = VerseKey::ParseVerseList(keytext);
if (tmpListKey.Count()) {
+ (*this) = tmpListKey.getElement(0);
+/*
SWKey::setText((const char *)tmpListKey);
for (int i = 1; i < 3; i++) {
for (int j = 1; j <= BMAX[i-1]; j++) {
@@ -319,6 +323,7 @@
sscanf(&keytext[booklen], "%d:%d", &chapter, &verse);
}
else error = 1;
+*/
} else error = 1;
}
if (checkAutoNormalize) {
@@ -355,6 +360,10 @@
realbook = BMAX[realtest-1];
}
sprintf(buf, "%s %d:%d", books[realtest-1][realbook-1].name, chapter, verse);
+ if (suffix) {
+ buf[strlen(buf)+1] = 0;
+ buf[strlen(buf)] = suffix;
+ }
}
stdstr((char **)&keytext, buf);
@@ -453,6 +462,7 @@
*number = 0;
int tobook = 0;
int tonumber = 0;
+ char suffix = 0;
int chap = -1, verse = -1;
int bookno = 0;
VerseKey curKey, lBound, lastKey;
@@ -471,6 +481,8 @@
int notAllDigits = 0;
curKey.AutoNormalize(0);
+ lastKey.AutoNormalize(0);
+ lBound.AutoNormalize(0);
if (defaultKey) lastKey = defaultKey;
while (*buf) {
@@ -588,6 +600,9 @@
}
if (verse >= 0) {
curKey.Verse(verse);
+ if (suffix) {
+ curKey.setSuffix(suffix);
+ }
}
else {
partial++;
@@ -621,9 +636,11 @@
// we store non-range entries as strings so we don't traverse
// maybe we should consider just setting
// lowerBound and upperBound to the same value
- tmpListKey << curKey.getText();
+ lastKey.LowerBound(curKey);
+ lastKey.UpperBound(curKey);
+ lastKey = TOP;
+ tmpListKey << lastKey;
tmpListKey.GetElement()->userData = (void *)buf;
- lastKey = curKey;
}
}
else if (expandRange) {
@@ -644,6 +661,7 @@
*book = 0;
chap = -1;
verse = -1;
+ suffix = 0;
if (*buf == ',')
comma = 1;
else comma = 0;
@@ -683,12 +701,17 @@
else {
switch (*buf) {
case ' ': // ignore these and don't reset number
- case 'f':
case 'F':
break;
default:
- number[tonumber] = 0;
- tonumber = 0;
+ // suffixes (and oddly 'f'-- ff.)
+ if (*buf >= 'a' && *buf <= 'z') {
+ if (chap >=0) suffix = *buf;
+ }
+ else {
+ number[tonumber] = 0;
+ tonumber = 0;
+ }
break;
}
}
@@ -779,6 +802,9 @@
}
if (verse >= 0) {
curKey.Verse(verse);
+ if (suffix) {
+ curKey.setSuffix(suffix);
+ }
}
else {
partial++;
@@ -806,9 +832,12 @@
tmpListKey.GetElement()->userData = (void *)buf;
}
else {
- tmpListKey << curKey.getText();
+ lastKey.LowerBound(curKey);
+ lastKey.UpperBound(curKey);
+ lastKey = TOP;
+ tmpListKey << lastKey;
+// tmpListKey << curKey.getText();
tmpListKey.GetElement()->userData = (void *)buf;
- lastKey = curKey;
}
}
else if (expandRange) {
@@ -838,13 +867,14 @@
* VerseKey::LowerBound - sets / gets the lower boundary for this key
*/
-VerseKey &VerseKey::LowerBound(const char *lb)
+VerseKey &VerseKey::LowerBound(const VerseKey &lb)
{
if (!lowerBound)
initBounds();
(*lowerBound) = lb;
- lowerBound->Normalize();
+// why are we normalizing?
+// lowerBound->Normalize();
lowerBound->setLocale( this->getLocale() );
boundSet = true;
return (*lowerBound);
@@ -855,7 +885,7 @@
* VerseKey::UpperBound - sets / gets the upper boundary for this key
*/
-VerseKey &VerseKey::UpperBound(const char *ub)
+VerseKey &VerseKey::UpperBound(const VerseKey &ub)
{
if (!upperBound)
initBounds();
@@ -864,10 +894,12 @@
(*upperBound) = ub;
if (*upperBound < *lowerBound)
*upperBound = *lowerBound;
- upperBound->Normalize();
+// why are we normalizing?
+// upperBound->Normalize();
upperBound->setLocale( this->getLocale() );
// until we have a proper method to resolve max verse/chap use this kludge
+/*
int len = strlen(ub);
bool alpha = false;
bool versespec = false;
@@ -884,9 +916,9 @@
*upperBound = MAXCHAPTER;
if (!versespec)
*upperBound = MAXVERSE;
-
+*/
+// -- end kludge
-// -- end kludge
boundSet = true;
return (*upperBound);
}
@@ -1005,19 +1037,23 @@
book = LowerBound().Book();
chapter = LowerBound().Chapter();
verse = LowerBound().Verse();
+ suffix = LowerBound().getSuffix();
break;
case POS_BOTTOM:
testament = UpperBound().Testament();
book = UpperBound().Book();
chapter = UpperBound().Chapter();
verse = UpperBound().Verse();
+ suffix = UpperBound().getSuffix();
break;
case POS_MAXVERSE:
Normalize();
verse = books[testament-1][book-1].versemax[chapter-1];
+ suffix = 0;
break;
case POS_MAXCHAPTER:
verse = 1;
+ suffix = 0;
Normalize();
chapter = books[testament-1][book-1].chapmax;
break;
@@ -1161,11 +1197,11 @@
// should we always perform bounds checks? Tried but seems to cause infinite recursion
if (_compare(UpperBound()) > 0) {
- setText(UpperBound(), false);
+ copyFrom(UpperBound());
error = KEYERR_OUTOFBOUNDS;
}
if (_compare(LowerBound()) < 0) {
- setText(LowerBound(), false);
+ copyFrom(LowerBound());
error = KEYERR_OUTOFBOUNDS;
}
}
@@ -1300,6 +1336,7 @@
{
int retval = verse;
+ setSuffix(0);
verse = iverse;
Normalize(1);
@@ -1307,6 +1344,14 @@
}
+char VerseKey::getSuffix() const {
+ return suffix;
+}
+
+void VerseKey::setSuffix(char suf) {
+ suffix = suf;
+}
+
/******************************************************************************
* VerseKey::AutoNormalize - Sets/gets flag that tells VerseKey to auto-
* matically normalize itself when modified
@@ -1435,6 +1480,7 @@
{
long offset;
+ suffix = 0;
// This is the dirty stuff --------------------------------------------
if (!testament)
@@ -1533,8 +1579,10 @@
keyval2 += ivkey.Book() * 1000000;
keyval1 += Chapter() * 1000;
keyval2 += ivkey.Chapter() * 1000;
- keyval1 += Verse();
- keyval2 += ivkey.Verse();
+ keyval1 += Verse() * 50;
+ keyval2 += ivkey.Verse() * 50;
+ keyval1 += (int)getSuffix();
+ keyval2 += (int)ivkey.getSuffix();
keyval1 -= keyval2;
keyval1 = (keyval1) ? ((keyval1 > 0) ? 1 : -1) /*keyval1/labs(keyval1)*/:0; // -1 | 0 | 1
return keyval1;
@@ -1606,7 +1654,7 @@
*/
const char *VerseKey::getRangeText() const {
- if (isBoundSet()) {
+ if (isBoundSet() && (LowerBound() != UpperBound())) {
char buf[1023];
sprintf(buf, "%s-%s", (const char *)LowerBound(), (const char *)UpperBound());
stdstr(&rangeText, buf);
Modified: trunk/src/keys/versetreekey.cpp
===================================================================
--- trunk/src/keys/versetreekey.cpp 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/src/keys/versetreekey.cpp 2008-06-20 15:10:47 UTC (rev 2178)
@@ -55,8 +55,10 @@
void VerseTreeKey::init(TreeKey *treeKey)
{
+ myclass = &classdef;
this->treeKey = treeKey;
- myclass = &classdef;
+ this->treeKey->setPositionChangeListener(this);
+ internalPosChange = false;
}
@@ -75,10 +77,84 @@
VerseTreeKey::~VerseTreeKey() {
}
+
+void VerseTreeKey::decrement(int steps) {
+ int treeError = 0;
+ if (!error) lastGoodOffset = treeKey->getOffset();
+ do {
+ treeKey->decrement();
+ treeError = treeKey->Error();
+ // iterate until 3 levels and no versekey parse errors
+ } while (!treeError && ((treeKey->getLevel() < 3) || error));
+ if (error && !treeError) {
+ int saveError = error;
+ increment();
+ error = saveError;
+ }
+ if (treeError) {
+ treeKey->setOffset(lastGoodOffset);
+ error = treeError;
+ }
+}
+void VerseTreeKey::increment(int steps) {
+ int treeError = 0;
+ if (!error) lastGoodOffset = treeKey->getOffset();
+ do {
+ treeKey->increment();
+ treeError = treeKey->Error();
+ // iterate until 3 levels and no versekey parse errors
+ } while (!treeError && ((treeKey->getLevel() < 3) || error));
+ if (error && !treeError) {
+ int saveError = error;
+ decrement();
+ error = saveError;
+ }
+ if (treeError) {
+ treeKey->setOffset(lastGoodOffset);
+ error = treeError;
+ }
+}
+
+
+void VerseTreeKey::positionChanged() {
+ if (!internalPosChange) {
+ TreeKey *tkey = TreeKey::PositionChangeListener::getTreeKey();
+ int saveError = tkey->Error();
+ long bookmark = tkey->getOffset();
+ SWBuf path;
+ internalPosChange = true;
+ int legs = 0;
+ do {
+ path = (SWBuf)tkey->getLocalName() + "." + path;
+ legs++;
+ } while (tkey->parent());
+ path--;
+ path << 1;
+ setText(path);
+ if (saveError) {
+ error = saveError;
+ }
+ tkey->setOffset(bookmark);
+ tkey->setError(saveError);
+ internalPosChange = false;
+ }
+}
+
+
void VerseTreeKey::syncVerseToTree() {
+ internalPosChange = true;
SWBuf path;
path.setFormatted("/%s/%d/%d", getOSISBookName(), Chapter(), Verse());
+ if (getSuffix()) path += getSuffix();
+ long bookmark = treeKey->getOffset();
treeKey->setText(path);
+
+ // if our module has jacked inconsistencies, then let's put our tree back to where it was
+ if (treeKey->Error()) {
+ treeKey->setOffset(bookmark);
+ }
+
+ internalPosChange = false;
}
@@ -87,5 +163,41 @@
return treeKey;
}
+// can autonormalize yet (ever?)
+void VerseTreeKey::Normalize(char autocheck) {
+ error = 0;
+}
+long VerseTreeKey::NewIndex() const {
+ return treeKey->getOffset();
+}
+
+
+void VerseTreeKey::setPosition(SW_POSITION p) {
+
+/*
+ if (boundSet) {
+ return VerseKey::setPosition(p);
+ }
+*/
+
+ switch (p) {
+ case POS_TOP:
+ treeKey->setPosition(p);
+ treeKey->increment();
+ treeKey->decrement();
+ treeKey->Error();
+ case POS_BOTTOM:
+ treeKey->setPosition(p);
+ treeKey->decrement();
+ treeKey->increment();
+ treeKey->Error();
+ break;
+ case POS_MAXVERSE:
+ case POS_MAXCHAPTER:
+ VerseKey::setPosition(p);
+ break;
+ }
+}
+
SWORD_NAMESPACE_END
Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/src/modules/swmodule.cpp 2008-06-20 15:10:47 UTC (rev 2178)
@@ -6,6 +6,7 @@
#include <vector>
+#include <swlog.h>
#include <sysdata.h>
#include <swmodule.h>
#include <utilstr.h>
@@ -435,9 +436,12 @@
terminateSearch = false;
char perc = 1;
bool savePEA = isProcessEntryAttributes();
- // determine if we might be doing special strip searches. useful for knowing if we can use shortcuts
- bool specialStrips = (getConfigEntry("LocalStripFilter") || strchr(istr, '<'));
+ // determine if we might be doing special strip searches. useful for knowing if we can use shortcuts
+ bool specialStrips = (getConfigEntry("LocalStripFilter")
+ || (getConfig().has("GlobalOptionFilter", "UTF8GreekAccents"))
+ || (strchr(istr, '<')));
+
processEntryAttributes(searchType == -3);
@@ -466,7 +470,7 @@
*this = BOTTOM;
// fix below when we find out the bug
- long highIndex = (vkcheck)?32300/*vkcheck->NewIndex()*/:key->Index();
+ long highIndex = (vkcheck)?/*32300*/vkcheck->NewIndex():key->Index();
if (!highIndex)
highIndex = 1; // avoid division by zero errors.
*this = TOP;
@@ -965,7 +969,7 @@
*this = BOTTOM;
- long highIndex = (vkcheck)?32300/*vkcheck->NewIndex()*/:key->Index();
+ long highIndex = (vkcheck)?/*32300*/vkcheck->NewIndex():key->Index();
if (!highIndex)
highIndex = 1; // avoid division by zero errors.
Modified: trunk/tests/parsekey.cpp
===================================================================
--- trunk/tests/parsekey.cpp 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/tests/parsekey.cpp 2008-06-20 15:10:47 UTC (rev 2178)
@@ -23,16 +23,12 @@
ListKey verses = DefaultVSKey.ParseVerseList(argv[1], DefaultVSKey, true);
+ std::cout << verses.getRangeText() << "\n";
+/*
for (int i = 0; i < verses.Count(); i++) {
- VerseKey *element = SWDYNAMIC_CAST(VerseKey, verses.GetElement(i));
- if (element) {
- std::cout << (SWBuf(element->LowerBound()) + " - " + SWBuf(element->UpperBound())).c_str() << "\n";
- }
- else std::cout << (const char *)*verses.GetElement(i) << "\n";
-// else {
-// std::cout << VerseKey(verses.GetElement(i)).getOSISRef() << "\n";
-// }
+ std::cout << verses.GetElement(i)->getRangeText() << "\n";
}
+*/
if (argc > 3) {
verses.setText(argv[3]);
Modified: trunk/usrinst.sh
===================================================================
--- trunk/usrinst.sh 2008-06-16 21:52:33 UTC (rev 2177)
+++ trunk/usrinst.sh 2008-06-20 15:10:47 UTC (rev 2178)
@@ -7,7 +7,7 @@
#OPTIONS="--with-vcl $OPTIONS"
OPTIONS="--enable-debug $OPTIONS"
#OPTIONS="--enable-profile $OPTIONS"
-#OPTIONS="--with-icu $OPTIONS"
+OPTIONS="--with-icu $OPTIONS"
#OPTIONS="--without-clucene $OPTIONS"
#OPTIONS="--without-curl $OPTIONS"
#OPTIONS="--enable-tests $OPTIONS"
More information about the sword-cvs
mailing list