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.2 2000-02-22 23:11:03 adam
9 * Fixed include statements.
11 * Revision 1.1 1996/08/20 09:27:49 adam
12 * More work on explain.
13 * Renamed tkinit.c to tkmain.c. The tcl shell uses the Tcl 7.5 interface
14 * for socket i/o instead of the handcrafted one (for Tcl 7.3 and Tcl7.4).
22 /* socket layer code for tk3.x and tk4.0 */
23 #if TK_MAJOR_VERSION < 4 || (TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0)
26 void (*f)(ClientData clientData, int r, int w, int e);
27 ClientData clientData;
29 struct sel_proc *next;
32 static struct sel_proc *sel_proc_list = NULL;
34 static void ir_tcl_tk_select_proc (ClientData clientData, int mask)
36 struct sel_proc *sp = (struct sel_proc *) clientData;
40 (*sp->f)(sp->clientData, mask & TK_READABLE, mask & TK_WRITABLE,
44 void ir_tcl_select_set (void (*f)(ClientData clientData, int r, int w, int e),
45 int fd, ClientData clientData, int r, int w, int e)
48 struct sel_proc *sp = sel_proc_list;
64 sp = ir_tcl_malloc (sizeof(*sp));
65 sp->next = sel_proc_list;
70 sp->clientData = clientData;
72 Tk_CreateFileHandler (fd, mask, ir_tcl_tk_select_proc, sp);
74 Tk_DeleteFileHandler (fd);
78 #if TK_MAJOR_VERSION >= 4
80 extern int matherr ();
81 int *tclDummyMathPtr = (int*) matherr;
83 int main (int argc, char **argv)
85 Tk_Main (argc, argv, Tcl_AppInit);
92 int *tclDummyMainPtr = (int*) main;
96 int Tcl_AppInit (Tcl_Interp *interp)
98 #if TK_MAJOR_VERSION < 4
101 if (!(mainw = Tk_MainWindow(interp)))
104 if (Tcl_Init(interp) == TCL_ERROR)
106 if (Tk_Init(interp) == TCL_ERROR)
108 if (Irtcl_Init(interp) == TCL_ERROR)