diff options
author | welch <welch> | 1999-07-02 06:04:26 (GMT) |
---|---|---|
committer | welch <welch> | 1999-07-02 06:04:26 (GMT) |
commit | 7a43ce50025a2bc85e4ff7342ef981a5ad47a898 (patch) | |
tree | bb0eb2e8443b9c77795a05524c0b47ea91d556ca /generic | |
parent | acb6f56b857e610cc16e61dfcc376446e1e8dac8 (diff) | |
download | tcl-7a43ce50025a2bc85e4ff7342ef981a5ad47a898.zip tcl-7a43ce50025a2bc85e4ff7342ef981a5ad47a898.tar.gz tcl-7a43ce50025a2bc85e4ff7342ef981a5ad47a898.tar.bz2 |
Added Tcl_SetNotifier and associated typedef.
This lets you hook the notifier procs.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.h | 20 | ||||
-rw-r--r-- | generic/tclNotify.c | 34 |
2 files changed, 52 insertions, 2 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 7b929f2..4d1ad50 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.50 1999/06/28 19:02:52 wart Exp $ + * RCS: @(#) $Id: tcl.h,v 1.51 1999/07/02 06:04:26 welch Exp $ */ #ifndef _TCL @@ -540,6 +540,9 @@ typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp, typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr)); typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, char *part1, char *part2, int flags)); +typedef void (Tcl_CreateFileHandlerProc) _ANSI_ARGS_((int fd, int mask, + Tcl_FileProc *proc, ClientData clientData)); +typedef void (Tcl_DeleteFileHandlerProc) _ANSI_ARGS_((int fd)); /* * The following structure represents a type of object, which is a @@ -1053,6 +1056,9 @@ typedef struct Tcl_Time { long usec; /* Microseconds. */ } Tcl_Time; +typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr)); +typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr)); + /* * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler * to indicate what sorts of events are of interest: @@ -1218,6 +1224,18 @@ typedef enum Tcl_PathType { } Tcl_PathType; /* + * The following structure represents the Notifier functions that + * you can override with the Tcl_SetNotifier call. + */ + +typedef struct Tcl_NotifierProcs { + Tcl_SetTimerProc *setTimerProc; + Tcl_WaitForEventProc *waitForEventProc; + Tcl_CreateFileHandlerProc *createFileHandlerProc; + Tcl_DeleteFileHandlerProc *deleteFileHandlerProc; +} Tcl_NotifierProcs; + +/* * The following structure represents a user-defined encoding. It collects * together all the functions that are used by the specific encoding. */ diff --git a/generic/tclNotify.c b/generic/tclNotify.c index 15553b9..8d4d270 100644 --- a/generic/tclNotify.c +++ b/generic/tclNotify.c @@ -13,12 +13,14 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNotify.c,v 1.4 1999/04/16 00:46:50 stanton Exp $ + * RCS: @(#) $Id: tclNotify.c,v 1.5 1999/07/02 06:04:26 welch Exp $ */ #include "tclInt.h" #include "tclPort.h" +extern TclStubs tclStubs; + /* * For each event source (created with Tcl_CreateEventSource) there * is a structure of the following type: @@ -163,6 +165,36 @@ TclFinalizeNotifier() /* *---------------------------------------------------------------------- * + * Tcl_SetNotifier -- + * + * Install a set of alternate functions for use with the notifier. + # In particular, this can be used to install the Xt-based + * notifier for use with the Browser plugin. + * + * Results: + * None. + * + * Side effects: + * Overstomps part of the stub vector. This relies on hooks + * added to the default procedures in case those are called + * directly (i.e., not through the stub table.) + * + *---------------------------------------------------------------------- + */ + +void +Tcl_SetNotifier(notifierProcPtr) + Tcl_NotifierProcs *notifierProcPtr; +{ + tclStubs.tcl_CreateFileHandler = notifierProcPtr->createFileHandlerProc; + tclStubs.tcl_DeleteFileHandler = notifierProcPtr->deleteFileHandlerProc; + tclStubs.tcl_SetTimer = notifierProcPtr->setTimerProc; + tclStubs.tcl_WaitForEvent = notifierProcPtr->waitForEventProc; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_CreateEventSource -- * * This procedure is invoked to create a new source of events. |