From: Adam Dickmeiss Date: Wed, 20 Mar 1996 13:54:01 +0000 (+0000) Subject: The Tcl_File structure is only manipulated in the Tk-event interface X-Git-Tag: IRTCL.1.4~135 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=bbf493d419191bb2650c061f5f00a39f42cc272f;p=ir-tcl-moved-to-github.git The Tcl_File structure is only manipulated in the Tk-event interface in tkinit.c. --- diff --git a/Makefile.in b/Makefile.in index 4ca4821..b9a31ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,7 +2,7 @@ # (c) Index Data 1995 # See the file LICENSE for details. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile.in,v 1.30 1996-02-29 15:30:19 adam Exp $ +# $Id: Makefile.in,v 1.31 1996-03-20 13:54:01 adam Exp $ SHELL=/bin/sh # IrTcl Version @@ -130,7 +130,7 @@ install: ir-tcl fi; clean: - rm -f *.[oa] ir-tk ir-tcl core gmon.out mon.out *.bak config.cache + rm -f *.[oa] ir-tk ir-tcl wais-tcl core gmon.out mon.out *.bak config.cache autoconf: -rm config.cache diff --git a/client.tcl b/client.tcl index 3339fa3..0ec50f9 100644 --- a/client.tcl +++ b/client.tcl @@ -4,7 +4,11 @@ # Sebastian Hammer, Adam Dickmeiss # # $Log: client.tcl,v $ -# Revision 1.89 1996-03-05 09:16:04 adam +# Revision 1.90 1996-03-20 13:54:02 adam +# The Tcl_File structure is only manipulated in the Tk-event interface +# in tkinit.c. +# +# Revision 1.89 1996/03/05 09:16:04 adam # Sets tearoff to off on several menus. # # Revision 1.88 1996/01/23 15:24:09 adam @@ -3954,7 +3958,7 @@ if {[catch {ir z39}]} { } # Init: Uncomment this line if you wan't to enable logging. -#z39 logLevel all {} irtcl.log +z39 logLevel all {} irtcl.log # Init: If hostid is a valid target, a new connection will be established # immediately. diff --git a/ir-tcl.c b/ir-tcl.c index b0f8f6e..2ac5a47 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.85 1996-03-15 11:15:48 adam + * Revision 1.86 1996-03-20 13:54:04 adam + * The Tcl_File structure is only manipulated in the Tk-event interface + * in tkinit.c. + * + * Revision 1.85 1996/03/15 11:15:48 adam * Modified to use new prototypes for p_query_rpn and p_query_scan. * * Revision 1.84 1996/03/07 12:42:49 adam @@ -313,8 +317,6 @@ #define CS_BLOCK 0 -#define IRTCL_GENERIC_FILES 0 - #include "ir-tclp.h" static void ir_deleteDiags (IrTcl_Diagnostic **dst_list, int *dst_num); @@ -1082,34 +1084,19 @@ static int do_connect (void *obj, Tcl_Interp *interp, } if (ir_tcl_strdup (interp, &p->hostname, argv[2]) == TCL_ERROR) return TCL_ERROR; -#if IRTCL_GENERIC_FILES -#ifdef WINDOWS - p->csFile = Tcl_GetFile (cs_fileno(p->cs_link), TCL_WIN_SOCKET); -#else - p->csFile = Tcl_GetFile (cs_fileno(p->cs_link), TCL_UNIX_FD); -#endif -#endif if ((r=cs_connect (p->cs_link, addr)) < 0) { interp->result = "connect fail"; ir_tcl_disconnect (p); return TCL_ERROR; } - logf(LOG_DEBUG, "cs_connect() returned %d fd=%d", r, + logf(LOG_DEBUG, "cs_connect() returned %d fd=%d", r, cs_fileno(p->cs_link)); p->eventType = "connect"; -#if IRTCL_GENERIC_FILES - ir_select_add (p->csFile, p); -#else ir_select_add (cs_fileno (p->cs_link), p); -#endif if (r == 1) { -#if IRTCL_GENERIC_FILES - ir_select_add_write (p->csFile, p); -#else ir_select_add_write (cs_fileno (p->cs_link), p); -#endif p->state = IR_TCL_R_Connecting; } else @@ -1131,26 +1118,17 @@ void ir_tcl_disconnect (IrTcl_Obj *p) { if (p->hostname) { - logf(LOG_DEBUG, "Closing connection to %s", p->hostname); + logf(LOG_DEBUG, "Closing connection to %s", p->hostname); free (p->hostname); p->hostname = NULL; -#if IRTCL_GENERIC_FILES - ir_select_remove_write (p->csFile, p); - ir_select_remove (p->csFile, p); -#else ir_select_remove_write (cs_fileno (p->cs_link), p); ir_select_remove (cs_fileno (p->cs_link), p); -#endif odr_reset (p->odr_in); assert (p->cs_link); cs_close (p->cs_link); p->cs_link = NULL; -#if IRTCL_GENERIC_FILES - Tcl_FreeFile (p->csFile); - p->csFile = NULL; -#endif ODR_MASK_ZERO (&p->options); ODR_MASK_SET (&p->options, 0); @@ -1181,9 +1159,6 @@ static int do_disconnect (void *obj, Tcl_Interp *interp, p->eventType = NULL; p->hostname = NULL; p->cs_link = NULL; -#if IRTCL_GENERIC_FILES - p->csFile = 0; -#endif return TCL_OK; } ir_tcl_disconnect (p); @@ -3493,7 +3468,7 @@ static void ir_select_read (ClientData clientData) logf(LOG_DEBUG, "Read handler fd=%d", cs_fileno(p->cs_link)); if (p->state == IR_TCL_R_Connecting) { - logf(LOG_DEBUG, "read: connect"); + logf(LOG_DEBUG, "read: connect"); r = cs_rcvconnect (p->cs_link); if (r == 1) { @@ -3502,11 +3477,7 @@ static void ir_select_read (ClientData clientData) } p->state = IR_TCL_R_Idle; p->ref_count = 2; -#if IRTCL_GENERIC_FILES - ir_select_remove_write (p->csFile, p); -#else ir_select_remove_write (cs_fileno (p->cs_link), p); -#endif if (r < 0) { logf (LOG_DEBUG, "cs_rcvconnect error"); @@ -3533,21 +3504,17 @@ static void ir_select_read (ClientData clientData) /* read incoming APDU */ if ((r=cs_get (p->cs_link, &p->buf_in, &p->len_in)) == 1) - { - logf(LOG_DEBUG, "PDU Fraction read"); + { + logf(LOG_DEBUG, "PDU Fraction read"); return ; - } + } /* signal one more use of ir object - callbacks must not release the ir memory (p pointer) */ p->ref_count = 2; if (r <= 0) { logf (LOG_DEBUG, "cs_get failed, code %d", r); -#if IRTCL_GENERIC_FILES - ir_select_remove (p->csFile, p); -#else ir_select_remove (cs_fileno (p->cs_link), p); -#endif ir_tcl_disconnect (p); if (p->failback) { @@ -3566,7 +3533,7 @@ static void ir_select_read (ClientData clientData) if (!z_APDU (p->odr_in, &apdu, 0)) { logf (LOG_DEBUG, "cs_get failed: %s", - odr_errmsg (odr_geterror (p->odr_in))); + odr_errmsg (odr_geterror (p->odr_in))); ir_tcl_disconnect (p); if (p->failback) { @@ -3578,7 +3545,7 @@ static void ir_select_read (ClientData clientData) ir_obj_delete (p); return; } - logf(LOG_DEBUG, "Decoded ok"); + logf(LOG_DEBUG, "Decoded ok"); /* handle APDU and invoke callback */ rq = p->request_queue; if (!rq) @@ -3596,7 +3563,7 @@ static void ir_select_read (ClientData clientData) case Z_APDU_initResponse: p->eventType = "init"; ir_initResponse (p, apdu->u.initResponse); - apdu_call = p->initResponse; + apdu_call = p->initResponse; break; case Z_APDU_searchResponse: p->eventType = "search"; @@ -3666,7 +3633,7 @@ static void ir_select_write (ClientData clientData) logf (LOG_DEBUG, "Write handler fd=%d", cs_fileno(p->cs_link)); if (p->state == IR_TCL_R_Connecting) { - logf(LOG_DEBUG, "write: connect"); + logf(LOG_DEBUG, "write: connect"); r = cs_rcvconnect (p->cs_link); if (r == 1) { @@ -3675,11 +3642,7 @@ static void ir_select_write (ClientData clientData) } p->state = IR_TCL_R_Idle; p->ref_count = 2; -#if IRTCL_GENERIC_FILES - ir_select_remove_write (p->csFile, p); -#else ir_select_remove_write (cs_fileno (p->cs_link), p); -#endif if (r < 0) { logf (LOG_DEBUG, "cs_rcvconnect error"); @@ -3717,13 +3680,9 @@ static void ir_select_write (ClientData clientData) } else if (r == 0) /* remove select bit */ { - logf (LOG_DEBUG, "Write completed"); + logf (LOG_DEBUG, "Write completed"); p->state = IR_TCL_R_Waiting; -#if IRTCL_GENERIC_FILES - ir_select_remove_write (p->csFile, p); -#else ir_select_remove_write (cs_fileno (p->cs_link), p); -#endif free (rq->buf_out); rq->buf_out = NULL; } @@ -3733,7 +3692,7 @@ static void ir_select_notify (ClientData clientData, int r, int w, int e) { if (r) ir_select_read (clientData); - if (w) + else if (w) ir_select_write (clientData); } diff --git a/ir-tclp.h b/ir-tclp.h index f41717f..17e1c89 100644 --- a/ir-tclp.h +++ b/ir-tclp.h @@ -5,7 +5,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tclp.h,v $ - * Revision 1.31 1996-03-05 09:21:19 adam + * Revision 1.32 1996-03-20 13:54:05 adam + * The Tcl_File structure is only manipulated in the Tk-event interface + * in tkinit.c. + * + * Revision 1.31 1996/03/05 09:21:19 adam * Bug fix: memory used by GRS records wasn't freed. * Rewrote some of the error handling code - the connection is always * closed before failback is called. @@ -186,10 +190,7 @@ typedef struct { int protocol_type; int failInfo; COMSTACK cs_link; -#if IRTCL_GENERIC_FILES - Tcl_File csFile; -#endif - + int state; int preferredMessageSize; diff --git a/queue.c b/queue.c index 8baebe9..331fa1f 100644 --- a/queue.c +++ b/queue.c @@ -6,7 +6,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: queue.c,v $ - * Revision 1.8 1996-03-05 09:21:20 adam + * Revision 1.9 1996-03-20 13:54:05 adam + * The Tcl_File structure is only manipulated in the Tk-event interface + * in tkinit.c. + * + * Revision 1.8 1996/03/05 09:21:20 adam * Bug fix: memory used by GRS records wasn't freed. * Rewrote some of the error handling code - the connection is always * closed before failback is called. @@ -109,11 +113,7 @@ int ir_tcl_send_q (IrTcl_Obj *p, IrTcl_Request *rp, const char *msg) return TCL_ERROR; else if (r == 1) { -#if IRTCL_GENERIC_FILES - ir_select_add_write (p->csFile, p); -#else ir_select_add_write (cs_fileno (p->cs_link), p); -#endif logf (LOG_DEBUG, "Send part of %s", msg); p->state = IR_TCL_R_Writing; }