[sword-devel] BibleTime indexing problem

Troy A. Griffitts scribe at crosswire.org
Tue Feb 28 09:21:38 MST 2012


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
>> Talbert<ransom1982 at gmail.com> wrote:
>>> On Mon, Feb 27, 2012 at 11:05 PM, Gary
>>> Holmlund<gary.holmlund at 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 at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list