summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authornijtmans <nijtmans>2008-10-15 06:17:03 (GMT)
committernijtmans <nijtmans>2008-10-15 06:17:03 (GMT)
commit9621a454a0bde1f84cef51026947815d4eb244b6 (patch)
tree20cca6f694fead4ac88a820249260a91c18a3387 /generic
parentde27d1ee5e8ba5ad01354e36be8914a8303bf45d (diff)
downloadtcl-9621a454a0bde1f84cef51026947815d4eb244b6.zip
tcl-9621a454a0bde1f84cef51026947815d4eb244b6.tar.gz
tcl-9621a454a0bde1f84cef51026947815d4eb244b6.tar.bz2
Add "const" to many internal
const tables, so those will be put by the C-compiler in the TEXT segment in stead of the DATA segment. This makes those table sharable in shared libraries.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBinary.c118
-rw-r--r--generic/tclCompile.c8
-rw-r--r--generic/tclDictObj.c10
-rw-r--r--generic/tclHash.c8
-rw-r--r--generic/tclInt.h58
-rw-r--r--generic/tclListObj.c10
-rw-r--r--generic/tclNamesp.c66
-rw-r--r--generic/tclObj.c18
-rw-r--r--generic/tclProc.c6
-rw-r--r--generic/tclRegexp.c4
-rw-r--r--generic/tclStringObj.c4
-rw-r--r--generic/tclUtil.c4
-rw-r--r--generic/tclVar.c18
13 files changed, 166 insertions, 166 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 5df4099..4073a61 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.47 2008/10/07 22:58:38 dkf Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.48 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -147,7 +147,7 @@ static const char B64Digits[65] = {
* converting an arbitrary String to a ByteArray may be.
*/
-Tcl_ObjType tclByteArrayType = {
+const Tcl_ObjType tclByteArrayType = {
"bytearray",
FreeByteArrayInternalRep,
DupByteArrayInternalRep,
@@ -613,7 +613,7 @@ TclInitBinaryCmd(Tcl_Interp *interp)
Tcl_Obj *binDict, *encDict, *decDict;
/*
- * FIX ME: I so ugly - please make me pretty ...
+ * FIX ME: I so ugly - please make me pretty ...
*/
nsTclPtr = Tcl_FindNamespace(interp, "::tcl",
@@ -634,9 +634,9 @@ TclInitBinaryCmd(Tcl_Interp *interp)
if (nsEncPtr == NULL) {
Tcl_Panic("unable to find or create ::tcl::binary::encode namespace!");
}
- encEnsemble = Tcl_CreateEnsemble(interp, "encode",
+ encEnsemble = Tcl_CreateEnsemble(interp, "encode",
nsBinPtr, 0);
-
+
nsDecPtr = Tcl_FindNamespace(interp, "::tcl::binary::decode",
NULL, TCL_CREATE_NS_IF_UNKNOWN);
if (nsDecPtr == NULL) {
@@ -659,7 +659,7 @@ TclInitBinaryCmd(Tcl_Interp *interp)
Tcl_CreateObjCommand(interp, "::tcl::binary::scan",
BinaryScanCmd, NULL, NULL);
Tcl_SetEnsembleMappingDict(interp, binEnsemble, binDict);
-
+
TclNewObj(encDict);
Tcl_DictObjPut(NULL, encDict, Tcl_NewStringObj("hex",-1),
Tcl_NewStringObj("::tcl::binary::encode::hex",-1));
@@ -744,7 +744,7 @@ BinaryFormatCmd(
* first pass computes the size of the output buffer. The second pass
* places the formatted data into the buffer.
*/
-
+
format = TclGetString(objv[1]);
arg = 2;
offset = 0;
@@ -766,7 +766,7 @@ BinaryFormatCmd(
* For string-type specifiers, the count corresponds to the
* number of bytes in a single argument.
*/
-
+
if (arg >= objc) {
goto badIndex;
}
@@ -830,14 +830,14 @@ BinaryFormatCmd(
} else {
int listc;
Tcl_Obj **listv;
-
- /* The macro evals its args more than once: avoid arg++ */
+
+ /* The macro evals its args more than once: avoid arg++ */
if (TclListObjGetElements(interp, objv[arg], &listc,
&listv) != TCL_OK) {
return TCL_ERROR;
}
arg++;
-
+
if (count == BINARY_ALL) {
count = listc;
} else if (count > listc) {
@@ -849,7 +849,7 @@ BinaryFormatCmd(
}
offset += count*size;
break;
-
+
case 'x':
if (count == BINARY_ALL) {
Tcl_AppendResult(interp,
@@ -896,16 +896,16 @@ BinaryFormatCmd(
if (length == 0) {
return TCL_OK;
}
-
+
/*
* Prepare the result object by preallocating the caclulated number of
* bytes and filling with nulls.
*/
-
+
resultPtr = Tcl_NewObj();
buffer = Tcl_SetByteArrayLength(resultPtr, length);
memset(buffer, 0, (size_t) length);
-
+
/*
* Pack the data into the result object. Note that we can skip the
* error checking during this pass, since we have already parsed the
@@ -932,9 +932,9 @@ BinaryFormatCmd(
case 'A': {
char pad = (char) (cmd == 'a' ? '\0' : ' ');
unsigned char *bytes;
-
+
bytes = Tcl_GetByteArrayFromObj(objv[arg++], &length);
-
+
if (count == BINARY_ALL) {
count = length;
} else if (count == BINARY_NOCOUNT) {
@@ -952,7 +952,7 @@ BinaryFormatCmd(
case 'b':
case 'B': {
unsigned char *last;
-
+
str = TclGetStringFromObj(objv[arg], &length);
arg++;
if (count == BINARY_ALL) {
@@ -1014,7 +1014,7 @@ BinaryFormatCmd(
case 'H': {
unsigned char *last;
int c;
-
+
str = TclGetStringFromObj(objv[arg], &length);
arg++;
if (count == BINARY_ALL) {
@@ -1170,26 +1170,26 @@ BinaryFormatCmd(
Tcl_AppendResult(interp, "expected ", errorString,
" string but got \"", errorValue, "\" instead", NULL);
return TCL_ERROR;
-
+
badCount:
errorString = "missing count for \"@\" field specifier";
goto error;
-
+
badIndex:
errorString = "not enough arguments for all format specifiers";
goto error;
-
+
badField:
{
Tcl_UniChar ch;
char buf[TCL_UTF_MAX + 1];
-
+
Tcl_UtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
Tcl_AppendResult(interp, "bad field specifier \"", buf, "\"", NULL);
return TCL_ERROR;
}
-
+
error:
Tcl_AppendResult(interp, errorString, NULL);
return TCL_ERROR;
@@ -1238,7 +1238,7 @@ BinaryScanCmd(
Tcl_Obj *valuePtr, *elementPtr;
Tcl_HashTable numberCacheHash;
Tcl_HashTable *numberCachePtr;
-
+
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv,
"value formatString ?varName ...?");
@@ -1261,7 +1261,7 @@ BinaryScanCmd(
case 'a':
case 'A': {
unsigned char *src;
-
+
if (arg >= objc) {
DeleteScanNumberCache(numberCachePtr);
goto badIndex;
@@ -1276,14 +1276,14 @@ BinaryScanCmd(
goto done;
}
}
-
+
src = buffer + offset;
size = count;
-
+
/*
* Trim trailing nulls and spaces, if necessary.
*/
-
+
if (cmd == 'A') {
while (size > 0) {
if (src[size-1] != '\0' && src[size-1] != ' ') {
@@ -1292,7 +1292,7 @@ BinaryScanCmd(
size--;
}
}
-
+
/*
* Have to do this #ifdef-fery because (as part of defining
* Tcl_NewByteArrayObj) we removed the #def that hides this
@@ -1533,36 +1533,36 @@ BinaryScanCmd(
goto badField;
}
}
-
+
/*
* Set the result to the last position of the cursor.
*/
-
+
done:
Tcl_SetObjResult(interp, Tcl_NewLongObj(arg - 3));
DeleteScanNumberCache(numberCachePtr);
-
+
return TCL_OK;
-
+
badCount:
errorString = "missing count for \"@\" field specifier";
goto error;
-
+
badIndex:
errorString = "not enough arguments for all format specifiers";
goto error;
-
+
badField:
{
Tcl_UniChar ch;
char buf[TCL_UTF_MAX + 1];
-
+
Tcl_UtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
Tcl_AppendResult(interp, "bad field specifier \"", buf, "\"", NULL);
return TCL_ERROR;
}
-
+
error:
Tcl_AppendResult(interp, errorString, NULL);
return TCL_ERROR;
@@ -1755,7 +1755,7 @@ CopyNumber(
int type) /* What type of thing are we copying? */
{
switch (NeedReversing(type)) {
- case 0:
+ case 0:
memcpy(to, from, length);
break;
case 1: {
@@ -2262,7 +2262,7 @@ DeleteScanNumberCache(
* a table to convert values to hexadecimal digits.
*
* Results:
- * Interp result set to an encoded byte array object
+ * Interp result set to an encoded byte array object
*
* Side effects:
* None
@@ -2273,7 +2273,7 @@ DeleteScanNumberCache(
static int
BinaryEncodeHex(
ClientData clientData,
- Tcl_Interp *interp,
+ Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
@@ -2282,7 +2282,7 @@ BinaryEncodeHex(
unsigned char *cursor = NULL;
const char *digits = clientData;
int offset = 0, count = 0;
-
+
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
return TCL_ERROR;
@@ -2307,7 +2307,7 @@ BinaryEncodeHex(
* Implement the [binary decode hex] binary encoding.
*
* Results:
- * Interp result set to an decoded byte array object
+ * Interp result set to an decoded byte array object
*
* Side effects:
* None
@@ -2318,7 +2318,7 @@ BinaryEncodeHex(
static int
BinaryDecodeHex(
ClientData clientData,
- Tcl_Interp *interp,
+ Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
@@ -2327,8 +2327,8 @@ BinaryDecodeHex(
unsigned char *begin, *cursor, c;
int i, index, value, size, count = 0, cut = 0, strict = 0;
enum {OPT_STRICT };
- static const char *optStrings[] = { "-strict", NULL };
-
+ static const char *const optStrings[] = { "-strict", NULL };
+
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
return TCL_ERROR;
@@ -2339,7 +2339,7 @@ BinaryDecodeHex(
return TCL_ERROR;
}
switch (index) {
- case OPT_STRICT:
+ case OPT_STRICT:
strict = 1;
break;
}
@@ -2405,7 +2405,7 @@ BinaryDecodeHex(
* base64 and uuencode binary encodings.
*
* Results:
- * Interp result set to an encoded byte array object
+ * Interp result set to an encoded byte array object
*
* Side effects:
* None
@@ -2444,10 +2444,10 @@ BinaryEncode64(
int wrapcharlen = 1;
int offset, i, index, size, outindex = 0, count = 0;
enum {OPT_MAXLEN, OPT_WRAPCHAR };
- static const char *optStrings[] = { "-maxlen", "-wrapchar", NULL };
+ static const char *const optStrings[] = { "-maxlen", "-wrapchar", NULL };
if (objc < 2 || objc%2 != 0) {
- Tcl_WrongNumArgs(interp, 1, objv,
+ Tcl_WrongNumArgs(interp, 1, objv,
"?-maxlen len? ?-wrapchar char? data");
return TCL_ERROR;
}
@@ -2457,7 +2457,7 @@ BinaryEncode64(
return TCL_ERROR;
}
switch (index) {
- case OPT_MAXLEN:
+ case OPT_MAXLEN:
if (Tcl_GetIntFromObj(interp, objv[i+1], &maxlen) != TCL_OK) {
return TCL_ERROR;
}
@@ -2518,7 +2518,7 @@ BinaryEncode64(
* Decode a uuencoded string.
*
* Results:
- * Interp result set to an byte array object
+ * Interp result set to an byte array object
*
* Side effects:
* None
@@ -2539,8 +2539,8 @@ BinaryDecodeUu(
int i, index, size, count = 0, cut = 0, strict = 0;
char c;
enum {OPT_STRICT };
- static const char *optStrings[] = { "-strict", NULL };
-
+ static const char *const optStrings[] = { "-strict", NULL };
+
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
return TCL_ERROR;
@@ -2551,7 +2551,7 @@ BinaryDecodeUu(
return TCL_ERROR;
}
switch (index) {
- case OPT_STRICT:
+ case OPT_STRICT:
strict = 1;
break;
}
@@ -2608,7 +2608,7 @@ BinaryDecodeUu(
* Decode a base64 encoded string.
*
* Results:
- * Interp result set to an byte array object
+ * Interp result set to an byte array object
*
* Side effects:
* None
@@ -2630,8 +2630,8 @@ BinaryDecode64(
int strict = 0;
int i, index, size, cut = 0, count = 0;
enum {OPT_STRICT };
- static const char *optStrings[] = { "-strict", NULL };
-
+ static const char *const optStrings[] = { "-strict", NULL };
+
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
return TCL_ERROR;
@@ -2642,7 +2642,7 @@ BinaryDecode64(
return TCL_ERROR;
}
switch (index) {
- case OPT_STRICT:
+ case OPT_STRICT:
strict = 1;
break;
}
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index b347018..ddf3818 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.158 2008/10/12 19:53:32 msofer Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.159 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -441,7 +441,7 @@ static void EnterCmdWordIndex (ExtCmdLoc *eclPtr, Tcl_Obj* obj,
* procedures that can be invoked by generic object code.
*/
-Tcl_ObjType tclByteCodeType = {
+const Tcl_ObjType tclByteCodeType = {
"bytecode", /* name */
FreeByteCodeInternalRep, /* freeIntRepProc */
DupByteCodeInternalRep, /* dupIntRepProc */
@@ -2147,7 +2147,7 @@ TclFindCompiledLocal(
if (procPtr == NULL) {
/*
- * Compiling a non-body script: give it read access to the LVT in the
+ * Compiling a non-body script: give it read access to the LVT in the
* current localCache
*/
@@ -2171,7 +2171,7 @@ TclFindCompiledLocal(
}
return -1;
}
-
+
if (name != NULL) {
int localCt = procPtr->numCompiledLocals;
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 6253e43..2b87c01 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.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: tclDictObj.c,v 1.68 2008/08/23 11:35:43 dkf Exp $
+ * RCS: @(#) $Id: tclDictObj.c,v 1.69 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -159,7 +159,7 @@ typedef struct Dict {
* functions that can be invoked by generic object code.
*/
-Tcl_ObjType tclDictType = {
+const Tcl_ObjType tclDictType = {
"dict",
FreeDictInternalRep, /* freeIntRepProc */
DupDictInternalRep, /* dupIntRepProc */
@@ -177,7 +177,7 @@ Tcl_ObjType tclDictType = {
* *this* file. Everything else should use the dict iterator API.
*/
-static Tcl_HashKeyType chainHashType = {
+static const Tcl_HashKeyType chainHashType = {
TCL_HASH_KEY_TYPE_VERSION,
0,
TclHashObjKey,
@@ -2713,7 +2713,7 @@ DictFilterCmd(
Tcl_Obj *const *objv)
{
Interp *iPtr = (Interp *) interp;
- static const char *filters[] = {
+ static const char *const filters[] = {
"key", "script", "value", NULL
};
enum FilterTypes {
@@ -3356,7 +3356,7 @@ TclInitDictCmd(
{
return TclMakeEnsemble(interp, "dict", implementationMap);
}
-
+
/*
* Local Variables:
* mode: c
diff --git a/generic/tclHash.c b/generic/tclHash.c
index bf1a87a..dd995f0 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.35 2008/10/04 11:51:25 nijtmans Exp $
+ * RCS: @(#) $Id: tclHash.c,v 1.36 2008/10/15 06:17:03 nijtmans Exp $
*/
#include "tclInt.h"
@@ -76,7 +76,7 @@ static Tcl_HashEntry * BogusCreate(Tcl_HashTable *tablePtr, const char *key,
int *newPtr);
static void RebuildTable(Tcl_HashTable *tablePtr);
-Tcl_HashKeyType tclArrayHashKeyType = {
+const Tcl_HashKeyType tclArrayHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
TCL_HASH_KEY_RANDOMIZE_HASH, /* flags */
HashArrayKey, /* hashKeyProc */
@@ -85,7 +85,7 @@ Tcl_HashKeyType tclArrayHashKeyType = {
NULL /* freeEntryProc */
};
-Tcl_HashKeyType tclOneWordHashKeyType = {
+const Tcl_HashKeyType tclOneWordHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
NULL, /* HashOneWordKey, */ /* hashProc */
@@ -94,7 +94,7 @@ Tcl_HashKeyType tclOneWordHashKeyType = {
NULL /* FreeOneWordKey, */ /* freeEntryProc */
};
-Tcl_HashKeyType tclStringHashKeyType = {
+const Tcl_HashKeyType tclStringHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
HashStringKey, /* hashKeyProc */
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 2487b68..551688d 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -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: tclInt.h,v 1.403 2008/10/10 04:09:27 das Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.404 2008/10/15 06:17:03 nijtmans Exp $
*/
#ifndef _TCLINT
@@ -1350,7 +1350,7 @@ typedef struct CoroutineData {
typedef struct ExecEnv {
ExecStack *execStackPtr; /* Points to the first item in the evaluation
* stack on the heap. */
- Tcl_Obj *constants[2]; /* Pointers to constant "0" and "1" objs. */
+ Tcl_Obj *constants[2]; /* Pointers to constant "0" and "1" objs. */
struct Tcl_Interp *interp;
struct TEOV_callback *callbackPtr;
/* Top callback in TEOV's stack */
@@ -1994,7 +1994,7 @@ typedef struct Interp {
/* Callbacks to be run after a command exited;
* this is only set for atProcExirt or
* tailcalls that fall back out of tebc. */
-
+
#ifdef TCL_COMPILE_STATS
/*
* Statistical information about the bytecode compiler and interpreter's
@@ -2498,32 +2498,32 @@ MODULE_SCOPE ClientData tclTimeClientData;
* Variables denoting the Tcl object types defined in the core.
*/
-MODULE_SCOPE Tcl_ObjType tclBignumType;
-MODULE_SCOPE Tcl_ObjType tclBooleanType;
-MODULE_SCOPE Tcl_ObjType tclByteArrayType;
-MODULE_SCOPE Tcl_ObjType tclByteCodeType;
-MODULE_SCOPE Tcl_ObjType tclDoubleType;
-MODULE_SCOPE Tcl_ObjType tclEndOffsetType;
-MODULE_SCOPE Tcl_ObjType tclIntType;
-MODULE_SCOPE Tcl_ObjType tclListType;
-MODULE_SCOPE Tcl_ObjType tclDictType;
-MODULE_SCOPE Tcl_ObjType tclProcBodyType;
-MODULE_SCOPE Tcl_ObjType tclStringType;
-MODULE_SCOPE Tcl_ObjType tclArraySearchType;
-MODULE_SCOPE Tcl_ObjType tclEnsembleCmdType;
+MODULE_SCOPE const Tcl_ObjType tclBignumType;
+MODULE_SCOPE const Tcl_ObjType tclBooleanType;
+MODULE_SCOPE const Tcl_ObjType tclByteArrayType;
+MODULE_SCOPE const Tcl_ObjType tclByteCodeType;
+MODULE_SCOPE const Tcl_ObjType tclDoubleType;
+MODULE_SCOPE const Tcl_ObjType tclEndOffsetType;
+MODULE_SCOPE const Tcl_ObjType tclIntType;
+MODULE_SCOPE const Tcl_ObjType tclListType;
+MODULE_SCOPE const Tcl_ObjType tclDictType;
+MODULE_SCOPE const Tcl_ObjType tclProcBodyType;
+MODULE_SCOPE const Tcl_ObjType tclStringType;
+MODULE_SCOPE const Tcl_ObjType tclArraySearchType;
+MODULE_SCOPE const Tcl_ObjType tclEnsembleCmdType;
#ifndef NO_WIDE_TYPE
-MODULE_SCOPE Tcl_ObjType tclWideIntType;
+MODULE_SCOPE const Tcl_ObjType tclWideIntType;
#endif
-MODULE_SCOPE Tcl_ObjType tclRegexpType;
+MODULE_SCOPE const Tcl_ObjType tclRegexpType;
/*
* Variables denoting the hash key types defined in the core.
*/
-MODULE_SCOPE Tcl_HashKeyType tclArrayHashKeyType;
-MODULE_SCOPE Tcl_HashKeyType tclOneWordHashKeyType;
-MODULE_SCOPE Tcl_HashKeyType tclStringHashKeyType;
-MODULE_SCOPE Tcl_HashKeyType tclObjHashKeyType;
+MODULE_SCOPE const Tcl_HashKeyType tclArrayHashKeyType;
+MODULE_SCOPE const Tcl_HashKeyType tclOneWordHashKeyType;
+MODULE_SCOPE const Tcl_HashKeyType tclStringHashKeyType;
+MODULE_SCOPE const Tcl_HashKeyType tclObjHashKeyType;
/*
* The head of the list of free Tcl objects, and the total number of Tcl
@@ -3550,7 +3550,7 @@ MODULE_SCOPE void TclpFreeAllocCache(void *);
* and TclThreadFreeObj().
*
* Note that the optimiser should resolve the case (interp==NULL) at compile
- * time.
+ * time.
*/
# define ALLOC_NOBJHIGH 1200
@@ -3568,7 +3568,7 @@ MODULE_SCOPE void TclpFreeAllocCache(void *);
--cachePtr->numObjects; \
} \
} while (0)
-
+
# define TclFreeObjStorageEx(interp, objPtr) \
do { \
AllocCache *cachePtr; \
@@ -4127,7 +4127,7 @@ typedef struct TEOV_callback {
ClientData data[4];
struct TEOV_callback *nextPtr;
} TEOV_callback;
-
+
#define TOP_CB(iPtr) (((Interp *)(iPtr))->execEnvPtr->callbackPtr)
/*
@@ -4145,10 +4145,10 @@ typedef struct TEOV_callback {
TEOV_callback *callbackPtr; \
TCLNR_ALLOC((interp), (callbackPtr)); \
callbackPtr->procPtr = (postProcPtr); \
- callbackPtr->data[0] = (data0); \
- callbackPtr->data[1] = (data1); \
- callbackPtr->data[2] = (data2); \
- callbackPtr->data[3] = (data3); \
+ callbackPtr->data[0] = (ClientData)(data0);\
+ callbackPtr->data[1] = (ClientData)(data1);\
+ callbackPtr->data[2] = (ClientData)(data2);\
+ callbackPtr->data[3] = (ClientData)(data3);\
callbackPtr->nextPtr = TOP_CB(interp); \
TOP_CB(interp) = callbackPtr; \
}
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 68db503..b8f9da7 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.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: tclListObj.c,v 1.54 2008/10/05 22:12:20 kennykb Exp $
+ * RCS: @(#) $Id: tclListObj.c,v 1.55 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -38,7 +38,7 @@ static void UpdateStringOfList(Tcl_Obj *listPtr);
* storage to avoid an auxiliary stack.
*/
-Tcl_ObjType tclListType = {
+const Tcl_ObjType tclListType = {
"list", /* name */
FreeListInternalRep, /* freeIntRepProc */
DupListInternalRep, /* dupIntRepProc */
@@ -1326,7 +1326,7 @@ TclLsetFlat(
* WARNING: the macro TclGetIntForIndexM is not safe for
* post-increments, avoid '*indexArray++' here.
*/
-
+
if (TclGetIntForIndexM(interp, *indexArray, elemCount - 1, &index)
!= TCL_OK) {
/* ...the index we're trying to use isn't an index at all. */
@@ -1425,9 +1425,9 @@ TclLsetFlat(
}
if (result != TCL_OK) {
- /*
+ /*
* Error return; message is already in interp. Clean up
- * any excess memory.
+ * any excess memory.
*/
if (retValuePtr != listPtr) {
Tcl_DecrRefCount(retValuePtr);
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index c05913d..5ce7858 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.178 2008/09/28 22:17:39 dkf Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.179 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -143,7 +143,7 @@ typedef struct EnsembleConfig {
int numParameters; /* Cached number of parameters. This is either
* 0 (if the parameterList field is NULL) or
* the length of the list in the parameterList
- * field. */
+ * field. */
} EnsembleConfig;
#define ENS_DEAD 0x1 /* Flag value to say that the ensemble is dead
@@ -245,7 +245,7 @@ static Tcl_NRPostProc NsEval_Callback;
* the object.
*/
-static Tcl_ObjType nsNameType = {
+static const Tcl_ObjType nsNameType = {
"nsName", /* the type's name */
FreeNsNameInternalRep, /* freeIntRepProc */
DupNsNameInternalRep, /* dupIntRepProc */
@@ -260,7 +260,7 @@ static Tcl_ObjType nsNameType = {
* that implements it.
*/
-Tcl_ObjType tclEnsembleCmdType = {
+const Tcl_ObjType tclEnsembleCmdType = {
"ensembleCommand", /* the type's name */
FreeEnsembleCmdRep, /* freeIntRepProc */
DupEnsembleCmdRep, /* dupIntRepProc */
@@ -2739,7 +2739,7 @@ GetNamespaceFromObj(
if (objPtr->typePtr == &nsNameType) {
/*
- * Check that the ResolvedNsName is still valid; avoid letting the ref
+ * Check that the ResolvedNsName is still valid; avoid letting the ref
* cross interps.
*/
@@ -2819,7 +2819,7 @@ TclNRNamespaceObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- static const char *subCmds[] = {
+ static const char *const subCmds[] = {
"children", "code", "current", "delete", "ensemble",
"eval", "exists", "export", "forget", "import",
"inscope", "origin", "parent", "path", "qualifiers",
@@ -3347,11 +3347,11 @@ NamespaceEvalCmd(
invoker = NULL;
word = 0;
}
-
+
/*
* TIP #280: Make invoking context available to eval'd script.
*/
-
+
TclNRAddCallback(interp, NsEval_Callback, namespacePtr, "eval",
NULL, NULL);
return TclNREvalObjEx(interp, objPtr, 0, invoker, word);
@@ -3364,13 +3364,13 @@ NsEval_Callback(
int result)
{
Tcl_Namespace *namespacePtr = data[0];
-
+
if (result == TCL_ERROR) {
int length = strlen(namespacePtr->fullName);
int limit = 200;
int overflow = (length > limit);
char *cmd = data[1];
-
+
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (in namespace %s \"%.*s%s\" script line %d)",
cmd,
@@ -3384,7 +3384,7 @@ NsEval_Callback(
TclPopStackFrame(interp);
return result;
-}
+}
/*
*----------------------------------------------------------------------
@@ -4570,7 +4570,7 @@ NamespaceWhichCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- static const char *opts[] = {
+ static const char *const opts[] = {
"-command", "-variable", NULL
};
int lookupType = 0;
@@ -4805,25 +4805,25 @@ NamespaceEnsembleCmd(
{
Namespace *nsPtr;
Tcl_Command token;
- static const char *subcommands[] = {
+ static const char *const subcommands[] = {
"configure", "create", "exists", NULL
};
enum EnsSubcmds {
ENS_CONFIG, ENS_CREATE, ENS_EXISTS
};
- static const char *createOptions[] = {
- "-command", "-map", "-parameters", "-prefixes", "-subcommands",
+ static const char *const createOptions[] = {
+ "-command", "-map", "-parameters", "-prefixes", "-subcommands",
"-unknown", NULL
};
enum EnsCreateOpts {
CRT_CMD, CRT_MAP, CRT_PARAM, CRT_PREFIX, CRT_SUBCMDS, CRT_UNKNOWN
};
- static const char *configOptions[] = {
- "-map", "-namespace", "-parameters", "-prefixes", "-subcommands",
+ static const char *const configOptions[] = {
+ "-map", "-namespace", "-parameters", "-prefixes", "-subcommands",
"-unknown", NULL
};
enum EnsConfigOpts {
- CONF_MAP, CONF_NAMESPACE, CONF_PARAM, CONF_PREFIX, CONF_SUBCMDS,
+ CONF_MAP, CONF_NAMESPACE, CONF_PARAM, CONF_PREFIX, CONF_SUBCMDS,
CONF_UNKNOWN
};
int index;
@@ -5841,7 +5841,7 @@ Tcl_GetEnsembleSubcommandList(
* Results:
* Tcl result code (error if command token does not indicate an
* ensemble). The list of parameters is returned by updating the
- * variable pointed to by the last parameter (NULL if there are
+ * variable pointed to by the last parameter (NULL if there are
* no parameters).
*
* Side effects:
@@ -6244,14 +6244,14 @@ NsEnsembleImplementationCmdNR(
* names. */
int reparseCount = 0; /* Number of reparses. */
- /*
+ /*
* Must recheck objc, since numParameters might have changed. Cf. test
* namespace-53.9.
*/
-
+
restartEnsembleParse:
if (objc < 2 + ensemblePtr->numParameters) {
- /*
+ /*
* We don't have a subcommand argument. Make error message.
*/
@@ -6262,7 +6262,7 @@ NsEnsembleImplementationCmdNR(
Tcl_DStringInit(&buf);
if (ensemblePtr->parameterList == NULL) {
len = 0;
- } else if (TclListObjGetElements(NULL, ensemblePtr->parameterList,
+ } else if (TclListObjGetElements(NULL, ensemblePtr->parameterList,
&len, &elemPtrs) != TCL_OK) {
Tcl_Panic("List of ensemble parameters is not a list");
}
@@ -6335,7 +6335,7 @@ NsEnsembleImplementationCmdNR(
* Cache for later in the subcommand object.
*/
- MakeCachedEnsembleCommand(objv[1 + ensemblePtr->numParameters],
+ MakeCachedEnsembleCommand(objv[1 + ensemblePtr->numParameters],
ensemblePtr, fullName, prefixObj);
} else if (!(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX)) {
/*
@@ -6404,7 +6404,7 @@ NsEnsembleImplementationCmdNR(
* Cache for later in the subcommand object.
*/
- MakeCachedEnsembleCommand(objv[1 + ensemblePtr->numParameters],
+ MakeCachedEnsembleCommand(objv[1 + ensemblePtr->numParameters],
ensemblePtr, fullName, prefixObj);
}
@@ -6417,10 +6417,10 @@ NsEnsembleImplementationCmdNR(
* number of arguments to this ensemble command), populating it and then
* feeding it back through the main command-lookup engine. In theory, we
* could look up the command in the namespace ourselves, as we already
- * have the namespace in which it is guaranteed to exist,
- *
+ * have the namespace in which it is guaranteed to exist,
+ *
* ((Q: That's not true if the -map option is used, is it?))
- *
+ *
* but we don't do that (the cacheing of the command object used should
* help with that.)
*/
@@ -6457,10 +6457,10 @@ NsEnsembleImplementationCmdNR(
listRepPtr->elemCount = copyObjc;
copyObjv = &listRepPtr->elements;
memcpy(copyObjv, prefixObjv, sizeof(Tcl_Obj *) * prefixObjc);
- memcpy(copyObjv+prefixObjc, objv+1,
+ memcpy(copyObjv+prefixObjc, objv+1,
sizeof(Tcl_Obj *) * ensemblePtr->numParameters);
- memcpy(copyObjv+prefixObjc+ensemblePtr->numParameters,
- objv+ensemblePtr->numParameters+2,
+ memcpy(copyObjv+prefixObjc+ensemblePtr->numParameters,
+ objv+ensemblePtr->numParameters+2,
sizeof(Tcl_Obj *) * (objc-ensemblePtr->numParameters-2));
for (i=0; i < copyObjc; i++) {
@@ -6499,7 +6499,7 @@ NsEnsembleImplementationCmdNR(
/*
* Hand off to the target command.
*/
-
+
return Tcl_NREvalObj(interp, copyPtr, TCL_EVAL_INVOKE);
}
@@ -6544,7 +6544,7 @@ NsEnsembleImplementationCmdNR(
}
Tcl_AppendResult(interp, "unknown ",
(ensemblePtr->flags & TCL_ENSEMBLE_PREFIX ? "or ambiguous " : ""),
- "subcommand \"", TclGetString(objv[1+ensemblePtr->numParameters]),
+ "subcommand \"", TclGetString(objv[1+ensemblePtr->numParameters]),
"\": must be ", NULL);
if (ensemblePtr->subcommandTable.numEntries == 1) {
Tcl_AppendResult(interp, ensemblePtr->subcommandArrayPtr[0], NULL);
diff --git a/generic/tclObj.c b/generic/tclObj.c
index f445f08..a92ea7e 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.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: tclObj.c,v 1.142 2008/07/27 22:18:21 nijtmans Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.143 2008/10/15 06:17:03 nijtmans Exp $
*/
#include "tclInt.h"
@@ -206,28 +206,28 @@ static int SetCmdNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
* implementations.
*/
-static Tcl_ObjType oldBooleanType = {
+static const Tcl_ObjType oldBooleanType = {
"boolean", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
NULL, /* updateStringProc */
SetBooleanFromAny /* setFromAnyProc */
};
-Tcl_ObjType tclBooleanType = {
+const Tcl_ObjType tclBooleanType = {
"booleanString", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
NULL, /* updateStringProc */
SetBooleanFromAny /* setFromAnyProc */
};
-Tcl_ObjType tclDoubleType = {
+const Tcl_ObjType tclDoubleType = {
"double", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfDouble, /* updateStringProc */
SetDoubleFromAny /* setFromAnyProc */
};
-Tcl_ObjType tclIntType = {
+const Tcl_ObjType tclIntType = {
"int", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
@@ -235,7 +235,7 @@ Tcl_ObjType tclIntType = {
SetIntFromAny /* setFromAnyProc */
};
#ifndef NO_WIDE_TYPE
-Tcl_ObjType tclWideIntType = {
+const Tcl_ObjType tclWideIntType = {
"wideInt", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
@@ -243,7 +243,7 @@ Tcl_ObjType tclWideIntType = {
SetWideIntFromAny /* setFromAnyProc */
};
#endif
-Tcl_ObjType tclBignumType = {
+const Tcl_ObjType tclBignumType = {
"bignum", /* name */
FreeBignum, /* freeIntRepProc */
DupBignum, /* dupIntRepProc */
@@ -255,7 +255,7 @@ Tcl_ObjType tclBignumType = {
* The structure below defines the Tcl obj hash key type.
*/
-Tcl_HashKeyType tclObjHashKeyType = {
+const Tcl_HashKeyType tclObjHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
TclHashObjKey, /* hashKeyProc */
@@ -279,7 +279,7 @@ Tcl_HashKeyType tclObjHashKeyType = {
* own purposes.
*/
-static Tcl_ObjType tclCmdNameType = {
+static const Tcl_ObjType tclCmdNameType = {
"cmdName", /* name */
FreeCmdNameInternalRep, /* freeIntRepProc */
DupCmdNameInternalRep, /* dupIntRepProc */
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 423eb3b..a0a608b 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.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: tclProc.c,v 1.164 2008/10/14 22:37:53 nijtmans Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.165 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -63,7 +63,7 @@ static Tcl_NRPostProc Uplevel_Callback;
* The ProcBodyObjType type
*/
-Tcl_ObjType tclProcBodyType = {
+const Tcl_ObjType tclProcBodyType = {
"procbody", /* name for this type */
ProcBodyFree, /* FreeInternalRep function */
ProcBodyDup, /* DupInternalRep function */
@@ -2801,7 +2801,7 @@ Tcl_DisassembleObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- static const char *types[] = {
+ static const char *const types[] = {
"lambda", "method", "objmethod", "proc", "script", NULL
};
enum Types {
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index c82b474..4748e58 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.29 2008/10/04 18:06:48 dkf Exp $
+ * RCS: @(#) $Id: tclRegexp.c,v 1.30 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -102,7 +102,7 @@ static int SetRegexpFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
* compiled form of the regular expression.
*/
-Tcl_ObjType tclRegexpType = {
+const Tcl_ObjType tclRegexpType = {
"regexp", /* name */
FreeRegexpInternalRep, /* freeIntRepProc */
DupRegexpInternalRep, /* dupIntRepProc */
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 16a5bae..4a7d0f4 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.71 2008/04/07 15:23:10 rmax Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.72 2008/10/15 06:17:04 nijtmans Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -64,7 +64,7 @@ static void UpdateStringOfString(Tcl_Obj *objPtr);
* functions that can be invoked by generic object code.
*/
-Tcl_ObjType tclStringType = {
+const Tcl_ObjType tclStringType = {
"string", /* name */
FreeStringInternalRep, /* freeIntRepPro */
DupStringInternalRep, /* dupIntRepProc */
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 71978d7..27a9248 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUtil.c,v 1.105 2008/10/14 22:37:53 nijtmans Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.106 2008/10/15 06:17:04 nijtmans Exp $
*/
#include "tclInt.h"
@@ -80,7 +80,7 @@ static void UpdateStringOfEndOffset(Tcl_Obj* objPtr);
* integer, so no memory management is required for it.
*/
-Tcl_ObjType tclEndOffsetType = {
+const Tcl_ObjType tclEndOffsetType = {
"end-offset", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
diff --git a/generic/tclVar.c b/generic/tclVar.c
index a359711..a68c5d2 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -16,7 +16,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.169 2008/10/08 14:50:57 dgp Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.170 2008/10/15 06:17:03 nijtmans Exp $
*/
#include "tclInt.h"
@@ -30,7 +30,7 @@ static void FreeVarEntry(Tcl_HashEntry *hPtr);
static int CompareVarKeys(void *keyPtr, Tcl_HashEntry *hPtr);
static unsigned int HashVarKey(Tcl_HashTable *tablePtr, void *keyPtr);
-static Tcl_HashKeyType tclVarHashKeyType = {
+static const Tcl_HashKeyType tclVarHashKeyType = {
TCL_HASH_KEY_TYPE_VERSION, /* version */
0, /* flags */
HashVarKey, /* hashKeyProc */
@@ -201,7 +201,7 @@ static Tcl_SetFromAnyProc PanicOnSetVarName;
* Tcl_Obj), or NULL if it is a scalar variable
*/
-static Tcl_ObjType localVarNameType = {
+static const Tcl_ObjType localVarNameType = {
"localVarName",
FreeLocalVarName, DupLocalVarName, PanicOnUpdateVarName, PanicOnSetVarName
};
@@ -219,13 +219,13 @@ static Tcl_ObjType localVarNameType = {
static Tcl_FreeInternalRepProc FreeNsVarName;
static Tcl_DupInternalRepProc DupNsVarName;
-static Tcl_ObjType tclNsVarNameType = {
+static const Tcl_ObjType tclNsVarNameType = {
"namespaceVarName",
FreeNsVarName, DupNsVarName, PanicOnUpdateVarName, PanicOnSetVarName
};
#endif
-static Tcl_ObjType tclParsedVarNameType = {
+static const Tcl_ObjType tclParsedVarNameType = {
"parsedVarName",
FreeParsedVarName, DupParsedVarName, UpdateParsedVarName, PanicOnSetVarName
};
@@ -242,7 +242,7 @@ static Tcl_ObjType tclParsedVarNameType = {
* as this can be safely copied.
*/
-Tcl_ObjType tclArraySearchType = {
+const Tcl_ObjType tclArraySearchType = {
"array search",
NULL, NULL, NULL, SetArraySearchObj
};
@@ -2723,7 +2723,7 @@ Tcl_ArrayObjCmd(
ARRAY_NAMES, ARRAY_NEXTELEMENT, ARRAY_SET, ARRAY_SIZE,
ARRAY_STARTSEARCH, ARRAY_STATISTICS, ARRAY_UNSET
};
- static const char *arrayOptions[] = {
+ static const char *const arrayOptions[] = {
"anymore", "donesearch", "exists", "get", "names", "nextelement",
"set", "size", "startsearch", "statistics", "unset", NULL
};
@@ -3051,7 +3051,7 @@ Tcl_ArrayObjCmd(
char *name;
Tcl_Obj *namePtr, *resultPtr, *patternPtr;
int mode, matched = 0;
- static const char *options[] = {
+ static const char *const options[] = {
"-exact", "-glob", "-regexp", NULL
};
enum options { OPT_EXACT, OPT_GLOB, OPT_REGEXP };
@@ -4351,7 +4351,7 @@ TclDeleteNamespaceVars(
varPtr = VarHashFirstVar(tablePtr, &search)) {
Tcl_Obj *objPtr = Tcl_NewObj();
Tcl_IncrRefCount(objPtr);
-
+
VarHashRefCount(varPtr)++; /* Make sure we get to remove from
* hash. */
Tcl_GetVariableFullName(interp, (Tcl_Var) varPtr, objPtr);