diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 8 | ||||
-rw-r--r-- | generic/tclCompile.c | 24 | ||||
-rw-r--r-- | generic/tclCompile.h | 20 | ||||
-rw-r--r-- | generic/tclExecute.c | 12 | ||||
-rw-r--r-- | generic/tclInt.decls | 10 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 10 |
7 files changed, 54 insertions, 42 deletions
@@ -1,3 +1,15 @@ +2008-10-04 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclInt.decls: CONSTified the AuxDataType argument + * generic/tclCompCmds.c: of TclCreateAuxData and + * generic/tclCompile.c TclRegisterAuxDataType and the return + * generic/tclCompile.h values of TclGetAuxDataType and + * generic/tclExecute.c TclGetInstructionTable + * ChangeLog + * generic/tclIntDecls.h: regenerated + This change complies with TIP #27 (even though it only + involves internal function, so this is not even necessary). + 2008-10-05 Donal K. Fellows <dkf@users.sf.net> * generic/tclIndexObj.c (TclInitPrefixCmd): Make the [tcl::prefix] diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 877bb11..4f7f230 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.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: tclCompCmds.c,v 1.147 2008/09/28 22:17:39 dkf Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.148 2008/10/05 20:47:52 nijtmans Exp $ */ #include "tclInt.h" @@ -187,21 +187,21 @@ static void CompileReturnInternal(CompileEnv *envPtr, * The structures below define the AuxData types defined in this file. */ -AuxDataType tclForeachInfoType = { +const AuxDataType tclForeachInfoType = { "ForeachInfo", /* name */ DupForeachInfo, /* dupProc */ FreeForeachInfo, /* freeProc */ PrintForeachInfo /* printProc */ }; -AuxDataType tclJumptableInfoType = { +const AuxDataType tclJumptableInfoType = { "JumptableInfo", /* name */ DupJumptableInfo, /* dupProc */ FreeJumptableInfo, /* freeProc */ PrintJumptableInfo /* printProc */ }; -AuxDataType tclDictUpdateInfoType = { +const AuxDataType tclDictUpdateInfoType = { "DictUpdateInfo", /* name */ DupDictUpdateInfo, /* dupProc */ FreeDictUpdateInfo, /* freeProc */ diff --git a/generic/tclCompile.c b/generic/tclCompile.c index a0ab92b..c55258f 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.156 2008/09/08 03:55:18 msofer Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.157 2008/10/05 20:47:52 nijtmans Exp $ */ #include "tclInt.h" @@ -52,7 +52,7 @@ static int traceInitialized = 0; * existence of a procedure call frame to distinguish these. */ -InstructionDesc tclInstructionTable[] = { +InstructionDesc const tclInstructionTable[] = { /* Name Bytes stackEffect #Opnds Operand types */ {"done", 1, -1, 0, {OPERAND_NONE}}, /* Finish ByteCode execution and return stktop (top stack item) */ @@ -485,7 +485,7 @@ TclSetByteCodeFromAny( Interp *iPtr = (Interp *) interp; CompileEnv compEnv; /* Compilation environment structure allocated * in frame. */ - register AuxData *auxDataPtr; + register const AuxData *auxDataPtr; LiteralEntry *entryPtr; register int i; int length, result = TCL_OK; @@ -694,7 +694,7 @@ TclCleanupByteCode( int numLitObjects = codePtr->numLitObjects; int numAuxDataItems = codePtr->numAuxDataItems; register Tcl_Obj **objArrayPtr, *objPtr; - register AuxData *auxDataPtr; + register const AuxData *auxDataPtr; int i; #ifdef TCL_COMPILE_STATS @@ -2607,7 +2607,7 @@ int TclCreateAuxData( ClientData clientData, /* The compilation auxiliary data to store in * the new aux data record. */ - AuxDataType *typePtr, /* Pointer to the type to attach to this + const AuxDataType *typePtr, /* Pointer to the type to attach to this * AuxData */ register CompileEnv *envPtr)/* Points to the CompileEnv for which a new * aux data structure is to be allocated. */ @@ -2958,7 +2958,7 @@ TclFixupForwardJump( *---------------------------------------------------------------------- */ -void * /* == InstructionDesc* == */ +const void * /* == InstructionDesc* == */ TclGetInstructionTable(void) { return &tclInstructionTable[0]; @@ -2985,7 +2985,7 @@ TclGetInstructionTable(void) void TclRegisterAuxDataType( - AuxDataType *typePtr) /* Information about object type; storage must + const AuxDataType *typePtr) /* Information about object type; storage must * be statically allocated (must live forever; * will not be deallocated). */ { @@ -3034,12 +3034,12 @@ TclRegisterAuxDataType( *---------------------------------------------------------------------- */ -AuxDataType * +const AuxDataType * TclGetAuxDataType( - char *typeName) /* Name of AuxData type to look up. */ + const char *typeName) /* Name of AuxData type to look up. */ { register Tcl_HashEntry *hPtr; - AuxDataType *typePtr = NULL; + const AuxDataType *typePtr = NULL; Tcl_MutexLock(&tableMutex); if (!auxDataTypeTableInitialized) { @@ -3048,7 +3048,7 @@ TclGetAuxDataType( hPtr = Tcl_FindHashEntry(&auxDataTypeTable, typeName); if (hPtr != NULL) { - typePtr = (AuxDataType *) Tcl_GetHashValue(hPtr); + typePtr = (const AuxDataType *) Tcl_GetHashValue(hPtr); } Tcl_MutexUnlock(&tableMutex); @@ -3744,7 +3744,7 @@ FormatInstruction( { Proc *procPtr = codePtr->procPtr; unsigned char opCode = *pc; - register InstructionDesc *instDesc = &tclInstructionTable[opCode]; + register const InstructionDesc *instDesc = &tclInstructionTable[opCode]; unsigned char *codeStart = codePtr->codeStart; unsigned pcOffset = pc - codeStart; int opnd = 0, i, j, numBytes = 1; diff --git a/generic/tclCompile.h b/generic/tclCompile.h index ab8eef8..f314937 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -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: tclCompile.h,v 1.107 2008/09/10 13:24:09 msofer Exp $ + * RCS: @(#) $Id: tclCompile.h,v 1.108 2008/10/05 20:47:52 nijtmans Exp $ */ #ifndef _TCLCOMPILATION @@ -177,7 +177,7 @@ typedef void (AuxDataPrintProc)(ClientData clientData, */ typedef struct AuxDataType { - char *name; /* The name of the type. Types can be + CONST86 char *name; /* The name of the type. Types can be * registered and found by name */ AuxDataDupProc *dupProc; /* Callback procedure to invoke when the aux * data is duplicated (e.g., when the ByteCode @@ -200,7 +200,7 @@ typedef struct AuxDataType { */ typedef struct AuxData { - AuxDataType *type; /* Pointer to the AuxData type associated with + CONST86 AuxDataType *type; /* Pointer to the AuxData type associated with * this ClientData. */ ClientData clientData; /* The compilation data itself. */ } AuxData; @@ -682,7 +682,7 @@ typedef enum InstOperandType { } InstOperandType; typedef struct InstructionDesc { - char *name; /* Name of instruction. */ + CONST86 char *name; /* Name of instruction. */ int numBytes; /* Total number of bytes for instruction. */ int stackEffect; /* The worst-case balance stack effect of the * instruction, used for stack requirements @@ -694,7 +694,7 @@ typedef struct InstructionDesc { /* The type of each operand. */ } InstructionDesc; -MODULE_SCOPE InstructionDesc tclInstructionTable[]; +MODULE_SCOPE InstructionDesc CONST86 tclInstructionTable[]; /* * Compilation of some Tcl constructs such as if commands and the logical or @@ -784,7 +784,7 @@ typedef struct ForeachInfo { * LAST FIELD IN THE STRUCTURE! */ } ForeachInfo; -MODULE_SCOPE AuxDataType tclForeachInfoType; +MODULE_SCOPE CONST86 AuxDataType tclForeachInfoType; /* * Structure used to hold information about a switch command that is needed @@ -797,7 +797,7 @@ typedef struct JumptableInfo { * offsets). */ } JumptableInfo; -MODULE_SCOPE AuxDataType tclJumptableInfoType; +MODULE_SCOPE CONST86 AuxDataType tclJumptableInfoType; /* * Structure used to hold information about a [dict update] command that is @@ -815,7 +815,7 @@ typedef struct { * STRUCTURE. */ } DictUpdateInfo; -MODULE_SCOPE AuxDataType tclDictUpdateInfoType; +MODULE_SCOPE CONST86 AuxDataType tclDictUpdateInfoType; /* * ClientData type used by the math operator commands. @@ -879,7 +879,7 @@ MODULE_SCOPE void TclCompileTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, CompileEnv *envPtr); MODULE_SCOPE int TclCreateAuxData(ClientData clientData, - AuxDataType *typePtr, CompileEnv *envPtr); + CONST AuxDataType *typePtr, CompileEnv *envPtr); MODULE_SCOPE int TclCreateExceptRange(ExceptionRangeType type, CompileEnv *envPtr); MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp); @@ -930,7 +930,7 @@ MODULE_SCOPE void TclPrintObject(FILE *outFile, Tcl_Obj *objPtr, int maxChars); MODULE_SCOPE void TclPrintSource(FILE *outFile, const char *string, int maxChars); -MODULE_SCOPE void TclRegisterAuxDataType(AuxDataType *typePtr); +MODULE_SCOPE void TclRegisterAuxDataType(CONST AuxDataType *typePtr); MODULE_SCOPE int TclRegisterLiteral(CompileEnv *envPtr, char *bytes, int length, int flags); MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index fd79931..1275aed 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.412 2008/09/18 15:43:15 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.413 2008/10/05 20:47:52 nijtmans Exp $ */ #include "tclInt.h" @@ -80,7 +80,7 @@ int tclTraceExec = 0; * disjoint for backward-compatability reasons. */ -static const char *operatorStrings[] = { +static const char *const operatorStrings[] = { "||", "&&", "|", "^", "&", "==", "!=", "<", ">", "<=", ">=", "<<", ">>", "+", "-", "*", "/", "%", "+", "-", "~", "!", "BUILTIN FUNCTION", "FUNCTION", @@ -93,7 +93,7 @@ static const char *operatorStrings[] = { */ #ifdef TCL_COMPILE_DEBUG -static const char *resultStrings[] = { +static const char *const resultStrings[] = { "TCL_OK", "TCL_ERROR", "TCL_RETURN", "TCL_BREAK", "TCL_CONTINUE" }; #endif @@ -123,7 +123,7 @@ long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS] = { 0, 0, 0, 0, 0 }; */ typedef struct { - char *name; /* Name of function. */ + const char *name; /* Name of function. */ int numArgs; /* Number of arguments for function. */ } BuiltinFunc; @@ -133,7 +133,7 @@ typedef struct { * operand byte. */ -static BuiltinFunc tclBuiltinFuncTable[] = { +static BuiltinFunc const tclBuiltinFuncTable[] = { {"acos", 1}, {"asin", 1}, {"atan", 1}, @@ -1820,7 +1820,7 @@ TclExecuteByteCode( int traceInstructions = (tclTraceExec == 3); char cmdNameBuf[21]; #endif - char *curInstName = NULL; + const char *curInstName = NULL; /* * The execution uses a unified stack: first a BottomData, immediately diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 8213109..3dfdfb7 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -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: tclInt.decls,v 1.127 2008/07/29 05:30:32 msofer Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.128 2008/10/05 20:47:52 nijtmans Exp $ library tcl @@ -576,7 +576,7 @@ declare 144 generic { int index) } declare 145 generic { - struct AuxDataType *TclGetAuxDataType(char *typeName) + CONST86 struct AuxDataType *TclGetAuxDataType(CONST char *typeName) } declare 146 generic { TclHandle TclHandleCreate(VOID *ptr) @@ -645,13 +645,13 @@ declare 162 generic { void TclChannelEventScriptInvoker(ClientData clientData, int flags) } -# ALERT: The result of 'TclGetInstructionTable' is actually an -# "InstructionDesc*" but we do not want to describe this structure in +# ALERT: The result of 'TclGetInstructionTable' is actually a +# "const InstructionDesc*" but we do not want to describe this structure in # "tclInt.h". It is described in "tclCompile.h". Use a cast to the # correct type when calling this procedure. declare 163 generic { - void *TclGetInstructionTable(void) + CONST86 void *TclGetInstructionTable(void) } # ALERT: The argument of 'TclExpandCodeArray' is actually a diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 2148ab6..b12fa91 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.123 2008/07/29 05:30:34 msofer Exp $ + * RCS: @(#) $Id: tclIntDecls.h,v 1.124 2008/10/05 20:47:52 nijtmans Exp $ */ #ifndef _TCLINTDECLS @@ -681,7 +681,7 @@ EXTERN void TclHideLiteral (Tcl_Interp * interp, #ifndef TclGetAuxDataType_TCL_DECLARED #define TclGetAuxDataType_TCL_DECLARED /* 145 */ -EXTERN struct AuxDataType * TclGetAuxDataType (char * typeName); +EXTERN CONST86 struct AuxDataType * TclGetAuxDataType (CONST char * typeName); #endif #ifndef TclHandleCreate_TCL_DECLARED #define TclHandleCreate_TCL_DECLARED @@ -764,7 +764,7 @@ EXTERN void TclChannelEventScriptInvoker (ClientData clientData, #ifndef TclGetInstructionTable_TCL_DECLARED #define TclGetInstructionTable_TCL_DECLARED /* 163 */ -EXTERN void * TclGetInstructionTable (void); +EXTERN CONST86 void * TclGetInstructionTable (void); #endif #ifndef TclExpandCodeArray_TCL_DECLARED #define TclExpandCodeArray_TCL_DECLARED @@ -1278,7 +1278,7 @@ typedef struct TclIntStubs { int (*tclSetByteCodeFromAny) (Tcl_Interp * interp, Tcl_Obj * objPtr, CompileHookProc * hookProc, ClientData clientData); /* 142 */ int (*tclAddLiteralObj) (struct CompileEnv * envPtr, Tcl_Obj * objPtr, LiteralEntry ** litPtrPtr); /* 143 */ void (*tclHideLiteral) (Tcl_Interp * interp, struct CompileEnv * envPtr, int index); /* 144 */ - struct AuxDataType * (*tclGetAuxDataType) (char * typeName); /* 145 */ + CONST86 struct AuxDataType * (*tclGetAuxDataType) (CONST char * typeName); /* 145 */ TclHandle (*tclHandleCreate) (VOID * ptr); /* 146 */ void (*tclHandleFree) (TclHandle handle); /* 147 */ TclHandle (*tclHandlePreserve) (TclHandle handle); /* 148 */ @@ -1296,7 +1296,7 @@ typedef struct TclIntStubs { void *reserved160; int (*tclChannelTransform) (Tcl_Interp * interp, Tcl_Channel chan, Tcl_Obj * cmdObjPtr); /* 161 */ void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */ - void * (*tclGetInstructionTable) (void); /* 163 */ + CONST86 void * (*tclGetInstructionTable) (void); /* 163 */ void (*tclExpandCodeArray) (void * envPtr); /* 164 */ void (*tclpSetInitialEncodings) (void); /* 165 */ int (*tclListObjSetElement) (Tcl_Interp * interp, Tcl_Obj * listPtr, int index, Tcl_Obj * valuePtr); /* 166 */ |