# 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
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
}
}
-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} {
}
}
-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
}
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
proc reopen-target {target base} {
close-target
open-target $target $base
- update-target-hotlist $target
+ update-target-hotlist $target $base
}
proc define-target-action {} {
if {$target == ""} {
return
}
- update-target-hotlist $target
foreach n [array names profile] {
if {$n == $target} {
protocol-setup $n
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
}
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]
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
.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 {}
proc protocol-setup-delete {target} {
global profile
+ global settingsChanged
set a [alert "Are you sure you want to delete the target \
definition $target ?"]
set w .setup-${wno}
destroy $w
unset profile($target)
+ set settingsChanged 1
cascade-target-list
}
}
set ResultSetCheck [lindex $profile($target) 10]
set protocolRadioType [lindex $profile($target) 11]
if {$protocolRadioType == ""} {
- set protocolRadioType z39v2
+ set protocolRadioType Z39
}
# Databases ....
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
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
}
# 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 {}}}}
* 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.
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);
}
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;
}
{ "accessCtrl", 6},
{ "scan", 7},
{ "sort", 8},
- { "extentedServices", 10},
+ { "extendedServices", 10},
{ "level-1Segmentation", 11},
{ "level-2Segmentation", 12},
{ "concurrentOperations", 13},
if (argc <= 0)
{
- p->preferredMessageSize = 4096;
+ p->preferredMessageSize = 30000;
return TCL_OK;
}
return get_set_int (&p->preferredMessageSize, interp, argc, argv);
if (argc <= 0)
{
- p->maximumRecordSize = 32768;
+ p->maximumRecordSize = 30000;
return TCL_OK;
}
return get_set_int (&p->maximumRecordSize, interp, argc, argv);
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)
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;
}
}
else
p->callback = NULL;
- p->interp = interp;
+ p->interp = irTcl_interp;
}
return TCL_OK;
}
}
else
p->failback = NULL;
- p->interp = interp;
+ p->interp = irTcl_interp;
}
return TCL_OK;
}
}
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;
switch (p->protocol_type)
{
case PROTO_Z3950:
- Tcl_AppendElement (interp, "Z3950");
+ Tcl_AppendElement (interp, "Z39");
break;
case PROTO_SR:
Tcl_AppendElement (interp, "SR");
(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;
}