summaryrefslogtreecommitdiff
path: root/utilities/diatheke/diatheke.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities/diatheke/diatheke.cpp')
-rw-r--r--utilities/diatheke/diatheke.cpp155
1 files changed, 82 insertions, 73 deletions
diff --git a/utilities/diatheke/diatheke.cpp b/utilities/diatheke/diatheke.cpp
index 1649169..83f30ff 100644
--- a/utilities/diatheke/diatheke.cpp
+++ b/utilities/diatheke/diatheke.cpp
@@ -2,7 +2,7 @@
*
* diatheke.cpp -
*
- * $Id: diatheke.cpp 3170 2014-04-17 04:14:38Z greg.hellings $
+ * $Id: diatheke.cpp 3450 2017-02-28 23:28:03Z refdoc $
*
* Copyright 1999-2014 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -47,22 +47,25 @@ void printsyntax() {
fprintf (stderr, " [-l locale] <-k query_key>\n");
fprintf (stderr, "\n");
fprintf (stderr, "If <book> is \"system\" you may use these system keys: \"modulelist\",\n");
- fprintf (stderr, "\"modulelistnames\", and \"localelist\".");
+ fprintf (stderr, "\"modulelistnames\", \"bibliography\", and \"localelist\".");
fprintf (stderr, "\n");
- fprintf (stderr, "Valid search_type values are: phrase (default), regex, multiword,\n");
- fprintf (stderr, " attribute, lucene, multilemma.\n");
+ fprintf (stderr, "Valid search_type values are: phrase , regex, multiword, attribute,\n");
+ fprintf (stderr, " lucene, multilemma.\n");
fprintf (stderr, "Valid (output) option_filters values are: n (Strong's numbers),\n");
fprintf (stderr, " f (Footnotes), m (Morphology), h (Section Headings),\n");
fprintf (stderr, " c (Cantillation), v (Hebrew Vowels), a (Greek Accents), p (Arabic Vowels)\n");
fprintf (stderr, " l (Lemmas), s (Scripture Crossrefs), r (Arabic Shaping),\n");
fprintf (stderr, " b (Bi-Directional Reordering), w (Red Words of Christ),\n");
- fprintf (stderr, " g (Glosses/Ruby), e (Word Enumerations),\n");
- fprintf (stderr, " x (Encoded Transliterations), t (Algorithmic Transliterations via ICU)\n");
+ fprintf (stderr, " g (Glosses/Ruby), e (Word Enumerations), i (Intros)\n");
+ fprintf (stderr, " x (Encoded Transliterations), t (Algorithmic Transliterations via ICU),\n");
+ fprintf (stderr, " M (morpheme segmentation)\n");
fprintf (stderr, "Maximum verses may be any integer value\n");
- fprintf (stderr, "Valid output_format values are: GBF, ThML, RTF, HTML, HTMLHREF, XHTML, OSIS,\n");
- fprintf (stderr, " CGI, and plain (def)\n");
- fprintf (stderr, "Valid output_encoding values are: Latin1, UTF8 (def), UTF16, HTML, and RTF\n");
+ fprintf (stderr, "Valid output_format values are: CGI, GBF, HTML, HTMLHREF, LaTeX, OSIS, RTF,\n");
+ fprintf (stderr, " ThML, WEBIF, XHTML, plain, and internal (def)\n");
+ fprintf (stderr, "The option LaTeX will produce a compilable document, but may well require\n");
+ fprintf (stderr, " tweaking to be usable.\n");
+ fprintf (stderr, "Valid output_encoding values are: Latin1, UTF8 (def), UTF16, HTML, RTF, and SCSU\n");
fprintf (stderr, "Valid locale values depend on installed locales. en is default.\n");
fprintf (stderr, "The query_key must be the last argument because all following\n");
fprintf (stderr, " arguments are added to the key.\n");
@@ -78,7 +81,7 @@ void printsyntax() {
int main(int argc, char **argv)
{
int maxverses = -1;
- unsigned char outputformat = FMT_PLAIN, searchtype = ST_NONE, outputencoding = ENC_UTF8;
+ unsigned char outputformat = FMT_INTERNAL, searchtype = ST_NONE, outputencoding = ENC_UTF8;
unsigned long optionfilters = OP_NONE;
char *text = 0, *locale = 0, *ref = 0, *range = 0;
char script[] = "Latin"; // for the moment, only this target script is supported
@@ -87,17 +90,17 @@ int main(int argc, char **argv)
char runquery = 0; // used to check that we have enough arguments to perform a legal query
// (a querytype & text = 1 and a ref = 2)
- for (int i = 1; i < argc; i++) {
+ for (int i = 1; i < argc; ++i) {
if (!::stricmp("-b", argv[i])) {
if (i+1 <= argc) {
- text = argv[i+1];
- i++;
+ ++i;
+ text = argv[i];
runquery |= RQ_BOOK;
}
}
else if (!::stricmp("-s", argv[i])) {
if (i+1 <= argc) {
- i++;
+ ++i;
if (!::stricmp("phrase", argv[i])) {
searchtype = ST_PHRASE;
}
@@ -125,129 +128,135 @@ int main(int argc, char **argv)
}
else if (!::stricmp("-r", argv[i])) {
if (i+1 <= argc) {
- range = argv[i+1];
- i++;
+ ++i;
+ range = argv[i];
}
}
else if (!::stricmp("-l", argv[i])) {
if (i+1 <= argc) {
- locale = argv[i+1];
- i++;
+ ++i;
+ locale = argv[i];
}
}
else if (!::stricmp("-m", argv[i])) {
if (i+1 <= argc) {
- maxverses = atoi(argv[i+1]);
- i++;
+ ++i;
+ maxverses = atoi(argv[i]);
}
}
else if (!::stricmp("-o", argv[i])) {
if (i+1 <= argc) {
- if (strchr(argv[i+1], 'f'))
+ ++i;
+ if (strchr(argv[i], 'f'))
optionfilters |= OP_FOOTNOTES;
- if (strchr(argv[i+1], 'n'))
+ if (strchr(argv[i], 'n'))
optionfilters |= OP_STRONGS;
- if (strchr(argv[i+1], 'h'))
+ if (strchr(argv[i], 'h'))
optionfilters |= OP_HEADINGS;
- if (strchr(argv[i+1], 'm'))
+ if (strchr(argv[i], 'm'))
optionfilters |= OP_MORPH;
- if (strchr(argv[i+1], 'c'))
+ if (strchr(argv[i], 'c'))
optionfilters |= OP_CANTILLATION;
- if (strchr(argv[i+1], 'v'))
+ if (strchr(argv[i], 'v'))
optionfilters |= OP_HEBREWPOINTS;
- if (strchr(argv[i+1], 'a'))
+ if (strchr(argv[i], 'a'))
optionfilters |= OP_GREEKACCENTS;
- if (strchr(argv[i+1], 'l'))
+ if (strchr(argv[i], 'l'))
optionfilters |= OP_LEMMAS;
- if (strchr(argv[i+1], 's'))
+ if (strchr(argv[i], 's'))
optionfilters |= OP_SCRIPREF;
- if (strchr(argv[i+1], 'r'))
+ if (strchr(argv[i], 'r'))
optionfilters |= OP_ARSHAPE;
- if (strchr(argv[i+1], 'b'))
+ if (strchr(argv[i], 'b'))
optionfilters |= OP_BIDI;
- if (strchr(argv[i+1], 'w'))
+ if (strchr(argv[i], 'w'))
optionfilters |= OP_REDLETTERWORDS;
- if (strchr(argv[i+1], 'p'))
+ if (strchr(argv[i], 'p'))
optionfilters |= OP_ARABICPOINTS;
- if (strchr(argv[i+1], 'g'))
+ if (strchr(argv[i], 'g'))
optionfilters |= OP_GLOSSES;
- if (strchr(argv[i+1], 'x'))
+ if (strchr(argv[i], 'x'))
optionfilters |= OP_XLIT;
- if (strchr(argv[i+1], 'e'))
+ if (strchr(argv[i], 'e'))
optionfilters |= OP_ENUM;
- if (strchr(argv[i+1], 't'))
+ if (strchr(argv[i], 'i'))
+ optionfilters |= OP_INTROS;
+ if (strchr(argv[i], 't'))
optionfilters |= OP_TRANSLITERATOR;
- i++;
+ if (strchr(argv[i], 'M'))
+ optionfilters |= OP_MORPHSEG;
}
}
else if (!::stricmp("-f", argv[i])) {
if (i+1 <= argc) {
- if (!::stricmp("thml", argv[i+1])) {
+ ++i;
+ if (!::stricmp("thml", argv[i])) {
outputformat = FMT_THML;
- i++;
}
- else if (!::stricmp("cgi", argv[i+1])) {
+ else if (!::stricmp("cgi", argv[i])) {
outputformat = FMT_CGI;
- i++;
}
- else if (!::stricmp("gbf", argv[i+1])) {
+ else if (!::stricmp("gbf", argv[i])) {
outputformat = FMT_GBF;
- i++;
}
- else if (!::stricmp("htmlhref", argv[i+1])) {
+ else if (!::stricmp("htmlhref", argv[i])) {
outputformat = FMT_HTMLHREF;
- i++;
}
- else if (!::stricmp("html", argv[i+1])) {
+ else if (!::stricmp("html", argv[i])) {
outputformat = FMT_HTML;
- i++;
}
- else if (!::stricmp("xhtml", argv[i+1])) {
+ else if (!::stricmp("xhtml", argv[i])) {
outputformat = FMT_XHTML;
- i++;
}
- else if (!::stricmp("rtf", argv[i+1])) {
+ else if (!::stricmp("rtf", argv[i])) {
outputformat = FMT_RTF;
- i++;
}
- else if (!::stricmp("osis", argv[i+1])) {
+ else if (!::stricmp("osis", argv[i])) {
outputformat = FMT_OSIS;
- i++;
}
- else i++;
+ else if (!::stricmp("latex", argv[i])) {
+ outputformat = FMT_LATEX;
+ }
+ else if (!::stricmp("plain", argv[i])) {
+ outputformat = FMT_PLAIN;
+ }
+ else if (!::stricmp("webif", argv[i])) {
+ outputformat = FMT_WEBIF;
+ }
+ else if (!::stricmp("internal", argv[i])) {
+ outputformat = FMT_INTERNAL;
+ }
}
}
else if (!::stricmp("-e", argv[i])) {
if (i+1 <= argc) {
- if (!::stricmp("utf8", argv[i+1])) {
+ ++i;
+ if (!::stricmp("utf8", argv[i])) {
outputencoding = ENC_UTF8;
- i++;
}
- else if (!::stricmp("rtf", argv[i+1])) {
+ else if (!::stricmp("rtf", argv[i])) {
outputencoding = ENC_RTF;
- i++;
}
- else if (!::stricmp("html", argv[i+1])) {
+ else if (!::stricmp("html", argv[i])) {
outputencoding = ENC_HTML;
- i++;
}
- else if (!::stricmp("latin1", argv[i+1])) {
+ else if (!::stricmp("latin1", argv[i])) {
outputencoding = ENC_LATIN1;
- i++;
}
- else if (!::stricmp("utf16", argv[i+1])) {
+ else if (!::stricmp("utf16", argv[i])) {
outputencoding = ENC_UTF16;
- i++;
}
- else i++;
+ else if (!::stricmp("scsu", argv[i])) {
+ outputencoding = ENC_SCSU;
+ }
}
}
else if (!::stricmp("-k", argv[i])) {
- i++;
+ ++i;
if (i < argc) {
SWBuf key = argv[i];
- i++;
- for (; i < argc; i++) {
+ ++i;
+ for (; i < argc; ++i) {
if (!::stricmp("-h", argv[i]) || !::stricmp("--help", argv[i]))
printsyntax();
key = key + " " + argv[i];
@@ -260,17 +269,17 @@ int main(int argc, char **argv)
}
else if (!::stricmp("-v", argv[i])) {
if (i+1 <= argc) {
- variants = atoi(argv[i+1]);
+ ++i;
+ variants = atoi(argv[i]);
optionfilters |= OP_VARIANTS;
- i++;
}
}
/*
else if (!::stricmp("-t", argv[i])) {
if (i+1 <= argc) {
- script = argv[i+1];
+ ++i;
+ script = argv[i];
optionfilters |= OP_TRANSLITERATOR;
- i++;
}
}
*/