From 3b51b9eef6e55ecf0fff481d06ac173988d53b27 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 19 Jun 1995 08:08:44 +0000 Subject: [PATCH] client.tcl: hotTargets now contain both database and target name. ir-tcl.c: setting protocol edited. Errors in callbacks are logged by logf(LOG_WARN, ...) calls. --- client.tcl | 82 +++++++++++++++++++++++++++++++++++++++++----------------- clientrc.tcl | 37 +++++++++++++------------- ir-tcl.c | 30 ++++++++++++++------- 3 files changed, 96 insertions(+), 53 deletions(-) diff --git a/client.tcl b/client.tcl index 5f7fb28..977b3d5 100644 --- a/client.tcl +++ b/client.tcl @@ -4,7 +4,12 @@ # Sebastian Hammer, Adam Dickmeiss # # $Log: client.tcl,v $ -# Revision 1.44 1995-06-16 14:55:18 adam +# Revision 1.45 1995-06-19 08:08:44 adam +# client.tcl: hotTargets now contain both database and target name. +# ir-tcl.c: setting protocol edited. Errors in callbacks are logged +# by logf(LOG_WARN, ...) calls. +# +# Revision 1.44 1995/06/16 14:55:18 adam # Book logo mirrored. # # Revision 1.43 1995/06/16 14:41:05 adam @@ -159,7 +164,7 @@ set busy 0 set libDir "" -set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} z39v2} +set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39} set hostid Default set settingsChanged 0 set setNo 0 @@ -336,8 +341,18 @@ proc cancel-operation {} { } } -proc show-target {target} { - .bot.a.target configure -text "$target" +proc show-target {target base} { + global profile + + if {$target == ""} { + .bot.a.target configure -text "" + return + } + if {$base == ""} { + .bot.a.target configure -text "$target" + } else { + .bot.a.target configure -text "$target - $base" + } } proc show-logo {v1} { @@ -619,18 +634,22 @@ proc popup-marc {sno no b df} { } } -proc update-target-hotlist {target} { +proc update-target-hotlist {target base} { global hotTargets set len [llength $hotTargets] if {$len > 0} { .top.target.m delete 6 [expr 6+[llength $hotTargets]] } - set indx [lsearch $hotTargets $target] - if {$indx >= 0} { - set hotTargets [lreplace $hotTargets $indx $indx] + set i 0 + foreach e $hotTargets { + if {$target == [lindex $e 0] && $base == [lindex $e 1]} { + set hotTargets [lreplace $hotTargets $i $i] + break + } + incr i } - set hotTargets [linsert $hotTargets 0 $target] + set hotTargets [linsert $hotTargets 0 [list $target $base]] set-target-hotlist } @@ -638,9 +657,16 @@ proc set-target-hotlist {} { global hotTargets set i 1 - foreach target $hotTargets { - .top.target.m add command -label "$i $target" -command \ + foreach e $hotTargets { + set target [lindex $e 0] + set base [lindex $e 1] + if {$base == ""} { + .top.target.m add command -label "$i $target" -command \ [list reopen-target $target {}] + } else { + .top.target.m add command -label "$i $target - $base" -command \ + [list reopen-target $target $base] + } incr i if {$i > 8} { break @@ -651,7 +677,7 @@ proc set-target-hotlist {} { proc reopen-target {target base} { close-target open-target $target $base - update-target-hotlist $target + update-target-hotlist $target $base } proc define-target-action {} { @@ -661,7 +687,6 @@ proc define-target-action {} { if {$target == ""} { return } - update-target-hotlist $target foreach n [array names profile] { if {$n == $target} { protocol-setup $n @@ -682,9 +707,9 @@ proc fail-response {target} { tkerror "Target connection closed or protocol error" } -proc connect-response {target} { +proc connect-response {target base} { puts "connect-response" - show-target $target + show-target $target $base init-request } @@ -694,6 +719,7 @@ proc open-target {target base} { z39 disconnect z39 comstack [lindex $profile($target) 6] + z39 protocol [lindex $profile($target) 11] z39 idAuthentication [lindex $profile($target) 3] z39 maximumRecordSize [lindex $profile($target) 4] z39 preferredMessageSize [lindex $profile($target) 5] @@ -701,17 +727,23 @@ proc open-target {target base} { puts [z39 maximumRecordSize] puts -nonewline "preferredMessageSize=" puts [z39 preferredMessageSize] - show-status {Connecting} 0 0 + show-status {Connecting} 1 0 if {$base == ""} { z39 databaseNames [lindex [lindex $profile($target) 7] 0] } else { z39 databaseNames $base } z39 failback [list fail-response $target] - z39 callback [list connect-response $target] - z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2] + z39 callback [list connect-response $target $base] + set err [catch { + z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2] + } errorMessage] + if {$err} { + tkerror $errorMessage + show-status Ready 0 {} + return + } # z39 options search present scan namedResultSets triggerResourceCtrl - show-status {Connecting} 1 {} set hostid $target .top.target.m disable 0 .top.target.m enable 1 @@ -728,7 +760,7 @@ proc close-target {} { .bot.a.set configure -text "" set hostid Default z39 disconnect - show-target {} + show-target {} {} show-status {Not connected} 0 0 init-title-lines show-message {} @@ -1303,6 +1335,7 @@ proc define-target-dialog {} { proc protocol-setup-delete {target} { global profile + global settingsChanged set a [alert "Are you sure you want to delete the target \ definition $target ?"] @@ -1311,6 +1344,7 @@ definition $target ?"] set w .setup-${wno} destroy $w unset profile($target) + set settingsChanged 1 cascade-target-list } } @@ -1481,7 +1515,7 @@ proc protocol-setup {target} { set ResultSetCheck [lindex $profile($target) 10] set protocolRadioType [lindex $profile($target) 11] if {$protocolRadioType == ""} { - set protocolRadioType z39v2 + set protocolRadioType Z39 } # Databases .... @@ -1526,9 +1560,9 @@ proc protocol-setup {target} { label $w.top.protocol.label -text "Protocol" radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \ - -command {puts z39v2} -variable protocolRadioType -value z39v2 + -command {puts Z39} -variable protocolRadioType -value Z39 radiobutton $w.top.protocol.sr -text "SR" -anchor w \ - -command {puts sr} -variable protocolRadioType -value sr + -command {puts sr} -variable protocolRadioType -value SR pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \ -padx 4 -side top -fill x @@ -1812,7 +1846,7 @@ proc exit-action {} { global settingsChanged if {$settingsChanged} { - set a [alert "you havent saved your settings. Do you wish to save?"] + set a [alert "you haven't saved your settings. Do you wish to save?"] if {$a} { save-settings } diff --git a/clientrc.tcl b/clientrc.tcl index 752ea37..a9e19ee 100644 --- a/clientrc.tcl +++ b/clientrc.tcl @@ -1,23 +1,22 @@ # Setup file -set {profile(CNIDR)} {CNIDR Kudzu.cnidr.org 5556 {} 16384 8192 tcpip {Book ERIC} 1 {} {} z39v2 1} -set {profile(Penn)} {{Penn State's Library} 128.118.88.200 210 {} 16384 8192 tcpip CATALOG 1 {} {} z39v2 2} -set {profile(A new server)} {{A completely new server} dtbsun.dtv.dk 9999 {} 16384 8192 tcpip {aaa aaaa} {} {} {} z39v2 20} -set {profile(ztest)} {{test server} localhost 9999 {} 16384 4096 tcpip dummy 1 {} {} z39v2 3} -set {profile(madison)} {{University of Wisconsin-Madison} z3950.adp.wisc.edu 210 {} 16384 8192 tcpip madison 1 {} {} z39v2 22} -set {profile(Nsrtest)} {{NSR in house.} localhost 4500 {} 16384 8192 mosi x 1 {} {} sr 4} -set {profile(Default)} {{} {} {210} {} 16384 8192 tcpip {} {} {} {} {} 23} -set {profile(RLG)} {{Research Libraries group} rlg.stanford.edu 210 {} 4096 4096 tcpip {BKS AMC MAPS MDF REC SCO SER VIM NAF SAF AUT CATALOG ABI AVI DSA EIP FLP HAP HST NPA PAI PRA WLI} 1 {} {} z39v2 5} -set {profile(AT&T server)} {{AT&T Z39 Server} z3950.research.att.com 210 {} 16384 8192 tcpip Default {} {} {} z39v2 21} -set {profile(LOC)} {{Library of Congress} IBM2.LOC.gov 210 {} 16384 16384 tcpip {BOOKS NAMES} 1 {} 0 z39v2 6} -set {profile(IREG)} {{Internet Resource} frost.notis.com 210 {} 16384 8192 tcpip {IREG ERIC} 1 {} {} z39v2 7} -set {profile(DANBIB)} {{SR Target DANBIB} 0103/find2.denet.dk 4500 {} 8192 8192 mosi danbib 1 {} 1 z39v2 8} -set {profile(OCLC)} {{OCLC First search engine} z3950.oclc.org 210 {} 16384 8192 tcpip {ArticleFirst BiographyIndex BusinessPeriodicalsIndex} 1 {} {} z39v2 9} -set {profile(Aleph)} {{Aleph at ram10.aleph.co.il:5555} localhost 9998 {} 16384 4096 tcpip {dem mar} 1 0 1 z39v2 10} -set {profile(CARL)} {{CARL systems} Z39.50.carl.org 210 {} 16384 8192 tcpip {ACC AIC AUR BEM CUB DPL DNU EPL FRC LAW LCC MCC MIN MPL NJC NWC OCC PPC PUE RDR RGU SPL TCC TKU UNC WYO} 1 {} {} z39v2 11} -set {profile(Innovative)} {{Innovatives server: demo.iii.com} demo.iii.com 210 {} 16384 8192 tcpip DEFAULT 1 {} {} z39v2 12} -set {profile(CLSI)} {CLSI inet-gw.clsi.uc.geac.com 210 {} 16384 8192 tcpip Cl 1 {} {} z39v2 13} -set {profile(AULS)} {{Acadia university} auls.acadiau.ca 210 {} 16384 8192 tcpip AULS 1 {} {} z39v2 14} -set {profile(dranet)} {dranet dranet.dra.com 210 {} 16384 16384 tcpip drewdb 1 {} {} z39v2 15} +set {profile(CNIDR)} {CNIDR Kudzu.cnidr.org 5556 {} 16384 8192 tcpip {Book ERIC} 1 {} {} Z39 1} +set {profile(Penn)} {{Penn State's Library} 128.118.88.200 210 {} 16384 8192 tcpip CATALOG 1 {} {} Z39 2} +set {profile(ztest)} {{test server} localhost 9999 {} 16384 4096 tcpip dummy 1 {} {} Z39 3} +set {profile(madison)} {{University of Wisconsin-Madison} z3950.adp.wisc.edu 210 {} 16384 8192 tcpip madison 1 {} {} Z39 22} +set {profile(Nsrtest)} {{NSR in house.} localhost 4500 {} 16384 8192 mosi x 1 {} {} SR 4} +set {profile(Default)} {{} {} {210} {} 16384 8192 tcpip {} {} {} {} {} 24} +set {profile(RLG)} {{Research Libraries group} rlg.stanford.edu 210 {} 4096 4096 tcpip {BKS AMC MAPS MDF REC SCO SER VIM NAF SAF AUT CATALOG ABI AVI DSA EIP FLP HAP HST NPA PAI PRA WLI} 1 {} {} Z39 5} +set {profile(AT&T server)} {{AT&T Z39 Server} z3950.research.att.com 210 {} 16384 8192 tcpip Default {} {} {} Z39 21} +set {profile(LOC)} {{Library of Congress} IBM2.LOC.gov 210 {} 16384 16384 tcpip {BOOKS NAMES} 1 {} 0 Z39 6} +set {profile(IREG)} {{Internet Resource} frost.notis.com 210 {} 16384 8192 tcpip {IREG ERIC} 1 {} {} Z39 7} +set {profile(DANBIB)} {{SR Target DANBIB} 0103/find2.denet.dk 4500 {} 8192 8192 mosi danbib 1 {} 1 SR 8} +set {profile(OCLC)} {{OCLC First search engine} z3950.oclc.org 210 {} 16384 8192 tcpip {ArticleFirst BiographyIndex BusinessPeriodicalsIndex} 1 {} {} Z39 9} +set {profile(CARL)} {{CARL systems} Z39.50.carl.org 210 {} 16384 8192 tcpip {ACC AIC AUR BEM CUB DPL DNU EPL FRC LAW LCC MCC MIN MPL NJC NWC OCC PPC PUE RDR RGU SPL TCC TKU UNC WYO} 1 {} {} Z39 11} +set {profile(Aleph)} {{Aleph at ram10.aleph.co.il:5555} localhost 9998 {} 16384 4096 tcpip {dem mar} 1 0 1 Z39 10} +set {profile(CLSI)} {CLSI inet-gw.clsi.uc.geac.com 210 {} 16384 8192 tcpip Cl 1 {} {} Z39 13} +set {profile(Innovative)} {{Innovatives server: demo.iii.com} demo.iii.com 210 {} 16384 8192 tcpip DEFAULT 1 {} {} Z39 12} +set {profile(AULS)} {{Acadia university} auls.acadiau.ca 210 {} 16384 8192 tcpip AULS 1 {} {} Z39 14} +set {profile(dranet)} {dranet dranet.dra.com 210 {} 16384 16384 tcpip drewdb 1 {} {} Z39 15} set queryTypes {Simple aaaaaaa phrase} set queryButtons {{ {I 0} {I 1} {I 2} } {{I 0} {I 1}} {{I 0} {I 1} {I 0}}} set queryInfo {{ {Title {1=4}} {Author {1=1}} {Subject {1=21}} {Any {1=1016}}} {{Title 1=4} {Year 1=30} {xxx 1=1034}} {{Title 1=4 4=1 6=2} {Author 1=1003 4=1 6=2} {ISBN 1=7} {ISSN 1=8} {Year 1=30 4=4 6=2} {Any {}}}} diff --git a/ir-tcl.c b/ir-tcl.c index 5569990..942ad55 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,12 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.41 1995-06-16 12:28:16 adam + * Revision 1.42 1995-06-19 08:08:52 adam + * client.tcl: hotTargets now contain both database and target name. + * ir-tcl.c: setting protocol edited. Errors in callbacks are logged + * by logf(LOG_WARN, ...) calls. + * + * Revision 1.41 1995/06/16 12:28:16 adam * Implemented preferredRecordSyntax. * Minor changes in diagnostic handling. * Record list deleted when connection closes. @@ -158,6 +163,8 @@ typedef struct { IrTcl_Method *tab; } IrTcl_Methods; +static Tcl_Interp *irTcl_interp; + static void ir_deleteDiags (IrTcl_Diagnostic **dst_list, int *dst_num); static int do_disconnect (void *obj, Tcl_Interp *interp, int argc, char **argv); @@ -235,6 +242,8 @@ int IrTcl_eval (Tcl_Interp *interp, const char *command) } strcpy (tmp, command); r = Tcl_Eval (interp, tmp); + if (r == TCL_ERROR) + logf (LOG_WARN, "Tcl error in line %d: %s", interp->errorLine, interp->result); free (tmp); return r; } @@ -600,7 +609,7 @@ static int do_options (void *obj, Tcl_Interp *interp, { "accessCtrl", 6}, { "scan", 7}, { "sort", 8}, - { "extentedServices", 10}, + { "extendedServices", 10}, { "level-1Segmentation", 11}, { "level-2Segmentation", 12}, { "concurrentOperations", 13}, @@ -631,7 +640,7 @@ static int do_preferredMessageSize (void *obj, Tcl_Interp *interp, if (argc <= 0) { - p->preferredMessageSize = 4096; + p->preferredMessageSize = 30000; return TCL_OK; } return get_set_int (&p->preferredMessageSize, interp, argc, argv); @@ -647,7 +656,7 @@ static int do_maximumRecordSize (void *obj, Tcl_Interp *interp, if (argc <= 0) { - p->maximumRecordSize = 32768; + p->maximumRecordSize = 30000; return TCL_OK; } return get_set_int (&p->maximumRecordSize, interp, argc, argv); @@ -677,7 +686,7 @@ static int do_implementationName (void *obj, Tcl_Interp *interp, if (argc == 0) return ir_strdup (interp, &p->implementationName, - "Index Data/TCL/TK on YAZ"); + "Index Data/IrTcl on YAZ"); else if (argc == -1) return ir_strdel (interp, &p->implementationName); if (argc == 3) @@ -892,7 +901,7 @@ static int do_connect (void *obj, Tcl_Interp *interp, return TCL_ERROR; if ((r=cs_connect (p->cs_link, addr)) < 0) { - interp->result = "cs_connect fail"; + interp->result = "connect fail"; do_disconnect (p, NULL, 2, NULL); return TCL_ERROR; } @@ -998,7 +1007,7 @@ static int do_callback (void *obj, Tcl_Interp *interp, } else p->callback = NULL; - p->interp = interp; + p->interp = irTcl_interp; } return TCL_OK; } @@ -1028,7 +1037,7 @@ static int do_failback (void *obj, Tcl_Interp *interp, } else p->failback = NULL; - p->interp = interp; + p->interp = irTcl_interp; } return TCL_OK; } @@ -1047,7 +1056,7 @@ static int do_protocol (void *o, Tcl_Interp *interp, int argc, char **argv) } else if (argc == 3) { - if (!strcmp (argv[2], "Z3950")) + if (!strcmp (argv[2], "Z39")) p->protocol_type = PROTO_Z3950; else if (!strcmp (argv[2], "SR")) p->protocol_type = PROTO_SR; @@ -1061,7 +1070,7 @@ static int do_protocol (void *o, Tcl_Interp *interp, int argc, char **argv) switch (p->protocol_type) { case PROTO_Z3950: - Tcl_AppendElement (interp, "Z3950"); + Tcl_AppendElement (interp, "Z39"); break; case PROTO_SR: Tcl_AppendElement (interp, "SR"); @@ -2912,6 +2921,7 @@ int ir_tcl_init (Tcl_Interp *interp) (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateCommand (interp, "ir-scan", ir_scan_obj_mk, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); + irTcl_interp = interp; return TCL_OK; } -- 1.7.10.4