summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-19 09:25:51 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-19 09:25:51 (GMT)
commit96dd069f9fc0b4e987db3a0ee7dde49edd93d3af (patch)
tree6d6df6037727c460a921918e2c1f7c8d56ef61a4 /unix/tclUnixChan.c
parent5c6b7dbf18cbb7a2ecb9a064790d175411e9b066 (diff)
parentd064b77a41441825f6578546de36e0122cd344d0 (diff)
downloadtcl-96dd069f9fc0b4e987db3a0ee7dde49edd93d3af.zip
tcl-96dd069f9fc0b4e987db3a0ee7dde49edd93d3af.tar.gz
tcl-96dd069f9fc0b4e987db3a0ee7dde49edd93d3af.tar.bz2
Merge trunk
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c104
1 files changed, 50 insertions, 54 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index edb1edb..693720c 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -161,22 +161,22 @@ static int TtySetOptionProc(void *instanceData,
static const Tcl_ChannelType fileChannelType = {
"file", /* Type name. */
- TCL_CHANNEL_VERSION_5, /* v5 channel */
- NULL, /* Close proc. */
- FileInputProc, /* Input proc. */
- FileOutputProc, /* Output proc. */
- NULL,
+ TCL_CHANNEL_VERSION_5,
+ NULL, /* Deprecated. */
+ FileInputProc,
+ FileOutputProc,
+ NULL, /* Deprecated. */
NULL, /* Set option proc. */
- FileGetOptionProc, /* Get option proc. */
- FileWatchProc, /* Initialize notifier. */
- FileGetHandleProc, /* Get OS handles out of channel. */
- FileCloseProc, /* close2proc. */
- FileBlockModeProc, /* Set blocking or non-blocking mode.*/
- NULL, /* flush proc. */
- NULL, /* handler proc. */
- FileWideSeekProc, /* wide seek proc. */
- NULL,
- FileTruncateProc /* truncate proc. */
+ FileGetOptionProc,
+ FileWatchProc,
+ FileGetHandleProc,
+ FileCloseProc,
+ FileBlockModeProc,
+ NULL, /* Flush proc. */
+ NULL, /* Bubbled event handler proc. */
+ FileWideSeekProc,
+ NULL, /* Thread action proc. */
+ FileTruncateProc
};
#ifdef SUPPORTS_TTY
@@ -186,23 +186,23 @@ static const Tcl_ChannelType fileChannelType = {
*/
static const Tcl_ChannelType ttyChannelType = {
- "tty", /* Type name. */
- TCL_CHANNEL_VERSION_5, /* v5 channel */
- NULL, /* Close proc. */
- FileInputProc, /* Input proc. */
- FileOutputProc, /* Output proc. */
+ "tty",
+ TCL_CHANNEL_VERSION_5,
+ NULL, /* Deprecated. */
+ FileInputProc,
+ FileOutputProc,
+ NULL, /* Deprecated. */
+ TtySetOptionProc,
+ TtyGetOptionProc,
+ FileWatchProc,
+ FileGetHandleProc,
+ TtyCloseProc,
+ FileBlockModeProc,
+ NULL, /* Flush proc. */
+ NULL, /* Bubbled event handler proc. */
NULL, /* Seek proc. */
- TtySetOptionProc, /* Set option proc. */
- TtyGetOptionProc, /* Get option proc. */
- FileWatchProc, /* Initialize notifier. */
- FileGetHandleProc, /* Get OS handles out of channel. */
- TtyCloseProc, /* close2proc. */
- FileBlockModeProc, /* Set blocking or non-blocking mode.*/
- NULL, /* flush proc. */
- NULL, /* handler proc. */
- NULL, /* wide seek proc. */
- NULL, /* thread action proc. */
- NULL /* truncate proc. */
+ NULL, /* Thread action proc. */
+ NULL /* Truncate proc. */
};
#endif /* SUPPORTS_TTY */
@@ -225,7 +225,7 @@ static const Tcl_ChannelType ttyChannelType = {
static int
FileBlockModeProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
int mode) /* The mode to set. Can be TCL_MODE_BLOCKING
* or TCL_MODE_NONBLOCKING. */
{
@@ -258,7 +258,7 @@ FileBlockModeProc(
static int
FileInputProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
char *buf, /* Where to store data read. */
int toRead, /* How much space is available in the
* buffer? */
@@ -308,7 +308,7 @@ FileInputProc(
static int
FileOutputProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
const char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCodePtr) /* Where to store error code. */
@@ -355,7 +355,7 @@ FileOutputProc(
static int
FileCloseProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
TCL_UNUSED(Tcl_Interp *),
int flags)
{
@@ -448,7 +448,7 @@ TtyCloseProc(
static long long
FileWideSeekProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
long long offset, /* Offset to seek to. */
int mode, /* Relative to where should we seek? Can be
* one of SEEK_START, SEEK_CUR or SEEK_END. */
@@ -496,7 +496,7 @@ FileWatchNotifyChannelWrapper(
static void
FileWatchProc(
- void *instanceData, /* The file state. */
+ void *instanceData, /* The file state. */
int mask) /* Events of interest; an OR-ed combination of
* TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
@@ -536,9 +536,9 @@ FileWatchProc(
static int
FileGetHandleProc(
- void *instanceData, /* The file state. */
+ void *instanceData, /* The file state. */
int direction, /* TCL_READABLE or TCL_WRITABLE */
- void **handlePtr) /* Where to store the handle. */
+ void **handlePtr) /* Where to store the handle. */
{
FileState *fsPtr = (FileState *)instanceData;
@@ -758,7 +758,7 @@ TtyModemStatusStr(
static int
TtySetOptionProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
Tcl_Interp *interp, /* For error reporting - can be NULL. */
const char *optionName, /* Which option to set? */
const char *value) /* New value for option. */
@@ -1098,7 +1098,7 @@ TtySetOptionProc(
static int
TtyGetOptionProc(
- void *instanceData, /* File state. */
+ void *instanceData, /* File state. */
Tcl_Interp *interp, /* For error reporting - can be NULL. */
const char *optionName, /* Option to get. */
Tcl_DString *dsPtr) /* Where to store value(s). */
@@ -1637,22 +1637,18 @@ TtyParseMode(
* not allow preprocessor directives in their arguments.
*/
- if (
-#if defined(PAREXT)
- strchr("noems", parity)
+#ifdef PAREXT
+#define PARITY_CHARS "noems"
+#define PARITY_MSG "n, o, e, m, or s"
#else
- strchr("noe", parity)
+#define PARITY_CHARS "noe"
+#define PARITY_MSG "n, o, or e"
#endif /* PAREXT */
- == NULL) {
+
+ if (strchr(PARITY_CHARS, parity) == NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "%s parity: should be %s", bad,
-#if defined(PAREXT)
- "n, o, e, m, or s"
-#else
- "n, o, or e"
-#endif /* PAREXT */
- ));
+ "%s parity: should be %s", bad, PARITY_MSG));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "SERIALMODE", (char *)NULL);
}
return TCL_ERROR;
@@ -2054,7 +2050,7 @@ Tcl_GetOpenFile(
* Ignored, we always check that
* the channel is open for the requested
* mode. */
- void **filePtr) /* Store pointer to FILE structure here. */
+ void **filePtr) /* Store pointer to FILE structure here. */
{
Tcl_Channel chan;
int chanMode, fd;