From e59732cebdaf9f69f6c33206115df326de1133f3 Mon Sep 17 00:00:00 2001 From: danglassey Date: Fri, 11 Oct 2002 13:02:36 +0000 Subject: sync with crosswire 20021011-1300 --- ChangeLog | 2 ++ apps/console/diatheke/cgi/diatheke.pl | 32 ++++++++++++++++++++++++++++---- apps/console/diatheke/corediatheke.cpp | 9 +++++++-- apps/console/diatheke/corediatheke.h | 2 +- apps/console/diatheke/diatheke.cpp | 18 +++++++++++------- usrinst.sh | 2 +- 6 files changed, 50 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3fd90d4..1d8e077 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ API ChangeLog (see the ChangeLog in each 'apps' directory for app specific changes +09-Oct-2002 Daniel Glassey + Add debian directory so you can build debs from cvs * Release 1.5.4a * diff --git a/apps/console/diatheke/cgi/diatheke.pl b/apps/console/diatheke/cgi/diatheke.pl index 1d3de91..3b0351d 100755 --- a/apps/console/diatheke/cgi/diatheke.pl +++ b/apps/console/diatheke/cgi/diatheke.pl @@ -10,7 +10,7 @@ $diatheke = "nice /usr/bin/diatheke"; # location of diatheke command line progr #$sword_path = "C:\\Program Files\\CrossWire\\The SWORD Project"; # SWORD_PATH environment variable you want to use #$diatheke = "$sword_path\\diatheke.exe"; # location of diatheke command line program -$cgiurl = "http:\/\/bible.gotjesus.org\/cgi-bin"; +$cgiurl = "http:\/\/www.crosswire.org\/cgi-bin"; $scriptname = "diatheke.pl"; $defaultfontface = "Times New Roman, Times, Roman, serif"; # default font name @@ -77,7 +77,7 @@ $palm = 0; $latinxlit = ""; $optionfilters = ""; -$debug=0; +$debug=1; foreach $i (@values) { ($varname, $mydata) = split(/=/,$i); if ($varname ne "Submit" && $varname ne "lookup") { @@ -89,6 +89,12 @@ foreach $i (@values) { elsif ($varname eq "search" && $mydata ne "" && $mydata ne "off") { $search = "-s $mydata"; } + elsif ($varname eq "range" && $mydata ne "" && $mydata ne "off") { + $range = $mydata; + $range =~ tr/+/ /; + $range =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; + $range = "-r \"$range\""; + } elsif ($varname eq "strongs") { $optionfilters .= "n"; @@ -178,7 +184,25 @@ if ($verse eq "") { Phrase Search
Multiple Word Search
Regular Expression Search
+
+ + + +
+ + + + + + +
+ Custom Range Restriction + + +
+ +
@@ -407,10 +431,10 @@ END } for ($i = 0; $i < $n; $i++) { - $line = "$diatheke $search $optionfilters $latinxlit -l $locale -m $maxverses -f cgi -b $versions[$i] -k \"$verse\" $err"; + $line = "$diatheke $search $range $optionfilters $latinxlit -l $locale -m $maxverses -f cgi -b $versions[$i] -k \"$verse\" $err"; if ($debug) { - print "command line: $line\n
"; + print "
command line: $line\n

"; } $line = `$line`; diff --git a/apps/console/diatheke/corediatheke.cpp b/apps/console/diatheke/corediatheke.cpp index 3b43450..17ad194 100644 --- a/apps/console/diatheke/corediatheke.cpp +++ b/apps/console/diatheke/corediatheke.cpp @@ -79,7 +79,7 @@ void systemquery(const char * key, ostream* output){ } } -void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAIN, unsigned char outputencoding = ENC_UTF8, unsigned long optionfilters = 0, unsigned char searchtype = ST_NONE, const char *text = 0, const char *locale = 0, const char *ref = 0, ostream* output = &cout, const char *script = 0, signed short variants = 0) { +void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAIN, unsigned char outputencoding = ENC_UTF8, unsigned long optionfilters = 0, unsigned char searchtype = ST_NONE, const char *range = 0, const char *text = 0, const char *locale = 0, const char *ref = 0, ostream* output = &cout, const char *script = 0, signed short variants = 0) { static DiathekeMgr manager; ModMap::iterator it; @@ -228,7 +228,12 @@ void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAI *output << ref; *output << "\"-- "; - listkey = target->Search(ref, st, REG_ICASE); + if (range) { + VerseKey parser; + ListKey scope = parser.ParseVerseList(range, parser, true); + listkey = target->Search(ref, st, REG_ICASE, &scope); + } + else listkey = target->Search(ref, st, REG_ICASE); if (strlen((const char*)listkey)) { if (!listkey.Error()) { diff --git a/apps/console/diatheke/corediatheke.h b/apps/console/diatheke/corediatheke.h index 45a0569..1b8fd3a 100644 --- a/apps/console/diatheke/corediatheke.h +++ b/apps/console/diatheke/corediatheke.h @@ -36,4 +36,4 @@ #define ST_MULTIWORD 3 // -2 int hasalpha (char * string); -void doquery(unsigned long maxverses, unsigned char outputformat, unsigned char outputencoding, unsigned long optionfilters, unsigned char searchtype, const char *text, const char *locale, const char *ref, std::ostream* output, const char* script, signed short variants); +void doquery(unsigned long maxverses, unsigned char outputformat, unsigned char outputencoding, unsigned long optionfilters, unsigned char searchtype, const char *range, const char *text, const char *locale, const char *ref, ostream* output, const char* script, signed short variants); diff --git a/apps/console/diatheke/diatheke.cpp b/apps/console/diatheke/diatheke.cpp index 58eaf01..51f98bb 100644 --- a/apps/console/diatheke/diatheke.cpp +++ b/apps/console/diatheke/diatheke.cpp @@ -22,7 +22,7 @@ void printsyntax() { fprintf (stderr, "Copyright 1999-2002 by the CrossWire Bible Society\n"); fprintf (stderr, "http://www.crosswire.org/sword/diatheke/\n"); fprintf (stderr, "usage: \n "); - fprintf (stderr, "diatheke <-b book> [-s search_type] [-o option_filters]\n"); + fprintf (stderr, "diatheke <-b book> [-s search_type] [-r search_range] [-o option_filters]\n"); fprintf (stderr, "[-m maximum_verses] [-f output_format] [-l locale]\n"); fprintf (stderr, "[-e output_encoding] [-t script] [-v variant#(-1=all|0|1)]\n"); fprintf (stderr, "<-k query_key>\n"); @@ -50,7 +50,7 @@ int main(int argc, char **argv) int maxverses = -1; unsigned char outputformat = FMT_PLAIN, searchtype = ST_NONE, outputencoding = ENC_UTF8; unsigned long optionfilters = OP_NONE; - char *text = 0, *locale = 0, *ref = 0, *script = 0; + char *text = 0, *locale = 0, *ref = 0, *script = 0, *range = 0; signed short variants = 0; char runquery = 0; // used to check that we have enough arguments to perform a legal query @@ -81,6 +81,12 @@ int main(int argc, char **argv) else i++; } } + else if (!stricmp("-r", argv[i])) { + if (i+1 <= argc) { + range = argv[i+1]; + i++; + } + } else if (!stricmp("-l", argv[i])) { if (i+1 <= argc) { locale = argv[i+1]; @@ -206,12 +212,10 @@ int main(int argc, char **argv) } - if (runquery == (RQ_BOOK | RQ_REF)) - { - doquery(maxverses, outputformat, outputencoding, optionfilters, searchtype, text, locale, ref, &cout, script, variants); + if (runquery == (RQ_BOOK | RQ_REF)) { + doquery(maxverses, outputformat, outputencoding, optionfilters, searchtype, range, text, locale, ref, &cout, script, variants); } - else - printsyntax(); + else printsyntax(); return 0; } diff --git a/usrinst.sh b/usrinst.sh index e9be9e6..c24e5bf 100755 --- a/usrinst.sh +++ b/usrinst.sh @@ -1,7 +1,7 @@ #!/bin/sh CPPFLAGS=-DUSBINARY ./configure --prefix=/usr \ - --disable-shared --disable-debug --without-conf --sysconfdir=/etc + --disable-shared --disable-debug --without-conf --sysconfdir=/etc \ --with-vcl \ $* -- cgit