Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
551efd8e1e | ||
|
|
60c1d787b1 | ||
|
|
b985fb8965 | ||
|
|
004d2e654f | ||
|
|
323f750af8 | ||
|
|
8733687efc | ||
|
|
d880550d56 | ||
|
|
c1e69b2d6b | ||
|
|
ecc60b1256 | ||
|
|
b7f335b27d | ||
|
|
50944b9abf | ||
|
|
4f7e149fb6 | ||
|
|
30816932df | ||
|
|
03b881a299 | ||
|
|
5452282a91 | ||
|
|
575f580d51 | ||
|
|
a071f9c13b | ||
|
|
edd3934b32 | ||
|
|
0070215933 | ||
|
|
bf2b5846b0 | ||
|
|
6b4a453621 | ||
|
|
24f3e6199d | ||
|
|
81da6c1a9a | ||
|
|
f4a4df7a48 | ||
|
|
c59dfa5e83 | ||
|
|
3f68e9f64f | ||
|
|
9df01df02c | ||
|
|
c2f255fe84 | ||
|
|
414a984d04 | ||
|
|
4314e8e438 | ||
|
|
96c8069270 |
@@ -4,6 +4,7 @@ on:
|
||||
branches:
|
||||
- "main"
|
||||
- "core-8-branch"
|
||||
- "core-8-6-branch"
|
||||
tags:
|
||||
- "core-**"
|
||||
permissions:
|
||||
|
||||
@@ -4,6 +4,7 @@ on:
|
||||
branches:
|
||||
- "main"
|
||||
- "core-8-branch"
|
||||
- "core-8-6-branch"
|
||||
tags:
|
||||
- "core-**"
|
||||
permissions:
|
||||
|
||||
@@ -4,6 +4,7 @@ on:
|
||||
branches:
|
||||
- "main"
|
||||
- "core-8-branch"
|
||||
- "core-8-6-branch"
|
||||
tags:
|
||||
- "core-**"
|
||||
permissions:
|
||||
|
||||
+2
-2
@@ -152,11 +152,11 @@ then calls \fBTcl_Eval\fR to execute that string as a Tcl command.
|
||||
It returns the result of the command and also modifies
|
||||
\fIinterp->result\fR in the same way as \fBTcl_Eval\fR.
|
||||
The last argument to \fBTcl_VarEval\fR must be NULL to indicate the end
|
||||
of arguments. \fBTcl_VarEval\fR is now deprecated.
|
||||
of arguments.
|
||||
.PP
|
||||
\fBTcl_VarEvalVA\fR is the same as \fBTcl_VarEval\fR except that
|
||||
instead of taking a variable number of arguments it takes an argument
|
||||
list. Like \fBTcl_VarEval\fR, \fBTcl_VarEvalVA\fR is deprecated.
|
||||
list. \fBTcl_VarEvalVA\fR is now deprecated.
|
||||
|
||||
.SH "FLAG BITS"
|
||||
.PP
|
||||
|
||||
@@ -203,6 +203,9 @@ matching rules of \fBstring match\fR) and their values if \fIpattern\fR is
|
||||
given.
|
||||
\fIArrayName\fR must be an array accessible to the caller of \fBparray\fR.
|
||||
It may be either local or global.
|
||||
.SS "WORD BOUNDARY HELPERS"
|
||||
.PP
|
||||
These procedures are mainly used internally by Tk.
|
||||
.TP
|
||||
\fBtcl_endOfWord \fIstr start\fR
|
||||
Returns the index of the first end-of-word location that occurs after
|
||||
|
||||
@@ -54,7 +54,6 @@ static const struct rerr {
|
||||
/*
|
||||
- regerror - the interface to error numbers
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
size_t /* Actual space needed (including NUL) */
|
||||
regerror(
|
||||
int code, /* Error code, or REG_ATOI or REG_ITOA */
|
||||
|
||||
+3
-3
@@ -131,7 +131,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
|
||||
#if !defined(TCL_NO_DEPRECATED)
|
||||
# define TCL_VARARGS(type, name) (type name, ...)
|
||||
# define TCL_VARARGS_DEF(type, name) (type name, ...)
|
||||
# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
|
||||
@@ -505,7 +505,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt;
|
||||
*/
|
||||
|
||||
typedef struct Tcl_Interp
|
||||
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
|
||||
#if !defined(TCL_NO_DEPRECATED)
|
||||
{
|
||||
/* TIP #330: Strongly discourage extensions from using the string
|
||||
* result. */
|
||||
@@ -1134,7 +1134,7 @@ typedef struct Tcl_DString {
|
||||
* give the flag)
|
||||
*/
|
||||
|
||||
#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
|
||||
#if !defined(TCL_NO_DEPRECATED)
|
||||
# define TCL_PARSE_PART1 0x400
|
||||
#endif /* !TCL_NO_DEPRECATED */
|
||||
|
||||
|
||||
+39
-51
@@ -5,9 +5,9 @@
|
||||
* commands into a sequence of instructions ("bytecodes").
|
||||
*
|
||||
* Copyright (c) 1997-1998 Sun Microsystems, Inc.
|
||||
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2001 Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2002 ActiveState Corporation.
|
||||
* Copyright (c) 2004-2013 by Donal K. Fellows.
|
||||
* Copyright (c) 2004-2013 Donal K. Fellows.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -21,28 +21,16 @@
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static ClientData DupDictUpdateInfo(ClientData clientData);
|
||||
static void FreeDictUpdateInfo(ClientData clientData);
|
||||
static void PrintDictUpdateInfo(ClientData clientData,
|
||||
Tcl_Obj *appendObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static void DisassembleDictUpdateInfo(ClientData clientData,
|
||||
Tcl_Obj *dictObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static ClientData DupForeachInfo(ClientData clientData);
|
||||
static void FreeForeachInfo(ClientData clientData);
|
||||
static void PrintForeachInfo(ClientData clientData,
|
||||
Tcl_Obj *appendObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static void DisassembleForeachInfo(ClientData clientData,
|
||||
Tcl_Obj *dictObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static void PrintNewForeachInfo(ClientData clientData,
|
||||
Tcl_Obj *appendObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static void DisassembleNewForeachInfo(ClientData clientData,
|
||||
Tcl_Obj *dictObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static AuxDataDupProc DupDictUpdateInfo;
|
||||
static AuxDataFreeProc FreeDictUpdateInfo;
|
||||
static AuxDataPrintProc PrintDictUpdateInfo;
|
||||
static AuxDataPrintProc DisassembleDictUpdateInfo;
|
||||
static AuxDataDupProc DupForeachInfo;
|
||||
static AuxDataFreeProc FreeForeachInfo;
|
||||
static AuxDataPrintProc PrintForeachInfo;
|
||||
static AuxDataPrintProc DisassembleForeachInfo;
|
||||
static AuxDataPrintProc PrintNewForeachInfo;
|
||||
static AuxDataPrintProc DisassembleNewForeachInfo;
|
||||
static int CompileEachloopCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, Command *cmdPtr,
|
||||
CompileEnv *envPtr, int collect);
|
||||
@@ -403,9 +391,9 @@ TclCompileArraySetCmd(
|
||||
keyVar = AnonymousLocal(envPtr);
|
||||
valVar = AnonymousLocal(envPtr);
|
||||
|
||||
infoPtr = ckalloc(TclOffset(ForeachInfo, varLists) + sizeof(ForeachVarList *));
|
||||
infoPtr = (ForeachInfo *)ckalloc(TclOffset(ForeachInfo, varLists) + sizeof(ForeachVarList *));
|
||||
infoPtr->numLists = 1;
|
||||
infoPtr->varLists[0] = ckalloc(TclOffset(ForeachVarList, varIndexes) + 2 * sizeof(int));
|
||||
infoPtr->varLists[0] = (ForeachVarList *)ckalloc(TclOffset(ForeachVarList, varIndexes) + 2 * sizeof(int));
|
||||
infoPtr->varLists[0]->numVars = 2;
|
||||
infoPtr->varLists[0]->varIndexes[0] = keyVar;
|
||||
infoPtr->varLists[0]->varIndexes[1] = valVar;
|
||||
@@ -1776,9 +1764,9 @@ TclCompileDictUpdateCmd(
|
||||
* that are to be used.
|
||||
*/
|
||||
|
||||
duiPtr = ckalloc(TclOffset(DictUpdateInfo, varIndices) + sizeof(int) * numVars);
|
||||
duiPtr = (DictUpdateInfo *)ckalloc(TclOffset(DictUpdateInfo, varIndices) + sizeof(int) * numVars);
|
||||
duiPtr->length = numVars;
|
||||
keyTokenPtrs = TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
|
||||
keyTokenPtrs = (Tcl_Token **)TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
|
||||
tokenPtr = TokenAfter(dictVarTokenPtr);
|
||||
|
||||
for (i=0 ; i<numVars ; i++) {
|
||||
@@ -2255,11 +2243,11 @@ DupDictUpdateInfo(
|
||||
ClientData clientData)
|
||||
{
|
||||
DictUpdateInfo *dui1Ptr, *dui2Ptr;
|
||||
unsigned len;
|
||||
size_t len;
|
||||
|
||||
dui1Ptr = clientData;
|
||||
dui1Ptr = (DictUpdateInfo *)clientData;
|
||||
len = TclOffset(DictUpdateInfo, varIndices) + sizeof(int) * dui1Ptr->length;
|
||||
dui2Ptr = ckalloc(len);
|
||||
dui2Ptr = (DictUpdateInfo *)ckalloc(len);
|
||||
memcpy(dui2Ptr, dui1Ptr, len);
|
||||
return dui2Ptr;
|
||||
}
|
||||
@@ -2278,7 +2266,7 @@ PrintDictUpdateInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
DictUpdateInfo *duiPtr = clientData;
|
||||
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
|
||||
int i;
|
||||
|
||||
for (i=0 ; i<duiPtr->length ; i++) {
|
||||
@@ -2296,7 +2284,7 @@ DisassembleDictUpdateInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
DictUpdateInfo *duiPtr = clientData;
|
||||
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
|
||||
int i;
|
||||
Tcl_Obj *variables;
|
||||
|
||||
@@ -2631,8 +2619,8 @@ TclCompileLmapCmd(
|
||||
Tcl_Interp *interp, /* Used for error reporting. */
|
||||
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
|
||||
* created by Tcl_ParseCommand. */
|
||||
Command *cmdPtr, /* Points to definition of command being
|
||||
* compiled. */
|
||||
Command *cmdPtr, /* Points to the definition of the command
|
||||
* being compiled. */
|
||||
CompileEnv *envPtr) /* Holds resulting instructions. */
|
||||
{
|
||||
return CompileEachloopCmd(interp, parsePtr, cmdPtr, envPtr,
|
||||
@@ -2694,7 +2682,7 @@ CompileEachloopCmd(
|
||||
}
|
||||
|
||||
/*
|
||||
* Bail out if the body requires substitutions in order to insure correct
|
||||
* Bail out if the body requires substitutions in order to ensure correct
|
||||
* behaviour. [Bug 219166]
|
||||
*/
|
||||
|
||||
@@ -2713,7 +2701,7 @@ CompileEachloopCmd(
|
||||
*/
|
||||
|
||||
numLists = (numWords - 2)/2;
|
||||
infoPtr = ckalloc(TclOffset(ForeachInfo, varLists)
|
||||
infoPtr = (ForeachInfo *)ckalloc(TclOffset(ForeachInfo, varLists)
|
||||
+ numLists * sizeof(ForeachVarList *));
|
||||
infoPtr->numLists = 0; /* Count this up as we go */
|
||||
|
||||
@@ -2747,7 +2735,7 @@ CompileEachloopCmd(
|
||||
goto done;
|
||||
}
|
||||
|
||||
varListPtr = ckalloc(TclOffset(ForeachVarList, varIndexes)
|
||||
varListPtr = (ForeachVarList *)ckalloc(TclOffset(ForeachVarList, varIndexes)
|
||||
+ numVars * sizeof(int));
|
||||
varListPtr->numVars = numVars;
|
||||
infoPtr->varLists[i/2] = varListPtr;
|
||||
@@ -2878,12 +2866,12 @@ DupForeachInfo(
|
||||
ClientData clientData) /* The foreach command's compilation auxiliary
|
||||
* data to duplicate. */
|
||||
{
|
||||
ForeachInfo *srcPtr = clientData;
|
||||
ForeachInfo *srcPtr = (ForeachInfo *)clientData;
|
||||
ForeachInfo *dupPtr;
|
||||
ForeachVarList *srcListPtr, *dupListPtr;
|
||||
int numVars, i, j, numLists = srcPtr->numLists;
|
||||
|
||||
dupPtr = ckalloc(TclOffset(ForeachInfo, varLists)
|
||||
dupPtr = (ForeachInfo *)ckalloc(TclOffset(ForeachInfo, varLists)
|
||||
+ numLists * sizeof(ForeachVarList *));
|
||||
dupPtr->numLists = numLists;
|
||||
dupPtr->firstValueTemp = srcPtr->firstValueTemp;
|
||||
@@ -2892,7 +2880,7 @@ DupForeachInfo(
|
||||
for (i = 0; i < numLists; i++) {
|
||||
srcListPtr = srcPtr->varLists[i];
|
||||
numVars = srcListPtr->numVars;
|
||||
dupListPtr = ckalloc(TclOffset(ForeachVarList, varIndexes)
|
||||
dupListPtr = (ForeachVarList *)ckalloc(TclOffset(ForeachVarList, varIndexes)
|
||||
+ numVars * sizeof(int));
|
||||
dupListPtr->numVars = numVars;
|
||||
for (j = 0; j < numVars; j++) {
|
||||
@@ -2927,7 +2915,7 @@ FreeForeachInfo(
|
||||
ClientData clientData) /* The foreach command's compilation auxiliary
|
||||
* data to free. */
|
||||
{
|
||||
ForeachInfo *infoPtr = clientData;
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *listPtr;
|
||||
int numLists = infoPtr->numLists;
|
||||
int i;
|
||||
@@ -2963,7 +2951,7 @@ PrintForeachInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
ForeachInfo *infoPtr = clientData;
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
int i, j;
|
||||
|
||||
@@ -3003,7 +2991,7 @@ PrintNewForeachInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
ForeachInfo *infoPtr = clientData;
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
int i, j;
|
||||
|
||||
@@ -3033,7 +3021,7 @@ DisassembleForeachInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
ForeachInfo *infoPtr = clientData;
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
int i, j;
|
||||
Tcl_Obj *objPtr, *innerPtr;
|
||||
@@ -3080,7 +3068,7 @@ DisassembleNewForeachInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
ForeachInfo *infoPtr = clientData;
|
||||
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
|
||||
ForeachVarList *varsPtr;
|
||||
int i, j;
|
||||
Tcl_Obj *objPtr, *innerPtr;
|
||||
@@ -3140,7 +3128,7 @@ TclCompileFormatCmd(
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
||||
Tcl_Obj **objv, *formatObj, *tmpObj;
|
||||
char *bytes, *start;
|
||||
const char *bytes, *start;
|
||||
int i, j, len;
|
||||
|
||||
/*
|
||||
@@ -3164,7 +3152,7 @@ TclCompileFormatCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
objv = ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
|
||||
objv = (Tcl_Obj **)ckalloc((parsePtr->numWords-2) * sizeof(Tcl_Obj *));
|
||||
for (i=0 ; i+2 < parsePtr->numWords ; i++) {
|
||||
tokenPtr = TokenAfter(tokenPtr);
|
||||
TclNewObj(objv[i]);
|
||||
@@ -3267,7 +3255,7 @@ TclCompileFormatCmd(
|
||||
if (*++bytes == '%') {
|
||||
Tcl_AppendToObj(tmpObj, "%", 1);
|
||||
} else {
|
||||
char *b = Tcl_GetStringFromObj(tmpObj, &len);
|
||||
const char *b = Tcl_GetStringFromObj(tmpObj, &len);
|
||||
|
||||
/*
|
||||
* If there is a non-empty literal from the format string,
|
||||
@@ -3458,7 +3446,7 @@ TclPushVarName(
|
||||
* assemble the corresponding token.
|
||||
*/
|
||||
|
||||
elemTokenPtr = TclStackAlloc(interp, sizeof(Tcl_Token));
|
||||
elemTokenPtr = (Tcl_Token *)TclStackAlloc(interp, sizeof(Tcl_Token));
|
||||
allocedTokens = 1;
|
||||
elemTokenPtr->type = TCL_TOKEN_TEXT;
|
||||
elemTokenPtr->start = elName;
|
||||
@@ -3512,7 +3500,7 @@ TclPushVarName(
|
||||
* token.
|
||||
*/
|
||||
|
||||
elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token));
|
||||
elemTokenPtr = (Tcl_Token *)TclStackAlloc(interp, n * sizeof(Tcl_Token));
|
||||
allocedTokens = 1;
|
||||
elemTokenPtr->type = TCL_TOKEN_TEXT;
|
||||
elemTokenPtr->start = elName;
|
||||
|
||||
+34
-27
@@ -6,9 +6,9 @@
|
||||
* of instructions ("bytecodes").
|
||||
*
|
||||
* Copyright (c) 1997-1998 Sun Microsystems, Inc.
|
||||
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2001 Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2002 ActiveState Corporation.
|
||||
* Copyright (c) 2004-2013 by Donal K. Fellows.
|
||||
* Copyright (c) 2004-2013 Donal K. Fellows.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -27,7 +27,6 @@ static void CompileReturnInternal(CompileEnv *envPtr,
|
||||
Tcl_Obj *returnOpts);
|
||||
static int IndexTailVarIfKnown(Tcl_Interp *interp,
|
||||
Tcl_Token *varTokenPtr, CompileEnv *envPtr);
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -128,9 +127,12 @@ TclCompileGlobalCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/* TODO: Consider what value can pass through the
|
||||
* IndexTailVarIfKnown() screen. Full CompileWord()
|
||||
* likely does not apply here. Push known value instead. */
|
||||
/*
|
||||
* TODO: Consider what value can pass through the
|
||||
* IndexTailVarIfKnown() screen. Full CompileWord() likely does not
|
||||
* apply here. Push known value instead.
|
||||
*/
|
||||
|
||||
CompileWord(envPtr, varTokenPtr, interp, i);
|
||||
TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr);
|
||||
}
|
||||
@@ -181,7 +183,8 @@ TclCompileIfCmd(
|
||||
* determined. */
|
||||
Tcl_Token *tokenPtr, *testTokenPtr;
|
||||
int jumpIndex = 0; /* Avoid compiler warning. */
|
||||
int jumpFalseDist, numWords, wordIdx, numBytes, j, code;
|
||||
int numBytes, j;
|
||||
int jumpFalseDist, numWords, wordIdx, code;
|
||||
const char *word;
|
||||
int realCond = 1; /* Set to 0 for static conditions:
|
||||
* "if 0 {..}" */
|
||||
@@ -271,7 +274,7 @@ TclCompileIfCmd(
|
||||
jumpIndex = jumpFalseFixupArray.next;
|
||||
jumpFalseFixupArray.next++;
|
||||
TclEmitForwardJump(envPtr, TCL_FALSE_JUMP,
|
||||
jumpFalseFixupArray.fixup+jumpIndex);
|
||||
jumpFalseFixupArray.fixup + jumpIndex);
|
||||
}
|
||||
code = TCL_OK;
|
||||
}
|
||||
@@ -318,7 +321,7 @@ TclCompileIfCmd(
|
||||
}
|
||||
jumpEndFixupArray.next++;
|
||||
TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP,
|
||||
jumpEndFixupArray.fixup+jumpIndex);
|
||||
jumpEndFixupArray.fixup + jumpIndex);
|
||||
|
||||
/*
|
||||
* Fix the target of the jumpFalse after the test. Generate a 4
|
||||
@@ -330,7 +333,7 @@ TclCompileIfCmd(
|
||||
|
||||
TclAdjustStackDepth(-1, envPtr);
|
||||
if (TclFixupForwardJumpToHere(envPtr,
|
||||
jumpFalseFixupArray.fixup+jumpIndex, 120)) {
|
||||
jumpFalseFixupArray.fixup + jumpIndex, 120)) {
|
||||
/*
|
||||
* Adjust the code offset for the proceeding jump to the end
|
||||
* of the "if" command.
|
||||
@@ -588,7 +591,7 @@ TclCompileInfoCommandsCmd(
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *tokenPtr;
|
||||
Tcl_Obj *objPtr;
|
||||
char *bytes;
|
||||
const char *bytes;
|
||||
|
||||
/*
|
||||
* We require one compile-time known argument for the case we can compile.
|
||||
@@ -921,7 +924,7 @@ TclCompileLappendCmd(
|
||||
CompileWord(envPtr, valueTokenPtr, interp, i);
|
||||
valueTokenPtr = TokenAfter(valueTokenPtr);
|
||||
}
|
||||
TclEmitInstInt4( INST_LIST, numWords-2, envPtr);
|
||||
TclEmitInstInt4( INST_LIST, numWords - 2, envPtr);
|
||||
if (isScalar) {
|
||||
if (localIndex < 0) {
|
||||
TclEmitOpcode( INST_LAPPEND_LIST_STK, envPtr);
|
||||
@@ -998,7 +1001,7 @@ TclCompileLassignCmd(
|
||||
*/
|
||||
|
||||
PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex,
|
||||
&isScalar, idx+2);
|
||||
&isScalar, idx + 2);
|
||||
|
||||
/*
|
||||
* Emit instructions to get the idx'th item out of the list value on
|
||||
@@ -2080,7 +2083,8 @@ TclCompileRegexpCmd(
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
|
||||
* parse of the RE or string. */
|
||||
int i, len, nocase, exact, sawLast, simple;
|
||||
int len;
|
||||
int i, nocase, exact, sawLast, simple;
|
||||
const char *str;
|
||||
|
||||
/*
|
||||
@@ -2184,7 +2188,7 @@ TclCompileRegexpCmd(
|
||||
}
|
||||
|
||||
if (!simple) {
|
||||
CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-2);
|
||||
CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords - 2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2192,7 +2196,7 @@ TclCompileRegexpCmd(
|
||||
*/
|
||||
|
||||
varTokenPtr = TokenAfter(varTokenPtr);
|
||||
CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-1);
|
||||
CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords - 1);
|
||||
|
||||
if (simple) {
|
||||
if (exact && !nocase) {
|
||||
@@ -2267,7 +2271,8 @@ TclCompileRegsubCmd(
|
||||
Tcl_Obj *patternObj = NULL, *replacementObj = NULL;
|
||||
Tcl_DString pattern;
|
||||
const char *bytes;
|
||||
int len, exact, quantified, result = TCL_ERROR;
|
||||
int exact, quantified, result = TCL_ERROR;
|
||||
int len;
|
||||
|
||||
if (parsePtr->numWords < 5 || parsePtr->numWords > 6) {
|
||||
return TCL_ERROR;
|
||||
@@ -2376,7 +2381,7 @@ TclCompileRegsubCmd(
|
||||
PushLiteral(envPtr, bytes, len);
|
||||
bytes = Tcl_GetStringFromObj(replacementObj, &len);
|
||||
PushLiteral(envPtr, bytes, len);
|
||||
CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords-2);
|
||||
CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords - 2);
|
||||
TclEmitOpcode( INST_STR_MAP, envPtr);
|
||||
|
||||
done:
|
||||
@@ -2422,7 +2427,8 @@ TclCompileReturnCmd(
|
||||
* General syntax: [return ?-option value ...? ?result?]
|
||||
* An even number of words means an explicit result argument is present.
|
||||
*/
|
||||
int level, code, objc, size, status = TCL_OK;
|
||||
int level, code, objc, status = TCL_OK;
|
||||
int size;
|
||||
int numWords = parsePtr->numWords;
|
||||
int explicitResult = (0 == (numWords % 2));
|
||||
int numOptionWords = numWords - 1 - explicitResult;
|
||||
@@ -2454,7 +2460,7 @@ TclCompileReturnCmd(
|
||||
* Allocate some working space.
|
||||
*/
|
||||
|
||||
objv = TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *));
|
||||
objv = (Tcl_Obj **)TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *));
|
||||
|
||||
/*
|
||||
* Scan through the return options. If any are unknown at compile time,
|
||||
@@ -2505,7 +2511,7 @@ TclCompileReturnCmd(
|
||||
*/
|
||||
|
||||
if (explicitResult) {
|
||||
CompileWord(envPtr, wordTokenPtr, interp, numWords-1);
|
||||
CompileWord(envPtr, wordTokenPtr, interp, numWords - 1);
|
||||
} else {
|
||||
/*
|
||||
* No explict result argument, so default result is empty string.
|
||||
@@ -2583,7 +2589,7 @@ TclCompileReturnCmd(
|
||||
*/
|
||||
|
||||
if (explicitResult) {
|
||||
CompileWord(envPtr, wordTokenPtr, interp, numWords-1);
|
||||
CompileWord(envPtr, wordTokenPtr, interp, numWords - 1);
|
||||
} else {
|
||||
PushStringLiteral(envPtr, "");
|
||||
}
|
||||
@@ -2814,12 +2820,12 @@ TclCompileVariableCmd(
|
||||
CompileWord(envPtr, varTokenPtr, interp, i);
|
||||
TclEmitInstInt4( INST_VARIABLE, localIndex, envPtr);
|
||||
|
||||
if (i+1 < numWords) {
|
||||
if (i + 1 < numWords) {
|
||||
/*
|
||||
* A value has been given: set the variable, pop the value
|
||||
*/
|
||||
|
||||
CompileWord(envPtr, valueTokenPtr, interp, i+1);
|
||||
CompileWord(envPtr, valueTokenPtr, interp, i + 1);
|
||||
Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr);
|
||||
TclEmitOpcode( INST_POP, envPtr);
|
||||
}
|
||||
@@ -2860,7 +2866,8 @@ IndexTailVarIfKnown(
|
||||
{
|
||||
Tcl_Obj *tailPtr;
|
||||
const char *tailName, *p;
|
||||
int len, n = varTokenPtr->numComponents;
|
||||
int n = varTokenPtr->numComponents;
|
||||
int len;
|
||||
Tcl_Token *lastTokenPtr;
|
||||
int full, localIndex;
|
||||
|
||||
@@ -2895,7 +2902,7 @@ IndexTailVarIfKnown(
|
||||
tailName = TclGetStringFromObj(tailPtr, &len);
|
||||
|
||||
if (len) {
|
||||
if (*(tailName+len-1) == ')') {
|
||||
if (*(tailName + len - 1) == ')') {
|
||||
/*
|
||||
* Possible array: bail out
|
||||
*/
|
||||
@@ -2909,7 +2916,7 @@ IndexTailVarIfKnown(
|
||||
*/
|
||||
|
||||
for (p = tailName + len -1; p > tailName; p--) {
|
||||
if ((*p == ':') && (*(p-1) == ':')) {
|
||||
if ((*p == ':') && (*(p - 1) == ':')) {
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
|
||||
+52
-59
@@ -7,9 +7,9 @@
|
||||
* Also includes the operator command compilers.
|
||||
*
|
||||
* Copyright (c) 1997-1998 Sun Microsystems, Inc.
|
||||
* Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2001 Kevin B. Kenny. All rights reserved.
|
||||
* Copyright (c) 2002 ActiveState Corporation.
|
||||
* Copyright (c) 2004-2010 by Donal K. Fellows.
|
||||
* Copyright (c) 2004-2010 Donal K. Fellows.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution of
|
||||
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
@@ -23,14 +23,10 @@
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static ClientData DupJumptableInfo(ClientData clientData);
|
||||
static void FreeJumptableInfo(ClientData clientData);
|
||||
static void PrintJumptableInfo(ClientData clientData,
|
||||
Tcl_Obj *appendObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static void DisassembleJumptableInfo(ClientData clientData,
|
||||
Tcl_Obj *dictObj, ByteCode *codePtr,
|
||||
unsigned int pcOffset);
|
||||
static AuxDataDupProc DupJumptableInfo;
|
||||
static AuxDataFreeProc FreeJumptableInfo;
|
||||
static AuxDataPrintProc PrintJumptableInfo;
|
||||
static AuxDataPrintProc DisassembleJumptableInfo;
|
||||
static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp,
|
||||
Tcl_Parse *parsePtr, const char *identity,
|
||||
int instruction, CompileEnv *envPtr);
|
||||
@@ -45,13 +41,12 @@ static int CompileUnaryOpCmd(Tcl_Interp *interp,
|
||||
CompileEnv *envPtr);
|
||||
static void IssueSwitchChainedTests(Tcl_Interp *interp,
|
||||
CompileEnv *envPtr, int mode, int noCase,
|
||||
int valueIndex, int numWords,
|
||||
Tcl_Token **bodyToken, int *bodyLines,
|
||||
int **bodyNext);
|
||||
int numWords, Tcl_Token **bodyToken,
|
||||
int *bodyLines, int **bodyNext);
|
||||
static void IssueSwitchJumpTable(Tcl_Interp *interp,
|
||||
CompileEnv *envPtr, int valueIndex,
|
||||
int numWords, Tcl_Token **bodyToken,
|
||||
int *bodyLines, int **bodyContLines);
|
||||
CompileEnv *envPtr, int numWords,
|
||||
Tcl_Token **bodyToken, int *bodyLines,
|
||||
int **bodyContLines);
|
||||
static int IssueTryClausesInstructions(Tcl_Interp *interp,
|
||||
CompileEnv *envPtr, Tcl_Token *bodyToken,
|
||||
int numHandlers, int *matchCodes,
|
||||
@@ -467,7 +462,7 @@ TclCompileStringIsCmd(
|
||||
"true", "upper", "wideinteger", "wordchar",
|
||||
"xdigit", NULL
|
||||
};
|
||||
enum isClasses {
|
||||
enum isClassesEnum {
|
||||
STR_IS_ALNUM, STR_IS_ALPHA, STR_IS_ASCII, STR_IS_CONTROL,
|
||||
STR_IS_BOOL, STR_IS_DIGIT, STR_IS_DOUBLE, STR_IS_ENTIER,
|
||||
STR_IS_FALSE, STR_IS_GRAPH, STR_IS_INT, STR_IS_LIST,
|
||||
@@ -531,7 +526,7 @@ TclCompileStringIsCmd(
|
||||
|
||||
CompileWord(envPtr, tokenPtr, interp, parsePtr->numWords-1);
|
||||
|
||||
switch ((enum isClasses) t) {
|
||||
switch ((enum isClassesEnum) t) {
|
||||
case STR_IS_ALNUM:
|
||||
strClassType = STR_CLASS_ALNUM;
|
||||
goto compileStrClass;
|
||||
@@ -692,14 +687,14 @@ TclCompileStringIsCmd(
|
||||
}
|
||||
|
||||
switch (t) {
|
||||
case STR_IS_INT:
|
||||
PUSH( "1");
|
||||
OP( EQ);
|
||||
break;
|
||||
case STR_IS_WIDE:
|
||||
PUSH( "2");
|
||||
OP( LE);
|
||||
break;
|
||||
case STR_IS_INT:
|
||||
PUSH( "1");
|
||||
OP( EQ);
|
||||
break;
|
||||
case STR_IS_ENTIER:
|
||||
PUSH( "3");
|
||||
OP( LE);
|
||||
@@ -860,7 +855,7 @@ TclCompileStringMapCmd(
|
||||
DefineLineInformation; /* TIP #280 */
|
||||
Tcl_Token *mapTokenPtr, *stringTokenPtr;
|
||||
Tcl_Obj *mapObj, **objv;
|
||||
char *bytes;
|
||||
const char *bytes;
|
||||
int len;
|
||||
|
||||
/*
|
||||
@@ -1354,7 +1349,7 @@ static int
|
||||
UniCharIsHexDigit(
|
||||
int character)
|
||||
{
|
||||
return (character >= 0) && (character < 0x80) && isxdigit(character);
|
||||
return (character >= 0) && (character < 0x80) && isxdigit(UCHAR(character));
|
||||
}
|
||||
|
||||
StringClassDesc const tclStringClassTable[] = {
|
||||
@@ -1415,7 +1410,7 @@ TclCompileSubstCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
objv = TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *));
|
||||
objv = (Tcl_Obj **)TclStackAlloc(interp, /*numArgs*/ numOpts * sizeof(Tcl_Obj *));
|
||||
|
||||
for (objc = 0; objc < /*numArgs*/ numOpts; objc++) {
|
||||
TclNewObj(objv[objc]);
|
||||
@@ -1908,10 +1903,10 @@ TclCompileSwitchCmd(
|
||||
if (maxLen < 2) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
bodyTokenArray = ckalloc(sizeof(Tcl_Token) * maxLen);
|
||||
bodyToken = ckalloc(sizeof(Tcl_Token *) * maxLen);
|
||||
bodyLines = ckalloc(sizeof(int) * maxLen);
|
||||
bodyContLines = ckalloc(sizeof(int*) * maxLen);
|
||||
bodyTokenArray = (Tcl_Token *)ckalloc(sizeof(Tcl_Token) * maxLen);
|
||||
bodyToken = (Tcl_Token **)ckalloc(sizeof(Tcl_Token *) * maxLen);
|
||||
bodyLines = (int *)ckalloc(sizeof(int) * maxLen);
|
||||
bodyContLines = (int **)ckalloc(sizeof(int*) * maxLen);
|
||||
|
||||
bline = mapPtr->loc[eclIndex].line[valueIndex+1];
|
||||
numWords = 0;
|
||||
@@ -1970,9 +1965,9 @@ TclCompileSwitchCmd(
|
||||
* Multi-word definition of patterns & actions.
|
||||
*/
|
||||
|
||||
bodyToken = ckalloc(sizeof(Tcl_Token *) * numWords);
|
||||
bodyLines = ckalloc(sizeof(int) * numWords);
|
||||
bodyContLines = ckalloc(sizeof(int*) * numWords);
|
||||
bodyToken = (Tcl_Token **)ckalloc(sizeof(Tcl_Token *) * numWords);
|
||||
bodyLines = (int *)ckalloc(sizeof(int) * numWords);
|
||||
bodyContLines = (int **)ckalloc(sizeof(int*) * numWords);
|
||||
bodyTokenArray = NULL;
|
||||
for (i=0 ; i<numWords ; i++) {
|
||||
/*
|
||||
@@ -2018,10 +2013,10 @@ TclCompileSwitchCmd(
|
||||
CompileWord(envPtr, valueTokenPtr, interp, valueIndex);
|
||||
|
||||
if (mode == Switch_Exact) {
|
||||
IssueSwitchJumpTable(interp, envPtr, valueIndex, numWords, bodyToken,
|
||||
IssueSwitchJumpTable(interp, envPtr, numWords, bodyToken,
|
||||
bodyLines, bodyContLines);
|
||||
} else {
|
||||
IssueSwitchChainedTests(interp, envPtr, mode, noCase, valueIndex,
|
||||
IssueSwitchChainedTests(interp, envPtr, mode, noCase,
|
||||
numWords, bodyToken, bodyLines, bodyContLines);
|
||||
}
|
||||
result = TCL_OK;
|
||||
@@ -2062,7 +2057,6 @@ IssueSwitchChainedTests(
|
||||
CompileEnv *envPtr, /* Holds resulting instructions. */
|
||||
int mode, /* Exact, Glob or Regexp */
|
||||
int noCase, /* Case-insensitivity flag. */
|
||||
int valueIndex, /* The value to match against. */
|
||||
int numBodyTokens, /* Number of tokens describing things the
|
||||
* switch can match against and bodies to
|
||||
* execute when the match succeeds. */
|
||||
@@ -2092,8 +2086,8 @@ IssueSwitchChainedTests(
|
||||
|
||||
contFixIndex = -1;
|
||||
contFixCount = 0;
|
||||
fixupArray = TclStackAlloc(interp, sizeof(JumpFixup) * numBodyTokens);
|
||||
fixupTargetArray = TclStackAlloc(interp, sizeof(int) * numBodyTokens);
|
||||
fixupArray = (JumpFixup *)TclStackAlloc(interp, sizeof(JumpFixup) * numBodyTokens);
|
||||
fixupTargetArray = (unsigned int *)TclStackAlloc(interp, sizeof(int) * numBodyTokens);
|
||||
memset(fixupTargetArray, 0, numBodyTokens * sizeof(int));
|
||||
fixupCount = 0;
|
||||
foundDefault = 0;
|
||||
@@ -2311,7 +2305,6 @@ static void
|
||||
IssueSwitchJumpTable(
|
||||
Tcl_Interp *interp, /* Context for compiling script bodies. */
|
||||
CompileEnv *envPtr, /* Holds resulting instructions. */
|
||||
int valueIndex, /* The value to match against. */
|
||||
int numBodyTokens, /* Number of tokens describing things the
|
||||
* switch can match against and bodies to
|
||||
* execute when the match succeeds. */
|
||||
@@ -2336,10 +2329,10 @@ IssueSwitchJumpTable(
|
||||
* Start by allocating the jump table itself, plus some workspace.
|
||||
*/
|
||||
|
||||
jtPtr = ckalloc(sizeof(JumptableInfo));
|
||||
jtPtr = (JumptableInfo *)ckalloc(sizeof(JumptableInfo));
|
||||
Tcl_InitHashTable(&jtPtr->hashTable, TCL_STRING_KEYS);
|
||||
infoIndex = TclCreateAuxData(jtPtr, &tclJumptableInfoType, envPtr);
|
||||
finalFixups = TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2));
|
||||
finalFixups = (int *)TclStackAlloc(interp, sizeof(int) * (numBodyTokens/2));
|
||||
foundDefault = 0;
|
||||
mustGenerate = 1;
|
||||
|
||||
@@ -2507,8 +2500,8 @@ static ClientData
|
||||
DupJumptableInfo(
|
||||
ClientData clientData)
|
||||
{
|
||||
JumptableInfo *jtPtr = clientData;
|
||||
JumptableInfo *newJtPtr = ckalloc(sizeof(JumptableInfo));
|
||||
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
|
||||
JumptableInfo *newJtPtr = (JumptableInfo *)ckalloc(sizeof(JumptableInfo));
|
||||
Tcl_HashEntry *hPtr, *newHPtr;
|
||||
Tcl_HashSearch search;
|
||||
int isNew;
|
||||
@@ -2527,7 +2520,7 @@ static void
|
||||
FreeJumptableInfo(
|
||||
ClientData clientData)
|
||||
{
|
||||
JumptableInfo *jtPtr = clientData;
|
||||
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
|
||||
|
||||
Tcl_DeleteHashTable(&jtPtr->hashTable);
|
||||
ckfree(jtPtr);
|
||||
@@ -2540,7 +2533,7 @@ PrintJumptableInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
JumptableInfo *jtPtr = clientData;
|
||||
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
|
||||
Tcl_HashEntry *hPtr;
|
||||
Tcl_HashSearch search;
|
||||
const char *keyPtr;
|
||||
@@ -2548,7 +2541,7 @@ PrintJumptableInfo(
|
||||
|
||||
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
|
||||
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
|
||||
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
|
||||
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
|
||||
offset = PTR2INT(Tcl_GetHashValue(hPtr));
|
||||
|
||||
if (i++) {
|
||||
@@ -2569,7 +2562,7 @@ DisassembleJumptableInfo(
|
||||
ByteCode *codePtr,
|
||||
unsigned int pcOffset)
|
||||
{
|
||||
JumptableInfo *jtPtr = clientData;
|
||||
JumptableInfo *jtPtr = (JumptableInfo *)clientData;
|
||||
Tcl_Obj *mapping;
|
||||
Tcl_HashEntry *hPtr;
|
||||
Tcl_HashSearch search;
|
||||
@@ -2579,7 +2572,7 @@ DisassembleJumptableInfo(
|
||||
TclNewObj(mapping);
|
||||
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
|
||||
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
|
||||
keyPtr = Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
|
||||
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
|
||||
offset = PTR2INT(Tcl_GetHashValue(hPtr));
|
||||
Tcl_DictObjPut(NULL, mapping, Tcl_NewStringObj(keyPtr, -1),
|
||||
Tcl_NewIntObj(offset));
|
||||
@@ -2798,12 +2791,12 @@ TclCompileTryCmd(
|
||||
numHandlers = numWords >> 2;
|
||||
numWords -= numHandlers * 4;
|
||||
if (numHandlers > 0) {
|
||||
handlerTokens = TclStackAlloc(interp, sizeof(Tcl_Token*)*numHandlers);
|
||||
matchClauses = TclStackAlloc(interp, sizeof(Tcl_Obj *) * numHandlers);
|
||||
handlerTokens = (Tcl_Token**)TclStackAlloc(interp, sizeof(Tcl_Token*)*numHandlers);
|
||||
matchClauses = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * numHandlers);
|
||||
memset(matchClauses, 0, sizeof(Tcl_Obj *) * numHandlers);
|
||||
matchCodes = TclStackAlloc(interp, sizeof(int) * numHandlers);
|
||||
resultVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers);
|
||||
optionVarIndices = TclStackAlloc(interp, sizeof(int) * numHandlers);
|
||||
matchCodes = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers);
|
||||
resultVarIndices = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers);
|
||||
optionVarIndices = (int *)TclStackAlloc(interp, sizeof(int) * numHandlers);
|
||||
|
||||
for (i=0 ; i<numHandlers ; i++) {
|
||||
Tcl_Obj *tmpObj, **objv;
|
||||
@@ -3067,9 +3060,9 @@ IssueTryClausesInstructions(
|
||||
* Slight overallocation, but reduces size of this function.
|
||||
*/
|
||||
|
||||
addrsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
forwardsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
noError = TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
addrsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
forwardsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
noError = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
|
||||
for (i=0 ; i<numHandlers ; i++) {
|
||||
noError[i] = -1;
|
||||
@@ -3096,7 +3089,7 @@ IssueTryClausesInstructions(
|
||||
OP( STR_EQ);
|
||||
JUMP4( JUMP_FALSE, notECJumpSource);
|
||||
} else {
|
||||
notECJumpSource = -1; /* LINT */
|
||||
notECJumpSource = -1;
|
||||
}
|
||||
OP( POP);
|
||||
|
||||
@@ -3278,8 +3271,8 @@ IssueTryClausesFinallyInstructions(
|
||||
* Slight overallocation, but reduces size of this function.
|
||||
*/
|
||||
|
||||
addrsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
forwardsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
addrsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
forwardsToFix = (int *)TclStackAlloc(interp, sizeof(int)*numHandlers);
|
||||
|
||||
for (i=0 ; i<numHandlers ; i++) {
|
||||
int noTrapError, trapError;
|
||||
@@ -3307,7 +3300,7 @@ IssueTryClausesFinallyInstructions(
|
||||
OP( STR_EQ);
|
||||
JUMP4( JUMP_FALSE, notECJumpSource);
|
||||
} else {
|
||||
notECJumpSource = -1; /* LINT */
|
||||
notECJumpSource = -1;
|
||||
}
|
||||
OP( POP);
|
||||
|
||||
|
||||
+8
-8
@@ -4080,10 +4080,10 @@ extern const TclStubs *tclStubsPtr;
|
||||
# undef Tcl_UtfNcmp
|
||||
# undef Tcl_UtfNcasecmp
|
||||
# undef Tcl_UniCharNcasecmp
|
||||
# define Tcl_DbNewLongObj ((Tcl_Obj*(*)(long,const char*,int))Tcl_DbNewWideIntObj)
|
||||
# define Tcl_GetLongFromObj ((int(*)(Tcl_Interp*,Tcl_Obj*,long*))Tcl_GetWideIntFromObj)
|
||||
# define Tcl_NewLongObj ((Tcl_Obj*(*)(long))Tcl_NewWideIntObj)
|
||||
# define Tcl_SetLongObj ((void(*)(Tcl_Obj*,long))Tcl_SetWideIntObj)
|
||||
# define Tcl_DbNewLongObj ((Tcl_Obj*(*)(long,const char*,int))(void *)Tcl_DbNewWideIntObj)
|
||||
# define Tcl_GetLongFromObj ((int(*)(Tcl_Interp*,Tcl_Obj*,long*))(void *)Tcl_GetWideIntFromObj)
|
||||
# define Tcl_NewLongObj ((Tcl_Obj*(*)(long))(void *)Tcl_NewWideIntObj)
|
||||
# define Tcl_SetLongObj ((void(*)(Tcl_Obj*,long))(void *)Tcl_SetWideIntObj)
|
||||
# define Tcl_ExprLong TclExprLong
|
||||
static inline int TclExprLong(Tcl_Interp *interp, const char *string, long *ptr){
|
||||
int intValue;
|
||||
@@ -4099,13 +4099,13 @@ extern const TclStubs *tclStubsPtr;
|
||||
return result;
|
||||
}
|
||||
# define Tcl_UniCharNcmp(ucs,uct,n) \
|
||||
((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcmp)(ucs,uct,(unsigned int)(n))
|
||||
((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))(void *)tclStubsPtr->tcl_UniCharNcmp)(ucs,uct,(unsigned int)(n))
|
||||
# define Tcl_UtfNcmp(s1,s2,n) \
|
||||
((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(n))
|
||||
((int(*)(const char*,const char*,unsigned int))(void *)tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(n))
|
||||
# define Tcl_UtfNcasecmp(s1,s2,n) \
|
||||
((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(n))
|
||||
((int(*)(const char*,const char*,unsigned int))(void *)tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(n))
|
||||
# define Tcl_UniCharNcasecmp(ucs,uct,n) \
|
||||
((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n))
|
||||
((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))(void *)tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
+27
-18
@@ -537,8 +537,8 @@ TclInitEncodingSubsystem(void)
|
||||
unsigned size;
|
||||
unsigned short i;
|
||||
union {
|
||||
char c;
|
||||
short s;
|
||||
char c;
|
||||
short s;
|
||||
} isLe;
|
||||
|
||||
if (encodingsInitialized) {
|
||||
@@ -1233,9 +1233,9 @@ Tcl_ExternalToUtf(
|
||||
}
|
||||
|
||||
if (!noTerminate) {
|
||||
if (dstLen < 1) {
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
}
|
||||
if (dstLen < 1) {
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
}
|
||||
/*
|
||||
* If there are any null characters in the middle of the buffer,
|
||||
* they will converted to the UTF-8 null character (\xC080). To get
|
||||
@@ -1245,9 +1245,9 @@ Tcl_ExternalToUtf(
|
||||
|
||||
dstLen--;
|
||||
} else {
|
||||
if (dstLen < 0) {
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
}
|
||||
if (dstLen < 0) {
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
}
|
||||
}
|
||||
do {
|
||||
Tcl_EncodingState savedState = *statePtr;
|
||||
@@ -1423,7 +1423,7 @@ Tcl_UtfToExternal(
|
||||
}
|
||||
|
||||
if (dstLen < encodingPtr->nullSize) {
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
return TCL_CONVERT_NOSPACE;
|
||||
}
|
||||
dstLen -= encodingPtr->nullSize;
|
||||
result = encodingPtr->fromUtfProc(encodingPtr->clientData, src, srcLen,
|
||||
@@ -2731,17 +2731,26 @@ TableToUtfProc(
|
||||
}
|
||||
byte = *((unsigned char *) src);
|
||||
if (prefixBytes[byte]) {
|
||||
src++;
|
||||
if (src >= srcEnd) {
|
||||
src--;
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
break;
|
||||
if (src >= srcEnd-1) {
|
||||
/* Prefix byte but nothing after it */
|
||||
if (!(flags & TCL_ENCODING_END)) {
|
||||
/* More data to come */
|
||||
result = TCL_CONVERT_MULTIBYTE;
|
||||
break;
|
||||
} else if (flags & TCL_ENCODING_STOPONERROR) {
|
||||
result = TCL_CONVERT_SYNTAX;
|
||||
break;
|
||||
} else {
|
||||
ch = (Tcl_UniChar)byte;
|
||||
}
|
||||
} else {
|
||||
ch = toUnicode[byte][*((unsigned char *)++src)];
|
||||
}
|
||||
ch = toUnicode[byte][*((unsigned char *) src)];
|
||||
} else {
|
||||
ch = pageZero[byte];
|
||||
}
|
||||
if ((ch == 0) && (byte != 0)) {
|
||||
/* Prefix+suffix pair is invalid */
|
||||
if (flags & TCL_ENCODING_STOPONERROR) {
|
||||
result = TCL_CONVERT_SYNTAX;
|
||||
break;
|
||||
@@ -2749,14 +2758,14 @@ TableToUtfProc(
|
||||
if (prefixBytes[byte]) {
|
||||
src--;
|
||||
}
|
||||
ch = (Tcl_UniChar) byte;
|
||||
ch = (Tcl_UniChar)byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* Special case for 1-byte Utf chars for speed.
|
||||
*/
|
||||
|
||||
if (ch && ch < 0x80) {
|
||||
if ((unsigned)ch - 1 < 0x7F) {
|
||||
*dst++ = (char) ch;
|
||||
} else {
|
||||
dst += Tcl_UniCharToUtf(ch, dst);
|
||||
@@ -2963,7 +2972,7 @@ Iso88591ToUtfProc(
|
||||
* Special case for 1-byte utf chars for speed.
|
||||
*/
|
||||
|
||||
if (ch && ch < 0x80) {
|
||||
if ((unsigned)ch - 1 < 0x7F) {
|
||||
*dst++ = (char) ch;
|
||||
} else {
|
||||
dst += Tcl_UniCharToUtf(ch, dst);
|
||||
|
||||
+14
-16
@@ -19,20 +19,20 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define tenviron _wenviron
|
||||
# define tenviron2utfdstr(tenvstr, len, dstr) \
|
||||
Tcl_WinTCharToUtf((TCHAR *)tenvstr, len, dstr)
|
||||
# define utf2tenvirondstr(str, len, dstr) \
|
||||
(const WCHAR *)Tcl_WinUtfToTChar(str, len, dstr)
|
||||
# define tenviron2utfdstr(str, dsPtr) \
|
||||
Tcl_WinTCharToUtf((TCHAR *)str, -1, dsPtr)
|
||||
# define utf2tenvirondstr(str, dsPtr) \
|
||||
(const WCHAR *)Tcl_WinUtfToTChar(str, -1, dsPtr)
|
||||
# define techar WCHAR
|
||||
# ifdef USE_PUTENV
|
||||
# define putenv(env) _wputenv((const wchar_t *)env)
|
||||
# endif
|
||||
#else
|
||||
# define tenviron environ
|
||||
# define tenviron2utfdstr(tenvstr, len, dstr) \
|
||||
Tcl_ExternalToUtfDString(NULL, tenvstr, len, dstr)
|
||||
# define utf2tenvirondstr(str, len, dstr) \
|
||||
Tcl_UtfToExternalDString(NULL, str, len, dstr)
|
||||
# define tenviron2utfdstr(str, dsPtr) \
|
||||
Tcl_ExternalToUtfDString(NULL, str, -1, dsPtr)
|
||||
# define utf2tenvirondstr(str, dsPtr) \
|
||||
Tcl_UtfToExternalDString(NULL, str, -1, dsPtr)
|
||||
# define techar char
|
||||
#endif
|
||||
|
||||
@@ -159,7 +159,7 @@ TclSetupEnv(
|
||||
const char *p1;
|
||||
char *p2;
|
||||
|
||||
p1 = tenviron2utfdstr(tenviron[i], -1, &envString);
|
||||
p1 = tenviron2utfdstr(tenviron[i], &envString);
|
||||
p2 = (char *)strchr(p1, '=');
|
||||
if (p2 == NULL) {
|
||||
/*
|
||||
@@ -301,7 +301,7 @@ TclSetEnv(
|
||||
* interpreters.
|
||||
*/
|
||||
|
||||
oldEnv = tenviron2utfdstr(tenviron[index], -1, &envString);
|
||||
oldEnv = tenviron2utfdstr(tenviron[index], &envString);
|
||||
if (strcmp(value, oldEnv + (length + 1)) == 0) {
|
||||
Tcl_DStringFree(&envString);
|
||||
Tcl_MutexUnlock(&envMutex);
|
||||
@@ -324,7 +324,7 @@ TclSetEnv(
|
||||
memcpy(p, name, nameLength);
|
||||
p[nameLength] = '=';
|
||||
memcpy(p+nameLength+1, value, valueLength+1);
|
||||
p2 = utf2tenvirondstr(p, -1, &envString);
|
||||
p2 = utf2tenvirondstr(p, &envString);
|
||||
|
||||
/*
|
||||
* Copy the native string to heap memory.
|
||||
@@ -462,8 +462,7 @@ TclUnsetEnv(
|
||||
const char *name) /* Name of variable to remove (UTF-8). */
|
||||
{
|
||||
char *oldValue;
|
||||
int length;
|
||||
int index;
|
||||
int length, index;
|
||||
#ifdef USE_PUTENV_FOR_UNSET
|
||||
Tcl_DString envString;
|
||||
char *string;
|
||||
@@ -512,7 +511,7 @@ TclUnsetEnv(
|
||||
string[length] = '\0';
|
||||
#endif /* _WIN32 */
|
||||
|
||||
utf2tenvirondstr(string, -1, &envString);
|
||||
utf2tenvirondstr(string, &envString);
|
||||
string = (char *)ckrealloc(string, Tcl_DStringLength(&envString) + tNTL);
|
||||
memcpy(string, Tcl_DStringValue(&envString),
|
||||
Tcl_DStringLength(&envString) + tNTL);
|
||||
@@ -587,7 +586,7 @@ TclGetEnv(
|
||||
if (index != -1) {
|
||||
Tcl_DString envStr;
|
||||
|
||||
result = tenviron2utfdstr(tenviron[index], -1, &envStr);
|
||||
result = tenviron2utfdstr(tenviron[index], &envStr);
|
||||
result += length;
|
||||
if (*result == '=') {
|
||||
result++;
|
||||
@@ -624,7 +623,6 @@ TclGetEnv(
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static char *
|
||||
EnvTraceProc(
|
||||
ClientData clientData, /* Not used. */
|
||||
|
||||
+10
-16
@@ -139,7 +139,6 @@ Tcl_PutsObjCmd(
|
||||
chanObjPtr = objv[2];
|
||||
string = objv[3];
|
||||
break;
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
} else if (strcmp(TclGetString(objv[3]), "nonewline") == 0) {
|
||||
/*
|
||||
* The code below provides backwards compatibility with an old
|
||||
@@ -151,7 +150,6 @@ Tcl_PutsObjCmd(
|
||||
chanObjPtr = objv[1];
|
||||
string = objv[2];
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
/* Fall through */
|
||||
default: /* [puts] or
|
||||
@@ -441,7 +439,6 @@ Tcl_ReadObjCmd(
|
||||
if (i < objc) {
|
||||
if ((TclGetIntFromObj(interp, objv[i], &toRead) != TCL_OK)
|
||||
|| (toRead < 0)) {
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
/*
|
||||
* The code below provides backwards compatibility with an old
|
||||
* form of the command that is no longer recommended or
|
||||
@@ -450,16 +447,13 @@ Tcl_ReadObjCmd(
|
||||
*/
|
||||
|
||||
if (strcmp(TclGetString(objv[i]), "nonewline") != 0) {
|
||||
#endif
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"expected non-negative integer but got \"%s\"",
|
||||
TclGetString(objv[i])));
|
||||
Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
|
||||
return TCL_ERROR;
|
||||
#if TCL_MAJOR_VERSION < 9
|
||||
}
|
||||
newline = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -954,7 +948,7 @@ Tcl_ExecObjCmd(
|
||||
*/
|
||||
|
||||
argc = objc - skip;
|
||||
argv = TclStackAlloc(interp, (unsigned)(argc + 1) * sizeof(char *));
|
||||
argv = (const char **)TclStackAlloc(interp, (unsigned)(argc + 1) * sizeof(char *));
|
||||
|
||||
/*
|
||||
* Copy the string conversions of each (post option) object into the
|
||||
@@ -1232,13 +1226,13 @@ TcpAcceptCallbacksDeleteProc(
|
||||
* was registered. */
|
||||
Tcl_Interp *interp) /* Interpreter being deleted - not used. */
|
||||
{
|
||||
Tcl_HashTable *hTblPtr = clientData;
|
||||
Tcl_HashTable *hTblPtr = (Tcl_HashTable *)clientData;
|
||||
Tcl_HashEntry *hPtr;
|
||||
Tcl_HashSearch hSearch;
|
||||
|
||||
for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch);
|
||||
hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) {
|
||||
AcceptCallback *acceptCallbackPtr = Tcl_GetHashValue(hPtr);
|
||||
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)Tcl_GetHashValue(hPtr);
|
||||
|
||||
acceptCallbackPtr->interp = NULL;
|
||||
}
|
||||
@@ -1280,10 +1274,10 @@ RegisterTcpServerInterpCleanup(
|
||||
Tcl_HashEntry *hPtr; /* Entry for this record. */
|
||||
int isNew; /* Is the entry new? */
|
||||
|
||||
hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
|
||||
|
||||
if (hTblPtr == NULL) {
|
||||
hTblPtr = ckalloc(sizeof(Tcl_HashTable));
|
||||
hTblPtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
|
||||
Tcl_InitHashTable(hTblPtr, TCL_ONE_WORD_KEYS);
|
||||
Tcl_SetAssocData(interp, "tclTCPAcceptCallbacks",
|
||||
TcpAcceptCallbacksDeleteProc, hTblPtr);
|
||||
@@ -1326,7 +1320,7 @@ UnregisterTcpServerInterpCleanupProc(
|
||||
Tcl_HashTable *hTblPtr;
|
||||
Tcl_HashEntry *hPtr;
|
||||
|
||||
hTblPtr = Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
|
||||
hTblPtr = (Tcl_HashTable *)Tcl_GetAssocData(interp, "tclTCPAcceptCallbacks", NULL);
|
||||
if (hTblPtr == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -1364,7 +1358,7 @@ AcceptCallbackProc(
|
||||
char *address, /* Address of client that was accepted. */
|
||||
int port) /* Port of client that was accepted. */
|
||||
{
|
||||
AcceptCallback *acceptCallbackPtr = callbackData;
|
||||
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
|
||||
|
||||
/*
|
||||
* Check if the callback is still valid; the interpreter may have gone
|
||||
@@ -1443,7 +1437,7 @@ TcpServerCloseProc(
|
||||
ClientData callbackData) /* The data passed in the call to
|
||||
* Tcl_CreateCloseHandler. */
|
||||
{
|
||||
AcceptCallback *acceptCallbackPtr = callbackData;
|
||||
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)callbackData;
|
||||
/* The actual data. */
|
||||
|
||||
if (acceptCallbackPtr->interp != NULL) {
|
||||
@@ -1587,10 +1581,10 @@ Tcl_SocketObjCmd(
|
||||
}
|
||||
|
||||
if (server) {
|
||||
AcceptCallback *acceptCallbackPtr =
|
||||
AcceptCallback *acceptCallbackPtr = (AcceptCallback *)
|
||||
ckalloc(sizeof(AcceptCallback));
|
||||
unsigned len = strlen(script) + 1;
|
||||
char *copyScript = ckalloc(len);
|
||||
char *copyScript = (char *)ckalloc(len);
|
||||
|
||||
memcpy(copyScript, script, len);
|
||||
acceptCallbackPtr->script = copyScript;
|
||||
|
||||
+10
-14
@@ -594,18 +594,18 @@ Tcl_ListObjAppendElement(
|
||||
|
||||
attempt = 2 * numRequired;
|
||||
if (attempt <= LIST_MAX) {
|
||||
newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
}
|
||||
if (newPtr == NULL) {
|
||||
attempt = numRequired + 1 + TCL_MIN_ELEMENT_GROWTH;
|
||||
if (attempt > LIST_MAX) {
|
||||
attempt = LIST_MAX;
|
||||
}
|
||||
newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
}
|
||||
if (newPtr == NULL) {
|
||||
attempt = numRequired;
|
||||
newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
}
|
||||
if (newPtr) {
|
||||
listRepPtr = newPtr;
|
||||
@@ -916,18 +916,18 @@ Tcl_ListObjReplace(
|
||||
List *newPtr = NULL;
|
||||
int attempt = 2 * numRequired;
|
||||
if (attempt <= LIST_MAX) {
|
||||
newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
}
|
||||
if (newPtr == NULL) {
|
||||
attempt = numRequired + 1 + TCL_MIN_ELEMENT_GROWTH;
|
||||
if (attempt > LIST_MAX) {
|
||||
attempt = LIST_MAX;
|
||||
}
|
||||
newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
}
|
||||
if (newPtr == NULL) {
|
||||
attempt = numRequired;
|
||||
newPtr = attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
newPtr = (List *)attemptckrealloc(listRepPtr, LIST_SIZE(attempt));
|
||||
}
|
||||
if (newPtr) {
|
||||
listRepPtr = newPtr;
|
||||
@@ -993,11 +993,7 @@ Tcl_ListObjReplace(
|
||||
if (listRepPtr == NULL) {
|
||||
for (i = 0; i < objc; i++) {
|
||||
/* See bug 3598580 */
|
||||
#if TCL_MAJOR_VERSION > 8
|
||||
Tcl_DecrRefCount(objv[i]);
|
||||
#else
|
||||
objv[i]->refCount--;
|
||||
#endif
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
||||
@@ -1536,7 +1532,7 @@ TclLsetFlat(
|
||||
* Clear away our internalrep surgery mess.
|
||||
*/
|
||||
|
||||
chainPtr = objPtr->internalRep.twoPtrValue.ptr2;
|
||||
chainPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2;
|
||||
objPtr->internalRep.twoPtrValue.ptr2 = NULL;
|
||||
}
|
||||
|
||||
@@ -1896,7 +1892,7 @@ SetListFromAny(
|
||||
TclNewStringObj(*elemPtrs, elemStart, elemSize);
|
||||
} else {
|
||||
TclNewObj(*elemPtrs);
|
||||
(*elemPtrs)->bytes = ckalloc((unsigned) elemSize + 1);
|
||||
(*elemPtrs)->bytes = (char *)ckalloc((unsigned) elemSize + 1);
|
||||
(*elemPtrs)->length = TclCopyAndCollapse(elemSize, elemStart,
|
||||
(*elemPtrs)->bytes);
|
||||
}
|
||||
@@ -1980,7 +1976,7 @@ UpdateStringOfList(
|
||||
* We know numElems <= LIST_MAX, so this is safe.
|
||||
*/
|
||||
|
||||
flagPtr = ckalloc(numElems);
|
||||
flagPtr = (char *)ckalloc(numElems);
|
||||
}
|
||||
elemPtrs = &listRepPtr->elements;
|
||||
for (i = 0; i < numElems; i++) {
|
||||
@@ -2015,7 +2011,7 @@ UpdateStringOfList(
|
||||
*
|
||||
*/
|
||||
|
||||
listPtr->bytes = ckalloc(bytesNeeded);
|
||||
listPtr->bytes = (char *)ckalloc(bytesNeeded);
|
||||
dst = listPtr->bytes;
|
||||
for (i = 0; i < numElems; i++) {
|
||||
flagPtr[i] |= (i ? TCL_DONT_QUOTE_HASH : 0);
|
||||
|
||||
+7
-6
@@ -1098,7 +1098,7 @@ test chan-io-7.3 {FilterInputBytes: split up character at EOF} -setup {
|
||||
lappend x [chan gets $f line] $line
|
||||
} -cleanup {
|
||||
chan close $f
|
||||
} -result [list 15 "1234567890123\uFF10\uFF11" 18 0 1 -1 ""]
|
||||
} -result [list 16 "1234567890123\uFF10\uFF11\x82" 18 0 1 -1 ""]
|
||||
test chan-io-7.4 {FilterInputBytes: recover from split up character} -setup {
|
||||
variable x ""
|
||||
} -constraints {stdio fileevent} -body {
|
||||
@@ -7219,22 +7219,23 @@ test chan-io-53.10 {Bug 1350564, multi-directional fcopy} -setup {
|
||||
}
|
||||
chan puts stderr SRV
|
||||
set l {}
|
||||
set srv [socket -server new 9999]
|
||||
set srv [socket -server new -myaddr 127.0.0.1 0]
|
||||
set port [lindex [chan configure $srv -sockname] 2]
|
||||
chan puts stderr WAITING
|
||||
chan event stdin readable bye
|
||||
chan puts OK
|
||||
puts "OK $port"
|
||||
vwait forever
|
||||
}
|
||||
# wait for OK from server.
|
||||
chan gets $pipe
|
||||
lassign [chan gets $pipe] ok port
|
||||
# Now the two clients.
|
||||
proc done {sock} {
|
||||
if {[chan eof $sock]} { chan close $sock ; return }
|
||||
lappend ::forever [chan gets $sock]
|
||||
return
|
||||
}
|
||||
set a [socket 127.0.0.1 9999]
|
||||
set b [socket 127.0.0.1 9999]
|
||||
set a [socket 127.0.0.1 $port]
|
||||
set b [socket 127.0.0.1 $port]
|
||||
chan configure $a -translation binary -buffering none
|
||||
chan configure $b -translation binary -buffering none
|
||||
chan event $a readable [namespace code "done $a"]
|
||||
|
||||
+3
-6
@@ -425,13 +425,10 @@ test dstring-4.3 {truncation} -constraints testdstring -setup {
|
||||
# Pass a negative length to Tcl_DStringSetLength();
|
||||
# if not caught, causing '\0' to be written out-of-bounds,
|
||||
# try corrupting dsPtr->length which begins
|
||||
# 2*sizeof(Tcl_Size) bytes before dsPtr->staticSpace[],
|
||||
# 2*sizeof(int) bytes before dsPtr->staticSpace[],
|
||||
# so that the result is -256 (on little endian systems)
|
||||
# rather than e.g. -8 or -16.
|
||||
# (sizeof(Tcl_Size) does not seem to be available via Tcl,
|
||||
# so assume sizeof(Tcl_Size) == sizeof(void*) for Tcl 9.)
|
||||
testdstring trunc [expr {-2*([package vsatisfies $tcl_version 9.0-]
|
||||
? $tcl_platform(pointerSize) : 4)}]
|
||||
# rather than e.g. -8.
|
||||
testdstring trunc -8
|
||||
list [testdstring get] [testdstring length]
|
||||
} -cleanup {
|
||||
testdstring free
|
||||
|
||||
+11
-8
@@ -48,6 +48,8 @@ testConstraint testservicemode [llength [info commands testservicemode]]
|
||||
testConstraint notWinCI [expr {
|
||||
$::tcl_platform(platform) ne "windows" || ![info exists ::env(CI)]}]
|
||||
testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}]
|
||||
# File permissions broken on wsl without some "exotic" wsl configuration
|
||||
testConstraint notWsl [expr {[llength [array names ::env *WSL*]] == 0}]
|
||||
|
||||
# You need a *very* special environment to do some tests. In
|
||||
# particular, many file systems do not support large-files...
|
||||
@@ -1134,7 +1136,7 @@ test io-7.3 {FilterInputBytes: split up character at EOF} {testchannel} {
|
||||
lappend x [gets $f line] $line
|
||||
close $f
|
||||
set x
|
||||
} [list 15 "1234567890123\uFF10\uFF11" 18 0 1 -1 ""]
|
||||
} [list 16 "1234567890123\uFF10\uFF11\x82" 18 0 1 -1 ""]
|
||||
test io-7.4 {FilterInputBytes: recover from split up character} {stdio fileevent} {
|
||||
set f [open "|[list [interpreter] $path(cat)]" w+]
|
||||
fconfigure $f -encoding binary -buffering none
|
||||
@@ -5752,7 +5754,7 @@ test io-40.1 {POSIX open access modes: RDWR} {
|
||||
close $f
|
||||
set x
|
||||
} {zzy abzzy}
|
||||
test io-40.2 {POSIX open access modes: CREAT} {unix} {
|
||||
test io-40.2 {POSIX open access modes: CREAT} {unix notWsl} {
|
||||
file delete $path(test3)
|
||||
set f [open $path(test3) {WRONLY CREAT} 0o600]
|
||||
file stat $path(test3) stats
|
||||
@@ -5764,7 +5766,7 @@ test io-40.2 {POSIX open access modes: CREAT} {unix} {
|
||||
close $f
|
||||
set x
|
||||
} {0o600 {line 1}}
|
||||
test io-40.3 {POSIX open access modes: CREAT} {unix umask} {
|
||||
test io-40.3 {POSIX open access modes: CREAT} {unix umask notWsl} {
|
||||
# This test only works if your umask is 2, like ouster's.
|
||||
file delete $path(test3)
|
||||
set f [open $path(test3) {WRONLY CREAT}]
|
||||
@@ -7912,22 +7914,23 @@ test io-53.10 {Bug 1350564, multi-directional fcopy} -setup {
|
||||
}
|
||||
puts stderr SRV
|
||||
set l {}
|
||||
set srv [socket -server new 9999]
|
||||
set srv [socket -server new -myaddr 127.0.0.1 0]
|
||||
set port [lindex [fconfigure $srv -sockname] 2]
|
||||
puts stderr WAITING
|
||||
fileevent stdin readable bye
|
||||
puts OK
|
||||
puts "OK $port"
|
||||
vwait forever
|
||||
}
|
||||
# wait for OK from server.
|
||||
gets $pipe
|
||||
lassign [gets $pipe] ok port
|
||||
# Now the two clients.
|
||||
proc ::done {sock} {
|
||||
if {[eof $sock]} { close $sock ; return }
|
||||
lappend ::forever [gets $sock]
|
||||
return
|
||||
}
|
||||
set a [socket 127.0.0.1 9999]
|
||||
set b [socket 127.0.0.1 9999]
|
||||
set a [socket 127.0.0.1 $port]
|
||||
set b [socket 127.0.0.1 $port]
|
||||
fconfigure $a -translation binary -buffering none
|
||||
fconfigure $b -translation binary -buffering none
|
||||
fileevent $a readable [list ::done $a]
|
||||
|
||||
Vendored
+107
-5
@@ -8978,6 +8978,113 @@ echo "${ECHO_T}$ac_cv_nolto" >&6
|
||||
CFLAGS_NOLTO=""
|
||||
fi
|
||||
|
||||
# Check for vfork, posix_spawnp() and friends unconditionally
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in vfork posix_spawnp posix_spawn_file_actions_adddup2 posix_spawnattr_setflags
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_var+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $ac_func innocuous_$ac_func
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $ac_func
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char $ac_func ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
|
||||
choke me
|
||||
#else
|
||||
char (*f) () = $ac_func;
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return f != $ac_func;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
eval "$as_ac_var=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_var=no"
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
|
||||
if test `eval echo '${'$as_ac_var'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# FIXME: This subst was left in only because the TCL_DL_LIBS
|
||||
# entry in tclConfig.sh uses it. It is not clear why someone
|
||||
# would use TCL_DL_LIBS instead of TCL_LIBS.
|
||||
@@ -17841,11 +17948,6 @@ done
|
||||
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define USE_VFORK 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define TCL_DEFAULT_ENCODING "utf-8"
|
||||
_ACEOF
|
||||
|
||||
@@ -563,7 +563,6 @@ if test "`uname -s`" = "Darwin" ; then
|
||||
AC_CHECK_HEADERS(libkern/OSAtomic.h)
|
||||
AC_CHECK_FUNCS(OSSpinLockLock)
|
||||
fi
|
||||
AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?])
|
||||
AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8",
|
||||
[Are we to override what our default encoding is?])
|
||||
AC_DEFINE(TCL_LOAD_FROM_MEMORY, 1,
|
||||
|
||||
+23
-19
@@ -17,19 +17,23 @@ TCL_VERSION= @TCL_VERSION@
|
||||
|
||||
CFLAGS_DEBUG = @CFLAGS_DEBUG@
|
||||
CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@
|
||||
CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@
|
||||
CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ -DTCL_NO_DEPRECATED=1 -Wall -Wextra -Wc++-compat -Wconversion -Werror
|
||||
LDFLAGS_DEBUG = @LDFLAGS_DEBUG@
|
||||
LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
|
||||
LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@
|
||||
|
||||
CC_SWITCHES = $(CFLAGS) -I${SRC_DIR}/../../generic -DTCL_MEM_DEBUG \
|
||||
CC_SWITCHES = $(CFLAGS) -I${SRC_DIR}/../../generic \
|
||||
${SHLIB_CFLAGS} -DUSE_TCL_STUBS ${AC_FLAGS}
|
||||
|
||||
all: pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} pkgd${SHLIB_SUFFIX} pkge${SHLIB_SUFFIX} pkgua${SHLIB_SUFFIX} pkgooa${SHLIB_SUFFIX}
|
||||
all: pkga${SHLIB_SUFFIX} pkgb${SHLIB_SUFFIX} pkgc${SHLIB_SUFFIX} \
|
||||
pkgd${SHLIB_SUFFIX} pkge${SHLIB_SUFFIX} pkgua${SHLIB_SUFFIX} \
|
||||
pkgooa${SHLIB_SUFFIX}
|
||||
@if test -n "$(DLTEST_SUFFIX)"; then $(MAKE) dltest_suffix; fi
|
||||
@touch ../dltest.marker
|
||||
|
||||
dltest_suffix: pkga${DLTEST_SUFFIX} pkgb${DLTEST_SUFFIX} pkgc${DLTEST_SUFFIX} pkgd${DLTEST_SUFFIX} pkge${DLTEST_SUFFIX} pkgua${DLTEST_SUFFIX} pkgooa${DLTEST_SUFFIX}
|
||||
dltest_suffix: pkga${DLTEST_SUFFIX} pkgb${DLTEST_SUFFIX} pkgc${DLTEST_SUFFIX} \
|
||||
pkgd${DLTEST_SUFFIX} pkge${DLTEST_SUFFIX} pkgua${DLTEST_SUFFIX} \
|
||||
pkgooa${DLTEST_SUFFIX}
|
||||
@touch ../dltest.marker
|
||||
|
||||
pkga.o: $(SRC_DIR)/pkga.c
|
||||
@@ -54,49 +58,49 @@ pkgooa.o: $(SRC_DIR)/pkgooa.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/pkgooa.c
|
||||
|
||||
pkga${SHLIB_SUFFIX}: pkga.o
|
||||
${SHLIB_LD} -o pkga${SHLIB_SUFFIX} pkga.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkga.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgb${SHLIB_SUFFIX}: pkgb.o
|
||||
${SHLIB_LD} -o pkgb${SHLIB_SUFFIX} pkgb.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkgb.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgc${SHLIB_SUFFIX}: pkgc.o
|
||||
${SHLIB_LD} -o pkgc${SHLIB_SUFFIX} pkgc.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkgc.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgd${SHLIB_SUFFIX}: pkgd.o
|
||||
${SHLIB_LD} -o pkgd${SHLIB_SUFFIX} pkgd.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkgd.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkge${SHLIB_SUFFIX}: pkge.o
|
||||
${SHLIB_LD} -o pkge${SHLIB_SUFFIX} pkge.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkge.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgua${SHLIB_SUFFIX}: pkgua.o
|
||||
${SHLIB_LD} -o pkgua${SHLIB_SUFFIX} pkgua.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkgua.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgooa${SHLIB_SUFFIX}: pkgooa.o
|
||||
${SHLIB_LD} -o pkgooa${SHLIB_SUFFIX} pkgooa.o ${SHLIB_LD_LIBS}
|
||||
${SHLIB_LD} -o $@ pkgooa.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkga${DLTEST_SUFFIX}: pkga.o
|
||||
${DLTEST_LD} -o pkga${DLTEST_SUFFIX} pkga.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkga.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgb${DLTEST_SUFFIX}: pkgb.o
|
||||
${DLTEST_LD} -o pkgb${DLTEST_SUFFIX} pkgb.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkgb.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgc${DLTEST_SUFFIX}: pkgc.o
|
||||
${DLTEST_LD} -o pkgc${DLTEST_SUFFIX} pkgc.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkgc.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgd${DLTEST_SUFFIX}: pkgd.o
|
||||
${DLTEST_LD} -o pkgd${DLTEST_SUFFIX} pkgd.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkgd.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkge${DLTEST_SUFFIX}: pkge.o
|
||||
${DLTEST_LD} -o pkge${DLTEST_SUFFIX} pkge.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkge.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgua${DLTEST_SUFFIX}: pkgua.o
|
||||
${DLTEST_LD} -o pkgua${DLTEST_SUFFIX} pkgua.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkgua.o ${SHLIB_LD_LIBS}
|
||||
|
||||
pkgooa${DLTEST_SUFFIX}: pkgooa.o
|
||||
${DLTEST_LD} -o pkgooa${DLTEST_SUFFIX} pkgooa.o ${SHLIB_LD_LIBS}
|
||||
${DLTEST_LD} -o $@ pkgooa.o ${SHLIB_LD_LIBS}
|
||||
|
||||
clean:
|
||||
rm -f *.o lib.exp ../dltest.marker
|
||||
rm -f embtest *.o lib.exp ../dltest.marker
|
||||
@if test "$(SHLIB_SUFFIX)" != ""; then \
|
||||
echo "rm -f *${SHLIB_SUFFIX}" ; \
|
||||
rm -f *${SHLIB_SUFFIX} ; \
|
||||
|
||||
+1
-10
@@ -13,15 +13,6 @@
|
||||
#undef STATIC_BUILD
|
||||
#include "tcl.h"
|
||||
|
||||
/*
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static int Pkga_EqObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int Pkga_QuoteObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -60,7 +51,7 @@ Pkga_EqObjCmd(
|
||||
str1 = Tcl_GetStringFromObj(objv[1], &len1);
|
||||
str2 = Tcl_GetStringFromObj(objv[2], &len2);
|
||||
if (len1 == len2) {
|
||||
result = (Tcl_UtfNcmp(str1, str2, len1) == 0);
|
||||
result = (Tcl_UtfNcmp(str1, str2, (size_t)len1) == 0);
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
+2
-13
@@ -17,17 +17,6 @@
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static int Pkgb_SubObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int Pkgb_UnsafeObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int Pkgb_DemoObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -112,11 +101,11 @@ Pkgb_DemoObjCmd(
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
#if (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 4)
|
||||
Tcl_Obj *first;
|
||||
(void)dummy;
|
||||
(void)objc;
|
||||
(void)objv;
|
||||
#if (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 4)
|
||||
Tcl_Obj *first;
|
||||
|
||||
if (Tcl_ListObjIndex(NULL, Tcl_GetEncodingSearchPath(), 0, &first)
|
||||
== TCL_OK) {
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
#undef STATIC_BUILD
|
||||
#include "tcl.h"
|
||||
|
||||
/*
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static int Pkgc_SubObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int Pkgc_UnsafeObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
#undef STATIC_BUILD
|
||||
#include "tcl.h"
|
||||
|
||||
/*
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static int Pkgd_SubObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int Pkgd_UnsafeObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
|
||||
@@ -84,10 +84,8 @@ static TclOOStubs stubsCopy = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
#ifdef Tcl_MethodIsPrivate
|
||||
,NULL
|
||||
#endif
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
DLLEXPORT int
|
||||
|
||||
+1
-11
@@ -14,16 +14,6 @@
|
||||
#undef STATIC_BUILD
|
||||
#include "tcl.h"
|
||||
|
||||
/*
|
||||
* Prototypes for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static int PkguaEqObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static int PkguaQuoteObjCmd(ClientData clientData,
|
||||
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]);
|
||||
static void CommandDeleted(ClientData clientData);
|
||||
|
||||
/*
|
||||
* In the following hash table we are going to store a struct that holds all
|
||||
* the command tokens created by Tcl_CreateObjCommand in an interpreter,
|
||||
@@ -149,7 +139,7 @@ PkguaEqObjCmd(
|
||||
str1 = Tcl_GetStringFromObj(objv[1], &len1);
|
||||
str2 = Tcl_GetStringFromObj(objv[2], &len2);
|
||||
if (len1 == len2) {
|
||||
result = (Tcl_UtfNcmp(str1, str2, len1) == 0);
|
||||
result = (Tcl_UtfNcmp(str1, str2, (size_t)len1) == 0);
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
+5
-3
@@ -590,7 +590,6 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
|
||||
# TCL_THREADS
|
||||
# _REENTRANT
|
||||
# _THREAD_SAFE
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([SC_ENABLE_THREADS], [
|
||||
@@ -2068,6 +2067,9 @@ dnl # preprocessing tests use only CPPFLAGS.
|
||||
CFLAGS_NOLTO=""
|
||||
fi
|
||||
|
||||
# Check for vfork, posix_spawnp() and friends unconditionally
|
||||
AC_CHECK_FUNCS(vfork posix_spawnp posix_spawn_file_actions_adddup2 posix_spawnattr_setflags)
|
||||
|
||||
# FIXME: This subst was left in only because the TCL_DL_LIBS
|
||||
# entry in tclConfig.sh uses it. It is not clear why someone
|
||||
# would use TCL_DL_LIBS instead of TCL_LIBS.
|
||||
@@ -2478,12 +2480,12 @@ AC_DEFUN([SC_TCL_LINK_LIBS], [
|
||||
AC_DEFUN([SC_TCL_EARLY_FLAG],[
|
||||
AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])],
|
||||
[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ 1
|
||||
[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[[#define ]$1[ ]m4_default([$4],[1])[
|
||||
]$2]], [[$3]])],
|
||||
[tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
|
||||
[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)]))
|
||||
if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
|
||||
AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
|
||||
AC_DEFINE($1, m4_default([$4],[1]), [Add the ]$1[ flag when building])
|
||||
tcl_flags="$tcl_flags $1"
|
||||
fi
|
||||
])
|
||||
|
||||
+12
-3
@@ -174,6 +174,15 @@
|
||||
/* Define to 1 if you have the `OSSpinLockLock' function. */
|
||||
#undef HAVE_OSSPINLOCKLOCK
|
||||
|
||||
/* Define to 1 if you have the `posix_spawnattr_setflags' function. */
|
||||
#undef HAVE_POSIX_SPAWNATTR_SETFLAGS
|
||||
|
||||
/* Define to 1 if you have the `posix_spawnp' function. */
|
||||
#undef HAVE_POSIX_SPAWNP
|
||||
|
||||
/* Define to 1 if you have the `posix_spawn_file_actions_adddup2' function. */
|
||||
#undef HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
|
||||
|
||||
/* Define to 1 if you have the `pthread_atfork' function. */
|
||||
#undef HAVE_PTHREAD_ATFORK
|
||||
|
||||
@@ -270,6 +279,9 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfork' function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define to 1 if you have the `waitpid' function. */
|
||||
#undef HAVE_WAITPID
|
||||
|
||||
@@ -447,9 +459,6 @@
|
||||
/* Do we want to use the threaded memory allocator? */
|
||||
#undef USE_THREAD_ALLOC
|
||||
|
||||
/* Should we use vfork() instead of fork()? */
|
||||
#undef USE_VFORK
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
+88
-4
@@ -13,7 +13,18 @@
|
||||
|
||||
#include "tclInt.h"
|
||||
|
||||
#ifdef USE_VFORK
|
||||
#ifdef HAVE_POSIX_SPAWNP
|
||||
# if defined(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2) \
|
||||
&& defined(HAVE_POSIX_SPAWNATTR_SETFLAGS) \
|
||||
&& !defined(HAVE_VFORK)
|
||||
# include <unistd.h>
|
||||
# include <spawn.h>
|
||||
# else
|
||||
# undef HAVE_POSIX_SPAWNP
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VFORK
|
||||
#define fork vfork
|
||||
#endif
|
||||
|
||||
@@ -411,6 +422,10 @@ TclpCreateProcess(
|
||||
Tcl_DString *dsArray;
|
||||
char **newArgv;
|
||||
int pid, i;
|
||||
#if defined(HAVE_POSIX_SPAWNP)
|
||||
int childErrno;
|
||||
static int use_spawn = -1;
|
||||
#endif
|
||||
|
||||
errPipeIn = NULL;
|
||||
errPipeOut = NULL;
|
||||
@@ -439,7 +454,7 @@ TclpCreateProcess(
|
||||
newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]);
|
||||
}
|
||||
|
||||
#ifdef USE_VFORK
|
||||
#if defined(HAVE_VFORK) || defined(HAVE_POSIX_SPAWNP)
|
||||
/*
|
||||
* After vfork(), do not call code in the child that changes global state,
|
||||
* because it is using the parent's memory space at that point and writes
|
||||
@@ -452,14 +467,80 @@ TclpCreateProcess(
|
||||
Tcl_GetStdChannel(TCL_STDIN);
|
||||
}
|
||||
if (!outputFile) {
|
||||
Tcl_GetStdChannel(TCL_STDOUT);
|
||||
Tcl_GetStdChannel(TCL_STDOUT);
|
||||
}
|
||||
if (!errorFile) {
|
||||
Tcl_GetStdChannel(TCL_STDERR);
|
||||
Tcl_GetStdChannel(TCL_STDERR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_POSIX_SPAWNP
|
||||
#ifdef _CS_GNU_LIBC_VERSION
|
||||
if (use_spawn < 0) {
|
||||
char conf[32], *p;
|
||||
int major = 0, minor = 0;
|
||||
|
||||
use_spawn = 0;
|
||||
memset(conf, 0, sizeof(conf));
|
||||
confstr(_CS_GNU_LIBC_VERSION, conf, sizeof(conf));
|
||||
p = strchr(conf, ' '); /* skip "glibc" */
|
||||
if (p != NULL) {
|
||||
++p;
|
||||
if (sscanf(p, "%d.%d", &major, &minor) > 1) {
|
||||
if ((major > 2) || ((major == 2) && (minor >= 24))) {
|
||||
use_spawn = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
status = -1;
|
||||
if (use_spawn) {
|
||||
posix_spawn_file_actions_t actions;
|
||||
posix_spawnattr_t attr;
|
||||
sigset_t sigs;
|
||||
|
||||
posix_spawn_file_actions_init(&actions);
|
||||
posix_spawnattr_init(&attr);
|
||||
sigfillset(&sigs);
|
||||
sigdelset(&sigs, SIGKILL);
|
||||
sigdelset(&sigs, SIGSTOP);
|
||||
|
||||
posix_spawnattr_setflags(&attr,
|
||||
POSIX_SPAWN_SETSIGDEF
|
||||
#ifdef POSIX_SPAWN_USEVFORK
|
||||
| POSIX_SPAWN_USEVFORK
|
||||
#endif
|
||||
);
|
||||
posix_spawnattr_setsigdefault(&attr, &sigs);
|
||||
|
||||
posix_spawn_file_actions_adddup2(&actions, GetFd(inputFile), 0);
|
||||
posix_spawn_file_actions_adddup2(&actions, GetFd(outputFile), 1);
|
||||
posix_spawn_file_actions_adddup2(&actions, GetFd(errorFile), 2);
|
||||
|
||||
status = posix_spawnp(&pid, newArgv[0], &actions, &attr,
|
||||
newArgv, environ);
|
||||
childErrno = errno;
|
||||
posix_spawn_file_actions_destroy(&actions);
|
||||
posix_spawnattr_destroy(&attr);
|
||||
|
||||
/*
|
||||
* Fork semantics:
|
||||
* - pid == 0: child process
|
||||
* - pid == -1: error
|
||||
* - pid > 0: parent process
|
||||
*
|
||||
* Mimic fork semantics to minimize changes below,
|
||||
* but retry with fork() as last ressort.
|
||||
*/
|
||||
}
|
||||
if (status != 0) {
|
||||
pid = fork();
|
||||
childErrno = errno;
|
||||
}
|
||||
#else
|
||||
pid = fork();
|
||||
#endif
|
||||
if (pid == 0) {
|
||||
size_t len;
|
||||
int joinThisError = errorFile && (errorFile == outputFile);
|
||||
@@ -509,6 +590,9 @@ TclpCreateProcess(
|
||||
TclStackFree(interp, dsArray);
|
||||
|
||||
if (pid == -1) {
|
||||
#ifdef HAVE_POSIX_SPAWNP
|
||||
errno = childErrno;
|
||||
#endif
|
||||
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
||||
"couldn't fork child process: %s", Tcl_PosixError(interp)));
|
||||
goto error;
|
||||
|
||||
+7
-17
@@ -636,23 +636,13 @@ extern char ** environ;
|
||||
defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
# warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5."
|
||||
# endif
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------------------
|
||||
* At present, using vfork() instead of fork() causes execve() to fail
|
||||
* intermittently on Darwin x86_64. rdar://4685553
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
# if defined(__x86_64__) && !defined(FIXED_RDAR_4685553)
|
||||
# undef USE_VFORK
|
||||
# endif /* __x86_64__ */
|
||||
/* Workaround problems with vfork() when building with llvm-gcc-4.2 */
|
||||
# if defined (__llvm__) && \
|
||||
(__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 2 || \
|
||||
(__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ > 0))))
|
||||
# undef USE_VFORK
|
||||
# endif /* __llvm__ */
|
||||
/*
|
||||
* For now, test exec-17.1 fails (I/O setup after closing stdout) with
|
||||
* posix_spawnp(), but the classic implementation (based on fork()+execvp())
|
||||
* works well under macOS.
|
||||
*/
|
||||
# undef HAVE_POSIX_SPAWNP
|
||||
# undef HAVE_VFORK
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -584,7 +584,7 @@ TestplatformChmod(
|
||||
/* Add in size required for each ACE entry in the ACL */
|
||||
for (i = 0; i < nSids; ++i) {
|
||||
newAclSize +=
|
||||
offsetof(ACCESS_ALLOWED_ACE, SidStart) + aceEntry[i].sidLen;
|
||||
TclOffset(ACCESS_ALLOWED_ACE, SidStart) + aceEntry[i].sidLen;
|
||||
}
|
||||
newAcl = (PACL)ckalloc(newAclSize);
|
||||
if (!InitializeAcl(newAcl, newAclSize, ACL_REVISION)) {
|
||||
|
||||
Reference in New Issue
Block a user