Shell works more like the YAZ line mode client.
[ir-tcl-moved-to-github.git] / iterate.tcl
1 # $Id: iterate.tcl,v 1.5 1996-08-21 11:24:01 adam Exp $
2 #
3 # Small test script which searches for science ...
4 proc fail-back {} {
5     puts "Fail"
6 }
7
8 proc connect-response {} {
9     z callback {init-response}
10     ir-set z.1 z
11     z init
12 }
13 proc init-response {} {
14     global count
15
16     set count 0
17     puts "In init-response"
18     do-search
19 }
20
21 proc do-search {} {
22     global count
23
24     incr count
25     puts $count
26     z callback {search-response}
27     z.1 search science
28 }
29
30 proc search-response {} {
31     set hits [z.1 resultCount]
32     if {$hits <= 0} {
33         do-search
34     }
35     z callback {present-response}
36     if {$hits < 10} {
37         z.1 present 1 $hits
38     } else {
39         z.1 present 1 10
40     }
41 }
42
43 proc present-response {} {
44     do-search
45 }
46
47 ir z
48 z failback {fail-back}
49 z databaseNames dummy
50 z callback {connect-response}
51 z connect localhost:9999
52 vwait forever