Re: [sword-devel] BibleTime indexing problem
Gary, Thank you so much for investing the time to put in the leg work to investigate this and provide a concise example that represents the problem. I seems to be a bug in the skipConsecutiveLinks flag with regard to Testament 1 Header. Did you say this only happens on the HunKar module? I have stepped through the code and something is certainly wrong-- even if there is a module bug. I'm not saying there is one, but even if there is a strange link in the headings, the -- operator on the module shouldn't jump from Testament 1 Heading to Malachi :) I'll let you know what I find. Any more information you have would be useful. Again, thanks for investing the time. This is exactly what we need to debug this. Troy On 03/03/2012 06:05 AM, Gary Holmlund wrote: Troy, I found it takes both of these conditions to cause the problem. key-Headings(true); book-setSkipConsecutiveLinks(true); The program below outputs Malachi 1:1 Should BibleTime do something different or is this a sword issue. Gary #include iostream #include swmgr.h #include swmodule.h #include versekey.h using namespace sword; using namespace std; int main(int argc, char **argv) { const char *modName = HunKar; SWMgr library; SWModule *book = library.getModule(modName); if (!book) { cerr Can't find module: modName endl; return -1; } VerseKey* key = ((VerseKey *)book-getKey()); key-Headings(true); book-setSkipConsecutiveLinks(true); book-setPosition(TOP); cout *key endl; return 0; } ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
Re: [sword-devel] BibleTime indexing problem
Troy, HunKar is the only module I am aware of that has the problem. I also note that sword 1.6.2 has the problem and 1.6.1 does not. Gary On 03/03/2012 06:26 PM, Troy A. Griffitts wrote: Gary, Thank you so much for investing the time to put in the leg work to investigate this and provide a concise example that represents the problem. I seems to be a bug in the skipConsecutiveLinks flag with regard to Testament 1 Header. Did you say this only happens on the HunKar module? I have stepped through the code and something is certainly wrong-- even if there is a module bug. I'm not saying there is one, but even if there is a strange link in the headings, the -- operator on the module shouldn't jump from Testament 1 Heading to Malachi :) I'll let you know what I find. Any more information you have would be useful. Again, thanks for investing the time. This is exactly what we need to debug this. Troy On 03/03/2012 06:05 AM, Gary Holmlund wrote: Troy, I found it takes both of these conditions to cause the problem. key-Headings(true); book-setSkipConsecutiveLinks(true); The program below outputs Malachi 1:1 Should BibleTime do something different or is this a sword issue. Gary #include iostream #include swmgr.h #include swmodule.h #include versekey.h using namespace sword; using namespace std; int main(int argc, char **argv) { const char *modName = HunKar; SWMgr library; SWModule *book = library.getModule(modName); if (!book) { cerr Can't find module: modName endl; return -1; } VerseKey* key = ((VerseKey *)book-getKey()); key-Headings(true); book-setSkipConsecutiveLinks(true); book-setPosition(TOP); cout *key endl; return 0; } ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
Re: [sword-devel] BibleTime indexing problem
Gary, if you add this line to your test program (which I suspect Bibletime did similarly at some point) you should get similar values in tmpKey at that point: return -1; } ((VerseKey *)book-getKey())-Headings(true); book-setPosition(TOP); return 0; Gary Holmlund gary.holml...@gmail.com wrote: On 02/28/2012 08:21 AM, Troy A. Griffitts wrote: So, a little background. SWORD keys handle versification + 4 special slots: chapter intro book intro testament intro module intro These are positioned respectively using, for example starting with John 3:16 VerseKey k(John 3:16); k.setVerse(0);// chapter intro k.setChapter(0); // book intro k.setBook(0); // testament intro k.setTestament(0); module intro If you try to output the key when positioned to any of these 4 special locations, you will get: John 3:0 John 0:0 [ Testament 2 Heading ] [ Module Heading ] It is important for our verse parser to be able to parse anything which it outputs. Thus the special cases for the magic strings which you note below. I don't think the module having any special text/absence or presence of headers has anything to do with the problem; the key itself doesn't know about the module content. Can you show a simple snippet which fails that I might try to debug? I have created a small test program, and have added it to the examples folder, which tests the functionality and it seems to work for me, but I am using SVN HEAD. Maybe you could try this program in your environment: http://crosswire.org/svn/sword/trunk/examples/classes/verseposition.cpp Hope we can get this fixed for you, Troy Troy The closest program that does what BibleTime does at the beginning of the indexing is this: #include iostream #include swmgr.h #include swmodule.h #include versekey.h using namespace sword; using namespace std; int main(int argc, char **argv) { const char *modName = HunKar; SWMgr library; SWModule *book = library.getModule(modName); if (!book) { cerr Can't find module: modName endl; return -1; } book-setPosition(TOP); return 0; } However, this program does not have the problem BibleTime is having. It seems that some other condition about the module is different between the two cases, but I have not been able to discover what it is. I have debugged down into the setPosition function until I see a difference. Perhaps if I explain that difference it will mean something to you. call stack 1sword::zText::incrementztext.cpp1780xb7f001a5 2sword::zText::decrementztext.h650xb7f004f1 3sword::SWModule::operator-=swmodule.h6740x815299f 4sword::SWModule::operator--swmodule.h6740x81529ff 5sword::SWModule::setPositionswmodule.cpp3680xb7ea81c9 6CSwordModuleInfo::buildIndexcswordmoduleinfo.cpp 262 0x813aa07 I get down to the increment function when I see the difference. The function begins like this: void zText::increment(int steps) { long start; unsigned short size; unsigned long buffnum; VerseKey *tmpkey = getVerseKey(); The values for tmpkey are different and in BibleTime we hit the error condition a little farther into the function: if ((error = key-Error())) { *key = lastgood; break; For the test program tmpkey looks like this: thisKey sword::VerseKey sword::SWKeysword::SWKey BMAX@0x8116e24 int [2] autonorm1 char book1 signed char chapter 1 int headings0 '\0' char internalListKey sword::ListKey lowerBound 0 long lowerBoundComponents sword::VerseKey::VerseComponents refSys @0x806a7fc sword::VerseMgr::System suffix 0 '\0' signed char testament 1 signed char tmpClone @0x8129db8 sword::VerseKey upperBound 32359 long upperBoundComponents sword::VerseKey::VerseComponents verse 2 int For BibleTime tmpkey looks like this: tmpkey @0x843cc40 sword::VerseKey sword::SWKeysword::SWKey BMAX@0x843cce4 int [2] autonorm1 char book0 '\0' signed char chapter 0 int headings1 char internalListKey sword::ListKey lowerBound 0 long lowerBoundComponents sword::VerseKey::VerseComponents refSys @0x843c08c
Re: [sword-devel] BibleTime indexing problem
Troy, I found it takes both of these conditions to cause the problem. key-Headings(true); book-setSkipConsecutiveLinks(true); The program below outputs Malachi 1:1 Should BibleTime do something different or is this a sword issue. Gary #include iostream #include swmgr.h #include swmodule.h #include versekey.h using namespace sword; using namespace std; int main(int argc, char **argv) { const char *modName = HunKar; SWMgr library; SWModule *book = library.getModule(modName); if (!book) { cerr Can't find module: modName endl; return -1; } VerseKey* key = ((VerseKey *)book-getKey()); key-Headings(true); book-setSkipConsecutiveLinks(true); book-setPosition(TOP); cout *key endl; return 0; } ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
Re: [sword-devel] BibleTime indexing problem
On 02/28/2012 08:21 AM, Troy A. Griffitts wrote: So, a little background. SWORD keys handle versification + 4 special slots: chapter intro book intro testament intro module intro These are positioned respectively using, for example starting with John 3:16 VerseKey k(John 3:16); k.setVerse(0);// chapter intro k.setChapter(0); // book intro k.setBook(0); // testament intro k.setTestament(0); module intro If you try to output the key when positioned to any of these 4 special locations, you will get: John 3:0 John 0:0 [ Testament 2 Heading ] [ Module Heading ] It is important for our verse parser to be able to parse anything which it outputs. Thus the special cases for the magic strings which you note below. I don't think the module having any special text/absence or presence of headers has anything to do with the problem; the key itself doesn't know about the module content. Can you show a simple snippet which fails that I might try to debug? I have created a small test program, and have added it to the examples folder, which tests the functionality and it seems to work for me, but I am using SVN HEAD. Maybe you could try this program in your environment: http://crosswire.org/svn/sword/trunk/examples/classes/verseposition.cpp Hope we can get this fixed for you, Troy Troy The closest program that does what BibleTime does at the beginning of the indexing is this: #include iostream #include swmgr.h #include swmodule.h #include versekey.h using namespace sword; using namespace std; int main(int argc, char **argv) { const char *modName = HunKar; SWMgr library; SWModule *book = library.getModule(modName); if (!book) { cerr Can't find module: modName endl; return -1; } book-setPosition(TOP); return 0; } However, this program does not have the problem BibleTime is having. It seems that some other condition about the module is different between the two cases, but I have not been able to discover what it is. I have debugged down into the setPosition function until I see a difference. Perhaps if I explain that difference it will mean something to you. call stack 1sword::zText::incrementztext.cpp1780xb7f001a5 2sword::zText::decrementztext.h650xb7f004f1 3sword::SWModule::operator-=swmodule.h6740x815299f 4sword::SWModule::operator--swmodule.h6740x81529ff 5sword::SWModule::setPositionswmodule.cpp3680xb7ea81c9 6CSwordModuleInfo::buildIndexcswordmoduleinfo.cpp 262 0x813aa07 I get down to the increment function when I see the difference. The function begins like this: void zText::increment(int steps) { long start; unsigned short size; unsigned long buffnum; VerseKey *tmpkey = getVerseKey(); The values for tmpkey are different and in BibleTime we hit the error condition a little farther into the function: if ((error = key-Error())) { *key = lastgood; break; For the test program tmpkey looks like this: thisKey sword::VerseKey sword::SWKeysword::SWKey BMAX@0x8116e24 int [2] autonorm1 char book1 signed char chapter 1 int headings0 '\0' char internalListKey sword::ListKey lowerBound 0 long lowerBoundComponents sword::VerseKey::VerseComponents refSys @0x806a7fc sword::VerseMgr::System suffix 0 '\0' signed char testament 1 signed char tmpClone @0x8129db8 sword::VerseKey upperBound 32359 long upperBoundComponents sword::VerseKey::VerseComponents verse 2 int For BibleTime tmpkey looks like this: tmpkey @0x843cc40 sword::VerseKey sword::SWKeysword::SWKey BMAX@0x843cce4 int [2] autonorm1 char book0 '\0' signed char chapter 0 int headings1 char internalListKey sword::ListKey lowerBound 0 long lowerBoundComponents sword::VerseKey::VerseComponents refSys @0x843c08c sword::VerseMgr::System suffix 0 '\0' signed char testament 1 signed char tmpClone @0x863a790 sword::VerseKey upperBound 32359 long upperBoundComponents sword::VerseKey::VerseComponents verse 0 int I suspect that the book, chapter, and headings values being
Re: [sword-devel] BibleTime indexing problem
So, a little background. SWORD keys handle versification + 4 special slots: chapter intro book intro testament intro module intro These are positioned respectively using, for example starting with John 3:16 VerseKey k(John 3:16); k.setVerse(0); // chapter intro k.setChapter(0); // book intro k.setBook(0); // testament intro k.setTestament(0); module intro If you try to output the key when positioned to any of these 4 special locations, you will get: John 3:0 John 0:0 [ Testament 2 Heading ] [ Module Heading ] It is important for our verse parser to be able to parse anything which it outputs. Thus the special cases for the magic strings which you note below. I don't think the module having any special text/absence or presence of headers has anything to do with the problem; the key itself doesn't know about the module content. Can you show a simple snippet which fails that I might try to debug? I have created a small test program, and have added it to the examples folder, which tests the functionality and it seems to work for me, but I am using SVN HEAD. Maybe you could try this program in your environment: http://crosswire.org/svn/sword/trunk/examples/classes/verseposition.cpp Hope we can get this fixed for you, Troy On 02/28/2012 06:39 AM, Gary Holmlund wrote: On 02/27/2012 08:30 PM, Greg Hellings wrote: On Mon, Feb 27, 2012 at 10:24 PM, Matthew Talbertransom1...@gmail.com wrote: On Mon, Feb 27, 2012 at 11:05 PM, Gary Holmlundgary.holml...@gmail.com wrote: I am investigating why the searching in BibleTime for the HunKar Bible begins Tracing down through sword book is set to 39 in sword:VerseKey::Normalize. Here is the call stack from setPosition down to Normalize: book is set to 39 by the following code in sword:VerseKey::Normalize if (book 1) { if (--testament 0) { book += BMAX[testament-1]; // versekey.cpp line 1274 ::Normalize } continue; } I don't think you should be using Normalize here. Normalize should be used for user input, which could be incorrect, so it will turn out of range verses (for example) into real verses. So if Normalize is doing something in this case, I think it means the rest of your code is wrong. If I'm reading the stack trace correctly, BibleTime is calling setPosition() which in turn calls many other things down the stack until setBook() calls Normalize(). It does not appear that BibleTime is invoking Normalize(). The issue appears to be arising, if Gary's analysis is correct, in the handling of the special key value [Testament Heading]. Perhaps the presence or absence of such a foreward in the HunKar Bible and similar are what is generating this problem in BibleTime? --Greg Greg, Yes, I believe that HunKar must have a [Testament Heading] and this is possibly a special case that many other modules don't have. If I set the parameter to 1 on versekey.cpp line 522 the indexing of the book works fine. if ((!strncmp(buf, [ Testament , 12)) (isdigit(buf[12])) (!strcmp(buf+13, Heading ]))) { curKey-Verse(0); curKey-Chapter(0); curKey-Book(0); // versekey.cpp line 522 ::ParseVerseList Gary ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
[sword-devel] BibleTime indexing problem
I am investigating why the searching in BibleTime for the HunKar Bible begins in Malachi instead of Genesis. I found that BibleTime is building the index incorrectly. This only happens with sword 1.6.2, not 1.6.1. Further debuging gets to the following BibleTime code in CSwordModuleInfo::buildIndex: m_module-setPosition(sword::TOP); Looking into member variables of m_module after the setPosition I see that book is set to 39 which is Malachi. It should be set to 1 for Genesis. Tracing down through sword book is set to 39 in sword:VerseKey::Normalize. Here is the call stack from setPosition down to Normalize: 0sword::VerseKey::Normalizeversekey.cpp12760xb7e77d78 1sword::VerseKey::setBookversekey.cpp14340xb7e783c3 2sword::VerseKey::Bookversekey.h3120x8154931 3sword::VerseKey::ParseVerseListversekey.cpp5220xb7e751b9 4sword::VerseKey::parseversekey.cpp2880xb7e74785 5sword::VerseKey::setTextversekey.h2200x8154830 6sword::SWKey::copyFromswkey.cpp1810xb7e6f19c 7sword::VerseKey::copyFromversekey.cpp2070xb7e741d6 8sword::SWKey::positionFromswkey.h1670x8152825 9sword::VerseKey::positionFromversekey.cpp1520xb7e73ec5 10sword::SWKey::operator=swkey.h2250xb7eaafa9 11sword::zText::incrementztext.cpp1780xb7f001a5 12sword::zText::decrementztext.h650xb7f004f1 13sword::SWModule::operator-=swmodule.h6740x815299f 14sword::SWModule::operator--swmodule.h6740x81529ff 15sword::SWModule::setPositionswmodule.cpp3680xb7ea81c9 16CSwordModuleInfo::buildIndexcswordmoduleinfo.cpp 262 0x813aa07 In sword::VerseKey::ParseVerseList I see something that does not seem right. The curKey-Book(0) seems like it should not have a 0 parameter. When it does have the 0 parameter, book is set to 39. I think it should be 1. This code is executed when using the HunKar Bible, but not other Bibles I tested. if ((!strncmp(buf, [ Testament , 12)) (isdigit(buf[12])) (!strcmp(buf+13, Heading ]))) { curKey-Verse(0); curKey-Chapter(0); curKey-Book(0); // versekey.cpp line 522 ::ParseVerseList book is set to 39 by the following code in sword:VerseKey::Normalize if (book 1) { if (--testament 0) { book += BMAX[testament-1]; // versekey.cpp line 1274 ::Normalize } continue; } I am hoping that some more familiar with the sword code can comment on this. Gary Holmlund ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
Re: [sword-devel] BibleTime indexing problem
On Mon, Feb 27, 2012 at 11:05 PM, Gary Holmlund gary.holml...@gmail.com wrote: I am investigating why the searching in BibleTime for the HunKar Bible begins Tracing down through sword book is set to 39 in sword:VerseKey::Normalize. Here is the call stack from setPosition down to Normalize: book is set to 39 by the following code in sword:VerseKey::Normalize if (book 1) { if (--testament 0) { book += BMAX[testament-1]; // versekey.cpp line 1274 ::Normalize } continue; } I don't think you should be using Normalize here. Normalize should be used for user input, which could be incorrect, so it will turn out of range verses (for example) into real verses. So if Normalize is doing something in this case, I think it means the rest of your code is wrong. Matthew ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
Re: [sword-devel] BibleTime indexing problem
On Mon, Feb 27, 2012 at 10:24 PM, Matthew Talbert ransom1...@gmail.com wrote: On Mon, Feb 27, 2012 at 11:05 PM, Gary Holmlund gary.holml...@gmail.com wrote: I am investigating why the searching in BibleTime for the HunKar Bible begins Tracing down through sword book is set to 39 in sword:VerseKey::Normalize. Here is the call stack from setPosition down to Normalize: book is set to 39 by the following code in sword:VerseKey::Normalize if (book 1) { if (--testament 0) { book += BMAX[testament-1]; // versekey.cpp line 1274 ::Normalize } continue; } I don't think you should be using Normalize here. Normalize should be used for user input, which could be incorrect, so it will turn out of range verses (for example) into real verses. So if Normalize is doing something in this case, I think it means the rest of your code is wrong. If I'm reading the stack trace correctly, BibleTime is calling setPosition() which in turn calls many other things down the stack until setBook() calls Normalize(). It does not appear that BibleTime is invoking Normalize(). The issue appears to be arising, if Gary's analysis is correct, in the handling of the special key value [Testament Heading]. Perhaps the presence or absence of such a foreward in the HunKar Bible and similar are what is generating this problem in BibleTime? --Greg Matthew ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
Re: [sword-devel] BibleTime indexing problem
On 02/27/2012 08:30 PM, Greg Hellings wrote: On Mon, Feb 27, 2012 at 10:24 PM, Matthew Talbertransom1...@gmail.com wrote: On Mon, Feb 27, 2012 at 11:05 PM, Gary Holmlundgary.holml...@gmail.com wrote: I am investigating why the searching in BibleTime for the HunKar Bible begins Tracing down through sword book is set to 39 in sword:VerseKey::Normalize. Here is the call stack from setPosition down to Normalize: book is set to 39 by the following code in sword:VerseKey::Normalize if (book 1) { if (--testament 0) { book += BMAX[testament-1]; // versekey.cpp line 1274 ::Normalize } continue; } I don't think you should be using Normalize here. Normalize should be used for user input, which could be incorrect, so it will turn out of range verses (for example) into real verses. So if Normalize is doing something in this case, I think it means the rest of your code is wrong. If I'm reading the stack trace correctly, BibleTime is calling setPosition() which in turn calls many other things down the stack until setBook() calls Normalize(). It does not appear that BibleTime is invoking Normalize(). The issue appears to be arising, if Gary's analysis is correct, in the handling of the special key value [Testament Heading]. Perhaps the presence or absence of such a foreward in the HunKar Bible and similar are what is generating this problem in BibleTime? --Greg Greg, Yes, I believe that HunKar must have a [Testament Heading] and this is possibly a special case that many other modules don't have. If I set the parameter to 1 on versekey.cpp line 522 the indexing of the book works fine. if ((!strncmp(buf, [ Testament , 12)) (isdigit(buf[12])) (!strcmp(buf+13, Heading ]))) { curKey-Verse(0); curKey-Chapter(0); curKey-Book(0); // versekey.cpp line 522 ::ParseVerseList Gary ___ sword-devel mailing list: sword-devel@crosswire.org http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page