diff options
author | danglassey <danglassey> | 2002-10-11 13:02:36 +0000 |
---|---|---|
committer | danglassey <danglassey> | 2002-10-11 13:02:36 +0000 |
commit | e59732cebdaf9f69f6c33206115df326de1133f3 (patch) | |
tree | 2b6b27c7c80cd184b3e3b6580f99a7d9d795cc72 /apps/console/diatheke | |
parent | ea2839d9ab02c10f20ec4abacc2a9f32016ac4c3 (diff) | |
download | sword-sf-cvs-e59732cebdaf9f69f6c33206115df326de1133f3.tar.gz |
sync with crosswire 20021011-1300
Diffstat (limited to 'apps/console/diatheke')
-rwxr-xr-x | apps/console/diatheke/cgi/diatheke.pl | 32 | ||||
-rw-r--r-- | apps/console/diatheke/corediatheke.cpp | 9 | ||||
-rw-r--r-- | apps/console/diatheke/corediatheke.h | 2 | ||||
-rw-r--r-- | apps/console/diatheke/diatheke.cpp | 18 |
4 files changed, 47 insertions, 14 deletions
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,8 +184,26 @@ if ($verse eq "") { <input type="radio" name="search" value="phrase" /><font face="Arial, Helvetica, sans-serif">Phrase Search</font><br /> <input type="radio" name="search" value="multiword" /><font face="Arial, Helvetica, sans-serif">Multiple Word Search</font><br /> <input type="radio" name="search" value="regex" /><font face="Arial, Helvetica, sans-serif">Regular Expression Search</font><br /> +<br /> <table width="100%" border="0"> <tr> + <td colspan="2" width="100%"> + + <table> + <tr> + <td> + <font size="-1" face="Arial, Helvetica, sans-serif">Custom Range Restriction</font> + </td> + <td> + <input type="text" name="range" size="20"> + </td> + </tr> + </table> + + </td> + </tr> + + <tr> <td width="50%"> <input type="checkbox" name="strongs" value="on" checked> <font size="-1" face="Arial, Helvetica, sans-serif">Show Strong's Numbers</font></td> @@ -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<br />"; + print "<br /><i>command line: $line\n</i><br /><br />"; } $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; } |