示例#1
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;
}
示例#2
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;
}
示例#3
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;
}
示例#4
0
int main(int argc, char **argv) {
	SWMgr mymgr;

	RawText::createModule(".");
	RawText mod(".");

	VerseKey vk;
	vk.setIntros(true);
	vk.setAutoNormalize(false);
	vk.setPersist(true);
	mod.setKey(vk);

	vk.setVerse(0);
	vk.setChapter(0);
	vk.setBook(0);
	vk.setTestament(0);

	mod << "Module heading text";

	vk.setVerse(0);
	vk.setChapter(0);
	vk.setBook(0);
	vk.setTestament(1);

	mod << "OT heading text";

	vk.setTestament(1);
	vk.setBook(1);
	vk.setChapter(0);
	vk.setVerse(0);

	mod << "Gen heading text";

	vk.setTestament(1);
	vk.setBook(1);
	vk.setChapter(1);
	vk.setVerse(0);

	mod << "Gen 1 heading text";

	vk.setTestament(1);
	vk.setBook(1);
	vk.setChapter(1);
	vk.setVerse(1);

	mod << "Gen 1:1 text";

	
	vk.setTestament(0);
	vk.setBook(0);
	vk.setChapter(0);
	vk.setVerse(0);

	std::cout << "Module heading text ?= " << (const char*)mod << std::endl;

	vk.setTestament(1);
	vk.setBook(0);
	vk.setChapter(0);
	vk.setVerse(0);

	std::cout << "OT heading text ?= " << (const char*)mod << std::endl;

	vk.setTestament(1);
	vk.setBook(1);
	vk.setChapter(0);
	vk.setVerse(0);

	std::cout << "Gen heading text ?= " << (const char*)mod << std::endl;

	vk.setTestament(1);
	vk.setBook(1);
	vk.setChapter(1);
	vk.setVerse(0);

	std::cout << "Gen 1 heading text ?= " << (const char*)mod << std::endl;

	vk.setTestament(1);
	vk.setBook(1);
	vk.setChapter(1);
	vk.setVerse(1);

	std::cout << "Gen 1:1 text ?= " << (const char*)mod << std::endl;

	  /* old introtest
	SWModule *mhc = mymgr.Modules["MHC"];

	if (mhc) {
		VerseKey vk;
		vk.setIntros(true);
		vk.setAutoNormalize(false);
		vk.setPersist(true);
		vk = "jas 0:0";
		std::cout << vk << ":\n";
		mhc->setKey(vk);
		std::cout << (const char *) mhc->Key() << ":\n";
		std::cout << (const char *) *mhc << "\n";
	}
	  */
	return 0;
}