From 8873e6101cf4dac7e9c39fd001cf489ab8173429 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Mar 2013 19:39:48 +0000 Subject: Remove TclInitCompilation() declaration that's never had a definition (14 years!). --- generic/tclCompile.h | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 31c1b94..d339721 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -839,7 +839,6 @@ EXTERN void TclFreeJumpFixupArray _ANSI_ARGS_(( EXTERN void TclInitAuxDataTypeTable _ANSI_ARGS_((void)); EXTERN void TclInitByteCodeObj _ANSI_ARGS_((Tcl_Obj *objPtr, CompileEnv *envPtr)); -EXTERN void TclInitCompilation _ANSI_ARGS_((void)); #ifndef TCL_TIP280 EXTERN void TclInitCompileEnv _ANSI_ARGS_((Tcl_Interp *interp, CompileEnv *envPtr, char *string, -- cgit v0.12 From ff33155b738339c0ecc8f822888b8a8eba45e676 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Mar 2013 20:16:41 +0000 Subject: Remove from tclCompile.h declarations used in only one source file. --- generic/tclCompile.c | 11 ++++++----- generic/tclCompile.h | 3 --- generic/tclLiteral.c | 16 +++++++++++----- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index fee30bd..cba659d 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -417,6 +417,7 @@ static int GetCmdLocEncodingSize(CompileEnv *envPtr); #ifdef TCL_COMPILE_STATS static void RecordByteCodeStats(ByteCode *codePtr); #endif /* TCL_COMPILE_STATS */ +static void RegisterAuxDataType(AuxDataType *typePtr); static int SetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int FormatInstruction(ByteCode *codePtr, @@ -3134,7 +3135,7 @@ TclGetInstructionTable(void) /* *-------------------------------------------------------------- * - * TclRegisterAuxDataType -- + * RegisterAuxDataType -- * * This procedure is called to register a new AuxData type in the table * of all AuxData types supported by Tcl. @@ -3150,8 +3151,8 @@ TclGetInstructionTable(void) *-------------------------------------------------------------- */ -void -TclRegisterAuxDataType( +static void +RegisterAuxDataType( AuxDataType *typePtr) /* Information about object type; storage must * be statically allocated (must live forever; * will not be deallocated). */ @@ -3255,8 +3256,8 @@ TclInitAuxDataTypeTable(void) * There are only two AuxData type at this time, so register them here. */ - TclRegisterAuxDataType(&tclForeachInfoType); - TclRegisterAuxDataType(&tclJumptableInfoType); + RegisterAuxDataType(&tclForeachInfoType); + RegisterAuxDataType(&tclJumptableInfoType); } /* diff --git a/generic/tclCompile.h b/generic/tclCompile.h index d62aab9..bc298ae 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -908,8 +908,6 @@ MODULE_SCOPE int TclExecuteByteCode(Tcl_Interp *interp, MODULE_SCOPE void TclFinalizeAuxDataTypeTable(void); MODULE_SCOPE int TclFindCompiledLocal(CONST char *name, int nameChars, int create, Proc *procPtr); -MODULE_SCOPE LiteralEntry * TclLookupLiteralEntry(Tcl_Interp *interp, - Tcl_Obj *objPtr); MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr, JumpFixup *jumpFixupPtr, int jumpDist, int distThreshold); @@ -937,7 +935,6 @@ MODULE_SCOPE void TclPrintObject(FILE *outFile, Tcl_Obj *objPtr, int maxChars); MODULE_SCOPE void TclPrintSource(FILE *outFile, CONST char *string, int maxChars); -MODULE_SCOPE void TclRegisterAuxDataType(AuxDataType *typePtr); MODULE_SCOPE int TclRegisterLiteral(CompileEnv *envPtr, char *bytes, int length, int flags); MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 2c91b82..09540ea 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -32,6 +32,10 @@ static int AddLocalLiteralEntry(CompileEnv *envPtr, Tcl_Obj *objPtr, int localHash); static void ExpandLocalLiteralArray(CompileEnv *envPtr); static unsigned int HashString(const char *bytes, int length); +#ifdef TCL_COMPILE_DEBUG +static LiteralEntry * LookupLiteralEntry(Tcl_Interp *interp, + Tcl_Obj *objPtr); +#endif static void RebuildLiteralTable(LiteralTable *tablePtr); /* @@ -237,7 +241,7 @@ TclCreateLiteral( } #ifdef TCL_COMPILE_DEBUG - if (TclLookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) { + if (LookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) { Tcl_Panic("TclRegisterLiteral: literal \"%.*s\" found globally but shouldn't be", (length>60? 60 : length), bytes); } @@ -407,10 +411,11 @@ TclRegisterLiteral( return objIndex; } +#ifdef TCL_COMPILE_DEBUG /* *---------------------------------------------------------------------- * - * TclLookupLiteralEntry -- + * LookupLiteralEntry -- * * Finds the LiteralEntry that corresponds to a literal Tcl object * holding a literal. @@ -424,8 +429,8 @@ TclRegisterLiteral( *---------------------------------------------------------------------- */ -LiteralEntry * -TclLookupLiteralEntry( +static LiteralEntry * +LookupLiteralEntry( Tcl_Interp *interp, /* Interpreter for which objPtr was created to * hold a literal. */ register Tcl_Obj *objPtr) /* Points to a Tcl object holding a literal @@ -449,6 +454,7 @@ TclLookupLiteralEntry( return NULL; } +#endif /* *---------------------------------------------------------------------- * @@ -1028,7 +1034,7 @@ TclVerifyLocalLiteralTable( Tcl_Panic("TclVerifyLocalLiteralTable: local literal \"%.*s\" had bad refCount %d", (length>60? 60 : length), bytes, localPtr->refCount); } - if (TclLookupLiteralEntry((Tcl_Interp *) envPtr->iPtr, + if (LookupLiteralEntry((Tcl_Interp *) envPtr->iPtr, localPtr->objPtr) == NULL) { bytes = Tcl_GetStringFromObj(localPtr->objPtr, &length); Tcl_Panic("TclVerifyLocalLiteralTable: local literal \"%.*s\" is not global", -- cgit v0.12 From 69eed829d100f7dcbe449ef6854ae7d24f72179c Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Mar 2013 22:13:30 +0000 Subject: New internal routine TclFetchLiteral() for better CompileEnv encapsulation. --- generic/tclCompCmds.c | 3 +-- generic/tclCompExpr.c | 13 +++++-------- generic/tclCompile.c | 18 +++++++++--------- generic/tclCompile.h | 1 + generic/tclEnsemble.c | 6 +++--- generic/tclLiteral.c | 27 +++++++++++++++++++++++++++ 6 files changed, 46 insertions(+), 22 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 4751455..40348fa 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -349,8 +349,7 @@ TclCompileArraySetCmd( Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); bytes = Tcl_GetStringFromObj(objPtr, &length); cmdLit = TclRegisterNewCmdLiteral(envPtr, bytes, length); - TclSetCmdNameObj(interp, envPtr->literalArrayPtr[cmdLit].objPtr, - cmdPtr); + TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr); TclEmitPush(cmdLit, envPtr); TclDecrRefCount(objPtr); if (localIndex >= 0) { diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 346f446..3597abe 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2445,14 +2445,11 @@ CompileExprTree( Tcl_Obj *literal = *litObjv; if (optimize) { - int length, index; + int length; const char *bytes = TclGetStringFromObj(literal, &length); - LiteralEntry *lePtr; - Tcl_Obj *objPtr; - - index = TclRegisterNewLiteral(envPtr, bytes, length); - lePtr = envPtr->literalArrayPtr + index; - objPtr = lePtr->objPtr; + int index = TclRegisterNewLiteral(envPtr, bytes, length); + Tcl_Obj *objPtr = TclFetchLiteral(envPtr, index); + if ((objPtr->typePtr == NULL) && (literal->typePtr != NULL)) { /* * Would like to do this: @@ -2511,7 +2508,7 @@ CompileExprTree( index = TclRegisterNewLiteral(envPtr, objPtr->bytes, objPtr->length); - tableValue = envPtr->literalArrayPtr[index].objPtr; + tableValue = TclFetchLiteral(envPtr, index); if ((tableValue->typePtr == NULL) && (objPtr->typePtr != NULL)) { /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index cf1e25e..5427759 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1896,8 +1896,7 @@ TclCompileScript( tokenPtr[1].start, tokenPtr[1].size); if (cmdPtr != NULL) { TclSetCmdNameObj(interp, - envPtr->literalArrayPtr[objIndex].objPtr, - cmdPtr); + TclFetchLiteral(envPtr, objIndex), cmdPtr); } } else { /* @@ -1914,7 +1913,7 @@ TclCompileScript( if (envPtr->clNext) { TclContinuationsEnterDerived( - envPtr->literalArrayPtr[objIndex].objPtr, + TclFetchLiteral(envPtr, objIndex), tokenPtr[1].start - envPtr->source, eclPtr->loc[wlineat].next[wordIdx]); } @@ -2223,9 +2222,8 @@ TclCompileTokens( Tcl_DStringFree(&textBuffer); if (numCL) { - TclContinuationsEnter( - envPtr->literalArrayPtr[literal].objPtr, numCL, - clPosition); + TclContinuationsEnter(TclFetchLiteral(envPtr, literal), + numCL, clPosition); } numCL = 0; } @@ -2271,7 +2269,7 @@ TclCompileTokens( TclEmitPush(literal, envPtr); numObjsToConcat++; if (numCL) { - TclContinuationsEnter(envPtr->literalArrayPtr[literal].objPtr, + TclContinuationsEnter(TclFetchLiteral(envPtr, literal), numCL, clPosition); } numCL = 0; @@ -2579,7 +2577,9 @@ TclInitByteCodeObj( p += TCL_ALIGN(codeBytes); /* align object array */ codePtr->objArrayPtr = (Tcl_Obj **) p; for (i = 0; i < numLitObjects; i++) { - if (objPtr == envPtr->literalArrayPtr[i].objPtr) { + Tcl_Obj *fetched = TclFetchLiteral(envPtr, i); + + if (objPtr == fetched) { /* * Prevent circular reference where the bytecode intrep of * a value contains a literal which is that same value. @@ -2598,7 +2598,7 @@ TclInitByteCodeObj( Tcl_IncrRefCount(codePtr->objArrayPtr[i]); Tcl_DecrRefCount(objPtr); } else { - codePtr->objArrayPtr[i] = envPtr->literalArrayPtr[i].objPtr; + codePtr->objArrayPtr[i] = fetched; } } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 10282ba..79497d2 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -954,6 +954,7 @@ MODULE_SCOPE ExceptionRange * TclGetExceptionRangeForPc(unsigned char *pc, MODULE_SCOPE void TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr); MODULE_SCOPE int TclNRExecuteByteCode(Tcl_Interp *interp, ByteCode *codePtr); +MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, unsigned int index); MODULE_SCOPE void TclFinalizeAuxDataTypeTable(void); MODULE_SCOPE int TclFindCompiledLocal(const char *name, int nameChars, int create, CompileEnv *envPtr); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index bf9dac2..813e056 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3167,7 +3167,7 @@ CompileToInvokedCommand( if (envPtr->clNext) { TclContinuationsEnterDerived( - envPtr->literalArrayPtr[literal].objPtr, + TclFetchLiteral(envPtr, literal), tokPtr[1].start - envPtr->source, mapPtr->loc[eclIndex].next[i]); } @@ -3190,7 +3190,7 @@ CompileToInvokedCommand( Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); bytes = Tcl_GetStringFromObj(objPtr, &length); cmdLit = TclRegisterNewCmdLiteral(envPtr, bytes, length); - TclSetCmdNameObj(interp, envPtr->literalArrayPtr[cmdLit].objPtr, cmdPtr); + TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr); TclEmitPush(cmdLit, envPtr); TclDecrRefCount(objPtr); @@ -3239,7 +3239,7 @@ CompileBasicNArgCommand( Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); bytes = Tcl_GetStringFromObj(objPtr, &length); literal = TclRegisterNewCmdLiteral(envPtr, bytes, length); - TclSetCmdNameObj(interp, envPtr->literalArrayPtr[literal].objPtr, cmdPtr); + TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, literal), cmdPtr); TclEmitPush(literal, envPtr); TclDecrRefCount(objPtr); diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index bd5fe73..e2ee9b4 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -305,6 +305,33 @@ TclCreateLiteral( /* *---------------------------------------------------------------------- * + * TclFetchLiteral -- + * + * Fetch from a CompileEnv the literal value identified by an index + * value, as returned by a prior call to TclRegisterLiteral(). + * + * Results: + * The literal value, or NULL if the index is out of range. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclFetchLiteral( + CompileEnv *envPtr, /* Points to the CompileEnv from which to + * fetch the registered literal value. */ + unsigned int index) /* Index of the desired literal, as returned + * by prior call to TclRegisterLiteral() */ +{ + if (index >= envPtr->literalArrayNext) { + return NULL; + } + return envPtr->literalArrayPtr[index].objPtr; +} + +/* + *---------------------------------------------------------------------- + * * TclRegisterLiteral -- * * Find, or if necessary create, an object in a CompileEnv literal array -- cgit v0.12 From 27425ba30a13f29ab5f0489e6bd00e54235495c9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Mar 2013 12:08:46 +0000 Subject: Tell fossil and Eclipse that the default eol-convention is LF. Tell fossil which files are binary and which files should never be committed. Tell Eclipse that the default encoding is UTF-8 --- .fossil-settings/binary-glob | 3 +++ .fossil-settings/crnl-glob | 0 .fossil-settings/ignore-glob | 15 +++++++++++++++ .project | 11 +++++++++++ .settings/org.eclipse.core.resources.prefs | 2 ++ .settings/org.eclipse.core.runtime.prefs | 2 ++ 6 files changed, 33 insertions(+) create mode 100644 .fossil-settings/binary-glob create mode 100644 .fossil-settings/crnl-glob create mode 100644 .fossil-settings/ignore-glob create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.core.runtime.prefs diff --git a/.fossil-settings/binary-glob b/.fossil-settings/binary-glob new file mode 100644 index 0000000..ca85874 --- /dev/null +++ b/.fossil-settings/binary-glob @@ -0,0 +1,3 @@ +*.bmp +*.gif +*.png diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob new file mode 100644 index 0000000..e69de29 diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob new file mode 100644 index 0000000..a101893 --- /dev/null +++ b/.fossil-settings/ignore-glob @@ -0,0 +1,15 @@ +*.a +*.dll +*.exe +*.o +*.obj +*.so +*/Makefile +*/config.cache +*/config.log +*/config.status +*/tclConfig.sh +*/tclsh* +*/tcltest* +unix/dltest.marker +win/tcl.hpj diff --git a/.project b/.project new file mode 100644 index 0000000..7342584 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + tcl8.4 + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000..5a0ad22 --- /dev/null +++ b/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n -- cgit v0.12 From 0390de18076f988f55706eaf74ec09448451ef6f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Mar 2013 12:22:55 +0000 Subject: Add Eclipse .project too --- .project | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .project diff --git a/.project b/.project new file mode 100644 index 0000000..2639b50 --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + tcl8.5 + + + + + + + + -- cgit v0.12