[sword-devel] osis2mod problem

Gregory Hellings greg.hellings at gmail.com
Tue Mar 17 12:59:30 MST 2009





On Mar 17, 2009, at 14:08, DM Smith <dmsmith at crosswire.org> wrote:

> Can someone help me fix a bug in osis2mod?
>
> The following code works in 1.5.11 to detect whether a verse is in  
> or out of the KJV v11n. This was present before my time, so I don't  
> know whether it was ever proper or whether it is expected to still  
> work.
>
> bool isKJVRef(const char *buf) {
>      VerseKey vk, test;
>      vk.AutoNormalize(0);
>      vk.Headings(1); // turn on mod/testmnt/book/chap headings
>      vk.Persist(1);
>       // lets do some tests on the verse --------------
>      vk = buf;
>      test = buf;      if (vk.Testament() && vk.Book() &&  
> vk.Chapter() && vk.Verse()) { // if we're not a heading
> #ifdef DEBUG
>              cout << (const char*)vk << " == "  << (const char*)test  
> << endl;
> #endif
>              return (vk == test);
>       }
>      else return true;       // no check if we're a heading...  
> Probably bad.
> }
>
> I've have changed it to use
>       VerseKey *vk = (VerseKey*) module->CreateKey();
> to create verse keys, but has the same problem.

I'm boy sure you specified exactly what the problem is. Perhaps  
VerseKey could be given the ability to throw an exception on an  
invalid key or have a Boolean test like isValid() or something like  
that to simplify this test for both you and other applications?

--Greg

>
>
> Thanks,
>   DM
>
>
>
> _______________________________________________
> 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