From 722d3186397220e0bcd65b0e0bd4ba3b91ef5534 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 15 Jan 2002 17:55:29 +0000 Subject: * Updated APIs in the file generic/tclIO.c according to the guidelines of TIP 27. Several minor documentation corrections as well. * Updated channel driver interface according to the guidelines of TIP 27. See also [Bug 500348]. * 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. --- ChangeLog | 44 ++++++++++++++++++++++++++++- doc/CrtChannel.3 | 47 +++++++++++++++---------------- doc/OpenFileChnl.3 | 72 +++++++++++++++++++++++------------------------ generic/tcl.decls | 28 +++++++++--------- generic/tcl.h | 19 +++---------- generic/tclDecls.h | 54 ++++++++++++++++++----------------- generic/tclIO.c | 70 +++++++++++++++++++++++---------------------- generic/tclIO.h | 8 +++--- generic/tclIOGT.c | 20 ++++++------- generic/tclInt.h | 17 +++++++++-- mac/tclMacChan.c | 10 +++---- mac/tclMacSock.c | 12 ++++---- tools/checkLibraryDoc.tcl | 3 +- unix/tclUnixChan.c | 28 +++++++++--------- unix/tclUnixPipe.c | 6 ++-- win/tclWinChan.c | 6 ++-- win/tclWinConsole.c | 8 +++--- win/tclWinPipe.c | 8 +++--- win/tclWinSerial.c | 18 ++++++------ win/tclWinSock.c | 10 +++---- 20 files changed, 265 insertions(+), 223 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ce15f5..6a83afe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,47 @@ +2002-01-15 Don Porter + + * 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 - + * doc/GetIndex.3: * doc/WrongNumArgs.3: * generic/tcl.decls (Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct, diff --git a/doc/CrtChannel.3 b/doc/CrtChannel.3 index 3ca35b5..1f809bc 100644 --- a/doc/CrtChannel.3 +++ b/doc/CrtChannel.3 @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: CrtChannel.3,v 1.12 2001/12/10 15:50:46 dgp Exp $ +'\" RCS: @(#) $Id: CrtChannel.3,v 1.13 2002/01/15 17:55:29 dgp Exp $ .so man.macros .TH Tcl_CreateChannel 3 8.3 Tcl "Tcl Library Procedures" .BS @@ -25,7 +25,7 @@ ClientData Tcl_ChannelType * \fBTcl_GetChannelType\fR(\fIchannel\fR) .sp -char * +CONST char * \fBTcl_GetChannelName\fR(\fIchannel\fR) .sp int @@ -73,7 +73,7 @@ int Tcl_Channel \fBTcl_GetTopChannel\fR(\fIchannel\fR) .sp -char * +CONST char * \fBTcl_ChannelName\fR(\fItypePtr\fR) .sp Tcl_ChannelTypeVersion @@ -117,11 +117,11 @@ Tcl_DriverHandlerProc * .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 @@ means the output handle is wanted. .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 @@ and \fBTCL_EXCEPTION\fR that indicates events that have occurred on 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 \fBTCL_WRITABLE\fR, indicating whether the channel is open for input 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 @@ is not allowed. 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 @@ generic layer to transfer data from an internal buffer to the output device. .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 @@ the generic layer to set a channel type specific option on a channel. 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 @@ returns \fBTCL_OK\fR. 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 @@ channel. \fIgetOptionProc\fR must match the following prototype: 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 @@ the generic options error message string. .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 @@ so you get for instance: 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 ``'' +``blah'' is the \fIoptionName\fR argument and ``'' 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. diff --git a/doc/OpenFileChnl.3 b/doc/OpenFileChnl.3 index d778007..c694c45 100644 --- a/doc/OpenFileChnl.3 +++ b/doc/OpenFileChnl.3 @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: OpenFileChnl.3,v 1.15 2001/12/10 15:50:46 dgp Exp $ +'\" RCS: @(#) $Id: OpenFileChnl.3,v 1.16 2002/01/15 17:55:29 dgp Exp $ .so man.macros .TH Tcl_OpenFileChannel 3 8.3 Tcl "Tcl Library Procedures" .BS @@ -15,8 +15,6 @@ Tcl_OpenFileChannel, Tcl_OpenCommandChannel, Tcl_MakeFileChannel, Tcl_GetChannel .nf \fB#include \fR .sp -typedef ... Tcl_Channel; -.sp Tcl_Channel \fBTcl_OpenFileChannel\fR(\fIinterp, fileName, mode, permissions\fR) .sp @@ -57,7 +55,7 @@ int \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 @@ int .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 @@ Used for error reporting and to look up a channel registered in it. 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 @@ file descriptor, for Windows it is a HANDLE. .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 @@ object. 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 @@ given by \fIseekMode\fR. May be either positive or negative. 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 @@ replacement for the standard channel. \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 @@ corresponding calls to \fBTcl_UnregisterChannel\fR. 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 @@ converting to or from UTF-8. 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 @@ of input unavailability. .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 @@ value is \-1 if the channel does not support seeking. .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 @@ error code. .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. diff --git a/generic/tcl.decls b/generic/tcl.decls index 913d7c9..72d3875 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -10,7 +10,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.decls,v 1.69 2002/01/14 15:07:39 dgp Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.70 2002/01/15 17:55:29 dgp Exp $ library tcl @@ -289,8 +289,8 @@ declare 77 generic { 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 @@ declare 87 generic { 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 @@ declare 150 generic { 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 @@ declare 155 generic { 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 224 generic { } 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 @@ declare 249 generic { 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 @@ declare 262 generic { 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 @@ declare 388 generic { 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 @@ declare 394 generic { 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 @@ declare 397 generic { 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) diff --git a/generic/tcl.h b/generic/tcl.h index 976be0c..b4a8d6e 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.107 2001/12/18 15:21:20 dkf Exp $ + * RCS: @(#) $Id: tcl.h,v 1.108 2002/01/15 17:55:29 dgp Exp $ */ #ifndef _TCL @@ -1337,15 +1337,15 @@ typedef int (Tcl_DriverClose2Proc) _ANSI_ARGS_((ClientData instanceData, 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_(( @@ -1390,17 +1390,6 @@ typedef int (Tcl_DriverHandlerProc) _ANSI_ARGS_(( #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: * * One such structure exists for each type (kind) of channel. diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 2a718d1..02a50cb 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDecls.h,v 1.69 2002/01/14 15:07:39 dgp Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.70 2002/01/15 17:55:29 dgp Exp $ */ #ifndef _TCLDECLS @@ -257,8 +257,8 @@ EXTERN char Tcl_Backslash _ANSI_ARGS_((CONST char * src, 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 @@ EXTERN int Tcl_CreateAliasObj _ANSI_ARGS_((Tcl_Interp * slave, 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 @@ EXTERN ClientData Tcl_GetAssocData _ANSI_ARGS_((Tcl_Interp * interp, 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 @@ EXTERN ClientData Tcl_GetChannelInstanceData _ANSI_ARGS_(( /* 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 @@ EXTERN void Tcl_SetChannelBufferSize _ANSI_ARGS_(( /* 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 @@ EXTERN char * Tcl_TranslateFileName _ANSI_ARGS_(( 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 @@ EXTERN ClientData Tcl_VarTraceInfo2 _ANSI_ARGS_((Tcl_Interp * interp, 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 Tcl_Mutex * Tcl_GetAllocMutex _ANSI_ARGS_((void)); 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 @@ EXTERN int Tcl_ReadRaw _ANSI_ARGS_((Tcl_Channel chan, 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 @@ typedef struct TclStubs { 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 @@ typedef struct TclStubs { 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 @@ typedef struct TclStubs { 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 @@ typedef struct TclStubs { 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 @@ typedef struct TclStubs { 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 @@ typedef struct TclStubs { 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 @@ typedef struct TclStubs { 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 */ diff --git a/generic/tclIO.c b/generic/tclIO.c index fa3d1d4..1c12a4b 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.43 2001/12/17 22:55:50 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.44 2002/01/15 17:55:30 dgp Exp $ */ #include "tclInt.h" @@ -112,7 +112,7 @@ static void DiscardOutputQueued _ANSI_ARGS_(( 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 @@ Tcl_RegisterChannel(interp, chan) 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_Channel 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 @@ Tcl_GetChannel(interp, chanName, modePtr) 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_GetChannel(interp, chanName, modePtr) 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 @@ Tcl_CreateChannel(typePtr, chanName, instanceData, mask) */ 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 @@ Tcl_GetChannelMode(chan) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_GetChannelName(chan) Tcl_Channel chan; /* The channel for which to return the name. */ { @@ -2276,7 +2277,7 @@ CloseChannel(interp, chanPtr, errorCode) if (chanPtr == statePtr->bottomChanPtr) { if (statePtr->channelName != (char *) NULL) { - ckfree(statePtr->channelName); + ckfree((char *) statePtr->channelName); statePtr->channelName = NULL; } @@ -2682,7 +2683,7 @@ Tcl_ClearChannelHandlers (channel) 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 @@ Tcl_Write(chan, src, srcLen) 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 @@ TranslateInputEOL(statePtr, dstStart, srcStart, dstLenPtr, srcLenPtr) 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 @@ Tcl_GetChannelBufferSize(chan) 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 @@ int 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 @@ int 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 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) 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 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) } 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 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) * 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 @@ CopyBuffer(chanPtr, result, space) 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 @@ Tcl_GetChannelNames(interp) 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 @@ Tcl_IsChannelExisting(chanName) { ChannelState *statePtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - char *name; + CONST char *name; int chanNameLen; chanNameLen = strlen(chanName); @@ -8572,7 +8574,7 @@ Tcl_IsChannelExisting(chanName) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_ChannelName(chanTypePtr) Tcl_ChannelType *chanTypePtr; /* Pointer to channel type. */ { diff --git a/generic/tclIO.h b/generic/tclIO.h index 2465fba..9a9c826 100644 --- a/generic/tclIO.h +++ b/generic/tclIO.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.h,v 1.4 2001/09/27 02:12:19 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIO.h,v 1.5 2002/01/15 17:55:30 dgp Exp $ */ /* @@ -158,7 +158,7 @@ typedef struct Channel { */ 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 @@ typedef struct ChannelState { * 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 diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 024dd34..4071217 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * CVS: $Id: tclIOGT.c,v 1.3 2000/09/29 21:42:19 hobbs Exp $ + * CVS: $Id: tclIOGT.c,v 1.4 2002/01/15 17:55:30 dgp Exp $ */ #include "tclInt.h" @@ -31,17 +31,17 @@ static int TransformInputProc _ANSI_ARGS_ (( 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 @@ TransformInputProc (instanceData, buf, toRead, errorCodePtr) static int TransformOutputProc (instanceData, buf, toWrite, errorCodePtr) ClientData instanceData; - char* buf; + CONST char* buf; int toWrite; int* errorCodePtr; { @@ -915,8 +915,8 @@ static int 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 @@ static int 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 @@ TransformGetOptionProc (instanceData, interp, optionName, dsPtr) 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. */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 80984a6..4c85ba6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.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: tclInt.h,v 1.73 2002/01/09 19:09:28 kennykb Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.74 2002/01/15 17:55:30 dgp Exp $ */ #ifndef _TCLINT @@ -1432,7 +1432,7 @@ typedef struct ParseValue { #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. */ @@ -1443,6 +1443,19 @@ typedef enum { } 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: * * TCL_INVOKE_HIDDEN Invoke a hidden command; if not set, diff --git a/mac/tclMacChan.c b/mac/tclMacChan.c index fc5e914..d8bcf6f 100644 --- a/mac/tclMacChan.c +++ b/mac/tclMacChan.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacChan.c,v 1.8 2001/11/23 01:27:21 das Exp $ + * RCS: @(#) $Id: tclMacChan.c,v 1.9 2002/01/15 17:55:30 dgp Exp $ */ #include "tclInt.h" @@ -108,7 +108,7 @@ static ThreadSpecificData *FileInit _ANSI_ARGS_((void)); 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 StdIOClose _ANSI_ARGS_((ClientData instanceData, 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 @@ StdIOInput( 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 @@ FileInput( 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. */ { diff --git a/mac/tclMacSock.c b/mac/tclMacSock.c index 7c71109..5239cfc 100644 --- a/mac/tclMacSock.c +++ b/mac/tclMacSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacSock.c,v 1.9 2001/11/23 01:28:30 das Exp $ + * RCS: @(#) $Id: tclMacSock.c,v 1.10 2002/01/15 17:55:30 dgp Exp $ */ #include "tclInt.h" @@ -171,12 +171,12 @@ static int TcpClose _ANSI_ARGS_((ClientData instanceData, 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 @@ TcpGetHandle( 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 @@ static int 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 @@ TcpGetOptionProc( * 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")) { diff --git a/tools/checkLibraryDoc.tcl b/tools/checkLibraryDoc.tcl index c6a8006..8a7008c 100755 --- a/tools/checkLibraryDoc.tcl +++ b/tools/checkLibraryDoc.tcl @@ -19,7 +19,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: checkLibraryDoc.tcl,v 1.6 1999/07/22 21:50:55 redman Exp $ +# RCS: @(#) $Id: checkLibraryDoc.tcl,v 1.7 2002/01/15 17:55:30 dgp Exp $ lappend auto_path "c:/program\ files/tclpro1.2/win32-ix86/bin" @@ -38,7 +38,6 @@ set StructList { Tcl_Encoding \ Tcl_EncodingState \ Tcl_EncodingType \ - Tcl_EolTranslation \ Tcl_HashEntry \ Tcl_HashSearch \ Tcl_HashTable \ diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 23bb599..27cd5f1 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.23 2001/11/21 02:36:21 hobbs Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.24 2002/01/15 17:55:30 dgp Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -189,8 +189,8 @@ static int FileGetHandleProc _ANSI_ARGS_((ClientData instanceData, 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 TcpCloseProc _ANSI_ARGS_((ClientData instanceData, 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 int TtyCloseProc _ANSI_ARGS_((ClientData instanceData, 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 int TtyParseMode _ANSI_ARGS_((Tcl_Interp *interp, 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 @@ FileInputProc(instanceData, buf, toRead, errorCodePtr) 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 @@ static int 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 @@ static int 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 @@ TcpInputProc(instanceData, buf, bufSize, errorCodePtr) 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 @@ static int 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. */ diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 8e6dd03..e6187b0 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPipe.c,v 1.17 2001/12/11 02:42:41 andreas_kupries Exp $ + * RCS: @(#) $Id: tclUnixPipe.c,v 1.18 2002/01/15 17:55:30 dgp Exp $ */ #include "tclInt.h" @@ -55,7 +55,7 @@ static int PipeGetHandleProc _ANSI_ARGS_((ClientData instanceData, 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 @@ PipeInputProc(instanceData, buf, toRead, errorCodePtr) 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. */ { diff --git a/win/tclWinChan.c b/win/tclWinChan.c index e1672c7..8c6dd84 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinChan.c,v 1.16 2001/10/15 17:34:53 hobbs Exp $ + * RCS: @(#) $Id: tclWinChan.c,v 1.17 2002/01/15 17:55:30 dgp Exp $ */ #include "tclWinInt.h" @@ -88,7 +88,7 @@ static ThreadSpecificData *FileInit _ANSI_ARGS_((void)); 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 @@ FileInputProc(instanceData, buf, bufSize, errorCode) 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. */ { diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 2e364d1..f233864 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinConsole.c,v 1.6 2001/07/16 23:30:16 mdejong Exp $ + * RCS: @(#) $Id: tclWinConsole.c,v 1.7 2002/01/15 17:55:30 dgp Exp $ */ #include "tclWinInt.h" @@ -145,8 +145,8 @@ static int ConsoleGetHandleProc(ClientData instanceData, 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 @@ ConsoleInputProc( 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. */ { diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 703f568..2fc0d5d 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.20 2001/09/06 01:38:02 davygrvy Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.21 2002/01/15 17:55:31 dgp Exp $ */ #include "tclWinInt.h" @@ -193,8 +193,8 @@ static int PipeGetHandleProc(ClientData instanceData, 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 @@ PipeInputProc( 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. */ { diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index ae24bdc..5d22b9e 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,7 +11,7 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.17 2002/01/11 20:21:32 andreas_kupries Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.18 2002/01/15 17:55:31 dgp Exp $ */ #include "tclWinInt.h" @@ -170,17 +170,17 @@ static int SerialGetHandleProc(ClientData instanceData, 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 @@ commError: 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 @@ static int 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 @@ static int 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; diff --git a/win/tclWinSock.c b/win/tclWinSock.c index d68b4a2..5864343 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.22 2001/12/13 18:07:13 andreas_kupries Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.23 2002/01/15 17:55:31 dgp Exp $ */ #include "tclWinInt.h" @@ -195,12 +195,12 @@ static int TcpBlockProc _ANSI_ARGS_((ClientData instanceData, 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 @@ TcpInputProc(instanceData, buf, toRead, errorCodePtr) 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 @@ static int 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. */ -- cgit v0.12