<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Greg,<br>
<br>
In your test, on like 19, you turn off auto normalization. This
means SWORD won't mess with the values you set for the components
of a verse. If you setText("Gen.1.1"); setChapter(999);
setVerse(9999); and print, you should get "Genesis 999:9999". If
you want normalization, then you need to remove the line in your
test which says key->setAutoNormalize(0);<br>
<br>
There is a good encapsulation of how I expect normalization to
work in the test suite. The specific test is:<br>
<br>
<a class="moz-txt-link-freetext" href="http://crosswire.org/svn/sword/trunk/tests/versekeytest.cpp">http://crosswire.org/svn/sword/trunk/tests/versekeytest.cpp</a><br>
<br>
And the expected output is:<br>
<br>
<a class="moz-txt-link-freetext" href="http://crosswire.org/svn/sword/trunk/tests/testsuite/versekeytest.good">http://crosswire.org/svn/sword/trunk/tests/testsuite/versekeytest.good</a><br>
<br>
(the labels in that test still use the old terminology of
'headings', but this is really 'intros')<br>
<br>
<br>
<br>
On 03/22/2013 02:02 AM, Greg Hellings wrote:<br>
</div>
<blockquote
cite="mid:CAHxvOVK0Y0GvP+HaEte+GnyQHAHab47QGLSp7jS7iWg23ByAng@mail.gmail.com"
type="cite">
<div dir="ltr">Test code: <a moz-do-not-send="true"
href="https://gist.github.com/greg-hellings/5218094">https://gist.github.com/greg-hellings/5218094</a>
<div><br>
</div>
<div style="">Output with your current patch, Troy, is $ g++
`pkg-config --cflags sword` `pkg-config --libs sword` test.cpp
-o test && ./test</div>
<div><font face="courier new, monospace">intro: 0</font></div>
<div><font face="courier new, monospace">bk (1): 1</font></div>
<div><font face="courier new, monospace">ch (1): 1</font></div>
<div><font face="courier new, monospace">vs (1): 1</font></div>
<div><font face="courier new, monospace">-----------------</font></div>
<div><font face="courier new, monospace">intro: 0</font></div>
<div><font face="courier new, monospace">bk (1): 0</font></div>
<div><font face="courier new, monospace">ch (1): 0</font></div>
<div><font face="courier new, monospace">vs (1): 0</font></div>
<div><font face="courier new, monospace">-----------------</font></div>
<div><font face="courier new, monospace">intro: 1</font></div>
<div><font face="courier new, monospace">bk (0): 0</font></div>
<div><font face="courier new, monospace">ch (0): 0</font></div>
<div><font face="courier new, monospace">vs (0): 0</font></div>
<div><font face="courier new, monospace">-----------------</font></div>
<div><br>
</div>
<div style="">
The value in parenthsis represents what I thought the value
"should" be. If I comment out line 19, I get this result $ g++
`pkg-config --cflags sword` `pkg-config --libs sword` test.cpp
-o test && ./test</div>
<div><font face="courier new, monospace">intro: 0</font></div>
<div><font face="courier new, monospace">bk (1): 1</font></div>
<div><font face="courier new, monospace">ch (1): 1</font></div>
<div><font face="courier new, monospace">vs (1): 1</font></div>
<div><font face="courier new, monospace">-----------------</font></div>
<div><font face="courier new, monospace">intro: 0</font></div>
<div><font face="courier new, monospace">bk (1): 1</font></div>
<div><font face="courier new, monospace">ch (1): 1</font></div>
<div><font face="courier new, monospace">vs (1): 1</font></div>
<div><font face="courier new, monospace">-----------------</font></div>
<div><font face="courier new, monospace">intro: 1</font></div>
<div><font face="courier new, monospace">bk (0): 0</font></div>
<div><font face="courier new, monospace">ch (0): 0</font></div>
<div><font face="courier new, monospace">vs (0): 0</font></div>
<div><font face="courier new, monospace">-----------------</font></div>
<div><br>
</div>
<div style="">
which matches the expected results. So Xiphos is getting
around calling setIntros(1) by instead disabling
auto-normalizing. It's odd to me that you can set a key to a
value in the intros while setIntros is false. That doesn't
seem like normalizing to me, that seems more like bounds
checking, but that's not necessarily a bug in the API,
possibly it's a bug in my understanding of intended behavior.</div>
<div style=""><br>
</div>
<div style="">Troy's fix along with shuffling the location of
setTestament (a change I made earlier to Xiphos' Subversion)
fixes the known bugs I've seen in Xiphos regarding chapters
not rendering and Genesis 1:1 causing a SegFault.</div>
<div style=""><br>
</div>
<div style="">--Greg</div>
<div style=""><br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Mar 21, 2013 at 6:51 PM, Greg
Hellings <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:greg.hellings@gmail.com" target="_blank">greg.hellings@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div class="im">On Thu, Mar 21, 2013 at 6:26 PM, Troy
A. Griffitts <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:scribe@crosswire.org"
target="_blank">scribe@crosswire.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>Thanks Karl, <br>
<br>
Yes, each snippet was helpful. Nic's was a
quick test which caused the bug and was easy
to use for testing. Greg's snippet wasn't as
helpful as all his comments and stack traces
leading up to his patch. He is preventing book
from getting to 0 which does alleviate the
problem but also stops a book from becoming an
intro. Hope that explains.<br>
</div>
</div>
</blockquote>
<div><br>
</div>
</div>
<div>If the conditional in my code is changed to </div>
<div><br>
</div>
<div>if (book > (intros?0:1) ) {</div>
<div><br>
</div>
<div>Then my code corrects the problem that -- was
moving a VerseKey from Genesis 1:1 to [Testament 1
Intro] when intros is false. While not a SegFault
producing bug, this is still a bug. Similar checks
should be made through the same run of code to
ensure moving to verse 0 and chapter 0 are not
possible when intros is false. Both your fix and an
adapted form of mine should be introduced.
Additionally, the issue with OSISFootnotes should
probably be fixed.</div>
<div><br>
</div>
<div>I will write up a simple test case for that, if
it helps, once I get back to my development machine.</div>
<span class="HOEnZb"><font color="#888888">
<div><br>
</div>
<div>--Greg</div>
<div> </div>
</font></span>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
<div>
<div>
<br>
Troy <br>
<br>
<div class="gmail_quote">Karl Kleinpaste <<a
moz-do-not-send="true"
href="mailto:karl@kleinpaste.org"
target="_blank">karl@kleinpaste.org</a>>
wrote:
<blockquote class="gmail_quote"
style="margin:0pt 0pt 0pt
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<pre style="white-space:pre-wrap;word-wrap:break-word;font-family:sans-serif;margin-top:0px"><div>You didn't also need this snippet from Greg a couple days ago?
--- src/keys/versekey.cpp (revision 2792)
+++ src/keys/versekey.cpp (working copy)
@@ -1347,7 +1347,9 @@
}
if (verse < (intros?0:1)) {
if (--chapter < (intros?0:1)) {
- --book;
+ if (book > 1) {
+ --book;
+ }
chapter += (getChapterMax() + (intros?1:0));
}
verse += (getVerseMax() + (intros?1:0));
<hr>
</div><div>sword-devel mailing list: <a moz-do-not-send="true" href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a>
<a moz-do-not-send="true" href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page
</div></pre>
</blockquote>
</div>
<br>
<div>
-- <br>
Sent from my Android phone with K-9 Mail.
Please excuse my brevity.</div>
</div>
</div>
<br>
</div>
_______________________________________________
<div class="im"><br>
sword-devel mailing list: <a
moz-do-not-send="true"
href="mailto:sword-devel@crosswire.org"
target="_blank">sword-devel@crosswire.org</a><br>
<a moz-do-not-send="true"
href="http://www.crosswire.org/mailman/listinfo/sword-devel"
target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings
at above page<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
</body>
</html>