summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/regexec.c2
-rw-r--r--generic/tcl.decls16
-rw-r--r--generic/tcl.h13
-rw-r--r--generic/tclAlloc.c2
-rw-r--r--generic/tclBasic.c124
-rw-r--r--generic/tclBinary.c4
-rw-r--r--generic/tclClock.c2
-rw-r--r--generic/tclCmdIL.c16
-rw-r--r--generic/tclCmdMZ.c8
-rw-r--r--generic/tclCompCmds.c55
-rw-r--r--generic/tclCompCmdsGR.c42
-rw-r--r--generic/tclCompCmdsSZ.c36
-rw-r--r--generic/tclCompExpr.c4
-rw-r--r--generic/tclCompile.c10
-rw-r--r--generic/tclCompile.h8
-rw-r--r--generic/tclDate.c274
-rw-r--r--generic/tclDecls.h58
-rw-r--r--generic/tclEncoding.c24
-rw-r--r--generic/tclEnsemble.c14
-rw-r--r--generic/tclEnv.c11
-rw-r--r--generic/tclEvent.c10
-rw-r--r--generic/tclExecute.c94
-rw-r--r--generic/tclFCmd.c4
-rw-r--r--generic/tclFileName.c8
-rw-r--r--generic/tclGetDate.y100
-rw-r--r--generic/tclIO.c6
-rw-r--r--generic/tclIO.h2
-rw-r--r--generic/tclIORChan.c8
-rw-r--r--generic/tclIOUtil.c6
-rw-r--r--generic/tclIndexObj.c10
-rw-r--r--generic/tclInt.decls4
-rw-r--r--generic/tclInt.h118
-rw-r--r--generic/tclIntDecls.h8
-rw-r--r--generic/tclInterp.c1107
-rw-r--r--generic/tclLink.c18
-rw-r--r--generic/tclListObj.c8
-rw-r--r--generic/tclLoad.c14
-rw-r--r--generic/tclNamesp.c34
-rw-r--r--generic/tclOO.c8
-rw-r--r--generic/tclOOBasic.c2
-rw-r--r--generic/tclOOInfo.c56
-rw-r--r--generic/tclOOInt.h4
-rw-r--r--generic/tclObj.c24
-rw-r--r--generic/tclOptimize.c2
-rw-r--r--generic/tclParse.c43
-rw-r--r--generic/tclPkg.c3
-rw-r--r--generic/tclProc.c11
-rw-r--r--generic/tclProcess.c12
-rw-r--r--generic/tclScan.c4
-rw-r--r--generic/tclStrToD.c89
-rw-r--r--generic/tclStringObj.c2
-rw-r--r--generic/tclStringRep.h6
-rw-r--r--generic/tclStubInit.c10
-rw-r--r--generic/tclTest.c300
-rw-r--r--generic/tclTestObj.c18
-rw-r--r--generic/tclTestProcBodyObj.c4
-rw-r--r--generic/tclThread.c22
-rw-r--r--generic/tclThreadStorage.c32
-rw-r--r--generic/tclThreadTest.c8
-rw-r--r--generic/tclTomMath.h41
-rw-r--r--generic/tclTomMathDecls.h2
-rw-r--r--generic/tclTrace.c6
-rw-r--r--generic/tclUtf.c279
-rw-r--r--generic/tclUtil.c486
-rw-r--r--generic/tclVar.c2
-rw-r--r--generic/tclZipfs.c80
-rw-r--r--generic/tclZlib.c276
67 files changed, 2188 insertions, 1926 deletions
diff --git a/generic/regexec.c b/generic/regexec.c
index b5f161b..e7260cd 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -73,7 +73,7 @@ struct dfa {
chr *lastnopr; /* location of last cache-flushed NOPROGRESS */
struct sset *search; /* replacement-search-pointer memory */
int cptsmalloced; /* were the areas individually malloced? */
- char *mallocarea; /* self, or master malloced area, or NULL */
+ char *mallocarea; /* self, or malloced area, or NULL */
};
#define WORK 1 /* number of work bitvectors needed */
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 0e172cb..93f3ff4 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -316,12 +316,12 @@ declare 85 {
int flags)
}
declare 86 {
- int Tcl_CreateAlias(Tcl_Interp *slave, const char *slaveCmd,
+ int Tcl_CreateAlias(Tcl_Interp *childInterp, const char *childCmd,
Tcl_Interp *target, const char *targetCmd, int argc,
const char *const *argv)
}
declare 87 {
- int Tcl_CreateAliasObj(Tcl_Interp *slave, const char *slaveCmd,
+ int Tcl_CreateAliasObj(Tcl_Interp *childInterp, const char *childCmd,
Tcl_Interp *target, const char *targetCmd, int objc,
Tcl_Obj *const objv[])
}
@@ -364,7 +364,7 @@ declare 96 {
Tcl_CmdDeleteProc *deleteProc)
}
declare 97 {
- Tcl_Interp *Tcl_CreateSlave(Tcl_Interp *interp, const char *slaveName,
+ Tcl_Interp *Tcl_CreateChild(Tcl_Interp *interp, const char *name,
int isSafe)
}
declare 98 {
@@ -527,12 +527,12 @@ declare 147 {deprecated {see TIP #559. Use Tcl_ResetResult}} {
void Tcl_FreeResult(Tcl_Interp *interp)
}
declare 148 {
- int Tcl_GetAlias(Tcl_Interp *interp, const char *slaveCmd,
+ int Tcl_GetAlias(Tcl_Interp *interp, const char *childCmd,
Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
int *argcPtr, const char ***argvPtr)
}
declare 149 {
- int Tcl_GetAliasObj(Tcl_Interp *interp, const char *slaveCmd,
+ int Tcl_GetAliasObj(Tcl_Interp *interp, const char *childCmd,
Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
int *objcPtr, Tcl_Obj ***objv)
}
@@ -582,10 +582,10 @@ declare 162 {
const char *Tcl_GetHostName(void)
}
declare 163 {
- int Tcl_GetInterpPath(Tcl_Interp *askInterp, Tcl_Interp *slaveInterp)
+ int Tcl_GetInterpPath(Tcl_Interp *interp, Tcl_Interp *childInterp)
}
declare 164 {
- Tcl_Interp *Tcl_GetMaster(Tcl_Interp *interp)
+ Tcl_Interp *Tcl_GetParent(Tcl_Interp *interp)
}
declare 165 {
const char *Tcl_GetNameOfExecutable(void)
@@ -616,7 +616,7 @@ declare 171 {
int Tcl_GetServiceMode(void)
}
declare 172 {
- Tcl_Interp *Tcl_GetSlave(Tcl_Interp *interp, const char *slaveName)
+ Tcl_Interp *Tcl_GetChild(Tcl_Interp *interp, const char *name)
}
declare 173 {
Tcl_Channel Tcl_GetStdChannel(int type)
diff --git a/generic/tcl.h b/generic/tcl.h
index 369a894..65169c0 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -973,11 +973,14 @@ typedef struct Tcl_DString {
#define TCL_DONT_QUOTE_HASH 8
/*
- * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
- * abbreviated strings.
+ * Flags that may be passed to Tcl_GetIndexFromObj.
+ * TCL_EXACT disallows abbreviated strings.
+ * TCL_INDEX_TEMP_TABLE disallows caching of lookups. A possible use case is
+ * a table that will not live long enough to make it worthwhile.
*/
-#define TCL_EXACT 1
+#define TCL_EXACT 1
+#define TCL_INDEX_TEMP_TABLE 2
/*
*----------------------------------------------------------------------------
@@ -2114,8 +2117,8 @@ typedef struct Tcl_EncodingType {
* The maximum number of bytes that are necessary to represent a single
* Unicode character in UTF-8. The valid values are 3 and 4
* (or perhaps 1 if we want to support a non-unicode enabled core). If 3,
- * then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If > 3,
- * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
+ * then Tcl_UniChar must be 2-bytes in size (UTF-16) (the default). If > 3,
+ * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UTF-16 mode
* is the default and recommended mode.
*/
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index 3a76469..bc4716d 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -345,7 +345,7 @@ TclpAlloc(
nextf[bucket] = overPtr->next;
overPtr->overMagic0 = overPtr->overMagic1 = MAGIC;
- overPtr->bucketIndex = (unsigned char) bucket;
+ overPtr->bucketIndex = UCHAR(bucket);
#ifdef MSTATS
numMallocs[bucket]++;
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 6c14f45..75f8527 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -684,7 +684,7 @@ Tcl_CreateInterp(void)
TclRegisterCommandTypeName(TclEnsembleImplementationCmd, "ensemble");
TclRegisterCommandTypeName(TclAliasObjCmd, "alias");
TclRegisterCommandTypeName(TclLocalAliasObjCmd, "alias");
- TclRegisterCommandTypeName(TclSlaveObjCmd, "slave");
+ TclRegisterCommandTypeName(TclChildObjCmd, "interp");
TclRegisterCommandTypeName(TclInvokeImportedCmd, "import");
TclRegisterCommandTypeName(TclOOPublicObjectCmd, "object");
TclRegisterCommandTypeName(TclOOPrivateObjectCmd, "privateObject");
@@ -2785,6 +2785,8 @@ TclCreateObjCommandInNs(
Command *refCmdPtr = oldRefPtr->importedCmdPtr;
dataPtr = (ImportedCmdData*)refCmdPtr->objClientData;
+ cmdPtr->refCount++;
+ TclCleanupCommandMacro(dataPtr->realCmdPtr);
dataPtr->realCmdPtr = cmdPtr;
oldRefPtr = oldRefPtr->nextPtr;
}
@@ -3374,7 +3376,7 @@ Tcl_GetCommandFullName(
* separator, and the command name.
*/
- if (cmdPtr != NULL) {
+ if ((cmdPtr != NULL) && TclRoutineHasName(cmdPtr)) {
if (cmdPtr->nsPtr != NULL) {
Tcl_AppendToObj(objPtr, cmdPtr->nsPtr->fullName, -1);
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
@@ -3464,7 +3466,7 @@ Tcl_DeleteCommandFromToken(
* and skip nested deletes.
*/
- if (cmdPtr->flags & CMD_IS_DELETED) {
+ if (cmdPtr->flags & CMD_DYING) {
/*
* Another deletion is already in progress. Remove the hash table
* entry now, but don't invoke a callback or free the command
@@ -3496,7 +3498,7 @@ Tcl_DeleteCommandFromToken(
* be ignored.
*/
- cmdPtr->flags |= CMD_IS_DELETED;
+ cmdPtr->flags |= CMD_DYING;
/*
* Call trace functions for the command being deleted. Then delete its
@@ -3526,7 +3528,7 @@ Tcl_DeleteCommandFromToken(
}
/*
- * The list of command exported from the namespace might have changed.
+ * The list of commands exported from the namespace might have changed.
* However, we do not need to recompute this just yet; next time we need
* the info will be soon enough.
*/
@@ -3547,6 +3549,19 @@ Tcl_DeleteCommandFromToken(
iPtr->compileEpoch++;
}
+ if (!(cmdPtr->flags & CMD_REDEF_IN_PROGRESS)) {
+ /*
+ * Delete any imports of this routine before deleting this routine itself.
+ * See issue 688fcc7082fa.
+ */
+ for (refPtr = cmdPtr->importRefPtr; refPtr != NULL;
+ refPtr = nextRefPtr) {
+ nextRefPtr = refPtr->nextPtr;
+ importCmd = (Tcl_Command) refPtr->importedCmdPtr;
+ Tcl_DeleteCommandFromToken(interp, importCmd);
+ }
+ }
+
if (cmdPtr->deleteProc != NULL) {
/*
* Delete the command's client data. If this was an imported command
@@ -3567,20 +3582,6 @@ Tcl_DeleteCommandFromToken(
}
/*
- * If this command was imported into other namespaces, then imported
- * commands were created that refer back to this command. Delete these
- * imported commands now.
- */
- if (!(cmdPtr->flags & CMD_REDEF_IN_PROGRESS)) {
- for (refPtr = cmdPtr->importRefPtr; refPtr != NULL;
- refPtr = nextRefPtr) {
- nextRefPtr = refPtr->nextPtr;
- importCmd = (Tcl_Command) refPtr->importedCmdPtr;
- Tcl_DeleteCommandFromToken(interp, importCmd);
- }
- }
-
- /*
* Don't use hPtr to delete the hash entry here, because it's possible
* that the deletion callback renamed the command. Instead, use
* cmdPtr->hptr, and make sure that no-one else has already deleted the
@@ -3617,6 +3618,7 @@ Tcl_DeleteCommandFromToken(
* TclNRExecuteByteCode looks up the command in the command hashtable).
*/
+ cmdPtr->flags |= CMD_DEAD;
TclCleanupCommandMacro(cmdPtr);
return 0;
}
@@ -3661,7 +3663,7 @@ CallCommandTraces(
* While a rename trace is active, we will not process any more rename
* traces; while a delete trace is active we will never reach here -
* because Tcl_DeleteCommandFromToken checks for the condition
- * (cmdPtr->flags & CMD_IS_DELETED) and returns immediately when a
+ * (cmdPtr->flags & CMD_DYING) and returns immediately when a
* command deletion is in progress. For all other traces, delete
* traces will not be invoked but a call to TraceCommandProc will
* ensure that tracePtr->clientData is freed whenever the command
@@ -3792,11 +3794,11 @@ CancelEvalProc(
TclSetCancelFlags(iPtr, cancelInfo->flags | CANCELED);
/*
- * Now, we must set the script cancellation flags on all the slave
+ * Now, we must set the script cancellation flags on all the child
* interpreters belonging to this one.
*/
- TclSetSlaveCancelFlags((Tcl_Interp *) iPtr,
+ TclSetChildCancelFlags((Tcl_Interp *) iPtr,
cancelInfo->flags | CANCELED, 0);
/*
@@ -4321,7 +4323,7 @@ TclResetCancellation(
* Tcl_Canceled --
*
* Check if the script in progress has been canceled, i.e.,
- * Tcl_CancelEval was called for this interpreter or any of its master
+ * Tcl_CancelEval was called for this interpreter or any of its parent
* interpreters.
*
* Results:
@@ -4686,7 +4688,7 @@ EvalObjvCore(
* Caller gave it to us.
*/
- if (!(preCmdPtr->flags & CMD_IS_DELETED)) {
+ if (!(preCmdPtr->flags & CMD_DEAD)) {
/*
* So long as it exists, use it.
*/
@@ -5214,7 +5216,7 @@ TEOV_RunLeaveTraces(
int length;
const char *command = TclGetStringFromObj(commandPtr, &length);
- if (!(cmdPtr->flags & CMD_IS_DELETED)) {
+ if (!(cmdPtr->flags & CMD_DYING)) {
if (cmdPtr->flags & CMD_HAS_EXEC_TRACES) {
traceCode = TclCheckExecutionTraces(interp, command, length,
cmdPtr, result, TCL_TRACE_LEAVE_EXEC, objc, objv);
@@ -5407,7 +5409,7 @@ TclEvalEx(
* the embedded command, which is refered to
* by 'script'. The 'clNextOuter' refers to
* the current entry in the table of
- * continuation lines in this "master script",
+ * continuation lines in this "main script",
* and the character offsets are relative to
* the 'outerScript' as well.
*
@@ -6460,7 +6462,7 @@ TclNREvalObjEx(
/*
* Shimmer protection! Always pass an unshared obj. The caller could
* incr the refCount of objPtr AFTER calling us! To be completely safe
- * we always make a copy. The callback takes care od the refCounts for
+ * we always make a copy. The callback takes care of the refCounts for
* both listPtr and objPtr.
*
* TODO: Create a test to demo this need, or eliminate it.
@@ -7029,7 +7031,7 @@ TclObjInvoke(
int
TclNRInvoke(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -7511,7 +7513,7 @@ Tcl_GetVersion(
static int
ExprCeilFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7551,7 +7553,7 @@ ExprCeilFunc(
static int
ExprFloorFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7591,7 +7593,7 @@ ExprFloorFunc(
static int
ExprIsqrtFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute. */
int objc, /* Actual parameter count. */
Tcl_Obj *const *objv) /* Actual parameter list. */
@@ -7697,7 +7699,7 @@ ExprIsqrtFunc(
static int
ExprSqrtFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7865,7 +7867,7 @@ ExprBinaryFunc(
static int
ExprAbsFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7964,7 +7966,7 @@ ExprAbsFunc(
static int
ExprBoolFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -7985,7 +7987,7 @@ ExprBoolFunc(
static int
ExprDoubleFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8012,7 +8014,7 @@ ExprDoubleFunc(
static int
ExprIntFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8068,7 +8070,7 @@ ExprIntFunc(
static int
ExprWideFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8089,7 +8091,7 @@ ExprWideFunc(
*/
static int
ExprMaxMinFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8129,7 +8131,7 @@ ExprMaxMinFunc(
static int
ExprMaxFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8140,7 +8142,7 @@ ExprMaxFunc(
static int
ExprMinFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8151,7 +8153,7 @@ ExprMinFunc(
static int
ExprRandFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8244,7 +8246,7 @@ ExprRandFunc(
static int
ExprRoundFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8323,7 +8325,7 @@ ExprRoundFunc(
static int
ExprSrandFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count. */
@@ -8512,7 +8514,7 @@ ClassifyDouble(
static int
ExprIsFiniteFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8543,7 +8545,7 @@ ExprIsFiniteFunc(
static int
ExprIsInfinityFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8573,7 +8575,7 @@ ExprIsInfinityFunc(
static int
ExprIsNaNFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8603,7 +8605,7 @@ ExprIsNaNFunc(
static int
ExprIsNormalFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8633,7 +8635,7 @@ ExprIsNormalFunc(
static int
ExprIsSubnormalFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8663,7 +8665,7 @@ ExprIsSubnormalFunc(
static int
ExprIsUnorderedFunc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8704,7 +8706,7 @@ ExprIsUnorderedFunc(
static int
FloatClassifyObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The interpreter in which to execute the
* function. */
int objc, /* Actual parameter count */
@@ -8813,7 +8815,7 @@ MathFuncWrongNumArgs(
static int
DTraceObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -9197,7 +9199,7 @@ TclSetTailcall(
int
TclNRTailcallObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -9390,7 +9392,7 @@ TclNRYieldObjCmd(
int
TclNRYieldToObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -9513,7 +9515,7 @@ NRCoroutineCallerCallback(
SAVE_CONTEXT(corPtr->running);
RESTORE_CONTEXT(corPtr->caller);
- if (cmdPtr->flags & CMD_IS_DELETED) {
+ if (cmdPtr->flags & CMD_DYING) {
/*
* The command was deleted while it was running: wind down the
* execEnv, this will do the complete cleanup. RewindCoroutine will
@@ -9700,7 +9702,7 @@ TclNREvalList(
static int
CoroTypeObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -9790,7 +9792,7 @@ GetCoroutineFromObj(
static int
TclNRCoroInjectObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -9835,7 +9837,7 @@ TclNRCoroInjectObjCmd(
static int
TclNRCoroProbeObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -10028,7 +10030,7 @@ InjectHandlerPostCall(
static int
NRInjectObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -10137,7 +10139,7 @@ TclNRInterpCoroutine(
int
TclNRCoroutineObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -10270,7 +10272,7 @@ TclNRCoroutineObjCmd(
int
TclInfoCoroutineCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -10282,7 +10284,7 @@ TclInfoCoroutineCmd(
return TCL_ERROR;
}
- if (corPtr && !(corPtr->cmdPtr->flags & CMD_IS_DELETED)) {
+ if (corPtr && !(corPtr->cmdPtr->flags & CMD_DYING)) {
Tcl_Obj *namePtr;
TclNewObj(namePtr);
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 2d1d4d8..806bd58 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -274,7 +274,7 @@ typedef struct ByteArray {
* array. */
unsigned int allocated; /* The amount of space actually allocated
* minus 1 byte. */
- unsigned char bytes[1]; /* The array of bytes. The actual size of this
+ unsigned char bytes[TCLFLEXARRAY]; /* The array of bytes. The actual size of this
* field depends on the 'allocated' field
* above. */
} ByteArray;
@@ -2841,7 +2841,7 @@ BinaryEncodeUu(
unsigned char *data, *start, *cursor;
int offset, count, rawLength, n, i, j, bits, index;
int lineLength = 61;
- const unsigned char SingleNewline[] = { (unsigned char) '\n' };
+ const unsigned char SingleNewline[] = { UCHAR('\n') };
const unsigned char *wrapchar = SingleNewline;
int wrapcharlen = sizeof(SingleNewline);
enum { OPT_MAXLEN, OPT_WRAPCHAR };
diff --git a/generic/tclClock.c b/generic/tclClock.c
index baaa568..ba85fec 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -263,7 +263,7 @@ TclClockInit(
};
/*
- * Safe interps get [::clock] as alias to a master, so do not need their
+ * Safe interps get [::clock] as alias to a parent, so do not need their
* own copies of the support routines.
*/
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 94ff2cc..3de976e 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -1026,7 +1026,7 @@ InfoErrorStackCmd(
target = interp;
if (objc == 2) {
- target = Tcl_GetSlave(interp, TclGetString(objv[1]));
+ target = Tcl_GetChild(interp, TclGetString(objv[1]));
if (target == NULL) {
return TCL_ERROR;
}
@@ -2142,7 +2142,7 @@ InfoCmdTypeCmd(
}
/*
- * There's one special case: safe slave interpreters can't see aliases as
+ * There's one special case: safe child interpreters can't see aliases as
* aliases as they're part of the security mechanisms.
*/
@@ -3305,7 +3305,7 @@ Tcl_LsearchObjCmd(
if (groupSize < 1) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"stride length must be at least 1", -1));
- Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT",
+ Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH",
"BADSTRIDE", NULL);
result = TCL_ERROR;
goto done;
@@ -3640,11 +3640,11 @@ Tcl_LsearchObjCmd(
/*
* Normally, binary search is written to stop when it finds a
* match. If there are duplicates of an element in the list,
- * our first match might not be the first occurance.
+ * our first match might not be the first occurrence.
* Consider: 0 0 0 1 1 1 2 2 2
*
* To maintain consistancy with standard lsearch semantics, we
- * must find the leftmost occurance of the pattern in the
+ * must find the leftmost occurrence of the pattern in the
* list. Thus we don't just stop searching here. This
* variation means that a search always makes log n
* comparisons (normal binary search might "get lucky" with an
@@ -4697,7 +4697,7 @@ static int
DictionaryCompare(
const char *left, const char *right) /* The strings to compare. */
{
- Tcl_UniChar uniLeft = 0, uniRight = 0, uniLeftLower, uniRightLower;
+ int uniLeft = 0, uniRight = 0, uniLeftLower, uniRightLower;
int diff, zeros;
int secondaryDiff = 0;
@@ -4766,8 +4766,8 @@ DictionaryCompare(
*/
if ((*left != '\0') && (*right != '\0')) {
- left += TclUtfToUniChar(left, &uniLeft);
- right += TclUtfToUniChar(right, &uniRight);
+ left += TclUtfToUCS4(left, &uniLeft);
+ right += TclUtfToUCS4(right, &uniRight);
/*
* Convert both chars to lower for the comparison, because
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index d7394fb..f95dd12 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -195,7 +195,7 @@ Tcl_RegexpObjCmd(
if (++i >= objc) {
goto endOfForLoop;
}
- if (TclGetIntForIndexM(interp, objv[i], 0, &temp) != TCL_OK) {
+ if (TclGetIntForIndexM(interp, objv[i], INT_MAX - 1, &temp) != TCL_OK) {
goto optionError;
}
if (startIndex) {
@@ -550,7 +550,7 @@ Tcl_RegsubObjCmd(
if (++idx >= objc) {
goto endOfForLoop;
}
- if (TclGetIntForIndexM(interp, objv[idx], 0, &temp) != TCL_OK) {
+ if (TclGetIntForIndexM(interp, objv[idx], INT_MAX - 1, &temp) != TCL_OK) {
goto optionError;
}
if (startIndex) {
@@ -1424,7 +1424,7 @@ StringIndexCmd(
*/
if (TclIsPureByteArray(objv[1])) {
- unsigned char uch = (unsigned char) ch;
+ unsigned char uch = UCHAR(ch);
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(&uch, 1));
} else {
@@ -4311,7 +4311,7 @@ Tcl_TimeRateObjCmd(
*/
measureOverhead = 0;
- Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
return TCL_OK;
}
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index e38be07..3e2da23 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -126,9 +126,9 @@ TclCompileAppendCmd(
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isScalar, localIndex, numWords, i;
- DefineLineInformation; /* TIP #280 */
/* TODO: Consider support for compiling expanded args. */
numWords = parsePtr->numWords;
@@ -390,9 +390,9 @@ TclCompileArraySetCmd(
keyVar = AnonymousLocal(envPtr);
valVar = AnonymousLocal(envPtr);
- infoPtr = (ForeachInfo *)ckalloc(sizeof(ForeachInfo));
+ infoPtr = (ForeachInfo *)ckalloc(offsetof(ForeachInfo, varLists) + sizeof(ForeachVarList *));
infoPtr->numLists = 1;
- infoPtr->varLists[0] = (ForeachVarList *)ckalloc(sizeof(ForeachVarList) + sizeof(int));
+ infoPtr->varLists[0] = (ForeachVarList *)ckalloc(offsetof(ForeachVarList, varIndexes) + 2 * sizeof(int));
infoPtr->varLists[0]->numVars = 2;
infoPtr->varLists[0]->varIndexes[0] = keyVar;
infoPtr->varLists[0]->varIndexes[1] = valVar;
@@ -572,10 +572,10 @@ TclCompileCatchCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
JumpFixup jumpFixup;
Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr;
int resultIndex, optsIndex, range, dropScript = 0;
- DefineLineInformation; /* TIP #280 */
int depth = TclGetStackDepth(envPtr);
/*
@@ -1003,9 +1003,9 @@ TclCompileDictSetCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int i, dictVarIndex;
- DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr;
/*
@@ -1128,9 +1128,9 @@ TclCompileDictGetCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int i;
- DefineLineInformation; /* TIP #280 */
/*
* There must be at least two arguments after the command (the single-arg
@@ -1164,9 +1164,9 @@ TclCompileDictGetWithDefaultCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int i;
- DefineLineInformation; /* TIP #280 */
/*
* There must be at least three arguments after the command.
@@ -1195,9 +1195,9 @@ TclCompileDictExistsCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int i;
- DefineLineInformation; /* TIP #280 */
/*
* There must be at least two arguments after the command (the single-arg
@@ -1232,8 +1232,8 @@ TclCompileDictUnsetCmd(
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
int i, dictVarIndex;
/*
@@ -1789,7 +1789,7 @@ TclCompileDictUpdateCmd(
* that are to be used.
*/
- duiPtr = (DictUpdateInfo *)ckalloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1));
+ duiPtr = (DictUpdateInfo *)ckalloc(offsetof(DictUpdateInfo, varIndices) + sizeof(int) * numVars);
duiPtr->length = numVars;
keyTokenPtrs = (Tcl_Token **)TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars);
tokenPtr = TokenAfter(dictVarTokenPtr);
@@ -2271,7 +2271,7 @@ DupDictUpdateInfo(
size_t len;
dui1Ptr = (DictUpdateInfo *)clientData;
- len = sizeof(DictUpdateInfo) + sizeof(int) * (dui1Ptr->length - 1);
+ len = offsetof(DictUpdateInfo, varIndices) + sizeof(int) * dui1Ptr->length;
dui2Ptr = (DictUpdateInfo *)ckalloc(len);
memcpy(dui2Ptr, dui1Ptr, len);
return dui2Ptr;
@@ -2347,13 +2347,13 @@ TclCompileErrorCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
+
/*
* General syntax: [error message ?errorInfo? ?errorCode?]
*/
- Tcl_Token *tokenPtr;
- DefineLineInformation; /* TIP #280 */
-
if (parsePtr->numWords < 2 || parsePtr->numWords > 4) {
return TCL_ERROR;
}
@@ -2464,11 +2464,11 @@ TclCompileForCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr;
JumpFixup jumpEvalCondFixup;
int bodyCodeOffset, nextCodeOffset, jumpDist;
int bodyRange, nextRange;
- DefineLineInformation; /* TIP #280 */
if (parsePtr->numWords != 5) {
return TCL_ERROR;
@@ -2676,6 +2676,7 @@ CompileEachloopCmd(
int collect) /* Select collecting or accumulating mode
* (TCL_EACH_*) */
{
+ DefineLineInformation; /* TIP #280 */
Proc *procPtr = envPtr->procPtr;
ForeachInfo *infoPtr=NULL; /* Points to the structure describing this
* foreach command. Stored in a AuxData
@@ -2685,7 +2686,6 @@ CompileEachloopCmd(
int jumpBackOffset, infoIndex, range;
int numWords, numLists, i, j, code = TCL_OK;
Tcl_Obj *varListObj = NULL;
- DefineLineInformation; /* TIP #280 */
/*
* If the foreach command isn't in a procedure, don't compile it inline:
@@ -2721,8 +2721,8 @@ CompileEachloopCmd(
*/
numLists = (numWords - 2)/2;
- infoPtr = (ForeachInfo *)ckalloc(sizeof(ForeachInfo)
- + (numLists - 1) * sizeof(ForeachVarList *));
+ infoPtr = (ForeachInfo *)ckalloc(offsetof(ForeachInfo, varLists)
+ + numLists * sizeof(ForeachVarList *));
infoPtr->numLists = 0; /* Count this up as we go */
/*
@@ -2755,8 +2755,8 @@ CompileEachloopCmd(
goto done;
}
- varListPtr = (ForeachVarList *)ckalloc(sizeof(ForeachVarList)
- + (numVars - 1) * sizeof(int));
+ varListPtr = (ForeachVarList *)ckalloc(offsetof(ForeachVarList, varIndexes)
+ + numVars * sizeof(int));
varListPtr->numVars = numVars;
infoPtr->varLists[i/2] = varListPtr;
infoPtr->numLists++;
@@ -2891,7 +2891,7 @@ DupForeachInfo(
ForeachVarList *srcListPtr, *dupListPtr;
int numVars, i, j, numLists = srcPtr->numLists;
- dupPtr = (ForeachInfo *)ckalloc(sizeof(ForeachInfo)
+ dupPtr = (ForeachInfo *)ckalloc(offsetof(ForeachInfo, varLists)
+ numLists * sizeof(ForeachVarList *));
dupPtr->numLists = numLists;
dupPtr->firstValueTemp = srcPtr->firstValueTemp;
@@ -2900,7 +2900,7 @@ DupForeachInfo(
for (i = 0; i < numLists; i++) {
srcListPtr = srcPtr->varLists[i];
numVars = srcListPtr->numVars;
- dupListPtr = (ForeachVarList *)ckalloc(sizeof(ForeachVarList)
+ dupListPtr = (ForeachVarList *)ckalloc(offsetof(ForeachVarList, varIndexes)
+ numVars * sizeof(int));
dupListPtr->numVars = numVars;
for (j = 0; j < numVars; j++) {
@@ -3446,10 +3446,10 @@ TclPushVarName(
/*
* last char is ')' => potential array reference.
*/
- last = Tcl_UtfPrev(name + nameLen, name);
+ last = &name[nameLen-1];
if (*last == ')') {
- for (p = name; p < last; p = Tcl_UtfNext(p)) {
+ for (p = name; p < last; p++) {
if (*p == '(') {
elName = p + 1;
elNameLen = last - elName;
@@ -3477,15 +3477,14 @@ TclPushVarName(
} else if (interp && ((n = varTokenPtr->numComponents) > 1)
&& (varTokenPtr[1].type == TCL_TOKEN_TEXT)
&& (varTokenPtr[n].type == TCL_TOKEN_TEXT)
- && (*((p = varTokenPtr[n].start + varTokenPtr[n].size)-1) == ')')
- && (*Tcl_UtfPrev(p, varTokenPtr[n].start) == ')')) {
+ && (*(varTokenPtr[n].start + varTokenPtr[n].size - 1) == ')')) {
/*
* Check for parentheses inside first token.
*/
simpleVarName = 0;
for (p = varTokenPtr[1].start,
- last = p + varTokenPtr[1].size; p < last; p = Tcl_UtfNext(p)) {
+ last = p + varTokenPtr[1].size; p < last; p++) {
if (*p == '(') {
simpleVarName = 1;
break;
@@ -3553,7 +3552,7 @@ TclPushVarName(
int hasNsQualifiers = 0;
- for (p = name, last = p + nameLen-1; p < last; p = Tcl_UtfNext(p)) {
+ for (p = name, last = p + nameLen-1; p < last; p++) {
if ((*p == ':') && (*(p+1) == ':')) {
hasNsQualifiers = 1;
break;
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index 59eebae..3361d7f 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -89,9 +89,9 @@ TclCompileGlobalCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr;
int localIndex, numWords, i;
- DefineLineInformation; /* TIP #280 */
/* TODO: Consider support for compiling expanded args. */
numWords = parsePtr->numWords;
@@ -170,6 +170,7 @@ TclCompileIfCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
JumpFixupArray jumpFalseFixupArray;
/* Used to fix the ifFalse jump after each
* test when its target PC is determined. */
@@ -185,7 +186,6 @@ TclCompileIfCmd(
* "if 0 {..}" */
int boolVal; /* Value of static condition. */
int compileScripts = 1;
- DefineLineInformation; /* TIP #280 */
/*
* Only compile the "if" command if all arguments are simple words, in
@@ -472,9 +472,9 @@ TclCompileIncrCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *incrTokenPtr;
int isScalar, localIndex, haveImmValue, immValue;
- DefineLineInformation; /* TIP #280 */
if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) {
return TCL_ERROR;
@@ -667,9 +667,9 @@ TclCompileInfoExistsCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int isScalar, localIndex;
- DefineLineInformation; /* TIP #280 */
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -840,9 +840,9 @@ TclCompileLappendCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isScalar, localIndex, numWords, i;
- DefineLineInformation; /* TIP #280 */
/* TODO: Consider support for compiling expanded args. */
numWords = parsePtr->numWords;
@@ -955,9 +955,9 @@ TclCompileLassignCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr;
int isScalar, localIndex, numWords, idx;
- DefineLineInformation; /* TIP #280 */
numWords = parsePtr->numWords;
@@ -1058,9 +1058,9 @@ TclCompileLindexCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *idxTokenPtr, *valTokenPtr;
int i, idx, numWords = parsePtr->numWords;
- DefineLineInformation; /* TIP #280 */
/*
* Quit if too few args.
@@ -1261,8 +1261,8 @@ TclCompileLlengthCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *varTokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *varTokenPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1293,8 +1293,8 @@ TclCompileLrangeCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
- Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr, *listTokenPtr;
int idx1, idx2;
if (parsePtr->numWords != 4) {
@@ -1353,8 +1353,8 @@ TclCompileLinsertCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
- Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr, *listTokenPtr;
int idx, i;
if (parsePtr->numWords < 3) {
@@ -1455,8 +1455,8 @@ TclCompileLreplaceCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
- Tcl_Token *tokenPtr, *listTokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr, *listTokenPtr;
int idx1, idx2, i;
int emptyPrefix=1, suffixStart = 0;
@@ -1618,6 +1618,7 @@ TclCompileLsetCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
int tempDepth; /* Depth used for emitting one part of the
* code burst. */
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
@@ -1625,7 +1626,6 @@ TclCompileLsetCmd(
int localIndex; /* Index of var in local var table. */
int isScalar; /* Flag == 1 if scalar, 0 if array. */
int i;
- DefineLineInformation; /* TIP #280 */
/*
* Check argument count.
@@ -1788,8 +1788,8 @@ TclCompileNamespaceCodeCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1837,8 +1837,8 @@ TclCompileNamespaceOriginCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -1858,8 +1858,8 @@ TclCompileNamespaceQualifiersCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
int off;
if (parsePtr->numWords != 2) {
@@ -1893,8 +1893,8 @@ TclCompileNamespaceTailCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
JumpFixup jumpFixup;
if (parsePtr->numWords != 2) {
@@ -1929,9 +1929,9 @@ TclCompileNamespaceUpvarCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int localIndex, numWords, i;
- DefineLineInformation; /* TIP #280 */
if (envPtr->procPtr == NULL) {
return TCL_ERROR;
@@ -2052,11 +2052,11 @@ TclCompileRegexpCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
+ 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;
const char *str;
- DefineLineInformation; /* TIP #280 */
/*
* We are only interested in compiling simple regexp cases. Currently
@@ -2390,6 +2390,7 @@ TclCompileReturnCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
/*
* General syntax: [return ?-option value ...? ?result?]
* An even number of words means an explicit result argument is present.
@@ -2400,7 +2401,6 @@ TclCompileReturnCmd(
int numOptionWords = numWords - 1 - explicitResult;
Tcl_Obj *returnOpts, **objv;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
- DefineLineInformation; /* TIP #280 */
/*
* Check for special case which can always be compiled:
@@ -2641,9 +2641,9 @@ TclCompileUpvarCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int localIndex, numWords, i;
- DefineLineInformation; /* TIP #280 */
Tcl_Obj *objPtr;
if (envPtr->procPtr == NULL) {
@@ -2747,9 +2747,9 @@ TclCompileVariableCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *valueTokenPtr;
int localIndex, numWords, i;
- DefineLineInformation; /* TIP #280 */
numWords = parsePtr->numWords;
if (numWords < 2) {
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index 081b141..81c01e0 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -129,9 +129,9 @@ TclCompileSetCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isAssignment, isScalar, localIndex, numWords;
- DefineLineInformation; /* TIP #280 */
numWords = parsePtr->numWords;
if ((numWords != 2) && (numWords != 3)) {
@@ -222,10 +222,10 @@ TclCompileStringCatCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
int i, numWords = parsePtr->numWords, numArgs;
Tcl_Token *wordTokenPtr;
Tcl_Obj *obj, *folded;
- DefineLineInformation; /* TIP #280 */
/* Trivial case, no arg */
@@ -444,8 +444,8 @@ TclCompileStringInsertCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
int idx;
if (parsePtr->numWords != 4) {
@@ -1046,8 +1046,8 @@ TclCompileStringReplaceCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
- Tcl_Token *tokenPtr, *valueTokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr, *valueTokenPtr;
int first, last;
if (parsePtr->numWords < 4 || parsePtr->numWords > 5) {
@@ -1415,7 +1415,7 @@ StringClassDesc const tclStringClassTable[] = {
{"upper", Tcl_UniCharIsUpper},
{"word", Tcl_UniCharIsWordChar},
{"xdigit", UniCharIsHexDigit},
- {NULL, NULL}
+ {"", NULL}
};
/*
@@ -1446,13 +1446,13 @@ TclCompileSubstCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
int numArgs = parsePtr->numWords - 1;
int numOpts = numArgs - 1;
int objc, flags = TCL_SUBST_ALL;
Tcl_Obj **objv/*, *toSubst = NULL*/;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
int code = TCL_ERROR;
- DefineLineInformation; /* TIP #280 */
if (numArgs == 0) {
return TCL_ERROR;
@@ -1778,6 +1778,7 @@ TclCompileSwitchCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *tokenPtr; /* Pointer to tokens in command. */
int numWords; /* Number of words in command. */
@@ -1794,7 +1795,6 @@ TclCompileSwitchCmd(
int foundMode = 0; /* Have we seen a mode flag yet? */
int i, valueIndex;
int result = TCL_ERROR;
- DefineLineInformation; /* TIP #280 */
int *clNext = envPtr->clNext;
/*
@@ -3610,9 +3610,9 @@ TclCompileUnsetCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr;
int isScalar, localIndex, flags = 1, i, varCount = 0, haveFlags = 0;
- DefineLineInformation; /* TIP #280 */
/* TODO: Consider support for compiling expanded args. */
@@ -3747,13 +3747,13 @@ TclCompileWhileCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation; /* TIP #280 */
Tcl_Token *testTokenPtr, *bodyTokenPtr;
JumpFixup jumpEvalCondFixup;
int testCodeOffset, bodyCodeOffset, jumpDist, range, code, boolVal;
int loopMayEnd = 1; /* This is set to 0 if it is recognized as an
* infinite loop. */
Tcl_Obj *boolObj;
- DefineLineInformation; /* TIP #280 */
if (parsePtr->numWords != 3) {
return TCL_ERROR;
@@ -4009,8 +4009,8 @@ CompileUnaryOpCmd(
int instruction,
CompileEnv *envPtr)
{
- Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
if (parsePtr->numWords != 2) {
return TCL_ERROR;
@@ -4051,8 +4051,8 @@ CompileAssociativeBinaryOpCmd(
int instruction,
CompileEnv *envPtr)
{
- Tcl_Token *tokenPtr = parsePtr->tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int words;
/* TODO: Consider support for compiling expanded args. */
@@ -4136,8 +4136,8 @@ CompileComparisonOpCmd(
int instruction,
CompileEnv *envPtr)
{
- Tcl_Token *tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr;
/* TODO: Consider support for compiling expanded args. */
if (parsePtr->numWords < 3) {
@@ -4290,15 +4290,15 @@ TclCompilePowOpCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
+ DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr = parsePtr->tokenPtr;
+ int words;
+
/*
* This one has its own implementation because the ** operator is the only
* one with right associativity.
*/
- Tcl_Token *tokenPtr = parsePtr->tokenPtr;
- DefineLineInformation; /* TIP #280 */
- int words;
-
for (words=1 ; words<parsePtr->numWords ; words++) {
tokenPtr = TokenAfter(tokenPtr);
CompileWord(envPtr, tokenPtr, interp, words);
@@ -4491,8 +4491,8 @@ TclCompileMinusOpCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
- Tcl_Token *tokenPtr = parsePtr->tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int words;
/* TODO: Consider support for compiling expanded args. */
@@ -4536,8 +4536,8 @@ TclCompileDivOpCmd(
TCL_UNUSED(Command *),
CompileEnv *envPtr)
{
- Tcl_Token *tokenPtr = parsePtr->tokenPtr;
DefineLineInformation; /* TIP #280 */
+ Tcl_Token *tokenPtr = parsePtr->tokenPtr;
int words;
/* TODO: Consider support for compiling expanded args. */
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 4fb41fc..74610c7 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2725,7 +2725,7 @@ TclVariadicOpCmd(
Tcl_Obj *const *litObjPtrPtr = litObjv;
if (lexeme == EXPON) {
- litObjv[1] = Tcl_NewIntObj(occdPtr->i.identity);
+ TclNewIntObj(litObjv[1], occdPtr->i.identity);
Tcl_IncrRefCount(litObjv[1]);
decrMe = 1;
litObjv[0] = objv[1];
@@ -2741,7 +2741,7 @@ TclVariadicOpCmd(
if (lexeme == DIVIDE) {
litObjv[0] = Tcl_NewDoubleObj(1.0);
} else {
- litObjv[0] = Tcl_NewIntObj(occdPtr->i.identity);
+ TclNewIntObj(litObjv[0], occdPtr->i.identity);
}
Tcl_IncrRefCount(litObjv[0]);
litObjv[1] = objv[1];
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 5d4555e..7d67e12 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -848,7 +848,7 @@ TclSetByteCodeFromAny(
* faster code in some cases, and more compact code in more.
*/
- if (Tcl_GetMaster(interp) == NULL &&
+ if (Tcl_GetParent(interp) == NULL &&
!Tcl_LimitTypeEnabled(interp, TCL_LIMIT_COMMANDS|TCL_LIMIT_TIME)
&& IsCompactibleCompileEnv(&compEnv)) {
TclFreeCompileEnv(&compEnv);
@@ -1834,7 +1834,7 @@ CompileCmdLiteral(
bytes = TclGetStringFromObj(cmdObj, &numBytes);
cmdLitIdx = TclRegisterLiteral(envPtr, bytes, numBytes, extraLiteralFlags);
- if (cmdPtr) {
+ if (cmdPtr && TclRoutineHasName(cmdPtr)) {
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr);
}
TclEmitPush(cmdLitIdx, envPtr);
@@ -1848,8 +1848,8 @@ TclCompileInvocation(
int numWords,
CompileEnv *envPtr)
{
- int wordIdx = 0, depth = TclGetStackDepth(envPtr);
DefineLineInformation;
+ int wordIdx = 0, depth = TclGetStackDepth(envPtr);
if (cmdObj) {
CompileCmdLiteral(interp, cmdObj, envPtr);
@@ -1892,8 +1892,8 @@ CompileExpanded(
int numWords,
CompileEnv *envPtr)
{
- int wordIdx = 0;
DefineLineInformation;
+ int wordIdx = 0;
int depth = TclGetStackDepth(envPtr);
StartExpanding(envPtr);
@@ -1951,8 +1951,8 @@ CompileCmdCompileProc(
Command *cmdPtr,
CompileEnv *envPtr)
{
- int unwind = 0, incrOffset = -1;
DefineLineInformation;
+ int unwind = 0, incrOffset = -1;
int depth = TclGetStackDepth(envPtr);
/*
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index 5e39a21..21a27f7 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -927,7 +927,7 @@ typedef enum InstStringClassType {
} InstStringClassType;
typedef struct StringClassDesc {
- const char *name; /* Name of the class. */
+ char name[8]; /* Name of the class. */
int (*comparator)(int); /* Function to test if a single unicode
* character is a member of the class. */
} StringClassDesc;
@@ -991,7 +991,7 @@ typedef struct JumpFixupArray {
typedef struct ForeachVarList {
int numVars; /* The number of variables in the list. */
- int varIndexes[1]; /* An array of the indexes ("slot numbers")
+ int varIndexes[TCLFLEXARRAY];/* An array of the indexes ("slot numbers")
* for each variable in the procedure's array
* of local variables. Only scalar variables
* are supported. The actual size of this
@@ -1015,7 +1015,7 @@ typedef struct ForeachInfo {
* the loop's iteration count. Used to
* determine next value list element to assign
* each loop var. */
- ForeachVarList *varLists[1];/* An array of pointers to ForeachVarList
+ ForeachVarList *varLists[TCLFLEXARRAY];/* An array of pointers to ForeachVarList
* structures describing each var list. The
* actual size of this field will be large
* enough to numVars indexes. THIS MUST BE THE
@@ -1046,7 +1046,7 @@ MODULE_SCOPE const AuxDataType tclJumptableInfoType;
typedef struct {
int length; /* Size of array */
- int varIndices[1]; /* Array of variable indices to manage when
+ int varIndices[TCLFLEXARRAY]; /* Array of variable indices to manage when
* processing the start and end of a [dict
* update]. There is really more than one
* entry, and the structure is allocated to
diff --git a/generic/tclDate.c b/generic/tclDate.c
index 294d4fe..f8552a3 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -102,9 +102,6 @@ typedef enum _MERIDIAN {
MERam, MERpm, MER24
} MERIDIAN;
-
-
-
/*
* yyparse will accept a 'struct DateInfo' as its parameter; that's where the
* parsed fields will be returned.
@@ -210,6 +207,9 @@ typedef enum _DSTMODE {
DSTon, DSToff, DSTmaybe
} DSTMODE;
+
+
+
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
@@ -560,7 +560,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 79
+#define YYLAST 81
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 26
@@ -569,7 +569,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 56
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 83
+#define YYNSTATES 85
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
@@ -587,7 +587,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 25, 22, 21, 24, 23, 2, 2,
+ 2, 2, 2, 25, 21, 23, 24, 22, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 20, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -618,11 +618,11 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyrline[] =
{
0, 223, 223, 224, 227, 230, 233, 236, 239, 242,
- 245, 249, 254, 257, 263, 269, 277, 283, 294, 298,
- 302, 308, 312, 316, 320, 324, 330, 334, 339, 344,
- 349, 354, 358, 363, 367, 372, 379, 383, 389, 398,
- 407, 417, 431, 436, 439, 442, 445, 448, 451, 456,
- 459, 464, 468, 472, 478, 496, 499
+ 245, 249, 254, 257, 263, 269, 277, 282, 287, 291,
+ 297, 301, 305, 309, 313, 319, 323, 328, 333, 338,
+ 343, 347, 352, 356, 361, 368, 372, 378, 388, 397,
+ 406, 416, 430, 435, 438, 441, 444, 447, 450, 455,
+ 458, 463, 467, 471, 477, 495, 498
};
#endif
@@ -634,7 +634,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID",
"tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT",
"tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", "tISOBASE",
- "tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'", "'+'",
+ "tDAY_UNIT", "tNEXT", "':'", "','", "'/'", "'-'", "'.'", "'+'",
"$accept", "spec", "item", "time", "zone", "day", "date", "ordMonth",
"iso", "trek", "relspec", "relunits", "sign", "unit", "number",
"o_merid", YY_NULLPTR
@@ -648,14 +648,14 @@ static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 58, 45, 44, 47, 46, 43
+ 58, 44, 47, 45, 46, 43
};
# endif
-#define YYPACT_NINF -22
+#define YYPACT_NINF -18
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-22)))
+ (!!((Yystate) == (-18)))
#define YYTABLE_NINF -1
@@ -666,15 +666,15 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int8 yypact[] =
{
- -22, 2, -22, -21, -22, -4, -22, 1, -22, 22,
- 18, -22, 8, -22, 40, -22, -22, -22, -22, -22,
- -22, -22, -22, -22, -22, -22, 32, 28, -22, -22,
- -22, 24, 26, -22, -22, 42, 47, -5, 49, -22,
- -22, 15, -22, -22, -22, 48, -22, -22, 43, 50,
- 51, -22, 17, 44, 46, 45, 52, -22, -22, -22,
- -22, -22, -22, -22, -22, 56, 57, -22, 58, 60,
- 61, 62, -3, -22, -22, -22, -22, 59, 63, -22,
- 64, -22, -22
+ -18, 2, -18, -17, -18, -4, -18, 10, -18, 22,
+ 8, -18, 18, -18, 39, -18, -18, -18, -18, -18,
+ -18, -18, -18, -18, -18, -18, 25, 21, -18, -18,
+ -18, 16, 14, -18, -18, 28, 36, 41, -5, -18,
+ -18, 5, -18, -18, -18, 47, -18, -18, 42, 46,
+ 48, -18, -6, 40, 43, 44, 49, -18, -18, -18,
+ -18, -18, -18, -18, -18, 50, -18, 51, 55, 57,
+ 58, 65, -18, -18, 59, 54, -18, 62, 63, 60,
+ -18, 64, 61, 66, -18
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -682,29 +682,29 @@ static const yytype_int8 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 21, 20, 0, 53, 0, 51, 54,
- 19, 34, 28, 52, 0, 49, 50, 3, 4, 5,
+ 2, 0, 1, 20, 18, 0, 53, 0, 51, 54,
+ 17, 33, 27, 52, 0, 49, 50, 3, 4, 5,
8, 6, 7, 10, 11, 9, 43, 0, 48, 12,
- 22, 31, 0, 23, 13, 33, 0, 0, 0, 45,
- 18, 0, 40, 25, 36, 0, 46, 42, 0, 0,
- 0, 35, 55, 0, 0, 26, 0, 38, 37, 47,
- 24, 44, 32, 41, 56, 0, 0, 14, 0, 0,
- 0, 0, 55, 15, 29, 30, 27, 0, 0, 16,
- 0, 17, 39
+ 21, 30, 0, 22, 13, 32, 0, 0, 0, 45,
+ 16, 0, 40, 24, 35, 0, 46, 42, 19, 0,
+ 0, 34, 55, 25, 0, 0, 0, 38, 36, 47,
+ 23, 44, 31, 41, 56, 0, 14, 0, 0, 0,
+ 0, 55, 26, 28, 29, 0, 15, 0, 0, 0,
+ 39, 0, 0, 0, 37
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -22, -22, -22, -22, -22, -22, -22, -22, -22, -22,
- -22, -22, -22, -9, -22, 6
+ -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
+ -18, -18, -18, -9, -18, 7
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 1, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 67
+ 25, 26, 27, 28, 29, 66
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -712,26 +712,28 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
- 39, 30, 2, 53, 64, 46, 3, 4, 54, 31,
- 5, 6, 7, 8, 32, 9, 10, 11, 78, 12,
- 13, 14, 41, 15, 64, 42, 33, 16, 56, 34,
- 35, 6, 57, 8, 40, 47, 59, 65, 66, 61,
- 13, 48, 36, 37, 43, 38, 49, 60, 44, 6,
- 50, 8, 6, 45, 8, 51, 58, 6, 13, 8,
- 52, 13, 55, 62, 63, 68, 13, 69, 70, 72,
- 73, 74, 71, 75, 76, 77, 81, 82, 79, 80
+ 39, 64, 2, 54, 30, 46, 3, 4, 55, 31,
+ 5, 6, 7, 8, 65, 9, 10, 11, 56, 12,
+ 13, 14, 57, 32, 40, 15, 33, 16, 47, 34,
+ 35, 6, 41, 8, 48, 42, 59, 49, 50, 61,
+ 13, 51, 36, 43, 37, 38, 60, 44, 6, 52,
+ 8, 6, 45, 8, 53, 58, 6, 13, 8, 62,
+ 13, 63, 67, 71, 72, 13, 68, 69, 73, 70,
+ 74, 75, 64, 77, 78, 79, 80, 82, 76, 84,
+ 81, 83
};
static const yytype_uint8 yycheck[] =
{
- 9, 22, 0, 8, 7, 14, 4, 5, 13, 13,
- 8, 9, 10, 11, 13, 13, 14, 15, 21, 17,
- 18, 19, 14, 21, 7, 17, 4, 25, 13, 7,
- 8, 9, 17, 11, 16, 3, 45, 20, 21, 48,
- 18, 13, 20, 21, 4, 23, 22, 4, 8, 9,
- 24, 11, 9, 13, 11, 13, 8, 9, 18, 11,
- 13, 18, 13, 13, 13, 21, 18, 21, 23, 13,
- 13, 13, 20, 13, 13, 13, 13, 13, 72, 20
+ 9, 7, 0, 8, 21, 14, 4, 5, 13, 13,
+ 8, 9, 10, 11, 20, 13, 14, 15, 13, 17,
+ 18, 19, 17, 13, 16, 23, 4, 25, 3, 7,
+ 8, 9, 14, 11, 13, 17, 45, 21, 24, 48,
+ 18, 13, 20, 4, 22, 23, 4, 8, 9, 13,
+ 11, 9, 13, 11, 13, 8, 9, 18, 11, 13,
+ 18, 13, 22, 13, 13, 18, 23, 23, 13, 20,
+ 13, 13, 7, 14, 20, 13, 13, 13, 71, 13,
+ 20, 20
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -739,23 +741,23 @@ static const yytype_uint8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 27, 0, 4, 5, 8, 9, 10, 11, 13,
- 14, 15, 17, 18, 19, 21, 25, 28, 29, 30,
+ 14, 15, 17, 18, 19, 23, 25, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 22, 13, 13, 4, 7, 8, 20, 21, 23, 39,
- 16, 14, 17, 4, 8, 13, 39, 3, 13, 22,
- 24, 13, 13, 8, 13, 13, 13, 17, 8, 39,
- 4, 39, 13, 13, 7, 20, 21, 41, 21, 21,
- 23, 20, 13, 13, 13, 13, 13, 13, 21, 41,
- 20, 13, 13
+ 21, 13, 13, 4, 7, 8, 20, 22, 23, 39,
+ 16, 14, 17, 4, 8, 13, 39, 3, 13, 21,
+ 24, 13, 13, 13, 8, 13, 13, 17, 8, 39,
+ 4, 39, 13, 13, 7, 20, 41, 22, 23, 23,
+ 20, 13, 13, 13, 13, 13, 41, 14, 20, 13,
+ 13, 20, 13, 20, 13
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 26, 27, 27, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 29, 29, 29, 29, 29, 30, 30,
- 30, 31, 31, 31, 31, 31, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 33, 33, 34, 34,
+ 28, 28, 28, 29, 29, 29, 30, 30, 30, 30,
+ 31, 31, 31, 31, 31, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 33, 33, 34, 34, 34,
34, 35, 36, 36, 37, 37, 37, 37, 37, 38,
38, 39, 39, 39, 40, 41, 41
};
@@ -764,9 +766,9 @@ static const yytype_uint8 yyr1[] =
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 4, 5, 6, 7, 2, 1,
- 1, 1, 2, 2, 3, 2, 3, 5, 1, 5,
- 5, 2, 4, 2, 1, 3, 2, 3, 3, 7,
+ 1, 1, 1, 2, 4, 6, 2, 1, 1, 2,
+ 1, 2, 2, 3, 2, 3, 5, 1, 5, 5,
+ 2, 4, 2, 1, 3, 2, 3, 11, 3, 7,
2, 4, 2, 1, 3, 2, 2, 3, 1, 1,
1, 1, 1, 1, 1, 0, 1
};
@@ -1639,12 +1641,10 @@ yyreduce:
case 15:
{
- yyHour = (yyvsp[-4].Number);
- yyMinutes = (yyvsp[-2].Number);
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
- ++yyHaveZone;
+ yyHour = (yyvsp[-5].Number);
+ yyMinutes = (yyvsp[-3].Number);
+ yySeconds = (yyvsp[-1].Number);
+ yyMeridian = (yyvsp[0].Meridian);
}
break;
@@ -1652,10 +1652,9 @@ yyreduce:
case 16:
{
- yyHour = (yyvsp[-5].Number);
- yyMinutes = (yyvsp[-3].Number);
- yySeconds = (yyvsp[-1].Number);
- yyMeridian = (yyvsp[0].Meridian);
+ yyTimezone = (yyvsp[-1].Number);
+ if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
+ yyDSTmode = DSTon;
}
break;
@@ -1663,13 +1662,9 @@ yyreduce:
case 17:
{
- yyHour = (yyvsp[-6].Number);
- yyMinutes = (yyvsp[-4].Number);
- yySeconds = (yyvsp[-2].Number);
- yyMeridian = MER24;
+ yyTimezone = (yyvsp[0].Number);
+ if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSToff;
- yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
- ++yyHaveZone;
}
break;
@@ -1677,7 +1672,7 @@ yyreduce:
case 18:
{
- yyTimezone = (yyvsp[-1].Number);
+ yyTimezone = (yyvsp[0].Number);
yyDSTmode = DSTon;
}
@@ -1686,7 +1681,7 @@ yyreduce:
case 19:
{
- yyTimezone = (yyvsp[0].Number);
+ yyTimezone = -(yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
yyDSTmode = DSToff;
}
@@ -1695,22 +1690,13 @@ yyreduce:
case 20:
{
- yyTimezone = (yyvsp[0].Number);
- yyDSTmode = DSTon;
- }
-
- break;
-
- case 21:
-
- {
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[0].Number);
}
break;
- case 22:
+ case 21:
{
yyDayOrdinal = 1;
@@ -1719,7 +1705,7 @@ yyreduce:
break;
- case 23:
+ case 22:
{
yyDayOrdinal = (yyvsp[-1].Number);
@@ -1728,7 +1714,7 @@ yyreduce:
break;
- case 24:
+ case 23:
{
yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number);
@@ -1737,7 +1723,7 @@ yyreduce:
break;
- case 25:
+ case 24:
{
yyDayOrdinal = 2;
@@ -1746,7 +1732,7 @@ yyreduce:
break;
- case 26:
+ case 25:
{
yyMonth = (yyvsp[-2].Number);
@@ -1755,7 +1741,7 @@ yyreduce:
break;
- case 27:
+ case 26:
{
yyMonth = (yyvsp[-4].Number);
@@ -1765,7 +1751,7 @@ yyreduce:
break;
- case 28:
+ case 27:
{
yyYear = (yyvsp[0].Number) / 10000;
@@ -1775,7 +1761,7 @@ yyreduce:
break;
- case 29:
+ case 28:
{
yyDay = (yyvsp[-4].Number);
@@ -1785,7 +1771,7 @@ yyreduce:
break;
- case 30:
+ case 29:
{
yyMonth = (yyvsp[-2].Number);
@@ -1795,7 +1781,7 @@ yyreduce:
break;
- case 31:
+ case 30:
{
yyMonth = (yyvsp[-1].Number);
@@ -1804,7 +1790,7 @@ yyreduce:
break;
- case 32:
+ case 31:
{
yyMonth = (yyvsp[-3].Number);
@@ -1814,7 +1800,7 @@ yyreduce:
break;
- case 33:
+ case 32:
{
yyMonth = (yyvsp[0].Number);
@@ -1823,7 +1809,7 @@ yyreduce:
break;
- case 34:
+ case 33:
{
yyMonth = 1;
@@ -1833,7 +1819,7 @@ yyreduce:
break;
- case 35:
+ case 34:
{
yyMonth = (yyvsp[-1].Number);
@@ -1843,7 +1829,7 @@ yyreduce:
break;
- case 36:
+ case 35:
{
yyMonthOrdinal = 1;
@@ -1852,7 +1838,7 @@ yyreduce:
break;
- case 37:
+ case 36:
{
yyMonthOrdinal = (yyvsp[-1].Number);
@@ -1861,10 +1847,24 @@ yyreduce:
break;
+ case 37:
+
+ {
+ if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT;
+ yyYear = (yyvsp[-10].Number);
+ yyMonth = (yyvsp[-8].Number);
+ yyDay = (yyvsp[-6].Number);
+ yyHour = (yyvsp[-4].Number);
+ yyMinutes = (yyvsp[-2].Number);
+ yySeconds = (yyvsp[0].Number);
+ }
+
+ break;
+
case 38:
{
- if ((yyvsp[-1].Number) != HOUR( 7)) YYABORT;
+ if ((yyvsp[-1].Number) != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = (yyvsp[-2].Number) / 10000;
yyMonth = ((yyvsp[-2].Number) % 10000)/100;
yyDay = (yyvsp[-2].Number) % 100;
@@ -1878,7 +1878,7 @@ yyreduce:
case 39:
{
- if ((yyvsp[-5].Number) != HOUR( 7)) YYABORT;
+ if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = (yyvsp[-6].Number) / 10000;
yyMonth = ((yyvsp[-6].Number) % 10000)/100;
yyDay = (yyvsp[-6].Number) % 100;
@@ -2459,31 +2459,31 @@ static const TABLE TimezoneTable[] = {
*/
static const TABLE MilitaryTable[] = {
- { "a", tZONE, -HOUR( 1) },
- { "b", tZONE, -HOUR( 2) },
- { "c", tZONE, -HOUR( 3) },
- { "d", tZONE, -HOUR( 4) },
- { "e", tZONE, -HOUR( 5) },
- { "f", tZONE, -HOUR( 6) },
- { "g", tZONE, -HOUR( 7) },
- { "h", tZONE, -HOUR( 8) },
- { "i", tZONE, -HOUR( 9) },
- { "k", tZONE, -HOUR(10) },
- { "l", tZONE, -HOUR(11) },
- { "m", tZONE, -HOUR(12) },
- { "n", tZONE, HOUR( 1) },
- { "o", tZONE, HOUR( 2) },
- { "p", tZONE, HOUR( 3) },
- { "q", tZONE, HOUR( 4) },
- { "r", tZONE, HOUR( 5) },
- { "s", tZONE, HOUR( 6) },
- { "t", tZONE, HOUR( 7) },
- { "u", tZONE, HOUR( 8) },
- { "v", tZONE, HOUR( 9) },
- { "w", tZONE, HOUR( 10) },
- { "x", tZONE, HOUR( 11) },
- { "y", tZONE, HOUR( 12) },
- { "z", tZONE, HOUR( 0) },
+ { "a", tZONE, -HOUR( 1) + HOUR(100) },
+ { "b", tZONE, -HOUR( 2) + HOUR(100) },
+ { "c", tZONE, -HOUR( 3) + HOUR(100) },
+ { "d", tZONE, -HOUR( 4) + HOUR(100) },
+ { "e", tZONE, -HOUR( 5) + HOUR(100) },
+ { "f", tZONE, -HOUR( 6) + HOUR(100) },
+ { "g", tZONE, -HOUR( 7) + HOUR(100) },
+ { "h", tZONE, -HOUR( 8) + HOUR(100) },
+ { "i", tZONE, -HOUR( 9) + HOUR(100) },
+ { "k", tZONE, -HOUR(10) + HOUR(100) },
+ { "l", tZONE, -HOUR(11) + HOUR(100) },
+ { "m", tZONE, -HOUR(12) + HOUR(100) },
+ { "n", tZONE, HOUR( 1) + HOUR(100) },
+ { "o", tZONE, HOUR( 2) + HOUR(100) },
+ { "p", tZONE, HOUR( 3) + HOUR(100) },
+ { "q", tZONE, HOUR( 4) + HOUR(100) },
+ { "r", tZONE, HOUR( 5) + HOUR(100) },
+ { "s", tZONE, HOUR( 6) + HOUR(100) },
+ { "t", tZONE, HOUR( 7) + HOUR(100) },
+ { "u", tZONE, HOUR( 8) + HOUR(100) },
+ { "v", tZONE, HOUR( 9) + HOUR(100) },
+ { "w", tZONE, HOUR( 10) + HOUR(100) },
+ { "x", tZONE, HOUR( 11) + HOUR(100) },
+ { "y", tZONE, HOUR( 12) + HOUR(100) },
+ { "z", tZONE, HOUR( 0) + HOUR(100) },
{ NULL, 0, 0 }
};
@@ -2501,12 +2501,12 @@ TclDateerror(
Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, -1);
Tcl_AppendToObj(infoPtr->messages, s, -1);
Tcl_AppendToObj(infoPtr->messages, " (characters ", -1);
- t = Tcl_NewIntObj(location->first_column);
+ TclNewIntObj(t, location->first_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
Tcl_AppendToObj(infoPtr->messages, "-", -1);
- t = Tcl_NewIntObj(location->last_column);
+ TclNewIntObj(t, location->last_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
@@ -2744,7 +2744,7 @@ TclDatelex(
int
TclClockOldscanObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Count of paraneters */
Tcl_Obj *const *objv) /* Parameters */
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 99992c9..57c1ca7 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -300,13 +300,13 @@ EXTERN int Tcl_ConvertElement(const char *src, char *dst,
EXTERN int Tcl_ConvertCountedElement(const char *src,
int length, char *dst, int flags);
/* 86 */
-EXTERN int Tcl_CreateAlias(Tcl_Interp *slave,
- const char *slaveCmd, Tcl_Interp *target,
+EXTERN int Tcl_CreateAlias(Tcl_Interp *childInterp,
+ const char *childCmd, Tcl_Interp *target,
const char *targetCmd, int argc,
const char *const *argv);
/* 87 */
-EXTERN int Tcl_CreateAliasObj(Tcl_Interp *slave,
- const char *slaveCmd, Tcl_Interp *target,
+EXTERN int Tcl_CreateAliasObj(Tcl_Interp *childInterp,
+ const char *childCmd, Tcl_Interp *target,
const char *targetCmd, int objc,
Tcl_Obj *const objv[]);
/* 88 */
@@ -345,8 +345,8 @@ EXTERN Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp,
ClientData clientData,
Tcl_CmdDeleteProc *deleteProc);
/* 97 */
-EXTERN Tcl_Interp * Tcl_CreateSlave(Tcl_Interp *interp,
- const char *slaveName, int isSafe);
+EXTERN Tcl_Interp * Tcl_CreateChild(Tcl_Interp *interp, const char *name,
+ int isSafe);
/* 98 */
EXTERN Tcl_TimerToken Tcl_CreateTimerHandler(int milliseconds,
Tcl_TimerProc *proc, ClientData clientData);
@@ -482,13 +482,13 @@ TCL_DEPRECATED("see TIP #559. Use Tcl_ResetResult")
void Tcl_FreeResult(Tcl_Interp *interp);
/* 148 */
EXTERN int Tcl_GetAlias(Tcl_Interp *interp,
- const char *slaveCmd,
+ const char *childCmd,
Tcl_Interp **targetInterpPtr,
const char **targetCmdPtr, int *argcPtr,
const char ***argvPtr);
/* 149 */
EXTERN int Tcl_GetAliasObj(Tcl_Interp *interp,
- const char *slaveCmd,
+ const char *childCmd,
Tcl_Interp **targetInterpPtr,
const char **targetCmdPtr, int *objcPtr,
Tcl_Obj ***objv);
@@ -527,10 +527,10 @@ EXTERN int Tcl_GetErrno(void);
/* 162 */
EXTERN const char * Tcl_GetHostName(void);
/* 163 */
-EXTERN int Tcl_GetInterpPath(Tcl_Interp *askInterp,
- Tcl_Interp *slaveInterp);
+EXTERN int Tcl_GetInterpPath(Tcl_Interp *interp,
+ Tcl_Interp *childInterp);
/* 164 */
-EXTERN Tcl_Interp * Tcl_GetMaster(Tcl_Interp *interp);
+EXTERN Tcl_Interp * Tcl_GetParent(Tcl_Interp *interp);
/* 165 */
EXTERN const char * Tcl_GetNameOfExecutable(void);
/* 166 */
@@ -556,8 +556,7 @@ EXTERN int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr);
/* 171 */
EXTERN int Tcl_GetServiceMode(void);
/* 172 */
-EXTERN Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp,
- const char *slaveName);
+EXTERN Tcl_Interp * Tcl_GetChild(Tcl_Interp *interp, const char *name);
/* 173 */
EXTERN Tcl_Channel Tcl_GetStdChannel(int type);
/* 174 */
@@ -2037,8 +2036,8 @@ typedef struct TclStubs {
char * (*tcl_Concat) (int argc, const char *const *argv); /* 83 */
int (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */
int (*tcl_ConvertCountedElement) (const char *src, int length, char *dst, int flags); /* 85 */
- int (*tcl_CreateAlias) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, const char *const *argv); /* 86 */
- int (*tcl_CreateAliasObj) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int objc, Tcl_Obj *const objv[]); /* 87 */
+ int (*tcl_CreateAlias) (Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, const char *targetCmd, int argc, const char *const *argv); /* 86 */
+ int (*tcl_CreateAliasObj) (Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, const char *targetCmd, int objc, Tcl_Obj *const objv[]); /* 87 */
Tcl_Channel (*tcl_CreateChannel) (const Tcl_ChannelType *typePtr, const char *chanName, ClientData instanceData, int mask); /* 88 */
void (*tcl_CreateChannelHandler) (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, ClientData clientData); /* 89 */
void (*tcl_CreateCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData); /* 90 */
@@ -2048,7 +2047,7 @@ typedef struct TclStubs {
Tcl_Interp * (*tcl_CreateInterp) (void); /* 94 */
TCL_DEPRECATED_API("") void (*tcl_CreateMathFunc) (Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData); /* 95 */
Tcl_Command (*tcl_CreateObjCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 96 */
- Tcl_Interp * (*tcl_CreateSlave) (Tcl_Interp *interp, const char *slaveName, int isSafe); /* 97 */
+ Tcl_Interp * (*tcl_CreateChild) (Tcl_Interp *interp, const char *name, int isSafe); /* 97 */
Tcl_TimerToken (*tcl_CreateTimerHandler) (int milliseconds, Tcl_TimerProc *proc, ClientData clientData); /* 98 */
Tcl_Trace (*tcl_CreateTrace) (Tcl_Interp *interp, int level, Tcl_CmdTraceProc *proc, ClientData clientData); /* 99 */
void (*tcl_DeleteAssocData) (Tcl_Interp *interp, const char *name); /* 100 */
@@ -2099,8 +2098,8 @@ typedef struct TclStubs {
Tcl_HashEntry * (*tcl_FirstHashEntry) (Tcl_HashTable *tablePtr, Tcl_HashSearch *searchPtr); /* 145 */
int (*tcl_Flush) (Tcl_Channel chan); /* 146 */
TCL_DEPRECATED_API("see TIP #559. Use Tcl_ResetResult") void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */
- int (*tcl_GetAlias) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *argcPtr, const char ***argvPtr); /* 148 */
- int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */
+ int (*tcl_GetAlias) (Tcl_Interp *interp, const char *childCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *argcPtr, const char ***argvPtr); /* 148 */
+ int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *childCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */
ClientData (*tcl_GetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc **procPtr); /* 150 */
Tcl_Channel (*tcl_GetChannel) (Tcl_Interp *interp, const char *chanName, int *modePtr); /* 151 */
int (*tcl_GetChannelBufferSize) (Tcl_Channel chan); /* 152 */
@@ -2114,8 +2113,8 @@ typedef struct TclStubs {
const char * (*tcl_GetCommandName) (Tcl_Interp *interp, Tcl_Command command); /* 160 */
int (*tcl_GetErrno) (void); /* 161 */
const char * (*tcl_GetHostName) (void); /* 162 */
- int (*tcl_GetInterpPath) (Tcl_Interp *askInterp, Tcl_Interp *slaveInterp); /* 163 */
- Tcl_Interp * (*tcl_GetMaster) (Tcl_Interp *interp); /* 164 */
+ int (*tcl_GetInterpPath) (Tcl_Interp *interp, Tcl_Interp *childInterp); /* 163 */
+ Tcl_Interp * (*tcl_GetParent) (Tcl_Interp *interp); /* 164 */
const char * (*tcl_GetNameOfExecutable) (void); /* 165 */
Tcl_Obj * (*tcl_GetObjResult) (Tcl_Interp *interp); /* 166 */
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
@@ -2131,7 +2130,7 @@ typedef struct TclStubs {
int (*tcl_Gets) (Tcl_Channel chan, Tcl_DString *dsPtr); /* 169 */
int (*tcl_GetsObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 170 */
int (*tcl_GetServiceMode) (void); /* 171 */
- Tcl_Interp * (*tcl_GetSlave) (Tcl_Interp *interp, const char *slaveName); /* 172 */
+ Tcl_Interp * (*tcl_GetChild) (Tcl_Interp *interp, const char *name); /* 172 */
Tcl_Channel (*tcl_GetStdChannel) (int type); /* 173 */
const char * (*tcl_GetStringResult) (Tcl_Interp *interp); /* 174 */
TCL_DEPRECATED_API("No longer in use, changed to macro") const char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */
@@ -2829,8 +2828,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_CreateMathFunc) /* 95 */
#define Tcl_CreateObjCommand \
(tclStubsPtr->tcl_CreateObjCommand) /* 96 */
-#define Tcl_CreateSlave \
- (tclStubsPtr->tcl_CreateSlave) /* 97 */
+#define Tcl_CreateChild \
+ (tclStubsPtr->tcl_CreateChild) /* 97 */
#define Tcl_CreateTimerHandler \
(tclStubsPtr->tcl_CreateTimerHandler) /* 98 */
#define Tcl_CreateTrace \
@@ -2963,8 +2962,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetHostName) /* 162 */
#define Tcl_GetInterpPath \
(tclStubsPtr->tcl_GetInterpPath) /* 163 */
-#define Tcl_GetMaster \
- (tclStubsPtr->tcl_GetMaster) /* 164 */
+#define Tcl_GetParent \
+ (tclStubsPtr->tcl_GetParent) /* 164 */
#define Tcl_GetNameOfExecutable \
(tclStubsPtr->tcl_GetNameOfExecutable) /* 165 */
#define Tcl_GetObjResult \
@@ -2985,8 +2984,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetsObj) /* 170 */
#define Tcl_GetServiceMode \
(tclStubsPtr->tcl_GetServiceMode) /* 171 */
-#define Tcl_GetSlave \
- (tclStubsPtr->tcl_GetSlave) /* 172 */
+#define Tcl_GetChild \
+ (tclStubsPtr->tcl_GetChild) /* 172 */
#define Tcl_GetStdChannel \
(tclStubsPtr->tcl_GetStdChannel) /* 173 */
#define Tcl_GetStringResult \
@@ -4187,7 +4186,10 @@ extern const TclStubs *tclStubsPtr;
#if defined(USE_TCL_STUBS) && (TCL_UTF_MAX > 3)
# undef Tcl_UtfCharComplete
# define Tcl_UtfCharComplete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
- ? 4 : tclStubsPtr->tcl_UtfCharComplete((src), (length)))
+ ? ((length) >= 4) : tclStubsPtr->tcl_UtfCharComplete((src), (length)))
#endif
+#define Tcl_CreateSlave Tcl_CreateChild
+#define Tcl_GetSlave Tcl_GetChild
+#define Tcl_GetMaster Tcl_GetParent
#endif /* _TCLDECLS */
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 4789b7f..3efbb74 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -116,7 +116,7 @@ typedef struct {
* entry in this array is 1, otherwise it is
* 0. */
int numSubTables; /* Length of following array. */
- EscapeSubTable subTables[1];/* Information about each EscapeSubTable used
+ EscapeSubTable subTables[TCLFLEXARRAY];/* Information about each EscapeSubTable used
* by this encoding type. The actual size is
* as large as necessary to hold all
* EscapeSubTables. */
@@ -2053,7 +2053,7 @@ LoadEscapeEncoding(
Tcl_DStringFree(&lineString);
}
- size = sizeof(EscapeEncodingData) - sizeof(EscapeSubTable)
+ size = offsetof(EscapeEncodingData, subTables)
+ Tcl_DStringLength(&escapeData);
dataPtr = (EscapeEncodingData *)ckalloc(size);
dataPtr->initLen = strlen(init);
@@ -2300,7 +2300,7 @@ UtfToUtfProc(
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd;
int result, numChars, charLimit = INT_MAX;
- Tcl_UniChar *chPtr = (Tcl_UniChar *) statePtr;
+ int *chPtr = (int *) statePtr;
if (flags & TCL_ENCODING_START) {
*statePtr = 0;
@@ -2321,7 +2321,7 @@ UtfToUtfProc(
dstEnd = dst + dstLen - TCL_UTF_MAX;
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
- if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) {
+ if ((src > srcClose) && (!TclUCS4Complete(src, srcEnd - src))) {
/*
* If there is more string to follow, this will ensure that the
* last UTF-8 character in the source buffer hasn't been cut off.
@@ -2341,6 +2341,7 @@ UtfToUtfProc(
*/
*dst++ = *src++;
+ *chPtr = 0; /* reset surrogate handling */
} else if (pureNullMode == 1 && UCHAR(*src) == 0xC0 &&
(src + 1 < srcEnd) && UCHAR(*(src+1)) == 0x80) {
/*
@@ -2348,24 +2349,25 @@ UtfToUtfProc(
*/
*dst++ = 0;
+ *chPtr = 0; /* reset surrogate handling */
src += 2;
- } else if (!Tcl_UtfCharComplete(src, srcEnd - src)) {
+ } else if (!TclUCS4Complete(src, srcEnd - src)) {
/*
- * Always check before using TclUtfToUniChar. Not doing can so
+ * Always check before using TclUtfToUCS4. Not doing can so
* cause it run beyond the end of the buffer! If we happen such an
* incomplete char its bytes are made to represent themselves.
*/
- *chPtr = (unsigned char) *src;
+ *chPtr = UCHAR(*src);
src += 1;
dst += Tcl_UniCharToUtf(*chPtr, dst);
} else {
- src += TclUtfToUniChar(src, chPtr);
+ src += TclUtfToUCS4(src, chPtr);
if ((*chPtr | 0x7FF) == 0xDFFF) {
/* A surrogate character is detected, handle especially */
- Tcl_UniChar low = *chPtr;
- size_t len = (src <= srcEnd-3) ? Tcl_UtfToUniChar(src, &low) : 0;
- if (((low | 0x3FF) != 0xDFFF) || (*chPtr & 0x400)) {
+ int low = *chPtr;
+ size_t len = (src <= srcEnd-3) ? TclUtfToUCS4(src, &low) : 0;
+ if (((low & ~0x3FF) != 0xDC00) || (*chPtr & 0x400)) {
*dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
*dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
*dst++ = (char) ((*chPtr | 0x80) & 0xBF);
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index b9c71a0..16bf8f7 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -2906,6 +2906,7 @@ TclCompileEnsemble(
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation;
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
Tcl_Obj *mapObj, *subcmdObj, *targetCmdObj, *listObj, **elems;
Tcl_Obj *replaced = Tcl_NewObj(), *replacement;
@@ -2915,7 +2916,6 @@ TclCompileEnsemble(
int ourResult = TCL_ERROR;
unsigned numBytes;
const char *word;
- DefineLineInformation;
Tcl_IncrRefCount(replaced);
if (parsePtr->numWords < depth + 1) {
@@ -3161,7 +3161,7 @@ TclCompileEnsemble(
}
/*
- * Now we've done the mapping process, can now actually try to compile.
+ * Now that the mapping process is done we actually try to compile.
* If there is a subcommand compiler and that successfully produces code,
* we'll use that. Otherwise, we fall back to generating opcodes to do the
* invoke at runtime.
@@ -3244,6 +3244,7 @@ TclAttemptCompileProc(
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation;
int result, i;
Tcl_Token *saveTokenPtr = parsePtr->tokenPtr;
int savedStackDepth = envPtr->currStackDepth;
@@ -3253,7 +3254,6 @@ TclAttemptCompileProc(
#ifdef TCL_COMPILE_DEBUG
int savedExceptDepth = envPtr->exceptDepth;
#endif
- DefineLineInformation;
if (cmdPtr->compileProc == NULL) {
return TCL_ERROR;
@@ -3261,9 +3261,9 @@ TclAttemptCompileProc(
/*
* Advance parsePtr->tokenPtr so that it points at the last subcommand.
- * This will be wrong, but it will not matter, and it will put the
- * tokens for the arguments in the right place without the needed to
- * allocate a synthetic Tcl_Parse struct, or copy tokens around.
+ * This will be wrong but it will not matter, and it will put the
+ * tokens for the arguments in the right place without the need to
+ * allocate a synthetic Tcl_Parse struct or copy tokens around.
*/
for (i = 0; i < depth - 1; i++) {
@@ -3377,11 +3377,11 @@ CompileToInvokedCommand(
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
+ DefineLineInformation;
Tcl_Token *tokPtr;
Tcl_Obj *objPtr, **words;
const char *bytes;
int i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME;
- DefineLineInformation;
/*
* Push the words of the command. Take care; the command words may be
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index bc4f675..96d050d 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -127,6 +127,17 @@ TclSetupEnv(
/*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr);
TclFindArrayPtrElements(varPtr, &namesHash);
+#if defined(_WIN32)
+ if (tenviron == NULL) {
+ /*
+ * When we are started from main(), the _wenviron array could
+ * be NULL and will be initialized by the first _wgetenv() call.
+ */
+
+ (void) _wgetenv(L"WINDIR");
+ }
+#endif
+
/*
* Go through the environment array and transfer its values into Tcl. At
* the same time, remove those elements we add/update from the hash table
diff --git a/generic/tclEvent.c b/generic/tclEvent.c
index db1f59a..a6d2234 100644
--- a/generic/tclEvent.c
+++ b/generic/tclEvent.c
@@ -311,7 +311,7 @@ HandleBgErrors(
int
TclDefaultBgErrorHandlerObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1046,7 +1046,7 @@ Tcl_InitSubsystems(void)
* implementation of self-initializing locks.
*/
- TclInitThreadStorage(); /* Creates master hash table for
+ TclInitThreadStorage(); /* Creates hash table for
* thread local storage */
#if USE_TCLALLOC
TclInitAlloc(); /* Process wide mutex init */
@@ -1163,7 +1163,7 @@ Tcl_Finalize(void)
TclFinalizeFilesystem();
/*
- * Undo all Tcl_ObjType registrations, and reset the master list of free
+ * Undo all Tcl_ObjType registrations, and reset the global list of free
* Tcl_Obj's. After this returns, no more Tcl_Obj's should be allocated or
* freed.
*
@@ -1398,7 +1398,7 @@ TclInThreadExit(void)
int
Tcl_VwaitObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1494,7 +1494,7 @@ VwaitVarProc(
int
Tcl_UpdateObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 5708772..09fda64 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -855,8 +855,8 @@ TclCreateExecEnv(
* [sizeof(Tcl_Obj*)] */
{
ExecEnv *eePtr = (ExecEnv *)ckalloc(sizeof(ExecEnv));
- ExecStack *esPtr = (ExecStack *)ckalloc(sizeof(ExecStack)
- + (size_t) (size-1) * sizeof(Tcl_Obj *));
+ ExecStack *esPtr = (ExecStack *)ckalloc(offsetof(ExecStack, stackWords)
+ + size * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
TclNewIntObj(eePtr->constants[0], 0);
@@ -1121,7 +1121,7 @@ GrowEvaluationStack(
newElems = needed;
#endif
- newBytes = sizeof(ExecStack) + (newElems-1) * sizeof(Tcl_Obj *);
+ newBytes = offsetof(ExecStack, stackWords) + newElems * sizeof(Tcl_Obj *);
oldPtr = esPtr;
esPtr = (ExecStack *)ckalloc(newBytes);
@@ -2130,6 +2130,22 @@ TEBCresume(
if (!pc) {
/* bytecode is starting from scratch */
pc = codePtr->codeStart;
+
+ /*
+ * Reset the interp's result to avoid possible duplications of large
+ * objects [3c6e47363e], [781585], [804681], This can happen by start
+ * also in nested compiled blocks (enclosed in parent cycle).
+ * See else branch below for opposite handling by continuation/resume.
+ */
+
+ objPtr = iPtr->objResultPtr;
+ if (objPtr->refCount > 1) {
+ TclDecrRefCount(objPtr);
+ TclNewObj(objPtr);
+ Tcl_IncrRefCount(objPtr);
+ iPtr->objResultPtr = objPtr;
+ }
+
goto cleanup0;
} else {
/* resume from invocation */
@@ -2169,7 +2185,7 @@ TEBCresume(
objc, cmdNameBuf), Tcl_GetObjResult(interp));
/*
- * Reset the interp's result to avoid possible duplications of large
+ * Obtain and reset interp's result to avoid possible duplications of
* objects [Bug 781585]. We do not call Tcl_ResetResult to avoid any
* side effects caused by the resetting of errorInfo and errorCode
* [Bug 804681], which are not needed here. We chose instead to
@@ -3619,7 +3635,7 @@ TEBCresume(
case INST_INCR_SCALAR_STK_IMM:
case INST_INCR_STK_IMM:
increment = TclGetInt1AtPtr(pc+1);
- incrPtr = Tcl_NewIntObj(increment);
+ TclNewIntObj(incrPtr, increment);
Tcl_IncrRefCount(incrPtr);
pcAdjustment = 2;
@@ -3654,7 +3670,7 @@ TEBCresume(
case INST_INCR_ARRAY1_IMM:
opnd = TclGetUInt1AtPtr(pc+1);
increment = TclGetInt1AtPtr(pc+2);
- incrPtr = Tcl_NewIntObj(increment);
+ TclNewIntObj(incrPtr, increment);
Tcl_IncrRefCount(incrPtr);
pcAdjustment = 3;
@@ -4448,7 +4464,7 @@ TEBCresume(
CoroutineData *corPtr = iPtr->execEnvPtr->corPtr;
TclNewObj(objResultPtr);
- if (corPtr && !(corPtr->cmdPtr->flags & CMD_IS_DELETED)) {
+ if (corPtr && !(corPtr->cmdPtr->flags & CMD_DYING)) {
Tcl_GetCommandFullName(interp, (Tcl_Command) corPtr->cmdPtr,
objResultPtr);
}
@@ -4508,6 +4524,18 @@ TEBCresume(
TRACE(("\"%.30s\" => ", O2S(OBJ_AT_TOS)));
cmd = Tcl_GetCommandFromObj(interp, OBJ_AT_TOS);
if (cmd == NULL) {
+ goto instOriginError;
+ }
+ origCmd = TclGetOriginalCommand(cmd);
+ if (origCmd == NULL) {
+ origCmd = cmd;
+ }
+
+ TclNewObj(objResultPtr);
+ Tcl_GetCommandFullName(interp, origCmd, objResultPtr);
+ if (TclCheckEmptyString(objResultPtr) == TCL_EMPTYSTRING_YES ) {
+ Tcl_DecrRefCount(objResultPtr);
+ instOriginError:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid command name \"%s\"", TclGetString(OBJ_AT_TOS)));
DECACHE_STACK_INFO();
@@ -4517,12 +4545,6 @@ TEBCresume(
TRACE_APPEND(("ERROR: not command\n"));
goto gotError;
}
- origCmd = TclGetOriginalCommand(cmd);
- if (origCmd == NULL) {
- origCmd = cmd;
- }
- TclNewObj(objResultPtr);
- Tcl_GetCommandFullName(interp, origCmd, objResultPtr);
TRACE_APPEND(("\"%.30s\"", O2S(OBJ_AT_TOS)));
NEXT_INST_F(1, 1, 1);
}
@@ -4841,13 +4863,19 @@ TEBCresume(
*/
if ((TclListObjGetElements(interp, valuePtr, &objc, &objv) == TCL_OK)
- && !TclHasIntRep(value2Ptr, &tclListType)
- && (TclGetIntForIndexM(NULL, value2Ptr, objc-1,
- &index) == TCL_OK)) {
- TclDecrRefCount(value2Ptr);
- tosPtr--;
- pcAdjustment = 1;
- goto lindexFastPath;
+ && !TclHasIntRep(value2Ptr, &tclListType)) {
+ int code;
+
+ DECACHE_STACK_INFO();
+ code = TclGetIntForIndexM(interp, value2Ptr, objc-1, &index);
+ CACHE_STACK_INFO();
+ if (code == TCL_OK) {
+ TclDecrRefCount(value2Ptr);
+ tosPtr--;
+ pcAdjustment = 1;
+ goto lindexFastPath;
+ }
+ Tcl_ResetResult(interp);
}
objResultPtr = TclLindexList(interp, valuePtr, value2Ptr);
@@ -5282,10 +5310,13 @@ TEBCresume(
*/
length = Tcl_GetCharLength(valuePtr);
+ DECACHE_STACK_INFO();
if (TclGetIntForIndexM(interp, value2Ptr, length-1, &index)!=TCL_OK) {
+ CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
}
+ CACHE_STACK_INFO();
if ((index < 0) || (index >= length)) {
TclNewObj(objResultPtr);
@@ -5322,13 +5353,21 @@ TEBCresume(
TRACE(("\"%.20s\" %.20s %.20s =>",
O2S(OBJ_AT_DEPTH(2)), O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS)));
length = Tcl_GetCharLength(OBJ_AT_DEPTH(2)) - 1;
+
+ DECACHE_STACK_INFO();
if (TclGetIntForIndexM(interp, OBJ_UNDER_TOS, length,
- &fromIdx) != TCL_OK
- || TclGetIntForIndexM(interp, OBJ_AT_TOS, length,
+ &fromIdx) != TCL_OK) {
+ CACHE_STACK_INFO();
+ TRACE_ERROR(interp);
+ goto gotError;
+ }
+ if (TclGetIntForIndexM(interp, OBJ_AT_TOS, length,
&toIdx) != TCL_OK) {
+ CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
}
+ CACHE_STACK_INFO();
if (fromIdx < 0) {
fromIdx = 0;
@@ -5411,14 +5450,17 @@ TEBCresume(
endIdx = Tcl_GetCharLength(valuePtr) - 1;
TRACE(("\"%.20s\" %s %s \"%.20s\" => ", O2S(valuePtr),
O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), O2S(value3Ptr)));
+ DECACHE_STACK_INFO();
if (TclGetIntForIndexM(interp, OBJ_UNDER_TOS, endIdx,
&fromIdx) != TCL_OK
|| TclGetIntForIndexM(interp, OBJ_AT_TOS, endIdx,
&toIdx) != TCL_OK) {
+ CACHE_STACK_INFO();
TclDecrRefCount(value3Ptr);
TRACE_ERROR(interp);
goto gotError;
}
+ CACHE_STACK_INFO();
TclDecrRefCount(OBJ_AT_TOS);
(void) POP_OBJECT();
TclDecrRefCount(OBJ_AT_TOS);
@@ -5543,9 +5585,11 @@ TEBCresume(
ustring1 = Tcl_GetUnicodeFromObj(valuePtr, &length);
match = 1;
if (length > 0) {
+ int ch;
end = ustring1 + length;
- for (p=ustring1 ; p<end ; p++) {
- if (!tclStringClassTable[opnd].comparator(*p)) {
+ for (p=ustring1 ; p<end ; ) {
+ p += TclUniCharToUCS4(p, &ch);
+ if (!tclStringClassTable[opnd].comparator(ch)) {
match = 0;
break;
}
@@ -7004,7 +7048,7 @@ TEBCresume(
if (valuePtr == NULL) {
Tcl_DictObjPut(NULL, dictPtr, OBJ_AT_TOS,Tcl_NewIntObj(opnd));
} else {
- value2Ptr = Tcl_NewIntObj(opnd);
+ TclNewIntObj(value2Ptr, opnd);
Tcl_IncrRefCount(value2Ptr);
if (Tcl_IsShared(valuePtr)) {
valuePtr = Tcl_DuplicateObj(valuePtr);
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index 3babd43..d6a152a 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -1085,7 +1085,7 @@ TclFileAttrsCmd(
}
if (Tcl_GetIndexFromObj(interp, objv[0], attributeStrings,
- "option", INDEX_TEMP_TABLE, &index) != TCL_OK) {
+ "option", TCL_INDEX_TEMP_TABLE, &index) != TCL_OK) {
goto end;
}
if (Tcl_FSFileAttrsGet(interp, index, filePtr,
@@ -1110,7 +1110,7 @@ TclFileAttrsCmd(
for (i = 0; i < objc ; i += 2) {
if (Tcl_GetIndexFromObj(interp, objv[i], attributeStrings,
- "option", INDEX_TEMP_TABLE, &index) != TCL_OK) {
+ "option", TCL_INDEX_TEMP_TABLE, &index) != TCL_OK) {
goto end;
}
if (i + 1 == objc) {
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 32b217f..187003d 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -598,7 +598,7 @@ Tcl_SplitPath(
for (i = 0; i < *argcPtr; i++) {
Tcl_ListObjIndex(NULL, resultPtr, i, &eltPtr);
str = TclGetStringFromObj(eltPtr, &len);
- memcpy(p, str, len+1);
+ memcpy(p, str, len + 1);
p += len+1;
}
@@ -2055,7 +2055,7 @@ TclGlob(
* SkipToChar --
*
* This function traverses a glob pattern looking for the next unquoted
- * occurance of the specified character at the same braces nesting level.
+ * occurrence of the specified character at the same braces nesting level.
*
* Results:
* Updates stringPtr to point to the matching character, or to the end of
@@ -2445,7 +2445,7 @@ DoGlob(
int len;
const char *joined = TclGetStringFromObj(joinedPtr,&len);
- if (strchr(separators, joined[len-1]) == NULL) {
+ if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
Tcl_AppendToObj(joinedPtr, "/", 1);
}
}
@@ -2482,7 +2482,7 @@ DoGlob(
int len;
const char *joined = TclGetStringFromObj(joinedPtr,&len);
- if (strchr(separators, joined[len-1]) == NULL) {
+ if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {
Tcl_AppendToObj(joinedPtr, "/", 1);
}
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index faa8b69..33b23ae 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -16,7 +16,7 @@
%parse-param {DateInfo* info}
%lex-param {DateInfo* info}
-%pure-parser
+%define api.pure
/* %error-verbose would be nice, but our token names are meaningless */
%locations
@@ -266,43 +266,32 @@ time : tUNUMBER tMERIDIAN {
yySeconds = 0;
yyMeridian = $4;
}
- | tUNUMBER ':' tUNUMBER '-' tUNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = ($5 % 100 + ($5 / 100) * 60);
- ++yyHaveZone;
- }
| tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
yyHour = $1;
yyMinutes = $3;
yySeconds = $5;
yyMeridian = $6;
}
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER '-' tUNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = ($7 % 100 + ($7 / 100) * 60);
- ++yyHaveZone;
- }
;
zone : tZONE tDST {
yyTimezone = $1;
+ if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSTon;
}
| tZONE {
yyTimezone = $1;
+ if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100);
yyDSTmode = DSToff;
}
| tDAYZONE {
yyTimezone = $1;
yyDSTmode = DSTon;
}
+ | sign tUNUMBER {
+ yyTimezone = -$1*($2 % 100 + ($2 / 100) * 60);
+ yyDSTmode = DSToff;
+ }
;
day : tDAY {
@@ -386,8 +375,18 @@ ordMonth: tNEXT tMONTH {
}
;
-iso : tISOBASE tZONE tISOBASE {
- if ($2 != HOUR( 7)) YYABORT;
+iso : tUNUMBER '-' tUNUMBER '-' tUNUMBER tZONE
+ tUNUMBER ':' tUNUMBER ':' tUNUMBER {
+ if ($6 != HOUR( 7) + HOUR(100)) YYABORT;
+ yyYear = $1;
+ yyMonth = $3;
+ yyDay = $5;
+ yyHour = $7;
+ yyMinutes = $9;
+ yySeconds = $11;
+ }
+ | tISOBASE tZONE tISOBASE {
+ if ($2 != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = $1 / 10000;
yyMonth = ($1 % 10000)/100;
yyDay = $1 % 100;
@@ -396,7 +395,7 @@ iso : tISOBASE tZONE tISOBASE {
yySeconds = $3 % 100;
}
| tISOBASE tZONE tUNUMBER ':' tUNUMBER ':' tUNUMBER {
- if ($2 != HOUR( 7)) YYABORT;
+ if ($2 != HOUR( 7) + HOUR(100)) YYABORT;
yyYear = $1 / 10000;
yyMonth = ($1 % 10000)/100;
yyDay = $1 % 100;
@@ -675,31 +674,31 @@ static const TABLE TimezoneTable[] = {
*/
static const TABLE MilitaryTable[] = {
- { "a", tZONE, -HOUR( 1) },
- { "b", tZONE, -HOUR( 2) },
- { "c", tZONE, -HOUR( 3) },
- { "d", tZONE, -HOUR( 4) },
- { "e", tZONE, -HOUR( 5) },
- { "f", tZONE, -HOUR( 6) },
- { "g", tZONE, -HOUR( 7) },
- { "h", tZONE, -HOUR( 8) },
- { "i", tZONE, -HOUR( 9) },
- { "k", tZONE, -HOUR(10) },
- { "l", tZONE, -HOUR(11) },
- { "m", tZONE, -HOUR(12) },
- { "n", tZONE, HOUR( 1) },
- { "o", tZONE, HOUR( 2) },
- { "p", tZONE, HOUR( 3) },
- { "q", tZONE, HOUR( 4) },
- { "r", tZONE, HOUR( 5) },
- { "s", tZONE, HOUR( 6) },
- { "t", tZONE, HOUR( 7) },
- { "u", tZONE, HOUR( 8) },
- { "v", tZONE, HOUR( 9) },
- { "w", tZONE, HOUR( 10) },
- { "x", tZONE, HOUR( 11) },
- { "y", tZONE, HOUR( 12) },
- { "z", tZONE, HOUR( 0) },
+ { "a", tZONE, -HOUR( 1) + HOUR(100) },
+ { "b", tZONE, -HOUR( 2) + HOUR(100) },
+ { "c", tZONE, -HOUR( 3) + HOUR(100) },
+ { "d", tZONE, -HOUR( 4) + HOUR(100) },
+ { "e", tZONE, -HOUR( 5) + HOUR(100) },
+ { "f", tZONE, -HOUR( 6) + HOUR(100) },
+ { "g", tZONE, -HOUR( 7) + HOUR(100) },
+ { "h", tZONE, -HOUR( 8) + HOUR(100) },
+ { "i", tZONE, -HOUR( 9) + HOUR(100) },
+ { "k", tZONE, -HOUR(10) + HOUR(100) },
+ { "l", tZONE, -HOUR(11) + HOUR(100) },
+ { "m", tZONE, -HOUR(12) + HOUR(100) },
+ { "n", tZONE, HOUR( 1) + HOUR(100) },
+ { "o", tZONE, HOUR( 2) + HOUR(100) },
+ { "p", tZONE, HOUR( 3) + HOUR(100) },
+ { "q", tZONE, HOUR( 4) + HOUR(100) },
+ { "r", tZONE, HOUR( 5) + HOUR(100) },
+ { "s", tZONE, HOUR( 6) + HOUR(100) },
+ { "t", tZONE, HOUR( 7) + HOUR(100) },
+ { "u", tZONE, HOUR( 8) + HOUR(100) },
+ { "v", tZONE, HOUR( 9) + HOUR(100) },
+ { "w", tZONE, HOUR( 10) + HOUR(100) },
+ { "x", tZONE, HOUR( 11) + HOUR(100) },
+ { "y", tZONE, HOUR( 12) + HOUR(100) },
+ { "z", tZONE, HOUR( 0) + HOUR(100) },
{ NULL, 0, 0 }
};
@@ -717,12 +716,12 @@ TclDateerror(
Tcl_AppendToObj(infoPtr->messages, infoPtr->separatrix, -1);
Tcl_AppendToObj(infoPtr->messages, s, -1);
Tcl_AppendToObj(infoPtr->messages, " (characters ", -1);
- t = Tcl_NewIntObj(location->first_column);
+ TclNewIntObj(t, location->first_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
Tcl_AppendToObj(infoPtr->messages, "-", -1);
- t = Tcl_NewIntObj(location->last_column);
+ TclNewIntObj(t, location->last_column);
Tcl_IncrRefCount(t);
Tcl_AppendObjToObj(infoPtr->messages, t);
Tcl_DecrRefCount(t);
@@ -897,7 +896,7 @@ TclDatelex(
location->first_column = yyInput - info->dateStart;
for ( ; ; ) {
- while (TclIsSpaceProc(UCHAR(*yyInput))) {
+ while (TclIsSpaceProcM(*yyInput)) {
yyInput++;
}
@@ -960,7 +959,7 @@ TclDatelex(
int
TclClockOldscanObjCmd(
- void *dummy, /* Unused */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Count of paraneters */
Tcl_Obj *const *objv) /* Parameters */
@@ -970,7 +969,6 @@ TclClockOldscanObjCmd(
DateInfo dateInfo;
DateInfo* info = &dateInfo;
int status;
- (void)dummy;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 1, objv,
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 63fb997..8c778d4 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4756,7 +4756,7 @@ Tcl_GetsObj(
gs.rawRead -= rawRead;
gs.bytesWrote--;
gs.charsWrote--;
- memmove(dst, dst + 1, (size_t) (dstEnd - dst));
+ memmove(dst, dst + 1, dstEnd - dst);
dstEnd--;
}
}
@@ -7711,7 +7711,7 @@ Tcl_BadChannelOption(
}
Tcl_ResetResult(interp);
errObj = Tcl_ObjPrintf("bad option \"%s\": should be one of ",
- optionName);
+ optionName ? optionName : "");
argc--;
for (i = 0; i < argc; i++) {
Tcl_AppendPrintfToObj(errObj, "-%s, ", argv[i]);
@@ -10509,7 +10509,7 @@ Tcl_IsChannelExisting(
}
if ((*chanName == *name) &&
- (memcmp(name, chanName, (size_t) chanNameLen + 1) == 0)) {
+ (memcmp(name, chanName, chanNameLen + 1) == 0)) {
return 1;
}
}
diff --git a/generic/tclIO.h b/generic/tclIO.h
index d10f268..54aa5af 100644
--- a/generic/tclIO.h
+++ b/generic/tclIO.h
@@ -44,7 +44,7 @@ typedef struct ChannelBuffer {
int bufLength; /* How big is the buffer? */
struct ChannelBuffer *nextPtr;
/* Next buffer in chain. */
- char buf[1]; /* Placeholder for real buffer. The real
+ char buf[TCLFLEXARRAY]; /* Placeholder for real buffer. The real
* buffer occuppies this space + bufSize-1
* bytes. This must be the last field in the
* structure. */
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 8a5675a..c622afa 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -1365,7 +1365,7 @@ ReflectInput(
Tcl_Preserve(rcPtr);
- toReadObj = Tcl_NewIntObj(toRead);
+ TclNewIntObj(toReadObj, toRead);
Tcl_IncrRefCount(toReadObj);
if (InvokeTclMethod(rcPtr, METH_READ, toReadObj, NULL, &resObj)!=TCL_OK) {
@@ -3047,8 +3047,10 @@ ForwardProc(
}
case ForwardedInput: {
- Tcl_Obj *toReadObj = Tcl_NewIntObj(paramPtr->input.toRead);
- Tcl_IncrRefCount(toReadObj);
+ Tcl_Obj *toReadObj;
+
+ TclNewIntObj(toReadObj, paramPtr->input.toRead);
+ Tcl_IncrRefCount(toReadObj);
Tcl_Preserve(rcPtr);
if (InvokeTclMethod(rcPtr, METH_READ, toReadObj, NULL, &resObj)!=TCL_OK){
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index db533d7..acc9e40 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -2697,7 +2697,7 @@ Tcl_FSGetCwd(
* always be in the 'else' branch below which is simpler.
*/
- ClientData cd = (ClientData) Tcl_FSGetNativePath(norm);
+ void *cd = (void *) Tcl_FSGetNativePath(norm);
FsUpdateCwd(norm, TclNativeDupInternalRep(cd));
Tcl_DecrRefCount(norm);
@@ -4085,7 +4085,7 @@ TclFSNonnativePathType(
if (pathLen < len) {
continue;
}
- if (strncmp(strVol, path, (size_t) len) == 0) {
+ if (strncmp(strVol, path, len) == 0) {
type = TCL_PATH_ABSOLUTE;
if (filesystemPtrPtr != NULL) {
*filesystemPtrPtr = fsRecPtr->fsPtr;
@@ -4488,7 +4488,7 @@ Tcl_FSGetFileSystemForPath(
return NULL;
}
- /* Start with an up-to-date copy of the master filesystem. */
+ /* Start with an up-to-date copy of the filesystem. */
fsRecPtr = FsGetFirstFilesystem();
Claim();
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index 5aa4d42..a0a31da 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.c
@@ -114,7 +114,7 @@ Tcl_GetIndexFromObj(
int flags, /* 0 or TCL_EXACT */
int *indexPtr) /* Place to store resulting integer index. */
{
- if (!(flags & INDEX_TEMP_TABLE)) {
+ if (!(flags & TCL_INDEX_TEMP_TABLE)) {
/*
* See if there is a valid cached result from a previous lookup (doing the
@@ -216,7 +216,7 @@ GetIndexFromObjList(
tablePtr[objc] = NULL;
result = Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr,
- sizeof(char *), msg, flags | INDEX_TEMP_TABLE, indexPtr);
+ sizeof(char *), msg, flags | TCL_INDEX_TEMP_TABLE, indexPtr);
ckfree(tablePtr);
@@ -280,7 +280,7 @@ Tcl_GetIndexFromObjStruct(
* See if there is a valid cached result from a previous lookup.
*/
- if (!(flags & INDEX_TEMP_TABLE)) {
+ if (!(flags & TCL_INDEX_TEMP_TABLE)) {
irPtr = TclFetchIntRep(objPtr, &indexType);
if (irPtr) {
indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;
@@ -344,7 +344,7 @@ Tcl_GetIndexFromObjStruct(
* operation.
*/
- if (!(flags & INDEX_TEMP_TABLE)) {
+ if (!(flags & TCL_INDEX_TEMP_TABLE)) {
irPtr = TclFetchIntRep(objPtr, &indexType);
if (irPtr) {
indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;
@@ -785,7 +785,7 @@ PrefixLongestObjCmd(
* Adjust in case we stopped in the middle of a UTF char.
*/
- resultLength = Tcl_UtfPrev(&resultString[i+1],
+ resultLength = TclUtfPrev(&resultString[i+1],
resultString) - resultString;
break;
}
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index bdc7288..4599bce 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -893,7 +893,7 @@ declare 227 {
# Used to be needed for TclOO-extension; unneeded now that TclOO is in the
# core and NRE-enabled
# declare 228 {
-# int TclObjInterpProcCore(register Tcl_Interp *interp, Tcl_Obj *procNameObj,
+# int TclObjInterpProcCore(Tcl_Interp *interp, Tcl_Obj *procNameObj,
# int skip, ProcErrorProc *errorProc)
# }
declare 229 {
@@ -990,7 +990,7 @@ declare 249 {
}
# TIP #285: Script cancellation support.
declare 250 {
- void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags, int force)
+ void TclSetChildCancelFlags(Tcl_Interp *interp, int flags, int force)
}
# Allow extensions for optimization
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 2ff644e..a5e8122 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -925,6 +925,12 @@ typedef struct VarInHash {
*----------------------------------------------------------------
*/
+#if defined(__GNUC__) && (__GNUC__ > 2)
+# define TCLFLEXARRAY 0
+#else
+# define TCLFLEXARRAY 1
+#endif
+
/*
* Forward declaration to prevent an error when the forward reference to
* Command is encountered in the Proc and ImportRef types declared below.
@@ -968,7 +974,7 @@ typedef struct CompiledLocal {
* is marked by a unique tag during
* compilation, and that same tag is used to
* find the variable at runtime. */
- char name[1]; /* Name of the local variable starts here. If
+ char name[TCLFLEXARRAY]; /* Name of the local variable starts here. If
* the name is NULL, this will just be '\0'.
* The actual size of this field will be large
* enough to hold the name. MUST BE THE LAST
@@ -1306,7 +1312,7 @@ typedef struct CFWordBC {
typedef struct ContLineLoc {
int num; /* Number of entries in loc, not counting the
* final -1 marker entry. */
- int loc[1]; /* Table of locations, as character offsets.
+ int loc[TCLFLEXARRAY];/* Table of locations, as character offsets.
* The table is allocated as part of the
* structure, extending behind the nominal end
* of the structure. An entry containing the
@@ -1455,7 +1461,7 @@ typedef struct ExecStack {
Tcl_Obj **markerPtr;
Tcl_Obj **endPtr;
Tcl_Obj **tosPtr;
- Tcl_Obj *stackWords[1];
+ Tcl_Obj *stackWords[TCLFLEXARRAY];
} ExecStack;
/*
@@ -1707,18 +1713,18 @@ typedef struct Command {
/*
* Flag bits for commands.
*
- * CMD_IS_DELETED - Means that the command is in the process of
+ * CMD_DYING - If 1 the command is in the process of
* being deleted (its deleteProc is currently
* executing). Other attempts to delete the
* command should be ignored.
- * CMD_TRACE_ACTIVE - 1 means that trace processing is currently
+ * CMD_TRACE_ACTIVE - If 1 the trace processing is currently
* underway for a rename/delete change. See the
* two flags below for which is currently being
* processed.
- * CMD_HAS_EXEC_TRACES - 1 means that this command has at least one
+ * CMD_HAS_EXEC_TRACES - If 1 means that this command has at least one
* execution trace (as opposed to simple
* delete/rename traces) in its tracePtr list.
- * CMD_COMPILES_EXPANDED - 1 means that this command has a compiler that
+ * CMD_COMPILES_EXPANDED - If 1 this command has a compiler that
* can handle expansion (provided it is not the
* first word).
* TCL_TRACE_RENAME - A rename trace is in progress. Further
@@ -1728,12 +1734,13 @@ typedef struct Command {
* (these last two flags are defined in tcl.h)
*/
-#define CMD_IS_DELETED 0x01
+#define CMD_DYING 0x01
#define CMD_TRACE_ACTIVE 0x02
#define CMD_HAS_EXEC_TRACES 0x04
#define CMD_COMPILES_EXPANDED 0x08
#define CMD_REDEF_IN_PROGRESS 0x10
#define CMD_VIA_RESOLVER 0x20
+#define CMD_DEAD 0x40
/*
@@ -1856,7 +1863,7 @@ typedef struct Interp {
* of hidden commands on a per-interp
* basis. */
void *interpInfo; /* Information used by tclInterp.c to keep
- * track of master/slave interps on a
+ * track of parent/child interps on a
* per-interp basis. */
union {
void (*optimizer)(void *envPtr);
@@ -2146,7 +2153,7 @@ typedef struct Interp {
* (c) are accessed very often (e.g., at each command call)
*
* Note that these are the same for all interps in the same thread. They
- * just have to be initialised for the thread's master interp, slaves
+ * just have to be initialised for the thread's parent interp, children
* inherit the value.
*
* They are used by the macros defined below.
@@ -2522,10 +2529,9 @@ typedef struct List {
? ((*(intPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \
: Tcl_GetIntFromObj((interp), (objPtr), (intPtr)))
#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \
- (((objPtr)->typePtr == &tclIntType \
- && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(INT_MAX)) \
- ? ((*(idxPtr) = ((objPtr)->internalRep.wideValue >= 0) \
- ? (int)(objPtr)->internalRep.wideValue : TCL_INDEX_NONE), TCL_OK) \
+ ((((objPtr)->typePtr == &tclIntType) && ((objPtr)->internalRep.wideValue >= 0) \
+ && ((Tcl_WideUInt)(objPtr)->internalRep.wideValue <= (Tcl_WideUInt)(endValue + 1))) \
+ ? ((*(idxPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \
: Tcl_GetIntForIndex((interp), (objPtr), (endValue), (idxPtr)))
/*
@@ -2606,15 +2612,6 @@ typedef struct TclFileAttrProcs {
} TclFileAttrProcs;
/*
- * Private flag value which controls Tcl_GetIndexFromObj*() routines
- * to instruct them not to cache lookups because the table will not
- * live long enough to make it worthwhile. Must not clash with public
- * flag value TCL_EXACT.
- */
-
-#define INDEX_TEMP_TABLE 2
-
-/*
* Opaque handle used in pipeline routines to encapsulate platform-dependent
* state.
*/
@@ -2670,20 +2667,20 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *leng
/*
* A ProcessGlobalValue struct exists for each internal value in Tcl that is
* to be shared among several threads. Each thread sees a (Tcl_Obj) copy of
- * the value, and the master is kept as a counted string, with epoch and mutex
- * control. Each ProcessGlobalValue struct should be a static variable in some
- * file.
+ * the value, and the gobal value is kept as a counted string, with epoch and
+ * mutex control. Each ProcessGlobalValue struct should be a static variable in
+ * some file.
*/
typedef struct ProcessGlobalValue {
unsigned int epoch; /* Epoch counter to detect changes in the
- * master value. */
- unsigned int numBytes; /* Length of the master string. */
- char *value; /* The master string value. */
- Tcl_Encoding encoding; /* system encoding when master string was
+ * global value. */
+ unsigned int numBytes; /* Length of the global string. */
+ char *value; /* The global string value. */
+ Tcl_Encoding encoding; /* system encoding when global string was
* initialized. */
TclInitProcessGlobalValueProc *proc;
- /* A procedure to initialize the master string
+ /* A procedure to initialize the global string
* copy when a "get" request comes in before
* any "set" request has been received. */
Tcl_Mutex mutex; /* Enforce orderly access from multiple
@@ -2714,6 +2711,8 @@ typedef struct ProcessGlobalValue {
/* Reject leading/trailing whitespace. */
#define TCL_PARSE_BINARY_ONLY 64
/* Parse binary even without prefix. */
+#define TCL_PARSE_NO_UNDERSCORE 128
+ /* Reject underscore digit separator */
/*
*----------------------------------------------------------------------
@@ -3156,8 +3155,8 @@ MODULE_SCOPE void TclpInitLock(void);
MODULE_SCOPE void TclpInitPlatform(void);
MODULE_SCOPE void TclpInitUnlock(void);
MODULE_SCOPE Tcl_Obj * TclpObjListVolumes(void);
-MODULE_SCOPE void TclpMasterLock(void);
-MODULE_SCOPE void TclpMasterUnlock(void);
+MODULE_SCOPE void TclpGlobalLock(void);
+MODULE_SCOPE void TclpGlobalUnlock(void);
MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators,
Tcl_DString *dirPtr, char *pattern, char *tail);
MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp,
@@ -3252,8 +3251,16 @@ MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct);
MODULE_SCOPE int TclUtfCount(int ch);
#if TCL_UTF_MAX > 3
# define TclUtfToUCS4 Tcl_UtfToUniChar
+# define TclUniCharToUCS4(src, ptr) (*ptr = *(src),1)
+# define TclUCS4Complete Tcl_UtfCharComplete
+# define TclChar16Complete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
+ ? ((length) >= 3) : Tcl_UtfCharComplete((src), (length)))
#else
- MODULE_SCOPE int TclUtfToUCS4(const char *src, int *ucs4Ptr);
+ MODULE_SCOPE int TclUtfToUCS4(const char *src, int *ucs4Ptr);
+ MODULE_SCOPE int TclUniCharToUCS4(const Tcl_UniChar *src, int *ucs4Ptr);
+# define TclUCS4Complete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
+ ? ((length) >= 4) : Tcl_UtfCharComplete((src), (length)))
+# define TclChar16Complete Tcl_UtfCharComplete
#endif
MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData);
MODULE_SCOPE Tcl_Obj * TclpFilesystemPathType(Tcl_Obj *pathPtr);
@@ -3296,8 +3303,8 @@ MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void);
MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp);
MODULE_SCOPE void * TclpThreadCreateKey(void);
MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr);
-MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr);
-MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr);
+MODULE_SCOPE void TclpThreadSetGlobalTSD(void *tsdKeyPtr, void *ptr);
+MODULE_SCOPE void * TclpThreadGetGlobalTSD(void *tsdKeyPtr);
MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp,
const char *msg, int length);
/* Tip 430 */
@@ -4165,7 +4172,7 @@ MODULE_SCOPE int TclFullFinalizationRequested(void);
MODULE_SCOPE Tcl_ObjCmdProc TclEnsembleImplementationCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclAliasObjCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclLocalAliasObjCmd;
-MODULE_SCOPE Tcl_ObjCmdProc TclSlaveObjCmd;
+MODULE_SCOPE Tcl_ObjCmdProc TclChildObjCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclInvokeImportedCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclOOPublicObjectCmd;
MODULE_SCOPE Tcl_ObjCmdProc TclOOPrivateObjectCmd;
@@ -4655,8 +4662,8 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
#if TCL_UTF_MAX > 3
#define TclUtfToUniChar(str, chPtr) \
- ((((unsigned char) *(str)) < 0x80) ? \
- ((*(chPtr) = (unsigned char) *(str)), 1) \
+ (((UCHAR(*(str))) < 0x80) ? \
+ ((*(chPtr) = UCHAR(*(str))), 1) \
: Tcl_UtfToUniChar(str, chPtr))
#else
#define TclUtfToUniChar(str, chPtr) \
@@ -4694,9 +4701,6 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
((unsigned char) *((src) - 1)) < 0x80 ? (src) - 1 : \
Tcl_UtfPrev(src, start))
-#define TclUtfNext(src) \
- ((((unsigned char) *(src)) < 0x80) ? (src) + 1 : Tcl_UtfNext(src))
-
/*
*----------------------------------------------------------------
* Macro that encapsulates the logic that determines when it is safe to
@@ -4928,7 +4932,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
* Computes number of bytes from beginning of structure to a given field.
*/
-#ifndef TCL_NO_DEPRECATED
+#if !defined(TCL_NO_DEPRECATED) && !defined(BUILD_tcl)
# define TclOffset(type, field) ((int) offsetof(type, field))
#endif
/* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */
@@ -4953,10 +4957,30 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
* the internal stubs, but the core can use the macro instead.
*/
-#define TclCleanupCommandMacro(cmdPtr) \
- if ((cmdPtr)->refCount-- <= 1) { \
- ckfree(cmdPtr);\
- }
+#define TclCleanupCommandMacro(cmdPtr) \
+ do { \
+ if ((cmdPtr)->refCount-- <= 1) { \
+ ckfree(cmdPtr); \
+ } \
+ } while (0)
+
+
+/*
+ * inside this routine crement refCount first incase cmdPtr is replacing itself
+ */
+#define TclRoutineAssign(location, cmdPtr) \
+ do { \
+ (cmdPtr)->refCount++; \
+ if ((location) != NULL \
+ && (location--) <= 1) { \
+ ckfree(((location))); \
+ } \
+ (location) = (cmdPtr); \
+ } while (0)
+
+
+#define TclRoutineHasName(cmdPtr) \
+ ((cmdPtr)->hPtr != NULL)
/*
*----------------------------------------------------------------
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 8ba0c4c..2c5b292 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -623,7 +623,7 @@ EXTERN int TclCopyChannel(Tcl_Interp *interp,
EXTERN char * TclDoubleDigits(double dv, int ndigits, int flags,
int *decpt, int *signum, char **endPtr);
/* 250 */
-EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags,
+EXTERN void TclSetChildCancelFlags(Tcl_Interp *interp, int flags,
int force);
/* 251 */
EXTERN int TclRegisterLiteral(void *envPtr, const char *bytes,
@@ -915,7 +915,7 @@ typedef struct TclIntStubs {
void (*tclResetRewriteEnsemble) (Tcl_Interp *interp, int isRootEnsemble); /* 247 */
int (*tclCopyChannel) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, Tcl_WideInt toRead, Tcl_Obj *cmdPtr); /* 248 */
char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */
- void (*tclSetSlaveCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */
+ void (*tclSetChildCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */
int (*tclRegisterLiteral) (void *envPtr, const char *bytes, int length, int flags); /* 251 */
Tcl_Obj * (*tclPtrGetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 252 */
Tcl_Obj * (*tclPtrSetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, const int flags); /* 253 */
@@ -1352,8 +1352,8 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclCopyChannel) /* 248 */
#define TclDoubleDigits \
(tclIntStubsPtr->tclDoubleDigits) /* 249 */
-#define TclSetSlaveCancelFlags \
- (tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */
+#define TclSetChildCancelFlags \
+ (tclIntStubsPtr->tclSetChildCancelFlags) /* 250 */
#define TclRegisterLiteral \
(tclIntStubsPtr->tclRegisterLiteral) /* 251 */
#define TclPtrGetVar \
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 1570837..b84c065 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -27,34 +27,34 @@ struct Target;
/*
* struct Alias:
*
- * Stores information about an alias. Is stored in the slave interpreter and
- * used by the source command to find the target command in the master when
+ * Stores information about an alias. Is stored in the child interpreter and
+ * used by the source command to find the target command in the parent when
* the source command is invoked.
*/
typedef struct Alias {
- Tcl_Obj *token; /* Token for the alias command in the slave
+ Tcl_Obj *token; /* Token for the alias command in the child
* interp. This used to be the command name in
- * the slave when the alias was first
+ * the child when the alias was first
* created. */
Tcl_Interp *targetInterp; /* Interp in which target command will be
* invoked. */
- Tcl_Command slaveCmd; /* Source command in slave interpreter, bound
+ Tcl_Command childCmd; /* Source command in child interpreter, bound
* to command that invokes the target command
* in the target interpreter. */
Tcl_HashEntry *aliasEntryPtr;
- /* Entry for the alias hash table in slave.
+ /* Entry for the alias hash table in child.
* This is used by alias deletion to remove
- * the alias from the slave interpreter alias
+ * the alias from the child interpreter alias
* table. */
- struct Target *targetPtr; /* Entry for target command in master. This is
- * used in the master interpreter to map back
+ struct Target *targetPtr; /* Entry for target command in parent. This is
+ * used in the parent interpreter to map back
* from the target command to aliases
* redirecting to it. */
int objc; /* Count of Tcl_Obj in the prefix of the
* target command to be invoked in the target
* interpreter. Additional arguments specified
- * when calling the alias in the slave interp
+ * when calling the alias in the child interp
* will be appended to the prefix before the
* command is invoked. */
Tcl_Obj *objPtr; /* The first actual prefix object - the target
@@ -66,45 +66,45 @@ typedef struct Alias {
/*
*
- * struct Slave:
+ * struct Child:
*
- * Used by the "interp" command to record and find information about slave
- * interpreters. Maps from a command name in the master to information about a
- * slave interpreter, e.g. what aliases are defined in it.
+ * Used by the "interp" command to record and find information about child
+ * interpreters. Maps from a command name in the parent to information about a
+ * child interpreter, e.g. what aliases are defined in it.
*/
-typedef struct Slave {
- Tcl_Interp *masterInterp; /* Master interpreter for this slave. */
- Tcl_HashEntry *slaveEntryPtr;
- /* Hash entry in masters slave table for this
- * slave interpreter. Used to find this
- * record, and used when deleting the slave
- * interpreter to delete it from the master's
+typedef struct Child {
+ Tcl_Interp *parentInterp; /* Parent interpreter for this child. */
+ Tcl_HashEntry *childEntryPtr;
+ /* Hash entry in parents child table for this
+ * child interpreter. Used to find this
+ * record, and used when deleting the child
+ * interpreter to delete it from the parent's
* table. */
- Tcl_Interp *slaveInterp; /* The slave interpreter. */
+ Tcl_Interp *childInterp; /* The child interpreter. */
Tcl_Command interpCmd; /* Interpreter object command. */
Tcl_HashTable aliasTable; /* Table which maps from names of commands in
- * slave interpreter to struct Alias defined
+ * child interpreter to struct Alias defined
* below. */
-} Slave;
+} Child;
/*
* struct Target:
*
- * Maps from master interpreter commands back to the source commands in slave
+ * Maps from parent interpreter commands back to the source commands in child
* interpreters. This is needed because aliases can be created between sibling
* interpreters and must be deleted when the target interpreter is deleted. In
* case they would not be deleted the source interpreter would be left with a
- * "dangling pointer". One such record is stored in the Master record of the
- * master interpreter with the master for each alias which directs to a
- * command in the master. These records are used to remove the source command
- * for an from a slave if/when the master is deleted. They are organized in a
- * doubly-linked list attached to the master interpreter.
+ * "dangling pointer". One such record is stored in the Parent record of the
+ * parent interpreter with the parent for each alias which directs to a
+ * command in the parent. These records are used to remove the source command
+ * for an from a child if/when the parent is deleted. They are organized in a
+ * doubly-linked list attached to the parent interpreter.
*/
typedef struct Target {
- Tcl_Command slaveCmd; /* Command for alias in slave interp. */
- Tcl_Interp *slaveInterp; /* Slave Interpreter. */
+ Tcl_Command childCmd; /* Command for alias in child interp. */
+ Tcl_Interp *childInterp; /* Child Interpreter. */
struct Target *nextPtr; /* Next in list of target records, or NULL if
* at the end of the list of targets. */
struct Target *prevPtr; /* Previous in list of target records, or NULL
@@ -112,43 +112,43 @@ typedef struct Target {
} Target;
/*
- * struct Master:
+ * struct Parent:
*
- * This record is used for two purposes: First, slaveTable (a hashtable) maps
- * from names of commands to slave interpreters. This hashtable is used to
- * store information about slave interpreters of this interpreter, to map over
- * all slaves, etc. The second purpose is to store information about all
- * aliases in slaves (or siblings) which direct to target commands in this
+ * This record is used for two purposes: First, childTable (a hashtable) maps
+ * from names of commands to child interpreters. This hashtable is used to
+ * store information about child interpreters of this interpreter, to map over
+ * all children, etc. The second purpose is to store information about all
+ * aliases in children (or siblings) which direct to target commands in this
* interpreter (using the targetsPtr doubly-linked list).
*
* NB: the flags field in the interp structure, used with SAFE_INTERP mask
* denotes whether the interpreter is safe or not. Safe interpreters have
- * restricted functionality, can only create safe slave interpreters and can
+ * restricted functionality, can only create safe interpreters and can
* only load safe extensions.
*/
-typedef struct Master {
- Tcl_HashTable slaveTable; /* Hash table for slave interpreters. Maps
- * from command names to Slave records. */
+typedef struct Parent {
+ Tcl_HashTable childTable; /* Hash table for child interpreters. Maps
+ * from command names to Child records. */
Target *targetsPtr; /* The head of a doubly-linked list of all the
* target records which denote aliases from
- * slaves or sibling interpreters that direct
+ * children or sibling interpreters that direct
* to commands in this interpreter. This list
* is used to remove dangling pointers from
- * the slave (or sibling) interpreters when
+ * the child (or sibling) interpreters when
* this interpreter is deleted. */
-} Master;
+} Parent;
/*
- * The following structure keeps track of all the Master and Slave information
+ * The following structure keeps track of all the Parent and Child information
* on a per-interp basis.
*/
typedef struct InterpInfo {
- Master master; /* Keeps track of all interps for which this
- * interp is the Master. */
- Slave slave; /* Information necessary for this interp to
- * function as a slave. */
+ Parent parent; /* Keeps track of all interps for which this
+ * interp is the Parent. */
+ Child child; /* Information necessary for this interp to
+ * function as a child. */
} InterpInfo;
/*
@@ -214,55 +214,55 @@ struct LimitHandler {
*/
static int AliasCreate(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, Tcl_Interp *masterInterp,
+ Tcl_Interp *childInterp, Tcl_Interp *parentInterp,
Tcl_Obj *namePtr, Tcl_Obj *targetPtr, int objc,
Tcl_Obj *const objv[]);
static int AliasDelete(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, Tcl_Obj *namePtr);
+ Tcl_Interp *childInterp, Tcl_Obj *namePtr);
static int AliasDescribe(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, Tcl_Obj *objPtr);
-static int AliasList(Tcl_Interp *interp, Tcl_Interp *slaveInterp);
+ Tcl_Interp *childInterp, Tcl_Obj *objPtr);
+static int AliasList(Tcl_Interp *interp, Tcl_Interp *childInterp);
static Tcl_ObjCmdProc AliasNRCmd;
static Tcl_CmdDeleteProc AliasObjCmdDeleteProc;
static Tcl_Interp * GetInterp(Tcl_Interp *interp, Tcl_Obj *pathPtr);
static Tcl_Interp * GetInterp2(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static Tcl_InterpDeleteProc InterpInfoDeleteProc;
-static int SlaveBgerror(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, int objc,
+static int ChildBgerror(Tcl_Interp *interp,
+ Tcl_Interp *childInterp, int objc,
Tcl_Obj *const objv[]);
-static Tcl_Interp * SlaveCreate(Tcl_Interp *interp, Tcl_Obj *pathPtr,
+static Tcl_Interp * ChildCreate(Tcl_Interp *interp, Tcl_Obj *pathPtr,
int safe);
-static int SlaveDebugCmd(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp,
+static int ChildDebugCmd(Tcl_Interp *interp,
+ Tcl_Interp *childInterp,
int objc, Tcl_Obj *const objv[]);
-static int SlaveEval(Tcl_Interp *interp, Tcl_Interp *slaveInterp,
+static int ChildEval(Tcl_Interp *interp, Tcl_Interp *childInterp,
int objc, Tcl_Obj *const objv[]);
-static int SlaveExpose(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, int objc,
+static int ChildExpose(Tcl_Interp *interp,
+ Tcl_Interp *childInterp, int objc,
Tcl_Obj *const objv[]);
-static int SlaveHide(Tcl_Interp *interp, Tcl_Interp *slaveInterp,
+static int ChildHide(Tcl_Interp *interp, Tcl_Interp *childInterp,
int objc, Tcl_Obj *const objv[]);
-static int SlaveHidden(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp);
-static int SlaveInvokeHidden(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp,
+static int ChildHidden(Tcl_Interp *interp,
+ Tcl_Interp *childInterp);
+static int ChildInvokeHidden(Tcl_Interp *interp,
+ Tcl_Interp *childInterp,
const char *namespaceName,
int objc, Tcl_Obj *const objv[]);
-static int SlaveMarkTrusted(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp);
-static Tcl_CmdDeleteProc SlaveObjCmdDeleteProc;
-static int SlaveRecursionLimit(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, int objc,
+static int ChildMarkTrusted(Tcl_Interp *interp,
+ Tcl_Interp *childInterp);
+static Tcl_CmdDeleteProc ChildObjCmdDeleteProc;
+static int ChildRecursionLimit(Tcl_Interp *interp,
+ Tcl_Interp *childInterp, int objc,
Tcl_Obj *const objv[]);
-static int SlaveCommandLimitCmd(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, int consumedObjc,
+static int ChildCommandLimitCmd(Tcl_Interp *interp,
+ Tcl_Interp *childInterp, int consumedObjc,
int objc, Tcl_Obj *const objv[]);
-static int SlaveTimeLimitCmd(Tcl_Interp *interp,
- Tcl_Interp *slaveInterp, int consumedObjc,
+static int ChildTimeLimitCmd(Tcl_Interp *interp,
+ Tcl_Interp *childInterp, int consumedObjc,
int objc, Tcl_Obj *const objv[]);
-static void InheritLimitsFromMaster(Tcl_Interp *slaveInterp,
- Tcl_Interp *masterInterp);
+static void InheritLimitsFromParent(Tcl_Interp *childInterp,
+ Tcl_Interp *parentInterp);
static void SetScriptLimitCallback(Tcl_Interp *interp, int type,
Tcl_Interp *targetInterp, Tcl_Obj *scriptObj);
static void CallScriptLimitCallback(ClientData clientData,
@@ -275,7 +275,7 @@ static void TimeLimitCallback(ClientData clientData);
/* NRE enabling */
static Tcl_NRPostProc NRPostInvokeHidden;
static Tcl_ObjCmdProc NRInterpCmd;
-static Tcl_ObjCmdProc NRSlaveCmd;
+static Tcl_ObjCmdProc NRChildCmd;
/*
@@ -461,7 +461,7 @@ end:
*
* TclInterpInit --
*
- * Initializes the invoking interpreter for using the master, slave and
+ * Initializes the invoking interpreter for using the parent, child and
* safe interp facilities. This is called from inside Tcl_CreateInterp().
*
* Results:
@@ -479,22 +479,22 @@ TclInterpInit(
Tcl_Interp *interp) /* Interpreter to initialize. */
{
InterpInfo *interpInfoPtr;
- Master *masterPtr;
- Slave *slavePtr;
+ Parent *parentPtr;
+ Child *childPtr;
interpInfoPtr = (InterpInfo *)ckalloc(sizeof(InterpInfo));
((Interp *) interp)->interpInfo = interpInfoPtr;
- masterPtr = &interpInfoPtr->master;
- Tcl_InitHashTable(&masterPtr->slaveTable, TCL_STRING_KEYS);
- masterPtr->targetsPtr = NULL;
+ parentPtr = &interpInfoPtr->parent;
+ Tcl_InitHashTable(&parentPtr->childTable, TCL_STRING_KEYS);
+ parentPtr->targetsPtr = NULL;
- slavePtr = &interpInfoPtr->slave;
- slavePtr->masterInterp = NULL;
- slavePtr->slaveEntryPtr = NULL;
- slavePtr->slaveInterp = interp;
- slavePtr->interpCmd = NULL;
- Tcl_InitHashTable(&slavePtr->aliasTable, TCL_STRING_KEYS);
+ childPtr = &interpInfoPtr->child;
+ childPtr->parentInterp = NULL;
+ childPtr->childEntryPtr = NULL;
+ childPtr->childInterp = interp;
+ childPtr->interpCmd = NULL;
+ Tcl_InitHashTable(&childPtr->aliasTable, TCL_STRING_KEYS);
Tcl_NRCreateCommand(interp, "interp", Tcl_InterpObjCmd, NRInterpCmd,
NULL, NULL);
@@ -509,7 +509,7 @@ TclInterpInit(
* InterpInfoDeleteProc --
*
* Invoked when an interpreter is being deleted. It releases all storage
- * used by the master/slave/safe interpreter facilities.
+ * used by the parent/child/safe interpreter facilities.
*
* Results:
* None.
@@ -522,13 +522,13 @@ TclInterpInit(
static void
InterpInfoDeleteProc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp) /* Interp being deleted. All commands for
- * slave interps should already be deleted. */
+ * child interps should already be deleted. */
{
InterpInfo *interpInfoPtr;
- Slave *slavePtr;
- Master *masterPtr;
+ Child *childPtr;
+ Parent *parentPtr;
Target *targetPtr;
interpInfoPtr = (InterpInfo *) ((Interp *) interp)->interpInfo;
@@ -537,11 +537,11 @@ InterpInfoDeleteProc(
* There shouldn't be any commands left.
*/
- masterPtr = &interpInfoPtr->master;
- if (masterPtr->slaveTable.numEntries != 0) {
+ parentPtr = &interpInfoPtr->parent;
+ if (parentPtr->childTable.numEntries != 0) {
Tcl_Panic("InterpInfoDeleteProc: still exist commands");
}
- Tcl_DeleteHashTable(&masterPtr->slaveTable);
+ Tcl_DeleteHashTable(&parentPtr->childTable);
/*
* Tell any interps that have aliases to this interp that they should
@@ -549,35 +549,35 @@ InterpInfoDeleteProc(
* have removed the target record already.
*/
- for (targetPtr = masterPtr->targetsPtr; targetPtr != NULL; ) {
+ for (targetPtr = parentPtr->targetsPtr; targetPtr != NULL; ) {
Target *tmpPtr = targetPtr->nextPtr;
- Tcl_DeleteCommandFromToken(targetPtr->slaveInterp,
- targetPtr->slaveCmd);
+ Tcl_DeleteCommandFromToken(targetPtr->childInterp,
+ targetPtr->childCmd);
targetPtr = tmpPtr;
}
- slavePtr = &interpInfoPtr->slave;
- if (slavePtr->interpCmd != NULL) {
+ childPtr = &interpInfoPtr->child;
+ if (childPtr->interpCmd != NULL) {
/*
* Tcl_DeleteInterp() was called on this interpreter, rather "interp
- * delete" or the equivalent deletion of the command in the master.
+ * delete" or the equivalent deletion of the command in the parent.
* First ensure that the cleanup callback doesn't try to delete the
* interp again.
*/
- slavePtr->slaveInterp = NULL;
- Tcl_DeleteCommandFromToken(slavePtr->masterInterp,
- slavePtr->interpCmd);
+ childPtr->childInterp = NULL;
+ Tcl_DeleteCommandFromToken(childPtr->parentInterp,
+ childPtr->interpCmd);
}
/*
* There shouldn't be any aliases left.
*/
- if (slavePtr->aliasTable.numEntries != 0) {
+ if (childPtr->aliasTable.numEntries != 0) {
Tcl_Panic("InterpInfoDeleteProc: still exist aliases");
}
- Tcl_DeleteHashTable(&slavePtr->aliasTable);
+ Tcl_DeleteHashTable(&childPtr->aliasTable);
ckfree(interpInfoPtr);
}
@@ -611,16 +611,16 @@ Tcl_InterpObjCmd(
static int
NRInterpCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tcl_Interp *slaveInterp;
+ Tcl_Interp *childInterp;
int index;
static const char *const options[] = {
"alias", "aliases", "bgerror", "cancel",
- "create", "debug", "delete",
+ "children", "create", "debug", "delete",
"eval", "exists", "expose",
"hide", "hidden", "issafe",
"invokehidden", "limit", "marktrusted", "recursionlimit",
@@ -629,7 +629,7 @@ NRInterpCmd(
};
enum option {
OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_CANCEL,
- OPT_CREATE, OPT_DEBUG, OPT_DELETE,
+ OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE,
OPT_EVAL, OPT_EXISTS, OPT_EXPOSE,
OPT_HIDE, OPT_HIDDEN, OPT_ISSAFE,
OPT_INVOKEHID, OPT_LIMIT, OPT_MARKTRUSTED,OPT_RECLIMIT,
@@ -646,51 +646,51 @@ NRInterpCmd(
}
switch ((enum option) index) {
case OPT_ALIAS: {
- Tcl_Interp *masterInterp;
+ Tcl_Interp *parentInterp;
if (objc < 4) {
aliasArgs:
Tcl_WrongNumArgs(interp, 2, objv,
- "slavePath slaveCmd ?masterPath masterCmd? ?arg ...?");
+ "childPath childCmd ?parentPath parentCmd? ?arg ...?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
if (objc == 4) {
- return AliasDescribe(interp, slaveInterp, objv[3]);
+ return AliasDescribe(interp, childInterp, objv[3]);
}
if ((objc == 5) && (TclGetString(objv[4])[0] == '\0')) {
- return AliasDelete(interp, slaveInterp, objv[3]);
+ return AliasDelete(interp, childInterp, objv[3]);
}
if (objc > 5) {
- masterInterp = GetInterp(interp, objv[4]);
- if (masterInterp == NULL) {
+ parentInterp = GetInterp(interp, objv[4]);
+ if (parentInterp == NULL) {
return TCL_ERROR;
}
- return AliasCreate(interp, slaveInterp, masterInterp, objv[3],
+ return AliasCreate(interp, childInterp, parentInterp, objv[3],
objv[5], objc - 6, objv + 6);
}
goto aliasArgs;
}
case OPT_ALIASES:
- slaveInterp = GetInterp2(interp, objc, objv);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp2(interp, objc, objv);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return AliasList(interp, slaveInterp);
+ return AliasList(interp, childInterp);
case OPT_BGERROR:
if (objc != 3 && objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "path ?cmdPrefix?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveBgerror(interp, slaveInterp, objc - 3, objv + 3);
+ return ChildBgerror(interp, childInterp, objc - 3, objv + 3);
case OPT_CANCEL: {
int i, flags;
Tcl_Obj *resultObjPtr;
@@ -734,18 +734,18 @@ NRInterpCmd(
}
/*
- * Did they specify a slave interp to cancel the script in progress
+ * Did they specify a child interp to cancel the script in progress
* in? If not, use the current interp.
*/
if (i < objc) {
- slaveInterp = GetInterp(interp, objv[i]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[i]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
i++;
} else {
- slaveInterp = interp;
+ childInterp = interp;
}
if (i < objc) {
@@ -761,11 +761,11 @@ NRInterpCmd(
resultObjPtr = NULL;
}
- return Tcl_CancelEval(slaveInterp, resultObjPtr, 0, flags);
+ return Tcl_CancelEval(childInterp, resultObjPtr, 0, flags);
}
case OPT_CREATE: {
int i, last, safe;
- Tcl_Obj *slavePtr;
+ Tcl_Obj *childPtr;
char buf[16 + TCL_INTEGER_SPACE];
static const char *const createOptions[] = {
"-safe", "--", NULL
@@ -780,7 +780,7 @@ NRInterpCmd(
* Weird historical rules: "-safe" is accepted at the end, too.
*/
- slavePtr = NULL;
+ childPtr = NULL;
last = 0;
for (i = 2; i < objc; i++) {
if ((last == 0) && (Tcl_GetString(objv[i])[0] == '-')) {
@@ -795,21 +795,21 @@ NRInterpCmd(
i++;
last = 1;
}
- if (slavePtr != NULL) {
+ if (childPtr != NULL) {
Tcl_WrongNumArgs(interp, 2, objv, "?-safe? ?--? ?path?");
return TCL_ERROR;
}
if (i < objc) {
- slavePtr = objv[i];
+ childPtr = objv[i];
}
}
buf[0] = '\0';
- if (slavePtr == NULL) {
+ if (childPtr == NULL) {
/*
* Create an anonymous interpreter -- we choose its name and the
* name of the command. We check that the command name that we use
* for the interpreter does not collide with an existing command
- * in the master interpreter.
+ * in the parent interpreter.
*/
for (i = 0; ; i++) {
@@ -820,15 +820,15 @@ NRInterpCmd(
break;
}
}
- slavePtr = Tcl_NewStringObj(buf, -1);
+ childPtr = Tcl_NewStringObj(buf, -1);
}
- if (SlaveCreate(interp, slavePtr, safe) == NULL) {
+ if (ChildCreate(interp, childPtr, safe) == NULL) {
if (buf[0] != '\0') {
- Tcl_DecrRefCount(slavePtr);
+ Tcl_DecrRefCount(childPtr);
}
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, slavePtr);
+ Tcl_SetObjResult(interp, childPtr);
return TCL_OK;
}
case OPT_DEBUG: /* TIP #378 */
@@ -840,29 +840,29 @@ NRInterpCmd(
Tcl_WrongNumArgs(interp, 2, objv, "path ?-frame ?bool??");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveDebugCmd(interp, slaveInterp, objc - 3, objv + 3);
+ return ChildDebugCmd(interp, childInterp, objc - 3, objv + 3);
case OPT_DELETE: {
int i;
InterpInfo *iiPtr;
for (i = 2; i < objc; i++) {
- slaveInterp = GetInterp(interp, objv[i]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[i]);
+ if (childInterp == NULL) {
return TCL_ERROR;
- } else if (slaveInterp == interp) {
+ } else if (childInterp == interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot delete the current interpreter", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"DELETESELF", NULL);
return TCL_ERROR;
}
- iiPtr = (InterpInfo *) ((Interp *) slaveInterp)->interpInfo;
- Tcl_DeleteCommandFromToken(iiPtr->slave.masterInterp,
- iiPtr->slave.interpCmd);
+ iiPtr = (InterpInfo *) ((Interp *) childInterp)->interpInfo;
+ Tcl_DeleteCommandFromToken(iiPtr->child.parentInterp,
+ iiPtr->child.interpCmd);
}
return TCL_OK;
}
@@ -871,16 +871,16 @@ NRInterpCmd(
Tcl_WrongNumArgs(interp, 2, objv, "path arg ?arg ...?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveEval(interp, slaveInterp, objc - 3, objv + 3);
+ return ChildEval(interp, childInterp, objc - 3, objv + 3);
case OPT_EXISTS: {
int exists = 1;
- slaveInterp = GetInterp2(interp, objc, objv);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp2(interp, objc, objv);
+ if (childInterp == NULL) {
if (objc > 3) {
return TCL_ERROR;
}
@@ -895,33 +895,33 @@ NRInterpCmd(
Tcl_WrongNumArgs(interp, 2, objv, "path hiddenCmdName ?cmdName?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveExpose(interp, slaveInterp, objc - 3, objv + 3);
+ return ChildExpose(interp, childInterp, objc - 3, objv + 3);
case OPT_HIDE:
if ((objc < 4) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "path cmdName ?hiddenCmdName?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveHide(interp, slaveInterp, objc - 3, objv + 3);
+ return ChildHide(interp, childInterp, objc - 3, objv + 3);
case OPT_HIDDEN:
- slaveInterp = GetInterp2(interp, objc, objv);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp2(interp, objc, objv);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveHidden(interp, slaveInterp);
+ return ChildHidden(interp, childInterp);
case OPT_ISSAFE:
- slaveInterp = GetInterp2(interp, objc, objv);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp2(interp, objc, objv);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tcl_IsSafe(slaveInterp)));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tcl_IsSafe(childInterp)));
return TCL_OK;
case OPT_INVOKEHID: {
int i;
@@ -960,11 +960,11 @@ NRInterpCmd(
"path ?-namespace ns? ?-global? ?--? cmd ?arg ..?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveInvokeHidden(interp, slaveInterp, namespaceName, objc - i,
+ return ChildInvokeHidden(interp, childInterp, namespaceName, objc - i,
objv + i);
}
case OPT_LIMIT: {
@@ -981,8 +981,8 @@ NRInterpCmd(
"path limitType ?-option value ...?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[3], limitTypes, "limit type", 0,
@@ -991,9 +991,9 @@ NRInterpCmd(
}
switch ((enum LimitTypes) limitType) {
case LIMIT_TYPE_COMMANDS:
- return SlaveCommandLimitCmd(interp, slaveInterp, 4, objc,objv);
+ return ChildCommandLimitCmd(interp, childInterp, 4, objc,objv);
case LIMIT_TYPE_TIME:
- return SlaveTimeLimitCmd(interp, slaveInterp, 4, objc, objv);
+ return ChildTimeLimitCmd(interp, childInterp, 4, objc, objv);
}
}
break;
@@ -1002,21 +1002,22 @@ NRInterpCmd(
Tcl_WrongNumArgs(interp, 2, objv, "path");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveMarkTrusted(interp, slaveInterp);
+ return ChildMarkTrusted(interp, childInterp);
case OPT_RECLIMIT:
if (objc != 3 && objc != 4) {
Tcl_WrongNumArgs(interp, 2, objv, "path ?newlimit?");
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- return SlaveRecursionLimit(interp, slaveInterp, objc - 3, objv + 3);
+ return ChildRecursionLimit(interp, childInterp, objc - 3, objv + 3);
+ case OPT_CHILDREN:
case OPT_SLAVES: {
InterpInfo *iiPtr;
Tcl_Obj *resultPtr;
@@ -1024,15 +1025,15 @@ NRInterpCmd(
Tcl_HashSearch hashSearch;
char *string;
- slaveInterp = GetInterp2(interp, objc, objv);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp2(interp, objc, objv);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- iiPtr = (InterpInfo *) ((Interp *) slaveInterp)->interpInfo;
+ iiPtr = (InterpInfo *) ((Interp *) childInterp)->interpInfo;
resultPtr = Tcl_NewObj();
- hPtr = Tcl_FirstHashEntry(&iiPtr->master.slaveTable, &hashSearch);
+ hPtr = Tcl_FirstHashEntry(&iiPtr->parent.childTable, &hashSearch);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
- string = (char *)Tcl_GetHashKey(&iiPtr->master.slaveTable, hPtr);
+ string = (char *)Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
Tcl_NewStringObj(string, -1));
}
@@ -1041,35 +1042,35 @@ NRInterpCmd(
}
case OPT_TRANSFER:
case OPT_SHARE: {
- Tcl_Interp *masterInterp; /* The master of the slave. */
+ Tcl_Interp *parentInterp; /* The parent of the child. */
Tcl_Channel chan;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "srcPath channelId destPath");
return TCL_ERROR;
}
- masterInterp = GetInterp(interp, objv[2]);
- if (masterInterp == NULL) {
+ parentInterp = GetInterp(interp, objv[2]);
+ if (parentInterp == NULL) {
return TCL_ERROR;
}
- chan = Tcl_GetChannel(masterInterp, TclGetString(objv[3]), NULL);
+ chan = Tcl_GetChannel(parentInterp, TclGetString(objv[3]), NULL);
if (chan == NULL) {
- Tcl_TransferResult(masterInterp, TCL_OK, interp);
+ Tcl_TransferResult(parentInterp, TCL_OK, interp);
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[4]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[4]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
- Tcl_RegisterChannel(slaveInterp, chan);
+ Tcl_RegisterChannel(childInterp, chan);
if (index == OPT_TRANSFER) {
/*
* When transferring, as opposed to sharing, we must unhitch the
* channel from the interpreter where it started.
*/
- if (Tcl_UnregisterChannel(masterInterp, chan) != TCL_OK) {
- Tcl_TransferResult(masterInterp, TCL_OK, interp);
+ if (Tcl_UnregisterChannel(parentInterp, chan) != TCL_OK) {
+ Tcl_TransferResult(parentInterp, TCL_OK, interp);
return TCL_ERROR;
}
}
@@ -1086,15 +1087,15 @@ NRInterpCmd(
return TCL_ERROR;
}
- slaveInterp = GetInterp(interp, objv[2]);
- if (slaveInterp == NULL) {
+ childInterp = GetInterp(interp, objv[2]);
+ if (childInterp == NULL) {
return TCL_ERROR;
}
aliasName = TclGetString(objv[3]);
- iiPtr = (InterpInfo *) ((Interp *) slaveInterp)->interpInfo;
- hPtr = Tcl_FindHashEntry(&iiPtr->slave.aliasTable, aliasName);
+ iiPtr = (InterpInfo *) ((Interp *) childInterp)->interpInfo;
+ hPtr = Tcl_FindHashEntry(&iiPtr->child.aliasTable, aliasName);
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"alias \"%s\" in path \"%s\" not found",
@@ -1167,46 +1168,46 @@ GetInterp2(
* A standard Tcl result.
*
* Side effects:
- * Creates a new alias, manipulates the result field of slaveInterp.
+ * Creates a new alias, manipulates the result field of childInterp.
*
*----------------------------------------------------------------------
*/
int
Tcl_CreateAlias(
- Tcl_Interp *slaveInterp, /* Interpreter for source command. */
- const char *slaveCmd, /* Command to install in slave. */
+ Tcl_Interp *childInterp, /* Interpreter for source command. */
+ const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
int argc, /* How many additional arguments? */
const char *const *argv) /* These are the additional args. */
{
- Tcl_Obj *slaveObjPtr, *targetObjPtr;
+ Tcl_Obj *childObjPtr, *targetObjPtr;
Tcl_Obj **objv;
int i;
int result;
- objv = (Tcl_Obj **)TclStackAlloc(slaveInterp, sizeof(Tcl_Obj *) * argc);
+ objv = (Tcl_Obj **)TclStackAlloc(childInterp, sizeof(Tcl_Obj *) * argc);
for (i = 0; i < argc; i++) {
objv[i] = Tcl_NewStringObj(argv[i], -1);
Tcl_IncrRefCount(objv[i]);
}
- slaveObjPtr = Tcl_NewStringObj(slaveCmd, -1);
- Tcl_IncrRefCount(slaveObjPtr);
+ childObjPtr = Tcl_NewStringObj(childCmd, -1);
+ Tcl_IncrRefCount(childObjPtr);
targetObjPtr = Tcl_NewStringObj(targetCmd, -1);
Tcl_IncrRefCount(targetObjPtr);
- result = AliasCreate(slaveInterp, slaveInterp, targetInterp, slaveObjPtr,
+ result = AliasCreate(childInterp, childInterp, targetInterp, childObjPtr,
targetObjPtr, argc, objv);
for (i = 0; i < argc; i++) {
Tcl_DecrRefCount(objv[i]);
}
- TclStackFree(slaveInterp, objv);
+ TclStackFree(childInterp, objv);
Tcl_DecrRefCount(targetObjPtr);
- Tcl_DecrRefCount(slaveObjPtr);
+ Tcl_DecrRefCount(childObjPtr);
return result;
}
@@ -1229,26 +1230,26 @@ Tcl_CreateAlias(
int
Tcl_CreateAliasObj(
- Tcl_Interp *slaveInterp, /* Interpreter for source command. */
- const char *slaveCmd, /* Command to install in slave. */
+ Tcl_Interp *childInterp, /* Interpreter for source command. */
+ const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
int objc, /* How many additional arguments? */
Tcl_Obj *const objv[]) /* Argument vector. */
{
- Tcl_Obj *slaveObjPtr, *targetObjPtr;
+ Tcl_Obj *childObjPtr, *targetObjPtr;
int result;
- slaveObjPtr = Tcl_NewStringObj(slaveCmd, -1);
- Tcl_IncrRefCount(slaveObjPtr);
+ childObjPtr = Tcl_NewStringObj(childCmd, -1);
+ Tcl_IncrRefCount(childObjPtr);
targetObjPtr = Tcl_NewStringObj(targetCmd, -1);
Tcl_IncrRefCount(targetObjPtr);
- result = AliasCreate(slaveInterp, slaveInterp, targetInterp, slaveObjPtr,
+ result = AliasCreate(childInterp, childInterp, targetInterp, childObjPtr,
targetObjPtr, objc, objv);
- Tcl_DecrRefCount(slaveObjPtr);
+ Tcl_DecrRefCount(childObjPtr);
Tcl_DecrRefCount(targetObjPtr);
return result;
}
@@ -1285,7 +1286,7 @@ Tcl_GetAlias(
int i, objc;
Tcl_Obj **objv;
- hPtr = Tcl_FindHashEntry(&iiPtr->slave.aliasTable, aliasName);
+ hPtr = Tcl_FindHashEntry(&iiPtr->child.aliasTable, aliasName);
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"alias \"%s\" not found", aliasName));
@@ -1347,7 +1348,7 @@ Tcl_GetAliasObj(
int objc;
Tcl_Obj **objv;
- hPtr = Tcl_FindHashEntry(&iiPtr->slave.aliasTable, aliasName);
+ hPtr = Tcl_FindHashEntry(&iiPtr->child.aliasTable, aliasName);
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"alias \"%s\" not found", aliasName));
@@ -1435,7 +1436,7 @@ TclPreventAliasLoop(
if (Tcl_InterpDeleted(nextAliasPtr->targetInterp)) {
/*
- * The slave interpreter can be deleted while creating the alias.
+ * The child interpreter can be deleted while creating the alias.
* [Bug #641195]
*/
@@ -1488,7 +1489,7 @@ TclPreventAliasLoop(
*
* Side effects:
* An alias command is created and entered into the alias table for the
- * slave interpreter.
+ * child interpreter.
*
*----------------------------------------------------------------------
*/
@@ -1496,9 +1497,9 @@ TclPreventAliasLoop(
static int
AliasCreate(
Tcl_Interp *interp, /* Interp for error reporting. */
- Tcl_Interp *slaveInterp, /* Interp where alias cmd will live or from
+ Tcl_Interp *childInterp, /* Interp where alias cmd will live or from
* which alias will be deleted. */
- Tcl_Interp *masterInterp, /* Interp in which target command will be
+ Tcl_Interp *parentInterp, /* Interp in which target command will be
* invoked. */
Tcl_Obj *namePtr, /* Name of alias cmd. */
Tcl_Obj *targetNamePtr, /* Name of target cmd. */
@@ -1508,15 +1509,15 @@ AliasCreate(
Alias *aliasPtr;
Tcl_HashEntry *hPtr;
Target *targetPtr;
- Slave *slavePtr;
- Master *masterPtr;
+ Child *childPtr;
+ Parent *parentPtr;
Tcl_Obj **prefv;
int isNew, i;
aliasPtr = (Alias *)ckalloc(sizeof(Alias) + objc * sizeof(Tcl_Obj *));
aliasPtr->token = namePtr;
Tcl_IncrRefCount(aliasPtr->token);
- aliasPtr->targetInterp = masterInterp;
+ aliasPtr->targetInterp = parentInterp;
aliasPtr->objc = objc + 1;
prefv = &aliasPtr->objPtr;
@@ -1528,21 +1529,21 @@ AliasCreate(
Tcl_IncrRefCount(objv[i]);
}
- Tcl_Preserve(slaveInterp);
- Tcl_Preserve(masterInterp);
+ Tcl_Preserve(childInterp);
+ Tcl_Preserve(parentInterp);
- if (slaveInterp == masterInterp) {
- aliasPtr->slaveCmd = Tcl_NRCreateCommand(slaveInterp,
+ if (childInterp == parentInterp) {
+ aliasPtr->childCmd = Tcl_NRCreateCommand(childInterp,
TclGetString(namePtr), TclLocalAliasObjCmd, AliasNRCmd,
aliasPtr, AliasObjCmdDeleteProc);
} else {
- aliasPtr->slaveCmd = Tcl_CreateObjCommand(slaveInterp,
+ aliasPtr->childCmd = Tcl_CreateObjCommand(childInterp,
TclGetString(namePtr), TclAliasObjCmd, aliasPtr,
AliasObjCmdDeleteProc);
}
- if (TclPreventAliasLoop(interp, slaveInterp,
- aliasPtr->slaveCmd) != TCL_OK) {
+ if (TclPreventAliasLoop(interp, childInterp,
+ aliasPtr->childCmd) != TCL_OK) {
/*
* Found an alias loop! The last call to Tcl_CreateObjCommand made the
* alias point to itself. Delete the command and its alias record. Be
@@ -1558,11 +1559,11 @@ AliasCreate(
Tcl_DecrRefCount(objv[i]);
}
- cmdPtr = (Command *) aliasPtr->slaveCmd;
+ cmdPtr = (Command *) aliasPtr->childCmd;
cmdPtr->clientData = NULL;
cmdPtr->deleteProc = NULL;
cmdPtr->deleteData = NULL;
- Tcl_DeleteCommandFromToken(slaveInterp, aliasPtr->slaveCmd);
+ Tcl_DeleteCommandFromToken(childInterp, aliasPtr->childCmd);
ckfree(aliasPtr);
@@ -1570,8 +1571,8 @@ AliasCreate(
* The result was already set by TclPreventAliasLoop.
*/
- Tcl_Release(slaveInterp);
- Tcl_Release(masterInterp);
+ Tcl_Release(childInterp);
+ Tcl_Release(parentInterp);
return TCL_ERROR;
}
@@ -1579,13 +1580,13 @@ AliasCreate(
* Make an entry in the alias table. If it already exists, retry.
*/
- slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
+ childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
while (1) {
Tcl_Obj *newToken;
const char *string;
string = TclGetString(aliasPtr->token);
- hPtr = Tcl_CreateHashEntry(&slavePtr->aliasTable, string, &isNew);
+ hPtr = Tcl_CreateHashEntry(&childPtr->aliasTable, string, &isNew);
if (isNew != 0) {
break;
}
@@ -1622,22 +1623,22 @@ AliasCreate(
*/
targetPtr = (Target *)ckalloc(sizeof(Target));
- targetPtr->slaveCmd = aliasPtr->slaveCmd;
- targetPtr->slaveInterp = slaveInterp;
+ targetPtr->childCmd = aliasPtr->childCmd;
+ targetPtr->childInterp = childInterp;
- masterPtr = &((InterpInfo*) ((Interp*) masterInterp)->interpInfo)->master;
- targetPtr->nextPtr = masterPtr->targetsPtr;
+ parentPtr = &((InterpInfo*) ((Interp*) parentInterp)->interpInfo)->parent;
+ targetPtr->nextPtr = parentPtr->targetsPtr;
targetPtr->prevPtr = NULL;
- if (masterPtr->targetsPtr != NULL) {
- masterPtr->targetsPtr->prevPtr = targetPtr;
+ if (parentPtr->targetsPtr != NULL) {
+ parentPtr->targetsPtr->prevPtr = targetPtr;
}
- masterPtr->targetsPtr = targetPtr;
+ parentPtr->targetsPtr = targetPtr;
aliasPtr->targetPtr = targetPtr;
Tcl_SetObjResult(interp, aliasPtr->token);
- Tcl_Release(slaveInterp);
- Tcl_Release(masterInterp);
+ Tcl_Release(childInterp);
+ Tcl_Release(parentInterp);
return TCL_OK;
}
@@ -1646,13 +1647,13 @@ AliasCreate(
*
* AliasDelete --
*
- * Deletes the given alias from the slave interpreter given.
+ * Deletes the given alias from the child interpreter given.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * Deletes the alias from the slave interpreter.
+ * Deletes the alias from the child interpreter.
*
*----------------------------------------------------------------------
*/
@@ -1660,21 +1661,21 @@ AliasCreate(
static int
AliasDelete(
Tcl_Interp *interp, /* Interpreter for result & errors. */
- Tcl_Interp *slaveInterp, /* Interpreter containing alias. */
+ Tcl_Interp *childInterp, /* Interpreter containing alias. */
Tcl_Obj *namePtr) /* Name of alias to delete. */
{
- Slave *slavePtr;
+ Child *childPtr;
Alias *aliasPtr;
Tcl_HashEntry *hPtr;
/*
- * If the alias has been renamed in the slave, the master can still use
+ * If the alias has been renamed in the child, the parent can still use
* the original name (with which it was created) to find the alias to
* delete it.
*/
- slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
- hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, TclGetString(namePtr));
+ childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
+ hPtr = Tcl_FindHashEntry(&childPtr->aliasTable, TclGetString(namePtr));
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"alias \"%s\" not found", TclGetString(namePtr)));
@@ -1683,7 +1684,7 @@ AliasDelete(
return TCL_ERROR;
}
aliasPtr = (Alias *)Tcl_GetHashValue(hPtr);
- Tcl_DeleteCommandFromToken(slaveInterp, aliasPtr->slaveCmd);
+ Tcl_DeleteCommandFromToken(childInterp, aliasPtr->childCmd);
return TCL_OK;
}
@@ -1708,22 +1709,22 @@ AliasDelete(
static int
AliasDescribe(
Tcl_Interp *interp, /* Interpreter for result & errors. */
- Tcl_Interp *slaveInterp, /* Interpreter containing alias. */
+ Tcl_Interp *childInterp, /* Interpreter containing alias. */
Tcl_Obj *namePtr) /* Name of alias to describe. */
{
- Slave *slavePtr;
+ Child *childPtr;
Tcl_HashEntry *hPtr;
Alias *aliasPtr;
Tcl_Obj *prefixPtr;
/*
- * If the alias has been renamed in the slave, the master can still use
+ * If the alias has been renamed in the child, the parent can still use
* the original name (with which it was created) to find the alias to
* describe it.
*/
- slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
- hPtr = Tcl_FindHashEntry(&slavePtr->aliasTable, Tcl_GetString(namePtr));
+ childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
+ hPtr = Tcl_FindHashEntry(&childPtr->aliasTable, Tcl_GetString(namePtr));
if (hPtr == NULL) {
return TCL_OK;
}
@@ -1738,7 +1739,7 @@ AliasDescribe(
*
* AliasList --
*
- * Computes a list of aliases defined in a slave interpreter.
+ * Computes a list of aliases defined in a child interpreter.
*
* Results:
* A standard Tcl result.
@@ -1752,17 +1753,17 @@ AliasDescribe(
static int
AliasList(
Tcl_Interp *interp, /* Interp for data return. */
- Tcl_Interp *slaveInterp) /* Interp whose aliases to compute. */
+ Tcl_Interp *childInterp) /* Interp whose aliases to compute. */
{
Tcl_HashEntry *entryPtr;
Tcl_HashSearch hashSearch;
Tcl_Obj *resultPtr = Tcl_NewObj();
Alias *aliasPtr;
- Slave *slavePtr;
+ Child *childPtr;
- slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
+ childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
- entryPtr = Tcl_FirstHashEntry(&slavePtr->aliasTable, &hashSearch);
+ entryPtr = Tcl_FirstHashEntry(&childPtr->aliasTable, &hashSearch);
for ( ; entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&hashSearch)) {
aliasPtr = (Alias *)Tcl_GetHashValue(entryPtr);
Tcl_ListObjAppendElement(NULL, resultPtr, aliasPtr->token);
@@ -1776,10 +1777,10 @@ AliasList(
*
* TclAliasObjCmd, TclLocalAliasObjCmd --
*
- * This is the function that services invocations of aliases in a slave
+ * This is the function that services invocations of aliases in a child
* interpreter. One such command exists for each alias. When invoked,
* this function redirects the invocation to the target command in the
- * master interpreter as designated by the Alias record associated with
+ * parent interpreter as designated by the Alias record associated with
* this command.
*
* TclLocalAliasObjCmd is a stripped down version used when the source
@@ -2009,7 +2010,7 @@ TclLocalAliasObjCmd(
*
* AliasObjCmdDeleteProc --
*
- * Is invoked when an alias command is deleted in a slave. Cleans up all
+ * Is invoked when an alias command is deleted in a child. Cleans up all
* storage associated with this alias.
*
* Results:
@@ -2039,17 +2040,17 @@ AliasObjCmdDeleteProc(
Tcl_DeleteHashEntry(aliasPtr->aliasEntryPtr);
/*
- * Splice the target record out of the target interpreter's master list.
+ * Splice the target record out of the target interpreter's parent list.
*/
targetPtr = aliasPtr->targetPtr;
if (targetPtr->prevPtr != NULL) {
targetPtr->prevPtr->nextPtr = targetPtr->nextPtr;
} else {
- Master *masterPtr = &((InterpInfo *) ((Interp *)
- aliasPtr->targetInterp)->interpInfo)->master;
+ Parent *parentPtr = &((InterpInfo *) ((Interp *)
+ aliasPtr->targetInterp)->interpInfo)->parent;
- masterPtr->targetsPtr = targetPtr->nextPtr;
+ parentPtr->targetsPtr = targetPtr->nextPtr;
}
if (targetPtr->nextPtr != NULL) {
targetPtr->nextPtr->prevPtr = targetPtr->prevPtr;
@@ -2062,13 +2063,13 @@ AliasObjCmdDeleteProc(
/*
*----------------------------------------------------------------------
*
- * Tcl_CreateSlave --
+ * Tcl_CreateChild --
*
- * Creates a slave interpreter. The slavePath argument denotes the name
- * of the new slave relative to the current interpreter; the slave is a
+ * Creates a child interpreter. The childPath argument denotes the name
+ * of the new child relative to the current interpreter; the child is a
* direct descendant of the one-before-last component of the path,
- * e.g. it is a descendant of the current interpreter if the slavePath
- * argument contains only one component. Optionally makes the slave
+ * e.g. it is a descendant of the current interpreter if the childPath
+ * argument contains only one component. Optionally makes the child
* interpreter safe.
*
* Results:
@@ -2077,33 +2078,33 @@ AliasObjCmdDeleteProc(
*
* Side effects:
* Creates a new interpreter and a new interpreter object command in the
- * interpreter indicated by the slavePath argument.
+ * interpreter indicated by the childPath argument.
*
*----------------------------------------------------------------------
*/
Tcl_Interp *
-Tcl_CreateSlave(
+Tcl_CreateChild(
Tcl_Interp *interp, /* Interpreter to start search at. */
- const char *slavePath, /* Name of slave to create. */
- int isSafe) /* Should new slave be "safe" ? */
+ const char *childPath, /* Name of child to create. */
+ int isSafe) /* Should new child be "safe" ? */
{
Tcl_Obj *pathPtr;
- Tcl_Interp *slaveInterp;
+ Tcl_Interp *childInterp;
- pathPtr = Tcl_NewStringObj(slavePath, -1);
- slaveInterp = SlaveCreate(interp, pathPtr, isSafe);
+ pathPtr = Tcl_NewStringObj(childPath, -1);
+ childInterp = ChildCreate(interp, pathPtr, isSafe);
Tcl_DecrRefCount(pathPtr);
- return slaveInterp;
+ return childInterp;
}
/*
*----------------------------------------------------------------------
*
- * Tcl_GetSlave --
+ * Tcl_GetChild --
*
- * Finds a slave interpreter by its path name.
+ * Finds a child interpreter by its path name.
*
* Results:
* Returns a Tcl_Interp * for the named interpreter or NULL if not found.
@@ -2115,29 +2116,29 @@ Tcl_CreateSlave(
*/
Tcl_Interp *
-Tcl_GetSlave(
+Tcl_GetChild(
Tcl_Interp *interp, /* Interpreter to start search from. */
- const char *slavePath) /* Path of slave to find. */
+ const char *childPath) /* Path of child to find. */
{
Tcl_Obj *pathPtr;
- Tcl_Interp *slaveInterp;
+ Tcl_Interp *childInterp;
- pathPtr = Tcl_NewStringObj(slavePath, -1);
- slaveInterp = GetInterp(interp, pathPtr);
+ pathPtr = Tcl_NewStringObj(childPath, -1);
+ childInterp = GetInterp(interp, pathPtr);
Tcl_DecrRefCount(pathPtr);
- return slaveInterp;
+ return childInterp;
}
/*
*----------------------------------------------------------------------
*
- * Tcl_GetMaster --
+ * Tcl_GetParent --
*
- * Finds the master interpreter of a slave interpreter.
+ * Finds the parent interpreter of a child interpreter.
*
* Results:
- * Returns a Tcl_Interp * for the master interpreter or NULL if none.
+ * Returns a Tcl_Interp * for the parent interpreter or NULL if none.
*
* Side effects:
* None.
@@ -2146,24 +2147,24 @@ Tcl_GetSlave(
*/
Tcl_Interp *
-Tcl_GetMaster(
- Tcl_Interp *interp) /* Get the master of this interpreter. */
+Tcl_GetParent(
+ Tcl_Interp *interp) /* Get the parent of this interpreter. */
{
- Slave *slavePtr; /* Slave record of this interpreter. */
+ Child *childPtr; /* Child record of this interpreter. */
if (interp == NULL) {
return NULL;
}
- slavePtr = &((InterpInfo *) ((Interp *) interp)->interpInfo)->slave;
- return slavePtr->masterInterp;
+ childPtr = &((InterpInfo *) ((Interp *) interp)->interpInfo)->child;
+ return childPtr->parentInterp;
}
/*
*----------------------------------------------------------------------
*
- * TclSetSlaveCancelFlags --
+ * TclSetChildCancelFlags --
*
- * This function marks all slave interpreters belonging to a given
+ * This function marks all child interpreters belonging to a given
* interpreter as being canceled or not canceled, depending on the
* provided flags.
*
@@ -2177,7 +2178,7 @@ Tcl_GetMaster(
*/
void
-TclSetSlaveCancelFlags(
+TclSetChildCancelFlags(
Tcl_Interp *interp, /* Set cancel flags of this interpreter. */
int flags, /* Collection of OR-ed bits that control
* the cancellation of the script. Only
@@ -2186,10 +2187,10 @@ TclSetSlaveCancelFlags(
int force) /* Non-zero to ignore numLevels for the purpose
* of resetting the cancellation flags. */
{
- Master *masterPtr; /* Master record of given interpreter. */
+ Parent *parentPtr; /* Parent record of given interpreter. */
Tcl_HashEntry *hPtr; /* Search element. */
Tcl_HashSearch hashSearch; /* Search variable. */
- Slave *slavePtr; /* Slave record of interpreter. */
+ Child *childPtr; /* Child record of interpreter. */
Interp *iPtr;
if (interp == NULL) {
@@ -2198,12 +2199,12 @@ TclSetSlaveCancelFlags(
flags &= (CANCELED | TCL_CANCEL_UNWIND);
- masterPtr = &((InterpInfo *) ((Interp *) interp)->interpInfo)->master;
+ parentPtr = &((InterpInfo *) ((Interp *) interp)->interpInfo)->parent;
- hPtr = Tcl_FirstHashEntry(&masterPtr->slaveTable, &hashSearch);
+ hPtr = Tcl_FirstHashEntry(&parentPtr->childTable, &hashSearch);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
- slavePtr = (Slave *)Tcl_GetHashValue(hPtr);
- iPtr = (Interp *) slavePtr->slaveInterp;
+ childPtr = (Child *)Tcl_GetHashValue(hPtr);
+ iPtr = (Interp *) childPtr->childInterp;
if (iPtr == NULL) {
continue;
@@ -2216,11 +2217,11 @@ TclSetSlaveCancelFlags(
}
/*
- * Now, recursively handle this for the slaves of this slave
+ * Now, recursively handle this for the children of this child
* interpreter.
*/
- TclSetSlaveCancelFlags((Tcl_Interp *) iPtr, flags, force);
+ TclSetChildCancelFlags((Tcl_Interp *) iPtr, flags, force);
}
}
@@ -2232,7 +2233,7 @@ TclSetSlaveCancelFlags(
* Sets the result of the asking interpreter to a proper Tcl list
* containing the names of interpreters between the asking and target
* interpreters. The target interpreter must be either the same as the
- * asking interpreter or one of its slaves (including recursively).
+ * asking interpreter or one of its children (including recursively).
*
* Results:
* TCL_OK if the target interpreter is the same as, or a descendant of,
@@ -2250,25 +2251,25 @@ TclSetSlaveCancelFlags(
int
Tcl_GetInterpPath(
- Tcl_Interp *askingInterp, /* Interpreter to start search from. */
+ Tcl_Interp *interp, /* Interpreter to start search from. */
Tcl_Interp *targetInterp) /* Interpreter to find. */
{
InterpInfo *iiPtr;
- if (targetInterp == askingInterp) {
- Tcl_SetObjResult(askingInterp, Tcl_NewObj());
+ if (targetInterp == interp) {
+ Tcl_SetObjResult(interp, Tcl_NewObj());
return TCL_OK;
}
if (targetInterp == NULL) {
return TCL_ERROR;
}
iiPtr = (InterpInfo *) ((Interp *) targetInterp)->interpInfo;
- if (Tcl_GetInterpPath(askingInterp, iiPtr->slave.masterInterp) != TCL_OK){
+ if (Tcl_GetInterpPath(interp, iiPtr->child.parentInterp) != TCL_OK){
return TCL_ERROR;
}
- Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(askingInterp),
- Tcl_NewStringObj((const char *)Tcl_GetHashKey(&iiPtr->master.slaveTable,
- iiPtr->slave.slaveEntryPtr), -1));
+ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
+ Tcl_NewStringObj((const char *)Tcl_GetHashKey(&iiPtr->parent.childTable,
+ iiPtr->child.childEntryPtr), -1));
return TCL_OK;
}
@@ -2277,10 +2278,10 @@ Tcl_GetInterpPath(
*
* GetInterp --
*
- * Helper function to find a slave interpreter given a pathname.
+ * Helper function to find a child interpreter given a pathname.
*
* Results:
- * Returns the slave interpreter known by that name in the calling
+ * Returns the child interpreter known by that name in the calling
* interpreter, or NULL if no interpreter known by that name exists.
*
* Side effects:
@@ -2296,11 +2297,11 @@ GetInterp(
* be found. */
{
Tcl_HashEntry *hPtr; /* Search element. */
- Slave *slavePtr; /* Interim slave record. */
+ Child *childPtr; /* Interim child record. */
Tcl_Obj **objv;
int objc, i;
Tcl_Interp *searchInterp; /* Interim storage for interp. to find. */
- InterpInfo *masterInfoPtr;
+ InterpInfo *parentInfoPtr;
if (TclListObjGetElements(interp, pathPtr, &objc, &objv) != TCL_OK) {
return NULL;
@@ -2308,15 +2309,15 @@ GetInterp(
searchInterp = interp;
for (i = 0; i < objc; i++) {
- masterInfoPtr = (InterpInfo *) ((Interp *) searchInterp)->interpInfo;
- hPtr = Tcl_FindHashEntry(&masterInfoPtr->master.slaveTable,
+ parentInfoPtr = (InterpInfo *) ((Interp *) searchInterp)->interpInfo;
+ hPtr = Tcl_FindHashEntry(&parentInfoPtr->parent.childTable,
TclGetString(objv[i]));
if (hPtr == NULL) {
searchInterp = NULL;
break;
}
- slavePtr = (Slave *)Tcl_GetHashValue(hPtr);
- searchInterp = slavePtr->slaveInterp;
+ childPtr = (Child *)Tcl_GetHashValue(hPtr);
+ searchInterp = childPtr->childInterp;
if (searchInterp == NULL) {
break;
}
@@ -2333,7 +2334,7 @@ GetInterp(
/*
*----------------------------------------------------------------------
*
- * SlaveBgerror --
+ * ChildBgerror --
*
* Helper function to set/query the background error handling command
* prefix of an interp
@@ -2342,16 +2343,16 @@ GetInterp(
* A standard Tcl result.
*
* Side effects:
- * When (objc == 1), slaveInterp will be set to a new background handler
+ * When (objc == 1), childInterp will be set to a new background handler
* of objv[0].
*
*----------------------------------------------------------------------
*/
static int
-SlaveBgerror(
+ChildBgerror(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* Interp in which limit is set/queried. */
+ Tcl_Interp *childInterp, /* Interp in which limit is set/queried. */
int objc, /* Set or Query. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
@@ -2366,19 +2367,19 @@ SlaveBgerror(
"BGERRORFORMAT", NULL);
return TCL_ERROR;
}
- TclSetBgErrorHandler(slaveInterp, objv[0]);
+ TclSetBgErrorHandler(childInterp, objv[0]);
}
- Tcl_SetObjResult(interp, TclGetBgErrorHandler(slaveInterp));
+ Tcl_SetObjResult(interp, TclGetBgErrorHandler(childInterp));
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * SlaveCreate --
+ * ChildCreate --
*
- * Helper function to do the actual work of creating a slave interp and
- * new object command. Also optionally makes the new slave interpreter
+ * Helper function to do the actual work of creating a child interp and
+ * new object command. Also optionally makes the new child interpreter
* "safe".
*
* Results:
@@ -2386,20 +2387,20 @@ SlaveBgerror(
* the result of the invoking interpreter contains an error message.
*
* Side effects:
- * Creates a new slave interpreter and a new object command.
+ * Creates a new child interpreter and a new object command.
*
*----------------------------------------------------------------------
*/
static Tcl_Interp *
-SlaveCreate(
+ChildCreate(
Tcl_Interp *interp, /* Interp. to start search from. */
- Tcl_Obj *pathPtr, /* Path (name) of slave to create. */
+ Tcl_Obj *pathPtr, /* Path (name) of child to create. */
int safe) /* Should we make it "safe"? */
{
- Tcl_Interp *masterInterp, *slaveInterp;
- Slave *slavePtr;
- InterpInfo *masterInfoPtr;
+ Tcl_Interp *parentInterp, *childInterp;
+ Child *childPtr;
+ InterpInfo *parentInfoPtr;
Tcl_HashEntry *hPtr;
const char *path;
int isNew, objc;
@@ -2409,25 +2410,25 @@ SlaveCreate(
return NULL;
}
if (objc < 2) {
- masterInterp = interp;
+ parentInterp = interp;
path = TclGetString(pathPtr);
} else {
Tcl_Obj *objPtr;
objPtr = Tcl_NewListObj(objc - 1, objv);
- masterInterp = GetInterp(interp, objPtr);
+ parentInterp = GetInterp(interp, objPtr);
Tcl_DecrRefCount(objPtr);
- if (masterInterp == NULL) {
+ if (parentInterp == NULL) {
return NULL;
}
path = TclGetString(objv[objc - 1]);
}
if (safe == 0) {
- safe = Tcl_IsSafe(masterInterp);
+ safe = Tcl_IsSafe(parentInterp);
}
- masterInfoPtr = (InterpInfo *) ((Interp *) masterInterp)->interpInfo;
- hPtr = Tcl_CreateHashEntry(&masterInfoPtr->master.slaveTable, path,
+ parentInfoPtr = (InterpInfo *) ((Interp *) parentInterp)->interpInfo;
+ hPtr = Tcl_CreateHashEntry(&parentInfoPtr->parent.childTable, path,
&isNew);
if (isNew == 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -2436,51 +2437,51 @@ SlaveCreate(
return NULL;
}
- slaveInterp = Tcl_CreateInterp();
- slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
- slavePtr->masterInterp = masterInterp;
- slavePtr->slaveEntryPtr = hPtr;
- slavePtr->slaveInterp = slaveInterp;
- slavePtr->interpCmd = Tcl_NRCreateCommand(masterInterp, path,
- TclSlaveObjCmd, NRSlaveCmd, slaveInterp, SlaveObjCmdDeleteProc);
- Tcl_InitHashTable(&slavePtr->aliasTable, TCL_STRING_KEYS);
- Tcl_SetHashValue(hPtr, slavePtr);
- Tcl_SetVar2(slaveInterp, "tcl_interactive", NULL, "0", TCL_GLOBAL_ONLY);
+ childInterp = Tcl_CreateInterp();
+ childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
+ childPtr->parentInterp = parentInterp;
+ childPtr->childEntryPtr = hPtr;
+ childPtr->childInterp = childInterp;
+ childPtr->interpCmd = Tcl_NRCreateCommand(parentInterp, path,
+ TclChildObjCmd, NRChildCmd, childInterp, ChildObjCmdDeleteProc);
+ Tcl_InitHashTable(&childPtr->aliasTable, TCL_STRING_KEYS);
+ Tcl_SetHashValue(hPtr, childPtr);
+ Tcl_SetVar2(childInterp, "tcl_interactive", NULL, "0", TCL_GLOBAL_ONLY);
/*
* Inherit the recursion limit.
*/
- ((Interp *) slaveInterp)->maxNestingDepth =
- ((Interp *) masterInterp)->maxNestingDepth;
+ ((Interp *) childInterp)->maxNestingDepth =
+ ((Interp *) parentInterp)->maxNestingDepth;
if (safe) {
- if (Tcl_MakeSafe(slaveInterp) == TCL_ERROR) {
+ if (Tcl_MakeSafe(childInterp) == TCL_ERROR) {
goto error;
}
} else {
- if (Tcl_Init(slaveInterp) == TCL_ERROR) {
+ if (Tcl_Init(childInterp) == TCL_ERROR) {
goto error;
}
/*
- * This will create the "memory" command in slave interpreters if we
+ * This will create the "memory" command in child interpreters if we
* compiled with TCL_MEM_DEBUG, otherwise it does nothing.
*/
- Tcl_InitMemory(slaveInterp);
+ Tcl_InitMemory(childInterp);
}
/*
* Inherit the TIP#143 limits.
*/
- InheritLimitsFromMaster(slaveInterp, masterInterp);
+ InheritLimitsFromParent(childInterp, parentInterp);
/*
* The [clock] command presents a safe API, but uses unsafe features in
* its implementation. This means it has to be implemented in safe interps
- * as an alias to a version in the (trusted) master.
+ * as an alias to a version in the (trusted) parent.
*/
if (safe) {
@@ -2489,7 +2490,7 @@ SlaveCreate(
TclNewLiteralStringObj(clockObj, "clock");
Tcl_IncrRefCount(clockObj);
- status = AliasCreate(interp, slaveInterp, masterInterp, clockObj,
+ status = AliasCreate(interp, childInterp, parentInterp, clockObj,
clockObj, 0, NULL);
Tcl_DecrRefCount(clockObj);
if (status != TCL_OK) {
@@ -2497,12 +2498,12 @@ SlaveCreate(
}
}
- return slaveInterp;
+ return childInterp;
error:
- Tcl_TransferResult(slaveInterp, TCL_ERROR, interp);
+ Tcl_TransferResult(childInterp, TCL_ERROR, interp);
error2:
- Tcl_DeleteInterp(slaveInterp);
+ Tcl_DeleteInterp(childInterp);
return NULL;
}
@@ -2510,10 +2511,10 @@ SlaveCreate(
/*
*----------------------------------------------------------------------
*
- * TclSlaveObjCmd --
+ * TclChildObjCmd --
*
* Command to manipulate an interpreter, e.g. to send commands to it to
- * be evaluated. One such command exists for each slave interpreter.
+ * be evaluated. One such command exists for each child interpreter.
*
* Results:
* A standard Tcl result.
@@ -2525,23 +2526,23 @@ SlaveCreate(
*/
int
-TclSlaveObjCmd(
- ClientData clientData, /* Slave interpreter. */
+TclChildObjCmd(
+ ClientData clientData, /* Child interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- return Tcl_NRCallObjProc(interp, NRSlaveCmd, clientData, objc, objv);
+ return Tcl_NRCallObjProc(interp, NRChildCmd, clientData, objc, objv);
}
static int
-NRSlaveCmd(
- ClientData clientData, /* Slave interpreter. */
+NRChildCmd(
+ ClientData clientData, /* Child interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tcl_Interp *slaveInterp = (Tcl_Interp *)clientData;
+ Tcl_Interp *childInterp = (Tcl_Interp *)clientData;
int index;
static const char *const options[] = {
"alias", "aliases", "bgerror", "debug",
@@ -2556,8 +2557,8 @@ NRSlaveCmd(
OPT_RECLIMIT
};
- if (slaveInterp == NULL) {
- Tcl_Panic("TclSlaveObjCmd: interpreter has been deleted");
+ if (childInterp == NULL) {
+ Tcl_Panic("TclChildObjCmd: interpreter has been deleted");
}
if (objc < 2) {
@@ -2573,14 +2574,14 @@ NRSlaveCmd(
case OPT_ALIAS:
if (objc > 2) {
if (objc == 3) {
- return AliasDescribe(interp, slaveInterp, objv[2]);
+ return AliasDescribe(interp, childInterp, objv[2]);
}
if (TclGetString(objv[3])[0] == '\0') {
if (objc == 4) {
- return AliasDelete(interp, slaveInterp, objv[2]);
+ return AliasDelete(interp, childInterp, objv[2]);
}
} else {
- return AliasCreate(interp, slaveInterp, interp, objv[2],
+ return AliasCreate(interp, childInterp, interp, objv[2],
objv[3], objc - 4, objv + 4);
}
}
@@ -2591,13 +2592,13 @@ NRSlaveCmd(
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
- return AliasList(interp, slaveInterp);
+ return AliasList(interp, childInterp);
case OPT_BGERROR:
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?cmdPrefix?");
return TCL_ERROR;
}
- return SlaveBgerror(interp, slaveInterp, objc - 2, objv + 2);
+ return ChildBgerror(interp, childInterp, objc - 2, objv + 2);
case OPT_DEBUG:
/*
* TIP #378
@@ -2607,37 +2608,37 @@ NRSlaveCmd(
Tcl_WrongNumArgs(interp, 2, objv, "?-frame ?bool??");
return TCL_ERROR;
}
- return SlaveDebugCmd(interp, slaveInterp, objc - 2, objv + 2);
+ return ChildDebugCmd(interp, childInterp, objc - 2, objv + 2);
case OPT_EVAL:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "arg ?arg ...?");
return TCL_ERROR;
}
- return SlaveEval(interp, slaveInterp, objc - 2, objv + 2);
+ return ChildEval(interp, childInterp, objc - 2, objv + 2);
case OPT_EXPOSE:
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "hiddenCmdName ?cmdName?");
return TCL_ERROR;
}
- return SlaveExpose(interp, slaveInterp, objc - 2, objv + 2);
+ return ChildExpose(interp, childInterp, objc - 2, objv + 2);
case OPT_HIDE:
if ((objc < 3) || (objc > 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "cmdName ?hiddenCmdName?");
return TCL_ERROR;
}
- return SlaveHide(interp, slaveInterp, objc - 2, objv + 2);
+ return ChildHide(interp, childInterp, objc - 2, objv + 2);
case OPT_HIDDEN:
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
- return SlaveHidden(interp, slaveInterp);
+ return ChildHidden(interp, childInterp);
case OPT_ISSAFE:
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tcl_IsSafe(slaveInterp)));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(Tcl_IsSafe(childInterp)));
return TCL_OK;
case OPT_INVOKEHIDDEN: {
int i;
@@ -2676,7 +2677,7 @@ NRSlaveCmd(
"?-namespace ns? ?-global? ?--? cmd ?arg ..?");
return TCL_ERROR;
}
- return SlaveInvokeHidden(interp, slaveInterp, namespaceName,
+ return ChildInvokeHidden(interp, childInterp, namespaceName,
objc - i, objv + i);
}
case OPT_LIMIT: {
@@ -2698,9 +2699,9 @@ NRSlaveCmd(
}
switch ((enum LimitTypes) limitType) {
case LIMIT_TYPE_COMMANDS:
- return SlaveCommandLimitCmd(interp, slaveInterp, 3, objc,objv);
+ return ChildCommandLimitCmd(interp, childInterp, 3, objc,objv);
case LIMIT_TYPE_TIME:
- return SlaveTimeLimitCmd(interp, slaveInterp, 3, objc, objv);
+ return ChildTimeLimitCmd(interp, childInterp, 3, objc, objv);
}
}
break;
@@ -2709,13 +2710,13 @@ NRSlaveCmd(
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
}
- return SlaveMarkTrusted(interp, slaveInterp);
+ return ChildMarkTrusted(interp, childInterp);
case OPT_RECLIMIT:
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "?newlimit?");
return TCL_ERROR;
}
- return SlaveRecursionLimit(interp, slaveInterp, objc - 2, objv + 2);
+ return ChildRecursionLimit(interp, childInterp, objc - 2, objv + 2);
}
return TCL_ERROR;
@@ -2724,71 +2725,71 @@ NRSlaveCmd(
/*
*----------------------------------------------------------------------
*
- * SlaveObjCmdDeleteProc --
+ * ChildObjCmdDeleteProc --
*
- * Invoked when an object command for a slave interpreter is deleted;
- * cleans up all state associated with the slave interpreter and destroys
- * the slave interpreter.
+ * Invoked when an object command for a child interpreter is deleted;
+ * cleans up all state associated with the child interpreter and destroys
+ * the child interpreter.
*
* Results:
* None.
*
* Side effects:
- * Cleans up all state associated with the slave interpreter and destroys
- * the slave interpreter.
+ * Cleans up all state associated with the child interpreter and destroys
+ * the child interpreter.
*
*----------------------------------------------------------------------
*/
static void
-SlaveObjCmdDeleteProc(
- ClientData clientData) /* The SlaveRecord for the command. */
+ChildObjCmdDeleteProc(
+ ClientData clientData) /* The ChildRecord for the command. */
{
- Slave *slavePtr; /* Interim storage for Slave record. */
- Tcl_Interp *slaveInterp = (Tcl_Interp *)clientData;
- /* And for a slave interp. */
+ Child *childPtr; /* Interim storage for Child record. */
+ Tcl_Interp *childInterp = (Tcl_Interp *)clientData;
+ /* And for a child interp. */
- slavePtr = &((InterpInfo *) ((Interp *) slaveInterp)->interpInfo)->slave;
+ childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
/*
- * Unlink the slave from its master interpreter.
+ * Unlink the child from its parent interpreter.
*/
- Tcl_DeleteHashEntry(slavePtr->slaveEntryPtr);
+ Tcl_DeleteHashEntry(childPtr->childEntryPtr);
/*
- * Set to NULL so that when the InterpInfo is cleaned up in the slave it
+ * Set to NULL so that when the InterpInfo is cleaned up in the child it
* does not try to delete the command causing all sorts of grief. See
- * SlaveRecordDeleteProc().
+ * ChildRecordDeleteProc().
*/
- slavePtr->interpCmd = NULL;
+ childPtr->interpCmd = NULL;
- if (slavePtr->slaveInterp != NULL) {
- Tcl_DeleteInterp(slavePtr->slaveInterp);
+ if (childPtr->childInterp != NULL) {
+ Tcl_DeleteInterp(childPtr->childInterp);
}
}
/*
*----------------------------------------------------------------------
*
- * SlaveDebugCmd -- TIP #378
+ * ChildDebugCmd -- TIP #378
*
- * Helper function to handle 'debug' command in a slave interpreter.
+ * Helper function to handle 'debug' command in a child interpreter.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * May modify INTERP_DEBUG_FRAME flag in the slave.
+ * May modify INTERP_DEBUG_FRAME flag in the child.
*
*----------------------------------------------------------------------
*/
static int
-SlaveDebugCmd(
+ChildDebugCmd(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* The slave interpreter in which command
+ Tcl_Interp *childInterp, /* The child interpreter in which command
* will be evaluated. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2803,7 +2804,7 @@ SlaveDebugCmd(
Interp *iPtr;
Tcl_Obj *resultPtr;
- iPtr = (Interp *) slaveInterp;
+ iPtr = (Interp *) childInterp;
if (objc == 0) {
resultPtr = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, resultPtr,
@@ -2843,9 +2844,9 @@ SlaveDebugCmd(
/*
*----------------------------------------------------------------------
*
- * SlaveEval --
+ * ChildEval --
*
- * Helper function to evaluate a command in a slave interpreter.
+ * Helper function to evaluate a command in a child interpreter.
*
* Results:
* A standard Tcl result.
@@ -2857,9 +2858,9 @@ SlaveDebugCmd(
*/
static int
-SlaveEval(
+ChildEval(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* The slave interpreter in which command
+ Tcl_Interp *childInterp, /* The child interpreter in which command
* will be evaluated. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2867,17 +2868,17 @@ SlaveEval(
int result;
/*
- * TIP #285: If necessary, reset the cancellation flags for the slave
- * interpreter now; otherwise, canceling a script in a master interpreter
- * can result in a situation where a slave interpreter can no longer
+ * TIP #285: If necessary, reset the cancellation flags for the child
+ * interpreter now; otherwise, canceling a script in a parent interpreter
+ * can result in a situation where a child interpreter can no longer
* evaluate any scripts unless somebody calls the TclResetCancellation
* function for that particular Tcl_Interp.
*/
- TclSetSlaveCancelFlags(slaveInterp, 0, 0);
+ TclSetChildCancelFlags(childInterp, 0, 0);
- Tcl_Preserve(slaveInterp);
- Tcl_AllowExceptions(slaveInterp);
+ Tcl_Preserve(childInterp);
+ Tcl_AllowExceptions(childInterp);
if (objc == 1) {
/*
@@ -2890,40 +2891,40 @@ SlaveEval(
TclArgumentGet(interp, objv[0], &invoker, &word);
- result = TclEvalObjEx(slaveInterp, objv[0], 0, invoker, word);
+ result = TclEvalObjEx(childInterp, objv[0], 0, invoker, word);
} else {
Tcl_Obj *objPtr = Tcl_ConcatObj(objc, objv);
Tcl_IncrRefCount(objPtr);
- result = Tcl_EvalObjEx(slaveInterp, objPtr, 0);
+ result = Tcl_EvalObjEx(childInterp, objPtr, 0);
Tcl_DecrRefCount(objPtr);
}
- Tcl_TransferResult(slaveInterp, result, interp);
+ Tcl_TransferResult(childInterp, result, interp);
- Tcl_Release(slaveInterp);
+ Tcl_Release(childInterp);
return result;
}
/*
*----------------------------------------------------------------------
*
- * SlaveExpose --
+ * ChildExpose --
*
- * Helper function to expose a command in a slave interpreter.
+ * Helper function to expose a command in a child interpreter.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * After this call scripts in the slave will be able to invoke the newly
+ * After this call scripts in the child will be able to invoke the newly
* exposed command.
*
*----------------------------------------------------------------------
*/
static int
-SlaveExpose(
+ChildExpose(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* Interp in which command will be exposed. */
+ Tcl_Interp *childInterp, /* Interp in which command will be exposed. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
@@ -2939,9 +2940,9 @@ SlaveExpose(
}
name = TclGetString(objv[(objc == 1) ? 0 : 1]);
- if (Tcl_ExposeCommand(slaveInterp, TclGetString(objv[0]),
+ if (Tcl_ExposeCommand(childInterp, TclGetString(objv[0]),
name) != TCL_OK) {
- Tcl_TransferResult(slaveInterp, TCL_ERROR, interp);
+ Tcl_TransferResult(childInterp, TCL_ERROR, interp);
return TCL_ERROR;
}
return TCL_OK;
@@ -2950,7 +2951,7 @@ SlaveExpose(
/*
*----------------------------------------------------------------------
*
- * SlaveRecursionLimit --
+ * ChildRecursionLimit --
*
* Helper function to set/query the Recursion limit of an interp
*
@@ -2958,16 +2959,16 @@ SlaveExpose(
* A standard Tcl result.
*
* Side effects:
- * When (objc == 1), slaveInterp will be set to a new recursion limit of
+ * When (objc == 1), childInterp will be set to a new recursion limit of
* objv[0].
*
*----------------------------------------------------------------------
*/
static int
-SlaveRecursionLimit(
+ChildRecursionLimit(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* Interp in which limit is set/queried. */
+ Tcl_Interp *childInterp, /* Interp in which limit is set/queried. */
int objc, /* Set or Query. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
@@ -2992,9 +2993,9 @@ SlaveRecursionLimit(
NULL);
return TCL_ERROR;
}
- Tcl_SetRecursionLimit(slaveInterp, limit);
- iPtr = (Interp *) slaveInterp;
- if (interp == slaveInterp && iPtr->numLevels > limit) {
+ Tcl_SetRecursionLimit(childInterp, limit);
+ iPtr = (Interp *) childInterp;
+ if (interp == childInterp && iPtr->numLevels > limit) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"falling back due to new recursion limit", -1));
Tcl_SetErrorCode(interp, "TCL", "RECURSION", NULL);
@@ -3003,7 +3004,7 @@ SlaveRecursionLimit(
Tcl_SetObjResult(interp, objv[0]);
return TCL_OK;
} else {
- limit = Tcl_SetRecursionLimit(slaveInterp, 0);
+ limit = Tcl_SetRecursionLimit(childInterp, 0);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(limit));
return TCL_OK;
}
@@ -3012,24 +3013,24 @@ SlaveRecursionLimit(
/*
*----------------------------------------------------------------------
*
- * SlaveHide --
+ * ChildHide --
*
- * Helper function to hide a command in a slave interpreter.
+ * Helper function to hide a command in a child interpreter.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * After this call scripts in the slave will no longer be able to invoke
+ * After this call scripts in the child will no longer be able to invoke
* the named command.
*
*----------------------------------------------------------------------
*/
static int
-SlaveHide(
+ChildHide(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* Interp in which command will be exposed. */
+ Tcl_Interp *childInterp, /* Interp in which command will be exposed. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
@@ -3045,8 +3046,8 @@ SlaveHide(
}
name = TclGetString(objv[(objc == 1) ? 0 : 1]);
- if (Tcl_HideCommand(slaveInterp, TclGetString(objv[0]), name) != TCL_OK) {
- Tcl_TransferResult(slaveInterp, TCL_ERROR, interp);
+ if (Tcl_HideCommand(childInterp, TclGetString(objv[0]), name) != TCL_OK) {
+ Tcl_TransferResult(childInterp, TCL_ERROR, interp);
return TCL_ERROR;
}
return TCL_OK;
@@ -3055,9 +3056,9 @@ SlaveHide(
/*
*----------------------------------------------------------------------
*
- * SlaveHidden --
+ * ChildHidden --
*
- * Helper function to compute list of hidden commands in a slave
+ * Helper function to compute list of hidden commands in a child
* interpreter.
*
* Results:
@@ -3070,16 +3071,16 @@ SlaveHide(
*/
static int
-SlaveHidden(
+ChildHidden(
Tcl_Interp *interp, /* Interp for data return. */
- Tcl_Interp *slaveInterp) /* Interp whose hidden commands to query. */
+ Tcl_Interp *childInterp) /* Interp whose hidden commands to query. */
{
Tcl_Obj *listObjPtr = Tcl_NewObj(); /* Local object pointer. */
Tcl_HashTable *hTblPtr; /* For local searches. */
Tcl_HashEntry *hPtr; /* For local searches. */
Tcl_HashSearch hSearch; /* For local searches. */
- hTblPtr = ((Interp *) slaveInterp)->hiddenCmdTablePtr;
+ hTblPtr = ((Interp *) childInterp)->hiddenCmdTablePtr;
if (hTblPtr != NULL) {
for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch);
hPtr != NULL;
@@ -3095,9 +3096,9 @@ SlaveHidden(
/*
*----------------------------------------------------------------------
*
- * SlaveInvokeHidden --
+ * ChildInvokeHidden --
*
- * Helper function to invoke a hidden command in a slave interpreter.
+ * Helper function to invoke a hidden command in a child interpreter.
*
* Results:
* A standard Tcl result.
@@ -3109,9 +3110,9 @@ SlaveHidden(
*/
static int
-SlaveInvokeHidden(
+ChildInvokeHidden(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp, /* The slave interpreter in which command will
+ Tcl_Interp *childInterp, /* The child interpreter in which command will
* be invoked. */
const char *namespaceName, /* The namespace to use, if any. */
int objc, /* Number of arguments. */
@@ -3128,31 +3129,31 @@ SlaveInvokeHidden(
return TCL_ERROR;
}
- Tcl_Preserve(slaveInterp);
- Tcl_AllowExceptions(slaveInterp);
+ Tcl_Preserve(childInterp);
+ Tcl_AllowExceptions(childInterp);
if (namespaceName == NULL) {
- NRE_callback *rootPtr = TOP_CB(slaveInterp);
+ NRE_callback *rootPtr = TOP_CB(childInterp);
- Tcl_NRAddCallback(interp, NRPostInvokeHidden, slaveInterp,
+ Tcl_NRAddCallback(interp, NRPostInvokeHidden, childInterp,
rootPtr, NULL, NULL);
- return TclNRInvoke(NULL, slaveInterp, objc, objv);
+ return TclNRInvoke(NULL, childInterp, objc, objv);
} else {
Namespace *nsPtr, *dummy1, *dummy2;
const char *tail;
- result = TclGetNamespaceForQualName(slaveInterp, namespaceName, NULL,
+ result = TclGetNamespaceForQualName(childInterp, namespaceName, NULL,
TCL_FIND_ONLY_NS | TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG
| TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy1, &dummy2, &tail);
if (result == TCL_OK) {
- result = TclObjInvokeNamespace(slaveInterp, objc, objv,
+ result = TclObjInvokeNamespace(childInterp, objc, objv,
(Tcl_Namespace *) nsPtr, TCL_INVOKE_HIDDEN);
}
}
- Tcl_TransferResult(slaveInterp, result, interp);
+ Tcl_TransferResult(childInterp, result, interp);
- Tcl_Release(slaveInterp);
+ Tcl_Release(childInterp);
return result;
}
@@ -3162,38 +3163,38 @@ NRPostInvokeHidden(
Tcl_Interp *interp,
int result)
{
- Tcl_Interp *slaveInterp = (Tcl_Interp *)data[0];
+ Tcl_Interp *childInterp = (Tcl_Interp *)data[0];
NRE_callback *rootPtr = (NRE_callback *)data[1];
- if (interp != slaveInterp) {
- result = TclNRRunCallbacks(slaveInterp, result, rootPtr);
- Tcl_TransferResult(slaveInterp, result, interp);
+ if (interp != childInterp) {
+ result = TclNRRunCallbacks(childInterp, result, rootPtr);
+ Tcl_TransferResult(childInterp, result, interp);
}
- Tcl_Release(slaveInterp);
+ Tcl_Release(childInterp);
return result;
}
/*
*----------------------------------------------------------------------
*
- * SlaveMarkTrusted --
+ * ChildMarkTrusted --
*
- * Helper function to mark a slave interpreter as trusted (unsafe).
+ * Helper function to mark a child interpreter as trusted (unsafe).
*
* Results:
* A standard Tcl result.
*
* Side effects:
* After this call the hard-wired security checks in the core no longer
- * prevent the slave from performing certain operations.
+ * prevent the child from performing certain operations.
*
*----------------------------------------------------------------------
*/
static int
-SlaveMarkTrusted(
+ChildMarkTrusted(
Tcl_Interp *interp, /* Interp for error return. */
- Tcl_Interp *slaveInterp) /* The slave interpreter which will be marked
+ Tcl_Interp *childInterp) /* The child interpreter which will be marked
* trusted. */
{
if (Tcl_IsSafe(interp)) {
@@ -3204,7 +3205,7 @@ SlaveMarkTrusted(
NULL);
return TCL_ERROR;
}
- ((Interp *) slaveInterp)->flags &= ~SAFE_INTERP;
+ ((Interp *) childInterp)->flags &= ~SAFE_INTERP;
return TCL_OK;
}
@@ -3261,14 +3262,14 @@ Tcl_MakeSafe(
{
Tcl_Channel chan; /* Channel to remove from safe interpreter. */
Interp *iPtr = (Interp *) interp;
- Tcl_Interp *master = ((InterpInfo*) iPtr->interpInfo)->slave.masterInterp;
+ Tcl_Interp *parent = ((InterpInfo*) iPtr->interpInfo)->child.parentInterp;
TclHideUnsafeCommands(interp);
- if (master != NULL) {
+ if (parent != NULL) {
/*
- * Alias these function implementations in the slave to those in the
- * master; the overall implementations are safe, but they're normally
+ * Alias these function implementations in the child to those in the
+ * parent; the overall implementations are safe, but they're normally
* defined by init.tcl which is not sourced by safe interpreters.
* Assume these functions all work. [Bug 2895741]
*/
@@ -3285,7 +3286,7 @@ Tcl_MakeSafe(
*/
/*
- * No env array in a safe slave.
+ * No env array in a safe interpreter.
*/
Tcl_UnsetVar2(interp, "env", NULL, TCL_GLOBAL_ONLY);
@@ -4186,7 +4187,7 @@ Tcl_LimitGetGranularity(
* DeleteScriptLimitCallback --
*
* Callback for when a script limit (a limit callback implemented as a
- * Tcl script in a master interpreter, as set up from Tcl) is deleted.
+ * Tcl script in a parent interpreter, as set up from Tcl) is deleted.
*
* Results:
* None.
@@ -4399,48 +4400,48 @@ TclInitLimitSupport(
/*
*----------------------------------------------------------------------
*
- * InheritLimitsFromMaster --
+ * InheritLimitsFromParent --
*
- * Derive the interpreter limit configuration for a slave interpreter
- * from the limit config for the master.
+ * Derive the interpreter limit configuration for a child interpreter
+ * from the limit config for the parent.
*
* Results:
* None.
*
* Side effects:
- * The slave interpreter limits are set so that if the master has a
- * limit, it may not exceed it by handing off work to slave interpreters.
- * Note that this does not transfer limit callbacks from the master to
- * the slave.
+ * The child interpreter limits are set so that if the parent has a
+ * limit, it may not exceed it by handing off work to child interpreters.
+ * Note that this does not transfer limit callbacks from the parent to
+ * the child.
*
*----------------------------------------------------------------------
*/
static void
-InheritLimitsFromMaster(
- Tcl_Interp *slaveInterp,
- Tcl_Interp *masterInterp)
+InheritLimitsFromParent(
+ Tcl_Interp *childInterp,
+ Tcl_Interp *parentInterp)
{
- Interp *slavePtr = (Interp *) slaveInterp;
- Interp *masterPtr = (Interp *) masterInterp;
+ Interp *childPtr = (Interp *) childInterp;
+ Interp *parentPtr = (Interp *) parentInterp;
- if (masterPtr->limit.active & TCL_LIMIT_COMMANDS) {
- slavePtr->limit.active |= TCL_LIMIT_COMMANDS;
- slavePtr->limit.cmdCount = 0;
- slavePtr->limit.cmdGranularity = masterPtr->limit.cmdGranularity;
+ if (parentPtr->limit.active & TCL_LIMIT_COMMANDS) {
+ childPtr->limit.active |= TCL_LIMIT_COMMANDS;
+ childPtr->limit.cmdCount = 0;
+ childPtr->limit.cmdGranularity = parentPtr->limit.cmdGranularity;
}
- if (masterPtr->limit.active & TCL_LIMIT_TIME) {
- slavePtr->limit.active |= TCL_LIMIT_TIME;
- memcpy(&slavePtr->limit.time, &masterPtr->limit.time,
+ if (parentPtr->limit.active & TCL_LIMIT_TIME) {
+ childPtr->limit.active |= TCL_LIMIT_TIME;
+ memcpy(&childPtr->limit.time, &parentPtr->limit.time,
sizeof(Tcl_Time));
- slavePtr->limit.timeGranularity = masterPtr->limit.timeGranularity;
+ childPtr->limit.timeGranularity = parentPtr->limit.timeGranularity;
}
}
/*
*----------------------------------------------------------------------
*
- * SlaveCommandLimitCmd --
+ * ChildCommandLimitCmd --
*
* Implementation of the [interp limit $i commands] and [$i limit
* commands] subcommands. See the interp manual page for a full
@@ -4456,9 +4457,9 @@ InheritLimitsFromMaster(
*/
static int
-SlaveCommandLimitCmd(
+ChildCommandLimitCmd(
Tcl_Interp *interp, /* Current interpreter. */
- Tcl_Interp *slaveInterp, /* Interpreter being adjusted. */
+ Tcl_Interp *childInterp, /* Interpreter being adjusted. */
int consumedObjc, /* Number of args already parsed. */
int objc, /* Total number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4482,7 +4483,7 @@ SlaveCommandLimitCmd(
* avoid. [Bug 3398794]
*/
- if (interp == slaveInterp) {
+ if (interp == childInterp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"limits on current interpreter inaccessible", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "SELF", NULL);
@@ -4493,7 +4494,7 @@ SlaveCommandLimitCmd(
Tcl_Obj *dictPtr;
TclNewObj(dictPtr);
- key.interp = slaveInterp;
+ key.interp = childInterp;
key.type = TCL_LIMIT_COMMANDS;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
@@ -4513,12 +4514,12 @@ SlaveCommandLimitCmd(
Tcl_NewStringObj(options[0], -1), empty);
}
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1),
- Tcl_NewWideIntObj(Tcl_LimitGetGranularity(slaveInterp,
+ Tcl_NewWideIntObj(Tcl_LimitGetGranularity(childInterp,
TCL_LIMIT_COMMANDS)));
- if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_COMMANDS)) {
+ if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_COMMANDS)) {
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1),
- Tcl_NewWideIntObj(Tcl_LimitGetCommands(slaveInterp)));
+ Tcl_NewWideIntObj(Tcl_LimitGetCommands(childInterp)));
} else {
Tcl_Obj *empty;
@@ -4535,7 +4536,7 @@ SlaveCommandLimitCmd(
}
switch ((enum Options) index) {
case OPT_CMD:
- key.interp = slaveInterp;
+ key.interp = childInterp;
key.type = TCL_LIMIT_COMMANDS;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
@@ -4547,12 +4548,12 @@ SlaveCommandLimitCmd(
break;
case OPT_GRAN:
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
- Tcl_LimitGetGranularity(slaveInterp, TCL_LIMIT_COMMANDS)));
+ Tcl_LimitGetGranularity(childInterp, TCL_LIMIT_COMMANDS)));
break;
case OPT_VAL:
- if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_COMMANDS)) {
+ if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_COMMANDS)) {
Tcl_SetObjResult(interp,
- Tcl_NewWideIntObj(Tcl_LimitGetCommands(slaveInterp)));
+ Tcl_NewWideIntObj(Tcl_LimitGetCommands(childInterp)));
}
break;
}
@@ -4608,18 +4609,18 @@ SlaveCommandLimitCmd(
}
}
if (scriptObj != NULL) {
- SetScriptLimitCallback(interp, TCL_LIMIT_COMMANDS, slaveInterp,
+ SetScriptLimitCallback(interp, TCL_LIMIT_COMMANDS, childInterp,
(scriptLen > 0 ? scriptObj : NULL));
}
if (granObj != NULL) {
- Tcl_LimitSetGranularity(slaveInterp, TCL_LIMIT_COMMANDS, gran);
+ Tcl_LimitSetGranularity(childInterp, TCL_LIMIT_COMMANDS, gran);
}
if (limitObj != NULL) {
if (limitLen > 0) {
- Tcl_LimitSetCommands(slaveInterp, limit);
- Tcl_LimitTypeSet(slaveInterp, TCL_LIMIT_COMMANDS);
+ Tcl_LimitSetCommands(childInterp, limit);
+ Tcl_LimitTypeSet(childInterp, TCL_LIMIT_COMMANDS);
} else {
- Tcl_LimitTypeReset(slaveInterp, TCL_LIMIT_COMMANDS);
+ Tcl_LimitTypeReset(childInterp, TCL_LIMIT_COMMANDS);
}
}
return TCL_OK;
@@ -4629,7 +4630,7 @@ SlaveCommandLimitCmd(
/*
*----------------------------------------------------------------------
*
- * SlaveTimeLimitCmd --
+ * ChildTimeLimitCmd --
*
* Implementation of the [interp limit $i time] and [$i limit time]
* subcommands. See the interp manual page for a full description.
@@ -4644,9 +4645,9 @@ SlaveCommandLimitCmd(
*/
static int
-SlaveTimeLimitCmd(
+ChildTimeLimitCmd(
Tcl_Interp *interp, /* Current interpreter. */
- Tcl_Interp *slaveInterp, /* Interpreter being adjusted. */
+ Tcl_Interp *childInterp, /* Interpreter being adjusted. */
int consumedObjc, /* Number of args already parsed. */
int objc, /* Total number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4670,7 +4671,7 @@ SlaveTimeLimitCmd(
* avoid. [Bug 3398794]
*/
- if (interp == slaveInterp) {
+ if (interp == childInterp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"limits on current interpreter inaccessible", -1));
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "SELF", NULL);
@@ -4681,7 +4682,7 @@ SlaveTimeLimitCmd(
Tcl_Obj *dictPtr;
TclNewObj(dictPtr);
- key.interp = slaveInterp;
+ key.interp = childInterp;
key.type = TCL_LIMIT_TIME;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
@@ -4700,13 +4701,13 @@ SlaveTimeLimitCmd(
Tcl_NewStringObj(options[0], -1), empty);
}
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1),
- Tcl_NewWideIntObj(Tcl_LimitGetGranularity(slaveInterp,
+ Tcl_NewWideIntObj(Tcl_LimitGetGranularity(childInterp,
TCL_LIMIT_TIME)));
- if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_TIME)) {
+ if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_TIME)) {
Tcl_Time limitMoment;
- Tcl_LimitGetTime(slaveInterp, &limitMoment);
+ Tcl_LimitGetTime(childInterp, &limitMoment);
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1),
Tcl_NewWideIntObj(limitMoment.usec/1000));
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[3], -1),
@@ -4729,7 +4730,7 @@ SlaveTimeLimitCmd(
}
switch ((enum Options) index) {
case OPT_CMD:
- key.interp = slaveInterp;
+ key.interp = childInterp;
key.type = TCL_LIMIT_TIME;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
@@ -4741,22 +4742,22 @@ SlaveTimeLimitCmd(
break;
case OPT_GRAN:
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
- Tcl_LimitGetGranularity(slaveInterp, TCL_LIMIT_TIME)));
+ Tcl_LimitGetGranularity(childInterp, TCL_LIMIT_TIME)));
break;
case OPT_MILLI:
- if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_TIME)) {
+ if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_TIME)) {
Tcl_Time limitMoment;
- Tcl_LimitGetTime(slaveInterp, &limitMoment);
+ Tcl_LimitGetTime(childInterp, &limitMoment);
Tcl_SetObjResult(interp,
Tcl_NewWideIntObj(limitMoment.usec/1000));
}
break;
case OPT_SEC:
- if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_TIME)) {
+ if (Tcl_LimitTypeEnabled(childInterp, TCL_LIMIT_TIME)) {
Tcl_Time limitMoment;
- Tcl_LimitGetTime(slaveInterp, &limitMoment);
+ Tcl_LimitGetTime(childInterp, &limitMoment);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(limitMoment.sec));
}
break;
@@ -4773,7 +4774,7 @@ SlaveTimeLimitCmd(
Tcl_Time limitMoment;
int tmp;
- Tcl_LimitGetTime(slaveInterp, &limitMoment);
+ Tcl_LimitGetTime(childInterp, &limitMoment);
for (i=consumedObjc ; i<objc ; i+=2) {
if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0,
&index) != TCL_OK) {
@@ -4870,18 +4871,18 @@ SlaveTimeLimitCmd(
limitMoment.sec += limitMoment.usec / 1000000;
limitMoment.usec %= 1000000;
- Tcl_LimitSetTime(slaveInterp, &limitMoment);
- Tcl_LimitTypeSet(slaveInterp, TCL_LIMIT_TIME);
+ Tcl_LimitSetTime(childInterp, &limitMoment);
+ Tcl_LimitTypeSet(childInterp, TCL_LIMIT_TIME);
} else {
- Tcl_LimitTypeReset(slaveInterp, TCL_LIMIT_TIME);
+ Tcl_LimitTypeReset(childInterp, TCL_LIMIT_TIME);
}
}
if (scriptObj != NULL) {
- SetScriptLimitCallback(interp, TCL_LIMIT_TIME, slaveInterp,
+ SetScriptLimitCallback(interp, TCL_LIMIT_TIME, childInterp,
(scriptLen > 0 ? scriptObj : NULL));
}
if (granObj != NULL) {
- Tcl_LimitSetGranularity(slaveInterp, TCL_LIMIT_TIME, gran);
+ Tcl_LimitSetGranularity(childInterp, TCL_LIMIT_TIME, gran);
}
return TCL_OK;
}
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 95844a0..c763218 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -911,8 +911,8 @@ LinkTraceProc(
return (char *) "wrong size of char* value";
}
if (linkPtr->flags & LINK_ALLOC_LAST) {
- memcpy(linkPtr->lastValue.aryPtr, value, (size_t) valueLength);
- memcpy(linkPtr->addr, value, (size_t) valueLength);
+ memcpy(linkPtr->lastValue.aryPtr, value, valueLength);
+ memcpy(linkPtr->addr, value, valueLength);
} else {
linkPtr->lastValue.c = '\0';
LinkedVar(char) = linkPtr->lastValue.c;
@@ -925,8 +925,8 @@ LinkTraceProc(
return (char *) "wrong size of binary value";
}
if (linkPtr->flags & LINK_ALLOC_LAST) {
- memcpy(linkPtr->lastValue.aryPtr, value, (size_t) valueLength);
- memcpy(linkPtr->addr, value, (size_t) valueLength);
+ memcpy(linkPtr->lastValue.aryPtr, value, valueLength);
+ memcpy(linkPtr->addr, value, valueLength);
} else {
linkPtr->lastValue.uc = (unsigned char) *value;
LinkedVar(unsigned char) = linkPtr->lastValue.uc;
@@ -1296,7 +1296,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewIntObj(linkPtr->lastValue.iPtr[i]);
+ TclNewIntObj(objv[i], linkPtr->lastValue.iPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
@@ -1348,7 +1348,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewIntObj(linkPtr->lastValue.cPtr[i]);
+ TclNewIntObj(objv[i], linkPtr->lastValue.cPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
@@ -1361,7 +1361,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewIntObj(linkPtr->lastValue.ucPtr[i]);
+ TclNewIntObj(objv[i], linkPtr->lastValue.ucPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
@@ -1374,7 +1374,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewIntObj(linkPtr->lastValue.sPtr[i]);
+ TclNewIntObj(objv[i], linkPtr->lastValue.sPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
@@ -1387,7 +1387,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewIntObj(linkPtr->lastValue.usPtr[i]);
+ TclNewIntObj(objv[i], linkPtr->lastValue.usPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 2877796..5a0d45f 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -1091,7 +1091,7 @@ Tcl_ListObjReplace(
if ((numAfterLast > 0) && (shift != 0)) {
Tcl_Obj **src = elemPtrs + start;
- memmove(src+shift, src, (size_t) numAfterLast * sizeof(Tcl_Obj*));
+ memmove(src+shift, src, numAfterLast * sizeof(Tcl_Obj*));
}
} else {
/*
@@ -1263,7 +1263,7 @@ TclLindexList(
ListGetIntRep(argPtr, listRepPtr);
if ((listRepPtr == NULL)
- && TclGetIntForIndexM(NULL , argPtr, 0, &index) == TCL_OK) {
+ && TclGetIntForIndexM(NULL , argPtr, INT_MAX - 1, &index) == TCL_OK) {
/*
* argPtr designates a single index.
*/
@@ -1373,7 +1373,7 @@ TclLindexFlat(
*/
while (++i < indexCount) {
- if (TclGetIntForIndexM(interp, indexArray[i], -1, &index)
+ if (TclGetIntForIndexM(interp, indexArray[i], INT_MAX - 1, &index)
!= TCL_OK) {
Tcl_DecrRefCount(sublistCopy);
return NULL;
@@ -1444,7 +1444,7 @@ TclLsetList(
ListGetIntRep(indexArgPtr, listRepPtr);
if (listRepPtr == NULL
- && TclGetIntForIndexM(NULL, indexArgPtr, 0, &index) == TCL_OK) {
+ && TclGetIntForIndexM(NULL, indexArgPtr, INT_MAX - 1, &index) == TCL_OK) {
/*
* indexArgPtr designates a single index.
*/
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 738f65b..5fdc116 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -115,7 +115,7 @@ static void LoadCleanupProc(ClientData clientData,
int
Tcl_LoadObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -196,9 +196,9 @@ Tcl_LoadObjCmd(
target = interp;
if (objc == 4) {
- const char *slaveIntName = Tcl_GetString(objv[3]);
+ const char *childIntName = Tcl_GetString(objv[3]);
- target = Tcl_GetSlave(interp, slaveIntName);
+ target = Tcl_GetChild(interp, childIntName);
if (target == NULL) {
code = TCL_ERROR;
goto done;
@@ -542,7 +542,7 @@ Tcl_LoadObjCmd(
int
Tcl_UnloadObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -632,9 +632,9 @@ Tcl_UnloadObjCmd(
target = interp;
if (objc - i == 3) {
- const char *slaveIntName = Tcl_GetString(objv[i + 2]);
+ const char *childIntName = Tcl_GetString(objv[i + 2]);
- target = Tcl_GetSlave(interp, slaveIntName);
+ target = Tcl_GetChild(interp, childIntName);
if (target == NULL) {
return TCL_ERROR;
}
@@ -1087,7 +1087,7 @@ TclGetLoadedPackagesEx(
return TCL_OK;
}
- target = Tcl_GetSlave(interp, targetName);
+ target = Tcl_GetChild(interp, targetName);
if (target == NULL) {
return TCL_ERROR;
}
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 26dca62..8e138d0 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -1770,6 +1770,8 @@ DoImport(
TclInvokeImportedCmd, InvokeImportedNRCmd, dataPtr,
DeleteImportedCmd);
dataPtr->realCmdPtr = cmdPtr;
+ /* corresponding decrement is in DeleteImportedCmd */
+ cmdPtr->refCount++;
dataPtr->selfPtr = (Command *) importedCmd;
dataPtr->selfPtr->compileProc = cmdPtr->compileProc;
Tcl_DStringFree(&ds);
@@ -2077,6 +2079,7 @@ DeleteImportedCmd(
prevPtr->nextPtr = refPtr->nextPtr;
}
ckfree(refPtr);
+ TclCleanupCommandMacro(realCmdPtr);
ckfree(dataPtr);
return;
}
@@ -3888,7 +3891,7 @@ NamespaceOriginCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tcl_Command command, origCommand;
+ Tcl_Command cmd, origCmd;
Tcl_Obj *resultPtr;
if (objc != 2) {
@@ -3896,30 +3899,29 @@ NamespaceOriginCmd(
return TCL_ERROR;
}
- command = Tcl_GetCommandFromObj(interp, objv[1]);
- if (command == NULL) {
+ cmd = Tcl_GetCommandFromObj(interp, objv[1]);
+ if (cmd == NULL) {
+ goto namespaceOriginError;
+ }
+ origCmd = TclGetOriginalCommand(cmd);
+ if (origCmd == NULL) {
+ origCmd = cmd;
+ }
+ TclNewObj(resultPtr);
+ Tcl_GetCommandFullName(interp, origCmd, resultPtr);
+ if (TclCheckEmptyString(resultPtr) == TCL_EMPTYSTRING_YES ) {
+ Tcl_DecrRefCount(resultPtr);
+ namespaceOriginError:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"invalid command name \"%s\"", TclGetString(objv[1])));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COMMAND",
TclGetString(objv[1]), NULL);
return TCL_ERROR;
}
- origCommand = TclGetOriginalCommand(command);
- TclNewObj(resultPtr);
- if (origCommand == NULL) {
- /*
- * The specified command isn't an imported command. Return the
- * command's name qualified by the full name of the namespace it was
- * defined in.
- */
-
- Tcl_GetCommandFullName(interp, command, resultPtr);
- } else {
- Tcl_GetCommandFullName(interp, origCommand, resultPtr);
- }
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
}
+
/*
*----------------------------------------------------------------------
diff --git a/generic/tclOO.c b/generic/tclOO.c
index 322daff..21018ac 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -133,7 +133,7 @@ static const Tcl_MethodType classConstructor = {
};
/*
- * Scripted parts of TclOO. First, the master script (cannot be outside this
+ * Scripted parts of TclOO. First, the main script (cannot be outside this
* file).
*/
@@ -258,7 +258,7 @@ TclOOInit(
}
return Tcl_PkgProvideEx(interp, "TclOO", TCLOO_PATCHLEVEL,
- (ClientData) &tclOOStubs);
+ (void *) &tclOOStubs);
}
/*
@@ -566,7 +566,7 @@ DeletedHelpersNamespace(
static void
KillFoundation(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp) /* The interpreter containing the OO system
* foundation. */
{
@@ -1177,7 +1177,7 @@ ObjectNamespaceDeleted(
* freed memory.
*/
- if (((Command *) oPtr->command)->flags && CMD_IS_DELETED) {
+ if (((Command *) oPtr->command)->flags && CMD_DYING) {
/*
* Something has already started the command deletion process. We can
* go ahead and clean up the the namespace,
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 9f7b526..b866c2c 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -1249,7 +1249,7 @@ TclOOSelfObjCmd(
}
case SELF_CALL:
result[0] = TclOORenderCallChain(interp, contextPtr->callPtr);
- result[1] = Tcl_NewIntObj(contextPtr->index);
+ TclNewIntObj(result[1], contextPtr->index);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, result));
return TCL_OK;
}
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index 3758d55..a555d1b 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -114,7 +114,7 @@ TclOOInitInfo(
TclMakeEnsemble(interp, "::oo::InfoClass", infoClassCmds);
/*
- * Install into the master [info] ensemble.
+ * Install into the [info] ensemble.
*/
infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
@@ -171,7 +171,7 @@ GetClassFromObj(
static int
InfoObjectClassCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -228,7 +228,7 @@ InfoObjectClassCmd(
static int
InfoObjectDefnCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -302,7 +302,7 @@ InfoObjectDefnCmd(
static int
InfoObjectFiltersCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -341,7 +341,7 @@ InfoObjectFiltersCmd(
static int
InfoObjectForwardCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -398,7 +398,7 @@ InfoObjectForwardCmd(
static int
InfoObjectIsACmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -517,7 +517,7 @@ InfoObjectIsACmd(
static int
InfoObjectMethodsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -637,7 +637,7 @@ InfoObjectMethodsCmd(
static int
InfoObjectMethodTypeCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -694,7 +694,7 @@ InfoObjectMethodTypeCmd(
static int
InfoObjectMixinsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -737,7 +737,7 @@ InfoObjectMixinsCmd(
static int
InfoObjectIdCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -769,7 +769,7 @@ InfoObjectIdCmd(
static int
InfoObjectNsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -802,7 +802,7 @@ InfoObjectNsCmd(
static int
InfoObjectVariablesCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -856,7 +856,7 @@ InfoObjectVariablesCmd(
static int
InfoObjectVarsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -917,7 +917,7 @@ InfoObjectVarsCmd(
static int
InfoClassConstrCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -978,7 +978,7 @@ InfoClassConstrCmd(
static int
InfoClassDefnCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1046,7 +1046,7 @@ InfoClassDefnCmd(
static int
InfoClassDefnNsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1096,7 +1096,7 @@ InfoClassDefnNsCmd(
static int
InfoClassDestrCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1140,7 +1140,7 @@ InfoClassDestrCmd(
static int
InfoClassFiltersCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1178,7 +1178,7 @@ InfoClassFiltersCmd(
static int
InfoClassForwardCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1229,7 +1229,7 @@ InfoClassForwardCmd(
static int
InfoClassInstancesCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1277,7 +1277,7 @@ InfoClassInstancesCmd(
static int
InfoClassMethodsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1393,7 +1393,7 @@ InfoClassMethodsCmd(
static int
InfoClassMethodTypeCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1445,7 +1445,7 @@ InfoClassMethodTypeCmd(
static int
InfoClassMixinsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1487,7 +1487,7 @@ InfoClassMixinsCmd(
static int
InfoClassSubsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1542,7 +1542,7 @@ InfoClassSubsCmd(
static int
InfoClassSupersCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1581,7 +1581,7 @@ InfoClassSupersCmd(
static int
InfoClassVariablesCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1635,7 +1635,7 @@ InfoClassVariablesCmd(
static int
InfoObjectCallCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -1681,7 +1681,7 @@ InfoObjectCallCmd(
static int
InfoClassCallCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h
index db4b7f1..007cbfd 100644
--- a/generic/tclOOInt.h
+++ b/generic/tclOOInt.h
@@ -329,7 +329,7 @@ typedef struct Class {
*/
typedef struct ThreadLocalData {
- int nsCount; /* Master epoch counter is used for keeping
+ int nsCount; /* Epoch counter is used for keeping
* the values used in Tcl_Obj internal
* representations sane. Must be thread-local
* because Tcl_Objs can cross interpreter
@@ -341,7 +341,7 @@ typedef struct Foundation {
Tcl_Interp *interp;
Class *objectCls; /* The root of the object system. */
Class *classCls; /* The class of all classes. */
- Tcl_Namespace *ooNs; /* Master ::oo namespace. */
+ Tcl_Namespace *ooNs; /* ::oo namespace. */
Tcl_Namespace *defineNs; /* Namespace containing special commands for
* manipulating objects and classes. The
* "oo::define" command acts as a special kind
diff --git a/generic/tclObj.c b/generic/tclObj.c
index dbe6686..e58206b 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -145,12 +145,12 @@ typedef struct PendingObjData {
#define ObjDeletionUnlock(contextPtr) ((contextPtr)->deletionCount--)
#define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0)
#define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL)
-#define PushObjToDelete(contextPtr,objPtr) \
+#define PushObjToDelete(contextPtr,objPtr) \
/* The string rep is already invalidated so we can use the bytes value \
* for our pointer chain: push onto the head of the stack. */ \
(objPtr)->bytes = (char *) ((contextPtr)->deletionStack); \
(contextPtr)->deletionStack = (objPtr)
-#define PopObjToDelete(contextPtr,objPtrVar) \
+#define PopObjToDelete(contextPtr,objPtrVar) \
(objPtrVar) = (contextPtr)->deletionStack; \
(contextPtr)->deletionStack = (Tcl_Obj *) (objPtrVar)->bytes
@@ -168,7 +168,7 @@ static __thread PendingObjData pendingObjData;
#else
static Tcl_ThreadDataKey pendingObjDataKey;
#define ObjInitDeletionContext(contextPtr) \
- PendingObjData *const contextPtr = \
+ PendingObjData *const contextPtr = \
(PendingObjData *)Tcl_GetThreadData(&pendingObjDataKey, sizeof(PendingObjData))
#endif
@@ -177,15 +177,15 @@ static Tcl_ThreadDataKey pendingObjDataKey;
*/
#define PACK_BIGNUM(bignum, objPtr) \
- if ((bignum).used > 0x7FFF) { \
- mp_int *temp = (mp_int *) ckalloc(sizeof(mp_int)); \
+ if ((bignum).used > 0x7FFF) { \
+ mp_int *temp = (mp_int *)ckalloc(sizeof(mp_int)); \
*temp = bignum; \
- (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \
+ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \
} else if (((bignum).alloc <= 0x7FFF) || (mp_shrink(&(bignum))) == MP_OKAY) { \
- (objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (bignum).dp; \
- (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR( ((bignum).sign << 30) \
- | ((bignum).alloc << 15) | ((bignum).used)); \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(bignum).dp; \
+ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(((bignum).sign << 30) \
+ | ((bignum).alloc << 15) | ((bignum).used)); \
}
/*
@@ -567,7 +567,7 @@ TclContinuationsEnter(
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
Tcl_CreateHashEntry(tsdPtr->lineCLPtr, objPtr, &newEntry);
- ContLineLoc *clLocPtr = (ContLineLoc *)ckalloc(sizeof(ContLineLoc) + num*sizeof(int));
+ ContLineLoc *clLocPtr = (ContLineLoc *)ckalloc(offsetof(ContLineLoc, loc) + (num + 1) *sizeof(int));
if (!newEntry) {
/*
@@ -4667,7 +4667,7 @@ SetCmdNameFromAny(
* report the failure to find the command as an error.
*/
- if (cmdPtr == NULL) {
+ if (cmdPtr == NULL || !TclRoutineHasName(cmdPtr)) {
return TCL_ERROR;
}
diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c
index 095e6c5..4383c62 100644
--- a/generic/tclOptimize.c
+++ b/generic/tclOptimize.c
@@ -34,7 +34,7 @@ static void TrimUnreachable(CompileEnv *envPtr);
#define AddrLength(address) \
(tclInstructionTable[*(unsigned char *)(address)].numBytes)
#define InstLength(instruction) \
- (tclInstructionTable[(unsigned char)(instruction)].numBytes)
+ (tclInstructionTable[UCHAR(instruction)].numBytes)
/*
* ----------------------------------------------------------------------
diff --git a/generic/tclParse.c b/generic/tclParse.c
index e95768d..86ce1d0 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -220,6 +220,10 @@ Tcl_ParseCommand(
* point to char after terminating one. */
int scanned;
+ if (numBytes < 0 && start) {
+ numBytes = strlen(start);
+ }
+ TclParseInit(interp, start, numBytes, parsePtr);
if ((start == NULL) && (numBytes != 0)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -227,10 +231,6 @@ Tcl_ParseCommand(
}
return TCL_ERROR;
}
- if (numBytes < 0) {
- numBytes = strlen(start);
- }
- TclParseInit(interp, start, numBytes, parsePtr);
parsePtr->commentStart = NULL;
parsePtr->commentSize = 0;
parsePtr->commandStart = NULL;
@@ -858,7 +858,7 @@ TclParseBackslash(
/*
* Keep only the last byte (2 hex digits).
*/
- result = (unsigned char) result;
+ result = UCHAR(result);
}
break;
case 'u':
@@ -868,13 +868,13 @@ TclParseBackslash(
* No hexdigits -> This is just "u".
*/
result = 'u';
- } else if (((result & 0xDC00) == 0xD800) && (count == 6)
+ } else if (((result & 0xFC00) == 0xD800) && (count == 6)
&& (p[5] == '\\') && (p[6] == 'u') && (numBytes >= 10)) {
/* If high surrogate is immediately followed by a low surrogate
* escape, combine them into one character. */
int low;
int count2 = ParseHex(p+7, 4, &low);
- if ((count2 == 4) && ((low & 0xDC00) == 0xDC00)) {
+ if ((count2 == 4) && ((low & 0xFC00) == 0xDC00)) {
result = ((result & 0x3FF)<<10 | (low & 0x3FF)) + 0x10000;
count += count2 + 2;
}
@@ -1347,16 +1347,15 @@ Tcl_ParseVarName(
int varIndex;
unsigned array;
- if ((numBytes == 0) || (start == NULL)) {
- return TCL_ERROR;
- }
- if (numBytes < 0) {
+ if (numBytes < 0 && start) {
numBytes = strlen(start);
}
-
if (!append) {
TclParseInit(interp, start, numBytes, parsePtr);
}
+ if ((numBytes == 0) || (start == NULL)) {
+ return TCL_ERROR;
+ }
/*
* Generate one token for the variable, an additional token for the name,
@@ -1629,16 +1628,15 @@ Tcl_ParseBraces(
const char *src;
int startIndex, level, length;
- if ((numBytes == 0) || (start == NULL)) {
- return TCL_ERROR;
- }
- if (numBytes < 0) {
+ if (numBytes < 0 && start) {
numBytes = strlen(start);
}
-
if (!append) {
TclParseInit(interp, start, numBytes, parsePtr);
}
+ if ((numBytes == 0) || (start == NULL)) {
+ return TCL_ERROR;
+ }
src = start;
startIndex = parsePtr->numTokens;
@@ -1827,16 +1825,15 @@ Tcl_ParseQuotedString(
* the quoted string's terminating close-quote
* if the parse succeeds. */
{
- if ((numBytes == 0) || (start == NULL)) {
- return TCL_ERROR;
- }
- if (numBytes < 0) {
+ if (numBytes < 0 && start) {
numBytes = strlen(start);
}
-
if (!append) {
TclParseInit(interp, start, numBytes, parsePtr);
}
+ if ((numBytes == 0) || (start == NULL)) {
+ return TCL_ERROR;
+ }
if (TCL_OK != ParseTokens(start+1, numBytes-1, TYPE_QUOTE, TCL_SUBST_ALL,
parsePtr)) {
@@ -2107,7 +2104,7 @@ TclSubstTokens(
* command, which is refered to by 'script'.
* The 'clNextOuter' refers to the current
* entry in the table of continuation lines in
- * this "master script", and the character
+ * this "main script", and the character
* offsets are relative to the 'outerScript'
* as well.
*
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index b39224e..bdd9a86 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -905,8 +905,9 @@ SelectPackageFinal(
}
}
} else if (result != TCL_ERROR) {
- Tcl_Obj *codePtr = Tcl_NewIntObj(result);
+ Tcl_Obj *codePtr;
+ TclNewIntObj(codePtr, result);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"attempt to provide package %s %s failed:"
" bad return code: %s",
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 5a1b589..67c8c41 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -544,7 +544,7 @@ TclCreateProc(
*/
argnamei = argname;
- argnamelast = Tcl_UtfPrev(argname + nameLength, argname);
+ argnamelast = (nameLength > 0) ? (argname + nameLength - 1) : argname;
while (argnamei < argnamelast) {
if (*argnamei == '(') {
if (*argnamelast == ')') { /* We have an array element. */
@@ -565,7 +565,7 @@ TclCreateProc(
"FORMALARGUMENTFORMAT", NULL);
goto procError;
}
- argnamei = Tcl_UtfNext(argnamei);
+ argnamei++;
}
if (precompiled) {
@@ -632,7 +632,8 @@ TclCreateProc(
* local variables for the argument.
*/
- localPtr = (CompiledLocal *)ckalloc(offsetof(CompiledLocal, name) + fieldValues[0]->length +1);
+ localPtr = (CompiledLocal *)ckalloc(
+ offsetof(CompiledLocal, name) + fieldValues[0]->length + 1);
if (procPtr->firstLocalPtr == NULL) {
procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr;
} else {
@@ -1313,8 +1314,8 @@ InitLocalCache(
* for future calls.
*/
- localCachePtr = (LocalCache *)ckalloc(sizeof(LocalCache)
- + (localCt - 1) * sizeof(Tcl_Obj *)
+ localCachePtr = (LocalCache *)ckalloc(offsetof(LocalCache, varName0)
+ + localCt * sizeof(Tcl_Obj *)
+ numArgs * sizeof(Var));
namePtr = &localCachePtr->varName0;
diff --git a/generic/tclProcess.c b/generic/tclProcess.c
index 5bf0af8..c0f21e3 100644
--- a/generic/tclProcess.c
+++ b/generic/tclProcess.c
@@ -267,8 +267,8 @@ WaitProcessStatus(
"child process exited abnormally", -1);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", -1);
- errorStrings[1] = Tcl_NewIntObj(resolvedPid);
- errorStrings[2] = Tcl_NewIntObj(WEXITSTATUS(waitStatus));
+ TclNewIntObj(errorStrings[1], resolvedPid);
+ TclNewIntObj(errorStrings[2], WEXITSTATUS(waitStatus));
*errorObjPtr = Tcl_NewListObj(3, errorStrings);
}
}
@@ -286,7 +286,7 @@ WaitProcessStatus(
"child killed: %s", msg);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", -1);
- errorStrings[1] = Tcl_NewIntObj(resolvedPid);
+ TclNewIntObj(errorStrings[1], resolvedPid);
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1);
errorStrings[3] = Tcl_NewStringObj(msg, -1);
*errorObjPtr = Tcl_NewListObj(4, errorStrings);
@@ -305,7 +305,7 @@ WaitProcessStatus(
"child suspended: %s", msg);
if (errorObjPtr) {
errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", -1);
- errorStrings[1] = Tcl_NewIntObj(resolvedPid);
+ TclNewIntObj(errorStrings[1], resolvedPid);
errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1);
errorStrings[3] = Tcl_NewStringObj(msg, -1);
*errorObjPtr = Tcl_NewListObj(4, errorStrings);
@@ -326,7 +326,7 @@ WaitProcessStatus(
errorStrings[1] = Tcl_NewStringObj("OPERATION", -1);
errorStrings[2] = Tcl_NewStringObj("EXEC", -1);
errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", -1);
- errorStrings[4] = Tcl_NewIntObj(resolvedPid);
+ TclNewIntObj(errorStrings[4], resolvedPid);
*errorObjPtr = Tcl_NewListObj(5, errorStrings);
}
return TCL_PROCESS_UNKNOWN_STATUS;
@@ -378,7 +378,7 @@ BuildProcessStatusObj(
* Abnormal exit, return {TCL_ERROR msg error}
*/
- resultObjs[0] = Tcl_NewIntObj(TCL_ERROR);
+ TclNewIntObj(resultObjs[0], TCL_ERROR);
resultObjs[1] = info->msg;
resultObjs[2] = info->error;
return Tcl_NewListObj(3, resultObjs);
diff --git a/generic/tclScan.c b/generic/tclScan.c
index dc98f54..4d86382 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -896,7 +896,7 @@ Tcl_ScanObjCmd(
width = ~0;
}
if (TCL_OK != TclParseNumber(NULL, objPtr, NULL, string, width,
- &end, TCL_PARSE_INTEGER_ONLY | parseFlag)) {
+ &end, TCL_PARSE_INTEGER_ONLY | TCL_PARSE_NO_UNDERSCORE | parseFlag)) {
Tcl_DecrRefCount(objPtr);
if (width < 0) {
if (*end == '\0') {
@@ -998,7 +998,7 @@ Tcl_ScanObjCmd(
width = ~0;
}
if (TCL_OK != TclParseNumber(NULL, objPtr, NULL, string, width,
- &end, TCL_PARSE_DECIMAL_ONLY | TCL_PARSE_NO_WHITESPACE)) {
+ &end, TCL_PARSE_DECIMAL_ONLY | TCL_PARSE_NO_WHITESPACE | TCL_PARSE_NO_UNDERSCORE)) {
Tcl_DecrRefCount(objPtr);
if (width < 0) {
if (*end == '\0') {
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 7ef2c60..6444823 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -535,6 +535,8 @@ TclParseNumber(
int shift = 0; /* Amount to shift when accumulating binary */
int explicitOctal = 0;
mp_err err = MP_OKAY;
+ int under = 0; /* Flag trailing '_' as error if true once
+ * number is accepted. */
#define ALL_BITS ((Tcl_WideUInt)-1)
#define MOST_BITS (ALL_BITS >> 1)
@@ -643,7 +645,7 @@ TclParseNumber(
acceptPoint = p;
acceptLen = len;
if (c == 'x' || c == 'X') {
- if (flags & (TCL_PARSE_OCTAL_ONLY|TCL_PARSE_BINARY_ONLY)) {
+ if (flags & (TCL_PARSE_OCTAL_ONLY|TCL_PARSE_BINARY_ONLY) || under) {
goto endgame;
}
state = ZERO_X;
@@ -656,7 +658,7 @@ TclParseNumber(
goto zeroo;
}
if (c == 'b' || c == 'B') {
- if (flags & TCL_PARSE_OCTAL_ONLY) {
+ if ((flags & TCL_PARSE_OCTAL_ONLY) || under) {
goto endgame;
}
state = ZERO_B;
@@ -666,11 +668,17 @@ TclParseNumber(
goto zerob;
}
if (c == 'o' || c == 'O') {
+ if (under) {
+ goto endgame;
+ }
explicitOctal = 1;
state = ZERO_O;
break;
}
if (c == 'd' || c == 'D') {
+ if (under) {
+ goto endgame;
+ }
state = ZERO_D;
break;
}
@@ -694,9 +702,11 @@ TclParseNumber(
zeroo:
if (c == '0') {
numTrailZeros++;
+ under = 0;
state = OCTAL;
break;
} else if (c >= '1' && c <= '7') {
+ under = 0;
if (objPtr != NULL) {
shift = 3 * (numTrailZeros + 1);
significandOverflow = AccumulateDecimalDigit(
@@ -746,6 +756,10 @@ TclParseNumber(
numTrailZeros = 0;
state = OCTAL;
break;
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
}
/* FALLTHROUGH */
@@ -774,6 +788,7 @@ TclParseNumber(
if (c == '0') {
numTrailZeros++;
+ under = 0;
state = BAD_OCTAL;
break;
} else if (isdigit(UCHAR(c))) {
@@ -789,12 +804,15 @@ TclParseNumber(
numSigDigs = 1;
}
numTrailZeros = 0;
+ under = 0;
state = BAD_OCTAL;
break;
} else if (c == '.') {
+ under = 0;
state = FRACTION;
break;
} else if (c == 'E' || c == 'e') {
+ under = 0;
state = EXPONENT_START;
break;
}
@@ -817,14 +835,22 @@ TclParseNumber(
zerox:
if (c == '0') {
numTrailZeros++;
+ under = 0;
state = HEXADECIMAL;
break;
} else if (isdigit(UCHAR(c))) {
+ under = 0;
d = (c-'0');
} else if (c >= 'A' && c <= 'F') {
+ under = 0;
d = (c-'A'+10);
} else if (c >= 'a' && c <= 'f') {
+ under = 0;
d = (c-'a'+10);
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
} else {
goto endgame;
}
@@ -870,8 +896,13 @@ TclParseNumber(
zerob:
if (c == '0') {
numTrailZeros++;
+ under = 0;
state = BINARY;
break;
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
} else if (c != '1') {
goto endgame;
}
@@ -910,10 +941,17 @@ TclParseNumber(
case ZERO_D:
if (c == '0') {
+ under = 0;
numTrailZeros++;
} else if ( ! isdigit(UCHAR(c))) {
+ if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
+ }
goto endgame;
}
+ under = 0;
state = DECIMAL;
flags |= TCL_PARSE_INTEGER_ONLY;
/* FALLTHROUGH */
@@ -932,6 +970,7 @@ TclParseNumber(
acceptLen = len;
if (c == '0') {
numTrailZeros++;
+ under = 0;
state = DECIMAL;
break;
} else if (isdigit(UCHAR(c))) {
@@ -943,14 +982,21 @@ TclParseNumber(
}
numSigDigs += numTrailZeros+1;
numTrailZeros = 0;
+ under = 0;
state = DECIMAL;
break;
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
} else if (flags & TCL_PARSE_INTEGER_ONLY) {
goto endgame;
} else if (c == '.') {
+ under = 0;
state = FRACTION;
break;
} else if (c == 'E' || c == 'e') {
+ under = 0;
state = EXPONENT_START;
break;
}
@@ -976,6 +1022,7 @@ TclParseNumber(
if (c == '0') {
numDigitsAfterDp++;
numTrailZeros++;
+ under = 0;
state = FRACTION;
break;
} else if (isdigit(UCHAR(c))) {
@@ -992,8 +1039,13 @@ TclParseNumber(
numSigDigs = 1;
}
numTrailZeros = 0;
+ under = 0;
state = FRACTION;
break;
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
}
goto endgame;
@@ -1005,10 +1057,12 @@ TclParseNumber(
*/
if (c == '+') {
+ under = 0;
state = EXPONENT_SIGNUM;
break;
} else if (c == '-') {
exponentSignum = 1;
+ under = 0;
state = EXPONENT_SIGNUM;
break;
}
@@ -1022,8 +1076,13 @@ TclParseNumber(
if (isdigit(UCHAR(c))) {
exponent = c - '0';
+ under = 0;
state = EXPONENT;
break;
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
}
goto endgame;
@@ -1042,8 +1101,13 @@ TclParseNumber(
} else {
exponent = LONG_MAX;
}
+ under = 0;
state = EXPONENT;
break;
+ } else if (c == '_' && !(flags & TCL_PARSE_NO_UNDERSCORE)) {
+ /* Ignore numeric "white space" */
+ under = 1;
+ break;
}
goto endgame;
@@ -1054,12 +1118,14 @@ TclParseNumber(
case sI:
if (c == 'n' || c == 'N') {
+ under = 0;
state = sIN;
break;
}
goto endgame;
case sIN:
if (c == 'f' || c == 'F') {
+ under = 0;
state = sINF;
break;
}
@@ -1068,6 +1134,7 @@ TclParseNumber(
acceptState = state;
acceptPoint = p;
acceptLen = len;
+ under = 0;
if (c == 'i' || c == 'I') {
state = sINFI;
break;
@@ -1075,24 +1142,28 @@ TclParseNumber(
goto endgame;
case sINFI:
if (c == 'n' || c == 'N') {
+ under = 0;
state = sINFIN;
break;
}
goto endgame;
case sINFIN:
if (c == 'i' || c == 'I') {
+ under = 0;
state = sINFINI;
break;
}
goto endgame;
case sINFINI:
if (c == 't' || c == 'T') {
+ under = 0;
state = sINFINIT;
break;
}
goto endgame;
case sINFINIT:
if (c == 'y' || c == 'Y') {
+ under = 0;
state = sINFINITY;
break;
}
@@ -1104,12 +1175,14 @@ TclParseNumber(
#ifdef IEEE_FLOATING_POINT
case sN:
if (c == 'a' || c == 'A') {
+ under = 0;
state = sNA;
break;
}
goto endgame;
case sNA:
if (c == 'n' || c == 'N') {
+ under = 0;
state = sNAN;
break;
}
@@ -1119,6 +1192,7 @@ TclParseNumber(
acceptPoint = p;
acceptLen = len;
if (c == '(') {
+ under = 0;
state = sNANPAREN;
break;
}
@@ -1129,12 +1203,14 @@ TclParseNumber(
*/
case sNANHEX:
if (c == ')') {
+ under = 0;
state = sNANFINISH;
break;
}
/* FALLTHROUGH */
case sNANPAREN:
if (TclIsSpaceProcM(c)) {
+ under = 0;
break;
}
if (numSigDigs < 13) {
@@ -1149,6 +1225,7 @@ TclParseNumber(
}
numSigDigs++;
significandWide = (significandWide << 4) + d;
+ under = 0;
state = sNANHEX;
break;
}
@@ -1161,6 +1238,7 @@ TclParseNumber(
acceptPoint = p;
acceptLen = len;
goto endgame;
+
}
p++;
len--;
@@ -1179,10 +1257,13 @@ TclParseNumber(
} else {
/*
* Back up to the last accepting state in the lexer.
+ * If the last char seen is the numeric whitespace character '_',
+ * backup to that.
*/
- p = acceptPoint;
- len = acceptLen;
+ p = under ? acceptPoint-1 : acceptPoint;
+ len = under ? acceptLen-1 : acceptLen;
+
if (!(flags & TCL_PARSE_NO_WHITESPACE)) {
/*
* Accept trailing whitespace.
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 78e49f9..81c5c92 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -3523,7 +3523,7 @@ TclStringCmp(
* length only.
*/
- match = memCmpFn(s1, s2, (size_t) length);
+ match = memCmpFn(s1, s2, length);
}
if ((match == 0) && (reqlength > length)) {
match = s1len - s2len;
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index fc5a713..e01ba2d 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -59,15 +59,15 @@ typedef struct {
* space allocated for the unicode array. */
int hasUnicode; /* Boolean determining whether the string has
* a Unicode representation. */
- Tcl_UniChar unicode[1]; /* The array of Unicode chars. The actual size
+ Tcl_UniChar unicode[TCLFLEXARRAY]; /* The array of Unicode chars. The actual size
* of this field depends on the 'maxChars'
* field above. */
} String;
#define STRING_MAXCHARS \
- (int)(((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar))
+ (int)(((size_t)UINT_MAX - 1 - offsetof(String, unicode))/sizeof(Tcl_UniChar))
#define STRING_SIZE(numChars) \
- (sizeof(String) + ((numChars) * sizeof(Tcl_UniChar)))
+ (offsetof(String, unicode) + ((numChars + 1) * sizeof(Tcl_UniChar)))
#define stringCheckLimits(numChars) \
do { \
if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 5529e7e..b6eb9da 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -319,7 +319,7 @@ mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
if (maxlen < 0) {
return MP_VAL;
}
- return TclBN_mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
+ return TclBN_mp_to_radix(a, str, maxlen, NULL, radix);
}
#define TclSetStartupScriptPath setStartupScriptPath
@@ -974,7 +974,7 @@ static const TclIntStubs tclIntStubs = {
TclResetRewriteEnsemble, /* 247 */
TclCopyChannel, /* 248 */
TclDoubleDigits, /* 249 */
- TclSetSlaveCancelFlags, /* 250 */
+ TclSetChildCancelFlags, /* 250 */
TclRegisterLiteral, /* 251 */
TclPtrGetVar, /* 252 */
TclPtrSetVar, /* 253 */
@@ -1311,7 +1311,7 @@ const TclStubs tclStubs = {
Tcl_CreateInterp, /* 94 */
Tcl_CreateMathFunc, /* 95 */
Tcl_CreateObjCommand, /* 96 */
- Tcl_CreateSlave, /* 97 */
+ Tcl_CreateChild, /* 97 */
Tcl_CreateTimerHandler, /* 98 */
Tcl_CreateTrace, /* 99 */
Tcl_DeleteAssocData, /* 100 */
@@ -1378,7 +1378,7 @@ const TclStubs tclStubs = {
Tcl_GetErrno, /* 161 */
Tcl_GetHostName, /* 162 */
Tcl_GetInterpPath, /* 163 */
- Tcl_GetMaster, /* 164 */
+ Tcl_GetParent, /* 164 */
Tcl_GetNameOfExecutable, /* 165 */
Tcl_GetObjResult, /* 166 */
#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
@@ -1394,7 +1394,7 @@ const TclStubs tclStubs = {
Tcl_Gets, /* 169 */
Tcl_GetsObj, /* 170 */
Tcl_GetServiceMode, /* 171 */
- Tcl_GetSlave, /* 172 */
+ Tcl_GetChild, /* 172 */
Tcl_GetStdChannel, /* 173 */
Tcl_GetStringResult, /* 174 */
Tcl_GetVar, /* 175 */
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 499ef93..91d486e 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -20,7 +20,11 @@
# define USE_TCL_STUBS
#endif
#include "tclInt.h"
-#include "tclTomMath.h"
+#ifdef TCL_WITH_EXTERNAL_TOMMATH
+# include "tommath.h"
+#else
+# include "tclTomMath.h"
+#endif
#include "tclOO.h"
#include <math.h>
@@ -308,7 +312,7 @@ static Tcl_FSNormalizePathProc TestReportNormalizePath;
static Tcl_FSPathInFilesystemProc TestReportInFilesystem;
static Tcl_FSFreeInternalRepProc TestReportFreeInternalRep;
static Tcl_FSDupInternalRepProc TestReportDupInternalRep;
-
+static Tcl_CmdProc TestServiceModeCmd;
static Tcl_FSStatProc SimpleStat;
static Tcl_FSAccessProc SimpleAccess;
static Tcl_FSOpenFileChannelProc SimpleOpenFileChannel;
@@ -446,9 +450,11 @@ Tcltest_Init(
if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) {
return TCL_ERROR;
}
+#ifndef TCL_WITH_EXTERNAL_TOMMATH
if (Tcl_TomMath_InitStubs(interp, "8.5-") == NULL) {
return TCL_ERROR;
}
+#endif
if (Tcl_OOInitStubs(interp) == NULL) {
return TCL_ERROR;
}
@@ -567,6 +573,8 @@ Tcltest_Init(
NULL, NULL);
Tcl_CreateObjCommand(interp, "testsaveresult", TestsaveresultCmd,
NULL, NULL);
+ Tcl_CreateCommand(interp, "testservicemode", TestServiceModeCmd,
+ NULL, NULL);
Tcl_CreateCommand(interp, "testsetassocdata", TestsetassocdataCmd,
NULL, NULL);
Tcl_CreateCommand(interp, "testsetnoerr", TestsetCmd,
@@ -719,7 +727,7 @@ Tcltest_SafeInit(
static int
TestasyncCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -929,7 +937,7 @@ AsyncThreadProc(
static int
TestbumpinterpepochObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -964,7 +972,7 @@ TestbumpinterpepochObjCmd(
static int
TestcmdinfoCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1091,7 +1099,7 @@ CmdDelProc2(
static int
TestcmdtokenCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1154,7 +1162,7 @@ TestcmdtokenCmd(
static int
TestcmdtraceCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1251,7 +1259,7 @@ CmdTraceProc(
char *command, /* The command being traced (after
* substitutions). */
TCL_UNUSED(Tcl_CmdProc *) /*cmdProc*/,
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
int argc, /* Number of arguments. */
const char *argv[]) /* Argument strings. */
{
@@ -1269,12 +1277,12 @@ CmdTraceProc(
static void
CmdTraceDeleteProc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(int) /*level*/,
TCL_UNUSED(char *) /*command*/,
TCL_UNUSED(Tcl_CmdProc *),
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
{
@@ -1289,7 +1297,7 @@ CmdTraceDeleteProc(
static int
ObjTraceProc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Tcl interpreter */
TCL_UNUSED(int) /*level*/,
const char *command,
@@ -1346,7 +1354,7 @@ ObjTraceDeleteProc(
static int
TestcreatecommandCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1376,7 +1384,7 @@ TestcreatecommandCmd(
static int
CreatedCommandProc(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
@@ -1398,7 +1406,7 @@ CreatedCommandProc(
static int
CreatedCommandProc2(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
@@ -1436,7 +1444,7 @@ CreatedCommandProc2(
static int
TestdcallCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1500,21 +1508,21 @@ DelCallbackProc(
static int
TestdelCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
{
DelCmd *dPtr;
- Tcl_Interp *slave;
+ Tcl_Interp *child;
if (argc != 4) {
Tcl_AppendResult(interp, "wrong # args", NULL);
return TCL_ERROR;
}
- slave = Tcl_GetSlave(interp, argv[1]);
- if (slave == NULL) {
+ child = Tcl_GetChild(interp, argv[1]);
+ if (child == NULL) {
return TCL_ERROR;
}
@@ -1523,7 +1531,7 @@ TestdelCmd(
dPtr->deleteCmd = (char *)ckalloc(strlen(argv[3]) + 1);
strcpy(dPtr->deleteCmd, argv[3]);
- Tcl_CreateCommand(slave, argv[2], DelCmdProc, dPtr,
+ Tcl_CreateCommand(child, argv[2], DelCmdProc, dPtr,
DelDeleteProc);
return TCL_OK;
}
@@ -1575,7 +1583,7 @@ DelDeleteProc(
static int
TestdelassocdataCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1612,7 +1620,7 @@ TestdelassocdataCmd(
static int
TestdoubledigitsObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj* const objv[]) /* Parameter vector */
@@ -1699,7 +1707,7 @@ TestdoubledigitsObjCmd(
static int
TestdstringCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -1825,7 +1833,7 @@ static void SpecialFree(
static int
TestencodingObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1985,7 +1993,7 @@ EncodingFreeProc(
static int
TestevalexObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2030,7 +2038,7 @@ TestevalexObjCmd(
static int
TestevalobjvObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2079,7 +2087,7 @@ TestevalobjvObjCmd(
static int
TesteventObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const objv[]) /* Parameter vector */
@@ -2258,7 +2266,7 @@ TesteventDeleteProc(
static int
TestexithandlerCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -2334,7 +2342,7 @@ ExitProcEven(
static int
TestexprlongCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -2377,7 +2385,7 @@ TestexprlongCmd(
static int
TestexprlongobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Argument objects. */
@@ -2419,7 +2427,7 @@ TestexprlongobjCmd(
static int
TestexprdoubleCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -2463,7 +2471,7 @@ TestexprdoubleCmd(
static int
TestexprdoubleobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Argument objects. */
@@ -2505,7 +2513,7 @@ TestexprdoubleobjCmd(
static int
TestexprstringCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -2537,7 +2545,7 @@ TestexprstringCmd(
static int
TestfilelinkCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -2604,7 +2612,7 @@ TestfilelinkCmd(
static int
TestgetassocdataCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -2642,7 +2650,7 @@ TestgetassocdataCmd(
static int
TestgetplatformCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -2682,23 +2690,23 @@ TestgetplatformCmd(
static int
TestinterpdeleteCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
{
- Tcl_Interp *slaveToDelete;
+ Tcl_Interp *childToDelete;
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" path\"", NULL);
return TCL_ERROR;
}
- slaveToDelete = Tcl_GetSlave(interp, argv[1]);
- if (slaveToDelete == NULL) {
+ childToDelete = Tcl_GetChild(interp, argv[1]);
+ if (childToDelete == NULL) {
return TCL_ERROR;
}
- Tcl_DeleteInterp(slaveToDelete);
+ Tcl_DeleteInterp(childToDelete);
return TCL_OK;
}
@@ -2722,7 +2730,7 @@ TestinterpdeleteCmd(
static int
TestlinkCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -3190,7 +3198,7 @@ TestlinkCmd(
static int
TestlinkarrayCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -3308,7 +3316,7 @@ TestlinkarrayCmd(
static int
TestlocaleCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -3394,7 +3402,7 @@ CleanupTestSetassocdataTests(
static int
TestparserObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -3450,7 +3458,7 @@ TestparserObjCmd(
static int
TestexprparserObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -3597,7 +3605,7 @@ PrintParse(
static int
TestparsevarObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -3638,7 +3646,7 @@ TestparsevarObjCmd(
static int
TestparsevarnameObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -3701,7 +3709,7 @@ TestparsevarnameObjCmd(
static int
TestpreferstableObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /*objv*/)
@@ -3731,7 +3739,7 @@ TestpreferstableObjCmd(
static int
TestprintObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -3772,7 +3780,7 @@ TestprintObjCmd(
static int
TestregexpObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -4095,7 +4103,7 @@ TestregexpXflags(
static int
TestreturnObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /*objv*/)
@@ -4123,7 +4131,7 @@ TestreturnObjCmd(
static int
TestsetassocdataCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4174,7 +4182,7 @@ TestsetassocdataCmd(
static int
TestsetplatformCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4223,7 +4231,7 @@ TestsetplatformCmd(
static int
TeststaticpkgCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4274,7 +4282,7 @@ StaticInitProc(
static int
TesttranslatefilenameCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4315,7 +4323,7 @@ TesttranslatefilenameCmd(
static int
TestupvarCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4367,7 +4375,7 @@ TestupvarCmd(
static int
TestseterrorcodeCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4419,7 +4427,7 @@ TestseterrorcodeCmd(
static int
TestsetobjerrorcodeCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -4447,7 +4455,7 @@ TestsetobjerrorcodeCmd(
static int
TestfeventCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4519,7 +4527,7 @@ TestfeventCmd(
static int
TestpanicCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -4538,7 +4546,7 @@ TestpanicCmd(
static int
TestfileCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
Tcl_Obj *const argv[]) /* The argument objects. */
@@ -4620,7 +4628,7 @@ TestfileCmd(
static int
TestgetvarfullnameCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -4694,7 +4702,7 @@ TestgetvarfullnameCmd(
static int
GetTimesObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* The current interpreter. */
TCL_UNUSED(int) /*cobjc*/,
TCL_UNUSED(Tcl_Obj *const *) /*cobjv*/)
@@ -4873,7 +4881,7 @@ GetTimesObjCmd(
static int
NoopCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
@@ -4900,7 +4908,7 @@ NoopCmd(
static int
NoopObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /*objv*/)
@@ -4925,7 +4933,7 @@ NoopObjCmd(
static int
TeststringbytesObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -4965,7 +4973,7 @@ TeststringbytesObjCmd(
static int
TestpurebytesobjObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -5012,7 +5020,7 @@ TestpurebytesobjObjCmd(
static int
TestsetbytearraylengthObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -5056,7 +5064,7 @@ TestsetbytearraylengthObjCmd(
static int
TestbytestringObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -5178,7 +5186,7 @@ Testset2Cmd(
static int
TestsaveresultCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,/* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
@@ -5309,7 +5317,7 @@ TestsaveresultFree(
static int
TestmainthreadCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,/* Current interpreter. */
int argc, /* Number of arguments. */
TCL_UNUSED(const char **) /*argv*/)
@@ -5370,7 +5378,7 @@ MainLoop(void)
static int
TestsetmainloopCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
@@ -5399,7 +5407,7 @@ TestsetmainloopCmd(
static int
TestexitmainloopCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
TCL_UNUSED(Tcl_Interp *),
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
@@ -5427,7 +5435,7 @@ TestexitmainloopCmd(
static int
TestChannelCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Interpreter for result. */
int argc, /* Count of additional args. */
const char **argv) /* Additional arg strings. */
@@ -5894,7 +5902,7 @@ TestChannelCmd(
static int
TestChannelEventCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int argc, /* Number of arguments. */
const char **argv) /* Argument strings. */
@@ -6106,7 +6114,7 @@ TestChannelEventCmd(
static int
TestSocketCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Interpreter for result. */
int argc, /* Count of additional args. */
const char **argv) /* Additional arg strings. */
@@ -6158,6 +6166,54 @@ TestSocketCmd(
/*
*----------------------------------------------------------------------
*
+ * TestServiceModeCmd --
+ *
+ * This procedure implements the "testservicemode" command which gets or
+ * sets the current Tcl ServiceMode. There are several tests which open
+ * a file and assign various handlers to it. For these tests to be
+ * deterministic it is important that file events not be processed until
+ * all of the handlers are in place.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * May change the ServiceMode setting.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TestServiceModeCmd(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
+{
+ int newmode, oldmode;
+ if (argc > 2) {
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " ?newmode?\"", NULL);
+ return TCL_ERROR;
+ }
+ oldmode = (Tcl_GetServiceMode() != TCL_SERVICE_NONE);
+ if (argc == 2) {
+ if (Tcl_GetInt(interp, argv[1], &newmode) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ if (newmode == 0) {
+ Tcl_SetServiceMode(TCL_SERVICE_NONE);
+ } else {
+ Tcl_SetServiceMode(TCL_SERVICE_ALL);
+ }
+ }
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(oldmode));
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TestWrongNumArgsObjCmd --
*
* Test the Tcl_WrongNumArgs function.
@@ -6173,7 +6229,7 @@ TestSocketCmd(
static int
TestWrongNumArgsObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6229,7 +6285,7 @@ TestWrongNumArgsObjCmd(
static int
TestGetIndexFromObjStructObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -6283,7 +6339,7 @@ TestGetIndexFromObjStructObjCmd(
static int
TestFilesystemObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -6625,7 +6681,7 @@ TestReportNormalizePath(
static int
SimplePathInFilesystem(
Tcl_Obj *pathPtr,
- TCL_UNUSED(ClientData *))
+ TCL_UNUSED(void **))
{
const char *str = Tcl_GetString(pathPtr);
@@ -6654,7 +6710,7 @@ SimplePathInFilesystem(
static int
TestSimpleFilesystemObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -6825,39 +6881,43 @@ TestUtfNextCmd(
char *bytes;
const char *result, *first;
char buffer[32];
- static const char tobetested[] = "\xFF\xFE\xF4\xF2\xF0\xEF\xE8\xE3\xE2\xE1\xE0\xC2\xC1\xC0\x82";
+ static const char tobetested[] = "A\xA0\xC0\xC1\xC2\xD0\xE0\xE8\xF2\xF7\xF8\xFE\xFF";
const char *p = tobetested;
- if (objc != 3 || strcmp(Tcl_GetString(objv[1]), "-bytestring")) {
- if (objc != 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes");
- return TCL_ERROR;
- }
- bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
- } else {
- bytes = (char *) Tcl_GetBytesFromObj(interp, objv[2], &numBytes);
- if (bytes == NULL) {
- return TCL_ERROR;
- }
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes");
+ return TCL_ERROR;
}
+ bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
- if (numBytes > (int)sizeof(buffer)-2) {
- Tcl_AppendResult(interp, "\"testutfnext\" can only handle 30 bytes", NULL);
+ if (numBytes > (int)sizeof(buffer) - 4) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "\"testutfnext\" can only handle %d bytes",
+ (int)sizeof(buffer) - 4));
return TCL_ERROR;
}
memcpy(buffer + 1, bytes, numBytes);
- buffer[0] = buffer[numBytes + 1] = '\x00';
+ buffer[0] = buffer[numBytes + 1] = buffer[numBytes + 2] = buffer[numBytes + 3] = '\xA0';
- first = result = TclUtfNext(buffer + 1);
+ first = result = Tcl_UtfNext(buffer + 1);
while ((buffer[0] = *p++) != '\0') {
/* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */
- result = TclUtfNext(buffer + 1);
+ result = Tcl_UtfNext(buffer + 1);
if (first != result) {
Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL);
return TCL_ERROR;
}
}
+ p = tobetested;
+ while ((buffer[numBytes + 1] = *p++) != '\0') {
+ /* Run Tcl_UtfNext with many more possible bytes at src[end], all should give the same result */
+ result = Tcl_UtfNext(buffer + 1);
+ if (first != result) {
+ first = buffer;
+ break;
+ }
+ }
Tcl_SetObjResult(interp, Tcl_NewIntObj(first - buffer - 1));
@@ -6879,17 +6939,13 @@ TestUtfPrevCmd(
int numBytes, offset;
char *bytes;
const char *result;
- Tcl_Obj *copy;
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?");
return TCL_ERROR;
}
- bytes = (char *) Tcl_GetBytesFromObj(interp, objv[1], &numBytes);
- if (bytes == NULL) {
- return TCL_ERROR;
- }
+ bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
if (objc == 3) {
if (TCL_OK != Tcl_GetIntForIndex(interp, objv[2], numBytes, &offset)) {
@@ -6904,14 +6960,8 @@ TestUtfPrevCmd(
} else {
offset = numBytes;
}
- copy = Tcl_DuplicateObj(objv[1]);
- bytes = (char *) Tcl_SetByteArrayLength(copy, numBytes+1);
- bytes[numBytes] = '\0';
-
result = TclUtfPrev(bytes + offset, bytes);
Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes));
-
- Tcl_DecrRefCount(copy);
return TCL_OK;
}
@@ -6921,7 +6971,7 @@ TestUtfPrevCmd(
static int
TestNumUtfCharsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -6950,7 +7000,7 @@ TestNumUtfCharsCmd(
static int
TestFindFirstCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -6972,7 +7022,7 @@ TestFindFirstCmd(
static int
TestFindLastCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -7014,7 +7064,7 @@ TestFindLastCmd(
static int
TestcpuidCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const * objv) /* Parameter vector */
@@ -7050,7 +7100,7 @@ TestcpuidCmd(
static int
TestHashSystemHashCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -7126,7 +7176,7 @@ TestHashSystemHashCmd(
*/
static int
TestgetintCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int argc,
const char **argv)
@@ -7153,7 +7203,7 @@ TestgetintCmd(
*/
static int
TestlongsizeCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int argc,
TCL_UNUSED(const char **) /*argv*/)
@@ -7195,7 +7245,7 @@ NREUnwind_callback(
static int
TestNREUnwind(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /*objv*/)
@@ -7213,7 +7263,7 @@ TestNREUnwind(
static int
TestNRELevels(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /*objv*/)
@@ -7269,7 +7319,7 @@ TestNRELevels(
static int
TestconcatobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(int) /*argc*/,
TCL_UNUSED(const char **) /*argv*/)
@@ -7565,7 +7615,7 @@ TestconcatobjCmd(
static int
TestgetencpathObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Argument strings. */
@@ -7598,7 +7648,7 @@ TestgetencpathObjCmd(
static int
TestsetencpathObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Argument strings. */
@@ -7632,7 +7682,7 @@ TestsetencpathObjCmd(
static int
TestparseargsCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Arguments. */
@@ -7871,7 +7921,7 @@ InterpCompiledVarResolver(
static int
TestInterpResolverCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
@@ -7887,7 +7937,7 @@ TestInterpResolverCmd(
return TCL_ERROR;
}
if (objc == 3) {
- interp = Tcl_GetSlave(interp, Tcl_GetString(objv[2]));
+ interp = Tcl_GetChild(interp, Tcl_GetString(objv[2]));
if (interp == NULL) {
Tcl_AppendResult(interp, "provided interpreter not found", NULL);
return TCL_ERROR;
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index bfd0a45..bd5d92e 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -149,7 +149,7 @@ TclObjTest_Init(
static int
TestbignumobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Argument count */
Tcl_Obj *const objv[]) /* Argument vector */
@@ -348,7 +348,7 @@ TestbignumobjCmd(
static int
TestbooleanobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -448,7 +448,7 @@ TestbooleanobjCmd(
static int
TestdoubleobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -566,7 +566,7 @@ TestdoubleobjCmd(
static int
TestindexobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -627,7 +627,7 @@ TestindexobjCmd(
argv[objc-4] = NULL;
result = Tcl_GetIndexFromObj((setError? interp : NULL), objv[3],
- argv, "token", INDEX_TEMP_TABLE|(allowAbbrev? 0 : TCL_EXACT),
+ argv, "token", TCL_INDEX_TEMP_TABLE|(allowAbbrev? 0 : TCL_EXACT),
&index);
ckfree(argv);
if (result == TCL_OK) {
@@ -656,7 +656,7 @@ TestindexobjCmd(
static int
TestintobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -860,7 +860,7 @@ TestintobjCmd(
static int
TestlistobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Tcl interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -957,7 +957,7 @@ TestlistobjCmd(
static int
TestobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1169,7 +1169,7 @@ TestobjCmd(
static int
TeststringobjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c
index 09dfbef..db6ec8a 100644
--- a/generic/tclTestProcBodyObj.c
+++ b/generic/tclTestProcBodyObj.c
@@ -228,7 +228,7 @@ ProcBodyTestInitInternal(
static int
ProcBodyTestProcObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* the current interpreter */
int objc, /* argument count */
Tcl_Obj *const objv[]) /* arguments */
@@ -327,7 +327,7 @@ ProcBodyTestProcObjCmd(
static int
ProcBodyTestCheckObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* the current interpreter */
int objc, /* argument count */
Tcl_Obj *const objv[]) /* arguments */
diff --git a/generic/tclThread.c b/generic/tclThread.c
index f22653a..76aaf4b 100644
--- a/generic/tclThread.c
+++ b/generic/tclThread.c
@@ -126,7 +126,7 @@ TclThreadDataKeyGet(
* Keep a list of (mutexes/condition variable/data key) used during
* finalization.
*
- * Assume master lock is held.
+ * Assume global lock is held.
*
* Results:
* None.
@@ -187,7 +187,7 @@ RememberSyncObject(
* ForgetSyncObject
*
* Remove a single object from the list.
- * Assume master lock is held.
+ * Assume global lock is held.
*
* Results:
* None.
@@ -219,7 +219,7 @@ ForgetSyncObject(
* TclRememberMutex
*
* Keep a list of mutexes used during finalization.
- * Assume master lock is held.
+ * Assume global lock is held.
*
* Results:
* None.
@@ -262,9 +262,9 @@ Tcl_MutexFinalize(
#if TCL_THREADS
TclpFinalizeMutex(mutexPtr);
#endif
- TclpMasterLock();
+ TclpGlobalLock();
ForgetSyncObject(mutexPtr, &mutexRecord);
- TclpMasterUnlock();
+ TclpGlobalUnlock();
}
/*
@@ -273,7 +273,7 @@ Tcl_MutexFinalize(
* TclRememberCondition
*
* Keep a list of condition variables used during finalization.
- * Assume master lock is held.
+ * Assume global lock is held.
*
* Results:
* None.
@@ -316,9 +316,9 @@ Tcl_ConditionFinalize(
#if TCL_THREADS
TclpFinalizeCondition(condPtr);
#endif
- TclpMasterLock();
+ TclpGlobalLock();
ForgetSyncObject(condPtr, &condRecord);
- TclpMasterUnlock();
+ TclpGlobalUnlock();
}
/*
@@ -382,7 +382,7 @@ TclFinalizeSynchronization(void)
Tcl_Mutex *mutexPtr;
Tcl_Condition *condPtr;
- TclpMasterLock();
+ TclpGlobalLock();
#endif
/*
@@ -404,7 +404,7 @@ TclFinalizeSynchronization(void)
#if TCL_THREADS
/*
- * Call thread storage master cleanup.
+ * Call thread storage global cleanup.
*/
TclFinalizeThreadStorage();
@@ -435,7 +435,7 @@ TclFinalizeSynchronization(void)
condRecord.max = 0;
condRecord.num = 0;
- TclpMasterUnlock();
+ TclpGlobalUnlock();
#endif /* TCL_THREADS */
}
diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c
index 99e6bac..74c23af 100644
--- a/generic/tclThreadStorage.c
+++ b/generic/tclThreadStorage.c
@@ -27,11 +27,11 @@
*/
/*
- * The master collection of information about TSDs. This is shared across the
+ * The global collection of information about TSDs. This is shared across the
* whole process, and includes the mutex used to protect it.
*/
-static struct TSDMaster {
+static struct {
void *key; /* Key into the system TSD structure. The
* collection of Tcl TSD values for a
* particular thread will hang off the
@@ -41,13 +41,13 @@ static struct TSDMaster {
* increasing value. */
Tcl_Mutex mutex; /* Protection for the rest of this structure,
* which holds per-process data. */
-} tsdMaster = { NULL, 0, NULL };
+} tsdGlobal = { NULL, 0, NULL };
/*
* The type of the data held per thread in a system TSD.
*/
-typedef struct TSDTable {
+typedef struct {
ClientData *tablePtr; /* The table of Tcl TSDs. */
sig_atomic_t allocated; /* The size of the table in the current
* thread. */
@@ -57,7 +57,7 @@ typedef struct TSDTable {
* The actual type of Tcl_ThreadDataKey.
*/
-typedef union TSDUnion {
+typedef union {
volatile sig_atomic_t offset;
/* The type is really an offset into the
* thread-local table of TSDs, which is this
@@ -189,7 +189,7 @@ void *
TclThreadStorageKeyGet(
Tcl_ThreadDataKey *dataKeyPtr)
{
- TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetMasterTSD(tsdMaster.key);
+ TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetGlobalTSD(tsdGlobal.key);
ClientData resultPtr = NULL;
TSDUnion *keyPtr = (TSDUnion *) dataKeyPtr;
sig_atomic_t offset = keyPtr->offset;
@@ -223,12 +223,12 @@ TclThreadStorageKeySet(
Tcl_ThreadDataKey *dataKeyPtr,
void *value)
{
- TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetMasterTSD(tsdMaster.key);
+ TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetGlobalTSD(tsdGlobal.key);
TSDUnion *keyPtr = (TSDUnion *) dataKeyPtr;
if (tsdTablePtr == NULL) {
tsdTablePtr = TSDTableCreate();
- TclpThreadSetMasterTSD(tsdMaster.key, tsdTablePtr);
+ TclpThreadSetGlobalTSD(tsdGlobal.key, tsdTablePtr);
}
/*
@@ -240,15 +240,15 @@ TclThreadStorageKeySet(
*/
if (keyPtr->offset == 0) {
- Tcl_MutexLock(&tsdMaster.mutex);
+ Tcl_MutexLock(&tsdGlobal.mutex);
if (keyPtr->offset == 0) {
/*
* The Tcl_ThreadDataKey hasn't been used yet. Make a new one.
*/
- keyPtr->offset = ++tsdMaster.counter;
+ keyPtr->offset = ++tsdGlobal.counter;
}
- Tcl_MutexUnlock(&tsdMaster.mutex);
+ Tcl_MutexUnlock(&tsdGlobal.mutex);
}
/*
@@ -288,11 +288,11 @@ TclThreadStorageKeySet(
void
TclFinalizeThreadDataThread(void)
{
- TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetMasterTSD(tsdMaster.key);
+ TSDTable *tsdTablePtr = (TSDTable *)TclpThreadGetGlobalTSD(tsdGlobal.key);
if (tsdTablePtr != NULL) {
TSDTableDelete(tsdTablePtr);
- TclpThreadSetMasterTSD(tsdMaster.key, NULL);
+ TclpThreadSetGlobalTSD(tsdGlobal.key, NULL);
}
}
@@ -316,7 +316,7 @@ TclFinalizeThreadDataThread(void)
void
TclInitThreadStorage(void)
{
- tsdMaster.key = TclpThreadCreateKey();
+ tsdGlobal.key = TclpThreadCreateKey();
}
/*
@@ -339,8 +339,8 @@ TclInitThreadStorage(void)
void
TclFinalizeThreadStorage(void)
{
- TclpThreadDeleteKey(tsdMaster.key);
- tsdMaster.key = NULL;
+ TclpThreadDeleteKey(tsdGlobal.key);
+ tsdGlobal.key = NULL;
}
#else /* !TCL_THREADS */
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index b1b64f4..b98623c 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -205,7 +205,7 @@ TclThread_Init(
static int
ThreadObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -293,7 +293,7 @@ ThreadObjCmd(
script = Tcl_GetStringFromObj(objv[2], &len);
if ((len > 1) && (script[0] == '-') && (script[1] == 'j') &&
- (0 == strncmp(script, "-joinable", (size_t) len))) {
+ (0 == strncmp(script, "-joinable", len))) {
joinable = 1;
script = "testthread wait"; /* Just enter event loop */
} else {
@@ -310,7 +310,7 @@ ThreadObjCmd(
script = Tcl_GetStringFromObj(objv[2], &len);
joinable = ((len > 1) && (script[0] == '-') && (script[1] == 'j')
- && (0 == strncmp(script, "-joinable", (size_t) len)));
+ && (0 == strncmp(script, "-joinable", len)));
script = Tcl_GetString(objv[3]);
} else {
Tcl_WrongNumArgs(interp, 2, objv, "?-joinable? ?script?");
@@ -1105,7 +1105,7 @@ ThreadFreeProc(
static int
ThreadDeleteEvent(
Tcl_Event *eventPtr, /* Really ThreadEvent */
- TCL_UNUSED(ClientData))
+ TCL_UNUSED(void *))
{
if (eventPtr->proc == ThreadEventProc) {
ckfree(((ThreadEvent *) eventPtr)->script);
diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h
index e9257a0..b421cde 100644
--- a/generic/tclTomMath.h
+++ b/generic/tclTomMath.h
@@ -2,13 +2,46 @@
#define BN_TCL_H_
#ifdef MP_NO_STDINT
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
+# ifdef HAVE_STDINT_H
+# include <stdint.h>
#else
-# include "../compat/stdint.h"
+# include "../compat/stdint.h"
+# endif
#endif
+#if defined(TCL_NO_TOMMATH_H)
+ typedef size_t mp_digit;
+ typedef int mp_sign;
+# define MP_ZPOS 0 /* positive integer */
+# define MP_NEG 1 /* negative */
+ typedef int mp_ord;
+# define MP_LT -1 /* less than */
+# define MP_EQ 0 /* equal to */
+# define MP_GT 1 /* greater than */
+ typedef int mp_err;
+# define MP_OKAY 0 /* no error */
+# define MP_ERR -1 /* unknown error */
+# define MP_MEM -2 /* out of mem */
+# define MP_VAL -3 /* invalid input */
+# define MP_ITER -4 /* maximum iterations reached */
+# define MP_BUF -5 /* buffer overflow, supplied buffer too small */
+# define MP_WUR /* nothing */
+# define mp_iszero(a) ((a)->used == 0)
+# define mp_isneg(a) ((a)->sign != 0)
+
+ /* the infamous mp_int structure */
+# ifndef MP_INT_DECLARED
+# define MP_INT_DECLARED
+ typedef struct mp_int mp_int;
+# endif
+ struct mp_int {
+ int used, alloc;
+ mp_sign sign;
+ mp_digit *dp;
+};
+
+#elif !defined(BN_H_) /* If BN_H_ already defined, don't try to include tommath.h again. */
+# include "tommath.h"
#endif
-#include "tommath.h"
#include "tclTomMathDecls.h"
#endif
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 736a640..1427e8b 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -744,7 +744,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
#undef mp_iseven
#undef mp_isodd
#define mp_iseven(a) (!mp_isodd(a))
-#define mp_isodd(a) (((a)->used != 0 && (((a)->dp[0] & 1) != 0)) ? MP_YES : MP_NO)
+#define mp_isodd(a) (((a)->used != 0) && (((a)->dp[0] & 1) != 0))
#undef mp_sqr
#define mp_sqr(a,b) mp_mul(a,a,b)
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index e05fa69..300e0b9 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -183,7 +183,7 @@ typedef struct {
int
Tcl_TraceObjCmd(
- TCL_UNUSED(ClientData),
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1848,7 +1848,7 @@ TraceExecutionProc(
* Append result code.
*/
- resultCode = Tcl_NewIntObj(code);
+ TclNewIntObj(resultCode, code);
resultCodeStr = Tcl_GetString(resultCode);
Tcl_DStringAppendElement(&cmd, resultCodeStr);
Tcl_DecrRefCount(resultCode);
@@ -1976,7 +1976,7 @@ TraceVarProc(
int rewind = ((Interp *)interp)->execEnvPtr->rewind;
/*
- * We might call Tcl_Eval() below, and that might evaluate [trace vdelete]
+ * We might call Tcl_EvalEx() below, and that might evaluate [trace vdelete]
* which might try to free tvarPtr. We want to use tvarPtr until the end
* of this function, so we use Tcl_Preserve() and Tcl_Release() to be sure
* it is not freed while we still need it.
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 19e1365..11bde5c 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -55,7 +55,7 @@
#define UNICODE_SELF 0x80
/*
- * The following structures are used when mapping between Unicode (UCS-2) and
+ * The following structures are used when mapping between Unicode and
* UTF-8.
*/
@@ -69,7 +69,13 @@ static const unsigned char totalBytes[256] = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
/* End of "continuation byte section" */
2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+#if TCL_UTF_MAX > 3
+ 4,4,4,4,4,
+#else
+ 1,1,1,1,1,
+#endif
+ 1,1,1,1,1,1,1,1,1,1,1
};
static const unsigned char complete[256] = {
@@ -86,7 +92,7 @@ static const unsigned char complete[256] = {
#if TCL_UTF_MAX > 3
4,4,4,4,4,
#else
- 1,1,1,1,1,
+ 3,3,3,3,3,
#endif
1,1,1,1,1,1,1,1,1,1,1
};
@@ -95,12 +101,7 @@ static const unsigned char complete[256] = {
* Functions used only in this module.
*/
-static int Invalid(unsigned char *src);
-
-#define UCS4ToUpper Tcl_UniCharToUpper
-#define UCS4ToLower Tcl_UniCharToLower
-#define UCS4ToTitle Tcl_UniCharToTitle
-
+static int Invalid(const char *src);
/*
*---------------------------------------------------------------------------
@@ -139,15 +140,23 @@ TclUtfCount(
*
* Invalid --
*
- * Utility routine to report whether /src/ points to the start of an
- * invald byte sequence that should be rejected. This might be because
- * it is an overlong encoding, or because it encodes something out of
- * the proper range. Caller guarantees that src[0] and src[1] are
- * readable, and
+ * Given a pointer to a two-byte prefix of a well-formed UTF-8 byte
+ * sequence (a lead byte followed by a trail byte) this routine
+ * examines those two bytes to determine whether the sequence is
+ * invalid in UTF-8. This might be because it is an overlong
+ * encoding, or because it encodes something out of the proper range.
+ *
+ * Given a pointer to the bytes \xF8 or \xFC , this routine will
+ * try to read beyond the end of the "bounds" table. Callers must
+ * prevent this.
*
- * (src[0] >= 0xC0) && (src[0] != 0xC1)
- * (src[1] >= 0x80) && (src[1] < 0xC0)
- * (src[0] < ((TCL_UTF_MAX > 3) ? 0xF5 : 0xF0))
+ * Given a pointer to something else (an ASCII byte, a trail byte,
+ * or another byte that can never begin a valid byte sequence such
+ * as \xF5) this routine returns false. That makes the routine poorly
+ * named, as it does not detect and report all invalid sequences.
+ *
+ * Callers have to take care that this routine does something useful
+ * for their needs.
*
* Results:
* A boolean.
@@ -166,19 +175,18 @@ static const unsigned char bounds[28] = {
static int
Invalid(
- unsigned char *src) /* Points to lead byte of a UTF-8 byte sequence */
+ const char *src) /* Points to lead byte of a UTF-8 byte sequence */
{
- unsigned char byte = *src;
+ unsigned char byte = UCHAR(*src);
int index;
- if (byte % 0x04) {
+ if ((byte & 0xC3) == 0xC0) {
/* Only lead bytes 0xC0, 0xE0, 0xF0, 0xF4 need examination */
- return 0;
- }
- index = (byte - 0xC0) >> 1;
- if (src[1] < bounds[index] || src[1] > bounds[index+1]) {
- /* Out of bounds - report invalid. */
- return 1;
+ index = (byte - 0xC0) >> 1;
+ if (UCHAR(src[1]) < bounds[index] || UCHAR(src[1]) > bounds[index+1]) {
+ /* Out of bounds - report invalid. */
+ return 1;
+ }
}
return 0;
}
@@ -443,7 +451,7 @@ static const unsigned short cp1252[32] = {
int
Tcl_UtfToUniChar(
const char *src, /* The UTF-8 string. */
- int *chPtr)/* Filled with the unsigned int represented by
+ int *chPtr)/* Filled with the Unicode character represented by
* the UTF-8 string. */
{
int byte;
@@ -502,7 +510,7 @@ Tcl_UtfToUniChar(
* represents itself.
*/
}
- else if (byte < 0xF8) {
+ else if (byte < 0xF5) {
if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) {
/*
* Four-byte-character lead byte followed by three trail bytes.
@@ -527,8 +535,8 @@ Tcl_UtfToUniChar(
int
Tcl_UtfToChar16(
const char *src, /* The UTF-8 string. */
- unsigned short *chPtr)/* Filled with the unsigned short represented by
- * the UTF-8 string. */
+ unsigned short *chPtr)/* Filled with the Tcl_UniChar represented by
+ * the UTF-8 string. This could be a surrogate too. */
{
unsigned short byte;
@@ -536,7 +544,7 @@ Tcl_UtfToChar16(
* Unroll 1 to 4 byte UTF-8 sequences.
*/
- byte = *((unsigned char *) src);
+ byte = UCHAR(*src);
if (byte < 0xC0) {
/*
* Handles properly formed UTF-8 characters between 0x01 and 0x7F.
@@ -598,20 +606,20 @@ Tcl_UtfToChar16(
* represents itself.
*/
}
- else if (byte < 0xF8) {
- if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) {
+ else if (byte < 0xF5) {
+ if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80)) {
/*
- * Four-byte-character lead byte followed by three trail bytes.
+ * Four-byte-character lead byte followed by at least two trail bytes.
+ * We don't test the validity of 3th trail byte, see [ed29806ba]
*/
- unsigned short high = (((byte & 0x07) << 8) | ((src[1] & 0x3F) << 2)
+ Tcl_UniChar high = (((byte & 0x07) << 8) | ((src[1] & 0x3F) << 2)
| ((src[2] & 0x3F) >> 4)) - 0x40;
- if (high >= 0x400) {
- /* out of range, < 0x10000 or > 0x10FFFF */
- } else {
+ if (high < 0x400) {
/* produce high surrogate, advance source pointer */
*chPtr = 0xD800 + high;
return 1;
}
+ /* out of range, < 0x10000 or > 0x10FFFF */
}
/*
@@ -653,8 +661,12 @@ Tcl_UtfToUniCharDString(
* DString. */
{
int ch = 0, *w, *wString;
- const char *p, *end;
+ const char *p;
int oldLength;
+ /* Pointer to the end of string. Never read endPtr[0] */
+ const char *endPtr = src + length;
+ /* Pointer to last byte where optimization still can be used */
+ const char *optPtr = endPtr - TCL_UTF_MAX;
if (src == NULL) {
return NULL;
@@ -676,20 +688,19 @@ Tcl_UtfToUniCharDString(
w = wString;
p = src;
- end = src + length - 4;
- while (p < end) {
- p += Tcl_UtfToUniChar(p, &ch);
+ endPtr = src + length;
+ optPtr = endPtr - 4;
+ while (p <= optPtr) {
+ p += TclUtfToUCS4(p, &ch);
*w++ = ch;
}
- end += 4;
- while (p < end) {
- if (Tcl_UtfCharComplete(p, end-p)) {
- p += Tcl_UtfToUniChar(p, &ch);
- } else {
- ch = UCHAR(*p++);
- }
+ while ((p < endPtr) && TclUCS4Complete(p, endPtr-p)) {
+ p += TclUtfToUCS4(p, &ch);
*w++ = ch;
}
+ while (p < endPtr) {
+ *w++ = UCHAR(*p++);
+ }
*w = '\0';
Tcl_DStringSetLength(dsPtr,
oldLength + ((char *) w - (char *) wString));
@@ -706,10 +717,13 @@ Tcl_UtfToChar16DString(
* appended to this previously initialized
* DString. */
{
- unsigned short ch = 0;
- unsigned short *w, *wString;
- const char *p, *end;
+ unsigned short ch = 0, *w, *wString;
+ const char *p;
int oldLength;
+ /* Pointer to the end of string. Never read endPtr[0] */
+ const char *endPtr = src + length;
+ /* Pointer to last byte where optimization still can be used */
+ const char *optPtr = endPtr - TCL_UTF_MAX;
if (src == NULL) {
return NULL;
@@ -731,19 +745,19 @@ Tcl_UtfToChar16DString(
w = wString;
p = src;
- end = src + length - 4;
- while (p < end) {
+ endPtr = src + length;
+ optPtr = endPtr - 3;
+ while (p <= optPtr) {
p += Tcl_UtfToChar16(p, &ch);
*w++ = ch;
}
- end += 4;
- while (p < end) {
- if (Tcl_UtfCharComplete(p, end-p)) {
+ while (p < endPtr) {
+ if (TclChar16Complete(p, endPtr-p)) {
p += Tcl_UtfToChar16(p, &ch);
+ *w++ = ch;
} else {
- ch = UCHAR(*p++);
+ *w++ = UCHAR(*p++);
}
- *w++ = ch;
}
*w = '\0';
Tcl_DStringSetLength(dsPtr,
@@ -751,6 +765,7 @@ Tcl_UtfToChar16DString(
return wString;
}
+
/*
*---------------------------------------------------------------------------
*
@@ -776,7 +791,7 @@ Tcl_UtfCharComplete(
* a complete UTF-8 character. */
int length) /* Length of above string in bytes. */
{
- return length >= complete[(unsigned char)*src];
+ return length >= complete[UCHAR(*src)];
}
/*
@@ -800,40 +815,51 @@ Tcl_UtfCharComplete(
int
Tcl_NumUtfChars(
const char *src, /* The UTF-8 string to measure. */
- int length) /* The length of the string in bytes, or -1
- * for strlen(string). */
+ int length) /* The length of the string in bytes, or -1
+ * for strlen(string). */
{
Tcl_UniChar ch = 0;
int i = 0;
- /*
- * The separate implementations are faster.
- *
- * Since this is a time-sensitive function, we also do the check for the
- * single-byte char case specially.
- */
-
if (length < 0) {
- while (*src != '\0') {
+ /* string is NUL-terminated, so TclUtfToUniChar calls are safe. */
+ while ((*src != '\0') && (i < INT_MAX)) {
src += TclUtfToUniChar(src, &ch);
i++;
}
- if (i < 0) i = INT_MAX; /* Bug [2738427] */
} else {
- const char *endPtr = src + length - 4;
+ /* Will return value between 0 and length. No overflow checks. */
- while (src < endPtr) {
+ /* Pointer to the end of string. Never read endPtr[0] */
+ const char *endPtr = src + length;
+ /* Pointer to last byte where optimization still can be used */
+ const char *optPtr = endPtr - TCL_UTF_MAX;
+
+ /*
+ * Optimize away the call in this loop. Justified because...
+ * when (src <= optPtr), (endPtr - src) >= (endPtr - optPtr)
+ * By initialization above (endPtr - optPtr) = TCL_UTF_MAX
+ * So (endPtr - src) >= TCL_UTF_MAX, and passing that to
+ * Tcl_UtfCharComplete we know will cause return of 1.
+ */
+ while (src <= optPtr
+ /* && Tcl_UtfCharComplete(src, endPtr - src) */ ) {
src += TclUtfToUniChar(src, &ch);
i++;
}
- endPtr += 4;
- while ((src < endPtr) && Tcl_UtfCharComplete(src, endPtr - src)) {
- src += TclUtfToUniChar(src, &ch);
+ /* Loop over the remaining string where call must happen */
+ while (src < endPtr) {
+ if (Tcl_UtfCharComplete(src, endPtr - src)) {
+ src += TclUtfToUniChar(src, &ch);
+ } else {
+ /*
+ * src points to incomplete UTF-8 sequence
+ * Treat first byte as character and count it
+ */
+ src++;
+ }
i++;
}
- if (src < endPtr) {
- i += endPtr - src;
- }
}
return i;
}
@@ -843,7 +869,7 @@ Tcl_NumUtfChars(
*
* Tcl_UtfFindFirst --
*
- * Returns a pointer to the first occurance of the given Unicode character
+ * Returns a pointer to the first occurrence of the given Unicode character
* in the NULL-terminated UTF-8 string. The NULL terminator is considered
* part of the UTF-8 string. Equivalent to Plan 9 utfrune().
*
@@ -863,9 +889,9 @@ Tcl_UtfFindFirst(
int ch) /* The Unicode character to search for. */
{
while (1) {
- int ucs4, len = TclUtfToUCS4(src, &ucs4);
+ int find, len = TclUtfToUCS4(src, &find);
- if (ucs4 == ch) {
+ if (find == ch) {
return src;
}
if (*src == '\0') {
@@ -880,7 +906,7 @@ Tcl_UtfFindFirst(
*
* Tcl_UtfFindLast --
*
- * Returns a pointer to the last occurance of the given Unicode character
+ * Returns a pointer to the last occurrence of the given Unicode character
* in the NULL-terminated UTF-8 string. The NULL terminator is considered
* part of the UTF-8 string. Equivalent to Plan 9 utfrrune().
*
@@ -902,9 +928,9 @@ Tcl_UtfFindLast(
const char *last = NULL;
while (1) {
- int ucs4, len = TclUtfToUCS4(src, &ucs4);
+ int find, len = TclUtfToUCS4(src, &find);
- if (ucs4 == ch) {
+ if (find == ch) {
last = src;
}
if (*src == '\0') {
@@ -940,8 +966,8 @@ const char *
Tcl_UtfNext(
const char *src) /* The current location in the string. */
{
- int left = totalBytes[UCHAR(*src)];
- const char *next = src + 1;
+ int left;
+ const char *next;
if (((*src) & 0xC0) == 0x80) {
if ((((*++src) & 0xC0) == 0x80) && (((*++src) & 0xC0) == 0x80)) {
@@ -950,6 +976,8 @@ Tcl_UtfNext(
return src;
}
+ left = totalBytes[UCHAR(*src)];
+ next = src + 1;
while (--left) {
if ((*next & 0xC0) != 0x80) {
/*
@@ -961,7 +989,14 @@ Tcl_UtfNext(
}
next++;
}
- if ((next == src + 1) || Invalid((unsigned char *)src)) {
+ /*
+ * Call Invalid() here only if required conditions are met:
+ * src[0] is known a lead byte.
+ * src[1] is known a trail byte.
+ * Especially important to prevent calls when src[0] == '\xF8' or '\xFC'
+ * See tests utf-6.37 through utf-6.43 through valgrind or similar tool.
+ */
+ if ((next == src + 1) || Invalid(src)) {
return src + 1;
}
return next;
@@ -998,7 +1033,7 @@ Tcl_UtfPrev(
/* If we cannot find a lead byte that might
* start a prefix of a valid UTF byte sequence,
* we will fallback to a one-byte back step */
- unsigned char *look = (unsigned char *)fallback;
+ const char *look = fallback;
/* Start search at the fallback position */
/* Quick boundary case exit. */
@@ -1007,7 +1042,7 @@ Tcl_UtfPrev(
}
do {
- unsigned char byte = look[0];
+ unsigned char byte = UCHAR(look[0]);
if (byte < 0x80) {
/*
@@ -1029,7 +1064,7 @@ Tcl_UtfPrev(
* it (the fallback) is correct.
*/
- || (trailBytesSeen >= totalBytes[byte])) {
+ || (trailBytesSeen >= complete[byte])) {
/*
* That is, (1 + trailBytesSeen > needed).
* We've examined more bytes than needed to complete
@@ -1043,7 +1078,7 @@ Tcl_UtfPrev(
/*
* trailBytesSeen > 0, so we can examine look[1] safely.
- * Use that capability to screen out overlong sequences.
+ * Use that capability to screen out invalid sequences.
*/
if (Invalid(look)) {
@@ -1070,7 +1105,7 @@ Tcl_UtfPrev(
/* Continue the search backwards... */
look--;
- } while (trailBytesSeen < 4);
+ } while (trailBytesSeen < TCL_UTF_MAX);
/*
* We've seen TCL_UTF_MAX trail bytes, so we know there will not be a
@@ -1078,7 +1113,11 @@ Tcl_UtfPrev(
* accepting the fallback (for TCL_UTF_MAX > 3) or just go back as
* far as we can.
*/
+#if TCL_UTF_MAX > 3
return fallback;
+#else
+ return src - TCL_UTF_MAX;
+#endif
}
/*
@@ -1103,10 +1142,24 @@ Tcl_UniCharAtIndex(
const char *src, /* The UTF-8 string to dereference. */
int index) /* The position of the desired character. */
{
- int ch = 0;
+ Tcl_UniChar ch = 0;
+ int i = 0;
- TclUtfToUCS4(Tcl_UtfAtIndex(src, index), &ch);
- return ch;
+ if (index < 0) {
+ return -1;
+ }
+ while (index-- > 0) {
+ i = TclUtfToUniChar(src, &ch);
+ src += i;
+ }
+#if TCL_UTF_MAX <= 3
+ if ((ch >= 0xD800) && (i < 3)) {
+ /* Index points at character following high Surrogate */
+ return -1;
+ }
+#endif
+ TclUtfToUCS4(src, &i);
+ return i;
}
/*
@@ -1235,7 +1288,7 @@ Tcl_UtfToUpper(
src = dst = str;
while (*src) {
len = TclUtfToUCS4(src, &ch);
- upChar = UCS4ToUpper(ch);
+ upChar = Tcl_UniCharToUpper(ch);
/*
* To keep badly formed Utf strings from getting inflated by the
@@ -1243,7 +1296,7 @@ Tcl_UtfToUpper(
* char to dst if its size is <= the original char.
*/
- if ((len < TclUtfCount(upChar)) || ((upChar & 0xF800) == 0xD800)) {
+ if ((len < TclUtfCount(upChar)) || ((upChar & ~0x7FF) == 0xD800)) {
memmove(dst, src, len);
dst += len;
} else {
@@ -1288,7 +1341,7 @@ Tcl_UtfToLower(
src = dst = str;
while (*src) {
len = TclUtfToUCS4(src, &ch);
- lowChar = UCS4ToLower(ch);
+ lowChar = Tcl_UniCharToLower(ch);
/*
* To keep badly formed Utf strings from getting inflated by the
@@ -1296,7 +1349,7 @@ Tcl_UtfToLower(
* char to dst if its size is <= the original char.
*/
- if ((len < TclUtfCount(lowChar)) || ((lowChar & 0xF800) == 0xD800)) {
+ if ((len < TclUtfCount(lowChar)) || ((lowChar & ~0x7FF) == 0xD800)) {
memmove(dst, src, len);
dst += len;
} else {
@@ -1344,9 +1397,9 @@ Tcl_UtfToTitle(
if (*src) {
len = TclUtfToUCS4(src, &ch);
- titleChar = UCS4ToTitle(ch);
+ titleChar = Tcl_UniCharToTitle(ch);
- if ((len < TclUtfCount(titleChar)) || ((titleChar & 0xF800) == 0xD800)) {
+ if ((len < TclUtfCount(titleChar)) || ((titleChar & ~0x7FF) == 0xD800)) {
memmove(dst, src, len);
dst += len;
} else {
@@ -1359,10 +1412,10 @@ Tcl_UtfToTitle(
lowChar = ch;
/* Special exception for Georgian Asomtavruli chars, no titlecase. */
if ((unsigned)(lowChar - 0x1C90) >= 0x30) {
- lowChar = UCS4ToLower(lowChar);
+ lowChar = Tcl_UniCharToLower(lowChar);
}
- if ((len < TclUtfCount(lowChar)) || ((lowChar & 0xF800) == 0xD800)) {
+ if ((len < TclUtfCount(lowChar)) || ((lowChar & ~0x7FF) == 0xD800)) {
memmove(dst, src, len);
dst += len;
} else {
@@ -1656,6 +1709,7 @@ Tcl_UniCharToUpper(
ch -= GetDelta(info);
}
}
+ /* Clear away extension bits, if any */
return ch & 0x1FFFFF;
}
@@ -1687,6 +1741,7 @@ Tcl_UniCharToLower(
ch += GetDelta(info);
}
}
+ /* Clear away extension bits, if any */
return ch & 0x1FFFFF;
}
@@ -1726,6 +1781,7 @@ Tcl_UniCharToTitle(
ch -= GetDelta(info);
}
}
+ /* Clear away extension bits, if any */
return ch & 0x1FFFFF;
}
@@ -1913,6 +1969,7 @@ Tcl_UniCharIsControl(
int ch) /* Unicode character to test. */
{
if (UNICODE_OUT_OF_RANGE(ch)) {
+ /* Clear away extension bits, if any */
ch &= 0x1FFFFF;
if ((ch == 0xE0001) || ((ch >= 0xE0020) && (ch <= 0xE007F))) {
return 1;
@@ -2564,6 +2621,20 @@ TclUtfToUCS4(
/* Make use of the #undef Tcl_UtfToUniChar above, which already handles UCS4. */
return Tcl_UtfToUniChar(src, ucs4Ptr);
}
+
+int
+TclUniCharToUCS4(
+ const Tcl_UniChar *src, /* The Tcl_UniChar string. */
+ int *ucs4Ptr) /* Filled with the UCS4 codepoint represented
+ * by the Tcl_UniChar string. */
+{
+ if (((src[0] & 0xFC00) == 0xD800) && ((src[1] & 0xFC00) == 0xDC00)) {
+ *ucs4Ptr = (((src[0] & 0x3FF) << 10) | (src[01] & 0x3FF)) + 0x10000;
+ return 2;
+ }
+ *ucs4Ptr = src[0];
+ return 1;
+}
#endif
/*
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index dd527dc..8db6606 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -108,7 +108,7 @@ static Tcl_ThreadDataKey precisionKey;
static void ClearHash(Tcl_HashTable *tablePtr);
static void FreeProcessGlobalValue(ClientData clientData);
static void FreeThreadHash(ClientData clientData);
-static int GetEndOffsetFromObj(Tcl_Obj *objPtr,
+static int GetEndOffsetFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t endValue, Tcl_WideInt *indexPtr);
static Tcl_HashTable * GetThreadHash(Tcl_ThreadDataKey *keyPtr);
static int GetWideForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
@@ -1857,8 +1857,9 @@ TclTrim(
/* If we did not trim the whole string, it starts with a character
* that we will not trim. Skip over it. */
if (numBytes > 0) {
+ int ch;
const char *first = bytes + trimLeft;
- bytes = TclUtfNext(first);
+ bytes += TclUtfToUCS4(first, &ch);
numBytes -= (bytes - first);
if (numBytes > 0) {
@@ -2161,7 +2162,7 @@ Tcl_StringCaseMatch(
int nocase) /* 0 for case sensitive, 1 for insensitive */
{
int p, charLen;
- Tcl_UniChar ch1 = 0, ch2 = 0;
+ int ch1 = 0, ch2 = 0;
while (1) {
p = *pattern;
@@ -2202,10 +2203,10 @@ Tcl_StringCaseMatch(
*/
if (UCHAR(*pattern) < 0x80) {
- ch2 = (Tcl_UniChar)
+ ch2 = (int)
(nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
} else {
- Tcl_UtfToUniChar(pattern, &ch2);
+ TclUtfToUCS4(pattern, &ch2);
if (nocase) {
ch2 = Tcl_UniCharToLower(ch2);
}
@@ -2221,7 +2222,7 @@ Tcl_StringCaseMatch(
if ((p != '[') && (p != '?') && (p != '\\')) {
if (nocase) {
while (*str) {
- charLen = TclUtfToUniChar(str, &ch1);
+ charLen = TclUtfToUCS4(str, &ch1);
if (ch2==ch1 || ch2==Tcl_UniCharToLower(ch1)) {
break;
}
@@ -2235,7 +2236,7 @@ Tcl_StringCaseMatch(
*/
while (*str) {
- charLen = TclUtfToUniChar(str, &ch1);
+ charLen = TclUtfToUCS4(str, &ch1);
if (ch2 == ch1) {
break;
}
@@ -2249,7 +2250,7 @@ Tcl_StringCaseMatch(
if (*str == '\0') {
return 0;
}
- str += TclUtfToUniChar(str, &ch1);
+ str += TclUtfToUCS4(str, &ch1);
}
}
@@ -2260,7 +2261,7 @@ Tcl_StringCaseMatch(
if (p == '?') {
pattern++;
- str += TclUtfToUniChar(str, &ch1);
+ str += TclUtfToUCS4(str, &ch1);
continue;
}
@@ -2271,15 +2272,15 @@ Tcl_StringCaseMatch(
*/
if (p == '[') {
- Tcl_UniChar startChar = 0, endChar = 0;
+ int startChar = 0, endChar = 0;
pattern++;
if (UCHAR(*str) < 0x80) {
- ch1 = (Tcl_UniChar)
+ ch1 = (int)
(nocase ? tolower(UCHAR(*str)) : UCHAR(*str));
str++;
} else {
- str += Tcl_UtfToUniChar(str, &ch1);
+ str += TclUtfToUCS4(str, &ch1);
if (nocase) {
ch1 = Tcl_UniCharToLower(ch1);
}
@@ -2289,11 +2290,11 @@ Tcl_StringCaseMatch(
return 0;
}
if (UCHAR(*pattern) < 0x80) {
- startChar = (Tcl_UniChar) (nocase
+ startChar = (int) (nocase
? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
pattern++;
} else {
- pattern += Tcl_UtfToUniChar(pattern, &startChar);
+ pattern += TclUtfToUCS4(pattern, &startChar);
if (nocase) {
startChar = Tcl_UniCharToLower(startChar);
}
@@ -2304,11 +2305,11 @@ Tcl_StringCaseMatch(
return 0;
}
if (UCHAR(*pattern) < 0x80) {
- endChar = (Tcl_UniChar) (nocase
+ endChar = (int) (nocase
? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
pattern++;
} else {
- pattern += Tcl_UtfToUniChar(pattern, &endChar);
+ pattern += TclUtfToUCS4(pattern, &endChar);
if (nocase) {
endChar = Tcl_UniCharToLower(endChar);
}
@@ -2356,8 +2357,8 @@ Tcl_StringCaseMatch(
* each string match.
*/
- str += TclUtfToUniChar(str, &ch1);
- pattern += TclUtfToUniChar(pattern, &ch2);
+ str += TclUtfToUCS4(str, &ch1);
+ pattern += TclUtfToUCS4(pattern, &ch2);
if (nocase) {
if (Tcl_UniCharToLower(ch1) != Tcl_UniCharToLower(ch2)) {
return 0;
@@ -2987,7 +2988,7 @@ Tcl_DStringGetResult(
Tcl_DString *dsPtr) /* Dynamic string that is to become the result
* of interp. */
{
-#ifdef TCL_NO_DEPRECATED
+#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
Tcl_Obj *obj = Tcl_GetObjResult(interp);
const char *bytes = TclGetString(obj);
@@ -3631,9 +3632,8 @@ GetWideForIndex(
Tcl_WideInt *widePtr) /* Location filled in with a wide integer
* representing an index. */
{
+ int numType;
ClientData cd;
- const char *opPtr;
- int numType, length, t1 = 0, t2 = 0;
int code = TclGetNumberFromObj(NULL, objPtr, &cd, &numType);
if (code == TCL_OK) {
@@ -3642,152 +3642,16 @@ GetWideForIndex(
*widePtr = *(Tcl_WideInt *)cd;
return TCL_OK;
}
- if (numType != TCL_NUMBER_BIG) {
- /* Must be a double -> not a valid index */
- goto parseError;
- }
-
- /* objPtr holds an integer outside the signed wide range */
- /* Truncate to the signed wide range. */
- *widePtr = ((mp_isneg((mp_int *)cd)) ? WIDE_MIN : WIDE_MAX);
- return TCL_OK;
- }
-
- /* objPtr does not hold a number, check the end+/- format... */
- if (GetEndOffsetFromObj(objPtr, endValue, widePtr) == TCL_OK) {
- return TCL_OK;
- }
-
- /* If we reach here, the string rep of objPtr exists. */
-
- /*
- * The valid index syntax does not include any value that is
- * a list of more than one element. This is necessary so that
- * lists of index values can be reliably distinguished from any
- * single index value.
- */
-
- /*
- * Quick scan to see if multi-value list is even possible.
- * This relies on TclGetString() returning a NUL-terminated string.
- */
- if ((TclMaxListLength(TclGetString(objPtr), -1, NULL) > 1)
-
- /* If it's possible, do the full list parse. */
- && (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &length))
- && (length > 1)) {
- goto parseError;
- }
-
- /* Passed the list screen, so parse for index arithmetic expression */
- if (TCL_OK == TclParseNumber(NULL, objPtr, NULL, NULL, -1, &opPtr,
- TCL_PARSE_INTEGER_ONLY)) {
- Tcl_WideInt w1=0, w2=0;
-
- /* value starts with valid integer... */
-
- if ((*opPtr == '-') || (*opPtr == '+')) {
- /* ... value continues with [-+] ... */
-
- /* Save first integer as wide if possible */
- TclGetNumberFromObj(NULL, objPtr, &cd, &t1);
- if (t1 == TCL_NUMBER_INT) {
- w1 = (*(Tcl_WideInt *)cd);
- }
-
- if (TCL_OK == TclParseNumber(NULL, objPtr, NULL, opPtr + 1,
- -1, NULL, TCL_PARSE_INTEGER_ONLY)) {
- /* ... value concludes with second valid integer */
-
- /* Save second integer as wide if possible */
- TclGetNumberFromObj(NULL, objPtr, &cd, &t2);
- if (t2 == TCL_NUMBER_INT) {
- w2 = (*(Tcl_WideInt *)cd);
- }
- }
- }
- /* Clear invalid intreps left by TclParseNumber */
- TclFreeIntRep(objPtr);
-
- if (t1 && t2) {
- /* We have both integer values */
- if ((t1 == TCL_NUMBER_INT) && (t2 == TCL_NUMBER_INT)) {
- /* Both are wide, do wide-integer math */
- if (*opPtr == '-') {
- if ((w2 == WIDE_MIN) && (interp != NULL)) {
- goto extreme;
- }
- w2 = -w2;
- }
-
- if ((w1 ^ w2) < 0) {
- /* Different signs, sum cannot overflow */
- *widePtr = w1 + w2;
- } else if (w1 >= 0) {
- if (w1 < WIDE_MAX - w2) {
- *widePtr = w1 + w2;
- } else {
- *widePtr = WIDE_MAX;
- }
- } else {
- if (w1 > WIDE_MIN - w2) {
- *widePtr = w1 + w2;
- } else {
- *widePtr = WIDE_MIN;
- }
- }
- } else if (interp == NULL) {
- /*
- * We use an interp to do bignum index calculations.
- * If we don't get one, call all indices with bignums errors,
- * and rely on callers to handle it.
- */
- return TCL_ERROR;
- } else {
- /*
- * At least one is big, do bignum math. Little reason to
- * value performance here. Re-use code. Parse has verified
- * objPtr is an expression. Compute it.
- */
-
- Tcl_Obj *sum;
-
- extreme:
- Tcl_ExprObj(interp, objPtr, &sum);
- TclGetNumberFromObj(NULL, sum, &cd, &numType);
-
- if (numType == TCL_NUMBER_INT) {
- /* sum holds an integer in the signed wide range */
- *widePtr = *(Tcl_WideInt *)cd;
- } else {
- /* sum holds an integer outside the signed wide range */
- /* Truncate to the signed wide range. */
- if (mp_isneg((mp_int *)cd)) {
- *widePtr = WIDE_MIN;
- } else {
- *widePtr = WIDE_MAX;
- }
- }
- Tcl_DecrRefCount(sum);
- }
+ if (numType == TCL_NUMBER_BIG) {
+ /* objPtr holds an integer outside the signed wide range */
+ /* Truncate to the signed wide range. */
+ *widePtr = ((mp_isneg((mp_int *)cd)) ? WIDE_MIN : WIDE_MAX);
return TCL_OK;
}
}
- /* Report a parse error. */
- parseError:
- if (interp != NULL) {
- char * bytes = TclGetString(objPtr);
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\": must be integer?[+-]integer? or"
- " end?[+-]integer?", bytes));
- if (!strncmp(bytes, "end-", 4)) {
- bytes += 4;
- }
- TclCheckBadOctal(interp, bytes);
- Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL);
- }
- return TCL_ERROR;
+ /* objPtr does not hold a number, check the end+/- format... */
+ return GetEndOffsetFromObj(interp, objPtr, endValue, widePtr);
}
/*
@@ -3824,19 +3688,23 @@ Tcl_GetIntForIndex(
int endValue, /* The value to be stored at "indexPtr" if
* "objPtr" holds "end". */
int *indexPtr) /* Location filled in with an integer
- * representing an index. */
+ * representing an index. May be NULL.*/
{
Tcl_WideInt wide;
- if (GetWideForIndex(interp, objPtr, endValue, &wide) == TCL_ERROR) {
+ if (GetWideForIndex(interp, objPtr, (size_t)(endValue + 1) - 1, &wide) == TCL_ERROR) {
return TCL_ERROR;
}
- if (wide < 0) {
- *indexPtr = -1;
- } else if (wide > INT_MAX) {
- *indexPtr = INT_MAX;
- } else {
- *indexPtr = (int) wide;
+ if (indexPtr != NULL) {
+ if ((wide < 0) && (endValue > TCL_INDEX_END)) {
+ *indexPtr = -1;
+ } else if (wide > INT_MAX) {
+ *indexPtr = INT_MAX;
+ } else if (wide < INT_MIN) {
+ *indexPtr = INT_MIN;
+ } else {
+ *indexPtr = (int) wide;
+ }
}
return TCL_OK;
}
@@ -3845,8 +3713,19 @@ Tcl_GetIntForIndex(
*
* GetEndOffsetFromObj --
*
- * Look for a string of the form "end[+-]offset" and convert it to an
- * internal representation holding the offset.
+ * Look for a string of the form "end[+-]offset" or "offset[+-]offset" and
+ * convert it to an internal representation.
+ *
+ * The internal representation (wideValue) uses the following encoding:
+ *
+ * WIDE_MIN: Index value TCL_INDEX_NONE (or -1)
+ * WIDE_MIN+1: Index value n, for any n < -1 (usually same effect as -1)
+ * -$n: Index "end-[expr {$n-1}]"
+ * -2: Index "end-1"
+ * -1: Index "end"
+ * 0: Index "0"
+ * WIDE_MAX-1: Index "end+n", for any n > 1
+ * WIDE_MAX: Index "end+1"
*
* Results:
* Tcl return code.
@@ -3859,6 +3738,7 @@ Tcl_GetIntForIndex(
static int
GetEndOffsetFromObj(
+ Tcl_Interp *interp,
Tcl_Obj *objPtr, /* Pointer to the object to parse */
size_t endValue, /* The value to be stored at "indexPtr" if
* "objPtr" holds "end". */
@@ -3866,42 +3746,164 @@ GetEndOffsetFromObj(
* representing an index. */
{
Tcl_ObjIntRep *irPtr;
- Tcl_WideInt offset = 0; /* Offset in the "end-offset" expression */
+ Tcl_WideInt offset = -1; /* Offset in the "end-offset" expression - 1 */
+ ClientData cd;
while ((irPtr = TclFetchIntRep(objPtr, &endOffsetType)) == NULL) {
Tcl_ObjIntRep ir;
int length;
const char *bytes = TclGetStringFromObj(objPtr, &length);
- if ((length < 3) || (length == 4)) {
- /* Too short to be "end" or to be "end-$integer" */
- return TCL_ERROR;
- }
- if ((*bytes != 'e') || (strncmp(bytes, "end", 3) != 0)) {
- /* Value doesn't start with "end" */
- return TCL_ERROR;
+ if (*bytes != 'e') {
+ int numType;
+ const char *opPtr;
+ int length, t1 = 0, t2 = 0;
+
+ /* Value doesn't start with "e" */
+
+ /* If we reach here, the string rep of objPtr exists. */
+
+ /*
+ * The valid index syntax does not include any value that is
+ * a list of more than one element. This is necessary so that
+ * lists of index values can be reliably distinguished from any
+ * single index value.
+ */
+
+ /*
+ * Quick scan to see if multi-value list is even possible.
+ * This relies on TclGetString() returning a NUL-terminated string.
+ */
+ if ((TclMaxListLength(TclGetString(objPtr), -1, NULL) > 1)
+
+ /* If it's possible, do the full list parse. */
+ && (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &length))
+ && (length > 1)) {
+ goto parseError;
+ }
+
+ /* Passed the list screen, so parse for index arithmetic expression */
+ if (TCL_OK == TclParseNumber(NULL, objPtr, NULL, NULL, -1, &opPtr,
+ TCL_PARSE_INTEGER_ONLY)) {
+ Tcl_WideInt w1=0, w2=0;
+
+ /* value starts with valid integer... */
+
+ if ((*opPtr == '-') || (*opPtr == '+')) {
+ /* ... value continues with [-+] ... */
+
+ /* Save first integer as wide if possible */
+ TclGetNumberFromObj(NULL, objPtr, &cd, &t1);
+ if (t1 == TCL_NUMBER_INT) {
+ w1 = (*(Tcl_WideInt *)cd);
+ }
+
+ if (TCL_OK == TclParseNumber(NULL, objPtr, NULL, opPtr + 1,
+ -1, NULL, TCL_PARSE_INTEGER_ONLY)) {
+ /* ... value concludes with second valid integer */
+
+ /* Save second integer as wide if possible */
+ TclGetNumberFromObj(NULL, objPtr, &cd, &t2);
+ if (t2 == TCL_NUMBER_INT) {
+ w2 = (*(Tcl_WideInt *)cd);
+ }
+ }
+ }
+ /* Clear invalid intreps left by TclParseNumber */
+ TclFreeIntRep(objPtr);
+
+ if (t1 && t2) {
+ /* We have both integer values */
+ if ((t1 == TCL_NUMBER_INT) && (t2 == TCL_NUMBER_INT)) {
+ /* Both are wide, do wide-integer math */
+ if (*opPtr == '-') {
+ if (w2 == WIDE_MIN) {
+ goto extreme;
+ }
+ w2 = -w2;
+ }
+
+ if ((w1 ^ w2) < 0) {
+ /* Different signs, sum cannot overflow */
+ offset = w1 + w2;
+ } else if (w1 >= 0) {
+ if (w1 < WIDE_MAX - w2) {
+ offset = w1 + w2;
+ } else {
+ offset = WIDE_MAX;
+ }
+ } else {
+ if (w1 > WIDE_MIN - w2) {
+ offset = w1 + w2;
+ } else {
+ offset = WIDE_MIN;
+ }
+ }
+ } else {
+ /*
+ * At least one is big, do bignum math. Little reason to
+ * value performance here. Re-use code. Parse has verified
+ * objPtr is an expression. Compute it.
+ */
+
+ Tcl_Obj *sum;
+
+ extreme:
+ if (interp) {
+ Tcl_ExprObj(interp, objPtr, &sum);
+ } else {
+ Tcl_Interp *compute = Tcl_CreateInterp();
+ Tcl_ExprObj(compute, objPtr, &sum);
+ Tcl_DeleteInterp(compute);
+ }
+ TclGetNumberFromObj(NULL, sum, &cd, &numType);
+
+ if (numType == TCL_NUMBER_INT) {
+ /* sum holds an integer in the signed wide range */
+ offset = *(Tcl_WideInt *)cd;
+ } else {
+ /* sum holds an integer outside the signed wide range */
+ /* Truncate to the signed wide range. */
+ if (mp_isneg((mp_int *)cd)) {
+ offset = WIDE_MIN;
+ } else {
+ offset = WIDE_MAX;
+ }
+ }
+ Tcl_DecrRefCount(sum);
+ }
+ if (offset < 0) {
+ offset = (offset == -1) ? WIDE_MIN : WIDE_MIN+1;
+ }
+ goto parseOK;
+ }
+ }
+ goto parseError;
}
+ if ((length < 3) || (length == 4) || (strncmp(bytes, "end", 3) != 0)) {
+ /* Doesn't start with "end" */
+ goto parseError;
+ }
if (length > 4) {
- ClientData cd;
int t;
/* Parse for the "end-..." or "end+..." formats */
if ((bytes[3] != '-') && (bytes[3] != '+')) {
/* No operator where we need one */
- return TCL_ERROR;
+ goto parseError;
}
if (TclIsSpaceProc(bytes[4])) {
/* Space after + or - not permitted. */
- return TCL_ERROR;
+ goto parseError;
}
/* Parse the integer offset */
if (TCL_OK != TclParseNumber(NULL, objPtr, NULL,
bytes+4, length-4, NULL, TCL_PARSE_INTEGER_ONLY)) {
/* Not a recognized integer format */
- return TCL_ERROR;
+ goto parseError;
}
/* Got an integer offset; pull it from where parser left it. */
@@ -3920,9 +3922,17 @@ GetEndOffsetFromObj(
if (bytes[3] == '-') {
offset = (offset == WIDE_MIN) ? WIDE_MAX : -offset;
}
+ if (offset == 1) {
+ offset = WIDE_MAX; /* "end+1" */
+ } else if (offset > 1) {
+ offset = WIDE_MAX - 1; /* "end+n", out of range */
+ } else if (offset != WIDE_MIN) {
+ offset--;
+ }
}
}
+ parseOK:
/* Success. Store the new internal rep. */
ir.wideValue = offset;
Tcl_StoreIntRep(objPtr, &endOffsetType, &ir);
@@ -3930,17 +3940,37 @@ GetEndOffsetFromObj(
offset = irPtr->wideValue;
- if (endValue == (size_t)-1) {
- *widePtr = offset - 1;
+ if (offset == WIDE_MAX) {
+ *widePtr = endValue + 1;
+ } else if (offset == WIDE_MIN) {
+ *widePtr = -1;
+ } else if (endValue == (size_t)-1) {
+ *widePtr = offset;
} else if (offset < 0) {
- /* Different signs, sum cannot overflow */
- *widePtr = endValue + offset;
- } else if (endValue < (Tcl_WideUInt)WIDE_MAX - offset) {
- *widePtr = endValue + offset;
+ /* Different signs, sum cannot overflow */
+ *widePtr = endValue + offset + 1;
+ } else if (offset < WIDE_MAX) {
+ *widePtr = offset;
} else {
- *widePtr = WIDE_MAX;
+ *widePtr = WIDE_MAX;
}
return TCL_OK;
+
+ /* Report a parse error. */
+ parseError:
+ if (interp != NULL) {
+ char * bytes = TclGetString(objPtr);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad index \"%s\": must be integer?[+-]integer? or"
+ " end?[+-]integer?", bytes));
+ if (!strncmp(bytes, "end-", 4)) {
+ bytes += 4;
+ }
+ TclCheckBadOctal(interp, bytes);
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL);
+ }
+
+ return TCL_ERROR;
}
/*
@@ -4006,52 +4036,32 @@ TclIndexEncode(
int after, /* Value to return for index after end */
int *indexPtr) /* Where to write the encoded answer, not NULL */
{
- ClientData cd;
Tcl_WideInt wide;
- int idx, numType, code = TclGetNumberFromObj(NULL, objPtr, &cd, &numType);
-
- if ((code == TCL_OK) && (numType == TCL_NUMBER_INT)) {
- /* We parsed a value in the range WIDE_MIN...WIDE_MAX */
- wide = (*(Tcl_WideInt *)cd);
- integerEncode:
- if (wide < TCL_INDEX_START) {
- /* All negative absolute indices are "before the beginning" */
- idx = before;
- } else if (wide >= INT_MAX) {
- /* This index value is always "after the end" */
- idx = after;
- } else {
- idx = (int) wide;
- }
- /* usual case, the absolute index value encodes itself */
- } else if (TCL_OK == GetEndOffsetFromObj(objPtr, 0, &wide)) {
- /*
- * We parsed an end+offset index value.
- * wide holds the offset value in the range WIDE_MIN...WIDE_MAX.
- */
- if (wide > 0) {
- /*
- * All end+postive or end-negative expressions
- * always indicate "after the end".
- */
- idx = after;
- } else if (wide < INT_MIN - TCL_INDEX_END) {
- /* These indices always indicate "before the beginning */
- idx = before;
- } else {
- /* Encoded end-positive (or end+negative) are offset */
- idx = (int)wide + TCL_INDEX_END;
- }
+ int idx;
- /* TODO: Consider flag to suppress repeated end-offset parse. */
- } else if (TCL_OK == GetWideForIndex(interp, objPtr, 0, &wide)) {
- /*
- * Only reach this case when the index value is a
- * constant index arithmetic expression, and wide
- * holds the result. Treat it the same as if it were
- * parsed as an absolute integer value.
- */
- goto integerEncode;
+ if (TCL_OK == GetWideForIndex(interp, objPtr, (unsigned)TCL_INDEX_END , &wide)) {
+ const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &endOffsetType);
+ if (irPtr && irPtr->wideValue >= 0) {
+ /* "int[+-]int" syntax, works the same here as "int" */
+ irPtr = NULL;
+ }
+ /*
+ * We parsed an end+offset index value.
+ * wide holds the offset value in the range WIDE_MIN...WIDE_MAX.
+ */
+ if (wide > (unsigned)(irPtr ? TCL_INDEX_END : INT_MAX)) {
+ /*
+ * All end+postive or end-negative expressions
+ * always indicate "after the end".
+ */
+ idx = after;
+ } else if (wide <= (irPtr ? INT_MAX : TCL_INDEX_NONE)) {
+ /* These indices always indicate "before the beginning */
+ idx = before;
+ } else {
+ /* Encoded end-positive (or end+negative) are offset */
+ idx = (int)wide;
+ }
} else {
return TCL_ERROR;
}
@@ -4353,8 +4363,8 @@ TclGetProcessGlobalValue(
if (pgvPtr->encoding != current) {
/*
- * The system encoding has changed since the master string value
- * was saved. Convert the master value to be based on the new
+ * The system encoding has changed since the global string value
+ * was saved. Convert the global value to be based on the new
* system encoding.
*/
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 72724a4..2818fc9 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -2322,7 +2322,7 @@ TclPtrIncrObjVarIdx(
VarHashRefCount(varPtr)--;
}
if (varValuePtr == NULL) {
- varValuePtr = Tcl_NewIntObj(0);
+ TclNewIntObj(varValuePtr, 0);
}
if (Tcl_IsShared(varValuePtr)) {
/* Copy on write */
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 6c6f850..e90f286 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -26,10 +26,17 @@
#ifndef MAP_FILE
#define MAP_FILE 0
#endif /* !MAP_FILE */
+#define NOBYFOUR
+#define crc32tab crc_table[0]
+#ifndef TBLS
+#define TBLS 1
+#endif
#ifdef HAVE_ZLIB
#include "zlib.h"
#include "crypt.h"
+#include "zutil.h"
+#include "crc32.h"
#ifdef CFG_RUNTIME_DLLFILE
@@ -289,70 +296,6 @@ static const char pwrot[17] =
"\x00\x80\x40\xC0\x20\xA0\x60\xE0"
"\x10\x90\x50\xD0\x30\xB0\x70\xF0";
-/*
- * Table to compute CRC32.
- */
-#ifdef Z_U4
- typedef Z_U4 z_crc_t;
-#else
- typedef unsigned long z_crc_t;
-#endif
-
-static const z_crc_t crc32tab[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
- 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
- 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
- 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
- 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
- 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
- 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
- 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
- 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
- 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
- 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
- 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
- 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
- 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
- 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
- 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
- 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
- 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
- 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
- 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
- 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
- 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
- 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
- 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
- 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
- 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
- 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
- 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
- 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
- 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
- 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
- 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
- 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
- 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
- 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
- 0x2d02ef8d,
-};
-
static const char *zipfs_literal_tcl_library = NULL;
/* Function prototypes */
@@ -2244,16 +2187,15 @@ ZipAddFile(
return TCL_ERROR;
}
ch = (int) (r * 256);
- kvbuf[i + 12] = (unsigned char) zencode(keys, crc32tab, ch, tmp);
+ kvbuf[i + 12] = UCHAR(zencode(keys, crc32tab, ch, tmp));
}
Tcl_ResetResult(interp);
init_keys(passwd, keys, crc32tab);
for (i = 0; i < 12 - 2; i++) {
- kvbuf[i] = (unsigned char)
- zencode(keys, crc32tab, kvbuf[i + 12], tmp);
+ kvbuf[i] = UCHAR(zencode(keys, crc32tab, kvbuf[i + 12], tmp));
}
- kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 16, tmp);
- kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 24, tmp);
+ kvbuf[i++] = UCHAR(zencode(keys, crc32tab, crc >> 16, tmp));
+ kvbuf[i++] = UCHAR(zencode(keys, crc32tab, crc >> 24, tmp));
len = Tcl_Write(out, (char *) kvbuf, 12);
memset(kvbuf, 0, 24);
if (len != 12) {
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 7f8d007..40aa20f 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -110,7 +110,7 @@ typedef struct {
int format; /* What format of data is going on the wire.
* Needed so that the correct [fconfigure]
* options can be enabled. */
- int readAheadLimit; /* The maximum number of bytes to read from
+ unsigned int readAheadLimit;/* The maximum number of bytes to read from
* the underlying stream in one go. */
z_stream inStream; /* Structure used by zlib for decompression of
* input. */
@@ -124,7 +124,6 @@ typedef struct {
GzipHeader outHeader; /* Header to write to an output stream, when
* compressing a gzip stream. */
Tcl_TimerToken timer; /* Timer used for keeping events fresh. */
- Tcl_DString decompressed; /* Buffer for decompression results. */
Tcl_Obj *compDictObj; /* Byte-array object containing compression
* dictionary (not dictObj!) to use if
* necessary. */
@@ -137,11 +136,15 @@ typedef struct {
* the input compressor.
* OUT_HEADER - Whether the outputHeader field has been registered
* with the output decompressor.
+ * STREAM_DECOMPRESS - Signal decompress pending data.
+ * STREAM_DONE - Flag to signal stream end up to transform input.
*/
-#define ASYNC 0x1
-#define IN_HEADER 0x2
-#define OUT_HEADER 0x4
+#define ASYNC 0x01
+#define IN_HEADER 0x02
+#define OUT_HEADER 0x04
+#define STREAM_DECOMPRESS 0x08
+#define STREAM_DONE 0x10
/*
* Size of buffers allocated by default, and the range it can be set to. The
@@ -184,10 +187,8 @@ static int GenerateHeader(Tcl_Interp *interp, Tcl_Obj *dictObj,
GzipHeader *headerPtr, int *extraSizePtr);
static int ZlibPushSubcmd(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-static inline int ResultCopy(ZlibChannelData *cd, char *buf,
- int toRead);
-static int ResultGenerate(ZlibChannelData *cd, int n, int flush,
- int *errorCodePtr);
+static int ResultDecompress(ZlibChannelData *cd, char *buf,
+ int toRead, int flush, int *errorCodePtr);
static Tcl_Channel ZlibStackChannelTransform(Tcl_Interp *interp,
int mode, int format, int level, int limit,
Tcl_Channel channel, Tcl_Obj *gzipHeaderDictPtr,
@@ -2399,7 +2400,7 @@ ZlibPushSubcmd(
const char *const *pushOptions = pushDecompressOptions;
enum pushOptions {poDictionary, poHeader, poLevel, poLimit};
Tcl_Obj *headerObj = NULL, *compDictObj = NULL;
- int limit = 1, dummy;
+ int limit = DEFAULT_BUFFER_SIZE, dummy;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "mode channel ?options...?");
@@ -2995,6 +2996,15 @@ ZlibTransformClose(
} while (e != Z_STREAM_END);
(void) deflateEnd(&cd->outStream);
} else {
+ /*
+ * If we have unused bytes from the read input (overshot by
+ * Z_STREAM_END or on possible error), unget them back to the parent
+ * channel, so that they appear as not being read yet.
+ */
+ if (cd->inStream.avail_in) {
+ Tcl_Ungets (cd->parent, (char *)cd->inStream.next_in, cd->inStream.avail_in, 0);
+ }
+
(void) inflateEnd(&cd->inStream);
}
@@ -3006,7 +3016,6 @@ ZlibTransformClose(
Tcl_DecrRefCount(cd->compDictObj);
cd->compDictObj = NULL;
}
- Tcl_DStringFree(&cd->decompressed);
if (cd->inBuffer) {
ckfree(cd->inBuffer);
@@ -3040,7 +3049,7 @@ ZlibTransformInput(
ZlibChannelData *cd = (ZlibChannelData *)instanceData;
Tcl_DriverInputProc *inProc =
Tcl_ChannelInputProc(Tcl_GetChannelType(cd->parent));
- int readBytes, gotBytes, copied;
+ int readBytes, gotBytes;
if (cd->mode == TCL_ZLIB_STREAM_DEFLATE) {
return inProc(Tcl_GetChannelInstanceData(cd->parent), buf, toRead,
@@ -3048,35 +3057,42 @@ ZlibTransformInput(
}
gotBytes = 0;
- while (toRead > 0) {
+ readBytes = cd->inStream.avail_in; /* how many bytes in buffer now */
+ while (!(cd->flags & STREAM_DONE) && toRead > 0) {
+ unsigned int n; int decBytes;
+
+ /* if starting from scratch or continuation after full decompression */
+ if (!cd->inStream.avail_in) {
+ /* buffer to start, we can read to whole available buffer */
+ cd->inStream.next_in = (Bytef *) cd->inBuffer;
+ }
/*
- * Loop until the request is satisfied (or no data available from
- * below, possibly EOF).
+ * If done - no read needed anymore, check we have to copy rest of
+ * decompressed data, otherwise return with size (or 0 for Eof)
*/
-
- copied = ResultCopy(cd, buf, toRead);
- toRead -= copied;
- buf += copied;
- gotBytes += copied;
-
- if (toRead == 0) {
- return gotBytes;
+ if (cd->flags & STREAM_DECOMPRESS) {
+ goto copyDecompressed;
}
-
/*
* The buffer is exhausted, but the caller wants even more. We now
* have to go to the underlying channel, get more bytes and then
* transform them for delivery. We may not get what we want (full EOF
* or temporarily out of data).
- *
- * Length (cd->decompressed) == 0, toRead > 0 here.
- *
- * The zlib transform allows us to read at most one character from the
- * underlying channel to properly identify Z_STREAM_END without
- * reading over the border.
*/
- readBytes = Tcl_ReadRaw(cd->parent, cd->inBuffer, cd->readAheadLimit);
+ /* Check free buffer size and adjust size of next chunk to read. */
+ n = cd->inAllocated - ((char *)cd->inStream.next_in - cd->inBuffer);
+ if (n <= 0) {
+ /* Normally unreachable: not enough input buffer to uncompress.
+ * Todo: firstly try to realloc inBuffer upto MAX_BUFFER_SIZE.
+ */
+ *errorCodePtr = ENOBUFS;
+ return -1;
+ }
+ if (n > cd->readAheadLimit) {
+ n = cd->readAheadLimit;
+ }
+ readBytes = Tcl_ReadRaw(cd->parent, (char *)cd->inStream.next_in, n);
/*
* Three cases here:
@@ -3092,45 +3108,59 @@ ZlibTransformInput(
/* See ReflectInput() in tclIORTrans.c */
if (Tcl_InputBlocked(cd->parent) && (gotBytes > 0)) {
- return gotBytes;
+ break;
}
*errorCodePtr = Tcl_GetErrno();
return -1;
}
- if (readBytes == 0) {
- /*
- * Eof in parent.
- *
- * Now this is a bit different. The partial data waiting is
- * converted and returned.
- */
- if (ResultGenerate(cd, 0, Z_SYNC_FLUSH, errorCodePtr) != TCL_OK) {
- return -1;
- }
+ /* more bytes (or Eof if readBytes == 0) */
+ cd->inStream.avail_in += readBytes;
- if (Tcl_DStringLength(&cd->decompressed) == 0) {
- /*
- * The drain delivered nothing. Time to deliver what we've
- * got.
- */
+copyDecompressed:
- return gotBytes;
- }
- } else /* readBytes > 0 */ {
+ /*
+ * Transform the read chunk, if not empty. Anything we get
+ * back is a transformation result to be put into our buffers, and
+ * the next iteration will put it into the result.
+ * For the case readBytes is 0 which signaling Eof in parent, the
+ * partial data waiting is converted and returned.
+ */
+
+ decBytes = ResultDecompress(cd, buf, toRead,
+ (readBytes != 0) ? Z_NO_FLUSH : Z_SYNC_FLUSH,
+ errorCodePtr);
+ if (decBytes == -1) {
+ return -1;
+ }
+ gotBytes += decBytes;
+ buf += decBytes;
+ toRead -= decBytes;
+
+ if (((decBytes == 0) || (cd->flags & STREAM_DECOMPRESS))) {
/*
- * Transform the read chunk, which was not empty. Anything we get
- * back is a transformation result to be put into our buffers, and
- * the next iteration will put it into the result.
+ * The drain delivered nothing (or buffer too small to decompress).
+ * Time to deliver what we've got.
*/
-
- if (ResultGenerate(cd, readBytes, Z_NO_FLUSH,
- errorCodePtr) != TCL_OK) {
+ if (!gotBytes && !(cd->flags & STREAM_DONE)) {
+ /* if no-data, but not ready - avoid signaling Eof,
+ * continue in blocking mode, otherwise EAGAIN */
+ if (Tcl_InputBlocked(cd->parent)) {
+ continue;
+ }
+ *errorCodePtr = EAGAIN;
return -1;
}
+ break;
}
+
+ /*
+ * Loop until the request is satisfied (or no data available from
+ * above, possibly EOF).
+ */
}
+
return gotBytes;
}
@@ -3516,7 +3546,7 @@ ZlibTransformWatch(
watchProc = Tcl_ChannelWatchProc(Tcl_GetChannelType(cd->parent));
watchProc(Tcl_GetChannelInstanceData(cd->parent), mask);
- if (!(mask & TCL_READABLE) || Tcl_DStringLength(&cd->decompressed) == 0) {
+ if (!(mask & TCL_READABLE) || !(cd->flags & STREAM_DECOMPRESS)) {
ZlibTransformEventTimerKill(cd);
} else if (cd->timer == NULL) {
cd->timer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME,
@@ -3702,6 +3732,9 @@ ZlibStackChannelTransform(
goto error;
}
cd->inAllocated = DEFAULT_BUFFER_SIZE;
+ if (cd->inAllocated < cd->readAheadLimit) {
+ cd->inAllocated = cd->readAheadLimit;
+ }
cd->inBuffer = (char *)ckalloc(cd->inAllocated);
if (cd->flags & IN_HEADER) {
if (inflateGetHeader(&cd->inStream, &cd->inHeader.header) != Z_OK) {
@@ -3732,8 +3765,6 @@ ZlibStackChannelTransform(
}
}
- Tcl_DStringInit(&cd->decompressed);
-
chan = Tcl_StackChannel(interp, &zlibChannelType, cd,
Tcl_GetChannelMode(channel), channel);
if (chan == NULL) {
@@ -3763,96 +3794,37 @@ ZlibStackChannelTransform(
/*
*----------------------------------------------------------------------
*
- * ResultCopy --
- *
- * Copies the requested number of bytes from the buffer into the
- * specified array and removes them from the buffer afterward. Copies
- * less if there is not enough data in the buffer.
- *
- * Side effects:
- * See above.
- *
- * Result:
- * The number of actually copied bytes, possibly less than 'toRead'.
- *
- *----------------------------------------------------------------------
- */
-
-static inline int
-ResultCopy(
- ZlibChannelData *cd, /* The location of the buffer to read from. */
- char *buf, /* The buffer to copy into */
- int toRead) /* Number of requested bytes */
-{
- int have = Tcl_DStringLength(&cd->decompressed);
-
- if (have == 0) {
- /*
- * Nothing to copy in the case of an empty buffer.
- */
-
- return 0;
- } else if (have > toRead) {
- /*
- * The internal buffer contains more than requested. Copy the
- * requested subset to the caller, shift the remaining bytes down, and
- * truncate.
- */
-
- char *src = Tcl_DStringValue(&cd->decompressed);
-
- memcpy(buf, src, toRead);
- memmove(src, src + toRead, have - toRead);
-
- Tcl_DStringSetLength(&cd->decompressed, have - toRead);
- return toRead;
- } else /* have <= toRead */ {
- /*
- * There is just or not enough in the buffer to fully satisfy the
- * caller, so take everything as best effort.
- */
-
- memcpy(buf, Tcl_DStringValue(&cd->decompressed), have);
- TclDStringClear(&cd->decompressed);
- return have;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * ResultGenerate --
+ * ResultDecompress --
*
* Extract uncompressed bytes from the compression engine and store them
- * in our working buffer.
+ * in our buffer (buf) up to toRead bytes.
*
* Result:
- * TCL_OK/TCL_ERROR (with *errorCodePtr updated with reason).
+ * Number of bytes decompressed or -1 if error (with *errorCodePtr updated with reason).
*
* Side effects:
- * See above.
+ * After execution it updates cd->inStream (next_in, avail_in) to reflect
+ * the data that has been decompressed.
*
*----------------------------------------------------------------------
*/
static int
-ResultGenerate(
+ResultDecompress(
ZlibChannelData *cd,
- int n,
+ char *buf,
+ int toRead,
int flush,
int *errorCodePtr)
{
-#define MAXBUF 1024
- unsigned char buf[MAXBUF];
- int e, written;
+ int e, written, resBytes = 0;
Tcl_Obj *errObj;
- cd->inStream.next_in = (Bytef *) cd->inBuffer;
- cd->inStream.avail_in = n;
- while (1) {
- cd->inStream.next_out = (Bytef *) buf;
- cd->inStream.avail_out = MAXBUF;
+ cd->flags &= ~STREAM_DECOMPRESS;
+ cd->inStream.next_out = (Bytef *) buf;
+ cd->inStream.avail_out = toRead;
+ while (cd->inStream.avail_out > 0) {
e = inflate(&cd->inStream, flush);
if (e == Z_NEED_DICT && cd->compDictObj) {
@@ -3861,31 +3833,35 @@ ResultGenerate(
/*
* A repetition of Z_NEED_DICT is just an error.
*/
-
- cd->inStream.next_out = (Bytef *) buf;
- cd->inStream.avail_out = MAXBUF;
e = inflate(&cd->inStream, flush);
}
}
/*
* avail_out is now the left over space in the output. Therefore
- * "MAXBUF - avail_out" is the amount of bytes generated.
+ * "toRead - avail_out" is the amount of bytes generated.
*/
- written = MAXBUF - cd->inStream.avail_out;
- if (written) {
- Tcl_DStringAppend(&cd->decompressed, (char *) buf, written);
- }
+ written = toRead - cd->inStream.avail_out;
/*
* The cases where we're definitely done.
*/
- if (((flush == Z_SYNC_FLUSH) && (e == Z_BUF_ERROR))
- || (e == Z_STREAM_END)
- || (e == Z_OK && written == 0)) {
- return TCL_OK;
+ if (e == Z_STREAM_END) {
+ cd->flags |= STREAM_DONE;
+ resBytes += written;
+ break;
+ }
+ if (e == Z_OK) {
+ if (written == 0) {
+ break;
+ }
+ resBytes += written;
+ }
+
+ if ((flush == Z_SYNC_FLUSH) && (e == Z_BUF_ERROR)) {
+ break;
}
/*
@@ -3906,10 +3882,20 @@ ResultGenerate(
*/
if (cd->inStream.avail_in <= 0 && flush != Z_SYNC_FLUSH) {
- return TCL_OK;
+ break;
}
}
+ if (!(cd->flags & STREAM_DONE)) {
+ /* if we have pending input data, but no available output buffer */
+ if (cd->inStream.avail_in && !cd->inStream.avail_out) {
+ /* next time try to decompress it got readable (new output buffer) */
+ cd->flags |= STREAM_DECOMPRESS;
+ }
+ }
+
+ return resBytes;
+
handleError:
errObj = Tcl_NewListObj(0, NULL);
Tcl_ListObjAppendElement(NULL, errObj, Tcl_NewStringObj("-errorcode",-1));
@@ -3919,7 +3905,7 @@ ResultGenerate(
Tcl_NewStringObj(cd->inStream.msg, -1));
Tcl_SetChannelError(cd->parent, errObj);
*errorCodePtr = EINVAL;
- return TCL_ERROR;
+ return -1;
}
/*