[sword-svn] r1790 - in trunk: . include lib/vcppmake/vc6 lib/vcppmake/vc7.1 samples samples/mods.d scripts src/keys src/mgr src/modules src/modules/comments/hrefcom src/modules/comments/rawcom src/modules/comments/rawfiles src/modules/comments/zcom src/modules/common src/modules/filters src/modules/genbook/rawgenbook src/modules/lexdict/rawld src/modules/lexdict/rawld4 src/modules/lexdict/zld src/modules/texts src/modules/texts/rawtext src/modules/texts/ztext src/utilfuns tests utilities utilities/kylixmake

scribe at crosswire.org scribe at crosswire.org
Mon May 2 20:49:04 MST 2005


Author: scribe
Date: 2005-05-02 20:49:04 -0700 (Mon, 02 May 2005)
New Revision: 1790

Removed:
   trunk/include/rawgbf.h
   trunk/include/unixstr.h
   trunk/include/utilconf.h
   trunk/include/utilfuns.h
   trunk/include/utilweb.h
   trunk/modlist
   trunk/src/modules/comments/hrefcom/jfbgen.cpp
   trunk/src/modules/comments/rawcom/mhcidx.cpp
   trunk/src/modules/comments/rawcom/rtfidx.cpp
   trunk/src/modules/comments/rawcom/rwpidx.cpp
   trunk/src/modules/comments/rawfiles/rawfilesgen.cpp
   trunk/src/modules/comments/zcom/makeidx.c
   trunk/src/modules/lexdict/rawld/no13.c
   trunk/src/modules/lexdict/rawld/rawldidx.c
   trunk/src/modules/lexdict/rawld/strongsidx.c
   trunk/src/modules/texts/rawgbf/
   trunk/src/modules/texts/rawtext/kjvidx.cpp
   trunk/src/modules/texts/rawtext/makebnds.c
   trunk/src/modules/texts/rawtext/nuidx.cpp
   trunk/src/modules/texts/rawtext/ojbtxidx.c
   trunk/src/modules/texts/rawtext/rawtxidx.c
   trunk/src/modules/texts/rawtext/rtfidx.cpp
   trunk/src/modules/texts/rawtext/svetxidx.c
   trunk/src/modules/texts/rawtext/vntidx.cpp
   trunk/src/modules/texts/ztext/gbfidx.cpp
   trunk/src/modules/texts/ztext/makeidx.c
   trunk/src/modules/texts/ztext/nasb.cpp
   trunk/src/utilfuns/unixstr.cpp
   trunk/src/utilfuns/utilconf.cpp
   trunk/src/utilfuns/utilweb.cpp
Modified:
   trunk/ChangeLog
   trunk/buildtest.cpp
   trunk/include/Makefile.am
   trunk/include/filemgr.h
   trunk/include/rawcom.h
   trunk/include/rawfiles.h
   trunk/include/rawgenbook.h
   trunk/include/rawld.h
   trunk/include/rawld4.h
   trunk/include/rawtext.h
   trunk/include/stringmgr.h
   trunk/include/swobject.h
   trunk/include/utilstr.h
   trunk/include/zcom.h
   trunk/include/zld.h
   trunk/include/ztext.h
   trunk/include/zverse.h
   trunk/lib/vcppmake/vc6/libsword.dsp
   trunk/lib/vcppmake/vc7.1/libsword.vcproj
   trunk/samples/mods.conf.large
   trunk/samples/mods.conf.small
   trunk/samples/mods.d/web.conf
   trunk/scripts/sapphire.cpp
   trunk/src/keys/listkey.cpp
   trunk/src/keys/strkey.cpp
   trunk/src/keys/swkey.cpp
   trunk/src/keys/treekeyidx.cpp
   trunk/src/keys/versekey.cpp
   trunk/src/mgr/curlftpt.cpp
   trunk/src/mgr/encfiltmgr.cpp
   trunk/src/mgr/filemgr.cpp
   trunk/src/mgr/ftplibftpt.cpp
   trunk/src/mgr/ftptrans.cpp
   trunk/src/mgr/installmgr.cpp
   trunk/src/mgr/localemgr.cpp
   trunk/src/mgr/stringmgr.cpp
   trunk/src/mgr/swconfig.cpp
   trunk/src/mgr/swlocale.cpp
   trunk/src/mgr/swmgr.cpp
   trunk/src/modules/comments/hrefcom/hrefcom.cpp
   trunk/src/modules/comments/rawcom/rawcom.cpp
   trunk/src/modules/comments/rawfiles/rawfiles.cpp
   trunk/src/modules/comments/zcom/zcom.cpp
   trunk/src/modules/common/rawstr.cpp
   trunk/src/modules/common/rawstr4.cpp
   trunk/src/modules/common/rawverse.cpp
   trunk/src/modules/common/sapphire.cpp
   trunk/src/modules/common/zstr.cpp
   trunk/src/modules/common/zverse.cpp
   trunk/src/modules/filters/gbffootnotes.cpp
   trunk/src/modules/filters/gbfheadings.cpp
   trunk/src/modules/filters/gbfmorph.cpp
   trunk/src/modules/filters/gbfosis.cpp
   trunk/src/modules/filters/gbfredletterwords.cpp
   trunk/src/modules/filters/gbfrtf.cpp
   trunk/src/modules/filters/gbfstrongs.cpp
   trunk/src/modules/filters/gbfwebif.cpp
   trunk/src/modules/filters/osisfootnotes.cpp
   trunk/src/modules/filters/osisheadings.cpp
   trunk/src/modules/filters/osislemma.cpp
   trunk/src/modules/filters/osismorph.cpp
   trunk/src/modules/filters/osisredletterwords.cpp
   trunk/src/modules/filters/osisscripref.cpp
   trunk/src/modules/filters/osisstrongs.cpp
   trunk/src/modules/filters/osiswebif.cpp
   trunk/src/modules/filters/osiswordjs.cpp
   trunk/src/modules/filters/plainfootnotes.cpp
   trunk/src/modules/filters/swbasicfilter.cpp
   trunk/src/modules/filters/swoptfilter.cpp
   trunk/src/modules/filters/thmlfootnotes.cpp
   trunk/src/modules/filters/thmlgbf.cpp
   trunk/src/modules/filters/thmlheadings.cpp
   trunk/src/modules/filters/thmlhtmlhref.cpp
   trunk/src/modules/filters/thmllemma.cpp
   trunk/src/modules/filters/thmlmorph.cpp
   trunk/src/modules/filters/thmlosis.cpp
   trunk/src/modules/filters/thmlrtf.cpp
   trunk/src/modules/filters/thmlscripref.cpp
   trunk/src/modules/filters/thmlstrongs.cpp
   trunk/src/modules/filters/thmlvariants.cpp
   trunk/src/modules/filters/thmlwebif.cpp
   trunk/src/modules/filters/thmlwordjs.cpp
   trunk/src/modules/filters/utf8html.cpp
   trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp
   trunk/src/modules/lexdict/rawld/rawld.cpp
   trunk/src/modules/lexdict/rawld4/rawld4.cpp
   trunk/src/modules/lexdict/zld/zld.cpp
   trunk/src/modules/swmodule.cpp
   trunk/src/modules/texts/rawtext/rawtext.cpp
   trunk/src/modules/texts/ztext/ztext.cpp
   trunk/src/utilfuns/Makefile.am
   trunk/src/utilfuns/utilstr.cpp
   trunk/sword.kdevprj
   trunk/tests/rawldidxtest.cpp
   trunk/tests/swbuftest.cpp
   trunk/tests/webiftest.cpp
   trunk/utilities/addcomment.cpp
   trunk/utilities/addgb.cpp
   trunk/utilities/addld.cpp
   trunk/utilities/addvs.cpp
   trunk/utilities/cipherraw.cpp
   trunk/utilities/imp2gbs.cpp
   trunk/utilities/imp2ld.cpp
   trunk/utilities/imp2vs.cpp
   trunk/utilities/kylixmake/libsword.bpr
   trunk/utilities/mkfastmod.cpp
   trunk/utilities/mod2osis.cpp
   trunk/utilities/mod2zmod.cpp
   trunk/utilities/osis2mod.cpp
   trunk/utilities/xml2gbs.cpp
Log:
Removed many tools files and added them to the sword-tools repository
Removed the need for many #if's throughout the code
Added seek, read, write, O_*, S_* to filemgr.cpp



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/ChangeLog	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,6 +1,12 @@
 API ChangeLog	(see the ChangeLog in each 'apps' directory for
 		app specific changes
 
+2-May-2005	Troy A. Griffitts <scribe at crosswire.org>
+	Removed many tools files and added them to
+		the sword-tools repository
+	Removed the need for many #if's throughout the code
+	Added seek, read, write, O_*, S_* to filemgr.cpp
+
 11-Apr-2005	Troy A. Griffitts <scribe at crosswire.org>
 	Cleaned up unused files in preparation for release
 	Updated pkg-config to report proper required libs

Modified: trunk/buildtest.cpp
===================================================================
--- trunk/buildtest.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/buildtest.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -3,7 +3,6 @@
 #include <rawtext.h>
 //#include <zcom.h>
 #include <rawcom.h>
-//#include <rawgbf.h>
 //#include <rawfiles.h>
 #ifndef NO_SWORD_NAMESPACE
 using sword::VerseKey;
@@ -21,7 +20,6 @@
 //	RawText text("src/modules/texts/rawtext/sve/", "Sven Text", "Sven Text");
 	RawText text("src/modules/texts/rawtext/webster/", "Webster", "Webster Text");
 //	RawText text("src/modules/texts/rawtext/orthjbc/", "Webster", "Webster Text");
-//	RawGBF text("src/modules/texts/rawgbf/newtext/", "WEB", "World English Bible");
 //	RawText text("src/modules/texts/rawtext/kjv/", "KJV", "KJV Text");
 //	RawText text("src/modules/texts/rawtext/vnt/", "VNT", "Valera Spanish NT");
 //	RawCom  commentary("src/modules/comments/rawcom/rwp/", "RWP", "Robertson's Word Pictures");

Modified: trunk/include/Makefile.am
===================================================================
--- trunk/include/Makefile.am	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/Makefile.am	2005-05-03 03:49:04 UTC (rev 1790)
@@ -62,7 +62,6 @@
 pkginclude_HEADERS += $(swincludedir)/plainhtml.h
 pkginclude_HEADERS += $(swincludedir)/rawcom.h
 pkginclude_HEADERS += $(swincludedir)/rawfiles.h
-pkginclude_HEADERS += $(swincludedir)/rawgbf.h
 pkginclude_HEADERS += $(swincludedir)/rawgenbook.h
 pkginclude_HEADERS += $(swincludedir)/rawld.h
 pkginclude_HEADERS += $(swincludedir)/rawld4.h
@@ -126,7 +125,6 @@
 pkginclude_HEADERS += $(swincludedir)/treekey.h
 pkginclude_HEADERS += $(swincludedir)/treekeyidx.h
 pkginclude_HEADERS += $(swincludedir)/unicodertf.h
-pkginclude_HEADERS += $(swincludedir)/unixstr.h
 pkginclude_HEADERS += $(swincludedir)/url.h
 pkginclude_HEADERS += $(swincludedir)/untgz.h
 pkginclude_HEADERS += $(swincludedir)/utf16utf8.h
@@ -141,11 +139,8 @@
 pkginclude_HEADERS += $(swincludedir)/utf8nfkd.h
 pkginclude_HEADERS += $(swincludedir)/utf8transliterator.h
 pkginclude_HEADERS += $(swincludedir)/utf8utf16.h
-pkginclude_HEADERS += $(swincludedir)/utilconf.h
-pkginclude_HEADERS += $(swincludedir)/utilfuns.h
 pkginclude_HEADERS += $(swincludedir)/utilstr.h
 pkginclude_HEADERS += $(swincludedir)/utilxml.h
-pkginclude_HEADERS += $(swincludedir)/utilweb.h
 
 pkginclude_HEADERS += $(swincludedir)/versekey.h
 pkginclude_HEADERS += $(swincludedir)/zcom.h

Modified: trunk/include/filemgr.h
===================================================================
--- trunk/include/filemgr.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/filemgr.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -31,19 +31,7 @@
 
 SWORD_NAMESPACE_START
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 
-#ifndef S_IREAD
-// Fix for VC6
-#ifdef _S_IREAD
-#define S_IREAD _S_IREAD
-#define S_IWRITE _S_IWRITE
-#endif
-//
-#endif
-
 class SWDLLEXPORT FileMgr;
 
 /**
@@ -65,6 +53,11 @@
 	/** @return File handle.
 	*/
 	int getFd();
+
+	long seek(long offset, int whence);
+	long read(void *buf, long count);
+	long write(const void *buf, long count);
+
 	/** Path to file.
 	*/
 	char *path;
@@ -94,6 +87,14 @@
 protected:
 	static FileMgr *systemFileMgr;
 public:
+	static int CREAT;
+	static int APPEND;
+	static int TRUNC;
+	static int RDONLY;
+	static int RDWR;
+	static int WRONLY;
+	static int IREAD;
+	static int IWRITE;
 
 	/** Maximum number of open files set in the constructor.
 	* determines the max number of real system files that

Modified: trunk/include/rawcom.h
===================================================================
--- trunk/include/rawcom.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawcom.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -50,7 +50,7 @@
 
 	// write interface ----------------------------
 	virtual bool isWritable() {
-		return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR));
+		return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & FileMgr::RDWR) == FileMgr::RDWR));
 	}
 	static char createModule(const char *path) { return RawVerse::createModule(path); }
 	virtual void setEntry(const char *inbuf, long len = -1);	// Modify current module entry

Modified: trunk/include/rawfiles.h
===================================================================
--- trunk/include/rawfiles.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawfiles.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -50,7 +50,7 @@
 	* @return yes or no
 	*/
 	virtual bool isWritable() {
-		return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR));
+		return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & FileMgr::RDWR) == FileMgr::RDWR));
 	}
 
 	/** Creates a new module

Deleted: trunk/include/rawgbf.h
===================================================================
--- trunk/include/rawgbf.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawgbf.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,47 +0,0 @@
-/******************************************************************************
- *  rawgbf.h   - code for class 'RawGBF'- a module that reads raw text files:
- *		  ot and nt using indexs ??.bks ??.cps ??.vss
- *
- * $Id$
- *
- * Copyright 1998 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.
- *
- */
-
-#ifndef RAWGBF_H
-#define RAWGBF_H
-
-#include <rawverse.h>
-#include <swtext.h>
-#include <swfilter.h>
-
-#include <defs.h>
-
-SWORD_NAMESPACE_START
-
-class SWDLLEXPORT RawGBF:public SWText, public RawVerse
-{
-
-public:
-  
-    
-    RawGBF (const char *ipath, const char *iname = 0, const char *idesc =
-	    0, SWDisplay * idisp = 0);
-    virtual ~ RawGBF ();
-  virtual operator char *();
-};
-
-SWORD_NAMESPACE_END
-#endif

Modified: trunk/include/rawgenbook.h
===================================================================
--- trunk/include/rawgenbook.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawgenbook.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -45,7 +45,7 @@
 	virtual SWBuf &getRawEntryBuf();
 	// write interface ----------------------------
 	virtual bool isWritable() {
-		return ((bdtfd->getFd() > 0) && ((bdtfd->mode & O_RDWR) == O_RDWR));
+		return ((bdtfd->getFd() > 0) && ((bdtfd->mode & FileMgr::RDWR) == FileMgr::RDWR));
 	}
 	static char createModule(const char *ipath);
 	virtual void setEntry(const char *inbuf, long len = -1);	// Modify current module entry

Modified: trunk/include/rawld.h
===================================================================
--- trunk/include/rawld.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawld.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -48,7 +48,7 @@
 	virtual void increment(int steps = 1);
 	virtual void decrement(int steps = 1) { increment(-steps); }
 	// write interface ----------------------------
-	virtual bool isWritable() { return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR)); }
+	virtual bool isWritable() { return ((idxfd->getFd() > 0) && ((idxfd->mode & FileMgr::RDWR) == FileMgr::RDWR)); }
 	static char createModule(const char *path) { return RawStr::createModule (path); }
 
 	virtual void setEntry(const char *inbuf, long len = -1);	// Modify current module entry

Modified: trunk/include/rawld4.h
===================================================================
--- trunk/include/rawld4.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawld4.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -49,7 +49,7 @@
 	virtual void decrement(int steps = 1) { increment(-steps); }
 	// write interface ----------------------------
 	virtual bool isWritable() {
-		return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR));
+		return ((idxfd->getFd() > 0) && ((idxfd->mode & FileMgr::RDWR) == FileMgr::RDWR));
 	}
 	static char createModule(const char *path) { return RawStr4::createModule(path); }
 

Modified: trunk/include/rawtext.h
===================================================================
--- trunk/include/rawtext.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/rawtext.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -51,7 +51,7 @@
 	virtual bool hasSearchFramework() { return true; }
 	virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
 	// write interface ----------------------------
-	virtual bool isWritable() { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
+	virtual bool isWritable() { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & FileMgr::RDWR) == FileMgr::RDWR)); }
 	static char createModule(const char *path) { return RawVerse::createModule(path); }
 	virtual void setEntry(const char *inbuf, long len = -1);	// Modify current module entry
 	virtual void linkEntry(const SWKey *linkKey);	// Link current module entry to other module entry

Modified: trunk/include/stringmgr.h
===================================================================
--- trunk/include/stringmgr.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/stringmgr.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,10 +1,10 @@
 /******************************************************************************
- *	stringmgr.h - A class which provides string andling functions which can 
- *			reimplemented by frontends
+ *	stringmgr.h - A class which provides string handling functions which can 
+ *			be reimplemented by frontends
  *
  * $Id$
  *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2005 CrossWire Bible Society (http://www.crosswire.org)
  *	CrossWire Bible Society
  *	P. O. Box 2528
  *	Tempe, AZ	85280-2528
@@ -41,6 +41,7 @@
 	* @return The global string handle
 	*/
 	static StringMgr* getSystemStringMgr();
+
 	/** Checks whether Utf8 support is available.
 	* Override the function supportsUnicode() to tell whether your implementation has utf8 support.
 	* @return True if this implementation provides support for Utf8 handling or false if just latin1 handling is available

Modified: trunk/include/swobject.h
===================================================================
--- trunk/include/swobject.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/swobject.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,12 +1,28 @@
+/******************************************************************************
+*  swobject.h  - definition for SWObject used as lowest base class for many
+*	SWORD objects
+*
+* $Id$
+*
+* Copyright 2005 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.
+*
+*/
+
 #ifndef SWOBJECT_H
 #define SWOBJECT_H
 
-#include <utilfuns.h>
-#if !defined(__GNUC__) && !defined(_WIN32_WCE)
-#else
-#include <unixstr.h>
-#endif
-
 #include <defs.h>
 
 SWORD_NAMESPACE_START
@@ -24,13 +40,7 @@
 		this->descends = descends;
 	}
 
-	bool isAssignableFrom(const char *className) const {
-		for (int i = 0; descends[i]; i++) {
-			if (!stricmp(descends[i], className))
-				return true;
-		}
-		return false;
-	}
+	bool isAssignableFrom(const char *className) const;
 };
 
 /** Base class for major Sword classes.

Deleted: trunk/include/unixstr.h
===================================================================
--- trunk/include/unixstr.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/unixstr.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,30 +0,0 @@
-// Include only if your UNIX compiler does not include stricmp but does include strcasecmp
-/*
- *
- * $Id$
- *
- * Copyright 1998 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.
- *
- */
-
-#ifndef UNIXSTR_H
-#define UNIXSTR_H
-#include <defs.h>
-
-SWORD_NAMESPACE_START
-int stricmp (const char *s1, const char *s2);
-SWORD_NAMESPACE_END
-
-#endif

Deleted: trunk/include/utilconf.h
===================================================================
--- trunk/include/utilconf.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/utilconf.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,9 +0,0 @@
-#ifndef UTILCONF_H
-#define UTILCONF_H
-
-#include <defs.h>
-SWORD_NAMESPACE_START
-char getconfent (char *filename, char *entryname, char *buf, int len);
-SWORD_NAMESPACE_END
-
-#endif

Deleted: trunk/include/utilfuns.h
===================================================================
--- trunk/include/utilfuns.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/utilfuns.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,29 +0,0 @@
-/******************************************************************************
- *  utilfuns.h	- utility function prototypes
- *
- * $Id$
- *
- * Copyright 1998 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.
- *
- */
-#ifndef UTILFUNS_H
-#define UTILFUNS_H
-
-
-#include <utilstr.h>
-#include <utilconf.h>
-#include <utilweb.h>
-
-#endif

Modified: trunk/include/utilstr.h
===================================================================
--- trunk/include/utilstr.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/utilstr.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -33,8 +33,8 @@
 char *stdstr (char **iistr, const char *istr, unsigned int memPadFactor = 1);
 char *strstrip (char *istr);
 const char *stristr (const char *s1, const char *s2);
-const char strnicmp(const char *s1, const char *s2, int len);
-unsigned int strlenw(const char *s1);
+int strnicmp(const char *s1, const char *s2, int len);
+int stricmp(const char *s1, const char *s2);
 // char *toupperstr(char *buf);
 // char *toupperstr_utf8(char *buf, unsigned int max = 0);
 

Deleted: trunk/include/utilweb.h
===================================================================
--- trunk/include/utilweb.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/utilweb.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,40 +0,0 @@
-/******************************************************************************
- *  utilxml.h   - definition of class that deal with xml constructs 
- *
- * $Id$
- *
- * Copyright 1998 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.
- *
- */
-
-#ifndef UTILWEB_H
-#define UTILWEB_H
-
-#include <defs.h>
-#include <swbuf.h>
-
-SWORD_NAMESPACE_START
-
-/** Encodes and URL
-* Encodes a string into a valid URL, e.g. changes http://www.crosswire.org/test.jsp?force=1&help=1 into
-* http://www.crosswire.org/test.jsp?force=1&amp;help=1
-* This function works on the data of the buf parameter.
-*/
-const SWBuf encodeURL( const SWBuf& buf );
-
-SWORD_NAMESPACE_END
-
-#endif
-

Modified: trunk/include/zcom.h
===================================================================
--- trunk/include/zcom.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/zcom.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -53,7 +53,7 @@
 
 	// write interface ----------------------------
 	virtual bool isWritable() {
-		return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR));
+		return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & FileMgr::RDWR) == FileMgr::RDWR));
 	}
 	static char createModule(const char *path, int blockBound) {
 		return zVerse::createModule(path, blockBound);

Modified: trunk/include/zld.h
===================================================================
--- trunk/include/zld.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/zld.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -48,7 +48,7 @@
 
 	// write interface ----------------------------
 	virtual bool isWritable() {
-		return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR));
+		return ((idxfd->getFd() > 0) && ((idxfd->mode & FileMgr::RDWR) == FileMgr::RDWR));
 	}
 	static char createModule(const char *path) {
 		return zStr::createModule(path);

Modified: trunk/include/ztext.h
===================================================================
--- trunk/include/ztext.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/ztext.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -67,7 +67,7 @@
 	virtual void decrement(int steps = 1) { increment(-steps); }
 
   // write interface ----------------------------
-	virtual bool isWritable() { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
+	virtual bool isWritable() { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & FileMgr::RDWR) == FileMgr::RDWR)); }
 	static char createModule(const char *path, int blockBound) {
 		return zVerse::createModule(path, blockBound);
 	}

Modified: trunk/include/zverse.h
===================================================================
--- trunk/include/zverse.h	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/include/zverse.h	2005-05-03 03:49:04 UTC (rev 1790)
@@ -46,7 +46,7 @@
 	char nl;
 
 
-	zVerse(const char *ipath, int fileMode = O_RDONLY, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
+	zVerse(const char *ipath, int fileMode = FileMgr::RDONLY, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
 	virtual ~zVerse();
 	void findOffset(char testmt, long idxoff, long *start, unsigned short *end);
 	void zReadText(char testmt, long start, unsigned short size, SWBuf &buf);

Modified: trunk/lib/vcppmake/vc6/libsword.dsp
===================================================================
--- trunk/lib/vcppmake/vc6/libsword.dsp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/lib/vcppmake/vc6/libsword.dsp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -883,10 +883,6 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\..\include\rawgbf.h
-# End Source File
-# Begin Source File
-
 SOURCE=..\..\..\include\rawgenbook.h
 # End Source File
 # Begin Source File

Modified: trunk/lib/vcppmake/vc7.1/libsword.vcproj
===================================================================
--- trunk/lib/vcppmake/vc7.1/libsword.vcproj	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/lib/vcppmake/vc7.1/libsword.vcproj	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5401,9 +5401,6 @@
 				RelativePath="..\..\..\include\rawfiles.h">
 			</File>
 			<File
-				RelativePath="..\..\..\include\rawgbf.h">
-			</File>
-			<File
 				RelativePath="..\..\..\include\rawgenbook.h">
 			</File>
 			<File

Deleted: trunk/modlist
===================================================================
--- trunk/modlist	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/modlist	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,35 +0,0 @@
-sword/src/modules/texts/rawtext/websters
-sword/src/modules/texts/rawtext/kjv
-sword/src/modules/texts/rawtext/kjvstr
-sword/src/modules/texts/rawtext/sve
-sword/src/modules/texts/rawtext/vnt
-sword/src/modules/texts/rawtext/nu
-sword/src/modules/texts/rawtext/gnt
-sword/src/modules/texts/rawtext/bbe
-sword/src/modules/texts/rawtext/indbis
-sword/src/modules/texts/rawtext/indtb
-sword/src/modules/texts/rawgbf/web
-sword/src/modules/texts/rawgbf/frenchlsg
-sword/src/modules/texts/rawgbf/niv
-sword/src/modules/texts/rawgbf/nasb
-sword/src/modules/texts/rawgbf/spanishrva
-sword/src/modules/texts/rawgbf/germanelb
-sword/src/modules/texts/ztext/webster
-sword/src/modules/texts/ztext/nasb
-sword/src/modules/texts/rawtext/orthjbc
-
-sword/src/modules/comments/rawcom/mhc
-sword/src/modules/comments/rawcom/rwp
-sword/src/modules/comments/rawcom/jfb
-sword/src/modules/comments/rawfiles/personal
-sword/src/modules/comments/hrefcom/jfb
-sword/src/modules/comments/zcom/mhc
-
-sword/src/modules/lexdict/rawld/eastons
-sword/src/modules/lexdict/rawld/vines
-sword/src/modules/lexdict/rawld/strongs
-sword/src/modules/lexdict/rawld/naves
-
-sword/examples/windoze/delphi20/ojbcwin
-sword/olb/all.c
-sword/olb/online.h

Modified: trunk/samples/mods.conf.large
===================================================================
--- trunk/samples/mods.conf.large	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/samples/mods.conf.large	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,8 +8,9 @@
 About=This module allows you to store your own commentary.
 
 [SpanishRVA]
-DataPath=/usr/local/sword/modules/texts/rawgbf/spanishrva/
-ModDrv=RawGBF
+DataPath=/usr/local/sword/modules/texts/rawtext/spanishrva/
+ModDrv=RawText
+SourceType=GBF
 Description=The New International Version
 About=\qc El texto b¡blico designado RVA es de LA SANTA BIBLIA, \par \
 VERSION REINA-VALERA ACTUALIZADA. Copyright 1982, 1986, \par \
@@ -21,8 +22,8 @@
 
 
 [NASB]
-DataPath=/usr/local/sword/modules/texts/rawgbf/nasb/
-ModDrv=RawGBF
+DataPath=/usr/local/sword/modules/texts/rawtext/nasb/
+ModDrv=RawText
 Description=The New American Standard Bible
 About=\qc -=+* see the file errata.doc for important verse descrepencies *+=- \par\par \
 The New American Standard Bible \par \
@@ -38,8 +39,8 @@
 
 
 [NIV]
-DataPath=/usr/local/sword/modules/texts/rawgbf/niv/
-ModDrv=RawGBF
+DataPath=/usr/local/sword/modules/texts/rawtext/niv/
+ModDrv=RawText
 Description=The New International Version
 About=\qc -=+* see the file errata.doc for important verse descrepencies *+=- \par\par\pard \
 Quotations designated (NIV) are from \par\par \
@@ -362,8 +363,8 @@
 
 
 [WEB]
-DataPath=/usr/local/sword/modules/texts/rawgbf/web/
-ModDrv=RawGBF
+DataPath=/usr/local/sword/modules/texts/rawtext/web/
+ModDrv=RawText
 Description=The World English Bible
 About= -=+* see the file 'info.txt' for more details *+=-\par\par \
 \qc The World English Bible (WEB) \par\par Public Domain \par\par \pard \
@@ -450,8 +451,8 @@
         http://www.online-bible.com
 
 [FrenchLSG]
-DataPath=/usr/local/sword/modules/texts/rawgbf/frenchlsg/
-ModDrv=RawGBF
+DataPath=/usr/local/sword/modules/texts/rawtext/frenchlsg/
+ModDrv=RawText
 Description=French 1910 Louis Segond Version 
 About=The 1910 edition of the Louis Segond Bible is keyed to Strong's numbers.  \
 All this material may be freely copied and shared with your friends.  \

Modified: trunk/samples/mods.conf.small
===================================================================
--- trunk/samples/mods.conf.small	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/samples/mods.conf.small	2005-05-03 03:49:04 UTC (rev 1790)
@@ -126,8 +126,9 @@
 
 
 [WEB]
-DataPath=/usr/local/lib/sword/modules/texts/rawgbf/web/
-ModDrv=RawGBF
+DataPath=/usr/local/lib/sword/modules/texts/rawtext/web/
+ModDrv=RawText
+SourceType=GBF
 Description=The World English Bible
 About= -=+* see the file 'info.txt' for more details *+=-\par\par \
 \qc The World English Bible (WEB) \par\par Public Domain \par\par \pard \

Modified: trunk/samples/mods.d/web.conf
===================================================================
--- trunk/samples/mods.d/web.conf	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/samples/mods.d/web.conf	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,6 +1,7 @@
 [WEB]
-DataPath=/usr/local/lib/sword/modules/texts/rawgbf/web/
-ModDrv=RawGBF
+DataPath=/usr/local/lib/sword/modules/texts/rawtext/web/
+ModDrv=RawText
+SourceType=GBF
 Description=The World English Bible
 About= -=+* see the file 'info.txt' for more details *+=-\par\par \
 \qc The World English Bible (WEB) \par\par Public Domain \par\par \pard \

Modified: trunk/scripts/sapphire.cpp
===================================================================
--- trunk/scripts/sapphire.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/scripts/sapphire.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -19,14 +19,6 @@
  */
 
 
-#ifdef UNIX
-#include <memory.h>
-#include <unistd.h>
-#else
-#include <mem.h>
-#endif
-#include "sapphire.h"
-
 unsigned char sapphire::keyrand(int limit,
                                 unsigned char *user_key,
                                 unsigned char keysize,

Modified: trunk/src/keys/listkey.cpp
===================================================================
--- trunk/src/keys/listkey.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/keys/listkey.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -4,7 +4,7 @@
  *				(e.g. a list of verses, place, etc.)
  */
 
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <stdlib.h>
 #include <swkey.h>
 #include <listkey.h>

Modified: trunk/src/keys/strkey.cpp
===================================================================
--- trunk/src/keys/strkey.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/keys/strkey.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5,7 +5,6 @@
  */
 
 #include <swmacs.h>
-#include <utilfuns.h>
 #include <strkey.h>
 #include <stdio.h>
 

Modified: trunk/src/keys/swkey.cpp
===================================================================
--- trunk/src/keys/swkey.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/keys/swkey.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5,7 +5,7 @@
  */
 
 #include <swkey.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/keys/treekeyidx.cpp
===================================================================
--- trunk/src/keys/treekeyidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/keys/treekeyidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -25,12 +25,8 @@
 #include <stdio.h>
 #include <errno.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
 #include <swlog.h>
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 
@@ -54,18 +50,14 @@
 	path = 0;
 	stdstr(&path, idxPath);
 
-#ifndef O_BINARY		// O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0		// If it hasn't been defined than we probably
-#endif				// don't need it.
-
 	if (fileMode == -1) { // try read/write if possible
-		fileMode = O_RDWR;
+		fileMode = FileMgr::RDWR;
 	}
 		
 	buf.setFormatted("%s.idx", path);
-	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 	buf.setFormatted("%s.dat", path);
-	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	if (datfd <= 0) {
 		SWLog::getSystemLog()->logError("%d", errno);
@@ -202,7 +194,7 @@
 		while (lastSib.next > -1) {
 			getTreeNodeFromIdxOffset(lastSib.next, &lastSib);
 		}
-		__u32 idxOffset = lseek(idxfd->getFd(), 0, SEEK_END);
+		__u32 idxOffset = idxfd->seek(0, SEEK_END);
 		lastSib.next = idxOffset;
 		saveTreeNodeOffsets(&lastSib);
 		__u32 parent = currentNode.parent;
@@ -218,7 +210,7 @@
 		append();
 	}
 	else {
-		__u32 idxOffset = lseek(idxfd->getFd(), 0, SEEK_END);
+		__u32 idxOffset = idxfd->seek(0, SEEK_END);
 		currentNode.firstChild = idxOffset;
 		saveTreeNodeOffsets(&currentNode);
 		__u32 parent = currentNode.offset;
@@ -256,13 +248,13 @@
 
 	sprintf(buf, "%s.dat", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s.idx", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
 
@@ -293,33 +285,33 @@
 
 	if (datfd > 0) {
 
-		lseek(datfd->getFd(), ioffset, SEEK_SET);
+		datfd->seek(ioffset, SEEK_SET);
 
-		read(datfd->getFd(), &tmp, 4);
+		datfd->read(&tmp, 4);
 		node->parent = swordtoarch32(tmp);
 
-		read(datfd->getFd(), &tmp, 4);
+		datfd->read(&tmp, 4);
 		node->next = swordtoarch32(tmp);
 
-		read(datfd->getFd(), &tmp, 4);
+		datfd->read(&tmp, 4);
 		node->firstChild = swordtoarch32(tmp);
 
 		SWBuf name;
 		do {
-			read(datfd->getFd(), &ch, 1);
+			datfd->read(&ch, 1);
 			name += ch;
 		} while (ch);
 
 		stdstr(&(node->name), name.c_str());
 
-		read(datfd->getFd(), &tmp2, 2);
+		datfd->read(&tmp2, 2);
 		node->dsize = swordtoarch16(tmp2);
 
 		if (node->dsize) {
 			if (node->userData)
 				delete [] node->userData;
 			node->userData = new char [node->dsize];
-			read(datfd->getFd(), node->userData, node->dsize);
+			datfd->read(node->userData, node->dsize);
 		}
 	}
 }
@@ -346,15 +338,15 @@
 	node->offset = ioffset;
 	if (idxfd > 0) {
 		if (idxfd->getFd() > 0) {
-			lseek(idxfd->getFd(), ioffset, SEEK_SET);
-			if (read(idxfd->getFd(), &offset, 4) == 4) {
+			idxfd->seek(ioffset, SEEK_SET);
+			if (idxfd->read(&offset, 4) == 4) {
 				offset = swordtoarch32(offset);
 				error = (error == 77) ? KEYERR_OUTOFBOUNDS : 0;
 				getTreeNodeFromDatOffset(offset, node);
 			}
 			else {
-				lseek(idxfd->getFd(), -4, SEEK_END);
-				if (read(idxfd->getFd(), &offset, 4) == 4) {
+				idxfd->seek(-4, SEEK_END);
+				if (idxfd->read(&offset, 4) == 4) {
 					offset = swordtoarch32(offset);
 					getTreeNodeFromDatOffset(offset, node);
 				}
@@ -379,25 +371,25 @@
 	__s32 tmp;
 
 	if (idxfd > 0) {
-		lseek(idxfd->getFd(), node->offset, SEEK_SET);
-		if (read(idxfd->getFd(), &tmp, 4) != 4) {
-			datOffset = lseek(datfd->getFd(), 0, SEEK_END);
+		idxfd->seek(node->offset, SEEK_SET);
+		if (idxfd->read(&tmp, 4) != 4) {
+			datOffset = datfd->seek(0, SEEK_END);
 			tmp = archtosword32(datOffset);
-			write(idxfd->getFd(), &tmp, 4);
+			idxfd->write(&tmp, 4);
 		}
 		else {
 			datOffset = swordtoarch32(tmp);
-			lseek(datfd->getFd(), datOffset, SEEK_SET);
+			datfd->seek(datOffset, SEEK_SET);
 		}
 
 		tmp = archtosword32(node->parent);
-		write(datfd->getFd(), &tmp, 4);
+		datfd->write(&tmp, 4);
 
 		tmp = archtosword32(node->next);
-		write(datfd->getFd(), &tmp, 4);
+		datfd->write(&tmp, 4);
 
 		tmp = archtosword32(node->firstChild);
-		write(datfd->getFd(), &tmp, 4);
+		datfd->write(&tmp, 4);
 	}
 }
 
@@ -444,22 +436,22 @@
 	__s32 tmp;
 	if (idxfd > 0) {
 
-		lseek(idxfd->getFd(), node->offset, SEEK_SET);
-		datOffset = lseek(datfd->getFd(), 0, SEEK_END);
+		idxfd->seek(node->offset, SEEK_SET);
+		datOffset = datfd->seek(0, SEEK_END);
 		tmp = archtosword32(datOffset);
-		write(idxfd->getFd(), &tmp, 4);
+		idxfd->write(&tmp, 4);
 
 		saveTreeNodeOffsets(node);
 
-		write(datfd->getFd(), node->name, strlen(node->name));
+		datfd->write(node->name, strlen(node->name));
 		char null = 0;
-		write(datfd->getFd(), &null, 1);
+		datfd->write(&null, 1);
 
 		__u16 tmp2 = archtosword16(node->dsize);
-		write(datfd->getFd(), &tmp2, 2);
+		datfd->write(&tmp2, 2);
 
 		if (node->dsize) {
-			write(datfd->getFd(), node->userData, node->dsize);
+			datfd->write(node->userData, node->dsize);
 		}
 	}
 }
@@ -503,7 +495,7 @@
 		root();
 		break;
 	case POS_BOTTOM:
-		error = getTreeNodeFromIdxOffset(lseek(idxfd->getFd(), -4, SEEK_END), &currentNode);
+		error = getTreeNodeFromIdxOffset(idxfd->seek(-4, SEEK_END), &currentNode);
 		break;
 	} 
 	Error();	// clear error from normalize

Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/keys/versekey.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -3,17 +3,10 @@
  */
 
 #include <swmacs.h>
-#include <utilfuns.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <stdlib.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
 #include <utilstr.h>
 #include <stringmgr.h>
 #include <swkey.h>

Modified: trunk/src/mgr/curlftpt.cpp
===================================================================
--- trunk/src/mgr/curlftpt.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/curlftpt.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,16 +7,7 @@
 #include <curlftpt.h>
 
 #include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #include <curl/curl.h>
 #include <curl/types.h>
 #include <curl/easy.h>

Modified: trunk/src/mgr/encfiltmgr.cpp
===================================================================
--- trunk/src/mgr/encfiltmgr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/encfiltmgr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -20,6 +20,7 @@
  */
 
 #include <encfiltmgr.h>
+#include <utilstr.h>
 
 #include <scsuutf8.h>
 #include <latin1utf8.h>

Modified: trunk/src/mgr/filemgr.cpp
===================================================================
--- trunk/src/mgr/filemgr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/filemgr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -36,6 +36,7 @@
 #include <unistd.h>
 #endif
 
+
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
@@ -48,8 +49,29 @@
 #define S_IROTH 0
 #endif
 
+// Fix for VC6
+#ifndef S_IREAD
+#ifdef _S_IREAD
+#define S_IREAD _S_IREAD
+#define S_IWRITE _S_IWRITE
+#endif
+#endif
+// -----------
+
+
 SWORD_NAMESPACE_START
 
+
+int FileMgr::CREAT = O_CREAT;
+int FileMgr::APPEND = O_APPEND;
+int FileMgr::TRUNC = O_TRUNC;
+int FileMgr::RDONLY = O_RDONLY;
+int FileMgr::RDWR = O_RDWR;
+int FileMgr::WRONLY = O_WRONLY;
+int FileMgr::IREAD = S_IREAD;
+int FileMgr::IWRITE = S_IWRITE;
+
+
 // ---------------- statics -----------------
 FileMgr *FileMgr::systemFileMgr = 0;
 
@@ -105,12 +127,23 @@
 //		return 777;
 	return fd;
 }
-/*
-unsigned int FileDesc::getFdu() {
-	getFd();
-	return (unsigned int)fd;
+
+
+long FileDesc::seek(long offset, int whence) {
+	return lseek(getFd(), offset, whence);
 }
-*/
+
+
+long FileDesc::read(void *buf, long count) {
+	return ::read(getFd(), buf, count);
+}
+
+
+long FileDesc::write(const void *buf, long count) {
+	return ::write(getFd(), buf, count);
+}
+
+
 FileMgr::FileMgr(int maxFiles) {
 	this->maxFiles = maxFiles;		// must be at least 2
 	files = 0;
@@ -129,9 +162,10 @@
 
 
 FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
-	return open(path, mode, S_IREAD | S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
+	return open(path, mode, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
 }
 
+
 FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
 	FileDesc **tmp, *tmp2;
 	
@@ -188,7 +222,7 @@
 						file->mode = (file->mode & ~O_RDWR);	// remove write access
 						file->mode = (file->mode | O_RDONLY);// add read access
 					}
-					file->fd = ::open(file->path, file->mode, file->perms);
+					file->fd = ::open(file->path, file->mode|O_BINARY, file->perms);
 
 					if (file->fd >= 0)
 						break;

Modified: trunk/src/mgr/ftplibftpt.cpp
===================================================================
--- trunk/src/mgr/ftplibftpt.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/ftplibftpt.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,16 +7,7 @@
 #include <ftplibftpt.h>
 
 #include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #include <ftplib.h>
 
 

Modified: trunk/src/mgr/ftptrans.cpp
===================================================================
--- trunk/src/mgr/ftptrans.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/ftptrans.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,19 +8,11 @@
 #include <filemgr.h>
 
 #include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
+#include <dirent.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 
-#include <dirent.h>
+using std::vector;
 
-using namespace std;
 
 SWORD_NAMESPACE_START
 
@@ -57,12 +49,12 @@
 	fprintf(stderr, "FTPURLGetDir: getting dir %s\n", dirURL);
 
 	if (!getURL("dirlist", dirURL)) {
-		int fd = open("dirlist", O_RDONLY|O_BINARY);
-		long size = lseek(fd, 0, SEEK_END);
-		lseek(fd, 0, SEEK_SET);
+		FileDesc *fd = FileMgr::getSystemFileMgr()->open("dirlist", FileMgr::RDONLY);
+		long size = lseek(fd->getFd(), 0, SEEK_END);
+		lseek(fd->getFd(), 0, SEEK_SET);
 		char *buf = new char [ size + 1 ];
-		read(fd, buf, size);
-		close(fd);
+		read(fd->getFd(), buf, size);
+		FileMgr::getSystemFileMgr()->close(fd);
 		char *start = buf;
 		char *end = start;
 		while (start < (buf+size)) {

Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/installmgr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -13,18 +13,10 @@
 
 #include <installmgr.h>
 #include <filemgr.h>
+#include <utilstr.h>
 
 #include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #include <swmgr.h>
 #include <dirent.h>
 
@@ -458,9 +450,9 @@
 	
 	errorCode = ftpCopy(is, "mods.d.tar.gz", archive.c_str(), false);
 	if (!errorCode) { //sucessfully downloaded the tar,gz of module configs
-		int fd = open(archive.c_str(), O_RDONLY|O_BINARY);
-		untargz(fd, root.c_str());
-		close(fd);
+		FileDesc *fd = FileMgr::getSystemFileMgr()->open(archive.c_str(), FileMgr::RDONLY);
+		untargz(fd->getFd(), root.c_str());
+		FileMgr::getSystemFileMgr()->close(fd);
 	}
 	else if (!term) //if the tar.gz download was canceled don't continue with another download
 #endif

Modified: trunk/src/mgr/localemgr.cpp
===================================================================
--- trunk/src/mgr/localemgr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/localemgr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -24,17 +24,11 @@
 #include <stdlib.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#include <unixstr.h>
-#endif
 #include <sys/stat.h>
 #include <dirent.h>
 
 #include <swmgr.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 
 #include <stringmgr.h>
 #include <filemgr.h>

Modified: trunk/src/mgr/stringmgr.cpp
===================================================================
--- trunk/src/mgr/stringmgr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/stringmgr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -45,7 +45,7 @@
 class __staticsystemStringMgr {
 public:
  	__staticsystemStringMgr() { }
- 	~__staticsystemStringMgr() { delete StringMgr::m_systemStringMgr; StringMgr::m_systemStringMgr = 0; }
+ 	~__staticsystemStringMgr() { if (StringMgr::m_systemStringMgr) delete StringMgr::m_systemStringMgr; StringMgr::m_systemStringMgr = 0; }
 } _staticsystemStringMgr;
 
 
@@ -114,15 +114,15 @@
 * @param The text encoded in utf8 which should be turned into an upper case string
 */	
 char* StringMgr::upperUTF8(char* t, const unsigned int maxlen) {
-        // try to decide if it's worth trying to toupper.  Do we have more
-        // characters that are probably lower latin than not?
-        long performOp = 0;
-        for (const char *ch = t; *ch; ch++)
-                performOp += (*ch > 0) ? 1 : -1;
+	// try to decide if it's worth trying to toupper.  Do we have more
+	// characters which are probably lower latin than not?
+	long performOp = 0;
+	for (const char *ch = t; *ch; ch++)
+		performOp += (*ch > 0) ? 1 : -1;
 
-        if (performOp) {
+	if (performOp > 0) {
 		return upperLatin1(t);
-        }
+	}
 
 	return t;
 }

Modified: trunk/src/mgr/swconfig.cpp
===================================================================
--- trunk/src/mgr/swconfig.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/swconfig.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -21,15 +21,11 @@
  */
 
 #include <swconfig.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <filemgr.h>
 #include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
 
+
 SWORD_NAMESPACE_START
 
 SWConfig::SWConfig(const char * ifilename) {
@@ -87,7 +83,7 @@
 	
 	Sections.erase(Sections.begin(), Sections.end());
 	
-	cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), O_RDONLY|O_BINARY);
+	cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDONLY);
 	if (cfile->getFd() > 0) {
 		while (FileMgr::getLine(cfile, line)) {
 			buf = new char [ line.length() + 1 ];
@@ -127,7 +123,7 @@
 	ConfigEntMap::iterator entry;
 	SWBuf sectname;
 	
-	cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), O_BINARY|O_RDWR|O_CREAT|O_TRUNC);
+	cfile = FileMgr::getSystemFileMgr()->open(filename.c_str(), FileMgr::RDWR|FileMgr::CREAT|FileMgr::TRUNC);
 	if (cfile->getFd() > 0) {
 		
 		for (sit = Sections.begin(); sit != Sections.end(); sit++) {

Modified: trunk/src/mgr/swlocale.cpp
===================================================================
--- trunk/src/mgr/swlocale.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/swlocale.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -21,7 +21,7 @@
  */
 
 #include <swlocale.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/mgr/swmgr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -24,12 +24,6 @@
 #include <stdlib.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#include <unixstr.h>
-#endif
 #include <sys/stat.h>
 #ifndef _MSC_VER
 #include <iostream>
@@ -43,7 +37,7 @@
 #include <hrefcom.h>
 #include <rawld.h>
 #include <rawld4.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <gbfplain.h>
 #include <thmlplain.h>
 #include <osisplain.h>
@@ -1018,11 +1012,11 @@
                               if ((configPath[strlen(configPath)-1] != '\\') && (configPath[strlen(configPath)-1] != '/'))
                                    targetName += "/";
                               targetName += ent->d_name;
-                              conffd = open(targetName.c_str(), O_WRONLY|O_CREAT, S_IREAD|S_IWRITE);
+                              conffd = open(targetName.c_str(), FileMgr::WRONLY|FileMgr::CREAT, FileMgr::IREAD|FileMgr::IWRITE);
                          }
                          else {
                               if (conffd < 1) {
-                                   conffd = open(config->filename.c_str(), O_WRONLY|O_APPEND);
+                                   conffd = open(config->filename.c_str(), FileMgr::WRONLY|FileMgr::APPEND);
                                    if (conffd > 0)
                                         lseek(conffd, 0L, SEEK_END);
                               }
@@ -1045,7 +1039,7 @@
 	char ch;
 
 	SWLog::getSystemLog()->logTimedInformation("Found new module [%s]. Installing...", fname);
-	modfd = open(fname, O_RDONLY);
+	modfd = open(fname, FileMgr::RDONLY);
 	ch = '\n';
 	write(conffd, &ch, 1);
 	while (read(modfd, &ch, 1) == 1)

Modified: trunk/src/modules/comments/hrefcom/hrefcom.cpp
===================================================================
--- trunk/src/modules/comments/hrefcom/hrefcom.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/hrefcom/hrefcom.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -9,13 +9,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <rawverse.h>
 #include <hrefcom.h>
 #include <swbuf.h>

Deleted: trunk/src/modules/comments/hrefcom/jfbgen.cpp
===================================================================
--- trunk/src/modules/comments/hrefcom/jfbgen.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/hrefcom/jfbgen.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,242 +0,0 @@
-/*****************************************************************************
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-#ifndef O_BINARY
-	#define O_BINARY 0
-#endif
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles();
-void checkparams(int argc, char **argv);
-void charsetconvert(char *data);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-char startflag = 0;
-
-
-main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1, num2, rangemax, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-	short size, tmp;
-	extern struct zonline online;
-
-	checkparams(argc, argv);
-
-	key1 = key2 = key3 = "Genesis 1:1";
-
-	openfiles();
-
-	num1    = key1.Chapter();
-	num2    = key1.Verse();
-
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		if (!startflag) {
-			startflag = 1;
-		}
-		else {
-			if (num2 < key2.Verse()) {            // new chapter
-				if (num1 <= key2.Chapter()) { // new book
-					key2.Verse(1);
-					key2.Chapter(1);
-					key2.Book(key2.Book()+1);
-				}
-				printf("Found Chapter Break: %d ('%s')\n", num1, (const char *)key2);
-				chapoffset = offset;
-				chapsize = size;
-//				continue;
-			}
-		}
-		key2.Verse(1);
-		key2.Chapter(num1);
-		key2.Verse(num2);
-
-		key3 = key2;
-//		key3 += (rangemax - key3.Verse());
-
-		writeidx(key1, key2, key3, offset, size);
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-/**************************************************************************
- * ENT:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	short tmp;
-
-		if (key1.Verse() == 1) {	// new chapter
-			if (key1.Chapter() == 1) {	// new book
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				write(vfp, &chapoffset, 4);  /* Book intro (vss)  set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
-				write(vfp, &chapsize, 2);
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-		}
-		if (key1 >= key2) {
-			write(vfp, &offset, 4);
-			write(vfp, &size, 2);
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-		}
-		key1++;
-}
-
-
-static VerseKey inckey = "Genesis 1:1";
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
-	char buf[7];
-	char buf2[20];
-	char ch;
-	char loop;
-	long offset2;
-	int ch2, vs2, rm2;
-	bool flag;
-	long chapstart = 0; 
-	static int olbvnum = 0;
-	char data[256];
-	char *bookabrev[66] = {"Ge", "Ex", "Le", "Nu", "De", "Jos", "Jud", "Ru",
-		"1Sa", "2Sa", "1Ki", "2Ki", "1Ch", "2Ch", "Ezr", "Ne", "Es",
-		"Job", "Ps", "Pr", "Ec", "So", "Isa", "Jer", "La", "Eze", "Da",
-		"Ho", "Joe", "Am", "Ob", "Jon", "Mic", "Na", "Heb", "Zep",
-		"Hag", "Zec", "Mal",
-		"Mt", "Mr", "Lu", "Joh", "Ac", "Ro", "1Co", "2Co", "Ga",
-		"Eph", "Php", "Col", "1Th", "2Th", "1Ti", "2Ti", "Tit", "Phm",
-		"Heb", "Jas", "1Pe", "2Pe", "1Jo", "2Jo", "3Jo", "Jude", "Re" };
-
-	if (++olbvnum <= 31102) {
-
-		if (olbvnum == 23146) {	// "Matthew 1:1"	
-			close(vfp);
-			close(cfp);
-			close(bfp);
-			close(fp);
-			key1 = key2 = key3 = inckey = "Matthew 1:1";
-			openfiles();
-			startflag = 0;
-		}
-
-
-		*offset = lseek(fp, 0, SEEK_CUR);
-
-		if ((olbvnum!=1) && (olbvnum != 23146))
-			inckey++;
-			
-		*num1 = inckey.Chapter();
-		*num2 = inckey.Verse();
-	
-		sprintf(data, "JFB%.2d.htm#%s%d_%d", inckey.Book() + ((inckey.Testament()>1)?39:0), bookabrev[inckey.Book() + ((inckey.Testament()>1)?39:0)-1], inckey.Chapter(), inckey.Verse());
-		write(fp, data, strlen(data));
-
-		*size = lseek(fp, 0, SEEK_CUR) - *offset;
-		write(fp, "\n", 1);
-		return 0;
-	}
-	return 1;
-}
-
-
-void openfiles()
-{
-	char buf[255];
-	char fname[5];
-	long pos;
-	short size;
-	
-	testmnt = key1.Testament();
-
-	strcpy(fname, (testmnt==2) ? "nt" : "ot");
-	unlink(fname);
-	if ((fp = open(fname, O_CREAT|O_RDWR|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	unlink(buf);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	unlink(buf);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	unlink(buf);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc !=1) {
-		fprintf(stderr, "usage: %s\n", argv[0]);
-		exit(1);
-	}
-}

Deleted: trunk/src/modules/comments/rawcom/mhcidx.cpp
===================================================================
--- trunk/src/modules/comments/rawcom/mhcidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/rawcom/mhcidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,292 +0,0 @@
-/*****************************************************************************
- *
- *	This code wreaks but works (at least for MHC).  Good luck!
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles(char *fname);
-void checkparams(int argc, char **argv);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-
-
-main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1, num2, rangemax, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127], startflag = 0;
-	short size, tmp;
-
-	checkparams(argc, argv);
-
-	openfiles(argv[1]);
-
-	testmnt = key1.Testament();
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		if (num2) {				
-			key2.Verse(1);
-			key2.Chapter(num1);
-			key2.Verse(num2);
-		}
-		else {
-			key2.Verse(1);
-			if (!startflag) {
-				startflag = 1;
-			}
-			else {
-				if (num1 <= key2.Chapter()) { // new book
-					key2.Chapter(1);
-					key2.Book(key2.Book()+1);
-				}
-			}
-			key2.Chapter(num1);
-			printf("Found Chapter Break: %d ('%s')\n", num1, (const char *)key2);
-			chapoffset = offset;
-			chapsize = size;
-			continue;
-		}
-
-		key3 = key2;
-		key3 += (rangemax - key3.Verse());
-
-		writeidx(key1, key2, key3, offset, size);
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-/**************************************************************************
- * ENT:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	short tmp;
-
-	for (; ((key1 <= key3) && (key1.Error() != KEYERR_OUTOFBOUNDS) && (key1.Testament() == testmnt)); key1+=1) {
-		if (key1.Verse() == 1) {	// new chapter
-			if (key1.Chapter() == 1) {	// new book
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				write(vfp, &chapoffset, 4);  /* Book intro (vss)  set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
-				write(vfp, &chapsize, 2);
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-		}
-		if (key1 >= key2) {
-			write(vfp, &offset, 4);
-			write(vfp, &size, 2);
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-		}
-	}
-}
-
-
-char startentry(char *buf)
-{
-	char loop;
-
-	if (buf[0] != 10)
-		return 0;
-	if (buf[1] != '#')
-		return 0;
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-	return 1;
-}
-
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
-	char buf[7];
-	char buf2[20];
-	char ch;
-	char loop;
-	long offset2;
-	int ch2, vs2, rm2;
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (startentry(buf)) {
-			memset(buf, ' ', 2);
-			for (loop = 2; loop < 7; loop++) {
-				if ((buf[loop] == '-') || (buf[loop] == ',') || (buf[loop] == ' ')) {
-					buf[loop] = 0;
-					*num2 = atoi(buf);
-					break;
-				}
-			}
-			for (ch = loop + 1; ch < 7; ch++) {
-				if (buf[ch] == ' ') {
-					break;
-				}
-			}
-			buf[ch] = 0;
-			*rangemax = atoi(&buf[loop+1]);
-			if (!*rangemax)
-				*rangemax = *num2;
-			*offset = lseek(fp, 0, SEEK_CUR) - 5;
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - (*offset)) - 3;
-					}
-					else {
-						sprintf(buf2, "$-$-$- XX:%d", ch2);
-						*size = (offset2 - (*offset)) - ((strlen(buf2) + 4));
-					}
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-					
-		if (!strncmp(buf, "$-$-$-", 6)) {
-			memset(buf2, 0, 7);
-			loop = 0;
-			while ((read(fp, &buf2[loop], 1) == 1) && (loop < 7)) {
-				if ((buf2[loop] == 10) || (buf2[loop] == 13)) {
-					buf2[loop] = 0;
-					break;
-				}
-				loop++;
-			}
-			while (read(fp, &ch, 1) == 1) {
-				if (ch == '*')
-					break;
-			}
-			
-			*offset = lseek(fp, 0, SEEK_CUR) - 1;
-			*num2 = 0;
-			for (loop = strlen(buf2) - 1; loop; loop--) {
-				if (buf2[loop] == ':')
-					break;
-			}
-			*num1 = atoi(&buf2[loop+1]);
-			printf("Chapter marker: %s\n", buf2);
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - (*offset)) - 3;
-					}
-					else {
-						sprintf(buf2, "$-$-$- XX:%d", ch2);
-						*size = (offset2 - (*offset)) - ((strlen(buf2) + 4));
-					}
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-				 
-				
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-
-
-void openfiles(char *fname)
-{
-	char buf[255];
-
-	if ((fp = open(fname, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process> [nt - for new testmt file]\n", argv[0]);
-		exit(1);
-	}
-	if (argc == 3)
-		key1 = key2 = key3 = "Matthew 1:1";
-	else	key1 = key2 = key3 = "Genesis 1:1";
-}

Modified: trunk/src/modules/comments/rawcom/rawcom.cpp
===================================================================
--- trunk/src/modules/comments/rawcom/rawcom.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/rawcom/rawcom.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,13 +8,6 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
 #include <rawverse.h>
 #include <rawcom.h>
 

Deleted: trunk/src/modules/comments/rawcom/rtfidx.cpp
===================================================================
--- trunk/src/modules/comments/rawcom/rtfidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/rawcom/rtfidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,292 +0,0 @@
-/*****************************************************************************
- *
- *	This code wreaks but works (at least for MHC).  Good luck!
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles(char *fname);
-void checkparams(int argc, char **argv);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-
-
-main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1, num2, rangemax, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127], startflag = 0;
-	short size, tmp;
-
-	checkparams(argc, argv);
-
-	openfiles(argv[1]);
-
-	testmnt = key1.Testament();
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		if (num2) {				
-			key2.Verse(1);
-			key2.Chapter(num1);
-			key2.Verse(num2);
-		}
-		else {
-			key2.Verse(1);
-			if (!startflag) {
-				startflag = 1;
-			}
-			else {
-				if (num1 <= key2.Chapter()) { // new book
-					key2.Chapter(1);
-					key2.Book(key2.Book()+1);
-				}
-			}
-			key2.Chapter(num1);
-			printf("Found Chapter Break: %d ('%s')\n", num1, (char *)key2);
-			chapoffset = offset;
-			chapsize = size;
-			continue;
-		}
-
-		key3 = key2;
-		key3 += (rangemax - key3.Verse());
-
-		writeidx(key1, key2, key3, offset, size);
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-/**************************************************************************
- * ENT:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	short tmp;
-
-	for (; ((key1 <= key3) && (key1.Error() != KEYERR_OUTOFBOUNDS) && (key1.Testament() == testmnt)); key1+=1) {
-		if (key1.Verse() == 1) {	// new chapter
-			if (key1.Chapter() == 1) {	// new book
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				write(vfp, &chapoffset, 4);  /* Book intro (vss)  set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
-				write(vfp, &chapsize, 2);
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-		}
-		if (key1 >= key2) {
-			write(vfp, &offset, 4);
-			write(vfp, &size, 2);
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-		}
-	}
-}
-
-
-char startentry(char *buf)
-{
-	char loop;
-
-	if (buf[0] != 10)
-		return 0;
-	if (buf[1] != '#')
-		return 0;
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-	return 1;
-}
-
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
-	char buf[7];
-	char buf2[20];
-	char ch;
-	char loop;
-	long offset2;
-	int ch2, vs2, rm2;
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (startentry(buf)) {
-			memset(buf, ' ', 2);
-			for (loop = 2; loop < 7; loop++) {
-				if ((buf[loop] == '-') || (buf[loop] == ',') || (buf[loop] == ' ')) {
-					buf[loop] = 0;
-					*num2 = atoi(buf);
-					break;
-				}
-			}
-			for (ch = loop + 1; ch < 7; ch++) {
-				if (buf[ch] == ' ') {
-					break;
-				}
-			}
-			buf[ch] = 0;
-			*rangemax = atoi(&buf[loop+1]);
-			if (!*rangemax)
-				*rangemax = *num2;
-			*offset = lseek(fp, 0, SEEK_CUR) - 5;
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - (*offset)) - 3;
-					}
-					else {
-						sprintf(buf2, "$-$-$- XX:%d", ch2);
-						*size = (offset2 - (*offset)) - ((strlen(buf2) + 4));
-					}
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-					
-		if (!strncmp(buf, "$-$-$-", 6)) {
-			memset(buf2, 0, 7);
-			loop = 0;
-			while ((read(fp, &buf2[loop], 1) == 1) && (loop < 7)) {
-				if ((buf2[loop] == 10) || (buf2[loop] == 13)) {
-					buf2[loop] = 0;
-					break;
-				}
-				loop++;
-			}
-			while (read(fp, &ch, 1) == 1) {
-				if (ch == '*')
-					break;
-			}
-			
-			*offset = lseek(fp, 0, SEEK_CUR) - 1;
-			*num2 = 0;
-			for (loop = strlen(buf2) - 1; loop; loop--) {
-				if (buf2[loop] == ':')
-					break;
-			}
-			*num1 = atoi(&buf2[loop+1]);
-			printf("Chapter marker: %s\n", buf2);
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - (*offset)) - 3;
-					}
-					else {
-						sprintf(buf2, "$-$-$- XX:%d", ch2);
-						*size = (offset2 - (*offset)) - ((strlen(buf2) + 4));
-					}
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-				 
-				
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-
-
-void openfiles(char *fname)
-{
-	char buf[255];
-
-	if ((fp = open(fname, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process> [nt - for new testmt file]\n", argv[0]);
-		exit(1);
-	}
-	if (argc == 3)
-		key1 = key2 = key3 = "Matthew 1:1";
-	else	key1 = key2 = key3 = "Genesis 1:1";
-}

Deleted: trunk/src/modules/comments/rawcom/rwpidx.cpp
===================================================================
--- trunk/src/modules/comments/rawcom/rwpidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/rawcom/rwpidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,266 +0,0 @@
-/*****************************************************************************
- *
- *	This code wreaks but works (at least for RWP).  Good luck!
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles(char *fname);
-void checkparams(int argc, char **argv);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-
-
-main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1 = 0, num2 = 0, rangemax, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127], startflag = 0;
-	short size, tmp;
-
-	checkparams(argc, argv);
-
-	openfiles(argv[1]);
-
-	testmnt = key1.Testament();
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		if (num2) {				
-			key2.Verse(1);
-			key2.Chapter(num1);
-			key2.Verse(num2);
-		}
-		else {
-			key2.Verse(1);
-			if (!startflag) {
-				startflag = 1;
-			}
-			else {
-				if (num1 <= key2.Chapter()) { // new book
-					key2.Chapter(1);
-					key2.Book(key2.Book()+1);
-				}
-			}
-			key2.Chapter(num1);
-			printf("Found Chapter Break: %d ('%s')\n", num1, (const char *)key2);
-			chapoffset = offset;
-			chapsize = size;
-			continue;
-		}
-
-		key3 = key2;
-		key3 += (rangemax - key3.Verse());
-
-		printf("Found verse Break: ('%s')\n", (const char *)key2);
-		writeidx(key1, key2, key3, offset, size);
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-/**************************************************************************
- * ENT:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	short tmp;
-
-	for (; ((key1 <= key3) && (key1.Error() != KEYERR_OUTOFBOUNDS) && (key1.Testament() == testmnt)); key1+=1) {
-		if (key1.Verse() == 1) {	// new chapter
-			if (key1.Chapter() == 1) {	// new book
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				write(vfp, &chapoffset, 4);  /* Book intro (vss)  set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
-				write(vfp, &chapsize, 2);
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-		}
-		if (key1 >= key2) {
-			write(vfp, &offset, 4);
-			write(vfp, &size, 2);
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-		}
-	}
-}
-
-
-char startentry(char *buf)
-{
-	char colon = 0;
-
-	if (buf[0] != 10)
-		return 0;
-	if (buf[1] != 10)
-		return 0;
-	if (!isdigit(buf[2]))
-		return 0;
-	if (!isdigit(buf[3])) {
-		if (buf[3]!= ':')
-			return 0;
-		else	colon++;
-	}
-	if (!isdigit(buf[4])) {
-		if (buf[4]!= ':')
-			return 0;
-		else	colon++;
-	}
-	if (colon != 1)
-		return 0;
-	return 1;
-}
-
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
-	char buf[7];
-	char buf2[20];
-	char ch;
-	char loop;
-	long offset2;
-	int ch2, vs2, rm2;
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (startentry(buf)) {
-			buf[0] = ' ';
-			buf[1] = ' ';
-			sscanf(buf, "%d:%d", num1, num2);
-			*rangemax = *num2;
-			*offset = lseek(fp, 0, SEEK_CUR) - 5;
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - (*offset)) - 2;
-					}
-					else {
-						*size = (offset2 - (*offset)) - 6;
-					}
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-					
-		if (!strncmp(buf, "$-$-$-", 6)) {
-			*offset = lseek(fp, 0, SEEK_CUR) - 1;
-			*num2 = 0;
-			(*num1)++;
-			printf("Book marker: %s\n", buf2);
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - (*offset)) - 2;
-					}
-					else {
-						*size = (offset2 - (*offset)) - 6;
-					}
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-				 
-				
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-
-
-void openfiles(char *fname)
-{
-	char buf[255];
-
-	if ((fp = open(fname, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process> [nt - for new testmt file]\n", argv[0]);
-		exit(1);
-	}
-	if (argc == 3)
-		key1 = key2 = key3 = "Matthew 1:1";
-	else	key1 = key2 = key3 = "Genesis 1:1";
-}

Modified: trunk/src/modules/comments/rawfiles/rawfiles.cpp
===================================================================
--- trunk/src/modules/comments/rawfiles/rawfiles.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/rawfiles/rawfiles.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -9,21 +9,10 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
 #include <rawverse.h>
 #include <rawfiles.h>
 #include <filemgr.h>
 
-#ifndef O_BINARY                // O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0              // If it hasn't been defined than we probably
-#endif                          // don't need it.
-
 SWORD_NAMESPACE_START
 
  /******************************************************************************
@@ -34,7 +23,7 @@
  *	idisp	 - Display object to use for displaying
  */
 
-RawFiles::RawFiles(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : RawVerse(ipath, O_RDWR), SWCom(iname, idesc, idisp, enc, dir, mark, ilang)
+RawFiles::RawFiles(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : RawVerse(ipath, FileMgr::RDWR), SWCom(iname, idesc, idisp, enc, dir, mark, ilang)
 {
 }
 
@@ -78,7 +67,7 @@
 		readText(key->Testament(), start, size, entryBuf);
 		tmpbuf += entryBuf;
 		entryBuf = "";
-		datafile = FileMgr::getSystemFileMgr()->open(tmpbuf.c_str(), O_RDONLY|O_BINARY);
+		datafile = FileMgr::getSystemFileMgr()->open(tmpbuf.c_str(), FileMgr::RDONLY);
 		if (datafile->getFd() > 0) {
 			size = lseek(datafile->getFd(), 0, SEEK_END);
 			char *tmpBuf = new char [ size + 1 ];
@@ -135,7 +124,7 @@
 		doSetText(key->Testament(), key->Index(), tmpbuf);
 		entryBuf += tmpbuf;
 	}
-	datafile = FileMgr::getSystemFileMgr()->open(entryBuf, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC);
+	datafile = FileMgr::getSystemFileMgr()->open(entryBuf, FileMgr::CREAT|FileMgr::WRONLY|FileMgr::TRUNC);
 	if (datafile->getFd() > 0) {
 		write(datafile->getFd(), inbuf, len);
 	}
@@ -228,13 +217,13 @@
 	FileDesc *datafile;
 
 	sprintf(incfile, "%s/incfile", path);
-	datafile = FileMgr::getSystemFileMgr()->open(incfile, O_RDONLY|O_BINARY);
+	datafile = FileMgr::getSystemFileMgr()->open(incfile, FileMgr::RDONLY);
 	if (read(datafile->getFd(), &number, 4) != 4)
 		number = 0;
 	number++;
 	FileMgr::getSystemFileMgr()->close(datafile);
 	
-	datafile = FileMgr::getSystemFileMgr()->open(incfile, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC);
+	datafile = FileMgr::getSystemFileMgr()->open(incfile, FileMgr::CREAT|FileMgr::WRONLY|FileMgr::TRUNC);
 	write(datafile->getFd(), &number, 4);
 	FileMgr::getSystemFileMgr()->close(datafile);
 	sprintf(incfile, "%.7ld", number-1);
@@ -248,7 +237,7 @@
 	FileDesc *datafile;
 
 	sprintf(incfile, "%s/incfile", path);
-	datafile = FileMgr::getSystemFileMgr()->open(incfile, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC);
+	datafile = FileMgr::getSystemFileMgr()->open(incfile, FileMgr::CREAT|FileMgr::WRONLY|FileMgr::TRUNC);
     delete [] incfile;
 	write(datafile->getFd(), &zero, 4);
 	FileMgr::getSystemFileMgr()->close(datafile);

Deleted: trunk/src/modules/comments/rawfiles/rawfilesgen.cpp
===================================================================
--- trunk/src/modules/comments/rawfiles/rawfilesgen.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/rawfiles/rawfilesgen.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,236 +0,0 @@
-/*****************************************************************************
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-#ifndef O_BINARY
-	#define O_BINARY 0
-#endif
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles();
-void checkparams(int argc, char **argv);
-void charsetconvert(char *data);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-char startflag = 0;
-
-
-main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1, num2, rangemax, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-	short size, tmp;
-	extern struct zonline online;
-
-	checkparams(argc, argv);
-
-	key1 = key2 = key3 = "Genesis 1:1";
-
-	openfiles();
-
-	num1    = key1.Chapter();
-	num2    = key1.Verse();
-
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		if (!startflag) {
-			startflag = 1;
-		}
-		else {
-			if (num2 < key2.Verse()) {            // new chapter
-				if (num1 <= key2.Chapter()) { // new book
-					key2.Verse(1);
-					key2.Chapter(1);
-					key2.Book(key2.Book()+1);
-				}
-				printf("Created Empty Entry: %d ('%s')\n", num1, (const char *)key2);
-				chapoffset = offset;
-				chapsize = size;
-//				continue;
-			}
-		}
-		key2.Verse(1);
-		key2.Chapter(num1);
-		key2.Verse(num2);
-
-		key3 = key2;
-//		key3 += (rangemax - key3.Verse());
-
-		writeidx(key1, key2, key3, offset, size);
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-/**************************************************************************
- * ENT:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	short tmp;
-
-		if (key1.Verse() == 1) {	// new chapter
-			if (key1.Chapter() == 1) {	// new book
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				write(vfp, &chapoffset, 4);  /* Book intro (vss)  set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
-				write(vfp, &chapsize, 2);
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-		}
-		if (key1 >= key2) {
-			write(vfp, &offset, 4);
-			size = 0;
-			write(vfp, &size, 2);
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-		}
-		key1++;
-}
-
-
-static VerseKey inckey = "Genesis 1:1";
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
-	char buf[7];
-	char buf2[20];
-	char ch;
-	char loop;
-	long offset2;
-	int ch2, vs2, rm2;
-	bool flag;
-	long chapstart = 0; 
-	static int olbvnum = 0;
-	char data[16];
-
-	memset (data,0,16);
-
-	if (++olbvnum <= 31102) {
-
-		if (olbvnum == 23146) {	// "Matthew 1:1"	
-			close(vfp);
-			close(cfp);
-			close(bfp);
-			close(fp);
-			key1 = key2 = key3 = inckey = "Matthew 1:1";
-			openfiles();
-			startflag = 0;
-		}
-
-
-		*offset = lseek(fp, 0, SEEK_CUR);
-
-		if ((olbvnum!=1) && (olbvnum != 23146))
-			inckey++;
-			
-		*num1 = inckey.Chapter();
-		*num2 = inckey.Verse();
-	
-		
-		write(fp, data, 16);
-
-		*size = lseek(fp, 0, SEEK_CUR) - *offset;
-		return 0;
-	}
-	return 1;
-}
-
-
-void openfiles()
-{
-	char buf[255];
-	char fname[5];
-	long pos;
-	short size;
-	
-	testmnt = key1.Testament();
-
-	strcpy(fname, (testmnt==2) ? "nt" : "ot");
-	unlink(fname);
-	if ((fp = open(fname, O_CREAT|O_RDWR|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	unlink(buf);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	unlink(buf);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	unlink(buf);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc !=1) {
-		fprintf(stderr, "usage: %s\n", argv[0]);
-		exit(1);
-	}
-}

Deleted: trunk/src/modules/comments/zcom/makeidx.c
===================================================================
--- trunk/src/modules/comments/zcom/makeidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/zcom/makeidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,146 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	short size, tmp;
-	int num1, num2, offset, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s <file to process>\n", argv[0]);
-		exit(1);
-	}
-
-	if ((fp = open(argv[1], O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while (!findbreak(fp, &offset, &num1, &num2, &size)) {
-
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfp, &pos, 4);  /* Book intro (vss) */
-				write(vfp, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);  /* Chapter intro */
-			write(vfp, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7d\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence\n", buf);
-			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence\n", buf);
-			break;
-		}
-		write(vfp, &offset, 4);
-		write(vfp, &size, 2);
-	}
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size)
-{
-	char buf[7];
-	char buf2[7];
-	char loop;
-	int offset2, ch2, vs2;
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (buf[3] == ':') {
-			memcpy(buf2, buf, 7);
-			for (loop = 0; loop < 7; loop++) {
-				if (!isdigit(buf2[loop]))
-					buf2[loop] = ' ';
-			}
-			buf2[3] = 0;
-			*num1 = atoi(buf2);
-			*num2 = atoi(&buf2[4]);
-			if (*num1 && *num2) {
-				*offset = lseek(fp, 0, SEEK_CUR);
-				sprintf(buf2, "%d", *num2);
-				*offset -= 2 - strlen(buf2);
-				if (size) {
-					if (findbreak(fp, &offset2, &ch2, &vs2, 0)) {
-						*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-					}
-					else {
-						sprintf(buf2, "%d:%d", ch2, vs2);
-						*size = (offset2 - (*offset)) - (strlen(buf2) + 2);
-					}
-					lseek(fp, *offset, SEEK_SET);
-				}
-				return 0;
-			}
-		}
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-

Modified: trunk/src/modules/comments/zcom/zcom.cpp
===================================================================
--- trunk/src/modules/comments/zcom/zcom.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/comments/zcom/zcom.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,13 +8,6 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
 #include <zverse.h>
 #include <zcom.h>
 

Modified: trunk/src/modules/common/rawstr.cpp
===================================================================
--- trunk/src/modules/common/rawstr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/common/rawstr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -10,14 +10,8 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
 #include <stdlib.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <rawstr.h>
 #include <sysdata.h>
 #include <swlog.h>
@@ -48,19 +42,15 @@
 	path = 0;
 	stdstr(&path, ipath);
 
-#ifndef O_BINARY		// O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0		// If it hasn't been defined than we probably
-#endif				// don't need it.
-
 	if (fileMode == -1) { // try read/write if possible
-		fileMode = O_RDWR;
+		fileMode = FileMgr::RDWR;
 	}
 		
 	buf.setFormatted("%s.idx", path);
-	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s.dat", path);
-	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	if (datfd < 0) {
 		SWLog::getSystemLog()->logError("%d", errno);
@@ -100,15 +90,15 @@
 	int size;
 	char ch;
 	if (datfd > 0) {
-		lseek(datfd->getFd(), ioffset, SEEK_SET);
-		for (size = 0; read(datfd->getFd(), &ch, 1) == 1; size++) {
+		datfd->seek(ioffset, SEEK_SET);
+		for (size = 0; datfd->read(&ch, 1) == 1; size++) {
 			if ((ch == '\\') || (ch == 10) || (ch == 13))
 				break;
 		}
 		*buf = (*buf) ? (char *)realloc(*buf, size*2 + 1) : (char *)malloc(size*2 + 1);
 		if (size) {
-			lseek(datfd->getFd(), ioffset, SEEK_SET);
-			read(datfd->getFd(), *buf, size);
+			datfd->seek(ioffset, SEEK_SET);
+			datfd->read(*buf, size);
 		}
 		(*buf)[size] = 0;
 		toupperstr_utf8(*buf, size*2);
@@ -135,8 +125,8 @@
 	long offset;
 	
 	if (idxfd > 0) {
-		lseek(idxfd->getFd(), ioffset, SEEK_SET);
-		read(idxfd->getFd(), &offset, 4);
+		idxfd->seek(ioffset, SEEK_SET);
+		idxfd->read(&offset, 4);
 
 		offset = swordtoarch32(offset);
 
@@ -164,7 +154,7 @@
 	long headoff, tailoff, tryoff = 0, maxoff = 0;
 
 	if (idxfd->getFd() >=0) {
-		tailoff = maxoff = lseek(idxfd->getFd(), 0, SEEK_END) - 6;
+		tailoff = maxoff = idxfd->seek(0, SEEK_END) - 6;
 		retval = (tailoff >= 0) ? 0 : -2;	// if NOT new file
 		if (*ikey) {
 			headoff = 0;
@@ -205,11 +195,11 @@
 		}
 		else	tryoff = 0;
 
-		lseek(idxfd->getFd(), tryoff, SEEK_SET);
+		idxfd->seek(tryoff, SEEK_SET);
 
 		*start = *size = 0;
-		read(idxfd->getFd(), start, 4);
-		read(idxfd->getFd(), size, 2);
+		idxfd->read(start, 4);
+		idxfd->read(size, 2);
 		if (idxoff)
 			*idxoff = tryoff;
 
@@ -225,7 +215,7 @@
 			bool bad = false;
 			if (((tryoff + (away*6)) < -6) || (tryoff + (away*6) > (maxoff+6)))
 				bad = true;
-			else if (lseek(idxfd->getFd(), tryoff, SEEK_SET) < 0)
+			else if (idxfd->seek(tryoff, SEEK_SET) < 0)
 				bad = true;
 			if (bad) {
 				retval = -1;
@@ -236,8 +226,8 @@
 					*idxoff = tryoff;
 				break;
 			}
-			read(idxfd->getFd(), start, 4);
-			read(idxfd->getFd(), size, 2);
+			idxfd->read(start, 4);
+			idxfd->read(size, 2);
 			if (idxoff)
 				*idxoff = tryoff;
 
@@ -346,8 +336,8 @@
 
 		*idxbuf = new char [ (*isize) ];
 
-		lseek(datfd->getFd(), start, SEEK_SET);
-		read(datfd->getFd(), buf.getRawData(), (int)((*isize) - 1));
+		datfd->seek(start, SEEK_SET);
+		datfd->read(buf.getRawData(), (int)((*isize) - 1));
 
 		for (ch = 0; buf[ch]; ch++) {		// skip over index string
 			if (buf[ch] == 10) {
@@ -424,8 +414,8 @@
 		do {
 			tmpbuf = new char [ size + 2 ];
 			memset(tmpbuf, 0, size + 2);
-			lseek(datfd->getFd(), start, SEEK_SET);
-			read(datfd->getFd(), tmpbuf, (int)(size - 1));
+			datfd->seek(start, SEEK_SET);
+			datfd->read(tmpbuf, (int)(size - 1));
 
 			for (ch = tmpbuf; *ch; ch++) {		// skip over index string
 				if (*ch == 10) {
@@ -450,14 +440,14 @@
 		while (true);	// while we're resolving links
 	}
 
-	endoff = lseek(idxfd->getFd(), 0, SEEK_END);
+	endoff = idxfd->seek(0, SEEK_END);
 
 	shiftSize = endoff - idxoff;
 
 	if (shiftSize > 0) {
 		idxBytes = new char [ shiftSize ];
-		lseek(idxfd->getFd(), idxoff, SEEK_SET);
-		read(idxfd->getFd(), idxBytes, shiftSize);
+		idxfd->seek(idxoff, SEEK_SET);
+		idxfd->read(idxBytes, shiftSize);
 	}
 
 	outbuf = new char [ len + strlen(key) + 5 ];
@@ -466,30 +456,30 @@
 	memcpy(outbuf + size, buf, len);
 	size = outsize = size + (len);
 
-	start = outstart = lseek(datfd->getFd(), 0, SEEK_END);
+	start = outstart = datfd->seek(0, SEEK_END);
 
 	outstart = archtosword32(start);
 	outsize  = archtosword16(size);
 
-	lseek(idxfd->getFd(), idxoff, SEEK_SET);
+	idxfd->seek(idxoff, SEEK_SET);
 	if (len > 0) {
-		lseek(datfd->getFd(), start, SEEK_SET);
-		write(datfd->getFd(), outbuf, (int)size);
+		datfd->seek(start, SEEK_SET);
+		datfd->write(outbuf, (int)size);
 
 		// add a new line to make data file easier to read in an editor
-		write(datfd->getFd(), &nl, 2);
+		datfd->write(&nl, 2);
 		
-		write(idxfd->getFd(), &outstart, 4);
-		write(idxfd->getFd(), &outsize, 2);
+		idxfd->write(&outstart, 4);
+		idxfd->write(&outsize, 2);
 		if (idxBytes) {
-			write(idxfd->getFd(), idxBytes, shiftSize);
+			idxfd->write(idxBytes, shiftSize);
 			delete [] idxBytes;
 		}
 	}
 	else {	// delete entry
 		if (idxBytes) {
-			write(idxfd->getFd(), idxBytes+6, shiftSize-6);
-			lseek(idxfd->getFd(), -1, SEEK_CUR);	// last valid byte
+			idxfd->write(idxBytes+6, shiftSize-6);
+			idxfd->seek(-1, SEEK_CUR);	// last valid byte
 			FileMgr::getSystemFileMgr()->trunc(idxfd);	// truncate index
 			delete [] idxBytes;
 		}
@@ -537,13 +527,13 @@
 
 	sprintf(buf, "%s.dat", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s.idx", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
 

Modified: trunk/src/modules/common/rawstr4.cpp
===================================================================
--- trunk/src/modules/common/rawstr4.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/common/rawstr4.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,15 +8,10 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <errno.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
 #include <stdlib.h>
-#include <utilfuns.h>
+#include <sys/types.h>
+
+#include <utilstr.h>
 #include <rawstr4.h>
 #include <sysdata.h>
 #include <swlog.h>
@@ -47,19 +42,15 @@
 	path = 0;
 	stdstr(&path, ipath);
 
-#ifndef O_BINARY		// O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0		// If it hasn't been defined than we probably
-#endif				// don't need it.
-
 	if (fileMode == -1) { // try read/write if possible
-		fileMode = O_RDWR;
+		fileMode = FileMgr::RDWR;
 	}
 		
 	buf.setFormatted("%s.idx", path);
-	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s.dat", path);
-	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	if (datfd < 0) {
 		SWLog::getSystemLog()->logError("%d", errno);
@@ -98,15 +89,15 @@
 	int size;
 	char ch;
 	if (datfd > 0) {
-		lseek(datfd->getFd(), ioffset, SEEK_SET);
-		for (size = 0; read(datfd->getFd(), &ch, 1) == 1; size++) {
+		datfd->seek(ioffset, SEEK_SET);
+		for (size = 0; datfd->read(&ch, 1) == 1; size++) {
 			if ((ch == '\\') || (ch == 10) || (ch == 13))
 				break;
 		}
 		*buf = (*buf) ? (char *)realloc(*buf, size*2 + 1) : (char *)malloc(size*2 + 1);
 		if (size) {
-			lseek(datfd->getFd(), ioffset, SEEK_SET);
-			read(datfd->getFd(), *buf, size);
+			datfd->seek(ioffset, SEEK_SET);
+			datfd->read(*buf, size);
 		}
 		(*buf)[size] = 0;
 		toupperstr_utf8(*buf, size*2);
@@ -133,8 +124,8 @@
 	long offset;
 	
 	if (idxfd > 0) {
-		lseek(idxfd->getFd(), ioffset, SEEK_SET);
-		read(idxfd->getFd(), &offset, 4);
+		idxfd->seek(ioffset, SEEK_SET);
+		idxfd->read(&offset, 4);
 
 		offset = swordtoarch32(offset);
 
@@ -171,7 +162,7 @@
 	long headoff, tailoff, tryoff = 0, maxoff = 0;
 
 	if (idxfd->getFd() >=0) {
-		tailoff = maxoff = lseek(idxfd->getFd(), 0, SEEK_END) - 8;
+		tailoff = maxoff = idxfd->seek(0, SEEK_END) - 8;
 		retval = (tailoff >= 0) ? 0 : -2;	// if NOT new file
 		if (*ikey) {
 			headoff = 0;
@@ -212,11 +203,11 @@
 		}
 		else	tryoff = 0;
 
-		lseek(idxfd->getFd(), tryoff, SEEK_SET);
+		idxfd->seek(tryoff, SEEK_SET);
 
 		*start = *size = 0;
-		read(idxfd->getFd(), start, 4);
-		read(idxfd->getFd(), size, 4);
+		idxfd->read(start, 4);
+		idxfd->read(size, 4);
 		if (idxoff)
 			*idxoff = tryoff;
 
@@ -232,7 +223,7 @@
 			bool bad = false;
 			if (((tryoff + (away*8)) < -8) || (tryoff + (away*8) > (maxoff+8)))
 				bad = true;
-			else if (lseek(idxfd->getFd(), tryoff, SEEK_SET) < 0)
+			else if (idxfd->seek(tryoff, SEEK_SET) < 0)
 				bad = true;
 			if (bad) {
 				retval = -1;
@@ -243,8 +234,8 @@
 					*idxoff = tryoff;
 				break;
 			}
-			read(idxfd->getFd(), start, 4);
-			read(idxfd->getFd(), size, 4);
+			idxfd->read(start, 4);
+			idxfd->read(size, 4);
 			if (idxoff)
 				*idxoff = tryoff;
 
@@ -352,8 +343,8 @@
 		buf = "";
 		buf.setFillByte(0);
 		buf.setSize(*isize);
-		lseek(datfd->getFd(), start, SEEK_SET);
-		read(datfd->getFd(), buf.getRawData(), (int)((*isize) - 1));
+		datfd->seek(start, SEEK_SET);
+		datfd->read(buf.getRawData(), (int)((*isize) - 1));
 
 		for (ch = 0; buf[ch]; ch++) {		// skip over index string
 			if (buf[ch] == 10) {
@@ -429,8 +420,8 @@
 		do {
 			tmpbuf = new char [ size + 2 ];
 			memset(tmpbuf, 0, size + 2);
-			lseek(datfd->getFd(), start, SEEK_SET);
-			read(datfd->getFd(), tmpbuf, (int)(size - 1));
+			datfd->seek(start, SEEK_SET);
+			datfd->read(tmpbuf, (int)(size - 1));
 
 			for (ch = tmpbuf; *ch; ch++) {		// skip over index string
 				if (*ch == 10) {
@@ -456,14 +447,14 @@
 		while (true);	// while we're resolving links
 	}
 
-	endoff = lseek(idxfd->getFd(), 0, SEEK_END);
+	endoff = idxfd->seek(0, SEEK_END);
 
 	shiftSize = endoff - idxoff;
 
 	if (shiftSize > 0) {
 		idxBytes = new char [ shiftSize ];
-		lseek(idxfd->getFd(), idxoff, SEEK_SET);
-		read(idxfd->getFd(), idxBytes, shiftSize);
+		idxfd->seek(idxoff, SEEK_SET);
+		idxfd->read(idxBytes, shiftSize);
 	}
 
 	outbuf = new char [ len + strlen(key) + 5 ];
@@ -472,30 +463,30 @@
 	memcpy(outbuf + size, buf, len);
 	size = outsize = size + len;
 
-	start = outstart = lseek(datfd->getFd(), 0, SEEK_END);
+	start = outstart = datfd->seek(0, SEEK_END);
 
 	outstart = archtosword32(start);
 	outsize  = archtosword32(size);
 
-	lseek(idxfd->getFd(), idxoff, SEEK_SET);
+	idxfd->seek(idxoff, SEEK_SET);
 	if (len>0) {
-		lseek(datfd->getFd(), start, SEEK_SET);
-		write(datfd->getFd(), outbuf, (long)size);
+		datfd->seek(start, SEEK_SET);
+		datfd->write(outbuf, (long)size);
 
 		// add a new line to make data file easier to read in an editor
-		write(datfd->getFd(), &nl, 2);
+		datfd->write(&nl, 2);
 		
-		write(idxfd->getFd(), &outstart, 4);
-		write(idxfd->getFd(), &outsize, 4);
+		idxfd->write(&outstart, 4);
+		idxfd->write(&outsize, 4);
 		if (idxBytes) {
-			write(idxfd->getFd(), idxBytes, shiftSize);
+			idxfd->write(idxBytes, shiftSize);
 			delete [] idxBytes;
 		}
 	}
 	else {	// delete entry
 		if (idxBytes) {
-			write(idxfd->getFd(), idxBytes+8, shiftSize-8);
-			lseek(idxfd->getFd(), -1, SEEK_CUR);	// last valid byte
+			idxfd->write(idxBytes+8, shiftSize-8);
+			idxfd->seek(-1, SEEK_CUR);	// last valid byte
 			FileMgr::getSystemFileMgr()->trunc(idxfd);	// truncate index
 			delete [] idxBytes;
 		}
@@ -543,13 +534,13 @@
 
 	sprintf(buf, "%s.dat", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s.idx", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
 

Modified: trunk/src/modules/common/rawverse.cpp
===================================================================
--- trunk/src/modules/common/rawverse.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/common/rawverse.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -11,21 +11,11 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#include <sys/stat.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <rawverse.h>
 #include <versekey.h>
 #include <sysdata.h>
 
-#ifndef O_BINARY		// O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0		// If it hasn't been defined than we probably
-#endif				// don't need it.
 
 SWORD_NAMESPACE_START
 
@@ -56,20 +46,20 @@
 		path[strlen(path)-1] = 0;
 
 	if (fileMode == -1) { // try read/write if possible
-		fileMode = O_RDWR;
+		fileMode = FileMgr::RDWR;
 	}
 		
 	buf.setFormatted("%s/ot.vss", path);
-	idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/nt.vss", path);
-	idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/ot", path);
-	textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/nt", path);
-	textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	instance++;
 }
@@ -110,15 +100,15 @@
 		testmt = ((idxfp[1]) ? 1:2);
 		
 	if (idxfp[testmt-1]->getFd() >= 0) {
-		lseek(idxfp[testmt-1]->getFd(), idxoff, SEEK_SET);
-		read(idxfp[testmt-1]->getFd(), start, 4);
-		long len = read(idxfp[testmt-1]->getFd(), size, 2); 		// read size
+		idxfp[testmt-1]->seek(idxoff, SEEK_SET);
+		idxfp[testmt-1]->read(start, 4);
+		long len = idxfp[testmt-1]->read(size, 2); 		// read size
 
 		*start = swordtoarch32(*start);
 		*size  = swordtoarch16(*size);
 
 		if (len < 2) {
-			*size = (unsigned short)((*start) ? (lseek(textfp[testmt-1]->getFd(), 0, SEEK_END) - (long)*start) : 0);	// if for some reason we get an error reading size, make size to end of file
+			*size = (unsigned short)((*start) ? (textfp[testmt-1]->seek(0, SEEK_END) - (long)*start) : 0);	// if for some reason we get an error reading size, make size to end of file
 		}
 	}
 	else {
@@ -205,8 +195,8 @@
 		testmt = ((idxfp[1]) ? 1:2);
 	if (size) {
 		if (textfp[testmt-1]->getFd() >= 0) {
-			lseek(textfp[testmt-1]->getFd(), start, SEEK_SET);
-			read(textfp[testmt-1]->getFd(), buf.getRawData(), (int)size); 
+			textfp[testmt-1]->seek(start, SEEK_SET);
+			textfp[testmt-1]->read(buf.getRawData(), (int)size); 
 		}
 	}
 }
@@ -233,15 +223,15 @@
 
 	size = outsize = (len < 0) ? strlen(buf) : len;
 
-	start = outstart = lseek(textfp[testmt-1]->getFd(), 0, SEEK_END);
-	lseek(idxfp[testmt-1]->getFd(), idxoff, SEEK_SET);
+	start = outstart = textfp[testmt-1]->seek(0, SEEK_END);
+	idxfp[testmt-1]->seek(idxoff, SEEK_SET);
 
 	if (size) {
-		lseek(textfp[testmt-1]->getFd(), start, SEEK_SET);
-		write(textfp[testmt-1]->getFd(), buf, (int)size);
+		textfp[testmt-1]->seek(start, SEEK_SET);
+		textfp[testmt-1]->write(buf, (int)size);
 
 		// add a new line to make data file easier to read in an editor
-		write(textfp[testmt-1]->getFd(), nl, 2);
+		textfp[testmt-1]->write(nl, 2);
 	}
 	else {
 		start = 0;
@@ -250,8 +240,8 @@
 	outstart = archtosword32(start);
 	outsize  = archtosword16(size);
 
-	write(idxfp[testmt-1]->getFd(), &outstart, 4);
-	write(idxfp[testmt-1]->getFd(), &outsize, 2);
+	idxfp[testmt-1]->write(&outstart, 4);
+	idxfp[testmt-1]->write(&outsize, 2);
 
 
 }
@@ -276,14 +266,14 @@
 		testmt = ((idxfp[1]) ? 1:2);
 
 	// get source
-	lseek(idxfp[testmt-1]->getFd(), srcidxoff, SEEK_SET);
-	read(idxfp[testmt-1]->getFd(), &start, 4);
-	read(idxfp[testmt-1]->getFd(), &size, 2);
+	idxfp[testmt-1]->seek(srcidxoff, SEEK_SET);
+	idxfp[testmt-1]->read(&start, 4);
+	idxfp[testmt-1]->read(&size, 2);
 
 	// write dest
-	lseek(idxfp[testmt-1]->getFd(), destidxoff, SEEK_SET);
-	write(idxfp[testmt-1]->getFd(), &start, 4);
-	write(idxfp[testmt-1]->getFd(), &size, 2);
+	idxfp[testmt-1]->seek(destidxoff, SEEK_SET);
+	idxfp[testmt-1]->write(&start, 4);
+	idxfp[testmt-1]->write(&size, 2);
 }
 
 
@@ -307,24 +297,24 @@
 
 	sprintf(buf, "%s/ot", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s/nt", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s/ot.vss", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 
 	sprintf(buf, "%s/nt.vss", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 
 	VerseKey vk;
@@ -332,8 +322,14 @@
 	long offset = 0;
 	short size = 0;
 	for (vk = TOP; !vk.Error(); vk++) {
-		write((vk.Testament() == 1) ? fd->getFd() : fd2->getFd(), &offset, 4);
-		write((vk.Testament() == 1) ? fd->getFd() : fd2->getFd(), &size, 2);
+		if (vk.Testament() == 1) {
+			fd->write(&offset, 4);
+			fd->write(&size, 2);
+		}
+		else	{
+			fd2->write(&offset, 4);
+			fd2->write(&size, 2);
+		}
 	}
 
 	FileMgr::getSystemFileMgr()->close(fd);

Modified: trunk/src/modules/common/sapphire.cpp
===================================================================
--- trunk/src/modules/common/sapphire.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/common/sapphire.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -11,22 +11,7 @@
 */
 
 
-#ifdef WIN32
-#include <memory.h>
-#endif
-
-#ifdef UNIX
-#include <memory.h>
-#include <unistd.h>
-#else
-#ifndef _MSC_VER
-#include <mem.h>
-#endif
-#endif
-
-#ifdef _WIN32_WCE
 #include <string.h>
-#endif
 
 #include "sapphire.h"
 

Modified: trunk/src/modules/common/zstr.cpp
===================================================================
--- trunk/src/modules/common/zstr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/common/zstr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,14 +8,8 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
 #include <stdlib.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <zstr.h>
 #include <swcomprs.h>
 
@@ -51,25 +45,22 @@
 
 	compressor = (icomp) ? icomp : new SWCompress();
 	this->blockCount = blockCount;
-#ifndef O_BINARY		// O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0		// If it hasn't been defined than we probably
-#endif				// don't need it.
 
 	if (fileMode == -1) { // try read/write if possible
-		fileMode = O_RDWR;
+		fileMode = FileMgr::RDWR;
 	}
 		
 	buf.setFormatted("%s.idx", path);
-	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s.dat", path);
-	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	datfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s.zdx", path);
-	zdxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	zdxfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s.zdt", path);
-	zdtfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	zdtfd = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	if (datfd <= 0) {
 		SWLog::getSystemLog()->logError("%d", errno);
@@ -121,15 +112,15 @@
 	int size;
 	char ch;
 	if (datfd > 0) {
-		lseek(datfd->getFd(), ioffset, SEEK_SET);
-		for (size = 0; read(datfd->getFd(), &ch, 1) == 1; size++) {
+		datfd->seek(ioffset, SEEK_SET);
+		for (size = 0; datfd->read(&ch, 1) == 1; size++) {
 			if ((ch == '\\') || (ch == 10) || (ch == 13))
 				break;
 		}
 		*buf = (*buf) ? (char *)realloc(*buf, size*2 + 1) : (char *)malloc(size*2 + 1);
 		if (size) {
-			lseek(datfd->getFd(), ioffset, SEEK_SET);
-			read(datfd->getFd(), *buf, size);
+			datfd->seek(ioffset, SEEK_SET);
+			datfd->read(*buf, size);
 		}
 		(*buf)[size] = 0;
 		toupperstr_utf8(*buf, size*2);
@@ -154,8 +145,8 @@
 	__u32 offset;
 	
 	if (idxfd > 0) {
-		lseek(idxfd->getFd(), ioffset, SEEK_SET);
-		read(idxfd->getFd(), &offset, sizeof(__u32));
+		idxfd->seek(ioffset, SEEK_SET);
+		idxfd->read(&offset, sizeof(__u32));
 		offset = swordtoarch32(offset);
 		getKeyFromDatOffset(offset, buf);
 	}
@@ -181,7 +172,7 @@
 	__u32 start, size;
 
 	if (idxfd->getFd() >= 0) {
-		tailoff = maxoff = lseek(idxfd->getFd(), 0, SEEK_END) - IDXENTRYSIZE;
+		tailoff = maxoff = idxfd->seek(0, SEEK_END) - IDXENTRYSIZE;
 		if (*ikey) {
 			headoff = 0;
 			stdstr(&key, ikey, 3);
@@ -219,11 +210,11 @@
 		}
 		else	{ tryoff = 0; }
 
-		lseek(idxfd->getFd(), tryoff, SEEK_SET);
+		idxfd->seek(tryoff, SEEK_SET);
 
 		start = size = 0;
-		retval = (read(idxfd->getFd(), &start, sizeof(__u32))==sizeof(__u32)) ? retval : -1;
-		retval = (read(idxfd->getFd(), &size, sizeof(__u32))==sizeof(__u32)) ? retval : -1;
+		retval = (idxfd->read(&start, sizeof(__u32))==sizeof(__u32)) ? retval : -1;
+		retval = (idxfd->read(&size, sizeof(__u32))==sizeof(__u32)) ? retval : -1;
 		start = swordtoarch32(start);
 		size  = swordtoarch32(size);
 
@@ -239,7 +230,7 @@
 			bool bad = false;
 			if (((long)(tryoff + (away*IDXENTRYSIZE)) < -IDXENTRYSIZE) || (tryoff + (away*IDXENTRYSIZE) > (maxoff+IDXENTRYSIZE)))
 				bad = true;
-			else	if (lseek(idxfd->getFd(), tryoff, SEEK_SET) < 0)
+			else	if (idxfd->seek(tryoff, SEEK_SET) < 0)
 				bad = true;
 			if (bad) {
 				retval = -1;
@@ -250,8 +241,8 @@
 					*idxoff = tryoff;
 				break;
 			}
-			read(idxfd->getFd(), &start, sizeof(__u32));
-			read(idxfd->getFd(), &size, sizeof(__u32));
+			idxfd->read(&start, sizeof(__u32));
+			idxfd->read(&size, sizeof(__u32));
 			start = swordtoarch32(start);
 			size  = swordtoarch32(size);
 
@@ -353,9 +344,9 @@
 	__u32 size;
 
 	do {
-		lseek(idxfd->getFd(), offset, SEEK_SET);
-		read(idxfd->getFd(), &start, sizeof(__u32));
-		read(idxfd->getFd(), &size, sizeof(__u32));
+		idxfd->seek(offset, SEEK_SET);
+		idxfd->read(&start, sizeof(__u32));
+		idxfd->read(&size, sizeof(__u32));
 		start = swordtoarch32(start);
 		size = swordtoarch32(size);
 
@@ -363,8 +354,8 @@
 		*idxbuf = (*idxbuf) ? (char *)realloc(*idxbuf, size*2 + 1) : (char *)malloc(size*2 + 1);
 		memset(*buf, 0, size + 1);
 		memset(*idxbuf, 0, size + 1);
-		lseek(datfd->getFd(), start, SEEK_SET);
-		read(datfd->getFd(), *buf, (int)(size));
+		datfd->seek(start, SEEK_SET);
+		datfd->read(*buf, (int)(size));
 
 		for (ch = *buf; *ch; ch++) {		// skip over index string
 			if (*ch == 10) {
@@ -417,16 +408,16 @@
 	if (cacheBlockIndex != block) {
 		__u32 start = 0;
 
-		lseek(zdxfd->getFd(), block * ZDXENTRYSIZE, SEEK_SET);
-		read(zdxfd->getFd(), &start, sizeof(__u32));
-		read(zdxfd->getFd(), &size, sizeof(__u32));
+		zdxfd->seek(block * ZDXENTRYSIZE, SEEK_SET);
+		zdxfd->read(&start, sizeof(__u32));
+		zdxfd->read(&size, sizeof(__u32));
 		start = swordtoarch32(start);
 		size = swordtoarch32(size);
 
 		SWBuf buf;
 		buf.setSize(size + 5);
-		lseek(zdtfd->getFd(), start, SEEK_SET);
-		read(zdtfd->getFd(), buf.getRawData(), size);
+		zdtfd->seek(start, SEEK_SET);
+		zdtfd->read(buf.getRawData(), size);
 
 		flushCache();
 
@@ -483,16 +474,16 @@
 		}
 		else if ((!diff) && (len > 0 /*we're not deleting*/)) { // got absolute entry
 			do {
-				lseek(idxfd->getFd(), idxoff, SEEK_SET);
-				read(idxfd->getFd(), &start, sizeof(__u32));
-				read(idxfd->getFd(), &size, sizeof(__u32));
+				idxfd->seek(idxoff, SEEK_SET);
+				idxfd->read(&start, sizeof(__u32));
+				idxfd->read(&size, sizeof(__u32));
 				start = swordtoarch32(start);
 				size = swordtoarch32(size);
 
 				tmpbuf = new char [ size + 2 ];
 				memset(tmpbuf, 0, size + 2);
-				lseek(datfd->getFd(), start, SEEK_SET);
-				read(datfd->getFd(), tmpbuf, size);
+				datfd->seek(start, SEEK_SET);
+				datfd->read(tmpbuf, size);
 
 				for (ch = tmpbuf; *ch; ch++) {		// skip over index string
 					if (*ch == 10) {
@@ -519,14 +510,14 @@
 		}
 	}
 
-	endoff = lseek(idxfd->getFd(), 0, SEEK_END);
+	endoff = idxfd->seek(0, SEEK_END);
 
 	shiftSize = endoff - idxoff;
 
 	if (shiftSize > 0) {
 	        idxBytes = new char [ shiftSize ];
-		lseek(idxfd->getFd(), idxoff, SEEK_SET);
-		read(idxfd->getFd(), idxBytes, shiftSize);
+		idxfd->seek(idxoff, SEEK_SET);
+		idxfd->read(idxBytes, shiftSize);
 	}
 
 	outbuf = new char [ len + strlen(key) + 5 ];
@@ -536,12 +527,12 @@
 		if (!cacheBlock) {
 			flushCache();
 			cacheBlock = new EntriesBlock();
-			cacheBlockIndex = (lseek(zdxfd->getFd(), 0, SEEK_END) / ZDXENTRYSIZE);
+			cacheBlockIndex = (zdxfd->seek(0, SEEK_END) / ZDXENTRYSIZE);
 		}
 		else if (cacheBlock->getCount() >= blockCount) {
 			flushCache();
 			cacheBlock = new EntriesBlock();
-			cacheBlockIndex = (lseek(zdxfd->getFd(), 0, SEEK_END) / ZDXENTRYSIZE);
+			cacheBlockIndex = (zdxfd->seek(0, SEEK_END) / ZDXENTRYSIZE);
 		}
 		__u32 entry = cacheBlock->addEntry(buf);
 		cacheDirty = true;
@@ -556,29 +547,29 @@
 		size += len;
 	}
 
-	start = lseek(datfd->getFd(), 0, SEEK_END);
+	start = datfd->seek(0, SEEK_END);
 
 	outstart = archtosword32(start);
 	outsize  = archtosword32(size);
 
-	lseek(idxfd->getFd(), idxoff, SEEK_SET);
+	idxfd->seek(idxoff, SEEK_SET);
 	if (len > 0) {
-		lseek(datfd->getFd(), start, SEEK_SET);
-		write(datfd->getFd(), outbuf, size);
+		datfd->seek(start, SEEK_SET);
+		datfd->write(outbuf, size);
 
 		// add a new line to make data file easier to read in an editor
-		write(datfd->getFd(), &nl, 2);
+		datfd->write(&nl, 2);
 		
-		write(idxfd->getFd(), &outstart, sizeof(__u32));
-		write(idxfd->getFd(), &outsize, sizeof(__u32));
+		idxfd->write(&outstart, sizeof(__u32));
+		idxfd->write(&outsize, sizeof(__u32));
 		if (idxBytes) {
-			write(idxfd->getFd(), idxBytes, shiftSize);
+			idxfd->write(idxBytes, shiftSize);
 		}
 	}
 	else {	// delete entry
 		if (idxBytes) {
-			write(idxfd->getFd(), idxBytes+IDXENTRYSIZE, shiftSize-IDXENTRYSIZE);
-			lseek(idxfd->getFd(), -1, SEEK_CUR);	// last valid byte
+			idxfd->write(idxBytes+IDXENTRYSIZE, shiftSize-IDXENTRYSIZE);
+			idxfd->seek(-1, SEEK_CUR);	// last valid byte
 			FileMgr::getSystemFileMgr()->trunc(idxfd);	// truncate index
 		}
 	}
@@ -624,16 +615,16 @@
 			buf.setSize(size);
 			rawZFilter(buf, 1); // 1 = encipher
 
-			long zdxSize = lseek(zdxfd->getFd(), 0, SEEK_END);
-			long zdtSize = lseek(zdtfd->getFd(), 0, SEEK_END);
+			long zdxSize = zdxfd->seek(0, SEEK_END);
+			long zdtSize = zdtfd->seek(0, SEEK_END);
 
 			if ((cacheBlockIndex * ZDXENTRYSIZE) > (zdxSize - ZDXENTRYSIZE)) {	// New Block
 				start = zdtSize;
 			}
 			else {
-				lseek(zdxfd->getFd(), cacheBlockIndex * ZDXENTRYSIZE, SEEK_SET);
-				read(zdxfd->getFd(), &start, sizeof(__u32));
-				read(zdxfd->getFd(), &outsize, sizeof(__u32));
+				zdxfd->seek(cacheBlockIndex * ZDXENTRYSIZE, SEEK_SET);
+				zdxfd->read(&start, sizeof(__u32));
+				zdxfd->read(&outsize, sizeof(__u32));
 				start = swordtoarch32(start);
 				outsize = swordtoarch32(outsize);
 				if (start + outsize >= zdtSize) {	// last entry, just overwrite
@@ -652,15 +643,15 @@
 			outstart = archtosword32(start);
 			outsize  = archtosword32((__u32)size);
 
-			lseek(zdxfd->getFd(), cacheBlockIndex * ZDXENTRYSIZE, SEEK_SET);
-			lseek(zdtfd->getFd(), start, SEEK_SET);
-			write(zdtfd->getFd(), buf, size);
+			zdxfd->seek(cacheBlockIndex * ZDXENTRYSIZE, SEEK_SET);
+			zdtfd->seek(start, SEEK_SET);
+			zdtfd->write(buf, size);
 
 			// add a new line to make data file easier to read in an editor
-			write(zdtfd->getFd(), &nl, 2);
+			zdtfd->write(&nl, 2);
 			
-			write(zdxfd->getFd(), &outstart, sizeof(__u32));
-			write(zdxfd->getFd(), &outsize, sizeof(__u32));
+			zdxfd->write(&outstart, sizeof(__u32));
+			zdxfd->write(&outsize, sizeof(__u32));
 		}
 		delete cacheBlock;
 		cacheBlock = 0;
@@ -689,25 +680,25 @@
 
 	sprintf(buf, "%s.dat", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s.idx", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
 
 	sprintf(buf, "%s.zdt", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
 
 	sprintf(buf, "%s.zdx", path);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd2);
 

Modified: trunk/src/modules/common/zverse.cpp
===================================================================
--- trunk/src/modules/common/zverse.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/common/zverse.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -12,23 +12,13 @@
 #include <errno.h>
 #include <stdlib.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <versekey.h>
 #include <zverse.h>
 #include <sysdata.h>
 #include <swbuf.h>
 
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 SWORD_NAMESPACE_START
 
 /******************************************************************************
@@ -45,7 +35,7 @@
  * ENT:	ipath - path of the directory where data and index files are located.
  *		be sure to include the trailing separator (e.g. '/' or '\')
  *		(e.g. 'modules/texts/rawtext/webster/')
- *		fileMode - open mode for the files (O_RDONLY, etc.)
+ *		fileMode - open mode for the files (FileMgr::RDONLY, etc.)
  *		blockType - verse, chapter, book, etc.
  */
 
@@ -67,26 +57,26 @@
 	compressor = (icomp) ? icomp : new SWCompress();
 
 	if (fileMode == -1) { // try read/write if possible
-		fileMode = O_RDWR;
+		fileMode = FileMgr::RDWR;
 	}
 		
 	buf.setFormatted("%s/ot.%czs", path, uniqueIndexID[blockType]);
-	idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/nt.%czs", path, uniqueIndexID[blockType]);
-	idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	idxfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/ot.%czz", path, uniqueIndexID[blockType]);
-	textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	textfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/nt.%czz", path, uniqueIndexID[blockType]);
-	textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	textfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/ot.%czv", path, uniqueIndexID[blockType]);
-	compfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	compfp[0] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 
 	buf.setFormatted("%s/nt.%czv", path, uniqueIndexID[blockType]);
-	compfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	compfp[1] = FileMgr::getSystemFileMgr()->open(buf, fileMode, true);
 	
 	instance++;
 }
@@ -158,9 +148,9 @@
 	if (compfp[testmt-1]->getFd() < 1)
 		return;
 		
-	long newOffset = lseek(compfp[testmt-1]->getFd(), idxoff, SEEK_SET);
+	long newOffset = compfp[testmt-1]->seek(idxoff, SEEK_SET);
 	if (newOffset == idxoff) {
-		if (read(compfp[testmt-1]->getFd(), &ulBuffNum, 4) != 4) {
+		if (compfp[testmt-1]->read(&ulBuffNum, 4) != 4) {
 			printf ("Error reading ulBuffNum\n");
 			return;
 		}
@@ -169,12 +159,12 @@
 
 	ulBuffNum = swordtoarch32(ulBuffNum);
 
-	if (read(compfp[testmt-1]->getFd(), &ulVerseStart, 4) < 2)
+	if (compfp[testmt-1]->read(&ulVerseStart, 4) < 2)
 	{
 		printf ("Error reading ulVerseStart\n");
 		return;
 	}
-	if (read(compfp[testmt-1]->getFd(), &usVerseSize, 2) < 2)
+	if (compfp[testmt-1]->read(&usVerseSize, 2) < 2)
 	{
 		printf ("Error reading usVerseSize\n");
 		return;
@@ -192,22 +182,22 @@
 		//printf ("Got buffer number{%ld} versestart{%ld} versesize{%d}\n", ulBuffNum, ulVerseStart, usVerseSize);
 
 
-		if (lseek(idxfp[testmt-1]->getFd(), ulBuffNum*12, SEEK_SET)!=(long) ulBuffNum*12)
+		if (idxfp[testmt-1]->seek(ulBuffNum*12, SEEK_SET)!=(long) ulBuffNum*12)
 		{
 			printf ("Error seeking compressed file index\n");
 			return;
 		}
-		if (read(idxfp[testmt-1]->getFd(), &ulCompOffset, 4)<4)
+		if (idxfp[testmt-1]->read(&ulCompOffset, 4)<4)
 		{
 			printf ("Error reading ulCompOffset\n");
 			return;
 		}
-		if (read(idxfp[testmt-1]->getFd(), &ulCompSize, 4)<4)
+		if (idxfp[testmt-1]->read(&ulCompSize, 4)<4)
 		{
 			printf ("Error reading ulCompSize\n");
 			return;
 		}
-		if (read(idxfp[testmt-1]->getFd(), &ulUnCompSize, 4)<4)
+		if (idxfp[testmt-1]->read(&ulUnCompSize, 4)<4)
 		{
 			printf ("Error reading ulUnCompSize\n");
 			return;
@@ -217,7 +207,7 @@
 		ulCompSize  = swordtoarch32(ulCompSize);
 		ulUnCompSize  = swordtoarch32(ulUnCompSize);
 
-		if (lseek(textfp[testmt-1]->getFd(), ulCompOffset, SEEK_SET)!=(long)ulCompOffset)
+		if (textfp[testmt-1]->seek(ulCompOffset, SEEK_SET)!=(long)ulCompOffset)
 		{
 			printf ("Error: could not seek to right place in compressed text\n");
 			return;
@@ -225,7 +215,7 @@
 		SWBuf pcCompText;
 		pcCompText.setSize(ulCompSize+5);
 
-		if (read(textfp[testmt-1]->getFd(), pcCompText.getRawData(), ulCompSize)<(long)ulCompSize) {
+		if (textfp[testmt-1]->read(pcCompText.getRawData(), ulCompSize)<(long)ulCompSize) {
 			printf ("Error reading compressed text\n");
 			return;
 		}
@@ -287,7 +277,7 @@
 	if (!testmt) 
 		testmt = ((idxfp[0]) ? 1:2);
 	if ((!dirtyCache) || (cacheBufIdx < 0)) {
-		cacheBufIdx = lseek(idxfp[testmt-1]->getFd(), 0, SEEK_END) / 12;
+		cacheBufIdx = idxfp[testmt-1]->seek(0, SEEK_END) / 12;
 		cacheTestament = testmt;
 		if (cacheBuf)
 			free(cacheBuf);
@@ -314,10 +304,10 @@
 	outstart  = archtosword32(start);
 	outsize   = archtosword16(size);
 
-	lseek(compfp[testmt-1]->getFd(), idxoff, SEEK_SET);
-	write(compfp[testmt-1]->getFd(), &outBufIdx, 4);
-	write(compfp[testmt-1]->getFd(), &outstart, 4);
-	write(compfp[testmt-1]->getFd(), &outsize, 2);
+	compfp[testmt-1]->seek(idxoff, SEEK_SET);
+	compfp[testmt-1]->write(&outBufIdx, 4);
+	compfp[testmt-1]->write(&outstart, 4);
+	compfp[testmt-1]->write(&outsize, 2);
 	strcat(cacheBuf, buf);
 }
 
@@ -347,18 +337,18 @@
 				buf.setSize(zsize);
 				rawZFilter(buf, 1); // 1 = encipher
 
-				start = outstart = lseek(textfp[cacheTestament-1]->getFd(), 0, SEEK_END);
+				start = outstart = textfp[cacheTestament-1]->seek(0, SEEK_END);
 
 				outstart  = archtosword32(start);
 				outsize   = archtosword32(size);
 				outzsize  = archtosword32(zsize);
 
-				write(textfp[cacheTestament-1]->getFd(), buf, zsize);
+				textfp[cacheTestament-1]->write(buf, zsize);
 
-				lseek(idxfp[cacheTestament-1]->getFd(), idxoff, SEEK_SET);
-				write(idxfp[cacheTestament-1]->getFd(), &outstart, 4);
-				write(idxfp[cacheTestament-1]->getFd(), &outzsize, 4);
-				write(idxfp[cacheTestament-1]->getFd(), &outsize, 4);
+				idxfp[cacheTestament-1]->seek(idxoff, SEEK_SET);
+				idxfp[cacheTestament-1]->write(&outstart, 4);
+				idxfp[cacheTestament-1]->write(&outzsize, 4);
+				idxfp[cacheTestament-1]->write(&outsize, 4);
 			}
 			free(cacheBuf);
 			cacheBuf = 0;
@@ -387,16 +377,16 @@
 		testmt = ((idxfp[1]) ? 1:2);
 
 	// get source
-	lseek(compfp[testmt-1]->getFd(), srcidxoff, SEEK_SET);
-	read(compfp[testmt-1]->getFd(), &bufidx, 4);
-	read(compfp[testmt-1]->getFd(), &start, 4);
-	read(compfp[testmt-1]->getFd(), &size, 2);
+	compfp[testmt-1]->seek(srcidxoff, SEEK_SET);
+	compfp[testmt-1]->read(&bufidx, 4);
+	compfp[testmt-1]->read(&start, 4);
+	compfp[testmt-1]->read(&size, 2);
 
 	// write dest
-	lseek(compfp[testmt-1]->getFd(), destidxoff, SEEK_SET);
-	write(compfp[testmt-1]->getFd(), &bufidx, 4);
-	write(compfp[testmt-1]->getFd(), &start, 4);
-	write(compfp[testmt-1]->getFd(), &size, 2);
+	compfp[testmt-1]->seek(destidxoff, SEEK_SET);
+	compfp[testmt-1]->write(&bufidx, 4);
+	compfp[testmt-1]->write(&start, 4);
+	compfp[testmt-1]->write(&size, 2);
 }
 
 
@@ -420,36 +410,36 @@
 
 	sprintf(buf, "%s/ot.%czs", path, uniqueIndexID[blockBound]);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s/nt.%czs", path, uniqueIndexID[blockBound]);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s/ot.%czz", path, uniqueIndexID[blockBound]);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s/nt.%czz", path, uniqueIndexID[blockBound]);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 
 	sprintf(buf, "%s/ot.%czv", path, uniqueIndexID[blockBound]);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 
 	sprintf(buf, "%s/nt.%czv", path, uniqueIndexID[blockBound]);
 	FileMgr::removeFile(buf);
-	fd2 = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd2 = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd2->getFd();
 
 	VerseKey vk;
@@ -457,9 +447,16 @@
 	long offset = 0;
 	short size = 0;
 	for (vk = TOP; !vk.Error(); vk++) {
-		write((vk.Testament() == 1) ? fd->getFd() : fd2->getFd(), &offset, 4);	//compBufIdxOffset
-		write((vk.Testament() == 1) ? fd->getFd() : fd2->getFd(), &offset, 4);
-		write((vk.Testament() == 1) ? fd->getFd() : fd2->getFd(), &size, 2);
+		if (vk.Testament() == 1) {
+			fd->write(&offset, 4);	//compBufIdxOffset
+			fd->write(&offset, 4);
+			fd->write(&size, 2);
+		}
+		else {
+			fd2->write(&offset, 4);	//compBufIdxOffset
+			fd2->write(&offset, 4);
+			fd2->write(&size, 2);
+		}
 	}
 
 	FileMgr::getSystemFileMgr()->close(fd);

Modified: trunk/src/modules/filters/gbffootnotes.cpp
===================================================================
--- trunk/src/modules/filters/gbffootnotes.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbffootnotes.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -11,10 +11,6 @@
 #include <swbuf.h>
 #include <versekey.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/gbfheadings.cpp
===================================================================
--- trunk/src/modules/filters/gbfheadings.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfheadings.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,10 +7,6 @@
 
 #include <stdlib.h>
 #include <gbfheadings.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/gbfmorph.cpp
===================================================================
--- trunk/src/modules/filters/gbfmorph.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfmorph.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,10 +7,6 @@
 
 #include <stdlib.h>
 #include <gbfmorph.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/gbfosis.cpp
===================================================================
--- trunk/src/modules/filters/gbfosis.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfosis.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -14,10 +14,6 @@
 #include <utilxml.h>
 #include <swlog.h>
 #include <stdarg.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/gbfredletterwords.cpp
===================================================================
--- trunk/src/modules/filters/gbfredletterwords.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfredletterwords.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,10 +8,6 @@
 #include <stdlib.h>
 #include <gbfredletterwords.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 #include <ctype.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/gbfrtf.cpp
===================================================================
--- trunk/src/modules/filters/gbfrtf.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfrtf.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5,6 +5,7 @@
 
 
 #include <gbfrtf.h>
+#include <utilstr.h>
 #include <ctype.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/gbfstrongs.cpp
===================================================================
--- trunk/src/modules/filters/gbfstrongs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfstrongs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,10 +8,6 @@
 #include <stdlib.h>
 #include <gbfstrongs.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 #include <ctype.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/gbfwebif.cpp
===================================================================
--- trunk/src/modules/filters/gbfwebif.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/gbfwebif.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -17,7 +17,7 @@
 
 #include <gbfwebif.h>
 #include <ctype.h>
-#include <utilweb.h>
+#include <url.h>
 
 SWORD_NAMESPACE_START
 
@@ -54,7 +54,7 @@
 						if (isdigit(url[1]))
 							url = url.c_str()+1;
 					}
-					buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+					buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 
 					for (tok = (!isdigit(*val))?val+1:val; *tok; tok++) {
 						buf += *tok;
@@ -79,7 +79,7 @@
 							if (isdigit(url[1]))
 								url = url.c_str()+1;
 						}
-						buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+						buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 
 						for (tok = (!isdigit(*val))?val+1:val; *tok; tok++) {
 							buf += *tok;
@@ -100,7 +100,7 @@
 				// normal robinsons tense
 					buf += *tok;
 				}
-				buf.appendFormatted("<a href=\"%s?showMorph=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+				buf.appendFormatted("<a href=\"%s?showMorph=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 
 				for (tok = val; *tok; tok++) {
 					buf += *tok;
@@ -120,7 +120,7 @@
 				if (isdigit(url[1]))
 					url = url.c_str()+1;
 			}
-			buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+			buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 
 			for (tok = token + 2; *tok; tok++) {
 				buf += *tok;
@@ -139,7 +139,7 @@
 				if (isdigit(url[1]))
 					url = url.c_str()+1;
 			}
-			buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+			buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 
 			for (tok = token + 3; *tok; tok++)
 				if(*tok != '\"')
@@ -153,7 +153,7 @@
 				if(*tok != '\"')
 					buf += *tok;
 			}
-			buf.appendFormatted("<a href=\"%s?showMorph=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+			buf.appendFormatted("<a href=\"%s?showMorph=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 
 			for (tok = token + 2; *tok; tok++) {
 				if(*tok != '\"')
@@ -173,7 +173,7 @@
 			  }
 			}
 
-			buf.appendFormatted("a href=\"%s?key=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+			buf.appendFormatted("a href=\"%s?key=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 		}
 
 		else {

Modified: trunk/src/modules/filters/osisfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/osisfootnotes.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osisfootnotes.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -11,10 +11,7 @@
 #include <swbuf.h>
 #include <versekey.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/osisheadings.cpp
===================================================================
--- trunk/src/modules/filters/osisheadings.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osisheadings.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -9,10 +9,7 @@
 #include <osisheadings.h>
 #include <swmodule.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/osislemma.cpp
===================================================================
--- trunk/src/modules/filters/osislemma.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osislemma.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,10 +8,6 @@
 #include <stdlib.h>
 #include <osislemma.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/osismorph.cpp
===================================================================
--- trunk/src/modules/filters/osismorph.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osismorph.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,10 +8,6 @@
 #include <stdlib.h>
 #include <osismorph.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/osisredletterwords.cpp
===================================================================
--- trunk/src/modules/filters/osisredletterwords.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osisredletterwords.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -9,11 +9,8 @@
 #include <osisredletterwords.h>
 #include <swmodule.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
+
 SWORD_NAMESPACE_START
 
 const char oName[] = "Words of Christ in Red";

Modified: trunk/src/modules/filters/osisscripref.cpp
===================================================================
--- trunk/src/modules/filters/osisscripref.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osisscripref.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -9,10 +9,6 @@
 #include <osisscripref.h>
 #include <swmodule.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/osisstrongs.cpp
===================================================================
--- trunk/src/modules/filters/osisstrongs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osisstrongs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,10 +8,6 @@
 #include <stdlib.h>
 #include <osisstrongs.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 #include <ctype.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/osiswebif.cpp
===================================================================
--- trunk/src/modules/filters/osiswebif.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osiswebif.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <osiswebif.h>
 #include <utilxml.h>
+#include <url.h>
 #include <versekey.h>
 #include <swmodule.h>
 #include <ctype.h>
@@ -80,7 +81,7 @@
 							val2++;
 						if ((!strcmp(val2, "3588")) && (lastText.length() < 1))
 							show = false;
-						else	buf.appendFormatted(" <small><em>&lt;<a href=\"%s?showStrong=%s#cv\">%s</a>&gt;</em></small> ", passageStudyURL.c_str(), encodeURL(val2).c_str(), val2);
+						else	buf.appendFormatted(" <small><em>&lt;<a href=\"%s?showStrong=%s#cv\">%s</a>&gt;</em></small> ", passageStudyURL.c_str(), URL::encode(val2).c_str(), val2);
 					} while (++i < count);
 				}
 				if ((attrib = tag.getAttribute("morph")) && (show)) {
@@ -98,7 +99,7 @@
 							const char *val2 = val;
 							if ((*val == 'T') && (strchr("GH", val[1])) && (isdigit(val[2])))
 								val2+=2;
-							buf.appendFormatted(" <small><em>(<a href=\"%s?showMorph=%s#cv\">%s</a>)</em></small> ", passageStudyURL.c_str(), encodeURL(val2).c_str(), val2);
+							buf.appendFormatted(" <small><em>(<a href=\"%s?showMorph=%s#cv\">%s</a>)</em></small> ", passageStudyURL.c_str(), URL::encode(val2).c_str(), val2);
 						} while (++i < count);
 					}
 				}

Modified: trunk/src/modules/filters/osiswordjs.cpp
===================================================================
--- trunk/src/modules/filters/osiswordjs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/osiswordjs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,10 +8,6 @@
 #include <stdlib.h>
 #include <osiswordjs.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 #include <ctype.h>
 #include <utilxml.h>
 #include <versekey.h>

Modified: trunk/src/modules/filters/plainfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/plainfootnotes.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/plainfootnotes.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -19,10 +19,6 @@
 #include <swkey.h>
 
 #include <stdlib.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/swbasicfilter.cpp
===================================================================
--- trunk/src/modules/filters/swbasicfilter.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/swbasicfilter.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -26,6 +26,7 @@
 #include <swbasicfilter.h>
 #include <stdio.h>
 #include <stdarg.h>
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/swoptfilter.cpp
===================================================================
--- trunk/src/modules/filters/swoptfilter.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/swoptfilter.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5,6 +5,7 @@
 
 
 #include <swoptfilter.h>
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlfootnotes.cpp
===================================================================
--- trunk/src/modules/filters/thmlfootnotes.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlfootnotes.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -11,10 +11,6 @@
 #include <swbuf.h>
 #include <versekey.h>
 #include <utilxml.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlgbf.cpp
===================================================================
--- trunk/src/modules/filters/thmlgbf.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlgbf.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -16,6 +16,7 @@
 
 #include <stdlib.h>
 #include <thmlgbf.h>
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlheadings.cpp
===================================================================
--- trunk/src/modules/filters/thmlheadings.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlheadings.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,15 +8,8 @@
 #include <stdlib.h>
 #include <thmlheadings.h>
 #include <utilxml.h>
+#include <utilstr.h>
 
-#ifndef	_WIN32_WCE
-#include <iostream>
-#endif
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
-
 SWORD_NAMESPACE_START
 
 const char oName[] = "Headings";

Modified: trunk/src/modules/filters/thmlhtmlhref.cpp
===================================================================
--- trunk/src/modules/filters/thmlhtmlhref.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlhtmlhref.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -18,6 +18,7 @@
 #include <thmlhtmlhref.h>
 #include <swmodule.h>
 #include <utilxml.h>
+#include <utilstr.h>
 #include <versekey.h>
 #include <url.h>
 

Modified: trunk/src/modules/filters/thmllemma.cpp
===================================================================
--- trunk/src/modules/filters/thmllemma.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmllemma.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,10 +7,7 @@
 
 #include <stdlib.h>
 #include <thmllemma.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlmorph.cpp
===================================================================
--- trunk/src/modules/filters/thmlmorph.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlmorph.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,10 +7,6 @@
 
 #include <stdlib.h>
 #include <thmlmorph.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlosis.cpp
===================================================================
--- trunk/src/modules/filters/thmlosis.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlosis.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -13,11 +13,9 @@
 #include <swlog.h>
 #include <versekey.h>
 #include <stdarg.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
+#include <utilstr.h>
 
+
 SWORD_NAMESPACE_START
 
 ThMLOSIS::ThMLOSIS() {

Modified: trunk/src/modules/filters/thmlrtf.cpp
===================================================================
--- trunk/src/modules/filters/thmlrtf.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlrtf.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -18,6 +18,7 @@
 #include <thmlrtf.h>
 #include <swmodule.h>
 #include <utilxml.h>
+#include <utilstr.h>
 #include <versekey.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/thmlscripref.cpp
===================================================================
--- trunk/src/modules/filters/thmlscripref.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlscripref.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -10,10 +10,6 @@
 #include <utilxml.h>
 #include <versekey.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlstrongs.cpp
===================================================================
--- trunk/src/modules/filters/thmlstrongs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlstrongs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -9,10 +9,7 @@
 #include <stdio.h>
 #include <thmlstrongs.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
+#include <utilstr.h>
 #include <ctype.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/thmlvariants.cpp
===================================================================
--- trunk/src/modules/filters/thmlvariants.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlvariants.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,10 +7,7 @@
 
 #include <stdlib.h>
 #include <thmlvariants.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
+#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 

Modified: trunk/src/modules/filters/thmlwebif.cpp
===================================================================
--- trunk/src/modules/filters/thmlwebif.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlwebif.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <thmlwebif.h>
 #include <swmodule.h>
-#include <utilweb.h>
+#include <url.h>
 #include <utilxml.h>
 #include <ctype.h>
 
@@ -44,7 +44,7 @@
 
 			if(tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "morph")){
 				buf += "<small><em> (";
-				buf.appendFormatted("<a href=\"%s?showMorph=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str() );
+				buf.appendFormatted("<a href=\"%s?showMorph=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str() );
 			}
 			else {
 				if (value) {
@@ -53,7 +53,7 @@
 				}
 
 				buf += "<small><em> &lt;";
-				buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str() );
+				buf.appendFormatted("<a href=\"%s?showStrong=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str() );
 			}
 
 			buf += value;
@@ -74,7 +74,7 @@
 				}
 				else { // end of scripRef like "<scripRef>John 3:16</scripRef>"
 					url = u->lastTextNode;
-					buf.appendFormatted("<a href=\"%s?key=%s#cv\">", passageStudyURL.c_str(), encodeURL(url).c_str());
+					buf.appendFormatted("<a href=\"%s?key=%s#cv\">", passageStudyURL.c_str(), URL::encode(url).c_str());
 					buf += u->lastTextNode.c_str();
 					buf += "</a>";
 
@@ -85,7 +85,7 @@
 			else if (tag.getAttribute("passage")) { //passage given
 				u->inscriptRef = true;
 
-				buf.appendFormatted("<a href=\"%s?key=%s#cv\">", passageStudyURL.c_str(), encodeURL(tag.getAttribute("passage")).c_str());
+				buf.appendFormatted("<a href=\"%s?key=%s#cv\">", passageStudyURL.c_str(), URL::encode(tag.getAttribute("passage")).c_str());
 			}
 			else { //no passage given
 				u->inscriptRef = false;

Modified: trunk/src/modules/filters/thmlwordjs.cpp
===================================================================
--- trunk/src/modules/filters/thmlwordjs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/thmlwordjs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,12 +8,9 @@
 #include <stdlib.h>
 #include <thmlwordjs.h>
 #include <swmodule.h>
-#ifndef __GNUC__
-#else
-#include <unixstr.h>
-#endif
 #include <ctype.h>
 #include <utilxml.h>
+#include <utilstr.h>
 #include <versekey.h>
 
 SWORD_NAMESPACE_START

Modified: trunk/src/modules/filters/utf8html.cpp
===================================================================
--- trunk/src/modules/filters/utf8html.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/filters/utf8html.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -24,7 +24,7 @@
 	 if ((unsigned long)key < 2)	// hack, we're en(1)/de(0)ciphering
 		return (char)-1;
 
-	len = strlenw(text.c_str()) + 2;						// shift string to right of buffer
+	len = strlen(text.c_str()) + 2;						// shift string to right of buffer
 
 	SWBuf orig = text;
   	from = (unsigned char *)orig.c_str();

Modified: trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp
===================================================================
--- trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,20 +7,10 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
 #include <rawgenbook.h>
 #include <rawstr.h>
+#include <utilstr.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 SWORD_NAMESPACE_START
 
 /******************************************************************************
@@ -33,7 +23,7 @@
 
 RawGenBook::RawGenBook(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang)
 		: SWGenBook(iname, idesc, idisp, enc, dir, mark, ilang) {
-	int fileMode = O_RDWR;
+
 	char *buf = new char [ strlen (ipath) + 20 ];
 
 	path = 0;
@@ -48,7 +38,7 @@
 
 
 	sprintf(buf, "%s.bdt", path);
-	bdtfd = FileMgr::getSystemFileMgr()->open(buf, fileMode|O_BINARY, true);
+	bdtfd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::RDWR, true);
 
 	delete [] buf;
 
@@ -191,7 +181,7 @@
 
 	sprintf(buf, "%s.bdt", path);
 	FileMgr::removeFile(buf);
-	fd = FileMgr::getSystemFileMgr()->open(buf, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
 	fd->getFd();
 	FileMgr::getSystemFileMgr()->close(fd);
 

Deleted: trunk/src/modules/lexdict/rawld/no13.c
===================================================================
--- trunk/src/modules/lexdict/rawld/no13.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/lexdict/rawld/no13.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,34 +0,0 @@
-#include <fcntl.h>
-#include <stdio.h>
-
-main(int argc, char **argv)
-{
-	int fd, loop;
-	char ch;
-	char breakcnt = 0;
-
-	if (argc != 2) {
-		fprintf(stderr, "This program writes to stdout, so to be useful,\n\tit should be redirected (e.g no13 bla > bla.dat)\nusage: %s <filename>\n", argv[0]);
-		exit(1);
-	}
-	fd = open(argv[1], O_RDONLY);
-	while (read(fd, &ch, 1) == 1) {
-		if (ch == 0x0d) {	// CR
-			breakcnt++;
-			continue;
-		}
-		if (ch == 0x1a)	// Ctrl-Z
-			continue;
-
-		if (ch != 0x0a) {	// LF
-			if (breakcnt > 1) {
-				for (loop = breakcnt; loop > 0; loop--)
-					putchar(0x0d);
-				putchar(0x0a);
-			}
-			breakcnt=0;
-		}
-		putchar(ch);
-	}
-	close(fd);
-}

Modified: trunk/src/modules/lexdict/rawld/rawld.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld/rawld.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/lexdict/rawld/rawld.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,13 +8,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <rawstr.h>
 #include <rawld.h>
 

Deleted: trunk/src/modules/lexdict/rawld/rawldidx.c
===================================================================
--- trunk/src/modules/lexdict/rawld/rawldidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/lexdict/rawld/rawldidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * Bible dictionary index utility
- */
-
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-char findbreak(int fd, long *offset, short *size)
-{
-	char buf[3];
-	char rc = 1;
-	long offset2;
-
-	memset(buf, 0, sizeof(buf));
-
-	while (read(fd, &buf[sizeof(buf)-1], 1) == 1) {
-		if ((buf[0] == 10) && (buf[1] == '$') && (buf[2] == '$')) {
-			while (read(fd, buf, 1) == 1) {
-				if (*buf == 10) {
-					if (read(fd, buf, 1) == 1) {
-						*offset = lseek(fd, 0, SEEK_CUR);
-						rc = 0;
-						if (size) {
-							if (!findbreak(fd, &offset2, 0))
-								*size = offset2 - *offset - 13;
-							else *size = lseek(fd, 0, SEEK_END) - *offset;
-							lseek(fd, *offset, SEEK_SET);
-						}
-						break;
-					}
-				}
-			}
-			break;
-		}
-		memmove(buf, &buf[1], sizeof(buf)-1);
-	}
-	return rc;
-}
-
-
-void main(int argc, char **argv)
-{
-	int   fd, ifd;
-	long  offset;
-	short size;
-	char  *buf;
-
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process (no .dat)>\n", argv[0]);
-		exit(1);
-	}
-
-	buf = (char *) calloc(strlen(argv[1]) + 5, 1);
-
-#ifndef O_BINARY		// O_BINARY is for Borland to be happy.  If we're in GNU, just define it to a NULL mask
-#define O_BINARY 0
-#endif
-	sprintf(buf, "%s.dat", argv[1]);
-	fd = open(buf, O_RDONLY|O_BINARY);
-
-	sprintf(buf, "%s.idx", argv[1]);
-	ifd = open(buf, O_CREAT|O_WRONLY|O_BINARY);
-
-	offset = 0;				/* write offset for intro */
-	write(ifd, &offset, 4);
-	findbreak(fd, &offset, 0);
-	lseek(fd, 0L, SEEK_SET);
-	size = offset - 12;
-	write(ifd, &size, 2);
-
-	buf[3] = 0;				/* delimit string for read below */
-
-	while(!findbreak(fd, &offset, &size)) {
-		write(ifd, &offset, 4);
-		write(ifd, &size, 2);
-		read(fd, buf, 3);
-		printf("Found: %s...(%ld:%d)\n", buf, offset, size);
-	}
-
-	free(buf);
-
-	close(ifd);
-	close(fd);
-}

Deleted: trunk/src/modules/lexdict/rawld/strongsidx.c
===================================================================
--- trunk/src/modules/lexdict/rawld/strongsidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/lexdict/rawld/strongsidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,90 +0,0 @@
-/*****************************************************************************
- * Bible dictionary index utility
- */
-
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-char findbreak(int fd, long *offset, short *size)
-{
-	char buf[3];
-	char rc = 1;
-	long offset2;
-
-	memset(buf, 0, sizeof(buf));
-
-	while (read(fd, &buf[sizeof(buf)-1], 1) == 1) {
-		if ((buf[0] == 10) && (isdigit(buf[1])) && (isdigit(buf[2]))) {
-			if (read(fd, buf, 1) == 1) {
-				*offset = lseek(fd, 0, SEEK_CUR) - 3;
-				rc = 0;
-				if (size) {
-					if (!findbreak(fd, &offset2, 0))
-						*size = offset2 - *offset;
-					else *size = lseek(fd, 0, SEEK_END) - *offset;
-					lseek(fd, *offset, SEEK_SET);
-				}
-				break;
-			}
-			break;
-		}
-		memmove(buf, &buf[1], sizeof(buf)-1);
-	}
-	return rc;
-}
-
-
-void main(int argc, char **argv)
-{
-	int   fd, ifd;
-	long  offset;
-	short size;
-	char  *buf;
-	char  entbuf[6];
-
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process (no .dat)>\n", argv[0]);
-		exit(1);
-	}
-
-	buf = (char *) calloc(strlen(argv[1]) + 5, 1);
-
-	sprintf(buf, "%s.dat", argv[1]);
-	fd = open(buf, O_RDONLY);
-
-	sprintf(buf, "%s.idx", argv[1]);
-	ifd = open(buf, O_CREAT|O_WRONLY);
-
-	offset = 0;				/* write offset for intro */
-	write(ifd, &offset, 4);
-	findbreak(fd, &offset, 0);
-	lseek(fd, 0L, SEEK_SET);
-	size = offset - 12;
-	write(ifd, &size, 2);
-
-	entbuf[5] = 0;				/* delimit string for read below */
-
-	while(!findbreak(fd, &offset, &size)) {
-		write(ifd, &offset, 4);
-		write(ifd, &size, 2);
-		read(fd, entbuf, 5);
-		printf("Found: %s...(%ld:%d)\n", entbuf, offset, size);
-	}
-
-	free(buf);
-
-	close(ifd);
-	close(fd);
-}

Modified: trunk/src/modules/lexdict/rawld4/rawld4.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld4/rawld4.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/lexdict/rawld4/rawld4.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,13 +8,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <rawstr4.h>
 #include <rawld4.h>
 

Modified: trunk/src/modules/lexdict/zld/zld.cpp
===================================================================
--- trunk/src/modules/lexdict/zld/zld.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/lexdict/zld/zld.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,13 +8,7 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <zstr.h>
 #include <zld.h>
 

Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/swmodule.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5,7 +5,7 @@
  */
 
 #include <swmodule.h>
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <regex.h>	// GNU
 #include <swfilter.h>
 #include <versekey.h>	// KLUDGE for Search

Deleted: trunk/src/modules/texts/rawtext/kjvidx.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/kjvidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/kjvidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,169 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <versekey.h>
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	short size, tmp;
-	int num1, num2, offset, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-	VerseKey mykey;
-
-	if ((argc < 2) || (argc > 3)) {
-		fprintf(stderr, "usage: %s <file to process> [nt]\n", argv[0]);
-		exit(1);
-	}
-
-	if ((fp = open(argv[1], O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	mykey = (argc == 3) ? "Matthew 1:1" : "Genesis 1:1";
-
-	while (!findbreak(fp, &offset, &num1, &num2, &size)) {
-		num1 = mykey.Chapter();
-		num2 = mykey.Verse();
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfp, &pos, 4);  /* Book intro (vss) */
-				write(vfp, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);  /* Chapter intro */
-			write(vfp, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7d\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence\n");
-			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence\n");
-			break;
-		}
-		write(vfp, &offset, 4);
-		write(vfp, &size, 2);
-		mykey++;
-	}
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size)
-{
-	char buf[17];
-	char buf2[7];
-	char loop;
-	char offadj, inquotes, sizeadj;
-	int offset2, ch2, vs2;
-	
-	memset(buf, ' ', 17);
-
-	while (1) {
-		offadj = -10;
-		inquotes = 0;
-		sizeadj = 0;
-  		if ((!memcmp(buf, "\\widctlpar {\\b\\f0\\cf2 ", 16)) && (!size)) {
-			offadj = -1;
-//			inquotes = 1;
-			sizeadj = -18;
-		}
-  		if (!memcmp(&buf[1], "\\f0\\fs16\\cf2\\up6", 15)) {
-			offadj = 0;
-			inquotes = 1;
-			sizeadj = (*buf == 10) ? -18:-17;
-		}
-  		if (!memcmp(buf, "\\fi200\\widctlpar", 16)) {
-			offadj = -1;
-//			inquotes = 1;
-			sizeadj = -18;
-		}
-		if (offadj > -10) {
-			*offset = lseek(fp, 0, SEEK_CUR) + offadj;
-			if (size) {
-				(*offset)++;
-				while (inquotes) {
-					while (read(fp, buf2, 1) == 1) {
-						if (*buf2 == '}')
-							break;
-						(*offset)++;
-					}
-					inquotes--;
-				}
-				if (findbreak(fp, &offset2, &ch2, &vs2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					sprintf(buf2, "%d:%d", ch2, vs2);
-					*size = (offset2 - (*offset));
-				}
-				lseek(fp, *offset+17, SEEK_SET);
-			}
-			else (*offset) += sizeadj;
-			return 0;
-		}
-		memmove(buf, &buf[1], 16);
-		if (read(fp, &buf[16], 1) != 1)
-			return 1;
-	}
-}
-

Deleted: trunk/src/modules/texts/rawtext/makebnds.c
===================================================================
--- trunk/src/modules/texts/rawtext/makebnds.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/makebnds.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,86 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-
-
-char *bnames[] = {
-	"Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy",
-	"Joshua", "Judges", "Ruth", "I Samual", "II Samuel",
-	"I Kings", "II Kings", "I Chronicles", "II Chronicles", "Ezra",
-	"Nehemiah", "Esther", "Job", "Psalms", "Proverbs",
-	"Ecclesiastes", "Song of Solomon", "Isaiah", "Jeremiah", "Lamentations",
-	"Ezekiel", "Daniel", "Hosea", "Joel", "Amos",
-	"Obadiah", "Jonah", "Micah", "Nahum", "Habakkuk",
-	"Zephaniah", "Haggai", "Zechariah", "Malachi",
-	"Matthew", "Mark", "Luke", "John", "Acts",
-	"Romans", "I Corinthians", "II Corinthians", "Galatians", "Ephesians",
-	"Philippians", "Colossians", "I Thessalonians", "II Thessalonians", "I Timothy",
-	"II Timothy", "Titus", "Philemon", "Hebrews", "James",
-	"I Peter", "II Peter", "I John", "II John", "III John",
-	"Jude", "Revelation of John"};
-
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	int num1, num2, offset, offset2, chapmax, chapoff, chapoff2, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-
-	if (argc > 3) {
-		fprintf(stderr, "usage: %s <file to process> [NT?]\n", argv[0]);
-		exit(1);
-	}
-
-	if (argc > 2)
-		curbook = 39;
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	read(bfp, &offset2, sizeof(offset2));
-	read(cfp, &chapoff2, sizeof(chapoff2));
-	while (read(bfp, &offset, sizeof(offset)) == sizeof(offset)) {
-		chapmax = (offset - offset2) / sizeof(offset);
-		printf("\n\{\"%s\", %d}, \n// %s\n", bnames[curbook], chapmax, bnames[curbook]);
-		curbook++;
-		for (curchap = 0; curchap < chapmax; curchap++) {
-			read(cfp, &chapoff, sizeof(chapoff));
-			printf("%d, ", (chapoff - chapoff2) / sizeof(chapoff));
-			chapoff2 = chapoff;
-		}
-		offset2 = offset;
-	}
-	pos     =       lseek(cfp, 0, SEEK_CUR);
-	offset  = (int) lseek(cfp, 0, SEEK_END);
-	chapmax = (offset - offset2) / sizeof(offset);
-	printf("\n\{\"%s\", %d}, \n// %s\n", bnames[curbook], chapmax, bnames[curbook]);
-	curbook++;
-	lseek(cfp, pos, SEEK_SET);
-	for (curchap = 0; curchap < chapmax - 1; curchap++) {
-		read(cfp, &chapoff, sizeof(chapoff));
-		printf("%d, ", (chapoff - chapoff2) / sizeof(chapoff));
-		chapoff2 = chapoff;
-	}
-	chapoff = (int) lseek(vfp, 0, SEEK_END);
-	printf("%d, ", (chapoff - chapoff2) / sizeof(chapoff));
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}

Deleted: trunk/src/modules/texts/rawtext/nuidx.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/nuidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/nuidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,238 +0,0 @@
-/*****************************************************************************
- *
- *	This code wreaks but works (at least for MHC).  Good luck!
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size);
-void openfiles(char *fname);
-void checkparams(int argc, char **argv);
-
-
-VerseKey key1, key2, key3;
-int fp, vfp, cfp, bfp;
-long chapoffset;
-short chapsize;
-char testmnt;
-
-
-main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1, num2, rangemax, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127], startflag = 0;
-	short size, tmp;
-
-	checkparams(argc, argv);
-
-	openfiles(argv[1]);
-
-	testmnt = key1.Testament();
-	num1 = key1.Chapter();
-	num2 = key1.Verse();
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		writeidx(key1, key2, key3, offset, size);
-		key2++;
-		key3 = key2;
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-/**************************************************************************
- * ENT:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	short tmp;
-
-	for (; ((key1 <= key3) && (key1.Error() != KEYERR_OUTOFBOUNDS) && (key1.Testament() == testmnt)); key1+=1) {
-		if (key1.Verse() == 1) {	// new chapter
-			if (key1.Chapter() == 1) {	// new book
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				write(vfp, &chapoffset, 4);  /* Book intro (vss)  set to same as chap for now(it should be chap 1 which usually contains the book into anyway)*/
-				write(vfp, &chapsize, 2);
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-		}
-		if (key1 >= key2) {
-			write(vfp, &offset, 4);
-			write(vfp, &size, 2);
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-		}
-	}
-}
-
-
-char startchap(char *buf)
-{
-	char loop;
-
-	if (buf[0] != '<')
-		return 0;
-	if (buf[1] != 'S')
-		return 0;
-	if (buf[2] != 'C')
-		return 0;
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char startentry(char *buf)
-{
-	char loop;
-
-	if (buf[0] != '<')
-		return 0;
-	if (buf[1] != 'S')
-		return 0;
-	if (buf[2] != 'V')
-		return 0;
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, short *size)
-{
-	char buf[7];
-	char buf2[20];
-	char ch;
-	char loop;
-	long offset2;
-	int ch2, vs2, rm2;
-	bool flag;
-	long chapstart = 0; 
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (startentry(buf)) {
-			if (size)
-				*offset = lseek(fp, 0, SEEK_CUR) - 3;
-			else	*offset = lseek(fp, 0, SEEK_CUR) - 7;
-			if (size) {
-				ch2 = *num1;
-				vs2 = *num2;
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					*size = (offset2 - (*offset));
-				}
-				lseek(fp, *offset, SEEK_SET);
-			}
-			return 0;
-		}
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-
-
-void openfiles(char *fname)
-{
-	char buf[255];
-
-	if ((fp = open(fname, O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process> [nt - for new testmt file]\n", argv[0]);
-		exit(1);
-	}
-	if (argc == 3)
-		key1 = key2 = key3 = "Matthew 1:1";
-	else	key1 = key2 = key3 = "Genesis 1:1";
-}

Deleted: trunk/src/modules/texts/rawtext/ojbtxidx.c
===================================================================
--- trunk/src/modules/texts/rawtext/ojbtxidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/ojbtxidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,166 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-
-char findbreak(int fd, long *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fd, vfd, cfd, bfd;
-	long pos, offset;
-	short size, tmp;
-	int num1, num2, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s <file to process>\n", argv[0]);
-		exit(1);
-	}
-#ifndef O_BINARY		// O_BINARY is for Borland to be happy.  If we're in GNU, just define it to a NULL mask
-#define O_BINARY 0
-#endif
-	if ((fd = open(argv[1], O_RDONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfd = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfd = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfd = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfd, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfd, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfd, &pos, 4);  /* Module intro */
-	write(vfd, &size, 2);
-	write(vfd, &pos, 4);  /* Testament intro */
-	write(vfd, &size, 2);
-
-	while (!findbreak(fd, &offset, &num1, &num2, &size)) {
-
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfd, 0, SEEK_CUR);
-				write(bfd, &pos, 4);
-				pos = lseek(vfd, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfd, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfd, &pos, 4);  /* Book intro (vss) */
-				write(vfd, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfd, 0, SEEK_CUR);
-			write(cfd, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfd, &pos, 4);  /* Chapter intro */
-			write(vfd, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7ld\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence (%2d:%3d:%3d)\n", curbook, num1-1, num2);
-			curchap = num1;
-//			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence (%2d:%3d:%3d)\n", curbook, num1, num2-1);
-//			break;
-			tmp = 0;
-			curverse = num2;
-			write(vfd, &offset, 4);
-			write(vfd, &tmp, 2);
-		}
-		write(vfd, &offset, 4);
-		write(vfd, &size, 2);
-	}
-	
-	close(vfd);
-	close(cfd);
-	close(bfd);
-	close(fd);
-	return 0;
-}
-
-
-char findbreak(int fd, long *offset, int *num1, int *num2, short *size)
-{
-	char buf[8];
-	char buf2[7];
-	char loop, len, star;
-
-	memset(buf, ' ', 7);
-	buf[7] = 0;
-
-	while (1) {
-
-		memmove(buf, &buf[1], 6);
-		if (read(fd, &buf[6], 1) != 1)
-			return 1;
-
-		if ((buf[0] == 10) && ((buf[2] == '*') || (buf[3] == '*') || (buf[4] == '*'))) { 
-			star = 0;
-			for (loop = 0; loop < 7; loop++) {
-				if (buf[loop] == '*')
-					star = 1;
-				if (isdigit(buf[loop])&&star)
-					break;
-				else buf[loop] = ' ';
-			}
-			if (loop < 7) {
-				sscanf(buf, "%d", num1);
-				continue;
-			}
-		}
-
-		if ((buf[0] == '|') && (isdigit(buf[1]))) {
-			sscanf(&buf[1], "%d", num2);
-			sprintf(buf, "%d", *num2);
-			(*offset)  = lseek(fd, 0, SEEK_CUR);
-			(*offset) -= (4-strlen(buf));
-
-			for (len = 1; len == 1; len = read(fd, &loop, 1)) {
-				if (loop == '|')
-					break;
-			}
-
-			*size = (short)(lseek(fd, 0, SEEK_CUR) - *offset) - 1;
-			lseek(fd, -1, SEEK_CUR);
-			break;
-		}
-	}
-	return 0;
-}
-

Modified: trunk/src/modules/texts/rawtext/rawtext.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/rawtext.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/rawtext.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -8,13 +8,7 @@
 #include <fcntl.h>
 #include <sysdata.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
+#include <utilstr.h>
 #include <rawverse.h>
 #include <rawtext.h>
 
@@ -208,8 +202,8 @@
 
 	
 	// --------- Let's output an index from our dictionary -----------
-	int datfd;
-	int idxfd;
+	FileDesc *datfd;
+	FileDesc *idxfd;
 	strlist::iterator it;
 	longlist::iterator it2;
 	unsigned long offset, entryoff;
@@ -223,10 +217,12 @@
 
 	// for old and new testament do...
 	for (int loop = 0; loop < 2; loop++) {
-		if ((datfd = open((fname + ((loop)?"ntwords.dat":"otwords.dat")).c_str(), O_CREAT|O_WRONLY|O_BINARY, 00644 )) == -1)
+		datfd = FileMgr::getSystemFileMgr()->open((fname + ((loop)?"ntwords.dat":"otwords.dat")).c_str(), FileMgr::CREAT|FileMgr::WRONLY, 00644);
+		if (datfd->getFd() == -1)
 			return -1;
-		if ((idxfd = open((fname + ((loop)?"ntwords.idx":"otwords.idx")).c_str(), O_CREAT|O_WRONLY|O_BINARY, 00644 )) == -1) {
-			close(datfd);
+		idxfd = FileMgr::getSystemFileMgr()->open((fname + ((loop)?"ntwords.idx":"otwords.idx")).c_str(), FileMgr::CREAT|FileMgr::WRONLY, 00644);
+		if (idxfd->getFd() == -1) {
+			FileMgr::getSystemFileMgr()->close(datfd);
 			return -1;
 		}
 
@@ -236,12 +232,12 @@
 
 			// get our current offset in our word.dat file and write this as the start
 			// of the next entry in our database
-			offset = lseek(datfd, 0, SEEK_CUR);
-			write(idxfd, &offset, 4);
+			offset = lseek(datfd->getFd(), 0, SEEK_CUR);
+			write(idxfd->getFd(), &offset, 4);
 
 			// write our word out to the word.dat file, delineating with a \n
-			write(datfd, it->first.c_str(), strlen(it->first.c_str()));
-			write(datfd, "\n", 1);
+			write(datfd->getFd(), it->first.c_str(), strlen(it->first.c_str()));
+			write(datfd->getFd(), "\n", 1);
 
 			// force our mod position list for this word to be unique (remove
 			// duplicates that may exist if the word was found more than once
@@ -253,20 +249,20 @@
 			unsigned short count = 0;
 			for (it2 = it->second.begin(); it2 != it->second.end(); it2++) {
 				entryoff= *it2;
-				write(datfd, &entryoff, 4);
+				write(datfd->getFd(), &entryoff, 4);
 				count++;
 			}
 			
 			// now see what our new position is in our word.dat file and
 			// determine the size of this database entry
-			size = lseek(datfd, 0, SEEK_CUR) - offset;
+			size = lseek(datfd->getFd(), 0, SEEK_CUR) - offset;
 
 			// store the size of this database entry
-			write(idxfd, &size, 2);
+			write(idxfd->getFd(), &size, 2);
 			printf("%d entries (size: %d)\n", count, size);
 		}
-		close(datfd);
-		close(idxfd);
+		FileMgr::getSystemFileMgr()->close(datfd);
+		FileMgr::getSystemFileMgr()->close(idxfd);
 	}
 	return 0;
 #else

Deleted: trunk/src/modules/texts/rawtext/rawtxidx.c
===================================================================
--- trunk/src/modules/texts/rawtext/rawtxidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/rawtxidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,146 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	short size, tmp;
-	int num1, num2, offset, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s <file to process>\n", argv[0]);
-		exit(1);
-	}
-
-	if ((fp = open(argv[1], O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while (!findbreak(fp, &offset, &num1, &num2, &size)) {
-
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfp, &pos, 4);  /* Book intro (vss) */
-				write(vfp, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);  /* Chapter intro */
-			write(vfp, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7d\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence\n", buf);
-			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence\n", buf);
-			break;
-		}
-		write(vfp, &offset, 4);
-		write(vfp, &size, 2);
-	}
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size)
-{
-	char buf[7];
-	char buf2[7];
-	char loop;
-	int offset2, ch2, vs2;
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (buf[3] == ':') {
-			memcpy(buf2, buf, 7);
-			for (loop = 0; loop < 7; loop++) {
-				if (!isdigit(buf2[loop]))
-					buf2[loop] = ' ';
-			}
-			buf2[3] = 0;
-			*num1 = atoi(buf2);
-			*num2 = atoi(&buf2[4]);
-			if (*num1 && *num2) {
-				*offset = lseek(fp, 0, SEEK_CUR);
-				sprintf(buf2, "%d", *num2);
-				*offset -= 2 - strlen(buf2);
-				if (size) {
-					if (findbreak(fp, &offset2, &ch2, &vs2, 0)) {
-						*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-					}
-					else {
-						sprintf(buf2, "%d:%d", ch2, vs2);
-						*size = (offset2 - (*offset)) - (strlen(buf2) + 2);
-					}
-					lseek(fp, *offset, SEEK_SET);
-				}
-				return 0;
-			}
-		}
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-

Deleted: trunk/src/modules/texts/rawtext/rtfidx.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/rtfidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/rtfidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,164 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <versekey.h>
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	short size, tmp;
-	int num1, num2, offset, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-	VerseKey mykey;
-
-	if ((argc < 2) || (argc > 3)) {
-		fprintf(stderr, "usage: %s <file to process> [nt]\n", argv[0]);
-		exit(1);
-	}
-
-	if ((fp = open(argv[1], O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	mykey = (argc == 3) ? "Matthew 1:1" : "Genesis 1:1";
-
-	while (!findbreak(fp, &offset, &num1, &num2, &size)) {
-		num1 = mykey.Chapter();
-		num2 = mykey.Verse();
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfp, &pos, 4);  /* Book intro (vss) */
-				write(vfp, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);  /* Chapter intro */
-			write(vfp, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7d\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence\n");
-			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence\n");
-			break;
-		}
-		write(vfp, &offset, 4);
-		write(vfp, &size, 2);
-		mykey++;
-	}
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size)
-{
-	char buf[17];
-	char buf2[7];
-	char loop;
-	char offadj, inquotes, sizeadj;
-	int offset2, ch2, vs2;
-	
-	memset(buf, ' ', 17);
-
-	while (1) {
-		offadj = -10;
-		inquotes = 0;
-		sizeadj = 0;
-  		if (!memcmp(&buf[1], "\\f0\\fs16\\cf2\\up6", 15)) {
-			offadj = 0;
-			inquotes = 1;
-			sizeadj = (*buf == 10) ? -19:-17;
-		}
-  		if (!memcmp(buf, "\\fi200\\widctlpar", 16)) {
-			offadj = -1;
-//			inquotes = 1;
-			sizeadj = -18;
-		}
-		if (offadj > -10) {
-			*offset = lseek(fp, 0, SEEK_CUR) + offadj;
-			if (size) {
-				(*offset)++;
-				while (inquotes) {
-					while (read(fp, buf2, 1) == 1) {
-						if (*buf2 == '}')
-							break;
-						(*offset)++;
-					}
-					inquotes--;
-				}
-				if (findbreak(fp, &offset2, &ch2, &vs2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					sprintf(buf2, "%d:%d", ch2, vs2);
-					*size = (offset2 - (*offset));
-				}
-				lseek(fp, *offset+17, SEEK_SET);
-			}
-			else (*offset) += sizeadj;
-			return 0;
-		}
-		memmove(buf, &buf[1], 16);
-		if (read(fp, &buf[16], 1) != 1)
-			return 1;
-	}
-}
-

Deleted: trunk/src/modules/texts/rawtext/svetxidx.c
===================================================================
--- trunk/src/modules/texts/rawtext/svetxidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/svetxidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,153 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-
-char findbreak(int fd, long *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fd, vfd, cfd, bfd;
-	long pos, offset;
-	short size, tmp;
-	int num1, num2, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s <file to process>\n", argv[0]);
-		exit(1);
-	}
-#ifndef O_BINARY		// O_BINARY is for Borland to be happy.  If we're in GNU, just define it to a NULL mask
-#define O_BINARY 0
-#endif
-	if ((fd = open(argv[1], O_RDONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfd = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfd = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfd = open(buf, O_CREAT|O_WRONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfd, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfd, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfd, &pos, 4);  /* Module intro */
-	write(vfd, &size, 2);
-	write(vfd, &pos, 4);  /* Testament intro */
-	write(vfd, &size, 2);
-
-	while (!findbreak(fd, &offset, &num1, &num2, &size)) {
-
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfd, 0, SEEK_CUR);
-				write(bfd, &pos, 4);
-				pos = lseek(vfd, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfd, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfd, &pos, 4);  /* Book intro (vss) */
-				write(vfd, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfd, 0, SEEK_CUR);
-			write(cfd, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfd, &pos, 4);  /* Chapter intro */
-			write(vfd, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7ld\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence (%2d:%3d:%3d)\n", curbook, num1-1, num2);
-			curchap = num1;
-//			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence (%2d:%3d:%3d)\n", curbook, num1, num2-1);
-//			break;
-			tmp = 0;
-			curverse = num2;
-			write(vfd, &offset, 4);
-			write(vfd, &tmp, 2);
-		}
-		write(vfd, &offset, 4);
-		write(vfd, &size, 2);
-	}
-	
-	close(vfd);
-	close(cfd);
-	close(bfd);
-	close(fd);
-}
-
-
-char findbreak(int fd, long *offset, int *num1, int *num2, short *size)
-{
-	char buf[8];
-	char buf2[7];
-	char loop, len;
-
-	memset(buf, ' ', 7);
-	buf[7] = 0;
-
-	while (1) {
-
-		memmove(buf, &buf[1], 6);
-		if (read(fd, &buf[6], 1) != 1)
-			return 1;
-
-		if ((buf[0] == 10) && (isdigit(buf[1]))) {
-			sscanf(buf, "%d %s", num2, buf2);
-			if (!strncmp(buf2, "KAP", 3)) {
-				*num1 = *num2;
-				continue;
-			}
-			sprintf(buf, "%d", *num2);
-			(*offset)  = lseek(fd, 0, SEEK_CUR);
-			(*offset) -= (5-strlen(buf));
-			for (len = 1; len == 1; len = read(fd, &loop, 1)) {
-				if ((loop == 10) || (loop == 13))
-					break;
-			}
-
-			*size = (short)(lseek(fd, 0, SEEK_CUR) - *offset) - 1;
-			lseek(fd, -1, SEEK_CUR);
-			break;
-		}
-	}
-	return 0;
-}
-

Deleted: trunk/src/modules/texts/rawtext/vntidx.cpp
===================================================================
--- trunk/src/modules/texts/rawtext/vntidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/rawtext/vntidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,185 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-#include <versekey.h>
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	short size, tmp;
-	int num1, num2, offset, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-	VerseKey mykey;
-
-	if ((argc < 2) || (argc > 3)) {
-		fprintf(stderr, "usage: %s <file to process> [nt]\n", argv[0]);
-		exit(1);
-	}
-
-	if ((fp = open(argv[1], O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	mykey = (argc == 3) ? "Matthew 1:1" : "Genesis 1:1";
-
-	while (!findbreak(fp, &offset, &num1, &num2, &size)) {
-		num1 = mykey.Chapter();
-		num2 = mykey.Verse();
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfp, &pos, 4);  /* Book intro (vss) */
-				write(vfp, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);  /* Chapter intro */
-			write(vfp, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7d\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence\n");
-			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence\n");
-			break;
-		}
-		write(vfp, &offset, 4);
-		write(vfp, &size, 2);
-		mykey++;
-	}
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size)
-{
-	char buf[17];
-	char buf2[7];
-	char buf3[7];
-	char loop;
-	char offadj, inquotes, sizeadj;
-	int offset2, ch2, vs2;
-	
-	strcpy (buf3, "\\par  ");
-	buf3[5] = 10;
-	memset(buf, ' ', 17);
-
-	while (1) {
-		offadj = -100;
-		inquotes = 0;
-		sizeadj = 0;
-  		if (!memcmp(buf, "\\par FIN DEL NUEVO TESTAMENTO", 16)) {
-			offadj = -11;
-//			inquotes = 1;
-			sizeadj = -7;
-		}
-		
-  		if ((!memcmp(buf, buf3, 6)) && (!size)) {
-			offadj = -11;
-//			inquotes = 1;
-			sizeadj = -7;
-		}
-  		if (!memcmp(buf, "\\par  ", 6)) {
-			if (isdigit(buf[6])) {
-				for (loop = 7; loop < 10; loop++) {
-					if (!isdigit(buf[loop]))
-						break;
-				}
-				offadj = -(11 - (loop - 6));
-	//			inquotes = 1;
-				sizeadj = -7;
-			}
-		}
-/*
-  		if (!memcmp(buf, "\\fi200\\widctlpar", 16)) {
-			offadj = -1;
-//			inquotes = 1;
-			sizeadj = -18;
-		}
-*/
-		if (offadj > -100) {
-			*offset = lseek(fp, 0, SEEK_CUR) + offadj;
-			if (size) {
-				(*offset)++;
-				while (inquotes) {
-					while (read(fp, buf2, 1) == 1) {
-						if (*buf2 == '}')
-							break;
-						(*offset)++;
-					}
-					inquotes--;
-				}
-				if (findbreak(fp, &offset2, &ch2, &vs2, 0)) {
-					*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-				}
-				else {
-					*size = (offset2 - (*offset));
-				}
-				lseek(fp, *offset-sizeadj, SEEK_SET);
-			}
-			else (*offset) += sizeadj;
-			return 0;
-		}
-		memmove(buf, &buf[1], 16);
-		if (read(fp, &buf[16], 1) != 1)
-			return 1;
-	}
-}
-

Deleted: trunk/src/modules/texts/ztext/gbfidx.cpp
===================================================================
--- trunk/src/modules/texts/ztext/gbfidx.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/ztext/gbfidx.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,661 +0,0 @@
-/*****************************************************************************
- *
- *	This code reeks but works (sometimes).  Good luck!
- * Modified for zText purposes
- */
-
-//#include <stdio.h>
-#include <iostream>
-#include <fstream>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-//#ifndef __GNUC__
-#include <io.h>
-//#else
-//#include <unistd.h>
-//#endif
-
-#include <fcntl.h>
-#include <versekey.h>
-
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size);
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, unsigned short *size);
-void openfiles(char *fname);
-void checkparams(int argc, char **argv);
-
-
-VerseKey key1, key2, key3;
-int fp=0, vfp=0, cfp=0, bfp=0;
-long chapoffset=0;
-unsigned short chapsize=0;
-long bookoffset=0;
-unsigned short booksize=0;
-long testoffset=0;
-unsigned short testsize=0;
-long verseoffset=0;
-unsigned short versesize=0;
-long nextoffset=0;
-char testmnt=0;
-int deadcount = 0;
-int chapmark=-4, bookmark=-1;
-ofstream cfile;
-
-
-int main(int argc, char **argv)
-{
-	long pos, offset;
-	int num1, num2, rangemax;//, curbook = 0, curchap = 0, curverse = 0;
-	//char buf[127],
-	char startflag = 0;
-	unsigned short size;//, tmp;
-
-	checkparams(argc, argv);
-
-	openfiles(argv[1]);
-	//key1 = "Matthew 1:1";
-	//key2 = "Matthew 1:1";
-	//key3 = "Matthew 1:1";
-
-	testmnt = key1.Testament();
-	cfile << "testament" << (int) testmnt << "\n";
-	num1 = key1.Chapter();
-	num2 = key1.Verse();
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	/*pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  // Module intro
-	write(vfp, &size, 2);
-	cfile << "modintro pos{" << pos << "} size{" << size << "}\n";
-	write(vfp, &pos, 4);  // Testament intro
-	write(vfp, &size, 2);
-	cfile << "test intro pos{" << pos << "} size{" << size << "}\n";
-	*/
-	cout << "GBFIDX Running\n";
-	cout.flush();
-	while(!findbreak(fp, &offset, &num1, &num2, &rangemax, &size)) {
-		if (!startflag) {
-			startflag = 1;
-		}
-		else {
-			if (num2 < key2.Verse()) {            // new chapter
-				if (num1 <= key2.Chapter()) { // new book
-					key2.Verse(1);
-					key2.Chapter(1);
-					key2.Book(key2.Book()+1);
-				}
-				cfile << "Found Chapter Break: " << num1 << " ('" << (const char *)key2 << "')\n";
-				//chapoffset = offset;
-				//chapsize = chapsize - size;
-//				continue;
-			}
-		}
-		key2.Verse(1);
-		key2.Chapter(num1);
-		key2.Verse(num2);
-
-		key3 = key2;
-//		key3 += (rangemax - key3.Verse());
-
-		writeidx(key1, key2, key3, offset, size);
-	}
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-
-	return 1;
-}
-
-
-/**************************************************************************
- * writeidx:	key1	- current location of index
- * 	key2	- minimum keyval for which this offset is valid
- * 	key3	- maximum keyval for which this offset is valid
- */
-
-void writeidx(VerseKey &key1, VerseKey &key2, VerseKey &key3, long offset, short size)
-{
-	long pos;
-	unsigned short tmp;
-
-	for (; ((key1 <= key3) && (key1.Error() != KEYERR_OUTOFBOUNDS) && (key1.Testament() == testmnt)); key1+=1) {
-		if (chapmark>=2)
-		{
-			if (bookmark==2)
-			{
-				//booksize = booksize - chapsize + 7;
-				cfile << "versesize " << versesize << " booksize " << booksize << " chapsize " << chapsize << " size " << size << "\n";
-				//cfile.flush();
-				//assert(chapsize < size);
-				//if (chapsize > size)           // At start of Psalms gets chapsize rather than chapsize+size ???
-				//{
-				//	versesize = versesize - (booksize - (chapsize - size) + 7);
-				//}
-				//else
-				//{
-				versesize = versesize - (booksize - (chapsize) + 7);
-				//}
-					cfile << "Last verse in book\n";
-			}
-			//chapsize = chapsize - size;
-			cfile << "versesize " << versesize << " chapsize " << chapsize << " size " << size<< "\n";
-			cfile.flush();
-			//assert(chapsize > size);
-			//if (chapsize > size)           // At start of Psalms gets chapsize rather than chapsize+size ???
-			//{
-			//	versesize = versesize - (chapsize - size);
-			//}
-			//else
-			//{
-			versesize = versesize - (chapsize);
-			//}
-			cfile << "Last verse in chapter\n";
-		}
-		if (chapmark>=2 && bookmark!=1)
-		{
-			cfile << "prev verse pos{" << verseoffset << "} size{" << versesize << "} nextoffset{" << nextoffset << "}\n";
-			cfile.flush();
-			assert(verseoffset==nextoffset);
-			write(vfp, &verseoffset, 4);
-			write(vfp, &versesize, 2);
-			nextoffset = verseoffset+versesize;
-			bookmark = 0;
-			chapmark = 0;
-		}
-		if (key1.Verse() == 1) {	// new chapter
-			cfile << "size??? " << size << "\n";
-			cfile.flush();
-			//assert(chapsize > size || key1.Chapter()==1);
-			//assert(chapsize > size);
-			//if (chapsize > size)           // At start of books gets chapsize rather than chapsize+size
-			//{
-			//	chapsize = chapsize - size;
-			//}
-			if (key1.Chapter() == 1) {	// new book
-				booksize = booksize - chapsize + 7;
-				if (key1.Book() == 1)
-				{
-					pos = 0;
-					//tmp = testoffset;
-					tmp = 0;            	// better just remember that it goes up to the testament intro to avoid 64k limit
-												// AV exceeds that anyway!
-					write(vfp, &pos, 4);  /* Module intro */
-					write(vfp, &tmp, 2);
-					assert(nextoffset==0);
-					cfile << "modintro pos{" << pos << "} size{" << tmp << "}\n";
-					testsize = testsize - booksize - chapsize + 7;
-					if (testsize > 10000)
-					{
-						cerr << "Error: testament too big " << testsize << "\n";
-						exit(-1);
-					}
-					//assert(testoffset==nextoffset);
-					write(vfp, &testoffset, 4);  /* Testament intro (vss)  */
-					write(vfp, &testsize, 2);
-					nextoffset = testoffset+testsize;
-					cfile << "test intro pos{" << testoffset << "} size{" << testsize << "}\n";
-				}
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				if (booksize > 10000)
-				{
-					cerr << "Error: book too big " << booksize << "\n";
-					exit(-1);
-				}
-				assert(bookoffset==nextoffset);
-				write(vfp, &bookoffset, 4);  /* Book intro (vss)  */
-				write(vfp, &booksize, 2);
-				nextoffset = bookoffset+booksize;
-				cfile << "book intro pos{" << bookoffset << "} size{" << booksize << "}\n";
-				//offset += booksize;
-				//bookmark = false;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			assert(chapsize < 10000);
-			write(vfp, &chapoffset, 4);  /* Chapter intro */
-			write(vfp, &chapsize, 2);
-			nextoffset = chapoffset+chapsize;
-			cfile << "chapter intro pos{" << chapoffset << "} size{" << chapsize << "}\n";
-			//offset += chapsize;
-			//size -= chapsize;
-			//chapmark = false;
-		}
-		if (key1 >= key2) {
-			if (size > 10000)
-			{
-				cerr << "Error: verse too big " << size << "\n";
-				exit(-1);
-			}
-			if (!chapmark && !bookmark)
-			{
-				write(vfp, &offset, 4);
-				write(vfp, &size, 2);
-				cfile << "verse pos{" << offset << "} size{" << size << "}\n";
-				cfile.flush();
-				assert(offset==nextoffset);
-				nextoffset = offset+size;
-				//cfile << "bookmark " << bookmark << " chapmark " << chapmark << "\n";
-			}
-			else
-			{
-				verseoffset = offset;
-				versesize = size;
-				cfile << "saving verse pos{" << offset << "} size{" << size << "}\n";
-				cfile << "bookmark " << bookmark << " chapmark " << chapmark << "\n";
-			}
-		}
-		else	{
-			pos = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);
-			write(vfp, &tmp, 2);
-			cfile << "blank pos{" << pos << "} size{" << tmp << "}\n";
-		}
-	}
-}
-
-char startmod(char *buf)
-{
-	//char loop;
-
-	if (buf[0] != '<')
-		return 0;
-	if (buf[1] != 'H')
-		return 0;
-	if (buf[2] != '0')
-		return 0;
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char starttest(char *buf)
-{
-	//char loop;
-
-	if (buf[0] != '<')
-		return 0;
-	if (buf[1] != 'B')
-		return 0;
-	if (testmnt==2)
-	{
-		if (buf[2] != 'N')
-			return 0;
-	}
-	else
-	{
-		if (buf[2] != 'O')
-			return 0;
-	}
-	//if (buf[3] != '>')
-	//	return 0;
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char startbook(char *buf)
-{
-	//char loop;
-
-	if (buf[0] != '<')
-		return 0;
-	if (buf[1] != 'S')
-		return 0;
-	if (buf[2] != 'B')
-		return 0;
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char startchap(char *buf)
-{
-	//char loop;
-
-	if (buf[0] != '<')
-		return 0;
-	if (buf[1] != 'S')
-		return 0;
-	if (buf[2] != 'C')
-		return 0;
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char startentry(char *buf)
-{
-	//char loop;
-	//cfile << "{SV}";
-
-	if (buf[0] != '<')
-	{
-		//cfile << "{no<}";
-		return 0;
-	}
-	if (buf[1] != 'S')
-	{
-		//cfile << "\n{noS}\n";
-		return 0;
-	}
-	if (buf[2] != 'V')
-	{
-		//cfile << "\n{noV}\n";
-		return 0;
-	}
-/*
-	if (!isdigit(buf[2]))
-		return 0;
-	for (loop = 3; loop < 7; loop++) {
-		if (buf[loop] == ' ')
-			break;
-		if ((!isdigit(buf[loop])) && (buf[loop] != ',') && (buf[loop] != '-'))
-			return 0;
-	}
-*/
-	return 1;
-}
-
-
-char findbreak(int fp, long *offset, int *num1, int *num2, int *rangemax, unsigned short *size)
-{
-	char buf[8];
-	//char buf2[20];
-	//char ch;
-	char loop=0;
-	long offset2;
-	int ch2, vs2, rm2;
-	bool flag;
-	long versestart = 0;
-	long chapstart = 0;
-	long bookstart = 0;
-	long teststart = 0;
-
-	memset(buf, ' ', 8);
-
-	while (1) {
-		//cfile << "#" << buf << "#";
-		//if (lseek(fp, 0, SEEK_CUR) > 2000000)
-		//{
-		//	cfile << lseek(fp, 0, SEEK_CUR) << "\n";
-		//}
-		if (starttest(buf)) {
-			cfile << "\n{start of testament}\n";
-			//chapstart = lseek(fp, 0, SEEK_CUR) - 7;
-			teststart = lseek(fp, 0, SEEK_CUR) - 7;
-			testoffset = teststart;
-			memset(buf, ' ', 3);
-			flag = false;
-			for (loop = 3; loop < 6; loop++) {
-				if (buf[loop]!='>')
-					flag = true;
-				else {
-					buf[loop] = 0;
-					break;
-				}
-			}
-			ch2 = *num1;
-			vs2 = 1;
-			if (size) {
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					testsize = (unsigned short) (lseek(fp, 0, SEEK_END) - teststart-7);
-				}
-				else {
-					if (vs2) {
-						testsize = (offset2 - teststart - 7);
-					}
-				}
-				lseek(fp, teststart+7, SEEK_SET);
-				cfile << "\nGot testsize " << testsize << "\n";
-			}
-		}
-
-
-		if (startbook(buf)) {
-			cfile << "\n{start of book}\n";
-			bookmark++;
-			//chapstart = lseek(fp, 0, SEEK_CUR) - 7;
-			bookstart = lseek(fp, 0, SEEK_CUR) - 7;
-			bookoffset = bookstart;
-			memset(buf, ' ', 3);
-			flag = false;
-			for (loop = 3; loop < 6; loop++) {
-				if (buf[loop]!='>')
-					flag = true;
-				else {
-					buf[loop] = 0;
-					break;
-				}
-			}
-			if (size) {
-				ch2 = *num1;
-				vs2 = 1;
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					booksize = (unsigned short) (lseek(fp, 0, SEEK_END) - bookstart - 7);
-				}
-				else {
-					if (vs2) {
-						booksize = (offset2 - bookstart - 7);
-					}
-				}
-				lseek(fp, bookstart+7, SEEK_SET);
-				cfile << "\nGot booksize " << booksize << "\n";
-			}
-		}
-
-		if (startchap(buf)) {
-			cfile << "{start of chapter}";
-			chapmark++;
-			//chapstart = lseek(fp, 0, SEEK_CUR) - 7;
-			chapstart = lseek(fp, 0, SEEK_CUR) - 7;
-			chapoffset = chapstart;
-			memset(buf, ' ', 3);
-			flag = false;
-			for (loop = 3; loop < 6; loop++) {
-				if (isdigit(buf[loop]))
-					flag = true;
-				else {
-					buf[loop] = 0;
-					break;
-				}
-			}
-			if (flag)
-				*num1 = atoi(buf);
-			else	(*num1)++;
-
-			if (size) {
-				ch2 = *num1;
-				vs2 = 1;
-				lseek(fp, chapstart, SEEK_SET);
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					chapsize = (unsigned short) (lseek(fp, 0, SEEK_END) - chapstart);
-					cfile << "getting chapsizeend{" << chapsize << "} = " << lseek(fp, 0, SEEK_END) << " - " << chapstart << "\n";
-				}
-				else {
-					if (vs2) {
-						chapsize = (offset2 - chapstart);
-						cfile << "getting chapsize{" << chapsize << "} = " << offset2 << " - " << chapstart << "\n";
-					}
-				}
-				lseek(fp, chapstart + 7, SEEK_SET);
-				cfile << "\nGot chapsize " << chapsize << " loop{" << (int) loop << "}\n";
-			}
-			//return 0;
-
-		}
-		if (startentry(buf)) {
-			//cfile << "{start of verse}";
-			memset(buf, ' ', 3);
-			flag = false;
-			for (loop = 3; loop < 6; loop++) {
-				if (isdigit(buf[loop]))
-					flag = true;
-				else {
-					buf[loop] = 0;
-					break;
-				}
-			if (flag)
-				*num2 = atoi(buf);
-			else	(*num2)++;
-			}
-			loop++;
-			/*
-			if (size)
-			{
-				// *offset = lseek(fp, 0, SEEK_CUR) - (7 - loop);
-				 *offset = lseek(fp, 0, SEEK_CUR) - 7;
-			}
-			//else	*offset = (chapstart) ? chapstart : lseek(fp, 0, SEEK_CUR) - 7;
-			else	*offset = (chapstart) ? chapstart : lseek(fp, 0, SEEK_CUR) - 7;
-			*/
-			/*if (chapstart)
-			{
-				chapsize = *offset-chapstart;
-			}
-			else
-			{
-				chapsize = 0;
-			}*/
-			*offset = lseek(fp, 0, SEEK_CUR) - 7;
-			versestart = *offset;
-			if (size) {
-				ch2 = *num1;
-				vs2 = *num2;
-				if (findbreak(fp, &offset2, &ch2, &vs2, &rm2, 0)) {
-					*size = (unsigned short) (lseek(fp, 0, SEEK_END) - versestart);
-					cfile << "getting sizeend{" << *size << "} = " << lseek(fp, 0, SEEK_END) << " - " << versestart << "\n";
-				}
-				else {
-					if (vs2) {
-						*size = (offset2 - versestart);
-						cfile << "getting size{" << *size << "} = " << offset2 << " - " << versestart << "\n";
-					}
-				}
-				lseek(fp, *offset+1, SEEK_SET);
-			}
-			else
-			{
-				cfile << "got offset{" << *offset << "}\n";
-			}
-			return 0;
-		}
-		//cfile << "{ng}";
-		//deadcount++;
-		//if (deadcount==1000) exit(-1);
-		//if (!size)
-		//{
-		//	cfile << "not bound offset{" << *offset << "}\n";
-		//}
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-
-
-void openfiles(char *fname)
-{
-#ifndef O_BINARY		// O_BINARY is needed in Borland C++ 4.53
-#define O_BINARY 0		// If it hasn't been defined than we probably
-#endif				// don't need it.
-	char buf[255];
-
-	if ((fp = open(fname, O_RDONLY|O_BINARY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", fname);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", fname);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", fname);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", fname);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY|O_BINARY|O_TRUNC)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-	cfile.open("gbfidx.log", ios::out);
-	if (!cfile.is_open())
-	{
-		cerr << "Failed to open log file\n";
-		exit(-1);
-	}
-}
-
-
-void checkparams(int argc, char **argv)
-{
-	if (argc < 2) {
-		fprintf(stderr, "usage: %s <file to process> [nt - for new testmt file]\n", argv[0]);
-		exit(1);
-	}
-	if (!strcmp(argv[1], "nt"))
-		key1 = key2 = key3 = "Matthew 1:1";
-	else if (!strcmp(argv[1], "ot"))
-	{
-			key1 = key2 = key3 = "Genesis 1:1";
-	}
-	else
-	{
-		cerr << "File must be ot or nt\n";
-		exit(-1);
-	}
-}

Deleted: trunk/src/modules/texts/ztext/makeidx.c
===================================================================
--- trunk/src/modules/texts/ztext/makeidx.c	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/ztext/makeidx.c	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,146 +0,0 @@
-#include <stdio.h>
-#include <fcntl.h>
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size);
-
-
-main(int argc, char **argv)
-{
-	int fp, vfp, cfp, bfp;
-	long pos;
-	short size, tmp;
-	int num1, num2, offset, curbook = 0, curchap = 0, curverse = 0;
-	char buf[127];
-
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s <file to process>\n", argv[0]);
-		exit(1);
-	}
-
-	if ((fp = open(argv[1], O_RDONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.vss", argv[1]);
-	if ((vfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.cps", argv[1]);
-	if ((cfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	sprintf(buf, "%s.bks", argv[1]);
-	if ((bfp = open(buf, O_CREAT|O_WRONLY)) == -1) {
-		fprintf(stderr, "Couldn't open file: %s\n", buf);
-		exit(1);
-	}
-
-	pos  = 0;
-	write(bfp, &pos, 4);  /* Book    offset for testament intros */
-	pos = 4;
-	write(cfp, &pos, 4);  /* Chapter offset for testament intro */
-
-
-/*	Right now just zero out intros until parsing correctly */
-	pos = 0;
-	size = 0;
-	write(vfp, &pos, 4);  /* Module intro */
-	write(vfp, &size, 2);
-	write(vfp, &pos, 4);  /* Testament intro */
-	write(vfp, &size, 2);
-
-	while (!findbreak(fp, &offset, &num1, &num2, &size)) {
-
-		if (num2 == 1) {  		/* if we're at a new chapter */
-			if (num1 == 1) {	/* if we're at a new book */
-				pos = lseek(cfp, 0, SEEK_CUR);
-				write(bfp, &pos, 4);
-				pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
-				write(cfp, &pos, 4);
-				pos  = 0;
-				tmp = 0;
-				write(vfp, &pos, 4);  /* Book intro (vss) */
-				write(vfp, &tmp, 2);
-				curbook++;
-				curchap = 0;
-			}
-			pos = lseek(vfp, 0, SEEK_CUR);
-			write(cfp, &pos, 4);
-			curverse = 1;
-			pos  = 0;
-			tmp = 0;
-			write(vfp, &pos, 4);  /* Chapter intro */
-			write(vfp, &tmp, 2);
-			curchap++;
-		}
-		else curverse++;
-	
-		printf("%2d:%3d:%3d found at offset: %7d\n", curbook, num1, num2, offset);
-
-		if (num1 != curchap) {
-			fprintf(stderr, "Error: Found chaptures out of sequence\n", buf);
-			break;
-		}
-		if (num2 != curverse) {
-			fprintf(stderr, "Error: Found verses out of sequence\n", buf);
-			break;
-		}
-		write(vfp, &offset, 4);
-		write(vfp, &size, 2);
-	}
-	
-	close(vfp);
-	close(cfp);
-	close(bfp);
-	close(fp);
-}
-
-
-char findbreak(int fp, int *offset, int *num1, int *num2, short *size)
-{
-	char buf[7];
-	char buf2[7];
-	char loop;
-	int offset2, ch2, vs2;
-	
-	memset(buf, ' ', 7);
-
-	while (1) {
-		if (buf[3] == ':') {
-			memcpy(buf2, buf, 7);
-			for (loop = 0; loop < 7; loop++) {
-				if (!isdigit(buf2[loop]))
-					buf2[loop] = ' ';
-			}
-			buf2[3] = 0;
-			*num1 = atoi(buf2);
-			*num2 = atoi(&buf2[4]);
-			if (*num1 && *num2) {
-				*offset = lseek(fp, 0, SEEK_CUR);
-				sprintf(buf2, "%d", *num2);
-				*offset -= 2 - strlen(buf2);
-				if (size) {
-					if (findbreak(fp, &offset2, &ch2, &vs2, 0)) {
-						*size = (short) (lseek(fp, 0, SEEK_END) - (*offset));
-					}
-					else {
-						sprintf(buf2, "%d:%d", ch2, vs2);
-						*size = (offset2 - (*offset)) - (strlen(buf2) + 2);
-					}
-					lseek(fp, *offset, SEEK_SET);
-				}
-				return 0;
-			}
-		}
-		memmove(buf, &buf[1], 6);
-		if (read(fp, &buf[6], 1) != 1)
-			return 1;
-	}
-}
-

Deleted: trunk/src/modules/texts/ztext/nasb.cpp
===================================================================
--- trunk/src/modules/texts/ztext/nasb.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/ztext/nasb.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,107 +0,0 @@
-
-
-#include <ctype.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <swcomprs.h>
-
-class FileCompress: public SWCompress {
-	int ifd;
-	int ofd;
-	int ufd;
-	int zfd;
-public:
-	FileCompress(char *);
-	~FileCompress();
-	int GetChars(char *, int len);
-	int SendChars(char *, int len);
-	void Encode();
-	void Decode();
-};
-
-
-FileCompress::FileCompress(char *fname) 
-{
-	char buf[256];
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-	ufd  = open(fname, O_RDWR|O_CREAT|O_BINARY);
-
-	sprintf(buf, "%s.zzz", fname);
-	zfd = open(buf, O_RDWR|O_CREAT|O_BINARY);
-}
-
-	
-FileCompress::~FileCompress(char *fname) 
-{
-	close(ufd);
-	close(zfd);
-}
-
-
-int FileCompress::GetChars(char *buf, int len) 
-{
-	return read(ifd, buf, len);
-}
-
-
-int FileCompress::SendChars(char *buf, int len) 
-{
-	return write(ofd, buf, len);
-}
-
-
-void FileCompress::Encode() 
-{
-	ifd = ufd;
-	ofd = zfd;
-
-	SWCompress::Encode();
-}
-
-
-void FileCompress::Decode() 
-{
-	ifd = zfd;
-	ofd = ufd;
-
-	SWCompress::Decode();
-}
-
-
-main(int argc, char **argv)
-{
-	int decomp = 0;
-	SWCompress *fobj;
-	
-	if (argc != 2) {
-		fprintf(stderr, "usage: %s <filename|filename.zzz>\n", argv[0]);
-		exit(1);
-	}
-
-	if (strlen(argv[1]) > 4) {
-		if (!strcmp(&argv[1][strlen(argv[1])-4], ".zzz")) {
-			argv[1][strlen(argv[1])-4] = 0;
-			decomp = 1;
-		}
-	}
-			
-	fobj = new FileCompress(argv[1]);
-	
-	if (decomp)
-		fobj->Decode();
-	else fobj->Encode();
-
-	delete fobj;
-}

Modified: trunk/src/modules/texts/ztext/ztext.cpp
===================================================================
--- trunk/src/modules/texts/ztext/ztext.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/modules/texts/ztext/ztext.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -7,16 +7,8 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <fcntl.h>
-
 #include <sysdata.h>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-#include <utilfuns.h>
 #include <ztext.h>
 
 #include <regex.h>	// GNU
@@ -222,12 +214,4 @@
 	else	return *key;
 }
 
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-
-
-
 SWORD_NAMESPACE_END

Modified: trunk/src/utilfuns/Makefile.am
===================================================================
--- trunk/src/utilfuns/Makefile.am	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/utilfuns/Makefile.am	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,10 +1,9 @@
 
 utilfunsdir = $(top_srcdir)/src/utilfuns
+libsword_la_SOURCES += $(utilfunsdir)/swobject.cpp
 libsword_la_SOURCES += $(utilfunsdir)/Greek2Greek.cpp
 libsword_la_SOURCES += $(utilfunsdir)/utilstr.cpp
-libsword_la_SOURCES += $(utilfunsdir)/utilweb.cpp
 libsword_la_SOURCES += $(utilfunsdir)/utilxml.cpp
-libsword_la_SOURCES += $(utilfunsdir)/unixstr.cpp
 libsword_la_SOURCES += $(utilfunsdir)/swunicod.cpp
 libsword_la_SOURCES += $(utilfunsdir)/swversion.cpp
 libsword_la_SOURCES += $(utilfunsdir)/swbuf.cpp

Deleted: trunk/src/utilfuns/unixstr.cpp
===================================================================
--- trunk/src/utilfuns/unixstr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/utilfuns/unixstr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,10 +0,0 @@
-// Include only if your UNIX compiler does not include stricmp but does include strcasecmp
-
-#include <unixstr.h>
-#include <string.h>
-
-SWORD_NAMESPACE_START
-int stricmp(const char *s1, const char *s2) {
-	return strcasecmp(s1, s2);
-}
-SWORD_NAMESPACE_END

Deleted: trunk/src/utilfuns/utilconf.cpp
===================================================================
--- trunk/src/utilfuns/utilconf.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/utilfuns/utilconf.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,22 +0,0 @@
-#include <utilstr.h>
-
-
-/******************************************************************************
- * getconfent - Get the value of an entry in a configuration file
- *
- * ENT:	filename	- File name in which to look for entry
- *		entryname	- Entry of which to obtain value
- *		buf		- Buffer to store entry value
- *		len		- Maximum length to write into buffer
- *
- * RET:	error status
- */
-
-SWORD_NAMESPACE_START
-
-char getconfent(char *filename, char *entryname, char *buf, int len)
-{
-	return 0;
-}
-
-SWORD_NAMESPACE_END

Modified: trunk/src/utilfuns/utilstr.cpp
===================================================================
--- trunk/src/utilfuns/utilstr.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/utilfuns/utilstr.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -141,14 +141,14 @@
 }
 
 /******************************************************************************
- * strnicmp - compares the first n bytes of 2 string ignoring case
+ * strnicmp - compares the first n bytes of 2 strings ignoring case
  *
  * ENT:	compares s1 to s2 comparing the first n byte ingnoring case
  *
  * RET:	same as strcmp
  */
 
-const char strnicmp(const char *s1, const char *s2, int len) {
+int strnicmp(const char *s1, const char *s2, int len) {
 	int tLen = strlen(s2);
 	int cLen = strlen(s1);
 	char diff;
@@ -162,32 +162,14 @@
 	return (i < len) ? cLen - tLen : 0;
 }
 
-/******************************************************************************
- * strlenw - Scans a string for trailing 0x0000 and return size in BYTES
- *
- * ENT:	target - string for which to determine size
- *
- * RET:	length in BYTES 
- *			If s2 does not occur in s1, returns null.
- */
-
-unsigned int strlenw(const char *s1) {
-	return strlen(s1);
-// utf8 says no null in string except terminator, so below code is overkill
-/*
-	const char *ch = s1;
-	if (!*ch)
-		ch++;
-	while (*ch) {
-		ch++;
-		if (!*ch)
-			ch++;
-	}
-	return (unsigned int)(ch - s1) - 1;
-*/
+int stricmp(const char *s1, const char *s2) {
+#if defined(__GNUC__) || defined(_WIN32_WCE)
+	return ::strcasecmp(s1, s2);
+#else
+	return ::stricmp(s1, s2);
+#endif
 }
 
-
 /******************************************************************************
  * toupperstr - converts a string to uppercase string
  *

Deleted: trunk/src/utilfuns/utilweb.cpp
===================================================================
--- trunk/src/utilfuns/utilweb.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/src/utilfuns/utilweb.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -1,37 +0,0 @@
-#include <utilxml.h>
-#include <stdio.h>
-#include <map>
-
-SWORD_NAMESPACE_START
-
-using std::map;
-
-typedef map<unsigned char,SWBuf> DataMap;
-
-const SWBuf encodeURL( const SWBuf& url ) {
-    	DataMap m;
-	for (unsigned short int c = 32; c <= 255; ++c) { //first set all encoding chars
-			if ( (c>='A' && c<='Z') || (c>='a' && c<='z') || (c>='0' && c<='9') || strchr("-_.!~*'()", c)) {
-				continue; //we don't need an encoding for this char
-			}
-
-			char s[5];
-			sprintf(s, "%-.2X", c); //left-aligned, 2 digits, uppercase hex
-			m[c] = SWBuf("%") + s; //encoded char is "% + 2 digit hex code of char"
-	}
-	//the special encodings for certain chars
-	m[' '] = '+';
-
-	SWBuf buf;
-	const int length = url.length();
-	for (int i = 0; i <= length; i++) { //fill "buf"
-		const char& c = url[i];
-		buf += (!m[c].length()) ? (SWBuf)c : (SWBuf)m[c];
-	}
-
-	return buf;
-}
-
-
-
-SWORD_NAMESPACE_END

Modified: trunk/sword.kdevprj
===================================================================
--- trunk/sword.kdevprj	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/sword.kdevprj	2005-05-03 03:49:04 UTC (rev 1790)
@@ -15,7 +15,7 @@
 kdevprj_version=1.3
 lfv_open_groups=
 make_options=\s-j1
-makefiles=Makefile.am,sword/Makefile.am,sword/docs/Makefile.am,sword/docs/en/Makefile.am,po/Makefile.am,include/Makefile.am,src/mgr/Makefile.am,src/Makefile.am,src/keys/Makefile.am,src/frontend/Makefile.am,src/utilfuns/Makefile.am,src/utilfuns/zlib/Makefile.am,src/modules/Makefile.am,src/modules/comments/Makefile.am,src/modules/comments/hrefcom/Makefile.am,src/modules/comments/rawcom/Makefile.am,src/modules/comments/rawfiles/Makefile.am,src/modules/comments/zcom/Makefile.am,src/modules/common/Makefile.am,src/modules/lexdict/Makefile.am,src/modules/lexdict/rawld/Makefile.am,src/modules/lexdict/rawld4/Makefile.am,src/modules/texts/Makefile.am,src/modules/texts/rawgbf/Makefile.am,src/modules/texts/rawtext/Makefile.am,src/modules/texts/ztext/Makefile.am,src/modules/filters/Makefile.am,src/frontend/im/Makefile.am,src/modules/genbook/Makefile.am,src/modules/genbook/rawgenbook/Makefile.am,src/modules/lexdict/zld/Makefile.am,tests/Makefile.am
+makefiles=Makefile.am,sword/Makefile.am,sword/docs/Makefile.am,sword/docs/en/Makefile.am,po/Makefile.am,include/Makefile.am,src/mgr/Makefile.am,src/Makefile.am,src/keys/Makefile.am,src/frontend/Makefile.am,src/utilfuns/Makefile.am,src/utilfuns/zlib/Makefile.am,src/modules/Makefile.am,src/modules/comments/Makefile.am,src/modules/comments/hrefcom/Makefile.am,src/modules/comments/rawcom/Makefile.am,src/modules/comments/rawfiles/Makefile.am,src/modules/comments/zcom/Makefile.am,src/modules/common/Makefile.am,src/modules/lexdict/Makefile.am,src/modules/lexdict/rawld/Makefile.am,src/modules/lexdict/rawld4/Makefile.am,src/modules/texts/Makefile.am,src/modules/texts/rawtext/Makefile.am,src/modules/texts/ztext/Makefile.am,src/modules/filters/Makefile.am,src/frontend/im/Makefile.am,src/modules/genbook/Makefile.am,src/modules/genbook/rawgenbook/Makefile.am,src/modules/lexdict/zld/Makefile.am,tests/Makefile.am
 modifyMakefiles=false
 project_name=Sword
 project_type=normal_empty
@@ -50,7 +50,7 @@
 type=HEADER
 
 [include/Makefile.am]
-files=include/canon.h,include/cipherfil.h,include/defs.h,include/echomod.h,include/entriesblk.h,include/femain.h,include/filemgr.h,include/gbffootnotes.h,include/gbfheadings.h,include/gbfhtml.h,include/swfilter.h,include/gbfhtmlhref.h,include/gbfmorph.h,include/gbfplain.h,include/gbfrtf.h,include/gbfstrongs.h,include/gbfthml.h,include/Greek2Greek.h,include/GreekChars.h,include/hrefcom.h,include/latin1utf16.h,include/latin1utf8.h,include/listkey.h,include/localemgr.h,include/lzsscomprs.h,include/plainfootnotes.h,include/plainhtml.h,include/rawcom.h,include/rawfiles.h,include/rawgbf.h,include/rawld.h,include/rawld4.h,include/rawstr.h,include/rawstr4.h,include/rawtext.h,include/rawverse.h,include/regex.h,include/roman.h,include/rtfhtml.h,include/rwphtml.h,include/rwprtf.h,include/sapphire.h,include/scsuutf8.h,include/strkey.h,include/swbasicfilter.h,include/swbyteswap.h,include/swcipher.h,include/swcom.h,include/swcomprs.h,include/swconfig.h,include/swdisp.h,include/swdisprtf.h,include/swdisprtfchap.h,include/swencodingmgr.h,include/swkey.h,include/swld.h,include/swlocale.h,include/swlog.h,include/swmacs.h,include/swmarkupmgr.h,include/swmgr.h,include/swmodule.h,include/swobject.h,include/swtext.h,include/swunicod.h,include/swwinlog.h,include/tbdisp.h,include/thmlgbf.h,include/thmlhtml.h,include/thmlhtmlhref.h,include/thmlplain.h,include/thmlrtf.h,include/unicodertf.h,include/unixstr.h,include/untgz.h,include/utf16utf8.h,include/utf8cantillation.h,include/utf8greekaccents.h,include/utf8hebrewpoints.h,include/utf8html.h,include/utf8latin1.h,include/utf8transliterator.h,include/utf8utf16.h,include/utilconf.h,include/utilfuns.h,include/utilstr.h,include/versekey.h,include/zcom.h,include/zconf.h,include/zipcomprs.h,include/zlib.h,include/ztext.h,include/zverse.h,include/thmlfootnotes.h,include/thmlheadings.h,include/thmllemma.h,include/thmlmorph.h,include/thmlscripref.h,include/thmlstrongs.h,include/utf8cnormalizer.h,include/utf8arshaping.h,include/utf8bidireorder.h,include/utf8nfc.h,include/utf8nfkd.h,include!
 /encfilt
mgr.h,include/swversion.h,include/swfiltermgr.h,include/markupfiltmgr.h,include/rawgenbook.h,include/swgenbook.h,include/treekey.h,include/thmlvariants.h,include/treekeyidx.h,include/zld.h,include/zstr.h,include/swinputmeth.h,include/nullim.h,include/hebrewmcim.h,include/flatapi.h,include/cdsourcemgr.h,include/ftpparse.h,include/gbfosis.h,include/gbfredletterwords.h,include/greeklexattribs.h,include/installmgr.h,include/osismorph.h,include/osisstrongs.h,include/remotesourcemgr.h,include/multimapwdef.h,include/swcacher.h,include/swinstallmgr.h,include/swremotemgr.h,include/swsourcemgr.h,include/sysdata.h,include/thmlosis.h,include/swbuf.h,include/osisplain.h,include/osisrtf.h
+files=include/canon.h,include/cipherfil.h,include/defs.h,include/echomod.h,include/entriesblk.h,include/femain.h,include/filemgr.h,include/gbffootnotes.h,include/gbfheadings.h,include/gbfhtml.h,include/swfilter.h,include/gbfhtmlhref.h,include/gbfmorph.h,include/gbfplain.h,include/gbfrtf.h,include/gbfstrongs.h,include/gbfthml.h,include/Greek2Greek.h,include/GreekChars.h,include/hrefcom.h,include/latin1utf16.h,include/latin1utf8.h,include/listkey.h,include/localemgr.h,include/lzsscomprs.h,include/plainfootnotes.h,include/plainhtml.h,include/rawcom.h,include/rawfiles.h,include/rawld.h,include/rawld4.h,include/rawstr.h,include/rawstr4.h,include/rawtext.h,include/rawverse.h,include/regex.h,include/roman.h,include/rtfhtml.h,include/rwphtml.h,include/rwprtf.h,include/sapphire.h,include/scsuutf8.h,include/strkey.h,include/swbasicfilter.h,include/swbyteswap.h,include/swcipher.h,include/swcom.h,include/swcomprs.h,include/swconfig.h,include/swdisp.h,include/swdisprtf.h,include/swdisprtfchap.h,include/swencodingmgr.h,include/swkey.h,include/swld.h,include/swlocale.h,include/swlog.h,include/swmacs.h,include/swmarkupmgr.h,include/swmgr.h,include/swmodule.h,include/swobject.h,include/swtext.h,include/swunicod.h,include/swwinlog.h,include/tbdisp.h,include/thmlgbf.h,include/thmlhtml.h,include/thmlhtmlhref.h,include/thmlplain.h,include/thmlrtf.h,include/unicodertf.h,include/unixstr.h,include/untgz.h,include/utf16utf8.h,include/utf8cantillation.h,include/utf8greekaccents.h,include/utf8hebrewpoints.h,include/utf8html.h,include/utf8latin1.h,include/utf8transliterator.h,include/utf8utf16.h,include/utilconf.h,include/utilfuns.h,include/utilstr.h,include/versekey.h,include/zcom.h,include/zconf.h,include/zipcomprs.h,include/zlib.h,include/ztext.h,include/zverse.h,include/thmlfootnotes.h,include/thmlheadings.h,include/thmllemma.h,include/thmlmorph.h,include/thmlscripref.h,include/thmlstrongs.h,include/utf8cnormalizer.h,include/utf8arshaping.h,include/utf8bidireorder.h,include/utf8nfc.h,include/utf8nfkd.h,include/encfiltmgr.h,inc!
 lude/swv
ersion.h,include/swfiltermgr.h,include/markupfiltmgr.h,include/rawgenbook.h,include/swgenbook.h,include/treekey.h,include/thmlvariants.h,include/treekeyidx.h,include/zld.h,include/zstr.h,include/swinputmeth.h,include/nullim.h,include/hebrewmcim.h,include/flatapi.h,include/cdsourcemgr.h,include/ftpparse.h,include/gbfosis.h,include/gbfredletterwords.h,include/greeklexattribs.h,include/installmgr.h,include/osismorph.h,include/osisstrongs.h,include/remotesourcemgr.h,include/multimapwdef.h,include/swcacher.h,include/swinstallmgr.h,include/swremotemgr.h,include/swsourcemgr.h,include/sysdata.h,include/thmlosis.h,include/swbuf.h,include/osisplain.h,include/osisrtf.h
 sub_dirs=
 type=normal
 
@@ -306,12 +306,6 @@
 install_location=
 type=HEADER
 
-[include/rawgbf.h]
-dist=true
-install=false
-install_location=
-type=HEADER
-
 [include/rawgenbook.h]
 dist=true
 install=false
@@ -1680,22 +1674,9 @@
 files=src/modules/texts/swtext.cpp
 sharedlib_LDFLAGS=-version-info 0:0:1
 sharedlib_rootname=texts
-sub_dirs=rawgbf,rawtext,ztext
+sub_dirs=rawtext,ztext
 type=static_library
 
-[src/modules/texts/rawgbf/Makefile.am]
-files=src/modules/texts/rawgbf/rawgbf.cpp
-sharedlib_LDFLAGS=-version-info 0:0:1
-sharedlib_rootname=rawgbf
-sub_dirs=
-type=static_library
-
-[src/modules/texts/rawgbf/rawgbf.cpp]
-dist=true
-install=false
-install_location=
-type=SOURCE
-
 [src/modules/texts/rawtext/Makefile.am]
 files=src/modules/texts/rawtext/rawtext.cpp
 sharedlib_LDFLAGS=-version-info 0:0:1

Modified: trunk/tests/rawldidxtest.cpp
===================================================================
--- trunk/tests/rawldidxtest.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/tests/rawldidxtest.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -2,10 +2,6 @@
 #include <rawstr.h>
 #include <swmgr.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifndef __GNUC__
 #include <io.h>
 #else
@@ -27,7 +23,7 @@
      char buf[127];
 
 	sprintf(buf, "%s.idx", argv[1]);
-	FileDesc *idxfd = FileMgr::getSystemFileMgr()->open(buf, O_RDONLY|O_BINARY, true);
+	FileDesc *idxfd = FileMgr::getSystemFileMgr()->open(buf, FileMgr::RDONLY, true);
 	long maxoff = lseek(idxfd->getFd(), 0, SEEK_END) - 6;
 	FileMgr::getSystemFileMgr()->close(idxfd);
 

Modified: trunk/tests/swbuftest.cpp
===================================================================
--- trunk/tests/swbuftest.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/tests/swbuftest.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -3,11 +3,11 @@
 
 #define BASEI 102400000L
 
-//#include <swbuf.h>
-//typedef sword::SWBuf StringType;
+#include <swbuf.h>
+typedef sword::SWBuf StringType;
 
-#include <string>
-typedef std::string StringType;
+//#include <string>
+//typedef std::string StringType;
 
 using std::cout;
 using std::cerr;
@@ -54,7 +54,7 @@
 	for (int j = 0; j < 100; j++) {
 		s += "0123456789";
 	}
-	for (int j = 0; j < BASEI/100; j++) {
+	for (int j = 0; j < BASEI/200; j++) {
 		for (unsigned long i = s.length()-1; i; i--) {
 			s[i] = (char) (i%40)+65;
 		}

Modified: trunk/tests/webiftest.cpp
===================================================================
--- trunk/tests/webiftest.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/tests/webiftest.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -3,9 +3,6 @@
 #else
 #include <unistd.h>
 #endif
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 #include <fcntl.h>
 #include <errno.h>
 #include <iostream>

Modified: trunk/utilities/addcomment.cpp
===================================================================
--- trunk/utilities/addcomment.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/addcomment.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -4,7 +4,6 @@
 #include <rawtext.h>
 #include <zcom.h>
 #include <rawcom.h>
-#include <rawgbf.h>
 #include <rawfiles.h>
 #include <stdlib.h>
 

Modified: trunk/utilities/addgb.cpp
===================================================================
--- trunk/utilities/addgb.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/addgb.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -17,10 +17,6 @@
 #include <treekeyidx.h>
 #include <rawgenbook.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifndef NO_SWORD_NAMESPACE
 using sword::TreeKeyIdx;
 using sword::RawGenBook;

Modified: trunk/utilities/addld.cpp
===================================================================
--- trunk/utilities/addld.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/addld.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -25,9 +25,6 @@
 using sword::RawLD;
 #endif
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 
 int main(int argc, char **argv) {
   

Modified: trunk/utilities/addvs.cpp
===================================================================
--- trunk/utilities/addvs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/addvs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -23,10 +23,6 @@
 using sword::SWModule;
 #endif
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 int main(int argc, char **argv) {
   
   const char * helptext = "addvs 1.1 Bible & Commentary module creation tool for the SWORD Project\nUse -a to add a new verse from standard input or a file, -d to delete a verse,\n-l to link two verses, -c to create a new module.\n  usage:\n   %s -a </path/to/module> <verse> [</path/to/file/with/verse>]\n   %s -d </path/to/module> <key>\n   %s -l </path/to/module> <first verse (already assigned)> <second verse>\n   %s -c </path/to/module>\n";

Modified: trunk/utilities/cipherraw.cpp
===================================================================
--- trunk/utilities/cipherraw.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/cipherraw.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -15,6 +15,8 @@
 #include <versekey.h>
 #include <rawverse.h>
 #include <swbuf.h>
+
+
 #ifndef NO_SWORD_NAMESPACE
 using namespace sword;
 #endif

Modified: trunk/utilities/imp2gbs.cpp
===================================================================
--- trunk/utilities/imp2gbs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/imp2gbs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -15,10 +15,6 @@
 #include <treekeyidx.h>
 #include <rawgenbook.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifndef NO_SWORD_NAMESPACE
 using sword::TreeKeyIdx;
 using sword::RawGenBook;

Modified: trunk/utilities/imp2ld.cpp
===================================================================
--- trunk/utilities/imp2ld.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/imp2ld.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -17,10 +17,6 @@
 #include <zld.h>
 #include <zipcomprs.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifndef NO_SWORD_NAMESPACE
 using sword::zLD;
 using sword::ZipCompress;

Modified: trunk/utilities/imp2vs.cpp
===================================================================
--- trunk/utilities/imp2vs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/imp2vs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -14,9 +14,6 @@
 #include <string>
 #include <rawtext.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 
 #ifndef NO_SWORD_NAMESPACE
 using sword::RawText;

Modified: trunk/utilities/kylixmake/libsword.bpr
===================================================================
--- trunk/utilities/kylixmake/libsword.bpr	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/kylixmake/libsword.bpr	2005-05-03 03:49:04 UTC (rev 1790)
@@ -70,7 +70,6 @@
       ../../src/modules/lexdict/swld.o ../../src/modules/lexdict/rawld/rawld.o 
       ../../src/modules/lexdict/rawld4/rawld4.o 
       ../../src/modules/lexdict/zld/zld.o ../../src/modules/texts/swtext.o 
-      ../../src/modules/texts/rawgbf/rawgbf.o 
       ../../src/modules/texts/rawtext/rawtext.o 
       ../../src/modules/texts/ztext/ztext.o ../../src/utilfuns/roman.o"/>
     <RESFILES value=""/>
@@ -81,7 +80,7 @@
     <PACKAGES value="rtl.bpi visualclx.bpi dataclx.bpi visualdbclx.bpi netclx.bpi 
       netdataclx.bpi xmlrtl.bpi indy.bpi webdsnapclx.bpi websnapclx.bpi 
       soaprtl.bpi"/>
-    <PATHCPP value=".;../../src/utilfuns:../../src/keys:../../src/mgr:../../src/frontend:../../src/modules:../../src/modules/comments:../../src/modules/comments/hrefcom:../../src/modules/comments/rawcom:../../src/modules/comments/rawfiles:../../src/modules/comments/zcom:../../src/modules/common:../../src/modules/filters:../../src/modules/genbook:../../src/modules/genbook/rawgenbook:../../src/modules/lexdict:../../src/modules/lexdict/rawld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/zld:../../src/modules/texts:../../src/modules/texts/rawgbf:../../src/modules/texts/rawtext:../../src/modules/texts/ztext"/>
+    <PATHCPP value=".;../../src/utilfuns:../../src/keys:../../src/mgr:../../src/frontend:../../src/modules:../../src/modules/comments:../../src/modules/comments/hrefcom:../../src/modules/comments/rawcom:../../src/modules/comments/rawfiles:../../src/modules/comments/zcom:../../src/modules/common:../../src/modules/filters:../../src/modules/genbook:../../src/modules/genbook/rawgenbook:../../src/modules/lexdict:../../src/modules/lexdict/rawld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/zld:../../src/modules/texts:../../src/modules/texts/rawtext:../../src/modules/texts/ztext"/>
     <PATHPAS value=".;"/>
     <PATHRC value=".;"/>
     <PATHASM value=".;"/>
@@ -89,8 +88,8 @@
     <USERDEFINES value="_DEBUG"/>
     <SYSDEFINES value=""/>
     <MAINSOURCE value="libsword.bpf"/>
-    <INCLUDEPATH value="../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts/rawgbf:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:../../include:$(BCB)/include/stlport:$(BCB)/include:$(BCB)/include/vcl:/usr/include"/>
-    <LIBPATH value="../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts/rawgbf:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:$(BCB)/lib/obj:$(BCB)/lib:/usr/lib:/lib:/usr/X11R6/lib:$(BCB)/bin"/>
+    <INCLUDEPATH value="../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:../../include:$(BCB)/include/stlport:$(BCB)/include:$(BCB)/include/vcl:/usr/include"/>
+    <LIBPATH value="../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:$(BCB)/lib/obj:$(BCB)/lib:/usr/lib:/lib:/usr/X11R6/lib:$(BCB)/bin"/>
     <WARNINGS value="-w-par"/>
     <LISTFILE value=""/>
     <OTHERFILES value=""/>
@@ -201,7 +200,6 @@
       <FILE FILENAME="../../src/modules/lexdict/rawld4/rawld4.cpp" FORMNAME="" UNITNAME="rawld4" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
       <FILE FILENAME="../../src/modules/lexdict/zld/zld.cpp" FORMNAME="" UNITNAME="zld" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
       <FILE FILENAME="../../src/modules/texts/swtext.cpp" FORMNAME="" UNITNAME="swtext" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
-      <FILE FILENAME="../../src/modules/texts/rawgbf/rawgbf.cpp" FORMNAME="" UNITNAME="rawgbf" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
       <FILE FILENAME="../../src/modules/texts/rawtext/rawtext.cpp" FORMNAME="" UNITNAME="rawtext" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
       <FILE FILENAME="../../src/modules/texts/ztext/ztext.cpp" FORMNAME="" UNITNAME="ztext" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
       <FILE FILENAME="../../src/utilfuns/roman.c" FORMNAME="" UNITNAME="roman" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
@@ -213,11 +211,11 @@
 [HistoryLists\hlIncludePath]
 Count=2
 Item0=../../include:$(BCB)/include/stlport:$(BCB)/include:$(BCB)/include/vcl:/usr/include
-Item1=../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts/rawgbf:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:$(BCB)/include/stlport:$(BCB)/include:$(BCB)/include/vcl:/usr/include
+Item1=../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:$(BCB)/include/stlport:$(BCB)/include:$(BCB)/include/vcl:/usr/include
 
 [HistoryLists\hlLibraryPath]
 Count=1
-Item0=../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts/rawgbf:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:$(BCB)/lib/obj:$(BCB)/lib:/usr/lib:/lib:/usr/X11R6/lib:$(BCB)/bin
+Item0=../../src/modules/texts/ztext:../../src/modules/texts/rawtext:../../src/modules/texts:../../src/modules/lexdict/zld:../../src/modules/lexdict/rawld4:../../src/modules/lexdict/rawld:../../src/modules/lexdict:../../src/modules/genbook/rawgenbook:../../src/modules/genbook:../../src/modules/filters:../../src/modules/common:../../src/modules/comments/zcom:../../src/modules/comments/rawfiles:../../src/modules/comments/rawcom:../../src/modules/comments/hrefcom:../../src/modules/comments:../../src/modules:../../src/frontend:../../src/mgr:../../src/keys:../../src/utilfuns:$(BCB)/lib/obj:$(BCB)/lib:/usr/lib:/lib:/usr/X11R6/lib:$(BCB)/bin
 
 [HistoryLists\hlConditionals]
 Count=1
@@ -237,4 +235,4 @@
 ShowInfoMsgs=0
 LinkDebugVcl=0
   </IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>

Modified: trunk/utilities/mkfastmod.cpp
===================================================================
--- trunk/utilities/mkfastmod.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/mkfastmod.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -3,6 +3,8 @@
 #include <swmgr.h>
 #include <markupfiltmgr.h>
 #include <swbuf.h>
+
+
 #ifndef NO_SWORD_NAMESPACE
 using sword::SWMgr;
 using sword::SWModule;

Modified: trunk/utilities/mod2osis.cpp
===================================================================
--- trunk/utilities/mod2osis.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/mod2osis.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -4,12 +4,6 @@
 #include <fstream>
 #include <string>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
 #include <ztext.h>
 #include <zld.h>
 #include <zcom.h>

Modified: trunk/utilities/mod2zmod.cpp
===================================================================
--- trunk/utilities/mod2zmod.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/mod2zmod.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -20,6 +20,8 @@
 #include <versekey.h>
 #include <stdio.h>
 #include <cipherfil.h>
+
+
 #ifndef NO_SWORD_NAMESPACE
 using sword::SWCompress;
 using sword::CipherFilter;

Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/osis2mod.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -5,12 +5,6 @@
 #include <stdlib.h>
 #include <string>
 
-#ifndef __GNUC__
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
 #include <utilstr.h>
 #include <filemgr.h>
 #include <swmgr.h>
@@ -20,10 +14,6 @@
 #include <utilxml.h>
 #include <listkey.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #ifndef NO_SWORD_NAMESPACE
 using namespace sword;
 #endif
@@ -359,7 +349,7 @@
 	}
 
 	// Let's see if we can open our input file
-	FileDesc *fd = FileMgr::getSystemFileMgr()->open(argv[2], O_RDONLY|O_BINARY);
+	FileDesc *fd = FileMgr::getSystemFileMgr()->open(argv[2], FileMgr::RDONLY);
 	if (fd->getFd() < 0) {
 		fprintf(stderr, "error: %s: couldn't open input file: %s \n", argv[0], argv[2]);
 		exit(-2);

Modified: trunk/utilities/xml2gbs.cpp
===================================================================
--- trunk/utilities/xml2gbs.cpp	2005-05-01 19:56:29 UTC (rev 1789)
+++ trunk/utilities/xml2gbs.cpp	2005-05-03 03:49:04 UTC (rev 1790)
@@ -17,9 +17,6 @@
 #include <treekeyidx.h>
 #include <rawgenbook.h>
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
 
 #ifndef NO_SWORD_NAMESPACE
 using sword::TreeKeyIdx;



More information about the sword-cvs mailing list