summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:59 -0400
committerRoberto C. Sanchez <roberto@connexer.com>2014-03-29 10:53:59 -0400
commit03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (patch)
tree847326a4de82f0241ac87cbbc427a1b92a696a02 /include
parentd7469385b05b9510338407fa123e9ad090f80af6 (diff)
Imported Upstream version 1.5.11
Diffstat (limited to 'include')
-rw-r--r--include/.cvsignore2
-rw-r--r--include/Greek2Greek.h117
-rw-r--r--include/GreekChars.h154
-rw-r--r--include/Makefile5
-rw-r--r--include/Makefile.am158
-rw-r--r--include/SwordAPI.pas69
-rw-r--r--include/apocrypha.h219
-rw-r--r--include/canon.h697
-rw-r--r--include/cipherfil.h40
-rw-r--r--include/config.h66
-rw-r--r--include/config.h.in65
-rw-r--r--include/curlftpt.h32
-rw-r--r--include/defs.h109
-rw-r--r--include/echomod.h41
-rw-r--r--include/encfiltmgr.h86
-rw-r--r--include/entriesblk.h34
-rw-r--r--include/femain.h32
-rw-r--r--include/filemgr.h190
-rw-r--r--include/flatapi.h106
-rw-r--r--include/ftplib.h124
-rw-r--r--include/ftplibftpt.h34
-rw-r--r--include/ftpparse.h53
-rw-r--r--include/ftptrans.h64
-rw-r--r--include/gbffootnotes.h38
-rw-r--r--include/gbfheadings.h38
-rw-r--r--include/gbfhtml.h46
-rw-r--r--include/gbfhtmlhref.h47
-rw-r--r--include/gbfmorph.h38
-rw-r--r--include/gbfosis.h68
-rw-r--r--include/gbfplain.h37
-rw-r--r--include/gbfredletterwords.h40
-rw-r--r--include/gbfrtf.h37
-rw-r--r--include/gbfstrongs.h38
-rw-r--r--include/gbfthml.h37
-rw-r--r--include/gbfwebif.h41
-rw-r--r--include/gbfwordjs.h52
-rw-r--r--include/greeklexattribs.h37
-rw-r--r--include/hebrewmcim.h32
-rw-r--r--include/hrefcom.h52
-rw-r--r--include/installmgr.h105
-rw-r--r--include/latin1utf16.h37
-rw-r--r--include/latin1utf8.h37
-rw-r--r--include/listkey.h144
-rw-r--r--include/localemgr.h118
-rw-r--r--include/lzsscomprs.h82
-rw-r--r--include/markupfiltmgr.h76
-rw-r--r--include/multimapwdef.h39
-rw-r--r--include/nullim.h16
-rw-r--r--include/osisbook.h640
-rw-r--r--include/osisfootnotes.h38
-rw-r--r--include/osisheadings.h38
-rw-r--r--include/osishtmlhref.h63
-rw-r--r--include/osislemma.h38
-rw-r--r--include/osismorph.h38
-rw-r--r--include/osismorphsegmentation.h42
-rw-r--r--include/osisosis.h54
-rw-r--r--include/osisplain.h49
-rw-r--r--include/osisredletterwords.h38
-rw-r--r--include/osisrtf.h42
-rw-r--r--include/osisscripref.h38
-rw-r--r--include/osisstrongs.h38
-rw-r--r--include/osisvariants.h54
-rw-r--r--include/osiswebif.h44
-rw-r--r--include/osiswordjs.h52
-rw-r--r--include/papyriplain.h37
-rw-r--r--include/plainfootnotes.h41
-rw-r--r--include/plainhtml.h38
-rw-r--r--include/rawcom.h63
-rw-r--r--include/rawcom4.h63
-rw-r--r--include/rawfiles.h86
-rw-r--r--include/rawgenbook.h65
-rw-r--r--include/rawld.h67
-rw-r--r--include/rawld4.h67
-rw-r--r--include/rawstr.h58
-rw-r--r--include/rawstr4.h59
-rw-r--r--include/rawtext.h66
-rw-r--r--include/rawtext4.h67
-rw-r--r--include/rawverse.h42
-rw-r--r--include/rawverse4.h42
-rw-r--r--include/regex.h545
-rw-r--r--include/roman.h36
-rw-r--r--include/rtfhtml.h37
-rw-r--r--include/sapphire.h59
-rw-r--r--include/scsuutf8.h40
-rw-r--r--include/stringmgr.h120
-rw-r--r--include/strkey.h55
-rw-r--r--include/swbasicfilter.h204
-rw-r--r--include/swbuf.h430
-rw-r--r--include/swcacher.h43
-rw-r--r--include/swcipher.h52
-rw-r--r--include/swcom.h69
-rw-r--r--include/swcomprs.h48
-rw-r--r--include/swconfig.h87
-rw-r--r--include/swdisp.h53
-rw-r--r--include/swfilter.h55
-rw-r--r--include/swfiltermgr.h87
-rw-r--r--include/swgenbook.h57
-rw-r--r--include/swinputmeth.h34
-rw-r--r--include/swkey.h214
-rw-r--r--include/swld.h66
-rw-r--r--include/swlocale.h76
-rw-r--r--include/swlog.h63
-rw-r--r--include/swmacs.h32
-rw-r--r--include/swmgr.h353
-rw-r--r--include/swmodule.h673
-rw-r--r--include/swobject.h65
-rw-r--r--include/swoptfilter.h84
-rw-r--r--include/swsearchable.h101
-rw-r--r--include/swtext.h69
-rw-r--r--include/swunicod.h43
-rw-r--r--include/swversion.h65
-rw-r--r--include/sysdata.h77
-rw-r--r--include/teihtmlhref.h51
-rw-r--r--include/teiplain.h49
-rw-r--r--include/teirtf.h50
-rw-r--r--include/thmlfootnotes.h38
-rw-r--r--include/thmlgbf.h38
-rw-r--r--include/thmlheadings.h38
-rw-r--r--include/thmlhtml.h46
-rw-r--r--include/thmlhtmlhref.h53
-rw-r--r--include/thmllemma.h38
-rw-r--r--include/thmlmorph.h38
-rw-r--r--include/thmlosis.h38
-rw-r--r--include/thmlplain.h37
-rw-r--r--include/thmlrtf.h51
-rw-r--r--include/thmlscripref.h38
-rw-r--r--include/thmlstrongs.h38
-rw-r--r--include/thmlvariants.h53
-rw-r--r--include/thmlwebif.h40
-rw-r--r--include/thmlwordjs.h52
-rw-r--r--include/treekey.h122
-rw-r--r--include/treekeyidx.h122
-rw-r--r--include/unicodertf.h37
-rw-r--r--include/untgz.h10
-rw-r--r--include/url.h93
-rw-r--r--include/utf16utf8.h37
-rw-r--r--include/utf8arshaping.h49
-rw-r--r--include/utf8bidireorder.h47
-rw-r--r--include/utf8cantillation.h38
-rw-r--r--include/utf8greekaccents.h38
-rw-r--r--include/utf8hebrewpoints.h38
-rw-r--r--include/utf8html.h37
-rw-r--r--include/utf8latin1.h38
-rw-r--r--include/utf8nfc.h45
-rw-r--r--include/utf8nfkd.h45
-rw-r--r--include/utf8transliterator.h87
-rw-r--r--include/utf8utf16.h37
-rw-r--r--include/utilstr.h46
-rw-r--r--include/utilxml.h88
-rw-r--r--include/versekey.h444
-rw-r--r--include/versetreekey.h102
-rw-r--r--include/zcom.h73
-rw-r--r--include/zconf.h279
-rw-r--r--include/zipcomprs.h43
-rw-r--r--include/zld.h74
-rw-r--r--include/zlib.h893
-rw-r--r--include/zstr.h76
-rw-r--r--include/ztext.h88
-rw-r--r--include/zverse.h59
159 files changed, 14059 insertions, 0 deletions
diff --git a/include/.cvsignore b/include/.cvsignore
new file mode 100644
index 0000000..9a4764a
--- /dev/null
+++ b/include/.cvsignore
@@ -0,0 +1,2 @@
+config.h.in
+stamp-h1
diff --git a/include/Greek2Greek.h b/include/Greek2Greek.h
new file mode 100644
index 0000000..00359c1
--- /dev/null
+++ b/include/Greek2Greek.h
@@ -0,0 +1,117 @@
+//*****************************************************************************
+// Author : William Dicks ***
+// Date Created: 10 February 1998 ***
+// Purpose : Interface for Greek to b-Greek conversion and vice versa ***
+// File Name : Greek2Greek.h ***
+// ***
+// Author info : ---------------------------------------------------------- ***
+// Address : 23 Tieroogpark ***
+// : Hoewe Str ***
+// : Elarduspark X3 ***
+// : 0181 ***
+// : South Africa ***
+// Home Tel: +27 (0)12 345 3166 ***
+// Cell No : +27 (0)82 577 4424 ***
+// e-mail : wd@isis.co.za ***
+// Church WWW : http://www.hatfield.co.za ***
+//*****************************************************************************
+/*
+ *
+ * $Id: Greek2Greek.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef __GREEK2GREEK
+#define __GREEK2GREEK
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+//*****************************************************************************
+// Used to convert a string created by using the Greek font supplied with the
+// Sword Project to a string that conforms to the b-Greek discussion list
+// method of transliteration.
+//*****************************************************************************
+unsigned char Greek2bGreek (unsigned char *sResult, unsigned char *sGreekText,
+ int nMaxResultBuflen);
+
+//*****************************************************************************
+// Used to convert a string created by using the b-Greek method of
+// transliteration to a string that can be converted to a Greek-font readable
+// string.
+//*****************************************************************************
+unsigned char bGreek2Greek (unsigned char *sResult,
+ unsigned char *sGreekText, int nMaxResultBuflen);
+
+//*****************************************************************************
+// Parse a Greek font created string and return the b-Greek equivalent
+//*****************************************************************************
+int ParseGreek (unsigned char *sResult,
+ unsigned char *sGreekText, int nMaxResultBuflen);
+
+//*****************************************************************************
+// Parse a b-Greek string and return the Greek font equivalent
+//*****************************************************************************
+int ParsebGreek (unsigned char *sResult,
+ unsigned char *sGreekText, int nMaxResultBuflen);
+
+//*****************************************************************************
+// Convert a unsigned character to a GREEK font unsigned character
+//*****************************************************************************
+unsigned char char2Font (unsigned char letter, // bGreek letter to convert to Font letter
+ bool finalSigma, // Is it a final SIGMA
+ bool iota, // TRUE = IOTA subscript; FALSE = No IOTA
+ bool breathing, // TRUE = add breathing; FALSE = no breathing
+ bool rough); // TRUE = rough breathing; False = smooth
+
+//*****************************************************************************
+// Convert a GREEK font unsigned character to a unsigned character
+//*****************************************************************************
+unsigned char Font2char (unsigned char letter, // bGreek letter to convert to Font letter
+ bool & iota, // TRUE = IOTA subscript; FALSE = No IOTA
+ bool & breathing, // TRUE = add breathing; FALSE = no breathing
+ bool & rough); // TRUE = rough breathing; False = smooth
+
+
+//*****************************************************************************
+// Identify and return a bGreek letter from a special font char
+//*****************************************************************************
+bool getSpecialChar (unsigned char Font, unsigned char &letter);
+
+//*****************************************************************************
+// true if the font character is a special character; false it isn't
+//*****************************************************************************
+bool SpecialGreek (unsigned char Font);
+
+//*****************************************************************************
+// Return Greek font puntuation from bGreek punstuation
+//*****************************************************************************
+unsigned char getGreekPunct (unsigned char bGreek);
+
+//*****************************************************************************
+// Return bGreek puntuation from Greek font punstuation
+//*****************************************************************************
+unsigned char getbGreekPunct (unsigned char Greek);
+
+//*****************************************************************************
+// Is the character punctuation or a space: true it is, false it isn't
+//*****************************************************************************
+bool isPunctSpace (unsigned char c);
+
+SWORD_NAMESPACE_END
+
+#endif // __GREEK2GREEK
diff --git a/include/GreekChars.h b/include/GreekChars.h
new file mode 100644
index 0000000..225f9ef
--- /dev/null
+++ b/include/GreekChars.h
@@ -0,0 +1,154 @@
+//*****************************************************************************
+// Author : William Dicks ***
+// Date Created: 10 February 1998 ***
+// Purpose : Enumeration for Greek to b-Greek conversion and vice ***
+// : versa. ***
+// File Name : GreekChars.h ***
+// ***
+// Author info : ---------------------------------------------------------- ***
+// Address : 23 Tieroogpark ***
+// : Hoewe Str ***
+// : Elarduspark X3 ***
+// : 0181 ***
+// : South Africa ***
+// Home Tel: +27 (0)12 345 3166 ***
+// Cell No : +27 (0)82 577 4424 ***
+// e-mail : wd@isis.co.za ***
+// Church WWW : http://www.hatfield.co.za ***
+//*****************************************************************************
+/*
+ *
+ * $Id: GreekChars.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef __GREEKCHARS_H
+#define __GREEKCHARS_H
+
+// This enum represents the values of the characters used for the
+// transliteration as used on the b-greek discussion list.
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+enum bGreekChars
+{
+ ALPHA = 65, // A
+ BETA, // B
+ CHI, // C
+ DELTA, // D
+ EPSILON, // E
+ PHI, // F
+ GAMMA, // G
+ ETA, // H
+ IOTA, // I
+ // No J
+ KAPPA = 75, // K
+ LAMBDA, // L
+ MU, // M
+ NU, // N
+ OMICRON, // O
+ PI, // P
+ THETA, // Q
+ RHO, // R
+ SIGMA, // S
+ TAU, // T
+ UPSILON, // U
+ // No V
+ OMEGA = 'W', // W
+ XI, // X
+ PSI, // Y
+ ZETA, // Z
+ ROUGH = 104, // h
+ IOTA_SUB // i
+};
+
+// This enum represents the values of the characters ib the Greek.ttf font,
+// and the comments on the right are the corresponding bGreek equivalents.
+
+enum GreekFontChars
+{
+ gALPHA = 'a', // A
+ gBETA, // B
+ gCHI, // C
+ gDELTA, // D
+ gEPSILON, // E
+ gPHI, // F
+ gGAMMA, // G
+ gETA, // H
+ gIOTA, // I
+ gSIGMA_END, // j
+ gKAPPA, // K
+ gLAMBDA, // L
+ gMU, // M
+ gNU, // N
+ gOMICRON, // O
+ gPI, // P
+ gTHETA, // Q
+ gRHO, // R
+ gSIGMA, // S
+ gTAU, // T
+ gUPSILON, // U
+ // No V
+ gOMEGA = 'w', // W
+ gXI, // X
+ gPSI, // Y
+ gZETA, // Z
+ gROUGH_ALPHA = 161, // hA
+ gROUGH_EPSILON = 152, // hE
+ gROUGH_ETA = 185, // hH
+ gROUGH_IOTA = 131, // hH
+ gROUGH_OMICRON = 208, // hH
+ gROUGH_RHO = 183, // hR
+ gROUGH_UPSILON = 216, // hU
+ gROUGH_OMEGA = 230, // hW
+ gIOTA_ALPHA = 'v', // Ai
+ gIOTA_ETA = 'V', // Ei
+ gIOTA_OMEGA = 'J', // Wi
+ gNON_ROUGH_ALPHA = 162, // hA
+ gNON_ROUGH_EPSILON = 153, // hE
+ gNON_ROUGH_ETA = 186, // hH
+ gNON_ROUGH_IOTA = 132, // hH
+ gNON_ROUGH_OMICRON = 209, // hH
+ gNON_ROUGH_RHO = 184, // hR
+ gNON_ROUGH_UPSILON = 217, // hU
+ gNON_ROUGH_OMEGA = 231 // hW
+};
+
+// English puntuation as used on bGreek
+
+enum bGreekPunct
+{
+ COMMA = ',',
+ STOP = '.',
+ SEMI_COLON = ';',
+ QUESTION = '?'
+};
+
+// English puntuation as used in the Greek font
+
+enum GreekPunct
+{
+ gCOMMA = ',',
+ gSTOP = '.',
+ gSEMI_COLON = ':',
+ gQUESTION = ';'
+};
+
+SWORD_NAMESPACE_END
+
+#endif // __GREEKCHARS_H
diff --git a/include/Makefile b/include/Makefile
new file mode 100644
index 0000000..fc04b62
--- /dev/null
+++ b/include/Makefile
@@ -0,0 +1,5 @@
+
+root := ..
+
+all:
+ make -C ${root}
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..62866cb
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,158 @@
+swincludedir = $(top_srcdir)/include
+
+pkginclude_HEADERS = $(swincludedir)/Greek2Greek.h
+pkginclude_HEADERS += $(swincludedir)/GreekChars.h
+pkginclude_HEADERS += $(swincludedir)/canon.h
+pkginclude_HEADERS += $(swincludedir)/cipherfil.h
+pkginclude_HEADERS += $(swincludedir)/curlftpt.h
+pkginclude_HEADERS += $(swincludedir)/defs.h
+pkginclude_HEADERS += $(swincludedir)/echomod.h
+pkginclude_HEADERS += $(swincludedir)/encfiltmgr.h
+pkginclude_HEADERS += $(swincludedir)/entriesblk.h
+pkginclude_HEADERS += $(swincludedir)/femain.h
+pkginclude_HEADERS += $(swincludedir)/filemgr.h
+pkginclude_HEADERS += $(swincludedir)/flatapi.h
+pkginclude_HEADERS += $(swincludedir)/ftpparse.h
+pkginclude_HEADERS += $(swincludedir)/ftptrans.h
+pkginclude_HEADERS += $(swincludedir)/ftplibftpt.h
+pkginclude_HEADERS += $(swincludedir)/ftplib.h
+
+pkginclude_HEADERS += $(swincludedir)/gbffootnotes.h
+pkginclude_HEADERS += $(swincludedir)/gbfheadings.h
+pkginclude_HEADERS += $(swincludedir)/gbfhtml.h
+pkginclude_HEADERS += $(swincludedir)/gbfhtmlhref.h
+pkginclude_HEADERS += $(swincludedir)/gbfwebif.h
+pkginclude_HEADERS += $(swincludedir)/gbfmorph.h
+pkginclude_HEADERS += $(swincludedir)/gbfosis.h
+pkginclude_HEADERS += $(swincludedir)/gbfplain.h
+pkginclude_HEADERS += $(swincludedir)/gbfredletterwords.h
+pkginclude_HEADERS += $(swincludedir)/gbfrtf.h
+pkginclude_HEADERS += $(swincludedir)/gbfstrongs.h
+pkginclude_HEADERS += $(swincludedir)/gbfwordjs.h
+pkginclude_HEADERS += $(swincludedir)/gbfthml.h
+pkginclude_HEADERS += $(swincludedir)/greeklexattribs.h
+
+pkginclude_HEADERS += $(swincludedir)/hebrewmcim.h
+pkginclude_HEADERS += $(swincludedir)/hrefcom.h
+pkginclude_HEADERS += $(swincludedir)/installmgr.h
+pkginclude_HEADERS += $(swincludedir)/latin1utf16.h
+pkginclude_HEADERS += $(swincludedir)/latin1utf8.h
+pkginclude_HEADERS += $(swincludedir)/listkey.h
+pkginclude_HEADERS += $(swincludedir)/localemgr.h
+pkginclude_HEADERS += $(swincludedir)/lzsscomprs.h
+pkginclude_HEADERS += $(swincludedir)/markupfiltmgr.h
+pkginclude_HEADERS += $(swincludedir)/multimapwdef.h
+pkginclude_HEADERS += $(swincludedir)/nullim.h
+
+pkginclude_HEADERS += $(swincludedir)/osisheadings.h
+pkginclude_HEADERS += $(swincludedir)/osishtmlhref.h
+pkginclude_HEADERS += $(swincludedir)/osiswebif.h
+pkginclude_HEADERS += $(swincludedir)/osismorph.h
+pkginclude_HEADERS += $(swincludedir)/osismorphsegmentation.h
+pkginclude_HEADERS += $(swincludedir)/osisplain.h
+pkginclude_HEADERS += $(swincludedir)/osisrtf.h
+pkginclude_HEADERS += $(swincludedir)/osisosis.h
+pkginclude_HEADERS += $(swincludedir)/osisstrongs.h
+pkginclude_HEADERS += $(swincludedir)/osisfootnotes.h
+pkginclude_HEADERS += $(swincludedir)/osislemma.h
+pkginclude_HEADERS += $(swincludedir)/osisredletterwords.h
+pkginclude_HEADERS += $(swincludedir)/osisscripref.h
+pkginclude_HEADERS += $(swincludedir)/osiswordjs.h
+pkginclude_HEADERS += $(swincludedir)/osisvariants.h
+
+pkginclude_HEADERS += $(swincludedir)/papyriplain.h
+pkginclude_HEADERS += $(swincludedir)/plainfootnotes.h
+pkginclude_HEADERS += $(swincludedir)/plainfootnotes.h
+pkginclude_HEADERS += $(swincludedir)/plainhtml.h
+pkginclude_HEADERS += $(swincludedir)/rawcom.h
+pkginclude_HEADERS += $(swincludedir)/rawfiles.h
+pkginclude_HEADERS += $(swincludedir)/rawgenbook.h
+pkginclude_HEADERS += $(swincludedir)/rawld.h
+pkginclude_HEADERS += $(swincludedir)/rawld4.h
+pkginclude_HEADERS += $(swincludedir)/rawstr.h
+pkginclude_HEADERS += $(swincludedir)/rawstr4.h
+pkginclude_HEADERS += $(swincludedir)/rawtext.h
+pkginclude_HEADERS += $(swincludedir)/rawverse.h
+pkginclude_HEADERS += $(swincludedir)/regex.h
+pkginclude_HEADERS += $(swincludedir)/roman.h
+pkginclude_HEADERS += $(swincludedir)/rtfhtml.h
+pkginclude_HEADERS += $(swincludedir)/sapphire.h
+pkginclude_HEADERS += $(swincludedir)/scsuutf8.h
+pkginclude_HEADERS += $(swincludedir)/strkey.h
+pkginclude_HEADERS += $(swincludedir)/swbasicfilter.h
+pkginclude_HEADERS += $(swincludedir)/swbuf.h
+pkginclude_HEADERS += $(swincludedir)/swcacher.h
+pkginclude_HEADERS += $(swincludedir)/swcipher.h
+pkginclude_HEADERS += $(swincludedir)/swcom.h
+pkginclude_HEADERS += $(swincludedir)/swcomprs.h
+pkginclude_HEADERS += $(swincludedir)/swconfig.h
+pkginclude_HEADERS += $(swincludedir)/swdisp.h
+pkginclude_HEADERS += $(swincludedir)/swfilter.h
+pkginclude_HEADERS += $(swincludedir)/swfiltermgr.h
+pkginclude_HEADERS += $(swincludedir)/swgenbook.h
+pkginclude_HEADERS += $(swincludedir)/swinputmeth.h
+pkginclude_HEADERS += $(swincludedir)/swkey.h
+pkginclude_HEADERS += $(swincludedir)/swld.h
+pkginclude_HEADERS += $(swincludedir)/swlocale.h
+pkginclude_HEADERS += $(swincludedir)/swlog.h
+pkginclude_HEADERS += $(swincludedir)/swmacs.h
+pkginclude_HEADERS += $(swincludedir)/swmgr.h
+pkginclude_HEADERS += $(swincludedir)/stringmgr.h
+pkginclude_HEADERS += $(swincludedir)/swmodule.h
+pkginclude_HEADERS += $(swincludedir)/swoptfilter.h
+pkginclude_HEADERS += $(swincludedir)/swobject.h
+pkginclude_HEADERS += $(swincludedir)/swsearchable.h
+pkginclude_HEADERS += $(swincludedir)/swtext.h
+pkginclude_HEADERS += $(swincludedir)/swunicod.h
+pkginclude_HEADERS += $(swincludedir)/swversion.h
+pkginclude_HEADERS += $(swincludedir)/sysdata.h
+
+pkginclude_HEADERS += $(swincludedir)/thmlfootnotes.h
+pkginclude_HEADERS += $(swincludedir)/thmlgbf.h
+pkginclude_HEADERS += $(swincludedir)/thmlheadings.h
+pkginclude_HEADERS += $(swincludedir)/thmlhtml.h
+pkginclude_HEADERS += $(swincludedir)/thmlhtmlhref.h
+pkginclude_HEADERS += $(swincludedir)/thmlwebif.h
+pkginclude_HEADERS += $(swincludedir)/thmllemma.h
+pkginclude_HEADERS += $(swincludedir)/thmlmorph.h
+pkginclude_HEADERS += $(swincludedir)/thmlosis.h
+pkginclude_HEADERS += $(swincludedir)/thmlplain.h
+pkginclude_HEADERS += $(swincludedir)/thmlrtf.h
+pkginclude_HEADERS += $(swincludedir)/thmlscripref.h
+pkginclude_HEADERS += $(swincludedir)/thmlstrongs.h
+pkginclude_HEADERS += $(swincludedir)/thmlvariants.h
+pkginclude_HEADERS += $(swincludedir)/thmlwordjs.h
+
+pkginclude_HEADERS += $(swincludedir)/teiplain.h
+pkginclude_HEADERS += $(swincludedir)/teirtf.h
+
+pkginclude_HEADERS += $(swincludedir)/treekey.h
+pkginclude_HEADERS += $(swincludedir)/treekeyidx.h
+pkginclude_HEADERS += $(swincludedir)/unicodertf.h
+pkginclude_HEADERS += $(swincludedir)/url.h
+pkginclude_HEADERS += $(swincludedir)/untgz.h
+pkginclude_HEADERS += $(swincludedir)/utf16utf8.h
+pkginclude_HEADERS += $(swincludedir)/utf8arshaping.h
+pkginclude_HEADERS += $(swincludedir)/utf8bidireorder.h
+pkginclude_HEADERS += $(swincludedir)/utf8cantillation.h
+pkginclude_HEADERS += $(swincludedir)/utf8greekaccents.h
+pkginclude_HEADERS += $(swincludedir)/utf8hebrewpoints.h
+pkginclude_HEADERS += $(swincludedir)/utf8html.h
+pkginclude_HEADERS += $(swincludedir)/utf8latin1.h
+pkginclude_HEADERS += $(swincludedir)/utf8nfc.h
+pkginclude_HEADERS += $(swincludedir)/utf8nfkd.h
+pkginclude_HEADERS += $(swincludedir)/utf8transliterator.h
+pkginclude_HEADERS += $(swincludedir)/utf8utf16.h
+pkginclude_HEADERS += $(swincludedir)/utilstr.h
+pkginclude_HEADERS += $(swincludedir)/utilxml.h
+
+pkginclude_HEADERS += $(swincludedir)/versekey.h
+pkginclude_HEADERS += $(swincludedir)/versetreekey.h
+pkginclude_HEADERS += $(swincludedir)/zcom.h
+pkginclude_HEADERS += $(swincludedir)/zconf.h
+pkginclude_HEADERS += $(swincludedir)/zipcomprs.h
+pkginclude_HEADERS += $(swincludedir)/zld.h
+pkginclude_HEADERS += $(swincludedir)/zstr.h
+pkginclude_HEADERS += $(swincludedir)/ztext.h
+pkginclude_HEADERS += $(swincludedir)/zverse.h
+
diff --git a/include/SwordAPI.pas b/include/SwordAPI.pas
new file mode 100644
index 0000000..837ff2d
--- /dev/null
+++ b/include/SwordAPI.pas
@@ -0,0 +1,69 @@
+{*
+ *
+ * $Id: SwordAPI.pas 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ *}
+unit SwordAPI;
+
+interface
+const
+ DLLNAME = 'sword32.dll';
+
+type
+ paramt = record
+ path, name, disc: pchar;
+ end;
+ pparamt = ^paramt;
+
+function NewModule(modtype: PChar; params: pparamt): integer; stdcall; external DLLNAME;
+procedure DeleteModule(hmod: integer); stdcall; external DLLNAME;
+function ModGetTextLen(hmod: integer): integer; stdcall; external DLLNAME;
+procedure ModGetText(hmod: integer; buf: PChar; size: integer); stdcall; external DLLNAME;
+procedure ModGetKeyText(hmod: integer; buf: PChar; size: integer); stdcall; external DLLNAME;
+function ModGetKey(hmod: integer):integer; stdcall; external DLLNAME;
+function ModSetKeyText(hmod: integer; keytext: PChar):char; stdcall; external DLLNAME;
+function ModSetKeyKey(hmod: integer; hkey: integer):char; stdcall; external DLLNAME;
+function ModSearch(hmod: integer; stext: PChar):integer; stdcall; external DLLNAME;
+procedure YoYo(x:integer; y:integer); stdcall; external DLLNAME;
+procedure ModInc(hmod: integer); stdcall; external DLLNAME;
+procedure ModDec(hmod: integer); stdcall; external DLLNAME;
+function ModError(hmod:integer): integer; stdcall; external DLLNAME;
+function NewKey(keytype:PChar):integer;stdcall; external DLLNAME;
+procedure DeleteKey(hkey: integer); stdcall; external DLLNAME;
+function KeyGetPersist(hkey: integer): integer; stdcall; external DLLNAME;
+procedure KeySetPersist(hkey: integer; value: integer); stdcall; external DLLNAME;
+function KeyError(hkey:integer): integer; stdcall; external DLLNAME;
+procedure KeyGetText(hkey: integer; buf: PChar; size: integer); stdcall; external DLLNAME;
+procedure KeySetText(hkey: integer; keytext: PChar); stdcall; external DLLNAME;
+procedure KeySetKey(hkey: integer; hkey: integer); stdcall; external DLLNAME;
+procedure KeyInc(hkey: integer); stdcall; external DLLNAME;
+procedure KeyDec(hkey: integer); stdcall; external DLLNAME;
+function VerseKeyGetTestament(hkey: integer): integer; stdcall; external DLLNAME;
+function VerseKeyGetBook(hkey: integer): integer; stdcall; external DLLNAME;
+function VerseKeyGetChapter(hkey: integer): integer; stdcall; external DLLNAME;
+function VerseKeyGetVerse(hkey: integer): integer; stdcall; external DLLNAME;
+procedure VerseKeySetTestament(hkey: integer; value: integer); stdcall; external DLLNAME;
+procedure VerseKeySetBook(hkey: integer; value: integer); stdcall; external DLLNAME;
+procedure VerseKeySetChapter(hkey: integer; value: integer); stdcall; external DLLNAME;
+procedure VerseKeySetVerse(hkey: integer; value: integer); stdcall; external DLLNAME;
+function VerseKeyGetAutoNormalize(hkey: integer): integer; stdcall; external DLLNAME;
+procedure VerseKeySetAutoNormalize(hkey: integer; value: integer); stdcall; external DLLNAME;
+procedure VerseKeyNormalize(hkey: integer); stdcall; external DLLNAME;
+
+implementation
+
+end.
diff --git a/include/apocrypha.h b/include/apocrypha.h
new file mode 100644
index 0000000..6f08bbe
--- /dev/null
+++ b/include/apocrypha.h
@@ -0,0 +1,219 @@
+/******************************************************************************
+ * apocrypha.h - Apocryphal text information to be included by VerseKey.cpp
+ *
+ * $Id: apocrypha.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+/******************************************************************************
+ * [a]tbooks - initialize static instance for all canonical text names
+ * and chapmax
+ */
+
+#include <defs.h>
+//SWORD_NAMESPACE_START
+
+//Data based on NRSVA unless otherwise noted; this book ordering is not necessarily optimal.
+
+struct sbook
+VerseKey::otbooks[] = {
+ //Catholic Deuterocanon
+ {"Tobit", "Tob", 14}, //67
+ {"Judith", "Jdt", 16}, //68
+ {"Wisdom", "Wis", 19}, //69
+ {"Sirach", "Sir", 51}, //70 //51 or 52? count prologue as separate book or just chapter?
+ {"Baruch", "Bar", 5}, //71 //5 or 6? (see next line)
+ {"Letter of Jeremiah", "EpJer", 1}, //72 //1 or 6? EpJer is ch6 of Baruch
+ {"1 Esdras", "1Esd", 9}, //73
+ {"2 Esdras", "2Esd", 16}, //74
+ {"1 Maccabees", "1Macc", 16}, //75
+ {"2 Maccabees", "2Macc", 15}, //76
+
+ //LXX
+ {"3 Maccabees", "3Macc", 7}, //77
+ {"4 Maccabees", "4Macc", 18}, //78
+ {"Odes", "Odes", 14}, //79 //based on LXX
+ {"Psalms of Solomon", "PssSol", 18}, //80 //based on LXX
+
+ //Protestant Apocrypha
+ {"Additions to Esther", "AddEsth", 6}, //81 //based on Charles/NRSVA //6 or F or 16? If you're Catholic, you have a 16 chapter canonical book called Esther (ie Greek Esther); if you're Protestant you have a 10 chapter canonical book called Esther (ie Hebrew Esther) plus a 6 "chapter" set of "Additions" in an apocryphal book called Additions to Esther, which are "numbered" A through F or continue from chapter 10 through 16.
+ {"Prayer of Azariah", "PrAzar", 1}, //82
+ {"Susanna", "Sus", 1}, //83
+ {"Bel and the Dragon", "Bel", 1}, //84
+ {"Prayer of Manasses", "PrMan", 1}, //85
+ {"Psalm 151", "Ps151", 1}, //86
+
+ //Vulgate
+ {"Epistle to the Laodiceans", "EpLao", 1}, //87 //based on Vulgate
+
+ //Other books may follow at a later date (e.g. Jub, 1En)
+};
+
+/******************************************************************************
+ * Abbreviations - MUST be in alphabetical order & by PRIORITY
+ * RULE: first match of entire key
+ * (e.g. key: "1CH"; match: "1CHRONICLES")
+ */
+
+const struct abbrev
+ VerseKey::builtin_abbrevs[] = {
+ {"1 ESDRAS", 73},
+ {"1 MACCABEES", 75},
+ {"1ESDRAS", 73},
+ {"1MACCABEES", 75},
+ {"2 ESDRAS", 74},
+ {"2 MACCABEES", 76},
+ {"2ESDRAS", 74},
+ {"2MACCABEES", 76},
+ {"3 MACCABEES", 77},
+ {"3MACCABEES", 77},
+ {"4 MACCABEES", 78},
+ {"4MACCABEES", 78},
+ {"ADDESTHER", 81},
+ {"ADDITIONS TO ESTHER", 81},
+ {"BARUCH", 71},
+ {"BEL AND THE DRAGON", 84},
+ {"BEN SIRACH", 70},
+ {"ECCLESIASTICUS", 70},
+ {"EPISTLE OF JEREMIAH", 72},
+ {"EPISTLE TO THE LAODICEANS", 87},
+ {"EPJER", 72},
+ {"EPLAO", 87},
+ {"I ESDRAS", 73},
+ {"I MACCABEES", 75},
+ {"IESDRAS", 73},
+ {"II ESDRAS", 74},
+ {"II MACCABEES", 76},
+ {"IIESDRAS", 74},
+ {"III MACCABEES", 77},
+ {"IIII MACCABEES", 78},
+ {"IIIIMACCABEES", 78},
+ {"IIIMACCABEES", 77},
+ {"IIMACCABEES", 76},
+ {"IMACCABEES", 75},
+ {"IV MACCABEES", 78},
+ {"IVMACCABEES", 78},
+ {"JDT", 68},
+ {"JESUS BEN SIRACH", 70},
+ {"JUDITH", 68},
+ {"LAODICEANS", 87},
+ {"LETTER OF JEREMIAH", 72},
+ {"MANASSEH", 85},
+ {"MANASSES", 85},
+ {"ODES", 79},
+ {"PRAYER OF AZARIAH", 82},
+ {"PRAYER OF MANASSEH", 85},
+ {"PRAYER OF MANASSES", 85},
+ {"PRAZAR", 82},
+ {"PRMAN", 85},
+ {"PS151", 86},
+ {"PSALM151", 86},
+ {"PSALMS OF SOLOMON", 80},
+ {"PSSOL", 80},
+ {"PSSSOL", 80},
+ {"SIRACH", 70},
+ {"SUSANNA", 83},
+ {"TOBIT", 67},
+ {"WISDOM OF JESUS BEN SIRACH", 70},
+ {"WISDOM", 69},
+ {"", -1}
+};
+
+
+/******************************************************************************
+ * Maximum verses per chapter
+ */
+
+int
+VerseKey::vm[] = {
+ //Catholic Deuterocanon
+ //Tobit 14 //67
+ 22, 14, 17, 21, 21, 17, 18, 21, 6, 12,
+ 19, 22, 18, 15,
+ //Judith 16 //68
+ 16, 28, 10, 15, 24, 21, 32, 36, 14, 23,
+ 23, 20, 20, 19, 13, 25,
+ //Wisdom 19 //69
+ 16, 24, 19, 20, 23, 25, 30, 21, 18, 21,
+ 26, 27, 19, 31, 19, 29, 21, 25, 22,
+ //Sirach 51 //70 //Prologue has 36 vv. in LXX, 1 v. in NRSVA
+ 30, 18, 31, 31, 15, 37, 36, 19, 18, 31,
+ 34, 18, 26, 27, 20, 30, 32, 33, 30, 32,
+ 28, 27, 27, 34, 26, 29, 30, 26, 28, 25,
+ 31, 24, 31, 26, 20, 26, 31, 34, 35, 30,
+ 23, 25, 33, 23, 26, 20, 25, 25, 16, 29,
+ 30,
+ //Baruch 5 //71
+ 21, 35, 37, 37, 9,
+ //Letter of Jeremiah 1 //72
+ 73,
+ //1 Esdras 9 //73
+ 58, 30, 24, 63, 73, 34, 15, 96, 55,
+ //2 Esdras 16 //74
+ 40, 48, 36, 52, 56, 59, 140, 63, 47, 59,
+ 46, 51, 58, 48, 63, 78,
+ //1 Maccabees 16 //75
+ 64, 70, 60, 61, 68, 63, 50, 32, 73, 89,
+ 74, 53, 53, 49, 41, 24,
+ //2 Maccabees 15 //76
+ 36, 32, 40, 50, 27, 31, 42, 36, 29, 38,
+ 38, 45, 26, 46, 39,
+
+ //LXX
+ //3 Maccabees 7 //77
+ 29, 33, 30, 21, 51, 41, 23,
+ //4 Maccabees 18 //78
+ 35, 24, 21, 26, 38, 35, 23, 29, 32, 21,
+ 27, 19, 27, 20, 32, 25, 24, 24,
+ //Odes 14 //79
+ 19, 43, 10, 19, 20, 10, 45, 88, 79, 9,
+ 20, 15, 32, 46,
+ //Psalms of Solomon 18 //80
+ 8, 37, 12, 25, 19, 6, 10, 34, 11, 8,
+ 9, 6, 12, 10, 13, 15, 46, 12,
+
+ //Protestant Apocrypha
+ //Additions to Esther 6 //81
+ 17, 7, 30, 16, 24, 11
+ //Prayer of Azariah 1 //82
+ 68,
+ //Susanna 1 //83
+ 64,
+ //Bel and the Dragon 1 //84
+ 42,
+ //Prayer of Manasses 1 //85
+ 15,
+ //Psalm 151 1 //86
+ 7,
+
+ //Vulgate
+ //Epistle to the Laodiceans 1 //87
+ 20,
+};
+
+
+long
+ VerseKey::atbks[] = {
+0, 1, 16, 33, 53, 105, 111, 113, 123, 140, 157, 173, 181, 200, 215, 234, 241, 243, 245, 247, 249, 251
+};
+
+long
+ VerseKey::atcps[] = {
+0, 2, 3, 26, 41, 59, 81, 103, 121, 140, 162, 169, 183, 203, 226, 245, 262, 279, 308, 319, 335, 360, 382, 415, 452, 467, 492, 516, 537, 558, 578, 592, 619, 636, 661, 681, 702, 726, 752, 783, 805, 824, 847, 874, 902, 922, 954, 974, 1004, 1026, 1052, 1076, 1107, 1126, 1158, 1190, 1206, 1244, 1281, 1301, 1320, 1353, 1388, 1407, 1434, 1462, 1483, 1514, 1547, 1581, 1612, 1646, 1675, 1703, 1731, 1766, 1793, 1823, 1854, 1881, 1910, 1937, 1969, 1994, 2026, 2053, 2074, 2101, 2133, 2168, 2204, 2236, 2260, 2286, 2320, 2344, 2371, 2392, 2418, 2444, 2461, 2492, 2524, 2546, 2582, 2620, 2658, 2669, 2744, 2803, 2834, 2859, 2923, 2997, 3032, 3048, 3145, 3202, 3243, 3292, 3329, 3382, 3439, 3499, 3640, 3704, 3752, 3813, 3860, 3912, 3971, 4020, 4084, 4164, 4229, 4300, 4361, 4423, 4492, 4556, 4607, 4640, 4714, 4805, 4880, 4934, 4988, 5038, 5080, 5106, 5143, 5176, 5217, 5268, 5296, 5328, 5371, 5408, 5438, 5478, 5517, 5563, 5590, 5637, 5678, 5708, 5742, 5773, 5795, 5847, 5889, 5914, 5950, 5975, 5997, 6024, 6063, 6099, 6123, 6153, 6186, 6209, 6237, 6257, 6285, 6306, 6339, 6365, 6390, 6416, 6436, 6480, 6491, 6511, 6532, 6543, 6589, 6678, 6758, 6769, 6790, 6806, 6839, 6887, 6896, 6934, 6947, 6973, 6993, 7000, 7011, 7046, 7058, 7068, 7078, 7085, 7098, 7109, 7123, 7139, 7186, 7200, 7270, 7336, 7380, 7397, 7406
+};
+
+//SWORD_NAMESPACE_END
diff --git a/include/canon.h b/include/canon.h
new file mode 100644
index 0000000..a17f86a
--- /dev/null
+++ b/include/canon.h
@@ -0,0 +1,697 @@
+/******************************************************************************
+ * canon.h - Canonical text information to be included by VerseKey.cpp
+ *
+ * $Id: canon.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998-2005 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+/******************************************************************************
+ * [on]tbooks - initialize static instance for all canonical text names
+ * and chapmax
+ */
+
+struct sbook
+ VerseKey::otbooks[] = {
+ {"Genesis", "Gen", 50},
+ {"Exodus", "Exod", 40},
+ {"Leviticus", "Lev", 27},
+ {"Numbers", "Num", 36},
+ {"Deuteronomy", "Deut", 34},
+ {"Joshua", "Josh", 24},
+ {"Judges", "Judg", 21},
+ {"Ruth", "Ruth", 4},
+ {"I Samuel", "1Sam", 31},
+ {"II Samuel", "2Sam", 24},
+ {"I Kings", "1Kgs", 22},
+ {"II Kings", "2Kgs", 25},
+ {"I Chronicles", "1Chr", 29},
+ {"II Chronicles", "2Chr", 36},
+ {"Ezra", "Ezra", 10},
+ {"Nehemiah", "Neh", 13},
+ {"Esther", "Esth", 10},
+ {"Job", "Job", 42},
+ {"Psalms", "Ps", 150},
+ {"Proverbs", "Prov", 31},
+ {"Ecclesiastes", "Eccl", 12},
+ {"Song of Solomon", "Song", 8},
+ {"Isaiah", "Isa", 66},
+ {"Jeremiah", "Jer", 52},
+ {"Lamentations", "Lam", 5},
+ {"Ezekiel", "Ezek", 48},
+ {"Daniel", "Dan", 12},
+ {"Hosea", "Hos", 14},
+ {"Joel", "Joel", 3},
+ {"Amos", "Amos", 9},
+ {"Obadiah", "Obad", 1},
+ {"Jonah", "Jonah", 4},
+ {"Micah", "Mic", 7},
+ {"Nahum", "Nah", 3},
+ {"Habakkuk", "Hab", 3},
+ {"Zephaniah", "Zeph", 3},
+ {"Haggai", "Hag", 2},
+ {"Zechariah", "Zech", 14},
+ {"Malachi", "Mal", 4}
+};
+
+struct sbook
+ VerseKey::ntbooks[] = {
+ {"Matthew", "Matt", 28},
+ {"Mark", "Mark", 16},
+ {"Luke", "Luke", 24},
+ {"John", "John", 21},
+ {"Acts", "Acts", 28},
+ {"Romans", "Rom", 16},
+ {"I Corinthians", "1Cor", 16},
+ {"II Corinthians", "2Cor", 13},
+ {"Galatians", "Gal", 6},
+ {"Ephesians", "Eph", 6},
+ {"Philippians", "Phil", 4},
+ {"Colossians", "Col", 4},
+ {"I Thessalonians", "1Thess", 5},
+ {"II Thessalonians", "2Thess", 3},
+ {"I Timothy", "1Tim", 6},
+ {"II Timothy", "2Tim", 4},
+ {"Titus", "Titus", 3},
+ {"Philemon", "Phlm", 1},
+ {"Hebrews", "Heb", 13},
+ {"James", "Jas", 5},
+ {"I Peter", "1Pet", 5},
+ {"II Peter", "2Pet", 3},
+ {"I John", "1John", 5},
+ {"II John", "2John", 1},
+ {"III John", "3John", 1},
+ {"Jude", "Jude", 1},
+ {"Revelation of John", "Rev", 22}
+};
+
+
+/******************************************************************************
+ * Abbreviations - MUST be in alphabetical order & by PRIORITY
+ * RULE: first match of entire key
+ * (e.g. key: "1CH"; match: "1CHRONICLES")
+ */
+
+const struct abbrev
+ VerseKey::builtin_abbrevs[] = {
+ {"1 C", 46}, // 1 Corinthians
+ {"1 CHRONICLES", 13}, // 1 Chronicles
+ {"1 CORINTHIANS", 46}, // 1 Corinthians
+ {"1 JN", 62}, // 1 John
+ {"1 JOHN", 62}, // 1 John
+ {"1 KGS", 11}, // 1 Kings
+ {"1 KINGS", 11}, // 1 Kings
+ {"1 PETER", 60}, // 1 Peter
+ {"1 PTR", 60}, // 1 Peter
+ {"1 SAMUEL", 9}, // 1 Samuel
+ {"1 THESSALONIANS", 52}, // 1 Thessalonians
+ {"1 TIMOTHY", 54}, // 1 Timothy
+ {"1C", 46}, // 1 Corinthians
+ {"1CHRONICLES", 13}, // 1 Chronicles
+ {"1CORINTHIANS", 46}, // 1 Corinthians
+ {"1JN", 62}, // 1 John
+ {"1JOHN", 62}, // 1 John
+ {"1KGS", 11}, // 1 Kings
+ {"1KINGS", 11}, // 1 Kings
+ {"1PETER", 60}, // 1 Peter
+ {"1PTR", 60}, // 1 Peter
+ {"1SAMUEL", 9}, // 1 Samuel
+ {"1THESSALONIANS", 52}, // 1 Thessalonians
+ {"1TIMOTHY", 54}, // 1 Timothy
+ {"2 C", 47}, // 2 Corinthians
+ {"2 CHRONICLES", 14}, // 2 Chronicles
+ {"2 CORINTHIANS", 47}, // 2 Corinthians
+ {"2 JN", 63}, // 2 John
+ {"2 JOHN", 63}, // 2 John
+ {"2 KGS", 12}, // 2 Kings
+ {"2 KINGS", 12}, // 2 Kings
+ {"2 PETER", 61}, // 2 Peter
+ {"2 PTR", 61}, // 2 Peter
+ {"2 SAMUEL", 10}, // 2 Samuel
+ {"2 THESSALONIANS", 53}, // 2 Thessalonians
+ {"2 TIMOTHY", 55}, // 2 Timothy
+ {"2C", 47}, // 2 Corinthians
+ {"2CHRONICLES", 14}, // 2 Chronicles
+ {"2CORINTHIANS", 47}, // 2 Corinthians
+ {"2JN", 63}, // 2 John
+ {"2JOHN", 63}, // 2 John
+ {"2KGS", 12}, // 2 Kings
+ {"2KINGS", 12}, // 2 Kings
+ {"2PETER", 61}, // 2 Peter
+ {"2PTR", 61}, // 2 Peter
+ {"2SAMUEL", 10}, // 2 Samuel
+ {"2THESSALONIANS", 53}, // 2 Thessalonians
+ {"2TIMOTHY", 55}, // 2 Timothy
+ {"3 JN", 64}, // 3 John
+ {"3 JOHN", 64}, // 3 John
+ {"3JN", 64}, // 3 John
+ {"3JOHN", 64}, // 3 John
+ {"ACTS", 44}, // Acts
+ {"AMOS", 30}, // Amos
+ {"APOCALYPSE OF ST. JOHN", 66}, // Apocalypse of St. John (Rev.)
+ {"C", 51}, // Colossians
+ {"CANTICLE OF CANTICLES", 22}, // Canticle of Canticles (Song of S.)
+ {"COLOSSIANS", 51}, // Colossians
+ {"D", 5}, // Deuteronomy
+ {"DANIEL", 27}, // Daniel
+ {"DEUTERONOMY", 5}, // Deuteronomy
+ {"E", 49}, // Ephesians
+ {"ECCLESIASTES", 21}, // Ecclesiastes
+ {"EPHESIANS", 49}, // Ephesians
+ {"ESTER", 17}, // Esther
+ {"ESTHER", 17}, // Esther
+ {"EXODUS", 2}, // Exodus
+ {"EZEKIEL", 26}, // Ezekiel
+ {"EZK", 26}, // Ezekiel
+ {"EZRA", 15}, // Ezra
+ {"G", 1}, // Genesis
+ {"GALATIANS", 48}, // Galatians
+ {"GENESIS", 1}, // Genesis
+ {"H", 58}, // Hebrews
+ {"HABAKKUK", 35}, // Habakkuk
+ {"HAGGAI", 37}, // Haggai
+ {"HEBREWS", 58}, // Hebrews
+ {"HOSEA", 28}, // Hosea
+ {"I C", 46}, // 1 Corinthians
+ {"I CHRONICLES", 13}, // 1 Chronicles
+ {"I CORINTHIANS", 46}, // 1 Corinthians
+ {"I JN", 62}, // 1 John
+ {"I JOHN", 62}, // 1 John
+ {"I KGS", 11}, // 1 Kings
+ {"I KINGS", 11}, // 1 Kings
+ {"I PETER", 60}, // 1 Peter
+ {"I PTR", 60}, // 1 Peter
+ {"I SAMUEL", 9}, // 1 Samuel
+ {"I THESSALONIANS", 52}, // 1 Thessalonians
+ {"I TIMOTHY", 54}, // 1 Timothy
+ {"IC", 46}, // 1 Corinthians
+ {"ICHRONICLES", 13}, // 1 Chronicles
+ {"ICORINTHIANS", 46}, // 1 Corinthians
+ {"II C", 47}, // 2 Corinthians
+ {"II CHRONICLES", 14}, // 2 Chronicles
+ {"II CORINTHIANS", 47}, // 2 Corinthians
+ {"II JN", 63}, // 2 John
+ {"II JOHN", 63}, // 2 John
+ {"II KGS", 12}, // 2 Kings
+ {"II KINGS", 12}, // 2 Kings
+ {"II PETER", 61}, // 2 Peter
+ {"II PTR", 61}, // 2 Peter
+ {"II SAMUEL", 10}, // 2 Samuel
+ {"II THESSALONIANS", 53}, // 2 Thessalonians
+ {"II TIMOTHY", 55}, // 2 Timothy
+ {"IIC", 47}, // 2 Corinthians
+ {"IICHRONICLES", 14}, // 2 Chronicles
+ {"IICORINTHIANS", 47}, // 2 Corinthians
+ {"III JN", 64}, // 3 John
+ {"III JOHN", 64}, // 3 John
+ {"IIIJN", 64}, // 3 John
+ {"IIIJOHN", 64}, // 3 John
+ {"IIJN", 63}, // 2 John
+ {"IIJOHN", 63}, // 2 John
+ {"IIKGS", 12}, // 2 Kings
+ {"IIKINGS", 12}, // 2 Kings
+ {"IIPETER", 61}, // 2 Peter
+ {"IIPTR", 61}, // 2 Peter
+ {"IISAMUEL", 10}, // 2 Samuel
+ {"IITHESSALONIANS", 53}, // 2 Thessalonians
+ {"IITIMOTHY", 55}, // 2 Timothy
+ {"IJN", 62}, // 1 John
+ {"IJOHN", 62}, // 1 John
+ {"IKGS", 11}, // 1 Kings
+ {"IKINGS", 11}, // 1 Kings
+ {"IPETER", 60}, // 1 Peter
+ {"IPTR", 60}, // 1 Peter
+ {"ISA", 23}, // Isaiah
+ {"ISAIAH", 23}, // Isaiah
+ {"ISAMUEL", 9}, // 1 Samuel
+ {"ITHESSALONIANS", 52}, // 1 Thessalonians
+ {"ITIMOTHY", 54}, // 1 Timothy
+ {"J", 43}, // John
+ {"JAMES", 59}, // James
+ {"JAS", 59}, // James
+ {"JDGS", 7}, // Judges
+ {"JEREMIAH", 24}, // Jeremiah
+ {"JHN", 43}, // John
+ {"JN", 43}, // John
+ {"JO", 43}, // John
+ {"JOB", 18}, // Job
+ {"JOEL", 29}, // Joel
+ {"JOHN", 43}, // John
+ {"JOL", 29}, // Joel
+ {"JONAH", 32}, // Jonah
+ {"JOSHUA", 6}, // Joshua
+ {"JUDE", 65}, // Jude
+ {"JUDGES", 7}, // Judges
+ {"L", 42}, // Luke
+ {"LAMENTATIONS", 25}, // Lamentations
+ {"LEVITICUS", 3}, // Leviticus
+ {"LK", 42}, // Luke
+ {"LUKE", 42}, // Luke
+ {"MA", 40}, // Matthew
+ {"MALACHI", 39}, // Malachi
+ {"MARK", 41}, // Mark
+ {"MATTHEW", 40}, // Matthew
+ {"MICAH", 33}, // Micah
+ {"MK", 41}, // Mark
+ {"MRK", 41}, // Mark
+ {"MT", 40}, // Matthew
+ {"N", 4}, // Numbers
+ {"NAHUM", 34}, // Nahum
+ {"NAM", 34}, // Nahum
+ {"NEHEMIAH", 16}, // Nehemiah
+ {"NUMBERS", 4}, // Numbers
+ {"OBADIAH", 31}, // Obadiah
+ {"P", 19}, // Psalms
+ {"PHIL", 50}, // Philippians
+ {"PHILEMON", 57}, // Philemon
+ {"PHILIPPIANS", 50}, // Philippians
+ {"PHLM", 57}, // Philemon
+ {"PHM", 57}, // Philemon
+ {"PHP", 50}, // Philippians
+ {"PROVERBS", 20}, // Proverbs
+ {"PSALMS", 19}, // Psalms
+ {"PSM", 19}, // Psalms
+ {"PSS", 19}, // Psalms
+ {"QOHELETH", 21}, // Qohelet (Ecclesiastes)
+ {"REVELATION OF JOHN", 66}, // Revelation
+ {"ROMANS", 45}, // Romans
+ {"RUTH", 8}, // Ruth
+ {"SNG", 22}, // Song of Solomon
+ {"SOLOMON", 22}, // Song of Solomon
+ {"SONG OF SOLOMON", 22}, // Song of Solomon
+ {"SONG OF SONGS", 22}, // Song of Solomon
+ {"SOS", 22}, // Song of Solomon
+ {"TITUS", 56}, // Titus
+ {"ZECHARIAH", 38}, // Zechariah
+ {"ZEPHANIAH", 36}, // Zephaniah
+ {"", -1}
+};
+
+
+/******************************************************************************
+ * Maximum verses per chapter
+ */
+
+int
+ VerseKey::vm[] = {
+ // Genesis
+ 31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38,
+ 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36,
+ 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26,
+ // Exodus
+ 22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25,
+ 26, 36, 31, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29,
+ 31, 43, 38,
+ // Leviticus
+ 17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37,
+ 27, 24, 33, 44, 23, 55, 46, 34,
+ // Numbers
+ 54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22,
+ 29, 35, 41, 30, 25, 18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13,
+ // Deuteronomy
+ 46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21,
+ 20, 23, 30, 25, 22, 19, 19, 26, 68, 29, 20, 30, 52, 29, 12,
+ // Joshua
+ 18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51,
+ 9, 45, 34, 16, 33,
+ // Judges
+ 36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30,
+ 48, 25,
+ // Ruth
+ 22, 23, 18, 22,
+ // I Samual
+ 28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24,
+ 42, 15, 23, 29, 22, 44, 25, 12, 25, 11, 31, 13,
+ // II Samuel
+ 27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43,
+ 26, 22, 51, 39, 25,
+ // I Kings
+ 53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21,
+ 43, 29, 53,
+ // II Kings
+ 18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37,
+ 21, 26, 20, 37, 20, 30,
+ // I Chronicles
+ 54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19,
+ 8, 30, 19, 32, 31, 31, 32, 34, 21, 30,
+ // II Chronicles
+ 17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11,
+ 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23,
+ // Ezra
+ 11, 70, 13, 24, 17, 22, 28, 36, 15, 44,
+ // Nehemiah
+ 11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31,
+ // Esther
+ 22, 23, 15, 17, 14, 14, 10, 17, 32, 3,
+ // Job
+ 22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29,
+ 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41,
+ 30, 24, 34, 17,
+ // Psalms
+ 6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13,
+ 31, 6, 10, 22, 12, 14, 9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17,
+ 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9, 6, 7, 23, 13, 11, 11, 17, 12,
+ 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72, 13,
+ 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9,
+ 5, 8, 28, 22, 35, 45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176,
+ 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 13, 10, 7,
+ 12, 15, 21, 10, 20, 14, 9, 6,
+ // Proverbs
+ 33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29,
+ 30, 31, 29, 35, 34, 28, 28, 27, 28, 27, 33, 31,
+ // Ecclesiastes
+ 18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14,
+ // Song of Solomon
+ 17, 17, 11, 16, 16, 13, 13, 14,
+ // Isaiah
+ 31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6,
+ 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8,
+ 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21,
+ 14, 21, 22, 11, 12, 19, 12, 25, 24,
+ // Jeremiah
+ 19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15,
+ 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21,
+ 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34,
+ // Lamentations
+ 22, 22, 66, 22, 22,
+ // Ezekiel
+ 28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14,
+ 49, 32, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28,
+ 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35,
+ // Daniel
+ 21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13,
+ // Hosea
+ 11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9,
+ // Joel
+ 20, 32, 21,
+ // Amos
+ 15, 16, 15, 13, 27, 14, 17, 14, 15,
+ // Obadiah
+ 21,
+ // Jonah
+ 17, 10, 10, 11,
+ // Micah
+ 16, 13, 12, 13, 15, 16, 20,
+ // Nahum
+ 15, 13, 19,
+ // Habakkuk
+ 17, 20, 19,
+ // Zephaniah
+ 18, 15, 20,
+ // Haggai
+ 15, 23,
+ // Zechariah
+ 21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21,
+ // Malachi
+ 14, 17, 18, 6,
+ // -----------------------------------------------------------------
+ // Matthew
+ 25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30,
+ 34, 46, 46, 39, 51, 46, 75, 66, 20,
+ // Mark
+ 45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20,
+ // Luke
+ 80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48,
+ 47, 38, 71, 56, 53,
+ // John
+ 51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42,
+ 31, 25,
+ // Acts
+ 26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41,
+ 38, 40, 30, 35, 27, 27, 32, 44, 31,
+ // Romans
+ 32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27,
+ // I Corinthians
+ 31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24,
+ // II Corinthians
+ 24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14,
+ // Galatians
+ 24, 21, 29, 31, 26, 18,
+ // Ephesians
+ 23, 22, 21, 32, 33, 24,
+ // Philippians
+ 30, 30, 21, 23,
+ // Colossians
+ 29, 23, 25, 18,
+ // I Thessalonians
+ 10, 20, 13, 18, 28,
+ // II Thessalonians
+ 12, 17, 18,
+ // I Timothy
+ 20, 15, 16, 16, 25, 21,
+ // II Timothy
+ 18, 26, 17, 22,
+ // Titus
+ 16, 15, 15,
+ // Philemon
+ 25,
+ // Hebrews
+ 14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25,
+ // James
+ 27, 26, 18, 17, 20,
+ // I Peter
+ 25, 25, 22, 19, 14,
+ // II Peter
+ 21, 22, 18,
+ // I John
+ 10, 29, 24, 21, 21,
+ // II John
+ 13,
+ // III John
+ 14,
+ // Jude
+ 25,
+ // Revelation of John
+ 20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 17, 18, 20, 8, 21, 18, 24, 21,
+ 15, 27, 21
+};
+
+
+long
+ VerseKey::otbks[] = {
+ 0, 1, 52, 93, 121, 158,
+ 193, 218, 240, 245, 277, 302, 325,
+ 351, 381, 418, 429, 443, 454, 497,
+ 648, 680, 693, 702, 769, 822, 828,
+ 877, 890, 905, 909, 919, 921, 926,
+ 934, 938, 942, 946, 949, 964
+};
+
+long
+ VerseKey::otcps[] = {
+ 0, 2, 3, 35, 61, 86,
+ 113, 146, 169, 194, 217, 247, 280,
+ 313, 334, 353, 378, 400, 417, 445,
+ 479, 518, 537, 572, 597, 618, 686,
+ 721, 757, 804, 827, 863, 907, 963,
+ 996, 1017, 1049, 1079, 1123, 1160, 1191,
+ 1215, 1239, 1297, 1336, 1371, 1406, 1435,
+ 1470, 1502, 1525, 1559, 1586, 1587, 1610,
+ 1636, 1659, 1691, 1715, 1746, 1772, 1805,
+ 1841, 1871, 1882, 1934, 1957, 1989, 2017,
+ 2054, 2071, 2099, 2125, 2152, 2189, 2221,
+ 2255, 2274, 2315, 2353, 2375, 2419, 2466,
+ 2505, 2524, 2560, 2584, 2620, 2656, 2695,
+ 2725, 2757, 2801, 2840, 2841, 2859, 2876,
+ 2894, 2930, 2950, 2981, 3020, 3057, 3082,
+ 3103, 3151, 3160, 3220, 3278, 3312, 3347,
+ 3364, 3395, 3433, 3461, 3486, 3520, 3565,
+ 3589, 3645, 3692, 3727, 3728, 3783, 3818,
+ 3870, 3920, 3952, 3980, 4070, 4097, 4121,
+ 4158, 4194, 4211, 4245, 4291, 4333, 4384,
+ 4398, 4431, 4454, 4484, 4520, 4562, 4593,
+ 4619, 4638, 4704, 4728, 4760, 4801, 4818,
+ 4873, 4916, 4973, 5003, 5038, 5052, 5053,
+ 5100, 5138, 5168, 5218, 5252, 5278, 5305,
+ 5326, 5356, 5379, 5412, 5445, 5464, 5494,
+ 5518, 5541, 5562, 5585, 5607, 5628, 5652,
+ 5683, 5709, 5732, 5752, 5772, 5799, 5868,
+ 5898, 5919, 5950, 6003, 6033, 6046, 6047,
+ 6066, 6091, 6109, 6134, 6150, 6178, 6205,
+ 6241, 6269, 6313, 6337, 6362, 6396, 6412,
+ 6476, 6487, 6506, 6535, 6587, 6597, 6643,
+ 6678, 6695, 6729, 6730, 6767, 6791, 6823,
+ 6848, 6880, 6921, 6947, 6983, 7041, 7060,
+ 7101, 7117, 7143, 7164, 7185, 7217, 7231,
+ 7263, 7294, 7343, 7369, 7370, 7393, 7417,
+ 7436, 7459, 7460, 7489, 7526, 7548, 7571,
+ 7584, 7606, 7624, 7647, 7675, 7703, 7719,
+ 7745, 7769, 7822, 7858, 7882, 7941, 7972,
+ 7997, 8040, 8056, 8080, 8110, 8133, 8178,
+ 8204, 8217, 8243, 8255, 8287, 8301, 8302,
+ 8330, 8363, 8403, 8416, 8442, 8466, 8496,
+ 8515, 8529, 8549, 8577, 8609, 8649, 8683,
+ 8721, 8745, 8775, 8809, 8853, 8880, 8903,
+ 8955, 8995, 9021, 9022, 9076, 9123, 9152,
+ 9187, 9206, 9245, 9297, 9364, 9393, 9423,
+ 9467, 9501, 9536, 9568, 9603, 9638, 9663,
+ 9710, 9732, 9776, 9806, 9860, 9861, 9880,
+ 9906, 9934, 9979, 10007, 10041, 10062, 10092,
+ 10130, 10167, 10189, 10211, 10237, 10267, 10306,
+ 10327, 10369, 10407, 10445, 10467, 10494, 10515,
+ 10553, 10574, 10605, 10606, 10661, 10717, 10742,
+ 10786, 10813, 10895, 10936, 10977, 11022, 11037,
+ 11085, 11126, 11141, 11159, 11189, 11233, 11261,
+ 11279, 11299, 11308, 11339, 11359, 11392, 11424,
+ 11456, 11489, 11524, 11546, 11577, 11578, 11596,
+ 11615, 11633, 11656, 11671, 11714, 11737, 11756,
+ 11788, 11808, 11832, 11849, 11872, 11888, 11908,
+ 11923, 11943, 11978, 11990, 12028, 12049, 12062,
+ 12084, 12112, 12141, 12165, 12175, 12203, 12240,
+ 12268, 12290, 12324, 12350, 12384, 12412, 12436,
+ 12437, 12449, 12520, 12534, 12559, 12577, 12600,
+ 12629, 12666, 12682, 12727, 12728, 12740, 12761,
+ 12794, 12818, 12838, 12858, 12932, 12951, 12990,
+ 13030, 13067, 13115, 13147, 13148, 13171, 13195,
+ 13211, 13229, 13244, 13259, 13270, 13288, 13321,
+ 13325, 13326, 13349, 13363, 13390, 13412, 13440,
+ 13471, 13493, 13516, 13552, 13575, 13596, 13622,
+ 13651, 13674, 13710, 13733, 13750, 13772, 13802,
+ 13832, 13867, 13898, 13916, 13942, 13949, 13964,
+ 13988, 14017, 14043, 14075, 14116, 14139, 14173,
+ 14211, 14228, 14262, 14287, 14329, 14360, 14385,
+ 14420, 14438, 14439, 14446, 14459, 14468, 14477,
+ 14490, 14501, 14519, 14529, 14550, 14569, 14577,
+ 14586, 14593, 14601, 14607, 14619, 14635, 14686,
+ 14701, 14711, 14725, 14757, 14764, 14775, 14798,
+ 14811, 14826, 14836, 14848, 14861, 14886, 14898,
+ 14921, 14944, 14973, 14986, 15027, 15050, 15064,
+ 15082, 15096, 15108, 15114, 15141, 15159, 15171,
+ 15181, 15196, 15217, 15241, 15261, 15271, 15278,
+ 15286, 15310, 15324, 15336, 15348, 15366, 15379,
+ 15388, 15401, 15413, 15424, 15438, 15459, 15467,
+ 15503, 15540, 15546, 15571, 15592, 15621, 15645,
+ 15656, 15669, 15690, 15763, 15777, 15797, 15814,
+ 15823, 15842, 15855, 15869, 15887, 15895, 15914,
+ 15967, 15985, 16002, 16018, 16024, 16048, 16060,
+ 16074, 16087, 16097, 16107, 16113, 16122, 16151,
+ 16174, 16210, 16256, 16305, 16349, 16363, 16395,
+ 16403, 16414, 16425, 16435, 16444, 16463, 16483,
+ 16486, 16516, 16693, 16701, 16710, 16720, 16725,
+ 16734, 16740, 16747, 16753, 16760, 16769, 16778,
+ 16782, 16801, 16805, 16809, 16831, 16858, 16868,
+ 16877, 16902, 16916, 16927, 16935, 16948, 16964,
+ 16986, 16997, 17018, 17033, 17043, 17050, 17051,
+ 17085, 17108, 17144, 17172, 17196, 17232, 17260,
+ 17297, 17316, 17349, 17381, 17410, 17436, 17472,
+ 17506, 17540, 17569, 17594, 17624, 17655, 17687,
+ 17717, 17753, 17788, 17817, 17846, 17874, 17903,
+ 17931, 17965, 17997, 17998, 18017, 18044, 18067,
+ 18084, 18105, 18118, 18148, 18166, 18185, 18206,
+ 18217, 18232, 18233, 18251, 18269, 18281, 18298,
+ 18315, 18329, 18343, 18358, 18359, 18391, 18414,
+ 18441, 18448, 18479, 18493, 18519, 18542, 18564,
+ 18599, 18616, 18623, 18646, 18679, 18689, 18704,
+ 18719, 18727, 18753, 18760, 18778, 18804, 18823,
+ 18847, 18860, 18882, 18896, 18926, 18951, 18985,
+ 18995, 19016, 19041, 19059, 19070, 19093, 19132,
+ 19155, 19164, 19196, 19226, 19252, 19281, 19310,
+ 19336, 19350, 19366, 19389, 19416, 19428, 19452,
+ 19468, 19481, 19499, 19513, 19526, 19548, 19563,
+ 19585, 19608, 19620, 19633, 19653, 19666, 19692,
+ 19717, 19718, 19738, 19776, 19802, 19834, 19866,
+ 19897, 19932, 19955, 19982, 20008, 20032, 20050,
+ 20078, 20101, 20123, 20145, 20173, 20197, 20213,
+ 20232, 20247, 20278, 20319, 20330, 20369, 20394,
+ 20417, 20435, 20468, 20493, 20534, 20579, 20606,
+ 20629, 20649, 20682, 20704, 20733, 20752, 20769,
+ 20788, 20811, 20825, 20856, 20862, 20891, 20899,
+ 20947, 20987, 21034, 21099, 21134, 21135, 21158,
+ 21181, 21248, 21271, 21294, 21295, 21324, 21335,
+ 21363, 21381, 21399, 21414, 21442, 21461, 21473,
+ 21496, 21522, 21551, 21575, 21599, 21608, 21672,
+ 21697, 21730, 21745, 21795, 21828, 21860, 21910,
+ 21938, 21956, 21978, 22015, 22042, 22064, 22091,
+ 22110, 22143, 22177, 22209, 22225, 22264, 22293,
+ 22317, 22347, 22397, 22424, 22445, 22473, 22505,
+ 22531, 22556, 22580, 22616, 22617, 22639, 22689,
+ 22720, 22758, 22790, 22819, 22848, 22876, 22904,
+ 22926, 22972, 22986, 22987, 22999, 23023, 23029,
+ 23049, 23065, 23077, 23094, 23109, 23127, 23143,
+ 23156, 23171, 23188, 23198, 23199, 23220, 23253,
+ 23275, 23276, 23292, 23309, 23325, 23339, 23367,
+ 23382, 23400, 23415, 23431, 23432, 23454, 23455,
+ 23473, 23484, 23495, 23507, 23508, 23525, 23539,
+ 23552, 23566, 23582, 23599, 23620, 23621, 23637,
+ 23651, 23671, 23672, 23690, 23711, 23731, 23732,
+ 23751, 23767, 23788, 23789, 23805, 23829, 23830,
+ 23852, 23866, 23877, 23892, 23904, 23920, 23935,
+ 23959, 23977, 23990, 24008, 24023, 24033, 24055,
+ 24056, 24071, 24089, 24108
+};
+
+long
+ VerseKey::ntbks[] = {
+ 0, 1, 30, 47, 72, 94,
+ 123, 140, 157, 171, 178, 185, 190,
+ 195, 201, 205, 212, 217, 221, 223,
+ 237, 243, 249, 253, 259, 261, 263,
+ 265
+};
+
+long
+ VerseKey::ntcps[] = {
+ 0, 2, 3, 29, 53, 71,
+ 97, 146, 181, 211, 246, 285, 328,
+ 359, 410, 469, 506, 546, 575, 603,
+ 639, 670, 705, 752, 799, 839, 891,
+ 938, 1014, 1081, 1102, 1103, 1149, 1178,
+ 1214, 1256, 1300, 1357, 1395, 1434, 1485,
+ 1538, 1572, 1617, 1655, 1728, 1776, 1797,
+ 1798, 1879, 1932, 1971, 2016, 2056, 2106,
+ 2157, 2214, 2277, 2320, 2375, 2435, 2471,
+ 2507, 2540, 2572, 2610, 2654, 2703, 2751,
+ 2790, 2862, 2919, 2973, 2974, 3026, 3052,
+ 3089, 3144, 3192, 3264, 3318, 3378, 3420,
+ 3463, 3521, 3572, 3611, 3643, 3671, 3705,
+ 3732, 3773, 3816, 3848, 3874, 3875, 3902,
+ 3950, 3977, 4015, 4058, 4074, 4135, 4176,
+ 4220, 4269, 4300, 4326, 4379, 4408, 4450,
+ 4491, 4526, 4555, 4597, 4636, 4677, 4708,
+ 4744, 4772, 4800, 4833, 4878, 4910, 4911,
+ 4944, 4974, 5006, 5032, 5054, 5078, 5104,
+ 5144, 5178, 5200, 5237, 5259, 5274, 5298,
+ 5332, 5360, 5361, 5393, 5410, 5434, 5456,
+ 5470, 5491, 5532, 5546, 5574, 5608, 5643,
+ 5675, 5689, 5730, 5789, 5814, 5815, 5840,
+ 5858, 5877, 5896, 5918, 5937, 5954, 5979,
+ 5995, 6014, 6048, 6070, 6085, 6086, 6111,
+ 6133, 6163, 6195, 6222, 6241, 6242, 6266,
+ 6289, 6311, 6344, 6378, 6403, 6404, 6435,
+ 6466, 6488, 6512, 6513, 6543, 6567, 6593,
+ 6612, 6613, 6624, 6645, 6659, 6678, 6707,
+ 6708, 6721, 6739, 6758, 6759, 6780, 6796,
+ 6813, 6830, 6856, 6878, 6879, 6898, 6925,
+ 6943, 6966, 6967, 6984, 7000, 7016, 7017,
+ 7043, 7044, 7059, 7078, 7098, 7115, 7130,
+ 7151, 7180, 7194, 7223, 7263, 7304, 7334,
+ 7360, 7361, 7389, 7416, 7435, 7453, 7474,
+ 7475, 7501, 7527, 7550, 7570, 7585, 7586,
+ 7608, 7631, 7650, 7651, 7662, 7692, 7717,
+ 7739, 7761, 7762, 7776, 7777, 7792, 7793,
+ 7819, 7820, 7841, 7871, 7894, 7906, 7921,
+ 7939, 7957, 7971, 7993, 8005, 8025, 8043,
+ 8062, 8083, 8092, 8114, 8133, 8158, 8180,
+ 8196, 8224
+};
+
+
+int
+ VerseKey::offsize[2][2] =
+ { {sizeof (VerseKey::otbks) / sizeof(long), sizeof (VerseKey::otcps) / sizeof(long)}
+, {sizeof (VerseKey::ntbks) / sizeof(long), sizeof (VerseKey::ntcps) / sizeof(long)}
+};
+
diff --git a/include/cipherfil.h b/include/cipherfil.h
new file mode 100644
index 0000000..cf48389
--- /dev/null
+++ b/include/cipherfil.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ *
+ * $Id: cipherfil.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef CIPHERFIL_H
+#define CIPHERFIL_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+class SWCipher;
+
+class SWDLLEXPORT CipherFilter:public SWFilter {
+ SWCipher *cipher;
+public:
+ CipherFilter(const char *key);
+ virtual ~CipherFilter();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule * = 0);
+ virtual SWCipher *getCipher();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/config.h b/include/config.h
new file mode 100644
index 0000000..08b25a9
--- /dev/null
+++ b/include/config.h
@@ -0,0 +1,66 @@
+/* include/config.h. Generated from config.h.in by configure. */
+/* include/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `z' library (-lz). */
+#define HAVE_LIBZ 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Name of package */
+#define PACKAGE "sword"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "sword-bugs@crosswire.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "sword"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "sword 1.5.11"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "sword"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.5.11"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.5.11"
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
diff --git a/include/config.h.in b/include/config.h.in
new file mode 100644
index 0000000..9cf654f
--- /dev/null
+++ b/include/config.h.in
@@ -0,0 +1,65 @@
+/* include/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
diff --git a/include/curlftpt.h b/include/curlftpt.h
new file mode 100644
index 0000000..7949814
--- /dev/null
+++ b/include/curlftpt.h
@@ -0,0 +1,32 @@
+#ifndef CURLFTPT_H
+#define CURLFTPT_H
+
+#include <defs.h>
+#include <ftptrans.h>
+
+SWORD_NAMESPACE_START
+
+class CURL;
+
+// initialize/cleanup SYSTEMWIDE library with life of this static.
+class CURLFTPTransport_init {
+public:
+ CURLFTPTransport_init();
+ ~CURLFTPTransport_init();
+};
+
+
+class SWDLLEXPORT CURLFTPTransport : public FTPTransport {
+ CURL *session;
+
+public:
+ CURLFTPTransport(const char *host, StatusReporter *statusReporter = 0);
+ ~CURLFTPTransport();
+
+ virtual char getURL(const char *destPath, const char *sourceURL, SWBuf *destBuf = 0);
+};
+
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/defs.h b/include/defs.h
new file mode 100644
index 0000000..be04f49
--- /dev/null
+++ b/include/defs.h
@@ -0,0 +1,109 @@
+// ----------------------------------------------------------------------------
+// Making or using sword as a Windows DLL
+// ----------------------------------------------------------------------------
+#ifndef SWORDDEFS_H
+#define SWORDDEFS_H
+
+#ifdef NO_SWORD_NAMESPACE
+ #define SWORD_NAMESPACE_START namespace sword {
+ #define SWORD_NAMESPACE_END }; using namespace sword;
+#else
+ #define SWORD_NAMESPACE_START namespace sword {
+ #define SWORD_NAMESPACE_END }
+#endif
+
+
+SWORD_NAMESPACE_START
+
+#ifdef _WIN32_WCE
+#define SWTRY
+#define SWCATCH(x) if (0)
+#define GLOBCONFPATH "/Program Files/sword/sword.conf"
+#else
+#define SWTRY try
+#define SWCATCH(x) catch (x)
+#endif
+
+// _declspec works in BC++ 5 and later, as well as VC++
+#if defined(_MSC_VER)
+
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _declspec( dllexport )
+# define SWDLLEXPORT_DATA(type) _declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT _declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) _declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#elif defined(__SWPM__)
+
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _Export
+# define SWDLLEXPORT_DATA(type) _Export type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT _Export
+# define SWDLLEXPORT_DATA(type) _Export type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#elif defined(__GNUWIN32__)
+
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT __declspec( dllexport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT __declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#elif defined(__BORLANDC__)
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _export
+# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT __declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
+
+#else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+#endif
+
+// For ostream, istream ofstream
+#if defined(__BORLANDC__) && defined( _RTLDLL )
+# define SWDLLIMPORT __import
+#else
+# define SWDLLIMPORT
+#endif
+
+enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
+enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI};
+enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_SCSU, ENC_UTF16, ENC_RTF, ENC_HTML};
+
+SWORD_NAMESPACE_END
+#endif //SWORDDEFS_H
diff --git a/include/echomod.h b/include/echomod.h
new file mode 100644
index 0000000..c3873b4
--- /dev/null
+++ b/include/echomod.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * echomod.h - code for class 'EchoMod' - a test module that just echo back
+ * text of key.
+ *
+ * $Id: echomod.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ECHOMOD_H
+#define ECHOMOD_H
+
+#include <swtext.h>
+#include <defs.h>
+
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT EchoMod : public SWText
+{
+public:
+ EchoMod();
+ virtual ~EchoMod();
+ virtual SWBuf &getRawEntryBuf();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/encfiltmgr.h b/include/encfiltmgr.h
new file mode 100644
index 0000000..1080994
--- /dev/null
+++ b/include/encfiltmgr.h
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * swencodingmgr.h - definition of class SWEncodingMgr, subclass of
+ * used to transcode all module text to a requested
+ * markup.
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ENCFILTERMGR_H
+#define ENCFILTERMGR_H
+
+#include <swfiltermgr.h>
+
+SWORD_NAMESPACE_START
+
+class SWFilter;
+
+/** This class is like a normal SWMgr,
+ * but you can additonally specify which encoding
+ * you want to use.
+ */
+
+class SWDLLEXPORT EncodingFilterMgr : public SWFilterMgr {
+
+protected:
+ SWFilter *latin1utf8;
+ SWFilter *scsuutf8;
+ SWFilter *targetenc;
+
+
+ /*
+ * current encoding value
+ */
+ char encoding;
+
+public:
+
+
+ /** Constructor of SWEncodingMgr.
+ *
+ * @param encoding The desired encoding.
+ */
+ EncodingFilterMgr (char encoding = ENC_UTF8);
+
+ /**
+ * The destructor of SWEncodingMgr.
+ */
+ ~EncodingFilterMgr();
+
+ /** Markup sets/gets the encoding after initialization
+ *
+ * @param enc The new encoding or ENC_UNKNOWN if you just want to get the current markup.
+ * @return The current (possibly changed) encoding format.
+ */
+ char Encoding(char enc);
+
+ /**
+ * Adds the raw filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the raw filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddRawFilters(SWModule *module, ConfigEntMap &section);
+
+ /**
+ * Adds the encoding filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the encoding filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddEncodingFilters(SWModule *module, ConfigEntMap &section);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/entriesblk.h b/include/entriesblk.h
new file mode 100644
index 0000000..833be03
--- /dev/null
+++ b/include/entriesblk.h
@@ -0,0 +1,34 @@
+#ifndef ENTRIESBLK_H
+#define ENTRIESBLK_H
+
+#include <sysdata.h>
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT EntriesBlock {
+ static const int METAHEADERSIZE;
+ static const int METAENTRYSIZE;
+
+private:
+ char *block;
+ void setCount(int count);
+ void getMetaEntry(int index, unsigned long *offset, unsigned long *size);
+ void setMetaEntry(int index, unsigned long offset, unsigned long size);
+
+public:
+ EntriesBlock(const char *iBlock, unsigned long size);
+ EntriesBlock();
+ ~EntriesBlock();
+
+ int getCount();
+ int addEntry(const char *entry);
+ const char *getEntry(int entryIndex);
+ unsigned long getEntrySize(int entryIndex);
+ void removeEntry(int entryIndex);
+ const char *getRawData(unsigned long *size);
+};
+
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/femain.h b/include/femain.h
new file mode 100644
index 0000000..5f4da3f
--- /dev/null
+++ b/include/femain.h
@@ -0,0 +1,32 @@
+/*
+ *
+ * $Id: femain.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef FEMAIN_H
+#define FEMAIN_H
+
+class FEMain
+{
+public:
+ FEMain ();
+ virtual ~FEMain ();
+ list < SWDisplay * >displays; // so we can delete each display we create
+};
+
+#endif
diff --git a/include/filemgr.h b/include/filemgr.h
new file mode 100644
index 0000000..86b8334
--- /dev/null
+++ b/include/filemgr.h
@@ -0,0 +1,190 @@
+/******************************************************************************
+* filemgr.h - definition of class FileMgr used for pooling file handles
+*
+* $Id: filemgr.h 2108 2007-10-13 20:35:02Z scribe $
+*
+* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
+
+#ifndef FILEMGR_H
+#define FILEMGR_H
+
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <defs.h>
+#include <swcacher.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT FileMgr;
+
+struct SWDLLEXPORT DirEntry {
+public:
+ SWBuf name;
+ unsigned long size;
+ bool isDirectory;
+};
+/**
+* This class represents one file. It works with the FileMgr object.
+*/
+class SWDLLEXPORT FileDesc {
+
+ friend class FileMgr;
+
+ long offset;
+ int fd; // -77 closed;
+ FileMgr *parent;
+ FileDesc *next;
+
+ FileDesc(FileMgr * parent, const char *path, int mode, int perms, bool tryDowngrade);
+ virtual ~FileDesc();
+
+public:
+ /** @return File handle.
+ */
+ int getFd();
+
+ long seek(long offset, int whence);
+ long read(void *buf, long count);
+ long write(const void *buf, long count);
+
+ /** Path to file.
+ */
+ char *path;
+ /** File access mode.
+ */
+ int mode;
+ /** File permissions.
+ */
+ int perms;
+ /**
+ */
+ bool tryDowngrade;
+};
+
+/**
+* This class ist used make file access operations easier.
+* It keeps a list of all open files internally and closes them
+* when the destructor is called.
+*/
+class SWDLLEXPORT FileMgr : public SWCacher {
+
+ friend class FileDesc;
+ friend class __staticsystemFileMgr;
+
+ FileDesc *files;
+ int sysOpen(FileDesc * file);
+protected:
+ static FileMgr *systemFileMgr;
+public:
+ static int CREAT;
+ static int APPEND;
+ static int TRUNC;
+ static int RDONLY;
+ static int RDWR;
+ static int WRONLY;
+ static int IREAD;
+ static int IWRITE;
+
+ /** Maximum number of open files set in the constructor.
+ * determines the max number of real system files that
+ * filemgr will open. Adjust for tuning.
+ */
+ int maxFiles;
+
+ static FileMgr *getSystemFileMgr();
+ static void setSystemFileMgr(FileMgr *newFileMgr);
+
+ /** Constructor.
+ * @param maxFiles The number of files that this FileMgr may open in parallel, if necessary.
+ */
+ FileMgr(int maxFiles = 35);
+
+ /**
+ * Destructor. Clean things up. Will close all files opened by this FileMgr object.
+ */
+ ~FileMgr();
+
+ /** Open a file and return a FileDesc for it.
+ * The file itself will only be opened when FileDesc::getFd() is called.
+ * @param path Filename.
+ * @param mode File access mode.
+ * @param tryDowngrade
+ * @return FileDesc object for the requested file.
+ */
+ FileDesc *open(const char *path, int mode, bool tryDowngrade);
+
+ /** Open a file and return a FileDesc for it.
+ * The file itself will only be opened when FileDesc::getFd() is called.
+ * @param path Filename.
+ * @param mode File access mode.
+ * @param perms Permissions.
+ * @param tryDowngrade
+ * @return FileDesc object for the requested file.
+ */
+ FileDesc *open(const char *path, int mode, int perms = IREAD | IWRITE, bool tryDowngrade = false);
+
+ /** Close a given file and delete its FileDesc object.
+ * Will only close the file if it was created by this FileMgr object.
+ * @param file The file to close.
+ */
+ void close(FileDesc * file);
+
+ /** Cacher methods overridden
+ */
+ virtual void flush();
+ virtual long resourceConsumption();
+
+ /** Checks for the existence of a file.
+ * @param ipath Path to file.
+ * @param ifileName Name of file to check for.
+ */
+ static signed char existsFile(const char *ipath, const char *ifileName = 0);
+
+ /** Checks for the existence of a directory.
+ * @param ipath Path to directory.
+ * @param idirName Name of directory to check for.
+ */
+ static signed char existsDir(const char *ipath, const char *idirName = 0);
+
+ /** Truncate a file at its current position
+ * leaving byte at current possition intact deleting everything afterward.
+ * @param file The file to operate on.
+ */
+ signed char trunc(FileDesc *file);
+
+ static char isDirectory(const char *path);
+ static int createParent(const char *pName);
+ static int createPathAndFile(const char *fName);
+
+ /** attempts to open a file readonly
+ * @param fName filename to open
+ * @return fd; < 0 = error
+ */
+ static int openFileReadOnly(const char *fName);
+ static int copyFile(const char *srcFile, const char *destFile);
+ static int copyDir(const char *srcDir, const char *destDir);
+ static int removeDir(const char *targetDir);
+ static int removeFile(const char *fName);
+ static char getLine(FileDesc *fDesc, SWBuf &line);
+
+};
+
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/flatapi.h b/include/flatapi.h
new file mode 100644
index 0000000..51cdeea
--- /dev/null
+++ b/include/flatapi.h
@@ -0,0 +1,106 @@
+/******************************************************************************
+ * swordapi.h - This file contains an api usable by non-C++
+ * environments
+ *
+ * $Id: flatapi.h 2152 2008-05-04 03:52:06Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWORDAPI_H
+#define SWORDAPI_H
+
+#include <defs.h>
+#include <inttypes.h>
+#ifdef __cplusplus
+#endif
+
+extern "C" {
+
+#define SWHANDLE intptr_t
+
+
+//-----------------------------------------------------------------
+// stringlist_iterator methods
+
+void SWDLLEXPORT stringlist_iterator_next(SWHANDLE hsli);
+const char * SWDLLEXPORT stringlist_iterator_val(SWHANDLE hsli);
+
+//-----------------------------------------------------------------
+// listkey_iterator methods
+
+void SWDLLEXPORT listkey_iterator_next(SWHANDLE lki);
+const char * SWDLLEXPORT listkey_iterator_val(SWHANDLE hsli);
+
+//-----------------------------------------------------------------
+// modmap methods
+//
+void SWDLLEXPORT ModList_iterator_next(SWHANDLE hmmi);
+SWHANDLE SWDLLEXPORT ModList_iterator_val(SWHANDLE hmmi);
+
+
+//-----------------------------------------------------------------
+// SWMgr methods
+//
+SWHANDLE SWDLLEXPORT SWMgr_new(char filterType);
+// SWConfig *, SWConfig *, bool, SWFilterMgr *
+SWHANDLE SWDLLEXPORT SWMgr_newEx(SWHANDLE hiconfig, SWHANDLE hisysconfig, char autoload, SWHANDLE hfilterMgr);
+void SWDLLEXPORT SWMgr_delete(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getConfig(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getModulesIterator(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getModuleByName(SWHANDLE hmgr, const char *name);
+const char * SWDLLEXPORT SWMgr_getPrefixPath(SWHANDLE hmgr);
+const char * SWDLLEXPORT SWMgr_getConfigPath(SWHANDLE hmgr);
+void SWDLLEXPORT SWMgr_setGlobalOption(SWHANDLE hmgr, const char *option, const char *value);
+const char * SWDLLEXPORT SWMgr_getGlobalOption(SWHANDLE hmgr, const char *option);
+const char * SWDLLEXPORT SWMgr_getGlobalOptionTip(SWHANDLE hmgr, const char *option);
+// ret: forward_iterator
+SWHANDLE SWDLLEXPORT SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr);
+// ret: forward_iterator
+SWHANDLE SWDLLEXPORT SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, const char *option);
+void SWDLLEXPORT SWMgr_setCipherKey(SWHANDLE hmgr, const char *modName, const char *key);
+
+
+//-----------------------------------------------------------------
+// SWModule methods
+
+void SWDLLEXPORT SWModule_terminateSearch(SWHANDLE hmodule);
+SWHANDLE SWDLLEXPORT SWModule_doSearch(SWHANDLE hmodule, const char *searchString, int type, int params, void (*percent) (char, void *), void *percentUserData);
+char SWDLLEXPORT SWModule_error(SWHANDLE hmodule);
+int SWDLLEXPORT SWModule_getEntrySize(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_setKeyText(SWHANDLE hmodule, const char *key);
+const char * SWDLLEXPORT SWModule_getKeyText(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getName(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getDescription(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getType(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_previous(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_next(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_begin(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getStripText(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getRenderText(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getEntryAttributes(SWHANDLE hmodule, const char *level1, const char *level2, const char *level3);
+const char * SWDLLEXPORT SWModule_getPreverseHeader(SWHANDLE hmodule, const char *key, int pvHeading);
+const char * SWDLLEXPORT SWModule_getFootnoteType(SWHANDLE hmodule, const char *key, const char *note);
+const char * SWDLLEXPORT SWModule_getFootnoteBody(SWHANDLE hmodule, const char *key, const char *note);
+const char * SWDLLEXPORT SWModule_getFootnoteRefList(SWHANDLE hmodule, const char *key, const char *note);
+
+SWHANDLE SWDLLEXPORT listkey_getVerselistIterator(const char * list, const char * key);
+
+}
+#ifdef __cplusplus
+#endif
+
+#endif
diff --git a/include/ftplib.h b/include/ftplib.h
new file mode 100644
index 0000000..75a90ae
--- /dev/null
+++ b/include/ftplib.h
@@ -0,0 +1,124 @@
+/***************************************************************************/
+/* ftplib.h - header file for callable ftp access routines */
+/* Copyright (C) 1996, 1997 Thomas Pfau, pfau@cnj.digex.net */
+/* 73 Catherine Street, South Bound Brook, NJ, 08880 */
+/* */
+/* This library is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU Library General Public */
+/* License as published by the Free Software Foundation; either */
+/* version 2 of the License, or (at your option) any later version. */
+/* */
+/* This library is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* Library General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU Library General Public */
+/* License along with this progam; if not, write to the */
+/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
+/* Boston, MA 02111-1307, USA. */
+/* */
+/***************************************************************************/
+
+#if !defined(__FTPLIB_H)
+#define __FTPLIB_H
+
+#if defined(__unix__) || defined(VMS)
+#define GLOBALDEF
+#define GLOBALREF extern
+#elif defined(_WIN32)
+#if defined BUILDING_LIBRARY
+#define GLOBALDEF __declspec(dllexport)
+#define GLOBALREF __declspec(dllexport)
+#else
+#define GLOBALREF __declspec(dllimport)
+#endif
+#endif
+
+/* FtpAccess() type codes */
+#define FTPLIB_DIR 1
+#define FTPLIB_DIR_VERBOSE 2
+#define FTPLIB_FILE_READ 3
+#define FTPLIB_FILE_WRITE 4
+
+/* FtpAccess() mode codes */
+#define FTPLIB_ASCII 'A'
+#define FTPLIB_IMAGE 'I'
+#define FTPLIB_TEXT FTPLIB_ASCII
+#define FTPLIB_BINARY FTPLIB_IMAGE
+
+/* connection modes */
+#define FTPLIB_PASSIVE 1
+#define FTPLIB_PORT 2
+
+/* connection option names */
+#define FTPLIB_CONNMODE 1
+#define FTPLIB_CALLBACK 2
+#define FTPLIB_IDLETIME 3
+#define FTPLIB_CALLBACKARG 4
+#define FTPLIB_CALLBACKBYTES 5
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct NetBuf netbuf;
+typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg);
+
+/* v1 compatibility stuff */
+#if !defined(_FTPLIB_NO_COMPAT)
+netbuf *DefaultNetbuf;
+
+#define ftplib_lastresp FtpLastResponse(DefaultNetbuf)
+#define ftpInit FtpInit
+#define ftpOpen(x) FtpConnect(x, &DefaultNetbuf)
+#define ftpLogin(x,y) FtpLogin(x, y, DefaultNetbuf)
+#define ftpSite(x) FtpSite(x, DefaultNetbuf)
+#define ftpMkdir(x) FtpMkdir(x, DefaultNetbuf)
+#define ftpChdir(x) FtpChdir(x, DefaultNetbuf)
+#define ftpRmdir(x) FtpRmdir(x, DefaultNetbuf)
+#define ftpNlst(x, y) FtpNlst(x, y, DefaultNetbuf)
+#define ftpDir(x, y) FtpDir(x, y, DefaultNetbuf)
+#define ftpGet(x, y, z) FtpGet(x, y, z, DefaultNetbuf)
+#define ftpPut(x, y, z) FtpPut(x, y, z, DefaultNetbuf)
+#define ftpRename(x, y) FtpRename(x, y, DefaultNetbuf)
+#define ftpDelete(x) FtpDelete(x, DefaultNetbuf)
+#define ftpQuit() FtpQuit(DefaultNetbuf)
+#endif /* (_FTPLIB_NO_COMPAT) */
+/* end v1 compatibility stuff */
+
+GLOBALREF int ftplib_debug;
+GLOBALREF void FtpInit(void);
+GLOBALREF char *FtpLastResponse(netbuf *nControl);
+GLOBALREF int FtpConnect(const char *host, netbuf **nControl);
+GLOBALREF int FtpOptions(int opt, long val, netbuf *nControl);
+GLOBALREF int FtpLogin(const char *user, const char *pass, netbuf *nControl);
+GLOBALREF int FtpAccess(const char *path, int typ, int mode, netbuf *nControl,
+ netbuf **nData);
+GLOBALREF int FtpRead(void *buf, int max, netbuf *nData);
+GLOBALREF int FtpWrite(void *buf, int len, netbuf *nData);
+GLOBALREF int FtpClose(netbuf *nData);
+GLOBALREF int FtpSite(const char *cmd, netbuf *nControl);
+GLOBALREF int FtpSysType(char *buf, int max, netbuf *nControl);
+GLOBALREF int FtpMkdir(const char *path, netbuf *nControl);
+GLOBALREF int FtpChdir(const char *path, netbuf *nControl);
+GLOBALREF int FtpCDUp(netbuf *nControl);
+GLOBALREF int FtpRmdir(const char *path, netbuf *nControl);
+GLOBALREF int FtpPwd(char *path, int max, netbuf *nControl);
+GLOBALREF int FtpNlst(const char *output, const char *path, netbuf *nControl);
+GLOBALREF int FtpDir(const char *output, const char *path, netbuf *nControl);
+GLOBALREF int FtpSize(const char *path, int *size, char mode, netbuf *nControl);
+GLOBALREF int FtpModDate(const char *path, char *dt, int max, netbuf *nControl);
+GLOBALREF int FtpGet(const char *output, const char *path, char mode,
+ netbuf *nControl);
+GLOBALREF int FtpPut(const char *input, const char *path, char mode,
+ netbuf *nControl);
+GLOBALREF int FtpRename(const char *src, const char *dst, netbuf *nControl);
+GLOBALREF int FtpDelete(const char *fnm, netbuf *nControl);
+GLOBALREF void FtpQuit(netbuf *nControl);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* __FTPLIB_H */
diff --git a/include/ftplibftpt.h b/include/ftplibftpt.h
new file mode 100644
index 0000000..7aa9e13
--- /dev/null
+++ b/include/ftplibftpt.h
@@ -0,0 +1,34 @@
+#ifndef FTPLIBFTPT_H
+#define FTPLIBFTPT_H
+
+#include <defs.h>
+#include <ftptrans.h>
+
+typedef struct NetBuf netbuf;
+
+SWORD_NAMESPACE_START
+
+
+// initialize/cleanup SYSTEMWIDE library with life of this static.
+class FTPLibFTPTransport_init {
+public:
+ FTPLibFTPTransport_init();
+ ~FTPLibFTPTransport_init();
+};
+
+
+class SWDLLEXPORT FTPLibFTPTransport : public FTPTransport {
+ netbuf *ftpConnection;
+
+ char assureLoggedIn();
+
+public:
+ FTPLibFTPTransport(const char *host, StatusReporter *statusReporter = 0);
+ ~FTPLibFTPTransport();
+ char getURL(const char *destPath, const char *sourceURL, SWBuf *destBuf = 0);
+};
+
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/ftpparse.h b/include/ftpparse.h
new file mode 100644
index 0000000..3da3c1b
--- /dev/null
+++ b/include/ftpparse.h
@@ -0,0 +1,53 @@
+#ifndef FTPPARSE_H
+#define FTPPARSE_H
+
+#include <time.h>
+
+/*
+ftpparse(&fp,buf,len) tries to parse one line of LIST output.
+
+The line is an array of len characters stored in buf.
+It should not include the terminating CR LF; so buf[len] is typically CR.
+
+If ftpparse() can't find a filename, it returns 0.
+
+If ftpparse() can find a filename, it fills in fp and returns 1.
+fp is a struct ftpparse, defined below.
+The name is an array of fp.namelen characters stored in fp.name;
+fp.name points somewhere within buf.
+*/
+
+struct ftpparse {
+ char *name; /* not necessarily 0-terminated */
+ int namelen;
+ int flagtrycwd; /* 0 if cwd is definitely pointless, 1 otherwise */
+ int flagtryretr; /* 0 if retr is definitely pointless, 1 otherwise */
+ int sizetype;
+ long size; /* number of octets */
+ int mtimetype;
+ time_t mtime; /* modification time */
+ int idtype;
+ char *id; /* not necessarily 0-terminated */
+ int idlen;
+} ;
+
+#define FTPPARSE_SIZE_UNKNOWN 0
+#define FTPPARSE_SIZE_BINARY 1 /* size is the number of octets in TYPE I */
+#define FTPPARSE_SIZE_ASCII 2 /* size is the number of octets in TYPE A */
+
+#define FTPPARSE_MTIME_UNKNOWN 0
+#define FTPPARSE_MTIME_LOCAL 1 /* time is correct */
+#define FTPPARSE_MTIME_REMOTEMINUTE 2 /* time zone and secs are unknown */
+#define FTPPARSE_MTIME_REMOTEDAY 3 /* time zone and time of day are unknown */
+/*
+When a time zone is unknown, it is assumed to be GMT. You may want
+to use localtime() for LOCAL times, along with an indication that the
+time is correct in the local time zone, and gmtime() for REMOTE* times.
+*/
+
+#define FTPPARSE_ID_UNKNOWN 0
+#define FTPPARSE_ID_FULL 1 /* unique identifier for files on this FTP server */
+
+extern int ftpparse(struct ftpparse *,char *,int);
+
+#endif
diff --git a/include/ftptrans.h b/include/ftptrans.h
new file mode 100644
index 0000000..c6a025a
--- /dev/null
+++ b/include/ftptrans.h
@@ -0,0 +1,64 @@
+#ifndef FTPTRANS_H
+#define FTPTRANS_H
+
+#include <vector>
+#include <defs.h>
+#include <swbuf.h>
+
+//SWORD_NAMESPACE_START
+
+
+// move this include to cpp once struct ftpparse isn't exposed anymore
+extern "C" {
+#include <ftpparse.h>
+}
+
+SWORD_NAMESPACE_START
+
+/** Class for reporting status
+*/
+class SWDLLEXPORT StatusReporter {
+public:
+ virtual ~StatusReporter() {};
+ /** Messages before stages of a batch download */
+ virtual void preStatus(long totalBytes, long completedBytes, const char *message);
+
+ /** frequently called throughout a download, to report status */
+ virtual void statusUpdate(double dtTotal, double dlNow);
+};
+
+
+/** TODO: document
+* A base class to be used for reimplementation of network services.
+*/
+class SWDLLEXPORT FTPTransport {
+
+protected:
+ StatusReporter *statusReporter;
+ bool passive;
+ bool term;
+ SWBuf host;
+
+public:
+ FTPTransport(const char *host, StatusReporter *statusReporter = 0);
+ virtual ~FTPTransport();
+
+ /***********
+ * override this method in your real impl
+ *
+ * if destBuf then write to buffer instead of file
+ */
+ virtual char getURL(const char *destPath, const char *sourceURL, SWBuf *destBuf = 0);
+
+
+ int copyDirectory(const char *urlPrefix, const char *dir, const char *dest, const char *suffix);
+
+ virtual std::vector<struct DirEntry> getDirList(const char *dirURL);
+ void setPassive(bool passive) { this->passive = passive; }
+ void terminate() { term = true; }
+};
+
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/gbffootnotes.h b/include/gbffootnotes.h
new file mode 100644
index 0000000..22ca18f
--- /dev/null
+++ b/include/gbffootnotes.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: gbffootnotes.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFFOOTNOTES_H
+#define GBFFOOTNOTES_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides footnotes in a GBF text
+ */
+class SWDLLEXPORT GBFFootnotes : public SWOptionFilter {
+public:
+ GBFFootnotes();
+ virtual ~GBFFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfheadings.h b/include/gbfheadings.h
new file mode 100644
index 0000000..b847f79
--- /dev/null
+++ b/include/gbfheadings.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: gbfheadings.h 2068 2007-08-31 06:40:23Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFHEADINGS_H
+#define GBFHEADINGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This Filter shows/hides headings in a GBF text
+ */
+class SWDLLEXPORT GBFHeadings : public SWOptionFilter {
+public:
+ GBFHeadings();
+ virtual ~GBFHeadings();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfhtml.h b/include/gbfhtml.h
new file mode 100644
index 0000000..5879d8e
--- /dev/null
+++ b/include/gbfhtml.h
@@ -0,0 +1,46 @@
+/******************************************************************************
+ *
+ * $Id: gbfhtml.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFHTML_H
+#define GBFHTML_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts GBF text to HTML text
+ */
+class SWDLLEXPORT GBFHTML : public SWBasicFilter {
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ bool hasFootnotePreTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ GBFHTML();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfhtmlhref.h b/include/gbfhtmlhref.h
new file mode 100644
index 0000000..0c849ad
--- /dev/null
+++ b/include/gbfhtmlhref.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ *
+ * $Id: gbfhtmlhref.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFHTMLHREF_H
+#define GBFHTMLHREF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts GBF text to HTML text with hrefs
+ */
+class SWDLLEXPORT GBFHTMLHREF : public SWBasicFilter {
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key);
+ bool hasFootnotePreTag;
+ SWBuf version;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ GBFHTMLHREF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfmorph.h b/include/gbfmorph.h
new file mode 100644
index 0000000..87e5b78
--- /dev/null
+++ b/include/gbfmorph.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: gbfmorph.h 2068 2007-08-31 06:40:23Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFMORPH_H
+#define GBFMORPH_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This Filter shows/hides morph tags in a GBF text
+ */
+class SWDLLEXPORT GBFMorph : public SWOptionFilter {
+public:
+ GBFMorph();
+ virtual ~GBFMorph();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfosis.h b/include/gbfosis.h
new file mode 100644
index 0000000..edcbc87
--- /dev/null
+++ b/include/gbfosis.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ *
+ * $Id: gbfosis.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFOSIS_H
+#define GBFOSIS_H
+
+#include <swfilter.h>
+#include <stack>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+
+class SWDLLEXPORT QuoteStack {
+private:
+ class QuoteInstance {
+ public:
+ char startChar;
+ char level;
+ SWBuf uniqueID;
+ char continueCount;
+ QuoteInstance(char startChar = '\"', char level = 1, SWBuf uniqueID = "", char continueCount = 0) {
+ this->startChar = startChar;
+ this->level = level;
+ this->uniqueID = uniqueID;
+ this->continueCount = continueCount;
+ }
+ void pushStartStream(SWBuf &text);
+ };
+
+ typedef std::stack<QuoteInstance> QuoteInstanceStack;
+ QuoteInstanceStack quotes;
+public:
+ QuoteStack();
+ virtual ~QuoteStack();
+ void handleQuote(char *buf, char *quotePos, SWBuf &text);
+ void clear();
+ bool empty() { return quotes.empty(); }
+};
+
+/** this filter converts GBF text to OSIS text
+ */
+class SWDLLEXPORT GBFOSIS : public SWFilter {
+public:
+ GBFOSIS();
+ virtual ~GBFOSIS();
+ char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif /* THMLOSIS_H */
diff --git a/include/gbfplain.h b/include/gbfplain.h
new file mode 100644
index 0000000..3ac9f98
--- /dev/null
+++ b/include/gbfplain.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: gbfplain.h 2068 2007-08-31 06:40:23Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFPLAIN_H
+#define GBFPLAIN_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This filter converts GBF text to plain text
+ */
+class SWDLLEXPORT GBFPlain : public SWFilter {
+public:
+ GBFPlain();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfredletterwords.h b/include/gbfredletterwords.h
new file mode 100644
index 0000000..26941b8
--- /dev/null
+++ b/include/gbfredletterwords.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ *
+ * $Id: gbfredletterwords.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFSREDLETTERWORDS_H
+#define GBFREDLETTERWORDS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides "red letter tags" (marking the
+ * words of Jesus) in a GBF text. Turn this off if you don't want
+ * to have this kind of markup in the text.
+ */
+class SWDLLEXPORT GBFRedLetterWords : public SWOptionFilter {
+public:
+ GBFRedLetterWords();
+ virtual ~GBFRedLetterWords();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfrtf.h b/include/gbfrtf.h
new file mode 100644
index 0000000..907dfbd
--- /dev/null
+++ b/include/gbfrtf.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: gbfrtf.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFRTF_H
+#define GBFRTF_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts GBF text into RTF text
+ */
+class SWDLLEXPORT GBFRTF : public SWFilter {
+public:
+ GBFRTF();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfstrongs.h b/include/gbfstrongs.h
new file mode 100644
index 0000000..0d08eb2
--- /dev/null
+++ b/include/gbfstrongs.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: gbfstrongs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFSTRONGS_H
+#define GBFSTRONGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides strong's numbers in a GBF text
+ */
+class SWDLLEXPORT GBFStrongs : public SWOptionFilter {
+public:
+ GBFStrongs();
+ virtual ~GBFStrongs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfthml.h b/include/gbfthml.h
new file mode 100644
index 0000000..0c650ab
--- /dev/null
+++ b/include/gbfthml.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: gbfthml.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFTHML_H
+#define GBFTHML_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts GBF text into ThML text
+ */
+class SWDLLEXPORT GBFThML : public SWFilter {
+public:
+ GBFThML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfwebif.h b/include/gbfwebif.h
new file mode 100644
index 0000000..ae96f92
--- /dev/null
+++ b/include/gbfwebif.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
+ * $Id: gbfwebif.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFWEBIF_H
+#define GBFWEBIF_H
+
+#include <gbfhtmlhref.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts GBF text to HTML text with hrefs
+ */
+class SWDLLEXPORT GBFWEBIF : public GBFHTMLHREF {
+ const SWBuf baseURL;
+ const SWBuf passageStudyURL;
+
+protected:
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ GBFWEBIF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfwordjs.h b/include/gbfwordjs.h
new file mode 100644
index 0000000..5f31d29
--- /dev/null
+++ b/include/gbfwordjs.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *
+ * $Id: gbfwordjs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFWORDSJS_H
+#define GBFWORDSJS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+class SWMgr;
+ /** This Filter shows/hides strong's numbers in a GBF text
+ */
+class SWDLLEXPORT GBFWordJS : public SWOptionFilter {
+ SWModule *defaultGreekLex;
+ SWModule *defaultHebLex;
+ SWModule *defaultGreekParse;
+ SWModule *defaultHebParse;
+ SWMgr *mgr;
+
+public:
+ GBFWordJS();
+ virtual ~GBFWordJS();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ void setDefaultModules(SWModule *defaultGreekLex = 0, SWModule *defaultHebLex = 0, SWModule *defaultGreekParse = 0, SWModule *defaultHebParse = 0) {
+ this->defaultGreekLex = defaultGreekLex;
+ this->defaultHebLex = defaultHebLex;
+ this->defaultGreekParse = defaultGreekParse;
+ this->defaultHebParse = defaultHebParse;
+ }
+ void setMgr(SWMgr *mgr) { this->mgr = mgr; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/greeklexattribs.h b/include/greeklexattribs.h
new file mode 100644
index 0000000..8dfb7d6
--- /dev/null
+++ b/include/greeklexattribs.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: greeklexattribs.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GREEKLEXATTRIBS_H
+#define GREEKLEXATTRIBS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to plain text
+ */
+class SWDLLEXPORT GreekLexAttribs : public SWOptionFilter {
+public:
+ GreekLexAttribs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/hebrewmcim.h b/include/hebrewmcim.h
new file mode 100644
index 0000000..3c9aa63
--- /dev/null
+++ b/include/hebrewmcim.h
@@ -0,0 +1,32 @@
+#ifndef HEBREWMCIM_H
+#define HEBREWMCIM_H
+
+/**
+ * Title: Keyboard mapping for Michigan-Claremont Hebrew input
+ * Description:
+ * Copyright: Copyright (c) 2001 CrossWire Bible Society under the terms of the GNU GPL
+ * Company:
+ * @author Troy A. Griffitts
+ * @version 1.0
+ */
+
+#include <swinputmeth.h>
+#include <map>
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+
+class SWDLLEXPORT HebrewMCIM : public SWInputMethod {
+
+ void init();
+ int subst[255];
+ map<int, int> subst2[12];
+ map<int, int*> multiChars;
+
+public:
+ HebrewMCIM();
+ int *translate(char in);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/hrefcom.h b/include/hrefcom.h
new file mode 100644
index 0000000..83d71e6
--- /dev/null
+++ b/include/hrefcom.h
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * hrefcom.h - code for class 'HREFCom'- a module that produces HTML HREFs
+ * pointing to actual text desired. Uses standard
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: hrefcom.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef HREFCOM_H
+#define HREFCOM_H
+
+#include <rawverse.h>
+#include <swcom.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT HREFCom:public RawVerse, public SWCom {
+ char *prefix;
+
+public:
+
+
+ HREFCom(const char *ipath, const char *prefix, const char *iname = 0,
+ const char *idesc = 0, SWDisplay * idisp = 0);
+ virtual ~HREFCom();
+ virtual SWBuf &getRawEntryBuf();
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/installmgr.h b/include/installmgr.h
new file mode 100644
index 0000000..f4d48e9
--- /dev/null
+++ b/include/installmgr.h
@@ -0,0 +1,105 @@
+#ifndef INSTALLMGR_H
+#define INSTALLMGR_H
+
+#include <defs.h>
+#include <swbuf.h>
+#include <map>
+#include <set>
+
+SWORD_NAMESPACE_START
+
+class SWMgr;
+class SWModule;
+class SWConfig;
+class FTPTransport;
+class StatusReporter;
+
+/** TODO: document
+*/
+class SWDLLEXPORT InstallSource {
+ SWMgr *mgr;
+public:
+ InstallSource(const char *type, const char *confEnt = 0);
+ virtual ~InstallSource();
+ SWBuf getConfEnt() {
+ return caption +"|" + source + "|" + directory;
+ }
+ SWBuf type;
+ SWBuf source;
+ SWBuf directory;
+ SWBuf caption;
+ SWBuf localShadow;
+ void *userData;
+ SWMgr *getMgr();
+ void flush();
+};
+
+typedef std::map<SWBuf, InstallSource *> InstallSourceMap;
+
+/** TODO: document
+*/
+class SWDLLEXPORT InstallMgr {
+
+protected:
+ std::set<SWBuf> defaultMods;
+ char *privatePath;
+ StatusReporter *statusReporter;
+ bool passive;
+
+ // override this method and provide your own custom FTPTransport subclass
+ virtual FTPTransport *createFTPTransport(const char *host, StatusReporter *statusReporter);
+
+ // we have a transport member to set as current running transport so we
+ // can ask it to terminate below, if user requests
+ FTPTransport *transport;
+
+public:
+
+ static const int MODSTAT_OLDER;
+ static const int MODSTAT_SAMEVERSION;
+ static const int MODSTAT_UPDATED;
+ static const int MODSTAT_NEW;
+ static const int MODSTAT_CIPHERED;
+ static const int MODSTAT_CIPHERKEYPRESENT;
+
+ SWConfig *installConf;
+ InstallSourceMap sources;
+ bool term;
+
+ InstallMgr(const char *privatePath = "./", StatusReporter *statusReporter = 0);
+ virtual ~InstallMgr();
+
+ virtual int removeModule(SWMgr *manager, const char *modName);
+ virtual int ftpCopy(InstallSource *is, const char *src, const char *dest, bool dirTransfer = false, const char *suffix = "");
+ virtual int installModule(SWMgr *destMgr, const char *fromLocation, const char *modName, InstallSource *is = 0);
+
+ virtual int refreshRemoteSource(InstallSource *is);
+ virtual bool getCipherCode(const char *modName, SWConfig *config);
+ void setFTPPassive(bool passive) { this->passive = passive; }
+ void terminate();
+
+ /************************************************************************
+ * getModuleStatus - compare the modules of two SWMgrs and return a
+ * vector describing the status of each. See MODSTAT_*
+ */
+ static std::map<SWModule *, int> getModuleStatus(const SWMgr &base, const SWMgr &other);
+
+ /************************************************************************
+ * isDefaultModule - allows an installation to provide a set of modules
+ * in installMgr.conf like:
+ * [General]
+ * DefaultMod=KJV
+ * DefaultMod=StrongsGreek
+ * DefaultMod=Personal
+ * This method allows a user interface to ask if a module is specified
+ * as a default in the above way. The logic is, if no modules are
+ * installed then all default modules should be automatically selected for install
+ * to help the user select a basic foundation of useful modules
+ */
+ bool isDefaultModule(const char *modName);
+};
+
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/latin1utf16.h b/include/latin1utf16.h
new file mode 100644
index 0000000..582a89b
--- /dev/null
+++ b/include/latin1utf16.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: latin1utf16.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef LATIN1UTF16_H
+#define LATIN1UTF16_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts Latin-1 encoded text to UTF-16
+ */
+class SWDLLEXPORT Latin1UTF16 : public SWFilter {
+public:
+ Latin1UTF16();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/latin1utf8.h b/include/latin1utf8.h
new file mode 100644
index 0000000..1de302d
--- /dev/null
+++ b/include/latin1utf8.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: latin1utf8.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef LATIN1UTF8_H
+#define LATIN1UTF8_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts Latin-1 encoded text to UTF-8
+ */
+class SWDLLEXPORT Latin1UTF8 : public SWFilter {
+public:
+ Latin1UTF8();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/listkey.h b/include/listkey.h
new file mode 100644
index 0000000..e939248
--- /dev/null
+++ b/include/listkey.h
@@ -0,0 +1,144 @@
+/******************************************************************************
+ * listkey.h - code for base class 'listkey'. listkey is the basis for all
+ * types of keys for indexing into modules
+ * (e.g. verse, word,
+ * place, etc.)
+ *
+ * $Id: listkey.h 1958 2006-08-22 00:15:10Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWLSTKEY_H
+#define SWLSTKEY_H
+
+#include <swkey.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+ /** ListKey is the basis for all
+ * types of keys that have lists of specified indexes
+ * (e.g. a list of verses, place, etc.)
+ */
+class SWDLLEXPORT ListKey : public SWKey {
+
+ static SWClass classdef;
+ void init();
+
+protected:
+ int arraypos;
+ int arraymax;
+ int arraycnt;
+ SWKey **array;
+
+public:
+
+ /** initializes instance of ListKey
+ *
+ * @param ikey text key
+ */
+ ListKey(const char *ikey = 0);
+ ListKey(ListKey const &k);
+
+ /** cleans up instance of ListKey
+ */
+ virtual ~ListKey();
+
+ virtual SWKey *clone() const;
+
+ /** Clears out elements of list
+ */
+ virtual void clear();
+
+ /** deprecated, use clear(), instead
+ */
+ virtual void ClearList() { clear(); }
+
+ /** Returns number of elements in list
+ * @return number of elements in list
+ */
+ virtual int Count();
+
+ /** Removes current element from list
+ */
+ virtual void Remove();
+
+ /** Sets key to element number
+ *
+ * @param ielement element number to set to
+ * @return error status
+ */
+ virtual char SetToElement(int ielement, SW_POSITION = TOP);
+
+ /** Gets a key element number
+ *
+ * @param pos element number to get (or default current)
+ * @return Key or null on error
+ */
+ virtual SWKey *getElement(int pos = -1);
+
+ // deprecated, use above function
+ virtual SWKey *GetElement(int pos = -1) { return getElement(pos); }
+
+ /** Adds an element to the list
+ * @param ikey the element to add
+ */
+ ListKey & operator <<(const SWKey &ikey) { add(ikey); return *this; }
+ virtual void add(const SWKey &ikey);
+
+ /** Equates this ListKey to another ListKey object
+ *
+ * @param ikey other ListKey object
+ */
+ virtual void copyFrom(const ListKey & ikey);
+ virtual void copyFrom(const SWKey & ikey) { SWKey::copyFrom(ikey); }
+
+ /** Positions this key
+ *
+ * @param pos position
+ * @return *this
+ */
+ virtual void setPosition(SW_POSITION pos);
+
+ /** Decrements a number of elements
+ */
+ virtual void decrement(int step);
+
+ /** Increments a number of elements
+ */
+ virtual void increment(int step);
+
+ virtual bool isTraversable() const { return true; }
+ virtual long Index() const { return arraypos; }
+ virtual const char *getRangeText() const;
+
+ /**
+ * Returns the index for the new one given as as parameter.
+ * The first parameter is the new index.
+ */
+ virtual long Index(long index) { SetToElement(index); return Index (); }
+ virtual const char *getText() const;
+ virtual void setText(const char *ikey);
+ virtual void sort();
+
+ SWKEY_OPERATORS
+ ListKey & operator =(const ListKey &key) { copyFrom(key); return *this; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/localemgr.h b/include/localemgr.h
new file mode 100644
index 0000000..9e30160
--- /dev/null
+++ b/include/localemgr.h
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * localemgr.h - definition of class LocaleMgr used to interact with
+ * registered locales for a sword installation
+ *
+ * $Id: localemgr.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef LOCALEMGR_H
+#define LOCALEMGR_H
+
+#include <map>
+#include <list>
+
+#include <defs.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+class SWLocale;
+
+typedef std::list<SWBuf> StringList;
+typedef std::map < SWBuf, SWLocale *, std::less < SWBuf > > LocaleMap;
+/**
+* The LocaleMgr class handles all the different locales of Sword.
+* It provides functions to get a list of all available locales,
+* to get the default locale name and to get it.
+* The other functions are not interesting for frontend programmers.
+*
+* To get the default locale name use @see getDefaultLocaleName
+* To set the default locale name use @see setDefaultLocaleName
+* To get the locale for a language name use @see getLocale
+* To get a list of availble locales use @see getAvailableLocales
+*/
+class SWDLLEXPORT LocaleMgr {
+private:
+ void deleteLocales();
+ char *defaultLocaleName;
+ LocaleMgr(const LocaleMgr &);
+ friend class __staticsystemLocaleMgr;
+protected:
+ LocaleMap *locales;
+ static LocaleMgr *systemLocaleMgr;
+
+public:
+
+ /** Default constructor of LocaleMgr
+ * You do normally not need this constructor, use LocaleMgr::getSystemLocaleMgr() instead.
+ */
+ LocaleMgr(const char *iConfigPath = 0);
+
+ /**
+ * Default destructor of LocaleMgr
+ */
+ virtual ~LocaleMgr();
+
+ /** Get the locale connected with the name "name".
+ *
+ * @param name The name of the locale you want to have. For example use getLocale("de") to get the locale for the German language.
+ * @return Returns the locale object if the locale with the name given as parameter was found. If it wasn't found return NULL.
+ */
+ virtual SWLocale *getLocale(const char *name);
+
+ /** Get the list of available locales.
+ *
+ * @return Returns a list of strings, which contains the names of the available locales.
+ */
+ virtual StringList getAvailableLocales();
+
+ /** Returns translated text.
+ * This function uses both parameters to return the translated version of the given text.
+ *
+ * @param text The text to translate into the language given by the first parameter.
+ * @param localeName The name of the locale Sword should use
+ * @return Returns the translated text.
+ */
+ virtual const char *translate(const char *text, const char *localeName = 0);
+
+ /** Get the default locale name. To set it use @see setDefaultLocaleName
+ *
+ * @return Returns the default locale name
+ */
+ virtual const char *getDefaultLocaleName();
+
+ /** Set the new standard locale of Sword.
+ *
+ * @param name The name of the new default locale
+ */
+ virtual void setDefaultLocaleName(const char *name);
+
+ /** The LocaleMgr object used globally in the Sword world.
+ * Do not create your own LocaleMgr, use this static object instead.
+ */
+ static LocaleMgr *getSystemLocaleMgr();
+ static void setSystemLocaleMgr(LocaleMgr *newLocaleMgr);
+
+ /** Augment this localmgr with all locale.conf files in a directory
+ */
+ virtual void loadConfigDir(const char *ipath);
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/lzsscomprs.h b/include/lzsscomprs.h
new file mode 100644
index 0000000..67732a3
--- /dev/null
+++ b/include/lzsscomprs.h
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * lzsscomprs.h - definition of Class SWCompress used for data compression
+ *
+ * $Id: lzsscomprs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef LZSSCOMPRS_H
+#define LZSSCOMPRS_H
+
+#include <swcomprs.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+// The following are constant sizes used by the compression algorithm.
+//
+// N - This is the size of the ring buffer. It is set
+// to 4K. It is important to note that a position
+// within the ring buffer requires 12 bits.
+//
+// F - This is the maximum length of a character sequence
+// that can be taken from the ring buffer. It is set
+// to 18. Note that a length must be 3 before it is
+// worthwhile to store a position/length pair, so the
+// length can be encoded in only 4 bits. Or, put yet
+// another way, it is not necessary to encode a length
+// of 0-18, it is necessary to encode a length of
+// 3-18, which requires 4 bits.
+//
+// THRESHOLD - It takes 2 bytes to store an offset and
+// a length. If a character sequence only
+// requires 1 or 2 characters to store
+// uncompressed, then it is better to store
+// it uncompressed than as an offset into
+// the ring buffer.
+//
+// Note that the 12 bits used to store the position and the 4 bits
+// used to store the length equal a total of 16 bits, or 2 bytes.
+
+#define N 4096
+#define F 18
+#define THRESHOLD 3
+#define NOT_USED N
+
+
+
+class SWDLLEXPORT LZSSCompress:public SWCompress
+{
+ static unsigned char m_ring_buffer[N + F - 1];
+ static short int m_match_position;
+ static short int m_match_length;
+ static short int m_lson[N + 1];
+ static short int m_rson[N + 257];
+ static short int m_dad[N + 1];
+ void InitTree ();
+ void InsertNode (short int Pos);
+ void DeleteNode (short int Node);
+public:
+ LZSSCompress ();
+ virtual ~ LZSSCompress ();
+ virtual void Encode (void);
+ virtual void Decode (void);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/markupfiltmgr.h b/include/markupfiltmgr.h
new file mode 100644
index 0000000..5d9faa6
--- /dev/null
+++ b/include/markupfiltmgr.h
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * swmarkupmgr.h - definition of class SWMarkupMgr, subclass of
+ * used to transcode all module text to a requested
+ * markup.
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef MARKUPFILTMGR_H
+#define MARKUPFILTMGR_H
+
+#include <encfiltmgr.h>
+
+SWORD_NAMESPACE_START
+
+/** This class is like a normal SWEncodingMgr,
+* but you can additonally specify which markup
+* you want to use.
+*/
+class SWDLLEXPORT MarkupFilterMgr : public EncodingFilterMgr {
+protected:
+ SWFilter* fromthml;
+ SWFilter* fromgbf;
+ SWFilter* fromplain;
+ SWFilter* fromosis;
+ SWFilter* fromtei;
+
+ /**
+ * current markup value
+ */
+ char markup;
+
+ void CreateFilters(char markup);
+public:
+ /** Constructor of SWMarkupMgr.
+ *
+ * @param encoding The desired encoding.
+ * @param markup The desired markup format.
+ */
+ MarkupFilterMgr(char markup = FMT_THML, char encoding = ENC_UTF8);
+
+ /**
+ * The destructor of SWMarkupMgr.
+ */
+ ~MarkupFilterMgr();
+
+ /** Markup sets/gets the markup after initialization
+ *
+ * @param m The new markup or FMT_UNKNOWN if you just want to get the current markup.
+ * @return The current (possibly changed) markup format.
+ */
+ char Markup(char m = FMT_UNKNOWN);
+
+ /**
+ * Adds the render filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the render filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddRenderFilters(SWModule *module, ConfigEntMap &section);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/multimapwdef.h b/include/multimapwdef.h
new file mode 100644
index 0000000..89b79a9
--- /dev/null
+++ b/include/multimapwdef.h
@@ -0,0 +1,39 @@
+#ifndef MULTIMAPWDEF
+#define MULTIMAPWDEF
+
+#include <map>
+
+SWORD_NAMESPACE_START
+
+// multmap that still lets you use [] to reference FIRST
+// entry of a key if multiples exist
+template <class Key, class T, class Compare>
+class multimapwithdefault : public std::multimap<Key, T, Compare> {
+public:
+ typedef std::pair<const Key, T> value_type;
+ T& getWithDefault(const Key& k, const T& defaultValue) {
+ if (find(k) == this->end()) {
+ insert(value_type(k, defaultValue));
+ }
+ return (*(find(k))).second;
+ }
+
+ T& operator[](const Key& k) {
+ if (find(k) == this->end()) {
+ insert(value_type(k, T()));
+ }
+ return (*(find(k))).second;
+ }
+ bool has(const Key& k, const T &val) const {
+ typename std::multimap<Key, T, Compare>::const_iterator start = lower_bound(k);
+ typename std::multimap<Key, T, Compare>::const_iterator end = upper_bound(k);
+ for (; start!=end; start++) {
+ if (start->second == val)
+ return true;
+ }
+ return false;
+ }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/nullim.h b/include/nullim.h
new file mode 100644
index 0000000..217c38f
--- /dev/null
+++ b/include/nullim.h
@@ -0,0 +1,16 @@
+#ifndef NULLIM_H
+#define NULLIM_H
+
+#include <swinputmeth.h>
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT NullIM : public SWInputMethod {
+
+public:
+ NullIM();
+ int * translate(char ch);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisbook.h b/include/osisbook.h
new file mode 100644
index 0000000..a3750f6
--- /dev/null
+++ b/include/osisbook.h
@@ -0,0 +1,640 @@
+/******************************************************************************
+ * osisbook.h - Canonical text information to be included by VerseKey2.cpp
+ *
+ * $Id: osisbook.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 2004 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+/******************************************************************************
+ * [on]tbooks - initialize static instance for all canonical text names
+ * and chapmax
+ * taken from http://whi.wts.edu/OSIS/Projects/Markup/specs/BibleBookNames.html
+ */
+
+#define TESTAMENT_HEADING 255
+//#define NTOFFSET 24115 //24115 is offset to start of NT
+#if 0
+#define OSISBMAX 68
+#endif
+#define BUILTINABBREVCNT 195
+
+struct sbook2 VerseKey2::osisbooks[] = {
+//Module Heading
+{"Module Heading", "ZZZ"},//0
+//Old Testament
+{"Old Testament", "OT"},//1
+{"Genesis", "Gen"},
+{"Exodus", "Exod"},
+{"Leviticus", "Lev"},
+{"Numbers", "Num"},
+{"Deuteronomy", "Deut"},
+{"Joshua", "Josh"},
+{"Judges", "Judg"},
+{"Ruth", "Ruth"},
+{"1 Samuel", "1Sam"},//10
+{"2 Samuel", "2Sam"},
+{"1 Kings", "1Kgs"},
+{"2 Kings", "2Kgs"},
+{"1 Chronicles", "1Chr"},
+{"2 Chronicles", "2Chr"},
+{"Ezra", "Ezra"},
+{"Nehemiah", "Neh"},
+{"Esther", "Esth"},
+{"Job", "Job"},
+{"Psalms", "Ps"},//20
+{"Proverbs", "Prov"},
+{"Ecclesiastes", "Eccl"}, // Qohelot
+{"Song of Solomon", "Song"}, // Canticle of Canticles
+{"Isaiah", "Isa"},
+{"Jeremiah", "Jer"},
+{"Lamentations", "Lam"},
+{"Ezekiel", "Ezek"},
+{"Daniel", "Dan"},
+{"Hosea", "Hos"},
+{"Joel", "Joel"},//30
+{"Amos", "Amos"},
+{"Obadiah", "Obad"},
+{"Jonah", "Jonah"},
+{"Micah", "Mic"},
+{"Nahum", "Nah"},
+{"Habakkuk", "Hab"},
+{"Zephaniah", "Zeph"},
+{"Haggai", "Hag"},
+{"Zechariah", "Zech"},
+{"Malachi", "Mal"},//40
+
+//Roman Catholic Deuterocanon
+{"Deuterocanon", "DC"},//41
+{"Tobit", "Tob"},//(70)
+{"Judith", "Jdt"},
+{"Wisdom", "Wis"}, // Wisdom of Solomon
+{"Sirach", "Sir"}, // Ecclesiasticus
+{"Baruch", "Bar"}, // 1 Baruch
+{"Letter of Jeremiah", "EpJer"},//(75)
+{"1 Esdras", "1Esd"}, // 3Ezra Esdras A
+{"2 Esdras", "2Esd"}, // 4Ezra Esdras B
+{"1 Maccabees", "1Macc"},//(78)50
+{"2 Maccabees", "2Macc"},//51
+
+
+//Septuagint
+{"3 Maccabees", "3Macc"},//(80)52
+{"4 Maccabees", "4Macc"},
+{"Odes of Solomon", "OdesSol"},
+{"Psalms of Solomon", "PssSol"},//55
+
+
+//Vulgate
+{"Epistle to the Laodiceans", "EpLao"},//(84)56
+
+
+//Orthodox Canon
+{"1 Enoch", "1En"},//(85)57 // Ethiopic Apocalypse of Enoch
+{"Jubilees", "Jub"},//(86)58
+
+
+//Protestant Apocrypha
+{"Apocrypha", "Apoc"},//(87)59
+{"Additions to Esther", "AddEsth"},
+{"Prayer of Azariah", "PrAzar"}, // Song of the Three Children
+{"Susanna", "Sus"},//(90)
+{"Bel and the Dragon", "Bel"},
+{"Prayer of Manasses", "PrMan"},
+{"Psalm 151", "Ps151"},//(93)65
+
+
+//New Testament
+{"New Testament", "NT"},//66
+{"Matthew", "Matt"},
+{"Mark", "Mark"},
+{"Luke", "Luke"},
+{"John", "John"},//70
+{"Acts", "Acts"},
+{"Romans", "Rom"},
+{"1 Corinthians", "1Cor"},
+{"2 Corinthians", "2Cor"},
+{"Galatians", "Gal"},//(50)
+{"Ephesians", "Eph"},
+{"Philippians", "Phil"},
+{"Colossians", "Col"},
+{"1 Thessalonians", "1Thess"},
+{"2 Thessalonians", "2Thess"},//80
+{"1 Timothy", "1Tim"},
+{"2 Timothy", "2Tim"},
+{"Titus", "Titus"},
+{"Philemon", "Phlm"},
+{"Hebrews", "Heb"},//(60)
+{"James", "Jas"},
+{"1 Peter", "1Pet"},
+{"2 Peter", "2Pet"},
+{"1 John", "1John"},
+{"2 John", "2John"},//90
+{"3 John", "3John"},
+{"Jude", "Jude"},
+{"Revelation", "Rev"}//(68)93
+
+
+};
+
+/* the en abbrevs will be in a conf file as well
+*/
+
+/*
+const struct abbrev2
+ VerseKey2::builtin_abbrevs[] = {
+ {"1 C", 48}, // 1 Corinthians
+ {"1 CHRONICLES", 14}, // 1 Chronicles
+ {"1 CORINTHIANS", 48}, // 1 Corinthians
+ {"1 JN", 64}, // 1 John
+ {"1 JOHN", 64}, // 1 John
+ {"1 KGS", 12}, // 1 Kings
+ {"1 KINGS", 12}, // 1 Kings
+ {"1 PETER", 62}, // 1 Peter
+ {"1 PTR", 62}, // 1 Peter
+ {"1 SAMUEL", 10}, // 1 Samuel
+ {"1 THESSALONIANS", 54}, // 1 Thessalonians
+ {"1 TIMOTHY", 56}, // 1 Timothy
+ {"1C", 48}, // 1 Corinthians
+ {"1CHRONICLES", 14}, // 1 Chronicles
+ {"1CORINTHIANS", 48}, // 1 Corinthians
+ {"1JN", 64}, // 1 John
+ {"1JOHN", 64}, // 1 John
+ {"1KGS", 12}, // 1 Kings
+ {"1KINGS", 12}, // 1 Kings
+ {"1PETER", 62}, // 1 Peter
+ {"1PTR", 62}, // 1 Peter
+ {"1SAMUEL", 10}, // 1 Samuel
+ {"1THESSALONIANS", 54}, // 1 Thessalonians
+ {"1TIMOTHY", 56}, // 1 Timothy
+ {"2 C", 49}, // 2 Corinthians
+ {"2 CHRONICLES", 15}, // 2 Chronicles
+ {"2 CORINTHIANS", 49}, // 2 Corinthians
+ {"2 JN", 65}, // 2 John
+ {"2 JOHN", 65}, // 2 John
+ {"2 KGS", 13}, // 2 Kings
+ {"2 KINGS", 13}, // 2 Kings
+ {"2 PETER", 63}, // 2 Peter
+ {"2 PTR", 63}, // 2 Peter
+ {"2 SAMUEL", 11}, // 2 Samuel
+ {"2 THESSALONIANS", 55}, // 2 Thessalonians
+ {"2 TIMOTHY", 57}, // 2 Timothy
+ {"2C", 49}, // 2 Corinthians
+ {"2CHRONICLES", 15}, // 2 Chronicles
+ {"2CORINTHIANS", 49}, // 2 Corinthians
+ {"2JN", 65}, // 2 John
+ {"2JOHN", 65}, // 2 John
+ {"2KGS", 13}, // 2 Kings
+ {"2KINGS", 13}, // 2 Kings
+ {"2PETER", 63}, // 2 Peter
+ {"2PTR", 63}, // 2 Peter
+ {"2SAMUEL", 11}, // 2 Samuel
+ {"2THESSALONIANS", 55}, // 2 Thessalonians
+ {"2TIMOTHY", 57}, // 2 Timothy
+ {"3 JN", 66}, // 3 John
+ {"3 JOHN", 66}, // 3 John
+ {"3JN", 66}, // 3 John
+ {"3JOHN", 66}, // 3 John
+ {"ACTS", 46}, // Acts
+ {"AMOS", 31}, // Amos
+ {"APOCALYPSE OF ST. JOHN", 68}, // Apocalypse of St. John (Rev.)
+ {"C", 53}, // Colossians
+ {"CANTICLE OF CANTICLES", 23}, // Canticle of Canticles (Song of S.)
+ {"COLOSSIANS", 53}, // Colossians
+ {"D", 6}, // Deuteronomy
+ {"DANIEL", 28}, // Daniel
+ {"DEUTERONOMY", 6}, // Deuteronomy
+ {"E", 51}, // Ephesians
+ {"ECCLESIASTES", 22}, // Ecclesiastes
+ {"EPHESIANS", 51}, // Ephesians
+ {"ESTER", 18}, // Esther
+ {"ESTHER", 18}, // Esther
+ {"EXODUS", 3}, // Exodus
+ {"EZEKIEL", 27}, // Ezekiel
+ {"EZK", 27}, // Ezekiel
+ {"EZRA", 16}, // Ezra
+ {"G", 2}, // Genesis
+ {"GALATIANS", 50}, // Galatians
+ {"GENESIS", 2}, // Genesis
+ {"H", 60}, // Hebrews
+ {"HABAKKUK", 36}, // Habakkuk
+ {"HAGGAI", 38}, // Haggai
+ {"HEBREWS", 60}, // Hebrews
+ {"HOSEA", 29}, // Hosea
+ {"I C", 48}, // 1 Corinthians
+ {"I CHRONICLES", 14}, // 1 Chronicles
+ {"I CORINTHIANS", 48}, // 1 Corinthians
+ {"I JN", 64}, // 1 John
+ {"I JOHN", 64}, // 1 John
+ {"I KGS", 12}, // 1 Kings
+ {"I KINGS", 12}, // 1 Kings
+ {"I PETER", 62}, // 1 Peter
+ {"I PTR", 62}, // 1 Peter
+ {"I SAMUEL", 10}, // 1 Samuel
+ {"I THESSALONIANS", 54}, // 1 Thessalonians
+ {"I TIMOTHY", 56}, // 1 Timothy
+ {"IC", 48}, // 1 Corinthians
+ {"ICHRONICLES", 14}, // 1 Chronicles
+ {"ICORINTHIANS", 48}, // 1 Corinthians
+ {"II C", 49}, // 2 Corinthians
+ {"II CHRONICLES", 15}, // 2 Chronicles
+ {"II CORINTHIANS", 49}, // 2 Corinthians
+ {"II JN", 65}, // 2 John
+ {"II JOHN", 65}, // 2 John
+ {"II KGS", 13}, // 2 Kings
+ {"II KINGS", 13}, // 2 Kings
+ {"II PETER", 63}, // 2 Peter
+ {"II PTR", 63}, // 2 Peter
+ {"II SAMUEL", 11}, // 2 Samuel
+ {"II THESSALONIANS", 55}, // 2 Thessalonians
+ {"II TIMOTHY", 57}, // 2 Timothy
+ {"IIC", 49}, // 2 Corinthians
+ {"IICHRONICLES", 15}, // 2 Chronicles
+ {"IICORINTHIANS", 49}, // 2 Corinthians
+ {"III JN", 66}, // 3 John
+ {"III JOHN", 66}, // 3 John
+ {"IIIJN", 66}, // 3 John
+ {"IIIJOHN", 66}, // 3 John
+ {"IIJN", 65}, // 2 John
+ {"IIJOHN", 65}, // 2 John
+ {"IIKGS", 13}, // 2 Kings
+ {"IIKINGS", 13}, // 2 Kings
+ {"IIPETER", 63}, // 2 Peter
+ {"IIPTR", 63}, // 2 Peter
+ {"IISAMUEL", 11}, // 2 Samuel
+ {"IITHESSALONIANS", 55}, // 2 Thessalonians
+ {"IITIMOTHY", 55}, // 2 Timothy
+ {"IJN", 64}, // 1 John
+ {"IJOHN", 64}, // 1 John
+ {"IKGS", 12}, // 1 Kings
+ {"IKINGS", 12}, // 1 Kings
+ {"IPETER", 62}, // 1 Peter
+ {"IPTR", 62}, // 1 Peter
+ {"ISA", 24}, // Isaiah
+ {"ISAIAH", 24}, // Isaiah
+ {"ISAMUEL", 10}, // 1 Samuel
+ {"ITHESSALONIANS", 54}, // 1 Thessalonians
+ {"ITIMOTHY", 56}, // 1 Timothy
+ {"J", 45}, // John
+ {"JAMES", 61}, // James
+ {"JAS", 61}, // James
+ {"JDGS", 8}, // Judges
+ {"JEREMIAH", 25}, // Jeremiah
+ {"JHN", 45}, // John
+ {"JN", 45}, // John
+ {"JO", 45}, // John
+ {"JOB", 19}, // Job
+ {"JOEL", 30}, // Joel
+ {"JOHN", 45}, // John
+ {"JOL", 30}, // Joel
+ {"JONAH", 33}, // Jonah
+ {"JOSHUA", 7}, // Joshua
+ {"JUDE", 67}, // Jude
+ {"JUDGES", 8}, // Judges
+ {"L", 44}, // Luke
+ {"LAMENTATIONS", 26}, // Lamentations
+ {"LEVITICUS", 4}, // Leviticus
+ {"LK", 44}, // Luke
+ {"LUKE", 44}, // Luke
+ {"MA", 42}, // Matthew
+ {"MALACHI", 40}, // Malachi
+ {"MARK", 43}, // Mark
+ {"MATTHEW", 42}, // Matthew
+ {"MICAH", 34}, // Micah
+ {"MODULE HEADING", 0}, // Module Heading
+ {"MK", 43}, // Mark
+ {"MRK", 43}, // Mark
+ {"MT", 42}, // Matthew
+ {"N", 5}, // Numbers
+ {"NAHUM", 35}, // Nahum
+ {"NAM", 35}, // Nahum
+ {"NEHEMIAH", 17}, // Nehemiah
+ {"NEW TESTAMENT", 41}, // New Testament
+ {"NUMBERS", 5}, // Numbers
+ {"OBADIAH", 32}, // Obadiah
+ {"OLD TESTAMENT", 1}, // Old Testament
+ {"P", 20}, // Psalms
+ {"PHIL", 52}, // Philippians
+ {"PHILEMON", 59}, // Philemon
+ {"PHILIPPIANS", 52}, // Philippians
+ {"PHLM", 59}, // Philemon
+ {"PHM", 59}, // Philemon
+ {"PHP", 52}, // Philippians
+ {"PR", 21}, // Proverbs
+ {"PROVERBS", 21}, // Proverbs
+ {"PSA", 20}, // Psalms
+ {"PSALMS", 20}, // Psalms
+ {"PSM", 20}, // Psalms
+ {"PSS", 20}, // Psalms
+ {"QOHELETH", 22}, // Qohelet (Ecclesiastes)
+ {"REVELATION OF JOHN", 68}, // Revelation
+ {"ROMANS", 47}, // Romans
+ {"RUTH", 9}, // Ruth
+ {"SNG", 23}, // Song of Solomon
+ {"SOLOMON", 23}, // Song of Solomon
+ {"SONG OF SOLOMON", 23}, // Song of Solomon
+ {"SONG OF SONGS", 23}, // Song of Solomon
+ {"SOS", 23}, // Song of Solomon
+ {"TITUS", 58}, // Titus
+ {"ZECHARIAH", 39}, // Zechariah
+ {"ZEPHANIAH", 37}, // Zephaniah
+ {"", -1}
+};
+*/
+
+/* includes all osis books - use the locale osis.conf instead
+const struct abbrev
+ VerseKey2::builtin_abbrevs[] = {
+ {"1 C", 46}, // 1 Corinthians
+ {"1 CHRONICLES", 13}, // 1 Chronicles
+ {"1 CORINTHIANS", 47}, // 1 Corinthians
+ {"1 ENOCH", 84},
+ {"1 ESDRAS", 75},
+ {"1 JN", 63}, // 1 John
+ {"1 JOHN", 63}, // 1 John
+ {"1 KGS", 11}, // 1 Kings
+ {"1 KINGS", 11}, // 1 Kings
+ {"1 MACCABEES", 77},
+ {"1 PETER", 61}, // 1 Peter
+ {"1 PTR", 61}, // 1 Peter
+ {"1 SAMUEL", 9}, // 1 Samuel
+ {"1 THESSALONIANS", 53}, // 1 Thessalonians
+ {"1 TIMOTHY", 55}, // 1 Timothy
+ {"1C", 47}, // 1 Corinthians
+ {"1CHRONICLES", 13}, // 1 Chronicles
+ {"1CORINTHIANS", 47}, // 1 Corinthians
+ {"1ENOCH", 84},
+ {"1ESDRAS", 75},
+ {"1JN", 63}, // 1 John
+ {"1JOHN", 63}, // 1 John
+ {"1KGS", 11}, // 1 Kings
+ {"1KINGS", 11}, // 1 Kings
+ {"1MACCABEES", 77},
+ {"1PETER", 61}, // 1 Peter
+ {"1PTR", 61}, // 1 Peter
+ {"1SAMUEL", 9}, // 1 Samuel
+ {"1THESSALONIANS", 53}, // 1 Thessalonians
+ {"1TIMOTHY", 55}, // 1 Timothy
+ {"2 C", 48}, // 2 Corinthians
+ {"2 CHRONICLES", 14}, // 2 Chronicles
+ {"2 CORINTHIANS", 48}, // 2 Corinthians
+ {"2 ESDRAS", 76},
+ {"2 JN", 64}, // 2 John
+ {"2 JOHN", 64}, // 2 John
+ {"2 KGS", 12}, // 2 Kings
+ {"2 KINGS", 12}, // 2 Kings
+ {"2 MACCABEES", 78},
+ {"2 PETER", 62}, // 2 Peter
+ {"2 PTR", 62}, // 2 Peter
+ {"2 SAMUEL", 10}, // 2 Samuel
+ {"2 THESSALONIANS", 54}, // 2 Thessalonians
+ {"2 TIMOTHY", 56}, // 2 Timothy
+ {"2C", 48}, // 2 Corinthians
+ {"2CHRONICLES", 14}, // 2 Chronicles
+ {"2CORINTHIANS", 48}, // 2 Corinthians
+ {"2ESDRAS", 76},
+ {"2JN", 64}, // 2 John
+ {"2JOHN", 64}, // 2 John
+ {"2KGS", 12}, // 2 Kings
+ {"2KINGS", 12}, // 2 Kings
+ {"2MACCABEES", 78},
+ {"2PETER", 62}, // 2 Peter
+ {"2PTR", 62}, // 2 Peter
+ {"2SAMUEL", 10}, // 2 Samuel
+ {"2THESSALONIANS", 54}, // 2 Thessalonians
+ {"2TIMOTHY", 56}, // 2 Timothy
+ {"3 JN", 65}, // 3 John
+ {"3 JOHN", 65}, // 3 John
+ {"3JN", 65}, // 3 John
+ {"3JOHN", 65}, // 3 John
+ {"3 MACCABEES", 79},
+ {"3MACCABEES", 79},
+ {"4 MACCABEES", 80},
+ {"4MACCABEES", 80},
+ {"ACTS", 45}, // Acts
+ {"ADDESTHER", 87},
+ {"ADDITIONS TO ESTHER", 87},
+ {"AMOS", 30}, // Amos
+ {"APOCALYPSE OF ST. JOHN", 67}, // Apocalypse of St. John (Rev.)
+ {"APOCRYPHA", 86},
+ {"BARUCH", 73},
+ {"BEL AND THE DRAGON",90},
+ {"BEN SIRACH", 72},
+ {"C", 52}, // Colossians
+ {"CANTICLE OF CANTICLES", 22}, // Canticle of Canticles (Song of S.)
+ {"COLOSSIANS", 52}, // Colossians
+ {"D", 5}, // Deuteronomy
+ {"DANIEL", 27}, // Daniel
+ {"DEUTERO", 5}, // Deuteronomy
+ {"DEUTEROCANON", 68}, // Deuteronomy
+ {"DEUTERONOMY", 5}, // Deuteronomy
+ {"E", 50}, // Ephesians
+ {"ECCLESIASTES", 21}, // Ecclesiastes
+ {"ECCLESIASTICUS", 73},
+ {"EPHESIANS", 50}, // Ephesians
+ {"EPISTLE OF JEREMIAH", 74},
+ {"EPISTLE TO THE LAODICEANS", 83},
+ {"EPJER", 74},
+ {"EPLAO", 83},
+ {"ESTER", 17}, // Esther
+ {"ESTHER", 17}, // Esther
+ {"EXODUS", 2}, // Exodus
+ {"EZEKIEL", 26}, // Ezekiel
+ {"EZK", 26}, // Ezekiel
+ {"EZRA", 15}, // Ezra
+ {"G", 1}, // Genesis
+ {"GALATIANS", 49}, // Galatians
+ {"GENESIS", 1}, // Genesis
+ {"H", 59}, // Hebrews
+ {"HABAKKUK", 35}, // Habakkuk
+ {"HAGGAI", 37}, // Haggai
+ {"HEBREWS", 59}, // Hebrews
+ {"HOSEA", 28}, // Hosea
+ {"I C", 47}, // 1 Corinthians
+ {"I CHRONICLES", 13}, // 1 Chronicles
+ {"I CORINTHIANS", 47}, // 1 Corinthians
+ {"I ENOCH", 84},
+ {"I ESDRAS", 76},
+ {"I JN", 63}, // 1 John
+ {"I JOHN", 63}, // 1 John
+ {"I KGS", 11}, // 1 Kings
+ {"I KINGS", 11}, // 1 Kings
+ {"I MACCABEES", 78},
+ {"I PETER", 61}, // 1 Peter
+ {"I PTR", 61}, // 1 Peter
+ {"I SAMUEL", 9}, // 1 Samuel
+ {"I THESSALONIANS", 53}, // 1 Thessalonians
+ {"I TIMOTHY", 55}, // 1 Timothy
+ {"IC", 47}, // 1 Corinthians
+ {"ICHRONICLES", 13}, // 1 Chronicles
+ {"ICORINTHIANS", 47}, // 1 Corinthians
+ {"IENOCH", 84},
+ {"IESDRAS", 76},
+ {"II C", 48}, // 2 Corinthians
+ {"II CHRONICLES", 14}, // 2 Chronicles
+ {"II CORINTHIANS", 48}, // 2 Corinthians
+ {"II ESDRAS", 77},
+ {"II JN", 64}, // 2 John
+ {"II JOHN", 64}, // 2 John
+ {"II KGS", 12}, // 2 Kings
+ {"II KINGS", 12}, // 2 Kings
+ {"II MACCABEES", 79},
+ {"II PETER", 62}, // 2 Peter
+ {"II PTR", 62}, // 2 Peter
+ {"II SAMUEL", 10}, // 2 Samuel
+ {"II THESSALONIANS", 54}, // 2 Thessalonians
+ {"II TIMOTHY", 56}, // 2 Timothy
+ {"IIC", 48}, // 2 Corinthians
+ {"IICHRONICLES", 14}, // 2 Chronicles
+ {"IICORINTHIANS", 48}, // 2 Corinthians
+ {"IIESDRAS", 77},
+ {"III JN", 65}, // 3 John
+ {"III JOHN", 65}, // 3 John
+ {"IIIJN", 65}, // 3 John
+ {"IIIJOHN", 65}, // 3 John
+ {"III MACCABEES", 80},
+ {"IIII MACCABEES", 81},
+ {"IIIIMACCABEES", 81},
+ {"IIIMACCABEES", 80},
+ {"IIJN", 64}, // 2 John
+ {"IIJOHN", 64}, // 2 John
+ {"IIKGS", 12}, // 2 Kings
+ {"IIKINGS", 12}, // 2 Kings
+ {"IIMACCABEES", 79},
+ {"IIPETER", 62}, // 2 Peter
+ {"IIPTR", 62}, // 2 Peter
+ {"IISAMUEL", 10}, // 2 Samuel
+ {"IITHESSALONIANS", 54}, // 2 Thessalonians
+ {"IITIMOTHY", 56}, // 2 Timothy
+ {"IJN", 63}, // 1 John
+ {"IJOHN", 63}, // 1 John
+ {"IKGS", 11}, // 1 Kings
+ {"IKINGS", 11}, // 1 Kings
+ {"IMACCABEES", 78},
+ {"IPETER", 61}, // 1 Peter
+ {"IPTR", 61}, // 1 Peter
+ {"ISA", 23}, // Isaiah
+ {"ISAIAH", 23}, // Isaiah
+ {"ISAMUEL", 9}, // 1 Samuel
+ {"ITHESSALONIANS", 53}, // 1 Thessalonians
+ {"ITIMOTHY", 55}, // 1 Timothy
+ {"IV MACCABEES", 81},
+ {"IVMACCABEES", 81},
+ {"J", 44}, // John
+ {"JAMES", 60}, // James
+ {"JAS", 60}, // James
+ {"JDGS", 7}, // Judges
+ {"JDT", 70},
+ {"JEREMIAH", 24}, // Jeremiah
+ {"JESUS BEN SIRACH", 73},
+ {"JHN", 44}, // John
+ {"JN", 44}, // John
+ {"JO", 44}, // John
+ {"JOB", 18}, // Job
+ {"JOEL", 29}, // Joel
+ {"JOHN", 44}, // John
+ {"JOL", 29}, // Joel
+ {"JONAH", 32}, // Jonah
+ {"JOSHUA", 6}, // Joshua
+ {"JUBILEES", 85},
+ {"JUDE", 66}, // Jude
+ {"JUDGES", 7}, // Judges
+ {"JUDITH", 70},
+ {"L", 43}, // Luke
+ {"LAMENTATIONS", 25}, // Lamentations
+ {"LAODICEANS", 83},
+ {"LETTER OF JEREMIAH", 74},
+ {"LEVITICUS", 3}, // Leviticus
+ {"LK", 43}, // Luke
+ {"LUKE", 43}, // Luke
+ {"MA", 41}, // Matthew
+ {"MALACHI", 39}, // Malachi
+ {"MANASSEH", 91},
+ {"MANASSES", 91},
+ {"MARK", 42}, // Mark
+ {"MATTHEW", 41}, // Matthew
+ {"MICAH", 33}, // Micah
+ {"MK", 42}, // Mark
+ {"MRK", 42}, // Mark
+ {"MT", 41}, // Matthew
+ {"N", 4}, // Numbers
+ {"NAHUM", 34}, // Nahum
+ {"NAM", 34}, // Nahum
+ {"NEHEMIAH", 16}, // Nehemiah
+ {"NEW TESTAMENT", 40}, // New Testament
+ {"NUMBERS", 4}, // Numbers
+ {"OBADIAH", 31}, // Obadiah
+ {"ODES OF SOLOMON", 81},
+ {"OLD TESTAMENT", 0}, // Old Testament
+ {"P", 19}, // Psalms
+ {"PHIL", 51}, // Philippians
+ {"PHILEMON", 58}, // Philemon
+ {"PHILIPPIANS", 51}, // Philippians
+ {"PHLM", 58}, // Philemon
+ {"PHM", 58}, // Philemon
+ {"PHP", 51}, // Philippians
+ {"PR", 20}, // Proverbs
+ {"PRAYER OF AZARIAH", 88},
+ {"PRAYER OF MANASSEH", 91},
+ {"PRAYER OF MANASSES", 91},
+ {"PRAZAR", 88},
+ {"PRMAN", 91},
+ {"PROVERBS", 20}, // Proverbs
+ {"PS151", 92},
+ {"PSA", 19}, // Psalms
+ {"PSALM ", 19},
+ {"PSALM 151", 92},
+ {"PSALM151", 92},
+ {"PSALMS", 19}, // Psalms
+ {"PSALMS OF SOLOMON", 82},
+ {"PSM", 19}, // Psalms
+ {"PSS", 19}, // Psalms
+ {"PSSOL", 82},
+ {"PSSSOL", 82},
+ {"QOHELETH", 21}, // Qohelet (Ecclesiastes)
+ {"REVELATION OF JOHN", 67}, // Revelation
+ {"ROMANS", 46}, // Romans
+ {"RUTH", 8}, // Ruth
+ {"SIRACH", 72},
+ {"SNG", 22}, // Song of Solomon
+ {"SOLOMON", 22}, // Song of Solomon
+ {"SONG OF SOLOMON", 22}, // Song of Solomon
+ {"SONG OF SONGS", 22}, // Song of Solomon
+ {"SOS", 22}, // Song of Solomon
+ {"SUSANNA", 89},
+ {"TITUS", 57}, // Titus
+ {"TOBIT", 69},
+ {"WISDOM", 71},//250
+ {"WISDOM OF JESUS BEN SIRACH", 72},
+ {"ZECHARIAH", 38}, // Zechariah
+ {"ZEPHANIAH", 36}, // Zephaniah
+ {"", -1}
+};
+*/
+
+/* The default versification scheme is KJV */
+/*
+ 0, 1, 52, 93, 121, 158,
+ 193, 218, 240, 245, 277, 302, 325,
+ 351, 381, 418, 429, 443, 454, 497,
+ 648, 680, 693, 702, 769, 822, 828,
+ 877, 890, 905, 909, 919, 921, 926,
+ 934, 938, 942, 946, 949, 964
+*/
+
+
+
+
diff --git a/include/osisfootnotes.h b/include/osisfootnotes.h
new file mode 100644
index 0000000..2478ce0
--- /dev/null
+++ b/include/osisfootnotes.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisfootnotes.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISFOOTNOTES_H
+#define OSISFOOTNOTES_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISFootnotes : public SWOptionFilter {
+public:
+ OSISFootnotes();
+ virtual ~OSISFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisheadings.h b/include/osisheadings.h
new file mode 100644
index 0000000..fd1460a
--- /dev/null
+++ b/include/osisheadings.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisheadings.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISHEADINGS_H
+#define OSISHEADINGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISHeadings : public SWOptionFilter {
+public:
+ OSISHeadings();
+ virtual ~OSISHeadings();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osishtmlhref.h b/include/osishtmlhref.h
new file mode 100644
index 0000000..af8fab2
--- /dev/null
+++ b/include/osishtmlhref.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ *
+ * $Id: osishtmlhref.h 2091 2007-09-28 01:49:45Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISHTMLHREF_H
+#define OSISHTMLHREF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to HTML text with hrefs
+ */
+class SWDLLEXPORT OSISHTMLHREF : public SWBasicFilter {
+private:
+ bool morphFirst;
+protected:
+ // used by derived classes so we have it in the header
+ class QuoteStack;
+ class MyUserData : public BasicFilterUserData {
+ public:
+ bool osisQToTick;
+ bool inBold;
+ bool inXRefNote;
+ bool BiblicalText;
+ int suspendLevel;
+ SWBuf wordsOfChristStart;
+ SWBuf wordsOfChristEnd;
+ QuoteStack *quoteStack;
+ SWBuf lastTransChange;
+ SWBuf w;
+ SWBuf fn;
+ SWBuf version;
+ MyUserData(const SWModule *module, const SWKey *key);
+ ~MyUserData();
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISHTMLHREF();
+ void setMorphFirst(bool val = true) { morphFirst = val; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osislemma.h b/include/osislemma.h
new file mode 100644
index 0000000..c61dad4
--- /dev/null
+++ b/include/osislemma.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osislemma.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISLEMMA_H
+#define OSISLEMMA_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISLemma : public SWOptionFilter {
+public:
+ OSISLemma();
+ virtual ~OSISLemma();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osismorph.h b/include/osismorph.h
new file mode 100644
index 0000000..85cd98f
--- /dev/null
+++ b/include/osismorph.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: osismorph.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISMORPH_H
+#define OSISMORPH_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides morph tags in a OSIS text
+ */
+class SWDLLEXPORT OSISMorph : public SWOptionFilter {
+public:
+ OSISMorph();
+ virtual ~OSISMorph();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osismorphsegmentation.h b/include/osismorphsegmentation.h
new file mode 100644
index 0000000..45bbec7
--- /dev/null
+++ b/include/osismorphsegmentation.h
@@ -0,0 +1,42 @@
+/******************************************************************************
+ *
+ * $Id: osismorphsegmentation.h,v 1.3 2005/09/02 22:15:30 joachim Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISMORPHSEGMENTATION_H
+#define OSISMORPHSEGMENTATION_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/* This filters toggles splitting of morphemes
+ * (for morpheme segmented Hebrew in the WLC)
+ */
+
+class OSISMorphSegmentation : public SWOptionFilter {
+
+public:
+ OSISMorphSegmentation();
+ virtual ~OSISMorphSegmentation();
+
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisosis.h b/include/osisosis.h
new file mode 100644
index 0000000..8f0304d
--- /dev/null
+++ b/include/osisosis.h
@@ -0,0 +1,54 @@
+/******************************************************************************
+ *
+ * $Id: osisosis.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISOSIS_H
+#define OSISOSIS_H
+
+#include <swbasicfilter.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts internal OSIS text to public OSIS text
+ */
+class SWDLLEXPORT OSISOSIS : public SWBasicFilter {
+private:
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ bool osisQToTick;
+ bool inBold;
+ SWBuf lastTransChange;
+ SWBuf w;
+ SWBuf fn;
+ XMLTag startTag;
+ MyUserData(const SWModule *module, const SWKey *key);
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual char processText(SWBuf &text, const SWKey *key, const SWModule *module);
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISOSIS();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisplain.h b/include/osisplain.h
new file mode 100644
index 0000000..19aee17
--- /dev/null
+++ b/include/osisplain.h
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
+ * $Id: osisplain.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISPLAIN_H
+#define OSISPLAIN_H
+
+#include <swbasicfilter.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to plain text
+ */
+class SWDLLEXPORT OSISPlain : public SWBasicFilter {
+public:
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ SWBuf w;
+ XMLTag tag;
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISPlain();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisredletterwords.h b/include/osisredletterwords.h
new file mode 100644
index 0000000..af63291
--- /dev/null
+++ b/include/osisredletterwords.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisredletterwords.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISREDLETTERWORDS_H
+#define OSISREDLETTERWORDS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISRedLetterWords : public SWOptionFilter {
+public:
+ OSISRedLetterWords();
+ virtual ~OSISRedLetterWords();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisrtf.h b/include/osisrtf.h
new file mode 100644
index 0000000..e5ac9a7
--- /dev/null
+++ b/include/osisrtf.h
@@ -0,0 +1,42 @@
+/******************************************************************************
+ *
+ * $Id: osisrtf.h 1973 2006-09-20 04:09:16Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISRTF_H
+#define OSISRTF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to RTF text
+ */
+class SWDLLEXPORT OSISRTF : public SWBasicFilter {
+private:
+
+protected:
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key);
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+public:
+ OSISRTF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisscripref.h b/include/osisscripref.h
new file mode 100644
index 0000000..d3e7362
--- /dev/null
+++ b/include/osisscripref.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisscripref.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISSCRIPREF_H
+#define OSISSCRIPREF_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISScripref : public SWOptionFilter {
+public:
+ OSISScripref();
+ virtual ~OSISScripref();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisstrongs.h b/include/osisstrongs.h
new file mode 100644
index 0000000..c40d8c2
--- /dev/null
+++ b/include/osisstrongs.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: osisstrongs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISSTRONGS_H
+#define OSISSTRONGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This Filter shows/hides strong's numbers in a OSIS text
+ */
+class SWDLLEXPORT OSISStrongs : public SWOptionFilter {
+public:
+ OSISStrongs();
+ virtual ~OSISStrongs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisvariants.h b/include/osisvariants.h
new file mode 100644
index 0000000..76f4806
--- /dev/null
+++ b/include/osisvariants.h
@@ -0,0 +1,54 @@
+/******************************************************************************
+ *
+ * $Id: osisvariants.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISVARIANTS_H
+#define OSISVARIANTS_H
+
+#include <swoptfilter.h>
+#include <swmodule.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides textual variants
+ */
+class SWDLLEXPORT OSISVariants : public SWOptionFilter {
+ char option;
+
+ static const char primary[];
+ static const char secondary[];
+ static const char all[];
+
+ static const char optName[];
+ static const char optTip[];
+ StringList options;
+
+public:
+ OSISVariants();
+ virtual ~OSISVariants();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ virtual const char *getOptionName() { return optName; }
+ virtual const char *getOptionTip() { return optTip; }
+ virtual void setOptionValue(const char *ival);
+ virtual const char *getOptionValue();
+ virtual StringList getOptionValues() { return options; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osiswebif.h b/include/osiswebif.h
new file mode 100644
index 0000000..2de6b89
--- /dev/null
+++ b/include/osiswebif.h
@@ -0,0 +1,44 @@
+/******************************************************************************
+ *
+ * $Id: osiswebif.h 1946 2006-07-15 20:41:24Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISWEBIF_H
+#define OSISWEBIF_H
+
+#include <osishtmlhref.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to HTML text with hrefs
+ */
+class SWDLLEXPORT OSISWEBIF : public OSISHTMLHREF {
+ const SWBuf baseURL;
+ const SWBuf passageStudyURL;
+ bool javascript;
+
+protected:
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key);
+public:
+ OSISWEBIF();
+ void setJavascript(bool mode) { javascript = mode; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osiswordjs.h b/include/osiswordjs.h
new file mode 100644
index 0000000..d278d11
--- /dev/null
+++ b/include/osiswordjs.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *
+ * $Id: osisstrongs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISWORDSJS_H
+#define OSISWORDSJS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+class SWMgr;
+ /** This Filter shows/hides strong's numbers in a OSIS text
+ */
+class SWDLLEXPORT OSISWordJS : public SWOptionFilter {
+ SWModule *defaultGreekLex;
+ SWModule *defaultHebLex;
+ SWModule *defaultGreekParse;
+ SWModule *defaultHebParse;
+ SWMgr *mgr;
+
+public:
+ OSISWordJS();
+ virtual ~OSISWordJS();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ void setDefaultModules(SWModule *defaultGreekLex = 0, SWModule *defaultHebLex = 0, SWModule *defaultGreekParse = 0, SWModule *defaultHebParse = 0) {
+ this->defaultGreekLex = defaultGreekLex;
+ this->defaultHebLex = defaultHebLex;
+ this->defaultGreekParse = defaultGreekParse;
+ this->defaultHebParse = defaultHebParse;
+ }
+ void setMgr(SWMgr *mgr) { this->mgr = mgr; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/papyriplain.h b/include/papyriplain.h
new file mode 100644
index 0000000..5498222
--- /dev/null
+++ b/include/papyriplain.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: papyriplain.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef PapyriPLAIN_H
+#define PapyriPLAIN_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This filter converts Papyri text to plain text
+ */
+class SWDLLEXPORT PapyriPlain : public SWOptionFilter {
+public:
+ PapyriPlain();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/plainfootnotes.h b/include/plainfootnotes.h
new file mode 100644
index 0000000..74a8c4a
--- /dev/null
+++ b/include/plainfootnotes.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ *
+ * $Id: plainfootnotes.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef PLAINFOOTNOTES_H
+#define PLAINFOOTNOTES_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+class SWKey;
+
+/**Shows or hides footnotes in plain text.
+ *@author The team of BibleTime
+ */
+class SWDLLEXPORT PLAINFootnotes : public SWOptionFilter {
+public:
+ PLAINFootnotes();
+ virtual ~PLAINFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/plainhtml.h b/include/plainhtml.h
new file mode 100644
index 0000000..e09821a
--- /dev/null
+++ b/include/plainhtml.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: plainhtml.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef PLAINHTML_H
+#define PLAINHTML_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts plain text to HTML text
+ * @author Torsten Uhlmann, begin : Tue Jun 15 15:34:26 CEST 1999
+ */
+class SWDLLEXPORT PLAINHTML : public SWFilter {
+public:
+ PLAINHTML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawcom.h b/include/rawcom.h
new file mode 100644
index 0000000..c5f7895
--- /dev/null
+++ b/include/rawcom.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * rawcom.h - code for class 'RawCom'- a module that reads raw commentary
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawcom.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWCOM_H
+#define RAWCOM_H
+
+#include <rawverse.h>
+#include <swcom.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawCom : public RawVerse, public SWCom {
+
+
+public:
+
+ RawCom(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char* ilang = 0);
+ virtual ~RawCom();
+
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps);
+ virtual void decrement(int steps) { increment(-steps); }
+
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) { return RawVerse::createModule(path); }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/rawcom4.h b/include/rawcom4.h
new file mode 100644
index 0000000..8cd0574
--- /dev/null
+++ b/include/rawcom4.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * rawcom.h - code for class 'RawCom4'- a module that reads raw commentary
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawcom.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWCOM4_H
+#define RAWCOM4_H
+
+#include <rawverse4.h>
+#include <swcom.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawCom4 : public RawVerse4, public SWCom {
+
+
+public:
+
+ RawCom4(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char* ilang = 0);
+ virtual ~RawCom4();
+
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps);
+ virtual void decrement(int steps) { increment(-steps); }
+
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) { return RawVerse4::createModule(path); }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/rawfiles.h b/include/rawfiles.h
new file mode 100644
index 0000000..5cb765b
--- /dev/null
+++ b/include/rawfiles.h
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * rawfiles.h - code for class 'RawFiles'- a module that produces HTML HREFs
+ * pointing to actual text desired. Uses standard
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawfiles.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWFILES_H
+#define RAWFILES_H
+
+#include <rawverse.h>
+#include <swcom.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawFiles : public RawVerse, public SWCom {
+
+ char *getNextFilename();
+
+public:
+
+
+ RawFiles(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char *ilang = 0);
+ virtual ~RawFiles();
+ virtual SWBuf &getRawEntryBuf();
+
+ // write interface ----------------------------
+ /** Is the module writable? :)
+ * @return yes or no
+ */
+ virtual bool isWritable();
+
+ /** Creates a new module
+ * @param path The first parameter is path of the new module
+ * @return error
+ */
+ static char createModule(const char *);
+
+ /** Modify the current module entry text
+ * - only if module @ref isWritable
+ * @return *this
+ */
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+
+ /** Link the current module entry to another module entry
+ * - only if module @ref isWritable
+ * @return *this
+ */
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+
+ /** Delete current module entry - only if module @ref isWritable
+ *
+ */
+ virtual void deleteEntry();
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawgenbook.h b/include/rawgenbook.h
new file mode 100644
index 0000000..a915b4e
--- /dev/null
+++ b/include/rawgenbook.h
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * rawtext.h - code for class 'RawText'- a module that reads raw text files:
+ * ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawgenbook.h 1917 2006-05-22 01:07:17Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWGENBOOK_H
+#define RAWGENBOOK_H
+
+#include <swgenbook.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class FileDesc;
+
+class SWDLLEXPORT RawGenBook : public SWGenBook {
+ char *path;
+ FileDesc *bdtfd;
+ bool verseKey;
+
+public:
+
+
+ RawGenBook(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0, const char *keyType = "TreeKey");
+ virtual ~RawGenBook();
+ virtual SWBuf &getRawEntryBuf();
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *ipath);
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey * linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ virtual SWKey *CreateKey();
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawld.h b/include/rawld.h
new file mode 100644
index 0000000..7afe9b9
--- /dev/null
+++ b/include/rawld.h
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and
+ * dictionary files: *.dat *.idx
+ *
+ * $Id: rawld.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWLD_H
+#define RAWLD_H
+
+#include <rawstr.h>
+#include <swld.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawLD : public RawStr, public SWLD {
+ void strongsPad(char *buf);
+ char getEntry(long away = 0);
+
+public:
+
+
+ RawLD(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~RawLD();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) { return RawStr::createModule (path); }
+
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawld4.h b/include/rawld4.h
new file mode 100644
index 0000000..616b992
--- /dev/null
+++ b/include/rawld4.h
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and
+ * dictionary files: *.dat *.idx
+ *
+ * $Id: rawld4.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWLD4_H
+#define RAWLD4_H
+
+#include <rawstr4.h>
+#include <swld.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawLD4 : public RawStr4, public SWLD {
+ void strongsPad(char *buf);
+ char getEntry(long away = 0);
+
+public:
+
+
+ RawLD4(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char *ilang = 0);
+
+ virtual ~RawLD4();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) { return RawStr4::createModule(path); }
+
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawstr.h b/include/rawstr.h
new file mode 100644
index 0000000..4367851
--- /dev/null
+++ b/include/rawstr.h
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * rawstr.h - code for class 'RawStr'- a module that reads raw text
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ * and provides lookup and parsing functions based on
+ * class StrKey
+ *
+ * $Id: rawstr.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWSTR_H
+#define RAWSTR_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWBuf;
+class FileDesc;
+
+class SWDLLEXPORT RawStr {
+ static int instance; // number of instantiated RawStr objects or derivitives
+ char *path;
+ long lastoff;
+
+protected:
+ FileDesc *idxfd;
+ FileDesc *datfd;
+ void doSetText(const char *key, const char *buf, long len = -1);
+ void doLinkEntry(const char *destkey, const char *srckey);
+public:
+ static void prepText(SWBuf &buf);
+ static char nl;
+ RawStr(const char *ipath, int fileMode = -1);
+ virtual ~RawStr();
+ void getIDXBuf(long ioffset, char **buf);
+ void getIDXBufDat(long ioffset, char **buf);
+ signed char findOffset(const char *key, long *start, unsigned short *size, long away = 0, long *idxoff = 0);
+ void readText(long start, unsigned short *size, char **idxbuf, SWBuf &buf);
+ static signed char createModule(const char *path);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawstr4.h b/include/rawstr4.h
new file mode 100644
index 0000000..32734ef
--- /dev/null
+++ b/include/rawstr4.h
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * rawstr.h - code for class 'RawStr'- a module that reads raw text
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ * and provides lookup and parsing functions based on
+ * class StrKey
+ *
+ * $Id: rawstr4.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWSTR4_H
+#define RAWSTR4_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class FileDesc;
+class SWBuf;
+
+class SWDLLEXPORT RawStr4 {
+ static int instance; // number of instantiated RawStr4 objects or derivitives
+ char *path;
+ long lastoff;
+
+protected:
+ FileDesc *idxfd;
+ FileDesc *datfd;
+ void prepText(SWBuf &buf);
+ void doSetText(const char *key, const char *buf, long len = -1);
+ void doLinkEntry(const char *destkey, const char *srckey);
+public:
+ char nl;
+ RawStr4(const char *ipath, int fileMode = -1);
+ virtual ~RawStr4();
+ void getIDXBuf(long ioffset, char **buf);
+ void getIDXBufDat(long ioffset, char **buf);
+ signed char findOffset(const char *key, long *start, unsigned long *size,
+ long away = 0, long *idxoff = 0);
+ void readText(long start, unsigned long *size, char **idxbuf, SWBuf &buf);
+ static signed char createModule(const char *path);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawtext.h b/include/rawtext.h
new file mode 100644
index 0000000..32986fe
--- /dev/null
+++ b/include/rawtext.h
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * rawtext.h - code for class 'RawText'- a module that reads raw text files:
+ * ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawtext.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWTEXT_H
+#define RAWTEXT_H
+
+#include <rawverse.h>
+#include <swtext.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class RawStr;
+
+class SWDLLEXPORT RawText : public SWText, public RawVerse {
+
+ RawStr *fastSearch[2];
+
+public:
+
+ RawText(const char *ipath, const char *iname = 0, const char *idesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char* ilang = 0);
+ virtual ~RawText();
+ virtual SWBuf &getRawEntryBuf();
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+ virtual void deleteSearchFramework();
+ virtual bool hasSearchFramework() { return true; }
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) { return RawVerse::createModule(path); }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawtext4.h b/include/rawtext4.h
new file mode 100644
index 0000000..39552ac
--- /dev/null
+++ b/include/rawtext4.h
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * rawtext.h - code for class 'RawText4'- a module that reads raw text files:
+ * ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawtext.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWTEXT4_H
+#define RAWTEXT4_H
+
+#include <rawverse4.h>
+#include <rawstr4.h>
+#include <swtext.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class RawStr;
+
+class SWDLLEXPORT RawText4 : public SWText, public RawVerse4 {
+
+ RawStr4 *fastSearch[2];
+
+public:
+
+ RawText4(const char *ipath, const char *iname = 0, const char *idesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char* ilang = 0);
+ virtual ~RawText4();
+ virtual SWBuf &getRawEntryBuf();
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+ virtual void deleteSearchFramework();
+ virtual bool hasSearchFramework() { return true; }
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) { return RawVerse4::createModule(path); }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawverse.h b/include/rawverse.h
new file mode 100644
index 0000000..00abff0
--- /dev/null
+++ b/include/rawverse.h
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * rawverse.h - code for class 'RawVerse'- a module that reads raw text
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ * and provides lookup and parsing functions based on
+ * class VerseKey
+ */
+
+#ifndef RAWVERSE_H
+#define RAWVERSE_H
+
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class FileDesc;
+class SWBuf;
+
+class SWDLLEXPORT RawVerse {
+
+
+ static int instance; // number of instantiated RawVerse objects or derivitives
+protected:
+ FileDesc *idxfp[2];
+ FileDesc *textfp[2];
+
+ char *path;
+ void prepText(SWBuf &buf);
+ void doSetText(char testmt, long idxoff, const char *buf, long len = -1);
+ void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
+
+public:
+ static const char *nl;
+ RawVerse(const char *ipath, int fileMode = -1);
+ virtual ~RawVerse();
+ void findOffset(char testmt, long idxoff, long *start, unsigned short *end);
+ void readText(char testmt, long start, unsigned short size, SWBuf &buf);
+ static char createModule(const char *path);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rawverse4.h b/include/rawverse4.h
new file mode 100644
index 0000000..0b3a767
--- /dev/null
+++ b/include/rawverse4.h
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * rawverse.h - code for class 'RawVerse'- a module that reads raw text
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ * and provides lookup and parsing functions based on
+ * class VerseKey
+ */
+
+#ifndef RAWVERSE4_H
+#define RAWVERSE4_H
+
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class FileDesc;
+class SWBuf;
+
+class SWDLLEXPORT RawVerse4 {
+
+
+ static int instance; // number of instantiated RawVerse objects or derivitives
+protected:
+ FileDesc *idxfp[2];
+ FileDesc *textfp[2];
+
+ char *path;
+ void prepText(SWBuf &buf);
+ void doSetText(char testmt, long idxoff, const char *buf, long len = -1);
+ void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
+
+public:
+ static const char *nl;
+ RawVerse4(const char *ipath, int fileMode = -1);
+ virtual ~RawVerse4();
+ void findOffset(char testmt, long idxoff, long *start, unsigned long *end);
+ void readText(char testmt, long start, unsigned long size, SWBuf &buf);
+ static char createModule(const char *path);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/regex.h b/include/regex.h
new file mode 100644
index 0000000..a81e07d
--- /dev/null
+++ b/include/regex.h
@@ -0,0 +1,545 @@
+/* Definitions for data structures and routines for the regular
+ expression library, version 0.12.
+ Copyright (C) 1985,89,90,91,92,93,95,96,97 Free Software Foundation, Inc.
+
+ the C library, however. The master source lives in /gd/gnu/lib.
+
+NOTE: The canonical source of this file is maintained with the
+GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _REGEX_H
+#define _REGEX_H 1
+
+/* Allow the use in C++ code. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* POSIX says that <sys/types.h> must be included (by the caller) before
+ <regex.h>. */
+
+#if !defined (_POSIX_C_SOURCE) && !defined (_POSIX_SOURCE) && defined (VMS)
+/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
+ should be there. */
+#include <stddef.h>
+#endif
+
+/* The following two types have to be signed and unsigned integer type
+ wide enough to hold a value of a pointer. For most ANSI compilers
+ ptrdiff_t and size_t should be likely OK. Still size of these two
+ types is 2 for Microsoft C. Ugh... */
+ typedef long int s_reg_t;
+ typedef unsigned long int active_reg_t;
+
+/* The following bits are used to determine the regexp syntax we
+ recognize. The set/not-set meanings are chosen so that Emacs syntax
+ remains the value 0. The bits are given in alphabetical order, and
+ the definitions shifted by one from the previous bit; thus, when we
+ add or remove a bit, only one other definition need change. */
+ typedef unsigned long int reg_syntax_t;
+
+/* If this bit is not set, then \ inside a bracket expression is literal.
+ If set, then such a \ quotes the following character. */
+#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
+
+/* If this bit is not set, then + and ? are operators, and \+ and \? are
+ literals.
+ If set, then \+ and \? are operators and + and ? are literals. */
+#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
+
+/* If this bit is set, then character classes are supported. They are:
+ [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
+ [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
+ If not set, then character classes are not supported. */
+#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
+
+/* If this bit is set, then ^ and $ are always anchors (outside bracket
+ expressions, of course).
+ If this bit is not set, then it depends:
+ ^ is an anchor if it is at the beginning of a regular
+ expression or after an open-group or an alternation operator;
+ $ is an anchor if it is at the end of a regular expression, or
+ before a close-group or an alternation operator.
+
+ This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
+ POSIX draft 11.2 says that * etc. in leading positions is undefined.
+ We already implemented a previous draft which made those constructs
+ invalid, though, so we haven't changed the code back. */
+#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
+
+/* If this bit is set, then special characters are always special
+ regardless of where they are in the pattern.
+ If this bit is not set, then special characters are special only in
+ some contexts; otherwise they are ordinary. Specifically,
+ * + ? and intervals are only special when not after the beginning,
+ open-group, or alternation operator. */
+#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
+
+/* If this bit is set, then *, +, ?, and { cannot be first in an re or
+ immediately after an alternation or begin-group operator. */
+#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
+
+/* If this bit is set, then . matches newline.
+ If not set, then it doesn't. */
+#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
+
+/* If this bit is set, then . doesn't match NUL.
+ If not set, then it does. */
+#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
+
+/* If this bit is set, nonmatching lists [^...] do not match newline.
+ If not set, they do. */
+#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
+
+/* If this bit is set, either \{...\} or {...} defines an
+ interval, depending on RE_NO_BK_BRACES.
+ If not set, \{, \}, {, and } are literals. */
+#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
+
+/* If this bit is set, +, ? and | aren't recognized as operators.
+ If not set, they are. */
+#define RE_LIMITED_OPS (RE_INTERVALS << 1)
+
+/* If this bit is set, newline is an alternation operator.
+ If not set, newline is literal. */
+#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
+
+/* If this bit is set, then `{...}' defines an interval, and \{ and \}
+ are literals.
+ If not set, then `\{...\}' defines an interval. */
+#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
+
+/* If this bit is set, (...) defines a group, and \( and \) are literals.
+ If not set, \(...\) defines a group, and ( and ) are literals. */
+#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
+
+/* If this bit is set, then \<digit> matches <digit>.
+ If not set, then \<digit> is a back-reference. */
+#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
+
+/* If this bit is set, then | is an alternation operator, and \| is literal.
+ If not set, then \| is an alternation operator, and | is literal. */
+#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
+
+/* If this bit is set, then an ending range point collating higher
+ than the starting range point, as in [z-a], is invalid.
+ If not set, then when ending range point collates higher than the
+ starting range point, the range is ignored. */
+#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
+
+/* If this bit is set, then an unmatched ) is ordinary.
+ If not set, then an unmatched ) is invalid. */
+#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
+
+/* If this bit is set, succeed as soon as we match the whole pattern,
+ without further backtracking. */
+#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
+
+/* If this bit is set, do not process the GNU regex operators.
+ If not set, then the GNU regex operators are recognized. */
+#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
+
+/* If this bit is set, turn on internal regex debugging.
+ If not set, and debugging was on, turn it off.
+ This only works if regex.c is compiled -DDEBUG.
+ We define this bit always, so that all that's needed to turn on
+ debugging is to recompile regex.c; the calling code can always have
+ this bit set, and it won't affect anything in the normal case. */
+#define RE_DEBUG (RE_NO_GNU_OPS << 1)
+
+/* This global variable defines the particular regexp syntax to use (for
+ some interfaces). When a regexp is compiled, the syntax used is
+ stored in the pattern buffer, so changing this does not affect
+ already-compiled regexps. */
+ extern reg_syntax_t re_syntax_options;
+
+/* Define combinations of the above bits for the standard possibilities.
+ (The [[[ comments delimit what gets put into the Texinfo file, so
+ don't delete them!) */
+/* [[[begin syntaxes]]] */
+#define RE_SYNTAX_EMACS 0
+
+#define RE_SYNTAX_AWK \
+ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \
+ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
+ | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
+
+#define RE_SYNTAX_GNU_AWK \
+ ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
+ & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
+
+#define RE_SYNTAX_POSIX_AWK \
+ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
+ | RE_INTERVALS | RE_NO_GNU_OPS)
+
+#define RE_SYNTAX_GREP \
+ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
+ | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
+ | RE_NEWLINE_ALT)
+
+#define RE_SYNTAX_EGREP \
+ (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
+ | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
+ | RE_NO_BK_VBAR)
+
+#define RE_SYNTAX_POSIX_EGREP \
+ (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
+
+/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
+#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
+
+#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
+
+/* Syntax bits common to both basic and extended POSIX regex syntax. */
+#define _RE_SYNTAX_POSIX_COMMON \
+ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
+ | RE_INTERVALS | RE_NO_EMPTY_RANGES)
+
+#define RE_SYNTAX_POSIX_BASIC \
+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
+
+/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
+ RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
+ isn't minimal, since other operators, such as \`, aren't disabled. */
+#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
+ (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
+
+#define RE_SYNTAX_POSIX_EXTENDED \
+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
+ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
+ | RE_UNMATCHED_RIGHT_PAREN_ORD)
+
+/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
+ replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
+#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \
+ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
+/* [[[end syntaxes]]] */
+
+/* Maximum number of duplicates an interval can allow. Some systems
+ (erroneously) define this in other header files, but we want our
+ value, so remove any previous define. */
+#ifdef RE_DUP_MAX
+#undef RE_DUP_MAX
+#endif
+/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
+#define RE_DUP_MAX (0x7fff)
+
+
+/* POSIX `cflags' bits (i.e., information for `regcomp'). */
+
+/* If this bit is set, then use extended regular expression syntax.
+ If not set, then use basic regular expression syntax. */
+#define REG_EXTENDED 1
+
+/* If this bit is set, then ignore case when matching.
+ If not set, then case is significant. */
+#define REG_ICASE (REG_EXTENDED << 1)
+
+/* If this bit is set, then anchors do not match at newline
+ characters in the string.
+ If not set, then anchors do match at newlines. */
+#define REG_NEWLINE (REG_ICASE << 1)
+
+/* If this bit is set, then report only success or fail in regexec.
+ If not set, then returns differ between not matching and errors. */
+#define REG_NOSUB (REG_NEWLINE << 1)
+
+
+/* POSIX `eflags' bits (i.e., information for regexec). */
+
+/* If this bit is set, then the beginning-of-line operator doesn't match
+ the beginning of the string (presumably because it's not the
+ beginning of a line).
+ If not set, then the beginning-of-line operator does match the
+ beginning of the string. */
+#define REG_NOTBOL 1
+
+/* Like REG_NOTBOL, except for the end-of-line. */
+#define REG_NOTEOL (1 << 1)
+
+
+/* If any error codes are removed, changed, or added, update the
+ `re_error_msg' table in regex.c. */
+ typedef enum
+ {
+ REG_NOERROR = 0, /* Success. */
+ REG_NOMATCH, /* Didn't find a match (for regexec). */
+
+ /* POSIX regcomp return error codes. (In the order listed in the
+ standard.) */
+ REG_BADPAT, /* Invalid pattern. */
+ REG_ECOLLATE, /* Not implemented. */
+ REG_ECTYPE, /* Invalid character class name. */
+ REG_EESCAPE, /* Trailing backslash. */
+ REG_ESUBREG, /* Invalid back reference. */
+ REG_EBRACK, /* Unmatched left bracket. */
+ REG_EPAREN, /* Parenthesis imbalance. */
+ REG_EBRACE, /* Unmatched \{. */
+ REG_BADBR, /* Invalid contents of \{\}. */
+ REG_ERANGE, /* Invalid range end. */
+ REG_ESPACE, /* Ran out of memory. */
+ REG_BADRPT, /* No preceding re for repetition op. */
+
+ /* Error codes we've added. */
+ REG_EEND, /* Premature end. */
+ REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
+ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
+ }
+ reg_errcode_t;
+
+/* This data structure represents a compiled pattern. Before calling
+ the pattern compiler, the fields `buffer', `allocated', `fastmap',
+ `translate', and `no_sub' can be set. After the pattern has been
+ compiled, the `re_nsub' field is available. All other fields are
+ private to the regex routines. */
+
+#ifndef RE_TRANSLATE_TYPE
+#define RE_TRANSLATE_TYPE char *
+#endif
+
+ struct re_pattern_buffer
+ {
+/* [[[begin pattern_buffer]]] */
+ /* Space that holds the compiled pattern. It is declared as
+ `unsigned char *' because its elements are
+ sometimes used as array indexes. */
+ unsigned char *buffer;
+
+ /* Number of bytes to which `buffer' points. */
+ unsigned long int allocated;
+
+ /* Number of bytes actually used in `buffer'. */
+ unsigned long int used;
+
+ /* Syntax setting with which the pattern was compiled. */
+ reg_syntax_t syntax;
+
+ /* Pointer to a fastmap, if any, otherwise zero. re_search uses
+ the fastmap, if there is one, to skip over impossible
+ starting points for matches. */
+ char *fastmap;
+
+ /* Either a translate table to apply to all characters before
+ comparing them, or zero for no translation. The translation
+ is applied to a pattern when it is compiled and to a string
+ when it is matched. */
+ RE_TRANSLATE_TYPE translate;
+
+ /* Number of subexpressions found by the compiler. */
+ size_t re_nsub;
+
+ /* Zero if this pattern cannot match the empty string, one else.
+ Well, in truth it's used only in `re_search_2', to see
+ whether or not we should use the fastmap, so we don't set
+ this absolutely perfectly; see `re_compile_fastmap' (the
+ `duplicate' case). */
+ unsigned can_be_null:1;
+
+ /* If REGS_UNALLOCATED, allocate space in the `regs' structure
+ for `max (RE_NREGS, re_nsub + 1)' groups.
+ If REGS_REALLOCATE, reallocate space if necessary.
+ If REGS_FIXED, use what's there. */
+#define REGS_UNALLOCATED 0
+#define REGS_REALLOCATE 1
+#define REGS_FIXED 2
+ unsigned regs_allocated:2;
+
+ /* Set to zero when `regex_compile' compiles a pattern; set to one
+ by `re_compile_fastmap' if it updates the fastmap. */
+ unsigned fastmap_accurate:1;
+
+ /* If set, `re_match_2' does not return information about
+ subexpressions. */
+ unsigned no_sub:1;
+
+ /* If set, a beginning-of-line anchor doesn't match at the
+ beginning of the string. */
+ unsigned not_bol:1;
+
+ /* Similarly for an end-of-line anchor. */
+ unsigned not_eol:1;
+
+ /* If true, an anchor at a newline matches. */
+ unsigned newline_anchor:1;
+
+/* [[[end pattern_buffer]]] */
+ };
+
+ typedef struct re_pattern_buffer regex_t;
+
+/* Type for byte offsets within the string. POSIX mandates this. */
+ typedef int regoff_t;
+
+
+/* This is the structure we store register match data in. See
+ regex.texinfo for a full description of what registers match. */
+ struct re_registers
+ {
+ unsigned num_regs;
+ regoff_t *start;
+ regoff_t *end;
+ };
+
+
+/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
+ `re_match_2' returns information about at least this many registers
+ the first time a `regs' structure is passed. */
+#ifndef RE_NREGS
+#define RE_NREGS 30
+#endif
+
+
+/* POSIX specification for registers. Aside from the different names than
+ `re_registers', POSIX uses an array of structures, instead of a
+ structure of arrays. */
+ typedef struct
+ {
+ regoff_t rm_so; /* Byte offset from string's start to substring's start. */
+ regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
+ }
+ regmatch_t;
+
+/* Declarations for routines. */
+
+/* To avoid duplicating every routine declaration -- once with a
+ prototype (if we are ANSI), and once without (if we aren't) -- we
+ use the following macro to declare argument types. This
+ unfortunately clutters up the declarations a bit, but I think it's
+ worth it. */
+#ifndef __STDC__
+#define __STDC__ 1
+#endif
+#if __STDC__
+
+#define _RE_ARGS(args) args
+
+#else /* not __STDC__ */
+
+#define _RE_ARGS(args) ()
+
+#endif /* not __STDC__ */
+
+/* Sets the current default syntax to SYNTAX, and return the old syntax.
+ You can also simply assign to the `re_syntax_options' variable. */
+ extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
+
+/* Compile the regular expression PATTERN, with length LENGTH
+ and syntax given by the global `re_syntax_options', into the buffer
+ BUFFER. Return NULL if successful, and an error string if not. */
+ extern const char *re_compile_pattern
+ _RE_ARGS ((const char *pattern, size_t length,
+ struct re_pattern_buffer * buffer));
+
+
+/* Compile a fastmap for the compiled pattern in BUFFER; used to
+ accelerate searches. Return 0 if successful and -2 if was an
+ internal error. */
+ extern int re_compile_fastmap
+ _RE_ARGS ((struct re_pattern_buffer * buffer));
+
+
+/* Search in the string STRING (with length LENGTH) for the pattern
+ compiled into BUFFER. Start searching at position START, for RANGE
+ characters. Return the starting position of the match, -1 for no
+ match, or -2 for an internal error. Also return register
+ information in REGS (if REGS and BUFFER->no_sub are nonzero). */
+ extern int re_search
+ _RE_ARGS ((struct re_pattern_buffer * buffer, const char *string,
+ int length, int start, int range, struct re_registers * regs));
+
+
+/* Like `re_search', but search in the concatenation of STRING1 and
+ STRING2. Also, stop searching at index START + STOP. */
+ extern int re_search_2
+ _RE_ARGS ((struct re_pattern_buffer * buffer, const char *string1,
+ int length1, const char *string2, int length2,
+ int start, int range, struct re_registers * regs, int stop));
+
+
+/* Like `re_search', but return how many characters in STRING the regexp
+ in BUFFER matched, starting at position START. */
+ extern int re_match
+ _RE_ARGS ((struct re_pattern_buffer * buffer, const char *string,
+ int length, int start, struct re_registers * regs));
+
+
+/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
+ extern int re_match_2
+ _RE_ARGS ((struct re_pattern_buffer * buffer, const char *string1,
+ int length1, const char *string2, int length2,
+ int start, struct re_registers * regs, int stop));
+
+
+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
+ ENDS. Subsequent matches using BUFFER and REGS will use this memory
+ for recording register information. STARTS and ENDS must be
+ allocated with malloc, and must each be at least `NUM_REGS * sizeof
+ (regoff_t)' bytes long.
+
+ If NUM_REGS == 0, then subsequent matches should allocate their own
+ register data.
+
+ Unless this function is called, the first search or match using
+ PATTERN_BUFFER will allocate its own register data, without
+ freeing the old data. */
+ extern void re_set_registers
+ _RE_ARGS ((struct re_pattern_buffer * buffer, struct re_registers * regs,
+ unsigned num_regs, regoff_t * starts, regoff_t * ends));
+
+#ifdef _REGEX_RE_COMP
+#ifndef _CRAY
+/* 4.2 bsd compatibility. */
+ extern char *re_comp _RE_ARGS ((const char *));
+ extern int re_exec _RE_ARGS ((const char *));
+#endif
+#endif
+
+/* POSIX compatibility. */
+ extern int regcomp
+ _RE_ARGS ((regex_t * preg, const char *pattern, int cflags));
+ extern int regexec
+ _RE_ARGS (
+ (const regex_t * preg, const char *string, size_t nmatch,
+ regmatch_t pmatch[], int eflags));
+ extern size_t regerror
+ _RE_ARGS (
+ (int errcode, const regex_t * preg, char *errbuf,
+ size_t errbuf_size));
+ extern void regfree _RE_ARGS ((regex_t * preg));
+
+
+#ifdef __cplusplus
+}
+#endif /* C++ */
+
+#endif /* regex.h */
+
+/*
+Local variables:
+make-backup-files: t
+version-control: t
+trim-versions-without-asking: nil
+End:
+*/
diff --git a/include/roman.h b/include/roman.h
new file mode 100644
index 0000000..dd1acbd
--- /dev/null
+++ b/include/roman.h
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * roman.h - roman numeral functions
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+#ifndef ROMAN_H
+#define ROMAN_H
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** Checks if a string is a roman numeral.
+*/
+char isroman(const char *);
+/* char* to_rom(int num, char *p); */
+
+/** Converts a roman numeral to a string.
+* @param s Roman numeral to convert.
+*/
+int from_rom(const char *s);
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/rtfhtml.h b/include/rtfhtml.h
new file mode 100644
index 0000000..4fba5ed
--- /dev/null
+++ b/include/rtfhtml.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *
+ * $Id: rtfhtml.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RTFHTML_H
+#define RTFHTML_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts RTF text into HTML text
+ */
+class SWDLLEXPORT RTFHTML : public SWFilter {
+public:
+ RTFHTML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/sapphire.h b/include/sapphire.h
new file mode 100644
index 0000000..a5e21ad
--- /dev/null
+++ b/include/sapphire.h
@@ -0,0 +1,59 @@
+/* sapphire.h -- Interface for the Saphire II stream cipher.
+
+ Dedicated to the Public Domain the author and inventor
+ (Michael Paul Johnson). This code comes with no warranty.
+ Use it at your own risk.
+ Ported from the Pascal implementation of the Sapphire Stream
+ Cipher 9 December 1994.
+ Added hash-specific functions 27 December 1994.
+ Made index variable initialization key-dependent,
+ made the output function more resistant to cryptanalysis,
+ and renamed to Sapphire II Stream Cipher 2 January 1995.
+
+ unsigned char is assumed to be 8 bits. If it is not, the
+ results of assignments need to be reduced to 8 bits with
+ & 0xFF or % 0x100, whichever is faster.
+*/
+
+#ifndef NULL
+#define NULL 0
+#endif /* */
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+ class sapphire
+{
+
+ // These variables comprise the state of the state machine.
+ unsigned char cards[256]; // A permutation of 0-255.
+ unsigned char rotor, // Index that rotates smoothly
+ ratchet, // Index that moves erratically
+ avalanche, // Index heavily data dependent
+ last_plain, // Last plain text byte
+ last_cipher; // Last cipher text byte
+
+ // This function is used by initialize(), which is called by the
+ // constructor.
+ unsigned char keyrand (int limit, unsigned char *user_key,
+ unsigned char keysize, unsigned char *rsum,
+unsigned *keypos); public:sapphire (unsigned char
+ *key = NULL, // Calls initialize if a real
+ unsigned char keysize = 0); // key is provided. If none
+ // is provided, call initialize
+ // before encrypt or decrypt.
+ ~sapphire (); // Destroy cipher state information.
+ void initialize (unsigned char *key, // User key is used to set
+ unsigned char keysize); // up state information.
+ void hash_init (void); // Set up default hash.
+ unsigned char encrypt (unsigned char b = 0); // Encrypt byte
+ // or get a random byte.
+ unsigned char decrypt (unsigned char b); // Decrypt byte.
+ void hash_final (unsigned char *hash, // Copy hash value to hash
+ unsigned char hashlength = 20); // Hash length (16-32)
+ void burn (void); // Destroy cipher state information.
+};
+
+
+SWORD_NAMESPACE_END
diff --git a/include/scsuutf8.h b/include/scsuutf8.h
new file mode 100644
index 0000000..000cdd6
--- /dev/null
+++ b/include/scsuutf8.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ *
+ * $Id: scsuutf8.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SCSUUTF8_H
+#define SCSUUTF8_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts SCSU compressed (encoded) text to UTF-8
+ */
+class SWDLLEXPORT SCSUUTF8 : public SWFilter {
+ unsigned long c, d;
+ unsigned char* UTF8Output(unsigned long, unsigned char* text);
+
+public:
+ SCSUUTF8();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/stringmgr.h b/include/stringmgr.h
new file mode 100644
index 0000000..fe2eb5e
--- /dev/null
+++ b/include/stringmgr.h
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * stringmgr.h - A class which provides string handling functions which can
+ * be reimplemented by frontends
+ *
+ * $Id: stringmgr.h 2098 2007-10-07 18:57:07Z scribe $
+ *
+ * Copyright 2005 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef STRINGMGR_H
+#define STRINGMGR_H
+
+#include <defs.h>
+#include <swbuf.h>
+#include <utilstr.h>
+
+SWORD_NAMESPACE_START
+
+/** StringMgr is a way to provide UTf8 handling by the Sword frontend
+ * Each platform, if it's up-to-date, should provide functions to handle unicode and utf8. This class makes it possible to implement Unicode support on the user-side and not in Sword itself.
+ */
+class SWDLLEXPORT StringMgr {
+public:
+
+ /** Sets the global StringMgr handle
+ * @param newStringMgr The new global StringMgr. This pointer will be deleted by this StringMgr
+ */
+ static void setSystemStringMgr(StringMgr *newStringMgr);
+
+ /** Returns the global StringMgr handle
+ * @return The global string handle
+ */
+ static StringMgr *getSystemStringMgr();
+
+ /** Checks whether Utf8 support is available.
+ * Override the function supportsUnicode() to tell whether your implementation has utf8 support.
+ * @return True if this implementation provides support for Utf8 handling or false if just latin1 handling is available
+ */
+ static inline bool hasUTF8Support() {
+ return getSystemStringMgr()->supportsUnicode();
+ };
+
+ /** Converts the param to an upper case Utf8 string
+ * @param text The text encoded in utf8 which should be turned into an upper case string
+ * @param max Max buffer size
+ * @return text buffer (only for convenience)
+ */
+ virtual char *upperUTF8(char *text, unsigned int max = 0) const;
+
+ /** Converts the param to an uppercase latin1 string
+ * @param text The text encoded in latin1 which should be turned into an upper case string
+ * @param max Max buffer size
+ * @return text buffer (only for convenience)
+ */
+ virtual char *upperLatin1(char *text, unsigned int max = 0) const;
+
+
+protected:
+ friend class __staticsystemStringMgr;
+
+ /** Default constructor. Protected to make instances on user side impossible, because this is a Singleton
+ */
+ StringMgr();
+
+ /** Copy constructor
+ */
+ StringMgr(const StringMgr &);
+
+ /** Destructor
+ */
+ virtual ~StringMgr();
+
+ virtual bool supportsUnicode() const;
+
+private:
+ static StringMgr *systemStringMgr;
+};
+
+inline char *toupperstr(char *t, unsigned int max = 0) {
+ return StringMgr::getSystemStringMgr()->upperUTF8(t, max);
+}
+
+inline char *toupperstr_utf8(char *t, unsigned int max = 0) {
+ return StringMgr::getSystemStringMgr()->upperUTF8(t, max);
+}
+
+/**
+ * Converts an SWBuf filled with UTF-8 to upper case
+ *
+ * @param b SWBuf to change to upper case
+ *
+ * @return b for convenience
+ */
+inline SWBuf &toupperstr(SWBuf &b) {
+ char *utf8 = 0;
+ stdstr(&utf8, b.c_str(), 2);
+ toupperstr(utf8, strlen(utf8)*2);
+ b = utf8;
+ delete [] utf8;
+ return b;
+}
+
+SWORD_NAMESPACE_END
+
+
+#endif //STRINGMGR_H
diff --git a/include/strkey.h b/include/strkey.h
new file mode 100644
index 0000000..29cb0a9
--- /dev/null
+++ b/include/strkey.h
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * strkey.h - code for class 'strkey'- a standard Biblical verse key
+ *
+ * $Id: strkey.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef STRKEY_H
+#define STRKEY_H
+
+#include <swkey.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+ /** a standard string key class (used
+ * for modules that index on single strings (eg. cities,
+ * names, words, etc.)
+ */
+class SWDLLEXPORT StrKey:public SWKey
+{
+ static SWClass classdef;
+ void init ();
+public:
+ /** initializes instance of StrKey
+ *
+ * @param ikey text key (word, city, name, etc.)
+ */
+ StrKey (const char *ikey = 0);
+ /** cleans up instance of StrKey
+ */
+ virtual ~ StrKey ();
+
+ SWKEY_OPERATORS
+
+};
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/swbasicfilter.h b/include/swbasicfilter.h
new file mode 100644
index 0000000..c3f9aee
--- /dev/null
+++ b/include/swbasicfilter.h
@@ -0,0 +1,204 @@
+/******************************************************************************
+ * swbasicfilter.h - definition of class SWBasicFilter. An SWFilter
+ * impl that provides some basic methods that
+ * many filter will need and can use as a starting
+ * point.
+ *
+ * $Id: swbasicfilter.h 1984 2006-10-08 05:06:52Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWBASICFILTER_H
+#define SWBASICFILTER_H
+
+#include <swfilter.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+
+// not a protected inner class because MSVC++ sucks and can't handle it
+class SWDLLEXPORT BasicFilterUserData {
+public:
+ BasicFilterUserData(const SWModule *module, const SWKey *key) { this->module = module; this->key = key; suspendTextPassThru = false; supressAdjacentWhitespace = false; }
+ virtual ~BasicFilterUserData() {}
+ const SWModule *module;
+ const SWKey *key;
+ SWBuf lastTextNode;
+ SWBuf lastSuspendSegment;
+ bool suspendTextPassThru;
+ bool supressAdjacentWhitespace;
+};
+
+/** A filter providing commonly used functionality.
+ * This filter has facilities for handling SGML/HTML/XML like tokens and
+ * escape strings (like SGML entities). It has the facility for just
+ * substituting the given tokens and escape strings to other strings and for
+ * "manual" custom token handling.
+ *
+ * In this class the functions with arguments looking as <code>char
+ * **buf</code> write a character sequnce at address specified by
+ * <code>*buf</code> address and change <code>*buf</code> to point past
+ * the last char of the written sequence.
+ */
+class SWDLLEXPORT SWBasicFilter : public SWFilter {
+
+class Private;
+
+ char *tokenStart;
+ char *tokenEnd;
+ char *escStart;
+ char *escEnd;
+ char escStartLen;
+ char escEndLen;
+ char tokenStartLen;
+ char tokenEndLen;
+ bool escStringCaseSensitive;
+ bool tokenCaseSensitive;
+ bool passThruUnknownToken;
+ bool passThruUnknownEsc;
+ bool passThruNumericEsc;
+ char processStages;
+
+
+ Private *p;
+public:
+
+ SWBasicFilter();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ virtual ~SWBasicFilter();
+
+protected:
+
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new BasicFilterUserData(module, key);
+ }
+
+ // STAGEs
+ static const char INITIALIZE; // flag for indicating processing before char loop
+ static const char PRECHAR; // flag for indicating processing at top in char loop
+ static const char POSTCHAR; // flag for indicating processing at bottom in char loop
+ static const char FINALIZE; // flag for indicating processing after char loop
+
+
+ /** Sets the beginning of escape sequence (by default "&").*/
+ void setEscapeStart(const char *escStart);
+
+ /** Sets the end of escape sequence (by default ";").*/
+ void setEscapeEnd(const char *escEnd);
+
+ /** Sets the beginning of token start sequence (by default "<").*/
+ void setTokenStart(const char *tokenStart);
+
+ /** Sets the end of token start sequence (by default ">").*/
+ void setTokenEnd(const char *tokenEnd);
+
+ /** Sets whether to pass thru an unknown token unchanged
+ * or just remove it.
+ * Default is false.*/
+ void setPassThruUnknownToken(bool val);
+
+ /** Sets whether to pass thru an unknown escape sequence unchanged
+ * or just remove it.
+ * Default is false.
+ */
+ void setPassThruUnknownEscapeString(bool val);
+
+ /** Sets whether to pass thru a numeric escape sequence unchanged
+ * or allow it to be handled otherwise.
+ * Default is false.*/
+ void setPassThruNumericEscapeString(bool val);
+
+ /** Are escapeStrings case sensitive or not? Call this
+ * function before addEscapeStingSubstitute()
+ */
+ void setEscapeStringCaseSensitive(bool val);
+
+ /** Registers an esc control sequence that can pass unchanged
+ */
+ void addAllowedEscapeString(const char *findString);
+
+ /** Unregisters an esc control sequence that can pass unchanged
+ */
+ void removeAllowedEscapeString(const char *findString);
+
+ /** Registers an esc control sequence
+ */
+ void addEscapeStringSubstitute(const char *findString, const char *replaceString);
+
+ /** Unregisters an esc control sequence
+ */
+ void removeEscapeStringSubstitute(const char *findString);
+
+ /** This function performs the substitution of escapeStrings */
+ bool substituteEscapeString(SWBuf &buf, const char *escString);
+
+ /** This passes allowed escapeStrings */
+ bool passAllowedEscapeString(SWBuf &buf, const char *escString);
+
+ /** This appends escString to buf as an entity */
+ void appendEscapeString(SWBuf &buf, const char *escString);
+
+ /** Are tokens case sensitive (like in GBF) or not? Call this
+ * function before addTokenSubstitute()
+ */
+ void setTokenCaseSensitive(bool val);
+
+ /** Registers a simple token substitutions. Usually called from the
+ * c-tor of a subclass
+ */
+ void addTokenSubstitute(const char *findString, const char *replaceString);
+
+ /** Unregisters a simple token substitute
+ */
+ void removeTokenSubstitute(const char *findString);
+
+ /** This function performs the substitution of tokens */
+ bool substituteToken(SWBuf &buf, const char *token);
+
+ /** This function is called for every token encountered in the input text.
+ * @param buf the output buffer
+ * @param token the token (e.g. <code>"p align='left'"</code>
+ * @param userData user storage space for data transient to 1 full buffer parse
+ * @return subclasses should return true if they handled the token, or false if they did not.
+ */
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+
+ virtual bool processStage(char /*stage*/, SWBuf &/*text*/, char *&/*from*/, BasicFilterUserData * /*userData*/) { return false; }
+ virtual void setStageProcessing(char stages) { processStages = stages; } // see STATICs up above
+
+ /** This function is called for every escape sequence encountered in the input text.
+ * @param buf the output buffer
+ * @param escString the escape sequence (e.g. <code>"amp"</code> for &amp;amp;)
+ * @param userData user storage space for data transient to 1 full buffer parse
+ * @return <code>false</code> if was not handled and should be handled in
+ * @return subclasses should return true if they handled the esc seq, or false if they did not.
+ */
+ virtual bool handleEscapeString(SWBuf &buf, const char *escString, BasicFilterUserData *userData);
+
+ /** This function is called for all numeric escape sequences. If passThrough
+ * @param buf the output buffer
+ * @param escString the escape sequence (e.g. <code>"#235"</code> for &amp;235;)
+ * @return subclasses should return true if they handled the esc seq, or false if they did not.
+ */
+ virtual bool handleNumericEscapeString(SWBuf &buf, const char *escString);
+
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swbuf.h b/include/swbuf.h
new file mode 100644
index 0000000..6ae6958
--- /dev/null
+++ b/include/swbuf.h
@@ -0,0 +1,430 @@
+/******************************************************************************
+* swbuf.h - code for SWBuf used as a transport and utility for data buffers
+*
+* $Id: swbuf.h 2116 2007-10-17 00:12:27Z scribe $
+*
+* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
+
+#ifndef SWBUF_H
+#define SWBUF_H
+
+#include <defs.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef __BORLANDC__
+#include <mem.h>
+#endif
+
+SWORD_NAMESPACE_START
+
+
+#define JUNKBUFSIZE 65534
+
+/**
+* This class is used as a transport and utility for data buffers.
+*
+* @warning This class does not perform pointer validity checks (for speed reasons).
+* Therefore, never try to pass an invalid string (const char* 0) as an argument-
+* it will crash your program. You need to perform the checks yourself!
+*/
+class SWDLLEXPORT SWBuf {
+ char *buf;
+ char *end;
+ char *endAlloc;
+ char fillByte;
+ unsigned long allocSize;
+ static char *nullStr;
+ static char junkBuf[JUNKBUFSIZE];
+
+ inline void assureMore(size_t pastEnd) {
+ if (size_t(endAlloc-end) < pastEnd) {
+ assureSize(allocSize + pastEnd);
+ }
+ }
+
+ inline void assureSize(size_t checkSize) {
+ if (checkSize > allocSize) {
+ long size = (end - buf);
+ checkSize += 128;
+ buf = (char *)((allocSize) ? realloc(buf, checkSize) : malloc(checkSize));
+ allocSize = checkSize;
+ end = (buf + size);
+ *end = 0;
+ endAlloc = buf + allocSize - 1;
+ }
+ }
+
+ inline void init(size_t initSize) {
+ fillByte = ' ';
+ allocSize = 0;
+ buf = nullStr;
+ end = buf;
+ endAlloc = buf;
+ if (initSize)
+ assureSize(initSize);
+ }
+
+
+public:
+
+ /******************************************************************************
+ * SWBuf Constructor - Creates an empty SWBuf object
+ *
+ */
+ inline SWBuf() {
+ init(0);
+ }
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from a const char *
+ *
+ */
+ SWBuf(const char *initVal, unsigned long initSize = 0);
+// SWBuf(unsigned long initSize);
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from a char
+ *
+ */
+ SWBuf(char initVal, unsigned long initSize = 0);
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from another SWBuf
+ *
+ */
+ SWBuf(const SWBuf &other, unsigned long initSize = 0);
+
+ /******************************************************************************
+ * SWBuf Destructor - Cleans up instance of SWBuf
+ */
+ inline ~SWBuf() {
+ if ((buf) && (buf != nullStr))
+ free(buf);
+ }
+
+ /**
+ * SWBuf::setFillByte - Set the fillByte character
+ *
+ * @param ch This character is used when the SWBuf is (re)sized.
+ * The memory will be filled with this character. \see setSize() \see resize()
+ */
+ inline void setFillByte(char ch) { fillByte = ch; }
+
+ /**
+ * SWBuf::getFillByte - Get the fillByte character
+ *
+ * @return The character used for filling memory. \see setFillByte.
+ */
+ inline char getFillByte() { return fillByte; }
+
+ /**
+ * @return a pointer to the buffer content (null-terminated string)
+ */
+ inline const char *c_str() const{ return buf; }
+
+ /**
+ * @param pos The position of the requested character.
+ * @return The character at the specified position
+ */
+ inline char &charAt(unsigned long pos) { return ((pos <= (unsigned long)(end - buf)) ? buf[pos] : ((*junkBuf=0),*junkBuf)); }
+
+ /**
+ * @return size() and length() return only the number of characters of the string.
+ * Add one for the following null and one for each char to be appended!
+ */
+ inline unsigned long size() const { return length(); }
+
+ /**
+ * set's the size of the buffer. This is a quick inline method which checks
+ * for changes before actually calling setSize().
+ * @param newSize new size of the buffer
+ */
+ inline void size(unsigned long newSize) { if (end - buf - newSize) setSize(newSize); }
+
+ /**
+ * @return size() and length() return only the number of characters of the string.
+ */
+ inline unsigned long length() const { return end - buf; }
+
+ /**
+ * SWBuf::set - sets this buf to a new value
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ * @param newVal the value to set this buffer to.
+ */
+ inline void set(const SWBuf &newVal) {
+ unsigned long len = newVal.length() + 1;
+ assureSize(len);
+// const char *n = newVal.c_str();
+// for (end = buf;len;len--) *end++ = *n++;
+ memcpy(buf, newVal.c_str(), len);
+ end = buf + (len - 1);
+ }
+
+ /**
+ * SWBuf::set - sets this buf to a new value.
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ * @param newVal the value to set this buffer to.
+ */
+ inline void set(const char *newVal) {
+ if (newVal) {
+ unsigned long len = strlen(newVal) + 1;
+ assureSize(len);
+ memcpy(buf, newVal, len);
+ end = buf + (len - 1);
+ }
+ else {
+ assureSize(1);
+ end = buf;
+ *end = 0;
+ }
+ }
+
+ /**
+ * SWBuf::setFormatted - sets this buf to a formatted string.
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ *
+ * @warning This function can only write at most JUNKBUFSIZE to the string per call.
+ *
+ * @warning This function is not very fast. For loops with many iterations you might
+ * consider replacing it by other calls.
+ * Example:
+ * \code SWBuf buf.setFormatted("<%s>", stringVal); \endcode
+ * should be replaced by:
+ * \code buf.set("<"); buf.append(stringVal); buf.append(">"); \endcode
+ * This will produce much faster results.
+ *
+ * @param format The format string. Same syntax as printf, for example.
+ * @param ... Add all arguments here.
+ */
+ void setFormatted(const char *format, ...);
+
+ /**
+ * SWBuf::setSize - Size this buffer to a specific length.
+ * @param len The new size of the buffer. One byte for the null will be added.
+ */
+ void setSize(unsigned long len);
+ /**
+ * SWBuf::resize - Resize this buffer to a specific length.
+ * @param len The new size of the buffer. One byte for the null will be added.
+ */
+ inline void resize(unsigned long len) { setSize(len); }
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf.
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param str Append this.
+ * @param max Append only max chars.
+ */
+ void append(const char *str, long max = -1);
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param str Append this.
+ * @param max Append only max chars.
+ */
+ inline void append(const SWBuf &str, long max = -1) { append(str.c_str(), max); }
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param ch Append this.
+ */
+ inline void append(char ch) {
+ assureMore(1);
+ *end++ = ch;
+ *end = 0;
+ }
+
+ /**
+ * SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf.
+ *
+ * @warning This function can only write at most JUNKBUFSIZE to the string per call.
+ *
+ * @warning This function is not very fast. For loops with many iterations you might
+ * consider replacing it by other calls.
+ * Example:
+ * \code SWBuf buf.appendFormatted("<%s>", stringVal); \endcode
+ * should be replaced by:
+ * \code buf.append("<"); buf.append(stringVal); buf.append(">"); \endcode
+ * This will produce much faster results.
+ *
+ * @param format The format string. Same syntax as printf, for example.
+ * @param ... Add all arguments here.
+ */
+ void appendFormatted(const char *format, ...);
+
+ /**
+ * SWBuf::insert - inserts the given string at position into this string
+ * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
+ * @param str string to be inserted
+ * @param start start from this position in the string to be inserted
+ * @param max Insert only max chars.
+ */
+ void insert(unsigned long pos, const char* str, unsigned long start = 0, signed long max = -1);
+
+ /**
+ * SWBuf::insert - inserts the given string at position into this string
+ * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
+ * @param str string to be inserted
+ * @param start start from this position in the string to be inserted
+ * @param max Insert only max chars.
+ */
+ inline void insert(unsigned long pos, const SWBuf &str, unsigned long start = 0, signed long max = -1) {
+ insert(pos, str.c_str(), start, max);
+ };
+
+ /**
+ * SWBuf::insert - inserts the given character at position into this string
+ * @param pos The position where to insert. pos=0 inserts at the beginning, pos=1 after the first char, etc. Using pos=length() is the same as calling append(s)
+ * @param c Insert this.
+ */
+ inline void insert(unsigned long pos, char c) {
+ insert(pos, SWBuf(c));
+ }
+
+ /** SWBuf::getRawData
+ *
+ * @warning be careful! Probably setSize needs to be called in conjunction before and maybe after
+ *
+ * @return Pointer to the allocated memory of the SWBuf.
+ */
+ inline char *getRawData() { return buf; }
+
+ inline operator const char *() const { return c_str(); }
+ inline char &operator[](unsigned long pos) { return charAt(pos); }
+ inline char &operator[](long pos) { return charAt((unsigned long)pos); }
+ inline char &operator[](unsigned int pos) { return charAt((unsigned long)pos); }
+ inline char &operator[](int pos) { return charAt((unsigned long)pos); }
+ inline SWBuf &operator =(const char *newVal) { set(newVal); return *this; }
+ inline SWBuf &operator =(const SWBuf &other) { set(other); return *this; }
+ inline SWBuf &operator +=(const char *str) { append(str); return *this; }
+ inline SWBuf &operator +=(char ch) { append(ch); return *this; }
+
+ /**
+ * Decrease the buffer size, discarding the last characters
+ * @param len how many bytes to decrease the buffer size
+ */
+ inline SWBuf &operator -=(unsigned long len) { setSize(length()-len); return *this; }
+
+ /**
+ * Decrease the buffer size, discarding the last character
+ */
+ inline SWBuf &operator --(int) { operator -=(1); return *this; }
+
+ /**
+ * Shift the buffer to the left, discarding the first bytes, decreasing the buffer size
+ */
+ inline SWBuf &operator <<(unsigned long n) { if (n && length()) { n = (n<=length())?n:(length()-1); memmove(buf, buf+n, length()-n); (*this)-=n; } return *this; }
+
+ /**
+ * Shift the buffer to the right, increasing the buffer size
+ */
+ inline SWBuf &operator >>(unsigned long n) { setSize(length()+n); memmove(buf+n, buf, length()-n); return *this; }
+
+ /**
+ * Concatenate another buffer to the end of this buffer
+ */
+ inline SWBuf operator +(const SWBuf &other) const {
+ SWBuf retVal = buf;
+ retVal += other;
+ return retVal;
+ }
+
+ /**
+ * Concatenate a byte to the end of this buffer
+ */
+ inline SWBuf operator +(char ch) const { return (*this) + SWBuf(ch); }
+
+ /**
+ * Trim whitespace from the start of this buffer, shifting the buffer left as necessary
+ */
+ inline SWBuf &trimStart() { while (size() && (strchr("\t\r\n ", *(buf)))) *this << 1; return *this; }
+
+ /**
+ * Trim whitespace from the end of this buffer, decreasing the size as necessary
+ */
+ inline SWBuf &trimEnd() { while (size() && (strchr("\t\r\n ", *(end-1)))) setSize(size()-1); return *this; }
+
+ /**
+ * Trim whitespace from the start and end of this buffer, shifting left and decreasing size as necessary
+ */
+ inline SWBuf &trim() { trimStart(); return trimEnd(); }
+
+
+ /**
+ * Strip a prefix from this buffer up to a separator byte.
+ * Returns the prefix and modifies this buffer, shifting left to remove prefix
+ * @param separator to use (e.g. ':')
+ * @return prefix if separator character found; otherwise, null and leaves buffer unmodified
+ */
+ inline const char *stripPrefix(char separator) { const char *m = strchr(buf, separator); if (m) { int len = m-buf; char *hold = new char[len]; memcpy(hold, buf, len); *this << (len+1); memcpy(end+1, hold, len); delete [] hold; end[len+1] = 0; } return (m) ? end+1 : 0; } // safe. we know we don't actually realloc and shrink buffer when shifting, so we can place our return val at end.
+
+ // this could be nicer, like replacing a contiguous series of target bytes with single replacement; offering replacement const char *
+ /**
+ * Replace with a new byte value all occurances in this buffer of any byte value specified in a set
+ * @param targets a set of bytes, any of which will be replaced
+ * @param newByte value to use as replacement.
+ *
+ * Example: replaceBytes("abc", 'z'); // replaces all occurances of 'a', 'b', and 'c' with 'z'
+ */
+ inline SWBuf &replaceBytes(const char *targets, char newByte) { for (unsigned int i = 0; (i < size()); i++) { if (strchr(targets, buf[i])) buf[i] = newByte; } return *this; }
+
+ /**
+ * @return returns true if this buffer starts with the specified prefix
+ */
+ inline bool startsWith(const SWBuf &prefix) const { return !strncmp(c_str(), prefix.c_str(), prefix.size()); }
+
+ /**
+ * @return returns true if this buffer ends with the specified postfix
+ */
+ inline bool endsWith(const SWBuf &postfix) const { return (size() >= postfix.size())?!strncmp(end-postfix.size(), postfix.c_str(), postfix.size()):false; }
+
+ inline int compare(const SWBuf &other) const { return strcmp(c_str(), other.c_str()); }
+ inline bool operator ==(const SWBuf &other) const { return compare(other) == 0; }
+ inline bool operator !=(const SWBuf &other) const { return compare(other) != 0; }
+ inline bool operator > (const SWBuf &other) const { return compare(other) > 0; }
+ inline bool operator < (const SWBuf &other) const { return compare(other) < 0; }
+ inline bool operator <=(const SWBuf &other) const { return compare(other) <= 0; }
+ inline bool operator >=(const SWBuf &other) const { return compare(other) >= 0; }
+
+ /**
+ * @return returns true if this buffer starts with the specified prefix
+ */
+ inline bool startsWith(const char *prefix) const { return !strncmp(c_str(), prefix, strlen(prefix)); }
+
+ /**
+ * @return returns true if this buffer ends with the specified postfix
+ */
+ inline bool endsWith(const char *postfix) const { unsigned int psize = strlen(postfix); return (size() >= psize)?!strncmp(end-psize, postfix, psize):false; }
+
+ inline int compare(const char *other) const { return strcmp(c_str(), other); }
+ inline bool operator ==(const char *other) const { return compare(other) == 0; }
+ inline bool operator !=(const char *other) const { return compare(other) != 0; }
+ inline bool operator > (const char *other) const { return compare(other) > 0; }
+ inline bool operator < (const char *other) const { return compare(other) < 0; }
+ inline bool operator <=(const char *other) const { return compare(other) <= 0; }
+ inline bool operator >=(const char *other) const { return compare(other) >= 0; }
+};
+
+
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swcacher.h b/include/swcacher.h
new file mode 100644
index 0000000..a68cb16
--- /dev/null
+++ b/include/swcacher.h
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * swcacher.h - definition of class SWCacher used to provide an interface for
+ * objects that cache and want a standard interface for cleaning up.
+ *
+ * $Id: swcacher.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWCACHER_H
+#define SWCACHER_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+/** used to provide an interface for objects that cache and want
+ * a standard interface for cleaning up.
+ */
+class SWDLLEXPORT SWCacher {
+public:
+ SWCacher();
+ virtual ~SWCacher();
+ virtual void flush();
+ virtual long resourceConsumption();
+ virtual long lastAccess();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swcipher.h b/include/swcipher.h
new file mode 100644
index 0000000..d9fad23
--- /dev/null
+++ b/include/swcipher.h
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * swcipher.h - definition of Class SWCipher used for data cipher/decipher
+ *
+ * $Id: swcipher.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1999 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWCIPHER_H
+#define SWCIPHER_H
+
+#include <sapphire.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT SWCipher
+{
+
+ sapphire master;
+ sapphire work;
+
+ char *buf;
+ bool cipher;
+ unsigned long len;
+protected:
+public:
+ SWCipher (unsigned char *key);
+ virtual void setCipherKey (const char *key);
+ virtual ~ SWCipher ();
+ virtual char *Buf (const char *buf = 0, unsigned long len = 0);
+ virtual char *cipherBuf (unsigned long *len, const char *buf = 0);
+ virtual void Encode (void);
+ virtual void Decode (void);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swcom.h b/include/swcom.h
new file mode 100644
index 0000000..5b17d83
--- /dev/null
+++ b/include/swcom.h
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * swcom.h - code for base class 'SWCom'. SWCom is the basis for all
+ * types of commentary modules
+ *
+ * $Id: swcom.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWCOM_H
+#define SWCOM_H
+
+#include <swmodule.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class VerseKey;
+class SWKey;
+
+ /** The basis for all commentary modules
+ */
+class SWDLLEXPORT SWCom : public SWModule {
+
+ mutable VerseKey *tmpVK;
+
+protected:
+ VerseKey &getVerseKey() const;
+
+
+public:
+
+ /** Initializes data for instance of SWCom
+ */
+ SWCom(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding enc = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup mark = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWCom();
+ virtual SWKey *CreateKey();
+
+ virtual long Index() const;
+ virtual long Index(long iindex);
+
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swcomprs.h b/include/swcomprs.h
new file mode 100644
index 0000000..e7a772e
--- /dev/null
+++ b/include/swcomprs.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * swcomprs.h - definition of Class SWCompress used for data compression
+ *
+ * $Id: swcomprs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWCOMPRS_H
+#define SWCOMPRS_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT SWCompress
+{
+ void Init ();
+ void cycleStream ();
+protected:
+ char *buf, *zbuf, direct; // 0 - encode; 1 - decode
+ unsigned long zlen, zpos, pos, slen;
+public:
+ SWCompress ();
+ virtual ~ SWCompress ();
+ virtual char *Buf (const char *buf = 0, unsigned long *len = 0);
+ virtual char *zBuf (unsigned long *len, char *buf = 0);
+ virtual unsigned long GetChars (char *buf, unsigned long len); // override for other than buffer compression
+ virtual unsigned long SendChars (char *buf, unsigned long len); // override for other than buffer compression
+ virtual void Encode (void); // override to provide compression algorythm
+ virtual void Decode (void); // override to provide compression algorythm
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swconfig.h b/include/swconfig.h
new file mode 100644
index 0000000..5bc46d9
--- /dev/null
+++ b/include/swconfig.h
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * swconfig.h - definition of Class SWConfig used for saving and retrieval
+ * of configuration information
+ *
+ * $Id: swconfig.h 2094 2007-09-29 00:34:03Z chrislit $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWCONFIG_H
+#define SWCONFIG_H
+
+#include <map>
+
+#include <defs.h>
+#include <multimapwdef.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+typedef multimapwithdefault < SWBuf, SWBuf, std::less < SWBuf > >ConfigEntMap;
+typedef std::map < SWBuf, ConfigEntMap, std::less < SWBuf > >SectionMap;
+
+/** The class to read and save settings using a file on disk.
+*
+*/
+class SWDLLEXPORT SWConfig {
+private:
+ char getline(int fd, SWBuf &line);
+public:
+ /** The filename used by this SWConfig object
+ *
+ */
+ SWBuf filename;
+ /** Map of available sections
+ * The map of available sections.
+ */
+ SectionMap Sections;
+
+ /** Constructor of SWConfig
+ * @param ifilename The file, which should be used for this config.
+ */
+ SWConfig(const char *ifilename);
+ virtual ~SWConfig();
+
+ /** Load from disk
+ * Load the content from disk.
+ */
+ virtual void Load();
+
+ /** Save to disk
+ * Save the content of this config object to disk.
+ */
+ virtual void Save();
+
+ /** Merges the values of addFrom
+ * @param addFrom The config which values should be merged to this config object. Already existing values will be overwritten.
+ */
+ virtual void augment(SWConfig &addFrom);
+ virtual SWConfig & operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
+
+ /** Get a section
+ * This is an easy way to get and store config values.
+ * The following will work:\n
+ *
+ * @code
+ * SWConfig config("/home/user/.setttings");
+ * config["Colors"]["Background"] = "red";
+ * @endcode
+ */
+ virtual ConfigEntMap & operator [](const char *section);
+ };
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swdisp.h b/include/swdisp.h
new file mode 100644
index 0000000..ca56a6e
--- /dev/null
+++ b/include/swdisp.h
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * swdisp.h - code for base class 'swdisp'. swdisp is the basis for all
+ * types of displays (e.g. raw textout, curses, xwindow, etc.)
+ *
+ * $Id: swdisp.h 1825 2005-06-10 09:03:37Z jansorg $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWDISP_H
+#define SWDISP_H
+
+#include <swobject.h>
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWModule;
+
+/** swdisp is the basis for all types of displays
+* (e.g. raw textout, curses, xwindow, etc.)
+*/
+class SWDLLEXPORT SWDisplay : public SWObject {
+ static SWClass classdef;
+public:
+ SWDisplay () { myclass = &classdef; };
+ virtual ~SWDisplay() {};
+
+ /** casts a module to a character pointer and displays it to
+ * raw output (overriden for different display types and
+ * module types if necessary)
+ *
+ * @param imodule module to display
+ * @return error status
+ */
+ virtual char Display (SWModule & imodule);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swfilter.h b/include/swfilter.h
new file mode 100644
index 0000000..8e16e22
--- /dev/null
+++ b/include/swfilter.h
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * swfilter.h - definition of class SWFilter used to filter text between
+ * different formats
+ *
+ * $Id: swfilter.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWFILTER_H
+#define SWFILTER_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWKey;
+class SWBuf;
+class SWModule;
+
+
+class SWModule;
+
+/** Base class for all filters in sword.
+* Filters are used to filter/convert text between different formats
+* like GBF, HTML, RTF ...
+*/
+class SWDLLEXPORT SWFilter {
+public:
+ virtual ~SWFilter() {}
+
+ /** This is the main filter function
+ * @param text The text to be filtered/converted
+ * @param key Current key That was used.
+ * @param module Current module.
+ * @return 0
+ */
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0) = 0;
+};
+
+ SWORD_NAMESPACE_END
+#endif
diff --git a/include/swfiltermgr.h b/include/swfiltermgr.h
new file mode 100644
index 0000000..49923fe
--- /dev/null
+++ b/include/swfiltermgr.h
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * swfiltermgr.h - definition of class SWFilterMgr used as an interface to
+ * manage filters on a module
+ *
+ * $Id: swfiltermgr.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWFILTERMGR_H
+#define SWFILTERMGR_H
+
+#include <defs.h>
+#include <swconfig.h>
+
+SWORD_NAMESPACE_START
+
+class SWModule;
+class SWMgr;
+
+/** Class to manage different kinds of filters.
+*/
+class SWDLLEXPORT SWFilterMgr {
+
+private:
+ SWMgr *parentMgr;
+
+public:
+ SWFilterMgr();
+ virtual ~SWFilterMgr();
+
+ virtual void setParentMgr(SWMgr *parentMgr);
+ virtual SWMgr *getParentMgr();
+
+ virtual void AddGlobalOptions(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start,
+ ConfigEntMap::iterator end);
+ virtual void AddLocalOptions(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start,
+ ConfigEntMap::iterator end);
+
+
+ /**
+ * Adds the encoding filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the encoding filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddEncodingFilters(SWModule *module, ConfigEntMap &section);
+
+
+ /**
+ * Adds the render filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the render filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddRenderFilters(SWModule *module, ConfigEntMap &section);
+
+
+ /**
+ * Adds the strip filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the strip filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddStripFilters(SWModule *module, ConfigEntMap &section);
+
+
+ /**
+ * Adds the raw filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the raw filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddRawFilters(SWModule *module, ConfigEntMap &section);
+
+};
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swgenbook.h b/include/swgenbook.h
new file mode 100644
index 0000000..3cfa785
--- /dev/null
+++ b/include/swgenbook.h
@@ -0,0 +1,57 @@
+/******************************************************************************
+* swgenbook.h
+*
+* $Id: swgenbook.h 1864 2005-11-20 06:06:40Z scribe $
+*
+* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
+
+#ifndef SWGENBOOK_H
+#define SWGENBOOK_H
+
+#include <swmodule.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+/** The basis for all Book modules.
+*/
+class SWDLLEXPORT SWGenBook : public SWModule {
+
+protected:
+ char *entkeytxt;
+
+public:
+ /** Initializes data for instance of SWGenBook
+ */
+ SWGenBook(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWGenBook();
+ virtual SWKey *CreateKey() = 0;
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swinputmeth.h b/include/swinputmeth.h
new file mode 100644
index 0000000..e2d14e2
--- /dev/null
+++ b/include/swinputmeth.h
@@ -0,0 +1,34 @@
+/**
+ * Title:
+ * Description:
+ * Copyright: Copyright (c) 2001 CrossWire Bible Society under the terms of the GNU GPL
+ * Company:
+ * @author Troy A. Griffitts
+ * @version 1.0
+ */
+
+#ifndef SWINPUTMETHOD_H
+#define SWINPUTMETHOD_H
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT SWInputMethod {
+
+private:
+ int state;
+
+protected:
+ virtual void setState(int state);
+
+public:
+ SWInputMethod();
+ virtual ~SWInputMethod() {}
+
+ virtual int *translate(char in) = 0;
+ virtual int getState();
+ virtual void clearState();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swkey.h b/include/swkey.h
new file mode 100644
index 0000000..ed62e67
--- /dev/null
+++ b/include/swkey.h
@@ -0,0 +1,214 @@
+/******************************************************************************
+ * swkey.h - code for base class 'swkey'. swkey is the basis for all
+ * types of keys for indexing into modules (e.g. verse, word,
+ * place, etc.)
+ *
+ * $Id: swkey.h 2121 2007-11-24 16:42:32Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWKEY_H
+#define SWKEY_H
+
+#include <swobject.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+#define KEYERR_OUTOFBOUNDS 1
+
+#define SWKEY_OPERATORS \
+ SWKey &operator =(const char *ikey) { setText(ikey); return *this; } \
+ SWKey &operator =(const SWKey &ikey) { copyFrom(ikey); return *this; } \
+ SWKey &operator =(SW_POSITION pos) { setPosition(pos); return *this; } \
+ operator const char *() const { return getText(); } \
+ bool operator ==(const SWKey &ikey) { return equals(ikey); } \
+ bool operator !=(const SWKey &ikey) { return !equals(ikey); } \
+ virtual bool operator >(const SWKey &ikey) { return (compare(ikey) > 0); } \
+ virtual bool operator <(const SWKey &ikey) { return (compare(ikey) < 0); } \
+ virtual bool operator >=(const SWKey &ikey) { return (compare(ikey) > -1); } \
+ virtual bool operator <=(const SWKey &ikey) { return (compare(ikey) < 1); } \
+ SWKey &operator -=(int steps) { decrement(steps); return *this; } \
+ SWKey &operator +=(int steps) { increment(steps); return *this; } \
+ SWKey &operator++(int) { return *this += 1; } \
+ SWKey &operator--(int) { return *this -= 1; }
+
+
+/** For use with = operator to position key.
+*/
+class SW_POSITION {
+ char pos;
+public:
+ SW_POSITION(char ipos) { pos = ipos; }
+ operator char() { return pos; }
+};
+
+#define POS_TOP ((char)1)
+#define POS_BOTTOM ((char)2)
+
+#define TOP SW_POSITION(POS_TOP)
+#define BOTTOM SW_POSITION(POS_BOTTOM)
+
+/** SWKey is used for positioning an SWModule to a specific entry.
+ * It always represents a possible location into a module and can additionally represent
+ * a domain of entries (e.g. "John 3:16" in the domain "John 1:1 - Mark 5:25")
+ */
+class SWDLLEXPORT SWKey : public SWObject {
+ long index;
+ static SWClass classdef;
+ void init();
+
+protected:
+ char *keytext;
+ mutable char *rangeText;
+ mutable bool boundSet;
+ char persist;
+ char error;
+
+public:
+
+ // misc pointer for whatever
+ void *userData;
+
+ /** initializes instance of SWKey from a string
+ * All keys can be reduced to a string representation which should be able
+ * to be used to again set the key to the same position
+ * @param ikey string to use for initializing this new key
+ */
+ SWKey(const char *ikey = 0);
+
+ /** Copy Constructor
+ * @param k The SWKey object to copy.
+ */
+ SWKey(SWKey const &k);
+
+ /** Destructor, cleans up this instance of SWKey
+ */
+ virtual ~SWKey();
+
+ /** Returns a new exact clone of this SWKey object. This allocates
+ * a new SWKey which must be deleted by the caller
+ * @return new clone of this key
+ */
+ virtual SWKey *clone() const;
+
+ /** Gets whether this key should persist in any module to which it is set
+ * otherwise just a copy will be used in the module.
+ * @return 1 - persists in module; 0 - a copy is attempted
+ */
+ char Persist() const;
+
+ /** Sets whether this key should persist in any module to which it is set
+ * otherwise just a copy will be used in the module.
+ * @param ipersist value which to set persist;
+ * @return 1 - persists in module; 0 - a copy is attempted
+ */
+ char Persist(signed char ipersist);
+
+ /** Gets and clears error status
+ * @return error status
+ */
+ virtual char Error();
+
+ /** Sets this SWKey with a character string
+ * @param ikey string used to set this key
+ */
+ virtual void setText(const char *ikey);
+
+ /** Copies as much info (position, range, etc.) as possible from another SWKey object
+ * @param ikey other SWKey object from which to copy
+ */
+ virtual void copyFrom(const SWKey &ikey);
+
+ /** returns string representation of this key
+ */
+ virtual const char *getText() const;
+ virtual const char *getShortText() const { return getText(); }
+ virtual const char *getRangeText() const;
+ virtual bool isBoundSet() const { return boundSet; }
+ virtual void clearBound() const { boundSet = false; }
+
+ /** Compares this key object to another SWKey object
+ * @param ikey key to compare with this one
+ * @return >0 if this key is greater than compare key;
+ * <0 if this key is smaller than compare key;
+ * 0 if the keys are the same
+ */
+ virtual int compare(const SWKey &ikey);
+
+ /** test equality of this SWKey object's position with another SWKey
+ * @param ikey key to compare with this one
+ * @return true if the key positions are equal
+ */
+ virtual bool equals(const SWKey &ikey) { return !compare(ikey); }
+
+ virtual void setPosition(SW_POSITION);
+
+ /** Decrements key a number of entry positions
+ * This is only valid if isTraversable is true
+ * @param steps Number of entries to jump backward
+ */
+ virtual void decrement(int steps = 1);
+
+ /** Increments key a number of entry positions
+ * This is only valid if isTraversable is true
+ * @param steps Number of entries to jump forward
+ */
+ virtual void increment(int steps = 1);
+
+ /** deprecated, use isTraversible
+ */
+ char Traversable() { return (isTraversable()) ? 1:0; }
+
+ /** Whether or not this key can be ++ -- incremented
+ */
+ virtual bool isTraversable() const { return false; }
+
+ /** Use this function to get an index position within a module.
+ * Here's a small example how to use this function and @ref Index(long).
+ * This function uses the GerLut module and chooses a random verse from the
+ * Bible and returns it.
+ * @code
+ * const char* randomVerse() {
+ * VerseKey vk;
+ * SWMgr mgr;
+ * LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName("de");
+ *
+ * SWModule* module = mgr->Modules("GerLut");
+ * srand( time(0) );
+ * const double newIndex = (double(rand())/RAND_MAX)*(24108+8224);
+ * vk.Index(newIndex);
+ * module->setKey(vk);
+ *
+ * char* text;
+ * sprintf(text, "%s: %s",(const char*)vk ,module->StripText(&vk));
+ * return text;
+ * @endcode
+ */
+ virtual long Index() const { return index; }
+
+ /** See documentation for @ref Index()
+ */
+ virtual long Index(long iindex) { index = iindex; return index; }
+
+ SWKEY_OPERATORS
+
+ };
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swld.h b/include/swld.h
new file mode 100644
index 0000000..28d416b
--- /dev/null
+++ b/include/swld.h
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * swld.h - code for base class 'SWLD'. SWLD is the basis for all
+ * types of Lexicon and Dictionary modules (hence the 'LD').
+ *
+ * $Id: swld.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWLD_H
+#define SWLD_H
+
+#include <swmodule.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+ /** the basis for all types of Lexicon and
+ * Dictionary modules (hence the 'LD').
+ */
+class SWDLLEXPORT SWLD : public SWModule {
+protected:
+ char *entkeytxt;
+public:
+ /** Initializes data for instance of SWLD
+ */
+ SWLD(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWLD();
+ virtual SWKey *CreateKey();
+
+ /** Sets/gets module KeyText, getting from saved text if key is persistent
+ *
+ * @param ikeytext value which to set keytext;
+ * [0] - only get
+ * @return pointer to keytext
+ */
+ virtual const char *KeyText(const char *ikeytext = 0);
+ virtual void setPosition(SW_POSITION pos);
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swlocale.h b/include/swlocale.h
new file mode 100644
index 0000000..afe45a1
--- /dev/null
+++ b/include/swlocale.h
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * swlocale.h - definition of Class SWLocale used for retrieval
+ * of locale lookups
+ *
+ * $Id: swlocale.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 2000 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWLOCALE_H
+#define SWLOCALE_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWConfig;
+static const int ENDOFABBREVS = -2;
+
+/** SWLocale is used for the localisation of the booknames
+* The SWLocale is a class which holds the information of one language.
+* Every language supported by SWORD has one SWLocale object,
+* get the name of the Language using @see getname of this class.
+* Another functions useful for frontend developers is @see getDescription.
+*/
+class SWDLLEXPORT SWLocale {
+
+class Private;
+
+ Private *p;
+
+ SWConfig *localeSource;
+
+ char *name;
+ char *description;
+ char *encoding;
+ struct abbrev *bookAbbrevs;
+ char *BMAX;
+ struct sbook **books;
+
+public:
+ SWLocale(const char *ifilename);
+ virtual ~SWLocale();
+
+ /**
+ * This function is used to get the name of the languages which this object is handling.
+ * @return The name of the managed language. A possible example is "de".
+ */
+ virtual const char *getName();
+ /**
+ * @return The description. A possible example is "German".
+ */
+ virtual const char *getDescription();
+ virtual const char *getEncoding();
+ virtual const char *translate(const char *text);
+ virtual void augment(SWLocale &addFrom);
+ virtual SWLocale & operator +=(SWLocale &addFrom) { augment(addFrom); return *this; }
+ virtual const struct abbrev *getBookAbbrevs();
+ virtual void getBooks(char **iBMAX, struct sbook ***ibooks);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swlog.h b/include/swlog.h
new file mode 100644
index 0000000..9aa6109
--- /dev/null
+++ b/include/swlog.h
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * swlog.h - definition of class SWLog used for logging messages
+ *
+ * $Id: swlog.h 2080 2007-09-17 06:21:29Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+//---------------------------------------------------------------------------
+#ifndef swlogH
+#define swlogH
+//---------------------------------------------------------------------------
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT SWLog {
+protected:
+ char logLevel;
+ static SWLog *systemLog;
+
+public:
+
+ static const int LOG_ERROR;
+ static const int LOG_WARN;
+ static const int LOG_INFO;
+ static const int LOG_TIMEDINFO;
+ static const int LOG_DEBUG;
+
+ static SWLog *getSystemLog();
+ static void setSystemLog(SWLog *newLogger);
+
+ SWLog() { logLevel = 1; /*default to show only errors*/}
+ virtual ~SWLog() {};
+
+ void setLogLevel(char level) { logLevel = level; }
+ char getLogLevel() const { return logLevel; }
+ void logWarning(const char *fmt, ...) const;
+ void logError(const char *fmt, ...) const;
+ void logInformation(const char *fmt, ...) const;
+ virtual void logTimedInformation(const char *fmt, ...) const;
+ void logDebug(const char *fmt, ...) const;
+
+ // Override this method if you want to have a custom logger
+ virtual void logMessage(const char *message, int level) const;
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swmacs.h b/include/swmacs.h
new file mode 100644
index 0000000..4da07b0
--- /dev/null
+++ b/include/swmacs.h
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * swmacs.h - generic macros
+ *
+ * $Id: swmacs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWMACS_H
+#define SWMACS_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+// Maximum positive value of a signed numeric type
+#define MAXPOS(x) ((x)((unsigned x)(1L << (sizeof(x)*8-1)) - 1))
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swmgr.h b/include/swmgr.h
new file mode 100644
index 0000000..7991933
--- /dev/null
+++ b/include/swmgr.h
@@ -0,0 +1,353 @@
+/******************************************************************************
+ * swmgr.h - definition of class SWMgr used to interact with an install
+ * base of sword modules.
+ *
+ * $Id: swmgr.h 2149 2008-03-31 04:44:30Z scribe $
+ *
+ * Copyright 1998-2008 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+/** @mainpage The SWORD Project - API documentation
+ * This is the API documentation for The SWORD Project.
+ * It describes the structure of the SWORD library and documents the functions of the classes.
+ * From time to time this documentation gives programming examples, too.
+ *
+ * SWORD provides a simple to use engine for working with many types of texts including Bibles,
+ * commentaries, lexicons, glossaries, daily devotionals, and others.
+ *
+ * Some main classes:
+ *
+ * SWMgr gives access to an installed library of modules (books).
+ * SWModule represents an individual module
+ * SWKey represents a location into a module (e.g. "John 3:16")
+ *
+ * An API Primer can be found at:
+ *
+ * http://crosswire.org/sword/develop/swordapi/apiprimer.jsp
+ *
+ * If you're interested in working on a client which uses SWORD, please first have a look at
+ * some of the existing ones. They can always use help, and will also prove to be good examples
+ * if you decide to start a new project.
+ *
+ * Well known frontends are:\n
+ * -SWORD for Windows (http://crosswire.org/sword/software/biblecs/)\n
+ * -GnomeSword (http://gnomesword.sourceforge.net/)\n
+ * -BibleTime (http://www.bibletime.info/)\n
+ */
+
+#ifndef SWMGR_H
+#define SWMGR_H
+
+#include <map>
+#include <list>
+#include <swbuf.h>
+#include <swconfig.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWModule;
+class SWFilter;
+class SWOptionFilter;
+class SWFilterMgr;
+class SWBuf;
+class SWKey;
+
+typedef std::map < SWBuf, SWModule *, std::less < SWBuf > >ModMap;
+typedef std::map < SWBuf, SWFilter * >FilterMap;
+typedef std::map < SWBuf, SWOptionFilter * >OptionFilterMap;
+typedef std::list < SWBuf >StringList;
+typedef std::list < SWFilter* >FilterList;
+typedef std::list < SWOptionFilter* >OptionFilterList;
+
+class FileDesc;
+class SWOptionFilter;
+
+/** SWMgr exposes an installed module set
+ *
+ * SWMgr exposes an installed module set and can be asked to configure the desired
+ * markup and options which modules will produce.
+ *
+ * @version $Id: swmgr.h 2149 2008-03-31 04:44:30Z scribe $
+ */
+class SWDLLEXPORT SWMgr {
+
+
+private:
+ bool mgrModeMultiMod;
+ bool augmentHome;
+ void commonInit(SWConfig *iconfig, SWConfig *isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod = false);
+
+protected:
+ SWFilterMgr *filterMgr; //made protected because because BibleTime needs it
+ SWConfig *myconfig; //made protected because because BibleTime needs it
+ SWConfig *mysysconfig;
+ SWConfig *homeConfig;
+ void CreateMods(bool multiMod = false);
+ SWModule *CreateMod(const char *name, const char *driver, ConfigEntMap &section);
+ void DeleteMods();
+ char configType; // 0 = file; 1 = directory
+ OptionFilterMap optionFilters;
+ FilterMap cipherFilters;
+ SWFilter *gbfplain;
+ SWFilter *thmlplain;
+ SWFilter *osisplain;
+ SWFilter *teiplain;
+ SWOptionFilter *transliterator;
+ FilterList cleanupFilters;
+ StringList options;
+ virtual void init(); // use to initialize before loading modules
+ virtual char AddModToConfig(FileDesc *conffd, const char *fname);
+ virtual void loadConfigDir(const char *ipath);
+ virtual void AddGlobalOptions(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end);
+ virtual void AddLocalOptions(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end);
+ StringList augPaths;
+
+ /**
+ * Called to add appropriate Encoding Filters to a module. Override to do special actions,
+ * if desired. See the module.conf Encoding= entry.
+ * @param module module to which to add Encoding Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddEncodingFilters(SWModule *module, ConfigEntMap &section);
+
+ /**
+ * Called to add appropriate Render Filters to a module. Override to do special actions,
+ * if desired. See the module.conf SourceType= entry.
+ * @param module module to which to add Render Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddRenderFilters(SWModule *module, ConfigEntMap &section);
+
+ /**
+ * Called to add appropriate Strip Filters to a module. Override to do special actions,
+ * if desired. See the module.conf SourceType= entry.
+ * @param module module to which to add Strip Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddStripFilters(SWModule *module, ConfigEntMap &section);
+
+ // ones manually specified in .conf file
+ virtual void AddStripFilters(SWModule *module, ConfigEntMap &section, ConfigEntMap::iterator start, ConfigEntMap::iterator end);
+
+ /**
+ * Called to add appropriate Raw Filters to a module. Override to do special actions,
+ * if desired. See the module.conf CipherKey= entry.
+ * @param module module to which to add Raw Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddRawFilters(SWModule *module, ConfigEntMap &section);
+
+
+public:
+
+ static bool isICU;
+ static const char *globalConfPath;
+
+ /**
+ *
+ */
+ static void findConfig(char *configType, char **prefixPath, char **configPath, StringList *augPaths = 0, SWConfig *providedSysConf = 0);
+
+ SWConfig *config;
+ SWConfig *sysconfig;
+
+ /** The path to main module set and locales
+ */
+ char *prefixPath;
+
+ /** path to main module set configuration
+ */
+ char *configPath;
+
+ /** The map of available modules.
+ * This map exposes the installed modules.
+ * Here's an example how to iterate over the map and check the module type of each module.
+ *
+ *@code
+ * ModMap::iterator it;
+ * SWModule *curMod = 0;
+ *
+ * for (it = Modules.begin(); it != Modules.end(); it++) {
+ * curMod = (*it).second;
+ * if (!strcmp(curMod->Type(), "Biblical Texts")) {
+ * // do something with curMod
+ * }
+ * else if (!strcmp(curMod->Type(), "Commentaries")) {
+ * // do something with curMod
+ * }
+ * else if (!strcmp(curMod->Type(), "Lexicons / Dictionaries")) {
+ * // do something with curMod
+ * }
+ * }
+ * @endcode
+ */
+ ModMap Modules;
+
+ /** Gets a specific module by name. e.g. SWModule *kjv = myManager.getModule("KJV");
+ * @param modName the name of the module to retrieve
+ * @return the module, if found, otherwise 0
+ */
+ SWModule *getModule(const char *modName) { ModMap::iterator it = Modules.find(modName); return ((it != Modules.end()) ? it->second : 0); }
+ const SWModule *getModule(const char *modName) const { ModMap::const_iterator it = Modules.find(modName); return ((it != Modules.end()) ? it->second : 0); }
+
+
+ /** Constructs an instance of SWMgr
+ *
+ * @param iconfig manually supply a configuration. If not supplied, SWMgr will look on the system
+ * using a complex hierarchical search. See README for detailed specifics.
+ * @param isysconfig
+ * @param autoload whether or not to immediately load modules on construction of this SWMgr.
+ * If you reimplemented SWMgr you can set this to false and call SWMgr::Load() after you have
+ * completed the contruction and setup of your SWMgr subclass.
+ * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules
+ * SWMgr TAKES OWNERSHIP FOR DELETING THIS OBJECT
+ * For example, this will create an SWMgr and cause its modules to produce HTMLHREF formatted output
+ * when asked for renderable text:
+ *
+ * SWMgr *myMgr = new SWMgr(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF));
+ */
+ SWMgr(SWConfig *iconfig = 0, SWConfig *isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false);
+
+ /**
+ */
+ SWMgr(SWFilterMgr *filterMgr, bool multiMod = false);
+
+ /**
+ * @param iConfigPath provide a custom path to use for module set location, instead of
+ * searching the system for it.
+ */
+ SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false, bool augmentHome = true);
+
+ /** The destructor of SWMgr.
+ * This function cleans up the modules and deletes the created object.
+ * Destroying the SWMgr causes all retrieved SWModule object to be invalid, so
+ * be sure to destroy only when retrieved objects are no longer needed.
+ */
+ virtual ~SWMgr();
+
+ /**
+ * Adds books from a new path to the library
+ * @param path the path in which to search for books
+ * @param multiMod whether or not to keep multiple copies of the same book if found in different paths
+ * default - false, uses last found version of the book
+ */
+ virtual void augmentModules(const char *path, bool multiMod = false);
+
+ void deleteModule(const char *);
+
+ /** Looks for any newly installed module.conf file in the path provided,
+ * displays the copyright information to the user, and then copies the
+ * module.conf to the main module set's mods.d directory
+ * @param dir where to search for new modules
+ */
+ virtual void InstallScan(const char *dir);
+
+ /** Load all modules. Should only be manually called if SWMgr was constructed
+ * without autoload; otherwise, this will be called on SWMgr construction
+ * Reimplement this function to supply special functionality when modules are
+ * initially loaded.
+ */
+ virtual signed char Load();
+
+ /** Change the values of global options (e.g. Footnotes, Strong's Number, etc.)
+ * @param option The name of the option, for which you want to change the
+ * value. Well known and often used values are "Footnotes" or "Strong's Numbers"
+ * @param value new value. Common values are "On" and "Off"
+ */
+ virtual void setGlobalOption(const char *option, const char *value);
+
+ /** Get the current value of the given option
+ * @param option the name of the option, who's value is desired
+ * @return the value of the given option
+ */
+ virtual const char *getGlobalOption(const char *option);
+
+ /** Gets a brief description for the given option
+ * @param option the name of the option, who's tip is desired
+ * @return description text
+ * @see setGlobalOption, getGlobalOption, getGlobalOptions
+ */
+ virtual const char *getGlobalOptionTip(const char *option);
+
+ /** Gets a list of all available option names
+ * @return list of option names
+ */
+ virtual StringList getGlobalOptions();
+
+ /** Gets a list of legal values to which a specific option
+ * may be set
+ * @param option the name of the option, who's legal values are desired
+ * @return a list of legal values for the given option
+ */
+ virtual StringList getGlobalOptionValues(const char *option);
+
+ /** Filters a buffer thru a named filter
+ * @param filterName
+ * @param text buffer to filter
+ * @param key context key if filter needs this for processing
+ * @param module context module if filter needs this for processing
+ * @return error status
+ */
+ virtual char filterText(const char *filterName, SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+
+ /**
+ * Sets the cipher key for the given module. This function updates the key
+ * at runtime, but it does not write to the config file.
+ * To write the new unlock key to the config file use code like this:
+ *
+ * @code
+ * SectionMap::iterator section;
+ * ConfigEntMap::iterator entry;
+ * DIR *dir = opendir(configPath);
+ * struct dirent *ent;
+ * char* modFile;
+ * if (dir) { // find and update .conf file
+ * rewinddir(dir);
+ * while ((ent = readdir(dir)))
+ * {
+ * if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, "..")))
+ * {
+ * modFile = m_backend->configPath;
+ * modFile += "/";
+ * modFile += ent->d_name;
+ * SWConfig *myConfig = new SWConfig( modFile );
+ * section = myConfig->Sections.find( m_module->Name() );
+ * if ( section != myConfig->Sections.end() )
+ * {
+ * entry = section->second.find("CipherKey");
+ * if (entry != section->second.end())
+ * {
+ * entry->second = unlockKey;//set cipher key
+ * myConfig->Save();//save config file
+ * }
+ * }
+ * delete myConfig;
+ * }
+ * }
+ * }
+ * closedir(dir);
+ * @endcode
+ *
+ * @param modName For this module we change the unlockKey
+ * @param key This is the new unlck key we use for te module.
+ */
+ virtual signed char setCipherKey(const char *modName, const char *key);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swmodule.h b/include/swmodule.h
new file mode 100644
index 0000000..f1db7e9
--- /dev/null
+++ b/include/swmodule.h
@@ -0,0 +1,673 @@
+/******************************************************************************
+ * swmodule.h - code for base class 'module'. Module is the basis for all
+ * types of modules (e.g. texts, commentaries, maps, lexicons,
+ * etc.)
+ *
+ * $Id: swmodule.h 2093 2007-09-28 19:20:22Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWMODULE_H
+#define SWMODULE_H
+
+#include <swdisp.h>
+#include <listkey.h>
+#include <swconfig.h>
+
+#include <swcacher.h>
+#include <swsearchable.h>
+
+#include <list>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWOptionFilter;
+class SWFilter;
+
+#define SEARCHFLAG_MATCHWHOLEENTRY 4096
+
+#define SWMODULE_OPERATORS \
+ operator const char *() { return RenderText(); } \
+ operator SWKey &() { return *getKey(); } \
+ operator SWKey *() { return getKey(); } \
+ SWModule &operator <<(const char *inbuf) { setEntry(inbuf); return *this; } \
+ SWModule &operator <<(const SWKey *sourceKey) { linkEntry(sourceKey); return *this; } \
+ SWModule &operator -=(int steps) { decrement(steps); return *this; } \
+ SWModule &operator +=(int steps) { increment(steps); return *this; } \
+ SWModule &operator ++(int) { return *this += 1; } \
+ SWModule &operator --(int) { return *this -= 1; } \
+ SWModule &operator =(SW_POSITION p) { setPosition(p); return *this; }
+
+
+typedef std::list < SWFilter * >FilterList;
+typedef std::list < SWOptionFilter * >OptionFilterList;
+typedef std::map < SWBuf, SWBuf, std::less < SWBuf > > AttributeValue;
+typedef std::map < SWBuf, AttributeValue, std::less < SWBuf > > AttributeList;
+typedef std::map < SWBuf, AttributeList, std::less < SWBuf > > AttributeTypeList;
+
+#define SWTextDirection char
+#define SWTextEncoding char
+#define SWTextMarkup char
+
+/**
+ * The class SWModule is the base class for all modules used in Sword.
+ * It provides functions to look up a text passage, to search in the module,
+ * to switch on/off the state of optional things like Strong's numbers or
+ * footnotes.
+ *
+ * SWModule has also functions to write to the data files.
+ */
+
+// TODO: should all SWModule decendents be SWCachers? Only some really
+// cache data. But if we don't do this, then we need another mechanism to
+// check if we are an SWCacher. Maybe make SWModule extend SWObject (which
+// it probably should anyway. But then we need to add all the cheezy
+// heirarchy info to all he decendent classes for our SWDYNAMIC_CAST and
+// then we can see if we implement SWCacher so we know whether or not to add
+// to the yet to be developed cachemgr.
+// Just leave for now. This lets us always able to call module->flush()
+// to manually flush a cache, and doesn't hurt if there is no work done.
+
+class SWDLLEXPORT SWModule : public SWCacher, public SWSearchable {
+
+protected:
+
+ ConfigEntMap ownConfig;
+ ConfigEntMap *config;
+ mutable AttributeTypeList entryAttributes;
+ mutable bool procEntAttr;
+
+ char error;
+ bool skipConsecutiveLinks;
+
+ /** the current key */
+ SWKey *key;
+
+ ListKey listKey;
+ char *modname;
+ char *moddesc;
+ char *modtype;
+ char *modlang;
+
+ char direction;
+ char markup;
+ char encoding;
+
+ /** this module's display object */
+ SWDisplay *disp;
+
+ static SWDisplay rawdisp;
+ SWBuf entryBuf;
+
+ /** filters to be executed to remove all markup (for searches) */
+ FilterList *stripFilters;
+
+ /** filters to be executed immediately upon fileread */
+ FilterList *rawFilters;
+
+ /** filters to be executed to format for display */
+ FilterList *renderFilters;
+
+ /** filters to be executed to change markup to user prefs */
+ OptionFilterList *optionFilters;
+
+ /** filters to be executed to decode text for display */
+ FilterList *encodingFilters;
+
+ int entrySize;
+ mutable long entryIndex; // internal common storage for index
+
+
+public:
+
+ /**
+ * Set this bool to false to terminate the search which is executed by this module (search()).
+ * This is useful for threaded applications to terminate the search from another thread.
+ */
+ bool terminateSearch;
+
+ /** SWModule c-tor
+ *
+ * @param imodname Internal name for module; see also getName()
+ * @param imoddesc Name to display to user for module; see also getDescription()
+ * @param idisp Display object to use for displaying; see also getDisplay()
+ * @param imodtype Type of module (e.g. Biblical Text, Commentary, etc.); see also getType()
+ * @param encoding Encoding of the module (e.g. UTF-8)
+ * @param dir Direction of text flow (e.g. Right to Left for Hebrew)
+ * @param markup Source Markup of the module (e.g. OSIS)
+ * @param modlang Language of the module (e.g. en)
+ */
+ SWModule(const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, char *imodtype = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* modlang = 0);
+
+ /** SWModule d-tor
+ */
+ virtual ~SWModule();
+
+ /** Gets and clears error status
+ *
+ * @return error status
+ */
+ virtual char Error();
+
+ /**
+ * @return True if this module is encoded in Unicode, otherwise returns false.
+ */
+ virtual const bool isUnicode() const { return (encoding == (char)ENC_UTF8 || encoding == (char)ENC_SCSU); }
+
+ // These methods are useful for modules that come from a standard SWORD install (most do).
+ // SWMgr will call setConfig. The user may use getConfig and getConfigEntry (if they
+ // are not comfortable with, or don't wish to use stl maps).
+ virtual void setConfig(ConfigEntMap *config);
+ virtual const ConfigEntMap &getConfig() const { return *config; }
+ virtual const char *getConfigEntry(const char *key) const;
+
+ /**
+ * @return The size of the text entry for the module's current key position.
+ */
+ virtual const int getEntrySize() const { return entrySize; }
+
+ /**
+ * Sets a key to this module for position to a particular record
+ *
+ * @param ikey key with which to set this module
+ * @return error status
+ */
+ virtual char setKey(const SWKey *ikey);
+
+ /**
+ * Sets a key to this module for position to a particular record
+ * @param ikey The SWKey which should be used as new key.
+ * @return Error status
+ */
+ char setKey(const SWKey &ikey) { return setKey(&ikey); }
+ /**
+ * @deprecated Use setKey() instead.
+ */
+ char SetKey(const SWKey *ikey) { return setKey(ikey); }
+ /**
+ * @deprecated Use setKey() instead.
+ */
+ char SetKey(const SWKey &ikey) { return setKey(ikey); }
+ /**
+ * @deprecated Use setKey() instead.
+ */
+ char Key(const SWKey & ikey) { return setKey(ikey); }
+
+ /** Gets the current module key
+ * @return the current key of this module
+ */
+ virtual SWKey *getKey() const;
+ /**
+ * @deprecated Use getKey() instead.
+ */
+ SWKey &Key() const { return *getKey(); }
+
+ /**
+ * Sets/gets module KeyText
+ * @deprecated Use getKeyText/setKey
+ * @param ikeytext Value which to set keytext; [0]-only get
+ * @return pointer to keytext
+ */
+ virtual const char *KeyText(const char *ikeytext = 0) {
+ if (ikeytext) setKey(ikeytext);
+ return *getKey();
+ }
+
+ /**
+ * gets the key text for the module.
+ * do we really need this?
+ */
+
+ virtual const char *getKeyText() const {
+ return *getKey();
+ }
+
+
+ virtual long Index() const { return entryIndex; }
+ virtual long Index(long iindex) { entryIndex = iindex; return entryIndex; }
+
+ /** Calls this module's display object and passes itself
+ *
+ * @return error status
+ */
+ virtual char Display();
+
+ /** Gets display driver
+ *
+ * @return pointer to SWDisplay class for this module
+ */
+ virtual SWDisplay *getDisplay() const;
+
+ /** Sets display driver
+ *
+ * @param idisp pointer to SWDisplay class to assign to this module
+ */
+ virtual void setDisplay(SWDisplay * idisp);
+
+ /**
+ * @deprecated Use get/setDisplay() instead.
+ */
+ SWDisplay *Disp(SWDisplay * idisp = 0) {
+ if (idisp)
+ setDisplay(idisp);
+ return getDisplay();
+ }
+
+ /** Gets module name
+ *
+ * @return pointer to modname
+ */
+ virtual char *Name() const;
+
+ /** Sets module name
+ *
+ * @param imodname Value which to set modname; [0]-only get
+ * @return pointer to modname
+ */
+ virtual char *Name(const char *imodname);
+
+ /** Gets module description
+ *
+ * @return pointer to moddesc
+ */
+ virtual char *Description() const;
+
+ /** Sets module description
+ *
+ * @param imoddesc Value which to set moddesc; [0]-only get
+ * @return pointer to moddesc
+ */
+ virtual char *Description(const char *imoddesc);
+
+ /** Gets module type
+ *
+ * @return pointer to modtype
+ */
+ virtual char *Type() const;
+
+ /** Sets module type
+ *
+ * @param imodtype Value which to set modtype; [0]-only get
+ * @return pointer to modtype
+ */
+ virtual char *Type(const char *imodtype);
+
+ /** Sets/gets module direction
+ *
+ * @param newdir Value which to set direction; [-1]-only get
+ * @return new direction
+ */
+ virtual char Direction(signed char newdir = -1);
+
+ /** Sets/gets module encoding
+ *
+ * @param enc Value which to set encoding; [-1]-only get
+ * @return Encoding
+ */
+ virtual char Encoding(signed char enc = -1);
+
+ /** Sets/gets module markup
+ *
+ * @param markup Vvalue which to set markup; [-1]-only get
+ * @return Markup
+ */
+ virtual char Markup(signed char markup = -1);
+
+ /** Sets/gets module language
+ *
+ * @param imodlang Value which to set modlang; [0]-only get
+ * @return pointer to modlang
+ */
+ virtual char *Lang(const char *imodlang = 0);
+
+
+ // search interface -------------------------------------------------
+
+ /** Searches a module for a string
+ *
+ * @param istr string for which to search
+ * @param searchType type of search to perform
+ * >=0 - regex
+ * -1 - phrase
+ * -2 - multiword
+ * -3 - entryAttrib (eg. Word//Strongs/G1234/)
+ * -4 - Lucene
+ * @param flags options flags for search
+ * @param scope Key containing the scope. VerseKey or ListKey are useful here.
+ * @param justCheckIfSupported if set, don't search,
+ * only tell if this function supports requested search.
+ * @param percent Callback function to get the current search status in %.
+ * @param percentUserData User data that is given to the callback function as parameter.
+ *
+ * @return ListKey set to verses that contain istr
+ */
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0,
+ SWKey * scope = 0,
+ bool * justCheckIfSupported = 0,
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+
+ // for backward compat-- deprecated
+ virtual ListKey &Search(const char *istr, int searchType = 0, int flags = 0,
+ SWKey * scope = 0,
+ bool * justCheckIfSupported = 0,
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0) {
+ return search(istr, searchType, flags, scope, justCheckIfSupported, percent, percentUserData);
+ }
+
+
+ /** Allocates a key of specific type for module
+ * The different reimplementatiosn of SWModule (e.g. SWText) support SWKey implementations, which support special.
+ * This functions returns a SWKey object which works with the current implementation of SWModule. For example for the SWText class it returns a VerseKey object.
+ * @see VerseKey, ListKey, SWText, SWLD, SWCom
+ * @return pointer to allocated key
+ */
+ virtual SWKey *CreateKey();
+
+ /** This function is reimplemented by the different kinds
+ * of module objects
+ * @return the raw module text of the current entry
+ */
+ virtual SWBuf &getRawEntryBuf() = 0;
+
+ virtual const char *getRawEntry() { return getRawEntryBuf().c_str(); }
+
+ // write interface ----------------------------
+ /** Is the module writable? :)
+ * @return yes or no
+ */
+ virtual bool isWritable() { return false; }
+
+ /** Creates a new, empty module
+ * @param path path where to create the new module
+ * @return error
+ */
+ static signed char createModule(const char *path);
+
+ /** Modify the current module entry text - only if module isWritable()
+ */
+ virtual void setEntry(const char *inbuf, long len= -1);
+
+ /** Link the current module entry to another module entry - only if
+ * module isWritable()
+ */
+ virtual void linkEntry(const SWKey *sourceKey);
+
+ /** Delete current module entry - only if module isWritable()
+ */
+ virtual void deleteEntry() {}
+
+ // end write interface ------------------------
+
+ /** Decrements module key a number of entries
+ * @param steps Number of entries to jump backward
+ */
+ virtual void decrement(int steps = 1);
+
+ /** Increments module key a number of entries
+ * @param steps Number of entries to jump forward
+ */
+ virtual void increment(int steps = 1);
+
+ /** Positions this modules to a logical position entry
+ * @param pos position (e.g. TOP, BOTTOM)
+ */
+ virtual void setPosition(SW_POSITION pos);
+
+ /** OptionFilterBuffer a text buffer
+ * @param filters the FilterList of filters to iterate
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void filterBuffer(OptionFilterList *filters, SWBuf &buf, SWKey *key);
+
+ /** FilterBuffer a text buffer
+ * @param filters the FilterList of filters to iterate
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void filterBuffer(FilterList *filters, SWBuf &buf, SWKey *key);
+
+ /** Adds a RenderFilter to this module's renderFilters queue.
+ * Render Filters are called when the module is asked to produce
+ * renderable text.
+ * @param newFilter the filter to add
+ * @return *this
+ */
+ virtual SWModule &AddRenderFilter(SWFilter *newfilter) {
+ renderFilters->push_back(newfilter);
+ return *this;
+ }
+
+ /** Retrieves a container of render filters associated with this
+ * module.
+ * @return container of render filters
+ */
+ virtual const FilterList &getRenderFilters() const {
+ return *renderFilters;
+ }
+
+ /** Removes a RenderFilter from this module's renderFilters queue
+ * @param oldfilter the filter to remove
+ * @return *this
+ */
+ virtual SWModule &RemoveRenderFilter(SWFilter *oldfilter) {
+ renderFilters->remove(oldfilter);
+ return *this;
+ }
+
+ /** Replaces a RenderFilter in this module's renderfilters queue
+ * @param oldfilter the filter to remove
+ * @param newfilter the filter to add in its place
+ * @return *this
+ */
+ virtual SWModule &ReplaceRenderFilter(SWFilter *oldfilter, SWFilter *newfilter) {
+ FilterList::iterator iter;
+ for (iter = renderFilters->begin(); iter != renderFilters->end(); iter++) {
+ if (*iter == oldfilter)
+ *iter = newfilter;
+ }
+ return *this;
+ }
+
+ /** RenderFilter run a buf through this module's Render Filters
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void renderFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(renderFilters, buf, key);
+ }
+
+ /** Adds an EncodingFilter to this module's @see encodingFilters queue.
+ * Encoding Filters are called immediately when the module is read
+ * from data source, to assure we have desired internal data stream
+ * (e.g. UTF-8 for text modules)
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule &AddEncodingFilter(SWFilter *newfilter) {
+ encodingFilters->push_back(newfilter);
+ return *this;
+ }
+
+ /** Removes an EncodingFilter from this module's encodingFilters queue
+ * @param oldfilter the filter to remove
+ * @return *this
+ */
+ virtual SWModule &RemoveEncodingFilter(SWFilter *oldfilter) {
+ encodingFilters->remove(oldfilter);
+ return *this;
+ }
+
+ /** Replaces an EncodingFilter in this module's encodingfilters queue
+ * @param oldfilter the filter to remove
+ * @param newfilter the filter to add in its place
+ * @return *this
+ */
+ virtual SWModule &ReplaceEncodingFilter(SWFilter *oldfilter, SWFilter *newfilter) {
+ FilterList::iterator iter;
+ for (iter = encodingFilters->begin(); iter != encodingFilters->end(); iter++) {
+ if (*iter == oldfilter)
+ *iter = newfilter;
+ }
+ return *this;
+ }
+
+ /** encodingFilter run a buf through this module's Encoding Filters
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void encodingFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(encodingFilters, buf, key);
+ }
+
+ /** Adds a StripFilter to this module's stripFilters queue.
+ * Strip filters are called when a module is asked to render
+ * an entry without any markup (like when searching).
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule &AddStripFilter(SWFilter *newfilter) {
+ stripFilters->push_back(newfilter);
+ return *this;
+ }
+
+ /** Adds a RawFilter to this module's rawFilters queue
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule &AddRawFilter(SWFilter *newfilter) {
+ rawFilters->push_back(newfilter);
+ return *this;
+ }
+
+ /** StripFilter run a buf through this module's Strip Filters
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void stripFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(stripFilters, buf, key);
+ }
+
+
+ /** RawFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void rawFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(rawFilters, buf, key);
+ }
+
+ /** Adds an OptionFilter to this module's optionFilters queue.
+ * Option Filters are used to turn options in the text on
+ * or off, or so some other state (e.g. Strong's Number,
+ * Footnotes, Cross References, etc.)
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule &AddOptionFilter(SWOptionFilter *newfilter) {
+ optionFilters->push_back(newfilter);
+ return *this;
+ }
+
+ /** OptionFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
+ virtual void optionFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(optionFilters, buf, key);
+ }
+
+ /** Produces plain text, without markup, of the current module entry,
+ * or supplied text
+ *
+ * @param buf buf to massage instead of current module entry;
+ * if buf is 0, the current text will be used
+ * @param len max len to process
+ * @return result buffer
+ */
+ virtual const char *StripText(const char *buf = 0, int len = -1);
+
+ /** Produces renderable text of the current module entry or supplied text
+ *
+ * @param buf buffer to massage instead of current module entry;
+ * if buf is 0, the current module position text will be used
+ * @param len max len to process
+ * @param render for internal use
+ * @return result buffer
+ */
+ virtual const char *RenderText(const char *buf = 0, int len = -1, bool render = true);
+
+ /** Produces plain text, without markup, of the module entry at the supplied key
+ * @param tmpKey desired module entry
+ * @return result buffer
+ */
+ virtual const char *StripText(SWKey *tmpKey);
+
+ /** Produces renderable text of the module entry at the supplied key
+ * @param tmpKey key to use to grab text
+ * @return this module's text at specified key location massaged by Render filters
+ */
+ virtual const char *RenderText(SWKey *tmpKey);
+
+ /** Whether or not to only hit one entry when iterating encounters
+ * consecutive links when iterating
+ * @param val = true means only include entry once in iteration
+ */
+ virtual void setSkipConsecutiveLinks(bool val) { skipConsecutiveLinks = val; }
+
+ /** Whether or not to only hit one entry when iterating encounters
+ * consecutive links when iterating
+ */
+ virtual bool getSkipConsecutiveLinks() { return skipConsecutiveLinks; }
+
+ /** Entry Attributes are special data pertaining to the current entry.
+ * To see what Entry Attributes exists for a specific entry of a module,
+ * the example examples/cmdline/lookup.cpp is a good utility which
+ * displays this information. It is also useful as an example of how
+ * to access such.
+ */
+ virtual AttributeTypeList &getEntryAttributes() const { return entryAttributes; }
+
+ /** Processing Entry Attributes can be expensive. This method allows
+ * turning the processing off if they are not desired. Some internal
+ * engine processing turns them off (like searching) temporarily for
+ * optimization.
+ */
+ virtual void processEntryAttributes(bool val) const { procEntAttr = val; }
+
+ /** Whether or not we're processing Entry Attributes
+ */
+ virtual bool isProcessEntryAttributes() const { return procEntAttr; }
+
+ // OPERATORS -----------------------------------------------------------------
+
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+ virtual void deleteSearchFramework();
+ virtual bool hasSearchFramework();
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swobject.h b/include/swobject.h
new file mode 100644
index 0000000..6f60a57
--- /dev/null
+++ b/include/swobject.h
@@ -0,0 +1,65 @@
+/******************************************************************************
+* swobject.h - definition for SWObject used as lowest base class for many
+* SWORD objects
+*
+* $Id: swobject.h 1790 2005-05-03 03:49:04Z scribe $
+*
+* Copyright 2005 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
+
+#ifndef SWOBJECT_H
+#define SWOBJECT_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
+
+/**
+* Class used for SWDYNAMIC_CAST to save the inheritance order.
+*/
+class SWDLLEXPORT SWClass {
+private:
+ const char **descends;
+
+public:
+ SWClass(const char **descends) {
+ this->descends = descends;
+ }
+
+ bool isAssignableFrom(const char *className) const;
+};
+
+/** Base class for major Sword classes.
+* SWObject is the base class for major Sword classes like SWKey.
+* It is used because dynamic_cast is not available on all plattforms supported
+* by Sword. Use SWDYNAMIC_CAST(classname, object) instead of dynamic_cast<classname>(object).
+*/
+class SWObject {
+protected:
+ SWClass * myclass;
+
+public:
+ /** Use this to get the class definition and inheritance order.
+ * @return The class definition of this object
+ */
+ const SWClass *getClass () const {
+ return myclass;
+ }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swoptfilter.h b/include/swoptfilter.h
new file mode 100644
index 0000000..f1b00a6
--- /dev/null
+++ b/include/swoptfilter.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ *
+ * $Id: swoptfilter.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWOPTFILTER_H
+#define SWOPTFILTER_H
+
+#include <swfilter.h>
+#include <swbuf.h>
+#include <list>
+
+SWORD_NAMESPACE_START
+
+/**
+* The type definitoin for option types
+*/
+typedef std::list < SWBuf > StringList;
+
+
+ /** Base class for all option filters.
+ */
+class SWDLLEXPORT SWOptionFilter : public SWFilter {
+protected:
+ SWBuf optionValue;
+ const char *optName;
+ const char *optTip;
+ const StringList *optValues;
+ bool option;
+public:
+
+ SWOptionFilter();
+ SWOptionFilter(const char *oName, const char *oTip, const StringList *oValues);
+ virtual ~SWOptionFilter();
+
+
+ /** gets the name of the option of this filter
+ * @return option name
+ */
+ virtual const char *getOptionName() { return optName; }
+
+ /** gets a short explanation of the option of this filter;
+ * it could be presented to the user in frontend programs
+ * @return option tip/explanation
+ */
+ virtual const char *getOptionTip() { return optTip; }
+
+ /** returns a list of the possible option values
+ *
+ * @return list of option values
+ */
+ virtual StringList getOptionValues() { return *optValues; }
+
+ /** @return The value of the current option.
+ */
+ virtual const char *getOptionValue();
+
+ /** sets the value of the option of this filter,
+ * e.g maybe a strong's filter mioght be set to "on" / "off" -
+ * that would mean to show or not to show the strongs in the text,
+ * see also getOptionValues()
+ * @param ival the new option value
+ */
+ virtual void setOptionValue(const char *ival);
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swsearchable.h b/include/swsearchable.h
new file mode 100644
index 0000000..928352e
--- /dev/null
+++ b/include/swsearchable.h
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * swsearchable.h - definition of class SWSearchable used to provide an
+ * interface for objects that be searched.
+ *
+ * $Id: swsearchable.h 2054 2007-05-25 17:31:39Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWSEARCHABLE_H
+#define SWSEARCHABLE_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class ListKey;
+class SWKey;
+
+/** used to provide an interface for objects that be searched.
+ */
+class SWDLLEXPORT SWSearchable {
+public:
+ SWSearchable();
+ virtual ~SWSearchable();
+
+ /**
+ * This is the default callback function for searching.
+ * This function is a placeholder and does nothing.
+ * You can define your own function for search progress
+ * evaluation, and pass it over to Search().
+ */
+ static void nullPercent(char percent, void *userData);
+
+ // search interface -------------------------------------------------
+
+ /**
+ * Searches a module for a string
+ * @param istr string for which to search
+ * @param searchType type of search to perform
+ * >=0 - regex
+ * -1 - phrase
+ * -2 - multiword
+ * -3 - entryAttrib (eg. Word//Strongs/G1234/)
+ * -4 - Lucene
+ * @param flags options flags for search
+ * @param scope Key containing the scope. VerseKey or ListKey are useful here.
+ * @param justCheckIfSupported if set, don't search,
+ * only tell if this function supports requested search.
+ * @param percent Callback function to get the current search status in %.
+ * @param percentUserData User data that is given to the callback function as parameter.
+ *
+ * @return ListKey set to verses that contain istr
+ */
+
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0,
+ SWKey * scope = 0,
+ bool * justCheckIfSupported = 0,
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0) = 0;
+
+ /**
+ * ask the object to build any indecies it wants for optimal searching
+ */
+ virtual signed char createSearchFramework(
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0); // special search framework
+
+ virtual void deleteSearchFramework();
+
+ /**
+ * was SWORD compiled with code to optimize searching for this driver?
+ */
+ virtual bool hasSearchFramework() { return false; }
+
+ /**
+ * Check if the search is optimally supported (e.g. if index files are
+ * presnt and working)
+ * This function checks whether the search framework may work in the
+ * best way.
+ * @return true if the the search is optimally supported, false if
+ * it's not working in the best way.
+ */
+ virtual bool isSearchOptimallySupported(const char *istr, int searchType, int flags, SWKey *scope);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swtext.h b/include/swtext.h
new file mode 100644
index 0000000..cb8d1d5
--- /dev/null
+++ b/include/swtext.h
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * swtext.h - code for base class 'SWText'. SWText is the basis for all
+ * types of text modules
+ *
+ * $Id: swtext.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWTEXT_H
+#define SWTEXT_H
+
+#include <swmodule.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class VerseKey;
+
+/** The basis for all text modules
+ */
+class SWDLLEXPORT SWText : public SWModule {
+
+ // for conversion if we have been set with a different internal key type
+ mutable VerseKey *tmpVK;
+
+protected:
+ VerseKey &getVerseKey() const;
+
+public:
+ /** Initializes data for instance of SWText
+ */
+ SWText(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0,
+ SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWText();
+ /** Create the correct key (VerseKey) for use with SWText
+ */
+ virtual SWKey *CreateKey();
+
+ virtual long Index() const;
+ virtual long Index(long iindex);
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/swunicod.h b/include/swunicod.h
new file mode 100644
index 0000000..3bf4e95
--- /dev/null
+++ b/include/swunicod.h
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef SWUNICOD_H
+#define SWUNICOD_H
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** Converts a 32-bit unsigned integer UTF-32 value into a UTF-8 encoded 1-6 byte array
+ * @param utf32 the UTF-32 Unicode code point value
+ * @param utf8 pointer to an array of 6 unsigned chars to contain the UTF-8 value
+ * @return utf8
+ */
+unsigned char* UTF32to8 (unsigned long utf32, unsigned char * utf8);
+
+
+/** Converts a UTF-8 encoded 1-6 byte array into a 32-bit unsigned integer UTF-32 value
+ * @param utf8 pointer to an array of 6 unsigned chars containing the UTF-8 value, starting in the utf8[0]
+ * @param utf32 the UTF-32 Unicode code point value
+ * @return utf32
+ */
+unsigned long UTF8to32 (unsigned char * utf8, unsigned long utf32);
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/swversion.h b/include/swversion.h
new file mode 100644
index 0000000..d3c0ab1
--- /dev/null
+++ b/include/swversion.h
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * swversion.h - definition of class SWVersion used to compare version info
+ *
+ * $Id: swversion.h 1763 2005-04-03 23:57:03Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWVERSION_H
+#define SWVERSION_H
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** A basic tool class to handle program version numbers.
+*/
+class SWDLLEXPORT SWVersion {
+ public:
+ /** The different version subnumbers.
+ */
+ int major, minor, minor2, minor3;
+ /**The constructor.
+ * @param version Version string to be parsed.
+ */
+ SWVersion(const char *version = "0.0");
+ /** Compare 2 Versions with each other.
+ * @param vi Version number to compare with.
+ * @return >0:this>vi; 0:this==vi; <0:this<vi
+ */
+ int compare(const SWVersion &vi) const;
+ /** @return The parsed version number text.
+ */
+ const char *getText() const;
+ /** @return The parsed version number text.
+ */
+ operator const char *() const { return getText(); }
+ bool operator>(const SWVersion &vi) const {return (compare(vi) > 0);}
+ bool operator<(const SWVersion &vi) const {return (compare(vi) < 0);}
+ bool operator>=(const SWVersion &vi) const {return (compare(vi) >= 0);}
+ bool operator<=(const SWVersion &vi) const {return (compare(vi) <= 0);}
+ bool operator==(const SWVersion &vi) const {return (compare(vi) == 0);}
+
+ /** Current sword library version.
+ * Use this to check (e.g. at compile time) if the
+ * version of the sword lib is recent enough for your program.
+ */
+ static SWVersion currentVersion;
+};
+
+SWORD_NAMESPACE_END
+#endif
+
diff --git a/include/sysdata.h b/include/sysdata.h
new file mode 100644
index 0000000..58b8083
--- /dev/null
+++ b/include/sysdata.h
@@ -0,0 +1,77 @@
+#ifndef SIZEDTYPES_H
+#define SIZEDTYPES_H
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+#ifdef USE_AUTOTOOLS
+#include "config.h"
+#endif
+
+
+typedef signed char __s8;
+typedef unsigned char __u8;
+
+typedef signed short __s16;
+typedef unsigned short __u16;
+
+typedef signed int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+//typedef __signed__ long long __s64;
+//typedef unsigned long long __u64;
+#endif
+
+
+#define __swap16(x) \
+ ((__u16)( \
+ (((__u16)(x) & (__u16)0x00ffU) << 8) | \
+ (((__u16)(x) & (__u16)0xff00U) >> 8) ))
+
+
+#define __swap32(x) \
+ ((__u32)( \
+ (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
+ (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
+ (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
+ (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
+
+
+#define __swap64(x) \
+ ((__u64)( \
+ (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
+ (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
+ (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
+ (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
+ (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
+ (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
+ (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
+ (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
+
+
+
+
+#ifndef WORDS_BIGENDIAN
+
+#define swordtoarch16(x) (x)
+#define swordtoarch32(x) (x)
+#define swordtoarch64(x) (x)
+#define archtosword16(x) (x)
+#define archtosword32(x) (x)
+#define archtosword64(x) (x)
+
+#else
+
+#define swordtoarch16(x) __swap16(x)
+#define swordtoarch32(x) __swap32(x)
+#define swordtoarch64(x) __swap64(x)
+#define archtosword16(x) __swap16(x)
+#define archtosword32(x) __swap32(x)
+#define archtosword64(x) __swap64(x)
+
+
+#endif
+
+
+#endif
diff --git a/include/teihtmlhref.h b/include/teihtmlhref.h
new file mode 100644
index 0000000..302c38e
--- /dev/null
+++ b/include/teihtmlhref.h
@@ -0,0 +1,51 @@
+/******************************************************************************
+ *
+ * $Id:
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef TEIHTMLHREF_H
+#define TEIHTMLHREF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts TEI text to HTMLHREF text
+ */
+class SWDLLEXPORT TEIHTMLHREF : public SWBasicFilter {
+private:
+
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ bool BiblicalText;
+ SWBuf lastHi;
+
+ SWBuf version;
+ MyUserData(const SWModule *module, const SWKey *key);
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ TEIHTMLHREF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/teiplain.h b/include/teiplain.h
new file mode 100644
index 0000000..b0fe06d
--- /dev/null
+++ b/include/teiplain.h
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
+ * $Id:
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef TEIPLAIN_H
+#define TEIPLAIN_H
+
+#include <swbasicfilter.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts TEI text to plain text
+ */
+class SWDLLEXPORT TEIPlain : public SWBasicFilter {
+public:
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ SWBuf w;
+ XMLTag tag;
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ TEIPlain();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/teirtf.h b/include/teirtf.h
new file mode 100644
index 0000000..9c115e4
--- /dev/null
+++ b/include/teirtf.h
@@ -0,0 +1,50 @@
+/******************************************************************************
+ *
+ * $Id:
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef TEIRTF_H
+#define TEIRTF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts TEI text to RTF text
+ */
+class SWDLLEXPORT TEIRTF : public SWBasicFilter {
+private:
+
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ bool BiblicalText;
+ SWBuf w;
+ SWBuf version;
+ MyUserData(const SWModule *module, const SWKey *key);
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ TEIRTF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlfootnotes.h b/include/thmlfootnotes.h
new file mode 100644
index 0000000..6106b13
--- /dev/null
+++ b/include/thmlfootnotes.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlfootnotes.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLFOOTNOTES_H
+#define THMLFOOTNOTES_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides footnotes in a ThML text
+ */
+class SWDLLEXPORT ThMLFootnotes : public SWOptionFilter {
+public:
+ ThMLFootnotes();
+ virtual ~ThMLFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlgbf.h b/include/thmlgbf.h
new file mode 100644
index 0000000..0975a24
--- /dev/null
+++ b/include/thmlgbf.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlgbf.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLGBF_H
+#define THMLGBF_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to GBF text
+ */
+class SWDLLEXPORT ThMLGBF : public SWFilter {
+protected:
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+public:
+ ThMLGBF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlheadings.h b/include/thmlheadings.h
new file mode 100644
index 0000000..18aadc5
--- /dev/null
+++ b/include/thmlheadings.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlheadings.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLHEADINGS_H
+#define THMLHEADINGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a ThML text
+ */
+class SWDLLEXPORT ThMLHeadings : public SWOptionFilter {
+public:
+ ThMLHeadings();
+ virtual ~ThMLHeadings();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlhtml.h b/include/thmlhtml.h
new file mode 100644
index 0000000..26871a6
--- /dev/null
+++ b/include/thmlhtml.h
@@ -0,0 +1,46 @@
+/******************************************************************************
+ *
+ * $Id: thmlhtml.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLHTML_H
+#define THMLHTML_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to HTML text
+ */
+class SWDLLEXPORT ThMLHTML : public SWBasicFilter {
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ bool SecHead;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ ThMLHTML();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlhtmlhref.h b/include/thmlhtmlhref.h
new file mode 100644
index 0000000..2f91fcd
--- /dev/null
+++ b/include/thmlhtmlhref.h
@@ -0,0 +1,53 @@
+/******************************************************************************
+ *
+ * $Id: thmlhtmlhref.h 2157 2008-05-13 23:37:56Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef _THMLHTMLHREF_H
+#define _THMLHTMLHREF_H
+
+#include <swbasicfilter.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to HTML text with hrefs
+ */
+class SWDLLEXPORT ThMLHTMLHREF : public SWBasicFilter {
+ SWBuf imgPrefix;
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key);//: BasicFilterUserData(module, key) {}
+ bool inscriptRef;
+ bool SecHead;
+ bool BiblicalText;
+ SWBuf version;
+ XMLTag startTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ ThMLHTMLHREF();
+ virtual const char *getImagePrefix() { return imgPrefix.c_str(); }
+ virtual void setImagePrefix(const char *newImgPrefix) { imgPrefix = newImgPrefix; }
+};
+SWORD_NAMESPACE_END
+#endif /* _THMLHTMLHREF_H */
diff --git a/include/thmllemma.h b/include/thmllemma.h
new file mode 100644
index 0000000..40a056a
--- /dev/null
+++ b/include/thmllemma.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmllemma.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLLEMMA_H
+#define THMLLEMMA_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides lemmas in a ThML text
+ */
+class SWDLLEXPORT ThMLLemma : public SWOptionFilter {
+public:
+ ThMLLemma();
+ virtual ~ThMLLemma();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlmorph.h b/include/thmlmorph.h
new file mode 100644
index 0000000..66e55bd
--- /dev/null
+++ b/include/thmlmorph.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlmorph.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLMORPH_H
+#define THMLMORPH_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides morph tags in a ThML text
+ */
+class SWDLLEXPORT ThMLMorph : public SWOptionFilter {
+public:
+ ThMLMorph();
+ virtual ~ThMLMorph();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlosis.h b/include/thmlosis.h
new file mode 100644
index 0000000..c3a2a13
--- /dev/null
+++ b/include/thmlosis.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlosis.h 1804 2005-05-07 06:26:10Z scribe $
+ *
+ * Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLOSIS_H
+#define THMLOSIS_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to OSIS text
+ */
+class SWDLLEXPORT ThMLOSIS : public SWFilter {
+public:
+ ThMLOSIS();
+ virtual ~ThMLOSIS();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif /* THMLOSIS_H */
diff --git a/include/thmlplain.h b/include/thmlplain.h
new file mode 100644
index 0000000..499dbf6
--- /dev/null
+++ b/include/thmlplain.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * $Id: thmlplain.h 2068 2007-08-31 06:40:23Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLPLAIN_H
+#define THMLPLAIN_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to plain text
+ */
+class SWDLLEXPORT ThMLPlain : public SWFilter {
+public:
+ ThMLPlain();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlrtf.h b/include/thmlrtf.h
new file mode 100644
index 0000000..dfeecb2
--- /dev/null
+++ b/include/thmlrtf.h
@@ -0,0 +1,51 @@
+/******************************************************************************
+ *
+ * $Id: thmlrtf.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLRTF_H
+#define THMLRTF_H
+
+#include <swbasicfilter.h>
+#include <utilxml.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to RTF text
+ */
+class SWDLLEXPORT ThMLRTF : public SWBasicFilter {
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key);
+ bool SecHead;
+ SWBuf version;
+ bool BiblicalText;
+ XMLTag startTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+public:
+ ThMLRTF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlscripref.h b/include/thmlscripref.h
new file mode 100644
index 0000000..58b4820
--- /dev/null
+++ b/include/thmlscripref.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlscripref.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLSCRIPREF_H
+#define THMLSCRIPREF_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides scripture references in a ThML text
+ */
+class SWDLLEXPORT ThMLScripref : public SWOptionFilter {
+public:
+ ThMLScripref();
+ virtual ~ThMLScripref();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlstrongs.h b/include/thmlstrongs.h
new file mode 100644
index 0000000..dfb97b3
--- /dev/null
+++ b/include/thmlstrongs.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: thmlstrongs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLSTRONGS_H
+#define THMLSTRONGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides strong's numbers in a ThML text
+ */
+class SWDLLEXPORT ThMLStrongs : public SWOptionFilter {
+public:
+ ThMLStrongs();
+ virtual ~ThMLStrongs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlvariants.h b/include/thmlvariants.h
new file mode 100644
index 0000000..9adda8c
--- /dev/null
+++ b/include/thmlvariants.h
@@ -0,0 +1,53 @@
+/******************************************************************************
+ *
+ * $Id: thmlvariants.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLVARIANTS_H
+#define THMLVARIANTS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides textual variants
+ */
+class SWDLLEXPORT ThMLVariants : public SWOptionFilter {
+ char option;
+
+ static const char primary[];
+ static const char secondary[];
+ static const char all[];
+
+ static const char optName[];
+ static const char optTip[];
+ StringList options;
+
+public:
+ ThMLVariants();
+ virtual ~ThMLVariants();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ virtual const char *getOptionName() { return optName; }
+ virtual const char *getOptionTip() { return optTip; }
+ virtual void setOptionValue(const char *ival);
+ virtual const char *getOptionValue();
+ virtual StringList getOptionValues() { return options; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlwebif.h b/include/thmlwebif.h
new file mode 100644
index 0000000..25201d7
--- /dev/null
+++ b/include/thmlwebif.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ *
+ * $Id: thmlwebif.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef _ThMLWEBIF_H
+#define _ThMLWEBIF_H
+
+#include <thmlhtmlhref.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to HTML text with hrefs
+ */
+class SWDLLEXPORT ThMLWEBIF : public ThMLHTMLHREF {
+ const SWBuf baseURL;
+ const SWBuf passageStudyURL;
+
+protected:
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ ThMLWEBIF();
+};
+SWORD_NAMESPACE_END
+#endif /* _ThMLWEBIF_H */
diff --git a/include/thmlwordjs.h b/include/thmlwordjs.h
new file mode 100644
index 0000000..9d7b83d
--- /dev/null
+++ b/include/thmlwordjs.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ *
+ * $Id: thmlstrongs.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLWORDSJS_H
+#define THMLWORDSJS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+class SWMgr;
+ /** This Filter shows/hides strong's numbers in a ThML text
+ */
+class SWDLLEXPORT ThMLWordJS : public SWOptionFilter {
+ SWModule *defaultGreekLex;
+ SWModule *defaultHebLex;
+ SWModule *defaultGreekParse;
+ SWModule *defaultHebParse;
+ SWMgr *mgr;
+
+public:
+ ThMLWordJS();
+ virtual ~ThMLWordJS();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ void setDefaultModules(SWModule *defaultGreekLex = 0, SWModule *defaultHebLex = 0, SWModule *defaultGreekParse = 0, SWModule *defaultHebParse = 0) {
+ this->defaultGreekLex = defaultGreekLex;
+ this->defaultHebLex = defaultHebLex;
+ this->defaultGreekParse = defaultGreekParse;
+ this->defaultHebParse = defaultHebParse;
+ }
+ void setMgr(SWMgr *mgr) { this->mgr = mgr; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/treekey.h b/include/treekey.h
new file mode 100644
index 0000000..1e7c773
--- /dev/null
+++ b/include/treekey.h
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * versekey.h - code for class 'versekey'- a standard Biblical verse key
+ *
+ * $Id: treekey.h 1958 2006-08-22 00:15:10Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef TREEKEY_H
+#define TREEKEY_H
+
+#include <swkey.h>
+#include <swbuf.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+/**
+ * Class TreeKey
+ * The base class for all tree-based key implementations in Sword.
+ */
+class SWDLLEXPORT TreeKey : public SWKey {
+ static SWClass classdef;
+ void init();
+
+protected:
+ // hold on to setText until we've done a snap action: getText or navigation
+ // if we set, and then write out userData, we want to assure the path exists.
+ // This better conforms to the SWORD write methodology: mod.setKey, mod.setEntry
+ mutable SWBuf unsnappedKeyText;
+
+public:
+// TreeKey (const char *ikey = 0);
+// TreeKey (const SWKey * ikey);
+// TreeKey (TreeKey const &k);
+ TreeKey () { init(); };
+ ~TreeKey () {};
+
+
+ virtual const char *getLocalName() = 0;
+ virtual const char *setLocalName(const char *) = 0;
+
+ virtual const char *getUserData(int *size = 0) = 0;
+ virtual void setUserData(const char *userData, int size = 0) = 0;
+
+ /** Go to the root node
+ */
+ virtual void root() = 0;
+
+ /** Go to the parent of the current node
+ * @return success or failure
+ */
+ virtual bool parent() = 0;
+
+ /** Go to the first child of the current node
+ * @return success or failure
+ */
+ virtual bool firstChild() = 0;
+
+ /** Go to the next sibling of the current node
+ * @return success or failure
+ */
+ virtual bool nextSibling() = 0;
+
+ /** Go to the previous sibling of the current node
+ * @return success or failure
+ */
+ virtual bool previousSibling() = 0;
+
+ /** Does the current node have children?
+ * @return whether or not it does
+ */
+ virtual bool hasChildren() = 0;
+
+ virtual void append() = 0;
+ virtual void appendChild() = 0;
+ virtual void insertBefore() = 0;
+
+ virtual void remove() = 0;
+
+
+ virtual void setOffset(unsigned long offset) = 0;
+ virtual unsigned long getOffset() const = 0;
+
+ virtual void setText(const char *ikey) = 0;
+ virtual void setPosition(SW_POSITION p) = 0;
+ virtual const char *getText() const = 0;
+ virtual int compare(const SWKey &ikey) = 0;
+ virtual void decrement(int steps = 1) = 0;
+ virtual void increment(int steps = 1) = 0;
+ virtual bool isTraversable() const { return true; }
+ virtual long Index() const { return getOffset(); }
+ virtual long Index(long iindex) { setOffset(iindex); return getOffset(); }
+
+ /** Set the key to this path. If the path doesn't exist, then
+ * nodes are created as necessary
+ * @keyPath = path to set/create; if unsupplied, then use any unsnapped setText value.
+ */
+ virtual void assureKeyPath(const char *keyPath = 0);
+ virtual void save() {}
+
+ SWKEY_OPERATORS
+
+ };
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/treekeyidx.h b/include/treekeyidx.h
new file mode 100644
index 0000000..4a9fc99
--- /dev/null
+++ b/include/treekeyidx.h
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * versekey.h - code for class 'versekey'- a standard Biblical verse key
+ *
+ * $Id: treekeyidx.h 2009 2006-11-25 21:24:43Z dglassey $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef TREEKEYIDX_H
+#define TREEKEYIDX_H
+
+#include <treekey.h>
+#include <sysdata.h>
+
+SWORD_NAMESPACE_START
+
+class FileDesc;
+
+/**
+ * Class TreeKeyIdx
+ * The TreeKey implementation used for all tree-based modules in Sword, such as GenBooks.
+ */
+class SWDLLEXPORT TreeKeyIdx : public TreeKey {
+
+ class TreeNode {
+ public:
+ TreeNode();
+ ~TreeNode();
+ void clear();
+ __s32 offset;
+ __s32 parent;
+ __s32 next;
+ __s32 firstChild;
+ char *name;
+ __u16 dsize;
+ char *userData;
+ } currentNode;
+
+ static SWClass classdef;
+
+ char *path;
+
+ FileDesc *idxfd;
+ FileDesc *datfd;
+
+ void getTreeNodeFromDatOffset(long ioffset, TreeNode *buf) const;
+ char getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const;
+ void saveTreeNode(TreeNode *node);
+ void saveTreeNodeOffsets(TreeNode *node);
+ void init();
+
+public:
+ TreeKeyIdx(const TreeKeyIdx &ikey);
+ TreeKeyIdx (const char *idxPath, int fileMode = -1);
+ ~TreeKeyIdx ();
+
+ virtual SWKey *clone() const;
+
+ virtual const char *getLocalName();
+ virtual const char *setLocalName(const char *);
+
+ virtual const char *getUserData(int *size = 0);
+ virtual void setUserData(const char *userData, int size = 0);
+
+ virtual void root();
+ virtual bool parent();
+
+ virtual bool firstChild();
+ virtual bool nextSibling();
+ virtual bool previousSibling();
+
+ virtual bool hasChildren();
+
+ virtual void append();
+ virtual void appendChild();
+ virtual void insertBefore();
+
+ virtual void remove();
+ virtual void save();
+
+ virtual void copyFrom(const TreeKeyIdx &ikey);
+ virtual void copyFrom(const SWKey &ikey);
+
+ void setOffset(unsigned long offset);
+ unsigned long getOffset() const;
+
+
+ // OPERATORS ------------------------------------------------------------
+
+
+ virtual SWKey &operator = (const TreeKeyIdx &ikey) { copyFrom(ikey); return *this; }
+ SWKEY_OPERATORS
+
+ virtual void setText(const char *ikey);
+ virtual void setPosition(SW_POSITION p);
+ virtual const char *getText() const;
+ virtual int _compare (const TreeKeyIdx & ikey);
+ virtual int compare(const SWKey &ikey);
+ virtual void decrement(int steps = 1);
+ virtual void increment(int steps = 1);
+ virtual bool isTraversable() const { return true; }
+
+ static signed char create(const char *path);
+};
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/unicodertf.h b/include/unicodertf.h
new file mode 100644
index 0000000..ace8b05
--- /dev/null
+++ b/include/unicodertf.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * $Id: unicodertf.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UNICODERTF_H
+#define UNICODERTF_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts UTF-8 text into RTF Unicode tags
+ */
+class SWDLLEXPORT UnicodeRTF : public SWFilter {
+public:
+ UnicodeRTF();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/untgz.h b/include/untgz.h
new file mode 100644
index 0000000..24ac8cf
--- /dev/null
+++ b/include/untgz.h
@@ -0,0 +1,10 @@
+#ifndef UNTGZ_H
+#define UNTGZ_H
+
+#include "zlib.h"
+
+int untargz(int fd, const char *dest);
+int untar(gzFile in, const char *dest);
+
+#endif
+
diff --git a/include/url.h b/include/url.h
new file mode 100644
index 0000000..c57ace0
--- /dev/null
+++ b/include/url.h
@@ -0,0 +1,93 @@
+/******************************************************************************
+* url.h - code for an URL parser utility class
+*
+* $Id: url.h 1763 2005-04-03 23:57:03Z scribe $
+*
+* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
+
+#ifndef URL_H
+#define URL_H
+
+#include <swbuf.h>
+#include <map>
+
+SWORD_NAMESPACE_START
+
+/** URL provides URL parsing
+ * The URL class provides an interface to work on the data of an URL like "http://www.crosswire.org/index.jsp?page=test&amp;user=nobody"
+ */
+class SWDLLEXPORT URL {
+public:
+ typedef std::map<SWBuf, SWBuf> ParameterMap;
+
+ /** Constructor.
+ * @param url The url string which should be parsed into protocol, hostname, path and paramters
+ */
+ URL(const char *url);
+
+ /** Get the protocol.
+ * @return The protocol, e.g. "http" for an url like "http://www.crosswire.org/index.jsp?page=help"
+ */
+ const char *getProtocol() const;
+ /** Get the hostname
+ * @return The hostname, e.g. "www.crosswire.org" for an url like "http://www.crosswire.org/index.jsp?page=help"
+ */
+ const char *getHostName() const;
+ /** Get the path
+ * @return The path, e.g. "/index.jsp" for an url like "http://www.crosswire.org/index.jsp?page=help"
+ */
+ const char *getPath() const;
+
+ /** All available paramters
+ * @return The map which contains the parameters and their values
+ */
+ const ParameterMap &getParameters() const;
+
+ /**
+ * Returns the value of an URL parameter. For the URL "http://www.crosswire.org/index.jsp?page=test&amp;user=nobody" the value of the parameter "page" would be "test".
+ * If the parameter is not set an empty string is returned.
+ * @param name The name of the paramter.
+ * @return The value of the given paramter of an empty string if the name could not be found in the list of available paramters
+ */
+ const char *getParameterValue(const char *name) const;
+
+ /** Encodes and URL
+ * Encodes a string into a valid URL, e.g. changes http://www.crosswire.org/test.jsp?force=1&help=1 into
+ * http://www.crosswire.org/test.jsp?force=1&amp;help=1
+ * This function works on the data of the buf parameter.
+ *
+ * WARNING: It doesn't check if the URL is encoded already, so http://www.crosswire.org/test.jsp?force=1&amp;help=1 becomes http://www.crosswire.org/test.jsp?force=1&amp;amp;help=1
+ */
+ static const SWBuf encode(const char *urlText);
+ static const SWBuf decode(const char *encodedText);
+
+private:
+ /** Parse
+ * Parse the URL into protocol, hostname, path, page and paramters
+ */
+ void parse();
+
+ SWBuf url;
+ SWBuf protocol;
+ SWBuf hostname;
+ SWBuf path;
+ ParameterMap parameterMap;
+};
+
+SWORD_NAMESPACE_END
+
+#endif //URL_H
diff --git a/include/utf16utf8.h b/include/utf16utf8.h
new file mode 100644
index 0000000..ed17116
--- /dev/null
+++ b/include/utf16utf8.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * $Id: utf16utf8.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF16UTF8_H
+#define UTF16UTF8_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts UTF-16 encoded text to UTF-8
+ */
+class SWDLLEXPORT UTF16UTF8 : public SWFilter {
+public:
+ UTF16UTF8();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8arshaping.h b/include/utf8arshaping.h
new file mode 100644
index 0000000..047b02f
--- /dev/null
+++ b/include/utf8arshaping.h
@@ -0,0 +1,49 @@
+/******************************************************************************
+ *
+ * $Id: utf8arshaping.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8ARSHAPING_H
+#define UTF8ARSHAPING_H
+
+#include <swfilter.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/uchar.h>
+#include <unicode/ushape.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter controls the arabic shaping of UTF-8 text
+ * FIXME: is that correct? how to control it?
+ */
+class SWDLLEXPORT UTF8arShaping : public SWFilter {
+private:
+ UConverter* conv;
+ UErrorCode err;
+public:
+ UTF8arShaping();
+ ~UTF8arShaping();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
+
+
diff --git a/include/utf8bidireorder.h b/include/utf8bidireorder.h
new file mode 100644
index 0000000..a673920
--- /dev/null
+++ b/include/utf8bidireorder.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ *
+ * $Id: utf8bidireorder.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8BIDIREORDER_H
+#define UTF8BIDIREORDER_H
+
+#include <swfilter.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/uchar.h>
+#include <unicode/ubidi.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter reorders UTF-8 text according to Unicode BiDi
+ */
+class SWDLLEXPORT UTF8BiDiReorder : public SWFilter {
+private:
+ UConverter* conv;
+ UErrorCode err;
+public:
+ UTF8BiDiReorder();
+ ~UTF8BiDiReorder();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
+
diff --git a/include/utf8cantillation.h b/include/utf8cantillation.h
new file mode 100644
index 0000000..c268655
--- /dev/null
+++ b/include/utf8cantillation.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: utf8cantillation.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8CANTILLATION_H
+#define UTF8CANTILLATION_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This Filter shows/hides Hebrew cantillation marks in UTF8 text
+ */
+class SWDLLEXPORT UTF8Cantillation : public SWOptionFilter {
+public:
+ UTF8Cantillation();
+ virtual ~UTF8Cantillation();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8greekaccents.h b/include/utf8greekaccents.h
new file mode 100644
index 0000000..847fd5c
--- /dev/null
+++ b/include/utf8greekaccents.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: utf8greekaccents.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8GREEKACCENTS_H
+#define UTF8GREEKACCENTS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This Filter shows/hides Greek Accents marks in UTF8 text
+ */
+class SWDLLEXPORT UTF8GreekAccents : public SWOptionFilter {
+public:
+ UTF8GreekAccents();
+ virtual ~UTF8GreekAccents();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8hebrewpoints.h b/include/utf8hebrewpoints.h
new file mode 100644
index 0000000..d3cc70b
--- /dev/null
+++ b/include/utf8hebrewpoints.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: utf8hebrewpoints.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8HEBREWPOINTS_H
+#define UTF8HEBREWPOINTS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides Hebrew vowel points in UTF8 text
+ */
+class SWDLLEXPORT UTF8HebrewPoints : public SWOptionFilter {
+public:
+ UTF8HebrewPoints();
+ virtual ~UTF8HebrewPoints();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8html.h b/include/utf8html.h
new file mode 100644
index 0000000..ee7d07e
--- /dev/null
+++ b/include/utf8html.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * $Id: utf8html.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8HTML_H
+#define UTF8HTML_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts UTF-8 text into HTML escape sequences
+ */
+class SWDLLEXPORT UTF8HTML : public SWFilter {
+public:
+ UTF8HTML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8latin1.h b/include/utf8latin1.h
new file mode 100644
index 0000000..5b3c544
--- /dev/null
+++ b/include/utf8latin1.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: utf8latin1.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8Latin1_H
+#define UTF8Latin1_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts UTF-8 encoded text to Latin-1
+ */
+class SWDLLEXPORT UTF8Latin1 : public SWFilter {
+ char replacementChar;
+public:
+ UTF8Latin1(char rchar = '?');
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8nfc.h b/include/utf8nfc.h
new file mode 100644
index 0000000..b91fe37
--- /dev/null
+++ b/include/utf8nfc.h
@@ -0,0 +1,45 @@
+/******************************************************************************
+ *
+ * $Id: utf8nfc.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8NFC_H
+#define UTF8NFC_H
+
+#include <swfilter.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/uchar.h>
+#include <unicode/unorm.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT UTF8NFC : public SWFilter {
+private:
+ UConverter* conv;
+ UChar *source, *target;
+ UErrorCode err;
+public:
+ UTF8NFC();
+ ~UTF8NFC();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8nfkd.h b/include/utf8nfkd.h
new file mode 100644
index 0000000..70a33e5
--- /dev/null
+++ b/include/utf8nfkd.h
@@ -0,0 +1,45 @@
+/******************************************************************************
+ *
+ * $Id: utf8nfkd.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8NFKD_H
+#define UTF8NFKD_H
+
+#include <swfilter.h>
+
+#include <unicode/utypes.h>
+#include <unicode/ucnv.h>
+#include <unicode/uchar.h>
+#include <unicode/unorm.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT UTF8NFKD : public SWFilter {
+private:
+ UConverter* conv;
+ UChar *source, *target;
+ UErrorCode err;
+public:
+ UTF8NFKD();
+ ~UTF8NFKD();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8transliterator.h b/include/utf8transliterator.h
new file mode 100644
index 0000000..d539ac3
--- /dev/null
+++ b/include/utf8transliterator.h
@@ -0,0 +1,87 @@
+/******************************************************************************
+ *
+ * $Id: utf8transliterator.h 2088 2007-09-26 23:42:44Z chrislit $
+ *
+ * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8TRANSLITERATOR_H
+#define UTF8TRANSLITERATOR_H
+
+enum scriptEnum {SE_OFF, SE_LATIN, /*one-way (to) transliterators*/ SE_IPA, SE_BASICLATIN, SE_SBL, SE_TC, SE_BETA, SE_BGREEK, SE_SERA, SE_HUGOYE, SE_UNGEGN, SE_ISO, SE_ALALC, SE_BGNPCGN, /*two-way transliterators*/ SE_GREEK, SE_HEBREW, SE_CYRILLIC, SE_ARABIC, SE_SYRIAC, SE_KATAKANA, SE_HIRAGANA, SE_HANGUL, SE_DEVANAGARI, SE_TAMIL, SE_BENGALI, SE_GURMUKHI, SE_GUJARATI, SE_ORIYA, SE_TELUGU, SE_KANNADA, SE_MALAYALAM, SE_THAI, SE_GEORGIAN, SE_ARMENIAN, SE_ETHIOPIC, SE_GOTHIC, SE_UGARITIC, SE_COPTIC, SE_MEROITIC, SE_LINEARB, SE_CYPRIOT, SE_RUNIC, SE_OGHAM, SE_THAANA, SE_GLAGOLITIC, /*SE_TENGWAR, SE_CIRTH,*/ /*one-way (from) transliterators*/ SE_JAMO, SE_HAN, SE_KANJI};
+#define NUMSCRIPTS 48
+#define NUMTARGETSCRIPTS NUMSCRIPTS-3//6
+
+#include <swoptfilter.h>
+
+#include <unicode/unistr.h>
+
+#include <unicode/translit.h>
+
+#include <defs.h>
+#include <map>
+
+SWORD_NAMESPACE_START
+
+class SWModule;
+
+struct SWTransData {
+ UnicodeString resource;
+ UTransDirection dir;
+};
+typedef std::map<const UnicodeString, SWTransData> SWTransMap;
+typedef std::pair<UnicodeString, SWTransData> SWTransPair;
+
+// Chris, please add more javadoc-style documentation in this header file
+// so that the information will show up in the doxygen-generated
+// api-docs.
+
+/** This Filter uses ICU for transliteration
+*/
+class SWDLLEXPORT UTF8Transliterator : public SWOptionFilter {
+private:
+
+ unsigned char option;
+
+ static const char optionstring[NUMTARGETSCRIPTS][16];
+
+ static const char optName[];
+ static const char optTip[];
+ static const char SW_RB_RULE_BASED_IDS[];
+ static const char SW_RB_RULE[];
+ static const char SW_RESDATA[];
+ StringList options;
+ static SWTransMap transMap;
+ UErrorCode utf8status;
+
+ void Load(UErrorCode &status);
+ void registerTrans(const UnicodeString& ID, const UnicodeString& resource, UTransDirection dir, UErrorCode &status);
+ bool addTrans(const char* newTrans, SWBuf* transList);
+ bool checkTrans(const UnicodeString& ID, UErrorCode &status);
+ Transliterator *createTrans(const UnicodeString& ID, UTransDirection dir, UErrorCode &status);
+
+public:
+ UTF8Transliterator();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ virtual const char *getOptionName() { return optName; }
+ virtual const char *getOptionTip() { return optTip; }
+ virtual void setOptionValue(const char *ival);
+ virtual const char *getOptionValue();
+ virtual StringList getOptionValues() { return options; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utf8utf16.h b/include/utf8utf16.h
new file mode 100644
index 0000000..0c51bea
--- /dev/null
+++ b/include/utf8utf16.h
@@ -0,0 +1,37 @@
+/******************************************************************************
+ *
+ * $Id: utf8utf16.h 1688 2005-01-01 04:42:26Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTF8UTF16_H
+#define UTF8UTF16_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This filter converts UTF-8 encoded text to UTF-16
+ */
+class SWDLLEXPORT UTF8UTF16 : public SWFilter {
+public:
+ UTF8UTF16();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utilstr.h b/include/utilstr.h
new file mode 100644
index 0000000..2e3a65e
--- /dev/null
+++ b/include/utilstr.h
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * utilstr.h - prototypes for string utility functions
+ *
+ * $Id: utilstr.h 2062 2007-07-19 17:27:31Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTILSTR_H
+#define UTILSTR_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+/** stdstr - clone a string
+*/
+char *stdstr (char **iistr, const char *istr, unsigned int memPadFactor = 1);
+char *strstrip (char *istr);
+const char *stristr (const char *s1, const char *s2);
+int strnicmp(const char *s1, const char *s2, int len);
+int stricmp(const char *s1, const char *s2);
+
+/******************************************************************************
+ * SW_toupper - array of uppercase values for any given Latin-1 value
+ *
+ * use this instead of toupper() for fast lookups on accented characters
+ */
+extern const unsigned char SW_toupper_array[256];
+#define SW_toupper(c) SW_toupper_array[(unsigned char)c]
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/utilxml.h b/include/utilxml.h
new file mode 100644
index 0000000..dc5e9d8
--- /dev/null
+++ b/include/utilxml.h
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * utilxml.h - definition of class that deal with xml constructs
+ *
+ * $Id: utilxml.h 2096 2007-10-07 00:40:00Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTILXML_H
+#define UTILXML_H
+
+#include <defs.h>
+#include <swbuf.h>
+#include <list>
+#include <map>
+
+SWORD_NAMESPACE_START
+
+typedef std::map<SWBuf, SWBuf> StringPairMap;
+typedef std::list<SWBuf> StringList;
+
+/** Simple XML helper class.
+*/
+class SWDLLEXPORT XMLTag {
+private:
+ mutable char *buf;
+ char *name;
+ mutable bool parsed;
+ mutable bool empty;
+ mutable bool endTag;
+ mutable StringPairMap attributes;
+ mutable SWBuf junkBuf;
+
+ void parse() const;
+ const char *getPart(const char *buf, int partNum = 0, char partSplit = '|') const;
+ static const char *nullstr;
+
+public:
+ XMLTag(const char *tagString = 0);
+ ~XMLTag();
+
+ void setText(const char *tagString);
+ inline const char *getName() const { return (name)?name:nullstr; }
+
+ inline bool isEmpty() const {
+ if (!parsed)
+ parse();
+
+ return empty;
+ }
+ inline void setEmpty(bool value) {
+ if (!parsed)
+ parse();
+ empty = value;
+ if (value)
+ endTag = false;
+ }
+
+ inline bool isEndTag() const { return endTag; }
+
+ const StringList getAttributeNames() const;
+ int getAttributePartCount(const char *attribName, char partSplit = '|') const;
+
+ // return values should not be considered to persist beyond the return of the function.
+ const char *getAttribute(const char *attribName, int partNum = -1, char partSplit = '|') const;
+ const char *setAttribute(const char *attribName, const char *attribValue, int partNum = -1, char partSplit = '|');
+ const char *toString() const;
+ inline operator const char *() const { return toString(); }
+ inline XMLTag & operator =(const char *tagString) { setText(tagString); return *this; }
+ inline XMLTag & operator =(const XMLTag &other) { setText(other.toString()); return *this; }
+};
+
+SWORD_NAMESPACE_END
+#endif
+
diff --git a/include/versekey.h b/include/versekey.h
new file mode 100644
index 0000000..42127bf
--- /dev/null
+++ b/include/versekey.h
@@ -0,0 +1,444 @@
+/******************************************************************************
+ * versekey.h - code for class 'versekey'- a standard Biblical verse key
+ *
+ * $Id: versekey.h 2169 2008-05-18 02:50:53Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef VERSEKEY_H
+#define VERSEKEY_H
+
+#include <swkey.h>
+#include <swmacs.h>
+#include <listkey.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+#define POS_MAXVERSE ((char)3)
+#define POS_MAXCHAPTER ((char)4)
+#define POS_MAXBOOK ((char)5)
+
+#define MAXVERSE SW_POSITION(POS_MAXVERSE)
+#define MAXCHAPTER SW_POSITION(POS_MAXCHAPTER)
+#define MAXBOOK SW_POSITION(POS_MAXBOOK)
+
+
+struct sbook
+{
+ /**Name of book
+ */
+ const char *name;
+
+ /**Preferred Abbreviation
+ */
+ const char *prefAbbrev;
+
+ /**Maximum chapters in book
+ */
+ unsigned char chapmax;
+ /** Array[chapmax] of maximum verses in chapters
+ */
+ int *versemax;
+};
+
+struct abbrev
+{
+ const char *ab;
+ int book;
+};
+
+
+class SWLocale;
+
+/**
+ * Class VerseKey
+ * The SWKey implementation used for verse based modules like Bibles or commentaries.
+ */
+class SWDLLEXPORT VerseKey : public SWKey {
+
+ class LocaleCache {
+ public:
+ char *name;
+ unsigned int abbrevsCnt;
+ SWLocale *locale;
+ LocaleCache() {
+ name = 0;
+ abbrevsCnt = 0;
+ locale = 0;
+ }
+ virtual ~LocaleCache() {
+ if (name)
+ delete[]name;
+ }
+ };
+
+ static SWClass classdef;
+
+ static long *offsets[2][2];
+ static int offsize[2][2];
+ /** number of instantiated VerseKey objects or derivitives
+ */
+ static int instance;
+ static struct sbook otbooks[];
+ static struct sbook ntbooks[];
+ static const char *osisotbooks[];
+ static const char *osisntbooks[];
+ static const char **osisbooks[];
+#if 1
+ static long otbks[];
+ static long otcps[];
+ static long ntbks[];
+ static long ntcps[];
+#endif
+ static int vm[];
+ static LocaleCache localeCache;
+ ListKey internalListKey;
+
+ const struct abbrev *abbrevs;
+ char *locale;
+ int abbrevsCnt;
+
+ /** The Testament: 0 - Old; 1 - New
+ */
+ signed char testament;
+ mutable signed char book;
+ mutable signed int chapter;
+ mutable signed int verse;
+
+ /** flag for auto normalization
+ */
+ char autonorm;
+
+ /** flag for headings on/off
+ */
+ char headings;
+
+ int getBookAbbrev(const char *abbr);
+ void initBounds() const;
+
+ /** initialize and allocate books array
+ */
+ void initstatics();
+
+ /** initializes this VerseKey()
+ */
+ void init();
+
+ /** Binary search to find the index closest, but less
+ * than the given value.
+ *
+ * @param array long * to array to search
+ * @param size number of elements in the array
+ * @param value value to find
+ * @return the index into the array that is less than but closest to value
+ */
+ int findindex(long *array, int size, long value);
+
+ mutable VerseKey *lowerBound, *upperBound;
+
+
+protected:
+
+ /** Refresh keytext based on testament|book|chapter|verse
+ * default auto normalization to true
+ * default display headings option is false
+ */
+ void freshtext() const;
+ /** Parse a character array into testament|book|chapter|verse
+ *
+ */
+ virtual char parse(bool checkNormalize = true);
+public:
+#if 0
+ static long otbks[];
+ static long otcps[];
+ static long ntbks[];
+ static long ntcps[];
+#endif
+ static const char builtin_BMAX[2];
+ static struct sbook *builtin_books[2];
+ static const struct abbrev builtin_abbrevs[];
+ const char *BMAX;
+ struct sbook **books;
+
+ /**
+ * VerseKey Constructor - initializes Instance of VerseKey
+ *
+ * @param ikey text key (will take various forms of 'BOOK CH:VS'.
+ * See parse() for more detailed information)
+ */
+ VerseKey(const char *ikey = 0);
+
+ /**
+ * VerseKey Constructor - initializes instance of VerseKey
+ *
+ * @param ikey base key (will take various forms of 'BOOK CH:VS'.
+ * See parse() for more detailed information)
+ */
+ VerseKey(const SWKey *ikey);
+
+ /** VerseKey Constructor - initializes instance of VerseKey
+ * with boundariess - see also LowerBound()
+ * and UpperBound()
+ * @param min the lower boundary of the new VerseKey
+ * @param max the upper boundary of the new VerseKey
+ */
+ VerseKey(const char *min, const char *max);
+
+ /** VerseKey Copy Constructor - will create a new VerseKey
+ * based on an existing SWKey
+ *
+ * @param k the VerseKey to copy from
+ */
+ VerseKey(const SWKey &k);
+
+ /** VerseKey Copy Constructor - will create a new VerseKey
+ * based on an existing one
+ *
+ * @param k the VerseKey to copy from
+ */
+ VerseKey(const VerseKey &k);
+
+ /** VerseKey Destructor
+ * Cleans up an instance of VerseKey
+ */
+ virtual ~VerseKey();
+
+ /** sets the lower boundary for this VerseKey
+ * and returns the new boundary
+ *
+ * @param lb the new lower boundary for this VerseKey
+ * @return the lower boundary the key was set to
+ */
+ VerseKey &LowerBound(const char *lb);
+
+ /** sets the upper boundary for this VerseKey
+ * and returns the new boundary
+ * @param ub the new upper boundary for this VerseKey
+ * @return the upper boundary the key was set to
+ */
+ VerseKey &UpperBound(const char *ub);
+
+ /** gets the lower boundary of this VerseKey
+ * @return the lower boundary of this VerseKey
+ */
+ VerseKey &LowerBound() const;
+
+ /** gets the upper boundary of this VerseKey
+ * @return the upper boundary of this VerseKey
+ */
+ VerseKey &UpperBound() const;
+
+ /** clears the boundaries of this VerseKey
+ */
+ void ClearBounds();
+
+ /** Creates a new SWKey based on the current VerseKey
+ * see also the Copy Constructor
+ */
+ virtual SWKey *clone() const;
+
+ /** refreshes keytext before returning if cast to
+ * a (char *) is requested
+ */
+ virtual const char *getText() const;
+ virtual const char *getShortText() const;
+ virtual void setText(const char *ikey, bool checkNormalize) { SWKey::setText(ikey); parse(checkNormalize); }
+ virtual void setText(const char *ikey) { SWKey::setText(ikey); parse(); }
+ virtual void copyFrom(const SWKey &ikey);
+
+ /** Equates this VerseKey to another VerseKey
+ */
+ virtual void copyFrom(const VerseKey &ikey);
+
+ /** Positions this key
+ *
+ * @param newpos Position to set to.
+ * @return *this
+ */
+ virtual void setPosition(SW_POSITION newpos);
+
+ /** Decrements key a number of verses
+ *
+ * @param steps Number of verses to jump backward
+ * @return *this
+ */
+ virtual void decrement(int steps);
+
+ /** Increments key a number of verses
+ *
+ * @param steps Number of verses to jump forward
+ * @return *this
+ */
+ virtual void increment(int steps);
+ virtual bool isTraversable() const { return true; }
+
+ virtual const char *getBookName() const;
+ virtual const char *getBookAbbrev() const;
+ /** Gets testament
+ *
+ * @return value of testament
+ */
+ virtual char Testament() const;
+
+ /** Gets book
+ *
+ * @return value of book
+ */
+ virtual char Book() const;
+
+ /** Gets chapter
+ *
+ * @return value of chapter
+ */
+ virtual int Chapter() const;
+
+ /** Gets verse
+ *
+ * @return value of verse
+ */
+ virtual int Verse() const;
+
+ /** Sets/gets testament
+ *
+ * @param itestament value which to set testament
+ * [MAXPOS(char)] - only get
+ * @return if unchanged -> value of testament,
+ * if changed -> previous value of testament
+ */
+ virtual char Testament(char itestament);
+
+ /** Sets/gets book
+ *
+ * @param ibook value which to set book
+ * [MAXPOS(char)] - only get
+ * @return if unchanged -> value of book,
+ * if changed -> previous value of book
+ */
+ virtual char Book(char ibook);
+
+ /** Sets/gets chapter
+ *
+ * @param ichapter value which to set chapter
+ * [MAXPOS(int)] - only get
+ * @return if unchanged -> value of chapter,
+ * if changed -> previous value of chapter
+ */
+ virtual int Chapter(int ichapter);
+
+ /** Sets/gets verse
+ *
+ * @param iverse value which to set verse
+ * [MAXPOS(int)] - only get
+ * @return if unchanged -> value of verse,
+ * if changed -> previous value of verse
+ */
+ virtual int Verse(int iverse);
+
+ /** checks limits and normalizes if necessary (e.g.
+ * Matthew 29:47 = Mark 2:2). If last verse is
+ * exceeded, key is set to last Book CH:VS
+ *
+ * @return *this
+ */
+ virtual void Normalize(char autocheck = 0);
+
+ /** Sets/gets flag that tells VerseKey to
+ * automatically normalize itself when modified
+ *
+ * @param iautonorm value which to set autonorm
+ * [MAXPOS(char)] - only get
+ * @return if unchanged -> value of autonorm,
+ * if changed -> previous value of autonorm
+ */
+ virtual char AutoNormalize(char iautonorm = MAXPOS(char));
+
+ /** Sets/gets flag that tells VerseKey to include
+ * chapter/book/testament/module headings
+ *
+ * @param iheadings value which to set headings
+ * [MAXPOS(char)] - only get
+ * @return if unchanged -> value of headings,
+ * if changed -> previous value of headings
+ */
+ virtual char Headings(char iheadings = MAXPOS(char));
+
+ virtual long NewIndex() const;
+
+ /** Gets index based upon current verse
+ *
+ * @return offset
+ */
+ virtual long Index() const;
+
+ /** Sets index based upon current verse
+ *
+ * @param iindex value to set index to
+ * @return offset
+ */
+ virtual long Index(long iindex);
+
+ virtual const char *getOSISRef() const;
+ static const int getOSISBookNum(const char *bookab);
+
+ /** Tries to parse a string and convert it into an OSIS reference
+ * @param inRef reference string to try to parse
+ * @param defaultKey @see ParseVerseList(..., defaultKey, ...)
+ */
+ static const char *convertToOSIS(const char *inRef, const SWKey *defaultKey);
+
+ virtual ListKey ParseVerseList(const char *buf, const char *defaultKey = 0, bool expandRange = false);
+ virtual const char *getRangeText() const;
+ /** Compares another SWKey object
+ *
+ * @param ikey key to compare with this one
+ * @return >0 if this VerseKey is greater than compare SWKey,
+ * <0 if this VerseKey is smaller than compare SWKey,
+ * 0 if the keys are the same
+ */
+ virtual int compare(const SWKey & ikey);
+
+ /** Compares another VerseKey object
+ *
+ * @param ikey key to compare with this one
+ * @return >0 if this VerseKey is greater than compare VerseKey,
+ * <0 if this VerseKey is smaller than compare VerseKey,
+ * 0 if the keys are the same
+ */
+ virtual int _compare(const VerseKey & ikey);
+
+ virtual void setBookAbbrevs(const struct abbrev *bookAbbrevs, unsigned int size = 0 /* default determine size */ );
+ virtual void setBooks(const char *iBMAX, struct sbook **ibooks);
+ virtual void setLocale(const char *name);
+ virtual const char *getLocale() const { return locale; }
+
+
+
+ // OPERATORS --------------------------------------------------------------------
+
+
+ SWKEY_OPERATORS
+
+ virtual SWKey & operator =(const VerseKey & ikey) { copyFrom(ikey); return *this; }
+};
+
+SWORD_NAMESPACE_END
+
+#endif //VERSEKEY_H
diff --git a/include/versetreekey.h b/include/versetreekey.h
new file mode 100644
index 0000000..574c026
--- /dev/null
+++ b/include/versetreekey.h
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * versekey.h - code for class 'versekey'- a standard Biblical verse key
+ *
+ * $Id: versekey.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+
+#ifndef VERSETREEKEY_H
+#define VERSETREEKEY_H
+
+#include <versekey.h>
+#include <treekey.h>
+#include <swmacs.h>
+#include <listkey.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+/**
+ * Class VerseKey
+ * The SWKey implementation used for verse based modules like Bibles or commentaries.
+ */
+class SWDLLEXPORT VerseTreeKey : public VerseKey {
+
+ static SWClass classdef;
+ TreeKey *treeKey;
+
+public:
+
+ /**
+ * VerseKey Constructor - initializes Instance of VerseKey
+ *
+ * @param ikey text key (will take various forms of 'BOOK CH:VS'.
+ * See parse() for more detailed information)
+ */
+ VerseTreeKey(TreeKey *treeKey, const char *ikey = 0);
+
+ /**
+ * VerseKey Constructor - initializes instance of VerseKey
+ *
+ * @param ikey base key (will take various forms of 'BOOK CH:VS'.
+ * See parse() for more detailed information)
+ */
+ VerseTreeKey(TreeKey *treeKey, const SWKey *ikey);
+
+ /** VerseKey Constructor - initializes instance of VerseKey
+ * with boundariess - see also LowerBound()
+ * and UpperBound()
+ * @param min the lower boundary of the new VerseKey
+ * @param max the upper boundary of the new VerseKey
+ */
+ VerseTreeKey(TreeKey *treeKey, const char *min, const char *max);
+
+ /** VerseKey Copy Constructor - will create a new VerseKey
+ * based on an existing one
+ *
+ * @param k the VerseKey to copy from
+ */
+ VerseTreeKey(const VerseTreeKey &k);
+
+ /** VerseKey Destructor
+ * Cleans up an instance of VerseKey
+ */
+ virtual ~VerseTreeKey();
+
+ /** Creates a new SWKey based on the current VerseKey
+ * see also the Copy Constructor
+ */
+ virtual SWKey *clone() const;
+
+ virtual bool isTraversable() const { return true; }
+
+ virtual TreeKey *getTreeKey() { return treeKey; }
+
+
+ // OPERATORS --------------------------------------------------------------------
+
+
+ SWKEY_OPERATORS
+
+ virtual SWKey & operator = (const VerseKey & ikey) { copyFrom(ikey); return *this; }
+};
+
+SWORD_NAMESPACE_END
+
+#endif //VERSETREEKEY_H
diff --git a/include/zcom.h b/include/zcom.h
new file mode 100644
index 0000000..137c5c3
--- /dev/null
+++ b/include/zcom.h
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * zcom.h - code for class 'zCom'- a module that reads compressed text
+ * files: ot and nt using indexs ??.vss
+ *
+ * $Id: zcom.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ZCOM_H
+#define ZCOM_H
+
+#include <swcom.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT zCom : public zVerse, public SWCom {
+
+ VerseKey *lastWriteKey;
+ bool sameBlock(VerseKey * lastWriteKey, VerseKey * key);
+ int blockType;
+
+
+public:
+
+ zCom(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+ virtual ~zCom();
+ virtual SWBuf &getRawEntryBuf();
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path, int blockBound) {
+ return zVerse::createModule(path, blockBound);
+ }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey * linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
+
+ // swcacher interface ----------------------
+ virtual void flush() { flushCache(); }
+ // end swcacher interface ----------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/zconf.h b/include/zconf.h
new file mode 100644
index 0000000..cb3b162
--- /dev/null
+++ b/include/zconf.h
@@ -0,0 +1,279 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zconf.h 1688 2005-01-01 04:42:26Z scribe $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+# define deflateInit_ z_deflateInit_
+# define deflate z_deflate
+# define deflateEnd z_deflateEnd
+# define inflateInit_ z_inflateInit_
+# define inflate z_inflate
+# define inflateEnd z_inflateEnd
+# define deflateInit2_ z_deflateInit2_
+# define deflateSetDictionary z_deflateSetDictionary
+# define deflateCopy z_deflateCopy
+# define deflateReset z_deflateReset
+# define deflateParams z_deflateParams
+# define inflateInit2_ z_inflateInit2_
+# define inflateSetDictionary z_inflateSetDictionary
+# define inflateSync z_inflateSync
+# define inflateSyncPoint z_inflateSyncPoint
+# define inflateReset z_inflateReset
+# define compress z_compress
+# define compress2 z_compress2
+# define uncompress z_uncompress
+# define adler32 z_adler32
+# define crc32 z_crc32
+# define get_crc_table z_get_crc_table
+
+# define Byte z_Byte
+# define uInt z_uInt
+# define uLong z_uLong
+# define Bytef z_Bytef
+# define charf z_charf
+# define intf z_intf
+# define uIntf z_uIntf
+# define uLongf z_uLongf
+# define voidpf z_voidpf
+# define voidp z_voidp
+#endif
+
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+# define WIN32
+#endif
+#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
+# ifndef __32BIT__
+# define __32BIT__
+# endif
+#endif
+#if defined(__MSDOS__) && !defined(MSDOS)
+# define MSDOS
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#if defined(MSDOS) && !defined(__32BIT__)
+# define MAXSEG_64K
+#endif
+#ifdef MSDOS
+# define UNALIGNED_OK
+#endif
+
+#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
+# define STDC
+#endif
+#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
+# ifndef STDC
+# define STDC
+# endif
+#endif
+
+#ifndef STDC
+# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+# define const
+# endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
+# define NO_DUMMY_DECL
+#endif
+
+/* Old Borland C incorrectly complains about missing returns: */
+#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
+# define NEED_DUMMY_RETURN
+#endif
+
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+# ifdef MAXSEG_64K
+# define MAX_MEM_LEVEL 8
+# else
+# define MAX_MEM_LEVEL 9
+# endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+# define MAX_WBITS 15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+ (1 << (windowBits+2)) + (1 << (memLevel+9))
+ that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+ make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+ The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+ /* Type declarations */
+
+#ifndef OF /* function prototypes */
+# ifdef STDC
+# define OF(args) args
+# else
+# define OF(args) ()
+# endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
+ /* MSC small or medium model */
+# define SMALL_MEDIUM
+# ifdef _MSC_VER
+# define FAR _far
+# else
+# define FAR far
+# endif
+#endif
+#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
+# ifndef __32BIT__
+# define SMALL_MEDIUM
+# define FAR _far
+# endif
+#endif
+
+/* Compile with -DZLIB_DLL for Windows DLL support */
+#if defined(ZLIB_DLL)
+# if defined(_WINDOWS) || defined(WINDOWS)
+# ifdef FAR
+# undef FAR
+# endif
+# include <windows.h>
+# define ZEXPORT WINAPI
+# ifdef WIN32
+# define ZEXPORTVA WINAPIV
+# else
+# define ZEXPORTVA FAR _cdecl _export
+# endif
+# endif
+# if defined (__BORLANDC__)
+# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
+# include <windows.h>
+# define ZEXPORT __declspec(dllexport) WINAPI
+# define ZEXPORTRVA __declspec(dllexport) WINAPIV
+# else
+# if defined (_Windows) && defined (__DLL__)
+# define ZEXPORT _export
+# define ZEXPORTVA _export
+# endif
+# endif
+# endif
+#endif
+
+#if defined (__BEOS__)
+# if defined (ZLIB_DLL)
+# define ZEXTERN extern __declspec(dllexport)
+# else
+# define ZEXTERN extern __declspec(dllimport)
+# endif
+#endif
+
+#ifndef ZEXPORT
+# define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+# define ZEXPORTVA
+#endif
+#ifndef ZEXTERN
+# define ZEXTERN extern
+#endif
+
+#ifndef FAR
+# define FAR
+#endif
+
+#if !defined(MACOS) && !defined(TARGET_OS_MAC) && !defined(VCL)
+typedef unsigned char Byte; /* 8 bits */
+#endif
+typedef unsigned int uInt; /* 16 bits or more */
+typedef unsigned long uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+# define Bytef Byte FAR
+#else
+ typedef unsigned char FAR Bytef;
+#endif
+typedef char FAR charf;
+typedef int FAR intf;
+typedef uInt FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+ typedef void FAR *voidpf;
+ typedef void *voidp;
+#else
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <sys/types.h> /* for off_t */
+# include <unistd.h> /* for SEEK_* and off_t */
+# define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+# define SEEK_SET 0 /* Seek from beginning of file. */
+# define SEEK_CUR 1 /* Seek from current position. */
+# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+# define z_off_t long
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+# pragma map(deflateInit_,"DEIN")
+# pragma map(deflateInit2_,"DEIN2")
+# pragma map(deflateEnd,"DEEND")
+# pragma map(inflateInit_,"ININ")
+# pragma map(inflateInit2_,"ININ2")
+# pragma map(inflateEnd,"INEND")
+# pragma map(inflateSync,"INSY")
+# pragma map(inflateSetDictionary,"INSEDI")
+# pragma map(inflate_blocks,"INBL")
+# pragma map(inflate_blocks_new,"INBLNE")
+# pragma map(inflate_blocks_free,"INBLFR")
+# pragma map(inflate_blocks_reset,"INBLRE")
+# pragma map(inflate_codes_free,"INCOFR")
+# pragma map(inflate_codes,"INCO")
+# pragma map(inflate_fast,"INFA")
+# pragma map(inflate_flush,"INFLU")
+# pragma map(inflate_mask,"INMA")
+# pragma map(inflate_set_dictionary,"INSEDI2")
+# pragma map(inflate_copyright,"INCOPY")
+# pragma map(inflate_trees_bits,"INTRBI")
+# pragma map(inflate_trees_dynamic,"INTRDY")
+# pragma map(inflate_trees_fixed,"INTRFI")
+# pragma map(inflate_trees_free,"INTRFR")
+#endif
+
+#endif /* _ZCONF_H */
diff --git a/include/zipcomprs.h b/include/zipcomprs.h
new file mode 100644
index 0000000..63500d4
--- /dev/null
+++ b/include/zipcomprs.h
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * swcomprs.h - definition of Class SWCompress used for data compression
+ *
+ * $Id: zipcomprs.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ZIPCOMPRS_H
+#define ZIPCOMPRS_H
+
+#include <swcomprs.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT ZipCompress : public SWCompress {
+
+protected:
+public:
+ ZipCompress();
+ virtual ~ZipCompress();
+
+ virtual void Encode(void);
+ virtual void Decode(void);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/zld.h b/include/zld.h
new file mode 100644
index 0000000..1046c33
--- /dev/null
+++ b/include/zld.h
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * zld.cpp - code for class 'zLD'- a module that reads compressed lexicon and
+ * dictionary files.
+ *
+ * $Id: zld.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ZLD_H
+#define ZLD_H
+
+#include <zstr.h>
+#include <swld.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT zLD : public zStr, public SWLD {
+
+ void strongsPad(char *buf);
+ char getEntry(long away = 0);
+
+public:
+
+
+ zLD(const char *ipath, const char *iname = 0, const char *idesc = 0, long blockCount = 200, SWCompress *icomp = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char* ilang = 0);
+ virtual ~zLD();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path) {
+ return zStr::createModule(path);
+ }
+
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
+
+ // swcacher interface ----------------------
+ virtual void flush() { flushCache(); }
+ // end swcacher interface ----------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/zlib.h b/include/zlib.h
new file mode 100644
index 0000000..52cb529
--- /dev/null
+++ b/include/zlib.h
@@ -0,0 +1,893 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.1.4, March 11th, 2002
+
+ Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+
+ The data format used by the zlib library is described by RFCs (Request for
+ Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+ (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.1.4"
+
+/*
+ The 'zlib' compression library provides in-memory compression and
+ decompression functions, including integrity checks of the uncompressed
+ data. This version of the library supports only one compression method
+ (deflation) but other algorithms will be added later and will have the same
+ stream interface.
+
+ Compression can be done in a single step if the buffers are large
+ enough (for example if an input file is mmap'ed), or can be done by
+ repeated calls of the compression function. In the latter case, the
+ application must provide more input and/or consume the output
+ (providing more output space) before each call.
+
+ The library also supports reading and writing files in gzip (.gz) format
+ with an interface similar to that of stdio.
+
+ The library does not install any signal handler. The decoder checks
+ the consistency of the compressed data, so the library should never
+ crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void (*free_func) OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+ Bytef *next_in; /* next input byte */
+ uInt avail_in; /* number of bytes available at next_in */
+ uLong total_in; /* total nb of input bytes read so far */
+
+ Bytef *next_out; /* next output byte should be put there */
+ uInt avail_out; /* remaining free space at next_out */
+ uLong total_out; /* total nb of bytes output so far */
+
+ char *msg; /* last error message, NULL if no error */
+ struct internal_state FAR *state; /* not visible by applications */
+
+ alloc_func zalloc; /* used to allocate the internal state */
+ free_func zfree; /* used to free the internal state */
+ voidpf opaque; /* private data object passed to zalloc and zfree */
+
+ int data_type; /* best guess about the data type: ascii or binary */
+ uLong adler; /* adler32 value of the uncompressed data */
+ uLong reserved; /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+ The application must update next_in and avail_in when avail_in has
+ dropped to zero. It must update next_out and avail_out when avail_out
+ has dropped to zero. The application must initialize zalloc, zfree and
+ opaque before calling the init function. All other fields are set by the
+ compression library and must not be updated by the application.
+
+ The opaque value provided by the application will be passed as the first
+ parameter for calls of zalloc and zfree. This can be useful for custom
+ memory management. The compression library attaches no meaning to the
+ opaque value.
+
+ zalloc must return Z_NULL if there is not enough memory for the object.
+ If zlib is used in a multi-threaded application, zalloc and zfree must be
+ thread safe.
+
+ On 16-bit systems, the functions zalloc and zfree must be able to allocate
+ exactly 65536 bytes, but will not be required to allocate more than this
+ if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+ pointers returned by zalloc for objects of exactly 65536 bytes *must*
+ have their offset normalized to zero. The default allocation function
+ provided by this library ensures this (see zutil.c). To reduce memory
+ requirements and avoid any allocation of 64K objects, at the expense of
+ compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+ The fields total_in and total_out can be used for statistics or
+ progress reports. After compression, total_in holds the total size of
+ the uncompressed data and may be saved for use in the decompressor
+ (particularly if the decompressor wants to decompress everything in
+ a single step).
+*/
+
+ /* constants */
+
+#define Z_NO_FLUSH 0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH 2
+#define Z_FULL_FLUSH 3
+#define Z_FINISH 4
+/* Allowed flush values; see deflate() below for details */
+
+#define Z_OK 0
+#define Z_STREAM_END 1
+#define Z_NEED_DICT 2
+#define Z_ERRNO (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR (-3)
+#define Z_MEM_ERROR (-4)
+#define Z_BUF_ERROR (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION 0
+#define Z_BEST_SPEED 1
+#define Z_BEST_COMPRESSION 9
+#define Z_DEFAULT_COMPRESSION (-1)
+/* compression levels */
+
+#define Z_FILTERED 1
+#define Z_HUFFMAN_ONLY 2
+#define Z_DEFAULT_STRATEGY 0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY 0
+#define Z_ASCII 1
+#define Z_UNKNOWN 2
+/* Possible values of the data_type field */
+
+#define Z_DEFLATED 8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+ /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+ If the first character differs, the library code actually used is
+ not compatible with the zlib.h header file used by the application.
+ This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+ Initializes the internal stream state for compression. The fields
+ zalloc, zfree and opaque must be initialized before by the caller.
+ If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+ use default allocation functions.
+
+ The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+ 1 gives best speed, 9 gives best compression, 0 gives no compression at
+ all (the input data is simply copied a block at a time).
+ Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+ compression (currently equivalent to level 6).
+
+ deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+ Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+ with the version assumed by the caller (ZLIB_VERSION).
+ msg is set to null if there is no error message. deflateInit does not
+ perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+ deflate compresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may introduce some
+ output latency (reading input without producing any output) except when
+ forced to flush.
+
+ The detailed semantics are as follows. deflate performs one or both of the
+ following actions:
+
+ - Compress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in and avail_in are updated and
+ processing will resume at this point for the next call of deflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. This action is forced if the parameter flush is non zero.
+ Forcing flush frequently degrades the compression ratio, so this parameter
+ should be set only when necessary (in interactive applications).
+ Some output may be provided even if flush is not set.
+
+ Before the call of deflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating avail_in or avail_out accordingly; avail_out
+ should never be zero before the call. The application can consume the
+ compressed output when it wants, for example when the output buffer is full
+ (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+ and with zero avail_out, it must be called again after making room in the
+ output buffer because there might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+ flushed to the output buffer and the output is aligned on a byte boundary, so
+ that the decompressor can get all input data available so far. (In particular
+ avail_in is zero after the call if enough output space has been provided
+ before the call.) Flushing may degrade compression for some compression
+ algorithms and so it should be used only when necessary.
+
+ If flush is set to Z_FULL_FLUSH, all output is flushed as with
+ Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+ restart from this point if previous compressed data has been damaged or if
+ random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+ the compression.
+
+ If deflate returns with avail_out == 0, this function must be called again
+ with the same value of the flush parameter and more output space (updated
+ avail_out), until the flush is complete (deflate returns with non-zero
+ avail_out).
+
+ If the parameter flush is set to Z_FINISH, pending input is processed,
+ pending output is flushed and deflate returns with Z_STREAM_END if there
+ was enough output space; if deflate returns with Z_OK, this function must be
+ called again with Z_FINISH and more output space (updated avail_out) but no
+ more input data, until it returns with Z_STREAM_END or an error. After
+ deflate has returned Z_STREAM_END, the only possible operations on the
+ stream are deflateReset or deflateEnd.
+
+ Z_FINISH can be used immediately after deflateInit if all the compression
+ is to be done in a single step. In this case, avail_out must be at least
+ 0.1% larger than avail_in plus 12 bytes. If deflate does not return
+ Z_STREAM_END, then it must be called again as described above.
+
+ deflate() sets strm->adler to the adler32 checksum of all input read
+ so far (that is, total_in bytes).
+
+ deflate() may update data_type if it can make a good guess about
+ the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+ binary. This field is only for information purposes and does not affect
+ the compression algorithm in any manner.
+
+ deflate() returns Z_OK if some progress has been made (more input
+ processed or more output produced), Z_STREAM_END if all input has been
+ consumed and all output has been produced (only when flush is set to
+ Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+ if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+ (for example avail_in or avail_out was zero).
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+ stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+ prematurely (some input or output was discarded). In the error case,
+ msg may be set but then points to a static string (which must not be
+ deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+ Initializes the internal stream state for decompression. The fields
+ next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+ the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+ value depends on the compression method), inflateInit determines the
+ compression method from the zlib header and allocates all data structures
+ accordingly; otherwise the allocation will be deferred to the first call of
+ inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+ use default allocation functions.
+
+ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+ version assumed by the caller. msg is set to null if there is no error
+ message. inflateInit does not perform any decompression apart from reading
+ the zlib header if present: this will be done by inflate(). (So next_in and
+ avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+ inflate decompresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may some
+ introduce some output latency (reading input without producing any output)
+ except when forced to flush.
+
+ The detailed semantics are as follows. inflate performs one or both of the
+ following actions:
+
+ - Decompress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in is updated and processing
+ will resume at this point for the next call of inflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. inflate() provides as much output as possible, until there
+ is no more input data or no more space in the output buffer (see below
+ about the flush parameter).
+
+ Before the call of inflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating the next_* and avail_* values accordingly.
+ The application can consume the uncompressed output when it wants, for
+ example when the output buffer is full (avail_out == 0), or after each
+ call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+ must be called again after making room in the output buffer because there
+ might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
+ output as possible to the output buffer. The flushing behavior of inflate is
+ not specified for values of the flush parameter other than Z_SYNC_FLUSH
+ and Z_FINISH, but the current implementation actually flushes as much output
+ as possible anyway.
+
+ inflate() should normally be called until it returns Z_STREAM_END or an
+ error. However if all decompression is to be performed in a single step
+ (a single call of inflate), the parameter flush should be set to
+ Z_FINISH. In this case all pending input is processed and all pending
+ output is flushed; avail_out must be large enough to hold all the
+ uncompressed data. (The size of the uncompressed data may have been saved
+ by the compressor for this purpose.) The next operation on this stream must
+ be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+ is never required, but can be used to inform inflate that a faster routine
+ may be used for the single inflate() call.
+
+ If a preset dictionary is needed at this point (see inflateSetDictionary
+ below), inflate sets strm-adler to the adler32 checksum of the
+ dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
+ it sets strm->adler to the adler32 checksum of all output produced
+ so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
+ an error code as described below. At the end of the stream, inflate()
+ checks that its computed adler32 checksum is equal to that saved by the
+ compressor and returns Z_STREAM_END only if the checksum is correct.
+
+ inflate() returns Z_OK if some progress has been made (more input processed
+ or more output produced), Z_STREAM_END if the end of the compressed data has
+ been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+ preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+ corrupted (input stream not conforming to the zlib format or incorrect
+ adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
+ (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if no progress is possible or if there was not
+ enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
+ case, the application may then call inflateSync to look for a good
+ compression block.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+ was inconsistent. In the error case, msg may be set but then points to a
+ static string (which must not be deallocated).
+*/
+
+ /* Advanced functions */
+
+/*
+ The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy));
+
+ This is another version of deflateInit with more compression options. The
+ fields next_in, zalloc, zfree and opaque must be initialized before by
+ the caller.
+
+ The method parameter is the compression method. It must be Z_DEFLATED in
+ this version of the library.
+
+ The windowBits parameter is the base two logarithm of the window size
+ (the size of the history buffer). It should be in the range 8..15 for this
+ version of the library. Larger values of this parameter result in better
+ compression at the expense of memory usage. The default value is 15 if
+ deflateInit is used instead.
+
+ The memLevel parameter specifies how much memory should be allocated
+ for the internal compression state. memLevel=1 uses minimum memory but
+ is slow and reduces compression ratio; memLevel=9 uses maximum memory
+ for optimal speed. The default value is 8. See zconf.h for total memory
+ usage as a function of windowBits and memLevel.
+
+ The strategy parameter is used to tune the compression algorithm. Use the
+ value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+ filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
+ string match). Filtered data consists mostly of small values with a
+ somewhat random distribution. In this case, the compression algorithm is
+ tuned to compress them better. The effect of Z_FILTERED is to force more
+ Huffman coding and less string matching; it is somewhat intermediate
+ between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
+ the compression ratio but not the correctness of the compressed output even
+ if it is not set appropriately.
+
+ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+ method). msg is set to null if there is no error message. deflateInit2 does
+ not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the compression dictionary from the given byte sequence
+ without producing any compressed output. This function must be called
+ immediately after deflateInit, deflateInit2 or deflateReset, before any
+ call of deflate. The compressor and decompressor must use exactly the same
+ dictionary (see inflateSetDictionary).
+
+ The dictionary should consist of strings (byte sequences) that are likely
+ to be encountered later in the data to be compressed, with the most commonly
+ used strings preferably put towards the end of the dictionary. Using a
+ dictionary is most useful when the data to be compressed is short and can be
+ predicted with good accuracy; the data can then be compressed better than
+ with the default empty dictionary.
+
+ Depending on the size of the compression data structures selected by
+ deflateInit or deflateInit2, a part of the dictionary may in effect be
+ discarded, for example if the dictionary is larger than the window size in
+ deflate or deflate2. Thus the strings most likely to be useful should be
+ put at the end of the dictionary, not at the front.
+
+ Upon return of this function, strm->adler is set to the Adler32 value
+ of the dictionary; the decompressor may later use this value to determine
+ which dictionary has been used by the compressor. (The Adler32 value
+ applies to the whole dictionary even if only a subset of the dictionary is
+ actually used by the compressor.)
+
+ deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent (for example if deflate has already been called for this stream
+ or if the compression method is bsort). deflateSetDictionary does not
+ perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+ z_streamp source));
+/*
+ Sets the destination stream as a complete copy of the source stream.
+
+ This function can be useful when several compression strategies will be
+ tried, for example when there are several ways of pre-processing the input
+ data with a filter. The streams that will be discarded should then be freed
+ by calling deflateEnd. Note that deflateCopy duplicates the internal
+ compression state which can be quite large, so this strategy is slow and
+ can consume lots of memory.
+
+ deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+ (such as zalloc being NULL). msg is left unchanged in both source and
+ destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to deflateEnd followed by deflateInit,
+ but does not free and reallocate all the internal compression state.
+ The stream will keep the same compression level and any other attributes
+ that may have been set by deflateInit2.
+
+ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+ int level,
+ int strategy));
+/*
+ Dynamically update the compression level and compression strategy. The
+ interpretation of level and strategy is as in deflateInit2. This can be
+ used to switch between compression and straight copy of the input data, or
+ to switch to a different kind of input data requiring a different
+ strategy. If the compression level is changed, the input available so far
+ is compressed with the old level (and may be flushed); the new level will
+ take effect only at the next call of deflate().
+
+ Before the call of deflateParams, the stream state must be set as for
+ a call of deflate(), since the currently available input may have to
+ be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+ deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+ if strm->avail_out was zero.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+ int windowBits));
+
+ This is another version of inflateInit with an extra parameter. The
+ fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+ before by the caller.
+
+ The windowBits parameter is the base two logarithm of the maximum window
+ size (the size of the history buffer). It should be in the range 8..15 for
+ this version of the library. The default value is 15 if inflateInit is used
+ instead. If a compressed stream with a larger window size is given as
+ input, inflate() will return with the error code Z_DATA_ERROR instead of
+ trying to allocate a larger window.
+
+ inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+ memLevel). msg is set to null if there is no error message. inflateInit2
+ does not perform any decompression apart from reading the zlib header if
+ present: this will be done by inflate(). (So next_in and avail_in may be
+ modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the decompression dictionary from the given uncompressed byte
+ sequence. This function must be called immediately after a call of inflate
+ if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+ can be determined from the Adler32 value returned by this call of
+ inflate. The compressor and decompressor must use exactly the same
+ dictionary (see deflateSetDictionary).
+
+ inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+ expected one (incorrect Adler32 value). inflateSetDictionary does not
+ perform any decompression: this will be done by subsequent calls of
+ inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+ Skips invalid compressed data until a full flush point (see above the
+ description of deflate with Z_FULL_FLUSH) can be found, or until all
+ available input is skipped. No output is provided.
+
+ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+ if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+ or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+ case, the application may save the current current value of total_in which
+ indicates where valid compressed data was found. In the error case, the
+ application may repeatedly call inflateSync, providing more input each time,
+ until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to inflateEnd followed by inflateInit,
+ but does not free and reallocate all the internal decompression state.
+ The stream will keep attributes that may have been set by inflateInit2.
+
+ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+
+ /* utility functions */
+
+/*
+ The following utility functions are implemented on top of the
+ basic stream-oriented functions. To simplify the interface, some
+ default options are assumed (compression level and memory usage,
+ standard memory allocation functions). The source code of these
+ utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Compresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be at least 0.1% larger than
+ sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
+ compressed buffer.
+ This function can be used to compress a whole file at once if the
+ input file is mmap'ed.
+ compress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level));
+/*
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least 0.1% larger than sourceLen plus
+ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+/*
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb") but can also include a compression level
+ ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+ Huffman only compression as in "wb1h". (See the description
+ of deflateInit2 for more information about the strategy parameter.)
+
+ gzopen can be used to read a file which is not in gzip format; in this
+ case gzread will directly read from the file without decompression.
+
+ gzopen returns NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR). */
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+ gzdopen() associates a gzFile with the file descriptor fd. File
+ descriptors are obtained from calls like open, dup, creat, pipe or
+ fileno (in the file has been previously opened with fopen).
+ The mode parameter is as in gzopen.
+ The next call of gzclose on the returned gzFile will also close the
+ file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+ descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+ gzdopen returns NULL if there was insufficient memory to allocate
+ the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+ Dynamically update the compression level or strategy. See the description
+ of deflateInit2 for the meaning of these parameters.
+ gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+ opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+ Reads the given number of uncompressed bytes from the compressed file.
+ If the input file was not in gzip format, gzread copies the given number
+ of bytes into the buffer.
+ gzread returns the number of uncompressed bytes actually read (0 for
+ end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+ const voidp buf, unsigned len));
+/*
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of uncompressed bytes actually written
+ (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+/*
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+ Reads bytes from the compressed file until len-1 characters are read, or
+ a newline character is read and transferred to buf, or an end-of-file
+ condition is encountered. The string is then terminated with a null
+ character.
+ gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function. The return value is the zlib
+ error number (see function gzerror below). gzflush returns Z_OK if
+ the flush parameter is Z_FINISH and all output could be flushed.
+ gzflush should be called only when strictly necessary because it can
+ degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+ z_off_t offset, int whence));
+/*
+ Sets the starting position for the next gzread or gzwrite on the
+ given compressed file. The offset represents a number of bytes in the
+ uncompressed data stream. The whence parameter is defined as in lseek(2);
+ the value SEEK_END is not supported.
+ If the file is opened for reading, this function is emulated but can be
+ extremely slow. If the file is opened for writing, only forward seeks are
+ supported; gzseek then compresses a sequence of zeroes up to the new
+ starting position.
+
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error, in
+ particular if the file is opened for writing and the new starting position
+ would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+/*
+ Rewinds the given file. This function is supported only for reading.
+
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+/*
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+
+ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+/*
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state. The return value is the zlib
+ error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+ Returns the error message for the last error which occurred on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occurred in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+
+ /* checksum functions */
+
+/*
+ These functions are not related to compression but are exported
+ anyway because they might be useful in applications using the
+ compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+ Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+ return the updated checksum. If buf is NULL, this function returns
+ the required initial value for the checksum.
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+ much faster. Usage example:
+
+ uLong adler = adler32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ adler = adler32(adler, buffer, length);
+ }
+ if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+/*
+ Update a running crc with the bytes buf[0..len-1] and return the updated
+ crc. If buf is NULL, this function returns the required initial value
+ for the crc. Pre- and post-conditioning (one's complement) is performed
+ within this function so it shouldn't be done by the application.
+ Usage example:
+
+ uLong crc = crc32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ crc = crc32(crc, buffer, length);
+ }
+ if (crc != original_crc) error();
+*/
+
+
+ /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
+ const char *version, int stream_size));
+#define deflateInit(strm, level) \
+ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
+ struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char * ZEXPORT zError OF((int err));
+ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */
diff --git a/include/zstr.h b/include/zstr.h
new file mode 100644
index 0000000..2622ca7
--- /dev/null
+++ b/include/zstr.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * zstr.h - code for class 'zStr'- a module that reads compressed text
+ * files.
+ * and provides lookup and parsing functions based on
+ * class StrKey
+ *
+ * $Id: zstr.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ZSTR_H
+#define ZSTR_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWCompress;
+class EntriesBlock;
+class FileDesc;
+class SWBuf;
+
+class SWDLLEXPORT zStr {
+
+private:
+ static int instance; // number of instantiated zStr objects or derivitives
+ EntriesBlock *cacheBlock;
+ long cacheBlockIndex;
+ bool cacheDirty;
+ char *path;
+ long lastoff;
+ long blockCount;
+ SWCompress *compressor;
+
+protected:
+ FileDesc *idxfd;
+ FileDesc *datfd;
+ FileDesc *zdxfd;
+ FileDesc *zdtfd;
+ static const int IDXENTRYSIZE;
+ static const int ZDXENTRYSIZE;
+
+ void getCompressedText(long block, long entry, char **buf);
+ void flushCache();
+ void prepText(SWBuf &buf);
+ void getKeyFromDatOffset(long ioffset, char **buf);
+ void getKeyFromIdxOffset(long ioffset, char **buf);
+
+public:
+ char nl;
+ zStr(const char *ipath, int fileMode = -1, long blockCount = 100, SWCompress *icomp = 0);
+ virtual ~zStr();
+ signed char findKeyIndex(const char *ikey, long *idxoff, long away = 0);
+ void getText(long index, char **idxbuf, char **buf);
+ void setText(const char *ikey, const char *buf, long len = -1);
+ void linkEntry(const char *destkey, const char *srckey);
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) {}
+ static signed char createModule (const char *path);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/ztext.h b/include/ztext.h
new file mode 100644
index 0000000..461dc45
--- /dev/null
+++ b/include/ztext.h
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * ztext.h - code for class 'zText'- a module that reads compressed text
+ * files: ot and nt using indexs ??.vss
+ *
+ * $Id: ztext.h 1864 2005-11-20 06:06:40Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef ZTEXT_H
+#define ZTEXT_H
+
+#include <zverse.h>
+#include <swtext.h>
+
+#include <defs.h>
+
+namespace lucene { namespace index {
+class IndexReader;
+}}
+
+namespace lucene { namespace search {
+class IndexSearcher;
+}}
+
+SWORD_NAMESPACE_START
+
+/*** SWModule implementation for compressed modules
+* This class handles compressed modules.
+* It should not be used in frontends, unless you are doing very special things.
+*/
+class SWDLLEXPORT zText:public zVerse, public SWText {
+
+ VerseKey *lastWriteKey;
+ bool sameBlock(VerseKey * lastWriteKey, VerseKey * key);
+ int blockType;
+
+
+public:
+
+ zText(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~zText();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+
+ // write interface ----------------------------
+ virtual bool isWritable();
+ static char createModule(const char *path, int blockBound) {
+ return zVerse::createModule(path, blockBound);
+ }
+
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
+
+ // swcacher interface ----------------------
+ virtual void flush() { flushCache(); }
+ // end swcacher interface ----------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/zverse.h b/include/zverse.h
new file mode 100644
index 0000000..6323025
--- /dev/null
+++ b/include/zverse.h
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * rawverse.h - code for class 'zVerse'- a module that reads raw text
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ * and provides lookup and parsing functions based on
+ * class VerseKey
+ */
+
+#ifndef ZVERSE_H
+#define ZVERSE_H
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class FileDesc;
+class SWCompress;
+class SWBuf;
+
+class SWDLLEXPORT zVerse {
+ SWCompress *compressor;
+
+protected:
+ static int instance; // number of instantiated zVerse objects or derivitives
+
+ FileDesc *idxfp[2];
+ FileDesc *textfp[2];
+ FileDesc *compfp[2];
+ char *path;
+ void prepText(SWBuf &buf);
+ void doSetText(char testmt, long idxoff, const char *buf, long len = 0);
+ void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
+ void flushCache();
+ char *cacheBuf;
+ char cacheTestament;
+ long cacheBufIdx;
+ bool dirtyCache;
+
+public:
+
+#define VERSEBLOCKS 2
+#define CHAPTERBLOCKS 3
+#define BOOKBLOCKS 4
+
+ static const char uniqueIndexID[];
+ char nl;
+
+
+ // fileMode default = RDONLY
+ zVerse(const char *ipath, int fileMode = -1, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
+ virtual ~zVerse();
+
+ void findOffset(char testmt, long idxoff, long *start, unsigned short *end);
+ void zReadText(char testmt, long start, unsigned short size, SWBuf &buf);
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) {}
+ static char createModule(const char *path, int blockBound);
+};
+
+SWORD_NAMESPACE_END
+#endif