[sword-devel] BibleTime indexing problem

2012-02-27 Thread Gary Holmlund


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

2012-02-27 Thread Matthew Talbert
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

2012-02-27 Thread Greg Hellings
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

2012-02-27 Thread Gary Holmlund

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