From c1c09b4242df9a16cd11477deea2e35f8ff57fec Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 27 Oct 1995 17:30:15 +0000 Subject: [PATCH] First search request/response that works. --- www/Makefile | 11 +++++++++-- www/query.egw | 11 +++++++++-- www/search.egw | 39 +++++++++++++++++++++++++++++++++------ www/wirtcl.c | 47 +++++++++++++++++++++++++++-------------------- www/wtcl.c | 7 +++++-- 5 files changed, 83 insertions(+), 32 deletions(-) diff --git a/www/Makefile b/www/Makefile index e2efd2b..ae58bd1 100644 --- a/www/Makefile +++ b/www/Makefile @@ -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); \ diff --git a/www/query.egw b/www/query.egw index e188c71..3f0d25f 100644 --- a/www/query.egw +++ b/www/query.egw @@ -1,6 +1,12 @@ { -# $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
} + set sessionWait 0 +} + proc init-response {} { global sessionWait htmlr {Init ok
} @@ -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 diff --git a/www/search.egw b/www/search.egw index d521220..7c0b84e 100644 --- a/www/search.egw +++ b/www/search.egw @@ -1,9 +1,36 @@ { -# $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
" + set r [z39.1 resultCount] + htmlr "$r hits
" + htmlr "" +} + +proc fail-response {} { + global sessionWait + set sessionWait 0 + + htmlr "failed
" + htmlr "" +} + + 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 + htmlr " WWW/Z39.50 Gateway Search Result ..." } - - WWW/Z39.50 Gateway Search Result sessionId: {html $sessionId}
@@ -12,6 +39,6 @@ form: {html [form]}
target: {html $t}
databases: {html $databases}

Search in databases

-

Not Functional Yet

- - +{ + htmlr [form entry1]
+} diff --git a/www/wirtcl.c b/www/wirtcl.c index c6548ce..f05500f 100644 --- a/www/wirtcl.c +++ b/www/wirtcl.c @@ -41,7 +41,10 @@ * 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; iw_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; } diff --git a/www/wtcl.c b/www/wtcl.c index c724b02..5255b66 100644 --- a/www/wtcl.c +++ b/www/wtcl.c @@ -41,7 +41,10 @@ * 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

\n" "%s %d
\n", pre, errorLine); wo_printf (p->wcl, "\n%s\n
\n", msg); -- 1.7.10.4