Bump version to 1.4.3
[ir-tcl-moved-to-github.git] / att.tcl
1 # $Id: att.tcl,v 1.1 1996-11-14 17:11:39 adam Exp $
2 # Very simple Explain test script.
3 proc fail-response {} {
4     global ok
5     puts "fail"
6     set ok -1
7 }
8
9 proc present-response {} {
10     global ok
11
12     puts "Got Present Response"
13     set ok 1
14     z callback {puts ok}
15 }
16
17 proc search-response {} {
18     puts "Got Search Response"
19     set r [z.1 resultCount]
20     puts "resultCount $r"
21     z callback {present-response}
22     z.1 present 1 $r
23 }
24
25 proc init-response {} {
26     global ok
27     if {![z initResult]} {
28         puts "Connect rejected: [z userInformationField]"
29         set ok -1
30         return
31     }
32     puts "init ok"
33     set ok 1
34 }
35
36 proc connect-response {} {
37     z callback {init-response}
38     z init
39 }
40
41 proc connect {} {
42     ir z
43     z callback {connect-response}
44     z failback {fail-response}
45     if {1} {
46         puts "Connecting to AT&T's research server"
47         z connect z3950.research.att.com
48     } else {
49         puts "Connecting to Silverplatter's internal server"
50         z connect scono.silverplatter.com:7019
51         z idAuthentication indexd indexd indexd
52     }
53 }
54
55 proc explainSearch {q} {
56     global ok
57     z callback {search-response}
58     ir-set z.1 z
59     z.1 preferredRecordSyntax explain
60     z.1 databaseNames IR-Explain-1
61     z.1 search "@attrset exp1 @attr 1=1 $q"
62     set ok 0
63     vwait ok
64 }
65
66 proc DatabaseInfo {} {
67     explainSearch DatabaseInfo
68 }
69
70 proc TargetInfo {} {
71     explainSearch TargetInfo
72 }
73
74 set ok 0
75 connect
76 vwait ok
77 puts "Type"
78 puts "  explainSearch <category>"
79 puts "where <category> is TargetInfo, DatabaseInfo, SchemaInfo, etc."