438 if (!strcmp(dstSys->getName(),
"KJVA") || !strcmp(dstSys->getName(),
"KJV"))
442 int b = dstSys->getBookNumberByOSISName(*book)-1;
448 for (
int i=0; i<(int)dstSys->p->mappingsExtraBooks.size(); ++i) {
450 if (!strcmp(*book, dstSys->p->mappingsExtraBooks[i])) {
451 b = (int)
p->
books.size()+i-2;
459 if (b >= (
int)dstSys->p->mappings.size() || b < 0) {
464 const unsigned char *a =
NULL;
467 for (
unsigned int i=0; i<dstSys->p->mappings[b].size(); ++i) {
468 const unsigned char *
m = dstSys->p->mappings[b][i];
470 if (m[0] != b+1)
continue;
472 if (m[4] == *chapter && m[5] <= *verse) {
474 if (m[5] == *verse || (m[6] >= *verse && m[5] <= *verse)) {
479 if (*m >= dstSys->p->books.size()) {
481 *book = dstSys->getBook(m[7]-1)->getOSISName();
486 if (a ==
NULL || (a[5]>a[6]?a[5]:a[6]) <= (m[5]>m[6]?m[5]:m[6]))
494 const int d = (a[3]>a[2]?a[3]:a[2])-(a[6]>a[5]?a[6]:a[5]);
495 if (*verse < *verse_end)
498 *verse_end = (*verse) + d;
500 if (*a > dstSys->p->books.size()) {
503 *book = dstSys->getBook(a[7]-1)->getOSISName();
509 else if (strcmp(dstSys->getName(),
"KJVA") && strcmp(dstSys->getName(),
"KJV")) {
511 const int src_verse = *verse;
515 int interm_verse = *verse, interm_range = *verse_end, interm_chapter = *chapter;
516 const char *interm_book = *book;
518 kjva->translateVerse(dstSys, book, chapter, verse, verse_end);
521 if (verse < verse_end && !(interm_verse < interm_range)) {
522 kjva->translateVerse(
this, &interm_book, &interm_chapter, &interm_verse, &interm_range);
523 if (interm_verse < interm_range) {
524 *verse += src_verse - interm_verse;
525 if (*verse > *verse_end)
538 for (
int i = (
int)
p->
mappings[b].size()-1; i>=0; --i) {
539 const unsigned char *m =
p->
mappings[b][i];
540 if (m[1] < *chapter) {
544 if (m[1] == *chapter && m[2] <= *verse) {
546 if (m[2] == *verse || (m[3] >= *verse && m[2] <= *verse)) {
554 const int d = (m[6]>m[5]?m[6]:m[5])-(m[3]>m[2]?m[3]:m[2]);
555 if (*verse < *verse_end)
558 *verse_end = (*verse) + d;
static SWLog * getSystemLog()
vector< mappingRule > mappings
void translateVerse(const System *dstSys, const char **book, int *chapter, int *verse, int *verse_end) const
int getBookNumberByOSISName(const char *bookName) const
const char * getName() const
void logWarning(const char *fmt,...) const
vector< const char * > mappingsExtraBooks
static VersificationMgr * getSystemVersificationMgr()
const System * getVersificationSystem(const char *name) const