diff options
56 files changed, 466 insertions, 369 deletions
@@ -1,3 +1,93 @@ +2002-01-25 Don Porter <dgp@users.sourceforge.net> + + * doc/Concat.3: + * doc/Encoding.3: + * doc/Filesystem.3: + * doc/Macintosh.3: + * doc/OpenFileChnl.3 + * doc/SetResult.3: + * doc/SetVar.3: + * doc/SplitList.3: + * doc/SplitPath.3: + * doc/Translate.3: + * generic/tcl.h (Tcl_FSMatchInDirectoryProc): + * generic/tclInt.h (TclpMatchInDirectory): + * generic/tcl.decls (Tcl_Concat,Tcl_GetStringResult,Tcl_GetVar, + Tcl_GetVar2,Tcl_JoinPath,Tcl_Merge,Tcl_OpenCommandChannel,Tcl_SetVar, + Tcl_SetVar2,Tcl_SplitList,Tcl_SplitPath,Tcl_TranslateFileName, + Tcl_ExternalToUtfDString,Tcl_GetEncodingName,Tcl_UtfToExternalDString, + Tcl_GetDefaultEncodingDir,Tcl_SetDefaultEncodingDir, + Tcl_FSMatchInDirectory,Tcl_MacEvalResource,Tcl_MacFindResource): + * generic/tclInt.decls (TclCreatePipeline,TclGetEnv,TclpGetCwd, + TclpCreateProcess): + * mac/tclMacFile.c (TclpGetCwd): + * generic/tclEncoding.c (Tcl_GetDefaultEncodingDir, + Tcl_SetDefaultEncodingDir,Tcl_GetEncodingName, + Tcl_ExternalToUtfDString,Tcl_UtfToExternalDString, OpenEncodingFile, + LoadEscapeEncoding): + * generic/tclFileName.c (DoTildeSubst,Tcl_JoinPath,Tcl_SplitPath, + Tcl_TranslateFileName): + * generic/tclIOUtil.c (Tcl_FSMatchInDirectory): + * generic/tclPipe.c (FileForRedirect,TclCreatePipeline, + Tcl_OpenCommandChannel): + * generic/tclResult.c (Tcl_GetStringResult): + * generic/tclUtil.c (Tcl_Concat,Tcl_SplitList,Tcl_Merge): + * generic/tclVar.c (Tcl_GetVar,Tcl_GetVar2,Tcl_SetVar,Tcl_SetVar2): + * mac/tclMacResource.c (Tcl_MacEvalResource,Tcl_MacFindResource): + Updated interfaces of generic/tclEncoding, generic/tclFilename.c, + generic/tclIOUtil.c, generic/tclPipe.c, generic/tclResult.c, + generic/tclUtil.c, generic/tclVar.c and mac/tclMacResource.c according + to TIP 27. Tcl_TranslateFileName rewritten as wrapper around + VFS-aware version. + ***POTENTIAL INCOMPATIBILITY*** + Includes source incompatibilities: argv arguments of Tcl_Concat, + Tcl_JoinPath, Tcl_OpenCommandChannel, Tcl_Merge; argvPtr arguments of + Tcl_SplitList and Tcl_SplitPath. + * generic/tclDecls.h: + * generic/tclIntDecls.h: make genstubs + + * generic/tclCkalloc.c (MemoryCmd): + * generic/tclClock.c (FormatClock): + * generic/tclCmdAH.c (Tcl_CaseObjCmd,Tcl_EncodingObjCmd,Tcl_FileObjCmd): + * generic/tclCmdIL.c (InfoLibraryCmd,InfoPatchLevelCmd, + InfoTclVersionCmd): + * generic/tclCompCmds.c (TclCompileForeachCmd): + * generic/tclCompCmds.h (TclCompileForeachCmd): + * generic/tclCompile.c (TclFindCompiledLocal): + * generic/tclEnv.c (TclSetupEnv,TclSetEnv,Tcl_PutEnv,TclGetEnv, + EnvTraceProc): + * generic/tclEvent.c (Tcl_BackgroundError): + * generic/tclIO.c (Tcl_BadChannelOption,Tcl_SetChannelOption): + * generic/tclIOCmd.c (Tcl_ExecObjCmd,Tcl_OpenObjCmd): + * generic/tclIOSock.c (TclSockGetPort): + * generic/tclIOUtil.c (SetFsPathFromAny): + * generic/tclLink.c (LinkTraceProc): + * generic/tclMain.c (Tcl_Main): + * generic/tclNamesp.c (TclTeardownNamespace): + * generic/tclProc.c (TclCreateProc): + * generic/tclTest.c (TestregexpObjCmd,TesttranslatefilenameCmd, + TestchmodCmd,GetTimesCmd,TestsetCmd,TestOpenFileChannelProc1, + TestOpenFileChannelProc2,TestOpenFileChannelProc3,AsyncHandlerProc, + TestpanicCmd): + * generic/tclThreadTest.c (ThreadErrorProc,ThreadEventProc): + * generic/tclUtil.c (TclPrecTraceProc): + * mac/tclMacFCmd.c (GetFileSpecs): + * mac/tclMacFile.c (TclpMatchInDirectory): + * mac/tclMacInit.c (TclpInitLibraryPath,Tcl_SourceRCFile): + * mac/tclMacOSA.c (tclOSAStore,tclOSALoad): + * mac/tclMacResource.c (Tcl_MacEvalResource): + * unix/tclUnixFCmd.c (TclpObjNormalizePath): + * unix/tclUnixFile.c (TclpMatchInDirectory,TclpGetUserHome,TclpGetCwd, + TclpReadLink): + * unix/tclUnixInit.c (TclpInitLibraryPath,TclpSetVariables, + Tcl_SourceRCFile): + * unix/tclUnixPipe.c (TclpOpenFile,TclpCreateTempFile, + TclpCreateProcess): + * win/tclWinFile.c (TclpGetCwd,TclpMatchInDirectory): + * win/tclWinInit.c (TclpInitLibraryPath,Tcl_SourceRCFile, + TclpSetVariables): + * win/tclWinPipe.c (TclpCreateProcess): Updated callers. + 2002-01-24 Don Porter <dgp@users.sourceforge.net> * generic/tclIOUtil.c (SetFsPathFromAny): Corrected tilde-substitution @@ -26,6 +116,7 @@ * win/tclWinSerial.c (TclWinSerialReopen): * win/tclWinSock.c (Tcl_OpenTcpServer): Corrections to earlier TIP 27 changes. Thanks to Andreas Kupries for the feedback. + * generic/tclPlatDecls.h: make genstubs * doc/GetHostName.3: * doc/GetOpnFl.3: diff --git a/doc/Concat.3 b/doc/Concat.3 index 83c5c30..d67eca3 100644 --- a/doc/Concat.3 +++ b/doc/Concat.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: Concat.3,v 1.3 2001/09/24 21:10:32 dgp Exp $ +'\" RCS: @(#) $Id: Concat.3,v 1.4 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_Concat 3 7.5 Tcl "Tcl Library Procedures" @@ -21,7 +21,7 @@ char * .SH ARGUMENTS .AP int argc in Number of strings. -.AP "char * CONST" argv[] in +.AP "CONST char * CONST" argv[] in Array of strings to concatenate. Must have \fIargc\fR entries. .BE diff --git a/doc/Encoding.3 b/doc/Encoding.3 index df219c3..65caab0 100644 --- a/doc/Encoding.3 +++ b/doc/Encoding.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: Encoding.3,v 1.7 1999/10/13 00:32:05 hobbs Exp $ +'\" RCS: @(#) $Id: Encoding.3,v 1.8 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_GetEncoding 3 "8.1" Tcl "Tcl Library Procedures" @@ -21,14 +21,14 @@ Tcl_Encoding void \fBTcl_FreeEncoding\fR(\fIencoding\fR) .sp -char * +CONST char * \fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR) .sp int \fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR) .sp -char * +CONST char * \fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR) .sp int @@ -41,7 +41,7 @@ char * TCHAR * \fBTcl_WinUtfToTChar\fR(\fIsrc, srcLen, dstPtr\fR) .sp -char * +CONST char * \fBTcl_GetEncodingName\fR(\fIencoding\fR) .sp int @@ -53,7 +53,7 @@ void Tcl_Encoding \fBTcl_CreateEncoding\fR(\fItypePtr\fR) .sp -char * +CONST char * \fBTcl_GetDefaultEncodingDir\fR(\fIvoid\fR) .sp void @@ -124,7 +124,7 @@ Filled with the number of characters that correspond to the number of bytes stored in the output buffer. May be NULL. .AP Tcl_EncodingType *typePtr in Structure that defines a new type of encoding. -.AP char *path in +.AP "CONST char" *path in A path to the location of the encoding file. .BE .SH INTRODUCTION diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index 405b40c..a56ea57 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.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: FileSystem.3,v 1.16 2002/01/17 04:37:32 dgp Exp $ +'\" RCS: @(#) $Id: FileSystem.3,v 1.17 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" @@ -140,7 +140,7 @@ rename operation. .AP Tcl_Obj *destPathPtr in As for \fBpathPtr\fR, but used for the destination filename for a copy or rename operation. -.AP char *pattern in +.AP "CONST char" *pattern in Only files or directories matching this pattern will be returned by \fBTcl_FSMatchInDirectory\fR. .AP GlobTypeData *types in @@ -863,7 +863,7 @@ typedef int Tcl_FSMatchInDirectoryProc( Tcl_Interp* \fIinterp\fR, Tcl_Obj *\fIresult\fR, Tcl_Obj *\fIpathPtr\fR, - char *\fIpattern\fR, + CONST char *\fIpattern\fR, Tcl_GlobTypeData * \fItypes\fR); .CE .PP diff --git a/doc/Macintosh.3 b/doc/Macintosh.3 index 40e5b39..f8a7ee5 100644 --- a/doc/Macintosh.3 +++ b/doc/Macintosh.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: Macintosh.3,v 1.3 2001/05/03 23:57:10 hobbs Exp $ +'\" RCS: @(#) $Id: Macintosh.3,v 1.4 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_MacSetEventProc 3 "8.1" Tcl "Tcl Library Procedures" @@ -39,17 +39,17 @@ void .AP Tcl_Interp *interp in Interpreter to use for error reporting, or NULL if no error reporting is desired. -.AP char *resourceName in +.AP "CONST char" *resourceName in Name of TEXT resource to source, NULL if number should be used. .AP int resourceNumber in Resource id of source. -.AP char *fileName in +.AP "CONST char" *fileName in Name of file to process. NULL if application resource. .AP Handle resource in Handle to TEXT resource. .AP long resourceType in Type of resource to load. -.AP char *resFileRef in +.AP "CONST char" *resFileRef in Registered resource file reference, NULL if searching all open resource files. .AP int *releaseIt out Should we release this resource when done. diff --git a/doc/OpenFileChnl.3 b/doc/OpenFileChnl.3 index b6f25b9..ca81bc9 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.17 2002/01/15 21:19:06 dgp Exp $ +'\" RCS: @(#) $Id: OpenFileChnl.3,v 1.18 2002/01/25 20:40:55 dgp Exp $ .so man.macros .TH Tcl_OpenFileChannel 3 8.3 Tcl "Tcl Library Procedures" .BS @@ -127,7 +127,7 @@ POSIX-style permission flags such as 0644. If a new file is created, these permissions will be set on the created file. .AP int argc in The number of elements in \fIargv\fR. -.AP char **argv in +.AP "CONST char" **argv in Arguments for constructing a command pipeline. These values have the same meaning as the non-switch arguments to the Tcl \fBexec\fR command. .AP int flags in diff --git a/doc/SetResult.3 b/doc/SetResult.3 index fd23390..5a86be2 100644 --- a/doc/SetResult.3 +++ b/doc/SetResult.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: SetResult.3,v 1.6 2000/07/24 00:03:02 jenglish Exp $ +'\" RCS: @(#) $Id: SetResult.3,v 1.7 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures" @@ -23,7 +23,7 @@ Tcl_Obj * .sp \fBTcl_SetResult\fR(\fIinterp, string, freeProc\fR) .sp -char * +CONST char * \fBTcl_GetStringResult\fR(\fIinterp\fR) .sp \fBTcl_AppendResult\fR(\fIinterp, string, string, ... , \fB(char *) NULL\fR) diff --git a/doc/SetVar.3 b/doc/SetVar.3 index bb07005..6f610c1 100644 --- a/doc/SetVar.3 +++ b/doc/SetVar.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: SetVar.3,v 1.3 1999/04/16 00:46:33 stanton Exp $ +'\" RCS: @(#) $Id: SetVar.3,v 1.4 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_SetVar 3 8.1 Tcl "Tcl Library Procedures" @@ -21,10 +21,10 @@ Tcl_Obj * \fBTcl_SetVar2Ex\fR(\fIinterp, name1, name2, newValuePtr, flags\fR) .VE .sp -char * +CONST char * \fBTcl_SetVar\fR(\fIinterp, varName, newValue, flags\fR) .sp -char * +CONST char * \fBTcl_SetVar2\fR(\fIinterp, name1, name2, newValue, flags\fR) .sp Tcl_Obj * @@ -35,10 +35,10 @@ Tcl_Obj * \fBTcl_GetVar2Ex\fR(\fIinterp, name1, name2, flags\fR) .VE .sp -char * +CONST char * \fBTcl_GetVar\fR(\fIinterp, varName, flags\fR) .sp -char * +CONST char * \fBTcl_GetVar2\fR(\fIinterp, name1, name2, flags\fR) .sp Tcl_Obj * @@ -78,7 +78,7 @@ an array. If the name references an element of an array, then the name must be in writable memory: Tcl will make temporary modifications to it while looking up the name. -.AP char *newValue in +.AP "CONST char" *newValue in New value for variable, specified as a NULL-terminated string. A copy of this value is stored in the variable. .AP Tcl_Obj *part1Ptr in diff --git a/doc/SplitList.3 b/doc/SplitList.3 index 0548606..c046af5 100644 --- a/doc/SplitList.3 +++ b/doc/SplitList.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: SplitList.3,v 1.5 2001/09/24 21:10:32 dgp Exp $ +'\" RCS: @(#) $Id: SplitList.3,v 1.6 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_SplitList 3 8.0 Tcl "Tcl Library Procedures" @@ -34,7 +34,7 @@ int int \fBTcl_ConvertCountedElement\fR(\fIsrc, length, dst, flags\fR) .SH ARGUMENTS -.AS Tcl_Interp ***argvPtr +.AS "CONST char * CONST" ***argvPtr .AP Tcl_Interp *interp out Interpreter to use for error reporting. If NULL, then no error message is left. @@ -42,14 +42,14 @@ is left. Pointer to a string with proper list structure. .AP int *argcPtr out Filled in with number of elements in \fIlist\fR. -.AP char ***argvPtr out +.AP "CONST char" ***argvPtr out \fI*argvPtr\fR will be filled in with the address of an array of pointers to the strings that are the extracted elements of \fIlist\fR. There will be \fI*argcPtr\fR valid entries in the array, followed by a NULL entry. .AP int argc in Number of elements in \fIargv\fR. -.AP "char * CONST" *argv in +.AP "CONST char * CONST" *argv in Array of strings to merge together into a single list. Each string will become a separate element of the list. .AP "CONST char" *src in diff --git a/doc/SplitPath.3 b/doc/SplitPath.3 index 165df09..9013dd0 100644 --- a/doc/SplitPath.3 +++ b/doc/SplitPath.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: SplitPath.3,v 1.4 2001/09/27 00:19:57 dgp Exp $ +'\" RCS: @(#) $Id: SplitPath.3,v 1.5 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_SplitPath 3 7.5 Tcl "Tcl Library Procedures" @@ -17,26 +17,26 @@ Tcl_SplitPath, Tcl_JoinPath, Tcl_GetPathType \- manipulate platform-dependent fi .sp \fBTcl_SplitPath\fR(\fIpath, argcPtr, argvPtr\fR) .sp -char * +CONST char * \fBTcl_JoinPath\fR(\fIargc, argv, resultPtr\fR) .sp Tcl_PathType \fBTcl_GetPathType\fR(\fIpath\fR) .SH ARGUMENTS .AS Tcl_DString ***argvPtr -.AP "CONST char" *path in +.AP "CONST char * CONST" *argvPtr in File path in a form appropriate for the current platform (see the \fBfilename\fR manual entry for acceptable forms for path names). .AP int *argcPtr out Filled in with number of path elements in \fIpath\fR. -.AP char ***argvPtr out +.AP CONST char ***argvPtr out \fI*argvPtr\fR will be filled in with the address of an array of pointers to the strings that are the extracted elements of \fIpath\fR. There will be \fI*argcPtr\fR valid entries in the array, followed by a NULL entry. .AP int argc in Number of elements in \fIargv\fR. -.AP char **argv in +.AP "CONST char * CONST" *argv in Array of path elements to merge together into a single path. .AP Tcl_DString *resultPtr in/out A pointer to an initialized \fBTcl_DString\fR to which the result of diff --git a/doc/Translate.3 b/doc/Translate.3 index d405be6..ff4a989 100644 --- a/doc/Translate.3 +++ b/doc/Translate.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: Translate.3,v 1.4 2000/04/14 23:01:54 hobbs Exp $ +'\" RCS: @(#) $Id: Translate.3,v 1.5 2002/01/25 20:40:55 dgp Exp $ '\" .so man.macros .TH Tcl_TranslateFileName 3 8.1 Tcl "Tcl Library Procedures" @@ -16,13 +16,13 @@ Tcl_TranslateFileName \- convert file name to native form and replace tilde with .nf \fB#include <tcl.h>\fR .sp -char * +CONST char * \fBTcl_TranslateFileName\fR(\fIinterp\fR, \fIname\fR, \fIbufferPtr\fR) .SH ARGUMENTS .AS Tcl_DString *bufferPtr .AP Tcl_Interp *interp in Interpreter in which to report an error, if any. -.AP char *name in +.AP "CONST char" *name in File name, which may start with a ``~''. .AP Tcl_DString *bufferPtr in/out If needed, this dynamic string is used to store the new file name. diff --git a/generic/tcl.decls b/generic/tcl.decls index fb2bd6d..45656ed 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.77 2002/01/23 20:46:01 dgp Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.78 2002/01/25 20:40:55 dgp Exp $ library tcl @@ -306,7 +306,7 @@ declare 82 generic { int Tcl_CommandComplete(char *cmd) } declare 83 generic { - char * Tcl_Concat(int argc, char * CONST *argv) + char * Tcl_Concat(int argc, CONST char * CONST *argv) } declare 84 generic { int Tcl_ConvertElement(CONST char *src, char *dst, int flags) @@ -624,13 +624,14 @@ declare 173 generic { Tcl_Channel Tcl_GetStdChannel(int type) } declare 174 generic { - char * Tcl_GetStringResult(Tcl_Interp *interp) + CONST char * Tcl_GetStringResult(Tcl_Interp *interp) } declare 175 generic { - char * Tcl_GetVar(Tcl_Interp *interp, char *varName, int flags) + CONST char * Tcl_GetVar(Tcl_Interp *interp, char *varName, int flags) } declare 176 generic { - char * Tcl_GetVar2(Tcl_Interp *interp, char *part1, char *part2, int flags) + CONST char * Tcl_GetVar2(Tcl_Interp *interp, char *part1, char *part2, \ + int flags) } declare 177 generic { int Tcl_GlobalEval(Tcl_Interp *interp, char *command) @@ -662,7 +663,8 @@ declare 185 generic { } # Obsolete, use Tcl_FSJoinPath declare 186 generic { - char * Tcl_JoinPath(int argc, char **argv, Tcl_DString *resultPtr) + CONST char * Tcl_JoinPath(int argc, CONST char * CONST *argv, + Tcl_DString *resultPtr) } declare 187 generic { int Tcl_LinkVar(Tcl_Interp *interp, char *varName, char *addr, int type) @@ -683,7 +685,7 @@ declare 191 generic { Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket) } declare 192 generic { - char * Tcl_Merge(int argc, char * CONST *argv) + char * Tcl_Merge(int argc, CONST char * CONST *argv) } declare 193 generic { Tcl_HashEntry * Tcl_NextHashEntry(Tcl_HashSearch *searchPtr) @@ -701,7 +703,7 @@ declare 196 generic { } declare 197 {unix win} { Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, \ - char **argv, int flags) + CONST char **argv, int flags) } # This is obsolete, use Tcl_FSOpenFileChannel declare 198 generic { @@ -833,12 +835,12 @@ declare 236 generic { void Tcl_SetStdChannel(Tcl_Channel channel, int type) } declare 237 generic { - char * Tcl_SetVar(Tcl_Interp *interp, char *varName, char *newValue, \ - int flags) + CONST char * Tcl_SetVar(Tcl_Interp *interp, char *varName, \ + CONST char *newValue, int flags) } declare 238 generic { - char * Tcl_SetVar2(Tcl_Interp *interp, char *part1, char *part2, \ - char *newValue, int flags) + CONST char * Tcl_SetVar2(Tcl_Interp *interp, char *part1, char *part2, \ + CONST char *newValue, int flags) } declare 239 generic { CONST char * Tcl_SignalId(int sig) @@ -851,11 +853,11 @@ declare 241 generic { } declare 242 generic { int Tcl_SplitList(Tcl_Interp *interp, CONST char *listStr, int *argcPtr, \ - char ***argvPtr) + CONST char ***argvPtr) } # Obsolete, use Tcl_FSSplitPath declare 243 generic { - void Tcl_SplitPath(CONST char *path, int *argcPtr, char ***argvPtr) + void Tcl_SplitPath(CONST char *path, int *argcPtr, CONST char ***argvPtr) } declare 244 generic { void Tcl_StaticPackage(Tcl_Interp *interp, CONST char *pkgName, \ @@ -876,7 +878,7 @@ declare 248 generic { int flags, Tcl_VarTraceProc *proc, ClientData clientData) } declare 249 generic { - char * Tcl_TranslateFileName(Tcl_Interp *interp, char *name, \ + CONST char * Tcl_TranslateFileName(Tcl_Interp *interp, CONST char *name, \ Tcl_DString *bufferPtr) } declare 250 generic { @@ -1060,8 +1062,8 @@ declare 295 generic { int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr) } declare 296 generic { - char * Tcl_ExternalToUtfDString(Tcl_Encoding encoding, CONST char *src, \ - int srcLen, Tcl_DString *dsPtr) + CONST char * Tcl_ExternalToUtfDString(Tcl_Encoding encoding, \ + CONST char *src, int srcLen, Tcl_DString *dsPtr) } declare 297 generic { void Tcl_FinalizeThread(void) @@ -1079,7 +1081,7 @@ declare 301 generic { Tcl_Encoding Tcl_GetEncoding(Tcl_Interp *interp, CONST char *name) } declare 302 generic { - char * Tcl_GetEncodingName(Tcl_Encoding encoding) + CONST char * Tcl_GetEncodingName(Tcl_Encoding encoding) } declare 303 generic { void Tcl_GetEncodingNames(Tcl_Interp *interp) @@ -1182,8 +1184,8 @@ declare 332 generic { int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr) } declare 333 generic { - char * Tcl_UtfToExternalDString(Tcl_Encoding encoding, CONST char *src, \ - int srcLen, Tcl_DString *dsPtr) + CONST char * Tcl_UtfToExternalDString(Tcl_Encoding encoding, \ + CONST char *src, int srcLen, Tcl_DString *dsPtr) } declare 334 generic { int Tcl_UtfToLower(char *src) @@ -1207,10 +1209,10 @@ declare 340 generic { char * Tcl_GetString(Tcl_Obj *objPtr) } declare 341 generic { - char * Tcl_GetDefaultEncodingDir(void) + CONST char * Tcl_GetDefaultEncodingDir(void) } declare 342 generic { - void Tcl_SetDefaultEncodingDir(char *path) + void Tcl_SetDefaultEncodingDir(CONST char *path) } declare 343 generic { void Tcl_AlertNotifier(ClientData clientData) @@ -1573,7 +1575,7 @@ declare 444 generic { declare 445 generic { int Tcl_FSMatchInDirectory(Tcl_Interp *interp, Tcl_Obj * result, \ Tcl_Obj *pathPtr, \ - char * pattern, Tcl_GlobTypeData * types) + CONST char * pattern, Tcl_GlobTypeData * types) } declare 446 generic { Tcl_Obj* Tcl_FSLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr) @@ -1733,13 +1735,13 @@ declare 1 mac { char * Tcl_MacConvertTextResource(Handle resource) } declare 2 mac { - int Tcl_MacEvalResource(Tcl_Interp *interp, char *resourceName, \ - int resourceNumber, char *fileName) + int Tcl_MacEvalResource(Tcl_Interp *interp, CONST char *resourceName, \ + int resourceNumber, CONST char *fileName) } declare 3 mac { Handle Tcl_MacFindResource(Tcl_Interp *interp, long resourceType, \ - char *resourceName, int resourceNumber, char *resFileRef, \ - int * releaseIt) + CONST char *resourceName, int resourceNumber, \ + CONST char *resFileRef, int * releaseIt) } # These routines support the new OSType object type (i.e. the packed 4 diff --git a/generic/tcl.h b/generic/tcl.h index 7965e2a..f6af1b1 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.110 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.111 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCL @@ -1503,7 +1503,7 @@ typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, CONST char *modeString, int permissions)); typedef int (Tcl_FSMatchInDirectoryProc) _ANSI_ARGS_((Tcl_Interp* interp, - Tcl_Obj *result, Tcl_Obj *pathPtr, char *pattern, + Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern, Tcl_GlobTypeData * types)); typedef Tcl_Obj* (Tcl_FSGetCwdProc) _ANSI_ARGS_((Tcl_Interp *interp)); typedef int (Tcl_FSChdirProc) _ANSI_ARGS_((Tcl_Obj *pathPtr)); diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 98c351b..434df51 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -13,7 +13,7 @@ * * This code contributed by Karl Lehenbauer and Mark Diekhans * - * RCS: @(#) $Id: tclCkalloc.c,v 1.14 2001/12/28 23:36:31 dgp Exp $ + * RCS: @(#) $Id: tclCkalloc.c,v 1.15 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -783,7 +783,7 @@ MemoryCmd (clientData, interp, argc, argv) int argc; char **argv; { - char *fileName; + CONST char *fileName; Tcl_DString buffer; int result; diff --git a/generic/tclClock.c b/generic/tclClock.c index f71b86f..5cfc675 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclClock.c,v 1.13 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclClock.c,v 1.14 2002/01/25 20:40:55 dgp Exp $ */ #include "tcl.h" @@ -297,7 +297,7 @@ FormatClock(interp, clockVal, useGMT, format) */ if (useGMT) { - char *varValue; + CONST char *varValue; varValue = Tcl_GetVar2(interp, "env", "TZ", TCL_GLOBAL_ONLY); if (varValue != NULL) { diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index cc7ab0f..8ba5132 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.18 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.19 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -131,7 +131,7 @@ Tcl_CaseObjCmd(dummy, interp, objc, objv) for (i = 0; i < caseObjc; i += 2) { int patObjc, j; - char **patObjv; + CONST char **patObjv; char *pat; unsigned char *p; @@ -512,7 +512,8 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv) return TCL_ERROR; } if (objc == 2) { - Tcl_SetResult(interp, Tcl_GetEncodingName(NULL), TCL_STATIC); + Tcl_SetStringObj(Tcl_GetObjResult(interp), + Tcl_GetEncodingName(NULL), -1); } else { return Tcl_SetSystemEncoding(interp, Tcl_GetStringFromObj(objv[2], NULL)); @@ -1014,7 +1015,7 @@ Tcl_FileObjCmd(dummy, interp, objc, objv) return TclFileMakeDirsCmd(interp, objc, objv); } case FILE_NATIVENAME: { - char *fileName; + CONST char *fileName; Tcl_DString ds; if (objc != 3) { diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index d0274a0..72f6760 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.38 2002/01/23 20:46:01 dgp Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.39 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -1192,7 +1192,7 @@ InfoLibraryCmd(dummy, interp, objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { - char *libDirName; + CONST char *libDirName; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); @@ -1454,7 +1454,7 @@ InfoPatchLevelCmd(dummy, interp, objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { - char *patchlevel; + CONST char *patchlevel; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); @@ -1742,7 +1742,7 @@ InfoTclVersionCmd(dummy, interp, objc, objv) int objc; /* Number of arguments. */ Tcl_Obj *CONST objv[]; /* Argument objects. */ { - char *version; + CONST char *version; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 58bd4e0..536ad2d 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.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: tclCompCmds.c,v 1.20 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.21 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -754,9 +754,9 @@ TclCompileForeachCmd(interp, parsePtr, envPtr) #define STATIC_VAR_LIST_SIZE 5 int varcListStaticSpace[STATIC_VAR_LIST_SIZE]; - char **varvListStaticSpace[STATIC_VAR_LIST_SIZE]; + CONST char **varvListStaticSpace[STATIC_VAR_LIST_SIZE]; int *varcList = varcListStaticSpace; - char ***varvList = varvListStaticSpace; + CONST char ***varvList = varvListStaticSpace; /* * If the foreach command isn't in a procedure, don't compile it inline: @@ -795,11 +795,11 @@ TclCompileForeachCmd(interp, parsePtr, envPtr) numLists = (numWords - 2)/2; if (numLists > STATIC_VAR_LIST_SIZE) { varcList = (int *) ckalloc(numLists * sizeof(int)); - varvList = (char ***) ckalloc(numLists * sizeof(char **)); + varvList = (CONST char ***) ckalloc(numLists * sizeof(char **)); } for (loopIndex = 0; loopIndex < numLists; loopIndex++) { varcList[loopIndex] = 0; - varvList[loopIndex] = (char **) NULL; + varvList[loopIndex] = NULL; } /* @@ -845,7 +845,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr) numVars = varcList[loopIndex]; for (j = 0; j < numVars; j++) { - char *varName = varvList[loopIndex][j]; + CONST char *varName = varvList[loopIndex][j]; if (!TclIsLocalScalar(varName, (int) strlen(varName))) { code = TCL_OUT_LINE_COMPILE; goto done; @@ -893,7 +893,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr) sizeof(ForeachVarList) + (numVars * sizeof(int))); varListPtr->numVars = numVars; for (j = 0; j < numVars; j++) { - char *varName = varvList[loopIndex][j]; + CONST char *varName = varvList[loopIndex][j]; int nameChars = strlen(varName); varListPtr->varIndexes[j] = TclFindCompiledLocal(varName, nameChars, /*create*/ 1, /*flags*/ VAR_SCALAR, procPtr); @@ -1029,7 +1029,7 @@ TclCompileForeachCmd(interp, parsePtr, envPtr) done: for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - if (varvList[loopIndex] != (char **) NULL) { + if (varvList[loopIndex] != NULL) { ckfree((char *) varvList[loopIndex]); } } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 2be7ed3..24a8693 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.30 2001/12/11 19:45:52 msofer Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.31 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -1711,7 +1711,7 @@ LogCompilationInfo(interp, script, command, length) int TclFindCompiledLocal(name, nameBytes, create, flags, procPtr) - register char *name; /* Points to first character of the name of + register CONST char *name; /* Points to first character of the name of * a scalar or array variable. If NULL, a * temporary var should be created. */ int nameBytes; /* Number of bytes in the name. */ diff --git a/generic/tclCompile.h b/generic/tclCompile.h index f2e478e..1a44da8 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.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: tclCompile.h,v 1.23 2001/12/10 15:44:34 msofer Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.24 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCLCOMPILATION @@ -786,7 +786,7 @@ EXTERN ExceptionRange * TclGetExceptionRangeForPc _ANSI_ARGS_(( EXTERN void TclExpandJumpFixupArray _ANSI_ARGS_(( JumpFixupArray *fixupArrayPtr)); EXTERN void TclFinalizeAuxDataTypeTable _ANSI_ARGS_((void)); -EXTERN int TclFindCompiledLocal _ANSI_ARGS_((char *name, +EXTERN int TclFindCompiledLocal _ANSI_ARGS_((CONST char *name, int nameChars, int create, int flags, Proc *procPtr)); EXTERN LiteralEntry * TclLookupLiteralEntry _ANSI_ARGS_(( diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 967636e..b559f16 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.77 2002/01/23 20:46:01 dgp Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.78 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCLDECLS @@ -274,7 +274,7 @@ EXTERN int Tcl_Close _ANSI_ARGS_((Tcl_Interp * interp, EXTERN int Tcl_CommandComplete _ANSI_ARGS_((char * cmd)); /* 83 */ EXTERN char * Tcl_Concat _ANSI_ARGS_((int argc, - char * CONST * argv)); + CONST char * CONST * argv)); /* 84 */ EXTERN int Tcl_ConvertElement _ANSI_ARGS_((CONST char * src, char * dst, int flags)); @@ -568,12 +568,12 @@ EXTERN Tcl_Interp * Tcl_GetSlave _ANSI_ARGS_((Tcl_Interp * interp, /* 173 */ EXTERN Tcl_Channel Tcl_GetStdChannel _ANSI_ARGS_((int type)); /* 174 */ -EXTERN char * Tcl_GetStringResult _ANSI_ARGS_((Tcl_Interp * interp)); +EXTERN CONST char * Tcl_GetStringResult _ANSI_ARGS_((Tcl_Interp * interp)); /* 175 */ -EXTERN char * Tcl_GetVar _ANSI_ARGS_((Tcl_Interp * interp, +EXTERN CONST char * Tcl_GetVar _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 176 */ -EXTERN char * Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp * interp, +EXTERN CONST char * Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 177 */ EXTERN int Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp * interp, @@ -599,7 +599,8 @@ EXTERN int Tcl_InterpDeleted _ANSI_ARGS_((Tcl_Interp * interp)); /* 185 */ EXTERN int Tcl_IsSafe _ANSI_ARGS_((Tcl_Interp * interp)); /* 186 */ -EXTERN char * Tcl_JoinPath _ANSI_ARGS_((int argc, char ** argv, +EXTERN CONST char * Tcl_JoinPath _ANSI_ARGS_((int argc, + CONST char * CONST * argv, Tcl_DString * resultPtr)); /* 187 */ EXTERN int Tcl_LinkVar _ANSI_ARGS_((Tcl_Interp * interp, @@ -614,7 +615,8 @@ EXTERN int Tcl_MakeSafe _ANSI_ARGS_((Tcl_Interp * interp)); EXTERN Tcl_Channel Tcl_MakeTcpClientChannel _ANSI_ARGS_(( ClientData tcpSocket)); /* 192 */ -EXTERN char * Tcl_Merge _ANSI_ARGS_((int argc, char * CONST * argv)); +EXTERN char * Tcl_Merge _ANSI_ARGS_((int argc, + CONST char * CONST * argv)); /* 193 */ EXTERN Tcl_HashEntry * Tcl_NextHashEntry _ANSI_ARGS_(( Tcl_HashSearch * searchPtr)); @@ -632,14 +634,14 @@ EXTERN Tcl_Obj * Tcl_ObjSetVar2 _ANSI_ARGS_((Tcl_Interp * interp, #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ /* 197 */ EXTERN Tcl_Channel Tcl_OpenCommandChannel _ANSI_ARGS_(( - Tcl_Interp * interp, int argc, char ** argv, - int flags)); + Tcl_Interp * interp, int argc, + CONST char ** argv, int flags)); #endif /* UNIX */ #ifdef __WIN32__ /* 197 */ EXTERN Tcl_Channel Tcl_OpenCommandChannel _ANSI_ARGS_(( - Tcl_Interp * interp, int argc, char ** argv, - int flags)); + Tcl_Interp * interp, int argc, + CONST char ** argv, int flags)); #endif /* __WIN32__ */ /* 198 */ EXTERN Tcl_Channel Tcl_OpenFileChannel _ANSI_ARGS_((Tcl_Interp * interp, @@ -764,12 +766,13 @@ EXTERN void Tcl_SetObjResult _ANSI_ARGS_((Tcl_Interp * interp, EXTERN void Tcl_SetStdChannel _ANSI_ARGS_((Tcl_Channel channel, int type)); /* 237 */ -EXTERN char * Tcl_SetVar _ANSI_ARGS_((Tcl_Interp * interp, - char * varName, char * newValue, int flags)); -/* 238 */ -EXTERN char * Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp * interp, - char * part1, char * part2, char * newValue, +EXTERN CONST char * Tcl_SetVar _ANSI_ARGS_((Tcl_Interp * interp, + char * varName, CONST char * newValue, int flags)); +/* 238 */ +EXTERN CONST char * Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp * interp, + char * part1, char * part2, + CONST char * newValue, int flags)); /* 239 */ EXTERN CONST char * Tcl_SignalId _ANSI_ARGS_((int sig)); /* 240 */ @@ -779,10 +782,10 @@ EXTERN void Tcl_SourceRCFile _ANSI_ARGS_((Tcl_Interp * interp)); /* 242 */ EXTERN int Tcl_SplitList _ANSI_ARGS_((Tcl_Interp * interp, CONST char * listStr, int * argcPtr, - char *** argvPtr)); + CONST char *** argvPtr)); /* 243 */ EXTERN void Tcl_SplitPath _ANSI_ARGS_((CONST char * path, - int * argcPtr, char *** argvPtr)); + int * argcPtr, CONST char *** argvPtr)); /* 244 */ EXTERN void Tcl_StaticPackage _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pkgName, @@ -804,8 +807,8 @@ EXTERN int Tcl_TraceVar2 _ANSI_ARGS_((Tcl_Interp * interp, Tcl_VarTraceProc * proc, ClientData clientData)); /* 249 */ -EXTERN char * Tcl_TranslateFileName _ANSI_ARGS_(( - Tcl_Interp * interp, char * name, +EXTERN CONST char * Tcl_TranslateFileName _ANSI_ARGS_(( + Tcl_Interp * interp, CONST char * name, Tcl_DString * bufferPtr)); /* 250 */ EXTERN int Tcl_Ungets _ANSI_ARGS_((Tcl_Channel chan, @@ -959,7 +962,7 @@ EXTERN int Tcl_ExternalToUtf _ANSI_ARGS_((Tcl_Interp * interp, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 296 */ -EXTERN char * Tcl_ExternalToUtfDString _ANSI_ARGS_(( +EXTERN CONST char * Tcl_ExternalToUtfDString _ANSI_ARGS_(( Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 297 */ @@ -975,7 +978,7 @@ EXTERN Tcl_ThreadId Tcl_GetCurrentThread _ANSI_ARGS_((void)); EXTERN Tcl_Encoding Tcl_GetEncoding _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 302 */ -EXTERN char * Tcl_GetEncodingName _ANSI_ARGS_(( +EXTERN CONST char * Tcl_GetEncodingName _ANSI_ARGS_(( Tcl_Encoding encoding)); /* 303 */ EXTERN void Tcl_GetEncodingNames _ANSI_ARGS_(( @@ -1069,7 +1072,7 @@ EXTERN int Tcl_UtfToExternal _ANSI_ARGS_((Tcl_Interp * interp, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 333 */ -EXTERN char * Tcl_UtfToExternalDString _ANSI_ARGS_(( +EXTERN CONST char * Tcl_UtfToExternalDString _ANSI_ARGS_(( Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 334 */ @@ -1090,9 +1093,10 @@ EXTERN int Tcl_WriteObj _ANSI_ARGS_((Tcl_Channel chan, /* 340 */ EXTERN char * Tcl_GetString _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 341 */ -EXTERN char * Tcl_GetDefaultEncodingDir _ANSI_ARGS_((void)); +EXTERN CONST char * Tcl_GetDefaultEncodingDir _ANSI_ARGS_((void)); /* 342 */ -EXTERN void Tcl_SetDefaultEncodingDir _ANSI_ARGS_((char * path)); +EXTERN void Tcl_SetDefaultEncodingDir _ANSI_ARGS_(( + CONST char * path)); /* 343 */ EXTERN void Tcl_AlertNotifier _ANSI_ARGS_((ClientData clientData)); /* 344 */ @@ -1406,7 +1410,7 @@ EXTERN int Tcl_FSLoadFile _ANSI_ARGS_((Tcl_Interp * interp, /* 445 */ EXTERN int Tcl_FSMatchInDirectory _ANSI_ARGS_(( Tcl_Interp * interp, Tcl_Obj * result, - Tcl_Obj * pathPtr, char * pattern, + Tcl_Obj * pathPtr, CONST char * pattern, Tcl_GlobTypeData * types)); /* 446 */ EXTERN Tcl_Obj* Tcl_FSLink _ANSI_ARGS_((Tcl_Obj * pathPtr, @@ -1624,7 +1628,7 @@ typedef struct TclStubs { void (*tcl_CancelIdleCall) _ANSI_ARGS_((Tcl_IdleProc * idleProc, ClientData clientData)); /* 80 */ int (*tcl_Close) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan)); /* 81 */ int (*tcl_CommandComplete) _ANSI_ARGS_((char * cmd)); /* 82 */ - char * (*tcl_Concat) _ANSI_ARGS_((int argc, char * CONST * argv)); /* 83 */ + char * (*tcl_Concat) _ANSI_ARGS_((int argc, CONST char * CONST * argv)); /* 83 */ int (*tcl_ConvertElement) _ANSI_ARGS_((CONST char * src, char * dst, int flags)); /* 84 */ int (*tcl_ConvertCountedElement) _ANSI_ARGS_((CONST char * src, int length, char * dst, int flags)); /* 85 */ int (*tcl_CreateAlias) _ANSI_ARGS_((Tcl_Interp * slave, CONST char * slaveCmd, Tcl_Interp * target, CONST char * targetCmd, int argc, char * CONST * argv)); /* 86 */ @@ -1731,9 +1735,9 @@ typedef struct TclStubs { int (*tcl_GetServiceMode) _ANSI_ARGS_((void)); /* 171 */ Tcl_Interp * (*tcl_GetSlave) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * slaveName)); /* 172 */ Tcl_Channel (*tcl_GetStdChannel) _ANSI_ARGS_((int type)); /* 173 */ - char * (*tcl_GetStringResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 174 */ - char * (*tcl_GetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 175 */ - char * (*tcl_GetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 176 */ + CONST char * (*tcl_GetStringResult) _ANSI_ARGS_((Tcl_Interp * interp)); /* 174 */ + CONST char * (*tcl_GetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags)); /* 175 */ + CONST char * (*tcl_GetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 176 */ int (*tcl_GlobalEval) _ANSI_ARGS_((Tcl_Interp * interp, char * command)); /* 177 */ int (*tcl_GlobalEvalObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 178 */ int (*tcl_HideCommand) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, CONST char * hiddenCmdToken)); /* 179 */ @@ -1743,22 +1747,22 @@ typedef struct TclStubs { int (*tcl_InputBuffered) _ANSI_ARGS_((Tcl_Channel chan)); /* 183 */ int (*tcl_InterpDeleted) _ANSI_ARGS_((Tcl_Interp * interp)); /* 184 */ int (*tcl_IsSafe) _ANSI_ARGS_((Tcl_Interp * interp)); /* 185 */ - char * (*tcl_JoinPath) _ANSI_ARGS_((int argc, char ** argv, Tcl_DString * resultPtr)); /* 186 */ + CONST char * (*tcl_JoinPath) _ANSI_ARGS_((int argc, CONST char * CONST * argv, Tcl_DString * resultPtr)); /* 186 */ int (*tcl_LinkVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, char * addr, int type)); /* 187 */ void *reserved188; Tcl_Channel (*tcl_MakeFileChannel) _ANSI_ARGS_((ClientData handle, int mode)); /* 189 */ int (*tcl_MakeSafe) _ANSI_ARGS_((Tcl_Interp * interp)); /* 190 */ Tcl_Channel (*tcl_MakeTcpClientChannel) _ANSI_ARGS_((ClientData tcpSocket)); /* 191 */ - char * (*tcl_Merge) _ANSI_ARGS_((int argc, char * CONST * argv)); /* 192 */ + char * (*tcl_Merge) _ANSI_ARGS_((int argc, CONST char * CONST * argv)); /* 192 */ Tcl_HashEntry * (*tcl_NextHashEntry) _ANSI_ARGS_((Tcl_HashSearch * searchPtr)); /* 193 */ void (*tcl_NotifyChannel) _ANSI_ARGS_((Tcl_Channel channel, int mask)); /* 194 */ Tcl_Obj * (*tcl_ObjGetVar2) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, int flags)); /* 195 */ Tcl_Obj * (*tcl_ObjSetVar2) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * part1Ptr, Tcl_Obj * part2Ptr, Tcl_Obj * newValuePtr, int flags)); /* 196 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, int flags)); /* 197 */ + Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, int flags)); /* 197 */ #endif /* UNIX */ #ifdef __WIN32__ - Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, int flags)); /* 197 */ + Tcl_Channel (*tcl_OpenCommandChannel) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, int flags)); /* 197 */ #endif /* __WIN32__ */ #ifdef MAC_TCL void *reserved197; @@ -1810,19 +1814,19 @@ typedef struct TclStubs { void (*tcl_SetObjErrorCode) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * errorObjPtr)); /* 234 */ void (*tcl_SetObjResult) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * resultObjPtr)); /* 235 */ void (*tcl_SetStdChannel) _ANSI_ARGS_((Tcl_Channel channel, int type)); /* 236 */ - char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, char * newValue, int flags)); /* 237 */ - char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, char * newValue, int flags)); /* 238 */ + CONST char * (*tcl_SetVar) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, CONST char * newValue, int flags)); /* 237 */ + CONST char * (*tcl_SetVar2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, CONST char * newValue, int flags)); /* 238 */ CONST char * (*tcl_SignalId) _ANSI_ARGS_((int sig)); /* 239 */ CONST char * (*tcl_SignalMsg) _ANSI_ARGS_((int sig)); /* 240 */ void (*tcl_SourceRCFile) _ANSI_ARGS_((Tcl_Interp * interp)); /* 241 */ - int (*tcl_SplitList) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * listStr, int * argcPtr, char *** argvPtr)); /* 242 */ - void (*tcl_SplitPath) _ANSI_ARGS_((CONST char * path, int * argcPtr, char *** argvPtr)); /* 243 */ + int (*tcl_SplitList) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * listStr, int * argcPtr, CONST char *** argvPtr)); /* 242 */ + void (*tcl_SplitPath) _ANSI_ARGS_((CONST char * path, int * argcPtr, CONST char *** argvPtr)); /* 243 */ void (*tcl_StaticPackage) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * pkgName, Tcl_PackageInitProc * initProc, Tcl_PackageInitProc * safeInitProc)); /* 244 */ int (*tcl_StringMatch) _ANSI_ARGS_((CONST char * str, CONST char * pattern)); /* 245 */ int (*tcl_Tell) _ANSI_ARGS_((Tcl_Channel chan)); /* 246 */ 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 */ + CONST char * (*tcl_TranslateFileName) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, Tcl_DString * bufferPtr)); /* 249 */ 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 */ @@ -1869,13 +1873,13 @@ typedef struct TclStubs { int (*tcl_EvalObjEx) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int flags)); /* 293 */ void (*tcl_ExitThread) _ANSI_ARGS_((int status)); /* 294 */ int (*tcl_ExternalToUtf) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Encoding encoding, CONST char * src, int srcLen, int flags, Tcl_EncodingState * statePtr, char * dst, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 295 */ - char * (*tcl_ExternalToUtfDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 296 */ + CONST char * (*tcl_ExternalToUtfDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 296 */ void (*tcl_FinalizeThread) _ANSI_ARGS_((void)); /* 297 */ void (*tcl_FinalizeNotifier) _ANSI_ARGS_((ClientData clientData)); /* 298 */ void (*tcl_FreeEncoding) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 299 */ Tcl_ThreadId (*tcl_GetCurrentThread) _ANSI_ARGS_((void)); /* 300 */ Tcl_Encoding (*tcl_GetEncoding) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 301 */ - char * (*tcl_GetEncodingName) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 302 */ + CONST char * (*tcl_GetEncodingName) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 302 */ void (*tcl_GetEncodingNames) _ANSI_ARGS_((Tcl_Interp * interp)); /* 303 */ int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CONST char ** tablePtr, int offset, CONST char * msg, int flags, int * indexPtr)); /* 304 */ VOID * (*tcl_GetThreadData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, int size)); /* 305 */ @@ -1906,7 +1910,7 @@ typedef struct TclStubs { CONST char * (*tcl_UtfNext) _ANSI_ARGS_((CONST char * src)); /* 330 */ CONST char * (*tcl_UtfPrev) _ANSI_ARGS_((CONST char * src, CONST char * start)); /* 331 */ int (*tcl_UtfToExternal) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Encoding encoding, CONST char * src, int srcLen, int flags, Tcl_EncodingState * statePtr, char * dst, int dstLen, int * srcReadPtr, int * dstWrotePtr, int * dstCharsPtr)); /* 332 */ - char * (*tcl_UtfToExternalDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 333 */ + CONST char * (*tcl_UtfToExternalDString) _ANSI_ARGS_((Tcl_Encoding encoding, CONST char * src, int srcLen, Tcl_DString * dsPtr)); /* 333 */ int (*tcl_UtfToLower) _ANSI_ARGS_((char * src)); /* 334 */ int (*tcl_UtfToTitle) _ANSI_ARGS_((char * src)); /* 335 */ int (*tcl_UtfToUniChar) _ANSI_ARGS_((CONST char * src, Tcl_UniChar * chPtr)); /* 336 */ @@ -1914,8 +1918,8 @@ typedef struct TclStubs { int (*tcl_WriteChars) _ANSI_ARGS_((Tcl_Channel chan, CONST char * src, int srcLen)); /* 338 */ int (*tcl_WriteObj) _ANSI_ARGS_((Tcl_Channel chan, Tcl_Obj * objPtr)); /* 339 */ char * (*tcl_GetString) _ANSI_ARGS_((Tcl_Obj * objPtr)); /* 340 */ - char * (*tcl_GetDefaultEncodingDir) _ANSI_ARGS_((void)); /* 341 */ - void (*tcl_SetDefaultEncodingDir) _ANSI_ARGS_((char * path)); /* 342 */ + CONST char * (*tcl_GetDefaultEncodingDir) _ANSI_ARGS_((void)); /* 341 */ + void (*tcl_SetDefaultEncodingDir) _ANSI_ARGS_((CONST char * path)); /* 342 */ void (*tcl_AlertNotifier) _ANSI_ARGS_((ClientData clientData)); /* 343 */ void (*tcl_ServiceModeHook) _ANSI_ARGS_((int mode)); /* 344 */ int (*tcl_UniCharIsAlnum) _ANSI_ARGS_((int ch)); /* 345 */ @@ -2018,7 +2022,7 @@ typedef struct TclStubs { int (*tcl_FSCreateDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 442 */ int (*tcl_FSDeleteFile) _ANSI_ARGS_((Tcl_Obj * pathPtr)); /* 443 */ int (*tcl_FSLoadFile) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * pathPtr, CONST char * sym1, CONST char * sym2, Tcl_PackageInitProc ** proc1Ptr, Tcl_PackageInitProc ** proc2Ptr, ClientData * clientDataPtr, Tcl_FSUnloadFileProc ** unloadProcPtr)); /* 444 */ - int (*tcl_FSMatchInDirectory) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * result, Tcl_Obj * pathPtr, char * pattern, Tcl_GlobTypeData * types)); /* 445 */ + int (*tcl_FSMatchInDirectory) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * result, Tcl_Obj * pathPtr, CONST char * pattern, Tcl_GlobTypeData * types)); /* 445 */ Tcl_Obj* (*tcl_FSLink) _ANSI_ARGS_((Tcl_Obj * pathPtr, Tcl_Obj * toPtr)); /* 446 */ int (*tcl_FSRemoveDirectory) _ANSI_ARGS_((Tcl_Obj * pathPtr, int recursive, Tcl_Obj ** errorPtr)); /* 447 */ int (*tcl_FSRenameFile) _ANSI_ARGS_((Tcl_Obj * srcPathPtr, Tcl_Obj * destPathPtr)); /* 448 */ diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index b69e2c0..78bd886 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.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: tclEncoding.c,v 1.8 2001/09/24 21:10:32 dgp Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.9 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -341,7 +341,7 @@ TclFinalizeEncodingSubsystem() *------------------------------------------------------------------------- */ -char * +CONST char * Tcl_GetDefaultEncodingDir() { return tclDefaultEncodingDir; @@ -362,7 +362,7 @@ Tcl_GetDefaultEncodingDir() void Tcl_SetDefaultEncodingDir(path) - char *path; + CONST char *path; { tclDefaultEncodingDir = (char *)ckalloc((unsigned) strlen(path) + 1); strcpy(tclDefaultEncodingDir, path); @@ -505,7 +505,7 @@ FreeEncoding(encoding) *--------------------------------------------------------------------------- */ -char * +CONST char * Tcl_GetEncodingName(encoding) Tcl_Encoding encoding; /* The encoding whose name to fetch. */ { @@ -781,7 +781,7 @@ Tcl_CreateEncoding(typePtr) *------------------------------------------------------------------------- */ -char * +CONST char * Tcl_ExternalToUtfDString(encoding, src, srcLen, dstPtr) Tcl_Encoding encoding; /* The encoding for the source string, or * NULL for the default system encoding. */ @@ -944,7 +944,7 @@ Tcl_ExternalToUtf(interp, encoding, src, srcLen, flags, statePtr, dst, *------------------------------------------------------------------------- */ -char * +CONST char * Tcl_UtfToExternalDString(encoding, src, srcLen, dstPtr) Tcl_Encoding encoding; /* The encoding for the converted string, * or NULL for the default system encoding. */ @@ -1280,15 +1280,15 @@ OpenEncodingFile(dir, name) CONST char *name; { - char *argv[3]; + CONST char *argv[3]; Tcl_DString pathString; CONST char *path; Tcl_Channel chan; Tcl_Obj *pathPtr; - argv[0] = (char *) dir; + argv[0] = dir; argv[1] = "encoding"; - argv[2] = (char *) name; + argv[2] = name; Tcl_DStringInit(&pathString); Tcl_JoinPath(3, argv, &pathString); @@ -1584,7 +1584,7 @@ LoadEscapeEncoding(name, chan) while (1) { int argc; - char **argv; + CONST char **argv; char *line; Tcl_DString lineString; diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 1650ed2..35fa180 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -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: tclEnv.c,v 1.9 2000/08/11 17:42:41 ericm Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.10 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -84,7 +84,8 @@ TclSetupEnv(interp) * managed. */ { Tcl_DString envString; - char *p1, *p2; + CONST char *p1; + char *p2; int i; /* @@ -133,7 +134,8 @@ TclSetupEnv(interp) } p2++; p2[-1] = '\0'; - Tcl_SetVar2(interp, "env", p1, p2, TCL_GLOBAL_ONLY); + Tcl_SetVar2(interp, "env", Tcl_DStringValue(&envString), p2, + TCL_GLOBAL_ONLY); Tcl_DStringFree(&envString); } Tcl_MutexUnlock(&envMutex); @@ -174,7 +176,8 @@ TclSetEnv(name, value) { Tcl_DString envString; int index, length, nameLength; - char *p, *p2, *oldValue; + char *p, *oldValue; + CONST char *p2; /* * Figure out where the entry is going to go. If the name doesn't @@ -206,7 +209,7 @@ TclSetEnv(name, value) oldValue = NULL; nameLength = strlen(name); } else { - char *env; + CONST char *env; /* * Compare the new value to the existing value. If they're @@ -303,7 +306,8 @@ Tcl_PutEnv(string) { Tcl_DString nameString; int nameLength; - char *name, *value; + CONST char *name; + char *value; if (string == NULL) { return 0; @@ -443,7 +447,7 @@ TclUnsetEnv(name) *---------------------------------------------------------------------- */ -char * +CONST char * TclGetEnv(name, valuePtr) CONST char *name; /* Name of environment variable to find * (UTF-8). */ @@ -452,7 +456,7 @@ TclGetEnv(name, valuePtr) * stored. */ { int length, index; - char *result; + CONST char *result; Tcl_MutexLock(&envMutex); index = TclpFindVariable(name, &length); @@ -530,7 +534,7 @@ EnvTraceProc(clientData, interp, name1, name2, flags) */ if (flags & TCL_TRACE_WRITES) { - char *value; + CONST char *value; value = Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY); TclSetEnv(name2, value); @@ -542,7 +546,7 @@ EnvTraceProc(clientData, interp, name1, name2, flags) if (flags & TCL_TRACE_READS) { Tcl_DString valueString; - char *value; + CONST char *value; value = TclGetEnv(name2, &valueString); if (value == NULL) { diff --git a/generic/tclEvent.c b/generic/tclEvent.c index ed0c77f..d85a550 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEvent.c,v 1.18 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclEvent.c,v 1.19 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -140,7 +140,7 @@ Tcl_BackgroundError(interp) * occurred. */ { BgError *errPtr; - char *errResult, *varValue; + CONST char *errResult, *varValue; ErrAssocData *assocPtr; int length; diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 6973799..3d8400a 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.27 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.28 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -70,7 +70,7 @@ TclPlatformType tclPlatform = TCL_PLATFORM_UNIX; * Prototypes for local procedures defined in this file: */ -static char * DoTildeSubst _ANSI_ARGS_((Tcl_Interp *interp, +static CONST char * DoTildeSubst _ANSI_ARGS_((Tcl_Interp *interp, CONST char *user, Tcl_DString *resultPtr)); static CONST char * ExtractWinRoot _ANSI_ARGS_((CONST char *path, Tcl_DString *resultPtr, int offset, @@ -554,7 +554,7 @@ Tcl_SplitPath(path, argcPtr, argvPtr) CONST char *path; /* Pointer to string containing a path. */ int *argcPtr; /* Pointer to location to fill in with * the number of elements in the path. */ - char ***argvPtr; /* Pointer to place to store pointer to array + CONST char ***argvPtr; /* Pointer to place to store pointer to array * of pointers to path elements. */ { Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */ @@ -585,7 +585,7 @@ Tcl_SplitPath(path, argcPtr, argvPtr) * the list plus the argv pointers and the terminating NULL pointer. */ - *argvPtr = (char **) ckalloc((unsigned) + *argvPtr = (CONST char **) ckalloc((unsigned) ((((*argcPtr) + 1) * sizeof(char *)) + size)); /* @@ -1268,10 +1268,10 @@ TclpNativeJoinPath(prefix, joining) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_JoinPath(argc, argv, resultPtr) int argc; - char **argv; + CONST char * CONST *argv; Tcl_DString *resultPtr; /* Pointer to previously initialized DString */ { int i, len; @@ -1326,57 +1326,34 @@ Tcl_JoinPath(argc, argv, resultPtr) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_TranslateFileName(interp, name, bufferPtr) Tcl_Interp *interp; /* Interpreter in which to store error * message (if necessary). */ - char *name; /* File name, which may begin with "~" (to + CONST char *name; /* File name, which may begin with "~" (to * indicate current user's home directory) or * "~<user>" (to indicate any user's home * directory). */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled * with name after tilde substitution. */ { - /* - * Handle tilde substitutions, if needed. - */ - if (name[0] == '~') { - int argc, length; - char **argv; - Tcl_DString temp; - - Tcl_SplitPath(name, &argc, (char ***) &argv); - - /* - * Strip the trailing ':' off of a Mac path before passing the user - * name to DoTildeSubst. - */ - - if (tclPlatform == TCL_PLATFORM_MAC) { - length = strlen(argv[0]); - argv[0][length-1] = '\0'; - } - - Tcl_DStringInit(&temp); - argv[0] = DoTildeSubst(interp, argv[0]+1, &temp); - if (argv[0] == NULL) { - Tcl_DStringFree(&temp); - ckfree((char *)argv); - return NULL; - } - Tcl_DStringInit(bufferPtr); - Tcl_JoinPath(argc, argv, bufferPtr); - Tcl_DStringFree(&temp); - ckfree((char*)argv); - } else { - Tcl_DStringInit(bufferPtr); - Tcl_JoinPath(1, &name, bufferPtr); + Tcl_Obj *path = Tcl_NewStringObj(name, -1); + CONST char *result; + + Tcl_IncrRefCount(path); + result = Tcl_FSGetTranslatedStringPath(interp,path); + if (result == NULL) { + return NULL; } + Tcl_DStringInit(bufferPtr); + Tcl_DStringAppend(bufferPtr, result, -1); + Tcl_DecrRefCount(path); /* * Convert forward slashes to backslashes in Windows paths because * some system interfaces don't accept forward slashes. */ + if (tclPlatform == TCL_PLATFORM_WINDOWS) { register char *p; for (p = Tcl_DStringValue(bufferPtr); *p != '\0'; p++) { @@ -1480,7 +1457,7 @@ TclGetExtension(name) *---------------------------------------------------------------------- */ -static char * +static CONST char * DoTildeSubst(interp, user, resultPtr) Tcl_Interp *interp; /* Interpreter in which to store error * message (if necessary). */ @@ -1489,7 +1466,7 @@ DoTildeSubst(interp, user, resultPtr) Tcl_DString *resultPtr; /* Initialized DString filled with name * after tilde substitution. */ { - char *dir; + CONST char *dir; if (*user == '\0') { Tcl_DString dirString; @@ -1515,7 +1492,7 @@ DoTildeSubst(interp, user, resultPtr) return NULL; } } - return resultPtr->string; + return Tcl_DStringValue(resultPtr); } /* @@ -1968,7 +1945,8 @@ TclGlob(interp, pattern, unquotedPrefix, globFlags, types) * May be NULL. */ { char *separators; - char *head, *tail, *start; + CONST char *head; + char *tail, *start; char c; int result, prefixLen; Tcl_DString buffer; diff --git a/generic/tclIO.c b/generic/tclIO.c index d341261..12df2a6 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.48 2002/01/21 20:38:06 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.49 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -5908,7 +5908,7 @@ Tcl_BadChannelOption(interp, optionName, optionList) if (interp) { CONST char *genericopt = "blocking buffering buffersize encoding eofchar translation"; - char **argv; + CONST char **argv; int argc, i; Tcl_DString ds; @@ -6192,7 +6192,7 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) ChannelState *statePtr = chanPtr->state; /* state info for channel */ size_t len; /* Length of optionName string. */ int argc; - char **argv; + CONST char **argv; /* * If the channel is in the middle of a background copy, fail. @@ -6318,13 +6318,13 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) statePtr->outEofChar = (int) argv[1][0]; } } - if (argv != (char **) NULL) { + if (argv != NULL) { ckfree((char *) argv); } return TCL_OK; } else if ((len > 1) && (optionName[1] == 't') && (strncmp(optionName, "-translation", len) == 0)) { - char *readMode, *writeMode; + CONST char *readMode, *writeMode; if (Tcl_SplitList(interp, newValue, &argc, &argv) == TCL_ERROR) { return TCL_ERROR; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index bc61a94..630efcd 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.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: tclIOCmd.c,v 1.12 2002/01/17 20:35:22 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.13 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -726,10 +726,10 @@ Tcl_ExecObjCmd(dummy, interp, objc, objv) #define NUM_ARGS 20 Tcl_Obj *resultPtr; - char **argv; + CONST char **argv; char *string; Tcl_Channel chan; - char *argStorage[NUM_ARGS]; + CONST char *argStorage[NUM_ARGS]; int argc, background, i, index, keepNewline, result, skip, length; static CONST char *options[] = { "-keepnewline", "--", NULL @@ -784,7 +784,7 @@ Tcl_ExecObjCmd(dummy, interp, objc, objv) argv = argStorage; argc = objc - skip; if ((argc + 1) > sizeof(argv) / sizeof(argv[0])) { - argv = (char **) ckalloc((unsigned)(argc + 1) * sizeof(char *)); + argv = (CONST char **) ckalloc((unsigned)(argc + 1) * sizeof(char *)); } /* @@ -976,7 +976,7 @@ Tcl_OpenObjCmd(notUsed, interp, objc, objv) return TCL_ERROR; #else int mode, seekFlag, cmdObjc; - char **cmdArgv; + CONST char **cmdArgv; if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 82d10a8..69a151a 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.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: tclIOSock.c,v 1.5 2000/03/31 08:52:04 hobbs Exp $ + * RCS: @(#) $Id: tclIOSock.c,v 1.6 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -43,7 +43,7 @@ TclSockGetPort(interp, string, proto, portPtr) { struct servent *sp; /* Protocol info for named services */ Tcl_DString ds; - char *native; + CONST char *native; if (Tcl_GetInt(NULL, string, portPtr) != TCL_OK) { /* diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 0ff5c0a..2e1eb4b 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.31 2002/01/25 04:27:26 dgp Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.32 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -984,7 +984,7 @@ TclGetOpenMode(interp, string, seekFlagPtr) * opening of the file. */ { int mode, modeArgc, c, i, gotRW; - char **modeArgv, *flag; + CONST char **modeArgv, *flag; #define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) /* @@ -1596,7 +1596,7 @@ Tcl_FSMatchInDirectory(interp, result, pathPtr, pattern, types) Tcl_Interp *interp; /* Interpreter to receive error messages. */ Tcl_Obj *result; /* List object to receive results. */ Tcl_Obj *pathPtr; /* Contains path to directory to search. */ - char *pattern; /* Pattern to match against. */ + CONST char *pattern; /* Pattern to match against. */ Tcl_GlobTypeData *types; /* Object containing list of acceptable types. * May be NULL. In particular the directory * flag is very important. */ @@ -3502,7 +3502,7 @@ SetFsPathFromAny(interp, objPtr) /* Do some tilde substitution */ if (name[1] == '\0') { /* We have just '~' */ - char *dir; + CONST char *dir; Tcl_DString dirString; if (split != len) { name[split] = separator; } diff --git a/generic/tclInt.decls b/generic/tclInt.decls index f3cb1d9..e8613f2 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -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.decls,v 1.42 2002/01/17 03:03:12 dgp Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.43 2002/01/25 20:40:55 dgp Exp $ library tcl @@ -60,7 +60,7 @@ declare 8 generic { # TclCreatePipeline unofficially exported for use by BLT. declare 9 {unix win} { - int TclCreatePipeline(Tcl_Interp *interp, int argc, char **argv, \ + int TclCreatePipeline(Tcl_Interp *interp, int argc, CONST char **argv, \ Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, \ TclFile *errFilePtr) } @@ -530,7 +530,7 @@ declare 135 generic { # int TclpChdir(CONST char *dirName) #} declare 138 generic { - char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr) + CONST char * TclGetEnv(CONST char *name, Tcl_DString *valuePtr) } #declare 139 generic { # int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1, \ @@ -542,7 +542,7 @@ declare 140 generic { } # This is used by TclX, but should otherwise be considered private declare 141 generic { - char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) + CONST char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) } declare 142 generic { int TclSetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr, \ @@ -841,7 +841,7 @@ declare 14 win { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } declare 15 win { - int TclpCreateProcess(Tcl_Interp *interp, int argc, char **argv, \ + int TclpCreateProcess(Tcl_Interp *interp, int argc, CONST char **argv, \ TclFile inputFile, TclFile outputFile, TclFile errorFile, \ Tcl_Pid *pidPtr) } @@ -909,7 +909,7 @@ declare 3 unix { int TclpCreatePipe(TclFile *readPipe, TclFile *writePipe) } declare 4 unix { - int TclpCreateProcess(Tcl_Interp *interp, int argc, char **argv, \ + int TclpCreateProcess(Tcl_Interp *interp, int argc, CONST char **argv, \ TclFile inputFile, TclFile outputFile, TclFile errorFile, \ Tcl_Pid *pidPtr) } diff --git a/generic/tclInt.h b/generic/tclInt.h index 301632d..f20379c 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.75 2002/01/15 21:19:07 dgp Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.76 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCLINT @@ -1845,7 +1845,7 @@ EXTERN int TclpObjRenameFile _ANSI_ARGS_((Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr)); EXTERN int TclpMatchInDirectory _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *resultPtr, Tcl_Obj *pathPtr, - char *pattern, Tcl_GlobTypeData *types)); + CONST char *pattern, Tcl_GlobTypeData *types)); EXTERN Tcl_Obj* TclpObjGetCwd _ANSI_ARGS_((Tcl_Interp *interp)); EXTERN Tcl_Obj* TclpObjLink _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_Obj *toPtr)); EXTERN int TclpObjChdir _ANSI_ARGS_((Tcl_Obj *pathPtr)); diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 6de0c22..3cf96e5 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIntDecls.h,v 1.35 2002/01/17 03:03:12 dgp Exp $ + * RCS: @(#) $Id: tclIntDecls.h,v 1.36 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCLINTDECLS @@ -63,14 +63,14 @@ EXTERN int TclCopyChannel _ANSI_ARGS_((Tcl_Interp * interp, #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ /* 9 */ EXTERN int TclCreatePipeline _ANSI_ARGS_((Tcl_Interp * interp, - int argc, char ** argv, + int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); #endif /* UNIX */ #ifdef __WIN32__ /* 9 */ EXTERN int TclCreatePipeline _ANSI_ARGS_((Tcl_Interp * interp, - int argc, char ** argv, + int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); #endif /* __WIN32__ */ @@ -426,14 +426,14 @@ EXTERN int TclpCheckStackSpace _ANSI_ARGS_((void)); /* Slot 136 is reserved */ /* Slot 137 is reserved */ /* 138 */ -EXTERN char * TclGetEnv _ANSI_ARGS_((CONST char * name, +EXTERN CONST char * TclGetEnv _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* Slot 139 is reserved */ /* 140 */ EXTERN int TclLooksLikeInt _ANSI_ARGS_((CONST char * bytes, int length)); /* 141 */ -EXTERN char * TclpGetCwd _ANSI_ARGS_((Tcl_Interp * interp, +EXTERN CONST char * TclpGetCwd _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 142 */ EXTERN int TclSetByteCodeFromAny _ANSI_ARGS_(( @@ -525,10 +525,10 @@ typedef struct TclIntStubs { int (*tclCopyAndCollapse) _ANSI_ARGS_((int count, CONST char * src, char * dst)); /* 7 */ int (*tclCopyChannel) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj * cmdPtr)); /* 8 */ #if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ - int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */ + int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */ #endif /* UNIX */ #ifdef __WIN32__ - int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */ + int (*tclCreatePipeline) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, Tcl_Pid ** pidArrayPtr, TclFile * inPipePtr, TclFile * outPipePtr, TclFile * errFilePtr)); /* 9 */ #endif /* __WIN32__ */ #ifdef MAC_TCL void *reserved9; @@ -677,10 +677,10 @@ typedef struct TclIntStubs { int (*tclpCheckStackSpace) _ANSI_ARGS_((void)); /* 135 */ void *reserved136; void *reserved137; - char * (*tclGetEnv) _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* 138 */ + CONST char * (*tclGetEnv) _ANSI_ARGS_((CONST char * name, Tcl_DString * valuePtr)); /* 138 */ void *reserved139; int (*tclLooksLikeInt) _ANSI_ARGS_((CONST char * bytes, int length)); /* 140 */ - char * (*tclpGetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 141 */ + CONST char * (*tclpGetCwd) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_DString * cwdPtr)); /* 141 */ int (*tclSetByteCodeFromAny) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CompileHookProc * hookProc, ClientData clientData)); /* 142 */ int (*tclAddLiteralObj) _ANSI_ARGS_((struct CompileEnv * envPtr, Tcl_Obj * objPtr, LiteralEntry ** litPtrPtr)); /* 143 */ void (*tclHideLiteral) _ANSI_ARGS_((Tcl_Interp * interp, struct CompileEnv * envPtr, int index)); /* 144 */ diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 6025cb4..3ddaf22 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.14 2001/11/26 18:06:46 dgp Exp $ + * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.15 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCLINTPLATDECLS @@ -43,9 +43,9 @@ EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile * readPipe, TclFile * writePipe)); /* 4 */ EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp * interp, - int argc, char ** argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, - Tcl_Pid * pidPtr)); + int argc, CONST char ** argv, + TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid * pidPtr)); /* Slot 5 is reserved */ /* 6 */ EXTERN TclFile TclpMakeFile _ANSI_ARGS_((Tcl_Channel channel, @@ -101,9 +101,9 @@ EXTERN int TclpCreatePipe _ANSI_ARGS_((TclFile * readPipe, TclFile * writePipe)); /* 15 */ EXTERN int TclpCreateProcess _ANSI_ARGS_((Tcl_Interp * interp, - int argc, char ** argv, TclFile inputFile, - TclFile outputFile, TclFile errorFile, - Tcl_Pid * pidPtr)); + int argc, CONST char ** argv, + TclFile inputFile, TclFile outputFile, + TclFile errorFile, Tcl_Pid * pidPtr)); /* Slot 16 is reserved */ /* Slot 17 is reserved */ /* 18 */ @@ -209,7 +209,7 @@ typedef struct TclIntPlatStubs { int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 1 */ Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid * pidPtr)); /* 2 */ int (*tclpCreatePipe) _ANSI_ARGS_((TclFile * readPipe, TclFile * writePipe)); /* 3 */ - int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 4 */ + int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 4 */ void *reserved5; TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 6 */ TclFile (*tclpOpenFile) _ANSI_ARGS_((CONST char * fname, int mode)); /* 7 */ @@ -232,7 +232,7 @@ typedef struct TclIntPlatStubs { int (*tclpCloseFile) _ANSI_ARGS_((TclFile file)); /* 12 */ Tcl_Channel (*tclpCreateCommandChannel) _ANSI_ARGS_((TclFile readFile, TclFile writeFile, TclFile errorFile, int numPids, Tcl_Pid * pidPtr)); /* 13 */ int (*tclpCreatePipe) _ANSI_ARGS_((TclFile * readPipe, TclFile * writePipe)); /* 14 */ - int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 15 */ + int (*tclpCreateProcess) _ANSI_ARGS_((Tcl_Interp * interp, int argc, CONST char ** argv, TclFile inputFile, TclFile outputFile, TclFile errorFile, Tcl_Pid * pidPtr)); /* 15 */ void *reserved16; void *reserved17; TclFile (*tclpMakeFile) _ANSI_ARGS_((Tcl_Channel channel, int direction)); /* 18 */ diff --git a/generic/tclLink.c b/generic/tclLink.c index 20f9191..3066557 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLink.c,v 1.3 1999/04/16 00:46:49 stanton Exp $ + * RCS: @(#) $Id: tclLink.c,v 1.4 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -235,7 +235,8 @@ LinkTraceProc(clientData, interp, name1, name2, flags) Link *linkPtr = (Link *) clientData; int changed; char buffer[TCL_DOUBLE_SPACE]; - char *value, **pp, *result; + CONST char *value; + char **pp, *result; Tcl_Obj *objPtr; /* @@ -364,7 +365,7 @@ LinkTraceProc(clientData, interp, name1, name2, flags) strcpy(*pp, value); break; default: - return "internal error: bad linked variable type"; + result = "internal error: bad linked variable type"; } end: Tcl_DecrRefCount(objPtr); diff --git a/generic/tclMain.c b/generic/tclMain.c index 05b8278..53dc064 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.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: tclMain.c,v 1.16 2002/01/07 17:54:52 dgp Exp $ + * RCS: @(#) $Id: tclMain.c,v 1.17 2002/01/25 20:40:55 dgp Exp $ */ #include "tcl.h" @@ -242,7 +242,14 @@ Tcl_Main(argc, argv, appInitProc) argv++; } } - args = Tcl_Merge(argc-1, argv+1); + + /* + * The CONST casting is safe, and better we do it here than force + * all callers of Tcl_Main to do it. (Those callers are likely + * in a main() that can't easily change its signature.) + */ + + args = Tcl_Merge(argc-1, (CONST char **)argv+1); Tcl_ExternalToUtfDString(NULL, args, -1, &argString); Tcl_SetVar(interp, "argv", Tcl_DStringValue(&argString), TCL_GLOBAL_ONLY); Tcl_DStringFree(&argString); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index e37aa09..56dac90 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.26 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.27 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -720,7 +720,8 @@ TclTeardownNamespace(nsPtr) * variables, in case they had any traces on them. */ - char *str, *errorInfoStr, *errorCodeStr; + CONST char *str; + char *errorInfoStr, *errorCodeStr; str = Tcl_GetVar((Tcl_Interp *) iPtr, "errorInfo", TCL_GLOBAL_ONLY); if (str != NULL) { diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 931f2a7..dcfabdf 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.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: tclPipe.c,v 1.4 2002/01/15 21:19:07 dgp Exp $ + * RCS: @(#) $Id: tclPipe.c,v 1.5 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -39,8 +39,9 @@ TCL_DECLARE_MUTEX(pipeMutex) /* Guard access to detList. */ */ static TclFile FileForRedirect _ANSI_ARGS_((Tcl_Interp *interp, - char *spec, int atOk, char *arg, char *nextArg, - int flags, int *skipPtr, int *closePtr, int *releasePtr)); + CONST char *spec, int atOk, CONST char *arg, + CONST char *nextArg, int flags, int *skipPtr, + int *closePtr, int *releasePtr)); /* *---------------------------------------------------------------------- @@ -67,14 +68,14 @@ static TclFile FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr, releasePtr) Tcl_Interp *interp; /* Intepreter to use for error reporting. */ - char *spec; /* Points to character just after + CONST char *spec; /* Points to character just after * redirection character. */ - char *arg; /* Pointer to entire argument containing + CONST char *arg; /* Pointer to entire argument containing * spec: used for error reporting. */ int atOK; /* Non-zero means that '@' notation can be * used to specify a channel, zero means that * it isn't. */ - char *nextArg; /* Next argument in argc/argv array, if needed + CONST char *nextArg; /* Next argument in argc/argv array, if needed * for file name or channel name. May be * NULL. */ int flags; /* Flags to use for opening file or to @@ -123,7 +124,7 @@ FileForRedirect(interp, spec, atOK, arg, nextArg, flags, skipPtr, closePtr, Tcl_Flush(chan); } } else { - char *name; + CONST char *name; Tcl_DString nameString; if (*spec == '\0') { @@ -439,7 +440,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ int argc; /* Number of entries in argv. */ - char **argv; /* Array of strings describing commands in + CONST char **argv; /* Array of strings describing commands in * pipeline plus I/O redirection with <, * <<, >, etc. Argv[argc] must be NULL. */ Tcl_Pid **pidArrayPtr; /* Word at *pidArrayPtr gets filled in with @@ -476,7 +477,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, * at *pidPtr right now. */ int cmdCount; /* Count of number of distinct commands * found in argc/argv. */ - char *inputLiteral = NULL; /* If non-null, then this points to a + CONST char *inputLiteral = NULL; /* If non-null, then this points to a * string containing input data (specified * via <<) to be piped to the first process * in the pipeline. */ @@ -498,7 +499,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, int errorClose = 0; /* If non-zero, then errorFile should be * closed when cleaning up. */ int errorRelease = 0; - char *p; + CONST char *p; int skip, lastBar, lastArg, i, j, atOK, flags, errorToOutput; Tcl_DString execBuffer; TclFile pipeIn; @@ -802,7 +803,7 @@ TclCreatePipeline(interp, argc, argv, pidArrayPtr, inPipePtr, for (i = 0; i < argc; i = lastArg + 1) { int result, joinThisError; Tcl_Pid pid; - char *oldName; + CONST char *oldName; /* * Convert the program name into native form. @@ -992,7 +993,7 @@ Tcl_OpenCommandChannel(interp, argc, argv, flags) Tcl_Interp *interp; /* Interpreter for error reporting. Can * NOT be NULL. */ int argc; /* How many arguments. */ - char **argv; /* Array of arguments for command pipe. */ + CONST char **argv; /* Array of arguments for command pipe. */ int flags; /* Or'ed combination of TCL_STDIN, TCL_STDOUT, * TCL_STDERR, and TCL_ENFORCE_MODE. */ { diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index 10430bc..f4ad40b 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -6,7 +6,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclPlatDecls.h,v 1.12 2001/09/09 22:45:13 davygrvy Exp $ + * RCS: @(#) $Id: tclPlatDecls.h,v 1.13 2002/01/25 20:40:55 dgp Exp $ */ #ifndef _TCLPLATDECLS @@ -49,12 +49,12 @@ EXTERN char * Tcl_MacConvertTextResource _ANSI_ARGS_(( Handle resource)); /* 2 */ EXTERN int Tcl_MacEvalResource _ANSI_ARGS_((Tcl_Interp * interp, - char * resourceName, int resourceNumber, - char * fileName)); + CONST char * resourceName, + int resourceNumber, CONST char * fileName)); /* 3 */ EXTERN Handle Tcl_MacFindResource _ANSI_ARGS_((Tcl_Interp * interp, - long resourceType, char * resourceName, - int resourceNumber, char * resFileRef, + long resourceType, CONST char * resourceName, + int resourceNumber, CONST char * resFileRef, int * releaseIt)); /* 4 */ EXTERN int Tcl_GetOSTypeFromObj _ANSI_ARGS_(( @@ -84,8 +84,8 @@ typedef struct TclPlatStubs { #ifdef MAC_TCL void (*tcl_MacSetEventProc) _ANSI_ARGS_((Tcl_MacConvertEventPtr procPtr)); /* 0 */ char * (*tcl_MacConvertTextResource) _ANSI_ARGS_((Handle resource)); /* 1 */ - int (*tcl_MacEvalResource) _ANSI_ARGS_((Tcl_Interp * interp, char * resourceName, int resourceNumber, char * fileName)); /* 2 */ - Handle (*tcl_MacFindResource) _ANSI_ARGS_((Tcl_Interp * interp, long resourceType, char * resourceName, int resourceNumber, char * resFileRef, int * releaseIt)); /* 3 */ + int (*tcl_MacEvalResource) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * resourceName, int resourceNumber, CONST char * fileName)); /* 2 */ + Handle (*tcl_MacFindResource) _ANSI_ARGS_((Tcl_Interp * interp, long resourceType, CONST char * resourceName, int resourceNumber, CONST char * resFileRef, int * releaseIt)); /* 3 */ int (*tcl_GetOSTypeFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, OSType * osTypePtr)); /* 4 */ void (*tcl_SetOSTypeObj) _ANSI_ARGS_((Tcl_Obj * objPtr, OSType osType)); /* 5 */ Tcl_Obj * (*tcl_NewOSTypeObj) _ANSI_ARGS_((OSType osType)); /* 6 */ diff --git a/generic/tclProc.c b/generic/tclProc.c index f73f8a7..f1e7510 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.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: tclProc.c,v 1.35 2001/12/10 15:44:34 msofer Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.36 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -235,11 +235,11 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr) Proc **procPtrPtr; /* returns: pointer to proc data */ { Interp *iPtr = (Interp*)interp; - char **argArray = NULL; + CONST char **argArray = NULL; register Proc *procPtr; int i, length, result, numArgs; - char *args, *bytes, *p; + CONST char *args, *bytes, *p; register CompiledLocal *localPtr = NULL; Tcl_Obj *defPtr; int precompiled = 0; @@ -335,7 +335,7 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr) } for (i = 0; i < numArgs; i++) { int fieldCount, nameLength, valueLength; - char **fieldValues; + CONST char **fieldValues; /* * Now divide the specifier up into name and default. @@ -375,7 +375,7 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr) p = fieldValues[0]; while (*p != '\0') { if (*p == '(') { - char *q = p; + CONST char *q = p; do { q++; } while (*q != '\0'); diff --git a/generic/tclResult.c b/generic/tclResult.c index 663f47f..367ca80 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.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: tclResult.c,v 1.4 1999/10/21 02:16:22 hobbs Exp $ + * RCS: @(#) $Id: tclResult.c,v 1.5 2002/01/25 20:40:55 dgp Exp $ */ #include "tclInt.h" @@ -297,7 +297,7 @@ Tcl_SetResult(interp, string, freeProc) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_GetStringResult(interp) register Tcl_Interp *interp; /* Interpreter whose result to return. */ { diff --git a/generic/tclTest.c b/generic/tclTest.c index 8eec071..8119004 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.40 2002/01/21 21:05:58 dgp Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.41 2002/01/25 20:40:55 dgp Exp $ */ #define TCL_TEST @@ -341,7 +341,7 @@ static Tcl_Channel TestReportOpenFileChannel _ANSI_ARGS_ (( CONST char *modeString, int permissions)); static int TestReportMatchInDirectory _ANSI_ARGS_ (( Tcl_Interp *interp, Tcl_Obj *resultPtr, - Tcl_Obj *dirPtr, char *pattern, + Tcl_Obj *dirPtr, CONST char *pattern, Tcl_GlobTypeData *types)); static int TestReportChdir _ANSI_ARGS_ ((Tcl_Obj *dirName)); static int TestReportLstat _ANSI_ARGS_ ((Tcl_Obj *path, @@ -753,12 +753,12 @@ AsyncHandlerProc(clientData, interp, code) int code; /* Current return code from command. */ { TestAsyncHandler *asyncPtr = (TestAsyncHandler *) clientData; - char *listArgv[4]; + CONST char *listArgv[4]; char string[TCL_INTEGER_SPACE], *cmd; TclFormatInt(string, code); listArgv[0] = asyncPtr->command; - listArgv[1] = Tcl_GetStringResult(interp); + listArgv[1] = Tcl_GetString(Tcl_GetObjResult(interp)); listArgv[2] = string; listArgv[3] = NULL; cmd = Tcl_Merge(3, listArgv); @@ -2841,7 +2841,8 @@ TestregexpObjCmd(dummy, interp, objc, objv) Tcl_SetIntObj(Tcl_GetObjResult(interp), 0); if (objc > 2 && (cflags®_EXPECT) && indices) { - char *varName, *value; + char *varName; + CONST char *value; int start, end; char info[TCL_INTEGER_SPACE * 2]; @@ -3254,7 +3255,7 @@ TesttranslatefilenameCmd(dummy, interp, argc, argv) char **argv; /* Argument strings. */ { Tcl_DString buffer; - char *result; + CONST char *result; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", @@ -3466,7 +3467,7 @@ TestpanicCmd(dummy, interp, argc, argv) * Append all of the arguments together separated by spaces */ - argString = Tcl_Merge(argc-1, argv+1); + argString = Tcl_Merge(argc-1, (CONST char **) argv+1); panic(argString); ckfree(argString); @@ -3516,13 +3517,14 @@ TestchmodCmd(dummy, interp, argc, argv) for (i = 2; i < argc; i++) { Tcl_DString buffer; + CONST char *translated; - argv[i] = Tcl_TranslateFileName(interp, argv[i], &buffer); - if (argv[i] == NULL) { + translated = Tcl_TranslateFileName(interp, argv[i], &buffer); + if (translated == NULL) { return TCL_ERROR; } - if (chmod(argv[i], (unsigned) mode) != 0) { - Tcl_AppendResult(interp, argv[i], ": ", Tcl_PosixError(interp), + if (chmod(translated, (unsigned) mode) != 0) { + Tcl_AppendResult(interp, translated, ": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } @@ -3707,7 +3709,7 @@ GetTimesCmd(unused, interp, argc, argv) Tcl_Time start, stop; Tcl_Obj *objPtr; Tcl_Obj **objv; - char *s; + CONST char *s; char newString[TCL_INTEGER_SPACE]; /* alloc & free 100000 times */ @@ -3937,7 +3939,7 @@ TestsetCmd(data, interp, argc, argv) char **argv; /* Argument strings. */ { int flags = (int) data; - char *value; + CONST char *value; if (argc == 2) { Tcl_SetResult(interp, "before get", TCL_STATIC); @@ -4549,7 +4551,7 @@ TestOpenFileChannelProc1(interp, fileName, modeString, permissions) * file, with what modes to create * it? */ { - char *expectname="testOpenFileChannel1%.fil"; + CONST char *expectname="testOpenFileChannel1%.fil"; Tcl_DString ds; Tcl_DStringInit(&ds); @@ -4577,7 +4579,7 @@ TestOpenFileChannelProc2(interp, fileName, modeString, permissions) * file, with what modes to create * it? */ { - char *expectname="testOpenFileChannel2%.fil"; + CONST char *expectname="testOpenFileChannel2%.fil"; Tcl_DString ds; Tcl_DStringInit(&ds); @@ -4605,7 +4607,7 @@ TestOpenFileChannelProc3(interp, fileName, modeString, permissions) * file, with what modes to create * it? */ { - char *expectname="testOpenFileChannel3%.fil"; + CONST char *expectname="testOpenFileChannel3%.fil"; Tcl_DString ds; Tcl_DStringInit(&ds); @@ -5552,7 +5554,7 @@ TestReportMatchInDirectory(interp, resultPtr, dirPtr, pattern, types) Tcl_Interp *interp; /* Interpreter to receive results. */ Tcl_Obj *resultPtr; /* Directory separators to pass to TclDoGlob. */ Tcl_Obj *dirPtr; /* Contains path to directory to search. */ - char *pattern; /* Pattern to match against. */ + CONST char *pattern; /* Pattern to match against. */ Tcl_GlobTypeData *types; /* Object containing list of acceptable types. * May be NULL. */ { diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 651c820..ef98e53 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclThreadTest.c,v 1.14 2002/01/18 03:22:31 das Exp $ + * RCS: @(#) $Id: tclThreadTest.c,v 1.15 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -546,8 +546,8 @@ ThreadErrorProc(interp) Tcl_Interp *interp; /* Interp that failed */ { Tcl_Channel errChannel; - char *errorInfo, *script; - char *argv[3]; + CONST char *errorInfo, *argv[3]; + char *script; char buf[TCL_DOUBLE_SPACE+1]; sprintf(buf, "%ld", (long) Tcl_GetCurrentThread()); @@ -853,7 +853,7 @@ ThreadEventProc(evPtr, mask) ThreadEventResult *resultPtr = threadEventPtr->resultPtr; Tcl_Interp *interp = tsdPtr->interp; int code; - char *result, *errorCode, *errorInfo; + CONST char *result, *errorCode, *errorInfo; if (interp == NULL) { code = TCL_ERROR; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 52a5566..7cdded7 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.27 2002/01/02 13:52:04 dkf Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.28 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -420,10 +420,10 @@ Tcl_SplitList(interp, list, argcPtr, argvPtr) CONST char *list; /* Pointer to string with list structure. */ int *argcPtr; /* Pointer to location to fill in with * the number of elements in the list. */ - char ***argvPtr; /* Pointer to place to store pointer to + CONST char ***argvPtr; /* Pointer to place to store pointer to * array of pointers to list elements. */ { - char **argv; + CONST char **argv; CONST char *l; char *p; int length, size, i, result, elSize, brace; @@ -442,7 +442,7 @@ Tcl_SplitList(interp, list, argcPtr, argvPtr) } } size++; /* Leave space for final NULL pointer. */ - argv = (char **) ckalloc((unsigned) + argv = (CONST char **) ckalloc((unsigned) ((size * sizeof(char *)) + (l - list) + 1)); length = strlen(list); for (i = 0, p = ((char *) argv) + size*sizeof(char *); @@ -847,7 +847,7 @@ Tcl_ConvertCountedElement(src, length, dst, flags) char * Tcl_Merge(argc, argv) int argc; /* How many strings to merge. */ - char * CONST *argv; /* Array of string values. */ + CONST char * CONST *argv; /* Array of string values. */ { # define LOCAL_SIZE 20 int localFlags[LOCAL_SIZE], *flagPtr; @@ -950,7 +950,7 @@ Tcl_Backslash(src, readPtr) char * Tcl_Concat(argc, argv) int argc; /* Number of strings to concatenate. */ - char * CONST *argv; /* Array of strings to concatenate. */ + CONST char * CONST *argv; /* Array of strings to concatenate. */ { int totalSize, i; char *p; @@ -1882,7 +1882,8 @@ TclPrecTraceProc(clientData, interp, name1, name2, flags) char *name2; /* Second part of variable name. */ int flags; /* Information about what happened. */ { - char *value, *end; + CONST char *value; + char *end; int prec; /* diff --git a/generic/tclVar.c b/generic/tclVar.c index 238f6ff..f632780 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.45 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.46 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -474,7 +474,7 @@ TclLookupVar(interp, part1, part2, flags, msg, createPart1, createPart2, *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_GetVar(interp, varName, flags) Tcl_Interp *interp; /* Command interpreter in which varName is * to be looked up. */ @@ -509,7 +509,7 @@ Tcl_GetVar(interp, varName, flags) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_GetVar2(interp, part1, part2, flags) Tcl_Interp *interp; /* Command interpreter in which variable is * to be looked up. */ @@ -1063,12 +1063,12 @@ Tcl_SetObjCmd(dummy, interp, objc, objv) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_SetVar(interp, varName, newValue, flags) Tcl_Interp *interp; /* Command interpreter in which varName is * to be looked up. */ char *varName; /* Name of a variable in interp. */ - char *newValue; /* New value for varName. */ + CONST char *newValue; /* New value for varName. */ int flags; /* Various flags that tell how to set value: * any of TCL_GLOBAL_ONLY, * TCL_NAMESPACE_ONLY, TCL_APPEND_VALUE, @@ -1104,7 +1104,7 @@ Tcl_SetVar(interp, varName, newValue, flags) *---------------------------------------------------------------------- */ -char * +CONST char * Tcl_SetVar2(interp, part1, part2, newValue, flags) Tcl_Interp *interp; /* Command interpreter in which variable is * to be looked up. */ @@ -1113,7 +1113,7 @@ Tcl_SetVar2(interp, part1, part2, newValue, flags) * an array. */ char *part2; /* Name of an element within an array, or * NULL. */ - char *newValue; /* New value for variable. */ + CONST char *newValue; /* New value for variable. */ int flags; /* Various flags that tell how to set value: * any of TCL_GLOBAL_ONLY, * TCL_NAMESPACE_ONLY, TCL_APPEND_VALUE, diff --git a/mac/tclMacFCmd.c b/mac/tclMacFCmd.c index 27196f5..bf13e5c 100644 --- a/mac/tclMacFCmd.c +++ b/mac/tclMacFCmd.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: tclMacFCmd.c,v 1.13 2002/01/18 03:22:40 das Exp $ + * RCS: @(#) $Id: tclMacFCmd.c,v 1.14 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -1027,7 +1027,7 @@ GetFileSpecs( char *dirName; OSErr err; int argc; - char **argv; + CONST char **argv; long d; Tcl_DString buffer; diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c index d38d784..921ada5 100644 --- a/mac/tclMacFile.c +++ b/mac/tclMacFile.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: tclMacFile.c,v 1.14 2002/01/18 03:22:52 das Exp $ + * RCS: @(#) $Id: tclMacFile.c,v 1.15 2002/01/25 20:40:56 dgp Exp $ */ /* @@ -128,7 +128,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) Tcl_Interp *interp; /* Interpreter to receive errors. */ Tcl_Obj *resultPtr; /* List object to lappend results. */ Tcl_Obj *pathPtr; /* Contains path to directory to search. */ - char *pattern; /* Pattern to match against. */ + CONST char *pattern; /* Pattern to match against. */ Tcl_GlobTypeData *types; /* Object containing list of acceptable types. * May be NULL. In particular the directory * flag is very important. */ @@ -541,7 +541,7 @@ TclpObjGetCwd(interp) } } -char * +CONST char * TclpGetCwd( Tcl_Interp *interp, /* If non-NULL, used for error reporting. */ Tcl_DString *bufferPtr) /* Uninitialized or free DString filled diff --git a/mac/tclMacInit.c b/mac/tclMacInit.c index b10a0bd..451e377 100644 --- a/mac/tclMacInit.c +++ b/mac/tclMacInit.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: tclMacInit.c,v 1.6 2001/12/27 22:46:19 das Exp $ + * RCS: @(#) $Id: tclMacInit.c,v 1.7 2002/01/25 20:40:56 dgp Exp $ */ #include <AppleEvents.h> @@ -354,7 +354,7 @@ TclpInitLibraryPath(argv0) * by querying the module handle. */ { Tcl_Obj *objPtr, *pathPtr; - char *str; + CONST char *str; Tcl_DString ds; TclMacCreateEnv(); @@ -395,7 +395,7 @@ TclpInitLibraryPath(argv0) str = TclGetEnv("EXT_FOLDER", &ds); if ((str != NULL) && (str[0] != '\0')) { Tcl_DString libPath, path; - char *argv[3]; + CONST char *argv[3]; argv[0] = str; argv[1] = "Tool Command Language"; @@ -739,7 +739,7 @@ Tcl_SourceRCFile( Tcl_Interp *interp) /* Interpreter to source rc file into. */ { Tcl_DString temp; - char *fileName; + CONST char *fileName; Tcl_Channel errChannel; Handle h; @@ -747,7 +747,7 @@ Tcl_SourceRCFile( if (fileName != NULL) { Tcl_Channel c; - char *fullName; + CONST char *fullName; Tcl_DStringInit(&temp); fullName = Tcl_TranslateFileName(interp, fileName, &temp); diff --git a/mac/tclMacOSA.c b/mac/tclMacOSA.c index dce052e..8402df5 100644 --- a/mac/tclMacOSA.c +++ b/mac/tclMacOSA.c @@ -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: tclMacOSA.c,v 1.7 2001/11/23 01:27:57 das Exp $ + * RCS: @(#) $Id: tclMacOSA.c,v 1.8 2002/01/25 20:40:56 dgp Exp $ */ #define MAC_TCL @@ -2068,7 +2068,7 @@ tclOSAStore( char idStr[16 + TCL_INTEGER_SPACE]; FSSpec fileSpec; Tcl_DString buffer; - char *nativeName; + CONST char *nativeName; OSErr myErr = noErr; OSAID scriptID; Size scriptSize; @@ -2287,7 +2287,7 @@ tclOSALoad( char idStr[16 + TCL_INTEGER_SPACE]; FSSpec fileSpec; Tcl_DString buffer; - char *nativeName; + CONST char *nativeName; saveRef = CurResFile(); diff --git a/mac/tclMacResource.c b/mac/tclMacResource.c index 4f72b9e..858bc1e 100644 --- a/mac/tclMacResource.c +++ b/mac/tclMacResource.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacResource.c,v 1.9 2002/01/18 03:23:02 das Exp $ + * RCS: @(#) $Id: tclMacResource.c,v 1.10 2002/01/25 20:40:56 dgp Exp $ */ #include <Errors.h> @@ -1235,10 +1235,10 @@ SetSoundVolume( int Tcl_MacEvalResource( Tcl_Interp *interp, /* Interpreter in which to process file. */ - char *resourceName, /* Name of TEXT resource to source, + CONST char *resourceName, /* Name of TEXT resource to source, NULL if number should be used. */ int resourceNumber, /* Resource id of source. */ - char *fileName) /* Name of file to process. + CONST char *fileName) /* Name of file to process. NULL if application resource. */ { Handle sourceText; @@ -1249,7 +1249,7 @@ Tcl_MacEvalResource( char idStr[64]; FSSpec fileSpec; Tcl_DString buffer; - char *nativeName; + CONST char *nativeName; saveRef = CurResFile(); @@ -1420,10 +1420,10 @@ Handle Tcl_MacFindResource( Tcl_Interp *interp, /* Interpreter in which to process file. */ long resourceType, /* Type of resource to load. */ - char *resourceName, /* Name of resource to find, + CONST char *resourceName, /* Name of resource to find, * NULL if number should be used. */ int resourceNumber, /* Resource id of source. */ - char *resFileRef, /* Registered resource file reference, + CONST char *resFileRef, /* Registered resource file reference, * NULL if searching all open resource files. */ int *releaseIt) /* Should we release this resource when done. */ { @@ -1462,15 +1462,17 @@ Tcl_MacFindResource( resource = GetResource(resourceType, resourceNumber); } } else { - c2pstr(resourceName); + Tcl_DString ds; + char *native = Tcl_UtfToExternalDString(NULL, resourceName, -1, &ds); + c2pstr(native); if (limitSearch) { resource = Get1NamedResource(resourceType, - (StringPtr) resourceName); + (StringPtr) native); } else { resource = GetNamedResource(resourceType, (StringPtr) resourceName); } - p2cstr((StringPtr) resourceName); + Tcl_DStringFree(&ds); } if (*resource == NULL) { diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index ee76818..a48c2ee 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.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: tclUnixFCmd.c,v 1.14 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclUnixFCmd.c,v 1.15 2002/01/25 20:40:56 dgp Exp $ * * Portions of this code were derived from NetBSD source code which has * the following copyright notice: @@ -1647,7 +1647,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint) if ((cur == '/' || cur == 0) && (path != currentPathEndPosition)) { /* Reached directory separator, or end of string */ Tcl_DString ds; - char *nativePath; + CONST char *nativePath; int accessOk; nativePath = Tcl_UtfToExternalDString(NULL, path, diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index eb215c9..031ece8 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.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: tclUnixFile.c,v 1.14 2002/01/17 04:37:33 dgp Exp $ + * RCS: @(#) $Id: tclUnixFile.c,v 1.15 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -196,12 +196,12 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) Tcl_Interp *interp; /* Interpreter to receive errors. */ Tcl_Obj *resultPtr; /* List object to lappend results. */ Tcl_Obj *pathPtr; /* Contains path to directory to search. */ - char *pattern; /* Pattern to match against. */ + CONST char *pattern; /* Pattern to match against. */ Tcl_GlobTypeData *types; /* Object containing list of acceptable types. * May be NULL. In particular the directory * flag is very important. */ { - char *native, *fname, *dirName; + CONST char *native, *fname, *dirName; DIR *d; Tcl_DString ds; struct stat statBuf; @@ -294,7 +294,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) while (1) { Tcl_DString utfDs; - char *utf; + CONST char *utf; struct dirent *entryPtr; entryPtr = readdir(d); /* INTL: Native. */ @@ -460,7 +460,7 @@ TclpGetUserHome(name, bufferPtr) { struct passwd *pwPtr; Tcl_DString ds; - char *native; + CONST char *native; native = Tcl_UtfToExternalDString(NULL, name, -1, &ds); pwPtr = getpwnam(native); /* INTL: Native. */ @@ -598,7 +598,7 @@ TclpObjGetCwd(interp) } /* Older string based version */ -char * +CONST char * TclpGetCwd(interp, bufferPtr) Tcl_Interp *interp; /* If non-NULL, used for error reporting. */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled @@ -649,7 +649,7 @@ TclpReadlink(path, linkPtr) { char link[MAXPATHLEN]; int length; - char *native; + CONST char *native; Tcl_DString ds; native = Tcl_UtfToExternalDString(NULL, path, -1, &ds); diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 32ee2ba..8ff747f 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.28 2001/11/20 09:24:55 hobbs Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.29 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -236,10 +236,10 @@ CONST char *path; /* Path to the executable in native { #define LIBRARY_SIZE 32 Tcl_Obj *pathPtr, *objPtr; - char *str; + CONST char *str; Tcl_DString buffer, ds; int pathc; - char **pathv; + CONST char **pathv; char installLib[LIBRARY_SIZE], developLib[LIBRARY_SIZE]; Tcl_DStringInit(&ds); @@ -679,7 +679,7 @@ TclpSetVariables(interp) struct utsname name; #endif int unameOK; - char *user; + CONST char *user; Tcl_DString ds; Tcl_SetVar(interp, "tclDefaultLibrary", defaultLibraryDir, TCL_GLOBAL_ONLY); @@ -688,7 +688,7 @@ TclpSetVariables(interp) unameOK = 0; #ifndef NO_UNAME if (uname(&name) >= 0) { - char *native; + CONST char *native; unameOK = 1; @@ -863,14 +863,14 @@ Tcl_SourceRCFile(interp) Tcl_Interp *interp; /* Interpreter to source rc file into. */ { Tcl_DString temp; - char *fileName; + CONST char *fileName; Tcl_Channel errChannel; fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY); if (fileName != NULL) { Tcl_Channel c; - char *fullName; + CONST char *fullName; Tcl_DStringInit(&temp); fullName = Tcl_TranslateFileName(interp, fileName, &temp); diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index e6187b0..581fee5 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.18 2002/01/15 17:55:30 dgp Exp $ + * RCS: @(#) $Id: tclUnixPipe.c,v 1.19 2002/01/25 20:40:56 dgp Exp $ */ #include "tclInt.h" @@ -136,7 +136,7 @@ TclpOpenFile(fname, mode) int mode; /* In what mode to open the file? */ { int fd; - char *native; + CONST char *native; Tcl_DString ds; native = Tcl_UtfToExternalDString(NULL, fname, -1, &ds); @@ -186,7 +186,8 @@ TclFile TclpCreateTempFile(contents) CONST char *contents; /* String to write into temp file, or NULL. */ { - char fileName[L_tmpnam + 9], *native; + char fileName[L_tmpnam + 9]; + CONST char *native; Tcl_DString dstring; int fd; @@ -367,7 +368,7 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile, * Error messages from the child process * itself are sent to errorFile. */ int argc; /* Number of arguments in following array. */ - char **argv; /* Array of argument strings in UTF-8. + CONST char **argv; /* Array of argument strings in UTF-8. * argv[0] contains the name of the executable * translated using Tcl_TranslateFileName * call). Additional arguments have not been @@ -420,7 +421,8 @@ TclpCreateProcess(interp, argc, argv, inputFile, outputFile, errorFile, newArgv = (char **) ckalloc((argc+1) * sizeof(char *)); newArgv[argc] = NULL; for (i = 0; i < argc; i++) { - newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]); + Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]); + newArgv[i] = Tcl_DStringValue(&dsArray[i]); } joinThisError = errorFile && (errorFile == outputFile); diff --git a/win/tclWinFile.c b/win/tclWinFile.c index c7db3fd..29f8fef 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.22 2002/01/24 01:34:16 dgp Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.23 2002/01/25 20:40:56 dgp Exp $ */ #include "tclWinInt.h" @@ -114,7 +114,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) Tcl_Interp *interp; /* Interpreter to receive errors. */ Tcl_Obj *resultPtr; /* List object to lappend results. */ Tcl_Obj *pathPtr; /* Contains path to directory to search. */ - char *pattern; /* Pattern to match against. */ + CONST char *pattern; /* Pattern to match against. */ Tcl_GlobTypeData *types; /* Object containing list of acceptable types. * May be NULL. In particular the directory * flag is very important. */ @@ -775,7 +775,7 @@ TclpReadlink(path, linkPtr) *---------------------------------------------------------------------- */ -char * +CONST char * TclpGetCwd(interp, bufferPtr) Tcl_Interp *interp; /* If non-NULL, used for error reporting. */ Tcl_DString *bufferPtr; /* Uninitialized or free DString filled diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 219f193..771081b 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclWinInit.c,v 1.31 2001/10/01 20:58:52 hobbs Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.32 2002/01/25 20:40:56 dgp Exp $ */ #include "tclWinInt.h" @@ -172,10 +172,10 @@ TclpInitLibraryPath(path) { #define LIBRARY_SIZE 32 Tcl_Obj *pathPtr, *objPtr; - char *str; + CONST char *str; Tcl_DString ds; int pathc; - char **pathv; + CONST char **pathv; char installLib[LIBRARY_SIZE], developLib[LIBRARY_SIZE]; Tcl_DStringInit(&ds); @@ -562,7 +562,7 @@ void TclpSetVariables(interp) Tcl_Interp *interp; /* Interp to initialize. */ { - char *ptr; + CONST char *ptr; char buffer[TCL_INTEGER_SPACE * 2]; SYSTEM_INFO sysInfo; OemId *oemId; @@ -791,14 +791,14 @@ Tcl_SourceRCFile(interp) Tcl_Interp *interp; /* Interpreter to source rc file into. */ { Tcl_DString temp; - char *fileName; + CONST char *fileName; Tcl_Channel errChannel; fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY); if (fileName != NULL) { Tcl_Channel c; - char *fullName; + CONST char *fullName; Tcl_DStringInit(&temp); fullName = Tcl_TranslateFileName(interp, fileName, &temp); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 2fc0d5d..3380942 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.21 2002/01/15 17:55:31 dgp Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.22 2002/01/25 20:40:56 dgp Exp $ */ #include "tclWinInt.h" @@ -180,7 +180,7 @@ typedef struct PipeEvent { static int ApplicationType(Tcl_Interp *interp, const char *fileName, char *fullName); static void BuildCommandLine(const char *executable, int argc, - char **argv, Tcl_DString *linePtr); + CONST char **argv, Tcl_DString *linePtr); static BOOL HasConsole(void); static int PipeBlockModeProc(ClientData instanceData, int mode); static void PipeCheckProc(ClientData clientData, int flags); @@ -949,7 +949,7 @@ TclpCreateProcess( * Error messages from the child process * itself are sent to errorFile. */ int argc, /* Number of arguments in following array. */ - char **argv, /* Array of argument strings. argv[0] + CONST char **argv, /* Array of argument strings. argv[0] * contains the name of the executable * converted to native format (using the * Tcl_TranslateFileName call). Additional @@ -1524,7 +1524,7 @@ BuildCommandLine( CONST char *executable, /* Full path of executable (including * extension). Replacement for argv[0]. */ int argc, /* Number of arguments. */ - char **argv, /* Argument strings in UTF. */ + CONST char **argv, /* Argument strings in UTF. */ Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the * command line (TCHAR). */ { |