示例#1
0
void parallelDisplay(vector<SWModule *>modules, const char *key) {

	// We'll use the first module's key as our master key to position all other modules.
	VerseKey *master = (VerseKey *)modules[0]->createKey();

	master->setText(key);
	int curVerse   = master->getVerse();
	int curChapter = master->getChapter();
	int curBook    = master->getBook();

	for (master->setVerse(1);	   (master->getBook()    == curBook)
					&& (master->getChapter() == curChapter)
					&& !master->popError();
										(*master)++) {

		cout << "<tr class=\"" << (master->getVerse() == curVerse ? "currentverse":"verse") << "\">";
		for (vector<SWModule *>::iterator module = modules.begin(); module != modules.end(); ++module) {
			(*module)->setKey(master);
			if (!(*module)->popError()) {
				cout << "<td>" << "<span class=\"versenum\">" << master->getVerse() << "</span> ";
				cout << (*module)->renderText() << "</td>";
			}
		}
		cout << "</tr>";
	}
	delete master;
}
示例#2
0
int main(int argc, char **argv)
{
	long pos, offset;
	int num1, num2, rangemax;
	char startflag = 0;
	short size;

	checkparams(argc, argv);

	openfiles(argv[1]);

	testmnt = key1.getTestament();
	num1 = key1.getChapter();
	num2 = key1.getVerse();
	pos  = 0;
	write(bfp, &pos, 4);  /* Book    offset for testament intros */
	pos = 4;
	write(cfp, &pos, 4);  /* Chapter offset for testament intro */


/*	Right now just zero out intros until parsing correctly */
	pos = 0;
	size = 0;
	write(vfp, &pos, 4);  /* Module intro */
	write(vfp, &size, 2);
	write(vfp, &pos, 4);  /* Testament intro */
	write(vfp, &size, 2);

	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
		if (!startflag) {
			startflag = 1;
		}
		else {
			if (num2 < key2.getVerse()) {            // new chapter
				if (num1 <= key2.getChapter()) { // new book
					key2.setVerse(1);
					key2.setChapter(1);
					key2.setBook(key2.getBook()+1);
				}
				printf("Found Chapter Break: %d ('%s')\n", num1, (const char *)key2);
				chapoffset = offset;
				chapsize = size;
//				continue;
			}
		}
		key2.setVerse(1);
		key2.setChapter(num1);
		key2.setVerse(num2);

		key3 = key2;
//		key3 += (rangemax - key3.getVerse());

		writeidx(key1, key2, key3, offset, size);
	}
	close(vfp);
	close(cfp);
	close(bfp);
	close(fp);
	return 0;
}
示例#3
0
int main(int argc, char **argv) {

	SWMgr library;
	SWModule *kjv = library.getModule((argc > 1)?argv[1]:"KJV");

	kjv->setKey(argc > 2 ? argv[2] : "Jn.3.16");

	VerseKey *key = (VerseKey *)kjv->getKey();

	int curVerse = key->getVerse();
	int curChapter = key->getChapter();
	int curBook = key->getBook();

	for (key->setVerse(1);
				(key->getBook()    == curBook)    &&
				(key->getChapter() == curChapter) &&
				!kjv->popError();
				(*kjv)++) {
		if (key->getVerse() == curVerse) cout << "* ";
		cout << key->getVerse() << " " << kjv->stripText() << "\n";
	}

	return 0;
}
示例#4
0
int main(int argc, char **argv) {

	cout << "\n";

	const char *modName = (argc > 1) ? argv[1] : "KJV";
	SWMgr manager;
	SWModule *bible = manager.getModule(modName);
	if (!bible) {
		cout << modName << " module is not installed.\nPlease install to show versification (v11n) from this specific Bible.\nShowing builtin KJV v11n scheme..\n\n";
	}

	VerseKey *vk = (bible) ? (VerseKey *)bible->getKey() : new VerseKey();

	for ((*vk) = TOP; !vk->popError(); vk->setBook(vk->getBook()+1)) {
		cout << vk->getBookName() << "\n";
	}

	// if we 'new'ed a VerseKey unassociated with a module, above, then we should delete it.
	if (!bible) delete vk;

	return 0;
}
示例#5
0
文件: keytest.cpp 项目: raphink/sword
int main(int argc, char **argv)
{
    int loop;
    int max;

    VerseKey yo("Gen.1.1", "Gen.1.2");
    std::cout << yo.getRangeText();
    if (argc > 1)
        LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(argv[1]);

    VerseKey	bla;
    long index;


    if (argc < 2)
        bla = "James    1:19";
    else	bla = argv[2];

    std::cout << "\n Headings: " << (bool)bla.isIntros() << "\n";
    std::cout << " (.Index(Index()+1))\n";

    max = (argc < 4) ? 10 : atoi(argv[3]);

    for (loop = 0; loop < max; loop++) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")";
        bla.setIndex(index+1);
        std::cout << "-> " << (const char *)bla << "\n";
    }

    std::cout << "-----------------\n";
    std::cout << "\n (.Index(Index()-1))\n";
    if (argc < 2)
        bla = "James    1:19";
    else	bla = argv[2];

    for (loop = max; loop; loop--) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")";
        bla.setIndex(index-1);
        std::cout << "-> " << (const char *)bla << "\n";
    }

    std::cout << "-----------------\n";
    bla.setIntros(true);
    std::cout << "\n Headings: " << (bool)bla.isIntros() << "\n";
    std::cout << " key++\n";

    if (argc < 2)
        bla = "Matthew  1:5";
    else	bla = argv[2];

    for (loop = 0; loop < max && !bla.popError(); loop++,bla++) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";
    bla.setIntros(true);
    std::cout << "\n Headings: " << (bool)bla.isIntros() << "\n";
    std::cout << " key--\n";

    if (argc < 2)
        bla = "Matthew  1:5";
    else	bla = argv[2];

    for (loop = max; loop && !bla.popError(); loop--, bla--) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";

    if (argc < 2)
        bla = "Genesis  1:5";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla--) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";

    if (argc < 2)
        bla = "Malachi  4:2";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla++) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";

    if (argc < 2)
        bla = "Revelation of John  22:17";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla++) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }


    std::cout << "-----------------\n";
    std::cout << "-------- Headings ---------\n";

    bla.setIntros(true);

    if (argc < 2)
        bla = "Matthew  1:5";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla--) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";

    if (argc < 2)
        bla = "Genesis  1:5";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla--) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";

    if (argc < 2)
        bla = "Malachi  4:2";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla++) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "-----------------\n";

    if (argc < 2)
        bla = "Revelation of John  22:17";
    else	bla = argv[2];

    for (loop = max; loop; loop--, bla++) {
        index = bla.getIndex();
        std::cout << (const char *)bla << "(" << index << ")\n";
    }

    std::cout << "\n\n";

    std::cout << "-------- Error Check ------------\n\n";
    bla = "Revelation of John 23:19";
    std::cout << "bla = \"Revelation of John 23:19\"\n";
    std::cout << "(const char *)bla = " << (const char *)bla << "\n";
    std::cout << "bla.popError() = " << (int)bla.popError() << " \n";
    std::cout << "bla++ \n";
    bla++;
    std::cout << "bla.popError() = " << (int)bla.popError() << " \n";

    bla.setIntros(false);
    for (bla = BOTTOM; !bla.popError(); bla.setBook(bla.getBook()-1))
        std::cout << (const char *)bla << "\n";
    bla.setTestament(1);
    bla = BOTTOM;
    std::cout << bla.getTestamentIndex() << "\n";
    std::cout << bla.getIndex() << "\n";
    std::cout << bla << "\n";
    bla.setTestament(2);
    bla = BOTTOM;
    std::cout << bla.getTestamentIndex() << "\n";
    std::cout << bla.getIndex() << "\n";
    std::cout << bla << "\n";
    return 0;
}