2 * IR toolkit for tcl/tk
3 * (c) Index Data 1995-1996
4 * See the file LICENSE for details.
5 * Sebastian Hammer, Adam Dickmeiss
8 * Revision 1.1 1996-08-20 09:27:49 adam
9 * More work on explain.
10 * Renamed tkinit.c to tkmain.c. The tcl shell uses the Tcl 7.5 interface
11 * for socket i/o instead of the handcrafted one (for Tcl 7.3 and Tcl7.4).
19 /* socket layer code for tk3.x and tk4.0 */
20 #if TK_MAJOR_VERSION < 4 || (TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0)
23 void (*f)(ClientData clientData, int r, int w, int e);
24 ClientData clientData;
26 struct sel_proc *next;
29 static struct sel_proc *sel_proc_list = NULL;
31 static void ir_tcl_tk_select_proc (ClientData clientData, int mask)
33 struct sel_proc *sp = (struct sel_proc *) clientData;
37 (*sp->f)(sp->clientData, mask & TK_READABLE, mask & TK_WRITABLE,
41 void ir_tcl_select_set (void (*f)(ClientData clientData, int r, int w, int e),
42 int fd, ClientData clientData, int r, int w, int e)
45 struct sel_proc *sp = sel_proc_list;
61 sp = ir_tcl_malloc (sizeof(*sp));
62 sp->next = sel_proc_list;
67 sp->clientData = clientData;
69 Tk_CreateFileHandler (fd, mask, ir_tcl_tk_select_proc, sp);
71 Tk_DeleteFileHandler (fd);
75 #if TK_MAJOR_VERSION >= 4
77 extern int matherr ();
78 int *tclDummyMathPtr = (int*) matherr;
80 int main (int argc, char **argv)
82 Tk_Main (argc, argv, Tcl_AppInit);
89 int *tclDummyMainPtr = (int*) main;
93 int Tcl_AppInit (Tcl_Interp *interp)
95 #if TK_MAJOR_VERSION < 4
98 if (!(mainw = Tk_MainWindow(interp)))
101 if (Tcl_Init(interp) == TCL_ERROR)
103 if (Tk_Init(interp) == TCL_ERROR)
105 if (Irtcl_Init(interp) == TCL_ERROR)