diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-04 13:42:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-04 13:42:42 (GMT) |
commit | 8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9 (patch) | |
tree | d2f706832df81f622d3246731bef82f25668218a /win | |
parent | a4154b246b048a378dd83998031d103263856c8f (diff) | |
download | tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.zip tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.tar.gz tcl-8defb7d10b69cdbe3219de6ae2dc169dc8df8bb9.tar.bz2 |
Implement WideSeekProc() for all channels which have a SeekProc(). Implement Close2Proc() for all channels, as minimal wrapper around CloseProc().
Backported (with comments) and adapted from core-8-branch.
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinChan.c | 18 | ||||
-rw-r--r-- | win/tclWinConsole.c | 18 | ||||
-rw-r--r-- | win/tclWinSerial.c | 18 |
3 files changed, 48 insertions, 6 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c index b8016ec..54d0c84 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -76,6 +76,8 @@ static void FileChannelExitHandler(ClientData clientData); static void FileCheckProc(ClientData clientData, int flags); static int FileCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int FileClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int FileEventProc(Tcl_Event *evPtr, int flags); static int FileGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); @@ -111,7 +113,7 @@ static const Tcl_ChannelType fileChannelType = { NULL, /* Get option proc. */ FileWatchProc, /* Set up the notifier to watch the channel. */ FileGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + FileClose2Proc, /* close2proc. */ FileBlockProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -360,7 +362,7 @@ FileBlockProc( /* *---------------------------------------------------------------------- * - * FileCloseProc -- + * FileCloseProc/FileClose2Proc -- * * Closes the IO channel. * @@ -427,6 +429,18 @@ FileCloseProc( ckfree(fileInfoPtr); return errorCode; } + +static int +FileClose2Proc( + ClientData instanceData, /* Pointer to FileInfo structure. */ + Tcl_Interp *interp, /* Not used. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return FileCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 173fe9e..1293ebe 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -140,6 +140,8 @@ static int ConsoleBlockModeProc(ClientData instanceData, static void ConsoleCheckProc(ClientData clientData, int flags); static int ConsoleCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int ConsoleClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int ConsoleEventProc(Tcl_Event *evPtr, int flags); static void ConsoleExitHandler(ClientData clientData); static int ConsoleGetHandleProc(ClientData instanceData, @@ -179,7 +181,7 @@ static const Tcl_ChannelType consoleChannelType = { NULL, /* Get option proc. */ ConsoleWatchProc, /* Set up notifier to watch the channel. */ ConsoleGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + ConsoleClose2Proc, /* close2proc. */ ConsoleBlockModeProc, /* Set blocking or non-blocking mode. */ NULL, /* Flush proc. */ NULL, /* Handler proc. */ @@ -506,7 +508,7 @@ ConsoleBlockModeProc( /* *---------------------------------------------------------------------- * - * ConsoleCloseProc -- + * ConsoleCloseProc/ConsoleClose2Proc -- * * Closes a console based IO channel. * @@ -604,6 +606,18 @@ ConsoleCloseProc( return errorCode; } + +static int +ConsoleClose2Proc( + ClientData instanceData, /* Pointer to ConsoleInfo structure. */ + Tcl_Interp *interp, /* For error reporting. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return ConsoleCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 4f7c0be..be7ec2c 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -160,6 +160,8 @@ static int SerialBlockProc(ClientData instanceData, int mode); static void SerialCheckProc(ClientData clientData, int flags); static int SerialCloseProc(ClientData instanceData, Tcl_Interp *interp); +static int SerialClose2Proc(ClientData instanceData, + Tcl_Interp *interp, int flags); static int SerialEventProc(Tcl_Event *evPtr, int flags); static void SerialExitHandler(ClientData clientData); static int SerialGetHandleProc(ClientData instanceData, @@ -203,7 +205,7 @@ static const Tcl_ChannelType serialChannelType = { SerialGetOptionProc, /* Get option proc. */ SerialWatchProc, /* Set up notifier to watch the channel. */ SerialGetHandleProc, /* Get an OS handle from channel. */ - NULL, /* close2proc. */ + SerialClose2Proc, /* close2proc. */ SerialBlockProc, /* Set blocking or non-blocking mode.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -572,7 +574,7 @@ SerialBlockProc( /* *---------------------------------------------------------------------- * - * SerialCloseProc -- + * SerialCloseProc/SerialClose2Proc -- * * Closes a serial based IO channel. * @@ -664,6 +666,18 @@ SerialCloseProc( } return errorCode; } + +static int +SerialClose2Proc( + ClientData instanceData, /* Pointer to SerialInfo structure. */ + Tcl_Interp *interp, /* For error reporting. */ + int flags) +{ + if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) == 0) { + return SerialCloseProc(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- |