[sword-devel] linking / testsuite

DM Smith dmsmith at crosswire.org
Sun Apr 26 20:19:42 MST 2009


On Apr 26, 2009, at 10:57 PM, Troy A. Griffitts wrote:

> Top-posting due to lateness... :)
>
> DM,
>
> Nice find!  Glad you tracked it down.  Count() is specific to only  
> ListKey and provides the number of subkey elements contained.  This  
> has been optimized now and will only be > 1 if there is a non- 
> contiguous range, e.g. 'jn.1.1-6,8-10' (Count() == 2 // two VerseKey  
> subkeys with ranges set appropriately)
>
> Can you use the following?

Sure. But can you give me a comment that explains what it does? I've  
been away from c++ too long and it doesn't make sense. I always  
comment the non-obvious.
>
>
> if (verseKeys++ == verseKeys) { /* then I have a single key */ }
>
> Hope this can work.
>
> 	-Troy.
>
>
>
> DM Smith wrote:
>> I found the problem. SWORD reports the count of verses in a  
>> VerseList differently. A range now counts as one. It used to count  
>> as many verses as was in it.
>> Here is a demonstration of the problem that I quickly hacked  
>> together. (Troy, tell me which testcase file to put it in and I'll  
>> add it.) It should say (and used to say) that
>> "There are 5 verses that are in the range"
>> #include <iostream>
>> #include <swbuf.h>
>> #include <listkey.h>
>> #include <versekey.h>
>> #ifndef NO_SWORD_NAMESPACE
>> using namespace sword;
>> #endif
>> using namespace std;
>> int main(int argc, char **argv) {
>>        VerseKey currentVerse;
>>        SWBuf keyVal = "Matt.1.1-Matt.1.5";
>>        ListKey verseKeys = currentVerse.ParseVerseList(keyVal, "Gen. 
>> 1.1", true);
>>        int memberKeyCount = verseKeys.Count();
>>        if (memberKeyCount) {
>>                cout << "There are " << memberKeyCount << " verses  
>> that are in the range: " << keyVal << endl;
>>                for (verseKeys = TOP; !verseKeys.Error(); verseKeys++)
>>                {
>>                        cout << verseKeys << endl;
>>                }
>>        }
>>        else {
>>                cout << "Error: Invalid reference/annotateRef: " <<  
>> keyVal << endl;
>>        }
>> }
>>>
>>>
>>> I'll look into the testsuite.  FYI, a sample xml is:
>>>
>>>    <?xml version="1.0" encoding="UTF-8"?>
>>>    <osis
>>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>        xmlns="http://www.bibletechnologies.net/2003/OSIS/namespace"
>>>        xmlns:osis="http://www.bibletechnologies.net/2003/OSIS/namespace 
>>> "
>>>           xsi:schemaLocation="http://www.bibletechnologies.net/2003/OSIS/namespace
>>>    http://www.bibletechnologies.net/osisCore.2.1.1.xsd">
>>>        <osisText osisIDWork="Luther" osisRefWork="commentary"
>>>    xml:lang="en" canonical="false">
>>>            <header>
>>>                header.
>>>            </header>
>>>            <div type="bookGroup">
>>>                <title>New Testament</title>
>>>                <div type="book" osisID="Matt" canonical="false">
>>>                    <title type="main" short="Matthew">Matthew</ 
>>> title>
>>>                    <div type="section" annotateType="commentary"
>>>    annotateRef="Matt.1.1">
>>>                        <p>
>>>                        Blah blah...
>>>                        This is a test!
>>>                        </p>
>>>                    </div>                   <div type="section"  
>>> annotateType="commentary"
>>>    annotateRef="Matt.22.1-Matt.22.9">
>>>                <title level="2">Sermon; Matthew 21:1-9</title>
>>>                <p>
>>>                    This fails
>>>                </p>
>>>                </div>                   </div>
>>>            </div>
>>>        </osisText>
>>>    </osis>
>>>
>>>
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org <mailto:sword-devel at 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 at 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 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