summaryrefslogtreecommitdiffstats
path: root/win/tclWinChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-28 13:13:07 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-02-28 13:13:07 (GMT)
commit57b1d9531c5dc0a0a8c5d8055b2bf09f9e966842 (patch)
treec1596b2a81451327a24c73124de842f3a471cf16 /win/tclWinChan.c
parent52e543c5691a60c3ef802fecf1ae08e7efcf19b7 (diff)
parente7306ac7d85c1452e8d096c1b5f3cf5a2d7b5efb (diff)
downloadtcl-57b1d9531c5dc0a0a8c5d8055b2bf09f9e966842.zip
tcl-57b1d9531c5dc0a0a8c5d8055b2bf09f9e966842.tar.gz
tcl-57b1d9531c5dc0a0a8c5d8055b2bf09f9e966842.tar.bz2
Implement TIP #562: Deprecate channel types 1-4
Diffstat (limited to 'win/tclWinChan.c')
-rw-r--r--win/tclWinChan.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index d8c734c..7ffd6b5 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -76,7 +76,7 @@ static int FileBlockProc(ClientData instanceData, int mode);
static void FileChannelExitHandler(ClientData clientData);
static void FileCheckProc(ClientData clientData, int flags);
static int FileCloseProc(ClientData instanceData,
- Tcl_Interp *interp);
+ Tcl_Interp *interp, int flags);
static int FileEventProc(Tcl_Event *evPtr, int flags);
static int FileGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
@@ -85,8 +85,10 @@ static int FileInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCode);
static int FileOutputProc(ClientData instanceData,
const char *buf, int toWrite, int *errorCode);
+#ifndef TCL_NO_DEPRECATED
static int FileSeekProc(ClientData instanceData, long offset,
int mode, int *errorCode);
+#endif
static Tcl_WideInt FileWideSeekProc(ClientData instanceData,
Tcl_WideInt offset, int mode, int *errorCode);
static void FileSetupProc(ClientData clientData, int flags);
@@ -105,15 +107,19 @@ static int NativeIsComPort(const WCHAR *nativeName);
static const Tcl_ChannelType fileChannelType = {
"file", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
- FileCloseProc, /* Close proc. */
+ TCL_CLOSE2PROC, /* Close proc. */
FileInputProc, /* Input proc. */
FileOutputProc, /* Output proc. */
+#ifndef TCL_NO_DEPRECATED
FileSeekProc, /* Seek proc. */
+#else
+ NULL,
+#endif
NULL, /* Set option proc. */
NULL, /* Get option proc. */
FileWatchProc, /* Set up the notifier to watch the channel. */
FileGetHandleProc, /* Get an OS handle from channel. */
- NULL, /* close2proc. */
+ FileCloseProc, /* close2proc. */
FileBlockProc, /* Set blocking or non-blocking mode.*/
NULL, /* flush proc. */
NULL, /* handler proc. */
@@ -390,7 +396,8 @@ FileBlockProc(
static int
FileCloseProc(
ClientData instanceData, /* Pointer to FileInfo structure. */
- Tcl_Interp *dummy) /* Not used. */
+ Tcl_Interp *dummy, /* Not used. */
+ int flags)
{
FileInfo *fileInfoPtr = (FileInfo *)instanceData;
FileInfo *infoPtr;
@@ -398,6 +405,10 @@ FileCloseProc(
int errorCode = 0;
(void)dummy;
+ if ((flags & (TCL_CLOSE_READ | TCL_CLOSE_WRITE)) != 0) {
+ return EINVAL;
+ }
+
/*
* Remove the file from the watch list.
*/
@@ -460,7 +471,7 @@ FileCloseProc(
*
*----------------------------------------------------------------------
*/
-
+#ifndef TCL_NO_DEPRECATED
static int
FileSeekProc(
ClientData instanceData, /* File state. */
@@ -520,6 +531,7 @@ FileSeekProc(
}
return (int) newPos;
}
+#endif
/*
*----------------------------------------------------------------------