summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:33 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:33 -0400
commit8d3fc864d094eeadc721f8e93436b37a5fab173e (patch)
tree05e201c67dca55b4ccdf90ad479a25d95e3b1e63 /utilities
Imported Upstream version 1.5.3
Diffstat (limited to 'utilities')
-rw-r--r--utilities/Makefile.am42
-rw-r--r--utilities/Makefile.in604
-rw-r--r--utilities/addcomment.cpp40
-rw-r--r--utilities/addgb.cpp148
-rw-r--r--utilities/addld.cpp196
-rw-r--r--utilities/addvs.cpp181
-rw-r--r--utilities/bcppmake/diatheke.bpf6
-rw-r--r--utilities/bcppmake/diatheke.bpr110
-rw-r--r--utilities/bcppmake/imp2gbs.bpf6
-rw-r--r--utilities/bcppmake/imp2gbs.bpr113
-rw-r--r--utilities/bcppmake/imp2ld.bpf6
-rw-r--r--utilities/bcppmake/imp2ld.bpr113
-rw-r--r--utilities/bcppmake/imp2vs.bpf6
-rw-r--r--utilities/bcppmake/imp2vs.bpr113
-rw-r--r--utilities/bcppmake/libsword.bpf113
-rw-r--r--utilities/bcppmake/libsword.bpr193
-rw-r--r--utilities/bcppmake/mkfastmod.bpf6
-rw-r--r--utilities/bcppmake/mkfastmod.bpr111
-rw-r--r--utilities/bcppmake/mod2vpl.bpf6
-rw-r--r--utilities/bcppmake/mod2vpl.bpr111
-rw-r--r--utilities/bcppmake/mod2zmod.bpf6
-rw-r--r--utilities/bcppmake/mod2zmod.bpr112
-rw-r--r--utilities/bcppmake/thml2gbs.bpf6
-rw-r--r--utilities/bcppmake/thml2gbs.bpr114
-rw-r--r--utilities/bcppmake/utilities.bpg58
-rw-r--r--utilities/bcppmake/vpl2mod.bpf6
-rw-r--r--utilities/bcppmake/vpl2mod.bpr111
-rw-r--r--utilities/cipherraw.cpp100
-rw-r--r--utilities/ciphertest.cpp55
-rw-r--r--utilities/ciphertest2.cpp39
-rw-r--r--utilities/emptyvss.cpp44
-rw-r--r--utilities/imp2gbs.cpp163
-rw-r--r--utilities/imp2ld.cpp155
-rw-r--r--utilities/imp2vs.cpp198
-rw-r--r--utilities/lexdump.c50
-rw-r--r--utilities/mkfastmod.cpp38
-rw-r--r--utilities/mod2vpl.cpp74
-rw-r--r--utilities/mod2zmod.cpp145
-rw-r--r--utilities/modwrite.cpp54
-rw-r--r--utilities/no13.c34
-rw-r--r--utilities/normcode.cpp96
-rwxr-xr-xutilities/perl/cipherkeygen.pl24
-rwxr-xr-xutilities/perl/linkvers.pl44
-rwxr-xr-xutilities/perl/localecap.pl23
-rwxr-xr-xutilities/perl/mkvsmod.pl21
-rw-r--r--utilities/step2vpl.cpp419
-rw-r--r--utilities/stepdump.cpp247
-rw-r--r--utilities/thml2gbs.cpp329
-rw-r--r--utilities/txt2sword.cpp233
-rw-r--r--utilities/vpl2mod.cpp250
50 files changed, 5472 insertions, 0 deletions
diff --git a/utilities/Makefile.am b/utilities/Makefile.am
new file mode 100644
index 0000000..4e4cd30
--- /dev/null
+++ b/utilities/Makefile.am
@@ -0,0 +1,42 @@
+AUTOMAKE_OPTIONS = 1.5
+INCLUDES = -I $(top_srcdir)/include
+LDADD = -L$(top_builddir)/lib -lsword
+
+noinst_PROGRAMS = cipherraw ciphertest ciphertest2 lexdump mkfastmod \
+mod2vpl vpl2mod stepdump step2vpl mod2zmod modwrite addvs addld emptyvss \
+txt2sword addgb imp2gbs imp2ld imp2vs thml2gbs
+
+if ICU
+ICUPROG = normcode
+else
+ICUPROG =
+endif
+
+noinst_PROGRAMS += $(ICUPROG)
+
+if ICU
+normcode_SOURCES = normcode.cpp
+normcode_LDADD = -licui18n -licuuc
+endif
+
+cipherraw_SOURCES = cipherraw.cpp
+ciphertest_SOURCES = ciphertest.cpp
+ciphertest2_SOURCES = ciphertest2.cpp
+lexdump_SOURCES = lexdump.c
+lexdump_LDADD = -lstdc++
+mkfastmod_SOURCES = mkfastmod.cpp
+mod2vpl_SOURCES = mod2vpl.cpp
+vpl2mod_SOURCES = vpl2mod.cpp
+stepdump_SOURCES = stepdump.cpp
+step2vpl_SOURCES = step2vpl.cpp
+mod2zmod_SOURCES = mod2zmod.cpp
+modwrite_SOURCES = modwrite.cpp
+addvs_SOURCES = addvs.cpp
+addld_SOURCES = addld.cpp
+emptyvss_SOURCES = emptyvss.cpp
+txt2sword_SOURCES = txt2sword.cpp
+addgb_SOURCES = addgb.cpp
+imp2gbs_SOURCES = imp2gbs.cpp
+imp2ld_SOURCES = imp2ld.cpp
+imp2vs_SOURCES = imp2vs.cpp
+thml2gbs_SOURCES = thml2gbs.cpp
diff --git a/utilities/Makefile.in b/utilities/Makefile.in
new file mode 100644
index 0000000..30aba5d
--- /dev/null
+++ b/utilities/Makefile.in
@@ -0,0 +1,604 @@
+# Makefile.in generated by automake 1.6 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+AMTAR = @AMTAR@
+AS = @AS@
+AWK = @AWK@
+CC = @CC@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+OBJDUMP = @OBJDUMP@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+dir_confdef = @dir_confdef@
+enable_debug = @enable_debug@
+enable_profile = @enable_profile@
+enable_vcl = @enable_vcl@
+install_sh = @install_sh@
+target_cpu = @target_cpu@
+target_mingw32 = @target_mingw32@
+target_os = @target_os@
+target_system = @target_system@
+target_vendor = @target_vendor@
+with_conf = @with_conf@
+with_icu = @with_icu@
+with_zlib = @with_zlib@
+AUTOMAKE_OPTIONS = 1.5
+INCLUDES = -I $(top_srcdir)/include
+LDADD = -L$(top_builddir)/lib -lsword
+
+noinst_PROGRAMS = cipherraw ciphertest ciphertest2 lexdump mkfastmod \
+mod2vpl vpl2mod stepdump step2vpl mod2zmod modwrite addvs addld emptyvss \
+txt2sword addgb imp2gbs imp2ld imp2vs thml2gbs\
+$(ICUPROG)
+
+@ICU_TRUE@ICUPROG = normcode
+@ICU_FALSE@ICUPROG =
+
+@ICU_TRUE@normcode_SOURCES = normcode.cpp
+@ICU_TRUE@normcode_LDADD = -licui18n -licuuc
+
+cipherraw_SOURCES = cipherraw.cpp
+ciphertest_SOURCES = ciphertest.cpp
+ciphertest2_SOURCES = ciphertest2.cpp
+lexdump_SOURCES = lexdump.c
+lexdump_LDADD = -lstdc++
+mkfastmod_SOURCES = mkfastmod.cpp
+mod2vpl_SOURCES = mod2vpl.cpp
+vpl2mod_SOURCES = vpl2mod.cpp
+stepdump_SOURCES = stepdump.cpp
+step2vpl_SOURCES = step2vpl.cpp
+mod2zmod_SOURCES = mod2zmod.cpp
+modwrite_SOURCES = modwrite.cpp
+addvs_SOURCES = addvs.cpp
+addld_SOURCES = addld.cpp
+emptyvss_SOURCES = emptyvss.cpp
+txt2sword_SOURCES = txt2sword.cpp
+addgb_SOURCES = addgb.cpp
+imp2gbs_SOURCES = imp2gbs.cpp
+imp2ld_SOURCES = imp2ld.cpp
+imp2vs_SOURCES = imp2vs.cpp
+thml2gbs_SOURCES = thml2gbs.cpp
+subdir = utilities
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+@ICU_TRUE@noinst_PROGRAMS = cipherraw$(EXEEXT) ciphertest$(EXEEXT) \
+@ICU_TRUE@ ciphertest2$(EXEEXT) lexdump$(EXEEXT) \
+@ICU_TRUE@ mkfastmod$(EXEEXT) mod2vpl$(EXEEXT) vpl2mod$(EXEEXT) \
+@ICU_TRUE@ stepdump$(EXEEXT) step2vpl$(EXEEXT) mod2zmod$(EXEEXT) \
+@ICU_TRUE@ modwrite$(EXEEXT) addvs$(EXEEXT) addld$(EXEEXT) \
+@ICU_TRUE@ emptyvss$(EXEEXT) txt2sword$(EXEEXT) addgb$(EXEEXT) \
+@ICU_TRUE@ imp2gbs$(EXEEXT) imp2ld$(EXEEXT) imp2vs$(EXEEXT) \
+@ICU_TRUE@ thml2gbs$(EXEEXT) normcode$(EXEEXT)
+@ICU_FALSE@noinst_PROGRAMS = cipherraw$(EXEEXT) ciphertest$(EXEEXT) \
+@ICU_FALSE@ ciphertest2$(EXEEXT) lexdump$(EXEEXT) \
+@ICU_FALSE@ mkfastmod$(EXEEXT) mod2vpl$(EXEEXT) vpl2mod$(EXEEXT) \
+@ICU_FALSE@ stepdump$(EXEEXT) step2vpl$(EXEEXT) \
+@ICU_FALSE@ mod2zmod$(EXEEXT) modwrite$(EXEEXT) addvs$(EXEEXT) \
+@ICU_FALSE@ addld$(EXEEXT) emptyvss$(EXEEXT) txt2sword$(EXEEXT) \
+@ICU_FALSE@ addgb$(EXEEXT) imp2gbs$(EXEEXT) imp2ld$(EXEEXT) \
+@ICU_FALSE@ imp2vs$(EXEEXT) thml2gbs$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+
+am_addgb_OBJECTS = addgb.$(OBJEXT)
+addgb_OBJECTS = $(am_addgb_OBJECTS)
+addgb_LDADD = $(LDADD)
+addgb_DEPENDENCIES =
+addgb_LDFLAGS =
+am_addld_OBJECTS = addld.$(OBJEXT)
+addld_OBJECTS = $(am_addld_OBJECTS)
+addld_LDADD = $(LDADD)
+addld_DEPENDENCIES =
+addld_LDFLAGS =
+am_addvs_OBJECTS = addvs.$(OBJEXT)
+addvs_OBJECTS = $(am_addvs_OBJECTS)
+addvs_LDADD = $(LDADD)
+addvs_DEPENDENCIES =
+addvs_LDFLAGS =
+am_cipherraw_OBJECTS = cipherraw.$(OBJEXT)
+cipherraw_OBJECTS = $(am_cipherraw_OBJECTS)
+cipherraw_LDADD = $(LDADD)
+cipherraw_DEPENDENCIES =
+cipherraw_LDFLAGS =
+am_ciphertest_OBJECTS = ciphertest.$(OBJEXT)
+ciphertest_OBJECTS = $(am_ciphertest_OBJECTS)
+ciphertest_LDADD = $(LDADD)
+ciphertest_DEPENDENCIES =
+ciphertest_LDFLAGS =
+am_ciphertest2_OBJECTS = ciphertest2.$(OBJEXT)
+ciphertest2_OBJECTS = $(am_ciphertest2_OBJECTS)
+ciphertest2_LDADD = $(LDADD)
+ciphertest2_DEPENDENCIES =
+ciphertest2_LDFLAGS =
+am_emptyvss_OBJECTS = emptyvss.$(OBJEXT)
+emptyvss_OBJECTS = $(am_emptyvss_OBJECTS)
+emptyvss_LDADD = $(LDADD)
+emptyvss_DEPENDENCIES =
+emptyvss_LDFLAGS =
+am_imp2gbs_OBJECTS = imp2gbs.$(OBJEXT)
+imp2gbs_OBJECTS = $(am_imp2gbs_OBJECTS)
+imp2gbs_LDADD = $(LDADD)
+imp2gbs_DEPENDENCIES =
+imp2gbs_LDFLAGS =
+am_imp2ld_OBJECTS = imp2ld.$(OBJEXT)
+imp2ld_OBJECTS = $(am_imp2ld_OBJECTS)
+imp2ld_LDADD = $(LDADD)
+imp2ld_DEPENDENCIES =
+imp2ld_LDFLAGS =
+am_imp2vs_OBJECTS = imp2vs.$(OBJEXT)
+imp2vs_OBJECTS = $(am_imp2vs_OBJECTS)
+imp2vs_LDADD = $(LDADD)
+imp2vs_DEPENDENCIES =
+imp2vs_LDFLAGS =
+am_lexdump_OBJECTS = lexdump.$(OBJEXT)
+lexdump_OBJECTS = $(am_lexdump_OBJECTS)
+lexdump_DEPENDENCIES =
+lexdump_LDFLAGS =
+am_mkfastmod_OBJECTS = mkfastmod.$(OBJEXT)
+mkfastmod_OBJECTS = $(am_mkfastmod_OBJECTS)
+mkfastmod_LDADD = $(LDADD)
+mkfastmod_DEPENDENCIES =
+mkfastmod_LDFLAGS =
+am_mod2vpl_OBJECTS = mod2vpl.$(OBJEXT)
+mod2vpl_OBJECTS = $(am_mod2vpl_OBJECTS)
+mod2vpl_LDADD = $(LDADD)
+mod2vpl_DEPENDENCIES =
+mod2vpl_LDFLAGS =
+am_mod2zmod_OBJECTS = mod2zmod.$(OBJEXT)
+mod2zmod_OBJECTS = $(am_mod2zmod_OBJECTS)
+mod2zmod_LDADD = $(LDADD)
+mod2zmod_DEPENDENCIES =
+mod2zmod_LDFLAGS =
+am_modwrite_OBJECTS = modwrite.$(OBJEXT)
+modwrite_OBJECTS = $(am_modwrite_OBJECTS)
+modwrite_LDADD = $(LDADD)
+modwrite_DEPENDENCIES =
+modwrite_LDFLAGS =
+@ICU_TRUE@am_normcode_OBJECTS = normcode.$(OBJEXT)
+normcode_OBJECTS = $(am_normcode_OBJECTS)
+@ICU_TRUE@normcode_DEPENDENCIES =
+@ICU_FALSE@normcode_DEPENDENCIES =
+normcode_LDFLAGS =
+am_step2vpl_OBJECTS = step2vpl.$(OBJEXT)
+step2vpl_OBJECTS = $(am_step2vpl_OBJECTS)
+step2vpl_LDADD = $(LDADD)
+step2vpl_DEPENDENCIES =
+step2vpl_LDFLAGS =
+am_stepdump_OBJECTS = stepdump.$(OBJEXT)
+stepdump_OBJECTS = $(am_stepdump_OBJECTS)
+stepdump_LDADD = $(LDADD)
+stepdump_DEPENDENCIES =
+stepdump_LDFLAGS =
+am_thml2gbs_OBJECTS = thml2gbs.$(OBJEXT)
+thml2gbs_OBJECTS = $(am_thml2gbs_OBJECTS)
+thml2gbs_LDADD = $(LDADD)
+thml2gbs_DEPENDENCIES =
+thml2gbs_LDFLAGS =
+am_txt2sword_OBJECTS = txt2sword.$(OBJEXT)
+txt2sword_OBJECTS = $(am_txt2sword_OBJECTS)
+txt2sword_LDADD = $(LDADD)
+txt2sword_DEPENDENCIES =
+txt2sword_LDFLAGS =
+am_vpl2mod_OBJECTS = vpl2mod.$(OBJEXT)
+vpl2mod_OBJECTS = $(am_vpl2mod_OBJECTS)
+vpl2mod_LDADD = $(LDADD)
+vpl2mod_DEPENDENCIES =
+vpl2mod_LDFLAGS =
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/addgb.Po ./$(DEPDIR)/addld.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/addvs.Po ./$(DEPDIR)/cipherraw.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ciphertest.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ciphertest2.Po ./$(DEPDIR)/emptyvss.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/imp2gbs.Po ./$(DEPDIR)/imp2ld.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/imp2vs.Po ./$(DEPDIR)/lexdump.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/mkfastmod.Po ./$(DEPDIR)/mod2vpl.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/mod2zmod.Po ./$(DEPDIR)/modwrite.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/normcode.Po ./$(DEPDIR)/step2vpl.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/stepdump.Po ./$(DEPDIR)/thml2gbs.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/txt2sword.Po ./$(DEPDIR)/vpl2mod.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXFLAGS = @CXXFLAGS@
+DIST_SOURCES = $(addgb_SOURCES) $(addld_SOURCES) $(addvs_SOURCES) \
+ $(cipherraw_SOURCES) $(ciphertest_SOURCES) \
+ $(ciphertest2_SOURCES) $(emptyvss_SOURCES) $(imp2gbs_SOURCES) \
+ $(imp2ld_SOURCES) $(imp2vs_SOURCES) $(lexdump_SOURCES) \
+ $(mkfastmod_SOURCES) $(mod2vpl_SOURCES) $(mod2zmod_SOURCES) \
+ $(modwrite_SOURCES) $(normcode_SOURCES) $(step2vpl_SOURCES) \
+ $(stepdump_SOURCES) $(thml2gbs_SOURCES) $(txt2sword_SOURCES) \
+ $(vpl2mod_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(addgb_SOURCES) $(addld_SOURCES) $(addvs_SOURCES) $(cipherraw_SOURCES) $(ciphertest_SOURCES) $(ciphertest2_SOURCES) $(emptyvss_SOURCES) $(imp2gbs_SOURCES) $(imp2ld_SOURCES) $(imp2vs_SOURCES) $(lexdump_SOURCES) $(mkfastmod_SOURCES) $(mod2vpl_SOURCES) $(mod2zmod_SOURCES) $(modwrite_SOURCES) $(normcode_SOURCES) $(step2vpl_SOURCES) $(stepdump_SOURCES) $(thml2gbs_SOURCES) $(txt2sword_SOURCES) $(vpl2mod_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .lo .o .obj
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu utilities/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+addgb$(EXEEXT): $(addgb_OBJECTS) $(addgb_DEPENDENCIES)
+ @rm -f addgb$(EXEEXT)
+ $(CXXLINK) $(addgb_LDFLAGS) $(addgb_OBJECTS) $(addgb_LDADD) $(LIBS)
+addld$(EXEEXT): $(addld_OBJECTS) $(addld_DEPENDENCIES)
+ @rm -f addld$(EXEEXT)
+ $(CXXLINK) $(addld_LDFLAGS) $(addld_OBJECTS) $(addld_LDADD) $(LIBS)
+addvs$(EXEEXT): $(addvs_OBJECTS) $(addvs_DEPENDENCIES)
+ @rm -f addvs$(EXEEXT)
+ $(CXXLINK) $(addvs_LDFLAGS) $(addvs_OBJECTS) $(addvs_LDADD) $(LIBS)
+cipherraw$(EXEEXT): $(cipherraw_OBJECTS) $(cipherraw_DEPENDENCIES)
+ @rm -f cipherraw$(EXEEXT)
+ $(CXXLINK) $(cipherraw_LDFLAGS) $(cipherraw_OBJECTS) $(cipherraw_LDADD) $(LIBS)
+ciphertest$(EXEEXT): $(ciphertest_OBJECTS) $(ciphertest_DEPENDENCIES)
+ @rm -f ciphertest$(EXEEXT)
+ $(CXXLINK) $(ciphertest_LDFLAGS) $(ciphertest_OBJECTS) $(ciphertest_LDADD) $(LIBS)
+ciphertest2$(EXEEXT): $(ciphertest2_OBJECTS) $(ciphertest2_DEPENDENCIES)
+ @rm -f ciphertest2$(EXEEXT)
+ $(CXXLINK) $(ciphertest2_LDFLAGS) $(ciphertest2_OBJECTS) $(ciphertest2_LDADD) $(LIBS)
+emptyvss$(EXEEXT): $(emptyvss_OBJECTS) $(emptyvss_DEPENDENCIES)
+ @rm -f emptyvss$(EXEEXT)
+ $(CXXLINK) $(emptyvss_LDFLAGS) $(emptyvss_OBJECTS) $(emptyvss_LDADD) $(LIBS)
+imp2gbs$(EXEEXT): $(imp2gbs_OBJECTS) $(imp2gbs_DEPENDENCIES)
+ @rm -f imp2gbs$(EXEEXT)
+ $(CXXLINK) $(imp2gbs_LDFLAGS) $(imp2gbs_OBJECTS) $(imp2gbs_LDADD) $(LIBS)
+imp2ld$(EXEEXT): $(imp2ld_OBJECTS) $(imp2ld_DEPENDENCIES)
+ @rm -f imp2ld$(EXEEXT)
+ $(CXXLINK) $(imp2ld_LDFLAGS) $(imp2ld_OBJECTS) $(imp2ld_LDADD) $(LIBS)
+imp2vs$(EXEEXT): $(imp2vs_OBJECTS) $(imp2vs_DEPENDENCIES)
+ @rm -f imp2vs$(EXEEXT)
+ $(CXXLINK) $(imp2vs_LDFLAGS) $(imp2vs_OBJECTS) $(imp2vs_LDADD) $(LIBS)
+lexdump$(EXEEXT): $(lexdump_OBJECTS) $(lexdump_DEPENDENCIES)
+ @rm -f lexdump$(EXEEXT)
+ $(LINK) $(lexdump_LDFLAGS) $(lexdump_OBJECTS) $(lexdump_LDADD) $(LIBS)
+mkfastmod$(EXEEXT): $(mkfastmod_OBJECTS) $(mkfastmod_DEPENDENCIES)
+ @rm -f mkfastmod$(EXEEXT)
+ $(CXXLINK) $(mkfastmod_LDFLAGS) $(mkfastmod_OBJECTS) $(mkfastmod_LDADD) $(LIBS)
+mod2vpl$(EXEEXT): $(mod2vpl_OBJECTS) $(mod2vpl_DEPENDENCIES)
+ @rm -f mod2vpl$(EXEEXT)
+ $(CXXLINK) $(mod2vpl_LDFLAGS) $(mod2vpl_OBJECTS) $(mod2vpl_LDADD) $(LIBS)
+mod2zmod$(EXEEXT): $(mod2zmod_OBJECTS) $(mod2zmod_DEPENDENCIES)
+ @rm -f mod2zmod$(EXEEXT)
+ $(CXXLINK) $(mod2zmod_LDFLAGS) $(mod2zmod_OBJECTS) $(mod2zmod_LDADD) $(LIBS)
+modwrite$(EXEEXT): $(modwrite_OBJECTS) $(modwrite_DEPENDENCIES)
+ @rm -f modwrite$(EXEEXT)
+ $(CXXLINK) $(modwrite_LDFLAGS) $(modwrite_OBJECTS) $(modwrite_LDADD) $(LIBS)
+normcode$(EXEEXT): $(normcode_OBJECTS) $(normcode_DEPENDENCIES)
+ @rm -f normcode$(EXEEXT)
+ $(CXXLINK) $(normcode_LDFLAGS) $(normcode_OBJECTS) $(normcode_LDADD) $(LIBS)
+step2vpl$(EXEEXT): $(step2vpl_OBJECTS) $(step2vpl_DEPENDENCIES)
+ @rm -f step2vpl$(EXEEXT)
+ $(CXXLINK) $(step2vpl_LDFLAGS) $(step2vpl_OBJECTS) $(step2vpl_LDADD) $(LIBS)
+stepdump$(EXEEXT): $(stepdump_OBJECTS) $(stepdump_DEPENDENCIES)
+ @rm -f stepdump$(EXEEXT)
+ $(CXXLINK) $(stepdump_LDFLAGS) $(stepdump_OBJECTS) $(stepdump_LDADD) $(LIBS)
+thml2gbs$(EXEEXT): $(thml2gbs_OBJECTS) $(thml2gbs_DEPENDENCIES)
+ @rm -f thml2gbs$(EXEEXT)
+ $(CXXLINK) $(thml2gbs_LDFLAGS) $(thml2gbs_OBJECTS) $(thml2gbs_LDADD) $(LIBS)
+txt2sword$(EXEEXT): $(txt2sword_OBJECTS) $(txt2sword_DEPENDENCIES)
+ @rm -f txt2sword$(EXEEXT)
+ $(CXXLINK) $(txt2sword_LDFLAGS) $(txt2sword_OBJECTS) $(txt2sword_LDADD) $(LIBS)
+vpl2mod$(EXEEXT): $(vpl2mod_OBJECTS) $(vpl2mod_DEPENDENCIES)
+ @rm -f vpl2mod$(EXEEXT)
+ $(CXXLINK) $(vpl2mod_LDFLAGS) $(vpl2mod_OBJECTS) $(vpl2mod_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addgb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addld.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addvs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cipherraw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ciphertest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ciphertest2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/emptyvss.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imp2gbs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imp2ld.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imp2vs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lexdump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkfastmod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod2vpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod2zmod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modwrite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/normcode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/step2vpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stepdump.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thml2gbs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/txt2sword.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpl2mod.Po@am__quote@
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c `cygpath -w $<`
+
+.c.lo:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+CCDEPMODE = @CCDEPMODE@
+
+.cpp.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+
+.cpp.lo:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(LTCXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+CXXDEPMODE = @CXXDEPMODE@
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir)$$dir \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS distclean distclean-compile \
+ distclean-depend distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ tags uninstall uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/utilities/addcomment.cpp b/utilities/addcomment.cpp
new file mode 100644
index 0000000..00aa6a8
--- /dev/null
+++ b/utilities/addcomment.cpp
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <iostream.h>
+#include <versekey.h>
+#include <rawtext.h>
+#include <zcom.h>
+#include <rawcom.h>
+#include <rawgbf.h>
+#include <rawfiles.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ int loop;
+ int max;
+ RawFiles personal("modules/comments/rawfiles/personal/", "MINE", "Personal Comments");
+ VerseKey mykey;
+
+ if (argc < 3) {
+ fprintf(stderr, "usage: %s <\"comment\"> <\"verse\"> [count] [disable AutoNormalization]\n", argv[0]);
+ exit(-1);
+ }
+
+ if (argc > 4)
+ mykey.AutoNormalize(0); // Turn off autonormalize if 3 args to allow for intros
+ // This is kludgy but at lease you can try it
+ // with something like: sword "Matthew 1:0" 1 1
+
+ mykey = argv[2];
+ mykey.Persist(1);
+ personal.SetKey(mykey);
+
+ max = (argc < 4) ? 1 : atoi(argv[3]);
+
+ for (loop = 0; loop < max; loop++) {
+ personal << argv[1];
+ mykey++;
+ }
+ cout << "Added Comment\n";
+ return 0;
+}
diff --git a/utilities/addgb.cpp b/utilities/addgb.cpp
new file mode 100644
index 0000000..5925ae0
--- /dev/null
+++ b/utilities/addgb.cpp
@@ -0,0 +1,148 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <entriesblk.h>
+#include <iostream.h>
+#include <string>
+#include <stdio.h>
+#include <treekeyidx.h>
+#include <rawgenbook.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
+ if (!target)
+ target = &treeKey;
+
+ unsigned long currentOffset = target->getOffset();
+ cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
+ for (int i = 0; i < level; i++) cout << "\t";
+ cout << treeKey.getLocalName() << "/\n";
+ if (treeKey.firstChild()) {
+ printTree(treeKey, target, level+1);
+ treeKey.parent();
+ }
+ if (treeKey.nextSibling())
+ printTree(treeKey, target, level);
+
+}
+
+
+int main(int argc, char **argv) {
+
+ const char * helptext ="addgb 1.0 General Book module creation tool for the SWORD Project\nUse -a to add a new leaf entry from standard input or a file\n usage:\n %s -a <filename> <key> [</path/to/file/with/entry>]\n";
+
+ // const char * helptext ="addgb 1.0 General Book module creation tool for the SWORD Project\nUse -a to add a new leaf entry from standard input or a file, -d to delete an\nentry, -l to link two leaf entries.\n usage:\n %s -a <filename> <key> [</path/to/file/with/entry>]\n %s -d <filename> <key>\n %s -l <filename> <first key (already assigned)> <second key>\n";
+
+ char mode;
+ unsigned long entrysize;
+
+ if (argc < 3) {
+ fprintf(stderr, helptext, argv[0]);
+ exit(-1);
+ }
+
+ mode = argv[1][1];
+
+ // Do some initialization stuff
+ TreeKeyIdx *treeKey = new TreeKeyIdx(argv[2]);
+ if (treeKey->Error()) {
+ treeKey->create(argv[2]);
+ delete treeKey;
+ treeKey = new TreeKeyIdx(argv[2]);
+ RawGenBook::createModule(argv[2]);
+ }
+ delete treeKey;
+ RawGenBook *book = new RawGenBook(argv[2]);
+ TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
+ treeKey = (TreeKeyIdx *)(SWKey *)(*book);
+
+ if ((mode == 'a') && (argc == 4 || argc == 5)) {
+ char buffer[1048576]; //this is the max size of any entry
+
+ char* tok = strtok(argv[3], "/");
+ while (tok) {
+ bool foundkey = false;
+ if (treeKey->hasChildren()) {
+ treeKey->firstChild();
+ if (!strcmp(treeKey->getLocalName(), tok)) {
+ foundkey = true;
+ } else {
+ while (treeKey->nextSibling()) {
+ if (treeKey->getLocalName()) {
+ if (!strcmp(treeKey->getLocalName(), tok)) {
+ foundkey = true;
+ }
+ }
+ }
+ }
+ if (!foundkey) {
+ treeKey->append();
+ treeKey->setLocalName(tok);
+ treeKey->save();
+ }
+ }
+ else {
+ treeKey->appendChild();
+ treeKey->setLocalName(tok);
+ treeKey->save();
+ }
+
+ //DEBUG cout << treeKey->getLocalName() << " : " << tok << endl;
+
+ tok = strtok(NULL, "/");
+
+ }
+
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+ book->setentry(buffer, entrysize); // save text to module at current position
+ }
+
+ /*
+ // let's pretend these don't exist for the time being
+
+ // Link 2 verses
+ else if ((mode == 'l') && argc == 5) {
+ *key = argv[3];
+ mod.SetKey(*key);
+
+ SWKey tmpkey = argv[4];
+ mod << &(tmpkey);
+ }
+
+ // Delete an entry
+ else if ((mode == 'd') && argc == 4) {
+ mod.SetKey(argv[3]);
+ mod.deleteEntry();
+ }
+ */
+ // Bad arguments, print usage
+ else {
+ fprintf(stderr, helptext, argv[0]);
+ exit(-1);
+ }
+
+ //DEBUG printTree(root, treeKey);
+
+ delete treeKey;
+ delete book;
+ return 0;
+}
diff --git a/utilities/addld.cpp b/utilities/addld.cpp
new file mode 100644
index 0000000..0c38296
--- /dev/null
+++ b/utilities/addld.cpp
@@ -0,0 +1,196 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swmgr.h>
+#include <rawld.h>
+#include <rawld4.h>
+#include <zld.h>
+#include <zipcomprs.h>
+#include <iostream.h>
+
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+int main(int argc, char **argv) {
+
+ const char * helptext ="addld 1.0 Lexicon & Dictionary module creation tool for the SWORD Project\nUse -a to add a new LD entry from standard input or a file, -d to delete an\nentry, -l to link two LD entries, -c to create a new module.\n usage:\n %s -a <filename> <key> [</path/to/file/with/entry>]\n %s -d <filename> <key>\n %s -l <filename> <first key (already assigned)> <second key>\n %s -c <filename>\nTo use 4-byte LD instead of 2-byte, insert a 4 immediately after the '-'.\nTo use zLD instead of 2-byte, insert a z immediately after the '-'.\n";
+ long entrysize;
+
+ bool fourbyte = false;
+ bool compress = false;
+ char mode;
+
+ if (argc < 3) {
+ fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
+ exit(-1);
+ }
+
+ if (argv[1][1] == '4') {
+ fourbyte = false;
+ mode = argv[1][2];
+ }
+ else if (argv[1][1] == 'z') {
+ compress = true;
+ mode = argv[1][2];
+ }
+ else {
+ mode = argv[1][1];
+ }
+
+ if ((mode == 'a') && (argc == 4 || argc == 5)) {
+
+ // Do some initialization stuff
+ if (fourbyte) {
+ char buffer[1048576]; //this is the max size of any entry
+ RawLD4 mod(argv[2]); // open our datapath with our RawText driver.
+ SWKey* key = mod.CreateKey();
+ key->Persist(1); // the magical setting
+
+ // Set our VerseKey
+ *key = argv[3];
+ mod.SetKey(*key);
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+ mod.setentry(buffer, entrysize); // save text to module at current position
+ }
+ else if (compress) {
+ char buffer[1048576]; //this is the max size of any entry
+ zLD mod(argv[2], 0, 0, 200, new ZipCompress()); // open our datapath with our RawText driver.
+ SWKey* key = mod.CreateKey();
+ key->Persist(1); // the magical setting
+
+ // Set our VerseKey
+ *key = argv[3];
+ mod.SetKey(*key);
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+ mod.setentry(buffer, entrysize); // save text to module at current position
+ }
+ else {
+ char buffer[65536]; //this is the max size of any entry
+ RawLD mod(argv[2]); // open our datapath with our RawText driver.
+ SWKey* key = mod.CreateKey();
+ key->Persist(1); // the magical setting
+
+ // Set our VerseKey
+ *key = argv[3];
+ mod.SetKey(*key);
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+ mod.setentry(buffer, entrysize); // save text to module at current position
+ }
+
+ }
+ // Link 2 verses
+ else if ((mode == 'l') && argc == 5) {
+ // Do some initialization stuff
+ if (fourbyte) {
+ RawLD4 mod(argv[2]); // open our datapath with our RawText driver.
+ SWKey* key = mod.CreateKey();
+ key->Persist(1); // the magical setting
+
+ *key = argv[3];
+ mod.SetKey(*key);
+ SWKey tmpkey = argv[4];
+ mod << &(tmpkey);
+ }
+ else if (compress) {
+ zLD mod(argv[2]); // open our datapath with our RawText driver.
+ SWKey* key = mod.CreateKey();
+ key->Persist(1); // the magical setting
+
+ *key = argv[3];
+ mod.SetKey(*key);
+
+ SWKey tmpkey = argv[4];
+ mod << &(tmpkey);
+ }
+ else {
+ RawLD mod(argv[2]); // open our datapath with our RawText driver.
+ SWKey* key = mod.CreateKey();
+ key->Persist(1); // the magical setting
+
+ *key = argv[3];
+ mod.SetKey(*key);
+
+ SWKey tmpkey = argv[4];
+ mod << &(tmpkey);
+ }
+ }
+ else if ((mode == 'd') && argc == 4) {
+ if (fourbyte) {
+ RawLD4 mod(argv[2]); // open our datapath with our RawText driver.
+ mod.SetKey(argv[3]);
+ mod.deleteEntry();
+ }
+ if (compress) {
+ zLD mod(argv[2]); // open our datapath with our RawText driver.
+ mod.SetKey(argv[3]);
+ mod.deleteEntry();
+ }
+ else {
+ RawLD mod(argv[2]); // open our datapath with our RawText driver.
+ mod.SetKey(argv[3]);
+ mod.deleteEntry();
+ }
+
+ }
+ // Make a new module
+ else if ((mode == 'c') && argc == 3) {
+ // Try to initialize a default set of datafiles and indicies at our
+ // datapath location passed to us from the user.
+ if (fourbyte) {
+ if (RawLD4::createModule(argv[2])) {
+ fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
+ exit(-2);
+ }
+ }
+ if (compress) {
+ if (zLD::createModule(argv[2])) {
+ fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
+ exit(-2);
+ }
+ }
+ else {
+ if (RawLD::createModule(argv[2])) {
+ fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
+ exit(-2);
+ }
+ }
+ }
+
+ // Bad arguments, print usage
+ else {
+ fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
+ exit(-1);
+ }
+}
diff --git a/utilities/addvs.cpp b/utilities/addvs.cpp
new file mode 100644
index 0000000..b8c8cc2
--- /dev/null
+++ b/utilities/addvs.cpp
@@ -0,0 +1,181 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swmgr.h>
+#include <rawtext.h>
+#include <iostream.h>
+
+
+#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";
+ long entrysize;
+
+ if (argc < 3) {
+ fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
+ exit(-1);
+ }
+ if (!strcmp(argv[1], "-a") && (argc == 4 || argc == 5)) {
+
+ // Do some initialization stuff
+ char buffer[65536]; //this is the max size of any entry
+ RawText * mod = new RawText(argv[2]); // open our datapath with our RawText driver.
+ VerseKey *vkey = new VerseKey;
+ vkey->Headings(1);
+ vkey->AutoNormalize(0);
+ vkey->Persist(1); // the magical setting
+ *vkey = argv[3];
+ // Set our VerseKey
+ mod->SetKey(*vkey);
+ if (!vkey->Chapter()) {
+ // bad hack >>
+ // 0:0 is Book intro
+ // (chapter):0 is Chapter intro
+ //
+ // 0:2 is Module intro
+ // 0:1 is Testament intro
+ int backstep = vkey->Verse();
+ vkey->Verse(0);
+ *mod -= backstep;
+ // << bad hack
+
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+
+ mod->setentry(buffer, entrysize); // save text to module at current position
+ }
+ else {
+ ListKey listkey = vkey->ParseVerseList(argv[3], "Gen1:1", true);
+ int i;
+ bool havefirst = false;
+ VerseKey firstverse;
+ for (i = 0; i < listkey.Count(); i++) {
+ VerseKey *element = SWDYNAMIC_CAST(VerseKey, listkey.GetElement(i));
+ if (element) {
+ mod->Key(element->LowerBound());
+ VerseKey finalkey = element->UpperBound();
+ cout << (const char*)mod->Key() << "-" << (const char*)finalkey << endl;
+ if (!havefirst) {
+ havefirst = true;
+ firstverse = mod->Key();
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+
+ ((SWModule*)mod)->setentry(buffer, entrysize); // save text to module at current position
+ cout << "f" << (const char*)firstverse << endl;
+ (*mod)++;
+ }
+ while (mod->Key() <= finalkey) {
+ cout << (const char*)mod->Key() << endl;
+ *(SWModule*)mod << &firstverse;
+ (*mod)++;
+ }
+ }
+ else {
+ if (havefirst) {
+ mod->Key(*listkey.GetElement(i));
+ *(SWModule*)mod << &firstverse;
+ cout << (const char*)mod->Key() << endl;
+ }
+ else {
+ mod->Key(*listkey.GetElement(i));
+ havefirst = true;
+ firstverse = mod->Key();
+ FILE *infile;
+ // case: add from text file
+ //Open our data file and read its contents into the buffer
+ if (argc == 5) infile = fopen(argv[4], "r");
+ // case: add from stdin
+ else infile = stdin;
+
+ entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+
+ ((SWModule*)mod)->setentry(buffer, entrysize); // save text to module at current position
+ cout << "f" << (const char*)firstverse << endl;
+ }
+ }
+ }
+ }
+ delete vkey;
+ }
+ // Link 2 verses
+ else if (!strcmp(argv[1], "-l") && argc == 5) {
+ // Do some initialization stuff
+ RawText *mod = new RawText(argv[2]); // open our datapath with our RawText driver.
+
+ mod->SetKey(argv[4]); // set key from argument
+ SWKey tmpkey = (SWKey) argv[3];
+ *(SWModule*)mod << &(tmpkey);
+ delete mod;
+ }
+
+ else if (!strcmp(argv[1], "-d") && argc == 4) {
+ RawText mod(argv[2]); // open our datapath with our RawText driver.
+ VerseKey *vkey = new VerseKey;
+ vkey->Headings(1);
+ vkey->AutoNormalize(0);
+ vkey->Persist(1); // the magical setting
+
+ // Set our VerseKey
+ mod.SetKey(*vkey);
+ *vkey = argv[3];
+
+ if (!vkey->Chapter())
+ {
+ // bad hack >>
+ // 0:0 is Book intro
+ // (chapter):0 is Chapter intro
+ //
+ // 0:2 is Module intro
+ // 0:1 is Testament intro
+ int backstep = vkey->Verse();
+ vkey->Verse(0);
+ mod -= backstep;
+ // << bad hack
+ }
+
+ mod.deleteEntry();
+ delete vkey;
+ }
+
+ // Make a new module
+ else if (!strcmp(argv[1], "-c") && argc == 3) {
+ // Try to initialize a default set of datafiles and indicies at our
+ // datapath location passed to us from the user.
+ if (RawText::createModule(argv[2])) {
+ fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
+ exit(-2);
+ }
+ }
+
+ // Bad arguments, print usage
+ else {
+ fprintf(stderr, helptext, argv[0], argv[0], argv[0], argv[0]);
+ exit(-1);
+ }
+}
diff --git a/utilities/bcppmake/diatheke.bpf b/utilities/bcppmake/diatheke.bpf
new file mode 100644
index 0000000..d80339c
--- /dev/null
+++ b/utilities/bcppmake/diatheke.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\..\apps\console\diatheke\diatheke.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/diatheke.bpr b/utilities/bcppmake/diatheke.bpr
new file mode 100644
index 0000000..0096a79
--- /dev/null
+++ b/utilities/bcppmake/diatheke.bpr
@@ -0,0 +1,110 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="diatheke.exe"/>
+ <OBJFILES value="..\..\apps\console\diatheke\diatheke.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;..\..\apps\console\diatheke"/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value="_DEBUG"/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL;USEPACKAGES"/>
+ <MAINSOURCE value="diatheke.bpf"/>
+ <INCLUDEPATH value="..\..\apps\console\diatheke;$(BCB)\include;$(BCB)\include\vcl;..\..\include"/>
+ <LIBPATH value="..\..\apps\console\diatheke;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC
+ -tWM -c"/>
+ <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zd"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn -v"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=2
+Item0=..\..\apps\console\diatheke;$(BCB)\include;$(BCB)\include\vcl;..\..\include\
+Item1=..\..\apps\console\diatheke;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=1
+Item0=..\..\apps\console\diatheke;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/imp2gbs.bpf b/utilities/bcppmake/imp2gbs.bpf
new file mode 100644
index 0000000..6c7f388
--- /dev/null
+++ b/utilities/bcppmake/imp2gbs.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\imp2gbs.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/imp2gbs.bpr b/utilities/bcppmake/imp2gbs.bpr
new file mode 100644
index 0000000..e6de082
--- /dev/null
+++ b/utilities/bcppmake/imp2gbs.bpr
@@ -0,0 +1,113 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="imp2gbs.exe"/>
+ <OBJFILES value="..\imp2gbs.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="imp2gbs.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -S:0x300000 -Sc:0x20000 -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=4
+Item0=..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item3=..\..\utilities;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=3
+Item0=..\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/imp2ld.bpf b/utilities/bcppmake/imp2ld.bpf
new file mode 100644
index 0000000..6d5b1ad
--- /dev/null
+++ b/utilities/bcppmake/imp2ld.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\imp2ld.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/imp2ld.bpr b/utilities/bcppmake/imp2ld.bpr
new file mode 100644
index 0000000..408f516
--- /dev/null
+++ b/utilities/bcppmake/imp2ld.bpr
@@ -0,0 +1,113 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="imp2ld.exe"/>
+ <OBJFILES value="..\imp2ld.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="imp2ld.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -S:0x300000 -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=4
+Item0=..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item3=..\..\utilities;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=3
+Item0=..\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/imp2vs.bpf b/utilities/bcppmake/imp2vs.bpf
new file mode 100644
index 0000000..ab348be
--- /dev/null
+++ b/utilities/bcppmake/imp2vs.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\imp2vs.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/imp2vs.bpr b/utilities/bcppmake/imp2vs.bpr
new file mode 100644
index 0000000..ab1ae50
--- /dev/null
+++ b/utilities/bcppmake/imp2vs.bpr
@@ -0,0 +1,113 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="imp2vs.exe"/>
+ <OBJFILES value="..\imp2vs.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="imp2vs.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -S:0x300000 -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=4
+Item0=..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item3=..\..\utilities;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=3
+Item0=..\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/libsword.bpf b/utilities/bcppmake/libsword.bpf
new file mode 100644
index 0000000..04f25c3
--- /dev/null
+++ b/utilities/bcppmake/libsword.bpf
@@ -0,0 +1,113 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+USEUNIT("..\..\src\keys\versekey.cpp");
+USEUNIT("..\..\src\keys\strkey.cpp");
+USEUNIT("..\..\src\keys\swkey.cpp");
+USEUNIT("..\..\src\keys\listkey.cpp");
+USEUNIT("..\..\src\mgr\swmgr.cpp");
+USEUNIT("..\..\src\mgr\localemgr.cpp");
+USEUNIT("..\..\src\mgr\swconfig.cpp");
+USEUNIT("..\..\src\mgr\swlocale.cpp");
+USEUNIT("..\..\src\mgr\filemgr.cpp");
+USEUNIT("..\..\src\utilfuns\utilstr.cpp");
+USEUNIT("..\..\src\utilfuns\utilconf.cpp");
+USEUNIT("..\..\src\utilfuns\Greek2Greek.cpp");
+USEUNIT("..\..\src\frontend\swlog.cpp");
+USEUNIT("..\..\src\frontend\swdisp.cpp");
+USEUNIT("..\..\src\modules\swmodule.cpp");
+USEUNIT("..\..\src\modules\comments\swcom.cpp");
+USEUNIT("..\..\src\modules\comments\hrefcom\hrefcom.cpp");
+USEUNIT("..\..\src\modules\comments\rawcom\rawcom.cpp");
+USEUNIT("..\..\src\modules\comments\rawfiles\rawfiles.cpp");
+USEUNIT("..\..\src\modules\common\lzsscomprs.cpp");
+USEUNIT("..\..\src\modules\common\rawstr.cpp");
+USEUNIT("..\..\src\modules\common\rawverse.cpp");
+USEUNIT("..\..\src\modules\common\sapphire.cpp");
+USEUNIT("..\..\src\modules\common\swcipher.cpp");
+USEUNIT("..\..\src\modules\common\swcomprs.cpp");
+USEUNIT("..\..\src\modules\filters\thmlrtf.cpp");
+USEUNIT("..\..\src\modules\filters\gbffootnotes.cpp");
+USEUNIT("..\..\src\modules\filters\gbfhtml.cpp");
+USEUNIT("..\..\src\modules\filters\gbfplain.cpp");
+USEUNIT("..\..\src\modules\filters\gbfrtf.cpp");
+USEUNIT("..\..\src\modules\filters\gbfstrongs.cpp");
+USEUNIT("..\..\src\modules\filters\gbfthml.cpp");
+USEUNIT("..\..\src\modules\filters\plainfootnotes.cpp");
+USEUNIT("..\..\src\modules\filters\plainhtml.cpp");
+USEUNIT("..\..\src\modules\filters\rtfhtml.cpp");
+USEUNIT("..\..\src\modules\filters\rwphtml.cpp");
+USEUNIT("..\..\src\modules\filters\rwprtf.cpp");
+USEUNIT("..\..\src\modules\filters\thmlgbf.cpp");
+USEUNIT("..\..\src\modules\filters\thmlhtml.cpp");
+USEUNIT("..\..\src\modules\filters\thmlplain.cpp");
+USEUNIT("..\..\src\modules\filters\cipherfil.cpp");
+USEUNIT("..\..\src\modules\lexdict\swld.cpp");
+USEUNIT("..\..\src\modules\lexdict\rawld\rawld.cpp");
+USEUNIT("..\..\src\modules\texts\swtext.cpp");
+USEUNIT("..\..\src\modules\texts\rawtext\rawtext.cpp");
+USEUNIT("..\..\src\modules\texts\ztext\ztext.cpp");
+USEUNIT("..\..\src\modules\common\zverse.cpp");
+USEUNIT("..\..\src\keys\treekey.cpp");
+USEUNIT("..\..\src\keys\treekeyidx.cpp");
+USEUNIT("..\..\src\modules\common\rawstr4.cpp");
+USEUNIT("..\..\src\modules\common\zstr.cpp");
+USEUNIT("..\..\src\modules\genbook\swgenbook.cpp");
+USEUNIT("..\..\src\modules\genbook\rawgenbook\rawgenbook.cpp");
+USEUNIT("..\..\src\mgr\swfiltermgr.cpp");
+USEUNIT("..\..\src\modules\filters\utf8utf16.cpp");
+USEUNIT("..\..\src\modules\filters\gbfheadings.cpp");
+USEUNIT("..\..\src\modules\filters\gbfhtmlhref.cpp");
+USEUNIT("..\..\src\modules\filters\gbfmorph.cpp");
+USEUNIT("..\..\src\modules\filters\latin1utf16.cpp");
+USEUNIT("..\..\src\modules\filters\latin1utf8.cpp");
+USEUNIT("..\..\src\modules\filters\scsuutf8.cpp");
+USEUNIT("..\..\src\modules\filters\swbasicfilter.cpp");
+USEUNIT("..\..\src\modules\filters\thmlfootnotes.cpp");
+USEUNIT("..\..\src\modules\filters\thmlheadings.cpp");
+USEUNIT("..\..\src\modules\filters\thmlhtmlhref.cpp");
+USEUNIT("..\..\src\modules\filters\thmllemma.cpp");
+USEUNIT("..\..\src\modules\filters\thmlmorph.cpp");
+USEUNIT("..\..\src\modules\filters\thmlolb.cpp");
+USEUNIT("..\..\src\modules\filters\thmlscripref.cpp");
+USEUNIT("..\..\src\modules\filters\thmlstrongs.cpp");
+USEUNIT("..\..\src\modules\filters\thmlvariants.cpp");
+USEUNIT("..\..\src\modules\filters\unicodertf.cpp");
+USEUNIT("..\..\src\modules\filters\utf16utf8.cpp");
+USEUNIT("..\..\src\modules\filters\utf8arshaping.cpp");
+USEUNIT("..\..\src\modules\filters\utf8bidireorder.cpp");
+USEUNIT("..\..\src\modules\filters\utf8cantillation.cpp");
+USEUNIT("..\..\src\modules\filters\utf8greekaccents.cpp");
+USEUNIT("..\..\src\modules\filters\utf8hebrewpoints.cpp");
+USEUNIT("..\..\src\modules\filters\utf8html.cpp");
+USEUNIT("..\..\src\modules\filters\utf8latin1.cpp");
+USEUNIT("..\..\src\modules\filters\utf8nfc.cpp");
+USEUNIT("..\..\src\modules\filters\utf8nfkd.cpp");
+USEUNIT("..\..\src\modules\filters\utf8transliterator.cpp");
+USEUNIT("..\..\src\utilfuns\roman.c");
+USEUNIT("..\..\src\modules\comments\zcom\zcom.cpp");
+USEUNIT("..\..\src\modules\lexdict\rawld4\rawld4.cpp");
+USEUNIT("..\..\src\modules\common\zipcomprs.cpp");
+USEUNIT("..\..\src\modules\lexdict\zld\zld.cpp");
+USEUNIT("..\..\src\modules\common\entriesblk.cpp");
+USEUNIT("..\..\src\utilfuns\zlib\zutil.c");
+USEUNIT("..\..\src\utilfuns\zlib\compress.c");
+USEUNIT("..\..\src\utilfuns\zlib\crc32.c");
+USEUNIT("..\..\src\utilfuns\zlib\deflate.c");
+USEUNIT("..\..\src\utilfuns\zlib\gzio.c");
+USEUNIT("..\..\src\utilfuns\zlib\infblock.c");
+USEUNIT("..\..\src\utilfuns\zlib\infcodes.c");
+USEUNIT("..\..\src\utilfuns\zlib\inffast.c");
+USEUNIT("..\..\src\utilfuns\zlib\inflate.c");
+USEUNIT("..\..\src\utilfuns\zlib\inftrees.c");
+USEUNIT("..\..\src\utilfuns\zlib\infutil.c");
+USEUNIT("..\..\src\utilfuns\zlib\trees.c");
+USEUNIT("..\..\src\utilfuns\zlib\uncompr.c");
+USEUNIT("..\..\src\utilfuns\zlib\untgz.c");
+USEUNIT("..\..\src\utilfuns\zlib\adler32.c");
+//---------------------------------------------------------------------------
+#define Library
+
+// To add a file to the library use the Project menu 'Add to Project'.
+
diff --git a/utilities/bcppmake/libsword.bpr b/utilities/bcppmake/libsword.bpr
new file mode 100644
index 0000000..90220e0
--- /dev/null
+++ b/utilities/bcppmake/libsword.bpr
@@ -0,0 +1,193 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="libsword.lib"/>
+ <OBJFILES value="..\..\src\keys\versekey.obj ..\..\src\keys\strkey.obj
+ ..\..\src\keys\swkey.obj ..\..\src\keys\listkey.obj
+ ..\..\src\mgr\swmgr.obj ..\..\src\mgr\localemgr.obj
+ ..\..\src\mgr\swconfig.obj ..\..\src\mgr\swlocale.obj
+ ..\..\src\mgr\filemgr.obj ..\..\src\utilfuns\utilstr.obj
+ ..\..\src\utilfuns\utilconf.obj ..\..\src\utilfuns\Greek2Greek.obj
+ ..\..\src\frontend\swlog.obj ..\..\src\frontend\swdisp.obj
+ ..\..\src\modules\swmodule.obj ..\..\src\modules\comments\swcom.obj
+ ..\..\src\modules\comments\hrefcom\hrefcom.obj
+ ..\..\src\modules\comments\rawcom\rawcom.obj
+ ..\..\src\modules\comments\rawfiles\rawfiles.obj
+ ..\..\src\modules\common\lzsscomprs.obj
+ ..\..\src\modules\common\rawstr.obj ..\..\src\modules\common\rawverse.obj
+ ..\..\src\modules\common\sapphire.obj
+ ..\..\src\modules\common\swcipher.obj ..\..\src\modules\common\swcomprs.obj
+ ..\..\src\modules\filters\thmlrtf.obj
+ ..\..\src\modules\filters\gbffootnotes.obj
+ ..\..\src\modules\filters\gbfhtml.obj
+ ..\..\src\modules\filters\gbfplain.obj
+ ..\..\src\modules\filters\gbfrtf.obj ..\..\src\modules\filters\gbfstrongs.obj
+ ..\..\src\modules\filters\gbfthml.obj
+ ..\..\src\modules\filters\plainfootnotes.obj
+ ..\..\src\modules\filters\plainhtml.obj
+ ..\..\src\modules\filters\rtfhtml.obj
+ ..\..\src\modules\filters\rwphtml.obj ..\..\src\modules\filters\rwprtf.obj
+ ..\..\src\modules\filters\thmlgbf.obj
+ ..\..\src\modules\filters\thmlhtml.obj
+ ..\..\src\modules\filters\thmlplain.obj
+ ..\..\src\modules\filters\cipherfil.obj ..\..\src\modules\lexdict\swld.obj
+ ..\..\src\modules\lexdict\rawld\rawld.obj
+ ..\..\src\modules\texts\swtext.obj
+ ..\..\src\modules\texts\rawtext\rawtext.obj
+ ..\..\src\modules\texts\ztext\ztext.obj
+ ..\..\src\modules\common\zverse.obj ..\..\src\keys\treekey.obj
+ ..\..\src\keys\treekeyidx.obj ..\..\src\modules\common\rawstr4.obj
+ ..\..\src\modules\common\zstr.obj ..\..\src\modules\genbook\swgenbook.obj
+ ..\..\src\modules\genbook\rawgenbook\rawgenbook.obj
+ ..\..\src\mgr\swfiltermgr.obj ..\..\src\modules\filters\utf8utf16.obj
+ ..\..\src\modules\filters\gbfheadings.obj
+ ..\..\src\modules\filters\gbfhtmlhref.obj
+ ..\..\src\modules\filters\gbfmorph.obj
+ ..\..\src\modules\filters\latin1utf16.obj
+ ..\..\src\modules\filters\latin1utf8.obj
+ ..\..\src\modules\filters\scsuutf8.obj
+ ..\..\src\modules\filters\swbasicfilter.obj
+ ..\..\src\modules\filters\thmlfootnotes.obj
+ ..\..\src\modules\filters\thmlheadings.obj
+ ..\..\src\modules\filters\thmlhtmlhref.obj
+ ..\..\src\modules\filters\thmllemma.obj
+ ..\..\src\modules\filters\thmlmorph.obj
+ ..\..\src\modules\filters\thmlolb.obj
+ ..\..\src\modules\filters\thmlscripref.obj
+ ..\..\src\modules\filters\thmlstrongs.obj
+ ..\..\src\modules\filters\thmlvariants.obj
+ ..\..\src\modules\filters\unicodertf.obj
+ ..\..\src\modules\filters\utf16utf8.obj
+ ..\..\src\modules\filters\utf8arshaping.obj
+ ..\..\src\modules\filters\utf8bidireorder.obj
+ ..\..\src\modules\filters\utf8cantillation.obj
+ ..\..\src\modules\filters\utf8greekaccents.obj
+ ..\..\src\modules\filters\utf8hebrewpoints.obj
+ ..\..\src\modules\filters\utf8html.obj
+ ..\..\src\modules\filters\utf8latin1.obj
+ ..\..\src\modules\filters\utf8nfc.obj
+ ..\..\src\modules\filters\utf8nfkd.obj
+ ..\..\src\modules\filters\utf8transliterator.obj
+ ..\..\src\utilfuns\roman.obj ..\..\src\modules\comments\zcom\zcom.obj
+ ..\..\src\modules\lexdict\rawld4\rawld4.obj
+ ..\..\src\modules\common\zipcomprs.obj
+ ..\..\src\modules\lexdict\zld\zld.obj
+ ..\..\src\modules\common\entriesblk.obj ..\..\src\utilfuns\zlib\zutil.obj
+ ..\..\src\utilfuns\zlib\compress.obj ..\..\src\utilfuns\zlib\crc32.obj
+ ..\..\src\utilfuns\zlib\deflate.obj ..\..\src\utilfuns\zlib\gzio.obj
+ ..\..\src\utilfuns\zlib\infblock.obj ..\..\src\utilfuns\zlib\infcodes.obj
+ ..\..\src\utilfuns\zlib\inffast.obj ..\..\src\utilfuns\zlib\inflate.obj
+ ..\..\src\utilfuns\zlib\inftrees.obj ..\..\src\utilfuns\zlib\infutil.obj
+ ..\..\src\utilfuns\zlib\trees.obj ..\..\src\utilfuns\zlib\uncompr.obj
+ ..\..\src\utilfuns\zlib\untgz.obj ..\..\src\utilfuns\zlib\adler32.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value=""/>
+ <LIBRARIES value=""/>
+ <PACKAGES value=""/>
+ <PATHCPP value=".;..\..\src\keys;..\..\src\mgr;..\..\src\utilfuns;..\..\src\frontend;..\..\src\modules;..\..\src\modules\comments;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\rawfiles;..\..\src\modules\common;..\..\src\modules\filters;..\..\src\modules\lexdict;..\..\src\modules\lexdict\rawld;..\..\src\modules\texts;..\..\src\modules\texts\rawtext;..\..\src\modules\texts\ztext;..\..\src\modules\genbook;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\comments\zcom;..\..\src\modules\lexdict\rawld4;..\..\src\modules\lexdict\zld;..\..\src\utilfuns\zlib"/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <LINKER value="TLib"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT"/>
+ <MAINSOURCE value="libsword.bpf"/>
+ <INCLUDEPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ <LISTFILE value=""/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="/P512"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="$(OBJFILES)"/>
+ <ALLLIB value="cg32.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=5
+Item0=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item3=..\include;$(BCB)\include;$(BCB)\include\vcl
+Item4=..\src\modules\texts\rawtext;..\src\modules\texts;..\src\modules\lexdict\rawld;..\src\modules\lexdict;..\src\modules\filters;..\src\modules\common;..\src\modules\comments\rawfiles;..\src\modules\comments\rawcom;..\src\modules\comments\hrefcom;..\src\modules\comments;..\src\modules;..\src\frontend;..\src\utilfuns;..\src\mgr;..\src\keys;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=4
+Item0=..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;$(BCB)\lib\obj;$(BCB)\lib
+Item3=..\src\modules\texts\rawtext;..\src\modules\texts;..\src\modules\lexdict\rawld;..\src\modules\lexdict;..\src\modules\filters;..\src\modules\common;..\src\modules\comments\rawfiles;..\src\modules\comments\rawcom;..\src\modules\comments\hrefcom;..\src\modules\comments;..\src\modules;..\src\frontend;..\src\utilfuns;..\src\mgr;..\src\keys;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[HistoryLists\hlTlibPageSize]
+Count=5
+Item0=0x0200
+Item1=0x0080
+Item2=0x0040
+Item3=0x0020
+Item4=0x0010
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/mkfastmod.bpf b/utilities/bcppmake/mkfastmod.bpf
new file mode 100644
index 0000000..f1ad852
--- /dev/null
+++ b/utilities/bcppmake/mkfastmod.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\mkfastmod.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/mkfastmod.bpr b/utilities/bcppmake/mkfastmod.bpr
new file mode 100644
index 0000000..1312ede
--- /dev/null
+++ b/utilities/bcppmake/mkfastmod.bpr
@@ -0,0 +1,111 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="mkfastmod.exe"/>
+ <OBJFILES value="..\mkfastmod.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="mkfastmod.bpf"/>
+ <INCLUDEPATH value="..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=3
+Item0=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=2
+Item0=..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=KJV
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/mod2vpl.bpf b/utilities/bcppmake/mod2vpl.bpf
new file mode 100644
index 0000000..869327c
--- /dev/null
+++ b/utilities/bcppmake/mod2vpl.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\mod2vpl.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/mod2vpl.bpr b/utilities/bcppmake/mod2vpl.bpr
new file mode 100644
index 0000000..80f3e60
--- /dev/null
+++ b/utilities/bcppmake/mod2vpl.bpr
@@ -0,0 +1,111 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="mod2vpl.exe"/>
+ <OBJFILES value="..\mod2vpl.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="mod2vpl.bpf"/>
+ <INCLUDEPATH value="..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=3
+Item0=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=2
+Item0=..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/mod2zmod.bpf b/utilities/bcppmake/mod2zmod.bpf
new file mode 100644
index 0000000..e9b585e
--- /dev/null
+++ b/utilities/bcppmake/mod2zmod.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\mod2zmod.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/mod2zmod.bpr b/utilities/bcppmake/mod2zmod.bpr
new file mode 100644
index 0000000..44dc7cc
--- /dev/null
+++ b/utilities/bcppmake/mod2zmod.bpr
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="mod2zmod.exe"/>
+ <OBJFILES value="..\mod2zmod.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="mod2zmod.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=3
+Item0=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..\..\utilities;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=3
+Item0=..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/thml2gbs.bpf b/utilities/bcppmake/thml2gbs.bpf
new file mode 100644
index 0000000..0c5e1bc
--- /dev/null
+++ b/utilities/bcppmake/thml2gbs.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\thml2gbs.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/thml2gbs.bpr b/utilities/bcppmake/thml2gbs.bpr
new file mode 100644
index 0000000..3efe248
--- /dev/null
+++ b/utilities/bcppmake/thml2gbs.bpr
@@ -0,0 +1,114 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="thml2gbs.exe"/>
+ <OBJFILES value="..\thml2gbs.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
+ ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
+ VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi Indy50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value="_DEBUG"/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL;USEPACKAGES"/>
+ <MAINSOURCE value="thml2gbs.bpf"/>
+ <INCLUDEPATH value="..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..;C:\INDY\C5\;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWC
+ -tWM- -c"/>
+ <PFLAGS value="-$YD -$W -$O- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zd"/>
+ <LFLAGS value="-D&quot;&quot; -S:0x200000 -Sc:0x20000 -ap -Tpe -x -Gn -v"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(PACKAGES) $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=4
+Item0=..\;..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..\;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=../../include;$(BCB)\include;$(BCB)\include\vcl
+Item3=..\;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=3
+Item0=..\;C:\INDY\C5\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item1=C:\INDY\C5;..\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item2=..\;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/bcppmake/utilities.bpg b/utilities/bcppmake/utilities.bpg
new file mode 100644
index 0000000..9a54bf0
--- /dev/null
+++ b/utilities/bcppmake/utilities.bpg
@@ -0,0 +1,58 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = libsword.lib mod2vpl.exe vpl2mod.exe mkfastmod.exe diatheke.exe \
+ imp2gbs.exe imp2ld.exe imp2vs.exe thml2gbs.exe mod2zmod.exe
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+libsword.lib: libsword.bpr
+ $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+mod2vpl.exe: mod2vpl.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+vpl2mod.exe: vpl2mod.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+mkfastmod.exe: mkfastmod.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+diatheke.exe: diatheke.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+imp2gbs.exe: imp2gbs.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+imp2ld.exe: imp2ld.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+imp2vs.exe: imp2vs.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+thml2gbs.exe: thml2gbs.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+mod2zmod.exe: mod2zmod.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+
diff --git a/utilities/bcppmake/vpl2mod.bpf b/utilities/bcppmake/vpl2mod.bpf
new file mode 100644
index 0000000..9dff153
--- /dev/null
+++ b/utilities/bcppmake/vpl2mod.bpf
@@ -0,0 +1,6 @@
+USEUNIT("..\vpl2mod.cpp");
+USELIB("libsword.lib");
+//---------------------------------------------------------------------------
+This file is used by the project manager only and should be treated like the project file
+
+ main \ No newline at end of file
diff --git a/utilities/bcppmake/vpl2mod.bpr b/utilities/bcppmake/vpl2mod.bpr
new file mode 100644
index 0000000..8c9ccca
--- /dev/null
+++ b/utilities/bcppmake/vpl2mod.bpr
@@ -0,0 +1,111 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="vpl2mod.exe"/>
+ <OBJFILES value="..\vpl2mod.obj"/>
+ <RESFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES)"/>
+ <LIBFILES value="libsword.lib"/>
+ <LIBRARIES value=""/>
+ <SPARELIBS value=""/>
+ <PACKAGES value="VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi
+ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi
+ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi
+ dclocx50.bpi bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;.."/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT;_NO_VCL"/>
+ <MAINSOURCE value="vpl2mod.bpf"/>
+ <INCLUDEPATH value="..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl"/>
+ <LIBPATH value="..\;..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -tWC -tWM -c"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -ap -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0x32.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=0
+AutoIncBuild=0
+MajorVer=1
+MinorVer=0
+Release=0
+Build=0
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=
+FileDescription=
+FileVersion=1.0.0.0
+InternalName=
+LegalCopyright=
+LegalTrademarks=
+OriginalFilename=
+ProductName=
+ProductVersion=1.0.0.0
+Comments=
+
+[HistoryLists\hlIncludePath]
+Count=3
+Item0=..\;..\..\utilities;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item1=..;..\..\include;$(BCB)\include;$(BCB)\include\vcl
+Item2=..\..\utilities;$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=2
+Item0=..\;..;$(BCB)\lib\obj;$(BCB)\lib
+Item1=..\..\utilities;$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/utilities/cipherraw.cpp b/utilities/cipherraw.cpp
new file mode 100644
index 0000000..1049689
--- /dev/null
+++ b/utilities/cipherraw.cpp
@@ -0,0 +1,100 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swcipher.h>
+#include <versekey.h>
+#include <rawverse.h>
+
+
+int main(int argc, char **argv) {
+ SWCipher *zobj;
+ VerseKey key;
+ RawVerse *rawdrv;
+ int ofd[2], oxfd[2];
+ long tmpoff = 0, offset, loffset = 0, lzoffset = 0;
+ unsigned short size, lsize = 0, lzsize;
+ char *tmpbuf;
+
+ if (argc != 3) {
+ printf("%d %d\n", sizeof(long), sizeof(unsigned short));
+ fprintf(stderr, "usage: %s <datapath> \"<key>\"\n", argv[0]);
+ exit(1);
+ }
+
+ rawdrv = new RawVerse(argv[1]);
+ zobj = new SWCipher((unsigned char *)argv[2]);
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+ tmpbuf = new char [ strlen(argv[1]) + 11 ];
+ sprintf(tmpbuf, "%sot.zzz", argv[1]);
+ ofd[0] = open(tmpbuf, O_WRONLY|O_BINARY|O_CREAT);
+ sprintf(tmpbuf, "%sot.zzz.vss", argv[1]);
+ oxfd[0] = open(tmpbuf, O_WRONLY|O_BINARY|O_CREAT);
+ sprintf(tmpbuf, "%snt.zzz", argv[1]);
+ ofd[1] = open(tmpbuf, O_WRONLY|O_BINARY|O_CREAT);
+ sprintf(tmpbuf, "%snt.zzz.vss", argv[1]);
+ oxfd[1] = open(tmpbuf, O_WRONLY|O_BINARY|O_CREAT);
+
+ delete [] tmpbuf;
+
+ printf("\n");
+ write(oxfd[0], &lzoffset, 4);
+ write(oxfd[0], &lzsize, 2);
+ write(oxfd[1], &lzoffset, 4);
+ write(oxfd[1], &lzsize, 2);
+
+ key.AutoNormalize(0);
+ key.Headings(1);
+ for (key.Index(0); (!key.Error()); key++) {
+ rawdrv->findoffset(key.Testament(), key.Index(), &offset, &size);
+ printf("%s: OLD offset: %d; size: %d\n", (const char *)key, offset, size);
+
+ if ((offset == loffset) && (size == lsize)) {
+ printf("using previous offset,size\n", size);
+ offset = lseek(oxfd[key.Testament() - 1], 0, SEEK_CUR);
+ printf("%ld %ld %d \n", offset, lzoffset, lzsize);
+ write(oxfd[key.Testament() - 1], &lzoffset, 4);
+ write(oxfd[key.Testament() - 1], &lzsize, 2);
+ }
+ else {
+ lsize = size;
+ loffset = offset;
+
+ if (size) {
+ tmpbuf = (char *) calloc(size + 2, 1);
+ rawdrv->gettext(key.Testament(), offset, size + 2, tmpbuf);
+ zobj->Buf(tmpbuf, size);
+ zobj->cipherBuf((unsigned int *)&size);
+ free(tmpbuf);
+ }
+ offset = lseek(ofd[key.Testament() - 1], 0, SEEK_CUR);
+ tmpoff = lseek(oxfd[key.Testament() - 1], 0, SEEK_CUR);
+ printf("%s: (%ld) NEW offset: %ld; size: %d\n", (const char *)key, tmpoff, offset, size);
+ write(oxfd[key.Testament() - 1], &offset, 4);
+ if (size)
+ write(ofd[key.Testament() - 1], zobj->cipherBuf((unsigned int *)&size), size);
+ lzoffset = offset;
+ write(oxfd[key.Testament() - 1], &size, 2);
+ lzsize = size;
+ }
+ }
+ delete zobj;
+ close(ofd[0]);
+ close(oxfd[0]);
+ close(ofd[1]);
+ close(oxfd[1]);
+ return 0;
+}
diff --git a/utilities/ciphertest.cpp b/utilities/ciphertest.cpp
new file mode 100644
index 0000000..da4c422
--- /dev/null
+++ b/utilities/ciphertest.cpp
@@ -0,0 +1,55 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swcipher.h>
+#include <versekey.h>
+#include <rawverse.h>
+
+
+int main(int argc, char **argv) {
+ SWCipher *zobj;
+ VerseKey key;
+ RawVerse *rawdrv;
+ long offset;
+ unsigned short size;
+ unsigned int len;
+ char *tmpbuf;
+
+ if (argc != 3) {
+ fprintf(stderr, "usage: %s <datapath> \"<key>\"\n", argv[0]);
+ exit(1);
+ }
+
+ rawdrv = new RawVerse(argv[1]);
+ zobj = new SWCipher((unsigned char *)argv[2]);
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+
+ printf("\n");
+
+ key.AutoNormalize(0);
+ key.Headings(1);
+ for (key.Index(0); (!key.Error()); key++) {
+ rawdrv->findoffset(key.Testament(), key.Index(), &offset, &size);
+ tmpbuf = (char *) calloc(size + 2, 1);
+ rawdrv->gettext(key.Testament(), offset, size + 2, tmpbuf);
+ len = size;
+ zobj->cipherBuf(&len, tmpbuf);
+ printf("%s\n", zobj->Buf());
+ free(tmpbuf);
+ }
+ delete zobj;
+ return 0;
+}
diff --git a/utilities/ciphertest2.cpp b/utilities/ciphertest2.cpp
new file mode 100644
index 0000000..5c7014e
--- /dev/null
+++ b/utilities/ciphertest2.cpp
@@ -0,0 +1,39 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <cipherfil.h>
+#include <versekey.h>
+#include <rawtext.h>
+
+
+int main(int argc, char **argv) {
+ VerseKey key;
+ RawText *rawdrv;
+
+ if (argc != 3) {
+ fprintf(stderr, "usage: %s <datapath> \"<key>\"\n", argv[0]);
+ exit(1);
+ }
+
+ rawdrv = new RawText(argv[1]);
+ rawdrv->AddRawFilter(new CipherFilter(argv[2]));
+
+ printf("\n");
+
+ key.AutoNormalize(0);
+ key.Headings(1);
+ for (key.Index(0); (!key.Error()); key++) {
+ rawdrv->Key(key);
+ printf("%s: %s\n", (const char *)key, (const char *)*rawdrv);
+ }
+ return 0;
+}
diff --git a/utilities/emptyvss.cpp b/utilities/emptyvss.cpp
new file mode 100644
index 0000000..0508eec
--- /dev/null
+++ b/utilities/emptyvss.cpp
@@ -0,0 +1,44 @@
+#include <swmgr.h>
+#include <versekey.h>
+#include <iostream.h>
+
+int main(int argc, char **argv) {
+ if (argc < 2) {
+ fprintf(stderr, "usage: %s <Mod Name>\n", argv[0]);
+ exit(-1);
+ }
+
+ SWMgr mgr;
+
+ ModMap::iterator it = mgr.Modules.find(argv[1]);
+ if (it == mgr.Modules.end()) {
+ fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
+ exit(-2);
+ }
+
+ SWModule *mod = it->second;
+
+ SWKey *key = (*mod);
+ VerseKey *vkey = 0;
+ try {
+ vkey = dynamic_cast<VerseKey *>(key);
+ }
+ catch (...) {}
+
+ if (!vkey) {
+ fprintf(stderr, "error: %s: %s module is not keyed to verses \n", argv[0], argv[1]);
+ exit(-3);
+ }
+
+ vkey->Headings(1); // turn on mod/testmnt/book/chap headings
+
+ (*mod) = TOP;
+
+ while (!mod->Error()) {
+
+ if (vkey->Verse())
+ if (!strlen ((const char *)(*mod)))
+ cout << *vkey << "\n";
+ (*mod)++;
+ }
+}
diff --git a/utilities/imp2gbs.cpp b/utilities/imp2gbs.cpp
new file mode 100644
index 0000000..12b3f2f
--- /dev/null
+++ b/utilities/imp2gbs.cpp
@@ -0,0 +1,163 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <entriesblk.h>
+#include <iostream.h>
+#include <treekeyidx.h>
+#include <rawgenbook.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
+ if (!target)
+ target = &treeKey;
+
+ unsigned long currentOffset = target->getOffset();
+ cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
+ for (int i = 0; i < level; i++) cout << "\t";
+ cout << treeKey.getLocalName() << "/\n";
+ if (treeKey.firstChild()) {
+ printTree(treeKey, target, level+1);
+ treeKey.parent();
+ }
+ if (treeKey.nextSibling())
+ printTree(treeKey, target, level);
+}
+
+void setkey (TreeKeyIdx * treeKey, char* keybuffer) {
+ char* tok = strtok(keybuffer, "/");
+ while (tok) {
+ bool foundkey = false;
+ if (treeKey->hasChildren()) {
+ treeKey->firstChild();
+ if (!strcmp(treeKey->getLocalName(), tok)) {
+ foundkey = true;
+ } else {
+ while (treeKey->nextSibling()) {
+ if (treeKey->getLocalName()) {
+ if (!strcmp(treeKey->getLocalName(), tok)) {
+ foundkey = true;
+ }
+ }
+ }
+ }
+ if (!foundkey) {
+ treeKey->append();
+ treeKey->setLocalName(tok);
+ treeKey->save();
+ }
+ }
+ else {
+ treeKey->appendChild();
+ treeKey->setLocalName(tok);
+ treeKey->save();
+ }
+
+ //DEBUG cout << treeKey->getLocalName() << " : " << tok << endl;
+
+ tok = strtok(NULL, "/");
+
+ }
+}
+
+int readline(FILE* infile, char* linebuffer) {
+ signed char c;
+ char* lbPtr = linebuffer;
+ while ((c = fgetc(infile)) != EOF) {
+ *lbPtr++ = c;
+ if (c == 10) {
+ *lbPtr = 0;
+ return (strlen(linebuffer));
+ }
+ }
+ return 0;
+}
+
+int main(int argc, char **argv) {
+
+ const char * helptext ="imp2gbs 1.0 General Book module creation tool for the SWORD Project\n usage:\n %s <filename> [modname]\n";
+
+ signed long i = 0;
+ char* keybuffer = new char[2048];
+ char* entbuffer = new char[1048576];
+ char* linebuffer = new char[1048576];
+ char modname[16];
+
+ if (argc > 2) {
+ strcpy (modname, argv[2]);
+ }
+ else if (argc > 1) {
+ for (i = 0; (i < 16) && (argv[1][i]) && (argv[1][i] != '.'); i++) {
+ modname[i] = argv[1][i];
+ }
+ modname[i] = 0;
+ }
+ else {
+ fprintf(stderr, helptext, argv[0]);
+ exit(-1);
+ }
+
+ FILE *infile;
+ infile = fopen(argv[1], "r");
+
+ TreeKeyIdx * treeKey;
+ RawGenBook *book;
+
+ // Do some initialization stuff
+ TreeKeyIdx::create(modname);
+ treeKey = new TreeKeyIdx(modname);
+ RawGenBook::createModule(modname);
+ delete treeKey;
+ book = new RawGenBook(modname);
+ //DEBUG TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
+ treeKey = ((TreeKeyIdx *)((SWKey *)(*book)));
+
+ while (readline(infile, linebuffer)) {
+ if (!strncmp(linebuffer, "$$$", 3)) {
+ if (strlen(keybuffer) && strlen(entbuffer)) {
+ cout << keybuffer << endl;
+ treeKey->root();
+ setkey(treeKey, keybuffer);
+ book->setentry(entbuffer, strlen(entbuffer));
+ }
+ linebuffer[strlen(linebuffer) - 1] = 0;
+ strcpy (keybuffer, linebuffer + 3);
+ *entbuffer = 0;
+ }
+ else {
+ strcat (entbuffer, linebuffer);
+ }
+ }
+
+ //handle final entry
+ if (strlen(keybuffer) && strlen(entbuffer)) {
+ cout << keybuffer << endl;
+ treeKey->root();
+ setkey(treeKey, keybuffer);
+ book->setentry(entbuffer, strlen(entbuffer));
+ }
+
+ //DEBUG printTree(root, treeKey);
+
+ delete treeKey;
+ delete book;
+ delete [] keybuffer;
+ delete [] linebuffer;
+ delete [] entbuffer;
+
+ return 0;
+}
+
+
+
diff --git a/utilities/imp2ld.cpp b/utilities/imp2ld.cpp
new file mode 100644
index 0000000..a28c95f
--- /dev/null
+++ b/utilities/imp2ld.cpp
@@ -0,0 +1,155 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <iostream.h>
+#include <string>
+#include <rawld.h>
+#include <rawld4.h>
+#include <zld.h>
+#include <zipcomprs.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+int readline(FILE* infile, char* linebuffer) {
+ signed char c;
+ char* lbPtr = linebuffer;
+ while ((c = fgetc(infile)) != EOF) {
+ *lbPtr++ = c;
+ if (c == 10) {
+ *lbPtr = 0;
+ return (strlen(linebuffer));
+ }
+ }
+ return 0;
+}
+
+int main(int argc, char **argv) {
+
+ const char * helptext ="imp2ld 1.0 Lexicon/Dictionary/Daily Devotional/Glossary module creation tool for the SWORD Project\n usage:\n %s <filename> [modname] [ 4 (default) | 2 | z - module driver]\n";
+
+ signed long i = 0;
+ char* keybuffer = new char[2048];
+ char* entbuffer = new char[1048576];
+ char* linebuffer = new char[1048576];
+ char modname[16];
+
+ if (argc > 2) {
+ strcpy (modname, argv[2]);
+ }
+ else if (argc > 1) {
+ for (i = 0; (i < 16) && (argv[1][i]) && (argv[1][i] != '.'); i++) {
+ modname[i] = argv[1][i];
+ }
+ modname[i] = 0;
+ }
+ else {
+ fprintf(stderr, helptext, argv[0]);
+ exit(-1);
+ }
+
+ FILE *infile;
+ infile = fopen(argv[1], "r");
+
+ char mode = 1;
+ if (argc > 3) {
+ switch (*argv[3]) {
+ case 'z':
+ mode = 3;
+ break;
+ case '2':
+ mode = 2;
+ break;
+ default:
+ mode = 1;
+ }
+ }
+
+ zLD* modZ;
+ RawLD* mod2;
+ RawLD4* mod4;
+ SWKey* key;
+
+ if (mode == 3) {
+ zLD::createModule(modname);
+ modZ = new zLD(modname, 0, 0, 30, new ZipCompress());
+ key = modZ->CreateKey();
+ }
+ else if (mode == 2) {
+ RawLD::createModule(modname);
+ mod2 = new RawLD(modname);
+ key = mod2->CreateKey();
+ }
+ else if (mode == 1) {
+ RawLD4::createModule(modname);
+ mod4 = new RawLD4(modname);
+ key = mod4->CreateKey();
+ }
+
+ key->Persist(1);
+
+ while (readline(infile, linebuffer)) {
+ if (!strncmp(linebuffer, "$$$", 3)) {
+ if (strlen(keybuffer) && strlen(entbuffer)) {
+ cout << keybuffer << endl;
+ *key = keybuffer;
+
+ if (mode == 3) {
+ modZ->SetKey(*key);
+ modZ->setentry(entbuffer, strlen(entbuffer));
+ }
+ else if (mode == 2) {
+ mod2->SetKey(*key);
+ mod2->setentry(entbuffer, strlen(entbuffer));
+ }
+ else if (mode == 1) {
+ mod4->SetKey(*key);
+ mod4->setentry(entbuffer, strlen(entbuffer));
+ }
+ }
+ linebuffer[strlen(linebuffer) - 1] = 0;
+ strcpy (keybuffer, linebuffer + 3);
+ *entbuffer = 0;
+ }
+ else {
+ strcat (entbuffer, linebuffer);
+ }
+ }
+
+ //handle final entry
+ if (strlen(keybuffer) && strlen(entbuffer)) {
+ cout << keybuffer << endl;
+ *key = keybuffer;
+
+ if (mode == 3) {
+ modZ->SetKey(*key);
+ modZ->setentry(entbuffer, strlen(entbuffer));
+ }
+ else if (mode == 2) {
+ mod2->SetKey(*key);
+ mod2->setentry(entbuffer, strlen(entbuffer));
+ }
+ else if (mode == 1) {
+ mod4->SetKey(*key);
+ mod4->setentry(entbuffer, strlen(entbuffer));
+ }
+ }
+
+ //DEBUG printTree(root, treeKey);
+
+ delete keybuffer;
+ delete entbuffer;
+ delete linebuffer;
+
+ return 0;
+}
diff --git a/utilities/imp2vs.cpp b/utilities/imp2vs.cpp
new file mode 100644
index 0000000..5de22a2
--- /dev/null
+++ b/utilities/imp2vs.cpp
@@ -0,0 +1,198 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <iostream.h>
+#include <string>
+#include <rawtext.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+int readline(FILE* infile, char* linebuffer) {
+ signed char c;
+ char* lbPtr = linebuffer;
+ while ((c = fgetc(infile)) != EOF) {
+ *lbPtr++ = c;
+ if (c == 10) {
+ *lbPtr = 0;
+ return (strlen(linebuffer));
+ }
+ }
+ return 0;
+}
+
+int main(int argc, char **argv) {
+
+ const char * helptext ="imp2vs 1.0 Bible/Commentary module creation tool for the SWORD Project\n usage:\n %s <filename> [output dir] \n";
+
+ signed long i = 0;
+ char* keybuffer = new char[2048];
+ char* entbuffer = new char[1048576];
+ char* linebuffer = new char[1048576];
+ char modname[16];
+
+ if (argc > 2) {
+ strcpy (modname, argv[2]);
+ }
+ else if (argc > 1) {
+ strcpy (modname, "./");
+ }
+ else {
+ fprintf(stderr, helptext, argv[0]);
+ exit(-1);
+ }
+
+ FILE *infile;
+ infile = fopen(argv[1], "r");
+
+ SWText* mod;
+ RawText::createModule(modname);
+ RawText modRaw(modname);
+ mod = &modRaw;
+
+ VerseKey* vkey = new VerseKey;
+ vkey->Headings(1);
+ vkey->AutoNormalize(0);
+ vkey->Persist(1);
+
+ while (readline(infile, linebuffer)) {
+ if (!strncmp(linebuffer, "$$$", 3)) {
+ if (strlen(keybuffer) && strlen(entbuffer)) {
+ cout << keybuffer << endl;
+ *vkey = keybuffer;
+ mod->SetKey(*vkey);
+ if (!vkey->Chapter()) {
+ // bad hack: 0:0 is Book intro; (chapter):0 is Chapter intro; 0:2 is Module intro; 0:1 is Testament intro
+ int backstep = vkey->Verse();
+ vkey->Verse(0);
+ *mod -= backstep;
+
+ mod->setentry(entbuffer, strlen(entbuffer));
+ }
+ else {
+ ListKey listkey = vkey->ParseVerseList(keybuffer, "Gen1:1", true);
+ int i;
+ bool havefirst = false;
+ VerseKey firstverse;
+ for (i = 0; i < listkey.Count(); i++) {
+ VerseKey *element = SWDYNAMIC_CAST(VerseKey, listkey.GetElement(i));
+ if (element) {
+ mod->Key(element->LowerBound());
+ VerseKey finalkey = element->UpperBound();
+ cout << (const char*)mod->Key() << "-" << (const char*)finalkey << endl;
+ if (!havefirst) {
+ havefirst = true;
+ firstverse = mod->Key();
+
+ ((SWModule*)mod)->setentry(entbuffer, strlen(entbuffer));
+ cout << "f" << (const char*)firstverse << endl;
+ (mod->Key())++;
+ }
+ while (mod->Key() <= finalkey) {
+ cout << (const char*)mod->Key() << endl;
+ *(SWModule*)mod << &firstverse;
+ (mod->Key())++;
+ }
+ }
+ else {
+ if (havefirst) {
+ mod->Key(*listkey.GetElement(i));
+ *(SWModule*)mod << &firstverse;
+ cout << (const char*)mod->Key() << endl;
+ }
+ else {
+ mod->Key(*listkey.GetElement(i));
+ havefirst = true;
+ firstverse = mod->Key();
+
+ ((SWModule*)mod)->setentry(entbuffer, strlen(entbuffer));
+ cout << "f" << (const char*)firstverse << endl;
+ }
+ }
+ }
+ }
+ }
+ linebuffer[strlen(linebuffer) - 1] = 0;
+ strcpy (keybuffer, linebuffer + 3);
+ *entbuffer = 0;
+ }
+ else {
+ strcat (entbuffer, linebuffer);
+ }
+ }
+
+ //handle final entry
+ if (strlen(keybuffer) && strlen(entbuffer)) {
+ cout << keybuffer << endl;
+ *vkey = keybuffer;
+ mod->SetKey(*vkey);
+ if (!vkey->Chapter()) {
+ // bad hack: 0:0 is Book intro; (chapter):0 is Chapter intro; 0:2 is Module intro; 0:1 is Testament intro
+ int backstep = vkey->Verse();
+ vkey->Verse(0);
+ *mod -= backstep;
+
+ mod->setentry(entbuffer, strlen(entbuffer));
+ }
+ else {
+ ListKey listkey = vkey->ParseVerseList(keybuffer, "Gen1:1", true);
+ int i;
+ bool havefirst = false;
+ VerseKey firstverse;
+ for (i = 0; i < listkey.Count(); i++) {
+ VerseKey *element = SWDYNAMIC_CAST(VerseKey, listkey.GetElement(i));
+ if (element) {
+ mod->Key(element->LowerBound());
+ VerseKey finalkey = element->UpperBound();
+ cout << (const char*)mod->Key() << "-" << (const char*)finalkey << endl;
+ if (!havefirst) {
+ havefirst = true;
+ firstverse = mod->Key();
+
+ ((SWModule*)mod)->setentry(entbuffer, strlen(entbuffer));
+ cout << "f" << (const char*)firstverse << endl;
+ (mod->Key())++;
+ }
+ while (mod->Key() <= finalkey) {
+ cout << (const char*)mod->Key() << endl;
+ *(SWModule*)mod << &firstverse;
+ (mod->Key())++;
+ }
+ }
+ else {
+ if (havefirst) {
+ mod->Key(*listkey.GetElement(i));
+ *(SWModule*)mod << &firstverse;
+ cout << (const char*)mod->Key() << endl;
+ }
+ else {
+ mod->Key(*listkey.GetElement(i));
+ havefirst = true;
+ firstverse = mod->Key();
+
+ ((SWModule*)mod)->setentry(entbuffer, strlen(entbuffer));
+ cout << "f" << (const char*)firstverse << endl;
+ }
+ }
+ }
+ }
+ }
+
+ //DEBUG printTree(root, treeKey);
+
+ delete entbuffer;
+ delete linebuffer;
+ delete keybuffer;
+
+ return 0;
+}
diff --git a/utilities/lexdump.c b/utilities/lexdump.c
new file mode 100644
index 0000000..cd3cc52
--- /dev/null
+++ b/utilities/lexdump.c
@@ -0,0 +1,50 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+int main(int argc, char **argv) {
+ char *tmpbuf;
+ int idxfd, datfd;
+ long offset;
+ unsigned int size;
+ char datbuf[255];
+
+ if (argc != 3) {
+ fprintf(stderr, "usage: %s <datapath/datafilebasename> <index>\n", argv[0]);
+ exit(1);
+ }
+
+ tmpbuf = calloc(strlen(argv[1]) + 11,1);
+ sprintf(tmpbuf, "%s.idx", argv[1]);
+ idxfd = open(tmpbuf, O_RDONLY|O_BINARY);
+ sprintf(tmpbuf, "%s.dat", argv[1]);
+ datfd = open(tmpbuf, O_RDONLY|O_BINARY);
+ free(tmpbuf);
+
+ offset = atoi(argv[2]) * 6;
+ lseek(idxfd, offset, SEEK_SET);
+ read(idxfd, &offset, 4);
+ read(idxfd, &size, 2);
+ printf("offset: %ld; size: %d\n", offset, size);
+ lseek(datfd, offset, SEEK_SET);
+ read(datfd, datbuf, 40);
+ datbuf[40] = 0;
+ printf("%s\n", datbuf);
+ close(datfd);
+ close(idxfd);
+ return 0;
+
+}
diff --git a/utilities/mkfastmod.cpp b/utilities/mkfastmod.cpp
new file mode 100644
index 0000000..a1664f8
--- /dev/null
+++ b/utilities/mkfastmod.cpp
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <rawtext.h>
+#include <swmgr.h>
+
+int main(int argc, char **argv)
+{
+ SWMgr manager(0,0,true);
+ SWModule *target;
+ ListKey listkey;
+ VerseKey vk;
+ ModMap::iterator it;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <modname>\n", argv[0]);
+ exit(-1);
+ }
+
+ it = manager.Modules.find(argv[1]);
+ if (it == manager.Modules.end()) {
+ fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]);
+ for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
+ fprintf(stderr, "[%s]\t - %s\n", (*it).second->Name(), (*it).second->Description());
+ }
+ exit(-1);
+ }
+ target = it->second;
+
+ if (!target->hasSearchFramework()) {
+ fprintf(stderr, "%s: error: %s does not support a search framework.\n", *argv, it->second->Name());
+ exit(-2);
+ }
+
+ printf("Building framework, please wait...\n");
+ char error = target->createSearchFramework();
+ if (error) {
+ fprintf(stderr, "%s: couldn't create search framework (permissions?)\n", *argv);
+ }
+}
diff --git a/utilities/mod2vpl.cpp b/utilities/mod2vpl.cpp
new file mode 100644
index 0000000..fb0804a
--- /dev/null
+++ b/utilities/mod2vpl.cpp
@@ -0,0 +1,74 @@
+#include <swmgr.h>
+#include <versekey.h>
+#include <iostream.h>
+
+void cleanbuf(char *buf) {
+ char *from = buf;
+ char *to = buf;
+
+ while (*from) {
+ if ((*from != 10) && (*from != 13)) {
+ *to++ = *from++;
+ }
+ else {
+ from++;
+ }
+ }
+ *to = 0;
+}
+
+int main(int argc, char **argv) {
+ char *buffer = 0;
+
+ if (argc < 2) {
+ fprintf(stderr, "usage: %s <Mod Name> [0|1 - prepend verse reference to each line]\n", argv[0]);
+ exit(-1);
+ }
+
+ SWMgr mgr;
+
+ ModMap::iterator it = mgr.Modules.find(argv[1]);
+ if (it == mgr.Modules.end()) {
+ fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
+ exit(-2);
+ }
+
+ bool vref = false;
+ if (argc > 2)
+ vref = (argv[2][0] == '0') ? false : true;
+
+
+ SWModule *mod = it->second;
+
+ SWKey *key = (*mod);
+ VerseKey *vkey = 0;
+ try {
+ vkey = dynamic_cast<VerseKey *>(key);
+ }
+ catch (...) {}
+
+ if (!vkey) {
+ fprintf(stderr, "error: %s: %s module is not keyed to verses \n", argv[0], argv[1]);
+ exit(-3);
+ }
+
+ vkey->Headings(1); // turn on mod/testmnt/book/chap headings
+
+ (*mod) = TOP;
+
+ while (!mod->Error()) {
+ buffer = new char [ strlen ((const char *)(*mod)) + 1 ];
+ strcpy(buffer, (const char *)(*mod));
+ cleanbuf(buffer);
+ if (vref) {
+ if ((strlen(buffer) > 0) && (vref)) {
+ cout << (const char *)(*vkey) << " ";
+ cout << buffer << "\n";
+ }
+ }
+ else cout << buffer << "\n";
+
+ delete [] buffer;
+ (*mod)++;
+ }
+}
diff --git a/utilities/mod2zmod.cpp b/utilities/mod2zmod.cpp
new file mode 100644
index 0000000..bfa7305
--- /dev/null
+++ b/utilities/mod2zmod.cpp
@@ -0,0 +1,145 @@
+// Compression on variable granularity
+
+#include <fcntl.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <ztext.h>
+#include <zld.h>
+#include <zcom.h>
+#include <swmgr.h>
+#include <lzsscomprs.h>
+#include <zipcomprs.h>
+#include <versekey.h>
+#include <stdio.h>
+
+void errorOutHelp(char *appName) {
+ cerr << appName << " - a tool to create compressed Sword modules\n";
+ cerr << "version 0.1\n\n";
+ cerr << "usage: "<< appName << " <modname> <datapath> [blockType [compressType]]\n\n";
+ cerr << "datapath: the directory in which to write the zModule\n";
+ cerr << "blockType : (default 4)\n\t2 - verses\n\t3 - chapters\n\t4 - books\n";
+ cerr << "compressType: (default 1):\n\t1 - LZSS\n\t2 - Zip\n";
+ cerr << "\n\n";
+ exit(-1);
+}
+
+
+int main(int argc, char **argv)
+{
+ int iType = 4;
+ int compType = 1;
+ SWCompress *compressor = 0;
+ SWModule *inModule = 0;
+ SWModule *outModule = 0;
+
+
+ if ((argc < 3) || (argc > 5)) {
+ errorOutHelp(argv[0]);
+ }
+
+ if (argc > 3) {
+ iType = atoi(argv[3]);
+ if (argc > 4) {
+ compType = atoi(argv[4]);
+ }
+ }
+
+ if ((iType < 2) || (compType < 1) || (compType > 2) || (!strcmp(argv[1], "-h")) || (!strcmp(argv[1], "--help")) || (!strcmp(argv[1], "/?")) || (!strcmp(argv[1], "-?")) || (!strcmp(argv[1], "-help"))) {
+ errorOutHelp(argv[0]);
+ }
+
+ SWMgr mgr;
+
+ ModMap::iterator it = mgr.Modules.find(argv[1]);
+ if (it == mgr.Modules.end()) {
+ fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
+ exit(-2);
+ }
+
+ inModule = it->second;
+
+ // Try to initialize a default set of datafiles and indicies at our
+ // datapath location passed to us from the user.
+
+#define BIBLE 1
+#define LEX 2
+#define COM 3
+
+ int modType = 0;
+ if (!strcmp(inModule->Type(), "Biblical Texts")) modType = BIBLE;
+ if (!strcmp(inModule->Type(), "Lexicons / Dictionaries")) modType = LEX;
+ if (!strcmp(inModule->Type(), "Commentaries")) modType = COM;
+
+ switch (compType) { // these are deleted by zText
+ case 1: compressor = new LZSSCompress(); break;
+ case 2: compressor = new ZipCompress(); break;
+ }
+
+ int result = 0;
+ switch (modType) {
+ case BIBLE:
+ result = zText::createModule(argv[2], iType);
+ break;
+ case LEX:
+ result = zLD::createModule(argv[2]);
+ break;
+ case COM:
+ result = zCom::createModule(argv[2], iType);
+ break;
+ }
+
+ if (result) {
+ fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
+ exit(-3);
+ }
+
+ switch (modType) {
+ case BIBLE:
+ outModule = new zText(argv[2], 0, 0, iType, compressor); // open our datapath with our RawText driver.
+ ((VerseKey *)(SWKey *)(*inModule))->Headings(1);
+ break;
+ case LEX:
+ outModule = new zLD(argv[2], 0, 0, iType, compressor); // open our datapath with our RawText driver.
+ break;
+ case COM:
+ outModule = new zCom(argv[2], 0, 0, iType, compressor); // open our datapath with our RawText driver.
+ ((VerseKey *)(SWKey *)(*inModule))->Headings(1);
+ break;
+ }
+
+ string lastBuffer = "Something that would never be first module entry";
+ SWKey bufferKey;
+
+ inModule->setSkipConsecutiveLinks(false);
+ (*inModule) = TOP;
+ while (!inModule->Error()) {
+ bufferKey = *(SWKey *)(*inModule);
+ // pseudo-check for link. Will get most common links.
+ if ((lastBuffer == inModule->getRawEntry()) &&(lastBuffer.length() > 0)) {
+ (*outModule) << &bufferKey; // link to last key
+ cout << "Adding [" << bufferKey << "] link to: \n";
+ }
+ else {
+ lastBuffer = inModule->getRawEntry();
+ if (lastBuffer.length() > 0) {
+ cout << "Adding [" << bufferKey << "] new text. \n";
+ outModule->SetKey(bufferKey);
+ (*outModule) << lastBuffer.c_str(); // save new text;
+ }
+ else {
+ cout << "Skipping [" << bufferKey << "] no entry in inModule. \n";
+ }
+ }
+ (*inModule)++;
+ }
+ delete outModule;
+}
+
diff --git a/utilities/modwrite.cpp b/utilities/modwrite.cpp
new file mode 100644
index 0000000..33bd20c
--- /dev/null
+++ b/utilities/modwrite.cpp
@@ -0,0 +1,54 @@
+// Compression on variable granularity
+
+#include <fcntl.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swmgr.h>
+#include <stdio.h>
+
+
+int main(int argc, char **argv)
+{
+ int action = 0;
+
+ if ((argc < 4) || (argc > 6)) {
+ cerr << "usage: " << argv[0] << " <mod_name> <key> <key|buf|""-delete> [0(deflt) - normal; 1 - link]\n";
+ exit(-1);
+ }
+
+ if (argc > 4)
+ action = atoi(argv[4]);
+
+ SWMgr mgr;
+
+ ModMap::iterator it = mgr.Modules.find(argv[1]);
+ if (it == mgr.Modules.end()) {
+ fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
+ exit(-2);
+ }
+
+ SWModule *module = it->second;
+ module->SetKey(argv[2]);
+
+ switch (action) {
+ case 0:
+ if (strlen(argv[3]))
+ (*module) << argv[3];
+ else module->deleteEntry();
+ break;
+ case 1:
+ (*module) << (SWKey)argv[3];
+ break;
+ default:
+ cerr << "Unknown action " << action << "\n";
+ exit(-3);
+ }
+}
diff --git a/utilities/no13.c b/utilities/no13.c
new file mode 100644
index 0000000..1e94846
--- /dev/null
+++ b/utilities/no13.c
@@ -0,0 +1,34 @@
+#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);
+}
diff --git a/utilities/normcode.cpp b/utilities/normcode.cpp
new file mode 100644
index 0000000..4a5bbf6
--- /dev/null
+++ b/utilities/normcode.cpp
@@ -0,0 +1,96 @@
+/* normcode.cpp
+ * Transcodes Latin-1/UTF-8 to canonically normalized UTF-8/SCSU
+ */
+
+#include <iostream>
+#include <string>
+#include <fstream>
+
+
+#include "unicode/utypes.h"
+#include "unicode/convert.h"
+#include "unicode/ustring.h"
+#include "unicode/normlzr.h"
+
+#define BUFSIZE 65536
+
+int main (char argc, char** argv) {
+
+ if (argc < 5) {
+ cout << "usage: " << argv[0] << " -[8|l] <input file> -[8|s] <outputfile> -[c|d]" << endl;
+ cout << "The first argument should be -8 if input is UTF-8 or -l if it is Latin-1/Codepage 1252." << endl;
+ cout << "The third argument should be -8 for UTF-8 output or -s for SCSU output." << endl;
+ cout << "The fifth arg should be -c if you want to pre-compose or -d if you want to decompose (default)." << endl;
+ return -1;
+ }
+
+ fstream inf, outf;
+ char* buffer = new char[BUFSIZE];
+ UnicodeString source, norm;
+ UErrorCode err;
+ int32_t buf32;
+
+ UnicodeConverter latin("Latin-1", err);
+ if (U_FAILURE(err)) cout << "Latin-1 converter error" << endl;
+ UnicodeConverter scsu("SCSU", err);
+ if (U_FAILURE(err)) cout << "SCSU converter error" << endl;
+ UnicodeConverter utf8("UTF-8", err);
+ if (U_FAILURE(err)) cout << "UTF-8 converter error" << endl;
+
+ inf.open(argv[2], fstream::in);
+ outf.open(argv[4], fstream::out);
+
+ while (!inf.eof()) {
+ inf.getline(buffer, BUFSIZE);
+ buf32 = inf.gcount();
+ if (buf32 == 0) {
+ outf << endl;
+ continue;
+ }
+ buffer[buf32-1] = '\n';
+ buffer[buf32] = 0;
+
+ if (argv[1][1] == 'l') {
+ latin.toUnicodeString(source, buffer, buf32, err);
+ if (U_FAILURE(err)) cout << "Latin-1 conversion error" << endl;
+ } else {
+ utf8.toUnicodeString(source, buffer, buf32, err);
+ if (U_FAILURE(err)) cout << "UTF-8 conversion error" << endl;
+ }
+
+ if (argc > 5) {
+ if (argv[5][1] == 'c') {
+ Normalizer::normalize(source, UNORM_NFC, 0, norm, err); //canonical composition
+ } else {
+ Normalizer::normalize(source, UNORM_NFD, 0, norm, err); //canonical decomposition
+ }
+ } else {
+ Normalizer::normalize(source, UNORM_NFD, 0, norm, err); //canonical decomposition
+ }
+
+ buf32 = BUFSIZE;
+ if (argv[3][1] == 's') {
+ scsu.fromUnicodeString((char*)buffer, buf32, norm, err);
+ if (U_FAILURE(err)) cout << "SCSU conversion error" << endl;
+ // scsu.toUnicodeString(norm, buffer, buf32, err);
+ // buf32 = BUFSIZE;
+ // utf8.fromUnicodeString((char*)buffer, buf32, norm, err);
+ } else {
+ utf8.fromUnicodeString((char*)buffer, buf32, norm, err);
+ if (U_FAILURE(err)) cout << "UTF-8 conversion error" << endl;
+ }
+
+ if (U_SUCCESS(err) && !inf.eof()) {
+ buffer[buf32] = 0;
+ }
+
+ outf.write(buffer, buf32);
+ }
+
+ outf.close();
+ inf.close();
+
+ delete buffer;
+
+ return 0;
+}
diff --git a/utilities/perl/cipherkeygen.pl b/utilities/perl/cipherkeygen.pl
new file mode 100755
index 0000000..db53d88
--- /dev/null
+++ b/utilities/perl/cipherkeygen.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+# cipherkeygen.pl
+
+# generates a cipher key of the format \d{4}[a-zA-Z]{4}\d{4}[a-zA-Z]{4}.
+# because I'm lazy and not random enough.
+# and because the utilities/perl directory is kinda bare...
+
+
+# let's get a base key of \d{4}[A-Z]{4}\d{4}[A-Z]{4}
+$key = int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . int(rand() * 10) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41) . chr(int(rand() * 26) + 0x41);
+
+# now randomly lowercase the letters, printing as we go
+foreach $c (unpack ("cccccccccccccccc", $key)) {
+ $c = chr($c);
+ if (rand() < 0.5) {
+ $c = lc($c);
+ }
+ print $c;
+}
+print "\n";
+
+
+
diff --git a/utilities/perl/linkvers.pl b/utilities/perl/linkvers.pl
new file mode 100755
index 0000000..751dc14
--- /dev/null
+++ b/utilities/perl/linkvers.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+$vplfile = $ARGV[0];
+
+if ($vplfile eq "") {
+ die("linkvers.pl Syntax:\n./linkvers.pl <vpl file> [1 - checking mode on].\nMust be run AFTER vpl2mod is completed.\ndied");
+}
+
+$check = $ARGV[1];
+
+open(INF,$vplfile) or die;
+while (<INF>) {
+ $line = $_;
+
+ $line =~ /([\w ]+:[\d\-]+)\s+(.*)/;
+ $vref = $1;
+
+ if ($vref =~ /\-/) {
+ $vref =~ /(.*:)(\d+)\-(\d+)/;
+ $ch = $1;
+ $fv = $2;
+ $lv = $3;
+ if ($fv + 1 == $lv) {
+ $sv = $lv;
+ }
+ else {
+ $sv = $fv + 1;
+ $sv .= "-" . $lv;
+ }
+ $first = $ch . $fv;
+ $last = $ch . $sv;
+
+ if ($check ne "") {
+ print "$first\t\t$last\n";
+ } else {
+ `addvs -l ./ \"$first\" \"$last\"`;
+ }
+ }
+}
+close(INF);
+
+
+
+
diff --git a/utilities/perl/localecap.pl b/utilities/perl/localecap.pl
new file mode 100755
index 0000000..f5d846e
--- /dev/null
+++ b/utilities/perl/localecap.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+# This tool is only for locales in Latin-1, not UTF-8 (should such locales be supported at a later date)
+
+use locale;
+
+$abbrevs = 0;
+
+open (INPUT, "$ARGV[0]") or print "Give the locale file as an argument.\n";
+@loc = <INPUT>;
+close (INPUT);
+open (OUTPUT, ">$ARGV[0]");
+foreach $line (@loc) {
+
+ if ($line =~ /\[Book Abbrevs\]/) {
+ $abbrevs = 1;
+ }
+ elsif ($abbrevs == 1) {
+ $line = uc($line);
+ }
+ print OUTPUT $line;
+}
+close (OUTPUT);
diff --git a/utilities/perl/mkvsmod.pl b/utilities/perl/mkvsmod.pl
new file mode 100755
index 0000000..e44c27d
--- /dev/null
+++ b/utilities/perl/mkvsmod.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+open (INF, $ARGV[0]);
+
+`addvs -c ./`;
+while (<INF>) {
+
+ $line = $_;
+ $line =~ s/[\r\n]//g;
+ $line =~ /(.+\d+:\d+:?) +(.*)/;
+ $ref = $1;
+ $ver = $2;
+ open (BUF, ">buffer");
+ print BUF "$ver";
+ close (BUF);
+ $x = `addvs -a ./ \"$ref\" buffer`;
+ print "$ref\n";
+
+}
+
+close (INF);
diff --git a/utilities/step2vpl.cpp b/utilities/step2vpl.cpp
new file mode 100644
index 0000000..fa3f84f
--- /dev/null
+++ b/utilities/step2vpl.cpp
@@ -0,0 +1,419 @@
+#include <iostream.h>
+#include <string>
+#include <stdio.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <lzsscomprs.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+using namespace std;
+
+long SECTIONSLEVELSTART = 38;
+long SECTIONSLEVELSIZE = 29;
+
+long VIEWABLEBLOCKSTART = 0;
+long VIEWABLEBLOCKSIZE = 0;
+
+typedef struct {
+ short versionRecordSize;
+ short publisherID;
+ short bookID;
+ short setID;
+ char conversionProgramVerMajor;
+ char conversionProgramVerMinor;
+ char leastCompatSTEPVerMajor;
+ char leastCompatSTEPVerMinor;
+ char encryptionType;
+ char editionID;
+ short modifiedBy;
+} Version;
+
+typedef struct {
+ short sectionsHeaderRecordSize;
+ long levelEntriesCount; // this is listed as nonGlossBlocksCount in spec!
+ long glossEntriesCount;
+ short levelEntriesSize;
+ long reserved;
+} SectionsHeader;
+
+typedef struct {
+ short viewableHeaderRecordSize;
+ long viewableBlocksCount; // this is listed as nonGlossBlocksCount in spec!
+ long glossBlocksCount;
+ char compressionType; // 0 - none; 1 - LZSS
+ char reserved1;
+ short blockEntriesSize;
+ short reserved2;
+} ViewableHeader;
+
+typedef struct {
+ short vSyncHeaderRecordSize;
+ short startBookNumber;
+ short endBookNumber;
+ short bookPointerEntriesSize;
+ short syncPointEntriesSize;
+ long reserved1_1;
+ short reserved1_2;
+} VSyncHeader;
+
+typedef struct {
+ long offset;
+ long uncompressedSize;
+ long size;
+} ViewableBlock;
+
+typedef struct {
+ long offset; // offset into VSYNC.IDX to first VSyncPoint
+ short count; // number of VSyncPoints for this book
+} VSyncBooksInfo;
+
+typedef struct {
+ short chapter;
+ short verse;
+ long offset; // offset into SECTIONS.IDX
+} VSyncPoint;
+
+typedef struct {
+ long parentOffset; // many of these are 0 if glossary
+ long previousOffset;
+ long nextOffset;
+ long viewableOffset;
+ short startLevel;
+ char level;
+ long nameOffset;
+ long outSync_1;
+ short outSync_2;
+} SectionLevelInfo;
+
+void readVersion(int fd, Version *versionRecord);
+void readHeaderControlWordAreaText(int fd, char **buf);
+void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord);
+void readVSyncHeader(int fd, VSyncHeader *vSyncHeaderRecord);
+void readVSyncBooksInfo(int fd, VSyncHeader *, VSyncBooksInfo **vSyncBooksInfo);
+void readViewableBlock(int fd, ViewableBlock *vb);
+void readViewableBlockText(int fd, ViewableBlock *vb, char **buf);
+void readSectionsHeader(int fd, SectionsHeader *sectionsHeaderRecord);
+void readSectionLevelInfo(int fd, SectionLevelInfo *sli);
+void readSectionName(int fd, SectionLevelInfo *sli, char **name);
+void displayBook(int fdbook, int fdviewable, int fdvsync, int fdsections, VSyncBooksInfo *vSyncBooksInfo);
+void extractVerseText(int fdviewable, int fdbook, SectionLevelInfo *sectionLevelInfo, char **verseText);
+void cleanBuf(char *buf);
+
+SWCompress *compress = 0;
+
+int main(int argc, char **argv) {
+
+ compress = new LZSSCompress();
+ char *buf;
+ Version versionRecord;
+ VSyncHeader vSyncHeaderRecord;
+ VSyncBooksInfo *vSyncBooksInfo;
+ SectionsHeader sectionsHeaderRecord;
+ ViewableHeader viewableHeaderRecord;
+
+
+ if (argc < 2) {
+ cerr << "usage: "<< *argv << " <database to step module>\n";
+ exit (-1);
+ }
+
+ string bookpath = argv[1];
+ string fileName;
+
+ if ((argv[1][strlen(argv[1])-1] != '/') &&
+ (argv[1][strlen(argv[1])-1] != '\\'))
+ bookpath += "/";
+
+ fileName = bookpath + "Book.dat";
+ int fdbook = open(fileName.c_str(), O_RDONLY|O_BINARY);
+
+ if (fdbook < 1) {
+ cerr << "error, couldn't open file: " << fileName << "\n";
+ exit (-2);
+ }
+
+ readVersion(fdbook, &versionRecord);
+ readHeaderControlWordAreaText(fdbook, &buf);
+ delete [] buf;
+
+
+ fileName = bookpath + "Viewable.idx";
+ int fdviewable = open(fileName.c_str(), O_RDONLY|O_BINARY);
+
+ if (fdviewable < 1) {
+ cerr << "error, couldn't open file: " << fileName << "\n";
+ exit (-3);
+ }
+
+ readVersion(fdviewable, &versionRecord);
+ readViewableHeader(fdviewable, &viewableHeaderRecord);
+
+ VIEWABLEBLOCKSTART = lseek(fdviewable, 0, SEEK_CUR);
+ VIEWABLEBLOCKSIZE = viewableHeaderRecord.blockEntriesSize;
+
+
+ fileName = bookpath + "Vsync.idx";
+ int fdvsync = open(fileName.c_str(), O_RDONLY|O_BINARY);
+
+ if (fdvsync < 1) {
+ cerr << "error, couldn't open file: " << fileName << "\n";
+ exit (-4);
+ }
+
+ fileName = bookpath + "Sections.idx";
+ int fdsections = open(fileName.c_str(), O_RDONLY|O_BINARY);
+
+ if (fdsections < 1) {
+ cerr << "error, couldn't open file: " << fileName << "\n";
+ exit (-4);
+ }
+ readVersion(fdsections, &versionRecord);
+ readSectionsHeader(fdsections, &sectionsHeaderRecord);
+ SECTIONSLEVELSTART = lseek(fdsections, 0, SEEK_CUR);
+ SECTIONSLEVELSIZE = sectionsHeaderRecord.levelEntriesSize;
+
+ readVersion(fdvsync, &versionRecord);
+ readVSyncHeader(fdvsync, &vSyncHeaderRecord);
+ readVSyncBooksInfo(fdvsync, &vSyncHeaderRecord, &vSyncBooksInfo);
+ int bookCount = vSyncHeaderRecord.endBookNumber - vSyncHeaderRecord.startBookNumber;
+ for (int i = 0; i <= bookCount; i++) {
+ displayBook(fdbook, fdviewable, fdvsync, fdsections, &vSyncBooksInfo[i]);
+ }
+
+ close(fdviewable);
+ close(fdvsync);
+ close(fdsections);
+ close(fdbook);
+
+}
+
+
+
+void readVersion(int fd, Version *versionRecord) {
+
+ read(fd, &(versionRecord->versionRecordSize), 2);
+ read(fd, &(versionRecord->publisherID), 2);
+ read(fd, &(versionRecord->bookID), 2);
+ read(fd, &(versionRecord->setID), 2);
+ read(fd, &(versionRecord->conversionProgramVerMajor), 1);
+ read(fd, &(versionRecord->conversionProgramVerMinor), 1);
+ read(fd, &(versionRecord->leastCompatSTEPVerMajor), 1);
+ read(fd, &(versionRecord->leastCompatSTEPVerMinor), 1);
+ read(fd, &(versionRecord->encryptionType), 1);
+ read(fd, &(versionRecord->editionID), 1);
+ read(fd, &(versionRecord->modifiedBy), 2);
+
+ int skip = versionRecord->versionRecordSize - 16/*sizeof(struct Version*/;
+
+ if (skip) {
+ char skipbuf[skip];
+ read(fd, skipbuf, skip);
+ }
+}
+
+
+void readSectionsHeader(int fd, SectionsHeader *sectionsHeaderRecord) {
+
+ read(fd, &(sectionsHeaderRecord->sectionsHeaderRecordSize), 2);
+ read(fd, &(sectionsHeaderRecord->levelEntriesCount), 4);
+ read(fd, &(sectionsHeaderRecord->glossEntriesCount), 4);
+ read(fd, &(sectionsHeaderRecord->levelEntriesSize), 2);
+ read(fd, &(sectionsHeaderRecord->reserved), 4);
+
+ int skip = sectionsHeaderRecord->sectionsHeaderRecordSize - 16/*sizeof(struct ViewableHeader)*/;
+
+ if (skip) {
+ char skipbuf[skip];
+ read(fd, skipbuf, skip);
+ }
+}
+
+
+void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord) {
+
+ read(fd, &(viewableHeaderRecord->viewableHeaderRecordSize), 2);
+ read(fd, &(viewableHeaderRecord->viewableBlocksCount), 4);
+ read(fd, &(viewableHeaderRecord->glossBlocksCount), 4);
+ read(fd, &(viewableHeaderRecord->compressionType), 1);
+ read(fd, &(viewableHeaderRecord->reserved1), 1);
+ read(fd, &(viewableHeaderRecord->blockEntriesSize), 2);
+ read(fd, &(viewableHeaderRecord->reserved2), 2);
+
+ int skip = viewableHeaderRecord->viewableHeaderRecordSize - 16/*sizeof(struct ViewableHeader)*/;
+
+ if (skip) {
+ char skipbuf[skip];
+ read(fd, skipbuf, skip);
+ }
+}
+
+
+void readVSyncHeader(int fd, VSyncHeader *vSyncHeaderRecord) {
+
+ read(fd, &(vSyncHeaderRecord->vSyncHeaderRecordSize), 2);
+ read(fd, &(vSyncHeaderRecord->startBookNumber), 2);
+ read(fd, &(vSyncHeaderRecord->endBookNumber), 2);
+ read(fd, &(vSyncHeaderRecord->bookPointerEntriesSize), 2);
+ read(fd, &(vSyncHeaderRecord->syncPointEntriesSize), 2);
+ read(fd, &(vSyncHeaderRecord->reserved1_1), 4);
+ read(fd, &(vSyncHeaderRecord->reserved1_2), 2);
+
+ int skip = vSyncHeaderRecord->vSyncHeaderRecordSize - 16/*sizeof(VSyncHeader)*/;
+
+ if (skip) {
+ char skipbuf[skip];
+ read(fd, skipbuf, skip);
+ }
+}
+
+
+void readViewableBlockText(int fd, ViewableBlock *vb, char **buf) {
+ unsigned long size = vb->size;
+
+ *buf = new char [ ((vb->size > vb->uncompressedSize) ? vb->size : vb->uncompressedSize) + 1 ];
+ lseek(fd, vb->offset, SEEK_SET);
+ read(fd, *buf, vb->size);
+
+ compress->zBuf(&size, *buf);
+ strcpy(*buf, compress->Buf());
+}
+
+
+void readViewableBlock(int fd, ViewableBlock *vb) {
+
+ read(fd, &(vb->offset), 4);
+ read(fd, &(vb->uncompressedSize), 4);
+ read(fd, &(vb->size), 4);
+}
+
+
+void readHeaderControlWordAreaText(int fd, char **buf) {
+ long headerControlWordAreaSize;
+ read(fd, &headerControlWordAreaSize, 4);
+
+ *buf = new char [headerControlWordAreaSize + 1];
+
+ read(fd, *buf, headerControlWordAreaSize);
+ (*buf)[headerControlWordAreaSize] = 0;
+
+}
+
+void readVSyncBooksInfo(int fd, VSyncHeader *vSyncHeaderRecord, VSyncBooksInfo **vSyncBooksInfo) {
+
+ int bookCount = vSyncHeaderRecord->endBookNumber - vSyncHeaderRecord->startBookNumber;
+ *vSyncBooksInfo = new VSyncBooksInfo[bookCount];
+ for (int i = 0; i <= bookCount; i++) {
+ read(fd, &(*vSyncBooksInfo)[i].offset, 4);
+ read(fd, &(*vSyncBooksInfo)[i].count, 2);
+ }
+}
+
+void displayBook(int fdbook, int fdviewable, int fdvsync, int fdsections, VSyncBooksInfo *vSyncBooksInfo) {
+ VSyncPoint vSyncPoint;
+
+ lseek(fdvsync, vSyncBooksInfo->offset, SEEK_SET);
+
+ for (int i = 0; i < vSyncBooksInfo->count; i++) {
+
+ SectionLevelInfo sectionLevelInfo;
+ char *sectionName;
+ char *verseText;
+
+ read(fdvsync, &(vSyncPoint.chapter), 2);
+ read(fdvsync, &(vSyncPoint.verse), 2);
+ read(fdvsync, &(vSyncPoint.offset), 4);
+ vSyncPoint.offset = SECTIONSLEVELSTART + (vSyncPoint.offset * SECTIONSLEVELSIZE);
+ lseek(fdsections, vSyncPoint.offset, SEEK_SET);
+ readSectionLevelInfo(fdsections, &sectionLevelInfo);
+ readSectionName(fdsections, &sectionLevelInfo, &sectionName);
+ cout << sectionName << " ";
+ delete [] sectionName;
+ extractVerseText(fdviewable, fdbook, &sectionLevelInfo, &verseText);
+ cleanBuf(verseText);
+ cout << verseText << "\n";
+ delete [] verseText;
+ }
+}
+
+
+void extractVerseText(int fdviewable, int fdbook, SectionLevelInfo *sectionLevelInfo, char **verseText) {
+ char numberBuf[16];
+ string startToken;
+ ViewableBlock vb;
+ int len = 0;
+ static long lastEntryOffset = -1;
+ static class FreeCachedEntryText {
+ public:
+ char *entryText;
+ FreeCachedEntryText() { entryText = 0; }
+ ~FreeCachedEntryText() { if (entryText) delete [] entryText; }
+ } _freeCachedEntryText;
+
+ if (sectionLevelInfo->viewableOffset != lastEntryOffset) {
+ if (_freeCachedEntryText.entryText)
+ delete [] _freeCachedEntryText.entryText;
+
+ lseek(fdviewable, sectionLevelInfo->viewableOffset, SEEK_SET);
+ readViewableBlock(fdviewable, &vb);
+ readViewableBlockText(fdbook, &vb, &(_freeCachedEntryText.entryText));
+ lastEntryOffset = sectionLevelInfo->viewableOffset;
+ }
+ sprintf(numberBuf, "%d", sectionLevelInfo->startLevel);
+ startToken = "\\stepstartlevel";
+ startToken += numberBuf;
+ char *start = strstr(_freeCachedEntryText.entryText, startToken.c_str());
+ if (start) {
+ start += strlen(startToken.c_str());
+ char *end = strstr(start, "\\stepstartlevel");
+ if (end)
+ len = end - start;
+ else len = strlen(start);
+ }
+ *verseText = new char [ len + 1 ];
+ strncpy(*verseText, start, len);
+ (*verseText)[len] = 0;
+}
+
+
+void readSectionName(int fd, SectionLevelInfo *sli, char **name) {
+ short size;
+ lseek(fd, sli->nameOffset, SEEK_SET);
+ read(fd, &size, 2);
+ *name = new char [ size + 1 ];
+ read(fd, *name, size);
+ (*name)[size] = 0;
+}
+
+void readSectionLevelInfo(int fd, SectionLevelInfo *sli) {
+
+ read(fd, &(sli->parentOffset), 4);
+ read(fd, &(sli->previousOffset), 4);
+ read(fd, &(sli->nextOffset), 4);
+ read(fd, &(sli->viewableOffset), 4);
+ sli->viewableOffset = VIEWABLEBLOCKSTART + (VIEWABLEBLOCKSIZE * sli->viewableOffset);
+ read(fd, &(sli->startLevel), 2);
+ read(fd, &(sli->level), 1);
+ read(fd, &(sli->nameOffset), 4);
+ read(fd, &(sli->outSync_1), 4);
+ read(fd, &(sli->outSync_2), 2);
+}
+
+void cleanBuf(char *buf) {
+ char *from = buf;
+ char *to = buf;
+
+ while (*from) {
+ if ((*from != 10) && (*from != 13)) {
+ *to++ = *from++;
+ }
+ else {
+ from++;
+ }
+ }
+ *to = 0;
+}
diff --git a/utilities/stepdump.cpp b/utilities/stepdump.cpp
new file mode 100644
index 0000000..d52600a
--- /dev/null
+++ b/utilities/stepdump.cpp
@@ -0,0 +1,247 @@
+#include <iostream.h>
+#include <string>
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <lzsscomprs.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+
+using namespace std;
+
+typedef struct {
+ short versionRecordSize;
+ short publisherID;
+ short bookID;
+ short setID;
+ char conversionProgramVerMajor;
+ char conversionProgramVerMinor;
+ char leastCompatSTEPVerMajor;
+ char leastCompatSTEPVerMinor;
+ char encryptionType;
+ char editionID;
+ short modifiedBy;
+} Version;
+
+typedef struct {
+ short viewableHeaderRecordSize;
+ long viewableBlocksCount; // this is listed as nonGlossBlocksCount in spec!
+ long glossBlocksCount;
+ char compressionType; // 0 - none; 1 - LZSS
+ char reserved1;
+ short blockEntriesSize;
+ short reserved2;
+} ViewableHeader;
+
+typedef struct {
+ long offset;
+ long uncompressedSize;
+ long size;
+} ViewableBlock;
+
+void readVersion(int fd, Version *versionRecord);
+void readHeaderControlWordAreaText(int fd, char **buf);
+void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord);
+void readViewableBlock(int fd, ViewableBlock *vb);
+void readViewableBlockText(int fd, ViewableBlock *vb, char **buf);
+
+SWCompress *compress = 0;
+
+int main(int argc, char **argv) {
+
+ compress = new LZSSCompress();
+ char *buf;
+ Version versionRecord;
+ ViewableHeader viewableHeaderRecord;
+
+ if (argc < 2) {
+ cerr << "usage: "<< *argv << " <database to step module>\n";
+ exit (-1);
+ }
+
+ string bookpath = argv[1];
+ string fileName;
+
+ if ((argv[1][strlen(argv[1])-1] != '/') &&
+ (argv[1][strlen(argv[1])-1] != '\\'))
+ bookpath += "/";
+
+ fileName = bookpath + "Book.dat";
+ int fd = open(fileName.c_str(), O_RDONLY|O_BINARY);
+
+ if (fd < 1) {
+ cerr << "error, couldn't open file: " << fileName << "\n";
+ exit (-2);
+ }
+
+ readVersion(fd, &versionRecord);
+ readHeaderControlWordAreaText(fd, &buf);
+ delete [] buf;
+
+
+ fileName = bookpath + "Viewable.idx";
+ int fdv = open(fileName.c_str(), O_RDONLY|O_BINARY);
+
+ if (fdv < 1) {
+ cerr << "error, couldn't open file: " << fileName << "\n";
+ exit (-3);
+ }
+
+ readVersion(fdv, &versionRecord);
+ readViewableHeader(fdv, &viewableHeaderRecord);
+
+ ViewableBlock vb;
+
+ cout << "\n\nReading special preface viewable BLOCK 0";
+
+ readViewableBlock(fdv, &vb);
+ readViewableBlockText(fd, &vb, &buf);
+ delete [] buf;
+
+ int nonGlossBlocksCount = viewableHeaderRecord.viewableBlocksCount
+ - viewableHeaderRecord.glossBlocksCount;
+
+ cout << "\n\nReading " << nonGlossBlocksCount << " non-glossary viewable blocks";
+ // 1 because we already read the first block above
+ for (int i = 1; i < nonGlossBlocksCount; i++) {
+ cout << "\nNon-Glossary viewable block: " << i;
+ readViewableBlock(fdv, &vb);
+ readViewableBlockText(fd, &vb, &buf);
+ delete [] buf;
+ }
+
+ cout << "\n\nReading " << viewableHeaderRecord.glossBlocksCount << " glossary viewable blocks";
+ for (int i = 0; i < viewableHeaderRecord.glossBlocksCount; i++) {
+ cout << "\nGlossary viewable block: " << i;
+ readViewableBlock(fdv, &vb);
+ readViewableBlockText(fd, &vb, &buf);
+ delete [] buf;
+ }
+
+ close(fdv);
+ close(fd);
+
+}
+
+
+
+void readVersion(int fd, Version *versionRecord) {
+
+ cout << "\n\nReading Version Record (" << 16/*sizeof(struct Version)*/ << " bytes)\n\n";
+// DO NOT USE BECAUSE OF RECORD BYTE ALIGNMENT PROBLEMS
+// read(fd, &versionRecord, sizeof(struct Version));
+
+ cout << "Version Record Information\n";
+ read(fd, &(versionRecord->versionRecordSize), 2);
+ cout << "\tversionRecordSize: " << versionRecord->versionRecordSize << "\n";
+ read(fd, &(versionRecord->publisherID), 2);
+ cout << "\tpublisherID: " << versionRecord->publisherID << "\n";
+ read(fd, &(versionRecord->bookID), 2);
+ cout << "\tbookID: " << versionRecord->bookID << "\n";
+ read(fd, &(versionRecord->setID), 2);
+ cout << "\tsetID: " << versionRecord->setID << "\n";
+ read(fd, &(versionRecord->conversionProgramVerMajor), 1);
+ cout << "\tconversionProgramVerMajor: " << (int)versionRecord->conversionProgramVerMajor << "\n";
+ read(fd, &(versionRecord->conversionProgramVerMinor), 1);
+ cout << "\tconversionProgramVerMinor: " << (int)versionRecord->conversionProgramVerMinor << "\n";
+ read(fd, &(versionRecord->leastCompatSTEPVerMajor), 1);
+ cout << "\tleastCompatSTEPVerMajor: " << (int)versionRecord->leastCompatSTEPVerMajor << "\n";
+ read(fd, &(versionRecord->leastCompatSTEPVerMinor), 1);
+ cout << "\tleastCompatSTEPVerMinor: " << (int)versionRecord->leastCompatSTEPVerMinor << "\n";
+ read(fd, &(versionRecord->encryptionType), 1);
+ cout << "\tencryptionType: " << (int)versionRecord->encryptionType << "\n";
+ read(fd, &(versionRecord->editionID), 1);
+ cout << "\teditionID: " << (int)versionRecord->editionID << "\n";
+ read(fd, &(versionRecord->modifiedBy), 2);
+ cout << "\tmodifiedBy: " << versionRecord->modifiedBy << "\n";
+
+ int skip = versionRecord->versionRecordSize - 16/*sizeof(struct Version*/;
+
+ if (skip) {
+ cout << "\nSkipping " << skip << " unknown bytes.\n";
+ char skipbuf[skip];
+ read(fd, skipbuf, skip);
+ }
+}
+
+
+void readViewableHeader(int fd, ViewableHeader *viewableHeaderRecord) {
+
+ cout << "\n\nReading Viewable Header Record (" << 16/*sizeof(struct ViewableHeader)*/ << " bytes)\n\n";
+
+// DO NOT USE BECAUSE OF RECORD BYTE ALIGNMENT PROBLEMS
+// read(fd, &viewableHeaderRecord, sizeof(struct ViewableHeader));
+
+ cout << "Viewable Header Record Information\n";
+ read(fd, &(viewableHeaderRecord->viewableHeaderRecordSize), 2);
+ cout << "\tviewableHeaderRecordSize: " << viewableHeaderRecord->viewableHeaderRecordSize << "\n";
+ read(fd, &(viewableHeaderRecord->viewableBlocksCount), 4);
+ cout << "\tviewableBlocksCount: " << viewableHeaderRecord->viewableBlocksCount << "\n";
+ read(fd, &(viewableHeaderRecord->glossBlocksCount), 4);
+ cout << "\tglossBlocksCount: " << viewableHeaderRecord->glossBlocksCount << "\n";
+ read(fd, &(viewableHeaderRecord->compressionType), 1);
+ cout << "\tcompressionType: " << (int)viewableHeaderRecord->compressionType << "(0 - none; 1 - LZSS)\n";
+ read(fd, &(viewableHeaderRecord->reserved1), 1);
+ cout << "\treserved1: " << (int)viewableHeaderRecord->reserved1 << "\n";
+ read(fd, &(viewableHeaderRecord->blockEntriesSize), 2);
+ cout << "\tblockEntriesSize: " << viewableHeaderRecord->blockEntriesSize << "\n";
+ read(fd, &(viewableHeaderRecord->reserved2), 2);
+ cout << "\treserved2: " << viewableHeaderRecord->reserved2 << "\n";
+
+ int skip = viewableHeaderRecord->viewableHeaderRecordSize - 16/*sizeof(struct ViewableHeader)*/;
+
+ if (skip) {
+ cout << "\nSkipping " << skip << " unknown bytes.\n";
+ char skipbuf[skip];
+ read(fd, skipbuf, skip);
+ }
+}
+
+
+void readViewableBlockText(int fd, ViewableBlock *vb, char **buf) {
+ unsigned long size = vb->size;
+
+ *buf = new char [ ((vb->size > vb->uncompressedSize) ? vb->size : vb->uncompressedSize) + 1 ];
+ lseek(fd, vb->offset, SEEK_SET);
+ read(fd, *buf, vb->size);
+
+ compress->zBuf(&size, *buf);
+ strcpy(*buf, compress->Buf());
+ cout << "Viewable Block Text:\n";
+ cout << *buf << "\n\n";
+}
+
+
+void readViewableBlock(int fd, ViewableBlock *vb) {
+
+ cout << "\n\nReading Viewable Block (" << 12/*sizeof(struct ViewableHeader)*/ << " bytes)\n\n";
+
+// DO NOT USE BECAUSE OF RECORD BYTE ALIGNMENT PROBLEMS
+// read(fd, &vb, sizeof(struct ViewableBlock));
+
+ cout << "Viewable Block Information\n";
+ read(fd, &(vb->offset), 4);
+ cout << "\toffset: " << vb->offset << "\n";
+ read(fd, &(vb->uncompressedSize), 4);
+ cout << "\tuncompressedSize: " << vb->uncompressedSize << "\n";
+ read(fd, &(vb->size), 4);
+ cout << "\tsize: " << vb->size << "\n";
+}
+
+
+void readHeaderControlWordAreaText(int fd, char **buf) {
+ long headerControlWordAreaSize;
+ read(fd, &headerControlWordAreaSize, 4);
+ cout << "Reading Header Control Word Area (" << headerControlWordAreaSize << " bytes)\n\n";
+
+ *buf = new char [headerControlWordAreaSize + 1];
+
+ read(fd, *buf, headerControlWordAreaSize);
+ (*buf)[headerControlWordAreaSize] = 0;
+
+ cout << "headerControlWordArea:\n" << *buf << "\n";
+}
diff --git a/utilities/thml2gbs.cpp b/utilities/thml2gbs.cpp
new file mode 100644
index 0000000..eb1eadc
--- /dev/null
+++ b/utilities/thml2gbs.cpp
@@ -0,0 +1,329 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <entriesblk.h>
+#include <iostream.h>
+#include <string>
+#include <stdio.h>
+#include <treekeyidx.h>
+#include <rawgenbook.h>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+void printTree(TreeKeyIdx treeKey, TreeKeyIdx *target = 0, int level = 1) {
+ if (!target)
+ target = &treeKey;
+
+ unsigned long currentOffset = target->getOffset();
+ cout << ((currentOffset == treeKey.getOffset()) ? "==>" : "");
+ for (int i = 0; i < level; i++) cout << "\t";
+ cout << treeKey.getLocalName() << "/\n";
+ if (treeKey.firstChild()) {
+ printTree(treeKey, target, level+1);
+ treeKey.parent();
+ }
+ if (treeKey.nextSibling())
+ printTree(treeKey, target, level);
+
+}
+
+
+
+void setkey (TreeKeyIdx * treeKey, char* keybuffer) {
+ char* tok = strtok(keybuffer, "/");
+ while (tok) {
+ bool foundkey = false;
+ if (treeKey->hasChildren()) {
+ treeKey->firstChild();
+ if (!strcmp(treeKey->getLocalName(), tok)) {
+ foundkey = true;
+ } else {
+ while (treeKey->nextSibling()) {
+ if (treeKey->getLocalName()) {
+ if (!strcmp(treeKey->getLocalName(), tok)) {
+ foundkey = true;
+ }
+ }
+ }
+ }
+ if (!foundkey) {
+ treeKey->append();
+ treeKey->setLocalName(tok);
+ treeKey->save();
+ }
+ }
+ else {
+ treeKey->appendChild();
+ treeKey->setLocalName(tok);
+ treeKey->save();
+ }
+
+ //DEBUG cout << treeKey->getLocalName() << " : " << tok << endl;
+
+ tok = strtok(NULL, "/");
+
+ }
+}
+
+int main(int argc, char **argv) {
+
+ const char * helptext ="thml2gbs 1.0 General Book module creation tool for the SWORD Project\n usage:\n %s <filename> [modname] [0|1 - long names] [0|1 - output in 'import format']\n";
+
+ signed long i = 0;
+ string divs[6];
+ int level = 0;
+ char* keybuffer = new char[2048];
+ char* entbuffer = new char[1048576];
+ char modname[16];
+ unsigned long entrysize = 0;
+ unsigned long keysize = 0;
+
+ bool closer = false;
+ bool longnames = false;
+ if (argc > 3)
+ if (strcmp(argv[3], "0"))
+ longnames = true;
+ bool exportfile = false;
+ if (argc > 4)
+ if (strcmp(argv[4], "0"))
+ exportfile = true;
+
+
+ char* n = new char[256];
+ char* type = new char[256];
+ char* title= new char[512];
+
+ char* strtmp;
+
+ if (argc > 2) {
+ strcpy (modname, argv[2]);
+ }
+ else if (argc > 1) {
+ for (i = 0; (i < 16) && (argv[1][i]) && (argv[1][i] != '.'); i++) {
+ modname[i] = argv[1][i];
+ }
+ modname[i] = 0;
+ }
+ else {
+ fprintf(stderr, helptext, argv[0]);
+ exit(-1);
+ }
+
+
+ FILE *infile;
+ infile = fopen(argv[1], "r");
+ FILE *outfile;
+ if (exportfile) {
+ strcat (modname, ".imp");
+ outfile = fopen(modname, "w");
+ }
+
+ TreeKeyIdx * treeKey;
+ RawGenBook *book;
+
+ if (!exportfile) {
+ // Do some initialization stuff
+ TreeKeyIdx::create(modname);
+ treeKey = new TreeKeyIdx(modname);
+ RawGenBook::createModule(modname);
+ delete treeKey;
+ book = new RawGenBook(modname);
+ //DEBUG TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
+ treeKey = ((TreeKeyIdx *)((SWKey *)(*book)));
+ }
+
+ int c;
+ while ((c = fgetc(infile)) != EOF) {
+ if (c == '<') {
+ if (fgets( keybuffer, 6, infile )) {
+ if (!strncmp(keybuffer, "/div", 4) && (keybuffer[4] > '0' && keybuffer[4] < '7')) {
+ if (!closer) {
+ keysize = 0;
+ keybuffer[0] = 0;
+ for (i = 0; i < level; i++) {
+ keybuffer[keysize] = '/';
+ keysize++;
+ keybuffer[keysize] = 0;
+ strcat (keybuffer, divs[i].c_str());
+ keysize += divs[i].length();
+ }
+
+ if (level) {
+ cout << keybuffer << endl;
+ if (exportfile) {
+ fprintf (outfile, "$$$%s\n%s\n", keybuffer, entbuffer);
+ }
+ else {
+ treeKey->root();
+ setkey(treeKey, keybuffer);
+ book->setentry(entbuffer, entrysize); // save text to module at current position
+ }
+ }
+ }
+ level--;
+ entbuffer[0] = 0;
+ entrysize = 0;
+
+ closer = true;
+ }
+ else if (strncmp(keybuffer, "div", 3)
+ || (keybuffer[3] < '1' || keybuffer[3] > '6')) {
+ for (i = 4; i >= 0; i--) {
+ ungetc(keybuffer[i], infile);
+ }
+ entbuffer[entrysize] = '<';
+ entrysize++;
+ entbuffer[entrysize] = 0;
+ }
+ else {
+ //we have a divN...
+ if (!closer) {
+ keysize = 0;
+ keybuffer[0] = 0;
+ for (i = 0; i < level; i++) {
+ keybuffer[keysize] = '/';
+ keysize++;
+ keybuffer[keysize] = 0;
+ strcat (keybuffer, divs[i].c_str());
+ keysize += divs[i].length();
+ }
+
+ if (level) {
+ cout << keybuffer << endl;
+ if (exportfile) {
+ fprintf (outfile, "$$$%s\n%s\n", keybuffer, entbuffer);
+ }
+ else {
+ treeKey->root();
+ setkey(treeKey, keybuffer);
+ book->setentry(entbuffer, entrysize); // save text to module at current position
+ }
+ }
+ }
+
+ entbuffer[0] = 0;
+ entrysize = 0;
+
+ level++;
+ keysize = 0;
+ while ((c = fgetc(infile)) != EOF) {
+ if (c != '>') {
+ keybuffer[keysize] = c;
+ keysize++;
+ }
+ else {
+ break;
+ }
+ }
+ keybuffer[keysize] = 0;
+
+ type[0] = 0;
+ strtmp = strstr(keybuffer, "type=\"");
+ if (strtmp) {
+ strtmp += 6;
+ i = 0;
+ for (;*strtmp != '\"'; strtmp++) {
+ if (*strtmp == 10) {
+ type[i] = ' ';
+ i++;
+ }
+ else if (*strtmp != 13) {
+ type[i] = *strtmp;
+ i++;
+ }
+ }
+ type[i] = 0;
+ }
+
+ n[0] = 0;
+ strtmp = strstr(keybuffer, "n=\"");
+ if (strtmp) {
+ strtmp += 3;
+ i = 0;
+ for (;*strtmp != '\"'; strtmp++) {
+ if (*strtmp == 10) {
+ n[i] = ' ';
+ i++;
+ }
+ else if (*strtmp != 13) {
+ n[i] = *strtmp;
+ i++;
+ }
+ }
+ n[i] = 0;
+ }
+
+ title[0] = 0;
+ strtmp = strstr(keybuffer, "title=\"");
+ if (strtmp) {
+ strtmp += 7;
+ i = 0;
+ for (;*strtmp != '\"'; strtmp++) {
+ if (*strtmp == 10) {
+ title[i] = ' ';
+ i++;
+ }
+ else if (*strtmp != 13) {
+ title[i] = *strtmp;
+ i++;
+ }
+ }
+ title[i] = 0;
+ }
+ strcpy (keybuffer, type);
+ if (strlen(keybuffer) && strlen(n))
+ strcat (keybuffer, " ");
+ strcat (keybuffer, n);
+
+ if (longnames && strlen(keybuffer))
+ strcat (keybuffer, ": ");
+ if (longnames || !strlen(keybuffer))
+ strcat (keybuffer, title);
+
+ divs[level-1] = keybuffer;
+
+ closer = false;
+ }
+ }
+ }
+ else if (c != 13) {
+ entbuffer[entrysize] = c;
+ entrysize++;
+ entbuffer[entrysize] = 0;
+ }
+ }
+//DEBUG printTree(root, treeKey);
+
+ delete treeKey;
+ delete book;
+ delete n;
+ delete type;
+ delete title;
+ delete keybuffer;
+ delete entbuffer;
+
+ return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/utilities/txt2sword.cpp b/utilities/txt2sword.cpp
new file mode 100644
index 0000000..5528905
--- /dev/null
+++ b/utilities/txt2sword.cpp
@@ -0,0 +1,233 @@
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <versekey.h>
+#include <sys/stat.h>
+#include <iostream.h>
+const long MAXVLEN = 8192;
+
+int fp, vfp, cfp, bfp, dfp;
+short size;
+
+void ProcessFile (char *fileName, char *testament);
+char getVerse (int fp, int *verseNum, char *verseBuf, char testament);
+void filterVerse (char *text, char lang);
+void openFiles (char *fileName);
+
+int main (int argc, char **argv) {
+ if (argc == 3)
+ ProcessFile(argv[1], argv[2]);
+ else
+ ProcessFile(argv[1], "ot");
+ return 0;
+};
+
+void ProcessFile(char *fileName, char *testament)
+{
+ unsigned long pos = 0L;
+ unsigned short size = 0, tmp;
+ int verseNum, curbook = 0, curchap = 0, curverse = 0, curTestament = 1;
+ char buf[127];
+ VerseKey mykey;
+ char verseBuf[MAXVLEN];
+ bool fail = false;
+ char end = 0;
+
+ if ((fp = open(fileName, O_RDONLY)) == -1) {
+ sprintf(buf, "Couldn't open file: %s\n", fileName);
+ printf(buf);
+ return;
+ }
+
+ if (!strcmp(testament, "nt")) {
+ openFiles("nt");
+
+ mykey = "Matthew 1:1";
+ } else {
+ openFiles("ot");
+
+ mykey = "Genesis 1:1";
+ }
+
+ // getVerse(fp, &verseNum, verseBuf, 1);
+ do {
+ end = getVerse(fp, &verseNum, verseBuf, mykey.Testament());
+
+ if (mykey.Verse() == 1) { /* if we're at a new chapter */
+ if (mykey.Chapter() == 1) { /* if we're at a new book */
+ if (mykey.Testament() != curTestament) { // we've made it to new testament
+ curTestament = mykey.Testament();
+ close(vfp); // verse
+ close(cfp); // chapter
+ close(bfp); // book
+ close(dfp); // data
+ openFiles("nt");
+ }
+
+ pos = lseek(cfp, 0, SEEK_CUR);
+ write(bfp, &pos, 4);
+ pos = lseek(vfp, 0, SEEK_CUR); /* Book intro (cps) */
+ write(cfp, &pos, 4);
+ pos = 0L;
+ 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 = 0L;
+ tmp = 0;
+ write(vfp, &pos, 4); /* Chapter intro */
+ write(vfp, &tmp, 2);
+ curchap++;
+ }
+ else curverse++;
+
+ if (mykey.Chapter() != curchap) {
+ sprintf(buf, "Error: Found chaptures out of sequence\n");
+ printf(buf);
+ fail = true;
+ break;
+ }
+ if ((mykey.Verse() != curverse) || (curverse != verseNum)) {
+ printf("Error: Found verses out of sequence");
+ sprintf(buf, "Expected %d (%s), but got %d\n\n", curverse, (const char *)mykey, verseNum);
+ printf(buf);
+ printf(" Currently SWORD only supports KJV verse numbering and book ordering.\n");
+ printf(" Try combining extra verses with the last valid verse just before.\n");
+ printf(" This way, even though they will display in SWORD along with the previous verse, all data will be displayed.\n");
+ printf(" Where verses are missing, add a blank entry.\n");
+ printf(" Then try rerunning\n");
+ fail = true;
+ break;
+ }
+
+ pos = lseek(dfp, 0, SEEK_CUR);
+ write(vfp, &pos, 4);
+ size = strlen(verseBuf);
+ write(vfp, &size, 2);
+ sprintf(buf, "%2d:%3d:%3d (%s) found at offset: %7ld; size: %d\n", curbook, mykey.Chapter(), mykey.Verse(), (const char *)mykey, pos, size);
+ printf(buf);
+ if (size > 1000) {
+ printf("WARNING: Strange Size.");
+ }
+ write(dfp, verseBuf, size);
+ mykey++;
+ } while (!end);
+
+ close(vfp); // verse
+ close(cfp); // chapter
+ close(bfp); // book
+ close(dfp); // data
+ close(fp); // source
+ if (!fail)
+ printf("SUCCESS!!!!!!!");
+}
+
+
+char getVerse(int fp, int *verseNum, char *verseBuf, char testament)
+{
+ int retVal = 1;
+ int tvn = 0;
+ char * temp_char = new char[2];
+ temp_char[1] = 0;
+ *verseBuf = 0;
+
+ while (1) {
+ retVal = read(fp, temp_char, 1);
+
+ if (isdigit(temp_char[0]))
+ tvn = (10 * tvn) + temp_char[0] - '0';
+ else
+ break;
+ }
+ cout << tvn << " ";
+ *verseNum = tvn;
+
+ while (1) {
+ retVal = read(fp, temp_char, 1);
+ if (temp_char[0] == 10 || temp_char[0] == 13)
+ break;
+ else
+ strcat (verseBuf, temp_char);
+ }
+ strcat (verseBuf, "\n");
+
+ cout << verseBuf;
+
+ if (retVal)
+ retVal = 0;
+ else
+ retVal = 1;
+
+ delete temp_char;
+ return retVal;
+}
+
+void openFiles(char *fileName)
+{
+ char buf[128];
+ long pos;
+ short size;
+
+ unlink(fileName);
+ if ((dfp = open(fileName, O_CREAT|O_WRONLY, S_IREAD|S_IWRITE)) == -1) {
+ sprintf(buf, "Couldn't open file: %s\n", fileName);
+ printf(buf);
+ return;
+ }
+
+ sprintf(buf, "%s.vss", fileName);
+ unlink(buf);
+ if ((vfp = open(buf, O_CREAT|O_WRONLY, S_IREAD|S_IWRITE)) == -1) {
+ sprintf(buf, "Couldn't open file: %s\n", buf);
+ printf(buf);
+ return;
+ }
+
+ sprintf(buf, "%s.cps", fileName);
+ unlink(buf);
+ if ((cfp = open(buf, O_CREAT|O_WRONLY, S_IREAD|S_IWRITE)) == -1) {
+ sprintf(buf, "Couldn't open file: %s\n", buf);
+ printf(buf);
+ return;
+ }
+
+ sprintf(buf, "%s.bks", fileName);
+ unlink(buf);
+ if ((bfp = open(buf, O_CREAT|O_WRONLY, S_IREAD|S_IWRITE)) == -1) {
+ sprintf(buf, "Couldn't open file: %s\n", buf);
+ printf(buf);
+ return;
+ }
+ 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);
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/utilities/vpl2mod.cpp b/utilities/vpl2mod.cpp
new file mode 100644
index 0000000..305225f
--- /dev/null
+++ b/utilities/vpl2mod.cpp
@@ -0,0 +1,250 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef __GNUC__
+#include <io.h>
+#else
+#include <unistd.h>
+#endif
+
+#include <swmgr.h>
+#include <rawtext.h>
+#include <iostream.h>
+#include <string>
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+char readline(int fd, char **buf) {
+ char ch;
+ if (*buf)
+ delete [] *buf;
+ *buf = 0;
+ int len;
+
+
+ long index = lseek(fd, 0, SEEK_CUR);
+ // clean up any preceding white space
+ while ((len = read(fd, &ch, 1)) == 1) {
+ if ((ch != 13) && (ch != ' ') && (ch != '\t'))
+ break;
+ else index++;
+ }
+
+
+ while (ch != 10) {
+ if ((len = read(fd, &ch, 1)) != 1)
+ break;
+ }
+
+ int size = (lseek(fd, 0, SEEK_CUR) - index) - 1;
+
+ *buf = new char [ size + 1 ];
+
+ if (size > 0) {
+ lseek(fd, index, SEEK_SET);
+ read(fd, *buf, size);
+ read(fd, &ch, 1); //pop terminating char
+ (*buf)[size] = 0;
+
+ // clean up any trailing junk on buf
+ for (char *it = *buf+(strlen(*buf)-1); it > *buf; it--) {
+ if ((*it != 10) && (*it != 13) && (*it != ' ') && (*it != '\t'))
+ break;
+ else *it = 0;
+ }
+ }
+ else **buf = 0;
+ return !len;
+}
+
+
+char *parseVReg(char *buf) {
+ char stage = 0;
+
+ while (*buf) {
+ switch (stage) {
+ case 0:
+ if (isalpha(*buf))
+ stage++;
+ break;
+ case 1:
+ if (isdigit(*buf))
+ stage++;
+ break;
+ case 2:
+ if (*buf == ':')
+ stage++;
+ break;
+ case 3:
+ if (isdigit(*buf))
+ stage++;
+ break;
+ case 4:
+ if (*buf == ' ') {
+ *buf = 0;
+ return ++buf;
+ }
+ break;
+ }
+ buf++;
+ }
+ return (stage == 4) ? buf : 0; // if we got to stage 4 return empty buf, else return error
+}
+
+
+bool isKJVRef(const char *buf) {
+ VerseKey vk, test;
+ vk.AutoNormalize(0);
+ vk.Headings(1); // turn on mod/testmnt/book/chap headings
+ vk.Persist(1);
+ // lets do some tests on the verse --------------
+ vk = buf;
+ test = buf;
+
+ if (vk.Testament() && vk.Book() && vk.Chapter() && vk.Verse()) { // if we're not a heading
+// cerr << (const char*)vk << " == " << (const char*)test << endl;
+ return (vk == test);
+ }
+ else return true; // no check if we're a heading... Probably bad.
+}
+
+
+void fixText(char *text) {
+ char *to = text;
+ while(*text) {
+ *to++ = *text++;
+ *to++ = *text++;
+ if (!*text)
+ break;
+ if (*text != ' ')
+ cerr << "problem\n";
+ else text++;
+ }
+ *to = 0;
+}
+
+int main(int argc, char **argv) {
+
+ // Let's test our command line arguments
+ if (argc < 2) {
+// fprintf(stderr, "usage: %s <vpl_file> </path/to/mod> [0|1 - file includes prepended verse references]\n", argv[0]);
+ fprintf(stderr, "usage: %s <source_vpl_file> </path/to/output/mod/> [0|1 - prepended verse refs] [0|1 - NT only]\n\n", argv[0]);
+ fprintf(stderr, "\tWith no verse refs, source file must contain exactly 31102 lines.\n");
+ fprintf(stderr, "\tThis is KJV verse count plus headings for MODULE,\n");
+ fprintf(stderr, "\tTESTAMENT, BOOK, CHAPTER. An example snippet follows:\n\n");
+ fprintf(stderr, "\t\tMODULE HEADER\n");
+ fprintf(stderr, "\t\tOLD TESTAMENT HEADER\n");
+ fprintf(stderr, "\t\tGENESIS HEADER\n");
+ fprintf(stderr, "\t\tCHAPTER 1 HEADER\n");
+ fprintf(stderr, "\t\tIn the beginning...\n\n");
+ fprintf(stderr, "\t... implying there must also be a CHAPTER2 HEADER,\n");
+ fprintf(stderr, "\tEXODUS HEADER, NEW TESTAMENT HEADER, etc. If there is no text for\n");
+ fprintf(stderr, "\tthe header, a blank line must, at least, hold place.\n\n");
+ fprintf(stderr, "\tWith verse refs, source file must simply contain any number of lines,\n");
+ fprintf(stderr, "\tthat begin with the verse reference for which it is an entry. e.g.:\n\n");
+ fprintf(stderr, "\t\tgen 1:0 CHAPTER 1 HEADER\n");
+ fprintf(stderr, "\t\tgen 1:1 In the beginning...\n\n");
+ exit(-1);
+ }
+
+ // Let's see if we can open our input file
+ int fd = open(argv[1], O_RDONLY|O_BINARY);
+ if (fd < 0) {
+ fprintf(stderr, "error: %s: couldn't open input file: %s \n", argv[0], argv[1]);
+ exit(-2);
+ }
+
+ // Try to initialize a default set of datafiles and indicies at our
+ // datapath location passed to us from the user.
+ if (RawText::createModule(argv[2])) {
+ fprintf(stderr, "error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
+ exit(-3);
+ }
+
+ // not used yet, but for future support of a vpl file with each line
+ // prepended with verse reference, eg. "Gen 1:1 In the beginning..."
+ bool vref = false;
+ if (argc > 3)
+ vref = (argv[3][0] == '0') ? false : true;
+
+ // if 'nt' is the 4th arg, our vpl file only has the NT
+ bool ntonly = false;
+ if (argc > 4)
+ ntonly = (argv[4][0] == '0') ? false : true;
+
+ // Do some initialization stuff
+ char *buffer = 0;
+ RawText mod(argv[2]); // open our datapath with our RawText driver.
+ VerseKey vk;
+ vk.AutoNormalize(0);
+ vk.Headings(1); // turn on mod/testmnt/book/chap headings
+ vk.Persist(1);
+
+ mod.SetKey(vk);
+
+ // Loop through module from TOP to BOTTOM and set next line from
+ // input file as text for this entry in the module
+ mod = TOP;
+ if (ntonly) vk = "Matthew 1:1";
+
+ int successive = 0; //part of hack below
+ while ((!mod.Error()) && (!readline(fd, &buffer))) {
+ if (*buffer == '|') // comments, ignore line
+ continue;
+ if (vref) {
+ const char *verseText = parseVReg(buffer);
+ if (!verseText) { // if we didn't find a valid verse ref
+ cerr << "No valid verse ref found on line: " << buffer << "\n";
+ exit(-4);
+ }
+
+ vk = buffer;
+ string orig = mod.getRawEntry();
+
+ if (!isKJVRef(buffer)) {
+ VerseKey origVK = vk;
+ /* This block is functioning improperly -- problem with AutoNormalize???
+ do {
+ vk--;
+ }
+ while (!vk.Error() && !isKJVRef(vk)); */
+ //hack to replace above:
+ successive++;
+ vk -= successive;
+ orig = mod.getRawEntry();
+
+ cerr << "Not a valid KJV ref: " << origVK << "\n";
+ cerr << "appending to ref: " << vk << "\n";
+ orig += " [ (";
+ orig += origVK;
+ orig += ") ";
+ orig += verseText;
+ orig += " ] ";
+ verseText = orig.c_str();
+ }
+ else {
+ successive = 0;
+ }
+
+ if (orig.length() > 1)
+ cerr << "Warning, overwriting verse: " << vk << endl;
+
+ // ------------- End verse tests -----------------
+ mod << verseText; // save text to module at current position
+ }
+ else {
+ fixText(buffer);
+ mod << buffer; // save text to module at current position
+ mod++; // increment module position
+ }
+ }
+
+ // clear up our buffer that readline might have allocated
+ if (buffer)
+ delete [] buffer;
+}