From 6ad116f411885307607d5bebcd6a987ebfafff40 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 20 Feb 2007 23:24:02 +0000 Subject: various "const" additions, in line with TIP #27 --- ChangeLog | 10 +++ generic/regc_locale.c | 22 +++--- generic/regcomp.c | 18 ++--- generic/regerror.c | 8 +- generic/tclBasic.c | 202 ++++++++++++++++++++++++------------------------ generic/tclBinary.c | 35 +++++---- generic/tclCompExpr.c | 62 +++++++-------- generic/tclCompile.c | 32 ++++---- generic/tclDate.c | 8 +- generic/tclExecute.c | 137 ++++++++++++++++---------------- generic/tclFileName.c | 79 +++++++++---------- generic/tclHash.c | 42 +++++----- generic/tclIOCmd.c | 56 +++++++------- generic/tclIORChan.c | 72 ++++++++--------- generic/tclIOSock.c | 8 +- generic/tclIOUtil.c | 120 ++++++++++++++--------------- generic/tclInt.decls | 7 +- generic/tclIntDecls.h | 9 ++- generic/tclLiteral.c | 8 +- generic/tclLoad.c | 17 ++-- generic/tclPathObj.c | 52 ++++++------- generic/tclRegexp.c | 36 ++++----- generic/tclStrToD.c | 16 ++-- generic/tclVar.c | 210 +++++++++++++++++++++++++------------------------- unix/tclUnixChan.c | 62 +++++++-------- unix/tclUnixPipe.c | 22 +++--- win/tclWinPipe.c | 34 ++++---- win/tclWinSock.c | 28 +++---- 28 files changed, 713 insertions(+), 699 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89a69ae..f282782 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-20 Jan Nijtmans + + * generic/tclInt.decls: Added "const" specifiers in TclSockGetPort + * generic/tclIntDecls.h: regenerated + * generic/*.c: + * unix/tclUnixChan.c + * unix/tclUnixPipe.c + * win/tclWinPipe.c + * win/tclWinSock.c: Added many "const" specifiers in implementation. + 2007-02-20 Don Porter * doc/tcltest.n: Typo fix. [Bug 1663539] diff --git a/generic/regc_locale.c b/generic/regc_locale.c index e6eb12a..a3b82d4 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -9,14 +9,14 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: regc_locale.c,v 1.14 2006/07/20 06:17:38 das Exp $ + * RCS: @(#) $Id: regc_locale.c,v 1.15 2007/02/20 23:24:04 nijtmans Exp $ */ /* ASCII character-name table */ static struct cname { - char *name; - char code; + const char *name; + const char code; } cnames[] = { {"NUL", '\0'}, {"SOH", '\001'}, @@ -660,7 +660,7 @@ element( struct cname *cn; size_t len; Tcl_DString ds; - CONST char *np; + const char *np; /* * Generic: one-chr names stand for themselves. @@ -830,15 +830,15 @@ cclass( size_t len; struct cvec *cv = NULL; Tcl_DString ds; - CONST char *np; - char **namePtr; + const char *np; + const char **namePtr; int i, index; /* * The following arrays define the valid character class names. */ - static char *classNames[] = { + static const char *classNames[] = { "alnum", "alpha", "ascii", "blank", "cntrl", "digit", "graph", "lower", "print", "punct", "space", "upper", "xdigit", NULL }; @@ -1075,11 +1075,11 @@ allcases( * Note that it does not need to report anything except equal/unequal. * Note also that the length is exact, and the comparison should not * stop at embedded NULs! - ^ static int cmp(CONST chr *, CONST chr *, size_t); + ^ static int cmp(const chr *, const chr *, size_t); */ static int /* 0 for equal, nonzero for unequal */ cmp( - CONST chr *x, CONST chr *y, /* strings to compare */ + const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { return memcmp(VS(x), VS(y), len*sizeof(chr)); @@ -1091,11 +1091,11 @@ cmp( * Note that it does not need to report anything except equal/unequal. * Note also that the length is exact, and the comparison should not * stop at embedded NULs! - ^ static int casecmp(CONST chr *, CONST chr *, size_t); + ^ static int casecmp(const chr *, const chr *, size_t); */ static int /* 0 for equal, nonzero for unequal */ casecmp( - CONST chr *x, CONST chr *y, /* strings to compare */ + const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { for (; len > 0; len--, x++, y++) { diff --git a/generic/regcomp.c b/generic/regcomp.c index 049ad69..d228879 100644 --- a/generic/regcomp.c +++ b/generic/regcomp.c @@ -38,7 +38,7 @@ /* =====^!^===== begin forwards =====^!^===== */ /* automatically gathered by fwd; do not hand-edit */ /* === regcomp.c === */ -int compile(regex_t *, CONST chr *, size_t, int); +int compile(regex_t *, const chr *, size_t, int); static VOID moresubs(struct vars *, int); static int freev(struct vars *, int); static VOID makesearch(struct vars *, struct nfa *); @@ -75,7 +75,7 @@ static VOID rfree(regex_t *); static VOID dump(regex_t *, FILE *); static VOID dumpst(struct subre *, FILE *, int); static VOID stdump(struct subre *, FILE *, int); -static char *stid(struct subre *, char *, size_t); +static const char *stid(struct subre *, char *, size_t); /* === regc_lex.c === */ static VOID lexstart(struct vars *); static VOID prefixes(struct vars *); @@ -191,8 +191,8 @@ static int before(celt, celt); static struct cvec *eclass(struct vars *, celt, int); static struct cvec *cclass(struct vars *, chr *, chr *, int); static struct cvec *allcases(struct vars *, pchr); -static int cmp(CONST chr *, CONST chr *, size_t); -static int casecmp(CONST chr *, CONST chr *, size_t); +static int cmp(const chr *, const chr *, size_t); +static int casecmp(const chr *, const chr *, size_t); /* automatically gathered by fwd; do not hand-edit */ /* =====^!^===== end forwards =====^!^===== */ @@ -278,12 +278,12 @@ static struct fns functions = { /* - compile - compile regular expression - ^ int compile(regex_t *, CONST chr *, size_t, int); + ^ int compile(regex_t *, const chr *, size_t, int); */ int compile( regex_t *re, - CONST chr *string, + const chr *string, size_t len, int flags) { @@ -1365,8 +1365,8 @@ repeat( #define INF 3 #define PAIR(x, y) ((x)*4 + (y)) #define REDUCE(x) ( ((x) == INFINITY) ? INF : (((x) > 1) ? SOME : (x)) ) - CONST int rm = REDUCE(m); - CONST int rn = REDUCE(n); + const int rm = REDUCE(m); + const int rn = REDUCE(n); struct state *s; struct state *s2; @@ -2466,7 +2466,7 @@ stdump( - stid - identify a subtree node for dumping ^ static char *stid(struct subre *, char *, size_t); */ -static char * /* points to buf or constant string */ +static const char * /* points to buf or constant string */ stid( struct subre *t, char *buf, diff --git a/generic/regerror.c b/generic/regerror.c index bbad8ec..49b6f3e 100644 --- a/generic/regerror.c +++ b/generic/regerror.c @@ -43,8 +43,8 @@ static char unk[] = "*** unknown regex error code 0x%x ***"; static struct rerr { int code; - char *name; - char *explain; + const char *name; + const char *explain; } rerrs[] = { /* The actual table is built from regex.h */ #include "regerrs.h" @@ -58,12 +58,12 @@ static struct rerr { size_t /* Actual space needed (including NUL) */ regerror( int code, /* Error code, or REG_ATOI or REG_ITOA */ - CONST regex_t *preg, /* Associated regex_t (unused at present) */ + const regex_t *preg, /* Associated regex_t (unused at present) */ char *errbuf, /* Result buffer (unless errbuf_size==0) */ size_t errbuf_size) /* Available space in errbuf, can be 0 */ { struct rerr *r; - char *msg; + const char *msg; char convbuf[sizeof(unk)+50]; /* 50 = plenty for int */ size_t len; int icode; diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 83a966a..cf57f69 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.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: tclBasic.c,v 1.234 2006/12/14 16:08:22 dkf Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.235 2007/02/20 23:24:02 nijtmans Exp $ */ #include "tclInt.h" @@ -50,46 +50,46 @@ typedef struct OldMathFuncData { */ static char * CallCommandTraces(Interp *iPtr, Command *cmdPtr, - CONST char *oldName, CONST char* newName, int flags); + const char *oldName, const char* newName, int flags); static int CheckDoubleResult(Tcl_Interp *interp, double dResult); static void DeleteInterpProc(Tcl_Interp *interp); static void DeleteOpCmdClientData(ClientData clientData); static void ProcessUnexpectedResult(Tcl_Interp *interp, int returnCode); static int OldMathFuncProc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static void OldMathFuncDeleteProc(ClientData clientData); static int ExprAbsFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprBinaryFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprBoolFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprCeilFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprDoubleFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprEntierFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprFloorFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprIntFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprIsqrtFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprRandFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprRoundFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprSqrtFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprSrandFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprUnaryFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static int ExprWideFunc(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST *objv); + int argc, Tcl_Obj *const *objv); static void MathFuncWrongNumArgs(Tcl_Interp* interp, int expected, - int actual, Tcl_Obj *CONST *objv); + int actual, Tcl_Obj *const *objv); extern TclStubs tclStubs; @@ -226,7 +226,7 @@ static const CmdInfo2 builtInCmds2[] = { */ typedef struct { - CONST char *name; /* Name of the function. The full name is + const char *name; /* Name of the function. The full name is * "::tcl::mathfunc::". */ Tcl_ObjCmdProc *objCmdProc; /* Function that evaluates the function */ ClientData clientData; /* Client data for the function */ @@ -901,7 +901,7 @@ Tcl_DontCallWhenDeleted( void Tcl_SetAssocData( Tcl_Interp *interp, /* Interpreter to associate with. */ - CONST char *name, /* Name for association. */ + const char *name, /* Name for association. */ Tcl_InterpDeleteProc *proc, /* Proc to call when interpreter is about to * be deleted. */ ClientData clientData) /* One-word value to pass to proc. */ @@ -947,7 +947,7 @@ Tcl_SetAssocData( void Tcl_DeleteAssocData( Tcl_Interp *interp, /* Interpreter to associate with. */ - CONST char *name) /* Name of association. */ + const char *name) /* Name of association. */ { Interp *iPtr = (Interp *) interp; AssocData *dPtr; @@ -989,7 +989,7 @@ Tcl_DeleteAssocData( ClientData Tcl_GetAssocData( Tcl_Interp *interp, /* Interpreter associated with. */ - CONST char *name, /* Name of association. */ + const char *name, /* Name of association. */ Tcl_InterpDeleteProc **procPtr) /* Pointer to place to store address of * current deletion callback. */ @@ -1354,8 +1354,8 @@ DeleteInterpProc( int Tcl_HideCommand( Tcl_Interp *interp, /* Interpreter in which to hide command. */ - CONST char *cmdName, /* Name of command to hide. */ - CONST char *hiddenCmdToken) /* Token name of the to-be-hidden command. */ + const char *cmdName, /* Name of command to hide. */ + const char *hiddenCmdToken) /* Token name of the to-be-hidden command. */ { Interp *iPtr = (Interp *) interp; Tcl_Command cmd; @@ -1520,8 +1520,8 @@ int Tcl_ExposeCommand( Tcl_Interp *interp, /* Interpreter in which to make command * callable. */ - CONST char *hiddenCmdToken, /* Name of hidden command. */ - CONST char *cmdName) /* Name of to-be-exposed command. */ + const char *hiddenCmdToken, /* Name of hidden command. */ + const char *cmdName) /* Name of to-be-exposed command. */ { Interp *iPtr = (Interp *) interp; Command *cmdPtr; @@ -1680,7 +1680,7 @@ Tcl_Command Tcl_CreateCommand( Tcl_Interp *interp, /* Token for command interpreter returned by a * previous call to Tcl_CreateInterp. */ - CONST char *cmdName, /* Name of command. If it contains namespace + const char *cmdName, /* Name of command. If it contains namespace * qualifiers, the new command is put in the * specified namespace; otherwise it is put in * the global namespace. */ @@ -1695,7 +1695,7 @@ Tcl_CreateCommand( Namespace *nsPtr, *dummy1, *dummy2; Command *cmdPtr, *refCmdPtr; Tcl_HashEntry *hPtr; - CONST char *tail; + const char *tail; int new; ImportedCmdData *dataPtr; @@ -1834,7 +1834,7 @@ Tcl_Command Tcl_CreateObjCommand( Tcl_Interp *interp, /* Token for command interpreter (returned by * previous call to Tcl_CreateInterp). */ - CONST char *cmdName, /* Name of command. If it contains namespace + const char *cmdName, /* Name of command. If it contains namespace * qualifiers, the new command is put in the * specified namespace; otherwise it is put in * the global namespace. */ @@ -1851,7 +1851,7 @@ Tcl_CreateObjCommand( Namespace *nsPtr, *dummy1, *dummy2; Command *cmdPtr, *refCmdPtr; Tcl_HashEntry *hPtr; - CONST char *tail; + const char *tail; int new; ImportedCmdData *dataPtr; @@ -2000,7 +2000,7 @@ TclInvokeStringCommand( ClientData clientData, /* Points to command's Command structure. */ Tcl_Interp *interp, /* Current interpreter. */ register int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register Command *cmdPtr = (Command *) clientData; register int i; @@ -2013,8 +2013,8 @@ TclInvokeStringCommand( */ #define NUM_ARGS 20 - CONST char *(argStorage[NUM_ARGS]); - CONST char **argv = argStorage; + const char *(argStorage[NUM_ARGS]); + const char **argv = argStorage; /* * Create the string argument array "argv". Make sure argv is large enough @@ -2022,7 +2022,7 @@ TclInvokeStringCommand( */ if ((objc + 1) > NUM_ARGS) { - argv = (CONST char **) ckalloc((unsigned)(objc + 1) * sizeof(char *)); + argv = (const char **) ckalloc((unsigned)(objc + 1) * sizeof(char *)); } for (i = 0; i < objc; i++) { @@ -2073,7 +2073,7 @@ TclInvokeObjectCommand( ClientData clientData, /* Points to command's Command structure. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - register CONST char **argv) /* Argument strings. */ + register const char **argv) /* Argument strings. */ { Command *cmdPtr = (Command *) clientData; register Tcl_Obj *objPtr; @@ -2166,7 +2166,7 @@ TclRenameCommand( const char *newName) /* New command name. */ { Interp *iPtr = (Interp *) interp; - CONST char *newTail; + const char *newTail; Namespace *cmdNsPtr, *newNsPtr, *dummy1, *dummy2; Tcl_Command cmd; Command *cmdPtr; @@ -2349,8 +2349,8 @@ int Tcl_SetCommandInfo( Tcl_Interp *interp, /* Interpreter in which to look for * command. */ - CONST char *cmdName, /* Name of desired command. */ - CONST Tcl_CmdInfo *infoPtr) /* Where to find information to store in the + const char *cmdName, /* Name of desired command. */ + const Tcl_CmdInfo *infoPtr) /* Where to find information to store in the * command. */ { Tcl_Command cmd; @@ -2383,7 +2383,7 @@ Tcl_SetCommandInfo( int Tcl_SetCommandInfoFromToken( Tcl_Command cmd, - CONST Tcl_CmdInfo *infoPtr) + const Tcl_CmdInfo *infoPtr) { Command *cmdPtr; /* Internal representation of the command */ @@ -2432,7 +2432,7 @@ int Tcl_GetCommandInfo( Tcl_Interp *interp, /* Interpreter in which to look for * command. */ - CONST char *cmdName, /* Name of desired command. */ + const char *cmdName, /* Name of desired command. */ Tcl_CmdInfo *infoPtr) /* Where to store information about * command. */ { @@ -2507,7 +2507,7 @@ Tcl_GetCommandInfoFromToken( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_GetCommandName( Tcl_Interp *interp, /* Interpreter containing the command. */ Tcl_Command command) /* Token for command returned by a previous @@ -2603,7 +2603,7 @@ int Tcl_DeleteCommand( Tcl_Interp *interp, /* Token for command interpreter (returned by * a previous Tcl_CreateInterp call). */ - CONST char *cmdName) /* Name of command to remove. */ + const char *cmdName) /* Name of command to remove. */ { Tcl_Command cmd; @@ -2809,9 +2809,9 @@ static char * CallCommandTraces( Interp *iPtr, /* Interpreter containing command. */ Command *cmdPtr, /* Command whose traces are to be invoked. */ - CONST char *oldName, /* Command's old name, or NULL if we must get + const char *oldName, /* Command's old name, or NULL if we must get * the name from cmdPtr */ - CONST char *newName, /* Command's new name, or NULL if the command + const char *newName, /* Command's new name, or NULL if the command * is not being renamed */ int flags) /* Flags indicating the type of traces to * trigger, either TCL_TRACE_DELETE or @@ -2965,7 +2965,7 @@ void Tcl_CreateMathFunc( Tcl_Interp *interp, /* Interpreter in which function is to be * available. */ - CONST char *name, /* Name of function (e.g. "sin"). */ + const char *name, /* Name of function (e.g. "sin"). */ int numArgs, /* Nnumber of arguments required by * function. */ Tcl_ValueType *argTypes, /* Array of types acceptable for each @@ -3021,7 +3021,7 @@ OldMathFuncProc( * function being called */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Parameter vector */ + Tcl_Obj *const *objv) /* Parameter vector */ { Tcl_Obj *valuePtr; OldMathFuncData *dataPtr = clientData; @@ -3243,7 +3243,7 @@ OldMathFuncDeleteProc( int Tcl_GetMathFuncInfo( Tcl_Interp *interp, - CONST char *name, + const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, @@ -3324,17 +3324,17 @@ Tcl_GetMathFuncInfo( Tcl_Obj * Tcl_ListMathFuncs( Tcl_Interp *interp, - CONST char *pattern) + const char *pattern) { Namespace *globalNsPtr = (Namespace *) Tcl_GetGlobalNamespace(interp); Namespace *nsPtr; Namespace *dummy1NsPtr; Namespace *dummy2NsPtr; - CONST char *dummyNamePtr; + const char *dummyNamePtr; Tcl_Obj *result = Tcl_NewObj(); Tcl_HashEntry *cmdHashEntry; Tcl_HashSearch cmdHashSearch; - CONST char *cmdNamePtr; + const char *cmdNamePtr; TclGetNamespaceForQualName(interp, "::tcl::mathfunc", globalNsPtr, TCL_FIND_ONLY_NS | TCL_GLOBAL_ONLY, @@ -3446,9 +3446,9 @@ TclEvalObjvInternal( Tcl_Interp *interp, /* Interpreter in which to evaluate the * command. Also used for error reporting. */ int objc, /* Number of words in command. */ - Tcl_Obj *CONST objv[], /* An array of pointers to objects that are + Tcl_Obj *const objv[], /* An array of pointers to objects that are * the words that make up the command. */ - CONST char *command, /* Points to the beginning of the string + const char *command, /* Points to the beginning of the string * representation of the command; this is used * for traces. If the string representation of * the command is unknown, an empty string @@ -3738,7 +3738,7 @@ Tcl_EvalObjv( Tcl_Interp *interp, /* Interpreter in which to evaluate the * command. Also used for error reporting. */ int objc, /* Number of words in command. */ - Tcl_Obj *CONST objv[], /* An array of pointers to objects that are + Tcl_Obj *const objv[], /* An array of pointers to objects that are * the words that make up the command. */ int flags) /* Collection of OR-ed bits that control the * evaluation of the script. Only @@ -3748,7 +3748,7 @@ Tcl_EvalObjv( Interp *iPtr = (Interp *) interp; Trace *tracePtr; Tcl_DString cmdBuf; - char *cmdString = ""; /* A command string is only necessary for + const char *cmdString = ""; /* A command string is only necessary for * command traces or error logs; it will be * generated to replace this default value if * necessary. */ @@ -3923,7 +3923,7 @@ int Tcl_EvalEx( Tcl_Interp *interp, /* Interpreter in which to evaluate the * script. Also used for error reporting. */ - CONST char *script, /* First character of script to evaluate. */ + const char *script, /* First character of script to evaluate. */ int numBytes, /* Number of bytes in script. If < 0, the * script consists of all bytes up to the * first null character. */ @@ -3938,7 +3938,7 @@ int TclEvalEx( Tcl_Interp *interp, /* Interpreter in which to evaluate the * script. Also used for error reporting. */ - CONST char *script, /* First character of script to evaluate. */ + const char *script, /* First character of script to evaluate. */ int numBytes, /* Number of bytes in script. If < 0, the * script consists of all bytes up to the * first NUL character. */ @@ -3948,7 +3948,7 @@ TclEvalEx( int line) /* The line the script starts on. */ { Interp *iPtr = (Interp *) interp; - CONST char *p, *next; + const char *p, *next; Tcl_Parse parse; #define NUM_STATIC_OBJS 20 Tcl_Obj *staticObjArray[NUM_STATIC_OBJS], **objv, **objvSpace; @@ -4081,7 +4081,7 @@ TclEvalEx( */ int wordLine = line; - CONST char *wordStart = parse.commandStart; + const char *wordStart = parse.commandStart; /* * Generate an array of objects for the words of the command. @@ -4393,10 +4393,10 @@ TclEvalEx( void TclAdvanceLines( int *line, - CONST char *start, - CONST char *end) + const char *start, + const char *end) { - CONST char *p; + const char *p; for (p = start; p < end; p++) { if (*p == '\n') { @@ -4431,7 +4431,7 @@ int Tcl_Eval( Tcl_Interp *interp, /* Token for command interpreter (returned by * previous call to Tcl_CreateInterp). */ - CONST char *script) /* Pointer to TCL command to execute. */ + const char *script) /* Pointer to TCL command to execute. */ { int code = Tcl_EvalEx(interp, script, -1, 0); @@ -4525,7 +4525,7 @@ TclEvalObjEx( int flags, /* Collection of OR-ed bits that control the * evaluation of the script. Supported values * are TCL_EVAL_GLOBAL and TCL_EVAL_DIRECT. */ - CONST CmdFrame *invoker, /* Frame of the command doing the eval. */ + const CmdFrame *invoker, /* Frame of the command doing the eval. */ int word) /* Index of the word which is in objPtr. */ { register Interp *iPtr = (Interp *) interp; @@ -4826,7 +4826,7 @@ int Tcl_ExprLong( Tcl_Interp *interp, /* Context in which to evaluate the * expression. */ - CONST char *exprstring, /* Expression to evaluate. */ + const char *exprstring, /* Expression to evaluate. */ long *ptr) /* Where to store result. */ { register Tcl_Obj *exprPtr; @@ -4853,7 +4853,7 @@ int Tcl_ExprDouble( Tcl_Interp *interp, /* Context in which to evaluate the * expression. */ - CONST char *exprstring, /* Expression to evaluate. */ + const char *exprstring, /* Expression to evaluate. */ double *ptr) /* Where to store result. */ { register Tcl_Obj *exprPtr; @@ -4881,7 +4881,7 @@ int Tcl_ExprBoolean( Tcl_Interp *interp, /* Context in which to evaluate the * expression. */ - CONST char *exprstring, /* Expression to evaluate. */ + const char *exprstring, /* Expression to evaluate. */ int *ptr) /* Where to store 0/1 result. */ { if (*exprstring == '\0') { @@ -4956,7 +4956,7 @@ Tcl_ExprLongObj( case TCL_NUMBER_DOUBLE: { mp_int big; - d = *((CONST double *)internalPtr); + d = *((const double *)internalPtr); Tcl_DecrRefCount(resultPtr); if (Tcl_InitBignumFromDouble(interp, d, &big) != TCL_OK) { return TCL_ERROR; @@ -5004,7 +5004,7 @@ Tcl_ExprDoubleObj( break; #endif case TCL_NUMBER_DOUBLE: - *ptr = *((CONST double *)internalPtr); + *ptr = *((const double *)internalPtr); result = TCL_OK; break; default: @@ -5058,7 +5058,7 @@ TclObjInvokeNamespace( Tcl_Interp *interp, /* Interpreter in which command is to be * invoked. */ int objc, /* Count of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects; objv[0] points to the + Tcl_Obj *const objv[], /* Argument objects; objv[0] points to the * name of the command to invoke. */ Tcl_Namespace *nsPtr, /* The namespace to use. */ int flags) /* Combination of flags controlling the call: @@ -5106,7 +5106,7 @@ TclObjInvoke( Tcl_Interp *interp, /* Interpreter in which command is to be * invoked. */ int objc, /* Count of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects; objv[0] points to the + Tcl_Obj *const objv[], /* Argument objects; objv[0] points to the * name of the command to invoke. */ int flags) /* Combination of flags controlling the call: * TCL_INVOKE_HIDDEN, TCL_INVOKE_NO_UNKNOWN, @@ -5165,7 +5165,7 @@ TclObjInvoke( && ((iPtr->flags & ERR_ALREADY_LOGGED) == 0)) { int length; Tcl_Obj *command = Tcl_NewListObj(objc, objv); - CONST char* cmdString; + const char* cmdString; Tcl_IncrRefCount(command); cmdString = Tcl_GetStringFromObj(command, &length); @@ -5200,7 +5200,7 @@ int Tcl_ExprString( Tcl_Interp *interp, /* Context in which to evaluate the * expression. */ - CONST char *expr) /* Expression to evaluate. */ + const char *expr) /* Expression to evaluate. */ { int code = TCL_OK; @@ -5256,7 +5256,7 @@ Tcl_AppendObjToErrorInfo( Tcl_Obj *objPtr) /* Message to record. */ { int length; - CONST char *message = Tcl_GetStringFromObj(objPtr, &length); + const char *message = Tcl_GetStringFromObj(objPtr, &length); Tcl_AddObjErrorInfo(interp, message, length); Tcl_DecrRefCount(objPtr); @@ -5285,7 +5285,7 @@ void Tcl_AddErrorInfo( Tcl_Interp *interp, /* Interpreter to which error information * pertains. */ - CONST char *message) /* Message to record. */ + const char *message) /* Message to record. */ { Tcl_AddObjErrorInfo(interp, message, -1); } @@ -5315,7 +5315,7 @@ void Tcl_AddObjErrorInfo( Tcl_Interp *interp, /* Interpreter to which error information * pertains. */ - CONST char *message, /* Points to the first byte of an array of + const char *message, /* Points to the first byte of an array of * bytes of the message. */ int length) /* The number of bytes in the message. If < 0, * then append all bytes up to a NULL byte. */ @@ -5463,7 +5463,7 @@ Tcl_VarEval( int Tcl_GlobalEval( Tcl_Interp *interp, /* Interpreter in which to evaluate command. */ - CONST char *command) /* Command to evaluate. */ + const char *command) /* Command to evaluate. */ { register Interp *iPtr = (Interp *) interp; int result; @@ -5600,7 +5600,7 @@ ExprCeilFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter list */ + Tcl_Obj *const *objv) /* Actual parameter list */ { int code; double d; @@ -5635,7 +5635,7 @@ ExprFloorFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter list */ + Tcl_Obj *const *objv) /* Actual parameter list */ { int code; double d; @@ -5669,7 +5669,7 @@ ExprIsqrtFunc( ClientData clientData, /* Ignored */ Tcl_Interp* interp, /* The interpreter in which to execute */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter list */ + Tcl_Obj *const *objv) /* Actual parameter list */ { ClientData ptr; int type; @@ -5702,7 +5702,7 @@ ExprIsqrtFunc( Tcl_GetDoubleFromObj(interp, objv[1], &d); return TCL_ERROR; case TCL_NUMBER_DOUBLE: - d = *((CONST double *)ptr); + d = *((const double *)ptr); if (d < 0) { goto negarg; } @@ -5770,7 +5770,7 @@ ExprSqrtFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter list */ + Tcl_Obj *const *objv) /* Actual parameter list */ { int code; double d; @@ -5813,7 +5813,7 @@ ExprUnaryFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter list */ + Tcl_Obj *const *objv) /* Actual parameter list */ { int code; double d; @@ -5873,7 +5873,7 @@ ExprBinaryFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Parameter vector */ + Tcl_Obj *const *objv) /* Parameter vector */ { int code; double d1, d2; @@ -5915,7 +5915,7 @@ ExprAbsFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Parameter vector */ + Tcl_Obj *const *objv) /* Parameter vector */ { ClientData ptr; int type; @@ -5931,7 +5931,7 @@ ExprAbsFunc( } if (type == TCL_NUMBER_LONG) { - long l = *((CONST long int *)ptr); + long l = *((const long int *)ptr); if (l < (long)0) { if (l == LONG_MIN) { TclBNInitBignumFromLong(&big, l); @@ -5945,7 +5945,7 @@ ExprAbsFunc( } if (type == TCL_NUMBER_DOUBLE) { - double d = *((CONST double *)ptr); + double d = *((const double *)ptr); if (d < 0.0) { Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d)); } else { @@ -5956,7 +5956,7 @@ ExprAbsFunc( #ifndef NO_WIDE_TYPE if (type == TCL_NUMBER_WIDE) { - Tcl_WideInt w = *((CONST Tcl_WideInt *)ptr); + Tcl_WideInt w = *((const Tcl_WideInt *)ptr); if (w < (Tcl_WideInt)0) { if (w == LLONG_MIN) { TclBNInitBignumFromWideInt(&big, w); @@ -6002,7 +6002,7 @@ ExprBoolFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { int value; @@ -6023,7 +6023,7 @@ ExprDoubleFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { double dResult; #if 0 @@ -6072,7 +6072,7 @@ ExprEntierFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { double d; int type; @@ -6087,7 +6087,7 @@ ExprEntierFunc( } if (type == TCL_NUMBER_DOUBLE) { - d = *((CONST double *)ptr); + d = *((const double *)ptr); if ((d >= (double)LONG_MAX) || (d <= (double)LONG_MIN)) { mp_int big; @@ -6128,7 +6128,7 @@ ExprIntFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { long iResult; Tcl_Obj *objPtr; @@ -6201,7 +6201,7 @@ ExprWideFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { Tcl_WideInt wResult; Tcl_Obj *objPtr; @@ -6274,7 +6274,7 @@ ExprRandFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { Interp *iPtr = (Interp *) interp; double dResult; @@ -6367,7 +6367,7 @@ ExprRoundFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Parameter vector */ + Tcl_Obj *const *objv) /* Parameter vector */ { double d; ClientData ptr; @@ -6386,7 +6386,7 @@ ExprRoundFunc( double fractPart, intPart; long max = LONG_MAX, min = LONG_MIN; - fractPart = modf(*((CONST double *)ptr), &intPart); + fractPart = modf(*((const double *)ptr), &intPart); if (fractPart <= -0.5) { min++; } else if (fractPart >= 0.5) { @@ -6442,7 +6442,7 @@ ExprSrandFunc( Tcl_Interp *interp, /* The interpreter in which to execute the * function. */ int objc, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Parameter vector */ + Tcl_Obj *const *objv) /* Parameter vector */ { Interp *iPtr = (Interp *) interp; long i = 0; /* Initialized to avoid compiler warning. */ @@ -6515,10 +6515,10 @@ MathFuncWrongNumArgs( Tcl_Interp *interp, /* Tcl interpreter */ int expected, /* Formal parameter count */ int found, /* Actual parameter count */ - Tcl_Obj *CONST *objv) /* Actual parameter vector */ + Tcl_Obj *const *objv) /* Actual parameter vector */ { - CONST char *name = Tcl_GetString(objv[0]); - CONST char *tail = name + strlen(name); + const char *name = Tcl_GetString(objv[0]); + const char *tail = name + strlen(name); while (tail > name+1) { --tail; diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 84fedf3..8ac5cb9 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.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: tclBinary.c,v 1.32 2006/11/07 14:10:51 dkf Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.33 2007/02/20 23:24:04 nijtmans Exp $ */ #include "tclInt.h" @@ -70,7 +70,7 @@ static int SetByteArrayFromAny(Tcl_Interp *interp, static void UpdateStringOfByteArray(Tcl_Obj *listPtr); static void DeleteScanNumberCache(Tcl_HashTable *numberCachePtr); static int NeedReversing(int format); -static void CopyNumber(CONST void *from, void *to, +static void CopyNumber(const void *from, void *to, unsigned int length, int type); /* @@ -154,7 +154,7 @@ typedef struct ByteArray { Tcl_Obj * Tcl_NewByteArrayObj( - CONST unsigned char *bytes, /* The array of bytes used to initialize the + const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ int length) /* Length of the array of bytes, which must be * >= 0. */ @@ -166,7 +166,7 @@ Tcl_NewByteArrayObj( Tcl_Obj * Tcl_NewByteArrayObj( - CONST unsigned char *bytes, /* The array of bytes used to initialize the + const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ int length) /* Length of the array of bytes, which must be * >= 0. */ @@ -208,11 +208,11 @@ Tcl_NewByteArrayObj( Tcl_Obj * Tcl_DbNewByteArrayObj( - CONST unsigned char *bytes, /* The array of bytes used to initialize the + const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ int length, /* Length of the array of bytes, which must be * >= 0. */ - CONST char *file, /* The name of the source file calling this + const char *file, /* The name of the source file calling this * procedure; used for debugging. */ int line) /* Line number in the source file; used for * debugging. */ @@ -228,11 +228,11 @@ Tcl_DbNewByteArrayObj( Tcl_Obj * Tcl_DbNewByteArrayObj( - CONST unsigned char *bytes, /* The array of bytes used to initialize the + const unsigned char *bytes, /* The array of bytes used to initialize the * new object. */ int length, /* Length of the array of bytes, which must be * >= 0. */ - CONST char *file, /* The name of the source file calling this + const char *file, /* The name of the source file calling this * procedure; used for debugging. */ int line) /* Line number in the source file; used for * debugging. */ @@ -262,7 +262,7 @@ Tcl_DbNewByteArrayObj( void Tcl_SetByteArrayObj( Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */ - CONST unsigned char *bytes, /* The array of bytes to use as the new + const unsigned char *bytes, /* The array of bytes to use as the new * value. */ int length) /* Length of the array of bytes, which must be * >= 0. */ @@ -562,7 +562,7 @@ Tcl_BinaryObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int arg; /* Index of next argument to consume. */ int value = 0; /* Current integer value to be packed. @@ -578,9 +578,10 @@ Tcl_BinaryObjCmd( unsigned char *cursor; /* Current position within result buffer. */ unsigned char *maxPos; /* Greatest position within result buffer that * cursor has visited.*/ - char *errorString, *errorValue, *str; + const char *errorString; + char *errorValue, *str; int offset, size, length, index; - static CONST char *options[] = { + static const char *options[] = { "format", "scan", NULL }; enum options { @@ -1159,7 +1160,7 @@ Tcl_BinaryObjCmd( char *dest; unsigned char *src; int i; - static CONST char hexdigit[] = "0123456789abcdef"; + static const char hexdigit[] = "0123456789abcdef"; if (arg >= objc) { DeleteScanNumberCache(numberCachePtr); @@ -1541,7 +1542,7 @@ NeedReversing( static void CopyNumber( - CONST void *from, /* source */ + const void *from, /* source */ void *to, /* destination */ unsigned int length, /* Number of bytes to copy */ int type) /* What type of thing are we copying? */ @@ -1551,7 +1552,7 @@ CopyNumber( memcpy(to, from, length); break; case 1: { - CONST unsigned char *fromPtr = from; + const unsigned char *fromPtr = from; unsigned char *toPtr = to; switch (length) { @@ -1575,7 +1576,7 @@ CopyNumber( break; } case 2: { - CONST unsigned char *fromPtr = from; + const unsigned char *fromPtr = from; unsigned char *toPtr = to; toPtr[0] = fromPtr[4]; @@ -1589,7 +1590,7 @@ CopyNumber( break; } case 3: { - CONST unsigned char *fromPtr = from; + const unsigned char *fromPtr = from; unsigned char *toPtr = to; toPtr[0] = fromPtr[3]; diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index d98061c..bbc5019 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.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: tclCompExpr.c,v 1.46 2006/12/13 16:28:06 dkf Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.47 2007/02/20 23:24:02 nijtmans Exp $ */ #include "tclInt.h" @@ -138,10 +138,10 @@ typedef struct OpNode { * Declarations for local functions to this file: */ -static int ParseLexeme(CONST char *start, int numBytes, +static int ParseLexeme(const char *start, int numBytes, unsigned char *lexemePtr, Tcl_Obj **literalPtr); #if (!defined(PARSE_DIRECT_EXPR_TOKENS) || !defined(USE_EXPR_TOKENS)) -static int ParseExpr(Tcl_Interp *interp, CONST char *start, +static int ParseExpr(Tcl_Interp *interp, const char *start, int numBytes, OpNode **opTreePtr, Tcl_Obj *litList, Tcl_Obj *funcList, Tcl_Parse *parsePtr); @@ -151,10 +151,10 @@ static void GenerateTokens(ExprNode *nodes, Tcl_Parse *scratchPtr, Tcl_Parse *parsePtr); #else static void ConvertTreeToTokens(Tcl_Interp *interp, - CONST char *start, int numBytes, OpNode *nodes, + const char *start, int numBytes, OpNode *nodes, Tcl_Obj *litList, Tcl_Token *tokenPtr, Tcl_Parse *parsePtr); -static int GenerateTokensForLiteral(CONST char *script, +static int GenerateTokensForLiteral(const char *script, int numBytes, Tcl_Obj *litList, int nextLiteral, Tcl_Parse *parsePtr); static int CopyTokens(Tcl_Token *sourcePtr, Tcl_Parse *parsePtr); @@ -190,7 +190,7 @@ static int CopyTokens(Tcl_Token *sourcePtr, Tcl_Parse *parsePtr); static int ParseExpr( Tcl_Interp *interp, /* Used for error reporting. */ - CONST char *start, /* Start of source string to parse. */ + const char *start, /* Start of source string to parse. */ int numBytes, /* Number of bytes in string. If < 0, the * string consists of all bytes up to the * first null character. */ @@ -210,9 +210,9 @@ ParseExpr( int lastOpen = 0, lastWas = 0; unsigned char lexeme = START; Tcl_Obj *msg = NULL, *post = NULL; - CONST int limit = 25; - CONST char *mark = "_@_"; - static CONST unsigned char prec[] = { + const int limit = 25; + const char *mark = "_@_"; + static const unsigned char prec[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 5, 16, 16, 16, 13, 13, 11, 10, 9, 6, 6, 14, 14, @@ -247,7 +247,7 @@ ParseExpr( OpNode *nodePtr; Tcl_Token *tokenPtr = NULL; Tcl_Obj *literal = NULL; - CONST char *lastStart = start - scanned; + const char *lastStart = start - scanned; /* * Each pass through this loop adds one more ExprNode. Allocate space @@ -346,7 +346,7 @@ ParseExpr( switch (NODE_TYPE & lexeme) { case LEAF: { - CONST char *end; + const char *end; int wordIndex; if (lastWas < 0) { @@ -784,14 +784,14 @@ ParseExpr( static int GenerateTokensForLiteral( - CONST char *script, + const char *script, int numBytes, Tcl_Obj *litList, int nextLiteral, Tcl_Parse *parsePtr) { int scanned, closer = 0; - CONST char *start = script; + const char *start = script; Tcl_Token *destPtr; unsigned char lexeme; @@ -804,7 +804,7 @@ GenerateTokensForLiteral( scanned = ParseLexeme(start, numBytes-scanned, &lexeme, NULL); if ((lexeme != NUMBER) && (lexeme != BAREWORD)) { Tcl_Obj *literal; - CONST char *bytes; + const char *bytes; Tcl_ListObjIndex(NULL, litList, nextLiteral, &literal); bytes = Tcl_GetStringFromObj(literal, &scanned); @@ -899,7 +899,7 @@ CopyTokens( static void ConvertTreeToTokens( Tcl_Interp *interp, - CONST char *start, + const char *start, int numBytes, OpNode *nodes, Tcl_Obj *litList, @@ -1122,7 +1122,7 @@ ConvertTreeToTokens( int Tcl_ParseExpr( Tcl_Interp *interp, /* Used for error reporting. */ - CONST char *start, /* Start of source string to parse. */ + const char *start, /* Start of source string to parse. */ int numBytes, /* Number of bytes in string. If < 0, the * string consists of all bytes up to the * first null character. */ @@ -1165,9 +1165,9 @@ Tcl_ParseExpr( Tcl_Parse scratch; /* Parsing scratch space */ Tcl_Obj *msg = NULL, *post = NULL; int scanned = 0, code = TCL_OK, insertMark = 0; - CONST char *mark = "_@_"; - CONST int limit = 25; - static CONST unsigned char prec[] = { + const char *mark = "_@_"; + const int limit = 25; + static const unsigned char prec[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 5, 16, 16, 16, 13, 13, 11, 10, 9, 6, 6, 14, 14, @@ -1305,10 +1305,10 @@ Tcl_ParseExpr( switch (NODE_TYPE & nodePtr->lexeme) { case LEAF: { - CONST char *end; + const char *end; if ((NODE_TYPE & lastNodePtr->lexeme) == LEAF) { - CONST char *operand = + const char *operand = scratch.tokenPtr[lastNodePtr->token].start; msg = Tcl_ObjPrintf("missing operator at %s", mark); @@ -1768,7 +1768,7 @@ GenerateTokens( ExprNode *nodePtr = nodes + nodes->right; Tcl_Token *sourcePtr, *destPtr, *tokenPtr = scratchPtr->tokenPtr; int toCopy; - CONST char *end = tokenPtr->start + tokenPtr->size; + const char *end = tokenPtr->start + tokenPtr->size; while (nodePtr->lexeme != START) { switch (NODE_TYPE & nodePtr->lexeme) { @@ -1914,14 +1914,14 @@ GenerateTokens( static int ParseLexeme( - CONST char *start, /* Start of lexeme to parse. */ + const char *start, /* Start of lexeme to parse. */ int numBytes, /* Number of bytes in string. */ unsigned char *lexemePtr, /* Write code of parsed lexeme to this * storage. */ Tcl_Obj **literalPtr) /* Write corresponding literal value to this storage, if non-NULL. */ { - CONST char *end; + const char *end; int scanned; Tcl_UniChar ch; Tcl_Obj *literal = NULL; @@ -2197,7 +2197,7 @@ static int opTableInitialized = 0; /* 0 means not yet initialized. */ TCL_DECLARE_MUTEX(opMutex) typedef struct OperatorDesc { - char *name; /* Name of the operator. */ + const char *name; /* Name of the operator. */ int numOperands; /* Number of operands. 0 if the operator * requires special handling. */ int instruction; /* Instruction opcode for the operator. @@ -2255,7 +2255,7 @@ static void CompileLandOrLorExpr(Tcl_Interp *interp, Tcl_Token *exprTokenPtr, int opIndex, CompileEnv *envPtr); static void CompileMathFuncCall(Tcl_Interp *interp, - Tcl_Token *exprTokenPtr, CONST char *funcName, + Tcl_Token *exprTokenPtr, const char *funcName, CompileEnv *envPtr); static void CompileSubExpr(Tcl_Interp *interp, Tcl_Token *exprTokenPtr, int *convertPtr, @@ -2305,7 +2305,7 @@ static void CompileExprTree(Tcl_Interp *interp, OpNode *nodes, int TclCompileExpr( Tcl_Interp *interp, /* Used for error reporting. */ - CONST char *script, /* The source script to compile. */ + const char *script, /* The source script to compile. */ int numBytes, /* Number of bytes in script. If < 0, the * string consists of all bytes up to the * first null character. */ @@ -2448,7 +2448,7 @@ CompileExprTree( OpNode *nodePtr = nodes; int nextFunc = 0; JumpList *jumpPtr = NULL; - static CONST int instruction[] = { + static const int instruction[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, INST_ADD, INST_SUB, 0, /* COMMA */ @@ -2475,7 +2475,7 @@ CompileExprTree( if (nodePtr->lexeme == FUNCTION) { Tcl_DString cmdName; Tcl_Obj *funcName; - CONST char *p; + const char *p; int length; Tcl_DStringInit(&cmdName); @@ -2994,7 +2994,7 @@ CompileSubExpr( OperatorDesc *opDescPtr; Tcl_HashEntry *hPtr; - CONST char *operator; + const char *operator; Tcl_DString opBuf; int opIndex; @@ -3304,7 +3304,7 @@ CompileMathFuncCall( Tcl_Interp *interp, /* Interp in which compile takes place */ Tcl_Token *exprTokenPtr, /* Points to TCL_TOKEN_SUB_EXPR token * containing the math function call. */ - CONST char *funcName, /* Name of the math function. */ + const char *funcName, /* Name of the math function. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_DString cmdName; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 2964e46..8509b60 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.106 2007/01/19 14:06:09 dkf Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.107 2007/02/20 23:24:02 nijtmans Exp $ */ #include "tclInt.h" @@ -396,7 +396,7 @@ static int SetByteCodeFromAny(Tcl_Interp *interp, * commands. */ static void EnterCmdWordData(ExtCmdLoc *eclPtr, int srcOffset, - Tcl_Token *tokenPtr, CONST char *cmd, int len, + Tcl_Token *tokenPtr, const char *cmd, int len, int numWords, int line, int **lines); /* @@ -819,7 +819,7 @@ TclInitCompileEnv( * initialize. */ char *stringPtr, /* The source string to be compiled. */ int numBytes, /* Number of bytes in source string. */ - CONST CmdFrame *invoker, /* Location context invoking the bcc */ + const CmdFrame *invoker, /* Location context invoking the bcc */ int word) /* Index of the word in that context getting * compiled */ { @@ -1105,7 +1105,7 @@ TclCompileScript( Tcl_Interp *interp, /* Used for error and status reporting. Also * serves as context for finding and compiling * commands. May not be NULL. */ - CONST char *script, /* The source script to compile. */ + const char *script, /* The source script to compile. */ int numBytes, /* Number of bytes in script. If < 0, the * script consists of all bytes up to the * first null character. */ @@ -1120,7 +1120,7 @@ TclCompileScript( int startCodeOffset = -1; /* Offset of first byte of current command's * code. Init. to avoid compiler warning. */ unsigned char *entryCodeNext = envPtr->codeNext; - CONST char *p, *next; + const char *p, *next; Namespace *cmdNsPtr; Command *cmdPtr; Tcl_Token *tokenPtr; @@ -1289,14 +1289,14 @@ TclCompileScript( if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { if (TclWordSimpleExpansion(tokenPtr)) { - CONST char *start = (tokenPtr+1)->start; - CONST char *end = + const char *start = (tokenPtr+1)->start; + const char *end = (tokenPtr+tokenPtr->numComponents)->start + (tokenPtr+tokenPtr->numComponents)->size; if (TclMarkList(NULL, start, end, exp+wordIdx, - (CONST int **)(expLen+wordIdx), - (CONST char ***)(expItem+wordIdx)) != TCL_OK) { + (const int **)(expLen+wordIdx), + (const char ***)(expItem+wordIdx)) != TCL_OK) { /* * We're trying to expand a literal that is not a * well-formed list. No option but to punt the @@ -1664,7 +1664,7 @@ TclCompileTokens( Tcl_DString textBuffer; /* Holds concatenated chars from adjacent * TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */ char buffer[TCL_UTF_MAX]; - CONST char *name, *p; + const char *name, *p; int numObjsToConcat, nameBytes, localVarName, localVar; int length, i; unsigned char *entryCodeNext = envPtr->codeNext; @@ -1919,7 +1919,7 @@ TclCompileExprWords( */ if ((numWords == 1) && (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD)) { - CONST char *script = tokenPtr[1].start; + const char *script = tokenPtr[1].start; int numBytes = tokenPtr[1].size; int savedNumCmds = envPtr->numCommands; unsigned int savedCodeNext = envPtr->codeNext - envPtr->codeStart; @@ -2192,7 +2192,7 @@ TclInitByteCodeObj( int TclFindCompiledLocal( - register CONST char *name, /* Points to first character of the name of a + 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. */ @@ -2467,14 +2467,14 @@ EnterCmdWordData( * information. */ int srcOffset, /* Offset of first char of the command. */ Tcl_Token *tokenPtr, - CONST char *cmd, + const char *cmd, int len, int numWords, int line, int **wlines) { ECL *ePtr; - CONST char *last; + const char *last; int wordIdx, wordLine, *wwlines; if (eclPtr->nuloc >= eclPtr->nloc) { @@ -3783,10 +3783,10 @@ TclPrintObject( void TclPrintSource( FILE *outFile, /* The file to print the source to. */ - CONST char *stringPtr, /* The string to print. */ + const char *stringPtr, /* The string to print. */ int maxChars) /* Maximum number of chars to print. */ { - register CONST char *p; + register const char *p; register int i = 0; if (stringPtr == NULL) { diff --git a/generic/tclDate.c b/generic/tclDate.c index 0156879..b38026f 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -219,7 +219,7 @@ typedef struct DateInfo { * An entry in the lexical lookup table. */ typedef struct _TABLE { - char *name; + const char *name; int type; time_t value; } TABLE; @@ -243,7 +243,7 @@ typedef enum _MERIDIAN { /* * Prototypes of internal functions. */ -static void TclDateerror(char *s); +static void TclDateerror(const char *s); static time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); static int LookupWord(char *buff); @@ -2079,7 +2079,7 @@ static TABLE MilitaryTable[] = { */ static void TclDateerror(s) - char *s; + const char *s; { } @@ -2292,7 +2292,7 @@ TclClockOldscanObjCmd( clientData, interp, objc, objv ) ClientData clientData; /* Unused */ Tcl_Interp* interp; /* Tcl interpreter */ int objc; /* Count of paraneters */ - Tcl_Obj *CONST *objv; /* Parameters */ + Tcl_Obj *const *objv; /* Parameters */ { Tcl_Obj* result; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f15f66e..94207b3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.258 2006/12/08 18:08:36 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.259 2007/02/20 23:24:03 nijtmans Exp $ */ #include "tclInt.h" @@ -91,7 +91,7 @@ int tclTraceExec = 0; * disjoint for backward-compatability reasons */ -static CONST char *operatorStrings[] = { +static const char *operatorStrings[] = { "||", "&&", "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>", "+", "-", "*", "/", "%", "+", "-", "~", "!", "BUILTIN FUNCTION", "FUNCTION", @@ -352,14 +352,14 @@ static Tcl_ObjType dictIteratorType = { #ifdef TCL_COMPILE_STATS static int EvalStatsCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); #endif /* TCL_COMPILE_STATS */ #ifdef TCL_COMPILE_DEBUG static char * GetOpcodeName(unsigned char *pc); #endif /* TCL_COMPILE_DEBUG */ static ExceptionRange * GetExceptRangeForPc(unsigned char *pc, int catchOnly, ByteCode* codePtr); -static char * GetSrcInfoForPc(unsigned char *pc, +static const char * GetSrcInfoForPc(unsigned char *pc, ByteCode* codePtr, int *lengthPtr); static void GrowEvaluationStack(ExecEnv *eePtr); static void IllegalExprOperandType(Tcl_Interp *interp, @@ -914,7 +914,7 @@ int TclCompEvalObj( Tcl_Interp *interp, Tcl_Obj *objPtr, - CONST CmdFrame* invoker, + const CmdFrame* invoker, int word) { register Interp *iPtr = (Interp *) interp; @@ -1066,8 +1066,8 @@ TclIncrObj( } if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - long augend = *((CONST long *)ptr1); - long addend = *((CONST long *)ptr2); + long augend = *((const long *)ptr1); + long addend = *((const long *)ptr2); long sum = augend + addend; /* Test for overflow */ if ((augend >= 0 || addend >= 0 || sum < 0) @@ -1516,7 +1516,7 @@ TclExecuteByteCode( NEXT_INST_F(5, 0, 0); #endif } else { - char *bytes; + const char *bytes; int length, opnd; Tcl_Obj *newObjResultPtr; @@ -1738,7 +1738,7 @@ TclExecuteByteCode( { Tcl_Obj **objv = (tosPtr - (objc-1)); int length; - char *bytes; + const char *bytes; /* * We keep the stack reference count as a (char *), as that works @@ -2454,7 +2454,7 @@ TclExecuteByteCode( objPtr = varPtr->value.objPtr; if (GetNumberFromObj(NULL, objPtr, &ptr, &type) == TCL_OK) { if (type == TCL_NUMBER_LONG) { - long augend = *((CONST long *)ptr); + long augend = *((const long *)ptr); long sum = augend + i; /* Test for overflow */ /* TODO: faster checking with known limits on i ? */ @@ -2496,7 +2496,7 @@ TclExecuteByteCode( #ifndef NO_WIDE_TYPE if (type == TCL_NUMBER_WIDE) { Tcl_WideInt sum; - w = *((CONST Tcl_WideInt *)ptr); + w = *((const Tcl_WideInt *)ptr); sum = w + i; /* Check for overflow */ @@ -3065,7 +3065,8 @@ TclExecuteByteCode( int found, s1len, s2len, llen, i; Tcl_Obj *valuePtr, *value2Ptr, *o; - char *s1, *s2; + char *s1; + const char *s2; value2Ptr = *tosPtr; valuePtr = *(tosPtr - 1); @@ -3201,7 +3202,7 @@ TclExecuteByteCode( * String compare */ - CONST char *s1, *s2; + const char *s1, *s2; int s1len, s2len, iResult; Tcl_Obj *valuePtr, *value2Ptr; @@ -3353,7 +3354,7 @@ TclExecuteByteCode( objResultPtr = Tcl_NewByteArrayObj((unsigned char *) (&bytes[index]), 1); } else if (valuePtr->bytes && length == valuePtr->length) { - objResultPtr = Tcl_NewStringObj((CONST char *) + objResultPtr = Tcl_NewStringObj((const char *) (&valuePtr->bytes[index]), 1); } else { char buf[TCL_UTF_MAX]; @@ -3362,7 +3363,7 @@ TclExecuteByteCode( ch = Tcl_GetUniChar(valuePtr, index); /* - * This could be: Tcl_NewUnicodeObj((CONST Tcl_UniChar *)&ch, + * This could be: Tcl_NewUnicodeObj((const Tcl_UniChar *)&ch, * 1) but creating the object as a string seems to be faster * in practical use. */ @@ -3458,21 +3459,21 @@ TclExecuteByteCode( } switch (type1) { case TCL_NUMBER_LONG: - l1 = *((CONST long *)ptr1); + l1 = *((const long *)ptr1); switch (type2) { case TCL_NUMBER_LONG: - l2 = *((CONST long *)ptr2); + l2 = *((const long *)ptr2); longCompare: compare = (l1 < l2) ? MP_LT : ((l1 > l2) ? MP_GT : MP_EQ); break; #ifndef NO_WIDE_TYPE case TCL_NUMBER_WIDE: - w2 = *((CONST Tcl_WideInt *)ptr2); + w2 = *((const Tcl_WideInt *)ptr2); w1 = (Tcl_WideInt)l1; goto wideCompare; #endif case TCL_NUMBER_DOUBLE: - d2 = *((CONST double *)ptr2); + d2 = *((const double *)ptr2); d1 = (double) l1; /* @@ -3521,19 +3522,19 @@ TclExecuteByteCode( #ifndef NO_WIDE_TYPE case TCL_NUMBER_WIDE: - w1 = *((CONST Tcl_WideInt *)ptr1); + w1 = *((const Tcl_WideInt *)ptr1); switch (type2) { case TCL_NUMBER_WIDE: - w2 = *((CONST Tcl_WideInt *)ptr2); + w2 = *((const Tcl_WideInt *)ptr2); wideCompare: compare = (w1 < w2) ? MP_LT : ((w1 > w2) ? MP_GT : MP_EQ); break; case TCL_NUMBER_LONG: - l2 = *((CONST long *)ptr2); + l2 = *((const long *)ptr2); w2 = (Tcl_WideInt)l2; goto wideCompare; case TCL_NUMBER_DOUBLE: - d2 = *((CONST double *)ptr2); + d2 = *((const double *)ptr2); d1 = (double) w1; if ((DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt)) || (w1 == (Tcl_WideInt) d1) || (modf(d2, &tmp) != 0.0)) { @@ -3562,15 +3563,15 @@ TclExecuteByteCode( #endif case TCL_NUMBER_DOUBLE: - d1 = *((CONST double *)ptr1); + d1 = *((const double *)ptr1); switch (type2) { case TCL_NUMBER_DOUBLE: - d2 = *((CONST double *)ptr2); + d2 = *((const double *)ptr2); doubleCompare: compare = (d1 < d2) ? MP_LT : ((d1 > d2) ? MP_GT : MP_EQ); break; case TCL_NUMBER_LONG: - l2 = *((CONST long *)ptr2); + l2 = *((const long *)ptr2); d2 = (double) l2; if ((DBL_MANT_DIG > CHAR_BIT*sizeof(long)) @@ -3589,7 +3590,7 @@ TclExecuteByteCode( goto longCompare; #ifndef NO_WIDE_TYPE case TCL_NUMBER_WIDE: - w2 = *((CONST Tcl_WideInt *)ptr2); + w2 = *((const Tcl_WideInt *)ptr2); d2 = (double) w2; if ((DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt)) || (w2 == (Tcl_WideInt) d2) || (modf(d1, &tmp) != 0.0)) { @@ -3643,7 +3644,7 @@ TclExecuteByteCode( mp_clear(&big1); break; case TCL_NUMBER_DOUBLE: - d2 = *((CONST double *)ptr2); + d2 = *((const double *)ptr2); if (TclIsInfinite(d2)) { compare = (d2 > 0.0) ? MP_LT : MP_GT; mp_clear(&big1); @@ -3754,7 +3755,7 @@ TclExecuteByteCode( long l2 = 0; /* silence gcc warning */ if (type2 == TCL_NUMBER_LONG) { - l2 = *((CONST long *)ptr2); + l2 = *((const long *)ptr2); if (l2 == 0) { TRACE(("%s %s => DIVIDE BY ZERO\n", O2S(valuePtr), O2S(value2Ptr))); @@ -3768,7 +3769,7 @@ TclExecuteByteCode( } } if (type1 == TCL_NUMBER_LONG) { - l1 = *((CONST long *)ptr1); + l1 = *((const long *)ptr1); if (l1 == 0) { /* 0 % (non-zero) always yields remainder of 0 */ objResultPtr = eePtr->constants[0]; @@ -3798,7 +3799,7 @@ TclExecuteByteCode( */ #ifndef NO_WIDE_TYPE if (type2 == TCL_NUMBER_WIDE) { - Tcl_WideInt w2 = *((CONST Tcl_WideInt *)ptr2); + Tcl_WideInt w2 = *((const Tcl_WideInt *)ptr2); if ((l1 > 0) ^ (w2 > (Tcl_WideInt)0)) { /* Arguments are opposite sign; remainder is sum */ @@ -3832,7 +3833,7 @@ TclExecuteByteCode( } #ifndef NO_WIDE_TYPE if (type1 == TCL_NUMBER_WIDE) { - Tcl_WideInt w1 = *((CONST Tcl_WideInt *)ptr1); + Tcl_WideInt w1 = *((const Tcl_WideInt *)ptr1); if (type2 != TCL_NUMBER_BIG) { Tcl_WideInt w2, wQuotient, wRemainder; @@ -3908,11 +3909,11 @@ TclExecuteByteCode( /* reject negative shift argument */ switch (type2) { case TCL_NUMBER_LONG: - invalid = (*((CONST long *)ptr2) < (long)0); + invalid = (*((const long *)ptr2) < (long)0); break; #ifndef NO_WIDE_TYPE case TCL_NUMBER_WIDE: - invalid = (*((CONST Tcl_WideInt *)ptr2) < (Tcl_WideInt)0); + invalid = (*((const Tcl_WideInt *)ptr2) < (Tcl_WideInt)0); break; #endif case TCL_NUMBER_BIG: @@ -3931,7 +3932,7 @@ TclExecuteByteCode( } /* Zero shifted any number of bits is still zero */ - if ((type1 == TCL_NUMBER_LONG) && (*((CONST long *)ptr1) == (long)0)) { + if ((type1 == TCL_NUMBER_LONG) && (*((const long *)ptr1) == (long)0)) { TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); objResultPtr = eePtr->constants[0]; TRACE(("%s\n", O2S(objResultPtr))); @@ -3946,7 +3947,7 @@ TclExecuteByteCode( * results. */ if ((type2 != TCL_NUMBER_LONG) - || (*((CONST long *)ptr2) > (long) INT_MAX)) { + || (*((const long *)ptr2) > (long) INT_MAX)) { /* * Technically, we could hold the value (1 << (INT_MAX+1)) in * an mp_int, but since we're using mp_mul_2d() to do the @@ -3959,13 +3960,13 @@ TclExecuteByteCode( result = TCL_ERROR; goto checkForCatch; } - shift = (int)(*((CONST long *)ptr2)); + shift = (int)(*((const long *)ptr2)); /* Handle shifts within the native long range */ TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); if ((type1 == TCL_NUMBER_LONG) && ((size_t)shift < CHAR_BIT*sizeof(long)) - && (l1 = *((CONST long *)ptr1)) + && (l1 = *((const long *)ptr1)) && !(((l1>0) ? l1 : ~l1) & -(1L<<(CHAR_BIT*sizeof(long)-1-shift)))) { TclNewLongObj(objResultPtr, (l1< ", O2S(valuePtr), O2S(value2Ptr))); if ((type2 != TCL_NUMBER_LONG) - || (*((CONST long *)ptr2) > INT_MAX)) { + || (*((const long *)ptr2) > INT_MAX)) { /* * Again, technically, the value to be shifted could be an * mp_int so huge that a right shift by (INT_MAX+1) bits could @@ -4005,11 +4006,11 @@ TclExecuteByteCode( switch (type1) { case TCL_NUMBER_LONG: - zero = (*((CONST long *)ptr1) > (long)0); + zero = (*((const long *)ptr1) > (long)0); break; #ifndef NO_WIDE_TYPE case TCL_NUMBER_WIDE: - zero = (*((CONST Tcl_WideInt *)ptr1) > (Tcl_WideInt)0); + zero = (*((const Tcl_WideInt *)ptr1) > (Tcl_WideInt)0); break; #endif case TCL_NUMBER_BIG: @@ -4028,10 +4029,10 @@ TclExecuteByteCode( TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); } - shift = (int)(*((CONST long *)ptr2)); + shift = (int)(*((const long *)ptr2)); /* Handle shifts within the native long range */ if (type1 == TCL_NUMBER_LONG) { - l1 = *((CONST long *)ptr1); + l1 = *((const long *)ptr1); if ((size_t)shift >= CHAR_BIT*sizeof(long)) { if (l1 >= (long)0) { objResultPtr = eePtr->constants[0]; @@ -4047,7 +4048,7 @@ TclExecuteByteCode( #ifndef NO_WIDE_TYPE /* Handle shifts within the native wide range */ if (type1 == TCL_NUMBER_WIDE) { - Tcl_WideInt w = *((CONST Tcl_WideInt *)ptr1); + Tcl_WideInt w = *((const Tcl_WideInt *)ptr1); if ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideInt)) { if (w >= (Tcl_WideInt)0) { objResultPtr = eePtr->constants[0]; @@ -4280,8 +4281,8 @@ TclExecuteByteCode( } #endif { - long lResult, l1 = *((CONST long *)ptr1); - long l2 = *((CONST long *)ptr2); + long lResult, l1 = *((const long *)ptr1); + long l2 = *((const long *)ptr2); switch (*pc) { case INST_BITAND: @@ -4668,8 +4669,8 @@ TclExecuteByteCode( if ((sizeof(long) >= 2*sizeof(int)) && (*pc == INST_MULT) && (type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - long l1 = *((CONST long *)ptr1); - long l2 = *((CONST long *)ptr2); + long l1 = *((const long *)ptr1); + long l2 = *((const long *)ptr2); if ((l1 <= INT_MAX) && (l1 >= INT_MIN) && (l2 <= INT_MAX) && (l2 >= INT_MIN)) { long lResult = l1 * l2; @@ -4710,7 +4711,7 @@ TclExecuteByteCode( long l1, l2 = 0; int oddExponent = 0, negativeExponent = 0; if (type2 == TCL_NUMBER_LONG) { - l2 = *((CONST long *)ptr2); + l2 = *((const long *)ptr2); if (l2 == 0) { /* Anything to the zero power is 1 */ objResultPtr = eePtr->constants[1]; @@ -4725,7 +4726,7 @@ TclExecuteByteCode( } #ifndef NO_WIDE_TYPE case TCL_NUMBER_WIDE: { - Tcl_WideInt w2 = *((CONST Tcl_WideInt *)ptr2); + Tcl_WideInt w2 = *((const Tcl_WideInt *)ptr2); negativeExponent = (w2 < 0); oddExponent = (int) (w2 & (Tcl_WideInt)1); break; @@ -4744,7 +4745,7 @@ TclExecuteByteCode( if (negativeExponent) { if (type1 == TCL_NUMBER_LONG) { - l1 = *((CONST long *)ptr1); + l1 = *((const long *)ptr1); switch (l1) { case 0: /* zero to a negative power is div by zero error */ @@ -4771,7 +4772,7 @@ TclExecuteByteCode( } if (type1 == TCL_NUMBER_LONG) { - l1 = *((CONST long *)ptr1); + l1 = *((const long *)ptr1); switch (l1) { case 0: /* zero to a positive power is zero */ @@ -4968,7 +4969,7 @@ TclExecuteByteCode( goto checkForCatch; } if (type == TCL_NUMBER_LONG) { - long l = *((CONST long *)ptr); + long l = *((const long *)ptr); if (Tcl_IsShared(valuePtr)) { TclNewLongObj(objResultPtr, ~l); NEXT_INST_F(1, 1, 1); @@ -4978,7 +4979,7 @@ TclExecuteByteCode( } #ifndef NO_WIDE_TYPE if (type == TCL_NUMBER_WIDE) { - Tcl_WideInt w = *((CONST Tcl_WideInt *)ptr); + Tcl_WideInt w = *((const Tcl_WideInt *)ptr); if (Tcl_IsShared(valuePtr)) { objResultPtr = Tcl_NewWideIntObj(~w); NEXT_INST_F(1, 1, 1); @@ -5021,15 +5022,15 @@ TclExecuteByteCode( double d; if (Tcl_IsShared(valuePtr)) { - TclNewDoubleObj(objResultPtr, -(*((CONST double *)ptr))); + TclNewDoubleObj(objResultPtr, -(*((const double *)ptr))); NEXT_INST_F(1, 1, 1); } - d = *((CONST double *)ptr); + d = *((const double *)ptr); TclSetDoubleObj(valuePtr, -d); NEXT_INST_F(1, 0, 0); } case TCL_NUMBER_LONG: { - long l = *((CONST long *)ptr); + long l = *((const long *)ptr); if (l != LONG_MIN) { if (Tcl_IsShared(valuePtr)) { TclNewLongObj(objResultPtr, -l); @@ -5044,9 +5045,9 @@ TclExecuteByteCode( case TCL_NUMBER_WIDE: { Tcl_WideInt w; if (type == TCL_NUMBER_LONG) { - w = (Tcl_WideInt)(*((CONST long *)ptr)); + w = (Tcl_WideInt)(*((const long *)ptr)); } else { - w = *((CONST Tcl_WideInt *)ptr); + w = *((const Tcl_WideInt *)ptr); } if (w != LLONG_MIN) { if (Tcl_IsShared(valuePtr)) { @@ -5064,11 +5065,11 @@ TclExecuteByteCode( switch (type) { #ifdef NO_WIDE_TYPE case TCL_NUMBER_LONG: - TclBNInitBignumFromLong(&big, *((CONST long *)ptr)); + TclBNInitBignumFromLong(&big, *((const long *)ptr)); break; #else case TCL_NUMBER_WIDE: - TclBNInitBignumFromWideInt(&big, *((CONST Tcl_WideInt*)ptr)); + TclBNInitBignumFromWideInt(&big, *((const Tcl_WideInt*)ptr)); break; #endif case TCL_NUMBER_BIG: @@ -5134,7 +5135,7 @@ TclExecuteByteCode( /* Numeric conversion of NaN -> error */ TRACE(("\"%.20s\" => IEEE FLOATING PT ERROR\n", O2S(objResultPtr))); - TclExprFloatError(interp, *((CONST double *)ptr)); + TclExprFloatError(interp, *((const double *)ptr)); } goto checkForCatch; } @@ -5965,7 +5966,7 @@ TclExecuteByteCode( * to process break, continue, and * errors. */ Tcl_Obj *valuePtr; - char *bytes; + const char *bytes; int length; #if TCL_COMPILE_DEBUG int opnd; @@ -6349,7 +6350,7 @@ IllegalExprOperandType( ClientData ptr; int type; unsigned char opcode = *pc; - CONST char *description, *operator = operatorStrings[opcode - INST_LOR]; + const char *description, *operator = operatorStrings[opcode - INST_LOR]; if (opcode == INST_EXPON) { operator = "**"; @@ -6357,7 +6358,7 @@ IllegalExprOperandType( if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) { int numBytes; - CONST char *bytes = Tcl_GetStringFromObj(opndPtr, &numBytes); + const char *bytes = Tcl_GetStringFromObj(opndPtr, &numBytes); if (numBytes == 0) { description = "empty string"; } else if (TclCheckBadOctal(NULL, bytes)) { @@ -6457,7 +6458,7 @@ TclGetSrcInfoForPc (cfPtr) } } -static char * +static const char * GetSrcInfoForPc( unsigned char *pc, /* The program counter value for which to * return the closest command's source info. @@ -6676,7 +6677,7 @@ TclExprFloatError( double value) /* Value returned after error; used to * distinguish underflows from overflows. */ { - CONST char *s; + const char *s; if ((errno == EDOM) || TclIsNaN(value)) { s = "domain error: argument not in valid range"; @@ -6757,7 +6758,7 @@ EvalStatsCmd( ClientData unused, /* Unused. */ Tcl_Interp *interp, /* The current interpreter. */ int objc, /* The number of arguments. */ - Tcl_Obj *CONST objv[]) /* The argument strings. */ + Tcl_Obj *const objv[]) /* The argument strings. */ { Interp *iPtr = (Interp *) interp; LiteralTable *globalTablePtr = &(iPtr->literalTable); diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 0e2fd20..adb94d0 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.77 2007/02/20 15:36:46 patthoyts Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.78 2007/02/20 23:24:03 nijtmans Exp $ */ #include "tclInt.h" @@ -28,16 +28,16 @@ TclPlatformType tclPlatform = TCL_PLATFORM_UNIX; * Prototypes for local procedures defined in this file: */ -static CONST char * DoTildeSubst(Tcl_Interp *interp, - CONST char *user, Tcl_DString *resultPtr); -static CONST char * ExtractWinRoot(CONST char *path, +static const char * DoTildeSubst(Tcl_Interp *interp, + const char *user, Tcl_DString *resultPtr); +static const char * ExtractWinRoot(const char *path, Tcl_DString *resultPtr, int offset, Tcl_PathType *typePtr); static int SkipToChar(char **stringPtr, int match); -static Tcl_Obj* SplitWinPath(CONST char *path); -static Tcl_Obj* SplitUnixPath(CONST char *path); +static Tcl_Obj* SplitWinPath(const char *path); +static Tcl_Obj* SplitUnixPath(const char *path); static int DoGlob(Tcl_Interp *interp, Tcl_Obj *resultPtr, - char *separators, Tcl_Obj *pathPtr, int flags, + const char *separators, Tcl_Obj *pathPtr, int flags, char *pattern, Tcl_GlobTypeData *types); /* @@ -86,9 +86,9 @@ SetResultLength(Tcl_DString *resultPtr, int offset, int extended) *---------------------------------------------------------------------- */ -static CONST char * +static const char * ExtractWinRoot( - CONST char *path, /* Path to parse. */ + const char *path, /* Path to parse. */ Tcl_DString *resultPtr, /* Buffer to hold result. */ int offset, /* Offset in buffer where result should be * stored. */ @@ -114,7 +114,7 @@ ExtractWinRoot( * Might be a UNC or Vol-Relative path. */ - CONST char *host, *share, *tail; + const char *host, *share, *tail; int hlen, slen; if (path[1] != '/' && path[1] != '\\') { @@ -328,7 +328,7 @@ ExtractWinRoot( Tcl_PathType Tcl_GetPathType( - CONST char *path) + const char *path) { Tcl_PathType type; Tcl_Obj *tempObj = Tcl_NewStringObj(path,-1); @@ -427,7 +427,7 @@ TclpGetNativePathType( } case TCL_PLATFORM_WINDOWS: { Tcl_DString ds; - CONST char *rootEnd; + const char *rootEnd; Tcl_DStringInit(&ds); rootEnd = ExtractWinRoot(path, &ds, 0, &type); @@ -528,10 +528,10 @@ TclpNativeSplitPath( void Tcl_SplitPath( - CONST char *path, /* Pointer to string containing a path. */ + 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. */ - CONST 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. */ @@ -565,7 +565,7 @@ Tcl_SplitPath( * plus the argv pointers and the terminating NULL pointer. */ - *argvPtr = (CONST char **) ckalloc((unsigned) + *argvPtr = (const char **) ckalloc((unsigned) ((((*argcPtr) + 1) * sizeof(char *)) + size)); /* @@ -619,10 +619,10 @@ Tcl_SplitPath( static Tcl_Obj * SplitUnixPath( - CONST char *path) /* Pointer to string containing a path. */ + const char *path) /* Pointer to string containing a path. */ { int length; - CONST char *p, *elementStart; + const char *p, *elementStart; Tcl_Obj *result = Tcl_NewObj(); /* @@ -696,10 +696,10 @@ SplitUnixPath( static Tcl_Obj * SplitWinPath( - CONST char *path) /* Pointer to string containing a path. */ + const char *path) /* Pointer to string containing a path. */ { int length; - CONST char *p, *elementStart; + const char *p, *elementStart; Tcl_PathType type = TCL_PATH_ABSOLUTE; Tcl_DString buf; Tcl_Obj *result = Tcl_NewObj(); @@ -774,7 +774,7 @@ Tcl_Obj * Tcl_FSJoinToPath( Tcl_Obj *pathPtr, /* Valid path or NULL. */ int objc, /* Number of array elements to join */ - Tcl_Obj *CONST objv[]) /* Path elements to join. */ + Tcl_Obj *const objv[]) /* Path elements to join. */ { int i; Tcl_Obj *lobj, *ret; @@ -944,7 +944,7 @@ TclpNativeJoinPath( char * Tcl_JoinPath( int argc, - CONST char *CONST *argv, + const char *const *argv, Tcl_DString *resultPtr) /* Pointer to previously initialized DString */ { int i, len; @@ -1015,7 +1015,7 @@ char * Tcl_TranslateFileName( Tcl_Interp *interp, /* Interpreter in which to store error message * (if necessary). */ - CONST 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 * "~" (to indicate any user's home * directory). */ @@ -1072,11 +1072,11 @@ Tcl_TranslateFileName( *---------------------------------------------------------------------- */ -CONST char * +const char * TclGetExtension( - CONST char *name) /* File name to parse. */ + const char *name) /* File name to parse. */ { - CONST char *p, *lastSep; + const char *p, *lastSep; /* * First find the last directory separator. @@ -1133,16 +1133,16 @@ TclGetExtension( *---------------------------------------------------------------------- */ -static CONST char * +static const char * DoTildeSubst( Tcl_Interp *interp, /* Interpreter in which to store error message * (if necessary). */ - CONST char *user, /* Name of user whose home directory should be + const char *user, /* Name of user whose home directory should be * substituted, or "" for current user. */ Tcl_DString *resultPtr) /* Initialized DString filled with name after * tilde substitution. */ { - CONST char *dir; + const char *dir; if (*user == '\0') { Tcl_DString dirString; @@ -1192,14 +1192,15 @@ Tcl_GlobObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int index, i, globFlags, length, join, dir, result; - char *string, *separators; + char *string; + const char *separators; Tcl_Obj *typePtr, *resultPtr, *look; Tcl_Obj *pathOrDir = NULL; Tcl_DString prefix; - static CONST char *options[] = { + static const char *options[] = { "-directory", "-join", "-nocomplain", "-path", "-tails", "-types", "--", NULL }; @@ -1599,7 +1600,7 @@ Tcl_GlobObjCmd( Tcl_AppendResult(interp, Tcl_DStringValue(&prefix), (char *) NULL); } else { - char *sep = ""; + const char *sep = ""; for (i = 0; i < objc; i++) { string = Tcl_GetString(objv[i]); Tcl_AppendResult(interp, sep, string, (char *) NULL); @@ -1673,8 +1674,8 @@ TclGlob( Tcl_GlobTypeData *types) /* Struct containing acceptable types. May be * NULL. */ { - char *separators; - CONST char *head; + const char *separators; + const char *head; char *tail, *start; int result; Tcl_Obj *filenamesObj, *savedResultObj; @@ -1936,7 +1937,7 @@ TclGlob( int objc, i; Tcl_Obj **objv; int prefixLen; - CONST char *pre; + const char *pre; /* * If this length has never been set, set it here. @@ -2092,7 +2093,7 @@ DoGlob( * resulting filenames. Caller allocates and * deallocates; DoGlob must not touch the * refCount of this object. */ - char *separators, /* String containing separator characters that + const char *separators, /* String containing separator characters that * should be used to identify globbing * boundaries. */ Tcl_Obj *pathPtr, /* Completely expanded prefix. */ @@ -2399,7 +2400,7 @@ DoGlob( #if defined(__CYGWIN__) && defined(__WIN32__) { - extern int cygwin_conv_to_win32_path(CONST char *, char *); + extern int cygwin_conv_to_win32_path(const char *, char *); char winbuf[MAX_PATH+1]; cygwin_conv_to_win32_path(Tcl_DStringValue(&append), winbuf); @@ -2438,7 +2439,7 @@ DoGlob( */ int len; - CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len); + const char *joined = Tcl_GetStringFromObj(joinedPtr,&len); if (strchr(separators, joined[len-1]) == NULL) { Tcl_AppendToObj(joinedPtr, "/", 1); @@ -2474,7 +2475,7 @@ DoGlob( */ int len; - CONST char *joined = Tcl_GetStringFromObj(joinedPtr,&len); + const char *joined = Tcl_GetStringFromObj(joinedPtr,&len); if (strchr(separators, joined[len-1]) == NULL) { if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) { diff --git a/generic/tclHash.c b/generic/tclHash.c index 61837d5..542e89c 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.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: tclHash.c,v 1.27 2006/11/13 08:23:08 das Exp $ + * RCS: @(#) $Id: tclHash.c,v 1.28 2007/02/20 23:24:04 nijtmans Exp $ */ #include "tclInt.h" @@ -74,8 +74,8 @@ static unsigned int HashStringKey(Tcl_HashTable *tablePtr, VOID *keyPtr); */ #if TCL_PRESERVE_BINARY_COMPATABILITY -static Tcl_HashEntry * BogusFind(Tcl_HashTable *tablePtr, CONST char *key); -static Tcl_HashEntry * BogusCreate(Tcl_HashTable *tablePtr, CONST char *key, +static Tcl_HashEntry * BogusFind(Tcl_HashTable *tablePtr, const char *key); +static Tcl_HashEntry * BogusCreate(Tcl_HashTable *tablePtr, const char *key, int *newPtr); #endif @@ -174,7 +174,7 @@ Tcl_InitCustomHashTable( * TCL_STRING_KEYS, TCL_ONE_WORD_KEYS, * TCL_CUSTOM_TYPE_KEYS, TCL_CUSTOM_PTR_KEYS, * or an integer >= 2. */ - Tcl_HashKeyType *typePtr) /* Pointer to structure which defines the + Tcl_HashKeyType *typePtr) /* Pointer to structure which defines the * behaviour of this table. */ { #if (TCL_SMALL_HASH_TABLE != 4) @@ -261,7 +261,7 @@ Tcl_InitCustomHashTable( Tcl_HashEntry * Tcl_FindHashEntry( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - CONST char *key) /* Key to use to find matching entry. */ + const char *key) /* Key to use to find matching entry. */ { return Tcl_CreateHashEntry(tablePtr, key, NULL); @@ -292,13 +292,13 @@ Tcl_FindHashEntry( Tcl_HashEntry * Tcl_CreateHashEntry( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - CONST char *key, /* Key to use to find or create matching + const char *key, /* Key to use to find or create matching * entry. */ int *newPtr) /* Store info here telling whether a new entry * was created. */ { register Tcl_HashEntry *hPtr; - Tcl_HashKeyType *typePtr; + const Tcl_HashKeyType *typePtr; unsigned int hash; int index; @@ -435,7 +435,7 @@ Tcl_DeleteHashEntry( Tcl_HashEntry *entryPtr) { register Tcl_HashEntry *prevPtr; - Tcl_HashKeyType *typePtr; + const Tcl_HashKeyType *typePtr; Tcl_HashTable *tablePtr; Tcl_HashEntry **bucketPtr; #if TCL_HASH_KEY_STORE_HASH @@ -516,7 +516,7 @@ Tcl_DeleteHashTable( register Tcl_HashTable *tablePtr) /* Table to delete. */ { register Tcl_HashEntry *hPtr, *nextPtr; - Tcl_HashKeyType *typePtr; + const Tcl_HashKeyType *typePtr; int i; #if TCL_PRESERVE_BINARY_COMPATABILITY @@ -669,7 +669,7 @@ Tcl_NextHashEntry( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_HashStats( Tcl_HashTable *tablePtr) /* Table for which to produce stats. */ { @@ -678,7 +678,7 @@ Tcl_HashStats( double average, tmp; register Tcl_HashEntry *hPtr; char *result, *p; - Tcl_HashKeyType *typePtr; + const Tcl_HashKeyType *typePtr; #if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { @@ -813,8 +813,8 @@ CompareArrayKeys( VOID *keyPtr, /* New key to compare. */ Tcl_HashEntry *hPtr) /* Existing key to compare. */ { - register CONST int *iPtr1 = (CONST int *) keyPtr; - register CONST int *iPtr2 = (CONST int *) hPtr->key.words; + register const int *iPtr1 = (const int *) keyPtr; + register const int *iPtr2 = (const int *) hPtr->key.words; Tcl_HashTable *tablePtr = hPtr->tablePtr; int count; @@ -852,7 +852,7 @@ HashArrayKey( Tcl_HashTable *tablePtr, /* Hash table. */ VOID *keyPtr) /* Key from which to compute hash value. */ { - register CONST int *array = (CONST int *) keyPtr; + register const int *array = (const int *) keyPtr; register unsigned int result; int count; @@ -884,7 +884,7 @@ AllocStringEntry( Tcl_HashTable *tablePtr, /* Hash table. */ VOID *keyPtr) /* Key to store in the hash table entry. */ { - CONST char *string = (CONST char *) keyPtr; + const char *string = (const char *) keyPtr; Tcl_HashEntry *hPtr; unsigned int size; @@ -920,8 +920,8 @@ CompareStringKeys( VOID *keyPtr, /* New key to compare. */ Tcl_HashEntry *hPtr) /* Existing key to compare. */ { - register CONST char *p1 = (CONST char *) keyPtr; - register CONST char *p2 = (CONST char *) hPtr->key.string; + register const char *p1 = (const char *) keyPtr; + register const char *p2 = (const char *) hPtr->key.string; #ifdef TCL_COMPARE_HASHES_WITH_STRCMP return !strcmp(p1, p2); @@ -960,7 +960,7 @@ HashStringKey( Tcl_HashTable *tablePtr, /* Hash table. */ VOID *keyPtr) /* Key from which to compute hash value. */ { - register CONST char *string = (CONST char *) keyPtr; + register const char *string = (const char *) keyPtr; register unsigned int result; register int c; @@ -1011,7 +1011,7 @@ HashStringKey( static Tcl_HashEntry * BogusFind( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - CONST char *key) /* Key to use to find matching entry. */ + const char *key) /* Key to use to find matching entry. */ { Tcl_Panic("called %s on deleted table", "Tcl_FindHashEntry"); return NULL; @@ -1038,7 +1038,7 @@ BogusFind( static Tcl_HashEntry * BogusCreate( Tcl_HashTable *tablePtr, /* Table in which to lookup entry. */ - CONST char *key, /* Key to use to find or create matching + const char *key, /* Key to use to find or create matching * entry. */ int *newPtr) /* Store info here telling whether a new entry * was created. */ @@ -1074,7 +1074,7 @@ RebuildTable( Tcl_HashEntry **oldBuckets; register Tcl_HashEntry **oldChainPtr, **newChainPtr; register Tcl_HashEntry *hPtr; - Tcl_HashKeyType *typePtr; + const Tcl_HashKeyType *typePtr; #if TCL_PRESERVE_BINARY_COMPATABILITY if (tablePtr->keyType == TCL_STRING_KEYS) { diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index d3cc36a..108af57 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.37 2006/12/04 23:13:20 dkf Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.38 2007/02/20 23:24:04 nijtmans Exp $ */ #include "tclInt.h" @@ -60,12 +60,12 @@ Tcl_PutsObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to puts on. */ Tcl_Obj *string; /* String to write. */ int newline; /* Add a newline at end? */ - char *channelId; /* Name of channel for puts. */ + const char *channelId; /* Name of channel for puts. */ int result; /* Result of puts operation. */ int mode; /* Mode in which channel is opened. */ @@ -180,7 +180,7 @@ Tcl_FlushObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to flush on. */ char *channelId; @@ -241,7 +241,7 @@ Tcl_GetsObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to read from. */ int lineLen; /* Length of line just read. */ @@ -322,7 +322,7 @@ Tcl_ReadObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to read from. */ int newline, i; /* Discard newline at end? */ @@ -458,7 +458,7 @@ Tcl_SeekObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to tell on. */ Tcl_WideInt offset; /* Where to seek? */ @@ -466,7 +466,7 @@ Tcl_SeekObjCmd( Tcl_WideInt result; /* Of calling Tcl_Seek. */ char *chanName; int optionIndex; - static CONST char *originOptions[] = { + static const char *originOptions[] = { "start", "current", "end", NULL }; static int modeArray[] = {SEEK_SET, SEEK_CUR, SEEK_END}; @@ -532,7 +532,7 @@ Tcl_TellObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to tell on. */ char *chanName; @@ -593,7 +593,7 @@ Tcl_CloseObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; /* The channel to close. */ char *arg; @@ -663,7 +663,7 @@ Tcl_FconfigureObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { char *chanName, *optionName, *valueName; Tcl_Channel chan; /* The channel to set a mode on. */ @@ -742,7 +742,7 @@ Tcl_EofObjCmd( ClientData unused, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; int dummy; @@ -786,7 +786,7 @@ Tcl_ExecObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { /* * This function generates an argv array for the string arguments. It @@ -796,13 +796,13 @@ Tcl_ExecObjCmd( #define NUM_ARGS 20 Tcl_Obj *resultPtr; - CONST char **argv; + const char **argv; char *string; Tcl_Channel chan; - CONST char *argStorage[NUM_ARGS]; + const char *argStorage[NUM_ARGS]; int argc, background, i, index, keepNewline, result, skip, length; int ignoreStderr; - static CONST char *options[] = { + static const char *options[] = { "-ignorestderr", "-keepnewline", "--", NULL }; enum options { @@ -857,7 +857,7 @@ Tcl_ExecObjCmd( argv = argStorage; argc = objc - skip; if ((size_t)(argc + 1) > sizeof(argv) / sizeof(argv[0])) { - argv = (CONST char **) ckalloc((unsigned)(argc + 1) * sizeof(char *)); + argv = (const char **) ckalloc((unsigned)(argc + 1) * sizeof(char *)); } /* @@ -966,7 +966,7 @@ Tcl_FblockedObjCmd( ClientData unused, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; int mode; @@ -1015,10 +1015,10 @@ Tcl_OpenObjCmd( ClientData notUsed, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int pipeline, prot; - char *modeString, *what; + const char *modeString, *what; Tcl_Channel chan; if ((objc < 2) || (objc > 4)) { @@ -1051,7 +1051,7 @@ Tcl_OpenObjCmd( chan = Tcl_FSOpenFileChannel(interp, objv[1], modeString, prot); } else { int mode, seekFlag, cmdObjc, binary; - CONST char **cmdArgv; + const char **cmdArgv; if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) { return TCL_ERROR; @@ -1374,9 +1374,9 @@ Tcl_SocketObjCmd( ClientData notUsed, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *socketOptions[] = { + static const char *socketOptions[] = { "-async", "-myaddr", "-myport","-server", NULL }; enum socketOptions { @@ -1558,14 +1558,14 @@ Tcl_FcopyObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel inChan, outChan; char *arg; int mode, i; int toRead, index; Tcl_Obj *cmdPtr; - static CONST char* switches[] = { "-size", "-command", NULL }; + static const char* switches[] = { "-size", "-command", NULL }; enum { FcopySize, FcopyCommand }; if ((objc < 3) || (objc > 7) || (objc == 4) || (objc == 6)) { @@ -1648,12 +1648,12 @@ TclChanPendingObjCmd( ClientData unused, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; int index, mode; char *arg; - static CONST char *options[] = {"input", "output", (char *) NULL}; + static const char *options[] = {"input", "output", (char *) NULL}; enum options {PENDING_INPUT, PENDING_OUTPUT}; if (objc != 3) { @@ -1713,7 +1713,7 @@ TclChanTruncateObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Channel chan; int mode; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 8926fc5..fcb40a7 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.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: tclIORChan.c,v 1.18 2006/11/15 20:08:44 dgp Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.19 2007/02/20 23:24:04 nijtmans Exp $ */ #include @@ -37,7 +37,7 @@ static int ReflectClose(ClientData clientData, Tcl_Interp *interp); static int ReflectInput(ClientData clientData, char *buf, int toRead, int *errorCodePtr); -static int ReflectOutput(ClientData clientData, CONST char *buf, +static int ReflectOutput(ClientData clientData, const char *buf, int toWrite, int *errorCodePtr); static void ReflectWatch(ClientData clientData, int mask); static int ReflectBlock(ClientData clientData, int mode); @@ -46,11 +46,11 @@ static Tcl_WideInt ReflectSeekWide(ClientData clientData, static int ReflectSeek(ClientData clientData, long offset, int mode, int *errorCodePtr); static int ReflectGetOption(ClientData clientData, - Tcl_Interp *interp, CONST char *optionName, + Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); static int ReflectSetOption(ClientData clientData, - Tcl_Interp *interp, CONST char *optionName, - CONST char *newValue); + Tcl_Interp *interp, const char *optionName, + const char *newValue); /* * The C layer channel type/driver definition used by the reflection. This is @@ -140,7 +140,7 @@ typedef struct { * Event literals. ================================================== */ -static CONST char *eventOptions[] = { +static const char *eventOptions[] = { "read", "write", NULL }; typedef enum { @@ -151,7 +151,7 @@ typedef enum { * Method literals. ================================================== */ -static CONST char *methodNames[] = { +static const char *methodNames[] = { "blocking", /* OPT */ "cget", /* OPT \/ Together or none */ "cgetall", /* OPT /\ of these two */ @@ -247,7 +247,7 @@ struct ForwardParamInput { }; struct ForwardParamOutput { ForwardParamBase base; /* "Supertype". MUST COME FIRST. */ - CONST char *buf; /* I: Where the bytes to write come from */ + const char *buf; /* I: Where the bytes to write come from */ int toWrite; /* I: #bytes to write, * O: #bytes actually written */ }; @@ -267,12 +267,12 @@ struct ForwardParamBlock { }; struct ForwardParamSetOpt { ForwardParamBase base; /* "Supertype". MUST COME FIRST. */ - CONST char *name; /* Name of option to set */ - CONST char *value; /* Value to set */ + const char *name; /* Name of option to set */ + const char *value; /* Value to set */ }; struct ForwardParamGetOpt { ForwardParamBase base; /* "Supertype". MUST COME FIRST. */ - CONST char *name; /* Name of option to get, maybe NULL */ + const char *name; /* Name of option to get, maybe NULL */ Tcl_DString *value; /* Result */ }; @@ -350,7 +350,7 @@ TCL_DECLARE_MUTEX(rcForwardMutex) */ static void ForwardOpToOwnerThread(ReflectedChannel *rcPtr, - ForwardedOperation op, CONST VOID *param); + ForwardedOperation op, const VOID *param); static int ForwardProc(Tcl_Event *evPtr, int mask); static void SrcExitProc(ClientData clientData); static void DstExitProc(ClientData clientData); @@ -393,14 +393,14 @@ static void UnmarshallErrorResult(Tcl_Interp *interp, */ static int EncodeEventMask(Tcl_Interp *interp, - CONST char *objName, Tcl_Obj *obj, int *mask); + const char *objName, Tcl_Obj *obj, int *mask); static Tcl_Obj * DecodeEventMask(int mask); static ReflectedChannel * NewReflectedChannel(Tcl_Interp *interp, Tcl_Obj *cmdpfxObj, int mode, Tcl_Obj *handleObj); static Tcl_Obj * NextHandle(void); static void FreeReflectedChannel(ReflectedChannel *rcPtr); static int InvokeTclMethod(ReflectedChannel *rcPtr, - CONST char *method, Tcl_Obj *argOneObj, + const char *method, Tcl_Obj *argOneObj, Tcl_Obj *argTwoObj, Tcl_Obj **resultObjPtr); /* @@ -410,14 +410,14 @@ static int InvokeTclMethod(ReflectedChannel *rcPtr, * list-quoting to keep the words of the message together. See also [x]. */ -static CONST char *msg_read_unsup = "{read not supported by Tcl driver}"; -static CONST char *msg_read_toomuch = "{read delivered more than requested}"; -static CONST char *msg_write_unsup = "{write not supported by Tcl driver}"; -static CONST char *msg_write_toomuch = "{write wrote more than requested}"; -static CONST char *msg_seek_beforestart = "{Tried to seek before origin}"; +static const char *msg_read_unsup = "{read not supported by Tcl driver}"; +static const char *msg_read_toomuch = "{read delivered more than requested}"; +static const char *msg_write_unsup = "{write not supported by Tcl driver}"; +static const char *msg_write_toomuch = "{write wrote more than requested}"; +static const char *msg_seek_beforestart = "{Tried to seek before origin}"; #ifdef TCL_THREADS -static CONST char *msg_send_originlost = "{Origin thread lost}"; -static CONST char *msg_send_dstlost = "{Destination thread lost}"; +static const char *msg_send_originlost = "{Origin thread lost}"; +static const char *msg_send_dstlost = "{Destination thread lost}"; #endif /* TCL_THREADS */ /* @@ -447,7 +447,7 @@ TclChanCreateObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST *objv) + Tcl_Obj *const *objv) { ReflectedChannel *rcPtr; /* Instance data of the new channel */ Tcl_Obj *rcId; /* Handle of the new channel */ @@ -698,7 +698,7 @@ TclChanPostEventObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST *objv) + Tcl_Obj *const *objv) { /* * Syntax: chan postevent CHANNEL EVENTSPEC @@ -713,9 +713,9 @@ TclChanPostEventObjCmd( #define CHAN (1) #define EVENT (2) - CONST char *chanId; /* Tcl level channel handle */ + const char *chanId; /* Tcl level channel handle */ Tcl_Channel chan; /* Channel associated to the handle */ - Tcl_ChannelType *chanTypePtr; + const Tcl_ChannelType *chanTypePtr; /* Its associated driver structure */ ReflectedChannel *rcPtr; /* Associated instance data */ int mode; /* Dummy, r|w mode of the channel */ @@ -1151,7 +1151,7 @@ ReflectInput( static int ReflectOutput( ClientData clientData, - CONST char *buf, + const char *buf, int toWrite, int *errorCodePtr) { @@ -1485,8 +1485,8 @@ static int ReflectSetOption( ClientData clientData, /* Channel to query */ Tcl_Interp *interp, /* Interpreter to leave error messages in */ - CONST char *optionName, /* Name of requested option */ - CONST char *newValue) /* The new value */ + const char *optionName, /* Name of requested option */ + const char *newValue) /* The new value */ { ReflectedChannel *rcPtr = (ReflectedChannel *) clientData; Tcl_Obj *optionObj; @@ -1550,7 +1550,7 @@ static int ReflectGetOption( ClientData clientData, /* Channel to query */ Tcl_Interp *interp, /* Interpreter to leave error messages in */ - CONST char *optionName, /* Name of reuqested option */ + const char *optionName, /* Name of reuqested option */ Tcl_DString *dsPtr) /* String to place the result into */ { /* @@ -1700,7 +1700,7 @@ ReflectGetOption( static int EncodeEventMask( Tcl_Interp *interp, - CONST char *objName, + const char *objName, Tcl_Obj *obj, int *mask) { @@ -1762,7 +1762,7 @@ static Tcl_Obj * DecodeEventMask( int mask) { - register CONST char *eventStr; + register const char *eventStr; Tcl_Obj *evObj; switch (mask & RANDW) { @@ -1962,7 +1962,7 @@ FreeReflectedChannel(rcPtr) static int InvokeTclMethod( ReflectedChannel *rcPtr, - CONST char *method, + const char *method, Tcl_Obj *argOneObj, /* NULL'able */ Tcl_Obj *argTwoObj, /* NULL'able */ Tcl_Obj **resultObjPtr) /* NULL'able */ @@ -2039,7 +2039,7 @@ InvokeTclMethod( if (result != TCL_ERROR) { Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rcPtr->argv); int cmdLen; - CONST char *cmdString = Tcl_GetStringFromObj(cmd, &cmdLen); + const char *cmdString = Tcl_GetStringFromObj(cmd, &cmdLen); Tcl_IncrRefCount(cmd); Tcl_ResetResult(rcPtr->interp); @@ -2093,7 +2093,7 @@ static void ForwardOpToOwnerThread( ReflectedChannel *rcPtr, /* Channel instance */ ForwardedOperation op, /* Forwarded driver operation */ - CONST VOID *param) /* Arguments */ + const VOID *param) /* Arguments */ { Tcl_ThreadId dst = rcPtr->thread; ForwardingEvent *evPtr; @@ -2406,7 +2406,7 @@ ForwardProc( ForwardSetDynamicError(paramPtr, buf); } else { int len; - CONST char *str = Tcl_GetStringFromObj(resObj, &len); + const char *str = Tcl_GetStringFromObj(resObj, &len); if (len) { Tcl_DStringAppend(paramPtr->getOpt.value, " ", 1); @@ -2530,7 +2530,7 @@ ForwardSetObjError( Tcl_Obj *obj) { int len; - CONST char *msgStr = Tcl_GetStringFromObj(obj, &len); + const char *msgStr = Tcl_GetStringFromObj(obj, &len); len++; ForwardSetDynamicError(paramPtr, ckalloc((unsigned) len)); diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 69e2351..6887b0c 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.10 2005/11/07 15:17:25 dkf Exp $ + * RCS: @(#) $Id: tclIOSock.c,v 1.11 2007/02/20 23:24:04 nijtmans Exp $ */ #include "tclInt.h" @@ -35,13 +35,13 @@ int TclSockGetPort( Tcl_Interp *interp, - char *string, /* Integer or service name */ - char *proto, /* "tcp" or "udp", typically */ + const char *string, /* Integer or service name */ + const char *proto, /* "tcp" or "udp", typically */ int *portPtr) /* Return port number */ { struct servent *sp; /* Protocol info for named services */ Tcl_DString ds; - CONST char *native; + const char *native; if (Tcl_GetInt(NULL, string, portPtr) != TCL_OK) { /* diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index dc49a50..a8401f7 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.139 2007/02/19 23:50:28 hobbs Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.140 2007/02/20 23:24:04 nijtmans Exp $ */ #include "tclInt.h" @@ -32,9 +32,9 @@ static FilesystemRecord*FsGetFirstFilesystem(void); static void FsThrExitProc(ClientData cd); -static Tcl_Obj * FsListMounts(Tcl_Obj *pathPtr, CONST char *pattern); +static Tcl_Obj * FsListMounts(Tcl_Obj *pathPtr, const char *pattern); static void FsAddMountsToGlobResult(Tcl_Obj *resultPtr, - Tcl_Obj *pathPtr, CONST char *pattern, + Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types); static void FsUpdateCwd(Tcl_Obj *cwdObj, ClientData clientData); @@ -49,8 +49,8 @@ static void FsRecacheFilesystemList(void); * they are not (and should not be) used anywhere else. */ -MODULE_SCOPE CONST char * tclpFileAttrStrings[]; -MODULE_SCOPE CONST TclFileAttrProcs tclpFileAttrProcs[]; +MODULE_SCOPE const char * tclpFileAttrStrings[]; +MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; /* * The following functions are obsolete string based APIs, and should be @@ -61,7 +61,7 @@ MODULE_SCOPE CONST TclFileAttrProcs tclpFileAttrProcs[]; /* Obsolete */ int Tcl_Stat( - CONST char *path, /* Path of file to stat (in current CP). */ + const char *path, /* Path of file to stat (in current CP). */ struct stat *oldStyleBuf) /* Filled with results of stat call. */ { int ret; @@ -147,7 +147,7 @@ Tcl_Stat( /* Obsolete */ int Tcl_Access( - CONST char *path, /* Path of file to access (in current CP). */ + const char *path, /* Path of file to access (in current CP). */ int mode) /* Permission setting. */ { int ret; @@ -165,8 +165,8 @@ Tcl_Channel Tcl_OpenFileChannel( Tcl_Interp *interp, /* Interpreter for error reporting; can be * NULL. */ - CONST char *path, /* Name of file to open. */ - CONST char *modeString, /* A list of POSIX open modes or a string such + const char *path, /* Name of file to open. */ + const char *modeString, /* A list of POSIX open modes or a string such * as "rw". */ int permissions) /* If the open involves creating a file, with * what modes to create it? */ @@ -184,7 +184,7 @@ Tcl_OpenFileChannel( /* Obsolete */ int Tcl_Chdir( - CONST char *dirName) + const char *dirName) { int ret; Tcl_Obj *pathPtr = Tcl_NewStringObj(dirName,-1); @@ -216,7 +216,7 @@ Tcl_GetCwd( int Tcl_EvalFile( Tcl_Interp *interp, /* Interpreter in which to process file. */ - CONST char *fileName) /* Name of file to process. Tilde-substitution + const char *fileName) /* Name of file to process. Tilde-substitution * will be performed on this name. */ { int ret; @@ -449,7 +449,7 @@ typedef struct FsDivertLoad { Tcl_LoadHandle loadHandle; Tcl_FSUnloadFileProc *unloadProcPtr; Tcl_Obj *divertedFile; - Tcl_Filesystem *divertedFilesystem; + const Tcl_Filesystem *divertedFilesystem; ClientData divertedFileNativeRep; } FsDivertLoad; @@ -567,7 +567,7 @@ TclFSCwdPointerEquals( return 1; } else { int len1, len2; - CONST char *str1, *str2; + const char *str1, *str2; str1 = Tcl_GetStringFromObj(tsdPtr->cwdPathPtr, &len1); str2 = Tcl_GetStringFromObj(*pathPtrPtr, &len2); @@ -1064,12 +1064,12 @@ Tcl_FSMatchInDirectory( * may be NULL. */ Tcl_Obj *resultPtr, /* List object to receive results. */ Tcl_Obj *pathPtr, /* Contains path to directory to search. */ - CONST 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. */ { - Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr; Tcl_Obj *cwd, *tmpResultPtr, **elemsPtr; int resLength, i, ret = -1; @@ -1187,7 +1187,7 @@ FsAddMountsToGlobResult( Tcl_Obj *resultPtr, /* The current list of matching paths; must * not be shared! */ Tcl_Obj *pathPtr, /* The directory in question */ - CONST 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. */ @@ -1232,8 +1232,8 @@ FsAddMountsToGlobResult( } if (!found && dir) { int len, mlen; - CONST char *path; - CONST char *mount; + const char *path; + const char *mount; Tcl_Obj *norm; /* @@ -1357,7 +1357,7 @@ Tcl_FSMountsChanged( ClientData Tcl_FSData( - Tcl_Filesystem *fsPtr) /* The filesystem record to query. */ + Tcl_Filesystem *fsPtr) /* The filesystem record to query. */ { ClientData retVal = NULL; FilesystemRecord *fsRecPtr = FsGetFirstFilesystem(); @@ -1488,7 +1488,7 @@ int TclGetOpenMode( Tcl_Interp *interp, /* Interpreter to use for error reporting - * may be NULL. */ - CONST char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */ + const char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */ int *seekFlagPtr) /* Set this to 1 if the caller should seek to * EOF during the opening of the file. */ { @@ -1528,7 +1528,7 @@ int TclGetOpenModeEx( Tcl_Interp *interp, /* Interpreter to use for error reporting - * may be NULL. */ - CONST char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */ + const char *modeString, /* Mode string, e.g. "r+" or "RDONLY CREAT" */ int *seekFlagPtr, /* Set this to 1 if the caller should seek to * EOF during the opening of the file. */ int *binaryPtr) /* Set this to 1 if the caller should @@ -1536,7 +1536,7 @@ TclGetOpenModeEx( * operations */ { int mode, modeArgc, c, i, gotRW; - CONST char **modeArgv, *flag; + const char **modeArgv, *flag; #define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) /* @@ -1738,7 +1738,7 @@ Tcl_FSEvalFileEx( Tcl_Interp *interp, /* Interpreter in which to process file. */ Tcl_Obj *pathPtr, /* Path of file to process. Tilde-substitution * will be performed on this name. */ - CONST char *encodingName) /* If non-NULL, then use this encoding for the + const char *encodingName) /* If non-NULL, then use this encoding for the * file. NULL means use the system encoding. */ { int result, length; @@ -1830,7 +1830,7 @@ Tcl_FSEvalFileEx( * Record information telling where the error occurred. */ - CONST char *pathString = Tcl_GetStringFromObj(pathPtr, &length); + const char *pathString = Tcl_GetStringFromObj(pathPtr, &length); int limit = 150; int overflow = (length > limit); @@ -1912,12 +1912,12 @@ Tcl_SetErrno( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_PosixError( Tcl_Interp *interp) /* Interpreter whose errorCode field is to be * set. */ { - CONST char *id, *msg; + const char *id, *msg; msg = Tcl_ErrnoMsg(errno); id = Tcl_ErrnoId(); @@ -1951,7 +1951,7 @@ Tcl_FSStat( Tcl_Obj *pathPtr, /* Path of file to stat (in current CP). */ Tcl_StatBuf *buf) /* Filled with results of stat call. */ { - Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr; #ifdef USE_OBSOLETE_FS_HOOKS struct stat oldStyleStatBuffer; int retVal = -1; @@ -2044,7 +2044,7 @@ Tcl_FSLstat( Tcl_Obj *pathPtr, /* Path of file to stat (in current CP). */ Tcl_StatBuf *buf) /* Filled with results of stat call. */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSLstatProc *proc = fsPtr->lstatProc; if (proc != NULL) { @@ -2082,7 +2082,7 @@ Tcl_FSAccess( Tcl_Obj *pathPtr, /* Path of file to access (in current CP). */ int mode) /* Permission setting. */ { - Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr; #ifdef USE_OBSOLETE_FS_HOOKS int retVal = -1; @@ -2154,12 +2154,12 @@ Tcl_FSOpenFileChannel( Tcl_Interp *interp, /* Interpreter for error reporting; can be * NULL. */ Tcl_Obj *pathPtr, /* Name of file to open. */ - CONST char *modeString, /* A list of POSIX open modes or a string such + const char *modeString, /* A list of POSIX open modes or a string such * as "rw". */ int permissions) /* If the open involves creating a file, with * what modes to create it? */ { - Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr; Tcl_Channel retVal = NULL; #ifdef USE_OBSOLETE_FS_HOOKS @@ -2287,7 +2287,7 @@ Tcl_FSUtime( struct utimbuf *tval) /* Structure containing access/modification * times to use. Should not be modified. */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSUtimeProc *proc = fsPtr->utimeProc; if (proc != NULL) { @@ -2317,7 +2317,7 @@ Tcl_FSUtime( *---------------------------------------------------------------------- */ -static CONST char ** +static const char ** NativeFileAttrStrings( Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) @@ -2411,12 +2411,12 @@ NativeFileAttrsSet( *---------------------------------------------------------------------- */ -CONST char ** +const char ** Tcl_FSFileAttrStrings( Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSFileAttrStringsProc *proc = fsPtr->fileAttrStringsProc; @@ -2449,11 +2449,11 @@ int TclFSFileAttrIndex( Tcl_Obj *pathPtr, /* File whose attributes are to be indexed * into. */ - CONST char *attributeName, /* The attribute being looked for. */ + const char *attributeName, /* The attribute being looked for. */ int *indexPtr) /* Where to write the found index. */ { Tcl_Obj *listObj = NULL; - CONST char **attrTable; + const char **attrTable; /* * Get the attribute table for the file. @@ -2533,7 +2533,7 @@ Tcl_FSFileAttrsGet( Tcl_Obj *pathPtr, /* filename we are operating on. */ Tcl_Obj **objPtrRef) /* for output. */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSFileAttrsGetProc *proc = fsPtr->fileAttrsGetProc; @@ -2570,7 +2570,7 @@ Tcl_FSFileAttrsSet( Tcl_Obj *pathPtr, /* filename we are operating on. */ Tcl_Obj *objPtr) /* Input value. */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSFileAttrsSetProc *proc = fsPtr->fileAttrsSetProc; @@ -2726,7 +2726,7 @@ Tcl_FSGetCwd( * the permissions on that directory have changed. */ - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr); /* * If the filesystem couldn't be found, or if no cwd function exists @@ -2859,7 +2859,7 @@ int Tcl_FSChdir( Tcl_Obj *pathPtr) { - Tcl_Filesystem *fsPtr; + const Tcl_Filesystem *fsPtr; int retVal = -1; if (Tcl_FSGetNormalizedPath(NULL, pathPtr) == NULL) { @@ -3015,7 +3015,7 @@ Tcl_FSLoadFile( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Obj *pathPtr, /* Name of the file containing the desired * code. */ - CONST char *sym1, CONST char *sym2, + const char *sym1, const char *sym2, /* Names of two functions to look up in the * file's symbol table. */ Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr, @@ -3029,7 +3029,7 @@ Tcl_FSLoadFile( * function which should be used for this * file. */ { - CONST char *symbols[2]; + const char *symbols[2]; Tcl_PackageInitProc **procPtrs[2]; ClientData clientData; int res; @@ -3106,7 +3106,7 @@ TclLoadFile( * code. */ int symc, /* Number of symbols/procPtrs in the next two * arrays. */ - CONST char *symbols[], /* Names of functions to look up in the file's + const char *symbols[], /* Names of functions to look up in the file's * symbol table. */ Tcl_PackageInitProc **procPtrs[], /* Where to return the addresses corresponding @@ -3122,7 +3122,7 @@ TclLoadFile( * function which should be used for this * file. */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); Tcl_FSLoadFileProc *proc; Tcl_Filesystem *copyFsPtr; Tcl_Obj *copyToPtr; @@ -3397,7 +3397,7 @@ TclpLoadFile( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Obj *pathPtr, /* Name of the file containing the desired * code (UTF-8). */ - CONST char *sym1, CONST char *sym2, + const char *sym1, CONST char *sym2, /* Names of two functions to look up in the * file's symbol table. */ Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr, @@ -3564,7 +3564,7 @@ Tcl_FSLink( Tcl_Obj *toPtr, /* NULL or path to be linked to */ int linkAction) /* Action to perform */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSLinkProc *proc = fsPtr->linkProc; @@ -3665,7 +3665,7 @@ Tcl_FSListVolumes(void) static Tcl_Obj * FsListMounts( Tcl_Obj *pathPtr, /* Contains path to directory to search. */ - CONST char *pattern) /* Pattern to match against. */ + const char *pattern) /* Pattern to match against. */ { FilesystemRecord *fsRecPtr; Tcl_GlobTypeData mountsOnly = { TCL_GLOB_TYPE_MOUNT, 0, NULL, NULL }; @@ -3904,7 +3904,7 @@ TclGetPathType( Tcl_PathType TclFSNonnativePathType( - CONST char *path, /* Path to determine type for */ + const char *path, /* Path to determine type for */ int pathLen, /* Length of the path */ Tcl_Filesystem **filesystemPtrPtr, /* If absolute path and this is not NULL, then @@ -4036,7 +4036,7 @@ Tcl_FSRenameFile( * (UTF-8). */ { int retVal = -1; - Tcl_Filesystem *fsPtr, *fsPtr2; + const Tcl_Filesystem *fsPtr, *fsPtr2; fsPtr = Tcl_FSGetFileSystemForPath(srcPathPtr); fsPtr2 = Tcl_FSGetFileSystemForPath(destPathPtr); @@ -4080,7 +4080,7 @@ Tcl_FSCopyFile( Tcl_Obj *destPathPtr) /* Pathname of file to copy to (UTF-8). */ { int retVal = -1; - Tcl_Filesystem *fsPtr, *fsPtr2; + const Tcl_Filesystem *fsPtr, *fsPtr2; fsPtr = Tcl_FSGetFileSystemForPath(srcPathPtr); fsPtr2 = Tcl_FSGetFileSystemForPath(destPathPtr); @@ -4194,7 +4194,7 @@ int Tcl_FSDeleteFile( Tcl_Obj *pathPtr) /* Pathname of file to be removed (UTF-8). */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSDeleteFileProc *proc = fsPtr->deleteFileProc; if (proc != NULL) { @@ -4226,7 +4226,7 @@ int Tcl_FSCreateDirectory( Tcl_Obj *pathPtr) /* Pathname of directory to create (UTF-8). */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL) { Tcl_FSCreateDirectoryProc *proc = fsPtr->createDirectoryProc; if (proc != NULL) { @@ -4265,7 +4265,7 @@ Tcl_FSCopyDirectory( * error, with refCount 1. */ { int retVal = -1; - Tcl_Filesystem *fsPtr, *fsPtr2; + const Tcl_Filesystem *fsPtr, *fsPtr2; fsPtr = Tcl_FSGetFileSystemForPath(srcPathPtr); fsPtr2 = Tcl_FSGetFileSystemForPath(destPathPtr); @@ -4309,7 +4309,7 @@ Tcl_FSRemoveDirectory( * object containing name of file causing * error, with refCount 1. */ { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr != NULL && fsPtr->removeDirectoryProc != NULL) { Tcl_FSRemoveDirectoryProc *proc = fsPtr->removeDirectoryProc; if (recursive) { @@ -4462,11 +4462,11 @@ Tcl_FSGetFileSystemForPath( *--------------------------------------------------------------------------- */ -CONST char * +const char * Tcl_FSGetNativePath( Tcl_Obj *pathPtr) { - return (CONST char *) Tcl_FSGetInternalRep(pathPtr, &tclNativeFilesystem); + return (const char *) Tcl_FSGetInternalRep(pathPtr, &tclNativeFilesystem); } /* @@ -4516,7 +4516,7 @@ Tcl_FSFileSystemInfo( { Tcl_Obj *resPtr; Tcl_FSFilesystemPathTypeProc *proc; - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr == NULL) { return NULL; @@ -4559,7 +4559,7 @@ Tcl_Obj * Tcl_FSPathSeparator( Tcl_Obj *pathPtr) { - Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); if (fsPtr == NULL) { return NULL; @@ -4597,7 +4597,7 @@ static Tcl_Obj * NativeFilesystemSeparator( Tcl_Obj *pathPtr) { - char *separator = NULL; /* lint */ + const char *separator = NULL; /* lint */ switch (tclPlatform) { case TCL_PLATFORM_UNIX: separator = "/"; diff --git a/generic/tclInt.decls b/generic/tclInt.decls index bf5158f..7cdba8d 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.105 2006/11/28 22:20:28 andreas_kupries Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.106 2007/02/20 23:24:04 nijtmans Exp $ library tcl @@ -416,7 +416,7 @@ declare 102 generic { void TclSetupEnv(Tcl_Interp *interp) } declare 103 generic { - int TclSockGetPort(Tcl_Interp *interp, char *str, char *proto, + int TclSockGetPort(Tcl_Interp *interp, CONST char *str, CONST char *proto, int *portPtr) } declare 104 {unix win} { @@ -1126,5 +1126,4 @@ declare 18 macosx { int TclMacOSXMatchType(Tcl_Interp *interp, CONST char *pathName, CONST char *fileName, Tcl_StatBuf *statBufPtr, Tcl_GlobTypeData *types) -} - +} \ No newline at end of file diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 97bb498..4adc112 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.96 2006/11/28 22:20:29 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIntDecls.h,v 1.97 2007/02/20 23:24:03 nijtmans Exp $ */ #ifndef _TCLINTDECLS @@ -442,8 +442,9 @@ EXTERN void TclSetupEnv (Tcl_Interp * interp); #ifndef TclSockGetPort_TCL_DECLARED #define TclSockGetPort_TCL_DECLARED /* 103 */ -EXTERN int TclSockGetPort (Tcl_Interp * interp, char * str, - char * proto, int * portPtr); +EXTERN int TclSockGetPort (Tcl_Interp * interp, + CONST char * str, CONST char * proto, + int * portPtr); #endif #if !defined(__WIN32__) /* UNIX */ #ifndef TclSockMinimumBuffers_TCL_DECLARED @@ -1139,7 +1140,7 @@ typedef struct TclIntStubs { void *reserved100; char * (*tclSetPreInitScript) (char * string); /* 101 */ void (*tclSetupEnv) (Tcl_Interp * interp); /* 102 */ - int (*tclSockGetPort) (Tcl_Interp * interp, char * str, char * proto, int * portPtr); /* 103 */ + int (*tclSockGetPort) (Tcl_Interp * interp, CONST char * str, CONST char * proto, int * portPtr); /* 103 */ #if !defined(__WIN32__) /* UNIX */ int (*tclSockMinimumBuffers) (int sock, int size); /* 104 */ #endif /* UNIX */ diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 949a3a2..d683177 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.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: tclLiteral.c,v 1.28 2006/08/10 12:15:31 dkf Exp $ + * RCS: @(#) $Id: tclLiteral.c,v 1.29 2007/02/20 23:24:03 nijtmans Exp $ */ #include "tclInt.h" @@ -33,7 +33,7 @@ static int AddLocalLiteralEntry(CompileEnv *envPtr, LiteralEntry *globalPtr, int localHash); static void ExpandLocalLiteralArray(CompileEnv *envPtr); -static unsigned int HashString(CONST char *bytes, int length); +static unsigned int HashString(const char *bytes, int length); static void RebuildLiteralTable(LiteralTable *tablePtr); /* @@ -104,7 +104,7 @@ TclCleanupLiteralTable( LiteralEntry* nextPtr; /* Pointer to the next entry in the bucket. */ Tcl_Obj* objPtr; /* Pointer to a literal object whose internal * rep is being freed. */ - Tcl_ObjType* typePtr; /* Pointer to the object's type. */ + const Tcl_ObjType* typePtr; /* Pointer to the object's type. */ int didOne; /* Flag for whether we've removed a literal in * the current bucket. */ @@ -822,7 +822,7 @@ TclReleaseLiteral( static unsigned int HashString( - register CONST char *bytes, /* String for which to compute hash value. */ + register const char *bytes, /* String for which to compute hash value. */ int length) /* Number of bytes in the string. */ { register unsigned int result; diff --git a/generic/tclLoad.c b/generic/tclLoad.c index b8a8b2c..29e2d01 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.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: tclLoad.c,v 1.15 2005/10/31 15:59:41 dkf Exp $ + * RCS: @(#) $Id: tclLoad.c,v 1.16 2007/02/20 23:24:03 nijtmans Exp $ */ #include "tclInt.h" @@ -125,7 +125,7 @@ Tcl_LoadObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Interp *target; LoadedPackage *pkgPtr, *defaultPtr; @@ -134,7 +134,7 @@ Tcl_LoadObjCmd( Tcl_PackageInitProc *initProc, *safeInitProc, *unloadProc, *safeUnloadProc; InterpPackage *ipFirstPtr, *ipPtr; int code, namesMatch, filesMatch, offset; - CONST char *symbols[4]; + const char *symbols[4]; Tcl_PackageInitProc **procPtrs[4]; ClientData clientData; char *p, *fullFileName, *packageName; @@ -498,7 +498,7 @@ Tcl_UnloadObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Interp *target; /* Which interpreter to unload from. */ LoadedPackage *pkgPtr, *defaultPtr; @@ -507,8 +507,9 @@ Tcl_UnloadObjCmd( InterpPackage *ipFirstPtr, *ipPtr; int i, index, code, complain = 1, keepLibrary = 0; int trustedRefCount = -1, safeRefCount = -1; - char *fullFileName = "", *packageName; - static CONST char *options[] = { + const char *fullFileName = ""; + char *packageName; + static const char *options[] = { "-nocomplain", "-keeplibrary", "--", NULL }; enum options { @@ -918,7 +919,7 @@ Tcl_StaticPackage( * already been loaded into the given * interpreter by calling the appropriate init * proc. */ - CONST char *pkgName, /* Name of package (must be properly + const char *pkgName, /* Name of package (must be properly * capitalized: first letter upper case, * others lower case). */ Tcl_PackageInitProc *initProc, @@ -1031,7 +1032,7 @@ TclGetLoadedPackages( Tcl_Interp *target; LoadedPackage *pkgPtr; InterpPackage *ipPtr; - char *prefix; + const char *prefix; if (targetName == NULL) { /* diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 1aa5cb2..a3dce53 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.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: tclPathObj.c,v 1.57 2007/02/20 15:36:46 patthoyts Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.58 2007/02/20 23:24:02 nijtmans Exp $ */ #include "tclInt.h" @@ -24,7 +24,7 @@ static void DupFsPathInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void FreeFsPathInternalRep(Tcl_Obj *pathPtr); static void UpdateStringOfFsPath(Tcl_Obj *pathPtr); static int SetFsPathFromAny(Tcl_Interp *interp, Tcl_Obj *pathPtr); -static int FindSplitPos(CONST char *path, int separator); +static int FindSplitPos(const char *path, int separator); static int IsSeparatorOrNull(int ch); static Tcl_Obj* GetExtension(Tcl_Obj *pathPtr); @@ -158,7 +158,7 @@ TclFSNormalizeAbsolutePath( * of normalization. */ { ClientData clientData = NULL; - CONST char *dirSep, *oldDirSep; + const char *dirSep, *oldDirSep; int first = 1; /* Set to zero once we've passed the first * directory separator - we can't use '..' to * remove the volume in a path. */ @@ -231,7 +231,7 @@ TclFSNormalizeAbsolutePath( int curLen; if (retVal == NULL) { - CONST char *path = TclGetString(pathPtr); + const char *path = TclGetString(pathPtr); retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } @@ -256,7 +256,7 @@ TclFSNormalizeAbsolutePath( */ if (retVal == NULL) { - CONST char *path = TclGetString(pathPtr); + const char *path = TclGetString(pathPtr); retVal = Tcl_NewStringObj(path, dirSep - path); Tcl_IncrRefCount(retVal); } @@ -281,7 +281,7 @@ TclFSNormalizeAbsolutePath( * the link onto the directory of the path so far. */ - CONST char *path = + const char *path = Tcl_GetStringFromObj(retVal, &curLen); while (--curLen >= 0) { @@ -397,7 +397,7 @@ TclFSNormalizeAbsolutePath( if (tclPlatform == TCL_PLATFORM_WINDOWS) { int len; - CONST char *path = Tcl_GetStringFromObj(retVal, &len); + const char *path = Tcl_GetStringFromObj(retVal, &len); if (len == 2 && path[0] != 0 && path[1] == ':') { if (Tcl_IsShared(retVal)) { @@ -563,7 +563,7 @@ TclPathPart( * the standardPath code. */ - CONST char *rest = TclGetString(fsPathPtr->normPathPtr); + const char *rest = TclGetString(fsPathPtr->normPathPtr); if (strchr(rest, '/') != NULL) { goto standardPath; @@ -588,7 +588,7 @@ TclPathPart( * we don't, and instead just use the standardPath code. */ - CONST char *rest = TclGetString(fsPathPtr->normPathPtr); + const char *rest = TclGetString(fsPathPtr->normPathPtr); if (strchr(rest, '/') != NULL) { goto standardPath; @@ -603,7 +603,7 @@ TclPathPart( case TCL_PATH_EXTENSION: return GetExtension(fsPathPtr->normPathPtr); case TCL_PATH_ROOT: { - CONST char *fileName, *extension; + const char *fileName, *extension; int length; fileName = Tcl_GetStringFromObj(fsPathPtr->normPathPtr, @@ -673,7 +673,7 @@ TclPathPart( return GetExtension(pathPtr); } else if (portion == TCL_PATH_ROOT) { int length; - CONST char *fileName, *extension; + const char *fileName, *extension; fileName = Tcl_GetStringFromObj(pathPtr, &length); extension = TclGetExtension(fileName); @@ -750,7 +750,7 @@ static Tcl_Obj * GetExtension( Tcl_Obj *pathPtr) { - CONST char *tail, *extension; + const char *tail, *extension; Tcl_Obj *ret; tail = TclGetString(pathPtr); @@ -864,7 +864,7 @@ Tcl_FSJoinPath( Tcl_ListObjIndex(NULL, listObj, i+1, &tail); type = TclGetPathType(tail, NULL, NULL, NULL); if (type == TCL_PATH_RELATIVE) { - CONST char *str; + const char *str; int len; str = Tcl_GetStringFromObj(tail, &len); @@ -917,7 +917,7 @@ Tcl_FSJoinPath( } return tail; } else { - CONST char *str; + const char *str; int len; str = Tcl_GetStringFromObj(tail, &len); @@ -1190,7 +1190,7 @@ IsSeparatorOrNull( static int FindSplitPos( - CONST char *path, + const char *path, int separator) { int count = 0; @@ -1241,7 +1241,7 @@ FindSplitPos( Tcl_Obj * TclNewFSPathObj( Tcl_Obj *dirPtr, - CONST char *addStrRep, + const char *addStrRep, int len) { FsPath *fsPathPtr; @@ -1309,7 +1309,7 @@ TclFSMakePathRelative( Tcl_Obj *cwdPtr) /* Make it relative to this. */ { int cwdLen, len; - CONST char *tempStr; + const char *tempStr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); if (pathPtr->typePtr == &tclFsPathType) { @@ -1639,7 +1639,7 @@ Tcl_FSGetTranslatedPath( *--------------------------------------------------------------------------- */ -CONST char * +const char * Tcl_FSGetTranslatedStringPath( Tcl_Interp *interp, Tcl_Obj *pathPtr) @@ -1648,7 +1648,7 @@ Tcl_FSGetTranslatedStringPath( if (transPtr != NULL) { int len; - CONST char *result, *orig; + const char *result, *orig; orig = Tcl_GetStringFromObj(transPtr, &len); result = (char*) ckalloc((unsigned)(len+1)); @@ -1700,7 +1700,7 @@ Tcl_FSGetNormalizedPath( Tcl_Obj *dir, *copy; int cwdLen; int pathType; - CONST char *cwdStr; + const char *cwdStr; ClientData clientData = NULL; pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr); @@ -1811,7 +1811,7 @@ Tcl_FSGetNormalizedPath( } else if (fsPathPtr->normPathPtr == NULL) { int cwdLen; Tcl_Obj *copy; - CONST char *cwdStr; + const char *cwdStr; ClientData clientData = NULL; copy = Tcl_DuplicateObj(fsPathPtr->cwdPtr); @@ -1864,7 +1864,7 @@ Tcl_FSGetNormalizedPath( */ Tcl_Obj *absolutePath = fsPathPtr->translatedPathPtr; - CONST char *path = TclGetString(absolutePath); + const char *path = TclGetString(absolutePath); /* * We have to be a little bit careful here to avoid infinite loops @@ -2041,7 +2041,7 @@ Tcl_FSGetInternalRep( */ if (fsPtr != srcFsPathPtr->fsRecPtr->fsPtr) { - Tcl_Filesystem *actualFs = Tcl_FSGetFileSystemForPath(pathPtr); + const Tcl_Filesystem *actualFs = Tcl_FSGetFileSystemForPath(pathPtr); if (actualFs == fsPtr) { return Tcl_FSGetInternalRep(pathPtr, fsPtr); @@ -2306,7 +2306,7 @@ SetFsPathFromAny( * We have just '~' */ - CONST char *dir; + const char *dir; Tcl_DString dirString; if (split != len) { @@ -2401,7 +2401,7 @@ SetFsPathFromAny( #if defined(__CYGWIN__) && defined(__WIN32__) { - extern int cygwin_conv_to_win32_path(CONST char *, char *); + extern int cygwin_conv_to_win32_path(const char *, char *); char winbuf[MAX_PATH+1]; /* @@ -2570,7 +2570,7 @@ UpdateStringOfFsPath( register Tcl_Obj *pathPtr) /* path obj with string rep to update. */ { FsPath* fsPathPtr = (FsPath*) PATHOBJ(pathPtr); - CONST char *cwdStr; + const char *cwdStr; int cwdLen; Tcl_Obj *copy; diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index a9ddf03..4c258e6 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.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: tclRegexp.c,v 1.22 2006/04/07 01:12:11 hobbs Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.23 2007/02/20 23:24:02 nijtmans Exp $ */ #include "tclInt.h" @@ -85,7 +85,7 @@ static Tcl_ThreadDataKey dataKey; * Declarations for functions used only in this file. */ -static TclRegexp * CompileRegexp(Tcl_Interp *interp, CONST char *pattern, +static TclRegexp * CompileRegexp(Tcl_Interp *interp, const char *pattern, int length, int flags); static void DupRegexpInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); @@ -93,7 +93,7 @@ static void FinalizeRegexp(ClientData clientData); static void FreeRegexp(TclRegexp *regexpPtr); static void FreeRegexpInternalRep(Tcl_Obj *objPtr); static int RegExpExecUniChar(Tcl_Interp *interp, Tcl_RegExp re, - CONST Tcl_UniChar *uniString, int numChars, + const Tcl_UniChar *uniString, int numChars, int nmatches, int flags); static int SetRegexpFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -136,7 +136,7 @@ Tcl_RegExp Tcl_RegExpCompile( Tcl_Interp *interp, /* For use in error reporting and to access * the interp regexp cache. */ - CONST char *pattern) /* String for which to produce compiled + const char *pattern) /* String for which to produce compiled * regular expression. */ { return (Tcl_RegExp) CompileRegexp(interp, pattern, (int) strlen(pattern), @@ -169,15 +169,15 @@ Tcl_RegExpExec( Tcl_RegExp re, /* Compiled regular expression; must have been * returned by previous call to * Tcl_GetRegExpFromObj. */ - CONST char *text, /* Text against which to match re. */ - CONST char *start) /* If text is part of a larger string, this + const char *text, /* Text against which to match re. */ + const char *start) /* If text is part of a larger string, this * identifies beginning of larger string, so * that "^" won't match. */ { int flags, result, numChars; TclRegexp *regexp = (TclRegexp *)re; Tcl_DString ds; - CONST Tcl_UniChar *ustr; + const Tcl_UniChar *ustr; /* * If the starting point is offset from the beginning of the buffer, then @@ -237,13 +237,13 @@ Tcl_RegExpRange( int index, /* 0 means give the range of the entire match, * > 0 means give the range of a matching * subrange. */ - CONST char **startPtr, /* Store address of first character in + const char **startPtr, /* Store address of first character in * (sub-)range here. */ - CONST char **endPtr) /* Store address of character just after last + const char **endPtr) /* Store address of character just after last * in (sub-)range here. */ { TclRegexp *regexpPtr = (TclRegexp *) re; - CONST char *string; + const char *string; if ((size_t) index > regexpPtr->re.re_nsub) { *startPtr = *endPtr = NULL; @@ -285,7 +285,7 @@ RegExpExecUniChar( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tcl_RegExp re, /* Compiled regular expression; returned by a * previous call to Tcl_GetRegExpFromObj */ - CONST Tcl_UniChar *wString, /* String against which to match re. */ + const Tcl_UniChar *wString, /* String against which to match re. */ int numChars, /* Length of Tcl_UniChar string (must be * >=0). */ int nmatches, /* How many subexpression matches (counting @@ -390,8 +390,8 @@ TclRegExpRangeUniChar( int Tcl_RegExpMatch( Tcl_Interp *interp, /* Used for error reporting. May be NULL. */ - CONST char *text, /* Text to search for pattern matches. */ - CONST char *pattern) /* Regular expression to match against text. */ + const char *text, /* Text to search for pattern matches. */ + const char *pattern) /* Regular expression to match against text. */ { Tcl_RegExp re; @@ -616,7 +616,7 @@ TclRegAbout( char buf[TCL_INTEGER_SPACE]; static struct infoname { int bit; - char *text; + const char *text; } infonames[] = { {REG_UBACKREF, "REG_UBACKREF"}, {REG_ULOOKAHEAD, "REG_ULOOKAHEAD"}, @@ -687,13 +687,13 @@ TclRegAbout( void TclRegError( Tcl_Interp *interp, /* Interpreter for error reporting. */ - CONST char *msg, /* Message to prepend to error. */ + const char *msg, /* Message to prepend to error. */ int status) /* Status code to report. */ { char buf[100]; /* ample in practice */ char cbuf[100]; /* lots in practice */ size_t n; - char *p; + const char *p; Tcl_ResetResult(interp); n = TclReError(status, NULL, buf, sizeof(buf)); @@ -822,12 +822,12 @@ SetRegexpFromAny( static TclRegexp * CompileRegexp( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - CONST char *string, /* The regexp to compile (UTF-8). */ + const char *string, /* The regexp to compile (UTF-8). */ int length, /* The length of the string in bytes. */ int flags) /* Compilation flags. */ { TclRegexp *regexpPtr; - CONST Tcl_UniChar *uniString; + const Tcl_UniChar *uniString; int numChars; Tcl_DString stringBuf; int status, i; diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index d25b645..9fd152c 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.26 2006/11/15 20:08:45 dgp Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.27 2007/02/20 23:24:03 nijtmans Exp $ * *---------------------------------------------------------------------- */ @@ -100,7 +100,7 @@ static int minDigits; /* The maximum number of digits to the right * of the decimal point in a double. */ static int mantDIGIT; /* Number of mp_digit's needed to hold the * significand of a double. */ -static CONST double pow_10_2_n[] = { /* Inexact higher powers of ten. */ +static const double pow_10_2_n[] = { /* Inexact higher powers of ten. */ 1.0, 100.0, 10000.0, @@ -244,12 +244,12 @@ int TclParseNumber( Tcl_Interp *interp, /* Used for error reporting. May be NULL */ Tcl_Obj *objPtr, /* Object to receive the internal rep */ - CONST char *expected, /* Description of the type of number the caller + const char *expected, /* Description of the type of number the caller * expects to be able to parse ("integer", * "boolean value", etc.). */ - CONST char *bytes, /* Pointer to the start of the string to scan */ + const char *bytes, /* Pointer to the start of the string to scan */ int numBytes, /* Maximum number of bytes to scan, see above */ - CONST char **endPtrPtr, /* Place to store pointer to the character + const char **endPtrPtr, /* Place to store pointer to the character * that terminated the scan */ int flags) /* Flags governing the parse */ { @@ -291,9 +291,9 @@ TclParseNumber( int exponentSignum = 0; /* Signum of the exponent of a floating point * number */ long exponent = 0; /* Exponent of a floating point number */ - CONST char *p; /* Pointer to next character to scan */ + const char *p; /* Pointer to next character to scan */ size_t len; /* Number of characters remaining after p */ - CONST char *acceptPoint; /* Pointer to position after last character in + const char *acceptPoint; /* Pointer to position after last character in * an acceptable number */ size_t acceptLen; /* Number of characters following that * point. */ @@ -2264,7 +2264,7 @@ Tcl_InitBignumFromDouble( if (TclIsInfinite(d)) { if (interp != NULL) { - char *s = "integer value too large to represent"; + const char *s = "integer value too large to represent"; Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1)); Tcl_SetErrorCode(interp, "ARITH", "IOVERFLOW", s, NULL); } diff --git a/generic/tclVar.c b/generic/tclVar.c index 62337bf..13d5dc6 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.126 2006/10/27 13:20:33 dkf Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.127 2007/02/20 23:24:03 nijtmans Exp $ */ #include "tclInt.h" @@ -25,17 +25,17 @@ * access is denied. */ -static CONST char *noSuchVar = "no such variable"; -static CONST char *isArray = "variable is array"; -static CONST char *needArray = "variable isn't array"; -static CONST char *noSuchElement = "no such element in array"; -static CONST char *danglingElement = +static const char *noSuchVar = "no such variable"; +static const char *isArray = "variable is array"; +static const char *needArray = "variable isn't array"; +static const char *noSuchElement = "no such element in array"; +static const char *danglingElement = "upvar refers to element in deleted array"; -static CONST char *danglingVar = +static const char *danglingVar = "upvar refers to variable in deleted namespace"; -static CONST char *badNamespace = "parent namespace doesn't exist"; -static CONST char *missingName = "missing variable name"; -static CONST char *isArrayElement = +static const char *badNamespace = "parent namespace doesn't exist"; +static const char *missingName = "missing variable name"; +static const char *isArrayElement = "name refers to an element in an array"; /* @@ -50,18 +50,18 @@ static CONST char *isArrayElement = */ static void DeleteSearches(Var *arrayVarPtr); -static void DeleteArray(Interp *iPtr, CONST char *arrayName, +static void DeleteArray(Interp *iPtr, const char *arrayName, Var *varPtr, int flags); static int ObjMakeUpvar(Tcl_Interp *interp, CallFrame *framePtr, Tcl_Obj *otherP1Ptr, - CONST char *otherP2, CONST int otherFlags, - CONST char *myName, int myFlags, int index); + const char *otherP2, const int otherFlags, + const char *myName, int myFlags, int index); static Var * NewVar(void); -static ArraySearch * ParseSearchId(Tcl_Interp *interp, CONST Var *varPtr, - CONST char *varName, Tcl_Obj *handleObj); +static ArraySearch * ParseSearchId(Tcl_Interp *interp, const Var *varPtr, + const char *varName, Tcl_Obj *handleObj); static void UnsetVarStruct(Var *varPtr, Var *arrayPtr, - Interp *iPtr, CONST char *part1, - CONST char *part2, int flags); + Interp *iPtr, const char *part1, + const char *part2, int flags); static int SetArraySearchObj(Tcl_Interp *interp, Tcl_Obj *objPtr); /* @@ -70,10 +70,10 @@ static int SetArraySearchObj(Tcl_Interp *interp, Tcl_Obj *objPtr); */ MODULE_SCOPE Var * TclLookupSimpleVar(Tcl_Interp *interp, - CONST char *varName, int flags, CONST int create, - CONST char **errMsgPtr, int *indexPtr); + const char *varName, int flags, const int create, + const char **errMsgPtr, int *indexPtr); MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp, - Tcl_Obj *part1Ptr, CONST char *part2, int flags); + Tcl_Obj *part1Ptr, const char *part2, int flags); static Tcl_DupInternalRepProc DupLocalVarName; static Tcl_FreeInternalRepProc FreeParsedVarName; @@ -187,14 +187,14 @@ Tcl_ObjType tclArraySearchType = { Var * TclLookupVar( Tcl_Interp *interp, /* Interpreter to use for lookup. */ - CONST char *part1, /* If part2 isn't NULL, this is the name of an + const char *part1, /* If part2 isn't NULL, this is the name of an * array. Otherwise, this is a full variable * name that could include a parenthesized * array element. */ - CONST char *part2, /* Name of element within array, or NULL. */ + const char *part2, /* Name of element within array, or NULL. */ int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * and TCL_LEAVE_ERR_MSG bits matter. */ - CONST char *msg, /* Verb to use in error messages, e.g. "read" + const char *msg, /* Verb to use in error messages, e.g. "read" * or "set". Only needed if TCL_LEAVE_ERR_MSG * is set in flags. */ int createPart1, /* If 1, create hash table entry for part 1 of @@ -209,14 +209,14 @@ TclLookupVar( * is set to NULL. */ { Var *varPtr; - CONST char *elName; /* Name of array element or NULL; may be same + const char *elName; /* Name of array element or NULL; may be same * as part2, or may be openParen+1. */ int openParen, closeParen; /* If this function parses a name into array * and index, these are the offsets to the * parens around the index. Otherwise they are * -1. */ - register CONST char *p; - CONST char *errMsg = NULL; + register const char *p; + const char *errMsg = NULL; int index; #define VAR_NAME_BUF_SIZE 26 char buffer[VAR_NAME_BUF_SIZE]; @@ -340,16 +340,16 @@ TclObjLookupVar( * array. Otherwise, this is a full variable * name that could include a parenthesized * array element. */ - CONST char *part2, /* Name of element within array, or NULL. */ + const char *part2, /* Name of element within array, or NULL. */ int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * and TCL_LEAVE_ERR_MSG bits matter. */ - CONST char *msg, /* Verb to use in error messages, e.g. "read" + const char *msg, /* Verb to use in error messages, e.g. "read" * or "set". Only needed if TCL_LEAVE_ERR_MSG * is set in flags. */ - CONST int createPart1, /* If 1, create hash table entry for part 1 of + const int createPart1, /* If 1, create hash table entry for part 1 of * name, if it doesn't already exist. If 0, * return error if it doesn't exist. */ - CONST int createPart2, /* If 1, create hash table entry for part 2 of + const int createPart2, /* If 1, create hash table entry for part 2 of * name, if it doesn't already exist. If 0, * return error if it doesn't exist. */ Var **arrayPtrPtr) /* If the name refers to an element of an @@ -364,8 +364,8 @@ TclObjLookupVar( int index, len1, len2; int parsed = 0; Tcl_Obj *objPtr; - Tcl_ObjType *typePtr = part1Ptr->typePtr; - CONST char *errMsg = NULL; + const Tcl_ObjType *typePtr = part1Ptr->typePtr; + const char *errMsg = NULL; CallFrame *varFramePtr = iPtr->varFramePtr; Namespace *nsPtr; @@ -659,15 +659,15 @@ TclObjLookupVar( Var * TclLookupSimpleVar( Tcl_Interp *interp, /* Interpreter to use for lookup. */ - CONST char *varName, /* This is a simple variable name that could + const char *varName, /* This is a simple variable name that could * represent a scalar or an array. */ int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * LOOKUP_FOR_UPVAR and TCL_LEAVE_ERR_MSG bits * matter. */ - CONST int create, /* If 1, create hash table entry for varname, + const int create, /* If 1, create hash table entry for varname, * if it doesn't already exist. If 0, return * error if it doesn't exist. */ - CONST char **errMsgPtr, + const char **errMsgPtr, int *indexPtr) { Interp *iPtr = (Interp *) interp; @@ -747,7 +747,7 @@ TclLookupSimpleVar( if (((flags & (TCL_GLOBAL_ONLY | TCL_NAMESPACE_ONLY)) != 0) || !HasLocalVars(varFramePtr) || (strstr(varName, "::") != NULL)) { - CONST char *tail; + const char *tail; int lookGlobal; lookGlobal = (flags & TCL_GLOBAL_ONLY) @@ -903,17 +903,17 @@ TclLookupSimpleVar( Var * TclLookupArrayElement( Tcl_Interp *interp, /* Interpreter to use for lookup. */ - CONST char *arrayName, /* This is the name of the array. */ - CONST char *elName, /* Name of element within array. */ - CONST int flags, /* Only TCL_LEAVE_ERR_MSG bit matters. */ - CONST char *msg, /* Verb to use in error messages, e.g. "read" + const char *arrayName, /* This is the name of the array. */ + const char *elName, /* Name of element within array. */ + const int flags, /* Only TCL_LEAVE_ERR_MSG bit matters. */ + const char *msg, /* Verb to use in error messages, e.g. "read" * or "set". Only needed if TCL_LEAVE_ERR_MSG * is set in flags. */ - CONST int createArray, /* If 1, transform arrayName to be an array if + const int createArray, /* If 1, transform arrayName to be an array if * it isn't one yet and the transformation is * possible. If 0, return error if it isn't * already an array. */ - CONST int createElem, /* If 1, create hash table entry for the + const int createElem, /* If 1, create hash table entry for the * element, if it doesn't already exist. If 0, * return error if it doesn't exist. */ Var *arrayPtr) /* Pointer to the array's Var structure. */ @@ -1005,11 +1005,11 @@ TclLookupArrayElement( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_GetVar( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ - CONST char *varName, /* Name of a variable in interp. */ + const char *varName, /* Name of a variable in interp. */ int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, * TCL_NAMESPACE_ONLY or TCL_LEAVE_ERR_MSG * bits. */ @@ -1040,13 +1040,13 @@ Tcl_GetVar( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_GetVar2( Tcl_Interp *interp, /* Command interpreter in which variable is to * be looked up. */ - CONST char *part1, /* Name of an array (if part2 is non-NULL) or + const char *part1, /* Name of an array (if part2 is non-NULL) or * the name of a variable. */ - CONST char *part2, /* If non-NULL, gives the name of an element + const char *part2, /* If non-NULL, gives the name of an element * in the array part1. */ int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, * TCL_NAMESPACE_ONLY and TCL_LEAVE_ERR_MSG * @@ -1088,9 +1088,9 @@ Tcl_Obj * Tcl_GetVar2Ex( Tcl_Interp *interp, /* Command interpreter in which variable is to * be looked up. */ - CONST char *part1, /* Name of an array (if part2 is non-NULL) or + const char *part1, /* Name of an array (if part2 is non-NULL) or * the name of a variable. */ - CONST char *part2, /* If non-NULL, gives the name of an element + const char *part2, /* If non-NULL, gives the name of an element * in the array part1. */ int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and * TCL_LEAVE_ERR_MSG bits. */ @@ -1200,15 +1200,15 @@ TclPtrGetVar( register Var *varPtr, /* The variable to be read.*/ Var *arrayPtr, /* NULL for scalar variables, pointer to the * containing array otherwise. */ - CONST char *part1, /* Name of an array (if part2 is non-NULL) or + const char *part1, /* Name of an array (if part2 is non-NULL) or * the name of a variable. */ - CONST char *part2, /* If non-NULL, gives the name of an element + const char *part2, /* If non-NULL, gives the name of an element * in the array part1. */ - CONST int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and + const int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and * TCL_LEAVE_ERR_MSG bits. */ { Interp *iPtr = (Interp *) interp; - CONST char *msg; + const char *msg; /* * Invoke any traces that have been set for the variable. @@ -1278,7 +1278,7 @@ Tcl_SetObjCmd( ClientData dummy, /* Not used. */ register Tcl_Interp *interp,/* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *varValueObj; @@ -1327,12 +1327,12 @@ Tcl_SetObjCmd( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_SetVar( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ - CONST char *varName, /* Name of a variable in interp. */ - CONST char *newValue, /* New value for varName. */ + const char *varName, /* Name of a variable in interp. */ + 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, TCL_LIST_ELEMENT, @@ -1367,16 +1367,16 @@ Tcl_SetVar( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_SetVar2( Tcl_Interp *interp, /* Command interpreter in which variable is to * be looked up. */ - CONST char *part1, /* If part2 is NULL, this is name of scalar + const char *part1, /* If part2 is NULL, this is name of scalar * variable. Otherwise it is the name of an * array. */ - CONST char *part2, /* Name of an element within an array, or + const char *part2, /* Name of an element within an array, or * NULL. */ - CONST 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, TCL_LIST_ELEMENT, or @@ -1441,9 +1441,9 @@ Tcl_Obj * Tcl_SetVar2Ex( Tcl_Interp *interp, /* Command interpreter in which variable is to * be found. */ - CONST char *part1, /* Name of an array (if part2 is non-NULL) or + const char *part1, /* Name of an array (if part2 is non-NULL) or * the name of a variable. */ - CONST char *part2, /* If non-NULL, gives the name of an element + const char *part2, /* If non-NULL, gives the name of an element * in the array part1. */ Tcl_Obj *newValuePtr, /* New value for variable. */ int flags) /* Various flags that tell how to set value: @@ -1558,12 +1558,12 @@ TclPtrSetVar( Var *arrayPtr, /* Reference to the array containing the * variable, or NULL if the variable is a * scalar. */ - CONST char *part1, /* Name of an array (if part2 is non-NULL) or + const char *part1, /* Name of an array (if part2 is non-NULL) or * the name of a variable. */ - CONST char *part2, /* If non-NULL, gives the name of an element + const char *part2, /* If non-NULL, gives the name of an element * in the array part1. */ Tcl_Obj *newValuePtr, /* New value for variable. */ - CONST int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and + const int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and * TCL_LEAVE_ERR_MSG bits. */ { Interp *iPtr = (Interp *) interp; @@ -1823,15 +1823,15 @@ TclPtrIncrObjVar( Var *arrayPtr, /* Reference to the array containing the * variable, or NULL if the variable is a * scalar. */ - CONST char *part1, /* Points to an object holding the name of an + const char *part1, /* Points to an object holding the name of an * array (if part2 is non-NULL) or the name of * a variable. */ - CONST char *part2, /* If non-null, points to an object holding + const char *part2, /* If non-null, points to an object holding * the name of an element in the array * part1Ptr. */ Tcl_Obj *incrPtr, /* Increment value */ /* TODO: Which of these flag values really make sense? */ - CONST int flags) /* Various flags that tell how to incr value: + const int flags) /* Various flags that tell how to incr value: * any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * TCL_APPEND_VALUE, TCL_LIST_ELEMENT, * TCL_LEAVE_ERR_MSG. */ @@ -1885,7 +1885,7 @@ int Tcl_UnsetVar( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ - CONST char *varName, /* Name of a variable in interp. May be either + const char *varName, /* Name of a variable in interp. May be either * a scalar name or an array name or an * element in an array. */ int flags) /* OR-ed combination of any of @@ -1920,8 +1920,8 @@ int Tcl_UnsetVar2( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ - CONST char *part1, /* Name of variable or array. */ - CONST char *part2, /* Name of element within array or NULL. */ + const char *part1, /* Name of variable or array. */ + const char *part2, /* Name of element within array or NULL. */ int flags) /* OR-ed combination of any of * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * TCL_LEAVE_ERR_MSG. */ @@ -1963,7 +1963,7 @@ TclObjUnsetVar2( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ Tcl_Obj *part1Ptr, /* Name of variable or array. */ - CONST char *part2, /* Name of element within array or NULL. */ + const char *part2, /* Name of element within array or NULL. */ int flags) /* OR-ed combination of any of * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, * TCL_LEAVE_ERR_MSG. */ @@ -2053,8 +2053,8 @@ UnsetVarStruct( Var *varPtr, Var *arrayPtr, Interp *iPtr, - CONST char *part1, - CONST char *part2, + const char *part1, + const char *part2, int flags) { Var dummyVar; @@ -2203,7 +2203,7 @@ Tcl_UnsetObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register int i, flags = TCL_LEAVE_ERR_MSG; register char *name; @@ -2271,7 +2271,7 @@ Tcl_AppendObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Var *varPtr, *arrayPtr; char *part1; @@ -2339,7 +2339,7 @@ Tcl_LappendObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *varValuePtr, *newValuePtr; int numElems, createdNewObj; @@ -2481,7 +2481,7 @@ Tcl_ArrayObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { /* * The list of constants below should match the arrayOptions string array @@ -2493,7 +2493,7 @@ Tcl_ArrayObjCmd( ARRAY_NAMES, ARRAY_NEXTELEMENT, ARRAY_SET, ARRAY_SIZE, ARRAY_STARTSEARCH, ARRAY_STATISTICS, ARRAY_UNSET }; - static CONST char *arrayOptions[] = { + static const char *arrayOptions[] = { "anymore", "donesearch", "exists", "get", "names", "nextelement", "set", "size", "startsearch", "statistics", "unset", NULL }; @@ -2810,7 +2810,7 @@ Tcl_ArrayObjCmd( char *name; Tcl_Obj *namePtr, *resultPtr; int mode, matched = 0; - static CONST char *options[] = { + static const char *options[] = { "-exact", "-glob", "-regexp", NULL }; enum options { OPT_EXACT, OPT_GLOB, OPT_REGEXP }; @@ -2973,7 +2973,7 @@ Tcl_ArrayObjCmd( } case ARRAY_STATISTICS: { - CONST char *stats; + const char *stats; if (notArray) { goto error; @@ -3194,10 +3194,10 @@ ObjMakeUpvar( CallFrame *framePtr, /* Call frame containing "other" variable. * NULL means use global :: context. */ Tcl_Obj *otherP1Ptr, - CONST char *otherP2, /* Two-part name of variable in framePtr. */ - CONST int otherFlags, /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: + const char *otherP2, /* Two-part name of variable in framePtr. */ + const int otherFlags, /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: * indicates scope of "other" variable. */ - CONST char *myName, /* Name of variable which will refer to + const char *myName, /* Name of variable which will refer to * otherP1/otherP2. Must be a scalar. */ int myFlags, /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: * indicates scope of myName. */ @@ -3280,7 +3280,7 @@ TclPtrMakeUpvar( Tcl_Interp *interp, /* Interpreter containing variables. Used for * error messages, too. */ Var *otherPtr, /* Pointer to the variable being linked-to */ - CONST char *myName, /* Name of variable which will refer to + const char *myName, /* Name of variable which will refer to * otherP1/otherP2. Must be a scalar. */ int myFlags, /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: * indicates scope of myName. */ @@ -3290,8 +3290,8 @@ TclPtrMakeUpvar( Interp *iPtr = (Interp *) interp; CallFrame *varFramePtr = iPtr->varFramePtr; Var *varPtr; - CONST char *errMsg; - CONST char *p; + const char *errMsg; + const char *p; if (index >= 0) { if (!HasLocalVars(varFramePtr)) { @@ -3402,12 +3402,12 @@ int Tcl_UpVar( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ - CONST char *frameName, /* Name of the frame containing the source + const char *frameName, /* Name of the frame containing the source * variable, such as "1" or "#0". */ - CONST char *varName, /* Name of a variable in interp to link to. + const char *varName, /* Name of a variable in interp to link to. * May be either a scalar name or an element * in an array. */ - CONST char *localName, /* Name of link variable. */ + const char *localName, /* Name of link variable. */ int flags) /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: * indicates scope of localName. */ { @@ -3438,12 +3438,12 @@ int Tcl_UpVar2( Tcl_Interp *interp, /* Interpreter containing variables. Used for * error messages too. */ - CONST char *frameName, /* Name of the frame containing the source + const char *frameName, /* Name of the frame containing the source * variable, such as "1" or "#0". */ - CONST char *part1, - CONST char *part2, /* Two parts of source variable name to link + const char *part1, + const char *part2, /* Two parts of source variable name to link * to. */ - CONST char *localName, /* Name of link variable. */ + const char *localName, /* Name of link variable. */ int flags) /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: * indicates scope of localName. */ { @@ -3540,7 +3540,7 @@ Tcl_GlobalObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; register Tcl_Obj *objPtr; @@ -3637,7 +3637,7 @@ Tcl_VariableObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Interp *iPtr = (Interp *) interp; char *varName, *tail, *cp; @@ -3764,7 +3764,7 @@ Tcl_UpvarObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { CallFrame *framePtr; char *localName; @@ -3938,8 +3938,8 @@ SetArraySearchObj( static ArraySearch * ParseSearchId( Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST Var *varPtr, /* Array variable search is for. */ - CONST char *varName, /* Name of array variable that search is + const Var *varPtr, /* Array variable search is for. */ + const char *varName, /* Name of array variable that search is * supposed to be for. */ Tcl_Obj *handleObj) /* Object containing id of search. Must have * form "search-num-var" where "num" is a @@ -4377,7 +4377,7 @@ TclDeleteCompiledLocalVars( static void DeleteArray( Interp *iPtr, /* Interpreter containing array. */ - CONST char *arrayName, /* Name of array (used for trace callbacks) */ + const char *arrayName, /* Name of array (used for trace callbacks) */ Var *varPtr, /* Pointer to variable structure. */ int flags) /* Flags to pass to TclCallVarTraces: * TCL_TRACE_UNSETS and sometimes @@ -4510,11 +4510,11 @@ TclCleanupVar( void TclVarErrMsg( Tcl_Interp *interp, /* Interpreter in which to record message. */ - CONST char *part1, - CONST char *part2, /* Variable's two-part name. */ - CONST char *operation, /* String describing operation that failed, + const char *part1, + const char *part2, /* Variable's two-part name. */ + const char *operation, /* String describing operation that failed, * e.g. "read", "set", or "unset". */ - CONST char *reason) /* String describing why operation failed. */ + const char *reason) /* String describing why operation failed. */ { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "can't ", operation, " \"", part1, NULL); diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 4c952a1..12ddaad 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.75 2006/11/28 14:50:58 dgp Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.76 2007/02/20 23:24:07 nijtmans Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -225,10 +225,10 @@ typedef struct TcpState { */ static TcpState * CreateSocket(Tcl_Interp *interp, - int port, CONST char *host, int server, - CONST char *myaddr, int myport, int async); + int port, const char *host, int server, + const char *myaddr, int myport, int async); static int CreateSocketAddress(struct sockaddr_in *sockaddrPtr, - CONST char *host, int port); + const char *host, int port); static int FileBlockModeProc(ClientData instanceData, int mode); static int FileCloseProc(ClientData instanceData, Tcl_Interp *interp); @@ -237,7 +237,7 @@ static int FileGetHandleProc(ClientData instanceData, static int FileInputProc(ClientData instanceData, char *buf, int toRead, int *errorCode); static int FileOutputProc(ClientData instanceData, - CONST char *buf, int toWrite, int *errorCode); + const char *buf, int toWrite, int *errorCode); static int FileSeekProc(ClientData instanceData, long offset, int mode, int *errorCode); #ifdef DEPRECATED @@ -256,19 +256,19 @@ static int TcpCloseProc(ClientData instanceData, static int TcpGetHandleProc(ClientData instanceData, int direction, ClientData *handlePtr); static int TcpGetOptionProc(ClientData instanceData, - Tcl_Interp *interp, CONST char *optionName, + Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); static int TcpInputProc(ClientData instanceData, char *buf, int toRead, int *errorCode); static int TcpOutputProc(ClientData instanceData, - CONST char *buf, int toWrite, int *errorCode); + const char *buf, int toWrite, int *errorCode); static void TcpWatchProc(ClientData instanceData, int mask); #ifdef SUPPORTS_TTY static int TtyCloseProc(ClientData instanceData, Tcl_Interp *interp); static void TtyGetAttributes(int fd, TtyAttrs *ttyPtr); static int TtyGetOptionProc(ClientData instanceData, - Tcl_Interp *interp, CONST char *optionName, + Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); #ifndef DIRECT_BAUD static int TtyGetBaud(unsigned long speed); @@ -278,15 +278,15 @@ static FileState * TtyInit(int fd, int initialize); static void TtyModemStatusStr(int status, Tcl_DString *dsPtr); #if BAD_TIP35_FLUSH static int TtyOutputProc(ClientData instanceData, - CONST char *buf, int toWrite, int *errorCode); + const char *buf, int toWrite, int *errorCode); #endif /* BAD_TIP35_FLUSH */ -static int TtyParseMode(Tcl_Interp *interp, CONST char *mode, +static int TtyParseMode(Tcl_Interp *interp, const char *mode, int *speedPtr, int *parityPtr, int *dataPtr, int *stopPtr); static void TtySetAttributes(int fd, TtyAttrs *ttyPtr); static int TtySetOptionProc(ClientData instanceData, - Tcl_Interp *interp, CONST char *optionName, - CONST char *value); + Tcl_Interp *interp, const char *optionName, + const char *value); #endif /* SUPPORTS_TTY */ static int WaitForConnect(TcpState *statePtr, int *errorCodePtr); static Tcl_Channel MakeTcpClientChannelMode(ClientData tcpSocket, @@ -496,7 +496,7 @@ FileInputProc( static int FileOutputProc( ClientData instanceData, /* File state. */ - CONST char *buf, /* The data buffer. */ + const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { @@ -808,7 +808,7 @@ TtyCloseProc( static int TtyOutputProc( ClientData instanceData, /* File state. */ - CONST char *buf, /* The data buffer. */ + const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { @@ -882,15 +882,15 @@ static int TtySetOptionProc( ClientData instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ - CONST char *optionName, /* Which option to set? */ - CONST char *value) /* New value for option. */ + const char *optionName, /* Which option to set? */ + const char *value) /* New value for option. */ { FileState *fsPtr = (FileState *) instanceData; unsigned int len, vlen; TtyAttrs tty; #ifdef USE_TERMIOS int flag, control, argc; - CONST char **argv; + const char **argv; IOSTATE iostate; #endif /* USE_TERMIOS */ @@ -1107,7 +1107,7 @@ static int TtyGetOptionProc( ClientData instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ - CONST char *optionName, /* Option to get. */ + const char *optionName, /* Option to get. */ Tcl_DString *dsPtr) /* Where to store value(s). */ { FileState *fsPtr = (FileState *) instanceData; @@ -1597,7 +1597,7 @@ TtySetAttributes( static int TtyParseMode( Tcl_Interp *interp, /* If non-NULL, interp for error return. */ - CONST char *mode, /* Mode string to be parsed. */ + const char *mode, /* Mode string to be parsed. */ int *speedPtr, /* Filled with baud rate from mode string. */ int *parityPtr, /* Filled with parity from mode string. */ int *dataPtr, /* Filled with data bits from mode string. */ @@ -1761,7 +1761,7 @@ TclpOpenFileChannel( { int fd, channelPermissions; FileState *fsPtr; - CONST char *native, *translation; + const char *native, *translation; char channelName[16 + TCL_INTEGER_SPACE]; Tcl_ChannelType *channelTypePtr; @@ -2136,7 +2136,7 @@ TcpInputProc( static int TcpOutputProc( ClientData instanceData, /* Socket state. */ - CONST char *buf, /* The data buffer. */ + const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { @@ -2227,7 +2227,7 @@ static int TcpGetOptionProc( ClientData instanceData, /* Socket state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ - CONST char *optionName, /* Name of the option to retrieve the value + const char *optionName, /* Name of the option to retrieve the value * for, or NULL to get all options and their * values. */ Tcl_DString *dsPtr) /* Where to store the computed value; @@ -2449,11 +2449,11 @@ static TcpState * CreateSocket( Tcl_Interp *interp, /* For error reporting; can be NULL. */ int port, /* Port number to open. */ - CONST char *host, /* Name of host on which to open port. NULL + const char *host, /* Name of host on which to open port. NULL * implies INADDR_ANY */ int server, /* 1 if socket should be a server socket, else * 0 for a client socket. */ - CONST char *myaddr, /* Optional client-side address */ + const char *myaddr, /* Optional client-side address */ int myport, /* Optional client-side port */ int async) /* If nonzero and creating a client socket, * attempt to do an async connect. Otherwise @@ -2626,7 +2626,7 @@ CreateSocket( static int CreateSocketAddress( struct sockaddr_in *sockaddrPtr, /* Socket address */ - CONST char *host, /* Host. NULL implies INADDR_ANY */ + const char *host, /* Host. NULL implies INADDR_ANY */ int port) /* Port number */ { struct hostent *hostent; /* Host database entry */ @@ -2639,7 +2639,7 @@ CreateSocketAddress( addr.s_addr = INADDR_ANY; } else { Tcl_DString ds; - CONST char *native; + const char *native; if (host == NULL) { native = NULL; @@ -2708,8 +2708,8 @@ Tcl_Channel Tcl_OpenTcpClient( Tcl_Interp *interp, /* For error reporting; can be NULL. */ int port, /* Port number to open. */ - CONST char *host, /* Host on which to open port. */ - CONST char *myaddr, /* Client-side address */ + const char *host, /* Host on which to open port. */ + const char *myaddr, /* Client-side address */ int myport, /* Client-side port */ int async) /* If nonzero, attempt to do an asynchronous * connect. Otherwise we do a blocking @@ -2830,7 +2830,7 @@ Tcl_Channel Tcl_OpenTcpServer( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ - CONST char *myHost, /* Name of local host. */ + const char *myHost, /* Name of local host. */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ @@ -3041,7 +3041,7 @@ TclpGetDefaultStdChannel( int Tcl_GetOpenFile( Tcl_Interp *interp, /* Interpreter in which to find file. */ - CONST char *chanID, /* String that identifies file. */ + const char *chanID, /* String that identifies file. */ int forWriting, /* 1 means the file is going to be used for * writing, 0 means for reading. */ int checkUsage, /* 1 means verify that the file was opened in @@ -3053,7 +3053,7 @@ Tcl_GetOpenFile( { Tcl_Channel chan; int chanMode; - Tcl_ChannelType *chanTypePtr; + const Tcl_ChannelType *chanTypePtr; ClientData data; int fd; FILE *f; diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 7cf9e2b..3cc4759 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.36 2006/11/13 08:23:11 das Exp $ + * RCS: @(#) $Id: tclUnixPipe.c,v 1.37 2007/02/20 23:24:07 nijtmans Exp $ */ #include "tclInt.h" @@ -58,7 +58,7 @@ static int PipeGetHandleProc(ClientData instanceData, static int PipeInputProc(ClientData instanceData, char *buf, int toRead, int *errorCode); static int PipeOutputProc(ClientData instanceData, - CONST char *buf, int toWrite, int *errorCode); + const char *buf, int toWrite, int *errorCode); static void PipeWatchProc(ClientData instanceData, int mask); static void RestoreSignals(void); static int SetupStdFile(TclFile file, int type); @@ -137,11 +137,11 @@ TclpMakeFile( TclFile TclpOpenFile( - CONST char *fname, /* The name of the file to open. */ + const char *fname, /* The name of the file to open. */ int mode) /* In what mode to open the file? */ { int fd; - CONST char *native; + const char *native; Tcl_DString ds; native = Tcl_UtfToExternalDString(NULL, fname, -1, &ds); @@ -189,10 +189,10 @@ TclpOpenFile( TclFile TclpCreateTempFile( - CONST char *contents) /* String to write into temp file, or NULL. */ + const char *contents) /* String to write into temp file, or NULL. */ { char fileName[L_tmpnam + 9]; - CONST char *native; + const char *native; Tcl_DString dstring; int fd; @@ -371,7 +371,7 @@ TclpCreateProcess( * Error messages from the child process * itself are sent to errorFile. */ int argc, /* Number of arguments in following array. */ - CONST 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 @@ -790,7 +790,7 @@ TclGetAndDetachPids( Tcl_Channel chan) /* Handle for the pipeline. */ { PipeState *pipePtr; - Tcl_ChannelType *chanTypePtr; + const Tcl_ChannelType *chanTypePtr; int i; char buf[TCL_INTEGER_SPACE]; @@ -1055,7 +1055,7 @@ PipeInputProc( static int PipeOutputProc( ClientData instanceData, /* Pipe state. */ - CONST char *buf, /* The data buffer. */ + const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { @@ -1224,7 +1224,7 @@ Tcl_PidObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Argument strings. */ + Tcl_Obj *const *objv) /* Argument strings. */ { if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); @@ -1234,7 +1234,7 @@ Tcl_PidObjCmd( Tcl_SetObjResult(interp, Tcl_NewLongObj((long) getpid())); } else { Tcl_Channel chan; - Tcl_ChannelType *chanTypePtr; + const Tcl_ChannelType *chanTypePtr; PipeState *pipePtr; int i; Tcl_Obj *resultPtr, *longObjPtr; diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 1795d3a..b27a762 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.64 2006/03/29 01:22:49 hobbs Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.65 2007/02/20 23:24:07 nijtmans 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, - CONST 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); @@ -193,7 +193,7 @@ static void PipeInit(void); static int PipeInputProc(ClientData instanceData, char *buf, int toRead, int *errorCode); static int PipeOutputProc(ClientData instanceData, - CONST char *buf, int toWrite, int *errorCode); + const char *buf, int toWrite, int *errorCode); static DWORD WINAPI PipeReaderThread(LPVOID arg); static void PipeSetupProc(ClientData clientData, int flags); static void PipeWatchProc(ClientData instanceData, int mask); @@ -549,13 +549,13 @@ TclpMakeFile( TclFile TclpOpenFile( - CONST char *path, /* The name of the file to open. */ + const char *path, /* The name of the file to open. */ int mode) /* In what mode to open the file? */ { HANDLE handle; DWORD accessMode, createMode, shareMode, flags; Tcl_DString ds; - CONST TCHAR *nativePath; + const TCHAR *nativePath; /* * Map the access bits to the NT access mode. @@ -670,10 +670,10 @@ TclpOpenFile( TclFile TclpCreateTempFile( - CONST char *contents) /* String to write into temp file, or NULL. */ + const char *contents) /* String to write into temp file, or NULL. */ { WCHAR name[MAX_PATH]; - CONST char *native; + const char *native; Tcl_DString dstring; HANDLE handle; @@ -694,7 +694,7 @@ TclpCreateTempFile( if (contents != NULL) { DWORD result, length; - CONST char *p; + const char *p; /* * Convert the contents from UTF to native encoding @@ -932,7 +932,7 @@ TclpCreateProcess( * Error messages from the child process * itself are sent to errorFile. */ int argc, /* Number of arguments in following array. */ - CONST char **argv, /* Array of argument strings. argv[0] contains + 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 @@ -1377,7 +1377,7 @@ ApplicationType( DWORD attr, read; IMAGE_DOS_HEADER header; Tcl_DString nameBuf, ds; - CONST TCHAR *nativeName; + const TCHAR *nativeName; WCHAR nativeFullPath[MAX_PATH]; static char extensions[][5] = {"", ".com", ".exe", ".bat"}; @@ -1538,14 +1538,14 @@ ApplicationType( static void BuildCommandLine( - CONST char *executable, /* Full path of executable (including + const char *executable, /* Full path of executable (including * extension). Replacement for argv[0]. */ int argc, /* Number of arguments. */ - CONST 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). */ { - CONST char *arg, *start, *special; + const char *arg, *start, *special; int quote, i; Tcl_DString ds; @@ -1770,7 +1770,7 @@ TclGetAndDetachPids( Tcl_Channel chan) { PipeInfo *pipePtr; - Tcl_ChannelType *chanTypePtr; + const Tcl_ChannelType *chanTypePtr; int i; char buf[TCL_INTEGER_SPACE]; @@ -2195,7 +2195,7 @@ PipeInputProc( static int PipeOutputProc( ClientData instanceData, /* Pipe state. */ - CONST char *buf, /* The data buffer. */ + const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ { @@ -2685,10 +2685,10 @@ Tcl_PidObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Argument strings. */ + Tcl_Obj *const *objv) /* Argument strings. */ { Tcl_Channel chan; - Tcl_ChannelType *chanTypePtr; + const Tcl_ChannelType *chanTypePtr; PipeInfo *pipePtr; int i; Tcl_Obj *resultPtr; diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 9b609a2..d46bfc0 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.56 2007/01/02 18:43:51 dkf Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.57 2007/02/20 23:24:07 nijtmans Exp $ */ #include "tclWinInt.h" @@ -229,10 +229,10 @@ static WNDCLASS windowClass; */ static SocketInfo * CreateSocket(Tcl_Interp *interp, int port, - CONST char *host, int server, CONST char *myaddr, + const char *host, int server, const char *myaddr, int myport, int async); static int CreateSocketAddress(LPSOCKADDR_IN sockaddrPtr, - CONST char *host, int port); + const char *host, int port); static void InitSockets(void); static SocketInfo * NewSocketInfo(SOCKET socket); static void SocketExitHandler(ClientData clientData); @@ -1069,10 +1069,10 @@ static SocketInfo * CreateSocket( Tcl_Interp *interp, /* For error reporting; can be NULL. */ int port, /* Port number to open. */ - CONST char *host, /* Name of host on which to open port. */ + const char *host, /* Name of host on which to open port. */ int server, /* 1 if socket should be a server socket, else * 0 for a client socket. */ - CONST char *myaddr, /* Optional client-side address */ + const char *myaddr, /* Optional client-side address */ int myport, /* Optional client-side port */ int async) /* If nonzero, connect client socket * asynchronously. */ @@ -1265,7 +1265,7 @@ CreateSocket( static int CreateSocketAddress( LPSOCKADDR_IN sockaddrPtr, /* Socket address */ - CONST char *host, /* Host. NULL implies INADDR_ANY */ + const char *host, /* Host. NULL implies INADDR_ANY */ int port) /* Port number */ { struct hostent *hostent; /* Host database entry */ @@ -1406,8 +1406,8 @@ Tcl_Channel Tcl_OpenTcpClient( Tcl_Interp *interp, /* For error reporting; can be NULL. */ int port, /* Port number to open. */ - CONST char *host, /* Host on which to open port. */ - CONST char *myaddr, /* Client-side address */ + const char *host, /* Host on which to open port. */ + const char *myaddr, /* Client-side address */ int myport, /* Client-side port */ int async) /* If nonzero, should connect client socket * asynchronously. */ @@ -1521,7 +1521,7 @@ Tcl_Channel Tcl_OpenTcpServer( Tcl_Interp *interp, /* For error reporting - may be NULL. */ int port, /* Port number to open. */ - CONST char *host, /* Name of local host. */ + const char *host, /* Name of local host. */ Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ @@ -1813,7 +1813,7 @@ TcpInputProc( static int TcpOutputProc( ClientData instanceData, /* The socket state. */ - CONST char *buf, /* Where to get data. */ + const char *buf, /* Where to get data. */ int toWrite, /* Maximum number of bytes to write. */ int *errorCodePtr) /* Where to store error codes. */ { @@ -1923,8 +1923,8 @@ static int TcpSetOptionProc( ClientData instanceData, /* Socket state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ - CONST char *optionName, /* Name of the option to set. */ - CONST char *value) /* New value for option. */ + const char *optionName, /* Name of the option to set. */ + const char *value) /* New value for option. */ { SocketInfo *infoPtr; SOCKET sock; @@ -2020,7 +2020,7 @@ static int TcpGetOptionProc( ClientData instanceData, /* Socket state. */ Tcl_Interp *interp, /* For error reporting - can be NULL */ - CONST char *optionName, /* Name of the option to retrieve the value + const char *optionName, /* Name of the option to retrieve the value * for, or NULL to get all options and their * values. */ Tcl_DString *dsPtr) /* Where to store the computed value; @@ -2529,7 +2529,7 @@ SocketProc( *---------------------------------------------------------------------- */ -CONST char * +const char * Tcl_GetHostName(void) { return Tcl_GetString(TclGetProcessGlobalValue(&hostName)); -- cgit v0.12