Ported ir-tcl to use the beta releases of tcl7.5/tk4.1.
[ir-tcl-moved-to-github.git] / iterate.tcl
index b04d101..91c9b8a 100644 (file)
@@ -1,28 +1,52 @@
-# $Id: iterate.tcl,v 1.1 1995-03-20 08:53:28 adam Exp $
+# $Id: iterate.tcl,v 1.4 1995-08-04 11:32:40 adam Exp $
 #
-# Small test script which searches for adam ...
+# Small test script which searches for science ...
+proc fail-back {} {
+    puts "Fail"
+}
+
+proc connect-response {} {
+    z callback {init-response}
+    ir-set z.1 z
+    z init
+}
 proc init-response {} {
     global count
 
     set count 0
     puts "In init-response"
-    z callback {search-response}
-    z.1 search adam
+    do-search
 }
 
-proc search-response {} {
+proc do-search {} {
     global count
 
     incr count
-    puts "In search-response $count"
+    puts $count
     z callback {search-response}
-    z.1 search adam
+    z.1 search science
+}
+
+proc search-response {} {
+    set hits [z.1 resultCount]
+    if {$hits <= 0} {
+        do-search
+    }
+    z callback {present-response}
+    if {$hits < 10} {
+        z.1 present 1 $hits
+    } else {
+        z.1 present 1 10
+    }
+}
+
+proc present-response {} {
+    do-search
 }
 
 ir z
-ir-set z.1
-z databaseNames DEM
-z connect localhost:9999
-z callback {init-response}
-z init
+z failback {fail-back}
+z databaseNames dummy
+z callback {connect-response}
+z connect localhost:210