First search request/response that works.
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 27 Oct 1995 17:30:15 +0000 (17:30 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 27 Oct 1995 17:30:15 +0000 (17:30 +0000)
www/Makefile
www/query.egw
www/search.egw
www/wirtcl.c
www/wtcl.c

index e2efd2b..ae58bd1 100644 (file)
@@ -2,7 +2,10 @@
 # Europagate, 1995
 #
 # $Log: Makefile,v $
-# Revision 1.5  1995/10/27 15:12:02  adam
+# Revision 1.6  1995/10/27 17:30:15  adam
+# First search request/response that works.
+#
+# Revision 1.5  1995/10/27  15:12:02  adam
 # IrTcl incorporated in the gateway.
 # Better separation of script types.
 # Z39.50 gateway scripts entered.
@@ -58,7 +61,9 @@ $(TPROG2): $(P2)
 $(TPROG3): $(P3)
        $(CC) $(CFLAGS) -o $(TPROG3) $(P3) $(OLIB)
 
-install: $(TPROG1) $(TPROG2)
+install: install.prog install.script
+
+install.prog: $(TPROG1) $(TPROG2)
        @for x in $(TPROG1) $(TPROG2); do \
                echo Installing $$x; \
                cp $$x $(CGIBIN); \
@@ -67,6 +72,8 @@ install: $(TPROG1) $(TPROG2)
        ln -f $(CGIBIN)/$(TPROG2) $(CGIBIN)/egwtcl; \
        ln -f $(CGIBIN)/$(TPROG2) $(CGIBIN)/egwirtcl; \
        ln -f $(CGIBIN)/$(TPROG2) $(CGIBIN)/egwhtml
+
+install.script:
        @for x in $(WSCRIPTS); do \
                echo Installing $$x; \
                cp $$x $(CGIBIN); \
index e188c71..3f0d25f 100644 (file)
@@ -1,6 +1,12 @@
 <html>
 {
-# $Id: query.egw,v 1.2 1995/10/27 15:12:04 adam Exp $
+# $Id: query.egw,v 1.3 1995/10/27 17:30:15 adam Exp $
+proc fail-response {} {
+    global sessionWait
+    htmlr {Init fail<br>}
+    set sessionWait 0
+}
+
 proc init-response {} {
     global sessionWait
     htmlr {Init ok <br>}
@@ -11,8 +17,9 @@ proc init-response {} {
 
     set t $sessionParms
     set databases [lindex $targets($t) 1]
-    ir z39
     set sessionWait 1
+    ir z39
+    z39 failback fail-response
     z39 connect $t
     z39 callback init-response
     z39 init
index d521220..7c0b84e 100644 (file)
@@ -1,9 +1,36 @@
 <html>
 {
-# $Id: search.egw,v 1.1 1995/10/23 17:04:17 adam Exp $
+# $Id: search.egw,v 1.2 1995/10/27 17:30:16 adam Exp $
+
+proc search-response {} {
+    global sessionWait
+    set sessionWait 0
+
+    htmlr "search response <br>"
+    set r [z39.1 resultCount]
+    htmlr "<strong>$r hits</strong><br>"
+    htmlr "</body></html>"
+}
+
+proc fail-response {} {
+    global sessionWait
+    set sessionWait 0
+
+    htmlr "<strong>failed</strong><br>"
+    htmlr "</body></html>"
+}
+
+    global sessionWait
+
+    z39 callback search-response
+    z39 failback fail-response
+    set sessionWait 1
+    ir-set z39.1 z39
+    z39.1 databaseNames [form base]
+    z39.1 search [form entry1]
+    htmlr <head>
+    htmlr "<title> WWW/Z39.50 Gateway Search Result ...</title>"
 }
-<head>
-<title> WWW/Z39.50 Gateway Search Result</title>
 </head>
 <body>
 sessionId: {html $sessionId} <br>
@@ -12,6 +39,6 @@ form: {html [form]} <br>
 target: {html $t} <br>
 databases: {html $databases} <br>
 <h2> Search in databases </h2>
-<h1> <blink> Not Functional Yet </blink> </h1>
-</body>
-</html>
+{
+    htmlr [form entry1] <br>
+}
index c6548ce..f05500f 100644 (file)
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * $Log: wirtcl.c,v $
- * Revision 1.1  1995/10/27 15:12:08  adam
+ * Revision 1.2  1995/10/27 17:30:16  adam
+ * First search request/response that works.
+ *
+ * Revision 1.1  1995/10/27  15:12:08  adam
  * IrTcl incorporated in the gateway.
  * Better separation of script types.
  * Z39.50 gateway scripts entered.
@@ -83,9 +86,23 @@ struct tcl_info {
     WCLIENT wcl;
 };
 
+
+/* select(2) callbacks */
+struct callback {
+    void (*r_handle)(ClientData);
+    void (*w_handle)(ClientData);
+    void (*x_handle)(ClientData);
+    void *obj;
+};
+#define MAX_CALLBACK 200
+
+static struct callback callback_table[MAX_CALLBACK];
+static int max_fd = 3;            /* don't worry: it will grow... */
+
 static void *do_create (WCLIENT wcl, void *args)
 {
     struct tcl_info *p;
+    int i;
 
     if (!(p = malloc (sizeof(*p))))
     {
@@ -105,20 +122,15 @@ static void *do_create (WCLIENT wcl, void *args)
         exit (1);
     }
     /* initialize irtcl */
+    for (i=0; i<MAX_CALLBACK; i++)
+    {
+        callback_table[i].r_handle = NULL;
+        callback_table[i].w_handle = NULL;
+        callback_table[i].x_handle = NULL;
+    }
     return p;
 }
 
-/* select(2) callbacks */
-struct callback {
-    void (*r_handle)(ClientData);
-    void (*w_handle)(ClientData);
-    void (*x_handle)(ClientData);
-    void *obj;
-};
-#define MAX_CALLBACK 200
-
-static struct callback callback_table[MAX_CALLBACK];
-static int max_fd = 3;            /* don't worry: it will grow... */
 
 static int do_exec (const char *fname, char *parms, void *mydata)
 {
@@ -129,12 +141,6 @@ static int do_exec (const char *fname, char *parms, void *mydata)
     static fd_set fdset_tcl_w;
     static fd_set fdset_tcl_x;
 
-    for (i=0; i<MAX_CALLBACK; i++)
-    {
-        callback_table[i].r_handle = NULL;
-        callback_table[i].w_handle = NULL;
-        callback_table[i].x_handle = NULL;
-    }
     if ((r = w_interp_exec (p->w_interp, fname, parms)))
         return r;
     while (1)
@@ -142,6 +148,9 @@ static int do_exec (const char *fname, char *parms, void *mydata)
         FD_ZERO (&fdset_tcl_r);
         FD_ZERO (&fdset_tcl_w);
         FD_ZERO (&fdset_tcl_x);
+
+       if ((cp=Tcl_GetVar (p->interp, "sessionWait", 0)) && !strcmp (cp, "0"))
+            return 0;
         for (r=0, i=min_fd; i<=max_fd; i++)
         {
             if (callback_table[i].w_handle)
@@ -188,8 +197,6 @@ static int do_exec (const char *fname, char *parms, void *mydata)
                 (*callback_table[i].x_handle) (callback_table[i].obj);
             }
         }
-       if ((cp=Tcl_GetVar (p->interp, "sessionWait", 0)) && !strcmp (cp, "0"))
-            return 0;
     }
     return 0;
 }
index c724b02..5255b66 100644 (file)
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * $Log: wtcl.c,v $
- * Revision 1.3  1995/10/27 15:12:14  adam
+ * Revision 1.4  1995/10/27 17:30:16  adam
+ * First search request/response that works.
+ *
+ * Revision 1.3  1995/10/27  15:12:14  adam
  * IrTcl incorporated in the gateway.
  * Better separation of script types.
  * Z39.50 gateway scripts entered.
@@ -180,7 +183,7 @@ static void *do_create (WCLIENT wcl, void *args)
 static void report_error (struct tcl_info *p, int errorLine,
                           const char *pre, const char *msg)
 {
-    gw_log (GW_LOG_WARN, "%s %d\%s", pre, errorLine, msg);
+    gw_log (GW_LOG_WARN, mod, "%s %d %s", pre, errorLine, msg);
     wo_printf (p->wcl, "\n<br><hr>\n<strong>"
                "%s %d</strong><br>\n", pre, errorLine);
     wo_printf (p->wcl, "<xmp>\n%s</xmp>\n<hr>\n", msg);