[sword-devel] BCV arithmetic problems
Karl Kleinpaste
karl at kleinpaste.org
Fri Dec 12 09:23:29 MST 2014
On 12/12/2014 10:56 AM, Troy A. Griffitts wrote:
> Could you try to run the sword/tests/versekeytest and have a look at
> the end of the output. There should be a test which tried to span the
> OT/NT which should output something like:
>
> Matthew.1.1-- = Malachi 4:6
> ++ = Matthew 1:1
OK, that's interesting, but maybe not sufficiently informative.
In Xiphos, I can forward/backward on navbar book, and it correctly
crosses between Mal.1.1 and Matt.1.1.
This is the end of versekeytest, which supports book forward/backward:
Mark.1.1-- = Matthew 28:20
++ = Mark 1:1
.setChapter(.getChapter() - 1) = Matthew 28:1
Matthew.1.1-- = Malachi 4:6
++ = Matthew 1:1
.setBook(.getBook() - 1) = Malachi 1:1
Now I see that it claims backing up one verse from Matt.1.1 should give
me Mal.4.6, but this is the Xiphos code using a freshly-obtained
VerseKey that's doing a navbar verse spin forward or backward (parameter
"direction" determines).
vkey->setAutoNormalize(1);
vkey->setText(tmpkey);
verse = vkey->getVerse() + (direction ? 1 : -1);
vkey->setVerse(verse);
In gdb, this is what happens:
194 vkey->setText(tmpkey);
(gdb) p tmpkey
$4 = 0x7b4aeb0 "Matt 1:1"
(gdb) n
196 verse = vkey->getVerse() + (direction ? 1 : -1);
(gdb) p verse
$5 = 0
(gdb)
197 vkey->setVerse(verse);
(gdb) n
199 tmpkey = g_strdup_printf("%s %d:%d", vkey->getBookName(),
(gdb)
200 vkey->getChapter(), vkey->getVerse());
(gdb)
201 gtk_entry_set_text(GTK_ENTRY(navbar.lookup_entry), tmpkey);
(gdb) p tmpkey
$6 = 0x63f81d0 "Zechariah 13:9"
This is mostly ancient code and I've never had reason to question it,
but the fact that vkey is set for auto-normalize makes me wonder: We've
taken "verse 1", decremented it, now 0, and then set that verse#. The
result is a scary traversal to Zech.13.9. A similar thing happens for
chapter spin (which lands in Zech.14.1), though book spin does the right
thing.
Suggestions welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20141212/82f00b3c/attachment.html>
More information about the sword-devel
mailing list