Attachment "io.patch" to
ticket [503565ffff]
added by
dgp
2002-01-16 01:10:05.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.791
diff -u -u -r1.791 ChangeLog
--- ChangeLog 2002/01/14 15:07:39 1.791
+++ ChangeLog 2002/01/15 17:44:27
@@ -1,5 +1,47 @@
+2002-01-15 Don Porter <[email protected]>
+
+ * doc/CrtChannel.3:
+ * doc/OpenFileChnl.3:
+ * generic/tcl.decls:
+ * generic/tclIO.h:
+ * generic/tclIO.c (DoWrite, Tcl_RegisterChannel, Tcl_GetChannel,
+ Tcl_CreateChannel, Tcl_GetChannelName, CloseChannel, Tcl_Write,
+ Tcl_WriteRaw, Tcl_Ungets, Tcl_BadChannelOption, Tcl_GetChannelOption,
+ Tcl_SetChannelOption, Tcl_GetChannelNamesEx, Tcl_ChannelName):
+ Updated APIs in the file generic/tclIO.c according to the guidelines
+ of TIP 27. Several minor documentation corrections as well.
+ * generic/tclDecls.h: make genstubs
+
+ * generic/tcl.h (Tcl_DriverOutputProc, Tcl_DriverGetOptionProc,
+ Tcl_DriverSetOptionProc):
+ * generic/tclIOGT.c (TransformOutputProc, TransformGetOptionProc,
+ TransformSetOptionProc):
+ * mac/tclMacChan.c (FileOutput, StdIOOutput):
+ * man/tclMacSock.c (TcpGetOptionProc, TcpOutput):
+ * unix/tclUnixChan.c (FileOutputProc, TcpGetOptionProc, TcpOutputProc,
+ TtyGetOptionProc, TtySetOptionProc):
+ * unix/tclUnixPipe.c (PipeOuputProc):
+ * win/tclWinChan.c (FileOutputProc):
+ * win/tclWinConsole.c (ConsleOutputProc):
+ * win/tclWinPipe.c (PipeOuputProc):
+ * win/tclWinSerial.c (SerialOutputProc, SerialGetOptionProc,
+ SerialSetOptionProc):
+ * win/tclWinSock.c (TcpGetOptionProc, TcpOutput): Updated channel
+ driver interface according to the guidelines of TIP 27. See also
+ [Bug 500348].
+
+ * doc/CrtChannel.3:
+ * generic/tcl.h:
+ * generic/tclIO.c:
+ * generic/tclIO.h:
+ * generic/tclInt.h:
+ * tools/checkLibraryDoc.tcl:
+ Moved Tcl_EolTranslation enum declaration from generic/tcl.h to
+ generic/tclInt.h (renamed to TclEolTranslation). It is not used
+ anywhere in Tcl's public interface.
+
2002-01-14 Don Porter <[email protected]>
-
+
* doc/GetIndex.3:
* doc/WrongNumArgs.3:
* generic/tcl.decls (Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct,
Index: doc/CrtChannel.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/CrtChannel.3,v
retrieving revision 1.12
diff -u -u -r1.12 CrtChannel.3
--- doc/CrtChannel.3 2001/12/10 15:50:46 1.12
+++ doc/CrtChannel.3 2002/01/15 17:44:27
@@ -25,7 +25,7 @@
Tcl_ChannelType *
\fBTcl_GetChannelType\fR(\fIchannel\fR)
.sp
-char *
+CONST char *
\fBTcl_GetChannelName\fR(\fIchannel\fR)
.sp
int
@@ -73,7 +73,7 @@
Tcl_Channel
\fBTcl_GetTopChannel\fR(\fIchannel\fR)
.sp
-char *
+CONST char *
\fBTcl_ChannelName\fR(\fItypePtr\fR)
.sp
Tcl_ChannelTypeVersion
@@ -117,11 +117,11 @@
.VE
.sp
.SH ARGUMENTS
-.AS Tcl_EolTranslation *channelName in
+.AS Tcl_ChannelType *channelName in
.AP Tcl_ChannelType *typePtr in
Points to a structure containing the addresses of procedures that
can be called to perform I/O and other functions on the channel.
-.AP char *channelName in
+.AP "CONST char" *channelName in
The name of this channel, such as \fBfile3\fR; must not be in use
by any other channel. Can be NULL, in which case the channel is
created without a name.
@@ -139,9 +139,6 @@
.AP ClientData *handlePtr out
Points to the location where the desired OS-specific handle should be
stored.
-.AP Tcl_EolTranslation transMode in
-The translation mode; one of the constants \fBTCL_TRANSLATE_AUTO\fR,
-\fBTCL_TRANSLATE_CR\fR, \fBTCL_TRANSLATE_LF\fR and \fBTCL_TRANSLATE_CRLF\fR.
.AP int size in
The size, in bytes, of buffers to allocate in this channel.
.AP int mask in
@@ -150,9 +147,9 @@
this channel.
.AP Tcl_Interp *interp in
Current interpreter. (can be NULL)
-.AP char *optionName in
+.AP "CONST char" *optionName in
Name of the invalid option.
-.AP char *optionList in
+.AP "CONST char" *optionList in
Specific options list (space separated words, without "-")
to append to the standard generic options list.
Can be NULL for generic options error message only.
@@ -247,7 +244,7 @@
and output.
.PP
\fBTcl_GetChannelBufferSize\fR returns the size, in bytes, of buffers
-allocated to store input or output in \fIchan\fR. If the value was not set
+allocated to store input or output in \fIchannel\fR. If the value was not set
by a previous call to \fBTcl_SetChannelBufferSize\fR, described below, then
the default value of 4096 is returned.
.PP
@@ -301,7 +298,7 @@
Application to a channel registered in some interpreter is not allowed.
.PP
\fBTcl_ClearChannelHandlers\fR removes all channelhandlers and event
-scripts associated with the specified \fIchannels\fR, thus shutting
+scripts associated with the specified \fIchannel\fR, thus shutting
down all event processing for this channel.
.VE
@@ -528,7 +525,7 @@
.CS
typedef int Tcl_DriverOutputProc(
ClientData \fIinstanceData\fR,
- char *\fIbuf\fR,
+ CONST char *\fIbuf\fR,
int \fItoWrite\fR,
int *\fIerrorCodePtr\fR);
.CE
@@ -604,11 +601,11 @@
typedef int Tcl_DriverSetOptionProc(
ClientData \fIinstanceData\fR,
Tcl_Interp *\fIinterp\fR,
- char *\fIoptionName\fR,
- char *\fIoptionValue\fR);
+ CONST char *\fIoptionName\fR,
+ CONST char *\fInewValue\fR);
.CE
.PP
-\fIoptionName\fR is the name of an option to set, and \fIoptionValue\fR is
+\fIoptionName\fR is the name of an option to set, and \fInewValue\fR is
the new value for that option, as a string. The \fIinstanceData\fR is the
same as the value given to \fBTcl_CreateChannel\fR when this channel was
created. The function should do whatever channel type specific action is
@@ -626,7 +623,7 @@
It should call \fBTcl_BadChannelOption\fR which itself returns
\fBTCL_ERROR\fR if the \fIoptionName\fR is
unrecognized.
-If \fIoptionValue\fR specifies a value for the option that
+If \fInewValue\fR specifies a value for the option that
is not supported or if a system call error occurs,
the function should leave an error message in the
\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
@@ -648,21 +645,21 @@
typedef int Tcl_DriverGetOptionProc(
ClientData \fIinstanceData\fR,
Tcl_Interp *\fIinterp\fR,
- char *\fIoptionName\fR,
- Tcl_DString *\fIdsPtr\fR);
+ CONST char *\fIoptionName\fR,
+ Tcl_DString *\fIoptionValue\fR);
.CE
.PP
\fIOptionName\fR is the name of an option supported by this type of
channel. If the option name is not NULL, the function stores its current
-value, as a string, in the Tcl dynamic string \fIdsPtr\fR.
-If \fIoptionName\fR is NULL, the function stores in \fIdsPtr\fR an
+value, as a string, in the Tcl dynamic string \fIoptionValue\fR.
+If \fIoptionName\fR is NULL, the function stores in \fIoptionValue\fR an
alternating list of all supported options and their current values.
On success, the function returns \fBTCL_OK\fR.
It should call \fBTcl_BadChannelOption\fR which itself returns
\fBTCL_ERROR\fR if the \fIoptionName\fR is
unrecognized. If a system call error occurs,
the function should leave an error message in the
-\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The
+result of \fIinterp\fR if \fIinterp\fR is not NULL. The
function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX
error code.
.PP
@@ -793,7 +790,7 @@
.PP
It always return \fBTCL_ERROR\fR
.PP
-An error message is generated in interp's result object to
+An error message is generated in \fIinterp\fR's result object to
indicate that a command was invoked with the a bad option
The message has the form
.CS
@@ -803,9 +800,9 @@
bad option "-blah": should be one of -blocking,
-buffering, -buffersize, -eofchar, -translation,
-peername, or -sockname
-when called with optionList="peername sockname"
+when called with \fIoptionList\fR="peername sockname"
.CE
-``blah'' is the optionName argument and ``<specific options>''
+``blah'' is the \fIoptionName\fR argument and ``<specific options>''
is a space separated list of specific option words.
The function takes good care of inserting minus signs before
each option, commas after, and an ``or'' before the last option.
Index: doc/OpenFileChnl.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/OpenFileChnl.3,v
retrieving revision 1.15
diff -u -u -r1.15 OpenFileChnl.3
--- doc/OpenFileChnl.3 2001/12/10 15:50:46 1.15
+++ doc/OpenFileChnl.3 2002/01/15 17:44:28
@@ -15,8 +15,6 @@
.nf
\fB#include <tcl.h>\fR
.sp
-typedef ... Tcl_Channel;
-.sp
Tcl_Channel
\fBTcl_OpenFileChannel\fR(\fIinterp, fileName, mode, permissions\fR)
.sp
@@ -57,7 +55,7 @@
\fBTcl_ReadChars\fR(\fIchannel, readObjPtr, charsToRead, appendFlag\fR)
.sp
int
-\fBTcl_Read\fR(\fIchannel, byteBuf, bytesToRead\fR)
+\fBTcl_Read\fR(\fIchannel, readBuf, bytesToRead\fR)
.sp
int
\fBTcl_GetsObj\fR(\fIchannel, lineObjPtr\fR)
@@ -80,10 +78,10 @@
.VS 8.3.2
.sp
int
-\fBTcl_ReadRaw\fR(\fIchannel, bufPtr, bytesToRead\fR)
+\fBTcl_ReadRaw\fR(\fIchannel, readBuf, bytesToRead\fR)
.sp
int
-\fBTcl_WriteRaw\fR(\fIchannel, bufPtr, bytesToWrite\fR)
+\fBTcl_WriteRaw\fR(\fIchannel, byteBuf, bytesToWrite\fR)
.VE
.sp
int
@@ -123,8 +121,7 @@
The name of a local or network file.
.AP char *mode in
Specifies how the file is to be accessed. May have any of the values
-allowed for the \fImode\fR argument to the Tcl \fBopen\fR command. For
-\fBTcl_OpenCommandChannel\fR, may be NULL.
+allowed for the \fImode\fR argument to the Tcl \fBopen\fR command.
.AP int permissions in
POSIX-style permission flags such as 0644. If a new file is created, these
permissions will be set on the created file.
@@ -149,12 +146,16 @@
.AP int readOrWrite in
OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate
what operations are valid on \fIhandle\fR.
-.AP char *channelName in
+.AP "CONST char" *channelName in
The name of the channel.
.AP int *modePtr out
Points at an integer variable that will receive an OR-ed combination of
\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR denoting whether the channel is
open for reading and writing.
+.VS 8.3
+.AP "CONST char" *pattern in
+The pattern to match on, passed to Tcl_StringMatch, or NULL.
+.VE
.AP Tcl_Channel channel in
A Tcl channel for input or output. Must have been the return value
from a procedure such as \fBTcl_OpenFileChannel\fR.
@@ -182,11 +183,20 @@
A pointer to a Tcl dynamic string in which to store the line read from the
channel. Must have been initialized by the caller. The line read will be
appended to any data already in the dynamic string.
+.VS 8.3
+.AP "CONST char" *input in
+The input to add to a channel buffer.
+.AP int inputLen in
+Length of the input
+.AP int addAtEnd in
+Flag indicating whether the input should be added to the end or
+beginning of the channel buffer.
+.VE
.AP Tcl_Obj *writeObjPtr in
A pointer to a Tcl Object whose contents will be output to the channel.
.AP "CONST char" *charBuf in
A buffer containing the characters to output to the channel.
-.AP char *byteBuf in
+.AP "CONST char" *byteBuf in
A buffer containing the bytes to output to the channel.
.AP int bytesToWrite in
The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and
@@ -200,25 +210,14 @@
Relative to which point to seek; used with \fIoffset\fR to calculate the new
access point for the channel. Legal values are \fBSEEK_SET\fR,
\fBSEEK_CUR\fR, and \fBSEEK_END\fR.
-.AP char *optionName in
+.AP "CONST char" *optionName in
The name of an option applicable to this channel, such as \fB\-blocking\fR.
May have any of the values accepted by the \fBfconfigure\fR command.
.AP Tcl_DString *optionValue in
Where to store the value of an option or a list of all options and their
values. Must have been initialized by the caller.
-.AP char *newValue in
+.AP "CONST char" *newValue in
New value for the option given by \fIoptionName\fR.
-.VS 8.3
-.AP char *pattern in
-The pattern to match on, passed to Tcl_StringMatch, or NULL.
-.AP char *input in
-The input to add to a channel buffer.
-.AP int inputLen in
-Length of the input
-.AP int addToEnd in
-Flag indicating whether the input should be added to the end or
-beginning of the channel buffer.
-.VE
.BE
.SH DESCRIPTION
@@ -316,7 +315,7 @@
\fBTcl_GetChannel\fR returns a channel given the \fIchannelName\fR used to
create it with \fBTcl_CreateChannel\fR and a pointer to a Tcl interpreter in
\fIinterp\fR. If a channel by that name is not registered in that interpreter,
-the procedure returns NULL. If the \fImode\fR argument is not NULL, it
+the procedure returns NULL. If the \fImodePtr\fR argument is not NULL, it
points at an integer variable that will receive an OR-ed combination of
\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR describing whether the channel is
open for reading and writing.
@@ -430,7 +429,7 @@
to UTF-8 based on the channel's encoding and storing the produced data in
\fIreadObjPtr\fR's string representation. The return value of
\fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR,
-that were stored in \fIobjPtr\fR. If an error occurs while reading, the
+that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the
return value is \-1 and \fBTcl_ReadChars\fR records a POSIX error code that
can be retrieved with \fBTcl_GetErrno\fR.
.PP
@@ -467,9 +466,9 @@
encoding conversions, regardless of the channel's encoding. It is deprecated
and exists for backwards compatibility with non-internationalized Tcl
extensions. It consumes bytes from \fIchannel\fR and stores them in
-\fIbuf\fR, performing end-of-line translations on the way. The return value
-of \fBTcl_Read\fR is the number of bytes, up to \fItoRead\fR, written in
-\fIbuf\fR. The buffer produced by \fBTcl_Read\fR is not NULL terminated.
+\fIreadBuf\fR, performing end-of-line translations on the way. The return value
+of \fBTcl_Read\fR is the number of bytes, up to \fIbytesToRead\fR, written in
+\fIreadBuf\fR. The buffer produced by \fBTcl_Read\fR is not NULL terminated.
Its contents are valid from the zeroth position up to and excluding the
position indicated by the return value.
.PP
@@ -506,15 +505,15 @@
.PP
\fBTcl_Gets\fR is the same as \fBTcl_GetsObj\fR except the resulting
characters are appended to the dynamic string given by
-\fIdsPtr\fR rather than a Tcl object.
+\fIlineRead\fR rather than a Tcl object.
.SH "TCL_UNGETS"
.PP
\fBTcl_Ungets\fR is used to add data to the input queue of a channel,
-at either the head or tail of the queue. \fIInput\fR is a pointer to
-the data that is to be added. \fIInputLen\fR gives the length of the
-input to add. \fIAddAtEnd\fR, in non-zero, indicates that the data is
-to be added at the end of queue; otherwise it will be added at the
+at either the head or tail of the queue. The pointer \fIinput\fR points
+to the data that is to be added. The length of the input to add is given
+by \fIinputLen\fR. A non-zero value of \fIaddAtEnd\fR indicates that the
+data is to be added at the end of queue; otherwise it will be added at the
head of the queue. If \fIchannel\fR has a "sticky" EOF set, no data will be
added to the input queue. \fBTcl_Ungets\fR returns \fIinputLen\fR or
-1 if an error occurs.
@@ -607,7 +606,7 @@
.SH TCL_GETCHANNELOPTION
.PP
-\fBTcl_GetChannelOption\fR retrieves, in \fIdsPtr\fR, the value of one of
+\fBTcl_GetChannelOption\fR retrieves, in \fIoptionValue\fR, the value of one of
the options currently in effect for a channel, or a list of all options and
their values. The \fIchannel\fR argument identifies the channel for which
to query an option or retrieve all options and their values.
@@ -629,9 +628,8 @@
.SH TCL_SETCHANNELOPTION
.PP
-\fBTcl_SetChannelOption\fR sets a new value for an option on \fIchannel\fR.
-\fIOptionName\fR is the option to set and \fInewValue\fR is the value to
-set.
+\fBTcl_SetChannelOption\fR sets a new value \fInewValue\fR
+for an option \fIoptionName\fR on \fIchannel\fR.
The procedure normally returns \fBTCL_OK\fR. If an error occurs,
it returns \fBTCL_ERROR\fR; in addition, if \fIinterp\fR is non-NULL,
\fBTcl_SetChannelOption\fR leaves an error message in the interpreter's result.
Index: generic/tcl.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.decls,v
retrieving revision 1.69
diff -u -u -r1.69 tcl.decls
--- generic/tcl.decls 2002/01/14 15:07:39 1.69
+++ generic/tcl.decls 2002/01/15 17:44:28
@@ -289,8 +289,8 @@
char Tcl_Backslash(CONST char *src, int *readPtr)
}
declare 78 generic {
- int Tcl_BadChannelOption(Tcl_Interp *interp, char *optionName, \
- char *optionList)
+ int Tcl_BadChannelOption(Tcl_Interp *interp, CONST char *optionName, \
+ CONST char *optionList)
}
declare 79 generic {
void Tcl_CallWhenDeleted(Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, \
@@ -325,8 +325,8 @@
Tcl_Obj *CONST objv[])
}
declare 88 generic {
- Tcl_Channel Tcl_CreateChannel(Tcl_ChannelType *typePtr, char *chanName, \
- ClientData instanceData, int mask)
+ Tcl_Channel Tcl_CreateChannel(Tcl_ChannelType *typePtr,
+ CONST char *chanName, ClientData instanceData, int mask)
}
declare 89 generic {
void Tcl_CreateChannelHandler(Tcl_Channel chan, int mask, \
@@ -543,7 +543,7 @@
Tcl_InterpDeleteProc **procPtr)
}
declare 151 generic {
- Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp, char *chanName, \
+ Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp, CONST char *chanName, \
int *modePtr)
}
declare 152 generic {
@@ -560,11 +560,11 @@
int Tcl_GetChannelMode(Tcl_Channel chan)
}
declare 156 generic {
- char * Tcl_GetChannelName(Tcl_Channel chan)
+ CONST char * Tcl_GetChannelName(Tcl_Channel chan)
}
declare 157 generic {
int Tcl_GetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, \
- char *optionName, Tcl_DString *dsPtr)
+ CONST char *optionName, Tcl_DString *dsPtr)
}
declare 158 generic {
Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan)
@@ -792,7 +792,7 @@
}
declare 225 generic {
int Tcl_SetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, \
- char *optionName, char *newValue)
+ CONST char *optionName, CONST char *newValue)
}
declare 226 generic {
int Tcl_SetCommandInfo(Tcl_Interp *interp, CONST char *cmdName, \
@@ -877,7 +877,7 @@
Tcl_DString *bufferPtr)
}
declare 250 generic {
- int Tcl_Ungets(Tcl_Channel chan, char *str, int len, int atHead)
+ int Tcl_Ungets(Tcl_Channel chan, CONST char *str, int len, int atHead)
}
declare 251 generic {
void Tcl_UnlinkVar(Tcl_Interp *interp, char *varName)
@@ -923,7 +923,7 @@
ClientData prevClientData)
}
declare 263 generic {
- int Tcl_Write(Tcl_Channel chan, char *s, int slen)
+ int Tcl_Write(Tcl_Channel chan, CONST char *s, int slen)
}
declare 264 generic {
void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, \
@@ -1365,7 +1365,7 @@
int Tcl_GetChannelNames(Tcl_Interp *interp)
}
declare 389 generic {
- int Tcl_GetChannelNamesEx(Tcl_Interp *interp, char *pattern)
+ int Tcl_GetChannelNamesEx(Tcl_Interp *interp, CONST char *pattern)
}
declare 390 generic {
int Tcl_ProcObjCmd(ClientData clientData, Tcl_Interp *interp, \
@@ -1387,7 +1387,7 @@
int Tcl_ReadRaw (Tcl_Channel chan, char *dst, int bytesToRead)
}
declare 395 generic {
- int Tcl_WriteRaw (Tcl_Channel chan, char *src, int srcLen)
+ int Tcl_WriteRaw (Tcl_Channel chan, CONST char *src, int srcLen)
}
declare 396 generic {
Tcl_Channel Tcl_GetTopChannel (Tcl_Channel chan)
@@ -1396,7 +1396,7 @@
int Tcl_ChannelBuffered (Tcl_Channel chan)
}
declare 398 generic {
- char * Tcl_ChannelName(Tcl_ChannelType *chanTypePtr)
+ CONST char * Tcl_ChannelName(Tcl_ChannelType *chanTypePtr)
}
declare 399 generic {
Tcl_ChannelTypeVersion Tcl_ChannelVersion(Tcl_ChannelType *chanTypePtr)
Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.107
diff -u -u -r1.107 tcl.h
--- generic/tcl.h 2001/12/18 15:21:20 1.107
+++ generic/tcl.h 2002/01/15 17:44:29
@@ -1337,15 +1337,15 @@
typedef int (Tcl_DriverInputProc) _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCodePtr));
typedef int (Tcl_DriverOutputProc) _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCodePtr));
+ CONST char *buf, int toWrite, int *errorCodePtr));
typedef int (Tcl_DriverSeekProc) _ANSI_ARGS_((ClientData instanceData,
long offset, int mode, int *errorCodePtr));
typedef int (Tcl_DriverSetOptionProc) _ANSI_ARGS_((
ClientData instanceData, Tcl_Interp *interp,
- char *optionName, char *value));
+ CONST char *optionName, CONST char *value));
typedef int (Tcl_DriverGetOptionProc) _ANSI_ARGS_((
ClientData instanceData, Tcl_Interp *interp,
- char *optionName, Tcl_DString *dsPtr));
+ CONST char *optionName, Tcl_DString *dsPtr));
typedef void (Tcl_DriverWatchProc) _ANSI_ARGS_((
ClientData instanceData, int mask));
typedef int (Tcl_DriverGetHandleProc) _ANSI_ARGS_((
@@ -1388,17 +1388,6 @@
# define Tcl_ValidateAllMemory(x,y)
#endif /* !TCL_MEM_DEBUG */
-
-/*
- * Enum for different end of line translation and recognition modes.
- */
-
-typedef enum Tcl_EolTranslation {
- TCL_TRANSLATE_AUTO, /* Eol == \r, \n and \r\n. */
- TCL_TRANSLATE_CR, /* Eol == \r. */
- TCL_TRANSLATE_LF, /* Eol == \n. */
- TCL_TRANSLATE_CRLF /* Eol == \r\n. */
-} Tcl_EolTranslation;
/*
* struct Tcl_ChannelType:
Index: generic/tclDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDecls.h,v
retrieving revision 1.69
diff -u -u -r1.69 tclDecls.h
--- generic/tclDecls.h 2002/01/14 15:07:39 1.69
+++ generic/tclDecls.h 2002/01/15 17:44:29
@@ -257,8 +257,8 @@
int * readPtr));
/* 78 */
EXTERN int Tcl_BadChannelOption _ANSI_ARGS_((
- Tcl_Interp * interp, char * optionName,
- char * optionList));
+ Tcl_Interp * interp, CONST char * optionName,
+ CONST char * optionList));
/* 79 */
EXTERN void Tcl_CallWhenDeleted _ANSI_ARGS_((Tcl_Interp * interp,
Tcl_InterpDeleteProc * proc,
@@ -293,7 +293,8 @@
Tcl_Obj *CONST objv[]));
/* 88 */
EXTERN Tcl_Channel Tcl_CreateChannel _ANSI_ARGS_((
- Tcl_ChannelType * typePtr, char * chanName,
+ Tcl_ChannelType * typePtr,
+ CONST char * chanName,
ClientData instanceData, int mask));
/* 89 */
EXTERN void Tcl_CreateChannelHandler _ANSI_ARGS_((
@@ -504,7 +505,7 @@
Tcl_InterpDeleteProc ** procPtr));
/* 151 */
EXTERN Tcl_Channel Tcl_GetChannel _ANSI_ARGS_((Tcl_Interp * interp,
- char * chanName, int * modePtr));
+ CONST char * chanName, int * modePtr));
/* 152 */
EXTERN int Tcl_GetChannelBufferSize _ANSI_ARGS_((
Tcl_Channel chan));
@@ -517,11 +518,11 @@
/* 155 */
EXTERN int Tcl_GetChannelMode _ANSI_ARGS_((Tcl_Channel chan));
/* 156 */
-EXTERN char * Tcl_GetChannelName _ANSI_ARGS_((Tcl_Channel chan));
+EXTERN CONST char * Tcl_GetChannelName _ANSI_ARGS_((Tcl_Channel chan));
/* 157 */
EXTERN int Tcl_GetChannelOption _ANSI_ARGS_((
Tcl_Interp * interp, Tcl_Channel chan,
- char * optionName, Tcl_DString * dsPtr));
+ CONST char * optionName, Tcl_DString * dsPtr));
/* 158 */
EXTERN Tcl_ChannelType * Tcl_GetChannelType _ANSI_ARGS_((Tcl_Channel chan));
/* 159 */
@@ -729,7 +730,8 @@
/* 225 */
EXTERN int Tcl_SetChannelOption _ANSI_ARGS_((
Tcl_Interp * interp, Tcl_Channel chan,
- char * optionName, char * newValue));
+ CONST char * optionName,
+ CONST char * newValue));
/* 226 */
EXTERN int Tcl_SetCommandInfo _ANSI_ARGS_((Tcl_Interp * interp,
CONST char * cmdName, Tcl_CmdInfo * infoPtr));
@@ -804,8 +806,8 @@
Tcl_Interp * interp, char * name,
Tcl_DString * bufferPtr));
/* 250 */
-EXTERN int Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan, char * str,
- int len, int atHead));
+EXTERN int Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan,
+ CONST char * str, int len, int atHead));
/* 251 */
EXTERN void Tcl_UnlinkVar _ANSI_ARGS_((Tcl_Interp * interp,
char * varName));
@@ -853,8 +855,8 @@
Tcl_VarTraceProc * procPtr,
ClientData prevClientData));
/* 263 */
-EXTERN int Tcl_Write _ANSI_ARGS_((Tcl_Channel chan, char * s,
- int slen));
+EXTERN int Tcl_Write _ANSI_ARGS_((Tcl_Channel chan,
+ CONST char * s, int slen));
/* 264 */
EXTERN void Tcl_WrongNumArgs _ANSI_ARGS_((Tcl_Interp * interp,
int objc, Tcl_Obj *CONST objv[],
@@ -1219,7 +1221,7 @@
EXTERN int Tcl_GetChannelNames _ANSI_ARGS_((Tcl_Interp * interp));
/* 389 */
EXTERN int Tcl_GetChannelNamesEx _ANSI_ARGS_((
- Tcl_Interp * interp, char * pattern));
+ Tcl_Interp * interp, CONST char * pattern));
/* 390 */
EXTERN int Tcl_ProcObjCmd _ANSI_ARGS_((ClientData clientData,
Tcl_Interp * interp, int objc,
@@ -1239,13 +1241,13 @@
char * dst, int bytesToRead));
/* 395 */
EXTERN int Tcl_WriteRaw _ANSI_ARGS_((Tcl_Channel chan,
- char * src, int srcLen));
+ CONST char * src, int srcLen));
/* 396 */
EXTERN Tcl_Channel Tcl_GetTopChannel _ANSI_ARGS_((Tcl_Channel chan));
/* 397 */
EXTERN int Tcl_ChannelBuffered _ANSI_ARGS_((Tcl_Channel chan));
/* 398 */
-EXTERN char * Tcl_ChannelName _ANSI_ARGS_((
+EXTERN CONST char * Tcl_ChannelName _ANSI_ARGS_((
Tcl_ChannelType * chanTypePtr));
/* 399 */
EXTERN Tcl_ChannelTypeVersion Tcl_ChannelVersion _ANSI_ARGS_((
@@ -1615,7 +1617,7 @@
int (*tcl_AsyncReady) _ANSI_ARGS_((void)); /* 75 */
void (*tcl_BackgroundError) _ANSI_ARGS_((Tcl_Interp * interp)); /* 76 */
char (*tcl_Backslash) _ANSI_ARGS_((CONST char * src, int * readPtr)); /* 77 */
- int (*tcl_BadChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, char * optionName, char * optionList)); /* 78 */
+ int (*tcl_BadChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * optionName, CONST char * optionList)); /* 78 */
void (*tcl_CallWhenDeleted) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 79 */
void (*tcl_CancelIdleCall) _ANSI_ARGS_((Tcl_IdleProc * idleProc, ClientData clientData)); /* 80 */
int (*tcl_Close) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 81 */
@@ -1625,7 +1627,7 @@
int (*tcl_ConvertCountedElement) _ANSI_ARGS_((CONST char * src, int length, char * dst, int flags)); /* 85 */
int (*tcl_CreateAlias) _ANSI_ARGS_((Tcl_Interp * slave, char * slaveCmd, Tcl_Interp * target, char * targetCmd, int argc, char ** argv)); /* 86 */
int (*tcl_CreateAliasObj) _ANSI_ARGS_((Tcl_Interp * slave, char * slaveCmd, Tcl_Interp * target, char * targetCmd, int objc, Tcl_Obj *CONST objv[])); /* 87 */
- Tcl_Channel (*tcl_CreateChannel) _ANSI_ARGS_((Tcl_ChannelType * typePtr, char * chanName, ClientData instanceData, int mask)); /* 88 */
+ Tcl_Channel (*tcl_CreateChannel) _ANSI_ARGS_((Tcl_ChannelType * typePtr, CONST char * chanName, ClientData instanceData, int mask)); /* 88 */
void (*tcl_CreateChannelHandler) _ANSI_ARGS_((Tcl_Channel chan, int mask, Tcl_ChannelProc * proc, ClientData clientData)); /* 89 */
void (*tcl_CreateCloseHandler) _ANSI_ARGS_((Tcl_Channel chan, Tcl_CloseProc * proc, ClientData clientData)); /* 90 */
Tcl_Command (*tcl_CreateCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_CmdProc * proc, ClientData clientData, Tcl_CmdDeleteProc * deleteProc)); /* 91 */
@@ -1696,13 +1698,13 @@
int (*tcl_GetAlias) _ANSI_ARGS_((Tcl_Interp * interp, char * slaveCmd, Tcl_Interp ** targetInterpPtr, char ** targetCmdPtr, int * argcPtr, char *** argvPtr)); /* 148 */
int (*tcl_GetAliasObj) _ANSI_ARGS_((Tcl_Interp * interp, char * slaveCmd, Tcl_Interp ** targetInterpPtr, char ** targetCmdPtr, int * objcPtr, Tcl_Obj *** objv)); /* 149 */
ClientData (*tcl_GetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc ** procPtr)); /* 150 */
- Tcl_Channel (*tcl_GetChannel) _ANSI_ARGS_((Tcl_Interp * interp, char * chanName, int * modePtr)); /* 151 */
+ Tcl_Channel (*tcl_GetChannel) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * chanName, int * modePtr)); /* 151 */
int (*tcl_GetChannelBufferSize) _ANSI_ARGS_((Tcl_Channel chan)); /* 152 */
int (*tcl_GetChannelHandle) _ANSI_ARGS_((Tcl_Channel chan, int direction, ClientData * handlePtr)); /* 153 */
ClientData (*tcl_GetChannelInstanceData) _ANSI_ARGS_((Tcl_Channel chan)); /* 154 */
int (*tcl_GetChannelMode) _ANSI_ARGS_((Tcl_Channel chan)); /* 155 */
- char * (*tcl_GetChannelName) _ANSI_ARGS_((Tcl_Channel chan)); /* 156 */
- int (*tcl_GetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, char * optionName, Tcl_DString * dsPtr)); /* 157 */
+ CONST char * (*tcl_GetChannelName) _ANSI_ARGS_((Tcl_Channel chan)); /* 156 */
+ int (*tcl_GetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, Tcl_DString * dsPtr)); /* 157 */
Tcl_ChannelType * (*tcl_GetChannelType) _ANSI_ARGS_((Tcl_Channel chan)); /* 158 */
int (*tcl_GetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_CmdInfo * infoPtr)); /* 159 */
CONST char * (*tcl_GetCommandName) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Command command)); /* 160 */
@@ -1794,7 +1796,7 @@
int (*tcl_ServiceEvent) _ANSI_ARGS_((int flags)); /* 222 */
void (*tcl_SetAssocData) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_InterpDeleteProc * proc, ClientData clientData)); /* 223 */
void (*tcl_SetChannelBufferSize) _ANSI_ARGS_((Tcl_Channel chan, int sz)); /* 224 */
- int (*tcl_SetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, char * optionName, char * newValue)); /* 225 */
+ int (*tcl_SetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, CONST char * newValue)); /* 225 */
int (*tcl_SetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, Tcl_CmdInfo * infoPtr)); /* 226 */
void (*tcl_SetErrno) _ANSI_ARGS_((int err)); /* 227 */
void (*tcl_SetErrorCode) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 228 */
@@ -1819,7 +1821,7 @@
int (*tcl_TraceVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 247 */
int (*tcl_TraceVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * proc, ClientData clientData)); /* 248 */
char * (*tcl_TranslateFileName) _ANSI_ARGS_((Tcl_Interp * interp, char * name, Tcl_DString * bufferPtr)); /* 249 */
- int (*tcl_Ungets) _ANSI_ARGS_((Tcl_Channel chan, char * str, int len, int atHead)); /* 250 */
+ int (*tcl_Ungets) _ANSI_ARGS_((Tcl_Channel chan, CONST char * str, int len, int atHead)); /* 250 */
void (*tcl_UnlinkVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName)); /* 251 */
int (*tcl_UnregisterChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 252 */
int (*tcl_UnsetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 253 */
@@ -1832,7 +1834,7 @@
int (*tcl_VarEval) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 260 */
ClientData (*tcl_VarTraceInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 261 */
ClientData (*tcl_VarTraceInfo2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 262 */
- int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, char * s, int slen)); /* 263 */
+ int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, CONST char * s, int slen)); /* 263 */
void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], CONST char * message)); /* 264 */
int (*tcl_DumpActiveMemory) _ANSI_ARGS_((CONST char * fileName)); /* 265 */
void (*tcl_ValidateAllMemory) _ANSI_ARGS_((CONST char * file, int line)); /* 266 */
@@ -1958,16 +1960,16 @@
void (*tcl_SetNotifier) _ANSI_ARGS_((Tcl_NotifierProcs * notifierProcPtr)); /* 386 */
Tcl_Mutex * (*tcl_GetAllocMutex) _ANSI_ARGS_((void)); /* 387 */
int (*tcl_GetChannelNames) _ANSI_ARGS_((Tcl_Interp * interp)); /* 388 */
- int (*tcl_GetChannelNamesEx) _ANSI_ARGS_((Tcl_Interp * interp, char * pattern)); /* 389 */
+ int (*tcl_GetChannelNamesEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pattern)); /* 389 */
int (*tcl_ProcObjCmd) _ANSI_ARGS_((ClientData clientData, Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[])); /* 390 */
void (*tcl_ConditionFinalize) _ANSI_ARGS_((Tcl_Condition * condPtr)); /* 391 */
void (*tcl_MutexFinalize) _ANSI_ARGS_((Tcl_Mutex * mutex)); /* 392 */
int (*tcl_CreateThread) _ANSI_ARGS_((Tcl_ThreadId * idPtr, Tcl_ThreadCreateProc proc, ClientData clientData, int stackSize, int flags)); /* 393 */
int (*tcl_ReadRaw) _ANSI_ARGS_((Tcl_Channel chan, char * dst, int bytesToRead)); /* 394 */
- int (*tcl_WriteRaw) _ANSI_ARGS_((Tcl_Channel chan, char * src, int srcLen)); /* 395 */
+ int (*tcl_WriteRaw) _ANSI_ARGS_((Tcl_Channel chan, CONST char * src, int srcLen)); /* 395 */
Tcl_Channel (*tcl_GetTopChannel) _ANSI_ARGS_((Tcl_Channel chan)); /* 396 */
int (*tcl_ChannelBuffered) _ANSI_ARGS_((Tcl_Channel chan)); /* 397 */
- char * (*tcl_ChannelName) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 398 */
+ CONST char * (*tcl_ChannelName) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 398 */
Tcl_ChannelTypeVersion (*tcl_ChannelVersion) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 399 */
Tcl_DriverBlockModeProc * (*tcl_ChannelBlockModeProc) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 400 */
Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) _ANSI_ARGS_((Tcl_ChannelType * chanTypePtr)); /* 401 */
Index: generic/tclIO.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.c,v
retrieving revision 1.43
diff -u -u -r1.43 tclIO.c
--- generic/tclIO.c 2001/12/17 22:55:50 1.43
+++ generic/tclIO.c 2002/01/15 17:44:31
@@ -112,7 +112,7 @@
ChannelState *chanPtr));
static int DoRead _ANSI_ARGS_((Channel *chanPtr, char *srcPtr,
int slen));
-static int DoWrite _ANSI_ARGS_((Channel *chanPtr, char *src,
+static int DoWrite _ANSI_ARGS_((Channel *chanPtr, CONST char *src,
int srcLen));
static int DoReadChars _ANSI_ARGS_ ((Channel* chan,
Tcl_Obj* objPtr, int toRead, int appendFlag));
@@ -756,7 +756,7 @@
chanPtr = ((Channel *) chan)->state->bottomChanPtr;
statePtr = chanPtr->state;
- if (statePtr->channelName == (char *) NULL) {
+ if (statePtr->channelName == (CONST char *) NULL) {
panic("Tcl_RegisterChannel: channel without name");
}
if (interp != (Tcl_Interp *) NULL) {
@@ -1003,7 +1003,7 @@
Tcl_GetChannel(interp, chanName, modePtr)
Tcl_Interp *interp; /* Interpreter in which to find or create
* the channel. */
- char *chanName; /* The name of the channel. */
+ CONST char *chanName; /* The name of the channel. */
int *modePtr; /* Where to store the mode in which the
* channel was opened? Will contain an ORed
* combination of TCL_READABLE and
@@ -1012,7 +1012,7 @@
Channel *chanPtr; /* The actual channel. */
Tcl_HashTable *hTblPtr; /* Hash table of channels. */
Tcl_HashEntry *hPtr; /* Search variable. */
- char *name; /* Translated name. */
+ CONST char *name; /* Translated name. */
/*
* Substitute "stdin", etc. Note that even though we immediately
@@ -1081,7 +1081,7 @@
Tcl_Channel
Tcl_CreateChannel(typePtr, chanName, instanceData, mask)
Tcl_ChannelType *typePtr; /* The channel type record. */
- char *chanName; /* Name of channel to record. */
+ CONST char *chanName; /* Name of channel to record. */
ClientData instanceData; /* Instance specific data. */
int mask; /* TCL_READABLE & TCL_WRITABLE to indicate
* if the channel is readable, writable. */
@@ -1121,8 +1121,9 @@
*/
if (chanName != (char *) NULL) {
- statePtr->channelName = ckalloc((unsigned) (strlen(chanName) + 1));
- strcpy(statePtr->channelName, chanName);
+ char *tmp = ckalloc((unsigned) (strlen(chanName) + 1));
+ statePtr->channelName = tmp;
+ strcpy(tmp, chanName);
} else {
panic("Tcl_CreateChannel: NULL channel name");
}
@@ -1717,7 +1718,7 @@
*----------------------------------------------------------------------
*/
-char *
+CONST char *
Tcl_GetChannelName(chan)
Tcl_Channel chan; /* The channel for which to return the name. */
{
@@ -2276,7 +2277,7 @@
if (chanPtr == statePtr->bottomChanPtr) {
if (statePtr->channelName != (char *) NULL) {
- ckfree(statePtr->channelName);
+ ckfree((char *) statePtr->channelName);
statePtr->channelName = NULL;
}
@@ -2682,7 +2683,7 @@
int
Tcl_Write(chan, src, srcLen)
Tcl_Channel chan; /* The channel to buffer output for. */
- char *src; /* Data to queue in output buffer. */
+ CONST char *src; /* Data to queue in output buffer. */
int srcLen; /* Length of data in bytes, or < 0 for
* strlen(). */
{
@@ -2732,7 +2733,7 @@
int
Tcl_WriteRaw(chan, src, srcLen)
Tcl_Channel chan; /* The channel to buffer output for. */
- char *src; /* Data to queue in output buffer. */
+ CONST char *src; /* Data to queue in output buffer. */
int srcLen; /* Length of data in bytes, or < 0 for
* strlen(). */
{
@@ -4912,7 +4913,7 @@
int
Tcl_Ungets(chan, str, len, atEnd)
Tcl_Channel chan; /* The channel for which to add the input. */
- char *str; /* The input itself. */
+ CONST char *str; /* The input itself. */
int len; /* The length of the input. */
int atEnd; /* If non-zero, add at end of queue; otherwise
* add at head of queue. */
@@ -5872,8 +5873,8 @@
int
Tcl_BadChannelOption(interp, optionName, optionList)
Tcl_Interp *interp; /* Current interpreter. (can be NULL)*/
- char *optionName; /* 'bad option' name */
- char *optionList; /* Specific options list to append
+ CONST char *optionName; /* 'bad option' name */
+ CONST char *optionList; /* Specific options list to append
* to the standard generic options.
* can be NULL for generic options
* only.
@@ -5935,7 +5936,7 @@
Tcl_GetChannelOption(interp, chan, optionName, dsPtr)
Tcl_Interp *interp; /* For error reporting - can be NULL. */
Tcl_Channel chan; /* Channel on which to get option. */
- char *optionName; /* Option to get. */
+ CONST char *optionName; /* Option to get. */
Tcl_DString *dsPtr; /* Where to store value(s). */
{
size_t len; /* Length of optionName string. */
@@ -6159,10 +6160,9 @@
Tcl_SetChannelOption(interp, chan, optionName, newValue)
Tcl_Interp *interp; /* For error reporting - can be NULL. */
Tcl_Channel chan; /* Channel on which to set mode. */
- char *optionName; /* Which option to set? */
- char *newValue; /* New value for option. */
+ CONST char *optionName; /* Which option to set? */
+ CONST char *newValue; /* New value for option. */
{
- int newMode; /* New (numeric) mode to sert. */
Channel *chanPtr = (Channel *) chan; /* The real IO channel. */
ChannelState *statePtr = chanPtr->state; /* state info for channel */
size_t len; /* Length of optionName string. */
@@ -6203,6 +6203,7 @@
if ((len > 2) && (optionName[1] == 'b') &&
(strncmp(optionName, "-blocking", len) == 0)) {
+ int newMode;
if (Tcl_GetBoolean(interp, newValue, &newMode) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -6321,23 +6322,24 @@
}
if (readMode) {
+ TclEolTranslation translation;
if (*readMode == '\0') {
- newMode = statePtr->inputTranslation;
+ translation = statePtr->inputTranslation;
} else if (strcmp(readMode, "auto") == 0) {
- newMode = TCL_TRANSLATE_AUTO;
+ translation = TCL_TRANSLATE_AUTO;
} else if (strcmp(readMode, "binary") == 0) {
- newMode = TCL_TRANSLATE_LF;
+ translation = TCL_TRANSLATE_LF;
statePtr->inEofChar = 0;
Tcl_FreeEncoding(statePtr->encoding);
statePtr->encoding = NULL;
} else if (strcmp(readMode, "lf") == 0) {
- newMode = TCL_TRANSLATE_LF;
+ translation = TCL_TRANSLATE_LF;
} else if (strcmp(readMode, "cr") == 0) {
- newMode = TCL_TRANSLATE_CR;
+ translation = TCL_TRANSLATE_CR;
} else if (strcmp(readMode, "crlf") == 0) {
- newMode = TCL_TRANSLATE_CRLF;
+ translation = TCL_TRANSLATE_CRLF;
} else if (strcmp(readMode, "platform") == 0) {
- newMode = TCL_PLATFORM_TRANSLATION;
+ translation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
Tcl_AppendResult(interp,
@@ -6355,8 +6357,8 @@
* complete the line.
*/
- if (newMode != statePtr->inputTranslation) {
- statePtr->inputTranslation = (Tcl_EolTranslation) newMode;
+ if (translation != statePtr->inputTranslation) {
+ statePtr->inputTranslation = translation;
statePtr->flags &= ~(INPUT_SAW_CR);
statePtr->flags &= ~(CHANNEL_NEED_MORE_DATA);
UpdateInterest(chanPtr);
@@ -8023,14 +8025,14 @@
static int
DoWrite(chanPtr, src, srcLen)
Channel *chanPtr; /* The channel to buffer output for. */
- char *src; /* Data to write. */
+ CONST char *src; /* Data to write. */
int srcLen; /* Number of bytes to write. */
{
ChannelState *statePtr = chanPtr->state; /* state info for channel */
ChannelBuffer *outBufPtr; /* Current output buffer. */
int foundNewline; /* Did we find a newline in output? */
char *dPtr;
- char *sPtr; /* Search variables for newline. */
+ CONST char *sPtr; /* Search variables for newline. */
int crsent; /* In CRLF eol translation mode,
* remember the fact that a CR was
* output to the channel without
@@ -8382,11 +8384,11 @@
int
Tcl_GetChannelNamesEx(interp, pattern)
Tcl_Interp *interp; /* Interp for error reporting. */
- char *pattern; /* pattern to filter on. */
+ CONST char *pattern; /* pattern to filter on. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
ChannelState *statePtr;
- char *name; /* name for channel */
+ CONST char *name; /* name for channel */
Tcl_Obj *resultPtr; /* pointer to result object */
Tcl_HashTable *hTblPtr; /* Hash table of channels. */
Tcl_HashEntry *hPtr; /* Search variable. */
@@ -8530,7 +8532,7 @@
{
ChannelState *statePtr;
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- char *name;
+ CONST char *name;
int chanNameLen;
chanNameLen = strlen(chanName);
@@ -8572,7 +8574,7 @@
*----------------------------------------------------------------------
*/
-char *
+CONST char *
Tcl_ChannelName(chanTypePtr)
Tcl_ChannelType *chanTypePtr; /* Pointer to channel type. */
{
Index: generic/tclIO.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIO.h,v
retrieving revision 1.4
diff -u -u -r1.4 tclIO.h
--- generic/tclIO.h 2001/09/27 02:12:19 1.4
+++ generic/tclIO.h 2002/01/15 17:44:31
@@ -158,7 +158,7 @@
*/
typedef struct ChannelState {
- char *channelName; /* The name of the channel instance in Tcl
+ CONST char *channelName; /* The name of the channel instance in Tcl
* commands. Storage is owned by the generic IO
* code, is dynamically allocated. */
int flags; /* ORed combination of the flags defined
@@ -182,10 +182,10 @@
* data bytes. May be TCL_ENCODING_START
* before converting first byte and
* TCL_ENCODING_END when EOF is seen. */
- Tcl_EolTranslation inputTranslation;
+ TclEolTranslation inputTranslation;
/* What translation to apply for end of line
* sequences on input? */
- Tcl_EolTranslation outputTranslation;
+ TclEolTranslation outputTranslation;
/* What translation to use for generating
* end of line sequences in output? */
int inEofChar; /* If nonzero, use this as a signal of EOF
Index: generic/tclIOGT.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIOGT.c,v
retrieving revision 1.3
diff -u -u -r1.3 tclIOGT.c
--- generic/tclIOGT.c 2000/09/29 21:42:19 1.3
+++ generic/tclIOGT.c 2002/01/15 17:44:31
@@ -31,17 +31,17 @@
ClientData instanceData,
char* buf, int toRead, int* errorCodePtr));
static int TransformOutputProc _ANSI_ARGS_ ((
- ClientData instanceData,
- char* buf, int toWrite, int* errorCodePtr));
+ ClientData instanceData, CONST char *buf,
+ int toWrite, int* errorCodePtr));
static int TransformSeekProc _ANSI_ARGS_ ((
ClientData instanceData, long offset,
int mode, int* errorCodePtr));
static int TransformSetOptionProc _ANSI_ARGS_((
ClientData instanceData, Tcl_Interp *interp,
- char *optionName, char *value));
+ CONST char *optionName, CONST char *value));
static int TransformGetOptionProc _ANSI_ARGS_((
ClientData instanceData, Tcl_Interp *interp,
- char *optionName, Tcl_DString *dsPtr));
+ CONST char *optionName, Tcl_DString *dsPtr));
static void TransformWatchProc _ANSI_ARGS_ ((
ClientData instanceData, int mask));
static int TransformGetFileHandleProc _ANSI_ARGS_ ((
@@ -796,7 +796,7 @@
static int
TransformOutputProc (instanceData, buf, toWrite, errorCodePtr)
ClientData instanceData;
- char* buf;
+ CONST char* buf;
int toWrite;
int* errorCodePtr;
{
@@ -915,8 +915,8 @@
TransformSetOptionProc (instanceData, interp, optionName, value)
ClientData instanceData;
Tcl_Interp *interp;
- char *optionName;
- char *value;
+ CONST char *optionName;
+ CONST char *value;
{
TransformChannelData* dataPtr = (TransformChannelData*) instanceData;
Tcl_Channel downChan = Tcl_GetStackedChannel(dataPtr->self);
@@ -953,7 +953,7 @@
TransformGetOptionProc (instanceData, interp, optionName, dsPtr)
ClientData instanceData;
Tcl_Interp* interp;
- char* optionName;
+ CONST char* optionName;
Tcl_DString* dsPtr;
{
TransformChannelData* dataPtr = (TransformChannelData*) instanceData;
@@ -964,7 +964,7 @@
if (getOptionProc != NULL) {
return (*getOptionProc)(Tcl_GetChannelInstanceData(downChan),
interp, optionName, dsPtr);
- } else if (optionName == (char*) NULL) {
+ } else if (optionName == (CONST char*) NULL) {
/*
* Request is query for all options, this is ok.
*/
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.73
diff -u -u -r1.73 tclInt.h
--- generic/tclInt.h 2002/01/09 19:09:28 1.73
+++ generic/tclInt.h 2002/01/15 17:44:32
@@ -1432,7 +1432,7 @@
#define TCL_ALIGN(x) (((int)(x) + 7) & ~7)
/*
- * The following macros are used to specify the runtime platform
+ * The following enum values are used to specify the runtime platform
* setting of the tclPlatform variable.
*/
@@ -1441,6 +1441,19 @@
TCL_PLATFORM_MAC, /* MacOS. */
TCL_PLATFORM_WINDOWS /* Any Microsoft Windows OS. */
} TclPlatformType;
+
+/*
+ * The following enum values are used to indicate the translation
+ * of a Tcl channel. Declared here so that each platform can define
+ * TCL_PLATFORM_TRANSLATION to the native translation on that platform
+ */
+
+typedef enum TclEolTranslation {
+ TCL_TRANSLATE_AUTO, /* Eol == \r, \n and \r\n. */
+ TCL_TRANSLATE_CR, /* Eol == \r. */
+ TCL_TRANSLATE_LF, /* Eol == \n. */
+ TCL_TRANSLATE_CRLF /* Eol == \r\n. */
+} TclEolTranslation;
/*
* Flags for TclInvoke:
Index: mac/tclMacChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacChan.c,v
retrieving revision 1.8
diff -u -u -r1.8 tclMacChan.c
--- mac/tclMacChan.c 2001/11/23 01:27:21 1.8
+++ mac/tclMacChan.c 2002/01/15 17:44:32
@@ -108,7 +108,7 @@
static int FileInput _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int FileOutput _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCode));
+ CONST char *buf, int toWrite, int *errorCode));
static int FileSeek _ANSI_ARGS_((ClientData instanceData,
long offset, int mode, int *errorCode));
static void FileSetupProc _ANSI_ARGS_((ClientData clientData,
@@ -124,7 +124,7 @@
static int StdIOInput _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int StdIOOutput _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCode));
+ CONST char *buf, int toWrite, int *errorCode));
static int StdIOSeek _ANSI_ARGS_((ClientData instanceData,
long offset, int mode, int *errorCode));
static int StdReady _ANSI_ARGS_((ClientData instanceData,
@@ -548,7 +548,7 @@
static int
StdIOOutput(
ClientData instanceData, /* Unused. */
- char *buf, /* The data buffer. */
+ CONST char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
@@ -1082,7 +1082,7 @@
static int
FileOutput(
ClientData instanceData, /* Unused. */
- char *buffer, /* The data buffer. */
+ CONST char *buffer, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCodePtr) /* Where to store error code. */
{
Index: mac/tclMacSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacSock.c,v
retrieving revision 1.9
diff -u -u -r1.9 tclMacSock.c
--- mac/tclMacSock.c 2001/11/23 01:28:30 1.9
+++ mac/tclMacSock.c 2002/01/15 17:44:33
@@ -171,12 +171,12 @@
static int TcpGetHandle _ANSI_ARGS_((ClientData instanceData,
int direction, ClientData *handlePtr));
static int TcpGetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
+ Tcl_Interp *interp, CONST char *optionName,
Tcl_DString *dsPtr));
static int TcpInput _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCodePtr));
static int TcpOutput _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCodePtr));
+ CONST char *buf, int toWrite, int *errorCodePtr));
static void TcpWatch _ANSI_ARGS_((ClientData instanceData,
int mask));
static int WaitForSocketEvent _ANSI_ARGS_((TcpState *infoPtr,
@@ -1201,7 +1201,7 @@
static int
TcpOutput(
ClientData instanceData, /* Channel state. */
- char *buf, /* The data buffer. */
+ CONST char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCodePtr) /* Where to store error code. */
{
@@ -1346,7 +1346,7 @@
TcpGetOptionProc(
ClientData instanceData, /* Socket state. */
Tcl_Interp *interp, /* For error reporting - can be NULL.*/
- char *optionName, /* Name of the option to
+ CONST char *optionName, /* Name of the option to
* retrieve the value for, or
* NULL to get all options and
* their values. */
@@ -1385,7 +1385,7 @@
* if optionName is NULL.
*/
- if (optionName == (char *) NULL || optionName[0] == '\0') {
+ if (optionName == (CONST char *) NULL || optionName[0] == '\0') {
doAll = true;
} else {
if (!strcmp(optionName, "-peername")) {
Index: tools/checkLibraryDoc.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/tools/checkLibraryDoc.tcl,v
retrieving revision 1.6
diff -u -u -r1.6 checkLibraryDoc.tcl
--- tools/checkLibraryDoc.tcl 1999/07/22 21:50:55 1.6
+++ tools/checkLibraryDoc.tcl 2002/01/15 17:44:33
@@ -38,7 +38,6 @@
Tcl_Encoding \
Tcl_EncodingState \
Tcl_EncodingType \
- Tcl_EolTranslation \
Tcl_HashEntry \
Tcl_HashSearch \
Tcl_HashTable \
Index: unix/tclUnixChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixChan.c,v
retrieving revision 1.23
diff -u -u -r1.23 tclUnixChan.c
--- unix/tclUnixChan.c 2001/11/21 02:36:21 1.23
+++ unix/tclUnixChan.c 2002/01/15 17:44:34
@@ -189,8 +189,8 @@
static int FileInputProc _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int FileOutputProc _ANSI_ARGS_((
- ClientData instanceData, char *buf, int toWrite,
- int *errorCode));
+ ClientData instanceData, CONST char *buf,
+ int toWrite, int *errorCode));
static int FileSeekProc _ANSI_ARGS_((ClientData instanceData,
long offset, int mode, int *errorCode));
static void FileWatchProc _ANSI_ARGS_((ClientData instanceData,
@@ -203,12 +203,12 @@
static int TcpGetHandleProc _ANSI_ARGS_((ClientData instanceData,
int direction, ClientData *handlePtr));
static int TcpGetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
+ Tcl_Interp *interp, CONST char *optionName,
Tcl_DString *dsPtr));
static int TcpInputProc _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int TcpOutputProc _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCode));
+ CONST char *buf, int toWrite, int *errorCode));
static void TcpWatchProc _ANSI_ARGS_((ClientData instanceData,
int mask));
#ifdef SUPPORTS_TTY
@@ -217,7 +217,7 @@
static void TtyGetAttributes _ANSI_ARGS_((int fd,
TtyAttrs *ttyPtr));
static int TtyGetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
+ Tcl_Interp *interp, CONST char *optionName,
Tcl_DString *dsPtr));
static FileState * TtyInit _ANSI_ARGS_((int fd, int initialize));
static int TtyParseMode _ANSI_ARGS_((Tcl_Interp *interp,
@@ -226,8 +226,8 @@
static void TtySetAttributes _ANSI_ARGS_((int fd,
TtyAttrs *ttyPtr));
static int TtySetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
- char *value));
+ Tcl_Interp *interp, CONST char *optionName,
+ CONST char *value));
#endif /* SUPPORTS_TTY */
static int WaitForConnect _ANSI_ARGS_((TcpState *statePtr,
int *errorCodePtr));
@@ -421,7 +421,7 @@
static int
FileOutputProc(instanceData, buf, toWrite, errorCodePtr)
ClientData instanceData; /* File state. */
- char *buf; /* The data buffer. */
+ CONST char *buf; /* The data buffer. */
int toWrite; /* How many bytes to write? */
int *errorCodePtr; /* Where to store error code. */
{
@@ -662,8 +662,8 @@
TtySetOptionProc(instanceData, interp, optionName, value)
ClientData instanceData; /* File state. */
Tcl_Interp *interp; /* For error reporting - can be NULL. */
- char *optionName; /* Which option to set? */
- char *value; /* New value for option. */
+ CONST char *optionName; /* Which option to set? */
+ CONST char *value; /* New value for option. */
{
FileState *fsPtr = (FileState *) instanceData;
unsigned int len;
@@ -713,7 +713,7 @@
TtyGetOptionProc(instanceData, interp, optionName, dsPtr)
ClientData instanceData; /* File state. */
Tcl_Interp *interp; /* For error reporting - can be NULL. */
- char *optionName; /* Option to get. */
+ CONST char *optionName; /* Option to get. */
Tcl_DString *dsPtr; /* Where to store value(s). */
{
FileState *fsPtr = (FileState *) instanceData;
@@ -1708,7 +1708,7 @@
static int
TcpOutputProc(instanceData, buf, toWrite, errorCodePtr)
ClientData instanceData; /* Socket state. */
- char *buf; /* The data buffer. */
+ CONST char *buf; /* The data buffer. */
int toWrite; /* How many bytes to write? */
int *errorCodePtr; /* Where to store error code. */
{
@@ -1800,7 +1800,7 @@
TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
ClientData instanceData; /* Socket state. */
Tcl_Interp *interp; /* For error reporting - can be NULL. */
- char *optionName; /* Name of the option to
+ CONST char *optionName; /* Name of the option to
* retrieve the value for, or
* NULL to get all options and
* their values. */
Index: unix/tclUnixPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixPipe.c,v
retrieving revision 1.17
diff -u -u -r1.17 tclUnixPipe.c
--- unix/tclUnixPipe.c 2001/12/11 02:42:41 1.17
+++ unix/tclUnixPipe.c 2002/01/15 17:44:34
@@ -55,7 +55,7 @@
static int PipeInputProc _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int PipeOutputProc _ANSI_ARGS_((
- ClientData instanceData, char *buf, int toWrite,
+ ClientData instanceData, CONST char *buf, int toWrite,
int *errorCode));
static void PipeWatchProc _ANSI_ARGS_((ClientData instanceData, int mask));
static void RestoreSignals _ANSI_ARGS_((void));
@@ -1041,7 +1041,7 @@
static int
PipeOutputProc(instanceData, buf, toWrite, errorCodePtr)
ClientData instanceData; /* Pipe state. */
- char *buf; /* The data buffer. */
+ CONST char *buf; /* The data buffer. */
int toWrite; /* How many bytes to write? */
int *errorCodePtr; /* Where to store error code. */
{
Index: win/tclWinChan.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinChan.c,v
retrieving revision 1.16
diff -u -u -r1.16 tclWinChan.c
--- win/tclWinChan.c 2001/10/15 17:34:53 1.16
+++ win/tclWinChan.c 2002/01/15 17:44:35
@@ -88,7 +88,7 @@
static int FileInputProc _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int FileOutputProc _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCode));
+ CONST char *buf, int toWrite, int *errorCode));
static int FileSeekProc _ANSI_ARGS_((ClientData instanceData,
long offset, int mode, int *errorCode));
static void FileSetupProc _ANSI_ARGS_((ClientData clientData,
@@ -535,7 +535,7 @@
static int
FileOutputProc(instanceData, buf, toWrite, errorCode)
ClientData instanceData; /* File state. */
- char *buf; /* The data buffer. */
+ CONST char *buf; /* The data buffer. */
int toWrite; /* How many bytes to write? */
int *errorCode; /* Where to store error code. */
{
Index: win/tclWinConsole.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinConsole.c,v
retrieving revision 1.6
diff -u -u -r1.6 tclWinConsole.c
--- win/tclWinConsole.c 2001/07/16 23:30:16 1.6
+++ win/tclWinConsole.c 2002/01/15 17:44:36
@@ -145,8 +145,8 @@
static ThreadSpecificData *ConsoleInit(void);
static int ConsoleInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCode);
-static int ConsoleOutputProc(ClientData instanceData, char *buf,
- int toWrite, int *errorCode);
+static int ConsoleOutputProc(ClientData instanceData,
+ CONST char *buf, int toWrite, int *errorCode);
static DWORD WINAPI ConsoleReaderThread(LPVOID arg);
static void ConsoleSetupProc(ClientData clientData, int flags);
static void ConsoleWatchProc(ClientData instanceData, int mask);
@@ -680,7 +680,7 @@
static int
ConsoleOutputProc(
ClientData instanceData, /* Console state. */
- char *buf, /* The data buffer. */
+ CONST char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
Index: win/tclWinPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinPipe.c,v
retrieving revision 1.20
diff -u -u -r1.20 tclWinPipe.c
--- win/tclWinPipe.c 2001/09/06 01:38:02 1.20
+++ win/tclWinPipe.c 2002/01/15 17:44:36
@@ -193,8 +193,8 @@
static void PipeInit(void);
static int PipeInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCode);
-static int PipeOutputProc(ClientData instanceData, char *buf,
- int toWrite, int *errorCode);
+static int PipeOutputProc(ClientData instanceData,
+ CONST char *buf, int toWrite, int *errorCode);
static DWORD WINAPI PipeReaderThread(LPVOID arg);
static void PipeSetupProc(ClientData clientData, int flags);
static void PipeWatchProc(ClientData instanceData, int mask);
@@ -2133,7 +2133,7 @@
static int
PipeOutputProc(
ClientData instanceData, /* Pipe state. */
- char *buf, /* The data buffer. */
+ CONST char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
Index: win/tclWinSerial.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSerial.c,v
retrieving revision 1.17
diff -u -u -r1.17 tclWinSerial.c
--- win/tclWinSerial.c 2002/01/11 20:21:32 1.17
+++ win/tclWinSerial.c 2002/01/15 17:44:36
@@ -170,17 +170,17 @@
static ThreadSpecificData *SerialInit(void);
static int SerialInputProc(ClientData instanceData, char *buf,
int toRead, int *errorCode);
-static int SerialOutputProc(ClientData instanceData, char *buf,
+static int SerialOutputProc(ClientData instanceData, CONST char *buf,
int toWrite, int *errorCode);
static void SerialSetupProc(ClientData clientData, int flags);
static void SerialWatchProc(ClientData instanceData, int mask);
static void ProcExitHandler(ClientData clientData);
static int SerialGetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
+ Tcl_Interp *interp, CONST char *optionName,
Tcl_DString *dsPtr));
static int SerialSetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
- char *value));
+ Tcl_Interp *interp, CONST char *optionName,
+ CONST char *value));
static DWORD WINAPI SerialWriterThread(LPVOID arg);
/*
@@ -928,7 +928,7 @@
static int
SerialOutputProc(
ClientData instanceData, /* Serial state. */
- char *buf, /* The data buffer. */
+ CONST char *buf, /* The data buffer. */
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
@@ -1523,8 +1523,8 @@
SerialSetOptionProc(instanceData, interp, optionName, value)
ClientData instanceData; /* File state. */
Tcl_Interp *interp; /* For error reporting - can be NULL. */
- char *optionName; /* Which option to set? */
- char *value; /* New value for option. */
+ CONST char *optionName; /* Which option to set? */
+ CONST char *value; /* New value for option. */
{
SerialInfo *infoPtr;
DCB dcb;
@@ -1861,7 +1861,7 @@
SerialGetOptionProc(instanceData, interp, optionName, dsPtr)
ClientData instanceData; /* File state. */
Tcl_Interp *interp; /* For error reporting - can be NULL. */
- char *optionName; /* Option to get. */
+ CONST char *optionName; /* Option to get. */
Tcl_DString *dsPtr; /* Where to store value(s). */
{
SerialInfo *infoPtr;
Index: win/tclWinSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSock.c,v
retrieving revision 1.22
diff -u -u -r1.22 tclWinSock.c
--- win/tclWinSock.c 2001/12/13 18:07:13 1.22
+++ win/tclWinSock.c 2002/01/15 17:44:37
@@ -195,12 +195,12 @@
static int TcpCloseProc _ANSI_ARGS_((ClientData instanceData,
Tcl_Interp *interp));
static int TcpGetOptionProc _ANSI_ARGS_((ClientData instanceData,
- Tcl_Interp *interp, char *optionName,
+ Tcl_Interp *interp, CONST char *optionName,
Tcl_DString *optionValue));
static int TcpInputProc _ANSI_ARGS_((ClientData instanceData,
char *buf, int toRead, int *errorCode));
static int TcpOutputProc _ANSI_ARGS_((ClientData instanceData,
- char *buf, int toWrite, int *errorCode));
+ CONST char *buf, int toWrite, int *errorCode));
static void TcpWatchProc _ANSI_ARGS_((ClientData instanceData,
int mask));
static int TcpGetHandleProc _ANSI_ARGS_((ClientData instanceData,
@@ -1765,7 +1765,7 @@
static int
TcpOutputProc(instanceData, buf, toWrite, errorCodePtr)
ClientData instanceData; /* The socket state. */
- char *buf; /* Where to get data. */
+ CONST char *buf; /* Where to get data. */
int toWrite; /* Maximum number of bytes to write. */
int *errorCodePtr; /* Where to store error codes. */
{
@@ -1881,7 +1881,7 @@
TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
ClientData instanceData; /* Socket state. */
Tcl_Interp *interp; /* For error reporting - can be NULL */
- char *optionName; /* Name of the option to
+ CONST char *optionName; /* Name of the option to
* retrieve the value for, or
* NULL to get all options and
* their values. */