[sword-svn] r2324 - in trunk: bindings bindings/corba/orbitcpp include lib/bcppmake src/keys src/modules src/modules/comments src/modules/comments/hrefcom src/modules/comments/rawcom src/modules/comments/rawcom4 src/modules/comments/rawfiles src/modules/comments/zcom src/modules/common src/modules/filters src/modules/texts src/modules/texts/rawtext src/modules/texts/rawtext4 src/modules/texts/ztext utilities utilities/diatheke

scribe at crosswire.org scribe at crosswire.org
Mon Apr 20 11:40:15 MST 2009


Author: scribe
Date: 2009-04-20 11:40:15 -0700 (Mon, 20 Apr 2009)
New Revision: 2324

Removed:
   trunk/include/osisbook.h
   trunk/utilities/mod2zmod2.cpp
   trunk/utilities/vpl2zmod2.cpp
Modified:
   trunk/bindings/corba/orbitcpp/swordorb-impl.cpp
   trunk/bindings/flatapi.cpp
   trunk/include/flatapi.h
   trunk/include/swcom.h
   trunk/include/swkey.h
   trunk/include/swtext.h
   trunk/include/versekey.h
   trunk/lib/bcppmake/libsword.bpr
   trunk/src/keys/versekey.cpp
   trunk/src/modules/comments/hrefcom/hrefcom.cpp
   trunk/src/modules/comments/rawcom/rawcom.cpp
   trunk/src/modules/comments/rawcom4/rawcom4.cpp
   trunk/src/modules/comments/rawfiles/rawfiles.cpp
   trunk/src/modules/comments/swcom.cpp
   trunk/src/modules/comments/zcom/zcom.cpp
   trunk/src/modules/common/rawverse.cpp
   trunk/src/modules/common/rawverse4.cpp
   trunk/src/modules/filters/gbffootnotes.cpp
   trunk/src/modules/filters/gbfosis.cpp
   trunk/src/modules/filters/osisfootnotes.cpp
   trunk/src/modules/filters/osisosis.cpp
   trunk/src/modules/filters/thmlfootnotes.cpp
   trunk/src/modules/filters/thmlosis.cpp
   trunk/src/modules/filters/thmlscripref.cpp
   trunk/src/modules/swmodule.cpp
   trunk/src/modules/texts/rawtext/rawtext.cpp
   trunk/src/modules/texts/rawtext4/rawtext4.cpp
   trunk/src/modules/texts/swtext.cpp
   trunk/src/modules/texts/ztext/ztext.cpp
   trunk/utilities/diatheke/corediatheke.cpp
   trunk/utilities/mkfastmod.cpp
   trunk/utilities/mod2osis.cpp
   trunk/utilities/osis2mod.cpp
   trunk/utilities/vpl2mod.cpp
Log:
Pushed VerseKey::positionFrom down to SWKey::positionFrom
modified SWKey::operator = to call positionFrom
Removed some standalone VerseKey logic making more v11n aware.
Cleaned up some extraneous files.

Modified: trunk/bindings/corba/orbitcpp/swordorb-impl.cpp
===================================================================
--- trunk/bindings/corba/orbitcpp/swordorb-impl.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/bindings/corba/orbitcpp/swordorb-impl.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -172,7 +172,6 @@
 SearchHitList *SWModule_impl::search(const char *istr, SearchType searchType, CORBA::Long flags, const char *scope) throw(CORBA::SystemException) {
 	int stype = 2;
 	sword::ListKey lscope;
-	sword::VerseKey parser;
 	if (searchType == REGEX) stype = 0;
 	if (searchType == PHRASE) stype = -1;
 	if (searchType == MULTIWORD) stype = -2;
@@ -181,8 +180,16 @@
 	sword::ListKey result;
 
 	if ((scope) && (strlen(scope)) > 0) {
-		lscope = parser.ParseVerseList(scope, parser, true);
+		sword::SWKey *p = delegate->CreateKey();
+        	sword::VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+	        if (!parser) {
+        		delete p;
+	                parser = new VerseKey();
+	        }
+	        *parser = delegate->getKeyText();
+		lscope = parser->ParseVerseList(scope, *parser, true);
 		result = delegate->Search(istr, stype, flags, &lscope);
+                delete parser;
 	}
 	else	result = delegate->Search(istr, stype, flags);
 

Modified: trunk/bindings/flatapi.cpp
===================================================================
--- trunk/bindings/flatapi.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/bindings/flatapi.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -319,8 +319,9 @@
 
 
 
-SWHANDLE listkey_getVerselistIterator(const char * list, const char * key) {
+SWHANDLE listkey_getVerselistIterator(const char *list, const char *key, const char *v11n) {
 	VerseKey versekey;
+        versekey.setVersification(v11n);
 	static ListKey verses;
 	
 	versekey.setText(key);

Modified: trunk/include/flatapi.h
===================================================================
--- trunk/include/flatapi.h	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/include/flatapi.h	2009-04-20 18:40:15 UTC (rev 2324)
@@ -97,7 +97,7 @@
 const char * SWDLLEXPORT SWModule_getFootnoteBody(SWHANDLE hmodule, const char *key, const char *note);
 const char * SWDLLEXPORT SWModule_getFootnoteRefList(SWHANDLE hmodule, const char *key, const char *note);
 
-SWHANDLE SWDLLEXPORT listkey_getVerselistIterator(const char * list, const char * key);
+SWHANDLE SWDLLEXPORT listkey_getVerselistIterator(const char *list, const char *key, const char *v11n = "KJV");
 
 }
 #ifdef __cplusplus

Deleted: trunk/include/osisbook.h
===================================================================
--- trunk/include/osisbook.h	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/include/osisbook.h	2009-04-20 18:40:15 UTC (rev 2324)
@@ -1,640 +0,0 @@
-/******************************************************************************
- * osisbook.h - Canonical text information to be included by VerseKey2.cpp
- *
- * $Id$
- *
- * Copyright 2004 CrossWire Bible Society (http://www.crosswire.org)
- *	CrossWire Bible Society
- *	P. O. Box 2528
- *	Tempe, AZ  85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- */
-
-/******************************************************************************
- * [on]tbooks - initialize static instance for all canonical text names
- *		and chapmax
- *	taken from http://whi.wts.edu/OSIS/Projects/Markup/specs/BibleBookNames.html
- */
-
-#define TESTAMENT_HEADING 255
-//#define NTOFFSET 24115  //24115 is offset to start of NT
-#if 0
-#define OSISBMAX 68
-#endif
-#define BUILTINABBREVCNT 195
- 
-struct sbook2 VerseKey2::osisbooks[] = {
-//Module Heading
-{"Module Heading", "ZZZ"},//0
-//Old Testament
-{"Old Testament", "OT"},//1
-{"Genesis", "Gen"},
-{"Exodus", "Exod"},
-{"Leviticus", "Lev"},
-{"Numbers", "Num"},
-{"Deuteronomy", "Deut"},
-{"Joshua", "Josh"},
-{"Judges", "Judg"},
-{"Ruth", "Ruth"},
-{"1 Samuel", "1Sam"},//10
-{"2 Samuel", "2Sam"},
-{"1 Kings", "1Kgs"},
-{"2 Kings", "2Kgs"},
-{"1 Chronicles", "1Chr"},
-{"2 Chronicles", "2Chr"},
-{"Ezra", "Ezra"},
-{"Nehemiah", "Neh"},
-{"Esther", "Esth"},
-{"Job", "Job"},
-{"Psalms", "Ps"},//20
-{"Proverbs", "Prov"},
-{"Ecclesiastes", "Eccl"},		// 	Qohelot
-{"Song of Solomon", "Song"}, 	// 	Canticle of Canticles
-{"Isaiah", "Isa"},
-{"Jeremiah", "Jer"},
-{"Lamentations", "Lam"},
-{"Ezekiel", "Ezek"},
-{"Daniel", "Dan"},
-{"Hosea", "Hos"},
-{"Joel", "Joel"},//30
-{"Amos", "Amos"},
-{"Obadiah", "Obad"},
-{"Jonah", "Jonah"},
-{"Micah", "Mic"},
-{"Nahum", "Nah"},
-{"Habakkuk", "Hab"},
-{"Zephaniah", "Zeph"},
-{"Haggai", "Hag"},
-{"Zechariah", "Zech"},
-{"Malachi", "Mal"},//40
-
-//Roman Catholic Deuterocanon
-{"Deuterocanon", "DC"},//41
-{"Tobit", "Tob"},//(70)
-{"Judith", "Jdt"},
-{"Wisdom", "Wis"},			// 		Wisdom of Solomon
-{"Sirach", "Sir"},			//  	Ecclesiasticus
-{"Baruch", "Bar"},			//  	1 Baruch
-{"Letter of Jeremiah", "EpJer"},//(75)
-{"1 Esdras", "1Esd"},		//  	3Ezra 	Esdras A
-{"2 Esdras", "2Esd"},		// 		4Ezra 	Esdras B
-{"1 Maccabees", "1Macc"},//(78)50
-{"2 Maccabees", "2Macc"},//51
- 
- 
-//Septuagint
-{"3 Maccabees", "3Macc"},//(80)52
-{"4 Maccabees", "4Macc"},
-{"Odes of Solomon", "OdesSol"},
-{"Psalms of Solomon", "PssSol"},//55
- 
- 
-//Vulgate
-{"Epistle to the Laodiceans", "EpLao"},//(84)56
- 
- 
-//Orthodox Canon
-{"1 Enoch", "1En"},//(85)57		// 	Ethiopic Apocalypse of Enoch
-{"Jubilees", "Jub"},//(86)58
- 
- 
-//Protestant Apocrypha
-{"Apocrypha", "Apoc"},//(87)59
-{"Additions to Esther", "AddEsth"},
-{"Prayer of Azariah", "PrAzar"},	// 	Song of the Three Children
-{"Susanna", "Sus"},//(90)
-{"Bel and the Dragon", "Bel"},
-{"Prayer of Manasses", "PrMan"},
-{"Psalm 151", "Ps151"},//(93)65
- 
- 
-//New Testament
-{"New Testament", "NT"},//66
-{"Matthew", "Matt"},
-{"Mark", "Mark"},
-{"Luke", "Luke"},
-{"John", "John"},//70
-{"Acts", "Acts"},
-{"Romans", "Rom"},
-{"1 Corinthians", "1Cor"},
-{"2 Corinthians", "2Cor"},
-{"Galatians", "Gal"},//(50)
-{"Ephesians", "Eph"},
-{"Philippians", "Phil"},
-{"Colossians", "Col"},
-{"1 Thessalonians", "1Thess"},
-{"2 Thessalonians", "2Thess"},//80
-{"1 Timothy", "1Tim"},
-{"2 Timothy", "2Tim"},
-{"Titus", "Titus"},
-{"Philemon", "Phlm"},
-{"Hebrews", "Heb"},//(60)
-{"James", "Jas"},
-{"1 Peter", "1Pet"},
-{"2 Peter", "2Pet"},
-{"1 John", "1John"},
-{"2 John", "2John"},//90
-{"3 John", "3John"},
-{"Jude", "Jude"},
-{"Revelation", "Rev"}//(68)93
- 
-
-};
-
-/* the en abbrevs will be in a conf file as well
-*/
-
-/*
-const struct abbrev2
-  VerseKey2::builtin_abbrevs[] = {
-  {"1 C", 48},			//   1 Corinthians
-  {"1 CHRONICLES", 14},		//   1 Chronicles
-  {"1 CORINTHIANS", 48},	//   1 Corinthians
-  {"1 JN", 64},			//    1 John
-  {"1 JOHN", 64},		//    1 John
-  {"1 KGS", 12},		//    1 Kings
-  {"1 KINGS", 12},		//    1 Kings
-  {"1 PETER", 62},		//    1 Peter
-  {"1 PTR", 62},		//    1 Peter
-  {"1 SAMUEL", 10},		//    1 Samuel
-  {"1 THESSALONIANS", 54},	//   1 Thessalonians
-  {"1 TIMOTHY", 56},		//   1 Timothy
-  {"1C", 48},			//   1 Corinthians
-  {"1CHRONICLES", 14},		//   1 Chronicles
-  {"1CORINTHIANS", 48},		//   1 Corinthians
-  {"1JN", 64},			//    1 John       
-  {"1JOHN", 64},		//    1 John
-  {"1KGS", 12},			// 1 Kings
-  {"1KINGS", 12},		//    1 Kings
-  {"1PETER", 62},		//    1 Peter
-  {"1PTR", 62},			//    1 Peter
-  {"1SAMUEL", 10},		//    1 Samuel
-  {"1THESSALONIANS", 54},	//   1 Thessalonians
-  {"1TIMOTHY", 56},		//   1 Timothy
-  {"2 C", 49},			//   2 Corinthians
-  {"2 CHRONICLES", 15},		//   2 Chronicles
-  {"2 CORINTHIANS", 49},	//   2 Corinthians
-  {"2 JN", 65},			//    2 John
-  {"2 JOHN", 65},		//    2 John
-  {"2 KGS", 13},		//    2 Kings
-  {"2 KINGS", 13},		//    2 Kings
-  {"2 PETER", 63},		//    2 Peter
-  {"2 PTR", 63},		//    2 Peter
-  {"2 SAMUEL", 11},		//    2 Samuel
-  {"2 THESSALONIANS", 55},	//   2 Thessalonians
-  {"2 TIMOTHY", 57},		//   2 Timothy
-  {"2C", 49},			//   2 Corinthians
-  {"2CHRONICLES", 15},		//   2 Chronicles
-  {"2CORINTHIANS", 49},		//   2 Corinthians
-  {"2JN", 65},			//    2 John    
-  {"2JOHN", 65},		//    2 John
-  {"2KGS", 13},			// 2 Kings
-  {"2KINGS", 13},		//    2 Kings
-  {"2PETER", 63},		//    2 Peter
-  {"2PTR", 63},			//    2 Peter
-  {"2SAMUEL", 11},		//    2 Samuel
-  {"2THESSALONIANS", 55},	//   2 Thessalonians
-  {"2TIMOTHY", 57},		//   2 Timothy
-  {"3 JN", 66},			//    3 John
-  {"3 JOHN", 66},		//    3 John
-  {"3JN", 66},			//    3 John
-  {"3JOHN", 66},		//    3 John
-  {"ACTS", 46},			//     Acts
-  {"AMOS", 31},			//    Amos
-  {"APOCALYPSE OF ST. JOHN", 68},	//    Apocalypse of St. John (Rev.)
-  {"C", 53},			//    Colossians
-  {"CANTICLE OF CANTICLES", 23},	//    Canticle of Canticles (Song of S.)
-  {"COLOSSIANS", 53},		//    Colossians
-  {"D", 6},			//     Deuteronomy
-  {"DANIEL", 28},		//    Daniel
-  {"DEUTERONOMY", 6},		//    Deuteronomy
-  {"E", 51},			//     Ephesians
-  {"ECCLESIASTES", 22},		//    Ecclesiastes
-  {"EPHESIANS", 51},		//    Ephesians
-  {"ESTER", 18},		//    Esther
-  {"ESTHER", 18},		//    Esther
-  {"EXODUS", 3},		//    Exodus
-  {"EZEKIEL", 27},		//   Ezekiel
-  {"EZK", 27},		//   Ezekiel
-  {"EZRA", 16},			//   Ezra
-  {"G", 2},			//     Genesis
-  {"GALATIANS", 50},		//    Galatians
-  {"GENESIS", 2},		//    Genesis
-  {"H", 60},			//     Hebrews
-  {"HABAKKUK", 36},		//    Habakkuk
-  {"HAGGAI", 38},		//   Haggai
-  {"HEBREWS", 60},		//    Hebrews
-  {"HOSEA", 29},		//    Hosea
-  {"I C", 48},			//   1 Corinthians
-  {"I CHRONICLES", 14},		//   1 Chronicles
-  {"I CORINTHIANS", 48},	//   1 Corinthians
-  {"I JN", 64},			//    1 John
-  {"I JOHN", 64},		//    1 John
-  {"I KGS", 12},		// 1 Kings
-  {"I KINGS", 12},		//    1 Kings
-  {"I PETER", 62},		//    1 Peter
-  {"I PTR", 62},		//    1 Peter
-  {"I SAMUEL", 10},		//    1 Samuel
-  {"I THESSALONIANS", 54},	//   1 Thessalonians
-  {"I TIMOTHY", 56},		//   1 Timothy
-  {"IC", 48},			//   1 Corinthians
-  {"ICHRONICLES", 14},		//   1 Chronicles
-  {"ICORINTHIANS", 48},		//   1 Corinthians
-  {"II C", 49},			//   2 Corinthians
-  {"II CHRONICLES", 15},	//   2 Chronicles
-  {"II CORINTHIANS", 49},	//   2 Corinthians
-  {"II JN", 65},		//    2 John  
-  {"II JOHN", 65},		//    2 John
-  {"II KGS", 13},		// 2 Kings
-  {"II KINGS", 13},		//    2 Kings
-  {"II PETER", 63},		//    2 Peter
-  {"II PTR", 63},		//    2 Peter
-  {"II SAMUEL", 11},		//    2 Samuel
-  {"II THESSALONIANS", 55},	//   2 Thessalonians
-  {"II TIMOTHY", 57},		//   2 Timothy
-  {"IIC", 49},			//   2 Corinthians
-  {"IICHRONICLES", 15},		//   2 Chronicles
-  {"IICORINTHIANS", 49},	//   2 Corinthians
-  {"III JN", 66},		//    3 John 
-  {"III JOHN", 66},		//    3 John
-  {"IIIJN", 66},		//    3 John
-  {"IIIJOHN", 66},		//    3 John
-  {"IIJN", 65},			//    2 John
-  {"IIJOHN", 65},		//    2 John
-  {"IIKGS", 13},		// 2 Kings
-  {"IIKINGS", 13},		//    2 Kings
-  {"IIPETER", 63},		//    2 Peter
-  {"IIPTR", 63},		//    2 Peter
-  {"IISAMUEL", 11},		//    2 Samuel
-  {"IITHESSALONIANS", 55},	//   2 Thessalonians
-  {"IITIMOTHY", 55},		//   2 Timothy
-  {"IJN", 64},			//    1 John
-  {"IJOHN", 64},		//    1 John
-  {"IKGS", 12},			// 1 Kings
-  {"IKINGS", 12},		//    1 Kings
-  {"IPETER", 62},		//    1 Peter
-  {"IPTR", 62},			//    1 Peter
-  {"ISA", 24},			//     Isaiah
-  {"ISAIAH", 24},		//     Isaiah
-  {"ISAMUEL", 10},		//    1 Samuel
-  {"ITHESSALONIANS", 54},	//   1 Thessalonians
-  {"ITIMOTHY", 56},		//   1 Timothy
-  {"J", 45},			//     John
-  {"JAMES", 61},		//    James
-  {"JAS", 61},			//    James
-  {"JDGS", 8},		//  Judges
-  {"JEREMIAH", 25},		//    Jeremiah
-  {"JHN", 45},			//    John
-  {"JN", 45},			//    John
-  {"JO", 45},			//    John
-  {"JOB", 19},			//   Job
-  {"JOEL", 30},			//   Joel
-  {"JOHN", 45},			//   John
-  {"JOL", 30},			//   Joel
-  {"JONAH", 33},		//   Jonah
-  {"JOSHUA", 7},		//   Joshua
-  {"JUDE", 67},			//  Jude
-  {"JUDGES", 8},		//  Judges
-  {"L", 44},			//     Luke
-  {"LAMENTATIONS", 26},		//    Lamentations
-  {"LEVITICUS", 4},		//    Leviticus
-  {"LK", 44},			//    Luke
-  {"LUKE", 44},			//    Luke
-  {"MA", 42},			//    Matthew
-  {"MALACHI", 40},		//   Malachi
-  {"MARK", 43},			//   Mark
-  {"MATTHEW", 42},		//   Matthew
-  {"MICAH", 34},		//    Micah
-  {"MODULE HEADING", 0},		//   Module Heading
-  {"MK", 43},			//    Mark
-  {"MRK", 43},			//    Mark
-  {"MT", 42},			//    Matthew
-  {"N", 5},			//     Numbers
-  {"NAHUM", 35},		//    Nahum
-  {"NAM", 35},		//    Nahum
-  {"NEHEMIAH", 17},		//    Nehemiah
-  {"NEW TESTAMENT", 41},		//     New Testament
-  {"NUMBERS", 5},		//    Numbers
-  {"OBADIAH", 32},		//     Obadiah
-  {"OLD TESTAMENT", 1},		//     Old Testament
-  {"P", 20},			//     Psalms
-  {"PHIL", 52},			//    Philippians
-  {"PHILEMON", 59},		// Philemon
-  {"PHILIPPIANS", 52},		// Philippians
-  {"PHLM", 59},		// Philemon
-  {"PHM", 59},			//   Philemon
-  {"PHP", 52},			//   Philippians
-  {"PR", 21},		//    Proverbs
-  {"PROVERBS", 21},		//    Proverbs
-  {"PSA", 20},		//    Psalms
-  {"PSALMS", 20},		//    Psalms
-  {"PSM", 20},			// Psalms
-  {"PSS", 20},			// Psalms
-  {"QOHELETH", 22},              // Qohelet (Ecclesiastes)
-  {"REVELATION OF JOHN", 68},	//     Revelation
-  {"ROMANS", 47},		//    Romans
-  {"RUTH", 9},			//    Ruth
-  {"SNG", 23},	//     Song of Solomon
-  {"SOLOMON", 23},	//     Song of Solomon
-  {"SONG OF SOLOMON", 23},	//     Song of Solomon
-  {"SONG OF SONGS", 23},	//     Song of Solomon
-  {"SOS", 23},			//     Song of Solomon
-  {"TITUS", 58},		//     Titus
-  {"ZECHARIAH", 39},		//   Zechariah
-  {"ZEPHANIAH", 37},		//   Zephaniah
-  {"", -1}
-};
-*/
-
-/* includes all osis books - use the locale osis.conf instead
-const struct abbrev
-  VerseKey2::builtin_abbrevs[] = {
-  {"1 C", 46},			//   1 Corinthians
-  {"1 CHRONICLES", 13},		//   1 Chronicles
-  {"1 CORINTHIANS", 47},	//   1 Corinthians
-  {"1 ENOCH", 84},
-  {"1 ESDRAS", 75},
-  {"1 JN", 63},			//    1 John
-  {"1 JOHN", 63},		//    1 John
-  {"1 KGS", 11},		//    1 Kings
-  {"1 KINGS", 11},		//    1 Kings
-  {"1 MACCABEES", 77},
-  {"1 PETER", 61},		//    1 Peter
-  {"1 PTR", 61},		//    1 Peter
-  {"1 SAMUEL", 9},		//    1 Samuel
-  {"1 THESSALONIANS", 53},	//   1 Thessalonians
-  {"1 TIMOTHY", 55},		//   1 Timothy
-  {"1C", 47},			//   1 Corinthians
-  {"1CHRONICLES", 13},		//   1 Chronicles
-  {"1CORINTHIANS", 47},		//   1 Corinthians
-  {"1ENOCH", 84},
-  {"1ESDRAS", 75},
-  {"1JN", 63},			//    1 John       
-  {"1JOHN", 63},		//    1 John
-  {"1KGS", 11},			// 1 Kings
-  {"1KINGS", 11},		//    1 Kings
-  {"1MACCABEES", 77},
-  {"1PETER", 61},		//    1 Peter
-  {"1PTR", 61},			//    1 Peter
-  {"1SAMUEL", 9},		//    1 Samuel
-  {"1THESSALONIANS", 53},	//   1 Thessalonians
-  {"1TIMOTHY", 55},		//   1 Timothy
-  {"2 C", 48},			//   2 Corinthians
-  {"2 CHRONICLES", 14},		//   2 Chronicles
-  {"2 CORINTHIANS", 48},	//   2 Corinthians
-  {"2 ESDRAS", 76},
-  {"2 JN", 64},			//    2 John
-  {"2 JOHN", 64},		//    2 John
-  {"2 KGS", 12},		//    2 Kings
-  {"2 KINGS", 12},		//    2 Kings
-  {"2 MACCABEES", 78},
-  {"2 PETER", 62},		//    2 Peter
-  {"2 PTR", 62},		//    2 Peter
-  {"2 SAMUEL", 10},		//    2 Samuel
-  {"2 THESSALONIANS", 54},	//   2 Thessalonians
-  {"2 TIMOTHY", 56},		//   2 Timothy
-  {"2C", 48},			//   2 Corinthians
-  {"2CHRONICLES", 14},		//   2 Chronicles
-  {"2CORINTHIANS", 48},		//   2 Corinthians
-  {"2ESDRAS", 76},
-  {"2JN", 64},			//    2 John    
-  {"2JOHN", 64},		//    2 John
-  {"2KGS", 12},			// 2 Kings
-  {"2KINGS", 12},		//    2 Kings
-  {"2MACCABEES", 78},
-  {"2PETER", 62},		//    2 Peter
-  {"2PTR", 62},			//    2 Peter
-  {"2SAMUEL", 10},		//    2 Samuel
-  {"2THESSALONIANS", 54},	//   2 Thessalonians
-  {"2TIMOTHY", 56},		//   2 Timothy
-  {"3 JN", 65},			//    3 John
-  {"3 JOHN", 65},		//    3 John
-  {"3JN", 65},			//    3 John
-  {"3JOHN", 65},		//    3 John
-  {"3 MACCABEES", 79},
-  {"3MACCABEES", 79},
-  {"4 MACCABEES", 80},
-  {"4MACCABEES", 80},
-  {"ACTS", 45},			//     Acts
-  {"ADDESTHER", 87},
-  {"ADDITIONS TO ESTHER", 87},
-  {"AMOS", 30},			//    Amos
-  {"APOCALYPSE OF ST. JOHN", 67},	//    Apocalypse of St. John (Rev.)
-  {"APOCRYPHA", 86},
-  {"BARUCH", 73},
-  {"BEL AND THE DRAGON",90},
-  {"BEN SIRACH", 72},
-  {"C", 52},			//    Colossians
-  {"CANTICLE OF CANTICLES", 22},	//    Canticle of Canticles (Song of S.)
-  {"COLOSSIANS", 52},		//    Colossians
-  {"D", 5},			//     Deuteronomy
-  {"DANIEL", 27},		//    Daniel
-  {"DEUTERO", 5},		//    Deuteronomy
-  {"DEUTEROCANON", 68},		//    Deuteronomy
-  {"DEUTERONOMY", 5},		//    Deuteronomy
-  {"E", 50},			//     Ephesians
-  {"ECCLESIASTES", 21},		//    Ecclesiastes
-  {"ECCLESIASTICUS", 73},
-  {"EPHESIANS", 50},		//    Ephesians
-  {"EPISTLE OF JEREMIAH", 74},
-  {"EPISTLE TO THE LAODICEANS", 83},
-  {"EPJER", 74},
-  {"EPLAO", 83},
-  {"ESTER", 17},		//    Esther
-  {"ESTHER", 17},		//    Esther
-  {"EXODUS", 2},		//    Exodus
-  {"EZEKIEL", 26},		//   Ezekiel
-  {"EZK", 26},		//   Ezekiel
-  {"EZRA", 15},			//   Ezra
-  {"G", 1},			//     Genesis
-  {"GALATIANS", 49},		//    Galatians
-  {"GENESIS", 1},		//    Genesis
-  {"H", 59},			//     Hebrews
-  {"HABAKKUK", 35},		//    Habakkuk
-  {"HAGGAI", 37},		//   Haggai
-  {"HEBREWS", 59},		//    Hebrews
-  {"HOSEA", 28},		//    Hosea
-  {"I C", 47},			//   1 Corinthians
-  {"I CHRONICLES", 13},		//   1 Chronicles
-  {"I CORINTHIANS", 47},	//   1 Corinthians
-  {"I ENOCH", 84},
-  {"I ESDRAS", 76},
-  {"I JN", 63},			//    1 John
-  {"I JOHN", 63},		//    1 John
-  {"I KGS", 11},		// 1 Kings
-  {"I KINGS", 11},		//    1 Kings
-  {"I MACCABEES", 78},
-  {"I PETER", 61},		//    1 Peter
-  {"I PTR", 61},		//    1 Peter
-  {"I SAMUEL", 9},		//    1 Samuel
-  {"I THESSALONIANS", 53},	//   1 Thessalonians
-  {"I TIMOTHY", 55},		//   1 Timothy
-  {"IC", 47},			//   1 Corinthians
-  {"ICHRONICLES", 13},		//   1 Chronicles
-  {"ICORINTHIANS", 47},		//   1 Corinthians
-  {"IENOCH", 84},
-  {"IESDRAS", 76},
-  {"II C", 48},			//   2 Corinthians
-  {"II CHRONICLES", 14},	//   2 Chronicles
-  {"II CORINTHIANS", 48},	//   2 Corinthians
-  {"II ESDRAS", 77},
-  {"II JN", 64},		//    2 John  
-  {"II JOHN", 64},		//    2 John
-  {"II KGS", 12},		// 2 Kings
-  {"II KINGS", 12},		//    2 Kings
-  {"II MACCABEES", 79},
-  {"II PETER", 62},		//    2 Peter
-  {"II PTR", 62},		//    2 Peter
-  {"II SAMUEL", 10},		//    2 Samuel
-  {"II THESSALONIANS", 54},	//   2 Thessalonians
-  {"II TIMOTHY", 56},		//   2 Timothy
-  {"IIC", 48},			//   2 Corinthians
-  {"IICHRONICLES", 14},		//   2 Chronicles
-  {"IICORINTHIANS", 48},	//   2 Corinthians
-  {"IIESDRAS", 77},
-  {"III JN", 65},		//    3 John 
-  {"III JOHN", 65},		//    3 John
-  {"IIIJN", 65},		//    3 John
-  {"IIIJOHN", 65},		//    3 John
-  {"III MACCABEES", 80},
-  {"IIII MACCABEES", 81},
-  {"IIIIMACCABEES", 81},
-  {"IIIMACCABEES", 80},
-  {"IIJN", 64},			//    2 John
-  {"IIJOHN", 64},		//    2 John
-  {"IIKGS", 12},		// 2 Kings
-  {"IIKINGS", 12},		//    2 Kings
-  {"IIMACCABEES", 79},
-  {"IIPETER", 62},		//    2 Peter
-  {"IIPTR", 62},		//    2 Peter
-  {"IISAMUEL", 10},		//    2 Samuel
-  {"IITHESSALONIANS", 54},	//   2 Thessalonians
-  {"IITIMOTHY", 56},		//   2 Timothy
-  {"IJN", 63},			//    1 John
-  {"IJOHN", 63},		//    1 John
-  {"IKGS", 11},			// 1 Kings
-  {"IKINGS", 11},		//    1 Kings
-  {"IMACCABEES", 78},
-  {"IPETER", 61},		//    1 Peter
-  {"IPTR", 61},			//    1 Peter
-  {"ISA", 23},			//     Isaiah
-  {"ISAIAH", 23},		//     Isaiah
-  {"ISAMUEL", 9},		//    1 Samuel
-  {"ITHESSALONIANS", 53},	//   1 Thessalonians
-  {"ITIMOTHY", 55},		//   1 Timothy
-  {"IV MACCABEES", 81},
-  {"IVMACCABEES", 81},
-  {"J", 44},			//     John
-  {"JAMES", 60},		//    James
-  {"JAS", 60},			//    James
-  {"JDGS", 7},		//  Judges
-  {"JDT", 70},
-  {"JEREMIAH", 24},		//    Jeremiah
-  {"JESUS BEN SIRACH", 73},
-  {"JHN", 44},			//    John
-  {"JN", 44},			//    John
-  {"JO", 44},			//    John
-  {"JOB", 18},			//   Job
-  {"JOEL", 29},			//   Joel
-  {"JOHN", 44},			//   John
-  {"JOL", 29},			//   Joel
-  {"JONAH", 32},		//   Jonah
-  {"JOSHUA", 6},		//   Joshua
-  {"JUBILEES", 85},
-  {"JUDE", 66},			//  Jude
-  {"JUDGES", 7},		//  Judges
-  {"JUDITH", 70},
-  {"L", 43},			//     Luke
-  {"LAMENTATIONS", 25},		//    Lamentations
-  {"LAODICEANS", 83},
-  {"LETTER OF JEREMIAH", 74},
-  {"LEVITICUS", 3},		//    Leviticus
-  {"LK", 43},			//    Luke
-  {"LUKE", 43},			//    Luke
-  {"MA", 41},			//    Matthew
-  {"MALACHI", 39},		//   Malachi
-  {"MANASSEH", 91},
-  {"MANASSES", 91},
-  {"MARK", 42},			//   Mark
-  {"MATTHEW", 41},		//   Matthew
-  {"MICAH", 33},		//    Micah
-  {"MK", 42},			//    Mark
-  {"MRK", 42},			//    Mark
-  {"MT", 41},			//    Matthew
-  {"N", 4},			//     Numbers
-  {"NAHUM", 34},		//    Nahum
-  {"NAM", 34},		//    Nahum
-  {"NEHEMIAH", 16},		//    Nehemiah
-  {"NEW TESTAMENT", 40},		//     New Testament
-  {"NUMBERS", 4},		//    Numbers
-  {"OBADIAH", 31},		//     Obadiah
-  {"ODES OF SOLOMON", 81},
-  {"OLD TESTAMENT", 0},		//     Old Testament
-  {"P", 19},			//     Psalms
-  {"PHIL", 51},			//    Philippians
-  {"PHILEMON", 58},		// Philemon
-  {"PHILIPPIANS", 51},		// Philippians
-  {"PHLM", 58},		// Philemon
-  {"PHM", 58},			//   Philemon
-  {"PHP", 51},			//   Philippians
-  {"PR", 20},		//    Proverbs
-  {"PRAYER OF AZARIAH", 88},
-  {"PRAYER OF MANASSEH", 91},
-  {"PRAYER OF MANASSES", 91},
-  {"PRAZAR", 88},
-  {"PRMAN", 91},
-  {"PROVERBS", 20},		//    Proverbs
-  {"PS151", 92},
-  {"PSA", 19},		//    Psalms
-  {"PSALM ", 19},
-  {"PSALM 151", 92},
-  {"PSALM151", 92},
-  {"PSALMS", 19},		//    Psalms
-  {"PSALMS OF SOLOMON", 82},
-  {"PSM", 19},			// Psalms
-  {"PSS", 19},			// Psalms
-  {"PSSOL", 82},
-  {"PSSSOL", 82},
-  {"QOHELETH", 21},              // Qohelet (Ecclesiastes)
-  {"REVELATION OF JOHN", 67},	//     Revelation
-  {"ROMANS", 46},		//    Romans
-  {"RUTH", 8},			//    Ruth
-  {"SIRACH", 72},
-  {"SNG", 22},	//     Song of Solomon
-  {"SOLOMON", 22},	//     Song of Solomon
-  {"SONG OF SOLOMON", 22},	//     Song of Solomon
-  {"SONG OF SONGS", 22},	//     Song of Solomon
-  {"SOS", 22},			//     Song of Solomon
-  {"SUSANNA", 89},
-  {"TITUS", 57},		//     Titus
-  {"TOBIT", 69},
-  {"WISDOM", 71},//250
-  {"WISDOM OF JESUS BEN SIRACH", 72},
-  {"ZECHARIAH", 38},		//   Zechariah
-  {"ZEPHANIAH", 36},		//   Zephaniah
-  {"", -1}
-};
-*/
-
-/* The default versification scheme is KJV */
-/*
-  0, 1, 52, 93, 121, 158,
-  193, 218, 240, 245, 277, 302, 325,
-  351, 381, 418, 429, 443, 454, 497,
-  648, 680, 693, 702, 769, 822, 828,
-  877, 890, 905, 909, 919, 921, 926,
-  934, 938, 942, 946, 949, 964
-*/
-
-
-
-

Modified: trunk/include/swcom.h
===================================================================
--- trunk/include/swcom.h	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/include/swcom.h	2009-04-20 18:40:15 UTC (rev 2324)
@@ -36,7 +36,9 @@
   */
 class SWDLLEXPORT SWCom : public SWModule {
 
-	mutable VerseKey *tmpVK;
+	mutable VerseKey *tmpVK1;
+	mutable VerseKey *tmpVK2;
+        mutable bool tmpSecond;
 	char *versification;
 
 protected:

Modified: trunk/include/swkey.h
===================================================================
--- trunk/include/swkey.h	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/include/swkey.h	2009-04-20 18:40:15 UTC (rev 2324)
@@ -35,7 +35,7 @@
 
 #define SWKEY_OPERATORS \
   SWKey &operator =(const char *ikey) { setText(ikey); return *this; } \
-  SWKey &operator =(const SWKey &ikey) { copyFrom(ikey); return *this; } \
+  SWKey &operator =(const SWKey &ikey) { positionFrom(ikey); return *this; } \
   SWKey &operator =(SW_POSITION pos) { setPosition(pos); return *this; } \
   operator const char *() const { return getText(); } \
   bool operator ==(const SWKey &ikey) { return equals(ikey); } \
@@ -164,8 +164,9 @@
 	 * @param ikey other SWKey object from which to copy
 	 */
 	virtual void copyFrom(const SWKey &ikey);
+	virtual void positionFrom(const SWKey &ikey) { copyFrom(ikey); }
 
-	/** returns string representation of this key 
+	/** returns string representation of this key
 	 */
 	virtual const char *getText() const;
 	virtual const char *getShortText() const { return getText(); }
@@ -214,25 +215,6 @@
 	void setLocale(const char *name) { stdstr(&localeName, name); locale = 0;	} // this will force an on demand lookup of our locale
 
 	/** Use this function to get an index position within a module.
-	 * Here's a small example how to use this function and @ref Index(long).
-	 * This function uses the GerLut module and chooses a random verse from the
-	 * Bible and returns it.
-	 * @code
-	 * const char* randomVerse() {
-	 *   VerseKey vk;
-	 *   SWMgr mgr;
-	 *   LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName("de");
-	 *
-	 *   SWModule* module = mgr->Modules("GerLut");
-	 *   srand( time(0) );
-	 *   const double newIndex = (double(rand())/RAND_MAX)*(24108+8224);
-	 *   vk.Index(newIndex);
-	 *   module->setKey(vk);
-	 *
-	 *   char* text;
-	 *   sprintf(text, "%s: %s",(const char*)vk ,module->StripText(&vk));
-	 *   return text;
-	 * @endcode
 	 */
 	virtual long Index() const { return index; }
 

Modified: trunk/include/swtext.h
===================================================================
--- trunk/include/swtext.h	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/include/swtext.h	2009-04-20 18:40:15 UTC (rev 2324)
@@ -36,7 +36,9 @@
 class SWDLLEXPORT SWText : public SWModule {
 
 	// for conversion if we have been set with a different internal key type
-	mutable VerseKey *tmpVK;
+	mutable VerseKey *tmpVK1;
+	mutable VerseKey *tmpVK2;
+        mutable bool tmpSecond;
 	char *versification;
 
 protected:

Modified: trunk/include/versekey.h
===================================================================
--- trunk/include/versekey.h	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/include/versekey.h	2009-04-20 18:40:15 UTC (rev 2324)
@@ -223,7 +223,7 @@
 
 	/** Only repositions this VerseKey to another VerseKey
 	*/
-	virtual void positionFrom(const VerseKey &ikey);
+	virtual void positionFrom(const SWKey &ikey);
 
 	/** Positions this key
 	*
@@ -405,7 +405,7 @@
 	* <0 if this	VerseKey is smaller than compare	SWKey,
 	* 0 if the keys are the same
 	*/
-	virtual int compare(const SWKey & ikey);
+	virtual int compare(const SWKey &ikey);
 
 	/** Compares another	VerseKey object
 	*
@@ -414,7 +414,7 @@
 	* <0 if this	VerseKey is smaller than compare	VerseKey,
 	* 0 if the keys are the same
 	*/
-	virtual int _compare(const VerseKey & ikey);
+	virtual int _compare(const VerseKey &ikey);
 
 	virtual void setVersificationSystem(const char *name);
 	virtual const char *getVersificationSystem() const;
@@ -428,7 +428,7 @@
 
 	SWKEY_OPERATORS
 
-	virtual SWKey & operator =(const VerseKey & ikey) { copyFrom(ikey); return *this; }
+	virtual SWKey &operator =(const VerseKey &ikey) { positionFrom(ikey); return *this; }
 };
 
 SWORD_NAMESPACE_END

Modified: trunk/lib/bcppmake/libsword.bpr
===================================================================
--- trunk/lib/bcppmake/libsword.bpr	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/lib/bcppmake/libsword.bpr	2009-04-20 18:40:15 UTC (rev 2324)
@@ -132,7 +132,7 @@
     <PATHRC value=".;"/>
     <PATHASM value=".;"/>
     <LINKER value="TLib"/>
-    <USERDEFINES value="UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE;LUCENE_ENABLE_REFCOUNT"/>
+    <USERDEFINES value="UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE;LUCENE_ENABLE_REFCOUNT;_DEBUG"/>
     <SYSDEFINES value="NO_STRICT"/>
     <MAINSOURCE value="libsword.bpf"/>
     <INCLUDEPATH value="..\..\src\modules\comments\rawcom4;..\..\src\modules\texts\rawtext4;..\..\src\modules\tests;..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n;..\..\..\biblecs\clucene\src;..\..\..\biblecs\apps\InstallMgr\curl\include"/>
@@ -160,9 +160,9 @@
       -D_ICU_ -D_ICUSWORD_ -DUSBINARY -DU_HAVE_PLACEMENT_NEW=0 -DUSELUCENE 
       -D_WIN32 -D_CL_DISABLE_MULTITHREADING -DCURLAVAILABLE 
       -DLUCENE_ENABLE_REFCOUNT -no_tie -boa"/>
-    <CFLAG1 value="-O2 -Vx -X- -a8 -4 -b- -k- -vi -c -tW -tWM"/>
-    <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
-    <AFLAGS value="/mx /w2 /zn"/>
+    <CFLAG1 value="-Od -Vx -X- -r- -a8 -4 -b- -k -y -v -vi- -c -tW -tWM"/>
+    <PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
+    <AFLAGS value="/mx /w2 /zi"/>
     <LFLAGS value="/P512"/>
   </OPTIONS>
   <LINKER>
@@ -237,31 +237,32 @@
 Item0=$(BCB)\source\vcl
 
 [HistoryLists\hlConditionals]
-Count=24
-Item0=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE;LUCENE_ENABLE_REFCOUNT
-Item1=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE
-Item2=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item3=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;_DEBUG
-Item4=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item5=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;UNICODE
-Item6=_UCS2;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item7=_ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item8=__ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item9=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
-Item10=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT;_DEBUG
-Item11=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
-Item12=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
-Item13=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
-Item14=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
-Item15=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
-Item16=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
-Item17=_ICU_;_ICUSWORD_;USBINARY
-Item18=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE;_DEBUG
-Item19=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE
-Item20=;USBINARY;_DEBUG
-Item21=_ICU_;_ICUSWORD_
-Item22=_ICU_;_ICUSWORD_;_DEBUG
-Item23=_DEBUG
+Count=25
+Item0=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE;LUCENE_ENABLE_REFCOUNT;_DEBUG
+Item1=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE;LUCENE_ENABLE_REFCOUNT
+Item2=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;CURLAVAILABLE
+Item3=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item4=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;_DEBUG
+Item5=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item6=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;UNICODE
+Item7=_UCS2;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item8=_ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item9=__ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item10=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
+Item11=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT;_DEBUG
+Item12=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
+Item13=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
+Item14=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
+Item15=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
+Item16=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
+Item17=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
+Item18=_ICU_;_ICUSWORD_;USBINARY
+Item19=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE;_DEBUG
+Item20=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE
+Item21=;USBINARY;_DEBUG
+Item22=_ICU_;_ICUSWORD_
+Item23=_ICU_;_ICUSWORD_;_DEBUG
+Item24=_DEBUG
 
 [HistoryLists\hlFinalOutputDir]
 Count=3
@@ -292,10 +293,9 @@
 LinkDebugVcl=0
 LinkCGLIB=0
 
-
 [Language]
 ActiveLang=
 ProjectLang=
 RootDir=
   </IDEOPTIONS>
-</PROJECT>
+</PROJECT>
\ No newline at end of file

Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/keys/versekey.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -114,7 +114,7 @@
 
 
 /******************************************************************************
- * VerseKey::positionFrom - Positions this VerseKey to another VerseKey
+ * VerseKey::setFromOther - Positions this VerseKey to another VerseKey
  */
 
 void VerseKey::setFromOther(const VerseKey &ikey) {
@@ -126,10 +126,24 @@
 }
 
 
-void VerseKey::positionFrom(const VerseKey &ikey) {
-	error = 0;
-	setFromOther(ikey);
-	// should we always perform bounds checks?  Tried but seems to cause infinite recursion
+void VerseKey::positionFrom(const SWKey &ikey) {
+ 	error = 0;
+        const SWKey *fromKey = &ikey;
+	ListKey *tryList = SWDYNAMIC_CAST(ListKey, fromKey);
+	if (tryList) {
+		SWKey *k = tryList->getElement();
+		if (k) fromKey = k;
+	}
+	VerseKey *tryVerse = SWDYNAMIC_CAST(VerseKey, fromKey);
+	if (tryVerse) {
+		setFromOther(*tryVerse);
+	}
+	else {
+		SWKey::positionFrom(*fromKey);
+		parse();
+	}
+
+ 	// should we always perform bounds checks?  Tried but seems to cause infinite recursion
 	if (_compare(UpperBound()) > 0) {
 		setFromOther(UpperBound());
 		error = KEYERR_OUTOFBOUNDS;
@@ -259,7 +273,7 @@
 	if (keytext) {
 		ListKey tmpListKey = ParseVerseList(keytext);
 		if (tmpListKey.Count()) {
-			this->positionFrom(tmpListKey.getElement(0));
+			this->positionFrom(*tmpListKey.getElement(0));
 			error = this->error;
 		} else error = 1;
 	}

Modified: trunk/src/modules/comments/hrefcom/hrefcom.cpp
===================================================================
--- trunk/src/modules/comments/hrefcom/hrefcom.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/comments/hrefcom/hrefcom.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -72,12 +72,7 @@
 	unsigned short size;
 	VerseKey *key = 0;
 
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
+        key = &getVerseKey();
 
 	findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
 	entrySize = size;        // support getEntrySize call

Modified: trunk/src/modules/comments/rawcom/rawcom.cpp
===================================================================
--- trunk/src/modules/comments/rawcom/rawcom.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/comments/rawcom/rawcom.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -105,7 +105,7 @@
 		long laststart = start;
 		unsigned short lastsize = size;
 		SWKey lasttry = *tmpkey;
-		(steps > 0) ? (*key)++ : (*key)--;
+		(steps > 0) ? ++(*key) : --(*key);
 		tmpkey = &getVerseKey();
 
 		if ((error = key->Error())) {
@@ -135,17 +135,8 @@
 
 void RawCom::linkEntry(const SWKey *inkey) {
 	VerseKey *destkey = &getVerseKey();
-	const VerseKey *srckey = 0;
+	const VerseKey *srckey = &getVerseKey(inkey);
 
-	// see if we have a VerseKey * or decendant
-	SWTRY {
-		srckey = SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {}
-	// if we don't have a VerseKey * decendant, create our own
-	if (!srckey)
-		srckey = new VerseKey(inkey);
-
 	doLinkEntry(destkey->Testament(), destkey->TestamentIndex(), srckey->TestamentIndex());
 
 	if (inkey != srckey) // free our key if we created a VerseKey

Modified: trunk/src/modules/comments/rawcom4/rawcom4.cpp
===================================================================
--- trunk/src/modules/comments/rawcom4/rawcom4.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/comments/rawcom4/rawcom4.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -104,7 +104,7 @@
 		long laststart = start;
 		unsigned long lastsize = size;
 		SWKey lasttry = *tmpkey;
-		(steps > 0) ? (*key)++ : (*key)--;
+		(steps > 0) ? ++(*key) : --(*key);
 		tmpkey = &getVerseKey();
 
 		if ((error = key->Error())) {
@@ -134,21 +134,8 @@
 
 void RawCom4::linkEntry(const SWKey *inkey) {
 	VerseKey *destkey = &getVerseKey();
-	const VerseKey *srckey = 0;
-
-	// see if we have a VerseKey * or decendant
-	SWTRY {
-		srckey = SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {}
-	// if we don't have a VerseKey * decendant, create our own
-	if (!srckey)
-		srckey = new VerseKey(inkey);
-
+	const VerseKey *srckey = &getVerseKey(inkey);
 	doLinkEntry(destkey->Testament(), destkey->TestamentIndex(), srckey->TestamentIndex());
-
-	if (inkey != srckey) // free our key if we created a VerseKey
-		delete srckey;
 }
 
 

Modified: trunk/src/modules/comments/rawfiles/rawfiles.cpp
===================================================================
--- trunk/src/modules/comments/rawfiles/rawfiles.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/comments/rawfiles/rawfiles.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -73,15 +73,8 @@
 	FileDesc *datafile;
 	long  start = 0;
 	unsigned short size = 0;
-	VerseKey *key = 0;
+	VerseKey *key = &getVerseKey();
 
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
-
 	findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
 
 	entryBuf = "";
@@ -104,10 +97,6 @@
 		}
 		FileMgr::getSystemFileMgr()->close(datafile);
 	}
-
-	if (key != this->key)
-		delete key;
-
 	return entryBuf;
 }
 
@@ -121,15 +110,9 @@
 	FileDesc *datafile;
 	long  start;
 	unsigned short size;
-	VerseKey *key = 0;
+	VerseKey *key = &getVerseKey();
 
 	len = (len<0)?strlen(inbuf):len;
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
 
 	findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
 
@@ -153,9 +136,6 @@
 		datafile->write(inbuf, len);
 	}
 	FileMgr::getSystemFileMgr()->close(datafile);
-	
-	if (key != this->key)
-		delete key;
 }
 
 
@@ -170,36 +150,17 @@
 
 	long  start;
 	unsigned short size;
-	const VerseKey *key = 0;
+	const VerseKey *key = &getVerseKey();
 
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
-
 	findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
 
 	if (size) {
 		SWBuf tmpbuf;
 		readText(key->Testament(), start, size + 2, tmpbuf);
 
-		if (key != inkey)
-			delete key;
-		key = 0;
-
-		SWTRY {
-			key = SWDYNAMIC_CAST(VerseKey, inkey);
-		}
-		SWCATCH ( ... ) {}
-		if (!key)
-			key = new VerseKey(this->key);
+		key = &getVerseKey(inkey);
 		doSetText(key->Testament(), key->TestamentIndex(), tmpbuf.c_str());
 	}
-	
-	if (key != inkey)
-		delete key;
 }
 
 
@@ -210,20 +171,8 @@
  */
 
 void RawFiles::deleteEntry() {
-
-	VerseKey *key = 0;
-
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
-
+	VerseKey *key = &getVerseKey();
 	doSetText(key->Testament(), key->TestamentIndex(), "");
-
-	if (key != this->key)
-		delete key;
 }
 
 

Modified: trunk/src/modules/comments/swcom.cpp
===================================================================
--- trunk/src/modules/comments/swcom.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/comments/swcom.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -42,7 +42,9 @@
 	stdstr(&(this->versification), versification);
 	delete key;
 	key = (VerseKey *)CreateKey();
-	tmpVK = (VerseKey *)CreateKey();
+	tmpVK1 = (VerseKey *)CreateKey();
+	tmpVK2 = (VerseKey *)CreateKey();
+        tmpSecond = false;
 }
 
 
@@ -51,7 +53,8 @@
  */
 
 SWCom::~SWCom() {
-	delete tmpVK;
+	delete tmpVK1;
+	delete tmpVK2;
 	delete [] versification;
 }
 
@@ -66,37 +69,18 @@
 
 
 long SWCom::Index() const {
-	VerseKey *key = 0;
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
-
+	VerseKey *key = &getVerseKey();
 	entryIndex = key->Index();
-
-	if (key != this->key)
-		delete key;
-
 	return entryIndex;
 }
 
 long SWCom::Index(long iindex) {
-	VerseKey *key = 0;
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
-
+	VerseKey *key = &getVerseKey();
 	key->Testament(1);
 	key->Index(iindex);
 
 	if (key != this->key) {
 		this->key->copyFrom(*key);
-		delete key;
 	}
 
 	return Index();
@@ -126,9 +110,11 @@
 		}
 	}
 	if (!key) {
-		tmpVK->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
-		(*tmpVK) = *(thisKey);
-		return (*tmpVK);
+                VerseKey *retKey = (tmpSecond) ? tmpVK1 : tmpVK2;
+                tmpSecond = !tmpSecond;
+		retKey->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
+		(*retKey) = *(thisKey);
+		return (*retKey);
 	}
 	else	return *key;
 }

Modified: trunk/src/modules/comments/zcom/zcom.cpp
===================================================================
--- trunk/src/modules/comments/zcom/zcom.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/comments/zcom/zcom.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -128,18 +128,8 @@
 
 void zCom::linkEntry(const SWKey *inkey) {
 	VerseKey *destkey = &getVerseKey();
-	const VerseKey *srckey = 0;
+	const VerseKey *srckey = &getVerseKey(inkey);
 
-	// see if we have a VerseKey * or decendant
-	SWTRY {
-		srckey = (const VerseKey *) SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {
-	}
-	// if we don't have a VerseKey * decendant, create our own
-	if (!srckey)
-		srckey = new VerseKey(inkey);
-
 	doLinkEntry(destkey->Testament(), destkey->TestamentIndex(), srckey->TestamentIndex());
 
 	if (inkey != srckey) // free our key if we created a VerseKey
@@ -180,7 +170,7 @@
 		long laststart = start;
 		unsigned short lastsize = size;
 		SWKey lasttry = *tmpkey;
-		(steps > 0) ? (*key)++ : (*key)--;
+		(steps > 0) ? ++(*key) : --(*key);
 		tmpkey = &getVerseKey();
 
 		if ((error = key->Error())) {

Modified: trunk/src/modules/common/rawverse.cpp
===================================================================
--- trunk/src/modules/common/rawverse.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/common/rawverse.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -303,10 +303,6 @@
 
 	delete [] path;
 	delete [] buf;
-/*
-	RawVerse rv(path);
-	VerseKey mykey("Rev 22:21");
-*/
 	
 	return 0;
 }

Modified: trunk/src/modules/common/rawverse4.cpp
===================================================================
--- trunk/src/modules/common/rawverse4.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/common/rawverse4.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -302,10 +302,6 @@
 
 	delete [] path;
 	delete [] buf;
-/*
-	RawVerse4 rv(path);
-	VerseKey mykey("Rev 22:21");
-*/
 	
 	return 0;
 }

Modified: trunk/src/modules/filters/gbffootnotes.cpp
===================================================================
--- trunk/src/modules/filters/gbffootnotes.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/gbffootnotes.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -48,7 +48,7 @@
 
 char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *module)
 {
-	
+
 	SWBuf token;
 	bool intoken    = false;
 	bool hide       = false;
@@ -57,11 +57,10 @@
 	SWBuf refs = "";
 	int footnoteNum = 1;
 	char buf[254];
-	VerseKey parser = key->getText();
 
 	SWBuf orig = text;
 	const char *from = orig.c_str();
-	
+
 	//XMLTag tag;
 
 	for (text = ""; *from; from++) {
@@ -76,7 +75,7 @@
 			//XMLTag tag(token);
 			if (!strncmp(token, "RF",2)) {
 // 				tag = token;
-				
+
 				refs = "";
 				startTag = token;
 				hide = true;
@@ -86,7 +85,7 @@
 			else if (!strncmp(token, "Rf",2)) {
 				if (module->isProcessEntryAttributes()) {
 					//tag = token;
-				
+
 					if((tagText.length() == 1) || !strcmp(module->Name(), "IGNT")) {
 						if (option) { // for ASV marks text in verse then put explanation at end of verse
 							text.append(" <FS>[");
@@ -108,7 +107,7 @@
 					startTag.setAttribute("swordFootnote", buf);
 				}
 				hide = false;
-				if (option) {	
+				if (option) {
 					text.append(startTag);
 					text.append(tagText);
 				}
@@ -135,7 +134,7 @@
 		else tagText.append(*from);
 	}
 	return 0;
-	
+
 	/*
 	if (!option) {	// if we don't want footnotes
 		char token[4096]; // cheese.  Fix.

Modified: trunk/src/modules/filters/gbfosis.cpp
===================================================================
--- trunk/src/modules/filters/gbfosis.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/gbfosis.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -332,10 +332,10 @@
 					newWord = false;
 					
 					//fix this if required?
-					//memset(to, 0, 10); 
-					
+					//memset(to, 0, 10);
+
 				}
-				
+
 				if (!suspendTextPassThru) {
 					text += (*from);
 					lastspace = (*from == ' ');
@@ -350,29 +350,29 @@
 		if (vkey->Verse()) {
 			ref.appendFormatted("\t\t<verse osisID=\"%s\">", vkey->getOSISRef());
 		}
-		
+
 		if (ref.length() > 0) {
-			
+
 			text = ref + text;
-			
+
 			if (vkey->Verse()) {
-				VerseKey tmp;
-				tmp = *vkey;
-				tmp.AutoNormalize(0);
-				tmp.Headings(1);
-				
+				VerseKey *tmp = (VerseKey *)vkey->clone();
+				*tmp = *vkey;
+				tmp->AutoNormalize(0);
+				tmp->Headings(1);
+
 				text += "</verse>";
-				
-				tmp = MAXVERSE;
-				if (*vkey == tmp) {
-					tmp.Verse(0);
+
+				*tmp = MAXVERSE;
+				if (*vkey == *tmp) {
+					tmp->Verse(0);
 //					sprintf(ref, "\t</div>");
 //					pushString(&to, ref);
-					tmp = MAXCHAPTER;
-					tmp = MAXVERSE;
-					if (*vkey == tmp) {
-						tmp.Chapter(0);
-						tmp.Verse(0);
+					*tmp = MAXCHAPTER;
+					*tmp = MAXVERSE;
+					if (*vkey == *tmp) {
+						tmp->Chapter(0);
+						tmp->Verse(0);
 //						sprintf(ref, "\t</div>");
 //						pushString(&to, ref);
 /*
@@ -383,6 +383,7 @@
 */
 					}
 				}
+                                delete tmp;
 			}
 //			else if (vkey->Chapter()) {
 //				sprintf(ref, "\t<div type=\"chapter\" osisID=\"%s\">", vkey->getOSISRef());

Modified: trunk/src/modules/filters/osisfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/osisfootnotes.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/osisfootnotes.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -56,11 +56,17 @@
 	SWBuf refs = "";
 	int footnoteNum = 1;
 	char buf[254];
-	VerseKey parser(key->getText());
+	SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey();
+        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+        if (!parser) {
+        	delete p;
+                parser = new VerseKey();
+        }
+        *parser = key->getText();
 
 	SWBuf orig = text;
 	const char *from = orig.c_str();
-	
+
 	XMLTag tag;
 	bool strongsMarkup = false;
 
@@ -74,20 +80,20 @@
 			continue;
 		}
 
-		
+
 		if (*from == '<') {
 			intoken = true;
 			token = "";
 			continue;
 		}
-		
-		
-		
+
+
+
 		if (*from == '>') {	// process tokens
-			intoken = false;			
+			intoken = false;
 			if (!strncmp(token, "note", 4) || !strncmp(token.c_str(), "/note", 5)) {
 				tag = token;
-				
+
 				if (!tag.isEndTag()) {
 					if (tag.getAttribute("type") && (!strcmp("x-strongsMarkup", tag.getAttribute("type"))
 											|| !strcmp("strongsMarkup", tag.getAttribute("type")))	// deprecated
@@ -95,7 +101,7 @@
 						tag.setEmpty(false);  // handle bug in KJV2003 module where some note open tags were <note ... />
 						strongsMarkup = true;
 					}
-					
+
 					if (!tag.isEmpty()) {
 //					if ((!tag.isEmpty()) || (SWBuf("strongsMarkup") == tag.getAttribute("type"))) {
 						refs = "";
@@ -116,7 +122,7 @@
 						startTag.setAttribute("swordFootnote", buf);
 						if ((startTag.getAttribute("type")) && (!strcmp(startTag.getAttribute("type"), "crossReference"))) {
 							if (!refs.length())
-								refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText();
+								refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText();
 							module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
 						}
 					}
@@ -137,7 +143,7 @@
 				if (refs.length()) {
 					refs.append("; ");
 				}
-				
+
 				const char* attr = strstr(token.c_str() + 9, "osisRef=\"");
 				const char* end  = attr ? strchr(attr+9, '"') : 0;
 
@@ -165,6 +171,7 @@
 		}
 		else tagText.append(*from);
 	}
+        delete parser;
 	return 0;
 }
 

Modified: trunk/src/modules/filters/osisosis.cpp
===================================================================
--- trunk/src/modules/filters/osisosis.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/osisosis.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -62,33 +62,34 @@
 		if (vkey->Verse()) {
 			ref.appendFormatted("\t\t<verse osisID=\"%s\">", vkey->getOSISRef());
 		}
-		
+
 		if (ref.length() > 0) {
-			
+
 			text = ref + text;
-			
+
 			if (vkey->Verse()) {
-				VerseKey tmp;
-				tmp = *vkey;
-				tmp.AutoNormalize(0);
-				tmp.Headings(1);
-				
+				VerseKey *tmp = (VerseKey *)vkey->clone();
+				*tmp = *vkey;
+				tmp->AutoNormalize(0);
+				tmp->Headings(1);
+
 				text += "</verse>";
-				
-				tmp = MAXVERSE;
-				if (*vkey == tmp) {
-					tmp.Verse(0);
+
+				*tmp = MAXVERSE;
+				if (*vkey == *tmp) {
+					tmp->Verse(0);
 //					sprintf(ref, "\t</div>");
 //					pushString(&to, ref);
-					tmp = MAXCHAPTER;
-					tmp = MAXVERSE;
-					if (*vkey == tmp) {
-						tmp.Chapter(0);
-						tmp.Verse(0);
+					*tmp = MAXCHAPTER;
+					*tmp = MAXVERSE;
+					if (*vkey == *tmp) {
+						tmp->Chapter(0);
+						tmp->Verse(0);
 //						sprintf(ref, "\t</div>");
 //						pushString(&to, ref);
 					}
 				}
+                                delete tmp;
 			}
 
 //

Modified: trunk/src/modules/filters/thmlfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/thmlfootnotes.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/thmlfootnotes.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -56,7 +56,13 @@
 	SWBuf refs = "";
 	int footnoteNum = 1;
 	char buf[254];
-	VerseKey parser = key->getText();
+	SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey();
+        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+        if (!parser) {
+        	delete p;
+                parser = new VerseKey();
+        }
+        *parser = key->getText();
 
 	SWBuf orig = text;
 	const char *from = orig.c_str();
@@ -95,7 +101,7 @@
 						startTag.setAttribute("swordFootnote", buf);
 						if ((startTag.getAttribute("type")) && (!strcmp(startTag.getAttribute("type"), "crossReference"))) {
 							if (!refs.length())
-								refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText();
+								refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText();
 							module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
 						}
 					}
@@ -135,6 +141,7 @@
 		}
 		else tagText += *from;
 	}
+        delete parser;
 	return 0;
 }
 

Modified: trunk/src/modules/filters/thmlosis.cpp
===================================================================
--- trunk/src/modules/filters/thmlosis.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/thmlosis.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -549,23 +549,23 @@
 			text = ref + text;
 			
 			if (vkey->Verse()) {
-				VerseKey tmp;
-				tmp = *vkey;
-				tmp.AutoNormalize(0);
-				tmp.Headings(1);
-				
+				VerseKey *tmp = (VerseKey *)vkey->clone();
+				*tmp = *vkey;
+				tmp->AutoNormalize(0);
+				tmp->Headings(1);
+
 				text += "</verse>";
-				
-				tmp = MAXVERSE;
-				if (*vkey == tmp) {
-					tmp.Verse(0);
+
+				*tmp = MAXVERSE;
+				if (*vkey == *tmp) {
+					tmp->Verse(0);
 //					sprintf(ref, "\t</div>");
 //					pushString(&to, ref);
-					tmp = MAXCHAPTER;
-					tmp = MAXVERSE;
-					if (*vkey == tmp) {
-						tmp.Chapter(0);
-						tmp.Verse(0);
+					*tmp = MAXCHAPTER;
+					*tmp = MAXVERSE;
+					if (*vkey == *tmp) {
+						tmp->Chapter(0);
+						tmp->Verse(0);
 //						sprintf(ref, "\t</div>");
 //						pushString(&to, ref);
 /*
@@ -576,6 +576,7 @@
 */
 					}
 				}
+                                delete tmp;
 			}
 //			else if (vkey->Chapter()) {
 //				sprintf(ref, "\t<div type=\"chapter\" osisID=\"%s\">", vkey->getOSISRef());

Modified: trunk/src/modules/filters/thmlscripref.cpp
===================================================================
--- trunk/src/modules/filters/thmlscripref.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/filters/thmlscripref.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -53,7 +53,13 @@
 	SWBuf refs = "";
 	int footnoteNum = 1;
 	char buf[254];
-	VerseKey parser = key->getText();
+	SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey();
+        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+        if (!parser) {
+        	delete p;
+                parser = new VerseKey();
+        }
+	*parser = key->getText();
 
 	SWBuf orig = text;
 	const char *from = orig.c_str();
@@ -92,8 +98,8 @@
 						startTag.setAttribute("swordFootnote", buf);
 						SWBuf passage = startTag.getAttribute("passage");
 						if (passage.length())
-							refs = parser.ParseVerseList(passage.c_str(), parser, true).getRangeText();
-						else	refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText();
+							refs = parser->ParseVerseList(passage.c_str(), *parser, true).getRangeText();
+						else	refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText();
 						module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str();
 					}
 					hide = false;
@@ -132,6 +138,7 @@
 		}
 		else tagText += *from;
 	}
+        delete parser;
 	return 0;
 }
 

Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/swmodule.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -993,8 +993,8 @@
 		}
 	}
 
-	
-	// be sure we give CLucene enough file handles	
+
+	// be sure we give CLucene enough file handles
 	FileMgr::getSystemFileMgr()->flush();
 
 	// save key information so as not to disrupt original
@@ -1015,7 +1015,7 @@
 	IndexWriter *coreWriter = NULL;
 	IndexWriter *fsWriter = NULL;
 	Directory *d = NULL;
- 
+
 	standard::StandardAnalyzer *an = new standard::StandardAnalyzer();
 	SWBuf target = getConfigEntry("AbsoluteDataPath");
 	bool includeKeyInSearch = getConfig().has("SearchOption", "IncludeKeyInSearch");
@@ -1027,12 +1027,14 @@
 
 	ramDir = new RAMDirectory();
 	coreWriter = new IndexWriter(ramDir, an, true);
-	
 
- 
+
+
 	char perc = 1;
 	VerseKey *vkcheck = 0;
 	vkcheck = SWDYNAMIC_CAST(VerseKey, key);
+	VerseKey *chapMax = 0;
+        if (vkcheck) chapMax = (VerseKey *)vkcheck->clone();
 
 	TreeKeyIdx *tkcheck = 0;
 	tkcheck = SWDYNAMIC_CAST(TreeKeyIdx, key);
@@ -1050,14 +1052,13 @@
 	// position module at the beginning
 	*this = TOP;
 
-	VerseKey chapMax;
 	SWBuf proxBuf;
 	SWBuf proxLem;
 	SWBuf strong;
 
 	const short int MAX_CONV_SIZE = 2047;
 	wchar_t wcharBuffer[MAX_CONV_SIZE + 1];
-	
+
 	char err = Error();
 	while (!err) {
 		long mindex = key->Index();
@@ -1087,7 +1088,7 @@
 		if (content && *content) {
 			good = true;
 
-			
+
 			// build "strong" field
 			AttributeTypeList::iterator words;
 			AttributeList::iterator word;
@@ -1144,12 +1145,12 @@
 
 		// for VerseKeys use chapter
 		if (vkcheck) {
-			chapMax = *vkcheck;
+			*chapMax = *vkcheck;
 			// we're the first verse in a chapter
 			if (vkcheck->Verse() == 1) {
-				chapMax = MAXVERSE;
+				*chapMax = MAXVERSE;
 				VerseKey saveKey = *vkcheck;
-				while ((!err) && (*vkcheck <= chapMax)) {
+				while ((!err) && (*vkcheck <= *chapMax)) {
 //printf("building proxBuf from (%s).\nproxBuf.c_str(): %s\n", (const char *)*key, proxBuf.c_str());
 //printf("building proxBuf from (%s).\n", (const char *)*key);
 
@@ -1185,7 +1186,7 @@
 						proxBuf += content;
 						proxBuf.append(' ');
 						proxLem += strong;
-						if (proxLem.length()) 
+						if (proxLem.length())
 							proxLem.append("\n");
 					}
 					(*this)++;
@@ -1195,7 +1196,7 @@
 				*vkcheck = saveKey;
 			}
 		}
-		
+
 		// for TreeKeys use siblings if we have no children
 		else if (tkcheck) {
 			if (!tkcheck->hasChildren()) {
@@ -1237,7 +1238,7 @@
 							proxBuf += content;
 							proxBuf.append(' ');
 							proxLem += strong;
-							if (proxLem.length()) 
+							if (proxLem.length())
 								proxLem.append("\n");
 						}
 					} while (tkcheck->nextSibling());
@@ -1247,11 +1248,11 @@
 				else tkcheck->nextSibling();	// reposition from our previousSibling test
 			}
 		}
-		
+
 		if (proxBuf.length() > 0) {
-	
+
 			lucene_utf8towcs(wcharBuffer, proxBuf, MAX_CONV_SIZE); //keyText must be utf8
-		
+
 //printf("proxBuf after (%s).\nprox: %s\nproxLem: %s\n", (const char *)*key, proxBuf.c_str(), proxLem.c_str());
 
 			doc->add( *Field::UnStored(_T("prox"), wcharBuffer) );
@@ -1282,7 +1283,7 @@
 		if (IndexReader::isLocked(d)) {
 			IndexReader::unlock(d);
 		}
- 
+
 		fsWriter = new IndexWriter( d, an, false);
 	} else {
 		d = FSDirectory::getDirectory(target.c_str(), true);
@@ -1307,6 +1308,8 @@
 	if (searchKey)
 		delete searchKey;
 
+        delete chapMax;
+
 	processEntryAttributes(savePEA);
 
 	// reset option filters back to original values

Modified: trunk/src/modules/texts/rawtext/rawtext.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/rawtext.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/texts/rawtext/rawtext.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -112,21 +112,8 @@
 
 void RawText::linkEntry(const SWKey *inkey) {
 	VerseKey &destkey = getVerseKey();
-	const VerseKey *srckey = 0;
-
-	// see if we have a VerseKey * or decendant
-	SWTRY {
-		srckey = SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {}
-	// if we don't have a VerseKey * decendant, create our own
-	if (!srckey)
-		srckey = new VerseKey(inkey);
-
+	const VerseKey *srckey = &getVerseKey(inkey);
 	doLinkEntry(destkey.Testament(), destkey.TestamentIndex(), srckey->TestamentIndex());
-
-	if (inkey != srckey) // free our key if we created a VerseKey
-		delete srckey;
 }
 
 
@@ -161,7 +148,7 @@
 		long laststart = start;
 		unsigned short lastsize = size;
 		SWKey lasttry = *tmpkey;
-		(steps > 0) ? (*key)++ : (*key)--;
+		(steps > 0) ? ++(*key) : --(*key);
 		tmpkey = &getVerseKey();
 
 		if ((error = key->Error())) {

Modified: trunk/src/modules/texts/rawtext4/rawtext4.cpp
===================================================================
--- trunk/src/modules/texts/rawtext4/rawtext4.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/texts/rawtext4/rawtext4.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -112,21 +112,8 @@
 
 void RawText4::linkEntry(const SWKey *inkey) {
 	VerseKey &destkey = getVerseKey();
-	const VerseKey *srckey = 0;
-
-	// see if we have a VerseKey * or decendant
-	SWTRY {
-		srckey = SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {}
-	// if we don't have a VerseKey * decendant, create our own
-	if (!srckey)
-		srckey = new VerseKey(inkey);
-
+	const VerseKey *srckey = &getVerseKey(inkey);
 	doLinkEntry(destkey.Testament(), destkey.TestamentIndex(), srckey->TestamentIndex());
-
-	if (inkey != srckey) // free our key if we created a VerseKey
-		delete srckey;
 }
 
 
@@ -161,7 +148,7 @@
 		long laststart = start;
 		unsigned long lastsize = size;
 		SWKey lasttry = *tmpkey;
-		(steps > 0) ? (*key)++ : (*key)--;
+		(steps > 0) ? ++(*key) : --(*key);
 		tmpkey = &getVerseKey();
 
 		if ((error = key->Error())) {

Modified: trunk/src/modules/texts/swtext.cpp
===================================================================
--- trunk/src/modules/texts/swtext.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/texts/swtext.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -39,7 +39,9 @@
 	stdstr(&(this->versification), versification);
 	delete key;
 	key = (VerseKey *)CreateKey();
-	tmpVK = (VerseKey *)CreateKey();
+	tmpVK1 = (VerseKey *)CreateKey();
+	tmpVK2 = (VerseKey *)CreateKey();
+        tmpSecond = false;
 	skipConsecutiveLinks = false;
 }
 
@@ -49,7 +51,8 @@
  */
 
 SWText::~SWText() {
-	delete tmpVK;
+	delete tmpVK1;
+	delete tmpVK2;
 	delete [] versification;
 }
 
@@ -68,37 +71,20 @@
 
 
 long SWText::Index() const {
-	VerseKey *key = 0;
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
-
+	VerseKey *key = &getVerseKey();
 	entryIndex = key->Index();
 
-	if (key != this->key)
-		delete key;
-
 	return entryIndex;
 }
 
 long SWText::Index(long iindex) {
-	VerseKey *key = 0;
-	SWTRY {
-		key = SWDYNAMIC_CAST(VerseKey, this->key);
-	}
-	SWCATCH ( ... ) {}
-	if (!key)
-		key = new VerseKey(this->key);
+	VerseKey *key = &getVerseKey();
 
 	key->Testament(1);
 	key->Index(iindex);
 
 	if (key != this->key) {
 		this->key->copyFrom(*key);
-		delete key;
 	}
 
 	return Index();
@@ -128,9 +114,11 @@
 		}
 	}
 	if (!key) {
-		tmpVK->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
-		(*tmpVK) = *(thisKey);
-		return (*tmpVK);
+                VerseKey *retKey = (tmpSecond) ? tmpVK1 : tmpVK2;
+                tmpSecond = !tmpSecond;
+		retKey->setLocale(LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName());
+		(*retKey) = *(thisKey);
+		return (*retKey);
 	}
 	else	return *key;
 }

Modified: trunk/src/modules/texts/ztext/ztext.cpp
===================================================================
--- trunk/src/modules/texts/ztext/ztext.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/src/modules/texts/ztext/ztext.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -133,22 +133,8 @@
 
 void zText::linkEntry(const SWKey *inkey) {
 	VerseKey &destkey = getVerseKey();
-	const VerseKey *srckey = 0;
-
-	// see if we have a VerseKey * or decendant
-	SWTRY {
-		srckey = (const VerseKey *) SWDYNAMIC_CAST(VerseKey, inkey);
-	}
-	SWCATCH ( ... ) {
-	}
-	// if we don't have a VerseKey * decendant, create our own
-	if (!srckey)
-		srckey = new VerseKey(inkey);
-
+	const VerseKey *srckey = &getVerseKey(inkey);
 	doLinkEntry(destkey.Testament(), destkey.TestamentIndex(), srckey->TestamentIndex());
-
-	if (inkey != srckey) // free our key if we created a VerseKey
-		delete srckey;
 }
 
 
@@ -185,7 +171,7 @@
 		long laststart = start;
 		unsigned short lastsize = size;
 		SWKey lasttry = *tmpkey;
-		(steps > 0) ? (*key)++ : (*key)--;
+		(steps > 0) ? ++(*key) : --(*key);
 		tmpkey = &getVerseKey();
 
 		if ((error = key->Error())) {

Modified: trunk/utilities/diatheke/corediatheke.cpp
===================================================================
--- trunk/utilities/diatheke/corediatheke.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/diatheke/corediatheke.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -79,7 +79,7 @@
 				if (names && descriptions) *output << " : ";
 				if (descriptions) *output << target->Description();
 				*output << endl;
-			} 
+			}
 		}
 		if (types) *output << "Dictionaries:\n";
 		for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
@@ -101,11 +101,11 @@
 				*output << endl;
 			}
 		}
-		
+
 	}
 }
 
-void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAIN, unsigned char outputencoding = ENC_UTF8, unsigned long optionfilters = 0, unsigned char searchtype = ST_NONE, const char *range = 0, const char *text = 0, const char *locale = 0, const char *ref = 0, ostream* output = &cout, const char *script = 0, signed short variants = 0) { 
+void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAIN, unsigned char outputencoding = ENC_UTF8, unsigned long optionfilters = 0, unsigned char searchtype = ST_NONE, const char *range = 0, const char *text = 0, const char *locale = 0, const char *ref = 0, ostream* output = &cout, const char *script = 0, signed short variants = 0) {
 	static DiathekeMgr manager(NULL, NULL, false, outputencoding, outputformat,
 		((OP_BIDI & optionfilters) == OP_BIDI),
 		((OP_ARSHAPE & optionfilters) == OP_ARSHAPE));
@@ -114,18 +114,16 @@
 	ListKey listkey;
 	SectionMap::iterator sit;
 	ConfigEntMap::iterator eit;
-	
-	SWModule * target;
+
+	SWModule *target;
 	char *font = 0;
 	char inputformat = 0;
 	SWBuf encoding;
-	char querytype = 0;	
+	char querytype = 0;
 
 	if (locale) {
 		LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale);
 	}
-	VerseKey vk;
-	VerseKey *parser;
 
 	//deal with queries to "system"
 	if (!::stricmp(text, "system")) {
@@ -142,7 +140,12 @@
 		return;
 	}
 	target = (*it).second;
-	parser = (VerseKey*) target->CreateKey();
+	SWKey *p = target->CreateKey();
+        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
+	if (!parser) {
+        	delete p;
+	        parser = new VerseKey();
+	}
 
 	if ((sit = manager.config->Sections.find((*it).second->Name())) != manager.config->Sections.end()) {
 		if ((eit = (*sit).second.find("SourceType")) != (*sit).second.end()) {
@@ -175,10 +178,11 @@
 	    break;
 	  default:
 	    *output << "Other";
-	  }	 
+	  }
 	  *output << ";";
 	  *output << target->Type();
 	  *output << ";";
+	  delete parser;
 	  return;
 	}
 
@@ -191,8 +195,8 @@
 	else if (!strcmp(target->Type(), "Lexicons / Dictionaries"))
 		querytype = QT_LD;
 	else if (!strcmp(target->Type(), "Generic Books"))
-		querytype = QT_LD;	
-	
+		querytype = QT_LD;
+
 	if (optionfilters & OP_FOOTNOTES)
 		manager.setGlobalOption("Footnotes","On");
 	else
@@ -246,7 +250,7 @@
                 manager.setGlobalOption("Transliteration", script);
 	else
 		manager.setGlobalOption("Transliteration", "Off");
-	
+
 	if (querytype == QT_SEARCH) {
 
 	        //this test is just to determine if we've got SWKeys or VerseKeys
@@ -258,7 +262,7 @@
 		  querytype = QT_LD;
 		else if (!strcmp(target->Type(), "Generic Books"))
 		  querytype = QT_LD;
-		
+
 		//do search stuff
 		char st = 1 - searchtype;
 		if (querytype == QT_BIBLE) {
@@ -273,13 +277,13 @@
  			listkey = target->Search(ref, st, REG_ICASE, &scope);
  		}
  		else listkey = target->Search(ref, st, REG_ICASE);
-		
+
 		if (strlen((const char*)listkey)) {
 		  if (!listkey.Error()) {
 		    if (outputformat == FMT_CGI) *output << "<entry>";
 		    if (querytype == QT_BIBLE) {
-		      vk = listkey;
-		      *output << (const char *)vk;
+		      *parser = listkey;
+		      *output << (const char *)*parser;
 		    }
 		    else *output << (const char *)listkey;
 		    if (outputformat == FMT_CGI) *output << "</entry>";
@@ -289,20 +293,20 @@
 		    *output << " ; ";
 		    if (outputformat == FMT_CGI) *output << "<entry>";
 		    if (querytype == QT_BIBLE) {
-		      vk = listkey;
-		      *output << (const char *)vk;
+		      *parser = listkey;
+		      *output << (const char *)*parser;
 		    }
 		    else *output << (const char *)listkey;
 		    if (outputformat == FMT_CGI) *output << "</entry>";
 		    listkey++;
 		  }
 		  *output << " -- ";
-		  
+
 		  char *temp = new char[10];
 		  sprintf(temp, "%u", listkey.Count());
 		  *output << temp;
 		  delete [] temp;
-		  
+
 		  *output << " matches total (";
 		  *output << target->Name();
 		  *output << ")\n";
@@ -313,12 +317,12 @@
 		  *output << ")\n";
 		}
 	}
-	
+
 	else if (querytype == QT_LD) {
 		//do dictionary stuff
-		
+
 		target->setKey(ref);
-		
+
 		const char * text = (const char *) *target;
 
 		if (outputformat == FMT_RTF) {
@@ -331,8 +335,8 @@
 		}
 		else if (outputformat == FMT_HTML) {
 			*output << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">";
-		}		
-	
+		}
+
 		if (strlen(text)) {
 			*output << (char*)target->KeyText();
 			if (font && (outputformat == FMT_HTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
@@ -357,14 +361,14 @@
 			*output << "(";
 			*output << target->Name();
 			*output << ")\n";
-		}	
+		}
 
 		if (outputformat == FMT_RTF) {
 			*output << "}";
 		}
 
 	}
-	
+
 	else if (querytype == QT_BIBLE || querytype == QT_COMM) {
 		//do commentary/Bible stuff
 
@@ -374,7 +378,7 @@
 				if (strlen(font) == 0) font = 0;
 			}
 		}
-		
+
  		listkey = parser->ParseVerseList(ref, "Gen1:1", true);
 		int i;
 
@@ -394,8 +398,8 @@
 			VerseKey *element = SWDYNAMIC_CAST(VerseKey, listkey.GetElement(i));
 			if (element && element->isBoundSet()) {
 			  target->Key(element->LowerBound());
-				vk = element->UpperBound();
-				while (maxverses && target->Key() <= vk) {
+				*parser = element->UpperBound();
+				while (maxverses && target->Key() <= *parser) {
 					*output << (char*)target->KeyText();
 					if (font && (outputformat == FMT_HTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
 						*output << ": <font face=\"";
@@ -426,8 +430,8 @@
 						*output << "<CM>";
 
 					*output << "\n";
-					
-					if (target->Key() == vk)
+
+					if (target->Key() == *parser)
 					  break;
 					maxverses--;
 					(*target)++;
@@ -454,7 +458,7 @@
 				else if (outputformat == FMT_RTF) {
 					*output << "}";
 				}
-					
+
 				if (inputformat != FMT_THML && (outputformat == FMT_HTML || outputformat == FMT_THML || outputformat == FMT_CGI))
 					*output << "<br />";
 				else if (outputformat == FMT_OSIS)

Modified: trunk/utilities/mkfastmod.cpp
===================================================================
--- trunk/utilities/mkfastmod.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/mkfastmod.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -50,15 +50,13 @@
 
 int main(int argc, char **argv)
 {
-
 	if (argc != 2) {
 		fprintf(stderr, "usage: %s <modname>\n", argv[0]);
 		exit(-1);
 	}
-	
+
 	SWModule *target;
 	ListKey listkey;
-	VerseKey vk;
 	ModMap::iterator it;
 
 	SWMgr manager;

Modified: trunk/utilities/mod2osis.cpp
===================================================================
--- trunk/utilities/mod2osis.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/mod2osis.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -138,14 +138,19 @@
 	cout << "\t</header>\n\n";
 
 
-	(*inModule) = TOP; 
-//	for ((*inModule) = TOP; (inModule->Key() < (VerseKey)"Mat 2:1"); (*inModule)++) {
-//	for ((*vkey) = "Mark6:29"; !inModule->Error(); (*inModule)++) {
+	(*inModule) = TOP;
 
-	VerseKey tmpKey;
-	tmpKey.Headings(1);
-	tmpKey.AutoNormalize(0);
+	SWKey *p = inModule->CreateKey();
+        VerseKey *tmpKey = SWDYNAMIC_CAST(VerseKey, p);
+	if (!tmpKey) {
+        	delete p;
+	        tmpKey = new VerseKey();
+	}
+	*tmpKey = inModule->getKeyText();
 
+	tmpKey->Headings(1);
+	tmpKey->AutoNormalize(0);
+
 	for ((*inModule) = TOP; !inModule->Error(); (*inModule)++) {
 		bool newTest = false;
 		bool newBook = false;
@@ -173,10 +178,10 @@
 					cout << "\t</div>\n";
 			}
 			*buf = 0;
-			tmpKey = *vkey;
-			tmpKey.Chapter(0);
-			tmpKey.Verse(0);
-			sprintf(buf, "\t<div type=\"book\" osisID=\"%s\">\n", tmpKey.getOSISRef());
+			*tmpKey = *vkey;
+			tmpKey->Chapter(0);
+			tmpKey->Verse(0);
+			sprintf(buf, "\t<div type=\"book\" osisID=\"%s\">\n", tmpKey->getOSISRef());
 //			filter.ProcessText(buf, 200 - 3, &lastHeading, inModule);
 			cout << "" << buf << endl;
 			openbook = true;
@@ -188,9 +193,9 @@
 					cout << "\t</chapter>\n";
 			}
 			*buf = 0;
-			tmpKey = *vkey;
-			tmpKey.Verse(0);
-			sprintf(buf, "\t<chapter osisID=\"%s\">\n", tmpKey.getOSISRef());
+			*tmpKey = *vkey;
+			tmpKey->Verse(0);
+			sprintf(buf, "\t<chapter osisID=\"%s\">\n", tmpKey->getOSISRef());
 //			filter.ProcessText(buf, 200 - 3, &lastHeading, inModule);
 			cout << "" << buf;
 			openchap = true;

Deleted: trunk/utilities/mod2zmod2.cpp
===================================================================
--- trunk/utilities/mod2zmod2.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/mod2zmod2.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -1,222 +0,0 @@
-// Compression on variable granularity
-
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
- *	CrossWire Bible Society
- *	P. O. Box 2528
- *	Tempe, AZ  85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- */
-
-#include <fcntl.h>
-#include <iostream>
-#include <fstream>
-#include <string>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-//#include <ztext.h>
-#include <ztext2.h>
-//#include <zld.h>
-//#include <zcom.h>
-#include <swmgr.h>
-#include <lzsscomprs.h>
-#include <zipcomprs.h>
-#include <versekey.h>
-#include <versekey2.h>
-#include <stdio.h>
-#include <cipherfil.h>
-#ifndef NO_SWORD_NAMESPACE
-using sword::SWCompress;
-using sword::CipherFilter;
-using sword::SWModule;
-using sword::SWMgr;
-using sword::ModMap;
-using sword::zText2;
-//using sword::zLD;
-//using sword::zCom;
-using sword::SWFilter;
-using sword::VerseKey2;
-using sword::VerseKey;
-using sword::SWKey;
-using sword::SW_POSITION;
-using sword::ZipCompress;
-using sword::LZSSCompress;
-#endif
-
-using std::cerr;
-using std::string;
-using std::cout;
-using std::endl;
-
-void errorOutHelp(char *appName) {
-	cerr << appName << " - a tool to create compressed Sword modules\n";
-	cerr << "version 0.1\n\n";
-	cerr << "usage: "<< appName << " <modname> <datapath> [blockType [blockNum [compressType [cipherKey]]]]\n\n";
-	cerr << "datapath: the directory in which to write the zModule\n";
-	cerr << "blockType  : (default 4)\n\t2 - verses\n\t3 - chapters\n\t4 - books\n";
-	cerr << "blockNum  : (default 1)\n\tnumber of blockType per block\n";
-	cerr << "compressType: (default 1):\n\t1 - LZSS\n\t2 - Zip\n";
-	cerr << "\n\n";
-	exit(-1);
-}
-
-
-int main(int argc, char **argv)
-{
-	int iType = 4;
-	int iPerBlock = 1;
-	int compType = 1;
-	string cipherKey = "";
-	SWCompress *compressor = 0;
-	SWModule *inModule     = 0;
-	SWModule *outModule    = 0;
-	
-
-	if ((argc < 3) || (argc > 6)) {
-		errorOutHelp(argv[0]);
-	}
-
-	if (argc > 3) {
-		iType = atoi(argv[3]);
-		if (argc > 4) {
-			iPerBlock = atoi(argv[4]);
-			if (argc > 5) {
-				compType = atoi(argv[5]);
-				if (argc > 6) {
-					cipherKey = argv[6];
-				}
-			}
-		}
-	}
-
-	if ((iType < 2) || (iType > 5) || (iPerBlock < 1) || (compType < 1) || (compType > 2) || (!strcmp(argv[1], "-h")) || 
-		(!strcmp(argv[1], "--help")) || (!strcmp(argv[1], "/?")) || (!strcmp(argv[1], "-?")) || (!strcmp(argv[1], "-help"))) {
-		errorOutHelp(argv[0]);
-	}
-
-	SWMgr mgr;
-
-	ModMap::iterator it = mgr.Modules.find(argv[1]);
-	if (it == mgr.Modules.end()) {
-		fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
-		exit(-2);
-	}
-
-	inModule = it->second;
-
-	// Try to initialize a default set of datafiles and indicies at our
-	// datapath location passed to us from the user.
-	
-#define BIBLE 1
-#define LEX 2
-#define COM 3
-
-	int modType = 0;
-	if (!strcmp(inModule->Type(), "Biblical Texts")) modType = BIBLE;
-	if (!strcmp(inModule->Type(), "Lexicons / Dictionaries")) modType = LEX;
-	if (!strcmp(inModule->Type(), "Commentaries")) modType = COM;
-
-	switch (compType) {	// these are deleted by zText
-	case 1: compressor = new LZSSCompress(); break;
-	case 2: compressor = new ZipCompress(); break;
-	}
-	cout << "Creating module " << argv[2] << endl;
-	int result = 1;
-	switch (modType) {
-	case BIBLE:
-		result = zText2::createModule(argv[2], iType);
-		break;
-	case LEX:
-		//result = zLD::createModule(argv[2]);
-		result = 1;
-		break;
-	case COM:
-		result = zText2::createModule(argv[2], iType);
-		break;
-	}
-
-	if (result) {
-		fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
-		exit(-3);
-	}
-
-	cout << "Opening datapath with driver " << argv[2] << " Type " << iType << " PerBlock " << iPerBlock << endl;
-	switch (modType) {
-	case BIBLE:
-		outModule = new zText2(argv[2], 0, 0, iType, iPerBlock, compressor);	// open our datapath with our RawText driver.
-		((VerseKey *)(SWKey *)(*inModule))->Headings(1);
-		break;
-	case LEX:
-		//outModule = new zLD(argv[2], 0, 0, iType, compressor);	// open our datapath with our RawText driver.
-		break;
-	case COM:
-		outModule = new zText2(argv[2], 0, 0, iType, iPerBlock, compressor);	// open our datapath with our RawText driver.
-		((VerseKey *)(SWKey *)(*inModule))->Headings(1);
-		break;
-	}
-
-	SWFilter *cipherFilter = 0;
-	if (!cipherKey.empty()) {
-		cipherFilter = new CipherFilter(cipherKey.c_str());
-		outModule->AddRawFilter(cipherFilter);
-	}
-
-	string lastBuffer = "Something that would never be first module entry";
-	SWKey bufferKey;
-	SWKey lastBufferKey;
-	SWKey *outModuleKey = outModule->CreateKey();
-	VerseKey2 *vkey = SWDYNAMIC_CAST(VerseKey2, outModuleKey);
-	outModuleKey->Persist(1);
-	if (vkey) {
-		vkey->Headings(1);
-		vkey->AutoNormalize(0);
-	}
-	outModule->setKey(*outModuleKey);
-
-	inModule->setSkipConsecutiveLinks(false);
-	(*inModule) = TOP;
-	while (!inModule->Error()) {
-		bufferKey = *(SWKey *)(*inModule);
-		cout << bufferKey << endl;
-		// pseudo-check for link.  Will get most common links.
-		if ((lastBuffer == inModule->getRawEntry()) &&(lastBuffer.length() > 0)) {
-			*outModuleKey = bufferKey;
-			outModule->linkEntry(&lastBufferKey);	// link to last key
-		//cout << "Adding [" << bufferKey << "] link to: [" << lastBufferKey << "]\n";
-		}
-		else {
-			lastBuffer = inModule->getRawEntry();
-			lastBufferKey = inModule->KeyText();
-			if (lastBuffer.length() > 0) {
-				//cout << "Adding [" << bufferKey << "] new text. \n";
-				*outModuleKey = bufferKey;
-//				outModule->getRawEntry();	// snap
-//				outModule->setKey(bufferKey);
-				(*outModule) << lastBuffer.c_str();	// save new text;
-			}
-			else {
-				cout << "Skipping [" << bufferKey << "] no entry in inModule. \n";
-			}
-		}
-		(*inModule)++;
-	}
-	delete outModule;
-	delete outModuleKey;
-	if (cipherFilter)
-		delete cipherFilter;
-}
-

Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/osis2mod.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -88,31 +88,13 @@
 
 std::vector<ListKey> linkedVerses;
 
-const char *osisabbrevs[] = {
-	"Gen",    "Exod",   "Lev",    "Num",    "Deut",   "Josh",   "Judg",   "Ruth",
-	"1Sam",   "2Sam",   "1Kgs",   "2Kgs",   "1Chr",   "2Chr",   "Ezra",   "Neh",
-	"Esth",   "Job",    "Ps",     "Prov",   "Eccl",   "Song",   "Isa",    "Jer",
-	"Lam",    "Ezek",   "Dan",    "Hos",    "Joel",   "Amos",   "Obad",   "Jonah",
-	"Mic",    "Nah",    "Hab",    "Zeph",   "Hag",    "Zech",   "Mal",
-
-	"Matt",   "Mark",   "Luke",   "John",   "Acts",   "Rom",    "1Cor",   "2Cor",
-	"Gal",    "Eph",    "Phil",   "Col",    "1Thess", "2Thess", "1Tim",   "2Tim",
-	"Titus",  "Phlm",   "Heb",    "Jas",    "1Pet",   "2Pet",   "1John",  "2John",
-	"3John",  "Jude",   "Rev"
-};
-
 static bool inCanonicalOSISBook = true; // osisID is for a book that is not in Sword's canon
 static bool normalize           = true; // Whether to normalize UTF-8 to NFC
 
 bool isOSISAbbrev(const char *buf) {
-	bool match = false;
-	for (int i = 0; i < 66; i++) {
-		if (!strcmp(buf, osisabbrevs[i])) {
-			match = true;
-			break;
-		}
-	}
-	return match;
+        VerseMgr *vmgr = VerseMgr::getSystemVerseMgr();
+        VerseMgr::System *v11n = vmgr->getVersificationSystem(currentVerse.getVersificationSystem());
+        return v11n->getBookNumberByOSISName(buf) >= 0;
 }
 
 /**
@@ -307,6 +289,8 @@
 
 bool isKJVRef(const char *buf) {
 	VerseKey vk, test;
+        vk.setVersificationSystem(currentVerse.getVersificationSystem());
+        test.setVersificationSystem(currentVerse.getVersificationSystem());
 	vk.AutoNormalize(0);
 	vk.Headings(1);	// turn on mod/testmnt/book/chap headings
 	vk.Persist(1);
@@ -351,6 +335,7 @@
  */
 void makeKJVRef(VerseKey &key) {
 	VerseKey saveKey;
+        saveKey.setVersificationSystem(key.getVersificationSystem());
 	saveKey.AutoNormalize(0);
 	saveKey.Headings(1);
 	saveKey = currentVerse;
@@ -403,10 +388,12 @@
 	}
 
 	static VerseKey lastKey;
+	lastKey.setVersificationSystem(currentKey.getVersificationSystem());
 	lastKey.AutoNormalize(0);
 	lastKey.Headings(1);
 
 	VerseKey saveKey;
+        saveKey.setVersificationSystem(currentVerse.getVersificationSystem());
 	saveKey.AutoNormalize(0);
 	saveKey.Headings(1);
 	saveKey = currentVerse;
@@ -455,6 +442,7 @@
 		int testmt = currentVerse.Testament();
 		if ((testmt == 1 && firstOT) || (testmt == 2 && firstNT)) {
 			VerseKey t;
+                        t.setVersificationSystem(currentVerse.getVersificationSystem());
 			t.AutoNormalize(0);
 			t.Headings(1);
 			t = currentVerse;
@@ -518,6 +506,7 @@
 	}
 
 	VerseKey saveKey;
+        saveKey.setVersificationSystem(currentVerse.getVersificationSystem());
 	saveKey.AutoNormalize(0);
 	saveKey.Headings(1);
 	saveKey = currentVerse;
@@ -657,6 +646,7 @@
 				}
 				// Initializing a temporary and copying that because there were problems with setting the text directly
 				VerseKey t;
+                                t.setVersificationSystem(currentVerse.getVersificationSystem());
 				t.AutoNormalize(0);
 				t.Headings(1);
 				t = token.getAttribute("osisID");
@@ -699,6 +689,7 @@
 				// as it does not change the content of VerseKey!
 				// currentVerse = token.getAttribute("osisID");
 				VerseKey t;
+                                t.setVersificationSystem(currentVerse.getVersificationSystem());
 				t.AutoNormalize(0);
 				t.Headings(1);
 				t = token.getAttribute("osisID");
@@ -1157,10 +1148,12 @@
 {
 	// Link all the verses
 	VerseKey destKey;
+        destKey.setVersificationSystem(currentVerse.getVersificationSystem());
 	destKey.AutoNormalize(0);
 	destKey.Headings(1);
 
 	VerseKey linkKey;
+        linkKey.setVersificationSystem(currentVerse.getVersificationSystem());
 	linkKey.AutoNormalize(0);
 	linkKey.Headings(1);
 	for (unsigned int i = 0; i < linkedVerses.size(); i++) {
@@ -1259,6 +1252,8 @@
 		else usage(*argv, (((SWBuf)"Unknown argument: ")+ argv[i]).c_str());
 	}
 
+        currentVerse.setVersificationSystem(v11n);
+
 	switch (compType) {	// these are deleted by zText
 		case 0: break;
 		case 1: compressor = new LZSSCompress(); break;

Modified: trunk/utilities/vpl2mod.cpp
===================================================================
--- trunk/utilities/vpl2mod.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/vpl2mod.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -160,6 +160,7 @@
 	if (argc < 2) {
 //		fprintf(stderr, "usage: %s <vpl_file> </path/to/mod> [0|1 - file includes prepended verse references]\n", argv[0]);
 		fprintf(stderr, "usage: %s <source_vpl_file> </path/to/output/mod/> [0|1 - prepended verse refs] [0|1 - NT only]\n\n", argv[0]);
+		fprintf(stderr, "\tWARNING: THIS IS CURRENTLY A KJV-VERSIFICATION-ONLY UTILITY\n");
 		fprintf(stderr, "\tWith no verse refs, source file must contain exactly 31102 lines.\n");
 		fprintf(stderr, "\tThis is KJV verse count plus headings for MODULE,\n");
 		fprintf(stderr, "\tTESTAMENT, BOOK, CHAPTER. An example snippet follows:\n\n");

Deleted: trunk/utilities/vpl2zmod2.cpp
===================================================================
--- trunk/utilities/vpl2zmod2.cpp	2009-04-14 00:08:15 UTC (rev 2323)
+++ trunk/utilities/vpl2zmod2.cpp	2009-04-20 18:40:15 UTC (rev 2324)
@@ -1,310 +0,0 @@
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
- *	CrossWire Bible Society
- *	P. O. Box 2528
- *	Tempe, AZ  85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <swmgr.h>
-#include <ztext2.h>
-#include <iostream>
-#include <swbuf.h>
-#include <lzsscomprs.h>
-#include <zipcomprs.h>
-#include <versekey2.h>
-
-#ifndef NO_SWORD_NAMESPACE
-using sword::SWMgr;
-using sword::SWBuf;
-using sword::zText2;
-using sword::VerseKey2;
-using sword::SW_POSITION;
-using sword::SWCompress;
-//using sword::CipherFilter;
-using sword::zText2;
-using sword::ZipCompress;
-using sword::LZSSCompress;
-#endif
-
-using std::string;
-
-char readline(int fd, char **buf) {
-	char ch;
-	if (*buf)
-		delete [] *buf;
-	*buf = 0;
-	int len;
-
-
-	long index = lseek(fd, 0, SEEK_CUR);
-	// clean up any preceding white space
-	while ((len = read(fd, &ch, 1)) == 1) {
-		if ((ch != 13) && (ch != ' ') && (ch != '\t'))
-			break;
-		else index++;
-	}
-
-
-	while (ch != 10) {
-        if ((len = read(fd, &ch, 1)) != 1)
-			break;
-	}
-	
-	int size = (lseek(fd, 0, SEEK_CUR) - index) - 1;
-
-	*buf = new char [ size + 1 ];
-
-	if (size > 0) {
-		lseek(fd, index, SEEK_SET);
-		read(fd, *buf, size);
-		read(fd, &ch, 1);   //pop terminating char
-		(*buf)[size] = 0;
-
-		// clean up any trailing junk on buf
-		for (char *it = *buf+(strlen(*buf)-1); it > *buf; it--) {
-			if ((*it != 10) && (*it != 13) && (*it != ' ') && (*it != '\t'))
-				break;
-			else *it = 0;
-		}
-	}
-	else **buf = 0;
-	return !len;
-}
-
-
-char *parseVReg(char *buf) {
-	char stage = 0;
-
-	while (*buf) {
-		switch (stage) {
-		case 0:
-			if (isalpha(*buf))
-				stage++;
-			break;
-		case 1:
-			if (isdigit(*buf))
-				stage++;
-			break;
-		case 2:
-			if (*buf == ':')
-				stage++;
-			break;
-		case 3:
-			if (isdigit(*buf))
-				stage++;
-			break;
-	   case 4:
-			if (*buf == ' ') {
-				*buf = 0;
-				return ++buf;
-			}
-			break;
-		}
-		buf++;
-	}
-	return (stage == 4) ? buf : 0;  // if we got to stage 4 return after key buf, else return 0;
-}
-
-
-bool isKJVRef(const char *buf) {
-	VerseKey2 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.Book() && vk.Chapter() && vk.Verse()) { // if we're not a heading
-		//std::cerr << (const char*)vk << " == "  << (const char*)test << std::endl;
-		return (vk == test);
-	}
-	else return true;	// no check if we're a heading... Probably bad.
-}
-
-
-void fixText(char *text) {
-	char *to = text;
-	while(*text) {
-		*to++ = *text++;
-		*to++ = *text++;
-		if (!*text)
-			break;
-		if (*text != ' ')
-			std::cerr << "problem\n";
-		else	text++;
-	}
-	*to = 0;
-}
-
-int main(int argc, char **argv) {
-	int iType = 3;
-	int iPerBlock = 7;
-	int compType = 2;
-	SWBuf cipherKey = "";
-	SWCompress *compressor = 0;
-
-	// Let's test our command line arguments
-	if (argc < 2) {
-//		fprintf(stderr, "usage: %s <vpl_file> </path/to/mod> [0|1 - file includes prepended verse references]\n", argv[0]);
-		fprintf(stderr, "usage: %s <source_vpl_file> </path/to/output/mod/> [0|1 - prepended verse refs] [0|1 - NT only]\n\n", argv[0]);
-		fprintf(stderr, "\tWith no verse refs, source file must contain exactly 31102 lines.\n");
-		fprintf(stderr, "\tThis is KJV verse count plus headings for MODULE,\n");
-		fprintf(stderr, "\tTESTAMENT, BOOK, CHAPTER. An example snippet follows:\n\n");
-		fprintf(stderr, "\t\tMODULE HEADER\n");
-		fprintf(stderr, "\t\tOLD TESTAMENT HEADER\n");
-		fprintf(stderr, "\t\tGENESIS HEADER\n");
-		fprintf(stderr, "\t\tCHAPTER 1 HEADER\n");
-		fprintf(stderr, "\t\tIn the beginning...\n\n");
-		fprintf(stderr, "\t... implying there must also be a CHAPTER2 HEADER,\n");
-        fprintf(stderr, "\tEXODUS HEADER, NEW TESTAMENT HEADER, etc.  If there is no text for\n");
-		fprintf(stderr, "\tthe header, a blank line must, at least, hold place.\n\n");
-		fprintf(stderr, "\tWith verse refs, source file must simply contain any number of lines,\n");
-		fprintf(stderr, "\tthat begin with the verse reference for which it is an entry.  e.g.:\n\n");
-		fprintf(stderr, "\t\tgen 1:0 CHAPTER 1 HEADER\n");
-		fprintf(stderr, "\t\tgen 1:1 In the beginning...\n\n");
-		exit(-1);
-	}
-
-	// Let's see if we can open our input file
-	int fd = FileMgr::openFileReadOnly(argv[1]);
-	if (fd < 0) {
-		fprintf(stderr, "error: %s: couldn't open input file: %s \n", argv[0], argv[1]);
-		exit(-2);
-	}
-
-	// not used yet, but for future support of a vpl file with each line
-	// prepended with verse reference, eg. "Gen 1:1 In the beginning..."
-	bool vref = false;
-
-	// if 'nt' is the 4th arg, our vpl file only has the NT
-	bool ntonly = false;
-
-	if (argc > 3) {
-		vref = (argv[3][0] == '0') ? false : true;
-		if (argc > 4) {
-			ntonly = (argv[4][0] == '0') ? false : true;
-			if (argc > 5) {
-				iType = atoi(argv[5]);
-				if (argc > 6) {
-					iPerBlock = atoi(argv[6]);
-					if (argc > 7) {
-						compType = atoi(argv[7]);
-						if (argc > 8) {
-							cipherKey = argv[8];
-						}
-					}
-				}
-			}
-		}
-	}
-
-	// Try to initialize a default set of datafiles and indicies at our
-	// datapath location passed to us from the user.
-	if (zText2::createModule(argv[2], iType)) {
-		fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
-		exit(-3);
-	}
-	switch (compType) {	// these are deleted by zText
-	case 1: compressor = new LZSSCompress(); break;
-	case 2: compressor = new ZipCompress(); break;
-	}
-
-	// Do some initialization stuff
-	char *buffer = 0;
-	zText2 mod(argv[2], 0, 0, iType, iPerBlock, compressor);	// open our datapath with our zText2 driver.
-	VerseKey2 vk;
-	vk.AutoNormalize(0);
-	vk.Headings(1);	// turn on mod/testmnt/book/chap headings
-	vk.Persist(1);
-
-	mod.setKey(vk);
-
-	// Loop through module from TOP to BOTTOM and set next line from
-	// input file as text for this entry in the module
-	mod = TOP;
-	if (ntonly) vk = "Matthew 1:1";
-	  
-	int successive = 0;  //part of hack below
-	while ((!mod.Error()) && (!readline(fd, &buffer))) {
-		if (*buffer == '|')	// comments, ignore line
-			continue;
-		if (vref) {
-			const char *verseText = parseVReg(buffer);
-			if (!verseText) {	// if we didn't find a valid verse ref
-				std::cerr << "No valid verse ref found on line: " << buffer << "\n";
-				exit(-4);
-			}
-
-			vk = buffer;
-			if (vk.Error()) {
-				std::cerr << "Error parsing key: " << buffer << "\n";
-				exit(-5);
-			}
-			string orig = mod.getRawEntry();
-
-			if (!isKJVRef(buffer)) {
-				VerseKey2 origVK = vk;
-				/* This block is functioning improperly -- problem with AutoNormalize???
-				do {
-					vk--;
-				}
-				while (!vk.Error() && !isKJVRef(vk)); */
-				//hack to replace above:
-				successive++;
-				vk -= successive;
-				orig = mod.getRawEntry();
-
-				std::cerr << "Not a valid KJV ref: " << origVK << "\n";
-				std::cerr << "appending to ref: " << vk << "\n";
-				orig += " [ (";
-				orig += origVK;
-				orig += ") ";
-				orig += verseText;
-				orig += " ] ";
-				verseText = orig.c_str();
-			}
-			else {
-			  successive = 0;
-			}
-
-			if (orig.length() > 1)
-				   std::cerr << "Warning, overwriting verse: " << vk << std::endl;
-			  
-			// ------------- End verse tests -----------------
-			mod << verseText;	// save text to module at current position
-		}
-		else {
-			fixText(buffer);
-			mod << buffer;	// save text to module at current position
-			mod++;	// increment module position
-		}
-	}
-
-	// clear up our buffer that readline might have allocated
-	if (buffer)
-		delete [] buffer;
-}




More information about the sword-cvs mailing list