X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ir-tcl.c;h=d87d4d8513a27b43386ce8e40a942d7a21f477a9;hb=63352c7277aa5760cca113b9a97d09716ba4e7f8;hp=8355899bd16cb3502fe2e155fee8603b91a9bf46;hpb=1b8061ca3570938335e6b538bfc514504abec092;p=ir-tcl-moved-to-github.git diff --git a/ir-tcl.c b/ir-tcl.c index 8355899..d87d4d8 100644 --- a/ir-tcl.c +++ b/ir-tcl.c @@ -5,7 +5,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: ir-tcl.c,v $ - * Revision 1.77 1996-02-20 17:52:58 adam + * Revision 1.78 1996-02-21 10:16:08 adam + * Simplified select handling. Only one function ir_tcl_select_set has + * to be externally defined. + * + * Revision 1.77 1996/02/20 17:52:58 adam * Uses the YAZ oid system to name record syntax object identifiers. * * Revision 1.76 1996/02/20 16:09:51 adam @@ -281,6 +285,8 @@ #define CS_BLOCK 0 +#define IRTCL_GENERIC_FILES 0 + #include "ir-tclp.h" typedef struct { @@ -298,6 +304,28 @@ static void ir_deleteDiags (IrTcl_Diagnostic **dst_list, int *dst_num); static int do_disconnect (void *obj, Tcl_Interp *interp, int argc, char **argv); +static void ir_select_notify (ClientData clientData, int r, int w, int e); + +void ir_select_add (int fd, void *obj) +{ + ir_tcl_select_set (ir_select_notify, fd, obj, 1, 0, 0); +} + +void ir_select_add_write (int fd, void *obj) +{ + ir_tcl_select_set (ir_select_notify, fd, obj, 1, 1, 0); +} + +void ir_select_remove (int fd, void *obj) +{ + ir_tcl_select_set (NULL, fd, obj, 0, 0, 0); +} + +void ir_select_remove_write (int fd, void *obj) +{ + ir_tcl_select_set (ir_select_notify, fd, obj, 1, 0, 0); +} + static IrTcl_RecordList *new_IR_record (IrTcl_SetObj *setobj, int no, int which, const char *elements) @@ -3367,7 +3395,7 @@ static void ir_scanResponse (void *o, Z_ScanResponse *scanrs, /* * ir_select_read: handle incoming packages */ -void ir_select_read (ClientData clientData) +static void ir_select_read (ClientData clientData) { IrTcl_Obj *p = clientData; Z_APDU *apdu; @@ -3541,7 +3569,7 @@ void ir_select_read (ClientData clientData) /* * ir_select_write: handle outgoing packages - not yet written. */ -void ir_select_write (ClientData clientData) +static void ir_select_write (ClientData clientData) { IrTcl_Obj *p = clientData; int r; @@ -3610,6 +3638,14 @@ void ir_select_write (ClientData clientData) } } +static void ir_select_notify (ClientData clientData, int r, int w, int e) +{ + if (r) + ir_select_read (clientData); + if (w) + ir_select_write (clientData); +} + /* ------------------------------------------------------- */ /*