From a286f72815078b57fa95179eb4dfdf75cc43e123 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 9 Apr 2013 10:10:34 +0000 Subject: Make (deprecated) Tcl_EvalObj/Tcl_GlobalEvalObj macro's always, not only when using stubs. --- generic/tclBasic.c | 2 ++ generic/tclDecls.h | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 134deac..bd4ad5d 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4923,6 +4923,7 @@ Tcl_Eval(interp, string) *---------------------------------------------------------------------- */ +#undef Tcl_EvalObj int Tcl_EvalObj(interp, objPtr) Tcl_Interp * interp; @@ -4931,6 +4932,7 @@ Tcl_EvalObj(interp, objPtr) return Tcl_EvalObjEx(interp, objPtr, 0); } +#undef Tcl_GlobalEvalObj int Tcl_GlobalEvalObj(interp, objPtr) Tcl_Interp * interp; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 8d9f635..618536d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4519,14 +4519,12 @@ extern TclStubs *tclStubsPtr; /* * Deprecated Tcl procedures: */ -#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) -# undef Tcl_EvalObj -# define Tcl_EvalObj(interp,objPtr) \ - Tcl_EvalObjEx((interp),(objPtr),0) -# undef Tcl_GlobalEvalObj -# define Tcl_GlobalEvalObj(interp,objPtr) \ - Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) -#endif +#undef Tcl_EvalObj +#define Tcl_EvalObj(interp,objPtr) \ + Tcl_EvalObjEx((interp),(objPtr),0) +#undef Tcl_GlobalEvalObj +#define Tcl_GlobalEvalObj(interp,objPtr) \ + Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) #endif /* _TCLDECLS */ -- cgit v0.12 From 6379f60ed8aca0d3ce1aa00314d5249bf6da6f86 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 9 Apr 2013 11:04:49 +0000 Subject: Allow URLs that don't have a path, but a query, e.g. http://example.com?foo=bar and bump http to 2.5.8. --- ChangeLog | 6 ++++++ library/http/http.tcl | 10 ++++++++-- library/http/pkgIndex.tcl | 2 +- tests/http.test | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f06e8d..2d39e97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-09 Reinhard Max + + * library/http/http.tcl (http::geturl): Allow URLs that don't have + a path, but a query query, e.g. http://example.com?foo=bar . + * Bump the http package to 2.5.8. + 2013-04-08 Don Porter * generic/regc_color.c: [Bug 3610026] Stop crash when the number of diff --git a/library/http/http.tcl b/library/http/http.tcl index ceef043..6299523 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -22,7 +22,7 @@ package require Tcl 8.4 # Keep this in sync with pkgIndex.tcl and with the install directories # in Makefiles -package provide http 2.5.7 +package provide http 2.5.8 namespace eval http { variable http @@ -346,7 +346,7 @@ proc http::geturl { url args } { ( [^/:\#?]+ ) # (?: : (\d+) )? # )? - ( / [^\#?]* (?: \? [^\#?]* )?)? # (including query) + ( [/\?] [^\#]*)? # (including query) (?: \# (.*) )? # $ } @@ -389,6 +389,12 @@ proc http::geturl { url args } { } } if {$srvurl ne ""} { + # RFC 3986 allows empty paths (not even a /), but servers + # return 400 if the path in the HTTP request doesn't start + # with / , so add it here if needed. + if {[string index $srvurl 0] ne "/"} { + set srvurl /$srvurl + } # Check for validity according to RFC 3986, Appendix A set validityRE {(?xi) ^ diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl index c5d2928..9bbec0a 100644 --- a/library/http/pkgIndex.tcl +++ b/library/http/pkgIndex.tcl @@ -9,4 +9,4 @@ # full path name of this file's directory. if {![package vsatisfies [package provide Tcl] 8.4]} {return} -package ifneeded http 2.5.7 [list tclPkgSetup $dir http 2.5.7 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] +package ifneeded http 2.5.8 [list tclPkgSetup $dir http 2.5.8 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] diff --git a/tests/http.test b/tests/http.test index 54fa369..7e40b82 100644 --- a/tests/http.test +++ b/tests/http.test @@ -135,6 +135,7 @@ set binurl //[info hostname]:$port/binary set posturl //[info hostname]:$port/post set badposturl //[info hostname]:$port/droppost set badcharurl //%user@[info hostname]:$port/a/^b/c +set authorityurl //[info hostname]:$port test http-3.4 {http::geturl} { set token [http::geturl $url] @@ -340,6 +341,19 @@ test http-3.25 {http::geturl parse failures} -body { set token [http::geturl $badcharurl] http::cleanup $token } -returnCodes ok -result {} +test http-3.30 {http::geturl query without path} -body { + set token [http::geturl $authorityurl?var=val] + http::ncode $token +} -cleanup { + catch { http::cleanup $token } +} -result 200 +test http-3.31 {http::geturl fragment without path} -body { + set token [http::geturl "$authorityurl#fragment42"] + http::ncode $token +} -cleanup { + catch { http::cleanup $token } +} -result 200 + test http-4.1 {http::Event} { set token [http::geturl $url] -- cgit v0.12 From 98fc2e08c445e88c982282eba4b2f7da09a583e9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 12 Apr 2013 11:08:18 +0000 Subject: Implement Tcl_Pkg* functions as macro's around Tcl_Pkg*Ex. This saves stack space, is (marginally) faster, while still being fully up/down compatible. It makes pkgb.so loadable in "novem" without the need to change the Tcl_PkgProvide() call to Tcl_PkgProvideEx(). --- generic/tclDecls.h | 10 ++++++++++ generic/tclPkg.c | 11 +++++++---- unix/dltest/pkgb.c | 4 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 618536d..a94cb0e 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4516,6 +4516,16 @@ extern TclStubs *tclStubsPtr; #undef TclUnusedStubEntry +#undef Tcl_PkgPresent +#define Tcl_PkgPresent(interp, name, version, exact) \ + Tcl_PkgPresentEx(interp, name, version, exact, NULL) +#undef Tcl_PkgProvide +#define Tcl_PkgProvide(interp, name, version) \ + Tcl_PkgProvideEx(interp, name, version, NULL) +#undef Tcl_PkgRequire +#define Tcl_PkgRequire(interp, name, version, exact) \ + Tcl_PkgRequireEx(interp, name, version, exact, NULL) + /* * Deprecated Tcl procedures: */ diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 940d011..6ab1b33 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -119,6 +119,7 @@ static CONST char * PkgRequireCore(Tcl_Interp *interp, CONST char *name, *---------------------------------------------------------------------- */ +#undef Tcl_PkgProvide int Tcl_PkgProvide(interp, name, version) Tcl_Interp *interp; /* Interpreter in which package is now @@ -223,6 +224,7 @@ Tcl_PkgRequireProc(interp,name,reqc,reqv,clientDataPtr) } #endif +#undef Tcl_PkgRequire CONST char * Tcl_PkgRequire(interp, name, version, exact) Tcl_Interp *interp; /* Interpreter in which package is now @@ -827,6 +829,7 @@ PkgRequireCore( *---------------------------------------------------------------------- */ +#undef Tcl_PkgPresent CONST char * Tcl_PkgPresent(interp, name, version, exact) Tcl_Interp *interp; /* Interpreter in which package is now @@ -1127,7 +1130,7 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) } } #endif - Tcl_PkgPresent(interp, name, version, exact); + Tcl_PkgPresentEx(interp, name, version, exact, NULL); return TCL_ERROR; break; } @@ -1155,7 +1158,7 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) #endif return TCL_ERROR; } - return Tcl_PkgProvide(interp, argv2, argv3); + return Tcl_PkgProvideEx(interp, argv2, argv3, NULL); } case PKG_REQUIRE: { require: @@ -1187,9 +1190,9 @@ Tcl_PackageObjCmd(dummy, interp, objc, objv) } if (exact) { argv3 = Tcl_GetString(objv[3]); - version = Tcl_PkgRequire(interp, argv3, version, exact); + version = Tcl_PkgRequireEx(interp, argv3, version, exact, NULL); } else { - version = Tcl_PkgRequire(interp, argv2, version, exact); + version = Tcl_PkgRequireEx(interp, argv2, version, exact, NULL); } if (version == NULL) { return TCL_ERROR; diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c index 99f189f..51aaad8 100644 --- a/unix/dltest/pkgb.c +++ b/unix/dltest/pkgb.c @@ -124,7 +124,7 @@ Pkgb_Init(interp) } Tcl_ResetResult(interp); } - code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL); + code = Tcl_PkgProvide(interp, "Pkgb", "2.3"); if (code != TCL_OK) { return code; } @@ -165,7 +165,7 @@ Pkgb_SafeInit(interp) } Tcl_ResetResult(interp); } - code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL); + code = Tcl_PkgProvide(interp, "Pkgb", "2.3"); if (code != TCL_OK) { return code; } -- cgit v0.12 From ce72cf1a029fcf4ca5d5fd7e7bd1925cf53351de Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 16 Apr 2013 20:18:19 +0000 Subject: 3610404 When we let go of commandPtr in TclEvalObjvInternal, NULL out the variable so we don't mistakenly try to use the value later after we freed it. --- generic/tclBasic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index cfb5c43..d3b5490 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3652,6 +3652,7 @@ TclEvalObjvInternal( checkTraces = 0; if (commandPtr) { Tcl_DecrRefCount(commandPtr); + commandPtr = NULL; } goto reparseBecauseOfTraces; } -- cgit v0.12 From 67e2135f3ad85c23c2093c309e90204ee4b81d77 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 19 Apr 2013 08:19:07 +0000 Subject: Implement many Tcl_*Var* functions and Tcl_GetIndexFromObj as (faster/stack-saving) macros around resp their Tcl_*Var*2 equivalent and Tcl_GetIndexFromObjStruct --- ChangeLog | 8 ++++++++ generic/tclDecls.h | 25 +++++++++++++++++++++++++ generic/tclIndexObj.c | 1 + generic/tclVar.c | 7 +++++++ 4 files changed, 41 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2d39e97..4e159a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-04-18 Jan Nijtmans + + * generic/tclDecls.h: Implement Tcl_Pkg* functions as + (faster/stack-saving) macros around Tcl_Pkg*Ex functions. + The same for many Tcl_*Var* functions around their + Tcl_*Var*2 equivalent and Tcl_GetIndexFromObj around + Tcl_GetIndexFromObjStruct. + 2013-04-09 Reinhard Max * library/http/http.tcl (http::geturl): Allow URLs that don't have diff --git a/generic/tclDecls.h b/generic/tclDecls.h index a94cb0e..813c75c 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4525,6 +4525,31 @@ extern TclStubs *tclStubsPtr; #undef Tcl_PkgRequire #define Tcl_PkgRequire(interp, name, version, exact) \ Tcl_PkgRequireEx(interp, name, version, exact, NULL) +#undef Tcl_GetIndexFromObj +#define Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr) \ + Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, \ + sizeof(char *), msg, flags, indexPtr) +#undef Tcl_SetVar +#define Tcl_SetVar(interp, varName, newValue, flags) \ + Tcl_SetVar2(interp, varName, NULL, newValue, flags) +#undef Tcl_UnsetVar +#define Tcl_UnsetVar(interp, varName, flags) \ + Tcl_UnsetVar2(interp, varName, NULL, flags) +#undef Tcl_GetVar +#define Tcl_GetVar(interp, varName, flags) \ + Tcl_GetVar2(interp, varName, NULL, flags) +#undef Tcl_TraceVar +#define Tcl_TraceVar(interp, varName, flags, proc, clientData) \ + Tcl_TraceVar2(interp, varName, NULL, flags, proc, clientData) +#undef Tcl_UntraceVar +#define Tcl_UntraceVar(interp, varName, flags, proc, clientData) \ + Tcl_UntraceVar2(interp, varName, NULL, flags, proc, clientData) +#undef Tcl_VarTraceInfo +#define Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) \ + Tcl_VarTraceInfo2(interp, varName, NULL, flags, proc, prevClientData) +#undef Tcl_UpVar +#define Tcl_UpVar(interp, frameName, varName, localName, flags) \ + Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) /* * Deprecated Tcl procedures: diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 0103cdb..508148b 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -90,6 +90,7 @@ typedef struct { *---------------------------------------------------------------------- */ +#undef Tcl_GetIndexFromObj int Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr) Tcl_Interp *interp; /* Used for error reporting if not NULL. */ diff --git a/generic/tclVar.c b/generic/tclVar.c index c029877..e01ae64 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -1006,6 +1006,7 @@ TclLookupArrayElement(interp, arrayName, elName, flags, msg, createArray, create *---------------------------------------------------------------------- */ +#undef Tcl_GetVar CONST char * Tcl_GetVar(interp, varName, flags) Tcl_Interp *interp; /* Command interpreter in which varName is @@ -1320,6 +1321,7 @@ Tcl_SetObjCmd(dummy, interp, objc, objv) *---------------------------------------------------------------------- */ +#undef Tcl_SetVar CONST char * Tcl_SetVar(interp, varName, newValue, flags) Tcl_Interp *interp; /* Command interpreter in which varName is @@ -1918,6 +1920,7 @@ TclPtrIncrVar(interp, varPtr, arrayPtr, part1, part2, incrAmount, flags) *---------------------------------------------------------------------- */ +#undef Tcl_UnsetVar int Tcl_UnsetVar(interp, varName, flags) Tcl_Interp *interp; /* Command interpreter in which varName is @@ -2222,6 +2225,7 @@ UnsetVarStruct(varPtr, arrayPtr, iPtr, part1, part2, flags) *---------------------------------------------------------------------- */ +#undef Tcl_TraceVar int Tcl_TraceVar(interp, varName, flags, proc, clientData) Tcl_Interp *interp; /* Interpreter in which variable is @@ -2340,6 +2344,7 @@ Tcl_TraceVar2(interp, part1, part2, flags, proc, clientData) *---------------------------------------------------------------------- */ +#undef Tcl_UntraceVar void Tcl_UntraceVar(interp, varName, flags, proc, clientData) Tcl_Interp *interp; /* Interpreter containing variable. */ @@ -2485,6 +2490,7 @@ Tcl_UntraceVar2(interp, part1, part2, flags, proc, clientData) *---------------------------------------------------------------------- */ +#undef Tcl_VarTraceInfo ClientData Tcl_VarTraceInfo(interp, varName, flags, proc, prevClientData) Tcl_Interp *interp; /* Interpreter containing variable. */ @@ -3690,6 +3696,7 @@ ObjMakeUpvar(interp, framePtr, otherP1Ptr, otherP2, otherFlags, myName, myFlags, *---------------------------------------------------------------------- */ +#undef Tcl_UpVar int Tcl_UpVar(interp, frameName, varName, localName, flags) Tcl_Interp *interp; /* Command interpreter in which varName is -- cgit v0.12 From cb37c28cf9df9a8ebdca318c7f03f697e5b5ee7d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Apr 2013 10:39:33 +0000 Subject: Implement Tcl_NewBooleanObj, Tcl_DbNewBooleanObj and Tcl_SetBooleanObj as macros using Tcl_NewIntObj, Tcl_DbNewLongObj and Tcl_SetIntObj. Starting with Tcl 8.5, this is exactly the same, it only eliminates code duplication. --- ChangeLog | 7 +++++++ generic/tclDecls.h | 11 ++++++++++- generic/tclObj.c | 10 ++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d74b73c..6b520e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-23 Jan Nijtmans + + * generic/tclDecls.h: Implement Tcl_NewBooleanObj, Tcl_DbNewBooleanObj + and Tcl_SetBooleanObj as macros using Tcl_NewIntObj, Tcl_DbNewLongObj + and Tcl_SetIntObj. Starting with Tcl 8.5, this is exactly the same, + it only eliminates code duplication. + 2013-04-19 Jan Nijtmans * generic/tclDecls.h: Implement many Tcl_*Var* functions and diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 30e305b..77402f8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -6560,6 +6560,15 @@ extern TclStubs *tclStubsPtr; #define Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr) \ Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, \ sizeof(char *), msg, flags, indexPtr) +#undef Tcl_NewBooleanObj +#define Tcl_NewBooleanObj(boolValue) \ + Tcl_NewIntObj((boolValue)!=0) +#undef Tcl_DbNewBooleanObj +#define Tcl_DbNewBooleanObj(boolValue, file, line) \ + Tcl_DbNewLongObj((boolValue)!=0, file, line) +#undef Tcl_SetBooleanObj +#define Tcl_SetBooleanObj(objPtr, boolValue) \ + Tcl_SetIntObj((objPtr), (boolValue)!=0) #undef Tcl_SetVar #define Tcl_SetVar(interp, varName, newValue, flags) \ Tcl_SetVar2(interp, varName, NULL, newValue, flags) @@ -6585,6 +6594,7 @@ extern TclStubs *tclStubsPtr; /* * Deprecated Tcl procedures: */ + #undef Tcl_EvalObj #define Tcl_EvalObj(interp,objPtr) \ Tcl_EvalObjEx((interp),(objPtr),0) @@ -6593,4 +6603,3 @@ extern TclStubs *tclStubsPtr; Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) #endif /* _TCLDECLS */ - diff --git a/generic/tclObj.c b/generic/tclObj.c index 96a4082..fb09a9e 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1700,14 +1700,14 @@ Tcl_InvalidateStringRep( *---------------------------------------------------------------------- */ -#ifdef TCL_MEM_DEBUG #undef Tcl_NewBooleanObj +#ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_NewBooleanObj( register int boolValue) /* Boolean used to initialize new object. */ { - return Tcl_DbNewBooleanObj(boolValue, "unknown", 0); + return Tcl_DbNewLongObj(boolValue!=0, "unknown", 0); } #else /* if not TCL_MEM_DEBUG */ @@ -1718,7 +1718,7 @@ Tcl_NewBooleanObj( { register Tcl_Obj *objPtr; - TclNewBooleanObj(objPtr, boolValue); + TclNewIntObj(objPtr, boolValue!=0); return objPtr; } #endif /* TCL_MEM_DEBUG */ @@ -1749,6 +1749,7 @@ Tcl_NewBooleanObj( *---------------------------------------------------------------------- */ +#undef Tcl_DbNewBooleanObj #ifdef TCL_MEM_DEBUG Tcl_Obj * @@ -1801,6 +1802,7 @@ Tcl_DbNewBooleanObj( *---------------------------------------------------------------------- */ +#undef Tcl_SetBooleanObj void Tcl_SetBooleanObj( register Tcl_Obj *objPtr, /* Object whose internal rep to init. */ @@ -1810,7 +1812,7 @@ Tcl_SetBooleanObj( Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj"); } - TclSetBooleanObj(objPtr, boolValue); + TclSetIntObj(objPtr, boolValue!=0); } /* -- cgit v0.12 From 7e4b7690f3583ba3196f7e17fec6c8113170ae4b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Apr 2013 13:30:50 +0000 Subject: Split ChangeLog in 3 parts, just as already done on trunk --- ChangeLog | 8377 ++++---------------------------------------------------- ChangeLog.2007 | 5921 +++++++++++++++++++++++++++++++++++++++ ChangeLog.2008 | 1529 +++++++++++ 3 files changed, 7927 insertions(+), 7900 deletions(-) create mode 100644 ChangeLog.2007 create mode 100644 ChangeLog.2008 diff --git a/ChangeLog b/ChangeLog index 6b520e4..c2d3561 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,8 +113,8 @@ 2013-02-27 Jan Nijtmans * generic/regcomp.c: [Bug 3606139]: missing error check allows - * tests/regexp.test: regexp to crash Tcl. Thanks to Tom Lane - for providing the test-case and the patch. + * tests/regexp.test: regexp to crash Tcl. Thanks to Tom Lane for + providing the test-case and the patch. 2013-02-26 Jan Nijtmans @@ -123,7 +123,7 @@ 2013-02-25 Don Porter - * tests/assocd.test: [Bugs 3605719,3605720] Test independence. + * tests/assocd.test: [Bugs 3605719,3605720]: Test independence. * tests/basic.test: Thanks Rolf Ade for patches. 2013-02-22 Don Porter @@ -134,30 +134,31 @@ 2013-02-20 Don Porter - * generic/tclNamesp.c: [Bug 3605447] Make sure the -clear option + * generic/tclNamesp.c: [Bug 3605447]: Make sure the -clear option * tests/namespace.test: to [namespace export] always clears, whether or not new export patterns are specified. 2013-02-19 Jan Nijtmans * generic/tclTrace.c: [Bug 2438181]: Incorrect error reporting in - * tests/trace.test: traces. Test-case and fix provided by Poor Yorick. + * tests/trace.test: traces. Test-case and fix provided by Poor + Yorick. 2013-02-15 Don Porter - * generic/regc_nfa.c: [Bug 3604074] Fix regexp optimization to + * generic/regc_nfa.c: [Bug 3604074]: Fix regexp optimization to * tests/regexp.test: stop hanging on the expression ((((((((a)*)*)*)*)*)*)*)* . Thanks to Bjørn Grathwohl for discovery. 2013-02-14 Harald Oehlmann - * library/msgcat/msgcat.tcl: [Bug 3604576]: Catch missing registry entry - "HCU\Control Panel\International". + * library/msgcat/msgcat.tcl: [Bug 3604576]: Catch missing registry + entry "HCU\Control Panel\International". Bumped msgcat version to 1.5.1 2013-02-05 Don Porter - * win/tclWinFile.c: [Bug 3603434] Make sure TclpObjNormalizePath() + * win/tclWinFile.c: [Bug 3603434]: Make sure TclpObjNormalizePath() properly declares "a:/" to be normalized, even when no "A:" drive is present on the system. @@ -173,9 +174,8 @@ * library/platform/platform.tcl (::platform::LibcVersion): See * library/platform/pkgIndex.tcl: [Bug 3599098]: Fixed the RE * unix/Makefile.in: extracting the version to avoid issues with - * win/Makefile.in: recent changes to the glibc banner. Now - targeting a less variable part of the string. Bumped package to - version 1.0.11. + * win/Makefile.in: recent changes to the glibc banner. Now targeting a + less variable part of the string. Bumped package to version 1.0.11. 2013-01-26 Jan Nijtmans @@ -197,33 +197,33 @@ 2013-01-16 Jan Nijtmans - * Makefile.in: Enable win32 build with -DTCL_NO_DEPRECATED, just - * generic/tcl.h: as the UNIX build. Define Tcl_EvalObj and + * Makefile.in: Allow win32 build with -DTCL_NO_DEPRECATED, just as + * generic/tcl.h: in the UNIX build. Define Tcl_EvalObj and * generic/tclDecls.h: Tcl_GlobalEvalObj as macros, even when - * generic/tclBasic.c: TCL_NO_DEPRECATED is defined, so Tk - can benefit from it too. + * generic/tclBasic.c: TCL_NO_DEPRECATED is defined, so Tk can benefit + from it too. 2013-01-14 Jan Nijtmans - * win/tcl.m4: More flexible search for win32 tclConfig.sh, - backported from TEA (not actually used in Tcl, only for Tk) + * win/tcl.m4: More flexible search for win32 tclConfig.sh, backported + from TEA (not actually used in Tcl, only for Tk) 2013-01-13 Jan Nijtmans - * generic/tclIntDecls.h: If TCL_NO_DEPRECATED is defined, make - sure that TIP #139 functions all are taken from the public stub - table, even if the inclusion is through tclInt.h. + * generic/tclIntDecls.h: If TCL_NO_DEPRECATED is defined, make sure + that TIP #139 functions all are taken from the public stub table, even + if the inclusion is through tclInt.h. 2013-01-09 Jan Nijtmans - * library/http/http.tcl: [Bug 3599395]: http assumes status line - is a proper tcl list. + * library/http/http.tcl: [Bug 3599395]: http assumes status line is a + proper Tcl list. Bump http package to 2.7.11. 2013-01-08 Jan Nijtmans * win/tclWinFile.c: [Bug 3092089]: [file normalize] can remove path - components. [Bug 3587096] win vista/7: "can't find init.tcl" when + components. [Bug 3587096]: win vista/7: "can't find init.tcl" when called via junction without folder list access. 2013-01-07 Jan Nijtmans @@ -235,9 +235,9 @@ 2013-01-02 Miguel Sofer - * generic/tclEnsemble.c: Remove stray calls to Tcl_Alloc and - * generic/tclExecute.c: friends: the core should only use ckalloc - * generic/tclIORTrans.c: to allow MEM_DEBUG to work properly + * generic/tclEnsemble.c: Remove stray calls to Tcl_Alloc and friends: + * generic/tclExecute.c: the core should only use ckalloc to allow + * generic/tclIORTrans.c: MEM_DEBUG to work properly. * generic/tclTomMathInterface.c: 2012-12-31 Donal K. Fellows @@ -249,13 +249,13 @@ 2012-12-27 Jan Nijtmans * generic/tclListObj.c: [Bug 3598580]: Tcl_ListObjReplace may release - deleted elements too early + deleted elements too early. 2012-12-21 Jan Nijtmans * unix/dltest/pkgb.c: Make pkgb.so loadable in Tcl 8.4 as well. - * generic/tclStubLib.c: Eliminate unnessarcy static HasStubSupport() and - isDigit() functions, just do the same inline. + * generic/tclStubLib.c: Eliminate unnecessary static HasStubSupport() + and isDigit() functions, just do the same inline. 2012-12-13 Jan Nijtmans @@ -290,8 +290,8 @@ * library/init.tcl: * tools/tcl.wse.in: * unix/configure.in: - * unix/tcl.spec: * win/configure.in: + * unix/tcl.spec: * README: * unix/configure: autoconf-2.59 @@ -382,13 +382,13 @@ * win/tclWinPort.h: Remove wrapper macro for ntohs(): unnecessary, because it doesn't require an initialized winsock_2 library. See: - * win/tclWinSock.c - * generic/tclStubInit.c + * win/tclWinSock.c: + * generic/tclStubInit.c: 2012-08-17 Jan Nijtmans - * win/nmakehlp.c: Add "-V" option, in order to be able - to detect partial version numbers. + * win/nmakehlp.c: Add "-V" option, in order to be able to detect + partial version numbers. 2012-08-15 Jan Nijtmans @@ -470,7 +470,7 @@ 2012-07-11 Jan Nijtmans - * win/tclWinReg.c: [Bug #3362446]: registry keys command fails + * win/tclWinReg.c: [Bug 3362446]: registry keys command fails with 8.5/8.6. Follow Microsofts example better in order to prevent problems when using HKEY_PERFORMANCE_DATA. @@ -495,7 +495,7 @@ * library/msgcat/msgcat.tcl: Add tn, ro_MO and ru_MO to msgcat. -2012-06-29 Harald Oehlmann +2012-06-29 Harald Oehlmann * library/msgcat/msgcat.tcl: [Bug 3536888]: Locale guessing of * library/msgcat/pkgIndex.tcl: msgcat fails on (some) Windows 7. Bump @@ -525,7 +525,7 @@ 2012-06-25 Jan Nijtmans - * generic/tclfileName.c: [Patch #1536227]: Cygwin network pathname + * generic/tclfileName.c: [Patch 1536227]: Cygwin network pathname * tests/fileName.test: support 2012-06-23 Jan Nijtmans @@ -535,8 +535,8 @@ 2012-06-21 Jan Nijtmans - * win/tclWinReg.c: [Bug #3362446]: registry keys command fails - * tests/registry.test: with 8.5/8.6 + * win/tclWinReg.c: [Bug 3362446]: registry keys command fails + * tests/registry.test: with 8.5/8.6 * library/reg/pkgIndex.tcl: registry version to 1.2.2 2012-06-11 Don Porter @@ -579,9 +579,9 @@ 2012-05-25 Jan Nijtmans - * win/tclWinDde.c: [Bug 473946]: special characters not correctly - * win/Makefile.in: sent, now for XTYP_EXECUTE as well as - XTYP_REQUEST. Fix "make genstubs" when cross-compiling on UNIX + * win/tclWinDde.c: [Bug 473946]: Special characters were not correctly + sent, now for XTYP_EXECUTE as well as XTYP_REQUEST. + * win/Makefile.in: Fix "make genstubs" when cross-compiling on UNIX 2012-05-24 Jan Nijtmans @@ -630,14 +630,14 @@ 2012-05-13 Jan Nijtmans - * win/tclWinDde.c: Protect against receiving strings without - ending \0, as external applications (or Tcl with TIP #106) could - generate that. + * win/tclWinDde.c: Protect against receiving strings without ending + \0, as external applications (or Tcl with TIP #106) could generate + that. 2012-05-10 Jan Nijtmans - * win/tclWinDde.c: [Bug 473946]: Special characters not - * library/dde/pkgIndex.tcl: correctly sent. Bump to 1.3.3 + * win/tclWinDde.c: [Bug 473946]: Special characters not correctly sent + * library/dde/pkgIndex.tcl: Increase version to 1.3.3 2012-05-02 Jan Nijtmans @@ -695,8 +695,8 @@ 2012-04-11 Jan Nijtmans - * win/tclWinInit.c: [Bug 3448512]: [clock scan 1958-01-01] fails - * win/tcl.m4: in debug compilation. + * win/tclWinInit.c: [Bug 3448512]: clock scan "1958-01-01" fails + * win/tcl.m4: only in debug compilation. * win/configure: * unix/tcl.m4: Use NDEBUG consistantly meaning: no debugging. * unix/configure: @@ -711,106 +711,107 @@ 2012-04-03 Jan Nijtmans - * generic/tclStubInit.c: Remove the TclpGetTZName implementation - * generic/tclIntDecls.h: for Cygwin (from previous commit) , - * generic/tclIntPlatDecls.h: re-generated + * generic/tclStubInit.c: Remove the TclpGetTZName implementation for + * generic/tclIntDecls.h: Cygwin (from 2012-04-02 commit), re-generated + * generic/tclIntPlatDecls.h: * generic/tcl.decls: cleanup unnecessary "generic" argument 2012-03-30 Jan Nijtmans - * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in - * generic/tclIntPlatDecls.h: cygwin tclsh. Implement - * generic/tclStubInit.c: TclWinGetTclInstance, TclpGetTZName, - and various more win32-specific internal functions for Cygwin, so - win32 extensions using those can be loaded in the cygwin version of - tclsh. + * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in cygwin tclsh + * generic/tclIntPlatDecls.h: Implement TclWinGetTclInstance, + * generic/tclStubInit.c: TclpGetTZName, and various more + win32-specific internal functions for Cygwin, so win32 extensions + using those can be loaded in the cygwin version of tclsh. 2012-03-30 Jan Nijtmans - * unix/tcl.m4: [Bug 3511806]: Compiler checks too early - * unix/configure.in: This change allows to build the cygwin - * unix/tclUnixPort.h: and mingw32 ports of Tcl/Tk to build - * win/tcl.m4: out-of-the-box using a native or cross- - * win/configure.in: compiler. - * win/tclWinPort.h: (autoconf still to be run!) + * unix/tcl.m4: [Bug 3511806]: Compiler checks too early + * unix/configure.in: This change allows to build the cygwin and + * unix/tclUnixPort.h: mingw32 ports of Tcl/Tk to build out-of-the-box + * win/tcl.m4: using a native or cross-compiler. + * win/configure.in: + * win/tclWinPort.h: 2012-03-27 Jan Nijtmans - * generic/tcl.h: [Bug 3508771]: Wrong Tcl_StatBuf used on MinGW - * generic/tclFCmd.c: [Bug 2015723]: duplicate inodes from file stat + * generic/tcl.h: [Bug 3508771]: Wrong Tcl_StatBuf used on MinGW. + * generic/tclFCmd.c: [Bug 2015723]: Duplicate inodes from file stat on windows (but now for cygwin as well) 2012-03-25 Jan Nijtmans - * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in - * generic/tclIntPlatDecls.h: cygwin tclsh. Implement - * generic/tclStubInit.c: TclWinConvertError, - * unix/Makefile.in: TclWinConvertWSAError, and various - * unix/tcl.m4: more win32-specific internal functions - * unix/configure: for Cygwin, so win32 extensions using - * win/tclWinError.c: those can be loaded in the cygwin - version of tclsh. + * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in cygwin + * generic/tclIntPlatDecls.h: tclsh. Implement TclWinConvertError, + * generic/tclStubInit.c: TclWinConvertWSAError, and various more + * unix/Makefile.in: win32-specific internal functions for + * unix/tcl.m4: Cygwin, so win32 extensions using those + * unix/configure: can be loaded in the cygwin version of + * win/tclWinError.c: tclsh. 2012-03-23 Jan Nijtmans - * generic/tclInt.decls: Revert some cygwin-related signature - * generic/tclIntPlatDecls.h: changes from [835f8e1e9d] (2010-02-01). - * win/tclWinError.c: They were an attempt to make the cygwin - port compile again, but since cygwin is based on unix this serves no - purpose any more. - - * unix/Makefile.in: Add tclWinError.c to the CYGWIN build. + * generic/tclInt.decls: Revert some cygwin-related signature + * generic/tclIntPlatDecls.h: changes from [835f8e1e9d] (2010-01-22). + * win/tclWinError.c: They were an attempt to make the cygwin + port compile again, but since cygwin is + based on unix this serves no purpose any + more. + * win/tclWinSerial.c: Use EAGAIN in stead of EWOULDBLOCK, + * win/tclWinSock.c: because in VS10+ the value of + EWOULDBLOCK is no longer the same as + EAGAIN. + * unix/Makefile.in: Add tclWinError.c to the CYGWIN build. * unix/tcl.m4: * unix/configure: 2012-03-20 Jan Nijtmans - * generic/tcl.decls: [Bug 3508771]: load tclreg.dll in - * generic/tclInt.decls: cygwin tclsh. Implement - * generic/tclIntPlatDecls.h: TclWinGetPlatformId,Tcl_WinUtfToTChar, - * generic/tclPlatDecls.h: Tcl_WinTCharToUtf (and a dummy - * generic/tclStubInit.c: TclWinCPUID) for Cygwin, so win32 - * unix/tclUnixCompat.c: extensions using those can be loaded - in the cygwin version of tclsh. + * generic/tcl.decls: [Bug 3508771]: load tclreg.dll in cygwin + * generic/tclInt.decls: tclsh. Implement TclWinGetPlatformId, + * generic/tclIntPlatDecls.h: Tcl_WinUtfToTChar, Tcl_WinTCharToUtf (and + * generic/tclPlatDecls.h: a dummy TclWinCPUID) for Cygwin, so win32 + * generic/tclStubInit.c: extensions using those can be loaded in + * unix/tclUnixCompat.c: the cygwin version of tclsh. 2012-03-19 Venkat Iyer * library/tzdata/America/Atikokan: Update to tzdata2012b. - * library/tzdata/America/Blanc-Sablon - * library/tzdata/America/Dawson_Creek - * library/tzdata/America/Edmonton - * library/tzdata/America/Glace_Bay - * library/tzdata/America/Goose_Bay - * library/tzdata/America/Halifax - * library/tzdata/America/Havana - * library/tzdata/America/Moncton - * library/tzdata/America/Montreal - * library/tzdata/America/Nipigon - * library/tzdata/America/Rainy_River - * library/tzdata/America/Regina - * library/tzdata/America/Santiago - * library/tzdata/America/St_Johns - * library/tzdata/America/Swift_Current - * library/tzdata/America/Toronto - * library/tzdata/America/Vancouver - * library/tzdata/America/Winnipeg - * library/tzdata/Antarctica/Casey - * library/tzdata/Antarctica/Davis - * library/tzdata/Antarctica/Palmer - * library/tzdata/Asia/Yerevan - * library/tzdata/Atlantic/Stanley - * library/tzdata/Pacific/Easter - * library/tzdata/Pacific/Fakaofo + * library/tzdata/America/Blanc-Sablon: + * library/tzdata/America/Dawson_Creek: + * library/tzdata/America/Edmonton: + * library/tzdata/America/Glace_Bay: + * library/tzdata/America/Goose_Bay: + * library/tzdata/America/Halifax: + * library/tzdata/America/Havana: + * library/tzdata/America/Moncton: + * library/tzdata/America/Montreal: + * library/tzdata/America/Nipigon: + * library/tzdata/America/Rainy_River: + * library/tzdata/America/Regina: + * library/tzdata/America/Santiago: + * library/tzdata/America/St_Johns: + * library/tzdata/America/Swift_Current: + * library/tzdata/America/Toronto: + * library/tzdata/America/Vancouver: + * library/tzdata/America/Winnipeg: + * library/tzdata/Antarctica/Casey: + * library/tzdata/Antarctica/Davis: + * library/tzdata/Antarctica/Palmer: + * library/tzdata/Asia/Yerevan: + * library/tzdata/Atlantic/Stanley: + * library/tzdata/Pacific/Easter: + * library/tzdata/Pacific/Fakaofo: * library/tzdata/America/Creston: (new) 2012-03-15 Jan Nijtmans * generic/tcl.h: [Bug 3288345]: Wrong Tcl_StatBuf used on Cygwin - * unix/tclUnixFile.c - * unix/tclUnixPort.h + * unix/tclUnixFile.c: + * unix/tclUnixPort.h: * win/cat.c: Remove cygwin stuff no longer needed - * win/tclWinFile.c - * win/tclWinPort.h + * win/tclWinFile.c: + * win/tclWinPort.h: 2012-03-12 Jan Nijtmans @@ -838,7 +839,7 @@ * generic/tclIOUtil.c: [Bug 3466099]: BOM in Unicode * generic/tclEncoding.c: - * tests/source.test + * tests/source.test: 2012-02-23 Donal K. Fellows @@ -869,9 +870,9 @@ 2012-02-06 Miguel Sofer - * generic/tclTrace.c: Fix for [Bug 3484621]: insure that - * tests/trace.test: execution traces on bytecoded commands bump - the interp's compile epoch. + * generic/tclTrace.c: [Bug 3484621]: Ensure that execution traces on + * tests/trace.test: bytecoded commands bump the interp's compile + epoch. 2012-02-02 Jan Nijtmans @@ -881,11 +882,11 @@ 2012-02-02 Don Porter * win/tclWinFile.c: [Bugs 2974459,2879351,1951574,1852572, - 1661378,1613456]: Revisions to the NativeAccess() routine that - queries file permissions on Windows native filesystems. Meant to - fix numerous bugs where [file writable|readable|executable] "lies" - about what operations are possible, especially when the file resides - on a Samba share. Patch merged from the fix-win-native-access branch. + 1661378,1613456]: Revisions to the NativeAccess() routine that queries + file permissions on Windows native filesystems. Meant to fix numerous + bugs where [file writable|readable|executable] "lies" about what + operations are possible, especially when the file resides on a Samba + share. 2012-02-01 Donal K. Fellows @@ -899,11 +900,11 @@ 2012-01-22 Jan Nijtmans - * tools/uniClass.tcl: [Frq 3473670]: Various Unicode-related - * tools/uniParse.tcl: speedups/robustness. Enhanced tools to - * generic/tclUniData.c: be able to handle characters > 0xffff - * generic/tclUtf.c: Done in all branches in order to simplify - * generic/regc_locale.c: merges for new Unicode versions (such as 6.1) + * tools/uniClass.tcl: [FRQ 3473670]: Various Unicode-related + * tools/uniParse.tcl: speedups/robustness. Enhanced tools to be + * generic/tclUniData.c: able to handle characters > 0xffff. Done in + * generic/tclUtf.c: all branches in order to simplify merges for + * generic/regc_locale.c: new Unicode versions (such as 6.1) 2012-01-22 Donal K. Fellows @@ -916,10 +917,10 @@ * generic/tcl.h: [Bug 3474726]: Eliminate detection of struct * generic/tclWinPort.h: _stat32i64, just use _stati64 in combination - * generic/tclFCmd.c: with _USE_32BIT_TIME_T, which is the same then. - * generic/tclTest.c: Only keep _stat32i64 usage for cygwin, so it - * win/configure.in: will not conflict with cygwin's own struct stat. - * win/configure: + * generic/tclFCmd.c: with _USE_32BIT_TIME_T, which is the same + * generic/tclTest.c: then. Only keep _stat32i64 usage for cygwin, + * win/configure.in: so it will not conflict with cygwin's own + * win/configure: struct stat. 2012-01-21 Don Porter @@ -945,37 +946,37 @@ 2012-01-09 Jan Nijtmans - * generic/tclUtf.c: [Bug 3464428]: string is graph \u0120 is wrong - * generic/regc_locale.c: Add table for Unicode [:cntrl:] class - * tools/uniClass.tcl: Generate Unicode [:cntrl:] class table + * generic/tclUtf.c: [Bug 3464428]: [string is graph \u0120] was + * generic/regc_locale.c: wrong. Add table for Unicode [:cntrl:] class. + * tools/uniClass.tcl: Generate Unicode [:cntrl:] class table. * tests/utf.test: 2012-01-08 Kevin B. Kenny - * library/clock.tcl (ReadZoneinfoFile): Corrected a bug where loading - * tests/clock.test (clock-56.4): zoneinfo would fail if one - timezone abbreviation was a proper tail of another, and zic used the - same bytes of the file to represent both of them. Added a test case - for the bug, using the same data that caused the observed failure - "in the wild." [Bug 3470928] + * library/clock.tcl (ReadZoneinfoFile): [Bug 3470928]: Corrected a bug + * tests/clock.test (clock-56.4): where loading zoneinfo would + fail if one timezone abbreviation was a proper tail of another, and + zic used the same bytes of the file to represent both of them. Added a + test case for the bug, using the same data that caused the observed + failure "in the wild." 2011-12-30 Venkat Iyer - * library/tzdata/America/Bahia : Update to Olson's tzdata2011n - * library/tzdata/America/Havana - * library/tzdata/Europe/Kiev - * library/tzdata/Europe/Simferopol - * library/tzdata/Europe/Uzhgorod - * library/tzdata/Europe/Zaporozhye - * library/tzdata/Pacific/Fiji + * library/tzdata/America/Bahia: Update to Olson's tzdata2011n + * library/tzdata/America/Havana: + * library/tzdata/Europe/Kiev: + * library/tzdata/Europe/Simferopol: + * library/tzdata/Europe/Uzhgorod: + * library/tzdata/Europe/Zaporozhye: + * library/tzdata/Pacific/Fiji: 2011-12-23 Jan Nijtmans - * generic/tclUtf.c: [Bug 3464428]: string is graph \u0120 is wrong + * generic/tclUtf.c: [Bug 3464428]: [string is graph \u0120] is wrong. * generic/tclUniData.c: * generic/regc_locale.c: * tests/utf.test: - * tools/uniParse.tcl: clean up some unused stuff, and be more robust + * tools/uniParse.tcl: Clean up some unused stuff, and be more robust against changes in UnicodeData.txt syntax 2011-12-11 Jan Nijtmans @@ -1004,8 +1005,8 @@ 2011-11-22 Jan Nijtmans - * win/tclWinPort.h: [Bug 3354324]: Windows: file mtime - * win/tclWinFile.c: sets wrong time (VS2005+ only) + * win/tclWinPort.h: [Bug 3354324]: Windows: [file mtime] sets wrong + * win/tclWinFile.c: time (VS2005+ only). * generic/tclTest.c: 2011-11-04 Don Porter @@ -1036,20 +1037,21 @@ 2011-10-18 Reinhard Max - * library/clock.tcl (::tcl::clock::GetSystemTimeZone): Cache the - time zone only if it was detected by one of the expensive - methods. Otherwise after unsetting TCL_TZ or TZ the previous value - will still be used. + * library/clock.tcl (::tcl::clock::GetSystemTimeZone): Cache the time + zone only if it was detected by one of the expensive methods. + Otherwise after unsetting TCL_TZ or TZ the previous value will still + be used. 2011-10-15 Venkat Iyer - * library/tzdata/America/Sitka : Update to Olson's tzdata2011l - * library/tzdata/Pacific/Fiji - * library/tzdata/Asia/Hebron (New) + + * library/tzdata/America/Sitka: Update to Olson's tzdata2011l + * library/tzdata/Pacific/Fiji: + * library/tzdata/Asia/Hebron: (New) 2011-10-11 Jan Nijtmans - * win/tclWinFile.c: [Bug 2935503]: Incorrect mode field - returned by file stat command + * win/tclWinFile.c: [Bug 2935503]: Incorrect mode field returned by + [file stat] command. 2011-10-07 Jan Nijtmans @@ -1061,16 +1063,16 @@ 2011-10-03 Venkat Iyer * library/tzdata/Africa/Dar_es_Salaam: Update to Olson's tzdata2011k - * library/tzdata/Africa/Kampala - * library/tzdata/Africa/Nairobi - * library/tzdata/Asia/Gaza - * library/tzdata/Europe/Kaliningrad - * library/tzdata/Europe/Kiev - * library/tzdata/Europe/Minsk - * library/tzdata/Europe/Simferopol - * library/tzdata/Europe/Uzhgorod - * library/tzdata/Europe/Zaporozhye - * library/tzdata/Pacific/Apia + * library/tzdata/Africa/Kampala: + * library/tzdata/Africa/Nairobi: + * library/tzdata/Asia/Gaza: + * library/tzdata/Europe/Kaliningrad: + * library/tzdata/Europe/Kiev: + * library/tzdata/Europe/Minsk: + * library/tzdata/Europe/Simferopol: + * library/tzdata/Europe/Uzhgorod: + * library/tzdata/Europe/Zaporozhye: + * library/tzdata/Pacific/Apia: 2011-09-16 Donal K. Fellows @@ -1091,8 +1093,8 @@ 2011-09-13 Don Porter - * generic/tclUtil.c: [Bug 3390638]: Workaround broken solaris - studio cc optimizer. Thanks to Wolfgang S. Kechel. + * generic/tclUtil.c: [Bug 3390638]: Workaround broken Solaris + Studio cc optimizer. Thanks to Wolfgang S. Kechel. * generic/tclDTrace.d: [Bug 3405652]: Portability workaround for broken system DTrace support. Thanks to Dagobert Michelson. @@ -1105,9 +1107,9 @@ 2011-09-07 Don Porter * generic/tclCompExpr.c: [Bug 3401704]: Allow function names like - * tests/parseExpr.test: influence(), nanobot(), and 99bottles() - that have been parsed as missing operator syntax errors before - with the form NUMBER + FUNCTION. + * tests/parseExpr.test: influence(), nanobot(), and 99bottles() that + have been parsed as missing operator syntax errors before with the + form NUMBER + FUNCTION. ***POTENTIAL INCOMPATIBILITY*** 2011-09-06 Venkat Iyer @@ -1144,8 +1146,8 @@ 2011-08-18 Jan Nijtmans * generic/tclUniData.c: [Bug 3393714]: Overflow in toupper delta - * tools/uniParse.tcl - * tests/utf.test + * tools/uniParse.tcl: + * tests/utf.test: 2011-08-17 Don Porter @@ -1177,13 +1179,13 @@ 2011-08-15 Jan Nijtmans - * win/tclWinPort.h: [Bug 3388350]: mingw64 compiler warnings - * win/tclWinPipe.c - * win/tclWinSock.c - * win/configure.in - * win/configure - * generic/tclPosixStr.c + * generic/tclPosixStr.c: [Bug 3388350]: mingw64 compiler warnings * generic/tclStrToD.c + * win/tclWinPort.h: + * win/tclWinPipe.c: + * win/tclWinSock.c: + * win/configure.in: + * win/configure: 2011-08-12 Don Porter @@ -1193,9 +1195,9 @@ 2011-08-09 Jan Nijtmans * win/tclWinConsole.c: [Bug 3388350]: mingw64 compiler warnings - * win/tclWinDde.c - * win/tclWinPipe.c - * win/tclWinSerial.c + * win/tclWinDde.c: + * win/tclWinPipe.c: + * win/tclWinSerial.c: 2011-08-05 Kevin B. Kenny @@ -1231,6 +1233,7 @@ * generic/tclUtil.c: [Bug 3371644]: Repair failure to properly handle * tests/util.test: (length == -1) scanning in TclConvertElement(). + Thanks to Thomas Sader and Alexandre Ferrieux. 2011-07-15 Don Porter @@ -1258,9 +1261,9 @@ * unix/Makefile.in: * win/Makefile.in: * win/Makefile.vc: - Fix a bug where bignum->double conversion is "round up" and - not "round to nearest" (causing expr double(1[string repeat 0 23]) - not to be 1e+23). [Bug 3349507] + [Bug 3349507]: Fix a bug where bignum->double conversion is "round up" + and not "round to nearest" (causing expr double(1[string repeat 0 23]) + not to be 1e+23). 2011-06-30 Reinhard Max @@ -1282,7 +1285,7 @@ * win/Makefile.in: * generic/tclInt.h: Fixed the inadvertently committed disabling of - stack checks, see my 2010-11-15 commit. + stack checks, see my 2010-11-15 commit. 2011-06-21 Don Porter @@ -1296,8 +1299,8 @@ * tests/init.test: Update test files to use new command. * tests/pkg.test: - * generic/tclLink.c: Prevent multiple links to a single Tcl - variable when calling Tcl_LinkVar(). [Bug 3317466] + * generic/tclLink.c: [Bug 3317466]: Prevent multiple links to a + single Tcl variable when calling Tcl_LinkVar(). 2011-06-13 Don Porter @@ -1307,8 +1310,8 @@ 2011-06-02 Don Porter * generic/tclBasic.c: Removed TclCleanupLiteralTable(), and old - * generic/tclInt.h: band-aid routine put in place while a fix - * generic/tclLiteral.c: for [Bug 994838] took shape. No longer needed. + * generic/tclInt.h: band-aid routine put in place while a fix for + * generic/tclLiteral.c: [Bug 994838] took shape. No longer needed. 2011-06-02 Donal K. Fellows @@ -1319,8 +1322,8 @@ 2011-06-01 Jan Nijtmans - * generic/tclUtil.c: Fix for [Bug 3309871]: Valgrind finds: - invalid read in TclMaxListLength() + * generic/tclUtil.c: Fix for [Bug 3309871]: Valgrind finds: invalid + read in TclMaxListLength(). 2011-05-25 Don Porter @@ -1336,19 +1339,19 @@ 2011-05-17 Andreas Kupries * generic/tclCompile.c (TclFixupForwardJump): Tracked down and fixed - * generic/tclBasic.c (TclArgumentBCEnter): the cause of a violation - of my assertion that 'ePtr->nline == objc' in TclArgumentBCEnter. - When a bytecode was grown during jump fixup the pc -> command line - mapping was not updated. When things aligned just wrong the mapping - would direct command A to the data for command B, with a different - number of arguments. + * generic/tclBasic.c (TclArgumentBCEnter): the cause of a violation of + my assertion that 'ePtr->nline == objc' in TclArgumentBCEnter. When a + bytecode was grown during jump fixup the pc -> command line mapping + was not updated. When things aligned just wrong the mapping would + direct command A to the data for command B, with a different number of + arguments. 2011-05-10 Don Porter * generic/tclInt.h: New internal routines TclScanElement() and * generic/tclUtil.c: TclConvertElement() are rewritten guts of - machinery to produce string rep of lists. The new routines avoid - and correct [Bug 3173086]. See comments for much more detail. + machinery to produce string rep of lists. The new routines avoid and + correct [Bug 3173086]. See comments for much more detail. * generic/tclDictObj.c: Update all callers. * generic/tclIndexObj.c: @@ -1363,8 +1366,8 @@ 2011-05-07 Miguel Sofer - * generic/tclInt.h: fix USE_TCLALLOC so that it can be enabled - * unix/Makefile.in: without editing the Makefile + * generic/tclInt.h: Fix USE_TCLALLOC so that it can be enabled without + * unix/Makefile.in: editing the Makefile. 2011-05-05 Don Porter @@ -1379,21 +1382,21 @@ 2011-05-02 Don Porter - * generic/tclCmdMZ.c: Revised TclFindElement() interface. The - * generic/tclDictObj.c: final argument had been bracePtr, the address - * generic/tclListObj.c: of a boolean var, where the caller can be told + * generic/tclCmdMZ.c: Revised TclFindElement() interface. The final + * generic/tclDictObj.c: argument had been bracePtr, the address of a + * generic/tclListObj.c: boolean var, where the caller can be told * generic/tclParse.c: whether or not the parsed list element was * generic/tclUtil.c: enclosed in braces. In practice, no callers really care about that. What the callers really want to know is whether the list element value exists as a literal substring of the string being parsed, or whether a call to TclCopyAndCollpase() is - needed to produce the list element value. Now the final argument - is changed to do what callers actually need. This is a better fit - for the calls in tclParse.c, where now a good deal of post-processing - checking for "naked backslashes" is no longer necessary. + needed to produce the list element value. Now the final argument is + changed to do what callers actually need. This is a better fit for the + calls in tclParse.c, where now a good deal of post-processing checking + for "naked backslashes" is no longer necessary. ***POTENTIAL INCOMPATIBILITY*** - For any callers calling in via the internal stubs table who really - do use the final argument explicitly to check for the enclosing brace + For any callers calling in via the internal stubs table who really do + use the final argument explicitly to check for the enclosing brace scenario. Simply looking for the braces where they must be is the revision available to those callers, and it will backport cleanly. @@ -1414,11 +1417,11 @@ 2011-04-28 Don Porter * generic/tclInt.h: New utility routines: - * generic/tclParse.c: TclIsSpaceProc() and - * generic/tclUtil.c: TclCountSpaceRuns() + * generic/tclParse.c: TclIsSpaceProc() and TclCountSpaceRuns() + * generic/tclUtil.c: - * generic/tclCmdMZ.c: Use new routines to replace calls to - * generic/tclListObj.c: isspace() and their /* INTL */ risk. + * generic/tclCmdMZ.c: Use new routines to replace calls to isspace() + * generic/tclListObj.c: and their /* INTL */ risk. * generic/tclStrToD.c: * generic/tclUtf.c: * unix/tclUnixFile.c: @@ -1485,8 +1488,8 @@ * generic/tclConfig.c: * generic/tclListObj.c: - * generic/tclInt.h: Define and use macros that test whether - * generic/tclBasic.c: a Tcl list value is canonical. + * generic/tclInt.h: Define and use macros that test whether a Tcl + * generic/tclBasic.c: list value is canonical. * generic/tclUtil.c: 2011-04-16 Donal K. Fellows @@ -1538,15 +1541,15 @@ 2011-04-04 Don Porter - * README: Updated README files, repairing broken URLs and - * macosx/README: removing other bits that were clearly wrong. + * README: [Bug 3202030]: Updated README files, repairing broken + * macosx/README:URLs and removing other bits that were clearly wrong. * unix/README: Still could use more eyeballs on the detailed build - * win/README: advice on various plaforms. [Bug 3202030] + * win/README: advice on various plaforms. 2011-04-02 Kevin B. Kenny - * generic/tclStrToD.c (QuickConversion): Replaced another couple of - 'double' declarations with 'volatile double' to work around + * generic/tclStrToD.c (QuickConversion): Replaced another couple + of 'double' declarations with 'volatile double' to work around misrounding issues in mingw-gcc 3.4.5. 2011-03-24 Donal K. Fellows @@ -1557,7 +1560,7 @@ 2011-03-21 Jan Nijtmans - * unix/tclLoadDl.c: [Bug #3216070]: Loading extension libraries + * unix/tclLoadDl.c: [Bug 3216070]: Loading extension libraries * unix/tclLoadDyld.c: from embedded Tcl applications. ***POTENTIAL INCOMPATIBILITY*** For extensions which rely on symbols from other extensions being @@ -1566,13 +1569,13 @@ 2011-03-16 Jan Nijtmans - * generic/tclCkalloc.c: [Bug #3197864]: pointer truncation on Win64 + * generic/tclCkalloc.c: [Bug 3197864]: Pointer truncation on Win64 TCL_MEM_DEBUG builds 2011-03-16 Don Porter - * generic/tclBasic.c: Some rewrites to eliminate calls to - * generic/tclParse.c: isspace() and their /* INTL */ risk. + * generic/tclBasic.c: Some rewrites to eliminate calls to isspace() + * generic/tclParse.c: and their /* INTL */ risk. * generic/tclProc.c: 2011-03-16 Jan Nijtmans @@ -1584,8 +1587,8 @@ 2011-03-14 Kevin B. Kenny - * tools/tclZIC.tcl (onDayOfMonth): Allow for leading zeroes - in month and day so that tzdata2011d parses correctly. + * tools/tclZIC.tcl (onDayOfMonth): Allow for leading zeroes in month + and day so that tzdata2011d parses correctly. * library/tzdata/America/Havana: * library/tzdata/America/Juneau: * library/tzdata/America/Santiago: @@ -1600,10 +1603,10 @@ 2011-03-09 Don Porter - * generic/tclNamesp.c: Tighten the detector of nested [namespace code] - * tests/namespace.test: quoting that the quoted scripts function - properly even in a namespace that contains a custom "namespace" - command. [Bug 3202171] + * generic/tclNamesp.c: [Bug 3202171]: Tighten the detector of nested + * tests/namespace.test: [namespace code] quoting that the quoted + scripts function properly even in a namespace that contains a custom + "namespace" command. * doc/tclvars.n: Formatting fix. Thanks to Pat Thotys. @@ -1616,8 +1619,8 @@ * generic/tclInt.h: Remove TclMarkList() routine, an experimental * generic/tclUtil.c: dead-end from the 8.5 alpha days. - * generic/tclResult.c (ResetObjResult): Correct failure to clear - invalid intrep. Thanks to Colin McDonald. [Bug 3202905] + * generic/tclResult.c (ResetObjResult): [Bug 3202905]: Correct failure + to clear invalid intrep. Thanks to Colin McDonald. 2011-03-06 Don Porter @@ -1626,13 +1629,13 @@ * generic/tclParse.c: * generic/tclUtil.c: - * generic/tclUtil.c (TclFindElement): Guard escape sequence scans - to not overrun the string end. [Bug 3192636] + * generic/tclUtil.c (TclFindElement): [Bug 3192636]: Guard escape + sequence scans to not overrun the string end. 2011-03-05 Don Porter - * generic/tclParse.c (TclParseBackslash): Correct trunction checks in - * tests/parse.test: \x and \u substitutions. [Bug 3200987] + * generic/tclParse.c (TclParseBackslash): [Bug 3200987]: Correct + * tests/parse.test: trunction checks in \x and \u substitutions. 2011-01-26 Donal K. Fellows @@ -1677,16 +1680,16 @@ * tests/io.test regarding legacy form. * tests/ioCmd.test -2011-01-15 Kevin B. Kenny +2011-01-15 Kevin B. Kenny * doc/tclvars.n: * generic/tclStrToD.c: * generic/tclUtil.c (Tcl_PrintDouble): - * tests/util.test (util-16.*): Restored full Tcl 8.4 compatibility - for the formatting of floating point numbers when $::tcl_precision - is not zero. Added compatibility tests to make sure that excess - trailing zeroes are suppressed for all eight major code paths. - [Bug 3157475] + * tests/util.test (util-16.*): [Bug 3157475]: Restored full Tcl 8.4 + compatibility for the formatting of floating point numbers when + $::tcl_precision is not zero. Added compatibility tests to make sure + that excess trailing zeroes are suppressed for all eight major code + paths. 2011-01-13 Miguel Sofer @@ -1719,7 +1722,7 @@ 2010-12-17 Stuart Cassoff - * unix/Makefile.in: Use 'rpmbuild', not 'rpm' [Bug 2537626]. + * unix/Makefile.in: [Bug 2537626]: Use 'rpmbuild', not 'rpm'. 2010-12-13 Jan Nijtmans @@ -1741,18 +1744,17 @@ 2010-12-03 Jeff Hobbs - * generic/tclUtil.c (TclReToGlob): add extra check for multiple - inner *s that leads to poor recursive glob matching, defer to - original RE instead. tclbench RE var backtrack. + * generic/tclUtil.c (TclReToGlob): Add extra check for multiple inner + *s that leads to poor recursive glob matching, defer to original RE + instead. tclbench RE var backtrack. 2010-12-01 Kevin B. Kenny * generic/tclStrToD.c (SetPrecisionLimits, TclDoubleDigits): - Added meaningless initialization of 'i', 'ilim' and 'ilim1' - to silence warnings from the C compiler about possible use of - uninitialized variables, Added a panic to the 'switch' that - assigns them, to assert that the 'default' case is impossible. - [Bug 3124675] + [Bug 3124675]: Added meaningless initialization of 'i', 'ilim' and + 'ilim1' to silence warnings from the C compiler about possible use of + uninitialized variables, Added a panic to the 'switch' that assigns + them, to assert that the 'default' case is impossible. 2010-11-30 Andreas Kupries @@ -1832,18 +1834,18 @@ 2010-11-03 Kevin B. Kenny - * generic/tclCompCmds.c (TclCompileCatchCmd): - * tests/compile.test (compile-3.6): [Bug 3098302]: Reworked the - compilation of the [catch] command so as to avoid placing any code - that might throw an exception (specifically, any initial substitutions - or any stores to result or options variables) between the BEGIN_CATCH - and END_CATCH but outside the exception range. Added a test case that - panics on a stack smash if the change is not made. + * generic/tclCompCmds.c (TclCompileCatchCmd): [Bug 3098302]: + * tests/compile.test (compile-3.6): Reworked the compilation of the + [catch] command so as to avoid placing any code that might throw an + exception (specifically, any initial substitutions or any stores to + result or options variables) between the BEGIN_CATCH and END_CATCH but + outside the exception range. Added a test case that panics on a stack + smash if the change is not made. 2010-11-01 Stuart Cassoff - * library/safe.tcl: Improved handling of non-standard module - * tests/safe.test: path lists, empty path lists in particular. + * library/safe.tcl: Improved handling of non-standard module path + * tests/safe.test: lists, empty path lists in particular. 2010-11-01 Kevin B. Kenny @@ -1863,31 +1865,31 @@ 2010-10-09 Miguel Sofer - * generic/tclExecute.c: fix overallocation of exec stack in TEBC - (mixing numwords and numbytes) + * generic/tclExecute.c: Fix overallocation of exec stack in TEBC (due + to mixing numwords and numbytes) 2010-10-01 Jeff Hobbs - * generic/tclExecute.c (EvalStatsCmd): change 'evalstats' to - return data to interp by default, or if given an arg, use that as - filename to output to (accepts 'stdout' and 'stderr'). - Fix output to print used inst count data. - * generic/tclCkalloc.c: change TclDumpMemoryInfo sig to allow - * generic/tclInt.decls: objPtr as well as FILE* as output. + * generic/tclExecute.c (EvalStatsCmd): change 'evalstats' to return + data to interp by default, or if given an arg, use that as filename to + output to (accepts 'stdout' and 'stderr'). Fix output to print used + inst count data. + * generic/tclCkalloc.c: Change TclDumpMemoryInfo sig to allow objPtr + * generic/tclInt.decls: as well as FILE* as output. * generic/tclIntDecls.h: 2010-09-24 Andreas Kupries - * tclWinsock.c: [Bug 3056775]: Fixed race condition between thread - and internal co-thread access of a socket's structure because of - the thread not using the socketListLock in TcpAccept(). Added + * tclWinsock.c: [Bug 3056775]: Fixed race condition between thread and + internal co-thread access of a socket's structure because of the + thread not using the socketListLock in TcpAccept(). Added documentation on how the module works to the top. 2010-09-23 Don Porter - * generic/tclCmdAH.c: Fix cases where value returned by - * generic/tclEvent.c: Tcl_GetReturnOptions() was leaked. - * generic/tclMain.c: Thanks to Jeff Hobbs for discovery of the + * generic/tclCmdAH.c: Fix cases where value returned by + * generic/tclEvent.c: Tcl_GetReturnOptions() was leaked. + * generic/tclMain.c: Thanks to Jeff Hobbs for discovery of the anti-pattern to seek and destroy. 2010-09-19 Donal K. Fellows @@ -1928,15 +1930,15 @@ * doc/glob.n: Fixed documentation ambiguity regarding the handling of -join. - * library/safe.tcl (::safe::AliasGlob): Fixed another problem, the - option -join does not stop option processing in the core builtin, - so the emulation must not do that either. + * library/safe.tcl (safe::AliasGlob): Fixed another problem, the + option -join does not stop option processing in the core builtin, so + the emulation must not do that either. 2010-09-01 Andreas Kupries - * library/safe.tcl (::safe::AliasGlob): Moved the command - extending the actual glob command with a -directory flag to when - we actually have a proper untranslated path, + * library/safe.tcl (safe::AliasGlob): Moved the command extending the + actual glob command with a -directory flag to when we actually have a + proper untranslated path, 2010-09-01 Don Porter @@ -1944,9 +1946,9 @@ 2010-09-01 Andreas Kupries - * generic/tclExecute.c: [Bug 3057639]. Applied patch by Jeff to - * generic/tclVar.c: make the behaviour of lappend in bytecompiled - * tests/append.test: mode consistent with direct-eval and 'append' + * generic/tclExecute.c: [Bug 3057639]: Applied patch by Jeff to make + * generic/tclVar.c: the behaviour of lappend in bytecompiled mode + * tests/append.test: consistent with direct-eval and 'append' * tests/appendComp.test: generally. Added tests (append*-9.*) showing the difference. ***POTENTIAL INCOMPATIBILITY*** @@ -1960,8 +1962,8 @@ 2010-08-31 Andreas Kupries - * win/tcl.m4: Applied patch by Jeff fixing issues with the - manifest handling on Win64. + * win/tcl.m4: Applied patch by Jeff fixing issues with the manifest + handling on Win64. * win/configure: Regenerated. 2010-08-29 Donal K. Fellows @@ -1977,9 +1979,9 @@ * win/Makefile.in (VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE): * win/configure, win/configure.in, win/tcl.m4: SC_EMBED_MANIFEST - macro and --enable-embedded-manifest configure arg added to - support manifest embedding where we know the magic. Help prevents - DLL hell with MSVC8+. + macro and --enable-embedded-manifest configure arg added to support + manifest embedding where we know the magic. Help prevents DLL hell + with MSVC8+. 2010-08-24 Don Porter @@ -2011,7 +2013,7 @@ 2010-08-11 Jeff Hobbs * unix/ldAix: Remove ancient (pre-4.2) AIX support - * unix/configure: regen with ac-2.59 + * unix/configure: Regen with ac-2.59 * unix/configure.in, unix/tclConfig.sh.in, unix/Makefile.in: * unix/tcl.m4 (AIX): Remove the need for ldAIX, replace with -bexpall/-brtl. Remove TCL_EXP_FILE (export file) and other baggage @@ -2089,8 +2091,8 @@ 2010-07-28 Miguel Sofer - * generic/tclVar.c: [Bug 3037525]: lose fickle optimisation in - TclDeleteVars (used for runtime-created locals) that caused crashes. + * generic/tclVar.c: [Bug 3037525]: Lose fickle optimisation in + TclDeleteVars (used for runtime-created locals) that caused crash. 2010-07-25 Jan Nijtmans @@ -2138,7 +2140,7 @@ 2010-06-16 Jan Nijtmans * tools/loadICU.tcl: [Bug 3016135]: Traceback using clock format - * library/msgs/he.msg: with locale of he_IL + * library/msgs/he.msg: with locale of he_IL. 2010-06-09 Andreas Kupries @@ -2233,11 +2235,11 @@ 2010-04-14 Andreas Kupries * library/platform/platform.tcl: Linux platform identification: - * library/platform/pkgIndex.tcl: Check /lib64 for existence of - * unix/Makefile.in: files matching libc* before accepting it as - * win/Makefile.in: base directory. This can happen on weirdly - installed 32bit systems which have an empty or partially filled - /lib64 without an actual libc. Bumped to version 1.0.6. + * library/platform/pkgIndex.tcl: Check /lib64 for existence of files + * unix/Makefile.in: matching libc* before accepting it as base + * win/Makefile.in: directory. This can happen on weirdly installed + 32bit systems which have an empty or partially filled /lib64 without + an actual libc. Bumped to version 1.0.6. 2010-04-03 Zoran Vasiljevic @@ -2260,21 +2262,21 @@ 2010-03-30 Andreas Kupries * generic/tclIORChan.c (ReflectClose, ReflectInput, ReflectOutput, - ReflectSeekWide, ReflectWatch, ReflectBlock, ReflectSetOption, - ReflectGetOption, ForwardProc): [Bug 2978773]: Preserve + (ReflectSeekWide, ReflectWatch, ReflectBlock, ReflectSetOption, + (ReflectGetOption, ForwardProc): [Bug 2978773]: Preserve ReflectedChannel* structures across handler invokations, to avoid - crashes when the handler implementation induces nested callbacks - and destruction of the channel deep inside such a nesting. + crashes when the handler implementation induces nested callbacks and + destruction of the channel deep inside such a nesting. 2010-03-30 Don Porter - * generic/tclObj.c (Tcl_GetCommandFromObj): [Bug 2979402]: Reorder + * generic/tclObj.c (Tcl_GetCommandFromObj): [Bug 2979402]: Reorder the validity tests on internal rep of a "cmdName" value to avoid invalid reads reported by valgrind. 2010-03-29 Don Porter - * generic/tclStringObj.c: Fix array overrun in test format-1.12 + * generic/tclStringObj.c: Fix array overrun in test format-1.12 caught by valgrind testing. 2010-03-25 Donal K. Fellows @@ -2284,8 +2286,8 @@ 2010-03-24 Don Porter - * generic/tclResult.c: [Bug 2383005]: Revise [return -errorcode] so - * tests/result.test: that it rejects illegal non-list values. + * generic/tclResult.c: [Bug 2383005]: Revise [return -errorcode] so + * tests/result.test: that it rejects illegal non-list values. 2010-03-20 Donal K. Fellows @@ -2294,21 +2296,21 @@ 2010-03-18 Don Porter - * generic/tclListObj.c: [Bug 2971669]: Prevent in overflow trouble in - * generic/tclTestObj.c: ListObjReplace operations. Thanks to kbk for - * tests/listObj.test: fix and test. + * generic/tclListObj.c: [Bug 2971669]: Prevent in overflow trouble in + * generic/tclTestObj.c: ListObjReplace operations. Thanks to kbk for + * tests/listObj.test: fix and test. 2010-03-12 Jan Nijtmans - * win/makefile.vc: Fix [Bug 2967340]: Static build failure - * win/.cvsignore + * win/makefile.vc: [Bug 2967340]: Static build was failing. + * win/.cvsignore: 2010-03-09 Andreas Kupries * generic/tclIORChan.c: [Bug 2936225]: Thanks to Alexandre Ferrieux - * doc/refchan.n: for debugging - * tests/ioCmd.test: and fixing the problem. It is the write-side - equivalent to the bug fixed 2009-08-06. + * doc/refchan.n: for debugging and + * tests/ioCmd.test: fixing the problem. It is the write-side + equivalent to the bug fixed 2009-08-06. 2010-03-09 Don Porter @@ -2340,11 +2342,12 @@ 2010-02-21 Jan Nijtmans * generic/tclBasic.c: Fix [Bug 2954959] expr abs(0.0) is -0.0 - * tests/expr.test + * tests/expr.test: 2010-02-19 Stuart Cassoff - * tcl.m4: Correct compiler/linker flags for threaded builds on OpenBSD + * tcl.m4: Correct compiler/linker flags for threaded builds on + OpenBSD. * configure: (regenerated). 2010-02-19 Donal K. Fellows @@ -2461,8 +2464,8 @@ 2010-01-05 Don Porter - * generic/tclPathObj.c (TclPathPart): [Bug 2918610]: Correct - * tests/fileName.test (filename-14.31): inconsistency between the + * generic/tclPathObj.c (TclPathPart): [Bug 2918610]: Correct + * tests/fileName.test (filename-14.31): inconsistency between the string rep and the intrep of a path value created by [file rootname]. Thanks to Vitaly Magerya for reporting. @@ -2581,7 +2584,7 @@ * changes: Update for 8.5.8 release. - * generic/tclClock.c (TclClockInit): Do not create [clock] support + * generic/tclClock.c (TclClockInit): Do not create [clock] support commands in safe interps. * tests/io.test: New test io-53.11 to test for [Bug 2895565]. @@ -2610,10 +2613,10 @@ 2009-11-11 Alexandre Ferrieux - * generic/tclIO.c: Backported fix for [Bug 2888099] (close discards - ENOSPC error) by saving the errno from the first of two - FlushChannel()s. Uneasy to test; might need specific channel drivers. - Four-hands with aku. + * generic/tclIO.c: Fix [Bug 2888099] (close discards ENOSPC error) + by saving the errno from the first of two + FlushChannel()s. Uneasy to test; might need + specific channel drivers. Four-hands with aku. 2009-11-10 Don Porter @@ -2676,18 +2679,19 @@ 2009-10-29 Don Porter - * generic/tcl.h: [Bug 2800740]: Changed the typedef for the - mp_digit type from: + * generic/tcl.h: Changed the typedef for the mp_digit type + from: typedef unsigned long mp_digit; to: typedef unsigned int mp_digit; For 32-bit builds where "long" and "int" are two names for the same - thing, this is no change at all. For 64-bit builds, though, this + thing, this is no change at all. For 64-bit builds, though, this causes the dp[] array of an mp_int to be made up of 32-bit elements - instead of 64-bit elements. This is a huge improvement because details - elsewhere in the mp_int implementation cause only 28 bits of each - element to be actually used storing number data. Without this change - bignums are over 50% wasted space on 64-bit systems. + instead of 64-bit elements. This is a huge improvement because + details elsewhere in the mp_int implementation cause only 28 bits of + each element to be actually used storing number data. Without this + change bignums are over 50% wasted space on 64-bit systems. [Bug + 2800740]. ***POTENTIAL INCOMPATIBILITY*** For 64-bit builds, callers of routines with (mp_digit) or (mp_digit *) @@ -2701,9 +2705,9 @@ 2009-10-29 Kevin B. Kenny * library/clock.tcl (LocalizeFormat): - * tests/clock.test (clock-67.1): [Bug 2819334]: - Corrected a problem where '%%' followed by a letter in a format group - could expand recursively: %%R would turn into %%H:%M:%S. + * tests/clock.test (clock-67.1): + [Bug 2819334]: Corrected a problem where '%%' followed by a letter in + a format group could expand recursively: %%R would turn into %%H:%M:%S 2009-10-28 Don Porter @@ -2723,9 +2727,9 @@ 2009-10-27 Kevin B. Kenny - * library/clock.tcl (ParseClockScanFormat): [Bug 2886852]: - Corrected a problem where [clock scan] didn't load the timezone soon - enough when processing a time format that lacked a complete date. + * library/clock.tcl (ParseClockScanFormat): [Bug 2886852]: Corrected a + problem where [clock scan] didn't load the timezone soon enough when + processing a time format that lacked a complete date. * tests/clock.test (clock-66.1): Added a test case for the above bug. * library/tzdata/America/Argentina/Buenos_Aires: @@ -2737,11 +2741,11 @@ 2009-10-24 Kevin B. Kenny * library/clock.tcl (ProcessPosixTimeZone): - Corrected a regression in the fix to [Bug 2207436] that caused [clock] - to apply EU daylight saving time rules in the US. Thanks to Karl - Lehenbauer for reporting this regression. + Corrected a regression in the fix to [Bug 2207436] that caused + [clock] to apply EU daylight saving time rules in the US. + Thanks to Karl Lehenbauer for reporting this regression. * tests/clock.test (clock-52.4): - Added a regression test for the above regression. + Added a regression test for the above bug. * library/tzdata/Asia/Dhaka: * library/tzdata/Asia/Karachi: New DST rules for Bangladesh and Pakistan. (Olson's tzdata2009o.) @@ -2749,9 +2753,9 @@ 2009-10-23 Andreas Kupries * generic/tclIO.c (FlushChannel): Skip OutputProc for low-level - 0-length writes. When closing pipes which have already been closed not - skipping leads to spurious SIG_PIPE signals. Reported by Mikhail - Teterin . + 0-length writes. When closing pipes which have already been closed + not skipping leads to spurious SIG_PIPE signals. Reported by + Mikhail Teterin . 2009-10-21 Donal K. Fellows @@ -2760,10 +2764,10 @@ 2009-10-19 Don Porter - * generic/tclIO.c: Revised ReadChars and FilterInputBytes - routines to permit reads to continue up to the string limits of Tcl - values. Before revisions, large read attempts could panic when as - little as half the limiting value length was reached. [Patch 2107634] + * generic/tclIO.c: [Patch 2107634]: Revised ReadChars and + FilterInputBytes routines to permit reads to continue up to the string + limits of Tcl values. Before revisions, large read attempts could + panic when as little as half the limiting value length was reached. Thanks to Sean Morrison and Bob Parker for their roles in the fix. 2009-10-18 Joe Mistachkin @@ -2798,22 +2802,21 @@ 2009-10-07 Andreas Kupries - * generic/tclObj.c: [Bug 2871908]: Plug memory leaks of the - objThreadMap and lineCLPtr hashtables. Also make the names of the - continuation line information initialization and finalization - functions more consistent. Patch supplied by Joe Mistachkin - . + * generic/tclObj.c: [Bug 2871908]: Plug memory leaks of objThreadMap + and lineCLPtr hashtables. Also make the names of the continuation + line information initialization and finalization functions more + consistent. Patch supplied by Joe Mistachkin . - * generic/tclIORChan.c (ErrnoReturn): Replace the hardwired constant - 11 with the proper errno define, EAGAIN. What was I thinking? The - BSD's have a different errno assignment and break with the hardwired - number. Reported by emiliano on the chat. + * generic/tclIORChan.c (ErrnoReturn): Replace hardwired constant 11 + with proper errno #define, EAGAIN. What was I thinking? The BSD's have + a different errno assignment and break with the hardwired number. + Reported by emiliano on the chat. 2009-10-06 Don Porter * generic/tclTomMathInt.h (new): Public header tclTomMath.h had - * generic/tclTomMath.h: dependence on private headers, breaking use - * generic/tommath.h: by extensions [Bug 1941434]. + * generic/tclTomMath.h: dependence on private headers, breaking use + * generic/tommath.h: by extensions [Bug 1941434]. 2009-10-05 Don Porter @@ -2835,7 +2838,7 @@ * generic/tclAlloc.c: Cleaned up various routines in the * generic/tclCkalloc.c: call stacks for memory allocation to - * generic/tclInt.h: guarantee that any size values computed + * generic/tclInt.h: guarantee that any size values computed * generic/tclThreadAlloc.c: are within the domains of the routines they get passed to. [Bugs 2557696 and 2557796]. @@ -2853,14 +2856,14 @@ 2009-09-01 Don Porter - * library/tcltest/tcltest.tcl: Bump to tcltest 2.3.2 after revision - * library/tcltest/pkgIndex.tcl: to verbose error message. + * library/tcltest/tcltest.tcl: Bump to tcltest 2.3.2 after revision + * library/tcltest/pkgIndex.tcl: to verbose error message. * unix/Makefile.in: * win/Makefile.in: 2009-08-27 Don Porter - * generic/tclStringObj.c: [Bug 2845535]: A few more string + * generic/tclStringObj.c: [Bug 2845535]: A few more string overflow cases in [format]. 2009-08-25 Andreas Kupries @@ -2890,8 +2893,8 @@ 2009-08-24 Daniel Steffen - * macosx/tclMacOSXNotify.c: Fix multiple issues with nested event - loops when CoreFoundation notifier is running in embedded mode. (Fixes + * macosx/tclMacOSXNotify.c: Fix multiple issues with nested event loops + when CoreFoundation notifier is running in embedded mode. (Fixes problems in TkAqua Cocoa reported by Youness Alaoui on tcl-mac) 2009-08-21 Don Porter @@ -2901,10 +2904,10 @@ 2009-08-20 Don Porter - * generic/tclFileName.c: [Bug 2837800]: Get the correct result from + * generic/tclFileName.c: [Bug 2837800]: Correct the result produced by [glob */test] when * matches something like ~foo. - * generic/tclPathObj.c: [Bug 2806250]: Prevent the storage of strings + * generic/tclPathObj.c: [Bug 2806250]: Prevent the storage of strings starting with ~ in the "tail" part (normPathPtr field) of the path intrep when PATHFLAGS != 0. This establishes the assumptions relied on elsewhere that the name stored there is a relative path. Also @@ -2917,16 +2920,17 @@ 2009-08-18 Don Porter - * generic/tclPathObj.c: [Bug 2837800]: Added NULL check to prevent - * tests/fileName.test: crashes during [glob]. + * generic/tclPathObj.c: [Bug 2837800]: Added NULL check to prevent + * tests/fileName.test: crashes during [glob]. 2009-08-06 Andreas Kupries * doc/refchan.n [Bug 2827000]: Extended the implementation of - * generic/tclIORChan.c: reflective channels (TIP 219, method 'read'), - * tests/ioCmd.test: enabling handlers to signal EAGAIN to indicate 'no - data, but not at EOF either', and other system errors. Updated - documentation, extended testsuite (New test cases iocmd*-23.{9,10}). + * generic/tclIORChan.c: reflective channels (TIP 219, method + * tests/ioCmd.test: 'read'), enabling handlers to signal EAGAIN to + indicate 'no data, but not at EOF either', and other system + errors. Updated documentation, extended testsuite (New test cases + iocmd*-23.{9,10}). 2009-08-02 Donal K. Fellows @@ -2937,8 +2941,8 @@ 2009-07-31 Don Porter - * generic/tclStringObj.c: [Bug 2830354]: Corrected failure to - * tests/format.test: grow buffer when format spec request + * generic/tclStringObj.c: [Bug 2830354]: Corrected failure to + * tests/format.test: grow buffer when format spec request large width floating point values. Thanks to Clemens Misch. 2009-07-24 Andreas Kupries @@ -2998,11 +3002,12 @@ and doesn't compile eval'd code either. Reworked the handling of literal command arguments in bytecode to be - saved (compiler) and used (execution) per command (see the - TCL_INVOKE_STK* instructions), and not per the whole bytecode. This - removes the problems with location data caused by literal sharing in - proc bodies. Simplified the associated datastructures (ExtIndex is - gone, as is the function EnterCmdWordIndex). + saved (compiler) and used (execution) per command (See the + TCL_INVOKE_STK* instructions), and not per the whole bytecode. This, + and the previous change remove the problems with location data caused + by literal sharing (across whole files, but also proc bodies). + Simplified the associated datastructures (ExtIndex is gone, as is the + function EnterCmdWordIndex). 2009-07-01 Pat Thoyts @@ -3017,25 +3022,25 @@ 2009-06-13 Don Porter - * generic/tclCompile.c: The value stashed in iPtr->compiledProcPtr - * generic/tclProc.c: when compiling a proc survives too long. We - * tests/execute.test: only need it there long enough for the right - TclInitCompileEnv() call to re-stash it into envPtr->procPtr. Once - that is done, the CompileEnv controls. If we let the value of - iPtr->compiledProcPtr linger, though, then any other bytecode compile - operation that takes place will also have its CompileEnv initialized - with it, and that's not correct. The value is meant to control the - compile of the proc body only, not other compile tasks that happen - along. Thanks to Carlos Tasada for discovering and reporting the - problem. [Bug 2802881]. + * generic/tclCompile.c: [Bug 2802881]: The value stashed in + * generic/tclProc.c: iPtr->compiledProcPtr when compiling a proc + * tests/execute.test: survives too long. We only need it there long + enough for the right TclInitCompileEnv() call to re-stash it into + envPtr->procPtr. Once that is done, the CompileEnv controls. If we + let the value of iPtr->compiledProcPtr linger, though, then any other + bytecode compile operation that takes place will also have its + CompileEnv initialized with it, and that's not correct. The value is + meant to control the compile of the proc body only, not other compile + tasks that happen along. Thanks to Carlos Tasada for discovering and + reporting the problem. 2009-06-10 Don Porter - * generic/tclStringObj.c: Revised [format] to not overflow the - integer calculations computing the length of the %ll formats of - really big integers. Also added protections so that [format]s that - would produce results overflowing the maximum string length of Tcl - values throw a normal Tcl error instead of a panic. [Bug 2801413] + * generic/tclStringObj.c: [Bug 2801413]: Revised [format] to not + overflow the integer calculations computing the length of the %ll + formats of really big integers. Also added protections so that + [format]s that would produce results overflowing the maximum string + length of Tcl values throw a normal Tcl error instead of a panic. 2006-06-09 Kevin B. Kenny @@ -3050,22 +3055,22 @@ 2006-06-08 Kevin B. Kenny - * library/tzdata/Asia/Dhaka: New DST rule for Bangladesh. - (Olson's tzdata2009i.) + * library/tzdata/Asia/Dhaka: New DST rule for Bangladesh. (Olson's + tzdata2009i.) 2009-06-02 Don Porter - * generic/tclExecute.c: Replace dynamically-initialized table with - a table of static constants in the lookup table for exponent operator + * generic/tclExecute.c: Replace dynamically-initialized table with a + table of static constants in the lookup table for exponent operator computations that fit in a 64 bit integer result. - * generic/tclExecute.c: Corrected implementations and selection - logic of the INST_EXPON instruction to fix [Bug 2798543]. + * generic/tclExecute.c: [Bug 2798543]: Corrected implementations and + selection logic of the INST_EXPON instruction. 2009-06-01 Don Porter - * tests/expr.test: Added many tests demonstrating the broken - cases of [Bug 2798543]. + * tests/expr.test: [Bug 2798543]: Added many tests demonstrating + the broken cases. 2009-05-30 Kevin B. Kenny @@ -3081,14 +3086,13 @@ 2009-05-07 Miguel Sofer - * generic/tclObj.c (Tcl_GetCommandFromObj): fix for bug [2785893], - insure that a command in a deleted namespace cannot be found - through a cached name. + * generic/tclObj.c (Tcl_GetCommandFromObj): [Bug 2785893]: Ensure that + a command in a deleted namespace can't be found through a cached name. 2009-05-06 Don Porter - * generic/tclCmdMZ.c: Improve overflow error message from - [string repeat]. [Bug 2582327] + * generic/tclCmdMZ.c: [Bug 2582327]: Improve overflow error message + from [string repeat]. 2009-04-28 Jeff Hobbs @@ -3194,8 +3198,8 @@ 2009-04-09 Kevin B. Kenny - * tools/tclZIC.tcl: Always emit Unix-style line terminators. - * library/tzdata: Olson's tzdata2009e. + * tools/tclZIC.tcl: Always emit files with Unix line termination. + * library/tzdata: Olson's tzdata2009e 2009-04-09 Don Porter @@ -3206,19 +3210,19 @@ 2009-04-08 Andreas Kupries - * library/platform/platform.tcl: Extended the darwin sections to - * library/platform/pkgIndex.tcl: add a kernel version number to - * unix/Makefile.in: the identifier for anything from Leopard (10.5) - * win/Makefile.in: on up. Extended patterns for same. Extended cpu - * doc/platform.n: recognition for 64bit Tcl running on a 32bit - kernel on a 64bit processor (By Daniel Steffen). Bumped version to - 1.0.4. Updated Makefiles. + * library/platform/platform.tcl: Extended the darwin sections to add + * library/platform/pkgIndex.tcl: a kernel version number to the + * unix/Makefile.in: identifier for anything from Leopard (10.5) on up. + * win/Makefile.in: Extended patterns for same. Extended cpu + * doc/platform.n: recognition for 64bit Tcl running on a 32bit kernel + on a 64bit processor (By Daniel Steffen). Bumped version to 1.0.4. + Updated Makefiles. 2009-04-08 Don Porter - * library/tcltest/tcltest.tcl: Converted [eval]s (some unsafe!) to - * library/tcltest/pkgIndex.tcl: {*} in tcltest package. [Bug 2570363] - * unix/Makefile.in: => tcltest 2.3.1 + * library/tcltest/tcltest.tcl: [Bug 2570363]: Converted [eval]s (some + * library/tcltest/pkgIndex.tcl: unsafe!) to {*} in tcltest package. + * unix/Makefile.in: => tcltest 2.3.1 * win/Makefile.in: 2009-04-07 Don Porter @@ -3228,7 +3232,7 @@ 2009-03-30 Don Porter - * doc/Alloc.3: Size argument is "unsigned int". [Bug 2556263] + * doc/Alloc.3: [Bug 2556263]: Size argument is "unsigned int". * generic/tclStringObj.c: Added protections from invalid memory * generic/tclTestObj.c: accesses when we append (some part of) @@ -3238,24 +3242,25 @@ 2009-03-27 Don Porter - * generic/tclPathObj.c (TclPathPart): TclPathPart() was computing - * tests/fileName.test: the wrong results for both [file dirname] and - [file tail] on "path" arguments with the PATHFLAGS != 0 intrep and - with an empty string for the "joined-on" part. [Bug 2710920] + * generic/tclPathObj.c (TclPathPart): [Bug 2710920]: TclPathPart() + * tests/fileName.test: was computing the wrong results for both [file + dirname] and [file tail] on "path" arguments with the PATHFLAGS != 0 + intrep and with an empty string for the "joined-on" part. 2009-03-20 Don Porter - * generic/tclStringObj.c: Test stringObj-6.9 checks that - * tests/stringObj.test: Tcl_AppendStringsToObj() no longer - crashes when operating on a pure unicode value. [Bug 2597185] + * tests/stringObj.test: [Bug 2597185]: Test stringObj-6.9 + checks that Tcl_AppendStringsToObj() no longer crashes when operating + on a pure unicode value. - * generic/tclExecute.c (INST_CONCAT1): Panic when appends overflow - the max length of a Tcl value. [Bug 2669109] + * generic/tclExecute.c (INST_CONCAT1): [Bug 2669109]: Panic when + appends overflow the max length of a Tcl value. 2009-03-18 Don Porter - * win/tclWinFile.c (TclpObjNormalizePath): Corrected Tcl_Obj leak. - Thanks to Joe Mistachkin for detection and patch. [Bug 2688184]. + * win/tclWinFile.c (TclpObjNormalizePath): [Bug 2688184]: + Corrected Tcl_Obj leak. Thanks to Joe Mistachkin for detection and + patch. 2009-03-15 Donal K. Fellows @@ -3264,10 +3269,10 @@ 2009-02-20 Don Porter - * generic/tclPathObj.c: Fixed mistaken logic in TclFSGetPathType() - * tests/fileName.test: that assumed (not "absolute" => "relative"). - This is a false assumption on Windows, where "volumerelative" is - another possibility. [Bug 2571597]. + * generic/tclPathObj.c: [Bug 2571597]: Fixed mistaken logic in + * tests/fileName.test: TclFSGetPathType() that assumed (not + "absolute") => "relative". This is a false assumption on Windows, + where "volumerelative" is another possibility. 2009-02-17 Jeff Hobbs @@ -3277,15 +3282,15 @@ 2009-02-05 Don Porter - * generic/tclStringObj.c: Added overflow protections to the - AppendUtfToUtfRep routine to either avoid invalid arguments and - crashes, or to replace them with controlled panics. [Bug 2561794] + * generic/tclStringObj.c: [Bug 2561794]: Added overflow protections to + the AppendUtfToUtfRep routine to either avoid invalid arguments and + crashes, or to replace them with controlled panics. 2009-02-04 Don Porter - * generic/tclStringObj.c (SetUnicodeObj): Corrected failure of - Tcl_SetUnicodeObj() to panic on a shared object. [Bug 2561488]. Also - factored out common code to reduce duplication. + * generic/tclStringObj.c (SetUnicodeObj): [Bug 2561488]: + Corrected failure of Tcl_SetUnicodeObj() to panic on a shared object. + Also factored out common code to reduce duplication. * generic/tclCmdMZ.c: Prevent crashes due to int overflow of the length of the result of [string repeat]. [Bug 2561746] @@ -3310,25 +3315,25 @@ 2009-01-19 Kevin B. Kenny - * unix/Makefile.in: Added a CONFIG_INSTALL_DIR parameter so that - * unix/tcl.m4: distributors can control where tclConfig.sh goes. - Made the installation of 'ldAix' conditional - upon actually being on an AIX system. Allowed for downstream - packagers to customize SHLIB_VERSION on BSD-derived systems. - Thanks to Stuart Cassoff for [Patch 907924]. + * unix/Makefile.in: [Patch 907924]:Added a CONFIG_INSTALL_DIR + * unix/tcl.m4: parameter so that distributors can control where + tclConfig.sh goes. Made the installation of 'ldAix' conditional upon + actually being on an AIX system. Allowed for downstream packagers to + customize SHLIB_VERSION on BSD-derived systems. Thanks to Stuart + Cassoff for his help. * unix/configure: Autoconf 2.59 2009-01-09 Don Porter - * generic/tclStringObj.c (STRING_SIZE): Corrected failure to limit - memory allocation requests to the sizes that can be supported by - Tcl's memory allocation routines. [Bug 2494093]. + * generic/tclStringObj.c (STRING_SIZE): [Bug 2494093]: Corrected + failure to limit memory allocation requests to the sizes that can be + supported by Tcl's memory allocation routines. 2009-01-08 Don Porter - * generic/tclStringObj.c (STRING_UALLOC): Added missing parens - required to get correct results out of things like - STRING_UALLOC(num + append). [Bug 2494093]. + * generic/tclStringObj.c (STRING_UALLOC): [Bug 2494093]: Added missing + parens required to get correct results out of things like + STRING_UALLOC(num + append). 2009-01-06 Donal K. Fellows @@ -3345,7442 +3350,14 @@ * tests/clock.test (clock-65.1) Added a test case for the above problem [Bug 2481670]. -2008-12-21 Don Porter - - *** 8.5.6 TAGGED FOR RELEASE *** - - * generic/tcl.h: Bump to 8.5.6 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - * README: - - * unix/configure: autoconf-2.59 - * win/configure: - - * changes: Update for 8.5.6 release. - - * library/tclIndex: Removed reference to no-longer-extant procedure - 'tclLdAout'. - * doc/library.n: Corrected mention of 'auto_exec' to 'auto_execok'. - [Patch 2114900] thanks to Stu Cassoff - Backport of 2008-11-26 commit from Kevin Kenny. - - * win/tclWinThrd.c (TclpThreadCreate): We need to initialize the - thread id variable to 0 as on 64 bit windows this is a pointer sized - field while windows only fills it with a 32 bit value. The result is - an inability to join the threads as the ids cannot be matched. - Backport of 2008-10-13 commit from Pat Thoyts. - -2008-12-15 Donal K. Fellows - - * generic/tclExecute.c (TEBC:INST_DICT_GET): Make sure that the result - is empty when generating an error message. [Bug 2431847] - -2008-12-12 Jan Nijtmans - - * library/clock.tcl (ProcessPosixTimeZone): Fix time change in Eastern - Europe (not 3:00 but 4:00 local time) [Bug 2207436] - -2008-12-11 Andreas Kupries - - * generic/tclIO.c (SetChannelFromAny and related): Modified the - * tests/io.test: internal representation of the tclChannelType to - contain not only the ChannelState pointer, but also a reference to the - interpreter it was made in. Invalidate and recompute the internal - representation when it is used in a different interpreter (like - cmdName intrep's). Added testcase. [Bug 2407783] - -2008-12-11 Jan Nijtmans - - * library/clock.tcl (ProcessPosixTimeZone): Fallback to European time - zone DST rules, when the timezone is between 0 and -12. [Bug 2207436] - * tests/clock.test (clock-52.[23]): Test cases. - -2008-12-10 Kevin B. Kenny - - * library/tzdata/*: Update from Olson's tzdata2008i. - -2008-12-04 Don Porter - - * generic/tclPathObj.c (Tcl_FSGetNormalizedPath): Added another - flag value TCLPATH_NEEDNORM to mark those intreps which need more - complete normalization attention for correct results. [Bug 2385549] - -2008-12-03 Don Porter - - * generic/tclFileName.c (DoGlob): One of the Tcl_FSMatchInDirectory - calls did not have its return code checked. This caused error messages - returned by some Tcl_Filesystem drivers to be swallowed. - -2008-12-02 Andreas Kupries - - * generic/tclIO.c (TclFinalizeIOSubsystem): Replaced Alexandre - Ferrieux's first patch for [Bug 2270477] with a gentler version, also - supplied by him. - -2008-12-01 Don Porter - - * generic/tclParse.c: Backport fix for [Bug 2251175]. - -2008-11-30 Kevin B. Kenny - - * library/clock.tcl (format, ParseClockScanFormat): Added a [string - map] to get rid of namespace delimiters before caching a scan or - format procedure. [Bug 2362156] - * tests/clock.test (clock-64.[12]): Added test cases for the bug that - was tickled by a namespace delimiter inside a format string. - -2008-11-25 Andreas Kupries - - * generic/tclIO.c (TclFinalizeIOSubsystem): Applied Alexandre - Ferrieux's patch for [Bug 2270477] to prevent infinite looping during - finalization of channels not bound to interpreters. - -2008-08-23 Andreas Kupries - - * generic/tclIO.c: Backport of fix for [Bug 2333466]. - -2008-11-18 Jan Nijtmans - - * generic/tcl.decls: Fix signature and implementation of - * generic/tclDecls.h: Tcl_HashStats, such that it conforms - * generic/tclHash.c: to the documentation. [Bug 2308236] - * doc/Hash.3: - -2008-11-13 Jan Nijtmans - - * generic/tclInt.h: Rename static function FSUnloadTempFile to - * generic/tclIOUtil.c: TclFSUnloadTempFile, needed in tclLoad.c - - * generic/tclLoad.c: Fixed [Bug 2269431]: load of shared - objects leaves temporary files on windows - -2008-11-10 Andreas Kupries - - * doc/platform_shell.n: Fixed [Bug 2255235], reported by Ulrich - * library/platform/pkgIndex.tcl: Ring . - * library/platform/shell.tcl: Updated the LOCATE command in the - * library/tm.tcl: package 'platform::shell' to handle the new form - * unix/Makefile.in: of 'provide' commands generated by tm.tcl. Bumped - * win/Makefile.in: package to version 1.1.4. Added cross-references - to the relevant parts of the code to avoid future desynchronization. - -2008-11-04 Jeff Hobbs - - * generic/tclPort.h: remove the ../win/ header dir as the build system - already has it, and it confuses builds when used with private headers - installed. - -2008-10-24 Pat Thoyts - - * library/http/http.tcl: Backported a fix for reading HTTP-like - protocols that used to work and were broken with http 2.7. Now http - 2.7.2 - -2008-10-23 Don Porter - - * generic/tcl.h: Bump version number to 8.5.6b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.5 and - * unix/configure.in: 8.5.6 releases. - * unix/tcl.spec: - * win/configure.in: - * tools/tcl.wse.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - -2008-10-19 Don Porter - - * generic/tclProc.c: Reset -level and -code values to defaults - after they are used. [Bug 2152286] - -2008-10-16 Don Porter - - * library/init.tcl: Revised [unknown] so that it carefully - preserves the state of the ::errorInfo and ::errorCode variables at - the start of auto-loading and restores that state before the - autoloaded command is evaluated. [Bug 2140628] - -2008-10-10 Don Porter - - *** 8.5.5 TAGGED FOR RELEASE *** - - * generic/tcl.h: Bump to 8.5.5 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * changes: Update for 8.5.5 release. - -2008-10-08 Don Porter - - * generic/tclTrace.c: Corrected handling of errors returned by - variable traces so that the errorInfo value contains the original - error message. [Bug 2151707] - - * generic/tclVar.c: Revised implementation of TclObjVarErrMsg so - that error message construction does not disturb an existing - iPtr->errorInfo that may be in progress. - -2008-10-06 Jan Nijtmans - - * tclWinTest.c: Fix compiler warning when compiling this file with - mingw gcc: - tclWinTest.c:706: warning: dereferencing type-punned pointer will - break strict-aliasing rules - * generic/tclLoad.c: Make sure that any library which doesn't have an - unloadproc is only really unloaded when no library code is executed - yet. [Bug 2059262] - -2008-10-06 Joe Mistachkin - - * tools/man2tcl.c: Added missing line from patch by Harald Oehlmann. - [Bug 1934200] - -2008-10-05 Kevin B. Kenny - - * libtommath/bn_mp_sqrt.c (bn_mp_sqrt): Handle the case where a - * tests/expr.test (expr-47.13): number's square root is - between n< - - * tools/man2help2.tcl: Integrated patches from Harald Oehlmann. - * tools/man2tcl.c: [Bug 1934200, 1934272] - -2008-09-27 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LrepeatObjCmd): Improve the handling of the - case where the combination of number of elements and repeat count - causes the resulting list to be too large. [Bug 2130992] - -2008-09-25 Don Porter - - * doc/global.n: Correct false claim about [info locals]. - -2008-09-17 Don Porter - - * generic/tclInt.h: Correct the TclGetLongFromObj, - TclGetIntFromObj, and TclGetIntForIndexM macros so that they - retrieve the internalRep.longValue field instead of casting the - internalRep.otherValuePtr field to type long. - -2008-09-17 Miguel Sofer - - * library/init.tcl: export min and max commands from the mathfunc - namespace [Bug 2116053] - -2008-09-10 Donal K. Fellows - - * generic/tclListObj.c (Tcl_ListObjGetElements): Make this list->dict - transformation - encountered when using [foreach] with dicts - not as - expensive as it was before. Spotted by Kieran Elby and reported on - tcl-core. - -2008-09-07 Miguel Sofer - - * doc/namespace.n: fix [Bug 2098441] - -2008-08-28 Don Porter - - * generic/tcl.h: Bump version number to 8.5.5b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.4 and - * unix/configure.in: 8.5.5 releases. - * unix/tcl.spec: - * win/configure.in: - * tools/tcl.wse.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - -2008-08-22 Don Porter - - * generic/tclUtil.c (TclReToGlob): Added missing set of the - *exactPtr value to really fix [Bug 2065115]. Also avoid possible - DString overflow. - * tests/regexpComp.test: Correct duplicate test names. - -2008-08-21 Jeff Hobbs - - * tests/regexp.test, tests/regexpComp.test: correct re2glob ***= - * generic/tclUtil.c (TclReToGlob): translation from exact - to anywhere-in-string match. [Bug 2065115] - -2008-08-20 Daniel Steffen - - * generic/tclTest.c (TestconcatobjCmd): fix use of internal-only - TclInvalidateStringRep macro. - [Bug 2057479] - -2008-08-17 Miguel Sofer - - * generic/tclTest.c (TestconcatobjCmd): - * generic/tclUtil.c (Tcl_ConcatObj): - * tests/util.test (util-4.7): - fix [Bug 1447328]; the original "fix" turned Tcl_ConcatObj() into - a hairy monster. This was exposed by [Bug 2055782]. Additionally, - Tcl_ConcatObj could corrupt its input under certain conditions! - - *** NASTY BUG FIXED *** - -2008-08-14 Don Porter - - *** 8.5.4 TAGGED FOR RELEASE *** - - * tests/fileName.test: Revise new tests for portability to case - insensitive filesystems. - -2008-08-14 Daniel Steffen - - * generic/tclCompile.h: Add support for debug logging of DTrace - * generic/tclBasic.c: 'proc', 'cmd' and 'inst' probes (does - _not_ require a platform with DTrace). - - * generic/tclCmdIL.c (TclInfoFrame): Check fPtr->line before - dereferencing as line info may - not exists when TclInfoFrame() - is called from a DTrace probe. - - * tests/msgcat.test: Fix for ::tcl::mac::locale with - @modifier (HEAD backport 2008-06-01). - - * tests/fCmd.test (fCmd-6.23): Made result matching robust when test - workdir and /tmp are not on same FS. - - * unix/Makefile.in: Ensure Makefile shell is /bin/bash for - * unix/configure.in (SunOS): DTrace-enabled build on Solaris. - (followup to 2008-06-12) [Bug 2016584] - - * unix/tcl.m4 (SC_PATH_X): Check for libX11.dylib in addition to - libX11.so et al. - - * unix/configure: autoconf-2.59 - -2008-08-13 Don Porter - - * generic/tclFileName.c: Fix for errors handling -types {} - * tests/fileName.test: option to [glob]. [Bug 1750300] - Thanks to Matthias Kraft and George Peter Staplin. - -2008-08-12 Don Porter - - * changes: Update for 8.5.4 release. - -2008-08-11 Pat Thoyts - - * library/http/http.tcl: Remove 8.5 requirement. - * library/http/pkgIndex.tcl: - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: - -2008-08-11 Andreas Kupries - - * library/tm.tcl: Added a 'package provide' command to the generated - ifneeded scripts of Tcl Modules, for early detection of conflicts - between the version specified through the file name and a 'provide' - command in the module implementation, if any. Note that this change - also now allows Tcl Modules to not provide a 'provide' command at all, - and declaring their version only through their filename. - - * generic/tclProc.c (Tcl_ProcObjCmd): Fixed memory leak triggered - * tests/proc.test: by procbody::test::proc. See [Bug 2043636]. Added a - test case demonstrating the leak before the fix. Fixed a few spelling - errors in test descriptions as well. - -2008-08-11 Don Porter - - * library/http/http.tcl: Bump http version to 2.7.1 to account - * library/http/pkgIndex.tcl: for [Bug 2046486] bug fix. This - * unix/Makefile.in: release of http now requires a - * win/Makefile.in: dependency on Tcl 8.5 to be able to - * win/makefile.bc: use the unsigned formats in the - * win/makefile.vc: [binary scan] command. - -2008-08-11 Pat Thoyts - - * library/http/http.tcl: crc field from zlib data should be treated as - unsigned for 64bit support [Bug 2046846] - -2008-08-08 Don Porter - - * generic/tcl.h: Bump to 8.5.4 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * changes: Update for 8.5.4 release. - -2008-08-08 Kevin Kenny - - * library/tzdata/CET: - * library/tzdata/MET: - * library/tzdata/Africa/Casablanca: - * library/tzdata/America/Eirunepe: - * library/tzdata/America/Santarem: - * library/tzdata/America/Rio_Branco: - * library/tzdata/America/Argentina/San_Luis: - * library/tzdata/Asia/Karachi: - * library/tzdata/Europe/Belgrade: - * library/tzdata/Europe/Berlin: - * library/tzdata/Europe/Budapest: - * library/tzdata/Europe/Sofia: - * library/tzdata/Indian/Mauritius: Olson's tzdata2008e. - -2008-08-06 Don Porter - - * generic/tclVar.c (TclLookupSimpleVar): Retrieve the number of - locals in the localCache from the CallFrame and not from the Proc - which may have been mangled by a (broken?) recompile. Backport from - the HEAD. - -2008-08-04 Don Porter - - * generic/tclExecute.c: Stopped faulty double-logging of errors to - * tests/execute.test: stack trace when a compile epoch bump triggers - fallback to direct evaluation of commands in a compiled script. - [Bug 2037338] - -2008-07-30 Don Porter - - * generic/tclBasic.c: Corrected the timing of when the flag - TCL_ALLOW_EXCEPTIONS is tested. - -2008-07-29 Miguel Sofer - - * generic/tclExecute.c: fix [Bug 2030670] that cause - TclStackRealloc to panic on rare corner cases. Thx ajpasadyn for - diagnose and patch. - -2008-07-28 Andreas Kupries - - * generic/tclBasic.c: Added missing ref count when creating an empty - string as path (TclEvalEx). In 8.4 the missing code caused panics in - the testsuite. It doesn't in 8.5. I am guessing that the code path - with the missing the incr-refcount is not invoked any longer. Because - the bug in itself is certainly the same. - -2008-07-25 Daniel Steffen - - * tests/info.test (info-37.0): Add !singleTestInterp constraint; - (info-22.8, info-23.0): switch to glob matching to avoid sensitivity - to tcltest.tcl line number changes, remove knownBug constraint, fix - expected result. [Bug 1605269] - -2008-07-25 Andreas Kupries - - * tests/info.test: Tests 38.* added, exactly testing the tracking of - location for uplevel scripts. - - * generic/tclCompile.c (TclInitCompileEnv): Reorganized the - initialization of the #280 location information to match the flow in - TclEvalObjEx to get more absolute contexts. - - * generic/tclBasic.c (TclEvalObjEx): Moved the pure-list optimization - out of the eval-direct code path to be done always, i.e. even when a - compile is requested. This way we do not loose the association between - #280 location information and the list elements, if any. - -2008-07-23 Andreas Kupries - - * tests/info.test: Reordered the tests to have monotonously - increasing numbers. - - * generic/tclBasic.c: Modified TclArgumentGet to reject pure lists - * generic/tclCmdIL.c: immediately, without search. Reworked setup - * generic/tclCompile.c: of eoFramePtr, doesn't need the line - * tests/info.test: information, more sensible to have everything on - line 1 when eval'ing a pure list. Updated the users of the line - information to special case this based on the frame type (i.e. - TCL_LOCATION_EVAL_LIST). Added a testcase demonstrating the new - behaviour. - -2008-07-22 Andreas Kupries - - * generic/tclBasic.c: Added missing function comments. - - * generic/tclCompile.c: Made the new TclEnterCmdWordIndex - * generic/tclCompile.h: static, and ansified. - - * generic/tclBasic.c: Reworked the handling of bytecode literals - * generic/tclCompile.c: for #280 to fix the abysmal performance - * generic/tclCompile.h: for deep recursion, replaced the linear - * generic/tclExecute.c: search through the whole stack with another - * generic/tclInt.h: hashtable and simplified the data structure used - by the compiler (array instead of hashtable). Incidentially this also - fixes the memory leak reported via [Bug 2024937]. - -2008-07-21 Don Porter - - * tests/encoding.test: Make failing tests pass again. [Bug 1972867] - -2008-07-21 Andreas Kupries - - * generic/tclBasic.c: Extended the existing TIP #280 system (info - * generic/tclCmdAH.c: frame), added the ability to track the - * generic/tclCompCmds.c: absolute location of literal procedure - * generic/tclCompile.c: arguments, and making this information - * generic/tclCompile.h: available to uplevel, eval, and - * generic/tclInterp.c: siblings. This allows proper tracking of - * generic/tclInt.h: absolute location through custom (Tcl-coded) - * generic/tclNamesp.c: control structures based on uplevel, etc. - * generic/tclProc.c: - -2008-07-21 Pat Thoyts - - * generic/tclFCmd.c: Inodes on windows are unreliable [Bug 2015723] - -2008-07-20 Donal K. Fellows - - * generic/tclDictObj.c (SetDictFromAny): Make the list->dict - transformation a bit more efficient; modern dicts are ordered and so - we can round-trip through lists without needing the string rep at all. - * generic/tclListObj.c (SetListFromAny): Make the dict->list - transformation not lossy of internal representations and hence more - efficient. [Bug 2008248] (ajpasadyn) but using a more efficient patch. - -2008-07-15 Donal K. Fellows - - * doc/DictObj.3: Fix error in example. [Bug 2016740] - -2008-07-08 Don Porter - - * generic/tclGet.c: Corrected out of date comments. - -2008-07-07 Andreas Kupries - - * generic/tclCmdIL.c (InfoFrameCmd): Fixed unsafe idiom of setting the - interp result found by Don Porter. - -2008-07-07 Donal K. Fellows - - * doc/regexp.n, doc/regsub.n: Correct examples. [Bug 1982642] - -2008-07-04 Joe English - - * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension - when converting incomplete UTF-8 sequences. See [Bug 1908443] for - details. - -2008-07-03 Andreas Kupries - - * generic/tclIORChan.c (InvokeTclMethod): Fixed the memory leak - reported in [Bug 1987821]. Thanks to Miguel for the rpeort and Don - Porter for tracking the cause down. - -2008-07-03 Don Porter - - * library/package.tcl: Removed [file readable] testing from - [tclPkgUnknown] and friends. We find out soon enough whether a file is - readable when we try to [source] it, and not testing before allows us - to workaround the bugs on some common filesystems where [file - readable] lies to us. [Patch 1969717] - -2008-06-29 Don Porter - - *** 8.5.3 TAGGED FOR RELEASE *** - - * generic/tcl.h: Bump to 8.5.3 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * doc/ObjectType.3: Updated documentation of the Tcl_ObjType - struct to match expectations of Tcl 8.5 [Bug 1917650]. - - * generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks - Rolf Ade for detecting. - -2008-06-28 Don Porter - - * generic/tclPathObj.c: Plug memory leak in [Bug 1972879] fix. Thanks - Rolf Ade for detecting and Dan Steffen for the fix [Bug 2004654]. - -2008-06-26 Andreas Kupries - - * unix/Makefile.in: Followup to my change of 2008-06-25, make code - generated by the Makefile and put into the installd tm.tcl conditional - on interpreter safeness as well. Thanks to Daniel Steffen for - reminding me of that code. - -2008-06-25 Don Porter - - * changes: Update for 8.5.3 release. - -2008-06-25 Andreas Kupries - - * library/tm.tcl: Modified the handling of Tcl Modules and of the - * library/safe.tcl: Safe Base to interact nicely with each other, - * library/init.tcl: enabling requiring Tcl Modules in safe - * tests/safe.test: interpreters. Fixes [Bug 1999119]. - -2008-06-25 Pat Thoyts - - * win/rules.vc: Backported fix for dde/registry versions and - * win/makefile.vc: the staticpkg build option - -2008-06-24 Don Porter - - * generic/tclPathObj.c: Fixed some internals management in the "path" - Tcl_ObjType for the empty string value. Problem led to a crash in the - command [glob -dir {} a]. [Bug 1999176]. - -2008-06-23 Don Porter - - * generic/tclPathObj.c: Fixed bug in Tcl_GetTranslatedPath() when - operating on the "Special path" variant of the "path" Tcl_ObjType - intrep. A full normalization was getting done, in particular, coercing - relative paths to absolute, contrary to what the function of - producing the "translated path" is supposed to do. [Bug 1972879] - -2008-06-19 Don Porter - - * changes: Update for 8.5.3 release. - - * generic/tclInterp.c: Fixed completely boneheaded mistake that - * tests/interp.test: [interp bgerror $slave] and [$slave bgerror] - would always act like [interp bgerror {}]. [Bug 1999035] - - * tests/chanio.test: Corrected flawed tests revealed by a -debug 1 - * tests/event.test: -singleproc 1 test suite run. - * tests/io.test: - -2008-06-19 Don Porter - - * changes: Updates for 8.5.3 release. - -2008-06-17 Andreas Kupries - - * generic/tclClock.c (ClockConvertlocaltoutcObjCmd): Removed left - over debug output. - -2008-06-17 Andreas Kupries - - * doc/tm.n: Followup to changelog entry 2008-03-18 regarding - ::tcl::tm::Defaults. Updated the documentation to not only mention - the new (underscored) form of environment variable names, but make - it the encouraged form as well. See [Bug 1914604]. - -2008-06-17 Kevin Kenny - - * generic/tclClock.c (ConvertLocalToUTC): - * tests/clock.test (clock-63.1): Fixed a bug where the - internal ConvertLocalToUTC command segfaulted if passed a - dictionary without the 'localSeconds' key. To the best of - my knowledge, the bug was not observable in the [clock] - command itself. - -2008-06-16 Andreas Kupries - - * generic/tclCmdIL.c (TclInfoFrame): Backport of fix made on the - * tests/info.test: head branch :: Moved the code looking up the - information for key 'proc' out of the TCL_LOCATION_BC branch to - after the switch, this is common to all frame types. Updated the - testsuite to match. This was exposed by the 2008-06-08 commit - (Miguel), switching uplevel from direct eval to compilation. Fixes - [Bug 1987851]. - -2008-06-12 Daniel Steffen - - * unix/Makefile.in: add complete deps on tclDTrace.h. - - * unix/Makefile.in: clean generated tclDTrace.h file. - * unix/configure.in (SunOS): fix static DTrace-enabled build. - - * unix/tcl.m4 (SunOS-5.11): fix 64bit amd64 support with gcc & Sun cc. - * unix/configure: autoconf-2.59 - - * macosx/Tcl.xcodeproj/project.pbxproj: add debug configs with gcov, - and with corefoundation disabled; updates and cleanup for Xcode 3.1 and - for Leopard. - * macosx/Tcl.xcode/project.pbxproj: sync Tcl.xcodeproj changes. - * macosx/README: document new build configs. - -2008-05-26 Jeff Hobbs - - * tests/io.test (io-53.9): need to close chan before removing file. - -2008-05-23 Andreas Kupries - - * win/tclWinChan.c (FileWideSeekProc): Accepted a patch by - Alexandre Ferrieux to fix the - [Bug 1965787]. 'tell' now works for locations > 2 GB as well - instead of going negative. - - * generic/tclIO.c (Tcl_SetChannelBufferSize): Accepted a patch by - * tests/io.test: Alexandre Ferrieux - * tests/chanio.test: to fix the [Bug 1969953]. Buffersize outside - of the supported range are now clipped to nearest boundary instead - of ignored. - -2008-05-22 Don Porter - - * generic/tclNamesp.c (Tcl_LogCommandInfo): Restored ability to - handle the argument value length = -1. Thanks to Chris Darroch for - discovering the bug and providing the fix. [Bug 1968245]. - -2008-05-21 Don Porter - - * generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace - * tests/parse.test (parse-15.60): routine has no mechanism to - return the "incomplete" status of "\\\n" so calling this routine - anywhere that can be reached within a Tcl_ParseCommand call is a - mistake. In particular, ParseComment must not use it. [Bug 1968882] - -2008-05-21 Donal K. Fellows - - * generic/tclNamesp.c (Tcl_SetNamespaceUnknownHandler): Corrected odd - logic for handling installation of namespace unknown handlers which - could lead too very strange things happening in the error case. - -2008-05-16 Miguel Sofer - - * generic/tclCompile.c: Fix crash with tcl_traceExec. Found and - fixed by Alexander Pasadyn [Bug 1964803]. - -2008-05-07 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictAppendCmd): Fix silly - off-by-one error that caused a crash every time a compiled 'dict - append' with more than one value argument was used. Found by Colin - McCormack. - -2008-04-26 Zoran Vasiljevic - - * generic/tclAsync.c: Tcl_AsyncDelete(): panic if attempt to locate - handler token fails. Happens when some other thread attempts to delete - somebody else's token. - - Also, panic early if we find out the wrong thread attempting to delete - the async handler (common trap). As, only the one that created the - handler is allowed to delete it. - -2008-04-24 Andreas Kupries - - * tests/ioCmd.test: Extended testsuite for reflected channel - implementation. Added test cases about how it handles if the rug is - pulled out from under a channel (= killing threads, interpreters - containing the tcl command for a channel, and channel sitting in a - different interpreter/thread.) - - * generic/tclIORChan.c: Fixed the bugs exposed by the new testcases, - redone most of the cleanup and exit handling. - -2008-04-15 Andreas Kupries - - * generic/tclIO.c (CopyData): Applied another patch by Alexandre - * io.test (io-53.8a): Ferrieux , - * chanio.test (chan-io-53.8a): to shift EOF handling to the async - part of the command if a callback is specified, should the channel - be at EOF already when fcopy is called. Testcase by myself. - -2008-04-14 Kevin B. Kenny - - * unix/tclUnixTime.c (NativeGetTime): Removed obsolete use of - 'struct timezone' in the call to 'gettimeofday'. [Bug 1942197]. - * tests/clock.test (clock-33.5, clock-33.5a, clock-33.8, clock-33.8a): - Added comments to the test that it can fail on a heavily loaded - system. - -2008-04-11 Don Porter - - * generic/tcl.h: Bump version number to 8.5.3b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.2 and - * unix/configure.in: 8.5.3 releases. - * unix/tcl.spec: - * win/configure.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - -2008-04-10 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Keeping check for negative - values, changed to not be an error, but behave like the special - value -1 (copy all, default). - - * tests/iocmd.test (iocmd-15.{12,13}): Removed. - - * tests/io.test (io-52.5{,a,b}): Reverted last change, added - * tests/chanio.test (chan-io-52.5{,a,b}): comment regarding the - meaning of -1, added two more testcases for other negative values, - and input wrapped to negative. - -2008-04-09 Andreas Kupries - - * tests/chanio.test (chan-io-52.5): Removed '-size -1' from test, - * tests/io.test (io-52.5): does not seem to have any bearing, and - was an illegal value. - - * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Added checking of -size - * tests/ioCmd.test (iocmd-15.{13,14}): value to reject negative - values, and values overflowing 32-bit signed. [Bug 1557855]. Basic - patch by Alexandre Ferrieux , with - modifications from me to separate overflow from true negative - value. Extended testsuite. - -2008-04-08 Andreas Kupries - - * tests/io.test (io-53.8): Fixed ordering of vwait and after - cancel. cancel has to be done after the vwait completes. - -2008-04-09 Daniel Steffen - - * tests/chanio.test (chan-io-53.8,53.9,53.10): fix typo & quoting for - * tests/io.test (io-53.8,53.9,53.10): spaces in builddir path - -2008-04-07 Andreas Kupries - - * tests/io.test (io-53.10): Testcase for bi-directionaly fcopy. - * tests/chanio.test: - * generic/tclIO.c: Additional changes to data structures for fcopy - * generic/tclIO.h: and channels to perform proper cleanup in case - of a channel having two background copy operations running as is - now possible. - - * tests/io.test (io-53.10): Testcase for bi-directionaly fcopy. - * generic/tclIO.c: Additional changes to data structures for fcopy - and channels to perform proper cleanup in case of a channel having - two background copy operations running as is now possible. - -2008-04-07 Andreas Kupries - - * generic/tclIO.c (BUSY_STATE, CheckChannelErrors, - TclCopyChannel): New macro, and the places using it. This change - allows for bi-directional fcopy on channels. [Bug 1350564]. Thanks - to Alexandre Ferrieux for the - patch. - -2008-04-07 Reinhard Max - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): Fix [format {% d}] - so that it behaves the same way as in 8.4 and as C's printf(). - * tests/format.test: Add a test for '% d' and '%+d'. - -2008-04-05 Kevin B. Kenny - - * tests/chanio.test (chan-io-53.9): - * tests/io.test (io-53.9): Made test cleanup robust against the - possibility of slow process shutdown on Windows. - - * win/tcl.m4: Added -D_CRT_SECURE_NO_DEPRECATE and - -DCRT_NONSTDC_NO_DEPRECATE to the MSVC compilation flags so that - the compilation doesn't barf on perfectly reasonable Posix system - calls. - * win/configure: Manually patched (don't have the right autoconf - to hand). - - * win/tclWinFile.c: (WinSymLinkDirectory): Fixed a problem that - Tcl was creating an NTFS junction point (IO_REPARSE_TAG_MOUNT_POINT) - but filling in the union member for a Vista symbolic link. We had - gotten away with this error because the union member - (SymbolicLinkReparseBuffer) was misdefined in this file and in the - 'winnt.h' in early versions of MinGW. MinGW 3.4.2 has the correct - definition of SymbolicLinkReparseBuffer, exposing the mismatch, - and making tests cmdAH-19.4.1, fCmd-28.*, and filename-11.* fail. - -2008-04-04 Andreas Kupries - - * tests/io.test (io-53.9): Added testcase for [Bug 780533], based - * tests/chanio.test: on Alexandre's test script. Also fixed - problem with timer in preceding test, was not canceled properly in - the ok case. - -2008-04-04 Andreas Kupries - - * generic/tclIORChan.c (ReflectOutput): Allow zero return from - write when input was zero-length anyway. Otherwise keept it an - error, and separate the message from 'written too much'. - - * tests/ioCmd.test (iocmd-24.6): Testcase updated for changed - message. - - * generic/tclIORChan.c (ReflectClose): Added missing removal of - the now closed channel from the reflection map. Before we could - crash the system by invoking 'chan postevent' on a closed - reflected channel, dereferencing the dangling pointer in the map. - - * tests/ioCmd.test (iocmd-31.8): Testcase for the above. - -2008-04-03 Andreas Kupries - - * generic/tclIO.c (CopyData): Applied patch [Bug 1932639] to - * tests/io.test: prevent fcopy from calling -command synchronously - * tests/chanio.test: the first time. Thanks to Alexandre Ferrieux - for report and patch. - -2008-04-02 Andreas Kupries - - * generic/tclIO.c (CopyData): Applied patch for the fcopy problem - [Bug 780533], with many thanks to Alexandre Ferrieux - for tracking it down and - providing a solution. Still have to convert his test script into a - proper test case. - -2008-04-01 Andreas Kupries - - * generic/tclStrToD.c: Applied patch for [Bug 1839067] (fp - * unix/tcl.m4: rounding setup on solaris x86, native cc), provided - * unix/configure: by Michael Schlenker. configure regen'd. - -2008-04-01 Don Porter - - * generic/tclStubLib.c (Tcl_InitStubs): Added missing error message. - * generic/tclPkg.c (Tcl_PkgInitStubsCheck): - -2008-03-30 Kevin Kenny - - * generic/tclInt.h (TclIsNaN): - * unix/configure.in: Added code to the configurator to check for - a standard isnan() macro and use it if one - is found. This change avoids bugs where - the test of ((d) != (d)) is optimized away - by an overaggressive compiler. [Bug 1783544] - * generic/tclObj.c: Added missing #include needed to - locate isnan() after the above change. - - * unix/configure: autoconf-2.61 - - * tests/mathop.test (mathop-25.9, mathop-25.14): Modified tests - to deal with (slightly buggy) math libraries in which pow() - returns an incorrectly rounded result. [Bug 1808174] - -2008-03-26 Don Porter - - *** 8.5.2 TAGGED FOR RELEASE *** - - * generic/tcl.h: Bump to 8.5.2 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * changes: Updated for 8.5.2 release. - -2008-03-28 Donal K. Fellows - - * tests/fCmd.test: Substantial rewrite to use many more tcltest - features. Great reduction in quantity of [catch] gymnastics. Several - buggy tests fixed, including one where the result of the previous test - was being checked! - -2008-03-27 Kevin B. Kenny - - * library/tzdata/America/Marigot: - * library/tztata/America/St_Barthelemy: - * library/tzdata/America/Argentina/San_Luis: - * library/tzdata/Asia/Ho_Chi_Minh: - * library/tzdata/Asia/Kolkata: (new files) - * library/tzdata/America/Caracas: - * library/tzdata/America/Havana: - * library/tzdata/America/Santiago: - * library/tzdata/America/Argentina/Buenos_Aires: - * library/tzdata/America/Argentina/Catamarca: - * library/tzdata/America/Argentina/Cordoba: - * library/tzdata/America/Argentina/Jujuy: - * library/tzdata/America/Argentina/La_Rioja: - * library/tzdata/America/Argentina/Mendoza: - * library/tzdata/America/Argentina/Rio_Gallegos: - * library/tzdata/America/Argentina/San_Juan: - * library/tzdata/America/Argentina/Tucuman: - * library/tzdata/America/Argentina/Ushuaia: - * library/tzdata/Asia/Baghdad: - * library/tzdata/Asia/Calcutta: - * library/tzdata/Asia/Damascus: - * library/tzdata/Asia/Saigon: - * library/tzdata/Pacific/Easter: - Changes up to and including Olson's tzdata2008b. - -2008-03-27 Daniel Steffen - - * unix/tcl.m4 (SunOS-5.1x): fix 64bit support for Sun cc. [Bug 1921166] - - * unix/configure: autoconf-2.59 - -2008-03-26 Don Porter - - * changes: Updated for 8.5.2 release. - -2008-03-24 Pat Thoyts - - * generic/tclBinary.c: [Bug 1923966] - crash in binary format - * tests/binary.test: Added tests for the above crash condition. - -2008-03-21 Donal K. Fellows - - * doc/switch.n: Clarified documentation in respect of two-argument - invokation. [Bug 1899962] - - * tests/switch.test: Added more tests of regexp-mode compilation of - the [switch] command. [Bug 1854435] - -2008-03-20 Donal K. Fellows - - * generic/tcl.h, generic/tclThreadAlloc.c: Tidied up the declarations - of Tcl_GetMemoryInfo so that it is always defined. Will panic when - called against a Tcl that was previously built without it at all, - which is OK because that also indicates a serious mismatch between - memory configuration options. - -2008-03-19 Donal K. Fellows - - * generic/tcl.h, generic/tclThreadAlloc.c (Tcl_GetMemoryInfo): Make - sure this function is available when direct linking. [Bug 1868171] - - * tests/reg.test (reg-33.14): Marked nonPortable because some - environments have small default stack sizes. [Bug 1905562] - -2008-03-18 Andreas Kupries - - * library/tm.tcl (::tcl::tm::UnknownHandler): Changed 'source' to - 'source -encoding utf-8'. This fixes a portability problem of Tcl - Modules pointed out by Don Porter. By using plain 'source' we were at - the mercy of 'encoding system', making modules less portable than they - could be. The exact scenario: A writes a TM in some weird encoding - which is A's system encoding, distributes it, and somewhere else it - cannot be read/used because the system encoding is different. Forcing - the use of utf-8 makes the module portable. - - ***INCOMPATIBILITY*** for all Tcl Modules already written in non-utf-8 - compatible encodings. - -2008-03-18 Don Porter - - * generic/tclExecute.c: Patch from Miguel Sofer to correct the - alignment of memory allocated by GrowEvaluationStack(). [Bug 1914503] - -2008-03-18 Andreas Kupries - - * library/tm.tcl (::tcl::tm::Defaults): Modified handling of - environment variables. See [Bug 1914604]. Solution slightly different - than proposed in the report. Using the underscored form TCLX_y_TM_PATH - even if TCLX.y_TM_PATH exists. Also using a loop to cut prevent code - replication. - -2008-03-16 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictForCmd): Correct the handling - of stack space calculation (the jump pattern used was confusing the - simple-minded code doing the calculations). [Bug 1903325] - - * doc/lreplace.n: Clarified documentation of what happens with - negative indices. [Bug 1905809] Added example, tidied up formatting. - -2008-03-14 Don Porter - - * generic/tclBasic.c (OldMathFuncProc): Same workaround protection - from bad TclStackAlloc() alignment. Thanks George Peter Staplin. - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Use ckalloc() to allocate - SortElement arrays instead of TclStackAlloc() which isn't getting - alignment right. Workaround for [Bug 1914503]. - -2008-03-14 Reinhard Max - - * generic/tclTest.c: Ignore the return value of write() when we are - * unix/tclUnixPipe.c: about to exit anyways. - -2008-03-13 Daniel Steffen - - * unix/configure.in: Use backslash-quoting instead of double-quoting - * unix/tcl.m4: for lib paths in tclConfig.sh. [Bug 1913622] - * unix/configure: autoconf-2.59 - -2008-03-13 Don Porter - - * changes: Updated for 8.5.2 release. - - * generic/tclStrToD.c: Resolve identifier conflict over "pow10" with - libm in Cygwin and DJGPP. Thanks to Gordon Schumacher and Philip - Moore. [Patch 1800636] - -2008-03-12 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: Add support for Xcode 3.1 - * macosx/Tcl.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and - * macosx/Tcl-Common.xcconfig: 'xcodebuild install'. - -2008-03-12 Andreas Kupries - - * doc/info.n: Replaced {expand} with {*}. - -2008-03-12 Jeff Hobbs - - * unix/Makefile.in (install-libraries): Bump http to 2.7 - * win/Makefile.in (install-libraries): Added -myaddr option to allow - * library/http/http.tcl (http::geturl): control of selected socket - * library/http/pkgIndex.tcl: interface. [Bug 559898] - * doc/http.n, tests/http.test: Added -keepalive and - -protocol 1.1 with chunked transfer encoding support. [Bug 1063703, - 1470377, 219225] (default keepalive is 0) - Added ability to override Host in -headers. [Bug 928154] - Added -strict option to control URL validation on per-call basis. - [Bug 1560506] - -2008-03-11 Jeff Hobbs - - * library/http/http.tcl (http::geturl): Add -method option to support - * tests/http.test (http-3.1): http PUT and DELETE requests. - * doc/http.n: [Bug 1599901, 862554] - - * library/http/http.tcl: Whitespace changes, code cleanup. Allow http - to be re-sourced without overwriting http state. - -2008-03-11 Daniel Steffen - - * generic/tclEncoding.c (LoadEscapeEncoding): Avoid leaking escape - sub-encodings, fixes encoding-11.1 failing after iso2022-jp loaded. - [Bug 1893053] - - * macosx/tclMacOSXNotify.c: Avoid using CoreFoundation after fork() on - Darwin 9 even when TclpCreateProcess() uses vfork(). - - * macosx/Tcl.xcodeproj/project.pbxproj: Add support for Xcode 3.1 and - * macosx/Tcl.xcodeproj/default.pbxuser: configs for building with - * macosx/Tcl-Common.xcconfig: gcc-4.2 and llvm-gcc-4.2. - - * unix/tclUnixPort.h: Workaround vfork() problems - in llvm-gcc-4.2.1 -O4 build. - - * unix/tclUnixPort.h: Move MODULE_SCOPE compat define - to top [Bug 1911102]. - - * macosx/GNUmakefile: Fix quoting to allow paths to - * macosx/Tcl-Common.xcconfig: ${builddir} and ${INSTALL_ROOT} - * unix/Makefile.in: to contain spaces. - * unix/configure.in: - * unix/install-sh: - * unix/tcl.m4: - * tests/ioCmd.test: - - * unix/configure: autoconf-2.59 - - * unix/Makefile.in (install-strip): Strip non-global symbols from - dynamic library. - - * unix/tclUnixNotfy.c: Fix warning. - - * tests/exec.test (exec-9.7): Reduce timing sensitivity - * tests/socket.test (socket-2.11): (esp. on multi-proc machines). - - * tests/fCmd.test (fCmd-9.4): Skip on Darwin 9 (xfail). - -2008-03-11 Miguel Sofer - - * generic/tclVar.c (TclDeleteNamespaceVars): - * tests/var.test (var-8.2): Unset traces on vars should be called with - a FQ named during namespace deletion. This was causing infinite loops - when unset traces recreated the var, as reported by Julian Noble. [Bug - 1911919] - -2008-03-10 Don Porter - - * changes: Updated for 8.5.2 release. - - * doc/http.n: Revised to indicate that [package require http 2.5.5] - is needed to get all the documented commands ([http::meta]). - - * generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Added error - * tests/event.test (event-5.*): checking to protect against callers - passing invalid return options dictionaries. [Bug 1901113] - - * generic/tclBasic.c (ExprAbsFunc): Revised so that the abs() - * tests/expr.test: function and the [::tcl::mathfunc::abs] - command do not return the value of -0, or equivalent values with more - alarming string reps like -1e-350. [Bug 1893815] - -2008-03-07 Andreas Kupries - - * generic/tclResult.c (ReleaseKeys): Workaround for [Bug 1904907]. - Reset the return option keys to NULL to allow full re-initialization - by GetKeys(). This introduces a memory leak for the key objects, but - gets us around a crash in the finalization of reflected channels when - handling returns, either at compile- or runtime. In both cases we - access the keys after they have been released by their thread exit - handler. A proper fix is entangled with the untangling of the - finalization ordering and attendant issues. For now we choose the - lesser evil. - -2008-03-07 Don Porter - - * generic/tclExecute.c (Tcl_ExprObj): Revised expression bytecode - compiling so that bytecodes invalid due to changing context or due to - the difference between expressions and scripts are not reused. [Bug - 1899164] - - * generic/tclCmdAH.c: Revised direct evaluation implementation of - [expr] so that [expr $e] caches compiled bytecodes for the expression - as the intrep of $e. - - * tests/execute.test (execute-6.*): More tests checking that - script bytecode is invalidated in the right situations. - -2008-03-07 Donal K. Fellows - - * win/configure.in: Add AC_HEADER_STDC to support msys/win64. - -2008-03-06 Donal K. Fellows - - * doc/namespace.n: Minor tidying up. [Bug 1909019] - -2008-03-04 Don Porter - - * tests/execute.test (6.3,4): Added tests for [Bug 1899164]. - -2008-03-03 Reinhard Max - - * unix/tclUnixChan.c: Fix mark and space parity on Linux, which uses - CMSPAR instead of PAREXT. - -2008-03-02 Miguel Sofer - - * generic/tclNamesp.c (GetNamespaceFromObj): - * tests/interp.test (interp-28.2): Spoil the intrep of an nsNameType - obj when the reference crosses interpreter boundaries. - -2008-02-29 Don Porter - - * generic/tclResult.c (Tcl_SetReturnOptions): Revised the refcount - management of Tcl_SetReturnOptions to become that of a conventional - Consumer routine. Thanks to Peter Spjuth for pointing out the - difficulties calling Tcl_SetReturnOptions with non-0-count value for - options. - * generic/tclExecute.c (INST_RETURN_STK): Revised the one caller - within Tcl itself which passes a non-0-count value to - Tcl_SetReturnOptions(). - - * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Revised the - refcount management of Tcl_AppendObjToErrorInfo to become that of a - conventional Consumer routine. This preserves the ease of use for the - overwhelming common callers who pass in a 0-count value, but makes the - proper call with a non-0-count value less surprising. - * generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Revised the - one caller within Tcl itself which passes a non-0-count value to - Tcl_AppendObjToErrorInfo(). - -2008-02-28 Joe English - - * unix/tclPort.h, unix/tclCompat.h, unix/tclUnixChan.h: Reduce scope - of and #includes. [Patch 1903339] - -2008-02-28 Joe English - - * unix/tclUnixChan.c, unix/tclUnixNotfy.c, unix/tclUnixPipe.c: - Consolidate all code conditionalized on -DUSE_FIONBIO into one place. - * unix/tclUnixPort.h, unix/tclUnixCompat.c: New routine - TclUnixSetBlockingMode() [Patch 1903339]. - -2008-02-28 Don Porter - - * generic/tclBasic.c (TclEvalObjvInternal): Plug memory leak when - an enter trace deletes or changes the command, prompting a reparsing. - Don't let the second pass lose commandPtr value allocated during the - first pass. - - * generic/tclCompExpr.c (ParseExpr): Plug memory leak in error - message generation. - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): [format %llx $big] - leaked an mp_int. - - * generic/tclCompCmds.c (TclCompileReturnCmd): The 2007-10-18 commit - to optimize compiled [return -level 0 $x] [RFE 1794073] introduced a - memory leak of the return options dictionary. Fixing that. - -2008-02-27 Pat Thoyts - - * library/http/http.tcl: [Bug 705956] - fix inverted logic when - cleaning up socket error in geturl. - -2008-02-27 Kevin B. Kenny - - * doc/clock.n: Corrected minor indentation gaffe in the penultimate - paragraph. [Bug 1898025] - * generic/tclClock.c (ParseClockFormatArgs): Changed to check that the - clock value is in the range of a 64-bit integer. [Bug 1862555] - * library/clock.tcl (::tcl::clock::format, ::tcl::clock::scan, - (::tcl::clock::add, ::tcl::clock::LocalizeFormat): Fixed bugs in - caching of localized strings that caused weird results when localized - date/time formats were used. [Bug 1902423] - * tests/clock.test (clock-61.*, clock-62.1): Regression tests for [Bug - 1862555] and [Bug 1902423]. - -2008-02-26 Joe English - - * generic/tclIOUtil.c, unix/tclUnixPort.h, unix/tclUnixChan.c: - Remove dead/unused portability-related #defines and unused conditional - code. See [Patch 1901828] for discussion. - -2008-02-26 Joe English - - * generic/tclIORChan.c (enum MethodName), - * generic/tclCompExpr.c (enum Marks): More stray trailing ","s - -2008-02-26 Joe English - - * unix/configure.in(socklen_t test): Define socklen_t as "int" if - missing, not "unsigned". Use AC_TRY_COMPILE instead of - AC_EGREP_HEADER. - * unix/configure: regenerated. - -2008-02-26 Joe English - - * generic/tclCompile.h: Remove stray trailing "," from enum - InstOperandType definition (C99ism). - -2008-02-26 Jeff Hobbs - - * generic/tclUtil.c (TclReToGlob): Fix the handling of the last star - * tests/regexpComp.test: possibly being escaped in - determining right anchor. [Bug 1902436] - -2008-02-26 Pat Thoyts - - * library/http/pkgIndex.tcl: Set version 2.5.5 - * library/http/http.tcl: It is better to do the [eof] check after - trying to read from the socket. No clashes found in testing. Added - http::meta command to access the http headers. [Bug 1868845] - -2008-02-22 Pat Thoyts - - * library/http/pkgIndex.tcl: Set version 2.5.4 - * library/http/http.tcl: Always check that the state array exists - in the http::status command. [Bug 1818565] - -2008-02-13 Don Porter - - * generic/tcl.h: Bump version number to 8.5.2b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.1 and - * unix/configure.in: 8.5.2 releases. - * unix/tcl.spec: - * win/configure.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - -2008-02-12 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Corrected logic for - * tests/switch.test (switch-10.15): handling -nocase compilation; the - -exact -nocase option cannot be compiled currently. [Bug 1891827] - - * unix/README: Documented missing configure flags. [Bug 1799011] - -2008-02-06 Kevin B. Kenny - - * doc/clock.n (%N): Corrected an error in the explanation of the %N - format group. - * generic/tclClock.c (ClockParseformatargsObjCmd): - * library/clock.tcl (::tcl::clock::format): - * tests/clock.test (clock-1.0, clock-1.4): - Performance enhancements in [clock format] (moving the analysis of - $args into C code, holding on to Tcl_Objs with resolved command names, - [lassign] in place of [foreach], avoiding [namespace which] for - command resolution). - -2008-02-04 Don Porter - - *** 8.5.1 TAGGED FOR RELEASE *** - - * changes: Updated for 8.5.1 release. - - * generic/tcl.h: Bump to 8.5.1 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2008-02-04 Miguel Sofer - - * generic/tclExecute.c (INST_CONCAT1): Fix optimisation for in-place - concatenation (was going over String type) - -2008-02-02 Daniel Steffen - - * unix/configure.in (Darwin): Correct Info.plist year substitution in - non-framework builds. - - * unix/configure: autoconf-2.59 - -2008-01-30 Miguel Sofer - - * generic/tclInterp.c (Tcl_GetAlias): Fix for [Bug 1882373], thanks go - to an00na. - -2008-01-30 Donal K. Fellows - - * tools/tcltk-man2html.tcl: Reworked manual page scraper to do a - proper job of handling references to Ttk options. [Tk Bug 1876493] - -2008-01-29 Donal K. Fellows - - * doc/man.macros (SO, SE): Adjusted macros so that it is possible for - Ttk to have its "standard options" on a manual page that is not called - "options". [Tk Bug 1876493] - -2008-01-25 Don Porter - - * changes: Updated for 8.5.1 release. - -2008-01-23 Don Porter - - * generic/tclInt.h: New macro TclGrowParseTokenArray() to - * generic/tclCompCmds.c: simplify code that might need to grow - * generic/tclCompExpr.c: an array of Tcl_Tokens in the parsePtr - * generic/tclParse.c: field of a Tcl_Parse. Replaces the - TclExpandTokenArray() routine via replacing: - int needed = parsePtr->numTokens + growth; - while (needed > parsePtr->tokensAvailable) { - TclExpandTokenArray(parsePtr); - } - with: - TclGrowParseTokenArray(parsePtr, growth); - This revision merged over from dgp-refactor branch. - - * generic/tclCompile.h: Demote TclCompEvalObj() from internal stubs to - * generic/tclInt.decls: a MODULE_SCOPE routine declared in - tclCompile.h. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2008-01-22 Don Porter - - * generic/tclTimer.c (AfterProc): Replace Tcl_EvalEx() with - Tcl_EvalObjEx() to evaluate [after] callbacks. Part of trend to favor - compiled execution over direct evaluation. - -2008-01-22 Miguel Sofer - - * generic/tclCmdIl.c (Tcl_LreverseObjCmd): - * tests/cmdIL.test (cmdIL-7.7): Fix crash on reversing an empty list. - [Bug 1876793] - -2008-01-20 Jeff Hobbs - - * unix/README: Minor typo fixes [Bug 1853072] - - * generic/tclIO.c (TclGetsObjBinary): Operate on topmost channel. - [Bug 1869405] (Ficicchia) - -2008-01-17 Don Porter - - * generic/tclCompExpr.c: Revision to preserve parsed intreps of - numeric and boolean literals when compiling expressions with (optimize - == 1). - -2008-01-15 Miguel Sofer - - * generic/tclCompExpr.c: Add an 'optimize' argument to - * generic/tclCompile.c: TclCompileExpr() to profit from better - * generic/tclCompile.h: literal management according to usage. - * generic/tclExecute.c: - - * generic/tclCompExpr.c: Fix literal leak in exprs [Bug 1869989] (dgp) - * generic/tclExecute.c: - * tests/compExpr.test: - - * doc/proc.n: Changed wording for access to non-local variables; added - mention to [namespace upvar]. Lame attempt at dealing with - documentation. [Bug 1872708] - -2008-01-15 Miguel Sofer - - * generic/tclBasic.c: Replacing 'operator' by 'op' in the def of - * generic/tclCompExpr.c: struct TclOpCmdClientData to accommodate C++ - * generic/tclCompile.h: compilers. [Bug 1855644] - -2008-01-13 Jeff Hobbs - - * win/tclWinSerial.c (SerialCloseProc, TclWinOpenSerialChannel): Use - critical section for read & write side. [Bug 1353846] (newman) - -2008-01-11 Miguel Sofer - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Restore stack checking - functionality in freebsd. [Bug 1850424] - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Fix for crash in - freebsd. [Bug 1860425] - -2008-01-10 Don Porter - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): Correct failure to - * tests/format.test: account for big.used == 0 corner case in the - %ll(idox) format directives. [Bug 1867855] - -2008-01-09 George Peter Staplin - - * doc/vwait.n: Add a missing be to fix a typo. - -2008-01-04 Jeff Hobbs - - * tools/tcltk-man2html.tcl (make-man-pages): Make man page title use - more specific info on lhs to improve tabbed browser view titles. - -2008-01-02 Donal K. Fellows - - * doc/binary.n: Fixed documentation bug reported on tcl-core, and - reordered documentation to discourage people from using the hex - formatter that is hardly ever useful. - -2008-01-02 Don Porter - - * generic/tcl.h: Bump version number to 8.5.1b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.0 and - * unix/configure.in: 8.5.1 releases. - * unix/tcl.spec: - * win/configure.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-12-31 Donal K. Fellows - - * doc/dict.n: Clarified meaning of dictionary values following - discussion on comp.lang.tcl. - -2007-12-26 Miguel Sofer - - * generic/tclCmdIL.c: More [lsort] data handling streamlines. The - function MergeSort is gone, essentially inlined into Tcl_LsortObjCmd. - It is not a straight inlining, two loops over all lists elements where - merged in the process: the linked list elements are now built and - merged into the temporary sublists in the same pass. - -2007-12-25 Miguel Sofer - - * generic/tclCmdIL.c: More [lsort] data handling streamlines. Extra - mem reqs of latest patches removed, restored to previous mem profile. - Improved -unique handling, now eliminating repeated elems immediately - instead of marking them to avoid reinsertion at the end. - -2007-12-23 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileRegexpCmd): TCL_REG_NOSUB cannot - * tests/regexp.test (regexp-22.2): be used because it - * tests/regexpComp.test: [Bug 1857126] disallows backrefs. - -2007-12-21 Miguel Sofer - - * generic/tclCmdIL.c: Speed patch for lsort [Patch 1856994]. - -2007-12-21 Miguel Sofer - - * generic/tclCmdIL.c (Tcl_LsortObjCmd, Tcl_LsearchObjCmd): Avoid - calling SelectObjFromSublist when there are no sublists. - -2007-12-21 Miguel Sofer - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Preallocate a listObj of - sufficient length for the sorted list instead of growing it. Second - commit replaces calls to Tcl_ListObjAppenElement with direct access to - the internal rep. - -2007-12-19 Don Porter - - *** 8.5.0 TAGGED FOR RELEASE *** - - * changes: Updated for 8.5.0 release. - -2007-12-19 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileSwitchCmd): update switch -regexp - * tests/switch.test-14.*: compilation to pass - the cflags to INST_REGEXP (changed on 12-07). Added tests for - switch -regexp compilation (need more). [Bug 1854399] - -2007-12-18 Don Porter - - * changes: Updated for 8.5.0 release. - -2007-12-18 Donal K. Fellows - - * generic/regguts.h, generic/regc_color.c, generic/regc_nfa.c: - Fixes for problems created when processing regular expressions that - generate very large automata. An enormous number of thanks to Will - Drewry , Tavis Ormandy , - and Tom Lane from the Postgresql crowd for - their help in tracking these problems down. [Bug 1810264] - -2007-12-17 Don Porter - - * changes: Updated for 8.5.0 release. - -2007-12-17 Miguel Sofer - - * generic/tclAlloc.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclThreadAlloc.c: Fix alignment for memory returned by - TclStackAlloc; insure that all memory allocators align to 16-byte - boundaries on 64 bit platforms [Bug 1851832, 1851524] - -2007-12-14 Jeff Hobbs - - * generic/tclIOUtil.c (FsAddMountsToGlobResult): fix the tail - conversion of vfs mounts. [Bug 1602539] - - * win/README: updated notes - -2007-12-14 Pat Thoyts - - * tests/winFile.test: Fixed tests for win2k with long machine name - -2007-12-14 Pat Thoyts - - * win/nmakehlp.c: Support compilation with MSVC9 for AMD64. - * win/makefile.vc: - -2007-12-13 Donal K. Fellows - - * doc/trace.n: Clarified documentation of enterstep and leavestep - traces, including adding example. [Bug 614282, 1701540, 1755984] - -2007-12-12 Don Porter - - * doc/IntObj.3: Update docs for the Tcl_GetBignumAndClearObj() -> - Tcl_TakeBignumFromObj() revision [TIP 298]. Added docs for the - Tcl_InitBignumFromDouble() routine. [Bug 1446971]. - - * changes: Updated for 8.5.0 release. - -2007-12-10 Jeff Hobbs - - * generic/tclUtil.c (TclReToGlob): reduce escapes in conversion - when not necessary - - * generic/tclInt.decls: move TclByteArrayMatch and TclReToGlob - * generic/tclIntDecls.h: to tclInt.h from stubs. - * generic/tclStubInit.c: Add flags var to TclByteArrayMatch for - * generic/tclInt.h: future extensibility - * generic/tcl.h: define TCL_MATCH_EXACT doc for Tcl_StringCaseMatch. - * doc/StrMatch.3: It is compatible with existing usage. - * generic/tclExecute.c (INST_STR_MATCH): flag for TclByteArrayMatch - * generic/tclUtil.c (TclByteArrayMatch, TclStringMatchObj): - * generic/tclRegexp.c (Tcl_RegExpExecObj): - * generic/tclCmdMZ.c (StringMatchCmd): Use TclStringMatchObj - * tests/string.test (11.9.* 11.10.*): more tests - -2007-12-10 Joe English - - * doc/string.n, doc/UniCharIsAlpha.3: Fix markup errors. - * doc/CrtCommand.3, doc/CrtMathFnc.3, doc/FileSystem.3, - * doc/GetStdChan.3, doc/OpenFileChnl.3, doc/SetChanErr.3, - * doc/eval.n, doc/filename.n: Consistency: Move "KEYWORDS" section - after "SEE ALSO". - -2007-12-10 Daniel Steffen - - * tools/genStubs.tcl: fix numerous issues handling 'macosx', - 'aqua' or 'x11' entries interleaved - with 'unix' entries [Bug 1834288]; add - genStubs::export command - [Tk FR 1716117]; cleanup formatting. - - * generic/tcl.decls: use new genstubs 'export' command to - * generic/tclInt.decls: mark exported symbols not in stubs - * generic/tclTomMath.decls: table [Tk FR 1716117]; cleanup - formatting. - - * generic/tclDecls.h: regen with new genStubs.tcl. - * generic/tclIntDecls.h: [Bug 1834288] - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclStubInit.c: - -2007-12-09 Jeff Hobbs - - * tests/io.test, tests/chanio.test (io-73.1): Make sure to invalidate - * generic/tclIO.c (SetChannelFromAny): internal rep only after - validating channel rep. [Bug 1847044] - -2007-12-08 Donal K. Fellows - - * doc/expr.n, doc/mathop.n: Improved the documentation of the - operators. [Bug 1823622] - - * generic/tclBasic.c (builtInCmds): Corrected list of hidden and - * doc/interp.n (SAFE INTERPRETERS): exposed commands so that the - documentation and reality now match. [Bug 1662436] - -2007-12-07 Jeff Hobbs - - * generic/tclExecute.c (TclExecuteByteCode INST_REGEXP): - * generic/tclCompCmds.c (TclCompileRegexpCmd): Pass correct RE - compile flags at compile time, and use TCL_REG_NOSUB. - - * generic/tclIOCmd.c (FinalizeIOCmdTSD, Tcl_PutsObjCmd): cache - stdout channel object for [puts $str] calls. - -2007-12-06 Don Porter - - * README: Remove mention of dead comp.lang.tcl.announce - newsgroup. [Bug 1846433]. - - * unix/README: Mention the stub library created by `make` and warn - about the effect of embedded paths in the installed binaries. - Thanks to Larry Virden. [Bug 1794084] - - * doc/AddErrInfo.3: Documentation for the new routines in TIP 270. - * doc/Interp.3: - * doc/StringObj.3: - -2007-12-06 Don Porter - - * doc/namespace.n: Documentation for zero-argument form of - [namespace import] (TIP 261) [Bug 1596416] - -2007-12-06 Jeff Hobbs - - * generic/tclInt.h: add TclGetChannelFromObj decl - (TclMatchIsTrivial): simplify TclMatchIsTrivial to remove ] check. - -2007-12-06 Donal K. Fellows - - - * generic/tclBasic.c (Tcl_CreateInterp): Simplify the setting up of - * generic/tclIOCmd.c (TclInitChanCmd): the [chan] ensemble. This - * library/init.tcl: gets rid of quite a bit of - code and makes it possible to understand the whole with less effort. - - * generic/tclCompCmds.c (TclCompileEnsemble): Ensure that the right - number of tokens are copied. [Bug 1845320] - - * generic/tclNamesp.c (TclMakeEnsemble): Added missing release of a - DString. [Bug 1845397] - -2007-12-05 Jeff Hobbs - - * generic/tclIO.h: Create Tcl_Obj for Tcl channels to reduce - * generic/tclIO.c: overhead in lookup by Tcl_GetChannel. New - * generic/tclIOCmd.c: TclGetChannelFromObj for internal use. - * generic/tclIO.c (WriteBytes, WriteChars): add opt check to avoid - EOL translation when not linebuffered or using lf. [Bug 1845092] - -2007-12-05 Miguel Sofer - - * tests/stack.test: made the tests for stack overflow not care - about which mechanism caused the error (interp's recursion limit - or C-stack depth detector). - -2007-12-05 Jeff Hobbs - - * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 - -loleaut32 but not msvc for Tk's [send]. [Bug 1844749] - -2007-12-05 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Prevent shimmering crash - when -exact and -integer/-real are mixed. [Bug 1844789] - -2007-12-03 Donal K. Fellows - - * unix/tclUnixChan.c (CreateSocketAddress): Add extra #ifdef-fery to - make code compile on BSD 5. [Bug 1618235, again] - -2007-12-03 Don Porter - - * library/tcltest/tcltest.tcl: Bump tcltest to version 2.3.0 so that - * library/tcltest/pkgIndex.tcl: we release a stable tcltest with a - * unix/Makefile.in: stable Tcl. - * win/Makefile.in: - -2007-12-03 Jeff Hobbs - - * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib - -2007-12-03 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Adjusted the [switch] - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): command so that when - passed two arguments, no check for options are performed. This is OK - since in the two-arg case, detecting an option would definitely lead - to a syntax error. [Patch 1836519] - -2007-11-29 Jeff Hobbs - - * win/makefile.vc: add ws2_32.lib to baselibs - * win/configure, win/tcl.m4: add ws2_32.lib / -lws2_32 to build. - * win/tclWinSock.c: remove dyn loading of winsock, assume that it is - always available now. - -2007-11-29 Don Porter - - * generic/tclWinSock.c (InitializeHostName): Correct error in - buffer length tracking. After gethostname() writes into a buffer, - convert only the written string to internal encoding, not the whole - buffer. - -2007-11-28 Don Porter - - * generic/tclConfig.c: Corrected failure of the [::foo::pkgconfig] - command to clean up registered configuration data when the query - command is deleted from the interp. [Bug 983501] - - * generic/tclNamesp.c (Tcl_SetEnsembleMappingDict): Added checks - that the dict value passed in is in the format required to make the - internals of ensembles work. [Bug 1436096] - - * generic/tclIO.c: Simplify test and improve accuracy of error - message in latest changes. - -2007-11-28 Pat Thoyts - - * generic/tclIO.c: -eofchar must support no eofchar. - -2007-11-27 Miguel Sofer - - * generic/tclBasic.c: remove unneeded call in Tcl_CreateInterp, add - comments. - -2007-11-27 Don Porter - - * win/tclWinSock.c: Add mising encoding conversion of the [info - hostname] value from the system encoding to Tcl's internal encoding. - - * doc/chan.n: "Fix" the limitation on channel -eofchar - * doc/fconfigure.n: values to single byte characters by documenting - * generic/tclIO.c: it and making it fail loudly. Thanks to Stuart - * tests/chan.test: Cassoff for contributing the fix. [Bug 800753] - -2007-11-26 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclInt.h: - * unix/tclUnixInit.c: - * unix/tclUnixThrd.c: Fix stack checking via workaround for bug in - glibc's pthread_attr_get_np, patch from [Bug 1815573]. Many thanks to - Sergei Golovan (aka Teo) for detecting the bug and helping diagnose - and develop the fix. - -2007-11-24 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictAppendCmd): Fix bug in [dict - append] compiler which caused strange stack corruption. [Bug 1837392] - -2007-11-23 Andreas Kupries - - * generic/tclIORChan.c: Fixed a problem with reflected channels. 'chan - postevent' is defined to work only from within the interpreter - containing the handler command. Sensible, we want only handler - commands to use it. It identifies the channel by handle. The channel - moves to a different interpreter or thread. The interpreter containing - the handler command doesn't know the channel any longer. 'chan - postevent' fails, not finding the channel any longer. Uhm. - - Fixed by creating a second per-interpreter channel table, just for - reflected channels, where each interpreter remembers for which - reflected channels it has the handler command. This info does not move - with the channel itself. The table is updated by 'chan create', and - used by 'chan postevent'. - - * tests/ioCmd.test: Updated the testsuite. - -2007-11-23 Jeff Hobbs - - * generic/tclVar.c (Tcl_ArrayObjCmd): handle the right data for - * tests/var.test (var-14.2): [array names $var -glob $ptn] - -2007-11-23 Donal K. Fellows - - * generic/tclCmdMZ.c (String*Cmd, TclInitStringCmd): Rebuilt [string] - * generic/tclCompCmds.c (TclCompileString*Cmd): as an ensemble. - -2007-11-22 Donal K. Fellows - - * generic/tclDictObj.c (Dict*Cmd,TclInitDictCmd): Rebuilt the [dict] - * generic/tclCompCmds.c (TclCompileDict*Cmd): command as an ensemble. - -2007-11-22 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Rewrote the [string] and - * generic/tclDictObj.c (Tcl_DictObjCmd): [dict] implementations to be - ready for conversion to ensembles. - - * tests/string.test (string-12.22): Flag shimmering bug found in - [string range]. - -2007-11-21 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileEnsemble): Rewrote the ensemble - compiler to remove many of the limitations. Can now compile scripts - that use unique prefixes of subcommands, and which have mappings of a - command to multiple words (provided the first is a compilable command - of course). - -2007-11-21 Donal K. Fellows - - * generic/tclNamesp.c (TclMakeEnsemble): Factor out the code to set up - a core ensemble from a table of information about subcommands, ready - for reuse within the core. - - * generic/various: Start to return more useful Error codes, currently - mainly on assorted lookup failures. - -2007-11-20 Donal K. Fellows - - * generic/tclDictObj.c: Changed the underlying implementation of the - hash table used in dictionaries to additionally keep all entries in - the hash table in a linked list, which is only ever added to at the - end. This makes iteration over all entries in the dictionary in - key insertion order a trivial operation, and so cleans up a great deal - of complexity relating to dictionary representation and stability of - iteration order. - - ***POTENTIAL INCOMPATIBILITY*** - For any code that depended on the (strange) old iteration order. - - * generic/tclConfig.c (QueryConfigObjCmd): Correct usage of - Tcl_WrongNumArgs. - -2007-11-19 Don Porter - - *** 8.5b3 TAGGED FOR RELEASE *** - - * README: Bump version number to 8.5b3. - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - - * changes: Updated for 8.5b3 release. - -2007-11-19 Kevin Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/America/Campo_Grande: - * library/tzdata/America/Caracas: - * library/tzdata/America/Cuiaba: - * library/tzdata/America/Havana: - * library/tzdata/America/Sao_Paulo: - * library/tzdata/Asia/Damascus: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Tehran: Olson's tzdata2007i imported. - -2007-11-18 Daniel Steffen - - * generic/tclExecute.c (TclExecuteByteCode:INST_EXIST_*): Fix read - traces not firing on non-existent array elements. [Bug 1833522] - -2007-11-16 Donal K. Fellows - - * generic/tclCmdIL.c (TclInitInfoCmd): Rename the implementation - commands for [info] to be something more "expected". - - * generic/tclCompCmds.c (TclCompileInfoExistsCmd): Compiler for the - [info exists] subcommand. - (TclCompileEnsemble): Cleaned up version of ensemble compiler that was - in TclCompileInfoCmd, but which is now much more generally applicable. - - * generic/tclInt.h (ENSEMBLE_COMPILE): Added flag to allow for cleaner - turning on and off of ensemble bytecode compilation. - - * generic/tclCompile.c (TclCompileScript): Add the cmdPtr to the list - of arguments passed to command compilers. - -2007-11-15 Don Porter - - * generic/regc_nfa.c: Fixed infinite loop in the regexp compiler. - [Bug 1810038] - - * generic/regc_nfa.c: Corrected looping logic in fixempties() to - avoid wasting time walking a list of dead states. [Bug 1832612] - -2007-11-15 Donal K. Fellows - - * generic/tclNamesp.c (NamespaceEnsembleCmd): Must pass a non-NULL - interp to Tcl_SetEnsemble* functions. - - * doc/re_syntax.n: Try to make this easier to read. It's still a very - difficult manual page! - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Allow people to turn off the -rpath - option to their linker if they so desire. This is a configuration only - recommended for (some) vendors. Relates to [Patch 1231022]. - -2007-11-15 Pat Thoyts - - * win/tclWin32Dll.c: Prefer UINT_PTR to DWORD_PTR when casting pointers - to integer types for greater portability. [Bug 1831253] - -2007-11-15 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: add new chanio.test. - * macosx/Tcl.xcode/project.pbxproj: - -2007-11-14 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Ensure that we get our count - in our INST_START_CMD calls right, even when there's a failure to - compile a command directly. - - * generic/tclNamesp.c (Tcl_SetEnsembleSubcommandList) - (Tcl_SetEnsembleMappingDict): Special code to make sure that - * generic/tclCmdIL.c (TclInitInfoCmd): [info exists] is compiled right - while not allowing changes to the ensemble to cause havok. - - * generic/tclCompCmds.c (TclCompileInfoCmd): Simple compiler for the - [info] command that only handles [info exists]. - - * generic/tclExecute.c (TclExecuteByteCode:INST_EXIST_*): New - instructions to allow the testing of whether a variable exists. - -2007-11-14 Andreas Kupries - - * tests/chanio.test: New file. This is essentially a duplicate of - 'io.test', with all channel commands converted to their 'chan xxx' - notation. - * tests/io.test: Fixed typo in test description. - -2007-11-14 Donal K. Fellows - - * generic/regc*.c: Eliminate multi-char collating element code - completely. Simplifies the code quite a bit. If people still want the - full code, it will remain on the 8.4 branch. [Bug 1831425] - -2007-11-13 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileRegexpCmd): clean up comments, only - free dstring on OK from TclReToGlob. - (TclCompileSwitchCmd): simplify TclReToGlob usage. - -2007-11-14 Donal K. Fellows - - * generic/regc*.c: #ifdef/comment out the code that deals with - multi-character collating elements, which have never been supported. - Cuts the memory consumption of the RE compiler. [Bug 1831425] - -2007-11-13 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd, TclCompileRegexpCmd): - Extend [switch] compiler to handle regular expressions as long as - things are not too complex. Fix [regexp] compiler so that non-trivial - literal regexps get fed to INST_REGEXP. - - * doc/mathop.n: Clarify definitions of some operations. - -2007-11-13 Miguel Sofer - - * unix/tclUnixInit.c: the TCL_NO_STACK_CHECK was being incorrectly - undefined here; this should be set (or not) in the compile options, it - is used elsewhere and needs to be consistent. - -2007-11-13 Pat Thoyts - - * unix/tcl.m4: Added autoconf goo to detect and make use of - * unix/configure.in: getaddrinfo and friends. - * unix/configure: (regenerated) - -2007-11-13 Donal K. Fellows - - * unix/tclUnixCompat.c (TclpGetHostByName): The six-argument form of - getaddressbyname_r() uses the fifth argument to indicate whether the - lookup succeeded or not on at least one platform. [Bug 1618235] - -2007-11-13 Don Porter - - * generic/regcomp.c: Convert optst() from expensive no-op to a - cheap no-op. - -2007-11-13 Donal K. Fellows - - * unix/tclUnixChan.c (CreateSocketAddress): Rewrote to use the - thread-safe version of gethostbyname() by forward-porting the code used - in 8.4, and added rudimentary support for getaddrinfo() (not enabled by - default, as no autoconf-ery written). Part of fix for [Bug 1618235]. - -2007-11-12 Jeff Hobbs - - * generic/tclGet.c (Tcl_Get, Tcl_GetInt): revert use of TclGet* macros - due to compiler warning. These cases won't save time either. - - * generic/tclUtil.c (TclReToGlob): add more comments, set interp result - if specified on error. - -2007-11-12 Miguel Sofer - - * generic/tclBasic.c: New macro TclResetResult, new iPtr flag - * generic/tclExecute.c: bit INTERP_RESULT_UNCLEAN: shortcut for - * generic/tclInt.h: Tcl_ResetResult for the "normal" case: - * generic/tclProc.c: TCL_OK, no return options, no errorCode - * generic/tclResult.c: nor errorInfo, return at normal level. - * generic/tclStubLib.c: [Patch 1830184] - * generic/tclUtil.c: - - THIS PATCH WAS REVERTED: initial (mis)measurements overstated the - perfomance wins, which turn out to be tiny. Not worth the complication. - -2007-11-11 Jeff Hobbs - - * generic/tclCompCmds.c, generic/tclCompile.c, generic/tclCompile.h: - * generic/tclExecute.c, generic/tclInt.decls, generic/tclIntDecls.h: - * generic/tclRegexp.c, generic/tclRegexp.h: Add INST_REGEXP and fully - * generic/tclStubInit.c, generic/tclUtil.c: compiled [regexp] for the - * tests/regexpComp.test: [Bug 1830166] simple cases. Also added - TclReToGlob function to convert RE to glob patterns and use these in - the possible cases. - -2007-11-11 Miguel Sofer - - * generic/tclResult.c (ResetObjResult): clarify the logic. - - * generic/tclBasic.c: Increased usage of macros to detect - * generic/tclBinary.c: and take advantage of objTypes. Added - * generic/tclClock.c: macros TclGet(Int|Long)FromObj, - * generic/tclCmdAH.c: TclGetIntForIndexM & TclListObjLength, - * generic/tclCmdIL.c: modified TclListObjGetElements. - * generic/tclCmdMZ.c: - * generic/tclCompCmds.c: The TclGetInt* macros are only a - * generic/tclCompExpr.c: shortcut on platforms where 'long' is - * generic/tclCompile.c: 'int'; it may be worthwhile to extend - * generic/tclDictObj.c: their functionality to other cases. - * generic/tclExecute.c: - * generic/tclGet.c: As this patch touches many files it has - * generic/tclIO.c: been recorded as [Patch 1830038] in - * generic/tclIOCmd.c: order to facilitate reviewing. - * generic/tclIOGT.c: - * generic/tclIndexObj.c: - * generic/tclInt.h: - * generic/tclInterp.c: - * generic/tclListObj.c: - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclParse.c: - * generic/tclProc.c: - * generic/tclRegexp.c: - * generic/tclResult.c: - * generic/tclScan.c: - * generic/tclStringObj.c: - * generic/tclUtil.c: - * generic/tclVar.c: - -2007-11-11 Daniel Steffen - - * unix/tclUnixTime.c (TclpWideClicksToNanoseconds): Fix issues with - * generic/tclInt.h: int64_t overflow. - - * generic/tclBasic.c: Fix stack check failure case if stack grows up - * unix/tclUnixInit.c: Simplify non-crosscompiled case. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-11-10 Miguel Sofer - - * generic/tclExecute.c: Fast path for INST_LIST_INDEX when the index is - not a list. - - * generic/tclBasic.c: - * unix/configure.in: - * unix/tclUnixInit.c: Detect stack grwoth direction at compile time, - only fall to runtime detection when crosscompiling. - - * unix/configure: autoconf 2.61 - - * generic/tclBasic.c: - * generic/tclInt.h: - * tests/interp.test: - * unix/tclUnixInit.c: - * win/tclWin32Dll.c: Restore simpler behaviour for stack checking, not - adaptive to stack size changes after a thread is launched. Consensus is - that "nobody does that", and so it is not worth the cost. Improved - failure comments (mistachkin). - -2007-11-10 Kevin Kenny - - * win/tclWin32Dll.c: Rewrote the Windows stack checking algorithm to - use information from VirtualQuery to determine the bound of the stack. - This change fixes a bug where the guard page of the stack was never - restored after an overflow. It also eliminates a nasty piece of - assembly code for structured exception handling on mingw. It introduces - an assumption that the stack is a single memory arena returned from - VirtualAlloc, but the code in MSVCRT makes the same assumption, so it - should be fairly safe. - -2007-11-10 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclInt.h: - * unix/tclUnixInit.c: - * unix/tclUnixPort.h: - * win/tclWin32Dll.c: Modify the stack checking algorithm to recheck in - case of failure. The working assumptions are now that (a) a thread's - stack is never moved, and (b) a thread's stack can grow but not shrink. - Port to windows - could be more efficient, but is already cheaper than - it was. - -2007-11-09 Miguel Sofer - - * generic/tclResult.c (ResetObjResult): new shortcut. - - * generic/tclAsync.c: - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclUnixInit.c: - * generic/tclUnixPort.h: New fields in interp (ekeko!) to cache TSD - data that is accessed at each command invocation, access macros to - replace Tcl_AsyncReady and TclpCheckStackSpace by much faster variants. - [Patch 1829248] - -2007-11-09 Jeff Hobbs - - * generic/tclInt.decls, generic/tclIntDecls.h: Use unsigned char for - * generic/tclExecute.c, generic/tclUtil.c: TclByteArrayMatch and - don't allow a nocase option. [Bug 1828296] - For INST_STR_MATCH, ignore pattern type for TclByteArrayMatch case. - - * generic/tclBinary.c (Tcl_GetByteArrayFromObj): check type before - func jump (perf). - -2007-11-07 Jeff Hobbs - - * generic/tclStubInit.c: Added TclByteArrayMatch - * generic/tclInt.decls: for efficient glob - * generic/tclIntDecls.h: matching of ByteArray - * generic/tclUtil.c (TclByteArrayMatch): Tcl_Objs, used in - * generic/tclExecute.c (TclExecuteByteCode): INST_STR_MATCH. [Bug - 1827996] - - * generic/tclIO.c (TclGetsObjBinary): Add an efficient binary path for - [gets]. - (DoWriteChars): Special case for 1-byte channel write. - -2007-11-06 Miguel Sofer - - * generic/tclEncoding.c: Version of the embedded iso8859-1 encoding - handler that is faster (functions to do the encoding know exactly what - they're doing instead of pulling it from a table, though the table - itself has to be retained for use by shift encodings that depend on - iso8859-1). [Patch 1826906], committing for dkf. - -2007-11-05 Andreas Kupries - - * generic/tclConfig.c (Tcl_RegisterConfig): Modified to not extend the - config database if the encoding provided by the user is not found - (venc == NULL). Scripts expecting the data will error out, however we - neither crash nor provide bogus information. See [Bug 983509] for more - discussion. - - * unix/tclUnixChan.c (TtyGetOptionProc): Accepted [Patch 1823576] - provided by Stuart Cassof . The patch adds - the necessary utf/external conversions to the handling of the arguments - of option -xchar which will allow the use of \0 and similar characters. - -2007-11-03 Miguel Sofer - - * generic/tclTest.c (TestSetCmd2): - * generic/tclVar.c (TclObjLookupVarEx): - * tests/set.test (set-5.1): Fix error branch when array name looks - like array element (code not normally exercised). - -2007-11-01 Donal K. Fellows - - * tools/tcltk-man2html.tcl (output-directive): Convert .DS/.DE pairs - into tables since that is now all that they are used for. - - * doc/RegExp.3: Clarified documentation of RE flags. [Bug 1167840] - - * doc/refchan.n: Adjust internal name to be consistent with the file - name for reduced user confusion. After comment by Dan Steffen. - - * generic/tclCmdMZ.c (Tcl_StringObjCmd, UniCharIsAscii): Remember, the - NUL character is in ASCII too. [Bug 1808258] - - * doc/file.n: Clarified use of [file normalize]. [Bug 1185154] - -2007-10-30 Don Porter - - * generic/tcl.h: Bump version number to 8.5b2.1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5b2 - * unix/configure.in: release. - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-10-30 Donal K. Fellows - - * doc/expr.n, doc/mathfunc.n: Improve documentation to try to make - clearer what is going on. - - * doc/interp.n: Shorten the basic descriptive text for some interp - subcommands so Solaris nroff doesn't truncate them. [Bug 1822268] - -2007-10-30 Donal K. Fellows - - * tools/tcltk-man2html.tcl (output-widget-options): Enhance the HTML - generator so that it can produce multi-line option descriptions. - -2007-10-28 Miguel Sofer - - * generic/tclUtil.c (Tcl_ConcatObj): optimise for some of the - concatenees being empty objs. [Bug 1447328] - -2007-10-28 Donal K. Fellows - - * generic/tclEncoding.c (TclInitEncodingSubsystem): Hard code the - iso8859-1 encoding, as it's needed for more than just text (especially - binary encodings...) Note that other encodings rely on the encoding - being a table encoding (!) so we can't use more efficient encoding - mapping functions. - -2007-10-27 Donal K. Fellows - - * generic/regc_lex.c (lexescape): Close off one of the problems - mentioned in [Bug 1810264]. - -2007-10-27 Miguel Sofer - - * generic/tclNamesp.c (Tcl_FindCommand): insure that FQ command names - are searched from the global namespace, ie, bypassing resolvers of the - current namespace. [Bug 1114355] - - * doc/apply.n: fixed example [Bug 1811791] - * doc/namespace.n: improved example [Bug 1788984] - * doc/AddErrInfo.3: typo [Bug 1715087] - * doc/CrtMathFnc.3: fixed Tcl_ListMathFuncs entry [Bug 1672219] - - * generic/tclCompile.h: - * generic/tclInt.h: moved declaration of TclSetCmdNameObj from - tclCompile.h to tclInt.h, reverting linker [Bug 1821159] caused by - commit of 2007-10-11 (both I and gcc missed one dep). - - * generic/tclVar.c: try to preserve Tcl_Objs when doing variable - lookups by name, partially addressing [Bug 1793601]. - -2007-10-27 Donal K. Fellows - - * tools/tcltk-man2html.tcl (make-man-pages, htmlize-text) - (process-text): Make the man->HTML scraper work better. - -2007-10-26 Don Porter - - *** 8.5b2 TAGGED FOR RELEASE *** - - * changes: Updated for 8.5b2 release. - - * doc/*.1: Revert doc changes that broke - * doc/*.3: `make html` so we can get the release - * doc/*.n: out the door. - - * README: Bump version number to 8.5b2. - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-10-26 Donal K. Fellows - - * tools/man2help2.tcl, tools/man2tcl.c: Made some of the tooling code - to do man->other formats work better with current manpage set. Long - way still to go. - -2007-10-25 Zoran Vasiljevic - - * generic/tclThread.c: Added TclpMasterLock/Unlock arround calls to - ForgetSyncObject in Tcl_MutexFinalize and Tcl_ConditionFinalize to - prevent from garbling the internal lists that track sync objects. [Bug - 1726873] - -2007-10-24 Donal K. Fellows - - * tools/man2html2.tcl (macro): Added support for converting the new - macros into HTML. - - * doc/man.macros (QW,PQ,QR,MT): New macros that hide the ugly mess - needed to get proper GOOBE quoting in the manual pages. - * doc/*.n, doc/*.3, doc/*.1: Lots of changes to take advantage of the - new macros. - -2007-10-20 Miguel Sofer - - * generic/tclCompile.c: Fix comments. - * generic/tclExecute.c: - -2007-10-18 David Gravereaux - - * tools/mkdepend.tcl: sort the dep list for a more humanly readable - output. - -2007-10-18 Don Porter - - * generic/tclResult.c (TclMergeReturnOptions): Make sure any -code - values get pulled out of the dictionary, even if they are integer - valued. - - * generic/tclCompCmds.c (TclCompileReturnCmd): Added code to more - optimally compile [return -level 0 $x] to "push $x". [RFE 1794073] - - * compat/tmpnam.c (removed): The routine tmpnam() is no longer - * unix/Makefile.in: called by Tcl source code. Remove autogoo the - * unix/configure.in: supplied a replacement version on systems - * win/tcl.dsp: where the routine was not available. [RFE - 1811848] - - * unix/configure: autoconf-2.59 - - * generic/tcl.h: Remove TCL_LL_MODIFIER_SIZE. [RFE 1811837] - -2007-10-17 David Gravereaux - - * tools/mkdepend.tcl: Improved defense from malformed object list - infile. - -2007-10-17 Donal K. Fellows - - * tools/man2html2.tcl: Convert .DS/.DE into HTML tables, not - preformatted text. - -2007-10-17 Kevin B. Kenny - - * generic/tclCompExpr.c: Moved a misplaced declaration that blocked - compilation on VC++. - * generic/tclExecute.c: Silenced several VC++ compiler warnings about - converting 'long' to 'unsigned short'. - -2007-10-16 David Gravereaux - - * win/makefile.vc: removed old dependency cruft that is no longer - needed. - -2007-10-15 Don Porter - - * generic/tclIOCmd.c: Revise [open] so that it interprets leading - zero strings passed as the "permissions" argument as octal numbers, - even if Tcl itself no longer parses integers in that way. - - * unix/tclUnixFCmd.c: Revise the "-permissions" [file attribute] so - that it interprets leading zero strings as octal numbers, even if Tcl - itself no longer parses integers in that way. - - * generic/tclCompExpr.c: Corrections to code that produces - * generic/tclUtil.c: extended "bad octal" error messages. - - * tests/cmdAH.test: Test revisions so that tests pass whether or - * tests/cmdIL.test: not Tcl parses leading zero strings as octal. - * tests/compExpr-old.test: - * tests/compExpr.test: - * tests/compile.test: - * tests/expr-old.test: - * tests/expr.test: - * tests/incr.test: - * tests/io.test: - * tests/lindex.test: - * tests/link.test: - * tests/mathop.test: - * tests/parseExpr.test: - * tests/set.test: - * tests/string.test: - * tests/stringComp.test: - -2007-10-15 David Gravereaux - - * tools/mkdepend.tcl: Produces usable output. Include path problem - * win/makefile.vc: fixed. Never fight city hall when it comes to - levels of quoting issues. - -2007-10-15 Miguel Sofer - - * generic/tclParse.c (Tcl_ParseBraces): fix for possible read after - the end of buffer. [Bug 1813528] (Joe Mistachkin) - -2007-10-14 David Gravereaux - - * tools/mkdepend.tcl (new): Initial stab at generating automatic - * win/makefile.vc: dependencies. - -2007-10-12 Pat Thoyts - - * win/makefile.vc: Mine all version information from headers. - * win/rules.vc: Sync tcl and tk and bring extension versions - * win/nmakehlp.c: closer together. Try and avoid using tclsh to do - substitutions as we may cross compile. - * win/coffbase.txt: Added offsets for snack dlls. - -2007-10-11 David Gravereaux - - * win/makefile.vc: Fixed my bad spelling mistakes from years back. - Dedependency, duh! Rather funny. - -2007-10-11 Don Porter - - * generic/tclCmdMZ.c: Correct [string is (wide)integer] failure - * tests/string.test: to report correct failindex values for - non-decimal integer strings. [Bug 1805887] - - * compat/strtoll.c (removed): The routines strtoll() and strtoull() - * compat/strtoull.c (removed): are no longer called by the Tcl source - * generic/tcl.h: code. (Their functionality has been replaced - * unix/Makefile.in: by TclParseNumber().) Remove outdated comments - * unix/configure.in: and mountains of configury autogoo that - * unix/tclUnixPort.h: allegedly support the mythical systems where - * win/Makefile.in: these routines might not have been available. - * win/makefile.bc: - * win/makefile.vc: - * win/tclWinPort.h: - - * unix/configure: autoconf-2.59 - -2007-10-11 Miguel Sofer - - * generic/tclObj.c: remove superfluous #include of tclCompile.h - -2007-10-08 George Peter Staplin - - * doc/Hash.3: Correct the valid usage of the flags member for the - Tcl_HashKeyType. It should be 0 or more of the flags mentioned. - -2007-10-02 Jeff Hobbs - - * generic/tcl.h (Tcl_DecrRefCount): Update change from 2006-05-29 to - make macro more warning-robust in unbraced if code. - -2007-10-02 Don Porter - - [core-stabilizer-branch] - - * README: Bump version number to 8.5.0 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-10-02 Andreas Kupries - - * library/tclIndex: Added 'tcl::tm::path' to the tclIndex. This fixes - [Bug 1806422] reported by Don Porter. - -2007-09-25 Donal K. Fellows - - * generic/tclProc.c (Tcl_DisassembleObjCmd): Define a command, - ::tcl::unsupported::disassemble, which can disassemble procedures, - lambdas and general scripts. - * generic/tclCompile.c (TclDisassembleByteCodeObj): Split apart the - code to print disassemblies of bytecode so that there is reusable code - that spits it out in a Tcl_Obj and then that code is used when doing - tracing. - -2007-09-20 Don Porter - - *** 8.5b1 TAGGED FOR RELEASE *** - - * changes: updates for 8.5b1 release. - -2007-09-19 Don Porter - - * README: Bump version number to 8.5b1 - * generic/tcl.h: Merge from core-stabilizer-branch. - * library/init.tcl: Stabilizing toward 8.5b1 release now done on - * tools/tcl.wse.in: the HEAD. core-stabilizer-branch is now - * unix/configure.in: suspended. - * unix/tcl.spec: - * win/configure.in: - -2007-09-19 Pat Thoyts - - * generic/tclStubLib.: Replaced isdigit with internal implementation. - -2007-09-18 Don Porter - - * generic/tclStubLib.c: Remove C library calls from Tcl_InitStubs() so - * win/makefile.vc: that we don't need the C library linked in to - libtclStub. - -2007-09-17 Pat Thoyts - - * win/makefile.vc: Add crt flags for tclStubLib now it uses C-library - functions. - -2007-09-17 Joe English - - * tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to build - shared libraries on current NetBSDs. [Bug 1749251] - * unix/configure: regenerated (autoconf-2.59). - -2007-09-17 Don Porter - - * unix/Makefile.in: Update `make dist` so that tclDTrace.d is - included in the source code distribution. - - * generic/tcl.h: Revised Tcl_InitStubs() to restore Tcl 8.4 - * generic/tclPkg.c: source compatibility with callers of - * generic/tclStubLib.c: Tcl_InitStubs(interp, TCL_VERSION, 1). [Bug - 1578344] - -2007-09-17 Donal K. Fellows - - * generic/tclTrace.c (Tcl_TraceObjCmd, TraceExecutionObjCmd) - (TraceCommandObjCmd, TraceVariableObjCmd): Generate literal values - * generic/tclNamesp.c (NamespaceCodeCmd): more efficiently using - * generic/tclFCmd.c (CopyRenameOneFile): TclNewLiteralStringObj - * generic/tclEvent.c (TclSetBgErrorHandler): macro. - -2007-09-15 Daniel Steffen - - * unix/tcl.m4: replace all direct references to compiler by ${CC} to - enable CC overriding at configure & make time; run - check for visibility "hidden" with all compilers; - quoting fixes from TEA tcl.m4. - (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld' in SHLIB_LD by - 'cc' compiler driver. - * unix/configure: autoconf-2.59 - -2007-09-14 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CreateObjCommand): Only invalidate along the - namespace path once; that is enough. [Bug 1519940] - -2007-09-14 Daniel Steffen - - * generic/tclDTrace.d (new file): Add DTrace provider for Tcl; allows - * generic/tclCompile.h: tracing of proc and command entry & - * generic/tclBasic.c: return, bytecode execution, object - * generic/tclExecute.c: allocation and more; with - * generic/tclInt.h: essentially zero cost when tracing - * generic/tclObj.c: is inactive; enable with - * generic/tclProc.c: --enable-dtrace configure arg - * unix/Makefile.in: (disabled by default, will only - * unix/configure.in: enable if DTrace is present). [Patch - 1793984] - - * macosx/GNUmakefile: Enable DTrace support. - * macosx/Tcl-Common.xcconfig: - * macosx/Tcl.xcodeproj/project.pbxproj: - - * generic/tclCmdIL.c: Factor out core of InfoFrameCmd() into - internal TclInfoFrame() for use by DTrace - probes. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-09-12 Don Porter - - * unix/Makefile.in: Perform missing updates of the tcltest Tcl - * win/Makefile.in: Module installed filename that should have - been part of the bump to tcltest 2.3b1. Thanks Larry Virden. - -2007-09-12 Pat Thoyts - - * win/makefile.vc, win/rules.vc, win/nmakehlp.c: Use nmakehlp to - substitute values for tclConfig.sh (helps cross-compiling). - -2007-09-11 Don Porter - - * library/tcltest/tcltest.tcl: Accept underscores and colons in - * library/tcltest/pkgIndex.tcl: constraint names. Properly handle - constraint expressions that return non-numeric boolean results like - "false". Bump to tcltest 2.3b1. [Bug 1772989; RFE 1071322] - * tests/info.test: Disable fragile tests. - - * doc/package.n: Restored the functioning of [package require - * generic/tclPkg.c: -exact] to be compatible with Tcl 8.4. [Bug - * tests/pkg.test: 1578344] - -2007-09-11 Miguel Sofer - - * generic/tclCompCmds.c (TclCompileDictCmd-update): - * generic/tclCompile.c (tclInstructionTable): - * generic/tclExecute.c (INST_DICT_UPDATE_END): fix stack management in - compiled [dict update]. [Bug 1786481] - - ***POTENTIAL INCOMPATIBILITY*** - Scripts that were precompiled on earlier versions of 8.5 and use [dict - update] will crash. Workaround: recompile. - -2007-09-11 Kevin B. Kenny - - * generic/tclExecute.c: Corrected an off-by-one error in the setting - of MaxBaseWide for certain powers. [Bug 1767293 - problem reported in - comments when bug was reopened] - -2007-09-10 Jeff Hobbs - - * generic/tclLink.c (Tcl_UpdateLinkedVar): guard against var being - unlinked. [Bug 1740631] (maros) - -2007-09-10 Miguel Sofer - - * generic/tclCompile.c: fix tclInstructionTable entry for - dictUpdateEnd - - * generic/tclExecute.c: remove unneeded setting of 'cleanup' variable - before jumping to checkForCatch. - -2007-09-10 Don Porter - - * doc/package.n: Restored the document parallel syntax of the - * generic/tclPkg.c: [package present] and [package require] - * tests/pkg.test: commands. [Bug 1723675] - -2007-09-09 Don Porter - - * generic/tclInt.h: Removed the "nsName" Tcl_ObjType from the - * generic/tclNamesp.c: registered set. Revised the management of the - * generic/tclObj.c: intrep of that Tcl_ObjType. Revised the - * tests/obj.test: TclGetNamespaceFromObj() routine to return - TCL_ERROR and write a consistent error message when a namespace is not - found. [Bug 1588842. Patch 1686862] - - ***POTENTIAL INCOMPATIBILITY*** - For callers of Tcl_GetObjType() on the name "nsName". - - * generic/tclExecute.c: Update TclGetNamespaceFromObj() callers. - * generic/tclProc.c: - - * tests/apply.test: Updated tests to expect new consistent - * tests/namespace-old.test: error message when a namespace is not - * tests/namespace.test: found. - * tests/upvar.test: - - * generic/tclCompCmds.c: Use the new INST_REVERSE instruction - * tests/mathop.test: to correct the compiled versions of math - operator commands. [Bug 1724437] - - * generic/tclCompile.c: New bytecode instruction INST_REVERSE to - * generic/tclCompile.h: reverse the order of N items at the top of - * generic/tclExecute.c: stack. - - * generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate - routine to compile ** to account for its different associativity. - -2007-09-08 Miguel Sofer - - * generic/tclVar.c (Tcl_SetVar2, TclPtrSetVar): [Bug 1710710] fixed - correctly, reverted fix of 2007-05-01. - -2007-09-08 Donal K. Fellows - - * generic/tclDictObj.c (DictUpdateCmd, DictWithCmd): Plug a hole that - * generic/tclExecute.c (TEBC,INST_DICT_UPDATE_END): allowed a careful - * tests/dict.test (dict-21.16,21.17,22.11): attacker to craft a dict - containing a recursive link to itself, violating one of Tcl's - fundamental datatype assumptions and causing a stack crash when the - dict was converted to a string. [Bug 1786481] - -2007-09-07 Don Porter - - * generic/tclEvent.c ([::tcl::Bgerror]): Corrections to Tcl's - * tests/event.test: default [interp bgerror] handler so that when - it falls back to a hidden [bgerror] in a safe interp, it gets the - right error context data. [Bug 1790274] - -2007-09-07 Miguel Sofer - - * generic/tclProc.c (TclInitCompiledLocals): the refCount of resolved - variables was being managed without checking if they were Var or - VarInHash: itcl [Bug 1790184] - -2007-09-06 Don Porter - - * generic/tclResult.c (Tcl_GetReturnOptions): Take care that a - * tests/init.test: non-TCL_ERROR code doesn't cause existing - -errorinfo, -errorcode, and -errorline entries to be omitted. - * generic/tclEvent.c: With -errorInfo no longer lost, generate more - complete ::errorInfo when calling [bgerror] after a non-TCL_ERROR - background exception. - -2007-09-06 Don Porter - - * generic/tclInterp.c (Tcl_Init): Removed constraint on ability - to define a custom [tclInit] before calling Tcl_Init(). Until now the - custom command had to be a proc. Now it can be any command. - - * generic/tclInt.decls: New internal routine TclBackgroundException() - * generic/tclEvent.c: that for the first time permits non-TCL_ERROR - exceptions to trigger [interp bgerror] handling. Closes a gap in TIP - 221. When falling back to [bgerror] (which is designed only to handle - TCL_ERROR), convert exceptions into errors complaining about the - exception. - - * generic/tclInterp.c: Convert Tcl_BackgroundError() callers to call - * generic/tclIO.c: TclBackgroundException(). - * generic/tclIOCmd.c: - * generic/tclTimer.c: - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2007-09-06 Daniel Steffen - - * macosx/Tcl.xcode/project.pbxproj: discontinue unmaintained support - * macosx/Tcl.xcode/default.pbxuser: for Xcode 1.5; replace by Xcode2 - project for use on Tiger (with Tcl.xcodeproj to be used on Leopard). - - * macosx/Tcl.xcodeproj/project.pbxproj: updates for Xcode 2.5 and 3.0. - * macosx/Tcl.xcodeproj/default.pbxuser: - * macosx/Tcl.xcode/project.pbxproj: - * macosx/Tcl.xcode/default.pbxuser: - * macosx/Tcl-Common.xcconfig: - - * macosx/README: document project changes. - -2007-09-05 Don Porter - - * generic/tclBasic.c: Removed support for the unmaintained - * generic/tclExecute.c: -DTCL_GENERIC_ONLY configuration. [Bug - * unix/Makefile.in: 1264623] - -2007-09-04 Don Porter - - * unix/Makefile.in: It's unreliable to count on the release - manager to remember to `make genstubs` before `make dist`. Let the - Makefile remember the dependency for us. - - * unix/Makefile.in: Corrections to `make dist` dependencies to be - sure that macosx/configure gets generated whenever it does not exist. - -2007-09-03 Kevin B, Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/America/Grand_Turk: - * library/tzdata/America/Port-au-Prince: - * library/tzdata/America/Indiana/Petersburg: - * library/tzdata/America/Indiana/Tell_City: - * library/tzdata/America/Indiana/Vincennes: - * library/tzdata/Antarctica/McMurdo: - * library/tzdata/Australia/Adelaide: - * library/tzdata/Australia/Broken_Hill: - * library/tzdata/Australia/Currie: - * library/tzdata/Australia/Hobart: - * library/tzdata/Australia/Lord_Howe: - * library/tzdata/Australia/Melbourne: - * library/tzdata/Australia/Sydney: - * library/tzdata/Pacific/Auckland: - * library/tzdata/Pacific/Chatham: Olson's tzdata2007g. - - * generic/tclListObj.c (TclLindexFlat): - * tests/lindex.test (lindex-17.[01]): Added code to detect the error - when a script does [lindex {} end foo]; an overaggressive optimisation - caused this call to return an empty object rather than an error. - -2007-09-03 Daniel Steffen - - * generic/tclObj.c (TclInitObjSubsystem): restore registration of the - "wideInt" Tcl_ObjType for compatibility with 8.4 extensions that - access the tclWideIntType Tcl_ObjType; add setFromAnyProc for - tclWideIntType. - -2007-09-02 Donal K. Fellows - - * doc/lsearch.n: Added note that order of results with the -all option - is that of the input list. It always was, but this makes it crystal. - -2007-08-30 Don Porter - - * generic/tclCompile.c: Added fflush() calls following all callers of - * generic/tclExecute.c: TclPrintByteCodeObj() so that tcl_traceCompile - output is less likely to get mangled when writes to stdout interleave - with other code. - -2007-08-28 Don Porter - - * generic/tclCompExpr.c: Use a table lookup in ParseLexeme() to - determine lexemes with single-byte representations. - - * generic/tclBasic.c: Used unions to better clarify overloading of - * generic/tclCompExpr.c: the fields of the OpCmdInfo and - * generic/tclCompile.h: TclOpCmdClientData structs. - -2007-08-27 Don Porter - - * generic/tclCompExpr.c: Call TclCompileSyntaxError() when - expression syntax errors are found when compiling expressions. With - this in place, convert TclCompileExpr to return void, since there's no - longer any need to report TCL_ERROR. - * generic/tclCompile.c: Update callers. - * generic/tclExecute.c: - - * generic/tclCompCmds.c: New routine TclCompileSyntaxError() - * generic/tclCompile.h: to directly compile bytecodes that report a - * generic/tclCompile.c: syntax error, rather than (ab)use a call to - TclCompileReturnCmd. Also, undo the most recent commit that papered - over some issues with that (ab)use. New routine produces a new opcode - INST_SYNTAX, which is a minor variation of INST_RETURN_IMM. Also a bit - of constification. - - * generic/tclCompile.c: Move the deallocation of local LiteralTable - * generic/tclCompExpr.c: entries into TclFreeCompileEnv(). - * generic/tclExecute.c: Update callers. - - * generic/tclCompExpr.c: Force numeric and boolean literals in - expressions to register with their intreps intact, even if that means - overwriting existing intreps in already registered literals. - -2007-08-25 Kevin B. Kenny - - * generic/tclExecute.c (TclExecuteByteCode): Added code to handle - * tests/expr.test (expr-23.48-53) integer exponentiation - that results in 32- and 64-bit integer results, avoiding calls to wide - integer exponentiation routines in this common case. [Bug 1767293] - - * library/clock.tcl (ParseClockScanFormat): Modified code to allow - * tests/clock.test (clock-60.*): case-insensitive matching - of time zone and month names. [Bug 1781282] - -2007-08-24 Don Porter - - * generic/tclCompExpr.c: Register literals found in expressions - * tests/compExpr.test: to restore literal sharing. Preserve numeric - intreps when literals are created for the first time. Correct memleak - in ExecConstantExprTree() and add test for the leak. - -2007-08-24 Miguel Sofer - - * generic/tclCompile.c: replaced copy loop that tripped some compilers - with memmove. [Bug 1780870] - -2007-08-23 Don Porter - - * library/init.tcl ([auto_load_index]): Delete stray "]" that created - an expr syntax error (masked by a [catch]). - - * generic/tclCompCmds.c (TclCompileReturnCmd): Added crash protection - to handle callers other than TclCompileScript() failing to meet the - initialization assumptions of the TIP 280 code in CompileWord(). - - * generic/tclCompExpr.c: Suppress the attempt to convert to - numeric when pre-compiling a constant expresion indicates an error. - -2007-08-22 Miguel Sofer - - * generic/tclExecute.c (TEBC): disable the new shortcut to frequent - INSTs for debug builds. REVERTED (collision with alternative fix) - -2007-08-21 Don Porter - - * generic/tclMain.c: Corrected the logic of dropping the last - * tests/main.test: newline from an interactively typed command. - [Bug 1775878] - -2007-08-21 Pat Thoyts - - * tests/thread.test: thread-4.4: clear ::errorInfo in the thread as a - message is left here from init.tcl on windows due to no tcl_pkgPath. - -2007-08-20 Miguel Sofer - - * generic/tclExecute.c (INST_SUB): fix usage of the new macro for - overflow detection in sums, adapt to subtraction. Lengthy comment - added. - -2007-08-19 Donal K. Fellows - - * generic/tclExecute.c (Overflowing, TclIncrObj, TclExecuteByteCode): - Encapsulate Miguel's last change in a more mnemonic macro. - -2007-08-19 Miguel Sofer - - * generic/tclExecute.c: changed the check for overflow in sums, - reducing objsize, number of branches and cache misses (according to - cachegrind). Non-overflow for s=a+b: - previous - ((a >= 0 || b >= 0 || s < 0) && (s >= 0 || b < 0 || a < 0)) - now - (((a^s) >= 0) || ((a^b) < 0)) - This expresses: "a and s have the same sign or else a and b have - different sign". - -2007-08-19 Donal K. Fellows - - * doc/interp.n (RESOURCE LIMITS): Added text to better explain why - time limits are described using absolute times. [Bug 1752148] - -2007-08-16 Miguel Sofer - - * generic/tclVar.c: improved localVarNameType caching to leverage - the new availability of Tcl_Obj in variable names, avoiding string - comparisons to verify that the cached value is usable. - - * generic/tclExecute.c: check the two most frequent instructions - before the switch. Reduces both runtime and obj size a tiny bit. - -2007-08-16 Don Porter - - * generic/tclCompExpr.c: Added a "constant" field to the OpNode - struct (again "free" due to alignment requirements) to mark those - subexpressions that are completely known at compile time. Enhanced - CompileExprTree() and its callers to precompute these constant - subexpressions at compile time. This resolves the issue raised in [Bug - 1564517]. - -2007-08-15 Donal K. Fellows - - * generic/tclIOUtil.c (TclGetOpenModeEx): Only set the O_APPEND flag - * tests/ioUtil.test (ioUtil-4.1): on a channel for the 'a' - mode and not for 'a+'. [Bug 1773127] - -2007-08-14 Miguel Sofer - - * generic/tclExecute.c (INST_INVOKE*): peephole opt, do not get the - interp's result if it will be pushed/popped. - -2007-08-14 Don Porter - - * generic/tclBasic.c: Use fully qualified variable names for - * tests/thread.test: ::errorInfo and ::errorCode so that string - * tests/trace.test: reported to variable traces are fully - qualified in agreement with Tcl 8.4 operations. - -2007-08-14 Daniel Steffen - - * unix/tclLoadDyld.c: use dlfcn API on Mac OS X 10.4 and later; fix - issues with loading from memory on intel and 64bit; add debug messages - - * tests/load.test: add test load-10.1 for loading from vfs. - - * unix/dltest/pkga.c: whitespace & comment cleanup, remove - * unix/dltest/pkgb.c: unused pkgf.c. - * unix/dltest/pkgc.c: - * unix/dltest/pkge.c: - * unix/dltest/pkgf.c (removed): - * unix/dltest/pkgua.c: - * macosx/Tcl.xcodeproj/project.pbxproj: - -2007-08-13 Don Porter - - * generic/tclExecute.c: Provide DECACHE/CACHE protection to the - * tests/trace.test: Tcl_LogCommandInfo() call. [Bug 1773040] - -2007-08-12 Miguel Sofer - - * generic/tclCmdMZ.c (Tcl_SplitObjCmd): use TclNewStringObj macro - instead of calling the function. - - * generic/tcl_Obj.c (TclAllocateFreeObjects): remove unneeded memset - to 0 of all allocated objects. - -2007-08-10 Miguel Sofer - - * generic/tclInt.h: remove redundant ops in TclNewStringObj macro. - -2007-08-10 Miguel Sofer - - * generic/tclInt.h: fix the TclSetVarNamespaceVar macro, was causing a - leak. - -2007-08-10 Don Porter - - * generic/tclCompExpr.c: Revise CompileExprTree() to use the - OpNode mark field scheme of tree traversal. This eliminates the need - to use magic values in the left and right fields for that purpose. - Also stop abusing the left field within ParseExpr() to store the - number of arguments in a parsed function call. CompileExprTree() now - determines that for itself at compile time. Then reorder code to - eliminate duplication. - -2007-08-09 Miguel Sofer - - * generic/tclProc.c (TclCreateProc): better comments on the required - varflag values when loading precompiled procs. - - * generic/tclExecute.c (INST_STORE_ARRAY): - * tests/trace.test (trace-2.6): whole array write traces on compiled - local variables were not firing. [Bug 1770591] - -2007-08-08 Jeff Hobbs - - * generic/tclProc.c (InitLocalCache): reference firstLocalPtr via - procPtr. codePtr->procPtr == NULL exposed by tbcload. - -2007-08-08 Don Porter - - * generic/tclExecute.c: Corrected failure to compile/link in the - -DNO_WIDE_TYPE configuration. - - * generic/tclExecute.c: Corrected improper use of bignum arguments to - * tests/expr.test: *SHIFT operations. [Bug 1770224] - -2007-08-07 Miguel Sofer - - * generic/tclInt.h: remove comments refering to VAR_SCALAR, as that - flag bit does not exist any longer. - * generic/tclProc.c (InitCompiledLocals): removed optimisation for - non-resolved case, as the function is never called in that case. - Renamed the function to InitResolvedLocals to calrify the point. - - * generic/tclInt.decls: Exporting via stubs to help xotcl adapt to - * generic/tclInt.h: VarReform. - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2007-08-07 Daniel Steffen - - * generic/tclEnv.c: improve environ handling on Mac OS X (adapted - * unix/tclUnixPort.h: from Apple changes in Darwin tcl-64). - - * unix/Makefile.in: add support for compile flags specific to - object files linked directly into executables. - - * unix/configure.in (Darwin): only use -seg1addr flag when prebinding; - use -mdynamic-no-pic flag for object files linked directly into exes; - support overriding TCL_PACKAGE_PATH/TCL_MODULE_PATH in environment. - - * unix/configure: autoconf-2.59 - -2007-08-06 Don Porter - - * tests/parseExpr.test: Update source file name of expr parser code. - - * generic/tclCompExpr.c: Added a "mark" field to the OpNode - struct, which is used to guide tree traversal. This field costs - nothing since alignement requirements used the memory already. - Rewrote ConvertTreeToTokens() to use the new field, which permitted - consolidation of utility routines CopyTokens() and - GenerateTokensForLiteral(). - -2007-08-06 Kevin B. Kenny - - * generic/tclGetDate.y: Added a cast to the definition of YYFREE to - silence compiler warnings. - * generic/tclDate.c: Regenerated - * win/tclWinTest.c: Added a cast to GetSecurityDescriptorDacl call - to silence compiler warnings. - -2007-08-04 Miguel Sofer - - * generic/tclInt.decls: Exporting via stubs to help itcl adapt to - * generic/tclInt.h: VarReform. Added localCache initialization - * generic/tclIntDecls.h: to TclInitCompiledLocals (which only exists - * generic/tclProc.c: for itcl). - * generic/tclStubInit.c: - * generic/tclVar.c: - -2007-08-01 Donal K. Fellows - - * library/word.tcl: Rewrote for greater efficiency. [Bug 1764318] - -2007-08-01 Pat Thoyts - - * generic/tclInt.h: Added a TclOffset macro ala Tk_Offset to - * generic/tclVar.c: abstract out 'offsetof' which may not be - * generic/tclExceute.c: defined (eg: msvc6). - -2007-08-01 Miguel Sofer - - * generic/tclVar.c (TclCleanupVar): fix [Bug 1765225], thx Larry - Virden. - -2007-07-31 Miguel Sofer - - * doc/Hash.3: - * generic/tclHash.c: - * generic/tclObj.c: - * generic/tclThreadStorage.c: (changes part of the patch below) - Stop Tcl_CreateHashVar from resetting hPtr->clientData to NULL after - calling the allocEntryProc for a custom table. - - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclCmdIL.c: - * generic/tclCompCmds.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclHash.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclProc.c: - * generic/tclThreadStorage.c: - * generic/tclTrace.c: - * generic/tclVar.c: VarReform [Patch 1750051] - - *** POTENTIAL INCOMPATIBILITY *** (tclInt.h and tclCompile.h) - Extensions that access internals defined in tclInt.h and/or - tclCompile.h may lose both binary and source compatibility. The - relevant changes are: - 1. 'struct Var' is completely changed, all acceses to its internals - (either direct or via the TclSetVar* and TclIsVar* macros) will - malfunction. Var flag values and semantics changed too. - 2. 'struct Bytecode' has an additional field that has to be - initialised to NULL - 3. 'struct Namespace' is larger, as the varTable is now one pointer - larger than a Tcl_HashTable. Direct access to its fields will - malfunction. - 4. 'struct CallFrame' grew one more field (the second such growth with - respect to Tcl8.4). - 5. API change for the functions TclFindCompiledLocal, TclDeleteVars - and many internal functions in tclVar.c - - Additionally, direct access to variable hash tables via the standard - Tcl_Hash* interface is to be considered as deprecated. It still works - in the present version, but will be broken by further specialisation - of these hash tables. This concerns especially the table of array - elements in an array, as well as the varTable field in the Namespace - struct. - -2007-07-31 Miguel Sofer - - * unix/configure.in: allow use of 'inline' in Tcl sources. [Patch - * win/configure.in: 1754128] - * win/makefile.vc: Regen with autoconf 2.61 - -2007-07-31 Donal K. Fellows - - * unix/tclUnixInit.c (TclpSetVariables): Use the thread-safe getpwuid - replacement to fill the tcl_platform(user) field as it is not subject - to spoofing. [Bug 681877] - - * unix/tclUnixCompat.c: Simplify the #ifdef logic. - - * unix/tclUnixChan.c (FileWatchProc): Fix test failures. - -2007-07-30 Donal K. Fellows - - * unix/tclUnixChan.c (SET_BITS, CLEAR_BITS): Added macros to make this - file clearer. - -2007-07-24 Miguel Sofer - - * generic/tclBasic.c (TEOvI, GetCommandSource): - * generic/tclExecute.c (TEBC, TclGetSrcInfoForCmd): - * generic/tclInt.h: - * generic/tclTrace.c (TclCheck(Interp|Execution)Traces): - Removed the need for TEBC to inspect the command before calling TEOvI, - leveraging the TIP 280 infrastructure. Moved the generation of a - correct nul-terminated command string away from the trace code, back - into TEOvI/GetCommandSource. - -2007-07-20 Andreas Kupries - - * library/platform/platform.tcl: Fixed bug in 'platform::patterns' - * library/platform/pkgIndex.tcl: where identifiers not matching - * unix/Makefile.in: the special linux and solaris forms would not - * win/Makefile.in: get 'tcl' as an acceptable platform added to - * doc/platform.n: the result. Bumped package to version 1.0.3 and - * doc/platform_shell.n: updated documentation and Makefiles. Also - fixed bad version info in the documentation of platform::shell. - -2007-07-19 Don Porter - - * generic/tclParse.c: In contexts where interp and parsePtr->interp - might be different, be sure to use the latter for error reporting. - Also pulled the interp argument back out of ParseTokens() since we - already had a parsePtr->interp to work with. - -2007-07-18 Don Porter - - * generic/tclCompExpr.c: Removed unused arguments and variables - -2007-07-17 Don Porter - - * generic/tclCompExpr.c (ParseExpr): While adding comments to - explain the operations of ParseExpr(), made significant revisions to - the code so it would be easier to explain, and in the process made the - code simpler and clearer as well. - -2007-07-15 Don Porter - - * generic/tclCompExpr.c: More commentary. - * tests/parseExpr.test: Several tests of syntax error messages - to check that when expression substrings are truncated they leave - visible the context relevant to the reported error. - -2007-07-12 Don Porter - - * generic/tclCompExpr.c: Factored out, corrected, and commented - common code for reporting syntax errors in LEAF elements. - -2007-07-11 Miguel Sofer - - * generic/tclCompCmds.c (TclCompileWhileCmd): - * generic/tclCompile.c (TclCompileScript): - Corrected faulty avoidance of INST_START_CMD when the first opcode in - a script is within a loop (as produced by 'while 1'), so that the - corresponding command is properly counted. [Bug 1752146] - -2007-07-11 Don Porter - - * generic/tclCompExpr.c: Added a "parseOnly" flag argument to - ParseExpr() to indicate whether the caller is Tcl_ParseExpr(), with an - end goal of filling a Tcl_Parse with Tcl_Tokens representing the - parsed expression, or TclCompileExpr() with the goal of compiling and - executing the expression. In the latter case, more aggressive - conversion of QUOTED and BRACED lexeme to literals is done. In the - former case, all such conversion is avoided, since Tcl_Token - production would revert it anyway. This enables simplifications to the - GenerateTokensForLiteral() routine as well. - -2007-07-10 Don Porter - - * generic/tclCompExpr.c: Added a field for operator precedence - to be stored directly in the parse tree. There's no memory cost to - this addition, since that memory would have been lost to alignment - issues anyway. Also, converted precedence definitions and lookup - tables to use symbolic constants instead of raw number for improved - readability, and continued extending/improving/correcting comments. - Removed some unused counter variables. Renamed some variables for - clarity and replaced some cryptic logic with more readable macros. - -2007-07-09 Don Porter - - * generic/tclCompExpr.c: Revision so that the END lexeme never - gets inserted into the parse tree. Later tree traversal never reaches - it since its location in the tree is not variable. Starting and - stopping with the START lexeme (node 0) is sufficient. Also finished - lexeme code commentary. - - * generic/tclCompExpr.c: Added missing creation and return of - the Tcl_Parse fields that indicate error conditions. [Bug 1749987] - -2007-07-05 Don Porter - - * library/init.tcl (unknown): Corrected inconsistent error message - in interactive [unknown] when empty command is invoked. [Bug 1743676] - -2007-07-05 Miguel Sofer - - * generic/tclNamesp.c (SetNsNameFromAny): - * generic/tclObj.c (SetCmdNameFromAny): Avoid unnecessary - ckfree/ckalloc when the old structs can be reused. - -2007-07-04 Miguel Sofer - - * generic/tclNamesp.c: Fix case where a FQ cmd or ns was being cached - * generic/tclObj.c: in a different interp, tkcon. [Bug 1747512] - -2007-07-03 Don Porter - - * generic/tclCompExpr.c: Revised #define values so that there - is now more expansion room to define more BINARY operators. - -2007-07-02 Donal K. Fellows - - * generic/tclHash.c (CompareStringKeys): Always use the strcmp() - version; the operation is functionally equivalent, the speed is - identical (up to measurement limitations), and yet the code is - simpler. [FRQ 951168] - -2007-07-02 Don Porter - - * generic/tcl.h: Removed TCL_PRESERVE_BINARY_COMPATIBILITY and - * generic/tclHash.c: any code enabled when it is set to 0. We will - * generic/tclStubInit.c: always want to preserve binary compat - of the structs that appear in the interface through the 8.* series of - releases, so it's pointless to drag around this never-enabled - alternative. - - * generic/tclIO.c: Removed dead code. - * unix/tclUnixChan.c: - - * generic/tclCompExpr.c: Removed dead code, old implementations - * generic/tclEvent.c: of expr parsing and compiling, including the - * generic/tclInt.h: routine TclFinalizeCompilation(). - -2007-06-30 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Plug a memory leak caused by a - missing Tcl_DecrRefCount on an error path. [Bug 1717186] - -2007-06-30 Zoran Vasiljevic - - * generic/tclThread.c: Prevent RemeberSyncObj() from growing the sync - object lists by reusing already free'd slots, if possible. See - discussion on Bug 1726873 for more information. - -2007-06-29 Donal K. Fellows - - * doc/DictObj.3 (Tcl_DictObjDone): Improved documentation of this - function to make it clearer how to use it. [Bug 1710795] - -2007-06-29 Daniel Steffen - - * generic/tclAlloc.c: on Darwin, ensure memory allocated by - * generic/tclThreadAlloc.c: the custom TclpAlloc()s is aligned to - 16 byte boundaries (as is the case with the Darwin system malloc). - - * generic/tclGetDate.y: use ckalloc/ckfree instead of malloc/free. - * generic/tclDate.c: bison 1.875e - - * generic/tclBasic.c (TclEvalEx): fix warnings. - - * macosx/Tcl.xcodeproj/project.pbxproj: better support for renamed tcl - * macosx/Tcl.xcodeproj/default.pbxuser: source dir; add 10.5 SDK build - * macosx/Tcl-Common.xcconfig: config; remove tclMathOp.c. - - * macosx/README: document Tcl.xcodeproj changes. - -2007-06-28 Don Porter - - * generic/tclBasic.c: Removed dead code, including the - * generic/tclExecute.c: entire file tclMathOp.c. - * generic/tclInt.h: - * generic/tclMathOp.c (removed): - * generic/tclTestObj.c: - * win/tclWinFile.c: - - * unix/Makefile.in: Updated to reflect deletion of tclMathOp.c. - * win/Makefile.in: - * win/makefile.bc: - * win/makefile.vc: - -2007-06-28 Pat Thoyts - - * generic/tclBasic.c: Silence constness warnings for TclStackFree - * generic/tclCompCmds.c: when building with msvc. - * generic/tclFCmd.c: - * generic/tclIOCmd.c: - * generic/tclTrace.c: - -2007-06-28 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct): fix possible segfault. - -2007-06-27 Don Porter - - * generic/tclTrace.c: Corrected broken trace reversal logic in - * generic/tclTest.c: TclCheckInterpTraces that led to infinite loop - * tests/trace.test: when multiple Tcl_CreateTrace traces were set - and one of them did not fire due to level restrictions. [Bug 1743931] - -2007-06-26 Don Porter - - * generic/tclBasic.c (TclEvalEx): Moved some arrays from the C - stack to the Tcl stack. - -2007-06-26 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct): more streamlining. - -2007-06-25 Don Porter - - * generic/tclExecute.c: Safety checks to avoid crashes in the - TclStack* routines when called with an incompletely initialized - interp. [Bug 1743302] - -2007-06-25 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct): fixing incomplete change, more - streamlining. - -2007-06-24 Miguel Sofer - - * generic/tclVar.c (TclDeleteCompiledLocalVars): removed inlining that - ended up not really optimising (limited benchmarks). Now calling - UnsetVarStruct (streamlined old code is #ifdef'ed out, in case better - benchmarks do show a difference). - - * generic/tclVar.c (UnsetVarStruct): fixed a leak introduced in last - commit. - -2007-06-23 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct, TclDeleteVars): made the logic - slightly clearer, eliminated some duplicated code. - - *** POTENTIAL INCOMPATIBILITY *** (tclInt.h and Var struct users) - The core never builds VAR_LINK variable to have traces. Such a - "monster", should one exist, will now have its unset traces called - *before* it is unlinked. - -2007-06-23 Daniel Steffen - - * macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation - APIs after fork() on systems where that would lead to an abort(). - -2007-06-22 Don Porter - - * generic/tclExecute.c: Revised TclStackRealloc() signature to better - * generic/tclInt.h: parallel (and fall back on) Tcl_Realloc. - - * generic/tclNamesp.c (TclResetShadowesCmdRefs): Replaced - ckrealloc based allocations with TclStackRealloc allocations. - - * generic/tclCmdIL.c: More conversions to use TclStackAlloc. - * generic/tclScan.c: - -2007-06-21 Don Porter - - * generic/tclBasic.c: Move most instances of the Tcl_Parse struct - * generic/tclCompExpr.c: off the C stack and onto the Tcl stack. This - * generic/tclCompile.c: is a rather large struct (> 3kB). - * generic/tclParse.c: - -2007-06-21 Miguel Sofer - - * generic/tclBasic.c (TEOvI): Made sure that leave traces - * generic/tclExecute.c (INST_INVOKE): that were created during - * tests/trace.test (trace-36.2): execution of an originally - untraced command do not fire [Bug 1740962], partial fix. - -2007-06-21 Donal K. Fellows - - * generic/tcl.h, generic/tclCompile.h, generic/tclCompile.c: Remove - references in comments to obsolete {expand} notation. [Bug 1740859] - -2007-06-20 Miguel Sofer - - * generic/tclVar.c: streamline namespace vars deletion: only compute - the variable's full name if the variable is traced. - -2007-06-20 Don Porter - - * generic/tclInt.decls: Revised the interfaces of the routines - * generic/tclExecute.c: TclStackAlloc and TclStackFree to make them - easier for callers to use (or more precisely, harder to misuse). - TclStackFree now takes a (void *) argument which is the pointer - intended to be freed. TclStackFree will panic if that's not actually - the memory the call will free. TSA/TSF also now tolerate receiving - (interp == NULL), in which case they simply fall back to be calls to - Tcl_Alloc/Tcl_Free. - - * generic/tclIntDecls.h: make genstubs - - * generic/tclBasic.c: Updated callers - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclFCmd.c: - * generic/tclFileName.c: - * generic/tclIOCmd.c: - * generic/tclIndexObj.c: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * generic/tclProc.c: - * generic/tclTrace.c: - * unix/tclUnixPipe.c: - -2007-06-20 Jeff Hobbs - - * tools/tcltk-man2html.tcl: revamp of html doc output to use CSS, - standardized headers, subheaders, dictionary sorting of names. - -2007-06-18 Jeff Hobbs - - * tools/tcltk-man2html.tcl: clean up copyright merging and output. - clean up coding constructs. - -2007-06-18 Miguel Sofer - - * generic/tclCmdIL.c (InfoFrameCmd): - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): - * generic/tclCompile.c (TclInitCompileEnv): - * generic/tclProc.c (Tcl_ProcObjCmd, SetLambdaFromAny): Moved the - CmdFrame off the C stack and onto the Tcl stack. - - * generic/tclExecute.c (TEBC): Moved the CmdFrame off the C stack and - onto the Tcl stack, between the catch and the execution stacks - -2007-06-18 Don Porter - - * generic/tclBasic.c (TclEvalEx,TclEvalObjEx): Moved the CmdFrame off - the C stack and onto the Tcl stack. - -2007-06-17 Donal K. Fellows - - * generic/tclProc.c (TclObjInterpProcCore): Minor fixes to make - * generic/tclExecute.c (TclExecuteByteCode): compilation debugging - builds work again. [Bug 1738542] - -2007-06-16 Donal K. Fellows - - * generic/tclProc.c (TclObjInterpProcCore): Use switch instead of a - chain of if's for a modest performance gain and a little more clarity. - -2007-06-15 Miguel Sofer - - * generic/tclCompCmds.c: Simplified [variable] compiler and executor. - * generic/tclExecute.c: Missed updates to "there is always a valid - frame". - - * generic/tclCompile.c: reverted TclEvalObjvInternal and INST_INVOKE - * generic/tclExecute.c: to essentially what they were previous to the - * generic/tclBasic.c: commit of 2007-04-03 [Patch 1693802] and the - subsequent optimisations, as they break the new trace tests described - below. - - * generic/trace.test: added tests 36 to 38 for dynamic trace creation - and addition. These tests expose a change in dynamics due to a recent - round of optimisations. The "correct" behaviour is not described in - docs nor TIP 62. - -2007-06-14 Miguel Sofer - - * generic/tclInt.decls: Modif to the internals of TclObjInterpProc - * generic/tclInt.h: to reduce stack consumption and improve task - * generic/tclIntDecls.h: separation. Changes the interface of - * generic/tclProc.c: TclObjInterpProcCore (patching TclOO - simultaneously). - - * generic/tclProc.c (TclObjInterpProcCore): simplified obj management - in wrongNumArgs calls. - -2007-06-14 Don Porter - - * generic/tclCompile.c: SetByteCodeFromAny() can no longer return any - * generic/tclExecute.c: code other than TCL_OK, so remove code that - * generic/tclProc.c: formerly handled exceptional codes. - -2007-06-13 Miguel Sofer - - * generic/tclExecute.c (TclCompEvalObj): missed update to "there is - always a valid frame". - - * generic/tclProc.c (TclObjInterpProcCore): call TEBC directly instead - of going through TclCompEvalObj - no need to check the compilation's - freshness, this has already been done. This improves speed and should - also provide some relief to [Bug 1066755]. - -2007-06-12 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CreateInterp): Turn the [info] command into - * generic/tclCmdIL.c (TclInitInfoCmd): an ensemble, making it easier - for third-party code to plug into. - - * generic/tclIndexObj.c (Tcl_WrongNumArgs): - * generic/tclNamesp.c, generic/tclInt.h (tclEnsembleCmdType): Make - Tcl_WrongNumArgs do replacement correctly with ensembles and other - sorts of complex replacement strategies. - -2007-06-11 Miguel Sofer - - * generic/tclExecute.c: comments added to explain iPtr->numLevels - management. - - * generic/tclNamesp.c: tweaks to Tcl_GetCommandFromObj and - * generic/tclObj.c: TclGetNamespaceFromObj; modified the usage of - structs ResolvedCmdName and ResolvedNsname so that the field refNsPtr - is NULL for fully qualified names. - -2007-06-10 Miguel Sofer - - * generic/tclBasic.c: Further TEOvI split, creating a new - * generic/tclCompile.h: TclEvalObjvKnownCommand() function to handle - * generic/tclExecute.c: commands that are already known and are not - traced. INST_INVOKE now calls into this function instead of inlining - parts of TEOvI. Same perf, better isolation. - - ***POTENTIAL INCOMPAT*** There is a subtle issue with the timing of - execution traces that is changed here - first change appeared in my - commit of 2007-04-03 [Patch 1693802], which caused some divergence - between compiled and non-compiled code. - ***THIS CHANGE IS UNDER REVIEW*** - -2007-06-10 Jeff Hobbs - - * README: updated links. [Bug 1715081] - - * generic/tclExecute.c (TclExecuteByteCode): restore support for - INST_CALL_BUILTIN_FUNC1 and INST_CALL_FUNC1 bytecodes to support 8.4- - precompiled sources (math functions). [Bug 1720895] - -2007-06-10 Miguel Sofer - - * generic/tclInt.h: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclvar.c: new macros TclGetCurrentNamespace() and - TclGetGlobalNamespace(); Tcl_GetCommandFromObj and - TclGetNamespaceFromObj rewritten to make the logic clearer; slightly - faster too. - -2007-06-09 Miguel Sofer - - * generic/tclExecute.c (INST_INVOKE): isolated two vars to the small - block where they are actually used. - - * generic/tclObj.c (Tcl_GetCommandFromObj): rewritten to make the - logic clearer; slightly faster too. - - * generic/tclBasic.c: Split TEOv in two, by separating a processor - for non-TCL_OK returns. Also split TEOvI in a full version that - handles non-existing and traced commands, and a separate shorter - version for the regular case. - - * generic/tclBasic.c: Moved the generation of command strings for - * generic/tclTrace.c: traces: previously in Tcl_EvalObjv(), now in - TclCheck[Interp|Execution]Traces(). Also insured that the strings are - properly NUL terminated at the correct length. [Bug 1693986] - - ***POTENTIAL INCOMPATIBILITY in internal API*** - The functions TclCheckInterpTraces() and TclCheckExecutionTraces() (in - internal stubs) used to be noops if the command string was NULL, this - is not true anymore: if the command string is NULL, they generate an - appropriate string from (objc,objv) and use it to call the traces. The - caller might as well not call them with a NULL string if he was - expecting a noop. - - * generic/tclBasic.c: Extend usage of TclLimitReady() and - * generic/tclExecute.c: (new) TclLimitExceeded() macros. - * generic/tclInt.h: - * generic/tclInterp.c: - - * generic/tclInt.h: New TclCleanupCommandMacro for core usage. - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclObj.c: - -2007-06-09 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: add new Tclsh-Info.plist.in. - -2007-06-08 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Changed [string first] and - * doc/string.n: [string last] so that they have clearer descriptions - for those people who know the adage about needles and haystacks. This - follows suggestions on comp.lang.tcl... - -2007-06-06 Miguel Sofer - - * generic/tclParse.c: fix for uninit read. [Bug 1732414] - -2007-06-06 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: add settings for Fix&Continue. - - * unix/configure.in (Darwin): add plist for tclsh; link the - * unix/Makefile.in (Darwin): Tcl and tclsh plists into - * macosx/Tclsh-Info.plist.in (new): their binaries in all cases. - * macosx/Tcl-Common.xcconfig: - - * unix/tcl.m4 (Darwin): fix CF checks in fat 32&64bit builds. - * unix/configure: autoconf-2.59 - -2007-06-05 Don Porter - - * generic/tclBasic.c: Added interp flag value ERR_LEGACY_COPY to - * generic/tclInt.h: control the timing with which the global - * generic/tclNamesp.c: variables ::errorCode and ::errorInfo get - * generic/tclProc.c: updated after an error. This keeps more - * generic/tclResult.c: precise compatibility with Tcl 8.4. - * tests/result.test (result-6.2): [Bug 1649062] - -2007-06-05 Miguel Sofer - - * generic/tclInt.h: - * generic/tclExecute.c: Tcl-stack reform, [Patch 1701202] - -2007-06-03 Daniel Steffen - - * unix/Makefile.in: add datarootdir to silence autoconf-2.6x warning. - -2007-05-30 Don Porter - - * generic/tclBasic.c: Removed code that dealt with - * generic/tclCompile.c: TCL_TOKEN_EXPAND_WORD tokens representing - * generic/tclCompile.h: expanded literal words. These sections were - mostly in place to enable [info frame] to discover line information in - expanded literals. Since the parser now generates a token for each - post-expansion word referring to the right location in the original - script string, [info frame] gets all the data it needs. - - * generic/tclInt.h: Revised the parser so that it never produces - * generic/tclParse.c: TCL_TOKEN_EXPAND_WORD tokens when parsing an - * tests/parse.test: expanded literal word; that is, something like - {*}{x y z}. Instead, generate the series of TCL_TOKEN_SIMPLE_WORD - tokens to represent the words that expansion of the literal string - produces. [RFE 1725186] - -2007-05-29 Jeff Hobbs - - * unix/tclUnixThrd.c (Tcl_JoinThread): fix for 64-bit handling of - pthread_join exit return code storage. [Bug 1712723] - -2007-05-22 Don Porter - - [core-stabilizer-branch] - - * unix/configure: autoconf-2.59 (FC6 fork) - * win/configure: - - * README: Bump version number to 8.5b1 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - -2007-05-18 Don Porter - - * unix/configure: autoconf-2.59 (FC6 fork) - * win/configure: - - * README: Bump version number to 8.5a7 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * generic/tclParse.c: Disable and remove the ALLOW_EXPAND sections - * tests/info.test: that continued to support the deprecated - * tests/mathop.test: {expand} syntax. Updated the few remaining - users of that syntax in the test suite. - -2007-05-17 Donal K. Fellows - - * generic/tclExecute.c (TclLimitReady): Created a macro version of - Tcl_LimitReady just for TEBC, to reduce the amount of times that the - bytecode engine calls out to external functions on the critical path. - * generic/tclInterp.c (Tcl_LimitReady): Added note to remind anyone - doing maintenance that there is a macro version to update. - -2007-05-17 Daniel Steffen - - * generic/tcl.decls: workaround 'make checkstubs' failures from - tclStubLib.c MODULE_SCOPE revert. [Bug 1716117] - -2007-05-16 Joe English - - * generic/tclStubLib.c: Change Tcl_InitStubs(), tclStubsPtr, and the - auxilliary stubs table pointers back to public visibility. - - These symbols need to be exported so that stub-enabled extensions may - be statically linked into an extended tclsh or Big Wish with a - dynamically-linked libtcl. [Bug 1716117] - -2007-05-15 Don Porter - - * win/configure: autoconf-2.59 (FC6 fork) - - * library/reg/pkgIndex.tcl: Bump to registry 1.2.1 to account for - * win/configure.in: [Bug 1682211] fix. - * win/makefile.bc: - * win/tclWinReg.c: - -2007-05-11 Pat Thoyts - - * generic/tclInt.h: Removed TclEvalObjEx and TclGetSrcInfoForPc from - tclInt.h now they are in the internal stubs table. - -2007-05-09 Don Porter - - * generic/tclInt.h: TclFinalizeThreadAlloc() is always defined, so - make sure it is also always declared (with MODULE_SCOPE). - -2007-05-09 Daniel Steffen - - * generic/tclInt.h: fix warning when building threaded with -DPURIFY. - - * macosx/Tcl.xcodeproj/project.pbxproj: add 'DebugUnthreaded' & - * macosx/Tcl.xcodeproj/default.pbxuser: 'DebugLeaks' configs and env - var settings needed to run the 'leaks' tool. - -2007-05-07 Don Porter - - [Tcl Bug 1706140] - - * generic/tclLink.c (LinkTraceProc): Update Tcl_VarTraceProcs so - * generic/tclNamesp.c (Error*Read): they call Tcl_InterpDeleted() - * generic/tclTrace.c (Trace*Proc): for themselves, and do not - * generic/tclUtil.c (TclPrecTraceProc): rely on (frequently buggy) - setting of the TCL_INTERP_DESTROYED flag by the trace core. - - * generic/tclVar.c: Update callers of TclCallVarTraces to not pass - in the TCL_INTERP_DESTROYED flag. Also apply filters so that public - routines only pass documented flag values down to lower level routines - - * generic/tclTrace.c (TclCallVarTraces): The setting of the - TCL_INTERP_DESTROYED flag is now done entirely within the - TclCallVarTraces routine, the only place it can be done right. - -2007-05-06 Donal K. Fellows - - * generic/tclInt.h (ExtraFrameInfo): Create a new mechanism for - * generic/tclCmdIL.c (InfoFrameCmd): conveying what information needs - to be added to the results of [info frame] to replace the hack that - was there before. - * generic/tclProc.c (Tcl_ApplyObjCmd): Use the new mechanism for the - [apply] command, the only part of Tcl itself that needs it (so far). - - * generic/tclInt.decls (TclEvalObjEx, TclGetSrcInfoForPc): Expose - these two functions through the internal stubs table, necessary for - extensions that need to integrate deeply with TIP#280. - -2007-05-05 Donal K. Fellows - - * win/tclWinFile.c (TclpGetUserHome): Squelch type-pun warnings in - * win/tclWinInit.c (TclpSetVariables): Win-specific code not found - * win/tclWinReg.c (AppendSystemError): during earlier work on Unix. - -2007-05-04 Kevin B. Kenny - - * generic/tclIO.c (TclFinalizeIOSubsystem): Added an initializer to - silence a spurious gcc warning about use of an uninitialized - variable. - * tests/encoding.test: Modified so that encoding tests happen in a - private namespace, to avoid polluting the global one. This problem was - discovered when running the test suite '-singleproc 1 -skip exec.test' - because the 'path' variable in encoding.test conflicted with the one - in io.test. - * tests/io.test: Made more of the working variables private to the - namespace. - -2007-05-02 Kevin B. Kenny - - * generic/tclTest.c (SimpleMatchInDirectory): Corrected a refcount - imbalance that affected the filesystem-[147]* tests in the test suite. - Thanks to Don Porter for the patch. [Bug 1710707] - * generic/tclPathObj.c (Tcl_FSJoinPath, Tcl_FSGetNormalizedPath): - Corrected several memory leaks that caused refcount imbalances - resulting in memory leaks on Windows. Thanks to Joe Mistachkin for the - patch. - -2007-05-01 Miguel Sofer - - * generic/tclVar.c (TclPtrSetVar): fixed leak whenever newvaluePtr had - refCount 0 and was used for appending (but not lappending). Thanks to - mistachkin and kbk. [Bug 1710710] - -2007-05-01 Kevin B. Kenny - - * generic/tclIO.c (DeleteChannelTable): Made changes so that - DeleteChannelTable tries to close all open channels, not just the - first. [Bug 1710285] - * generic/tclThread.c (TclFinalizeSynchronization): Make sure that TSD - blocks get freed on non-threaded builds. [Bug 1710825] - * tests/utf.test (utf-25.1--utf-25.4): Modified tests to clean up - after the 'testobj' extension to avoid spurious reports of memory - leaks. - -2007-05-01 Don Porter - - * generic/tclCmdMZ.c (STR_MAP): When [string map] has a pure dict map, - a missing Tcl_DictObjDone() call led to a memleak. [Bug 1710709] - -2007-04-30 Daniel Steffen - - * unix/Makefile.in: add 'tclsh' dependency to install targets that - rely on tclsh, fixes parallel 'make install' from empty build dir. - -2007-04-30 Andreas Kupries - - * generic/tclIO.c (FixLevelCode): Corrected reference count - mismanagement of newlevel, newcode. Changed to allocate the Tcl_Obj's - as late as possible, and only when actually needed. [Bug 1705778, leak - K29] - -2007-04-30 Kevin B. Kenny - - * generic/tclProc.c (Tcl_ProcObjCmd, SetLambdaFromAny): Corrected - reference count mismanagement on the name of the source file in the - TIP 280 code. [Bug 1705778, leak K02 among other manifestations] - -2007-04-25 Donal K. Fellows - - *** 8.5a6 TAGGED FOR RELEASE *** - - * generic/tclProc.c (TclObjInterpProcCore): Only allocate objects for - error message generation when associated with argument names that are - really used. [Bug 1705778, leak K15] - -2007-04-25 Kevin B. Kenny - - * generic/tclIOUtil.c (Tcl_FSChdir): Changed the memory management so - that the path returned from Tcl_FSGetNativePath is not duplicated - before being stored as the current directory, to avoid a memory leak. - [Bug 1705778, leak K01 among other manifestations] - -2007-04-25 Don Porter - - * generic/tclCompExpr.c (ParseExpr): Revised to be sure that an - error return doesn't prevent all literals getting placed on the - litList to be returned to the caller for freeing. Corrects some - memleaks. [Bug 1705778, leak K23] - -2007-04-25 Daniel Steffen - - * unix/Makefile.in (dist): add macosx/*.xcconfig files to src dist; - copy license.terms to dist macosx dir; fix autoheader bits. - -2007-04-24 Miguel Sofer - - * generic/tclListObj.c: reverting [Patch 738900] (committed on - 2007-04-20). Causes some Tk test breakage of unknown importance, but - the impact of the patch itself is likely to be so small that it does - not warrant investigation at this time. - -2007-04-24 Donal K. Fellows - - * generic/tclDictObj.c (DictKeysCmd): Rewrote so that the lock on the - internal representation of a dict is only set when necessary. [Bug - 1705778, leak K04] - (DictFilterCmd): Added code to drop the lock in the trivial match - case. [Bug 1705778, leak K05] - -2007-04-24 Kevin B. Kenny - - * generic/tclBinary.c: Addressed several code paths where the error - return from the 'binary format' command leaked the result buffer. - * generic/tclListObj.c (TclLsetFlat): Fixed a bug where the new list - under construction was leaked in the error case. [Bug 1705778, leaks - K13 and K14] - -2007-04-24 Jeff Hobbs - - * unix/Makefile.in (dist): add platform library package to src dist - -2007-04-24 Don Porter - - * generic/tclCompExpr.c (ParseExpr): Memory leak in error case; the - literal Tcl_Obj was not getting freed. [Bug 1705778, leak #1 (new)] - - * generic/tclNamesp.c (Tcl_DeleteNamespace): Corrected flaw in the - flag marking scheme to be sure that global namespaces are freed when - their interp is deleted. [Bug 1705778] - -2007-04-24 Kevin B. Kenny - - * generic/tclExecute.c (TclExecuteByteCode): Plugged six memory leaks - in bignum arithmetic. - * generic/tclIOCmd.c (Tcl_ReadObjCmd): Plugged a leak of the buffer - object if the physical read returned an error and the bypass area had - no message. - * generic/tclIORChan.c (TclChanCreateObjCmd): Plugged a leak of the - return value from the "initialize" method of a channel handler. - (All of the above under [Bug 1705778]) - -2007-04-23 Daniel Steffen - - * generic/tclCkalloc.c: fix warnings from gcc build configured with - * generic/tclCompile.c: --enable-64bit --enable-symbols=all. - * generic/tclExecute.c: - - * unix/tclUnixFCmd.c: add workaround for crashing bug in fts_open() - * unix/tclUnixInit.c: without FTS_NOSTAT on 64bit Darwin 8 or earlier. - - * unix/tclLoadDyld.c (TclpLoadMemory): fix (void*) arithmetic. - - * macosx/Tcl-Common.xcconfig: enable more warnings. - - * macosx/Tcl.xcodeproj/project.pbxproj: add 'DebugMemCompile' build - configuration that calls configure with --enable-symbols=all; override - configure check for __attribute__((__visibility__("hidden"))) in Debug - configuration to restore availability of ZeroLink. - - * macosx/tclMacOSXNotify.c: fix warnings. - - * macosx/tclMacOSXFCmd.c: const fixes. - - * macosx/Tcl-Common.xcconfig: fix whitespace. - * macosx/Tcl-Debug.xcconfig: - * macosx/Tcl-Release.xcconfig: - * macosx/README: - - * macosx/GNUmakefile: fix/add copyright and license refs. - * macosx/tclMacOSXBundle.c: - * macosx/Tcl-Info.plist.in: - * macosx/Tcl.xcode/project.pbxproj: - * macosx/Tcl.xcodeproj/project.pbxproj: - - * unix/configure.in: install license.terms into Tcl.framework. - * unix/configure: autoconf-2.59 - -2007-04-23 Don Porter - - * generic/tclVar.c (UnsetVarStruct): Make sure the - TCL_INTERP_DESTROYED flags gets passed to unset trace routines so they - can respond appropriately. [Bug 1705778, leak #9] - -2007-04-23 Miguel Sofer - - * generic/tclCompile.c (TclFreeCompileEnv): Tip 280's new field - extCmdMapPtr was not being freed. [Bug 1705778, leak #1] - -2007-04-23 Kevin B. Kenny - - * generic/tclCompCmds.c (TclCompileUpvarCmd): Plugged a memory leak in - 'upvar' when compiling (a) upvar outside a proc, (b) upvar with a - syntax error, or (c) upvar where the frame index is not known at - compile time. - * generic/tclCompExpr.c (ParseExpr): Plugged a memory leak when - parsing expressions that contain syntax errors. - * generic/tclEnv.c (ReplaceString): Clear memory correctly when - growing the cache to avoid reads of uninitialised data. - * generic/tclIORChan.c (TclChanCreateObjCmd, FreeReflectedChannel): - Plugged two memory leaks. - * generic/tclStrToD.c (AccumulateDecimalDigit): Fixed a mistake where - we'd run beyond the end of the 'pow10_wide' array if a number begins - with a string of more than 'maxpow10_wide' zeroes. - * generic/tclTest.c (Testregexpobjcmd): Removed an invalid access - beyond the end of 'objv' in 'testregexp -about'. - All of these issues reported under [Bug 1705778] - detected with the - existing test suite, no new regression tests required. - -2007-04-22 Miguel Sofer - - * generic/tclVar.c (TclDeleteNamespaceVars): fixed access to freed - memory detected by valgrind: Tcl_GetCurrentNamespace was being - called after freeing root CallFrame (on interp deletion). - -2007-04-20 Miguel Sofer - - * generic/tclListObj.c (SetListFromAny): avoid discarding internal - reps of objects converted to singleton lists. [Patch 738900] - -2007-04-20 Kevin B. Kenny - - * doc/clock.n: Corrected a silly error (transposed 'uppercase' and - 'lowercase' in clock.n. [Bug 1656002] - Clarified that [clock scan] does not recognize a locale's alternative - calendar. - Deleted an entirely superfluous (and also incorrect) remark about the - effect of Daylight Saving Time on relative times in [clock scan]. [Bug - 1582951] - * library/clock.tcl: Corrected an error in skipping over the %Ey field - on input. - * library/msgs/ja.msg: - * tools/loadICU.tcl: Corrected several localisation faults in the - Japanese locale (most notably, incorrect dates for the Emperors' - eras). [Bug 1637471]. Many thanks to SourceForge user 'nyademo' for - pointing this out and developing a fix. - * generic/tclPathObj.c: Corrected a 'const'ness fault that caused - bitter complaints from MSVC. - * tests/clock.test (clock-40.1, clock-58.1, clock-59.1): Corrected a - test case that depended on ":localtime" being able to handle dates - prior to the Posix epoch. [Bug 1618445] Added a test case for the - dates of the Japanese emperors. [Bug 1637471] Added a regression test - for military time zone input conversion. [Bug 1586828] - * generic/tclGetDate.y (MilitaryTable): Fixed an ancient bug where the - military NZA time zones had the signs reversed. [Bug 1586828] - * generic/tclDate.c: Regenerated. - * doc/Notifier.3: Documented Tcl_SetNotifier and Tcl_ServiceModeHook. - Quite against my better judgment. [Bug 414933] - * generic/tclBasic.c, generic/tclCkalloc.c, generic/tclClock.c: - * generic/tclCmdIL.c, generic/tclCmdMZ.c, generic/tclFCmd.c: - * generic/tclFileName.c, generic/tclInterp.c, generic/tclIO.c: - * generic/tclIOUtil.c, generic/tclNamesp.c, generic/tclObj.c: - * generic/tclPathObj.c, generic/tclPipe.c, generic/tclPkg.c: - * generic/tclResult.c, generic/tclTest.c, generic/tclTestObj.c: - * generic/tclVar.c, unix/tclUnixChan.c, unix/tclUnixTest.c: - * win/tclWinLoad.c, win/tclWinSerial.c: Replaced commas in varargs - with string concatenation where possible. [Patch 1515234] - * library/tzdata/America/Tegucigalpa: - * library/tzdata/Asia/Damascus: Olson's tzdata 2007e. - -2007-04-19 Donal K. Fellows - - * generic/regcomp.c, generic/regc_cvec.c, generic/regc_lex.c, - * generic/regc_locale.c: Improve the const-correctness of the RE - compiler. - -2007-04-18 Miguel Sofer - - * generic/tclExecute.c (INST_LSHIFT): fixed a mistake introduced in - version 1.266 ('=' became '=='), which effectively turned the block - that handles native shifts into dead code. This explains why the - testsuite did not pick this mistake. Rewrote to make the intention - clear. - - * generic/tclInt.h (TclDecrRefCount): change the order of the - branches, use empty 'if ; else' to handle use in unbraced outer - if/else conditions (as already done in tcl.h) - - * generic/tclExecute.c: slight changes in Tcl_Obj management. - -2007-04-17 Kevin B. Kenny - - * library/clock.tcl: Fixed the naming of - ::tcl::clock::ReadZoneinfoFile because (yoicks!) it was in the global - namespace. - * doc/clock.n: Clarified the cases in which legacy time zone is - recognized. [Bug 1656002] - -2007-04-17 Miguel Sofer - - * generic/tclExecute.c: fixed checkInterp logic [Bug 1702212] - -2007-04-16 Donal K. Fellows - - * various (including generic/tclTest.c): Complete the purge of K&R - function definitions from manually-written code. - -2007-04-15 Kevin B. Kenny - - * generic/tclCompCmds.c: added a cast to silence a compiler error on - VC2005. - * library/clock.tcl: Restored unique-prefix matching of keywords on - the [clock] command. [Bug 1690041] - * tests/clock.test: Added rudimentary test cases for unique-prefix - matching of keywords. - -2007-04-14 Miguel Sofer - - * generic/tclExecute.c: removed some code at INST_EXPAND_SKTOP that - duplicates functionality already present at checkForCatch. - -2007-04-12 Miguel Sofer - - * generic/tclExecute.c: new macros OBJ_AT_TOS, OBJ_UNDER_TOS, - OBJ_AT_DEPTH(n) and CURR_DEPTH that remove all direct references to - tosPtr from TEBC (after initialisation and the code at the label - cleanupV_pushObjResultPtr). - -2007-04-11 Miguel Sofer - - * generic/tclCompCmds.c: moved all exceptDepth management to the - macros - the decreasing half was managed by hand. - -2007-04-10 Donal K. Fellows - - * generic/tclInt.h (TclNewLiteralStringObj): New macro to make - allocating literal string objects (i.e. objects whose value is a - constant string) easier and more efficient, by allowing the omission - of the length argument. Based on [Patch 1529526] (afredd) - * generic/*.c: Make use of this (in many files). - -2007-04-08 Miguel Sofer - - * generic/tclCompile (tclInstructionTable): Fixed bugs in description - of dict instructions. - -2007-04-07 Miguel Sofer - - * generic/tclCompile (tclInstructionTable): Fixed bug in description - of INST_START_COMMAND. - - * generic/tclExecute.c (TEBC): Small code reduction. - -2007-04-06 Miguel Sofer - - * generic/tclExecute.c (TEBC): - * generic/tclNamespace.c (NsEnsembleImplementationCmd): - * generic/tclProc.c (InitCompiledLocals, ObjInterpProcEx) - (TclObjInterpProcCore, ProcCompileProc): Code reordering to reduce - branching and improve branch prediction (assume that forward branches - are typically not taken). - -2007-04-03 Miguel Sofer - - * generic/tclExecute.c: INST_INVOKE optimisation. [Patch 1693802] - -2007-04-03 Don Porter - - * generic/tclNamesp.c: Revised ErrorCodeRead and ErrorInfoRead trace - routines so they guarantee the ::errorCode and ::errorInfo variable - always appear to exist. [Bug 1693252] - -2007-04-03 Miguel Sofer - - * generic/tclInt.decls: Moved TclGetNamespaceFromObj() to the - * generic/tclInt.h: internal stubs table; regen. - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2007-04-02 Miguel Sofer - - * generic/tclBasic.c: Added bytecode compilers for the variable - * generic/tclCompCmds.c: linking commands: 'global', 'variable', - * generic/tclCompile.h: 'upvar', 'namespace upvar' [Patch 1688593] - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclVar.c: - -2007-04-02 Don Porter - - * generic/tclBasic.c: Replace arrays on the C stack and ckalloc - * generic/tclExecute.c: calls with TclStackAlloc calls to use memory - * generic/tclFCmd.c: on Tcl's evaluation stack. - * generic/tclFileName.c: - * generic/tclIOCmd.c: - * generic/tclIndexObj.c: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * generic/tclTrace.c: - * unix/tclUnixPipe.c: - -2007-04-01 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript, TclPrintInstruction): - * generic/tclExecute.c (TclExecuteByteCode): Changed the definition of - INST_START_CMD so that it knows how many commands start at the current - location. This makes the interpreter command counter correct without - requiring a large number of instructions to be issued. (See my change - from 2007-01-19 for what triggered this.) - -2007-03-30 Don Porter - - * generic/tclCompile.c: - * generic/tclCompExpr.c: - * generic/tclCompCmds.c: Replace arrays on the C stack and - ckalloc calls with TclStackAlloc calls to use memory on Tcl's - evaluation stack. - - * generic/tclCmdMZ.c: Revised [string to* $s $first $last] - implementation to reduce number of allocs/copies. - - * tests/string.test: More [string reverse] tests. - -2007-03-30 Miguel Sofer - - * generic/tclExecute.c: optimise the lookup of elements of indexed - arrays. - -2007-03-29 Miguel Sofer - - * generic/tclProc.c (Tcl_ApplyObjCmd): - * tests/apply.test (9.3): Fixed Tcl_Obj leak on error return; an - unneeded ref to lambdaPtr was being set and not released on an error - return path. - -2007-03-28 Don Porter - - * generic/tclCmdMZ.c (STR_REVERSE): Implement the actual [string - reverse] command in terms of the new TclStringObjReverse() routine. - - * generic/tclInt.h (TclStringObjReverse): New internal routine - * generic/tclStringObj.c (TclStringObjReverse): that implements the - [string reverse] operation, making use of knowledge/surgery of the - String intrep to minimize the number of allocs and copies needed to do - the job. - -2007-03-27 Don Porter - - * generic/tclCmdMZ.c (STR_MAP): Replace ckalloc calls with - TclStackAlloc calls. - -2007-03-24 Zoran Vasiljevic - - * win/tclWinThrd.c: Thread exit handler marks the current thread as - un-initialized. This allows exit handlers that are registered later to - re-initialize this subsystem in case they need to use some sync - primitives (cond variables) from this file again. - -2007-03-23 Miguel Sofer - - * generic/tclBasic.c (DeleteInterpProc): pop the root frame pointer - before deleting the global namespace [Bug 1658572] - -2007-03-23 Kevin B. Kenny - - * win/Makefile.in: Added code to keep a Cygwin path name from leaking - into LIBRARY_DIR when doing 'make test' or 'make runtest'. - -2007-03-22 Don Porter - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Replaced arrays on the - C stack and ckalloc calls with TclStackAlloc calls to use memory on - Tcl's evaluation stack. - - * generic/tclExecute.c: Revised GrowEvaluationStack to take an - argument specifying the growth required by the caller, so that a - single reallocation / copy is the most that will ever be needed even - when required growth is large. - -2007-03-21 Don Porter - - * generic/tclExecute.c: More ckalloc -> ckrealloc conversions. - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclParse.c: - * generic/tclPreserve.c: - * generic/tclStringObj.c: - * generic/tclUtil.c: - -2007-03-20 Don Porter - - * generic/tclEnv.c: Some more ckalloc -> ckrealloc replacements. - * generic/tclLink.c: - -2007-03-20 Kevin B. Kenny - - * generic/tclDate.c: Rebuilt, despite Donal Fellows's comment when - committing it that no rebuild was required. - * generic/tclGetDate.y: According to Donal Fellows, "Introduce modern - formatting standards; no need for rebuild of tclDate.c." - - * library/tzdata/America/Cambridge_Bay: - * library/tzdata/America/Havana: - * library/tzdata/America/Inuvik: - * library/tzdata/America/Iqaluit: - * library/tzdata/America/Pangnirtung: - * library/tzdata/America/Rankin_Inlet: - * library/tzdata/America/Resolute: - * library/tzdata/America/Yellowknife: - * library/tzdata/Asia/Choibalsan: - * library/tzdata/Asia/Dili: - * library/tzdata/Asia/Hovd: - * library/tzdata/Asia/Jakarta: - * library/tzdata/Asia/Jayapura: - * library/tzdata/Asia/Makassar: - * library/tzdata/Asia/Pontianak: - * library/tzdata/Asia/Ulaanbaatar: - * library/tzdata/Europe/Istanbul: Upgraded to Olson's tzdata2007d. - - * generic/tclListObj.c (TclLsetList, TclLsetFlat): - * tests/lset.test: Changes to deal with shared internal representation - for lists passed to the [lset] command. Thanks to Don Porter for - fixing this issue. [Bug 1677512] - -2007-03-19 Don Porter - - * generic/tclCompile.c: Revise the various expansion routines for - CompileEnv fields to use ckrealloc() where appropriate. - - * generic/tclBinary.c (Tcl_SetByteArrayLength): Replaced ckalloc() / - memcpy() sequence with ckrealloc() call. - - * generic/tclBasic.c (Tcl_CreateMathFunc): Replaced some calls to - * generic/tclEvent.c (Tcl_CreateThread): Tcl_Alloc() with calls - * generic/tclObj.c (UpdateStringOfBignum): to ckalloc(), which - * unix/tclUnixTime.c (SetTZIfNecessary): better supports memory - * win/tclAppInit.c (setargv): debugging. - -2007-03-19 Donal K. Fellows - - * doc/regsub.n: Corrected example so that it doesn't recommend - potentially unsafe practice. Many thanks to Konstantin Kushnir - for reporting this. - -2007-03-17 Kevin B. Kenny - - * win/tclWinReg.c (GetKeyNames): Size the buffer for enumerating key - names correctly, so that Unicode names exceeding 127 chars can be - retrieved without crashing. [Bug 1682211] - * tests/registry.test (registry-4.9): Added test case for the above - bug. - -2007-03-15 Mo DeJong - - * generic/tclIOUtil.c (Tcl_Stat): Reimplement workaround to avoid gcc - warning by using local variables. When the macro argument is of type - long long instead of long, the incorrect warning is not generated. - -2007-03-15 Mo DeJong - - * win/Makefile.in: Fully qualify LIBRARY_DIR so that `make test` does - not depend on working dir. - -2007-03-15 Mo DeJong - - * tests/parse.test: Add two backslash newline parse tests. - -2007-03-12 Don Porter - - * generic/tclExecute.c (INST_FOREACH_STEP4): Make private copy of - * tests/foreach.test (foreach-10.1): value list to be assigned to - variables so that shimmering of that list doesn't lead to invalid - pointers. [Bug 1671087] - - * generic/tclEvent.c (HandleBgErrors): Make efficient private copy - * tests/event.test (event-5.3): of the command prefix for the interp's - background error handling command to avoid panics due to pointers to - memory invalid after shimmering. [Bug 1670155] - - * generic/tclNamesp.c (NsEnsembleImplementationCmd): Make efficient - * tests/namespace.test (namespace-42.8): private copy of the - command prefix as we invoke the command appropriate to a particular - subcommand of a particular ensemble to avoid panic due to shimmering - of the List intrep. [Bug 1670091] - - * generic/tclVar.c (TclArraySet): Make efficient private copy of - * tests/var.test (var-17.1): the "list" argument to [array set] to - avoid crash due to shimmering invalidating pointers. [Bug 1669489] - -2007-03-12 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Fix problems with declaration - positioning and memory leaks. [Bug 1679072] - -2007-03-11 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Ensure that a list is - correctly reversed even if its internal representation is shared - without the object itself being shared. [Bug 1675044] - -2007-03-10 Miguel Sofer - - * generic/tclCmdIL (Tcl_LsortObjCmd): changed fix to [Bug 1675116] to - use the cheaper TclListObjCopy() instead of Tcl_DuplicateObj(). - -2007-03-09 Andreas Kupries - - * library/platform/shell.tcl: Made more robust if an older platform - * library/platform/pkgIndex.tcl: package is present in the inspected - * unix/Makefile.in: shell. Package forget it to prevent errors. Bumped - * win/Makefile.in: package version to 1.1.3, and updated the Makefiles - installing it as Tcl Module. - -2007-03-09 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Handle tricky case with loss - * tests/cmdIL.test (cmdIL-1.29): of list rep during sorting due - to shimmering. [Bug 1675116] - -2007-03-09 Kevin B. Kenny - - * library/clock.tcl (ReadZoneinfoFile): Added Y2038 compliance to the - code for version-2 'zoneinfo' files. - * tests/clock.test (clock-56.3): Added a test case for Y2038 and - 'zoneinfo'. Modified test initialisation to use the - 'loadTestedCommands' function of tcltest to bring in the correct path - for the registry library. - -2007-03-08 Don Porter - - * generic/tclListObj.c (TclLsetList): Rewrite so that the routine - itself does not do any direct intrep surgery. Better isolates those - things into the implementation of the "list" Tcl_ObjType. - -2007-03-08 Donal K. Fellows - - * generic/tclListObj.c (TclLindexList, TclLindexFlat): Moved these - functions to tclListObj.c from tclCmdIL.c to mirror the way that the - equivalent functions for [lset]'s guts are arranged. - -2007-03-08 Kevin B. Kenny - - * library/clock.tcl: Further tweaks to the Windows time zone table - (restoring missing Mexican time zones). Added rudimentary handling of - version-2 'zoneinfo' files. Update US DST rules so that zones such as - 'EST5EDT' get the correct transition dates. - * tests/clock.test: Added rudimentary test cases for 'zoneinfo' - parsing. Adjusted several tests that depended on obsolete US DST - transition rules. - -2007-03-07 Daniel Steffen - - * macosx/tclMacOSXNotify.c: add spinlock debugging and sanity checks. - - * macosx/Tcl.xcodeproj/project.pbxproj: ensure gcc version used by - * macosx/Tcl.xcodeproj/default.pbxuser: Xcode and configure/make are - * macosx/Tcl-Common.xcconfig: consistent and independent of - gcc_select default and CC env var; fixes for Xcode 3.0. - - * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check - * unix/configure: autoconf-2.59 - -2007-03-07 Don Porter - - * generic/tclCmdIL.c (TclLindex*): Rewrites to make efficient - private copies of the list and indexlist arguments, so we can operate - on the list elements directly with no fear of shimmering effects. - Replaces defensive coding schemes that are otherwise required. End - result is that TclLindexList is entirely a wrapper around - TclLindexFlat, which is now the core engine of all [lindex] - operations. - - * generic/tclObj.c (Tcl_AppendAllObjTypes): Converted to simpler - list validity test. - -2007-03-07 Donal K. Fellows - - * generic/tclRegexp.c (TclRegAbout): Generate information about a - regexp as a Tcl_Obj instead of as a string, which is more efficient. - -2007-03-07 Kevin B. Kenny - - * library/clock.tcl: Adjusted Windows time zone table to handle new US - DST rules by locale rather than as Posix time zone spec. - * tests/clock.test (clock-39.6, clock-49.2, testclock::registry): - Adjusted tests to simulate new US rules. - * library/tzdata/America/Indiana/Winamac: - * library/tzdata/Europe/Istanbul: - * library/tzdata/Pacific/Easter: - Olson's tzdata2007c. - -2007-03-05 Andreas Kupries - - * library/platform/shell.tcl (::platform::shell::RUN): In the case of - * library/platform/pkgIndex.tcl: a failure put the captured stderr - * unix/Makefile.in: into the error message to aid in debugging. Bumped - * win/Makefile.in: package version to 1.1.2, and updated the makefiles - installing it as Tcl Module. - -2007-03-03 Donal K. Fellows - - * generic/tclLink.c (LinkedVar): Added macro to conceal at least some - of the pointer hackery. - -2007-03-02 Don Porter - - * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Added missing - TclInvalidateStringRep() call when we directly manipulate the intrep - of an unshared "list" Tcl_Obj. [Bug 1672585] - - * generic/tclCmdIL.c (Tcl_JoinObjCmd): Revised [join] implementation - to append Tcl_Obj's instead of strings. [RFE 1669420] - - * generic/tclCmdIL.c (Info*Cmd): Code simplifications and - optimizations. - -2007-03-02 Donal K. Fellows - - * generic/tclCompile.c (TclPrintInstruction): Added a scheme to allow - * generic/tclCompile.h (AuxDataPrintProc): aux-data to be printed - * generic/tclCompCmds.c (Print*Info): out for debugging. For - this to work, immediate operands referring to aux-data must be - identified as such in the instruction descriptor table using - OPERAND_AUX4 (all are always 4 bytes). - - * generic/tclExecute.c (TclExecuteByteCode): Rewrote the compiled - * generic/tclCompCmds.c (TclCompileDictCmd): [dict update] so that it - * generic/tclCompile.h (DictUpdateInfo): stores critical - * tests/dict.test (dict-21.{14,15}): non-varying data in an - aux-data value instead of a (shimmerable) literal. [Bug 1671001] - -2007-03-01 Don Porter - - * generic/tclCmdIL.c (Tcl_LinsertObjCmd): Code simplifications - and optimizations. - - * generic/tclCmdIL.c (Tcl_LreplaceObjCmd): Code simplifications - and optimizations. - - * generic/tclCmdIL.c (Tcl_LrangeObjCmd): Rewrite in the same - spirit; avoid shimmer effects rather than react to them. - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Stop throwing away - * tests/foreach.test (foreach-1.14): useful error information when - loop variable sets fail. - - * generic/tclCmdIL.c (Tcl_LassignObjCmd): Rewrite to make an - efficient private copy of the list argument, so we can operate on the - list elements directly with no fear of shimmering effects. Replaces - defensive coding schemes that are otherwise required. - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Rewrite to make - efficient private copies of the variable and value lists, so we can - operate on them without any special shimmer defense coding schemes. - -2007-03-01 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileForeachCmd): Prevent an unexpected - * tests/foreach.test (foreach-9.1): infinite loop when the - variable list is empty and the foreach is compiled. [Bug 1671138] - -2007-02-26 Andreas Kupries - - * generic/tclIORChan.c (FreeReflectedChannel): Added the missing - refcount release between NewRC and FreeRC for the channel handle - object, spotted by Don Porter. [Bug 1667990] - -2007-02-26 Don Porter - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Removed surplus - copying of the objv array that used to be a workaround for [Bug - 404865]. That bug is long fixed. - -2007-02-24 Don Porter - - * generic/tclBasic.c: Use new interface in Tcl_EvalObjEx so that the - recounting logic of the List internal rep need not be repeated there. - Better encapsulation of internal details. - - * generic/tclInt.h: New internal routine TclListObjCopy() used - * generic/tclListObj.c: to efficiently do the equivalent of [lrange - $list 0 end]. After some experience with this, might be a good - candidate for exposure as a public interface. It's useful for callers - of Tcl_ListObjGetElements() who want to control the ongoing validity - of the returned objv pointer. - -2007-02-22 Andreas Kupries - - * tests/pkg.test: Added tests for the case of an alpha package - satisfying a require for the regular package, demonstrating a corner - case specified in TIP#280. More notes in the comments to the test. - -2007-02-20 Jan Nijtmans - - * generic/tclInt.decls: Added "const" specifiers in TclSockGetPort - * generic/tclIntDecls.h: regenerated - * generic/*.c: - * unix/tclUnixChan.c - * unix/tclUnixPipe.c - * win/tclWinPipe.c - * win/tclWinSock.c: Added many "const" specifiers in implementation. - -2007-02-20 Don Porter - - * doc/tcltest.n: Typo fix. [Bug 1663539] - -2007-02-20 Pat Thoyts - - * generic/tclFileName.c: Handle extended paths on Windows NT and - * generic/tclPathObj.c: above. These have a \\?\ prefix. [Bug - * win/tclWinFile.c: 1479814] - * tests/winFCmd.test: Tests for extended path handling. - -2007-02-19 Jeff Hobbs - - * unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch. - * unix/configure: autoconf-2.59 - - * generic/tclIOUtil.c (Tcl_FSEvalFileEx): safe incr of objPtr ref. - -2007-02-18 Donal K. Fellows - - * doc/chan.n, doc/clock.n, doc/eval.n, doc/exit.n, doc/expr.n: - * doc/interp.n, doc/open.n, doc/platform_shell.n, doc/pwd.n: - * doc/refchan.n, doc/regsub.n, doc/scan.n, doc/tclvars.n, doc/tm.n: - * doc/unload.n: Apply [Bug 1610310] to fix typos. Thanks to Larry - Virden for spotting them. - - * doc/interp.n: Partial fix of [Bug 1662436]; rest requires some - policy decisions on what should and shouldn't be safe commands from - the "new in 8.5" set. - -2007-02-13 Kevin B. Kenny - - * tools/fix_tommath_h.tcl: Further tweaking for the x86-64. The change - is to make 'mp_digit' be an 'unsigned int' on that platform; since - we're using only 32 bits of it, there's no reason to make it a 64-bit - 'unsigned long.' - * generic/tclTomMath.h: Regenerated. - -2007-02-13 Donal K. Fellows - - * doc/re_syntax.n: Corrected description of 'print' class [Bug - 1614687] and enhanced description of 'graph' class. - -2007-02-12 Kevin B. Kenny - - * tools/fix_tommath_h.tcl: Added code to patch out a check for - __x86_64__ that caused Tommath to use __attributes(TI)__ for the - mp_word type. Tetra-int's simply fail on too many gcc-glibc-OS - combinations to be ready for shipment today, even if they work for - some of us. This change allows reversion of das's change of 2006-08-18 - that accomplised the same thing on Darwin. [Bugs 1601380, 1603737, - 1609936, 1656265] - * generic/tclTomMath.h: Regenerated. - * library/tzdata/Africa/Asmara: - * library/tzdata/Africa/Asmera: - * library/tzdata/America/Nassau: - * library/tzdata/Atlantic/Faeroe: - * library/tzdata/Atlantic/Faroe: - * library/tzdata/Australia/Eucla: - * library/tzdata/Pacific/Easter: Rebuilt from Olson's tzdata2007b. - -2007-02-09 Joe Mistachkin - - * win/nmakehlp.c: Properly cleanup after nmakehlp, including the - * win/makefile.vc: vcX0.pch file. - -2007-02-08 Jeff Hobbs - - * unix/tclUnixInit.c (TclpCheckStackSpace): do stack size checks with - unsigned size_t to correctly validate stackSize in the 2^31+ range. - [Bug 1654104] - -2007-02-08 Don Porter - - * generic/tclNamesp.c: Corrected broken logic in Tcl_DeleteNamespace - * tests/namespace.test: introduced in Patch 1577278 that caused - [namespace delete ::] to be effective only at level #0. New test - namespace-7.7 should prevent similar error in the future [Bug 1655305] - -2007-02-06 Don Porter - - * generic/tclNamesp.c: Corrected broken implementation of the - * tests/namespace.test: TclMatchIsTrivial optimization on [namespace - children $namespace $pattern]. - -2007-02-04 Daniel Steffen - - * unix/tcl.m4: use gcc4's __attribute__((__visibility__("hidden"))) if - available to define MODULE_SCOPE effective on all platforms. - * unix/configure.in: add caching to -pipe and zoneinfo checks. - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-02-03 Joe Mistachkin - - * win/rules.vc: Fix platform specific file copy macros for downlevel - Windows. - -2007-01-29 Don Porter - - * generic/tclResult.c: Added optimization case to TclTransferResult to - cover common case where there's big savings over the fully general - path. Thanks to Peter MacDonald. [Bug 1626518] - - * generic/tclLink.c: Broken linked float logic corrected. Thanks to - Andy Goth. [Bug 1602538] - - * doc/fcopy.n: Typo fix. [Bug 1630627] - -2007-01-28 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: extract build settings that - * macosx/Tcl.xcodeproj/default.pbxuser: were common to multiple - * macosx/Tcl-Common.xcconfig (new file): configurations into external - * macosx/Tcl-Debug.xcconfig (new file): xcconfig files; add extra - * macosx/Tcl-Release.xcconfig (new file): configurations for building - with SDKs and 64bit; convert legacy jam-based 'Tcl' target to native - target with single script phase; correct syntax of build setting - references to use $() throughout. - - * macosx/README: document new Tcl.xcodeproj configurations; other - minor updates/corrections. - - * generic/tcl.h: update location of version numbers in macosx files. - - * macosx/Tcl.xcode/project.pbxproj: restore 'tcltest' target to - * macosx/Tcl.xcode/default.pbxuser: working order by replicating - applicable changes to Tcl.xcodeproj since 2006-07-20. - -2007-01-25 Daniel Steffen - - * unix/tcl.m4: integrate CPPFLAGS into CFLAGS as late as possible and - move (rather than duplicate) -isysroot flags from CFLAGS to CPPFLAGS - to avoid errors about multiple -isysroot flags from some older gcc - builds. - - * unix/configure: autoconf-2.59 - -2007-01-22 Donal K. Fellows - - * compat/memcmp.c (memcmp): Reworked so that arithmetic is never - performed upon void pointers, since that is illegal. [Bug 1631017] - -2007-01-19 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Reduce the frequency with - which we issue INST_START_CMD, making bytecode both more compact and - somewhat faster. The optimized case is where we would otherwise be - issuing a sequence of those instructions; in those cases, it is only - ever the first one encountered that could possibly trigger. - -2007-01-19 Joe Mistachkin - - * tools/man2tcl.c: Include stdlib.h for exit() and improve comment - detection. - * win/nmakehlp.c: Update usage. - * win/makefile.vc: Properly build man2tcl.c for MSVC8. - -2007-01-19 Daniel Steffen - - * macosx/tclMacOSXFCmd.c (TclMacOSXSetFileAttribute): on some versions - of Mac OS X, truncate() fails on resource forks, in that case use - open() with O_TRUNC instead. - - * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of - OSSpinLock(Un)Lock API. - - * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars - * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running - testsuite from Xcode. - - * tests/env.test: add extra system env vars that need to be preserved - on some Mac OS X versions for testsuite to work. - - * unix/Makefile.in: Move libtommath defines into configure.in to - * unix/configure.in: avoid replicating them across multiple - * macosx/Tcl.xcodeproj/project.pbxproj: buildsystems. - - * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] - (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS - when present in CFLAGS to avoid discrepancies between what headers - configure sees during preprocessing tests and compiling tests. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-01-18 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Make sure that when parsing - an expanded literal fails, a correct bytecode sequence is still - issued. [Bug 1638414]. Also make sure that the start of the expansion - bytecode sequence falls inside the span of bytecodes for a command. - * tests/compile.test (compile-16.24): Added test for [Bug 1638414] - -2007-01-17 Donal K. Fellows - - * generic/tclIO.c: Added macros to make usage of ChannelBuffers - clearer. - -2007-01-11 Joe English - - * win/tcl.m4(CFLAGS_WARNING): Remove "-Wconversion". This was removed - from unix/tcl.m4 2004-07-16 but not from here. - * win/configure: Regenerated. - -2007-01-11 Pat Thoyts - - * win/makefile.vc: Fixes to work better on Win98. Read version numbers - * win/nmakehlp.c: from package index file to avoid keeping numbers in - * win/rules.vc: the makefile where they may become de-synchronized. - -2007-01-10 Donal K. Fellows - - * generic/regcomp.c (compile, freev): Define a strategy for - * generic/regexec.c (exec): managing the internal - * generic/regguts.h (AllocVars, FreeVars): vars of the RE engine to - * generic/regcustom.h (AllocVars, FreeVars): reduce C stack usage. - This will make Tcl as a whole much less likely to run out of stack - space... - -2007-01-09 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileLindexCmd): - * tests/lindex.test (lindex-9.2): Fix silly bug that ended up - sometimes compiling list arguments in the wrong order. [Bug 1631364] - -2007-01-03 Kevin B. Kenny - - * generic/tclDate.c: Regenerated to recover a lost fix from patthoyts. - [Bug 1618523] - -2006-12-26 Mo DeJong - - * generic/tclIO.c (Tcl_GetsObj): Avoid checking for for the LF in a - possible CRLF sequence when EOF has already been found. - -2006-12-26 Mo DeJong - - * generic/tclEncoding.c (EscapeFromUtfProc): Clear the - TCL_ENCODING_END flag when end bytes are written. This fix keep this - method from writing escape bytes for an encoding like iso2022-jp - multiple times when the escape byte overlap with the end of the IO - buffer. - * tests/io.test: Add test for escape byte overlap issue. - -2006-12-19 Donal K. Fellows - - * unix/tclUnixThrd.c (Tcl_GetAllocMutex, TclpNewAllocMutex): Add - intermediate variables to shut up unwanted warnings. [Bug 1618838] - -2006-12-19 Daniel Steffen - - * unix/tclUnixThrd.c (TclpInetNtoa): fix for 64 bit. - - * unix/tcl.m4 (Darwin): --enable-64bit: verify linking with 64bit - -arch flag succeeds before enabling 64bit build. - * unix/configure: autoconf-2.59 - -2006-12-17 Daniel Steffen - - * tests/macOSXLoad.test (new file): add testing of .bundle loading and - * tests/load.test: unloading on Darwin (in addition - * tests/unload.test: to existing tests of .dylib - loading). - * macosx/Tcl.xcodeproj/project.pbxproj: add building of dltest - binaries so that testsuite run from Xcode can use them; fix testsuite - run script - * unix/configure.in: add support for building dltest binaries as - * unix/dltest/Makefile.in: .bundle (in addition to .dylib) on Darwin. - * unix/Makefile.in: add stub lib dependency to dltest target. - * unix/configure: autoconf-2.59 - - * tests/append.test: fix cleanup failure when all tests are skipped. - - * tests/chan.test (chan-16.9): cleanup chan event handler to avoid - causing error in event.test when running testsuite with -singleproc 1. - - * tests/info.test: add !singleTestInterp constraint to tests that fail - when running testsuite with -singleproc 1. [Bug 1605269] - -2006-12-14 Donal K. Fellows - - * doc/string.n: Fix example. [Bug 1615277] - -2006-12-12 Don Porter - - * generic/tclCompExpr.c: Now that the new internal structs are - in use to support operator commands, might as well make them the - default for [expr] as well and avoid passing every parsed expression - through the inefficient Tcl_Token array format. This addresses most - issues in [RFE 1517602]. Assuming no performance disasters result from - this, much dead code supporting the other implementation might now be - removed. - - * generic/tclBasic.c: Final step routing all direct evaluation forms - * generic/tclCompExpr.c: of the operator commands through TEBC, - * generic/tclCompile.h: dropping all the routines in tclMathOp.c. - * generic/tclMathOp.c: Still needs Engineering Manual attention. - -2006-12-11 Don Porter - - * generic/tclBasic.c: Another step with all sorting operator - * generic/tclCompExpr.c: commands now routing through TEBC via - * generic/tclCompile.h: TclSortingOpCmd(). - -2006-12-08 Don Porter - - * generic/tclBasic.c: Another step down the path of re-using - * generic/tclCompExpr.c: TclExecuteByteCode to implement the TIP 174 - * generic/tclCompile.h: commands instead of using a mass of code - * generic/tclMathOp.c: duplication. Now all operator commands that - * tests/mathop.test: demand exactly one operation are implemented - via TclSingleOpCmd and a call to TEBC. - - * generic/tclCompExpr.c: Revised implementation of TclInvertOpCmd to - * generic/tclMathOp.c: perform a bytecode compile / execute sequence. - This demonstrates a path toward avoiding mountains of code duplication - in tclMathOp.c and tclExecute.c. - - * generic/tclCompile.h: Change TclExecuteByteCode() from static to - * generic/tclExecute.c: MODULE_SCOPE so all files including - tclCompile.h may call it. - - * generic/tclMathOp.c: More revisions to make tests pass. - * tests/mathop.test: - -2006-12-08 Donal K. Fellows - - * generic/tclNamesp.c (TclTeardownNamespace): Ensure that dying - namespaces unstitch themselves from their referents. [Bug 1571056] - (NsEnsembleImplementationCmd): Silence GCC warning. - - * tests/mathop.test: Full tests for & | and ^ operators - -2006-12-08 Daniel Steffen - - * library/tcltest/tcltest.tcl: use [info frame] for "-verbose line". - -2006-12-07 Don Porter - - * generic/tclCompCmds.c: Additional commits correct most - * generic/tclExecute.c: failing tests illustrating bugs - * generic/tclMathOp.c: uncovered in [Patch 1578137]. - - * generic/tclBasic.c: Biggest source of TIP 174 failures was that - the commands were not [namespace export]ed from the ::tcl::mathop - namespace. More bits from [Patch 1578137] correct that. - - * tests/mathop.test: Commmitted several new tests from Peter Spjuth - found in [Patch 1578137]. Many failures now demonstrate issues to fix - in the TIP 174 implementation. - -2006-12-07 Donal K. Fellows - - * tests/mathop.test: Added tests for ! ~ eq operators. - * generic/tclMathOp.c (TclInvertOpCmd): Add in check for non-integral - numeric values. - * generic/tclCompCmds.c (CompileCompareOpCmd): Factor out the code - generation for the chained comparison operators. - -2006-12-07 Pat Thoyts - - * tests/exec.test: Fixed line endings (caused win32 problems). - -2006-12-06 Don Porter - - * generic/tclCompCmds.c: Revised and consolidated into utility - * tests/mathop.test: routines some of routines that compile - the new TIP 174 commands. This corrects some known bugs. More to come. - -2006-12-06 Kevin B. Kenny - - * tests/expr.test (expr-47.12): Improved error reporting in hopes of - having more information to pursue [Bug 1609936]. - -2006-12-05 Andreas Kupries - - TIP#291 IMPLEMENTATION - - * generic/tclBasic.c: Define tcl_platform element for pointerSize. - * doc/tclvars.n: - - * win/Makefile.in: Added installation instructions for the platform - * win/makefile.vc: package. Added the platform package. - * win/makefile.bc: - * unix/Makefile.in: - - * tests/platform.test: - * tests/safe.test: - - * library/platform/platform.tcl: - * library/platform/shell.tcl: - * library/platform/pkgIndex.tcl: - - * doc/platform.n: - * doc/platform_shell.n: - -2006-12-05 Don Porter - - * generic/tclPkg.c: When no requirements are supplied to a - * tests/pkg.test: [package require $pkg] and [package unknown] - is invoked to find a satisfying package, pass the requirement argument - "0-" (which means all versions are acceptable). This permits a - registered [package unknown] command to call [package vsatisfies - $testVersion {*}$args] without any special handling of the empty $args - case. This fixes/avoids a bug in [::tcl::tm::UnknownHandler] that was - causing old TM versions to be provided in preference to newer TM - versions. Thanks to Julian Noble for discovering the issue. - -2006-12-04 Donal K. Fellows - - TIP#267 IMPLEMENTATION - - * generic/tclIOCmd.c (Tcl_ExecObjCmd): Added -ignorestderr option, - * tests/exec.test, doc/exec.n: loosely from [Patch 1476191] - -2006-12-04 Don Porter - - * generic/tclCompExpr.c: Added implementation for the - CompileExprTree() routine that can produce expression bytecode - directly from internal structures with no need to pass through the - Tcl_Token array representation. Still disabled by default. #undef - USE_EXPR_TOKENS to try it out. - -2006-12-03 Don Porter - - * generic/tclCompExpr.c: Added expr parsing routines that - produce a different set of internal structures representing the parsed - expression, as well as routines that go on to convert those structures - into the traditional Tcl_Token array format. Use of these routines is - currently disabled. #undef PARSE_DIRECT_EXPR_TOKENS to enable them. - These routines will only become really useful when more routines that - compile directly from the new internal structures are completed. - -2006-12-02 Donal K. Fellows - - * doc/file.n: Clarification of [file pathtype] docs. [Bug 1606454] - -2006-12-01 Kevin B. Kenny - - * libtommath/bn_mp_add.c: Corrected the effects of a - * libtommath/bn_mp_div.c: bollixed 'cvs merge' operation - * libtommath/bncore.c: that inadvertently committed some - * libtommath/tommath_class.h: half-developed code. - - TIP#299 IMPLEMENTATION - - * doc/mathfunc.n: Added isqrt() function to docs - * generic/tclBasic.c: Added isqrt() math function (ExprIsqrtFunc) - * tests/expr.test (expr-47.*): Added tests for isqrt() - * tests/info.test (info-20.2): Added isqrt() to expected math funcs. - -2006-12-01 Don Porter - - * tests/chan.test: Correct timing sensitivity in new test. [Bug - 1606860] - - TIP#287 IMPLEMENTATION - - * doc/chan.n: New subcommand [chan pending]. - * generic/tclBasic.c: Thanks to Michael Cleverly for proposal - * generic/tclInt.h: and implementation. - * generic/tclIOCmd.c: - * library/init.tcl: - * tests/chan.test: - * tests/ioCmd.test: - - TIP#298 IMPLEMENTATION - - * generic/tcl.decls: Tcl_GetBignumAndClearObj -> Tcl_TakeBignumFromObj - * generic/tclObj.c: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclExecute.c: Update callers. - * generic/tclMathOp.c: - -2006-11-30 Kevin B. Kenny - - * library/tzdata: Olson's tzdata2006p. - * libtommath/bn_mp_sqrt.c: Fixed a bug where the initial approximation - to the square root could be on the wrong side, causing failure of - convergence. - -2006-11-29 Don Porter - - * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Added - Tcl_DecrRefCount() on the objPtr argument to plug memory leaks. This - makes the routine a consumer, which makes it easiest to use. - -2006-11-28 Andreas Kupries - - * generic/tclBasic.c: TIP #280 implementation. - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclIOUtil.c: - * generic/tclInt.h: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclProc.c: - * tests/compile.test: - * tests/info.test: - * tests/platform.test: - * tests/safe.test: - -2006-11-27 Kevin B. Kenny - - * unix/tclUnixChan.c (TclUnixWaitForFile): - * tests/event.test (event-14.*): Corrected a bug where - TclUnixWaitForFile would present select() with the wrong mask on an - LP64 machine if a fd number exceeds 32. Thanks to Jean-Luc Fontaine - for reporting and diagnosing [Bug 1602208]. - -2006-11-27 Don Porter - - * generic/tclExecute.c (TclIncrObj): Correct failure to detect - floating-point increment values. Thanks to William Coleda [Bug - 1602991] - -2006-11-26 Donal K. Fellows - - * tests/mathop.test, doc/mathop.n: More bits and pieces of the TIP#174 - implementation. Note that the test suite is not yet complete. - -2006-11-26 Daniel Steffen - - * unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389] - * unix/configure: autoconf-2.59 [Bug 1230558] - -2006-11-25 Donal K. Fellows - - TIP#174 IMPLEMENTATION - - * generic/tclMathOp.c (new file): Completed the implementation of the - interpreted versions of all the tcl::mathop commands. Moved to a new - file to make tclCompCmds.c more focused in purpose. - -2006-11-23 Donal K. Fellows - - * generic/tclCompCmds.c (Tcl*OpCmd, TclCompile*OpCmd): - * generic/tclBasic.c (Tcl_CreateInterp): Partial implementation of - TIP#174; the commands are compiled, but (mostly) not interpreted yet. - -2006-11-22 Donal K. Fellows - - TIP#269 IMPLEMENTATION - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Implementation of the [string - * tests/string.test (string-25.*): is list] command, based on - * doc/string.n: work by Joe Mistachkin, with - enhancements by Donal Fellows for better failindex behaviour. - -2006-11-22 Don Porter - - * tools/genWinImage.tcl (removed): Removed two files used in - * win/README.binary (removed): production of binary distributions - for Windows, a task we no longer perform. [Bug 1476980] - * generic/tcl.h: Remove mention of win/README.binary in comment - - * generic/tcl.h: Moved TCL_REG_BOSONLY #define from tcl.h to - * generic/tclInt.h: tclInt.h. Only know user is Expect, which - already #include's tclInt.h. No need to continue greater exposure. - [Bug 926500] - -2006-11-20 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CreateInterp, TclHideUnsafeCommands): - * library/init.tcl: Refactored the [chan] command's guts so that it - does not use aliases to global commands, making the code more robust. - -2006-11-17 Don Porter - - * generic/tclExecute.c (INST_EXPON): Corrected crash on - [expr 2**(1<<63)]. Was operating on cleared bignum Tcl_Obj. - -2006-11-16 Donal K. Fellows - - * doc/apply.n, doc/chan.n: Added examples. - -2006-11-15 Don Porter - - TIP#270 IMPLEMENTATION - - * generic/tcl.decls: New public routines Tcl_ObjPrintf, - * generic/tclStringObj.c: Tcl_AppendObjToErrorInfo, Tcl_Format, - * generic/tclInt.h: Tcl_AppendLimitedToObj, - Tcl_AppendFormatToObj and Tcl_AppendPrintfToObj. Former internal - versions removed. - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclBasic.c: Updated callers. - * generic/tclCkalloc.c: - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclDictObj.c: - * generic/tclExecute.c: - * generic/tclIORChan.c: - * generic/tclIOUtil.c: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclStrToD.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c: - - * tools/genStubs.tcl: Updated script to no longer produce the - _ANSI_ARGS_ wrapper in generated declarations. Also revised to accept - variadic prototypes with more than one fixed argument. (This is - possible since TCL_VARARGS and its limitations are no longer in use). - * generic/tcl.h: Some reordering so that macro definitions do - not interfere with the now _ANSI_ARGS_-less stub declarations. - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclTomMathDecls.h: - -2006-11-15 Donal K. Fellows - - * doc/ChnlStack.3, doc/CrtObjCmd.3, doc/GetIndex.3, doc/OpenTcp.3: - * doc/chan.n, doc/fconfigure.n, doc/fcopy.n, doc/foreach.n: - * doc/history.n, doc/http.n, doc/library.n, doc/lindex.n: - * doc/lrepeat.n, doc/lreverse.n, doc/pkgMkIndex.n, doc/re_syntax.n: - Convert \fP to \fR so that man-page scrapers have an easier time. - -2006-11-14 Don Porter - - TIP#261 IMPLEMENTATION - - * generic/tclNamesp.c: [namespace import] with 0 arguments - introspects the list of imported commands. - -2006-11-13 Kevin B. Kenny - - * generic/tclThreadStorage.c (Tcl_InitThreadStorage): - (Tcl_FinalizeThreadStorage): Silence a compiler warning about - presenting a volatile pointer to 'memset'. - -2006-11-13 Don Porter - - * generic/tclIO.c: When [gets] on a binary channel needs to use - the "iso8859-1" encoding, save a copy of that encoding per-thread to - avoid repeated freeing and re-loading of it from the file system. This - replaces the cached copy of this encoding that the platform - initialization code used to keep in pre-8.5 releases. - -2006-11-13 Daniel Steffen - - * generic/tclCompExpr.c: Fix gcc warnings about 'cast to/from - * generic/tclEncoding.c: pointer from/to integer of different - * generic/tclEvent.c: size' on 64-bit platforms by casting - * generic/tclExecute.c: to intermediate types - * generic/tclHash.c: intptr_t/uintptr_t via new PTR2INT(), - * generic/tclIO.c: INT2PTR(), PTR2UINT() and UINT2PTR() - * generic/tclInt.h: macros. [Patch 1592791] - * generic/tclProc.c: - * generic/tclTest.c: - * generic/tclThreadStorage.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/configure.in: - * unix/tclUnixChan.c: - * unix/tclUnixPipe.c: - * unix/tclUnixPort.h: - * unix/tclUnixTest.c: - * unix/tclUnixThrd.c: - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-11-12 Donal K. Fellows - - * generic/tclInt.h, generic/tclInt.decls: Transfer TclPtrMakeUpvar and - TclObjLookupVar to the internal stubs table. - -2006-11-10 Daniel Steffen - - * tests/fCmd.test (fCmd-6.26): fix failure when env(HOME) path - contains symlinks. - - * macosx/Tcl.xcodeproj/project.pbxproj: remove tclParseExpr.c; when - running testsuite from inside Xcdoe, skip stack-3.1 (it only fails - under those circumstances). - - * unix/tcl.m4 (Darwin): suppress linker arch warnings when building - universal for both 32 & 64 bit and no 64bit CoreFoundation is - available; sync with tk tcl.m4 change. - * unix/configure.in: whitespace. - * unix/configure: autoconf-2.59 - -2006-11-09 Don Porter - - * generic/tclParseExpr.c (removed): Moved all the code of - * generic/tclCompExpr.c: tclParseExpr.c into tclCompExpr.c. - * unix/Makefile.in: This sets the stage for expr compiling to work - * win/Makefile.in: directly with the full parse tree structures, - * win/makefile.bc: and not have to pass through the information - * win/makefile.vc: lossy format of an array of Tcl_Tokens. - * win/tcl.dsp: - -2006-11-09 Donal K. Fellows - - TIP#272 IMPLEMENTATION - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Implementation of the - * tests/string.test, tests/stringComp.test: [string reverse] command - * doc/string.n: from TIP#272. - - * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Implementation of the - * generic/tclBasic.c, generic/tclInt.h: [lreverse] command from - * tests/cmdIL.test (cmdIL-7.*): TIP#272. - * doc/lreverse.n: - -2006-11-08 Donal K. Fellows - - * generic/tclIO.c, generic/tclPkg.c: Style & clarity rewrites. - -2006-11-07 Andreas Kupries - - * unix/tclUnixFCmd.c (CopyFile): Added code to fall back to a - hardwired default block size should the filesystem report a bogus - value. [Bug 1586470] - -2006-11-04 Don Porter - - * generic/tclStringObj.c: Changed Tcl_ObjPrintf() response to an - invalid format specifier string. No longer panics; now produces an - error message as output. - - TIP#274 IMPLEMENTATION - - * generic/tclParseExpr.c: Exponentiation operator is now right - * tests/expr.test: associative. [Patch 1556802] - -2006-11-03 Miguel Sofer - - * generic/tclBasic.c (TEOVI): fix por possible leak of a Command in - the presence of execution traces that delete it. - - * generic/tclBasic.c (TEOVI): - * tests/trace.test (trace-21.11): fix for [Bug 1590232], execution - traces may cause a second command resolution in the wrong namespace. - -2006-11-03 Donal K. Fellows - - * tests/event.test (event-11.5): Rewrote tests to stop Tcl from - * tests/io.test (multiple tests): opening sockets that are - * tests/ioCmd.test (iocmd-15.1,16,17): reachable from outside hosts - * tests/iogt.test (__echo_srv__.tcl): where not necessary. This is - * tests/socket.test (multiple tests): noticably annoying on some - * tests/unixInit.test (unixInit-1.2): systems (e.g., Windows). - -2006-11-02 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: check autoconf/autoheader exit - status and stop build if they fail. - -2006-11-02 Jeff Hobbs - - * doc/ParseCmd.3, doc/Tcl.n, doc/eval.n, doc/exec.n: - * doc/fconfigure.n, doc/interp.n, doc/unknown.n: - * library/auto.tcl, library/init.tcl, library/package.tcl: - * library/safe.tcl, library/tm.tcl, library/msgcat/msgcat.tcl: - * tests/all.tcl, tests/basic.test, tests/cmdInfo.test: - * tests/compile.test, tests/encoding.test, tests/execute.test: - * tests/fCmd.test, tests/http.test, tests/init.test: - * tests/interp.test, tests/io.test, tests/ioUtil.test: - * tests/iogt.test, tests/namespace-old.test, tests/namespace.test: - * tests/parse.test, tests/pkg.test, tests/pkgMkIndex.test: - * tests/proc.test, tests/reg.test, tests/trace.test: - * tests/upvar.test, tests/winConsole.test, tests/winFCmd.test: - * tools/tclZIC.tcl: - * generic/tclParse.c (Tcl_ParseCommand): Replace {expand} with {*} - officially (TIP #293). Leave -DALLOW_EXPAND=0|1 option to keep - {expand} syntax for transition users. [Bug 1589629] - -2006-11-02 Donal K. Fellows - - * generic/tclBasic.c, generic/tclInterp.c, generic/tclProc.c: Silence - warnings from gcc over signed/unsigned and TclStackAlloc(). - * generic/tclCmdMZ.c: Update to more compact and clearer coding style. - -2006-11-02 Don Porter - - * generic/tclCmdAH.c: Further revisions to produce the routines - * generic/tclInt.h: TclFormat() and TclAppendFormatToObj() that - * generic/tclNamesp.c: accept (objc, objv) arguments rather than - * generic/tclStringObj.c: any varargs stuff. - - * generic/tclBasic.c: Further revised TclAppendPrintToObj() and - * generic/tclCkalloc.c: TclObjPrintf() routines to panic when unable - * generic/tclCmdAH.c: to complete their formatting operations, - * generic/tclCmdIL.c: rather than report an error message. This - * generic/tclCmdMZ.c: means an interp argument for error message - * generic/tclDictObj.c: recording is no longer needed, further - * generic/tclExecute.c: simplifying the interface for callers. - * generic/tclIORChan.c: - * generic/tclIOUtil.c: - * generic/tclInt.h: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclParseExpr.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclStringObj.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c: - -2006-11-02 Donal K. Fellows - - * tests/winPipe.test (winpipe-4.[2345]): Made robust when run in - directory with spaces in its name. - - * generic/tclCmdAH.c: Clean up uses of cast NULLs. - - * generic/tclInterp.c (AliasObjCmd): Added more explanatory comments. - - * generic/tclBasic.c (TclEvalObjvInternal): Rewrote so that comments - are relevant and informative once more. Also made the unknown handler - processing use the Tcl execution stack for working space, and not the - general heap. - -2006-11-01 Daniel Steffen - - * unix/tclUnixPort.h: ensure MODULE_SCOPE is defined before use, so - that tclPort.h can once again be included without tclInt.h. - - * generic/tclEnv.c (Darwin): mark _environ symbol as unexported even - when MODULE_SCOPE != __private_extern__. - -2006-10-31 Don Porter - - * generic/tclBasic.c: Refactored and renamed the routines - * generic/tclCkalloc.c: TclObjPrintf, TclFormatObj, and - * generic/tclCmdAH.c: TclFormatToErrorInfo to a new set of routines - * generic/tclCmdIL.c: TclAppendPrintfToObj, TclAppendFormatToObj, - * generic/tclCmdMZ.c: TclObjPrintf, and TclObjFormat, with the - * generic/tclDictObj.c: intent of making the latter list, plus - * generic/tclExecute.c: TclAppendLimitedToObj and - * generic/tclIORChan.c: TclAppendObjToErrorInfo, public via a revised - * generic/tclIOUtil.c: TIP 270. - * generic/tclInt.h: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclParseExpr.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclStringObj.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c: - -2006-10-31 Miguel Sofer - - * generic/tclBasic.c, generic/tcl.h, generic/tclInterp.c: - * generic/tclNamesp.c: removing the flag bit TCL_EVAL_NOREWRITE, the - last remnant of the callObjc/v fiasco. It is not needed, as it is now - always set and checked or'ed with TCL_EVAL_INVOKE. - -2006-10-31 Pat Thoyts - - * win/rules.vc: Fix for [Bug 1582769] - options conflict with VC2003. - -2006-10-31 Donal K. Fellows - - * generic/tclBasic.c, generic/tclNamesp.c, generic/tclProc.c: - * generic/tclInt.h: Removed the callObjc and callObjv fields from the - Interp structure. They did not function correctly and made other parts - of the core amazingly complex, resulting in a substantive change to - [info level] behaviour. [Bug 1587618] - * library/clock.tcl: Removed use of [info level 0] for calculating the - command name as used by the user and replace with a literal. What's - there now is sucky, but at least appears to be right to most users. - * tests/namespace.test (namespace-42.7,namespace-47.1): Reverted - changes to these tests. - * tests/info.test (info-9.11,info-9.12): Added knownBug constraint - since these tests require a different behaviour of [info level] than - is possible because of other dependencies. - -2006-10-30 Jeff Hobbs - - * tools/tcltk-man2html.tcl (option-toc): handle any kind of options - defined toc section (needed for ttk docs) - -2006-10-30 Miguel Sofer - - * generic/tclBasic.c (TEOVI): insured that the interp's callObjc/v - fields are restored after traces run, as they be spoiled. This was - causing a segfault in tcllib's profiler tests. - -2006-10-30 Don Porter - - * generic/tclExecute.c (INST_MOD): Corrected improper testing of the - * tests/expr.test: sign of bignums when applying Tcl's - division rules. Thanks to Peter Spjuth. [Bug 1585704] - -2006-10-29 Miguel Sofer - - * generic/tclNamesp.c (EnsembleImplementationCmd): - * tests/namespace.test (47.7-8): reverted a wrong "optimisation" that - completely broke snit; added two tests. - -2006-10-28 Donal K. Fellows - - * generic/tclProc.c (ObjInterpProcEx, TclObjInterpProcCore): Split the - core of procedures to make it easier to build procedure-like code - without going through horrible contortions. This is the last critical - component to make advanced OO systems workable as simple loadable - extensions. TOIPC is now in the internal stub table. - (MakeProcError, MakeLambdaError): Refactored ProcessProcResultCode to - be simpler, some of which goes to TclObjInterpProcCore, and the rest - of which is now in these far simpler routines which just do errorInfo - stack generation for different types of procedure-like entity. - * tests/apply.test (apply-5.1): Updated to expect the more informative - form of message. - -2006-10-27 Donal K. Fellows - - * generic/tclVar.c (HasLocalVars): New macro to make various bits and - pieces cleaner. - - * generic/tclNamesp.c (TclSetNsPath): Expose SetNsPath() through - internal stubs table with semi-external name. - - * generic/tclInt.h (CallFrame): Add a field for handling context data - for extensions (like object systems) that should be tied to a call - frame (and not a command or interpreter). - - * generic/tclBasic.c (TclRenameCommand): Change to take CONST args; - they were only ever used in a constant way anyway, so this appears to - be a spot that was missed during TIP#27 work. - -2006-10-26 Miguel Sofer - - * generic/tclProc.c (SetLambdaFromAny): minor change, eliminate - redundant call to Tcl_GetString (thanks aku). - - * generic/tclInterp.c (ApplyObjCmd): - * generic/tclNamesp.c (EnsembleImplementationCmd): replaced ckalloc - (heap) with TclStackAlloc (execution stack). - -2006-10-24 Miguel Sofer - - * tests/info.test (info-9.11-12): tests for [Bug 1577492] - * tests/apply.test (apply-4.3-5): tests for [Bug 1574835] - - * generic/tclProc.c (ObjInterpProcEx): disable itcl hacks for calls - from ApplyObjCmd (islambda==1), as they mess apply's error messages - [Bug 1583266] - -2006-10-23 Miguel Sofer - - * generic/tclProc.c (ApplyObjCmd): fix wrong#args for apply by using - the ensemble rewrite engine. [Bug 1574835] - * generic/tclInterp.c (AliasObjCmd): previous commit missed usage of - TCL_EVAL_NOREWRITE for aliases. - - * generic/tclBasic.c (TclEvalObjvInternal): removed redundant check - for ensembles. [Bug 1577628] - - * library/clock.tcl (format, scan): corrected wrong # args messages to - * tests/clock.test (3.1, 34.1): make use of the new rewrite - capabilities of [info level] - - * generic/tcl.h: Lets TEOV update the iPtr->callObj[cv] new - * generic/tclBasic.c: fields, except when the flag bit - * generic/tclInt.h: TCL_EVAL_NOREWRITE is present. These values - * generic/tclNamesp.c: are used by Tcl_PushCallFrame to initialise - * generic/tclProc.c: the frame's obj[cv] fields, and allows - * tests/namespace.test: [info level] to know and use ensemble - rewrites. [Bug 1577492] - - ***POTENTIAL INCOMPATIBILITY*** - The return value from [info level 0] on interp alias calls is changed: - previously returned the target command (including curried values), now - returns the source - what was actually called. - -2006-10-23 Miguel Sofer - - * generic/tcl.h: Modified the Tcl call stack so there is - * generic/tclBasic.c: always a valid CallFrame, even at level 0 - * generic/tclCmdIL.c: [Patch 1577278]. Most of the changes - * generic/tclInt.h: involve removing tests for a NULL - * generic/tclNamesp.c: iPtr->(var)framePtr. There is now a - * generic/tclObj.c: CallFrame pushed at interp creation with a - * generic/tclProc.c: pointer to it stored in iPtr->rootFramePtr. - * generic/tclTrace.c: A second unused field in Interp is - * generic/tclVar.c: hijacked to enable further functionality, - currently unused (but with several FRQs depending on it). - - ***POTENTIAL INCOMPATIBILITY*** - Any user that includes tclInt.h and needs to determine if it is - running at level 0 should change (iPtr->varFramePtr == NULL) to - (iPtr->varFramePtr == iPtr->rootFramePtr). - -2006-10-23 Don Porter - - * README: Bump version number to 8.5a6 - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2006-10-21 Miguel Sofer - - * generic/tcl.h, generic/tclHash.c: Tcl_FindHashEntry now calls - Tcl_CreateHashEntry with a newPtr set to NULL: this would have caused - a segfault previously and eliminates duplicated code. A macro has been - added to tcl.h (only used when TCL_PRESERVE_BINARY_COMPATABALITY is - not set - i.e., not by default). - -2006-10-20 Reinhard Max - - * unix/configure.in: Added autodetection for OS-supplied timezone - * unix/Makefile.in: files and configure switches to override the - * unix/configure: detected default. - -2006-10-20 Daniel Steffen - - *** 8.5a5 TAGGED FOR RELEASE *** - - * tools/tcltk-man2html.tcl: add support for alpha & beta versions to - useversion glob pattern. [Bug 1579941] - -2006-10-18 Don Porter - - * changes: 8.5a5 release date set - - * doc/Encoding.3: Missing doc updates (mostly Table of - * doc/Ensemble.3: Contents) exposed by `make checkdoc` - * doc/FileSystem.3: - * doc/GetTime.3: - * doc/PkgRequire.3: - -2006-10-17 Miguel Sofer - - * generic/tclInterp.c (ApplyObjCmd): fixed bad error in 2006-10-12 - commit: interp released too early. Spotted by mistachkin. - -2006-10-16 Miguel Sofer - - * tclProc.c (SetLambdaFromAny): - * tests/apply.test (9.1-9.2): plugged intrep leak [Bug 1578454], - found by mjanssen. - -2006-10-16 Andreas Kupries - - * generic/tclBasic.c: Moved TIP#219 cleanup to DeleteInterpProc. - -2006-10-16 Daniel Steffen - - * changes: updates for 8.5a5 release. - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Darwin: fix for main - thread, where pthread_get_stacksize_np() returns incorrect info. - - * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires. - -2006-10-16 Don Porter - - * generic/tclPkg.c (ExactRequirement): Plugged memory leak. Also - changed Tcl_Alloc()/Tcl_Free() calls to ckalloc()/ckfree() for easier - memory debugging in the future. [Bug 1568373] - - * library/tcltest/tcltest.tcl: Revise tcltest bump to 2.3a1. - * library/tcltest/pkgIndex.tcl: This permits more features to be - * unix/Makefile.in: added to tcltest before we reach version 2.3.0 - * win/Makefile.in: best timed to match the release of Tcl 8.5.0. - * win/makefile.vc: This also serves as a demo of TIP 268 features - -2006-10-13 Colin McCormack - - * win/tclWinFile.c: corrected erroneous attempt to protect against - NULL return from Tcl_FSGetNormalizedPath per [Bug 1548263] causing - [Bug 1575837]. - * win/tclWinFile.c: alfredd supplied patch to fix [Bug 1575837] - -2006-10-13 Daniel Steffen - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): on Darwin, use - * unix/tcl.m4: pthread_get_stacksize_np() API to get thread stack size - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-10-12 Miguel Sofer - - * generic/tclInterp.c (ApplyObjCmd): - * tests/interp.test (interp-14.5-10): made [interp alias] use the - ensemble rewrite machinery to produce better error messages [Bug - 1576006] - -2006-10-12 David Gravereaux - - * win/nmakehlp.c: Replaced all wnsprintf() calls with snprintf(). - wnsprintf was not in my shwlapi header file (VC++6) - -2006-10-11 Don Porter - - * generic/tclPkg.c (Tcl_PackageRequireEx): Corrected crash when - argument version=NULL passed in. - -2006-10-10 Don Porter - - * changes: Updates for 8.5a5 release. - - * generic/tclNamespace.c (TclTeardownNamespace): After the - commandPathSourceList of a namespace is cleared, set the - commandPathSourceList to NULL so we don't try to walk the list a - second time, possibly after it is freed. [Bug 1566526] - * tests/namespace.test (namespace-51.16): Added test. - -2006-10-09 Miguel Sofer - - * doc/UpVar.3: brough the docs in accordance to the code. Ever since - 8.0, Tcl_UpVar(2)? accepts TCL_NAMESPACE_ONLY as a flag value, and - var-3.4 tests for proper behaviour. The docs only allowed 0 and - TCL_GLOBAL_ONLY. [Bug 1574099] - -2006-10-09 Miguel Sofer - - * tests/*.test: updated all tests to refer explicitly to the global - variables ::errorInfo, ::errorCode, ::env and ::tcl_platform: many - were relying on the alternative lookup in the global namespace, that - feature is tested specifically in namespace and variable tests. - - The modified testfiles are: apply.test, basic.test, case.test, - cmdIL.test, cmdMZ.test, compExpr-old.test, error.test, eval.test, - event.test, expr.test, fileSystem.test, for.test, http.test, if.test, - incr-old.test, incr.test, interp.test, io.test, ioCmd.test, load.test, - misc.test, namespace.test, parse.test, parseOld.test, pkg.test, - proc-old.test, set.test, switch.test, tcltest.test, thread.test, - var.test, while-old.test, while.test. - -2006-10-06 Pat Thoyts - - * win/rules.vc: [Bug 1571954] avoid /RTCc flag with MSVC8 - -2006-10-06 Pat Thoyts - - * doc/binary.n: TIP #275: Support unsigned values in binary - * generic/tclBinary.c: command. Tests and documentation updated. - * tests/binary.test: - -2006-10-05 Andreas Kupries - - * library/tm.tcl: Fixed bug in TIP #189 implementation, now allowing - '_' in module names. - -2006-10-05 Jeff Hobbs - - * library/http/http.tcl (http::geturl): only do geturl url rfc 3986 - validity checking if $::http::strict is true (default true for 8.5). - [Bug 1560506] - - * generic/tcl.h: note limitation on changing Tcl_UniChar size - * generic/tclEncoding.c (UtfToUnicodeProc, UnicodeToUtfProc): - * tests/encoding.test (encoding-16.1): fix alignment issues in - unicode <> utf conversion procs. [Bug 1122671] - -2006-10-05 Miguel Sofer - - * generic/tclVar.c (Tcl_LappendObjCmd): - * tests/append.test(4.21-22): fix for longstanding [Bug 1570718], - lappending nothing to non-list. Reported by lvirden - -2006-10-04 Kevin B. Kenny - - * tzdata/: Olson's tzdata2006m. - -2006-10-01 Kevin B. Kenny - - * tests/clock.test (clock-49.2): Removed a locale dependency that - caused a spurious failure in the German locale. [Bug 1567956] - -2006-10-01 Miguel Sofer - - * doc/Eval.3 (TclEvalObjv): added note on refCount management for the - elements of objv. [Bug 730244] - -2006-10-01 Pat Thoyts - - * win/tclWinFile.c: Handle possible missing define. - - * win/tclWinFile.c (TclpUtime): [Bug 1420432] file mtime fails for - * tests/cmdAH.test: directories on windows - - * tests/winFile.test: Handle Msys environment a little differently in - getuser function. [Bug 1567956] - -2006-09-30 Miguel Sofer - - * generic/tclUtil.c (Tcl_SplitList): optimisation, [Patch 1344747] by - dgp. - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclObj.c: - * generic/tclStubInit.c: added an internal function TclObjBeingDeleted - to provide info as to the reason for the loss of an internal rep. [FR - 1512138] - - * generic/tclCompile.c: - * generic/tclHistory.c: - * generic/tclInt.h: - * generic/tclProc.c: made Tcl_RecordAndEvalObj not call "history" if - it has been redefined to an empty proc, in order to reduce the noise - when debugging [FR 1190441]. Moved TclCompileNoOp from tclProc.c to - tclCompile.c - -2006-09-28 Andreas Kupries - - * generic/tclPkg.c (CompareVersions): Bugfix. Check string lengths - * tests/pkg.test: before comparison. The shorter string is the smaller - number. Added testcases as well. Interestingly all existing test cases - for vcompare compared numbers of the same length with each other. [Bug - 1563836] - -2006-09-28 Miguel Sofer - - * generic/tclIO.c (Tcl_GetsObj): added two test'n'panic guards for - possible NULL derefs, [Bug 1566382] and coverity #33. - -2006-09-27 Don Porter - - * generic/tclExecute.c: Corrected error in INST_LSHIFT in the - * tests/expr.test: calculation done to determine whether a shift - in the (long int) type is possible. The calculation had literal value - "1" where it needed a value "1L" to compute the correct result. Error - detected via testing with the math::bigfloat package [Bug 1567222] - - * generic/tclPkg.c (CompareVersion): Flatten strcmp() results to - {-1, 0, 1} to match expectations of CompareVersion() callers. - -2006-09-27 Miguel Sofer - - * generic/regc_color.c (singleton): - * generic/regc_cvec.c (addmcce): - * generic/regcomp.c (compile, dovec): the static function addmcce does - nothing when called with two NULL pointers; the only call is by - compile with two NULL pointers (regcomp.c #includes regc_cvec.c). - Large parts (all?) the code for mcce (multi character collating - element) that we do not use is ifdef'ed out with the macro - REGEXP_MCCE_ENABLE. - This silences coverity bugs 7, 16, 80 - - * generic/regc_color.c (uncolorchain): - * generic/regc_nfa.c (freearc): changed tests and asserts to - equivalent formulation, designed to avoid an explicit comparison to - NULL and satisfy coverity that 6 and 9 are not bugs. - -2006-09-27 Andreas Kupries - - * tests/pkg.test: Added test for version comparison at the 32bit - boundary. [Bug 1563836] - - * generic/tclPkg.c: Rewrote CompareVersion to perform string - comparison instead of numeric. This breaks through the 32bit limit on - version numbers. See code for details (handling of leading zeros, - signs, etc.). un-CONSTed some arguments of CompareVersions, - RequirementSatisfied, and AllRequirementsSatisfied. The new compare - modifies the string (temporary string terminators). All callers use - heap-allocated ver-intreps, so we are good with that. [Bug 1563836] - -2006-09-27 Miguel Sofer - - * generic/tclFileName.c (TclGlob): added a panic for a call with - TCL_GLOBMODE_TAILS and pathPrefix==NULL. This would cause a segfault, - as found by coverity #26. - -2006-09-26 Kevin B. Kenny - - * doc/Encoding.3: Added covariant 'const' qualifier for the - * generic/tcl.decls: Tcl_EncodingType argument to - * generic/tclEncoding.c: Tcl_CreateEncoding. [Further TIP#27 work.] - * generic/tclDecls.h: Reran 'make genstubs'. - -2006-09-26 Pat Thoyts - - * win/makefile.vc: Additional compiler flags and amd64 support. - * win/nmakehlp.c: - * win/rules.vc: - -2006-09-26 Don Porter - - * generic/tcl.h: As 2006-09-22 commit from Donal K. Fellows - demonstrates, "#define NULL 0" is just wrong, and as a quotable chat - figure observed, "If NULL isn't defined, we're not using a C compiler" - Improper fallback definition of NULL removed. - -2006-09-25 Pat Thoyts - - * generic/tcl.h: More fixing which struct stat to refer to. - * generic/tclGetDate.y: Some casts from time_t to int required. - * generic/tclTimer.c: Tcl_Time structure members are longs. - * win/makefile.vc: Support for varying compiler options - * win/rules.vc: and build to platform-specific subdirs. - -2006-09-25 Andreas Kupries - - * generic/tclIO.c (Tcl_StackChannel): Fixed [Bug 1564642], aka - coverity #51. Extended loop condition, added checking for NULL to - prevent seg.fault. - -2006-09-25 Andreas Kupries - - * doc/package.n: Fixed nits reported by Daniel Steffen in the TIP#268 - changes. - -2006-09-25 Kevin B. Kenny - - * generic/tclNotify.c (Tcl_DeleteEvents): Simplified the code in hopes - of making the invariants clearer and proving to Coverity that the - event queue memory is managed correctly. - -2006-09-25 Donal K. Fellows - - * generic/tclNotify.c (Tcl_DeleteEvents): Make it clear what happens - when the event queue is mismanaged. [Bug 1564677], coverity bug #10. - -2006-09-24 Miguel Sofer - - * generic/tclParse.c (Tcl_ParseCommand): also return an error if - start==NULL and numBytes<0. This is coverity's bug #20 - - * generic/tclStringObj.c (STRING_SIZE): fix allocation for 0-length - strings. This is coverity's bugs #54-5 - -2006-09-22 Andreas Kupries - - * generic/tclInt.h: Moved TIP#268's field 'packagePrefer' to the end - of the structure, for better backward compatibility. - -2006-09-22 Andreas Kupries - - TIP#268 IMPLEMENTATION - - * generic/tclDecls.h: Regenerated from tcl.decls. - * generic/tclStubInit.c: - - * doc/PkgRequire.3: Documentation of extended API, extended testsuite. - * doc/package.n: - * tests/pkg.test: - - * generic/tcl.decls: Implementation. - * generic/tclBasic.c: - * generic/tclConfig.c: - * generic/tclInt.h: - * generic/tclPkg.c: - * generic/tclTest.c: - * generic/tclTomMathInterface.c: - * library/init.tcl: - * library/package.tcl: - * library/tm.tcl: - -2006-09-22 Donal K. Fellows - - * generic/tclThreadTest.c (TclCreateThread): Use NULL instead of 0 as - end-of-strings marker to Tcl_AppendResult; the difference matters on - 64-bit machines. [Bug 1562528] - -2006-09-21 Don Porter - - * generic/tclUtil.c: Dropped ParseInteger() routine. TclParseNumber - covers the task just fine. - -2006-09-19 Donal K. Fellows - - * generic/tclEvent.c (Tcl_VwaitObjCmd): Rewrite so that an exceeded - limit trapped in a vwait cannot cause a dangerous dangling trace. - -2006-09-19 Don Porter - - * generic/tclExecute.c (INST_EXPON): Native type overflow detection - * tests/expr.test: was completely broken. Falling back on use of - bignums for all non-trivial ** calculations until - native-type-constrained special cases can be done carefully and - correctly. [Bug 1561260] - -2006-09-15 Jeff Hobbs - - * library/http/http.tcl: Change " " -> "+" url encoding mapping - * library/http/pkgIndex.tcl: to " " -> "%20" as per RFC 3986. - * tests/http.test (http-5.1): bump http to 2.5.3 - * unix/Makefile.in: - * win/Makefile.in: - -2006-09-12 Andreas Kupries - - * unix/configure.in (HAVE_MTSAFE_GETHOST*): Modified to recognize - HP-UX 11.00 and beyond as having mt-safe implementations of the - gethost functions. - * unix/configure: Regenerated, using autoconf 2.59 - - * unix/tclUnixCompat.c (PadBuffer): Fixed bug in calculation of the - increment needed to align the pointer, and added documentation - explaining why the macro is implemented as it is. - -2006-09-11 Pat Thoyts - - * win/rules.vc: Updated to install http, tcltest and msgcat as - * win/makefile.vc: Tcl Modules (as per Makefile.in). - * win/makefile.vc: Added tommath_(super)class headers. - -2006-09-11 Andreas Kupries - - * unix/Makefile.in (install-libraries): Fixed typo tcltest 2.3.9 -> - 2.3.0. - -2006-09-11 Daniel Steffen - - * unix/tclUnixCompat.c: make compatLock static and only declare it - when it will actually be used; #ifdef parts of TSD that are not always - needed; adjust #ifdefs to cover all possible cases; fix whitespace. - -2006-09-11 Andreas Kupries - - * tests/msgcat.test: Bumped version in auxiliary files as well. - * doc/msgcat.n: - -2006-09-11 Kevin B. Kenny - - * unix/Makefile.in: Bumped msgcat version to 1.4.2 to be - * win/Makefile.in: consistent with dgp's commits of 2006-09-10. - -2006-09-11 Don Porter - - * library/msgcat/msgcat.tcl: Removed some unneeded [uplevel]s. - -2006-09-10 Don Porter - - * generic/tclExecute.c: Corrected INST_EXPON flaw that treated - * tests/expr.test: $x**1 as $x**3. [Bug 1555371] - - * doc/tcltest.n: Bump to version tcltest 2.3.0 to - * library/tcltest/pkgIndex.tcl: account for new "-verbose line" - * library/tcltest/tcltest.tcl: feature. - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.bc: - * win/makefile.vc: - - * library/msgcat/msgcat.tcl: Bump to version msgcat 1.4.2 to - * library/msgcat/pkgIndex.tcl: account for modifications. - -2006-09-10 Daniel Steffen - - * library/msgcat/msgcat.tcl (msgcat::Init): on Darwin, add fallback of - * tests/msgcat.test: default msgcat locale to - * unix/tclUnixInit.c (TclpSetVariables): current CFLocale - identifier if available (via private ::tcl::mac::locale global, set at - interp init when on Mac OS X 10.3 or later with CoreFoundation). - - * library/tcltest/tcltest.tcl: add 'line' verbose level: prints source - * doc/tcltest.n: file line information of failing tests. - - * macosx/Tcl.xcodeproj/project.pbxproj: add new tclUnixCompat.c file; - revise tests target to use new tcltest 'line' verbose level. - - * unix/configure.in: add descriptions to new AC_DEFINEs for MT-safe. - * unix/tcl.m4: add caching to new SC_TCL_* macros for MT-safe wrappers - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-09-08 Zoran Vasiljevic - - * unix/tclUnixCompat.c: Added fallback to gethostbyname() and - gethostbyaddr() if the implementation is known to be MT-safe - (currently for Darwin 6 or later only). - - * unix/configure.in: Assume gethostbyname() and gethostbyaddr() are - MT-safe starting with Darwin 6 (Mac OSX 10.2). - - * unix/configure: Regenerated with autoconf V2.59 - -2006-09-08 Andreas Kupries - - * unix/tclUnixCompat.c: Fixed conditions for CopyArray/CopyString, and - CopyHostent. Also fixed bad var names in TclpGetHostByName. - -2006-09-07 Zoran Vasiljevic - - * unix/tclUnixCompat.c: Added fallback to MT-unsafe library calls if - TCL_THREADS is not defined. - Fixed alignment of arrays copied by CopyArray() to be on the - sizeof(char *) boundary. - -2006-09-07 Zoran Vasiljevic - - * unix/tclUnixChan.c: Rewritten MT-safe wrappers to return ptrs to - * unix/tclUnixCompat.c: TSD storage making them all look like their - * unix/tclUnixFCmd.c: MT-unsafe pendants API-wise. - * unix/tclUnixPort.h: - * unix/tclUnixSock.c: - -2006-09-06 Zoran Vasiljevic - - * unix/tclUnixChan.c: Added TCL_THREADS ifdef'ed usage of MT-safe - * unix/tclUnixFCmd.c: calls like: getpwuid, getpwnam, getgrgid, - * unix/tclUnixSock.c: getgrnam, gethostbyname and gethostbyaddr. - * unix/tclUnixPort.h: See [Bug 999544] - * unix/Makefile.in: - * unix/configure.in: - * unix/tcl.m4: - * unix/configure: Regenerated. - - * unix/tclUnixCompat.c: New file containing MT-safe implementation of - some library calls. - -2006-09-04 Don Porter - - * generic/tclCompExpr.c: Removed much complexity that is no - longer needed. - - * tests/main.text (Tcl_Main-4.4): Test corrected to not be - timing sensitive to the Bug 1481986 fix. [Bug 1550858] - -2006-09-04 Jeff Hobbs - - * doc/package.n: correct package example - -2006-08-31 Don Porter - - * generic/tclCompExpr.c: Corrected flawed logic for disabling - the INST_TRY_CVT_TO_NUMERIC instruction at the end of an expression - when function arguments contain operators. [Bug 1541274] - - * tests/expr-old.test: The remaining failing tests reported in - * tests/expr.test: [Bug 1381715] are all new in Tcl 8.5, so - there's really no issue of compatibility with Tcl 8.4 result to deal - with. Fixed by updating tests to expect 8.5 results. - -2006-08-29 Don Porter - - * generic/tclParseExpr.c: Dropped the old expr parser. - -2006-08-30 Jeff Hobbs - - * generic/tclBasic.c (Tcl_CreateInterp): init iPtr->threadId - - * win/tclWinChan.c [Bug 819667] Improve logic for identifying COM - ports. - - * generic/tclIOGT.c (ExecuteCallback): - * generic/tclPkg.c (Tcl_PkgRequireEx): replace Tcl_GlobalEval(Obj) - with more efficient Tcl_Eval(Obj)Ex - - * unix/Makefile.in (valgrindshell): add valgrindshell target and - update default VALGRINDARGS. User can override, or add to it with - VALGRIND_OPTS env var. - - * generic/tclFileName.c (DoGlob): match incrs with decrs. - -2006-08-29 Don Porter - - * generic/tclParseExpr.c: Use the "parent" field of orphan - ExprNodes to store the closure of left pointers. This lets us avoid - repeated re-scanning leftward for the left boundary of subexpressions, - which in worst case led to near O(N^2) runtime. - -2006-08-29 Joe Mistachkin - - * unix/tclUnixInit.c: Fixed the issue (typo) that was causing - * unix/tclUnixThrd.c (TclpThreadGetStackSize): stack.test to fail on - FreeBSD (and possibly other Unix platforms). - -2006-08-29 Colin McCormack - - * generic/tclIOUtil.c: Added test for NULL return from - * generic/tclPathObj.c: Tcl_FSGetNormalizedPath which was causing - * unix/tclUnixFile.c: segv's per [Bug 1548263] - * win/tclWinFCmd.c: - * win/tclWinFile.c: - -2006-08-28 Kevin B. Kenny - - * library/tzdata/America/Havana: Regenerated from Olson's - * library/tzdata/America/Tegucigalpa: tzdata2006k. - * library/tzdata/Asia/Gaza: - -2006-08-28 Don Porter - - * generic/tclStringObj.c: Revised ObjPrintfVA to take care to - * generic/tclParseExpr.c: copy only whole characters when doing - %s formatting. This relieves callers of TclObjPrintf() and - TclFormatToErrorInfo() from needing to fix arguments to character - boundaries. Tcl_ParseExpr() simplified by taking advantage. [Bug - 1547786] - - * generic/tclStringObj.c: Corrected TclFormatObj's failure to - count up the number of arguments required by examining the format - string. [Bug 1547681] - -2006-08-27 Joe Mistachkin - - * generic/tclClock.c (ClockClicksObjCmd): Fix nested macro breakage - with TCL_MEM_DEBUG enabled. [Bug 1547662] - -2006-08-26 Miguel Sofer - - * doc/namespace.n: - * generic/tclNamesp.c: - * tests/upvar.test: bugfix, docs clarification and new tests for - [namespace upvar] as follow up to [Bug 1546833], reported by Will - Duquette. - -2006-08-24 Kevin B. Kenny - - * library/tzdata: Regenerated, including several new files, from - Olson's tzdata2006j. - * library/clock.tcl: - * tests/clock.test: Removed an early testing hack that allowed loading - 'registry' from the build tree rather than an installed one. This is a - workaround for [Bug 15232730], which remains open because it's a - symptom of a deeper underlying problem. - -2006-08-23 Don Porter - - * generic/tclParseExpr.c: Minimal collection of new tests - * tests/parseExpr.test: testing the error messages of the new - expr parser. Several bug fixes and code simplifications that appeared - during that effort. - -2006-08-21 Don Porter - - * generic/tclIOUtil.c: Revisions to complete the thread finalization - of the cwdPathPtr. [Bug 1536142] - - * generic/tclParseExpr.c: Revised mistaken call to - TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same - additional info in error message. - - * tests/compExpr-old.test: Update existing tests to not fail with - * tests/compExpr.test: the new expr parser. - * tests/compile.test: - * tests/expr-old.test: - * tests/expr.test: - * tests/for.test: - * tests/if.test: - * tests/parseExpr.test: - * tests/while.test: - -2006-08-21 Donal K. Fellows - - * win/Makefile.in (gdb): Make this target work so that debugging an - msys build is possible. - -2006-08-21 Daniel Steffen - - * macosx/tclMacOSXNotify.c (Tcl_WaitForEvent): if the run loop is - already running (e.g. if Tcl_WaitForEvent was called recursively), - re-run it in a custom run loop mode containing only the source for the - notifier thread, otherwise wakeups from other sources added to the - common run loop modes might get lost. - - * unix/tclUnixNotfy.c (Tcl_WaitForEvent): on 64-bit Darwin, - pthread_cond_timedwait() appears to have a bug that causes it to wait - forever when passed an absolute time which has already been exceeded - by the system time; as a workaround, when given a very brief timeout, - just do a poll on that platform. [Bug 1457797] - - * generic/tclClock.c (ClockClicksObjCmd): add support for Darwin - * generic/tclCmdMZ.c (Tcl_TimeObjCmd): nanosecond resolution timer - * generic/tclInt.h: to [clock clicks] and [time] - * unix/configure.in (Darwin): when TCL_WIDE_CLICKS defined - * unix/tclUnixTime.c (TclpGetWideClicks, TclpWideClicksToNanoseconds): - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * unix/tclUnixPort.h (Darwin): override potentially faulty configure - detection of termios availability in all cases, since termios is known - to be present on all Mac OS X releases since 10.0. [Bug 497147] - -2006-08-18 Daniel Steffen - - * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for - universal builds including x86_64, for 64-bit CoreFoundation on - Leopard and for use of -mmacosx-version-min instead of - MACOSX_DEPLOYMENT_TARGET - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * generic/tcl.h: add fixes for building on Leopard and - * unix/tclUnixPort.h: support for 64-bit CoreFoundation on Leopard - * macosx/tclMacOSXFCmd.c: - - * unix/tclUnixPort.h: on Darwin x86_64, disable use of vfork as it - causes execve to fail intermittently. (rdar://4685553) - - * generic/tclTomMath.h: on Darwin 64-bit, for now disable use of - 128-bit arithmetic through __attribute__ ((mode(TI))), as it leads to - link errors due to missing fallbacks. (rdar://4685527) - - * macosx/Tcl.xcodeproj/project.pbxproj: add x86_64 to universal build, - switch native release targets to use DWARF with dSYM, Xcode 3.0 - changes - * macosx/README: updates for x86_64 and Xcode 2.4. - - * macosx/Tcl.xcodeproj/default.pbxuser: add test suite target that - * macosx/Tcl.xcodeproj/project.pbxproj: runs the tcl test suite at - build time and shows clickable test suite errors in the GUI build - window. - - * tests/macOSXFCmd.test: fix use of deprecated resource fork paths. - - * unix/tclUnixInit.c (TclpInitLibraryPath): move code that is only - needed when TCL_LIBRARY is defined to run only in that case. - - * generic/tclLink.c (LinkTraceProc): fix 64-bit signed-with-unsigned - comparison warning from gcc4 -Wextra. - - * unix/tclUnixChan.c (TclUnixWaitForFile): with timeout < 0, if - select() returns early (e.g. due to a signal), call it again instead - of returning a timeout result. Fixes intermittent event-13.8 failures. - -2006-08-17 Don Porter - - * generic/tclCompile.c: Revised the new set of expression - * generic/tclParseExpr.c: parse error messages. - -2006-08-16 Don Porter - - * generic/tclParseExpr.c: Replace PrecedenceOf() function with - prec[] static array. - -2006-08-14 Donal K. Fellows - - * library/clock.tcl (::tcl::clock::add): Added missing braces to - clockval validation code. Pointed out on comp.lang.tcl. - -2006-08-11 Donal K. Fellows - - * generic/tclNamesp.c: Improvements in buffer management to make - namespace creation faster. Plus selected other minor improvements to - code quality. [Patch 1352382] - -2006-08-10 Donal K. Fellows - - Misc patches to make code more efficient. [Bug 1530474] (afredd) - * generic/*.c, macosx/tclMacOSXNotify.c, unix/tclUnixNotfy.c, - * win/tclWinThrd.c: Tidy up invokations of Tcl_Panic() to promote - string constant sharing and consistent style. - * generic/tclBasic.c (Tcl_CreateInterp): More efficient handling of - * generic/tclClock.c (TclClockInit): registration of commands not - in global namespace. - * generic/tclVar.c (Tcl_UnsetObjCmd): Remove unreachable clause. - -2006-08-09 Don Porter - - * generic/tclEncoding.c: Replace buffer copy in for loop with - call to memcpy(). Thanks to afredd. [Patch 1530262] - -2006-08-09 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LassignObjCmd): Make the wrong#args message - a bit more consistent with those used elsewhere. [Bug 1534628] - - * generic/tclDictObj.c (DictForCmd): Stop crash when attempting to - iterate over an invalid dictionary. [Bug 1531184] - - * doc/ParseCmd.3, doc/expr.n, doc/set.n, doc/subst.n, doc/switch.n: - * doc/tclvars.n: Ensure that uses of [expr] in documentation examples - are also good style (with braces) unless otherwise necessary. [Bug - 1526581] - -2006-08-03 Daniel Steffen - - * unix/tclUnixPipe.c (TclpCreateProcess): for USE_VFORK: ensure - standard channels are initialized before vfork() so that the child - doesn't potentially corrupt global state in the parent's address space - - * tests/compExpr-old.test: add 'oldExprParser' constraint to all tests - * tests/compExpr.test: that depend on the exact format of the - * tests/compile.test: error messages of the pre-2006-07-05 - * tests/expr-old.test: expression parser. The constraint is on by - * tests/expr.test: default (i.e those tests still fail), but - * tests/for.test: can be turned off by passing '-constraints - * tests/if.test: newExprParser' to tcltest, which will skip - * tests/parseExpr.test: the 196 failing tests in the testsuite that - * tests/while.test: are caused by the new expression parser - error messages. - -2006-07-31 Kevin B. Kenny - - * generic/tclClock.c (ConvertLocalToUTCUsingC): Corrected a regression - that caused dates before 1969 to be one day off in the :localtime time - zone if TZ is not set. [Bug 1531530] - -2006-07-30 Kevin B. Kenny - - * generic/tclClock.c (GetJulianDayFromEraYearMonthDay): Corrected - several errors in converting dates before the Common Era [Bug 1426279] - * library/clock.tcl: Corrected syntax errors in generated code for %EC - %Ey, and %W format groups [Bug 1505383]. Corrected a bug in cache - management for format strings containing [glob] metacharacters [Bug - 1494664]. Corrected several errors in formatting/scanning of years - prior to the Common Era, and added the missing %EE format group to - indicate the era. - * tools/makeTestCases.tcl: Added code to make sure that %U and %V - format groups are included in the tests. (The code depends on %U and - %V formatting working correctly when 'makeTestCases.tcl' is run, - rather than making a completely independent check.) Added tests for - [glob] metacharacters in strings. Added tests for years prior to the - Common Era. - * tests/clock.test: Rebuilt with new test cases for all the above. - -2006-07-30 Joe English - - * doc/AppInit.3: Fix typo [Bug 1496886] - -2006-07-26 Don Porter - - * generic/tclExecute.c: Corrected flawed overflow detection in - * tests/expr.test: INST_EXPON that caused [expr 2**64] to return - 0 instead of the same value as [expr 1<<64]. - -2006-07-24 Don Porter - - * win/tclWinSock.c: Correct un-initialized Tcl_DString. Thanks to - afredd. [Bug 1518166] - -2006-07-21 Miguel Sofer - - * generic/tclExecute.c: - * tests/execute.test (execute-9.1): dgp's fix for [Bug 1522803]. - -2006-07-20 Daniel Steffen - - * macosx/tclMacOSXNotify.c (Tcl_InitNotifier, Tcl_WaitForEvent): - create notifier thread lazily upon first call to Tcl_WaitForEvent() - rather than in Tcl_InitNotifier(). Allows calling exeve() in processes - where the event loop has not yet been run (Darwin's execve() fails in - processes with more than one thread), in particular allows embedders - to call fork() followed by execve(), previously the pthread_atfork() - child handler's call to Tcl_InitNotifier() would immediately recreate - the notifier thread in the child after a fork. - - * macosx/tclMacOSXFCmd.c (TclMacOSXCopyFileAttributes): add support - * macosx/tclMacOSXNotify.c (Tcl_InitNotifier): for weakly - * unix/tclUnixInit.c (Tcl_GetEncodingNameFromEnvironment): importing - symbols not available on OSX 10.2 or 10.3, enables binaires built on - later OSX versions to run on earlier ones. - * macosx/Tcl.xcodeproj/project.pbxproj: enable weak-linking; turn on - extra warnings. - * macosx/README: document how to enable weak-linking; cleanup. - * unix/tclUnixPort.h: add support for weak-linking; conditionalize - AvailabilityMacros.h inclusion; only disable realpath on 10.2 or - earlier when threads are enabled. - * unix/tclLoadDyld.c (TclpLoadMemoryGetBuffer): change runtime Darwin - * unix/tclUnixInit.c (TclpInitPlatform): release check to use - global initialized - once - * unix/tclUnixFCmd.c (DoRenameFile, TclpObjNormalizePath): add runtime - Darwin release check to determine if realpath is threadsafe. - * unix/configure.in: add check on Darwin for compiler support of weak - * unix/tcl.m4: import and for AvailabilityMacros.h header; move - Darwin specific checks & defines that are only relevant to the tcl - build out of tcl.m4; restrict framework option to Darwin; clean up - quoting and help messages. - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * generic/regc_locale.c (cclass): - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclIOCmd.c (Tcl_ExecObjCmd): - * generic/tclListObj.c (NewListIntRep): - * generic/tclObj.c (Tcl_GetLongFromObj, Tcl_GetWideIntFromObj) - (FreeBignum, Tcl_SetBignumObj): - * generic/tclParseExpr.c (Tcl_ParseExpr): - * generic/tclStrToD.c (TclParseNumber): - * generic/tclStringObj.c (TclAppendFormattedObjs): - * unix/tclLoadDyld.c (TclpLoadMemory): - * unix/tclUnixPipe.c (TclpCreateProcess): fix signed-with-unsigned - comparison and other warnings from gcc4 -Wextra. - -2006-07-13 Andreas Kupries - - * unix/tclUnixPort.h: Added the inclusion of . - The missing header caused the upcoming #if conditions to wrongly - exclude realpath, causing file normalize to ignore symbolic links in - the path. - -2006-07-11 Zoran Vasiljevic - - * generic/tclAsync.c: Made Tcl_AsyncDelete() more tolerant when called - after all thread TSD has been garbage-collected. - -2006-07-05 Don Porter - - * generic/tclParseExpr.c: Completely new expression parser that - builds a parse tree instead of operating with deep recursion. This - corrects reports of stack-blowing crashes parsing long expressions - [Bug 906201] and replaces a fundamentally O(N^2) algorithm with an - O(N) one [RFE 903765]. The new parser is better able to generate error - messages that clearly report both the nature and context of the syntax - error [Bugs 1029267, 1381715]. For now, the code for the old parser is - still present and can be activated with a "#define OLD_EXPR_PARSER - 1". This is for the sake of a clean implementation patch, and for ease - of benchmarking. The new parser is non-recursive, so much lighter in - stack consumption, but it does use more heap, so there may be cases - where parsing of long expressions that succeeded with the old parser - will lead to out of memory panics with the new one. There are still - more improvements possible on that point, though significant progress - may require changes to the Tcl_Token specifications documented for the - public Tcl_Parse*() routines. - ***POTENTIAL INCOMPATIBILITY*** for any callers that rely on the exact - (usually terrible) error messages generated by the old parser. This - includes a large number of tests in the test suite. - - * generic/tclInt.h: Replaced TclParseWhiteSpace() with - * generic/tclParse.c: TclParseAllWhiteSpace() which is what - * generic/tclParseExpr.c: all the callers really needed. - Breaking whitespace runs at newlines is useful only to the command - parsing function, and it can call the file scoped routine - ParseWhiteSpace() to do that. - - * tests/expr-old.test: Removed knownBug constraints that masked - * tests/expr.test: failures due to revised error messages. - * tests/parseExpr.test: - -2006-06-20 Don Porter - - * generic/tclIOUtil.c: Changed default configuration to - * generic/tclInt.decls: #undef USE_OBSOLETE_FS_HOOKS which disables - * generic/tclTest.c: access to the Tcl 8.3 internal routines for - hooking into filesystem operations. Everyone ought to have migrated to - Tcl_Filesystems by now. - ***POTENTIAL INCOMPATIBILITY*** for any code still stuck in the - pre-Tcl_Filesystem era. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclStrToD.c: Removed dead code that permitted disabling of - recognition of the new 0b and 0o numeric formats. - - * generic/tclExecute.c: Removed dead code that implemented alternative - * generic/tclObj.c: design where numeric values did not - automatically narrow to the smallest Tcl_ObjType required to hold them - - * generic/tclCmdAH.c: Removed dead code that was old implementation - of [format]. - -2006-06-14 Daniel Steffen - - * unix/tclUnixPort.h (Darwin): support MAC_OS_X_VERSION_MAX_ALLOWED - define from AvailabilityMacros.h: override configure detection and - only use API available in the indicated OS version or earlier. - -2006-06-14 Donal K. Fellows - - * doc/format.n, doc/scan.n: Added examples for converting between - characters and their numeric interpretations following user prompting. - -2006-06-13 Donal K. Fellows - - * unix/tclLoadDl.c (TclpDlopen): Workaround for a compiler bug in Sun - Forte 6. [Bug 1503729] - -2006-06-06 Don Porter - - * doc/GetStdChan.3: Added recommendation that each call to - Tcl_SetStdChannel() be accompanied by a call to Tcl_RegisterChannel(). - -2006-06-05 Donal K. Fellows - - * doc/Alloc.3: Added documentation of promise that Tcl_Realloc(NULL,x) - is the same as Tcl_Alloc(x), as discussed in comp.lang.tcl. Also fixed - nonsense sentence to say something meaningful. - -2006-05-29 Jeff Hobbs - - * generic/tcl.h (Tcl_DecrRefCount): use if/else construct to allow - placement in unbraced outer if/else conditions. (jcw) - -2006-05-27 Daniel Steffen - - * macosx/tclMacOSXNotify.c: implemented pthread_atfork() handler that - * unix/tcl.m4 (Darwin): recreates CoreFoundation state and - notifier thread in the child after a fork(). Note that pthread_atfork - is available starting with Tiger only. Because vfork() is used by the - core on Darwin, [exec]/[open] are not affected by this fix, only - extensions or embedders that call fork() directly (such as TclX). - However, this only makes fork() safe from corefoundation tcl with - --disable-threads; as on all platforms, forked children may deadlock - in threaded tcl due to the potential for stale locked mutexes in the - child. [Patch 923072] - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-05-24 Donal K. Fellows - - * unix/tcl.m4 (SC_CONFIG_SYSTEM): Fixed quoting of command script to - awk; it was a rarely used branch, but it was wrong. [Bug 1494160] - -2006-05-23 Donal K. Fellows - - * doc/chan.n, doc/refchan.n: Tighten up the documentation to follow a - slightly more consistent style with regard to argument capitalization. - -2006-05-13 Don Porter - - * generic/tclProc.c (ProcCompileProc): When a bump of the compile - epoch forces the re-compile of a proc body, take care not to overwrite - any Proc struct that may be referred to on the active call stack. This - fixes [Bug 1482718]. Note that the fix will not be effective for code - that calls the private routine TclProcCompileProc() directly. - -2006-05-13 Daniel Steffen - - * generic/tclEvent.c (HandleBgErrors): fix leak. [Coverity issue 86] - -2006-05-05 Don Porter - - * generic/tclMain.c (Tcl_Main): Corrected flaw that required - * tests/main.test: (Tcl_Main-4.5): processing of one interactive - command before passing control to the loop routine registered with - Tcl_SetMainLoop(). [Bug 1481986] - -2006-05-04 Don Porter - - * README: Bump version number to 8.5a5 - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * generic/tclBasic.c (ExprSrandFunc): Restore acceptance of wide/big - * doc/mathfunc.n: integer values by srand(). [Bug 1480509] - -2006-04-26 Don Porter - - *** 8.5a4 TAGGED FOR RELEASE *** - - * changes: Updates for another RC. - - * generic/tclBinary.c: Revised the handling of the Q and q format - * generic/tclInt.h: specifiers for [binary] to account for the - * generic/tclStrToD.c: "middle endian" floating point format used in - Nokia N770. - -2006-04-25 Don Porter - - * doc/DoubleObj.3: More doc updates for TIP 237. - * doc/expr.n: - * doc/format.n: - * doc/mathfunc.n: - * doc/scan.n: - * doc/string.n: - - * generic/tclScan.c: [scan $s %u] is documented to accept only - * tests/scan.test: decimal formatted integers. Fixed to match. - -2006-04-19 Kevin B. Kenny - - * generic/tclStrToD.c: Added code to support the "middle endian" - floating point format used in the Nokia N770's software-based floating - point. Thanks to Bruce Johnson for reporting this bug, originally on - http://wiki.tcl.tk/15408. - * library/clock.tcl: Fixed a bug with Daylight Saving Time and Posix - time zone specifiers reported by Martin Lemburg in - http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/9a8b15a4dfc0b7a0 - (and not at SourceForge). - * tests/clock.test: Added test case for the above bug. - -2006-04-18 Donal K. Fellows - - * doc/IntObj.3: Minor review fixes, including better documentation of - the behaviour of Tcl_GetBignumAndClearObj. - -2006-04-17 Don Porter - - * doc/IntObj.3: Documentation changes to account for TIP 237 changes. - * doc/Object.3: [Bug 1446971] - -2006-04-12 Donal K. Fellows - - * generic/regc_locale.c (cclass): Redefined the meaning of [:print:] - to be exactly UNICODE letters, numbers, punctuation, symbols and - spaces (*not* whitespace). [Bug 1376892] - -2006-04-11 Don Porter - - * generic/tclTrace.c: Stop some interference between enter traces - * tests/trace.test: and enterstep traces. [Bug 1458266] - -2006-04-07 Don Porter - - * generic/tclPathObj.c: Yet another revised fix for the [Bug 1379287] - * tests/fileSystem.test: family of path normalization bugs. - -2006-04-06 Jeff Hobbs - - * generic/tclRegexp.c (FinalizeRegexp): full reset data to indicate - readiness for reinitialization. - -2006-04-06 Don Porter - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): It seems there - * tests/indexObj.test: are extensions that rely on the prior behavior - * doc/GetIndex.3: that the empty string cannot succeed as a - unique prefix matcher, so I'm restoring Donal Fellows's solution. - Added mention of this detail to the documentation. [Bug 1464039] - - * tests/compExpr-old.test: Updated testmathfunctions constraint - * tests/compExpr.test: to post-TIP-232 world. - * tests/expr-old.test: - * tests/expr.test: - * tests/info.test: - - * tests/indexObj.test: Corrected other test errors revealed by - * tests/upvar.test: testing outside the tcltest application. - - * generic/tclPathObj.c: Revised fix for the [Bug 1379287] family of - path normalization bugs. - -2006-04-06 Daniel Steffen - - * unix/tcl.m4: removed TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING - define on Darwin. [Bug 1457515] - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-04-05 Don Porter - - * win/tclWinInit.c: More careful calls to Tcl_DStringSetLength() - * win/tclWinSock.c: to avoid creating invalid DString states. Bump - * win/tclWinDde.c: to version 1.3.2. [RFE 1366195] - * library/dde/pkgIndex.tcl: - - * library/reg/pkgIndex.tcl: Bump to registry 1.2 because - * win/tclWinReg.c: Registry_Unload() is a new public routine - * win/Makefile.in: compared to the 1.1.* releases. - - * win/configure.in: Bump package version numbers. - * win/configure: autoconf 2.59 - -2006-04-05 Donal K. Fellows - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Allow empty - strings to be matched by the Tcl_GetIndexFromObj machinery, in the - same manner as any other key. [Bug 1464039] - -2006-04-03 Andreas Kupries - - * generic/tclIO.c (ReadChars): Added check, panic and commentary to a - piece of code which relies on BUFFER_PADDING to create enough space at - the beginning of each buffer for the insertion of partial multibyte - data at the beginning of a buffer. Commentary explains why this code - is OK, and the panic is as a precaution if someone twiddled the - BUFFER_PADDING into uselessness. - - * generic/tclIO.c (ReadChars): Temporarily suppress the use of - TCL_ENCODING_END set when EOF was reached while the buffer we are - converting is not truly the last buffer in the queue. Together with - the Utf bug below it was possible to completely wreck the buffer data - structures, eventually crashing Tcl. [Bug 1462248] - - * generic/tclEncoding.c (UtfToUtfProc): Stop accessing memory beyond - the end of the input buffer when TCL_ENCODING_END is set and the last - bytes of the buffer start a multi-byte sequence. This bug contributed - to [Bug 1462248]. - -2006-03-30 Miguel Sofer - - * generic/tclExecute.c: remove unused var and silence gcc warning - -2006-03-29 Jeff Hobbs - - * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\" - path-as-escape issue. - -2006-03-29 Don Porter - - * changes: Updates for another RC. - - * generic/tclPathObj.c: More fixes for path normalization when /../ - * tests/fileSystem.test: tries to go beyond root.[Bug 1379287] - - * generic/tclExecute.c: Revised INST_MOD implementation to do - calculations in native types as much as possible, moving to mp_ints - only when necessary. - -2006-03-28 Jeff Hobbs - - * win/tclWinPipe.c (TclpCreateProcess): change panics to Tcl errors - and do proper refcounting of noe objPtr. [Bug 1194429] - - * unix/tcl.m4, win/tcl.m4: []-quote AC_DEFUN functions. - -2006-03-28 Daniel Steffen - - * macosx/Tcl.xcode/default.pbxuser: add '-singleproc 1' cli arg to - * macosx/Tcl.xcodeproj/default.pbxuser: tcltest to ease test debugging - - * macosx/Tcl.xcode/project.pbxproj: removed $prefix/share from - * macosx/Tcl.xcodeproj/project.pbxproj: TCL_PACKAGE_PATH as per change - to unix/configure.in of 2006-03-13. - - * unix/tclUnixFCmd.c (TclpObjNormalizePath): deal with *BSD/Darwin - realpath() converting relative paths into absolute paths [Bug 1064247] - -2006-03-28 Vince Darley - - * generic/tclIOUtil.c: fix to nativeFilesystemRecord comparisons - (lesser part of [Bug 1064247]) - -2006-03-27 Pat Thoyts - - * win/tclWinTest.c: Fixes for [Bug 1456373] (mingw-gcc issue) - -2006-03-27 Andreas Kupries - - * doc/CrtChannel.3: Added TCL_CHANNEL_VERSION_5, made it the - * generic/tcl.h: version where the "truncateProc" is defined at, - * generic/tclIO.c: and moved all channel drivers of Tcl to v5. - * generic/tclIOGT.c, generic/tclIORChan.c, unix/tclUnixChan.c: - * unix/tclUnixPipe.c, win/tclWinChan.c, win/tclWinConsole.c: - * win/tclWinPipe.c, win/tclWinSerial.c, win/tclWinSock.c: - -2006-03-27 Don Porter - - * generic/tclExecute.c: Merge INST_MOD computation in with the - INST_?SHIFT instructions, which also operate only on two integral - values. Also corrected flaw that made INST_BITNOT of wide values - require mp_int calculations. Also corrected type that missed optimized - handling of the tclBooleanType by the TclGetBooleanFromObj macro. - - * changes: Updates for another RC. - -2006-03-25 Don Porter - - * generic/tclExecute.c: Corrections to INST_EXPON detection of - overflow to use mp_int calculations. - -2006-03-24 Kevin B. Kenny - - * generic/tclExecute.c (TclExecuteByteCode): Added a couple of missing - casts to 'int' that were affecting compilablity on VC6. - -2006-03-24 Don Porter - - * generic/tclEncoding.c: Reverted latest change [Bug 506653] since it - reportedly killed test performance on Windows. - - * generic/tclExecute.c: Revised INST_EXPON implementation to do - calculations in native types as much as possible, moving to mp_ints - only when necessary. - -2006-03-23 Don Porter - - * generic/tclExecute.c: Merged INST_EXPON handling in with the other - binary operators that operate on all number types (INST_ADD, etc.). - - * tests/env.test: With case preserved (see 2006-03-21 commit) be sure - to do case-insensitive filtering. [Bug 1457065] - -2006-03-23 Reinhard Max - - * unix/tcl.spec: Cleaned up and completed the spec file. An RPM can - now be built from the tcl source distribution with "rpmbuild -tb - " - -2006-03-22 Reinhard Max - - * tests/stack.test: Run the stack tests in subshells, so that they are - reported as failed tests rather than bugs in the test suite if the - recursion causes a segfault. - -2006-03-21 Don Porter - - * changes: Updates for another RC. - - * generic/tclStrToD.c: One of the branches of AccumulateDecimalDigit - * tests/parseExpr.test: did not. [Bug 1451233] - - * tests/env.test: Preserve case of saved env vars. [Bug 1409272] - -2006-03-21 Daniel Steffen - - * generic/tclInt.decls: implement globbing for HFS creator & type - * macosx/tclMacOSXFCmd.c:codes and 'hidden' flag, as documented in - * tests/macOSXFCmd.test: glob.n; objectified OSType handling in [glob] - * unix/tclUnixFile.c: and [file attributes]; fix globbing for - hidden files with pattern==NULL arg. [Bug 823329] - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: make genstubs - -2006-03-20 Andreas Kupries - - * win/Makefile.in (install-libraries): Generate tcl8/8.4 directory - under Windows as well (cygwin Makefile). Related entry: 2006-03-07, - dgp. This moved the installation of http from 8.2 to 8.4, partially. A - fix of the required directory creation was done for unix on Mar 10, - without entry in the Changelog. This entry is for the fix of the - directory creation under Windows. - - * unix/installManPage: There is always one even more broken "sed". - Moved the # comment starting character in the sed script to the - beginning of their respective lines. The AIX sed will not recognize - them as comments otherwise :( The actual text stays indented for - better association with the commands they belong to. - -2006-03-20 Donal K. Fellows - - * tests/cmdAH.test, tests/fCmd.test, tests/unixFCmd.test: - * tests/winFCmd.test: Cleanup of some test constraint handling, and a - few other minor issues. - -2006-03-18 Vince Darley - - * generic/tclFileName.c: - * doc/FileSystem.3: - * tests/fileName.test: Fix to [Bug 1084705] so that 'glob -nocomplain' - finally agrees with its documentation and doesn't swallow genuine - errors. - - ***POTENTIAL INCOMPATIBILITY*** for scripts that assumed '-nocomplain' - removes the need for 'catch' to deal with non-understood path names. - - Small optimisation to implementation of pattern==NULL case of TclGlob, - and clarification to the documentation. [Tclvfs bug 1405317] - -2006-03-18 Vince Darley - - * tests/fCmd.test: added knownBug test case for [Bug 1394972] - - * tests/winFCmd.test: - * tests/tcltest.test: corrected tests to better account for behaviour - of writable/non-writable directories on Windows 2000/XP. This, with - the previous patches, closes [Bug 1193497] - -2006-03-17 Andreas Kupries - - * doc/chan.n: Updated with documentation for the commands 'chan - create' and 'chan postevent' (TIP #219). - - * doc/refchan.n: New file. Documentation of the command handler API - for reflected channels (TIP #219). - -2006-03-17 Joe Mistachkin - - * unix/tclUnixPort.h: Include pthread.h prior to pthread_np.h [Bug - 1444692] - - * win/tclWinTest.c: Corrected typo of 'initializeMutex' that prevented - successful compilation. - -2006-03-16 Andreas Kupries - - * doc/open.n: Documented the changed behaviour of 'a'ppend mode. - - * tests/io.test (io-43.1 io-44.[1234]): Rewritten to be self-contained - with regard to setup and cleanup. [Bug 681793] - - * generic/tclIOUtil.c (TclGetOpenMode): Added the flag O_APPEND to the - list of POSIX modes used when opening a file for 'a'ppend. This - enables the proper automatic seek-to-end-on-write by the OS. See [Bug - 680143] for longer discussion. - - * tests/ioCmd.test (iocmd-13.7.*): Extended the testsuite to check the - new handling of 'a'. - -2006-03-15 Andreas Kupries - - * tests/socket.test: Extended the timeout in socket-11.11 from 10 to - 40 seconds to allow for really slow machines. Also extended - actual/expected results with value of variable 'done' to make it - clearer when a test fails due to a timeout. [Bug 792159] - -2006-03-15 Vince Darley - - * win/fCmd.test: add proper test constraints so the new tests don't - run on Unix. - -2006-03-14 Andreas Kupries - - * generic/tclPipe.c (TclCreatePipeline): Modified the processing of - pipebars to fail if the last bar is followed only by redirections. - [Bug 768659] - -2006-03-14 Andreas Kupries - - * doc/fconfigure.n: Clarified that -translation is binary is reported - as lf when queried, because it is identical to lf, except for the - special additional behaviour when setting it. [Bug 666770] - -2006-03-14 Andreas Kupries - - * doc/clock.n: Removed double-quotes around section title NAME; not - needed. - * unix/installManpage: Reverted part to handle double-quotes in - section NAME, chokes older sed installations. - -2006-03-14 Andreas Kupries - - * library/tm.tcl (::tcl::tm::Defaults): Fixed handling of environment - variable TCLX.y_TM_PATH, bad variable reference. Thanks to Julian - Noble. [Bug 1448251] - -2006-03-14 Vince Darley - - * win/tclWinFile.c: updated patch to deal with 'file writable' issues - on Windows XP/2000. - * generic/tclTest.c: - * unix/tclUnixTest.c: - * win/tclWinTest.c: - * tests/fCmd.test: updated test suite to deal with correct permissions - setting and differences between XP/2000 and 95/98 3 tests still fail; - to be dealt with shortly - -2006-03-13 Don Porter - - * generic/tclEncoding.c: Report error when an escape encoding is - missing one of its sub-encodings. [Bug 506653] - - * unix/configure.in: Revert change from 2005-07-26 that sometimes - * unix/configure: added $prefix/share to the tcl_pkgPath. See - [Patch 1231015]. autoconf-2.59. - -2006-03-10 Miguel Sofer - - * generic/tclProc.c (ObjInterpProcEx): - * tests/apply.test (apply-5.1): Fix [apply] error messages so that - they quote the lambda expression. [Bug 1447355] - -2006-03-10 Zoran Vasiljevic - - -- Summary of changes fixing [Bug 1437595] -- - - * generic/tclEvent.c: Cosmetic touches and identation - * generic/tclInt.h: Added TclpFinalizeSockets() call. - - * generic/tclIO.c: Calls TclpFinalizeSockets() as part of the - TclFinalizeIOSubsystem(). - - * unix/tclUnixSock.c: Added no-op TclpFinalizeSockets(). - - * win/tclWinPipe.c, win/tclWinSock.c: Finalization of sockets/pipes is - now solely done in TclpFinalizeSockets() and TclpFinalizePipes() and - not over the thread-exit handler, because the order of actions the Tcl - generic core will impose may result in cores/hangs if the thread exit - handler tears down corresponding subsystem(s) too early. - -2006-03-10 Vince Darley - - * win/tclWinFile.c: previous patch breaks tests, so removed. - -2006-03-09 Vince Darley - - * win/tclWinFile.c: fix to 'file writable' in certain XP directories. - Thanks to fvogel and jfg. [Patch 1344540] Modified patch to make use - of existing use of getSecurityProc. - -2006-03-08 Don Porter - - * generic/tclExecute.c: Complete missing bit of TIP 215 implementation - * tests/incr.test: - -2006-03-07 Joe English - - * unix/tcl.m4: Set SHLIB_LD_FLAGS='${LIBS}' on NetBSD, as per the - other *BSD variants. [Bug 1334613] - * unix/configure: Regenerated. - -2006-03-07 Don Porter - - * changes: Update in prep. for 8.5a4 release. - - * unix/Makefile.in: Package http 2.5.2 requires Tcl 8.4, so the - * win/Makefile.in: *.tm installation has to be placed in an "8.4" - directory, not an "8.2" directory. - -2006-03-06 Don Porter - - * generic/tclBasic.c: Revised handling of TCL_EVAL_* flags to - * tests/parse.test: simplify TclEvalObjvInternal and to correct - the auto-loading of alias targets (parse-8.12). [Bug 1444291] - -2006-03-03 Don Porter - - * generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287] to - work on Windows. - - * generic/tclObj.c: Compatibility support for existing code that - calls Tcl_GetObjType("boolean"). - -2006-03-02 Don Porter - - * generic/tclPathObj.c: Fix for failed normalization of paths - * tests/fileSystem.test: with /../ that lead back to the root - of the filesystem, like /foo/.. [Bug 1379287] - -2006-03-01 Reinhard Max - - * unix/installManPage: Fix the script for manpages that have quotes - around the .SH arguments, as doctools produces them. [Bug 1292145] - Some minor cleanups and improvements. - -2006-02-28 Don Porter - - * generic/tclBasic.c: Corrections to be sure that TCL_EVAL_GLOBAL - * tests/namespace.test: evaluations act the same as [uplevel #0] - * tests/parse.test: evaluations, even when execution traces or - * tests/trace.test: invocations of [::unknown] are present. [Bug - 1439836] - -2006-02-22 Don Porter - - * generic/tclBasic.c: Corrected a few bugs in how [namespace - * tests/namespace.test: unknown] interacts with TCL_EVAL_* flags. - [Patch 958222] - -2006-02-17 Don Porter - - * generic/tclIORChan.c: Revised error message generation and handling - * tests/ioCmd.test: of exceptional return codes in the channel - reflection layer. [Bug 1372348] - -2006-02-16 Don Porter - - * generic/tclIndexObj.c: Disallow the "ambiguous" error message - * tests/indexObj.test: when TCL_EXACT matching is requested. - * tests/ioCmd.test: - -2006-02-15 Don Porter - - * generic/tclIO.c: Made several routines tolerant of - * generic/tclIORChan.c: interp == NULL arguments. [Bug 1380662] - * generic/tclIOUtil.c: - -2006-02-09 Don Porter - - TIP#215 IMPLEMENTATION - - * doc/incr.n: Revised [incr] to auto-initialize when varName - * generic/tclExecute.c: argument is unset. [Patch 1413115] - * generic/tclVar.c: - * tests/compile.test: - * tests/incr-old.test: - * tests/incr.test: - * tests/set.test: - - * tests/main.test (Tcl_Main-6.7): Improved robustness of - command auto-completion test. [Bug 1422736] - -2006-02-08 Donal K. Fellows - - * doc/Encoding.3, doc/encoding.n: Updates due to review at request of - Don Porter. Mostly minor changes. - -2006-02-08 Don Porter - - TIP#258 IMPLEMENTATION - - * doc/Encoding.3: New subcommand [encoding dirs]. - * doc/encoding.n: New routine Tcl_GetEncodingNameFromEnvironment - * generic/tcl.decls: Made public: - * generic/tclBasic.c: TclGetEncodingFromObj - * generic/tclCmdAH.c: -> Tcl_GetEncodingFromObj - * generic/tclEncoding.c:TclGetEncodingSearchPath - * generic/tclInt.decls: -> Tcl_GetEncodingSearchPath - * generic/tclInt.h: TclSetEncodingSearchPath - * generic/tclTest.c: -> Tcl_SetEncodingSearchPath - * library/init.tcl: Removed commands: - * tests/cmdAH.test: [tcl::unsupported::EncodingDirs] - * tests/encoding.test: [testencoding path] (Tcltest) - * unix/tclUnixInit.c: [Patch 1413934] - * win/tclWinInit.c: - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2006-02-01 Miguel Sofer - - * generic/tclProc.c: minor improvements to [apply] - * tests/apply.test: new tests; apply-5.1 currently fails to indicate - missing work in error reporting - -2006-02-01 Don Porter - - TIP#194 IMPLEMENTATION - - * doc/apply.n: (New file) New command [apply]. [Patch 944803] - * doc/uplevel.n: - * generic/tclBasic.c: - * generic/tclInt.h: - * generic/tclProc.c: - * tests/apply.test: (New file) - * tests/proc-old.test: - * tests/proc.test: - - TIP#181 IMPLEMENTATION - - * doc/Namespace.3: New command [namespace unknown]. New public C - * doc/namespace.n: routines Tcl_(Get|Set)NamespaceUnknownHandler. - * doc/unknown.n: [Patch 958222] - * generic/tcl.decls: - * generic/tclBasic.c: - * generic/tclInt.h: - * generic/tclNamesp.c: - * tests/namespace.test: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - TIP#250 IMPLEMENTATION - - * doc/namespace.n: New command [namespace upvar]. [Patch 1275435] - * generic/tclInt.h: - * generic/tclNamesp.c: - * generic/tclVar.c: - * tests/namespace.test: - * tests/upvar.test: - -2006-01-26 Donal K. Fellows - - * doc/dict.n: Fixed silly bug in example. Thanks to Heiner Marxen - for catching this! [Bug 1415725] - -2006-01-26 Donal K. Fellows - - * unix/tclUnixChan.c (TclpOpenFileChannel): Tidy up and comment the - mess to do with setting up serial channels. This (deliberately) breaks - a broken FreeBSD port, indicates what we're really doing, and reduces - the amount of conditional compilation sections for better maintenance. - -2006-01-25 Donal K. Fellows - - * unix/tclUnixInit.c (TclpInitPlatform): Improved conditions on when - to update the FP rounding mode on FreeBSD, taken from FreeBSD port. - -2006-01-23 Donal K. Fellows - - * tests/string.test (string-12.21): Added test for [Bug 1410553] based - on original bug report. - -2006-01-23 Miguel Sofer - - * generic/tclStringObj.c: fixed incorrect handling of internal rep in - Tcl_GetRange. Thanks to twylite and Peter Spjuth. [Bug 1410553] - - * generic/tclProc.c: fixed args handling for precompiled bodies [Bug - 1412695]; thanks to Uwe Traum. - -2006-01-16 Reinhard Max - - * generic/tclPipe.c (FileForRedirect): Prevent nameString from being - freed without having been initialized. - * tests/exec.test: Added a test for the above. - -2006-01-12 Zoran Vasiljevic - - * generic/tclPathObj.c (Tcl_FSGetInternalRep): backported patch from - core-8-4-branch. A freed pointer has been overwritten causing all - sorts of coredumps. - -2006-01-12 Vince Darley - - * win/tclWinFile.c: fix to sharing violation [Bug 1366227] - -2006-01-11 Don Porter - - * generic/tclBasic.c: Moved Tcl_LogCommandInfo from tclBasic.c to - * generic/tclNamesp.c: tclNamesp.c to get access to identifier with - * tests/error.test (error-7.0): file scope. Added check for traces on - ::errorInfo, and when present fall back to contruction of the stack - trace in the variable so that write trace notification timings are - compatible with earlier Tcl releases. This reduces, but does not - completely eliminate the ***POTENTIAL INCOMPATIBILITY*** created by - the 2004-10-15 commit. [Bug 1397843] - -2006-01-10 Daniel Steffen - - * unix/configure: add caching, use AC_CACHE_CHECK instead of - * unix/configure.in: AC_CACHE_VAL where possible, consistent message - * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes - and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with - default argument, Darwin improvements to SC_LOAD_*CONFIG. - -2006-01-09 Don Porter - - * generic/tclNamesp.c (NamespaceInscopeCmd): [namespace inscope] - * tests/namespace.test: commands were not reported by [info level]. - [Bug 1400572] - -2006-01-09 Donal K. Fellows - - * generic/tclTrace.c: Stop exporting the guts of the trace command; - nothing outside this file needs to see it. [Bug 971336] - -2006-01-05 Donal K. Fellows - - * unix/tcl.m4 (TCL_CONFIG_SYSTEM): Factor out the code to determine - the operating system version number, as it was replicated in several - places. - -2006-01-04 David Gravereaux - - * win/tclAppInit.c: WIN32 native console signal handler removed. This - was found to be interfering with TWAPI extension one. IMO, special - services such as signal handlers should best be done with extensions - to the core after discussions on c.l.t. about Roy Terry's tclsh - children of a real windows service shell. - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** - *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** - *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** + *** CHANGELOG ENTRIES FOR 2008 IN "ChangeLog.2008" *** + *** CHANGELOG ENTRIES FOR 2006-2007 IN "ChangeLog.2007" *** + *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** + *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** + *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** + *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** + *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** + *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** ****************************************************************** diff --git a/ChangeLog.2007 b/ChangeLog.2007 new file mode 100644 index 0000000..e01a50e --- /dev/null +++ b/ChangeLog.2007 @@ -0,0 +1,5921 @@ +2007-12-31 Donal K. Fellows + + * doc/dict.n: Clarified meaning of dictionary values following + discussion on comp.lang.tcl. + +2007-12-26 Miguel Sofer + + * generic/tclCmdIL.c: More [lsort] data handling streamlines. The + function MergeSort is gone, essentially inlined into Tcl_LsortObjCmd. + It is not a straight inlining, two loops over all lists elements where + merged in the process: the linked list elements are now built and + merged into the temporary sublists in the same pass. + +2007-12-25 Miguel Sofer + + * generic/tclCmdIL.c: More [lsort] data handling streamlines. Extra + mem reqs of latest patches removed, restored to previous mem profile. + Improved -unique handling, now eliminating repeated elems immediately + instead of marking them to avoid reinsertion at the end. + +2007-12-23 Jeff Hobbs + + * generic/tclCompCmds.c (TclCompileRegexpCmd): TCL_REG_NOSUB cannot + * tests/regexp.test (regexp-22.2): be used because it + * tests/regexpComp.test: [Bug 1857126] disallows backrefs. + +2007-12-21 Miguel Sofer + + * generic/tclCmdIL.c: Speed patch for lsort. [Patch 1856994] + +2007-12-21 Miguel Sofer + + * generic/tclCmdIL.c (Tcl_LsortObjCmd, Tcl_LsearchObjCmd): Avoid + calling SelectObjFromSublist when there are no sublists. + +2007-12-21 Miguel Sofer + + * generic/tclCmdIL.c (Tcl_LsortObjCmd): Preallocate a listObj of + sufficient length for the sorted list instead of growing it. Second + commit replaces calls to Tcl_ListObjAppenElement with direct access to + the internal rep. + +2007-12-19 Don Porter + + *** 8.5.0 TAGGED FOR RELEASE *** + + * changes: Updated for 8.5.0 release. + +2007-12-19 Jeff Hobbs + + * generic/tclCompCmds.c (TclCompileSwitchCmd): update switch -regexp + * tests/switch.test-14.*: compilation to pass + the cflags to INST_REGEXP (changed on 12-07). Added tests for switch + -regexp compilation (need more). [Bug 1854399] + +2007-12-18 Don Porter + + * changes: Updated for 8.5.0 release. + +2007-12-18 Donal K. Fellows + + * generic/regguts.h, generic/regc_color.c, generic/regc_nfa.c: + Fixes for problems created when processing regular expressions that + generate very large automata. An enormous number of thanks to Will + Drewry , Tavis Ormandy , + and Tom Lane from the Postgresql crowd for + their help in tracking these problems down. [Bug 1810264] + +2007-12-17 Don Porter + + * changes: Updated for 8.5.0 release. + +2007-12-17 Miguel Sofer + + * generic/tclAlloc.c: + * generic/tclExecute.c: + * generic/tclInt.h: + * generic/tclThreadAlloc.c: Fix alignment for memory returned by + TclStackAlloc; insure that all memory allocators align to 16-byte + boundaries on 64 bit platforms [Bug 1851832, 1851524] + +2007-12-14 Jeff Hobbs + + * generic/tclIOUtil.c (FsAddMountsToGlobResult): fix the tail + conversion of vfs mounts. [Bug 1602539] + + * win/README: updated notes + +2007-12-14 Pat Thoyts + + * tests/winFile.test: Fixed tests for win2k with long machine name + +2007-12-14 Pat Thoyts + + * win/nmakehlp.c: Support compilation with MSVC9 for AMD64. + * win/makefile.vc: + +2007-12-13 Donal K. Fellows + + * doc/trace.n: Clarified documentation of enterstep and leavestep + traces, including adding example. [Bug 614282, 1701540, 1755984] + +2007-12-12 Don Porter + + * doc/IntObj.3: Update docs for the Tcl_GetBignumAndClearObj() -> + Tcl_TakeBignumFromObj() revision [TIP 298]. Added docs for the + Tcl_InitBignumFromDouble() routine. [Bug 1446971] + + * changes: Updated for 8.5.0 release. + +2007-12-10 Jeff Hobbs + + * generic/tclUtil.c (TclReToGlob): reduce escapes in conversion + when not necessary + + * generic/tclInt.decls: move TclByteArrayMatch and TclReToGlob + * generic/tclIntDecls.h: to tclInt.h from stubs. + * generic/tclStubInit.c: Add flags var to TclByteArrayMatch for + * generic/tclInt.h: future extensibility + * generic/tcl.h: define TCL_MATCH_EXACT doc for Tcl_StringCaseMatch. + * doc/StrMatch.3: It is compatible with existing usage. + * generic/tclExecute.c (INST_STR_MATCH): flag for TclByteArrayMatch + * generic/tclUtil.c (TclByteArrayMatch, TclStringMatchObj): + * generic/tclRegexp.c (Tcl_RegExpExecObj): + * generic/tclCmdMZ.c (StringMatchCmd): Use TclStringMatchObj + * tests/string.test (11.9.* 11.10.*): more tests + +2007-12-10 Joe English + + * doc/string.n, doc/UniCharIsAlpha.3: Fix markup errors. + * doc/CrtCommand.3, doc/CrtMathFnc.3, doc/FileSystem.3, + * doc/GetStdChan.3, doc/OpenFileChnl.3, doc/SetChanErr.3, + * doc/eval.n, doc/filename.n: Consistency: Move "KEYWORDS" section + after "SEE ALSO". + +2007-12-10 Daniel Steffen + + * tools/genStubs.tcl: fix numerous issues handling 'macosx', + 'aqua' or 'x11' entries interleaved + with 'unix' entries [Bug 1834288]; add + genStubs::export command + [Tk FR 1716117]; cleanup formatting. + + * generic/tcl.decls: use new genstubs 'export' command to + * generic/tclInt.decls: mark exported symbols not in stubs + * generic/tclTomMath.decls: table [Tk FR 1716117]; cleanup + formatting. + + * generic/tclDecls.h: regen with new genStubs.tcl. + * generic/tclIntDecls.h: [Bug 1834288] + * generic/tclIntPlatDecls.h: + * generic/tclPlatDecls.h: + * generic/tclStubInit.c: + +2007-12-09 Jeff Hobbs + + * tests/io.test, tests/chanio.test (io-73.1): Make sure to invalidate + * generic/tclIO.c (SetChannelFromAny): internal rep only after + validating channel rep. [Bug 1847044] + +2007-12-08 Donal K. Fellows + + * doc/expr.n, doc/mathop.n: Improved the documentation of the + operators. [Bug 1823622] + + * generic/tclBasic.c (builtInCmds): Corrected list of hidden and + * doc/interp.n (SAFE INTERPRETERS): exposed commands so that the + documentation and reality now match. [Bug 1662436] + +2007-12-07 Jeff Hobbs + + * generic/tclExecute.c (TclExecuteByteCode INST_REGEXP): + * generic/tclCompCmds.c (TclCompileRegexpCmd): Pass correct RE + compile flags at compile time, and use TCL_REG_NOSUB. + + * generic/tclIOCmd.c (FinalizeIOCmdTSD, Tcl_PutsObjCmd): cache + stdout channel object for [puts $str] calls. + +2007-12-06 Don Porter + + * README: Remove mention of dead comp.lang.tcl.announce + newsgroup. [Bug 1846433] + + * unix/README: Mention the stub library created by `make` and warn + about the effect of embedded paths in the installed binaries. + Thanks to Larry Virden. [Bug 1794084] + + * doc/AddErrInfo.3: Documentation for the new routines in TIP 270. + * doc/Interp.3: + * doc/StringObj.3: + +2007-12-06 Don Porter + + * doc/namespace.n: Documentation for zero-argument form of + [namespace import] (TIP 261) [Bug 1596416] + +2007-12-06 Jeff Hobbs + + * generic/tclInt.h: add TclGetChannelFromObj decl + (TclMatchIsTrivial): simplify TclMatchIsTrivial to remove ] check. + +2007-12-06 Donal K. Fellows + + + * generic/tclBasic.c (Tcl_CreateInterp): Simplify the setting up of + * generic/tclIOCmd.c (TclInitChanCmd): the [chan] ensemble. This + * library/init.tcl: gets rid of quite a bit of + code and makes it possible to understand the whole with less effort. + + * generic/tclCompCmds.c (TclCompileEnsemble): Ensure that the right + number of tokens are copied. [Bug 1845320] + + * generic/tclNamesp.c (TclMakeEnsemble): Added missing release of a + DString. [Bug 1845397] + +2007-12-05 Jeff Hobbs + + * generic/tclIO.h: Create Tcl_Obj for Tcl channels to reduce + * generic/tclIO.c: overhead in lookup by Tcl_GetChannel. New + * generic/tclIOCmd.c: TclGetChannelFromObj for internal use. + * generic/tclIO.c (WriteBytes, WriteChars): add opt check to avoid + EOL translation when not linebuffered or using lf. [Bug 1845092] + +2007-12-05 Miguel Sofer + + * tests/stack.test: made the tests for stack overflow not care + about which mechanism caused the error (interp's recursion limit + or C-stack depth detector). + +2007-12-05 Jeff Hobbs + + * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 + -loleaut32 but not msvc for Tk's [send]. [Bug 1844749] + +2007-12-05 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Prevent shimmering crash + when -exact and -integer/-real are mixed. [Bug 1844789] + +2007-12-03 Donal K. Fellows + + * unix/tclUnixChan.c (CreateSocketAddress): Add extra #ifdef-fery to + make code compile on BSD 5. [Bug 1618235, again] + +2007-12-03 Don Porter + + * library/tcltest/tcltest.tcl: Bump tcltest to version 2.3.0 so that + * library/tcltest/pkgIndex.tcl: we release a stable tcltest with a + * unix/Makefile.in: stable Tcl. + * win/Makefile.in: + +2007-12-03 Jeff Hobbs + + * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib + +2007-12-03 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileSwitchCmd): Adjusted the [switch] + * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): command so that when + passed two arguments, no check for options are performed. This is OK + since in the two-arg case, detecting an option would definitely lead + to a syntax error. [Patch 1836519] + +2007-11-29 Jeff Hobbs + + * win/makefile.vc: add ws2_32.lib to baselibs + * win/configure, win/tcl.m4: add ws2_32.lib / -lws2_32 to build. + * win/tclWinSock.c: remove dyn loading of winsock, assume that it is + always available now. + +2007-11-29 Don Porter + + * generic/tclWinSock.c (InitializeHostName): Correct error in + buffer length tracking. After gethostname() writes into a buffer, + convert only the written string to internal encoding, not the whole + buffer. + +2007-11-28 Don Porter + + * generic/tclConfig.c: Corrected failure of the [::foo::pkgconfig] + command to clean up registered configuration data when the query + command is deleted from the interp. [Bug 983501] + + * generic/tclNamesp.c (Tcl_SetEnsembleMappingDict): Added checks + that the dict value passed in is in the format required to make the + internals of ensembles work. [Bug 1436096] + + * generic/tclIO.c: Simplify test and improve accuracy of error + message in latest changes. + +2007-11-28 Pat Thoyts + + * generic/tclIO.c: -eofchar must support no eofchar. + +2007-11-27 Miguel Sofer + + * generic/tclBasic.c: remove unneeded call in Tcl_CreateInterp, add + comments. + +2007-11-27 Don Porter + + * win/tclWinSock.c: Add mising encoding conversion of the [info + hostname] value from the system encoding to Tcl's internal encoding. + + * doc/chan.n: "Fix" the limitation on channel -eofchar + * doc/fconfigure.n: values to single byte characters by + * generic/tclIO.c: documenting it and making it fail loudly. + * tests/chan.test: Thanks to Stuart Cassoff for contributing the + fix. [Bug 800753] + +2007-11-26 Miguel Sofer + + * generic/tclBasic.c: + * generic/tclInt.h: + * unix/tclUnixInit.c: + * unix/tclUnixThrd.c: Fix stack checking via workaround for bug in + glibc's pthread_attr_get_np, patch from [Bug 1815573]. Many thanks to + Sergei Golovan (aka Teo) for detecting the bug and helping diagnose + and develop the fix. + +2007-11-24 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileDictAppendCmd): Fix bug in [dict + append] compiler which caused strange stack corruption. [Bug 1837392] + +2007-11-23 Andreas Kupries + + * generic/tclIORChan.c: Fixed a problem with reflected channels. 'chan + postevent' is defined to work only from within the interpreter + containing the handler command. Sensible, we want only handler + commands to use it. It identifies the channel by handle. The channel + moves to a different interpreter or thread. The interpreter containing + the handler command doesn't know the channel any longer. 'chan + postevent' fails, not finding the channel any longer. Uhm. + + Fixed by creating a second per-interpreter channel table, just for + reflected channels, where each interpreter remembers for which + reflected channels it has the handler command. This info does not move + with the channel itself. The table is updated by 'chan create', and + used by 'chan postevent'. + + * tests/ioCmd.test: Updated the testsuite. + +2007-11-23 Jeff Hobbs + + * generic/tclVar.c (Tcl_ArrayObjCmd): handle the right data for + * tests/var.test (var-14.2): [array names $var -glob $ptn] + +2007-11-23 Donal K. Fellows + + * generic/tclCmdMZ.c (String*Cmd, TclInitStringCmd): Rebuilt [string] + * generic/tclCompCmds.c (TclCompileString*Cmd): as an ensemble. + +2007-11-22 Donal K. Fellows + + * generic/tclDictObj.c (Dict*Cmd,TclInitDictCmd): Rebuilt the [dict] + * generic/tclCompCmds.c (TclCompileDict*Cmd): command as an ensemble. + +2007-11-22 Donal K. Fellows + + * generic/tclCmdMZ.c (Tcl_StringObjCmd): Rewrote the [string] and + * generic/tclDictObj.c (Tcl_DictObjCmd): [dict] implementations to be + ready for conversion to ensembles. + + * tests/string.test (string-12.22): Flag shimmering bug found in + [string range]. + +2007-11-21 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileEnsemble): Rewrote the ensemble + compiler to remove many of the limitations. Can now compile scripts + that use unique prefixes of subcommands, and which have mappings of a + command to multiple words (provided the first is a compilable command + of course). + +2007-11-21 Donal K. Fellows + + * generic/tclNamesp.c (TclMakeEnsemble): Factor out the code to set up + a core ensemble from a table of information about subcommands, ready + for reuse within the core. + + * generic/various: Start to return more useful Error codes, currently + mainly on assorted lookup failures. + +2007-11-20 Donal K. Fellows + + * generic/tclDictObj.c: Changed the underlying implementation of the + hash table used in dictionaries to additionally keep all entries in + the hash table in a linked list, which is only ever added to at the + end. This makes iteration over all entries in the dictionary in + key insertion order a trivial operation, and so cleans up a great deal + of complexity relating to dictionary representation and stability of + iteration order. + + ***POTENTIAL INCOMPATIBILITY*** + For any code that depended on the (strange) old iteration order. + + * generic/tclConfig.c (QueryConfigObjCmd): Correct usage of + Tcl_WrongNumArgs. + +2007-11-19 Don Porter + + *** 8.5b3 TAGGED FOR RELEASE *** + + * README: Bump version number to 8.5b3. + * generic/tcl.h: + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf (2.59) + * win/configure: + + * changes: Updated for 8.5b3 release. + +2007-11-19 Kevin Kenny + + * library/tzdata/Africa/Cairo: + * library/tzdata/America/Campo_Grande: + * library/tzdata/America/Caracas: + * library/tzdata/America/Cuiaba: + * library/tzdata/America/Havana: + * library/tzdata/America/Sao_Paulo: + * library/tzdata/Asia/Damascus: + * library/tzdata/Asia/Gaza: + * library/tzdata/Asia/Tehran: Olson's tzdata2007i imported. + +2007-11-18 Daniel Steffen + + * generic/tclExecute.c (TclExecuteByteCode:INST_EXIST_*): Fix read + traces not firing on non-existent array elements. [Bug 1833522] + +2007-11-16 Donal K. Fellows + + * generic/tclCmdIL.c (TclInitInfoCmd): Rename the implementation + commands for [info] to be something more "expected". + + * generic/tclCompCmds.c (TclCompileInfoExistsCmd): Compiler for the + [info exists] subcommand. + (TclCompileEnsemble): Cleaned up version of ensemble compiler that was + in TclCompileInfoCmd, but which is now much more generally applicable. + + * generic/tclInt.h (ENSEMBLE_COMPILE): Added flag to allow for cleaner + turning on and off of ensemble bytecode compilation. + + * generic/tclCompile.c (TclCompileScript): Add the cmdPtr to the list + of arguments passed to command compilers. + +2007-11-15 Don Porter + + * generic/regc_nfa.c: Fixed infinite loop in the regexp compiler. + [Bug 1810038] + + * generic/regc_nfa.c: Corrected looping logic in fixempties() to + avoid wasting time walking a list of dead states. [Bug 1832612] + +2007-11-15 Donal K. Fellows + + * generic/tclNamesp.c (NamespaceEnsembleCmd): Must pass a non-NULL + interp to Tcl_SetEnsemble* functions. + + * doc/re_syntax.n: Try to make this easier to read. It's still a very + difficult manual page! + + * unix/tcl.m4 (SC_CONFIG_CFLAGS): Allow people to turn off the -rpath + option to their linker if they so desire. This is a configuration only + recommended for (some) vendors. Relates to [Patch 1231022]. + +2007-11-15 Pat Thoyts + + * win/tclWin32Dll.c: Prefer UINT_PTR to DWORD_PTR when casting + pointers to integer types for greater portability. [Bug 1831253] + +2007-11-15 Daniel Steffen + + * macosx/Tcl.xcodeproj/project.pbxproj: add new chanio.test. + * macosx/Tcl.xcode/project.pbxproj: + +2007-11-14 Donal K. Fellows + + * generic/tclCompile.c (TclCompileScript): Ensure that we get our + count in our INST_START_CMD calls right, even when there's a failure + to compile a command directly. + + * generic/tclNamesp.c (Tcl_SetEnsembleSubcommandList) + (Tcl_SetEnsembleMappingDict): Special code to make sure that + * generic/tclCmdIL.c (TclInitInfoCmd): [info exists] is compiled + right while not allowing changes to the ensemble to cause havok. + + * generic/tclCompCmds.c (TclCompileInfoCmd): Simple compiler for the + [info] command that only handles [info exists]. + + * generic/tclExecute.c (TclExecuteByteCode:INST_EXIST_*): New + instructions to allow the testing of whether a variable exists. + +2007-11-14 Andreas Kupries + + * tests/chanio.test: New file. This is essentially a duplicate of + 'io.test', with all channel commands converted to their 'chan xxx' + notation. + * tests/io.test: Fixed typo in test description. + +2007-11-14 Donal K. Fellows + + * generic/regc*.c: Eliminate multi-char collating element code + completely. Simplifies the code quite a bit. If people still want the + full code, it will remain on the 8.4 branch. [Bug 1831425] + +2007-11-13 Jeff Hobbs + + * generic/tclCompCmds.c (TclCompileRegexpCmd): clean up comments, only + free dstring on OK from TclReToGlob. + (TclCompileSwitchCmd): simplify TclReToGlob usage. + +2007-11-14 Donal K. Fellows + + * generic/regc*.c: #ifdef/comment out the code that deals with + multi-character collating elements, which have never been supported. + Cuts the memory consumption of the RE compiler. [Bug 1831425] + +2007-11-13 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileSwitchCmd, TclCompileRegexpCmd): + Extend [switch] compiler to handle regular expressions as long as + things are not too complex. Fix [regexp] compiler so that non-trivial + literal regexps get fed to INST_REGEXP. + + * doc/mathop.n: Clarify definitions of some operations. + +2007-11-13 Miguel Sofer + + * unix/tclUnixInit.c: the TCL_NO_STACK_CHECK was being incorrectly + undefined here; this should be set (or not) in the compile options, it + is used elsewhere and needs to be consistent. + +2007-11-13 Pat Thoyts + + * unix/tcl.m4: Added autoconf goo to detect and make use of + * unix/configure.in: getaddrinfo and friends. + * unix/configure: (regenerated) + +2007-11-13 Donal K. Fellows + + * unix/tclUnixCompat.c (TclpGetHostByName): The six-argument form of + getaddressbyname_r() uses the fifth argument to indicate whether the + lookup succeeded or not on at least one platform. [Bug 1618235] + +2007-11-13 Don Porter + + * generic/regcomp.c: Convert optst() from expensive no-op to a + cheap no-op. + +2007-11-13 Donal K. Fellows + + * unix/tclUnixChan.c (CreateSocketAddress): Rewrote to use the + thread-safe version of gethostbyname() by forward-porting the code + used in 8.4, and added rudimentary support for getaddrinfo() (not + enabled by default, as no autoconf-ery written). Part of fix for [Bug + 1618235]. + +2007-11-12 Jeff Hobbs + + * generic/tclGet.c (Tcl_Get, Tcl_GetInt): revert use of TclGet* macros + due to compiler warning. These cases won't save time either. + + * generic/tclUtil.c (TclReToGlob): add more comments, set interp + result if specified on error. + +2007-11-12 Miguel Sofer + + * generic/tclBasic.c: New macro TclResetResult, new iPtr + * generic/tclExecute.c: flag bit INTERP_RESULT_UNCLEAN: + * generic/tclInt.h: shortcut for Tcl_ResetResult for the + * generic/tclProc.c: "normal" case: TCL_OK, no return + * generic/tclResult.c: options, no errorCode nor errorInfo, + * generic/tclStubLib.c: return at normal level. [Patch + * generic/tclUtil.c: 1830184] + + THIS PATCH WAS REVERTED: initial (mis)measurements overstated the + perfomance wins, which turn out to be tiny. Not worth the + complication. + +2007-11-11 Jeff Hobbs + + * generic/tclCompCmds.c, generic/tclCompile.c, generic/tclCompile.h: + * generic/tclExecute.c, generic/tclInt.decls, generic/tclIntDecls.h: + * generic/tclRegexp.c, generic/tclRegexp.h: Add INST_REGEXP and fully + * generic/tclStubInit.c, generic/tclUtil.c: compiled [regexp] for the + * tests/regexpComp.test: [Bug 1830166] simple cases. Also added + TclReToGlob function to convert RE to glob patterns and use these in + the possible cases. + +2007-11-11 Miguel Sofer + + * generic/tclResult.c (ResetObjResult): clarify the logic. + + * generic/tclBasic.c: Increased usage of macros to detect + * generic/tclBinary.c: and take advantage of objTypes. Added + * generic/tclClock.c: macros TclGet(Int|Long)FromObj, + * generic/tclCmdAH.c: TclGetIntForIndexM & TclListObjLength, + * generic/tclCmdIL.c: modified TclListObjGetElements. + * generic/tclCmdMZ.c: + * generic/tclCompCmds.c: The TclGetInt* macros are only a + * generic/tclCompExpr.c: shortcut on platforms where 'long' is + * generic/tclCompile.c: 'int'; it may be worthwhile to extend + * generic/tclDictObj.c: their functionality to other cases. + * generic/tclExecute.c: + * generic/tclGet.c: As this patch touches many files it + * generic/tclIO.c: has been recorded as [Patch 1830038] + * generic/tclIOCmd.c: in order to facilitate reviewing. + * generic/tclIOGT.c: + * generic/tclIndexObj.c: + * generic/tclInt.h: + * generic/tclInterp.c: + * generic/tclListObj.c: + * generic/tclLiteral.c: + * generic/tclNamesp.c: + * generic/tclObj.c: + * generic/tclParse.c: + * generic/tclProc.c: + * generic/tclRegexp.c: + * generic/tclResult.c: + * generic/tclScan.c: + * generic/tclStringObj.c: + * generic/tclUtil.c: + * generic/tclVar.c: + +2007-11-11 Daniel Steffen + + * unix/tclUnixTime.c (TclpWideClicksToNanoseconds): Fix issues with + * generic/tclInt.h: int64_t overflow. + + * generic/tclBasic.c: Fix stack check failure case if stack grows up + * unix/tclUnixInit.c: Simplify non-crosscompiled case. + + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2007-11-10 Miguel Sofer + + * generic/tclExecute.c: Fast path for INST_LIST_INDEX when the index + is not a list. + + * generic/tclBasic.c: + * unix/configure.in: + * unix/tclUnixInit.c: Detect stack grwoth direction at compile time, + only fall to runtime detection when crosscompiling. + + * unix/configure: autoconf 2.61 + + * generic/tclBasic.c: + * generic/tclInt.h: + * tests/interp.test: + * unix/tclUnixInit.c: + * win/tclWin32Dll.c: Restore simpler behaviour for stack checking, not + adaptive to stack size changes after a thread is launched. Consensus + is that "nobody does that", and so it is not worth the cost. Improved + failure comments (mistachkin). + +2007-11-10 Kevin Kenny + + * win/tclWin32Dll.c: Rewrote the Windows stack checking algorithm to + use information from VirtualQuery to determine the bound of the stack. + This change fixes a bug where the guard page of the stack was never + restored after an overflow. It also eliminates a nasty piece of + assembly code for structured exception handling on mingw. It + introduces an assumption that the stack is a single memory arena + returned from VirtualAlloc, but the code in MSVCRT makes the same + assumption, so it should be fairly safe. + +2007-11-10 Miguel Sofer + + * generic/tclBasic.c: + * generic/tclInt.h: + * unix/tclUnixInit.c: + * unix/tclUnixPort.h: + * win/tclWin32Dll.c: Modify the stack checking algorithm to recheck in + case of failure. The working assumptions are now that (a) a thread's + stack is never moved, and (b) a thread's stack can grow but not + shrink. Port to windows - could be more efficient, but is already + cheaper than it was. + +2007-11-09 Miguel Sofer + + * generic/tclResult.c (ResetObjResult): new shortcut. + + * generic/tclAsync.c: + * generic/tclBasic.c: + * generic/tclExecute.c: + * generic/tclInt.h: + * generic/tclUnixInit.c: + * generic/tclUnixPort.h: New fields in interp (ekeko!) to cache TSD + data that is accessed at each command invocation, access macros to + replace Tcl_AsyncReady and TclpCheckStackSpace by much faster variants + [Patch 1829248] + +2007-11-09 Jeff Hobbs + + * generic/tclInt.decls, generic/tclIntDecls.h: Use unsigned char for + * generic/tclExecute.c, generic/tclUtil.c: TclByteArrayMatch and + don't allow a nocase option. [Bug 1828296] + For INST_STR_MATCH, ignore pattern type for TclByteArrayMatch case. + + * generic/tclBinary.c (Tcl_GetByteArrayFromObj): check type before + func jump (perf). + +2007-11-07 Jeff Hobbs + + * generic/tclStubInit.c: Added TclByteArrayMatch + * generic/tclInt.decls: for efficient glob + * generic/tclIntDecls.h: matching of ByteArray + * generic/tclUtil.c (TclByteArrayMatch): Tcl_Objs, used in + * generic/tclExecute.c (TclExecuteByteCode): INST_STR_MATCH. [Bug + 1827996] + + * generic/tclIO.c (TclGetsObjBinary): Add an efficient binary path for + [gets]. + (DoWriteChars): Special case for 1-byte channel write. + +2007-11-06 Miguel Sofer + + * generic/tclEncoding.c: Version of the embedded iso8859-1 encoding + handler that is faster (functions to do the encoding know exactly what + they're doing instead of pulling it from a table, though the table + itself has to be retained for use by shift encodings that depend on + iso8859-1). [Patch 1826906], committing for dkf. + +2007-11-05 Andreas Kupries + + * generic/tclConfig.c (Tcl_RegisterConfig): Modified to not extend the + config database if the encoding provided by the user is not found + (venc == NULL). Scripts expecting the data will error out, however we + neither crash nor provide bogus information. See [Bug 983509] for more + discussion. + + * unix/tclUnixChan.c (TtyGetOptionProc): Accepted [Patch 1823576] + provided by Stuart Cassof . The patch adds + the necessary utf/external conversions to the handling of the + arguments of option -xchar which will allow the use of \0 and similar + characters. + +2007-11-03 Miguel Sofer + + * generic/tclTest.c (TestSetCmd2): + * generic/tclVar.c (TclObjLookupVarEx): + * tests/set.test (set-5.1): Fix error branch when array name looks + like array element (code not normally exercised). + +2007-11-01 Donal K. Fellows + + * tools/tcltk-man2html.tcl (output-directive): Convert .DS/.DE pairs + into tables since that is now all that they are used for. + + * doc/RegExp.3: Clarified documentation of RE flags. [Bug 1167840] + + * doc/refchan.n: Adjust internal name to be consistent with the file + name for reduced user confusion. After comment by Dan Steffen. + + * generic/tclCmdMZ.c (Tcl_StringObjCmd, UniCharIsAscii): Remember, the + NUL character is in ASCII too. [Bug 1808258] + + * doc/file.n: Clarified use of [file normalize]. [Bug 1185154] + +2007-10-30 Don Porter + + * generic/tcl.h: Bump version number to 8.5b2.1 to distinguish + * library/init.tcl: CVS development snapshots from the 8.5b2 + * unix/configure.in: release. + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf (2.59) + * win/configure: + +2007-10-30 Donal K. Fellows + + * doc/expr.n, doc/mathfunc.n: Improve documentation to try to make + clearer what is going on. + + * doc/interp.n: Shorten the basic descriptive text for some interp + subcommands so Solaris nroff doesn't truncate them. [Bug 1822268] + +2007-10-30 Donal K. Fellows + + * tools/tcltk-man2html.tcl (output-widget-options): Enhance the HTML + generator so that it can produce multi-line option descriptions. + +2007-10-28 Miguel Sofer + + * generic/tclUtil.c (Tcl_ConcatObj): optimise for some of the + concatenees being empty objs. [Bug 1447328] + +2007-10-28 Donal K. Fellows + + * generic/tclEncoding.c (TclInitEncodingSubsystem): Hard code the + iso8859-1 encoding, as it's needed for more than just text (especially + binary encodings...) Note that other encodings rely on the encoding + being a table encoding (!) so we can't use more efficient encoding + mapping functions. + +2007-10-27 Donal K. Fellows + + * generic/regc_lex.c (lexescape): Close off one of the problems + mentioned in [Bug 1810264]. + +2007-10-27 Miguel Sofer + + * generic/tclNamesp.c (Tcl_FindCommand): insure that FQ command names + are searched from the global namespace, ie, bypassing resolvers of the + current namespace. [Bug 1114355] + + * doc/apply.n: fixed example [Bug 1811791] + * doc/namespace.n: improved example [Bug 1788984] + * doc/AddErrInfo.3: typo [Bug 1715087] + * doc/CrtMathFnc.3: fixed Tcl_ListMathFuncs entry [Bug 1672219] + + * generic/tclCompile.h: + * generic/tclInt.h: moved declaration of TclSetCmdNameObj from + tclCompile.h to tclInt.h, reverting linker [Bug 1821159] caused by + commit of 2007-10-11 (both I and gcc missed one dep). + + * generic/tclVar.c: try to preserve Tcl_Objs when doing variable + lookups by name, partially addressing [Bug 1793601]. + +2007-10-27 Donal K. Fellows + + * tools/tcltk-man2html.tcl (make-man-pages, htmlize-text) + (process-text): Make the man->HTML scraper work better. + +2007-10-26 Don Porter + + *** 8.5b2 TAGGED FOR RELEASE *** + + * changes: Updated for 8.5b2 release. + + * doc/*.1: Revert doc changes that broke + * doc/*.3: `make html` so we can get the release + * doc/*.n: out the door. + + * README: Bump version number to 8.5b2. + * generic/tcl.h: + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf (2.59) + * win/configure: + +2007-10-26 Donal K. Fellows + + * tools/man2help2.tcl, tools/man2tcl.c: Made some of the tooling code + to do man->other formats work better with current manpage set. Long + way still to go. + +2007-10-25 Zoran Vasiljevic + + * generic/tclThread.c: Added TclpMasterLock/Unlock arround calls to + ForgetSyncObject in Tcl_MutexFinalize and Tcl_ConditionFinalize to + prevent from garbling the internal lists that track sync objects. [Bug + 1726873] + +2007-10-24 Donal K. Fellows + + * tools/man2html2.tcl (macro): Added support for converting the new + macros into HTML. + + * doc/man.macros (QW,PQ,QR,MT): New macros that hide the ugly mess + needed to get proper GOOBE quoting in the manual pages. + * doc/*.n, doc/*.3, doc/*.1: Lots of changes to take advantage of the + new macros. + +2007-10-20 Miguel Sofer + + * generic/tclCompile.c: Fix comments. + * generic/tclExecute.c: + +2007-10-18 David Gravereaux + + * tools/mkdepend.tcl: sort the dep list for a more humanly readable + output. + +2007-10-18 Don Porter + + * generic/tclResult.c (TclMergeReturnOptions): Make sure any -code + values get pulled out of the dictionary, even if they are integer + valued. + + * generic/tclCompCmds.c (TclCompileReturnCmd): Added code to more + optimally compile [return -level 0 $x] to "push $x". [RFE 1794073] + + * compat/tmpnam.c (removed): The routine tmpnam() is no longer + * unix/Makefile.in: called by Tcl source code. Remove autogoo the + * unix/configure.in: supplied a replacement version on systems + * win/tcl.dsp: where the routine was not available. [RFE + 1811848] + + * unix/configure: autoconf-2.59 + + * generic/tcl.h: Remove TCL_LL_MODIFIER_SIZE. [RFE 1811837] + +2007-10-17 David Gravereaux + + * tools/mkdepend.tcl: Improved defense from malformed object list + infile. + +2007-10-17 Donal K. Fellows + + * tools/man2html2.tcl: Convert .DS/.DE into HTML tables, not + preformatted text. + +2007-10-17 Kevin B. Kenny + + * generic/tclCompExpr.c: Moved a misplaced declaration that blocked + compilation on VC++. + * generic/tclExecute.c: Silenced several VC++ compiler warnings about + converting 'long' to 'unsigned short'. + +2007-10-16 David Gravereaux + + * win/makefile.vc: removed old dependency cruft that is no longer + needed. + +2007-10-15 Don Porter + + * generic/tclIOCmd.c: Revise [open] so that it interprets leading + zero strings passed as the "permissions" argument as octal numbers, + even if Tcl itself no longer parses integers in that way. + + * unix/tclUnixFCmd.c: Revise the "-permissions" [file attribute] so + that it interprets leading zero strings as octal numbers, even if Tcl + itself no longer parses integers in that way. + + * generic/tclCompExpr.c: Corrections to code that produces + * generic/tclUtil.c: extended "bad octal" error messages. + + * tests/cmdAH.test: Test revisions so that tests pass whether or + * tests/cmdIL.test: not Tcl parses leading zero strings as octal. + * tests/compExpr-old.test: + * tests/compExpr.test: + * tests/compile.test: + * tests/expr-old.test: + * tests/expr.test: + * tests/incr.test: + * tests/io.test: + * tests/lindex.test: + * tests/link.test: + * tests/mathop.test: + * tests/parseExpr.test: + * tests/set.test: + * tests/string.test: + * tests/stringComp.test: + +2007-10-15 David Gravereaux + + * tools/mkdepend.tcl: Produces usable output. Include path problem + * win/makefile.vc: fixed. Never fight city hall when it comes to + levels of quoting issues. + +2007-10-15 Miguel Sofer + + * generic/tclParse.c (Tcl_ParseBraces): fix for possible read after + the end of buffer. [Bug 1813528] (Joe Mistachkin) + +2007-10-14 David Gravereaux + + * tools/mkdepend.tcl (new): Initial stab at generating automatic + * win/makefile.vc: dependencies. + +2007-10-12 Pat Thoyts + + * win/makefile.vc: Mine all version information from headers. + * win/rules.vc: Sync tcl and tk and bring extension versions + * win/nmakehlp.c: closer together. Try and avoid using tclsh to do + substitutions as we may cross compile. + * win/coffbase.txt: Added offsets for snack dlls. + +2007-10-11 David Gravereaux + + * win/makefile.vc: Fixed my bad spelling mistakes from years back. + Dedependency, duh! Rather funny. + +2007-10-11 Don Porter + + * generic/tclCmdMZ.c: Correct [string is (wide)integer] failure + * tests/string.test: to report correct failindex values for + non-decimal integer strings. [Bug 1805887] + + * compat/strtoll.c (removed): The routines strtoll() and strtoull() + * compat/strtoull.c (removed): are no longer called by the Tcl source + * generic/tcl.h: code. (Their functionality has been replaced + * unix/Makefile.in: by TclParseNumber().) Remove outdated comments + * unix/configure.in: and mountains of configury autogoo that + * unix/tclUnixPort.h: allegedly support the mythical systems where + * win/Makefile.in: these routines might not have been available. + * win/makefile.bc: + * win/makefile.vc: + * win/tclWinPort.h: + + * unix/configure: autoconf-2.59 + +2007-10-11 Miguel Sofer + + * generic/tclObj.c: remove superfluous #include of tclCompile.h + +2007-10-08 George Peter Staplin + + * doc/Hash.3: Correct the valid usage of the flags member for the + Tcl_HashKeyType. It should be 0 or more of the flags mentioned. + +2007-10-02 Jeff Hobbs + + * generic/tcl.h (Tcl_DecrRefCount): Update change from 2006-05-29 to + make macro more warning-robust in unbraced if code. + +2007-10-02 Don Porter + + [core-stabilizer-branch] + + * README: Bump version number to 8.5.0 + * generic/tcl.h: + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf (2.59) + * win/configure: + +2007-10-02 Andreas Kupries + + * library/tclIndex: Added 'tcl::tm::path' to the tclIndex. This fixes + [Bug 1806422] reported by Don Porter. + +2007-09-25 Donal K. Fellows + + * generic/tclProc.c (Tcl_DisassembleObjCmd): Define a command, + ::tcl::unsupported::disassemble, which can disassemble procedures, + lambdas and general scripts. + * generic/tclCompile.c (TclDisassembleByteCodeObj): Split apart the + code to print disassemblies of bytecode so that there is reusable code + that spits it out in a Tcl_Obj and then that code is used when doing + tracing. + +2007-09-20 Don Porter + + *** 8.5b1 TAGGED FOR RELEASE *** + + * changes: updates for 8.5b1 release. + +2007-09-19 Don Porter + + * README: Bump version number to 8.5b1 + * generic/tcl.h: Merge from core-stabilizer-branch. + * library/init.tcl: Stabilizing toward 8.5b1 release now done on + * tools/tcl.wse.in: the HEAD. core-stabilizer-branch is now + * unix/configure.in: suspended. + * unix/tcl.spec: + * win/configure.in: + +2007-09-19 Pat Thoyts + + * generic/tclStubLib.: Replaced isdigit with internal implementation. + +2007-09-18 Don Porter + + * generic/tclStubLib.c: Remove C library calls from Tcl_InitStubs() so + * win/makefile.vc: that we don't need the C library linked in to + libtclStub. + +2007-09-17 Pat Thoyts + + * win/makefile.vc: Add crt flags for tclStubLib now it uses C-library + functions. + +2007-09-17 Joe English + + * tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to build + shared libraries on current NetBSDs. [Bug 1749251] + * unix/configure: regenerated (autoconf-2.59). + +2007-09-17 Don Porter + + * unix/Makefile.in: Update `make dist` so that tclDTrace.d is + included in the source code distribution. + + * generic/tcl.h: Revised Tcl_InitStubs() to restore Tcl 8.4 + * generic/tclPkg.c: source compatibility with callers of + * generic/tclStubLib.c: Tcl_InitStubs(interp, TCL_VERSION, 1). [Bug + 1578344] + +2007-09-17 Donal K. Fellows + + * generic/tclTrace.c (Tcl_TraceObjCmd, TraceExecutionObjCmd) + (TraceCommandObjCmd, TraceVariableObjCmd): Generate literal values + * generic/tclNamesp.c (NamespaceCodeCmd): more efficiently using + * generic/tclFCmd.c (CopyRenameOneFile): TclNewLiteralStringObj + * generic/tclEvent.c (TclSetBgErrorHandler): macro. + +2007-09-15 Daniel Steffen + + * unix/tcl.m4: replace all direct references to compiler by ${CC} to + enable CC overriding at configure & make time; run + check for visibility "hidden" with all compilers; + quoting fixes from TEA tcl.m4. + (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld' in SHLIB_LD by + 'cc' compiler driver. + * unix/configure: autoconf-2.59 + +2007-09-14 Donal K. Fellows + + * generic/tclBasic.c (Tcl_CreateObjCommand): Only invalidate along the + namespace path once; that is enough. [Bug 1519940] + +2007-09-14 Daniel Steffen + + * generic/tclDTrace.d (new file): Add DTrace provider for Tcl; allows + * generic/tclCompile.h: tracing of proc and command entry & + * generic/tclBasic.c: return, bytecode execution, object + * generic/tclExecute.c: allocation and more; with + * generic/tclInt.h: essentially zero cost when tracing + * generic/tclObj.c: is inactive; enable with + * generic/tclProc.c: --enable-dtrace configure arg + * unix/Makefile.in: (disabled by default, will only + * unix/configure.in: enable if DTrace is present). [Patch + 1793984] + + * macosx/GNUmakefile: Enable DTrace support. + * macosx/Tcl-Common.xcconfig: + * macosx/Tcl.xcodeproj/project.pbxproj: + + * generic/tclCmdIL.c: Factor out core of InfoFrameCmd() into + internal TclInfoFrame() for use by DTrace + probes. + + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2007-09-12 Don Porter + + * unix/Makefile.in: Perform missing updates of the tcltest Tcl + * win/Makefile.in: Module installed filename that should have + been part of the bump to tcltest 2.3b1. Thanks Larry Virden. + +2007-09-12 Pat Thoyts + + * win/makefile.vc, win/rules.vc, win/nmakehlp.c: Use nmakehlp to + substitute values for tclConfig.sh (helps cross-compiling). + +2007-09-11 Don Porter + + * library/tcltest/tcltest.tcl: Accept underscores and colons in + * library/tcltest/pkgIndex.tcl: constraint names. Properly handle + constraint expressions that return non-numeric boolean results like + "false". Bump to tcltest 2.3b1. [Bug 1772989; RFE 1071322] + * tests/info.test: Disable fragile tests. + + * doc/package.n: Restored the functioning of [package require + * generic/tclPkg.c: -exact] to be compatible with Tcl 8.4. [Bug + * tests/pkg.test: 1578344] + +2007-09-11 Miguel Sofer + + * generic/tclCompCmds.c (TclCompileDictCmd-update): + * generic/tclCompile.c (tclInstructionTable): + * generic/tclExecute.c (INST_DICT_UPDATE_END): fix stack management in + compiled [dict update]. [Bug 1786481] + + ***POTENTIAL INCOMPATIBILITY*** + Scripts that were precompiled on earlier versions of 8.5 and use [dict + update] will crash. Workaround: recompile. + +2007-09-11 Kevin B. Kenny + + * generic/tclExecute.c: Corrected an off-by-one error in the setting + of MaxBaseWide for certain powers. [Bug 1767293 - problem reported in + comments when bug was reopened] + +2007-09-10 Jeff Hobbs + + * generic/tclLink.c (Tcl_UpdateLinkedVar): guard against var being + unlinked. [Bug 1740631] (maros) + +2007-09-10 Miguel Sofer + + * generic/tclCompile.c: fix tclInstructionTable entry for + dictUpdateEnd + + * generic/tclExecute.c: remove unneeded setting of 'cleanup' variable + before jumping to checkForCatch. + +2007-09-10 Don Porter + + * doc/package.n: Restored the document parallel syntax of the + * generic/tclPkg.c: [package present] and [package require] + * tests/pkg.test: commands. [Bug 1723675] + +2007-09-09 Don Porter + + * generic/tclInt.h: Removed the "nsName" Tcl_ObjType from the + * generic/tclNamesp.c: registered set. Revised the management of the + * generic/tclObj.c: intrep of that Tcl_ObjType. Revised the + * tests/obj.test: TclGetNamespaceFromObj() routine to return + TCL_ERROR and write a consistent error message when a namespace is not + found. [Bug 1588842. Patch 1686862] + + ***POTENTIAL INCOMPATIBILITY*** + For callers of Tcl_GetObjType() on the name "nsName". + + * generic/tclExecute.c: Update TclGetNamespaceFromObj() callers. + * generic/tclProc.c: + + * tests/apply.test: Updated tests to expect new consistent + * tests/namespace-old.test: error message when a namespace is not + * tests/namespace.test: found. + * tests/upvar.test: + + * generic/tclCompCmds.c: Use the new INST_REVERSE instruction + * tests/mathop.test: to correct the compiled versions of math + operator commands. [Bug 1724437] + + * generic/tclCompile.c: New bytecode instruction INST_REVERSE to + * generic/tclCompile.h: reverse the order of N items at the top of + * generic/tclExecute.c: stack. + + * generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate + routine to compile ** to account for its different associativity. + +2007-09-08 Miguel Sofer + + * generic/tclVar.c (Tcl_SetVar2, TclPtrSetVar): [Bug 1710710] fixed + correctly, reverted fix of 2007-05-01. + +2007-09-08 Donal K. Fellows + + * generic/tclDictObj.c (DictUpdateCmd, DictWithCmd): Plug a hole that + * generic/tclExecute.c (TEBC,INST_DICT_UPDATE_END): allowed a careful + * tests/dict.test (dict-21.16,21.17,22.11): attacker to craft a dict + containing a recursive link to itself, violating one of Tcl's + fundamental datatype assumptions and causing a stack crash when the + dict was converted to a string. [Bug 1786481] + +2007-09-07 Don Porter + + * generic/tclEvent.c ([::tcl::Bgerror]): Corrections to Tcl's + * tests/event.test: default [interp bgerror] handler so that when + it falls back to a hidden [bgerror] in a safe interp, it gets the + right error context data. [Bug 1790274] + +2007-09-07 Miguel Sofer + + * generic/tclProc.c (TclInitCompiledLocals): the refCount of resolved + variables was being managed without checking if they were Var or + VarInHash: itcl [Bug 1790184] + +2007-09-06 Don Porter + + * generic/tclResult.c (Tcl_GetReturnOptions): Take care that a + * tests/init.test: non-TCL_ERROR code doesn't cause existing + -errorinfo, -errorcode, and -errorline entries to be omitted. + * generic/tclEvent.c: With -errorInfo no longer lost, generate more + complete ::errorInfo when calling [bgerror] after a non-TCL_ERROR + background exception. + +2007-09-06 Don Porter + + * generic/tclInterp.c (Tcl_Init): Removed constraint on ability + to define a custom [tclInit] before calling Tcl_Init(). Until now the + custom command had to be a proc. Now it can be any command. + + * generic/tclInt.decls: New internal routine TclBackgroundException() + * generic/tclEvent.c: that for the first time permits non-TCL_ERROR + exceptions to trigger [interp bgerror] handling. Closes a gap in TIP + 221. When falling back to [bgerror] (which is designed only to handle + TCL_ERROR), convert exceptions into errors complaining about the + exception. + + * generic/tclInterp.c: Convert Tcl_BackgroundError() callers to call + * generic/tclIO.c: TclBackgroundException(). + * generic/tclIOCmd.c: + * generic/tclTimer.c: + + * generic/tclIntDecls.h: make genstubs + * generic/tclStubInit.c: + +2007-09-06 Daniel Steffen + + * macosx/Tcl.xcode/project.pbxproj: discontinue unmaintained support + * macosx/Tcl.xcode/default.pbxuser: for Xcode 1.5; replace by Xcode2 + project for use on Tiger (with Tcl.xcodeproj to be used on Leopard). + + * macosx/Tcl.xcodeproj/project.pbxproj: updates for Xcode 2.5 and 3.0. + * macosx/Tcl.xcodeproj/default.pbxuser: + * macosx/Tcl.xcode/project.pbxproj: + * macosx/Tcl.xcode/default.pbxuser: + * macosx/Tcl-Common.xcconfig: + + * macosx/README: document project changes. + +2007-09-05 Don Porter + + * generic/tclBasic.c: Removed support for the unmaintained + * generic/tclExecute.c: -DTCL_GENERIC_ONLY configuration. [Bug + * unix/Makefile.in: 1264623] + +2007-09-04 Don Porter + + * unix/Makefile.in: It's unreliable to count on the release + manager to remember to `make genstubs` before `make dist`. Let the + Makefile remember the dependency for us. + + * unix/Makefile.in: Corrections to `make dist` dependencies to be + sure that macosx/configure gets generated whenever it does not exist. + +2007-09-03 Kevin B, Kenny + + * library/tzdata/Africa/Cairo: + * library/tzdata/America/Grand_Turk: + * library/tzdata/America/Port-au-Prince: + * library/tzdata/America/Indiana/Petersburg: + * library/tzdata/America/Indiana/Tell_City: + * library/tzdata/America/Indiana/Vincennes: + * library/tzdata/Antarctica/McMurdo: + * library/tzdata/Australia/Adelaide: + * library/tzdata/Australia/Broken_Hill: + * library/tzdata/Australia/Currie: + * library/tzdata/Australia/Hobart: + * library/tzdata/Australia/Lord_Howe: + * library/tzdata/Australia/Melbourne: + * library/tzdata/Australia/Sydney: + * library/tzdata/Pacific/Auckland: + * library/tzdata/Pacific/Chatham: Olson's tzdata2007g. + + * generic/tclListObj.c (TclLindexFlat): + * tests/lindex.test (lindex-17.[01]): Added code to detect the error + when a script does [lindex {} end foo]; an overaggressive optimisation + caused this call to return an empty object rather than an error. + +2007-09-03 Daniel Steffen + + * generic/tclObj.c (TclInitObjSubsystem): restore registration of the + "wideInt" Tcl_ObjType for compatibility with 8.4 extensions that + access the tclWideIntType Tcl_ObjType; add setFromAnyProc for + tclWideIntType. + +2007-09-02 Donal K. Fellows + + * doc/lsearch.n: Added note that order of results with the -all option + is that of the input list. It always was, but this makes it crystal. + +2007-08-30 Don Porter + + * generic/tclCompile.c: Added fflush() calls following all callers of + * generic/tclExecute.c: TclPrintByteCodeObj() so that tcl_traceCompile + output is less likely to get mangled when writes to stdout interleave + with other code. + +2007-08-28 Don Porter + + * generic/tclCompExpr.c: Use a table lookup in ParseLexeme() to + determine lexemes with single-byte representations. + + * generic/tclBasic.c: Used unions to better clarify overloading of + * generic/tclCompExpr.c: the fields of the OpCmdInfo and + * generic/tclCompile.h: TclOpCmdClientData structs. + +2007-08-27 Don Porter + + * generic/tclCompExpr.c: Call TclCompileSyntaxError() when + expression syntax errors are found when compiling expressions. With + this in place, convert TclCompileExpr to return void, since there's no + longer any need to report TCL_ERROR. + * generic/tclCompile.c: Update callers. + * generic/tclExecute.c: + + * generic/tclCompCmds.c: New routine TclCompileSyntaxError() + * generic/tclCompile.h: to directly compile bytecodes that report a + * generic/tclCompile.c: syntax error, rather than (ab)use a call to + TclCompileReturnCmd. Also, undo the most recent commit that papered + over some issues with that (ab)use. New routine produces a new opcode + INST_SYNTAX, which is a minor variation of INST_RETURN_IMM. Also a bit + of constification. + + * generic/tclCompile.c: Move the deallocation of local LiteralTable + * generic/tclCompExpr.c: entries into TclFreeCompileEnv(). + * generic/tclExecute.c: Update callers. + + * generic/tclCompExpr.c: Force numeric and boolean literals in + expressions to register with their intreps intact, even if that means + overwriting existing intreps in already registered literals. + +2007-08-25 Kevin B. Kenny + + * generic/tclExecute.c (TclExecuteByteCode): Added code to handle + * tests/expr.test (expr-23.48-53) integer exponentiation + that results in 32- and 64-bit integer results, avoiding calls to wide + integer exponentiation routines in this common case. [Bug 1767293] + + * library/clock.tcl (ParseClockScanFormat): Modified code to allow + * tests/clock.test (clock-60.*): case-insensitive matching + of time zone and month names. [Bug 1781282] + +2007-08-24 Don Porter + + * generic/tclCompExpr.c: Register literals found in expressions + * tests/compExpr.test: to restore literal sharing. Preserve numeric + intreps when literals are created for the first time. Correct memleak + in ExecConstantExprTree() and add test for the leak. + +2007-08-24 Miguel Sofer + + * generic/tclCompile.c: replaced copy loop that tripped some compilers + with memmove. [Bug 1780870] + +2007-08-23 Don Porter + + * library/init.tcl ([auto_load_index]): Delete stray "]" that created + an expr syntax error (masked by a [catch]). + + * generic/tclCompCmds.c (TclCompileReturnCmd): Added crash protection + to handle callers other than TclCompileScript() failing to meet the + initialization assumptions of the TIP 280 code in CompileWord(). + + * generic/tclCompExpr.c: Suppress the attempt to convert to + numeric when pre-compiling a constant expresion indicates an error. + +2007-08-22 Miguel Sofer + + * generic/tclExecute.c (TEBC): disable the new shortcut to frequent + INSTs for debug builds. REVERTED (collision with alternative fix) + +2007-08-21 Don Porter + + * generic/tclMain.c: Corrected the logic of dropping the last + * tests/main.test: newline from an interactively typed command. + [Bug 1775878] + +2007-08-21 Pat Thoyts + + * tests/thread.test: thread-4.4: clear ::errorInfo in the thread as a + message is left here from init.tcl on windows due to no tcl_pkgPath. + +2007-08-20 Miguel Sofer + + * generic/tclExecute.c (INST_SUB): fix usage of the new macro for + overflow detection in sums, adapt to subtraction. Lengthy comment + added. + +2007-08-19 Donal K. Fellows + + * generic/tclExecute.c (Overflowing, TclIncrObj, TclExecuteByteCode): + Encapsulate Miguel's last change in a more mnemonic macro. + +2007-08-19 Miguel Sofer + + * generic/tclExecute.c: changed the check for overflow in sums, + reducing objsize, number of branches and cache misses (according to + cachegrind). Non-overflow for s=a+b: + previous + ((a >= 0 || b >= 0 || s < 0) && (s >= 0 || b < 0 || a < 0)) + now + (((a^s) >= 0) || ((a^b) < 0)) + This expresses: "a and s have the same sign or else a and b have + different sign". + +2007-08-19 Donal K. Fellows + + * doc/interp.n (RESOURCE LIMITS): Added text to better explain why + time limits are described using absolute times. [Bug 1752148] + +2007-08-16 Miguel Sofer + + * generic/tclVar.c: improved localVarNameType caching to leverage + the new availability of Tcl_Obj in variable names, avoiding string + comparisons to verify that the cached value is usable. + + * generic/tclExecute.c: check the two most frequent instructions + before the switch. Reduces both runtime and obj size a tiny bit. + +2007-08-16 Don Porter + + * generic/tclCompExpr.c: Added a "constant" field to the OpNode + struct (again "free" due to alignment requirements) to mark those + subexpressions that are completely known at compile time. Enhanced + CompileExprTree() and its callers to precompute these constant + subexpressions at compile time. This resolves the issue raised in [Bug + 1564517]. + +2007-08-15 Donal K. Fellows + + * generic/tclIOUtil.c (TclGetOpenModeEx): Only set the O_APPEND flag + * tests/ioUtil.test (ioUtil-4.1): on a channel for the 'a' + mode and not for 'a+'. [Bug 1773127] + +2007-08-14 Miguel Sofer + + * generic/tclExecute.c (INST_INVOKE*): peephole opt, do not get the + interp's result if it will be pushed/popped. + +2007-08-14 Don Porter + + * generic/tclBasic.c: Use fully qualified variable names for + * tests/thread.test: ::errorInfo and ::errorCode so that string + * tests/trace.test: reported to variable traces are fully + qualified in agreement with Tcl 8.4 operations. + +2007-08-14 Daniel Steffen + + * unix/tclLoadDyld.c: use dlfcn API on Mac OS X 10.4 and later; fix + issues with loading from memory on intel and 64bit; add debug messages + + * tests/load.test: add test load-10.1 for loading from vfs. + + * unix/dltest/pkga.c: whitespace & comment cleanup, remove + * unix/dltest/pkgb.c: unused pkgf.c. + * unix/dltest/pkgc.c: + * unix/dltest/pkge.c: + * unix/dltest/pkgf.c (removed): + * unix/dltest/pkgua.c: + * macosx/Tcl.xcodeproj/project.pbxproj: + +2007-08-13 Don Porter + + * generic/tclExecute.c: Provide DECACHE/CACHE protection to the + * tests/trace.test: Tcl_LogCommandInfo() call. [Bug 1773040] + +2007-08-12 Miguel Sofer + + * generic/tclCmdMZ.c (Tcl_SplitObjCmd): use TclNewStringObj macro + instead of calling the function. + + * generic/tcl_Obj.c (TclAllocateFreeObjects): remove unneeded memset + to 0 of all allocated objects. + +2007-08-10 Miguel Sofer + + * generic/tclInt.h: remove redundant ops in TclNewStringObj macro. + +2007-08-10 Miguel Sofer + + * generic/tclInt.h: fix the TclSetVarNamespaceVar macro, was causing a + leak. + +2007-08-10 Don Porter + + * generic/tclCompExpr.c: Revise CompileExprTree() to use the + OpNode mark field scheme of tree traversal. This eliminates the need + to use magic values in the left and right fields for that purpose. + Also stop abusing the left field within ParseExpr() to store the + number of arguments in a parsed function call. CompileExprTree() now + determines that for itself at compile time. Then reorder code to + eliminate duplication. + +2007-08-09 Miguel Sofer + + * generic/tclProc.c (TclCreateProc): better comments on the required + varflag values when loading precompiled procs. + + * generic/tclExecute.c (INST_STORE_ARRAY): + * tests/trace.test (trace-2.6): whole array write traces on compiled + local variables were not firing. [Bug 1770591] + +2007-08-08 Jeff Hobbs + + * generic/tclProc.c (InitLocalCache): reference firstLocalPtr via + procPtr. codePtr->procPtr == NULL exposed by tbcload. + +2007-08-08 Don Porter + + * generic/tclExecute.c: Corrected failure to compile/link in the + -DNO_WIDE_TYPE configuration. + + * generic/tclExecute.c: Corrected improper use of bignum arguments to + * tests/expr.test: *SHIFT operations. [Bug 1770224] + +2007-08-07 Miguel Sofer + + * generic/tclInt.h: remove comments refering to VAR_SCALAR, as that + flag bit does not exist any longer. + * generic/tclProc.c (InitCompiledLocals): removed optimisation for + non-resolved case, as the function is never called in that case. + Renamed the function to InitResolvedLocals to calrify the point. + + * generic/tclInt.decls: Exporting via stubs to help xotcl adapt to + * generic/tclInt.h: VarReform. + * generic/tclIntDecls.h: + * generic/tclStubInit.c: + +2007-08-07 Daniel Steffen + + * generic/tclEnv.c: improve environ handling on Mac OS X (adapted + * unix/tclUnixPort.h: from Apple changes in Darwin tcl-64). + + * unix/Makefile.in: add support for compile flags specific to + object files linked directly into executables. + + * unix/configure.in (Darwin): only use -seg1addr flag when prebinding; + use -mdynamic-no-pic flag for object files linked directly into exes; + support overriding TCL_PACKAGE_PATH/TCL_MODULE_PATH in environment. + + * unix/configure: autoconf-2.59 + +2007-08-06 Don Porter + + * tests/parseExpr.test: Update source file name of expr parser code. + + * generic/tclCompExpr.c: Added a "mark" field to the OpNode + struct, which is used to guide tree traversal. This field costs + nothing since alignement requirements used the memory already. + Rewrote ConvertTreeToTokens() to use the new field, which permitted + consolidation of utility routines CopyTokens() and + GenerateTokensForLiteral(). + +2007-08-06 Kevin B. Kenny + + * generic/tclGetDate.y: Added a cast to the definition of YYFREE to + silence compiler warnings. + * generic/tclDate.c: Regenerated + * win/tclWinTest.c: Added a cast to GetSecurityDescriptorDacl call + to silence compiler warnings. + +2007-08-04 Miguel Sofer + + * generic/tclInt.decls: Exporting via stubs to help itcl adapt to + * generic/tclInt.h: VarReform. Added localCache initialization + * generic/tclIntDecls.h: to TclInitCompiledLocals (which only exists + * generic/tclProc.c: for itcl). + * generic/tclStubInit.c: + * generic/tclVar.c: + +2007-08-01 Donal K. Fellows + + * library/word.tcl: Rewrote for greater efficiency. [Bug 1764318] + +2007-08-01 Pat Thoyts + + * generic/tclInt.h: Added a TclOffset macro ala Tk_Offset to + * generic/tclVar.c: abstract out 'offsetof' which may not be + * generic/tclExceute.c: defined (eg: msvc6). + +2007-08-01 Miguel Sofer + + * generic/tclVar.c (TclCleanupVar): fix [Bug 1765225], thx Larry + Virden. + +2007-07-31 Miguel Sofer + + * doc/Hash.3: + * generic/tclHash.c: + * generic/tclObj.c: + * generic/tclThreadStorage.c: (changes part of the patch below) + Stop Tcl_CreateHashVar from resetting hPtr->clientData to NULL after + calling the allocEntryProc for a custom table. + + * generic/tcl.h: + * generic/tclBasic.c: + * generic/tclCmdIL.c: + * generic/tclCompCmds.c: + * generic/tclCompile.c: + * generic/tclCompile.h: + * generic/tclExecute.c: + * generic/tclHash.c: + * generic/tclInt.decls: + * generic/tclInt.h: + * generic/tclIntDecls.h: + * generic/tclLiteral.c: + * generic/tclNamesp.c: + * generic/tclObj.c: + * generic/tclProc.c: + * generic/tclThreadStorage.c: + * generic/tclTrace.c: + * generic/tclVar.c: VarReform [Patch 1750051] + + *** POTENTIAL INCOMPATIBILITY *** (tclInt.h and tclCompile.h) + Extensions that access internals defined in tclInt.h and/or + tclCompile.h may lose both binary and source compatibility. The + relevant changes are: + 1. 'struct Var' is completely changed, all acceses to its internals + (either direct or via the TclSetVar* and TclIsVar* macros) will + malfunction. Var flag values and semantics changed too. + 2. 'struct Bytecode' has an additional field that has to be + initialised to NULL + 3. 'struct Namespace' is larger, as the varTable is now one pointer + larger than a Tcl_HashTable. Direct access to its fields will + malfunction. + 4. 'struct CallFrame' grew one more field (the second such growth with + respect to Tcl8.4). + 5. API change for the functions TclFindCompiledLocal, TclDeleteVars + and many internal functions in tclVar.c + + Additionally, direct access to variable hash tables via the standard + Tcl_Hash* interface is to be considered as deprecated. It still works + in the present version, but will be broken by further specialisation + of these hash tables. This concerns especially the table of array + elements in an array, as well as the varTable field in the Namespace + struct. + +2007-07-31 Miguel Sofer + + * unix/configure.in: allow use of 'inline' in Tcl sources. [Patch + * win/configure.in: 1754128] + * win/makefile.vc: Regen with autoconf 2.61 + +2007-07-31 Donal K. Fellows + + * unix/tclUnixInit.c (TclpSetVariables): Use the thread-safe getpwuid + replacement to fill the tcl_platform(user) field as it is not subject + to spoofing. [Bug 681877] + + * unix/tclUnixCompat.c: Simplify the #ifdef logic. + + * unix/tclUnixChan.c (FileWatchProc): Fix test failures. + +2007-07-30 Donal K. Fellows + + * unix/tclUnixChan.c (SET_BITS, CLEAR_BITS): Added macros to make this + file clearer. + +2007-07-24 Miguel Sofer + + * generic/tclBasic.c (TEOvI, GetCommandSource): + * generic/tclExecute.c (TEBC, TclGetSrcInfoForCmd): + * generic/tclInt.h: + * generic/tclTrace.c (TclCheck(Interp|Execution)Traces): + Removed the need for TEBC to inspect the command before calling TEOvI, + leveraging the TIP 280 infrastructure. Moved the generation of a + correct nul-terminated command string away from the trace code, back + into TEOvI/GetCommandSource. + +2007-07-20 Andreas Kupries + + * library/platform/platform.tcl: Fixed bug in 'platform::patterns' + * library/platform/pkgIndex.tcl: where identifiers not matching + * unix/Makefile.in: the special linux and solaris forms would not + * win/Makefile.in: get 'tcl' as an acceptable platform added to + * doc/platform.n: the result. Bumped package to version 1.0.3 and + * doc/platform_shell.n: updated documentation and Makefiles. Also + fixed bad version info in the documentation of platform::shell. + +2007-07-19 Don Porter + + * generic/tclParse.c: In contexts where interp and parsePtr->interp + might be different, be sure to use the latter for error reporting. + Also pulled the interp argument back out of ParseTokens() since we + already had a parsePtr->interp to work with. + +2007-07-18 Don Porter + + * generic/tclCompExpr.c: Removed unused arguments and variables + +2007-07-17 Don Porter + + * generic/tclCompExpr.c (ParseExpr): While adding comments to + explain the operations of ParseExpr(), made significant revisions to + the code so it would be easier to explain, and in the process made the + code simpler and clearer as well. + +2007-07-15 Don Porter + + * generic/tclCompExpr.c: More commentary. + * tests/parseExpr.test: Several tests of syntax error messages + to check that when expression substrings are truncated they leave + visible the context relevant to the reported error. + +2007-07-12 Don Porter + + * generic/tclCompExpr.c: Factored out, corrected, and commented + common code for reporting syntax errors in LEAF elements. + +2007-07-11 Miguel Sofer + + * generic/tclCompCmds.c (TclCompileWhileCmd): + * generic/tclCompile.c (TclCompileScript): + Corrected faulty avoidance of INST_START_CMD when the first opcode in + a script is within a loop (as produced by 'while 1'), so that the + corresponding command is properly counted. [Bug 1752146] + +2007-07-11 Don Porter + + * generic/tclCompExpr.c: Added a "parseOnly" flag argument to + ParseExpr() to indicate whether the caller is Tcl_ParseExpr(), with an + end goal of filling a Tcl_Parse with Tcl_Tokens representing the + parsed expression, or TclCompileExpr() with the goal of compiling and + executing the expression. In the latter case, more aggressive + conversion of QUOTED and BRACED lexeme to literals is done. In the + former case, all such conversion is avoided, since Tcl_Token + production would revert it anyway. This enables simplifications to the + GenerateTokensForLiteral() routine as well. + +2007-07-10 Don Porter + + * generic/tclCompExpr.c: Added a field for operator precedence + to be stored directly in the parse tree. There's no memory cost to + this addition, since that memory would have been lost to alignment + issues anyway. Also, converted precedence definitions and lookup + tables to use symbolic constants instead of raw number for improved + readability, and continued extending/improving/correcting comments. + Removed some unused counter variables. Renamed some variables for + clarity and replaced some cryptic logic with more readable macros. + +2007-07-09 Don Porter + + * generic/tclCompExpr.c: Revision so that the END lexeme never + gets inserted into the parse tree. Later tree traversal never reaches + it since its location in the tree is not variable. Starting and + stopping with the START lexeme (node 0) is sufficient. Also finished + lexeme code commentary. + + * generic/tclCompExpr.c: Added missing creation and return of + the Tcl_Parse fields that indicate error conditions. [Bug 1749987] + +2007-07-05 Don Porter + + * library/init.tcl (unknown): Corrected inconsistent error message + in interactive [unknown] when empty command is invoked. [Bug 1743676] + +2007-07-05 Miguel Sofer + + * generic/tclNamesp.c (SetNsNameFromAny): + * generic/tclObj.c (SetCmdNameFromAny): Avoid unnecessary + ckfree/ckalloc when the old structs can be reused. + +2007-07-04 Miguel Sofer + + * generic/tclNamesp.c: Fix case where a FQ cmd or ns was being cached + * generic/tclObj.c: in a different interp, tkcon. [Bug 1747512] + +2007-07-03 Don Porter + + * generic/tclCompExpr.c: Revised #define values so that there + is now more expansion room to define more BINARY operators. + +2007-07-02 Donal K. Fellows + + * generic/tclHash.c (CompareStringKeys): Always use the strcmp() + version; the operation is functionally equivalent, the speed is + identical (up to measurement limitations), and yet the code is + simpler. [FRQ 951168] + +2007-07-02 Don Porter + + * generic/tcl.h: Removed TCL_PRESERVE_BINARY_COMPATIBILITY and + * generic/tclHash.c: any code enabled when it is set to 0. We will + * generic/tclStubInit.c: always want to preserve binary compat + of the structs that appear in the interface through the 8.* series of + releases, so it's pointless to drag around this never-enabled + alternative. + + * generic/tclIO.c: Removed dead code. + * unix/tclUnixChan.c: + + * generic/tclCompExpr.c: Removed dead code, old implementations + * generic/tclEvent.c: of expr parsing and compiling, including the + * generic/tclInt.h: routine TclFinalizeCompilation(). + +2007-06-30 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LsortObjCmd): Plug a memory leak caused by a + missing Tcl_DecrRefCount on an error path. [Bug 1717186] + +2007-06-30 Zoran Vasiljevic + + * generic/tclThread.c: Prevent RemeberSyncObj() from growing the sync + object lists by reusing already free'd slots, if possible. See + discussion on Bug 1726873 for more information. + +2007-06-29 Donal K. Fellows + + * doc/DictObj.3 (Tcl_DictObjDone): Improved documentation of this + function to make it clearer how to use it. [Bug 1710795] + +2007-06-29 Daniel Steffen + + * generic/tclAlloc.c: on Darwin, ensure memory allocated by + * generic/tclThreadAlloc.c: the custom TclpAlloc()s is aligned to + 16 byte boundaries (as is the case with the Darwin system malloc). + + * generic/tclGetDate.y: use ckalloc/ckfree instead of malloc/free. + * generic/tclDate.c: bison 1.875e + + * generic/tclBasic.c (TclEvalEx): fix warnings. + + * macosx/Tcl.xcodeproj/project.pbxproj: better support for renamed tcl + * macosx/Tcl.xcodeproj/default.pbxuser: source dir; add 10.5 SDK build + * macosx/Tcl-Common.xcconfig: config; remove tclMathOp.c. + + * macosx/README: document Tcl.xcodeproj changes. + +2007-06-28 Don Porter + + * generic/tclBasic.c: Removed dead code, including the + * generic/tclExecute.c: entire file tclMathOp.c. + * generic/tclInt.h: + * generic/tclMathOp.c (removed): + * generic/tclTestObj.c: + * win/tclWinFile.c: + + * unix/Makefile.in: Updated to reflect deletion of tclMathOp.c. + * win/Makefile.in: + * win/makefile.bc: + * win/makefile.vc: + +2007-06-28 Pat Thoyts + + * generic/tclBasic.c: Silence constness warnings for TclStackFree + * generic/tclCompCmds.c: when building with msvc. + * generic/tclFCmd.c: + * generic/tclIOCmd.c: + * generic/tclTrace.c: + +2007-06-28 Miguel Sofer + + * generic/tclVar.c (UnsetVarStruct): fix possible segfault. + +2007-06-27 Don Porter + + * generic/tclTrace.c: Corrected broken trace reversal logic in + * generic/tclTest.c: TclCheckInterpTraces that led to infinite loop + * tests/trace.test: when multiple Tcl_CreateTrace traces were set + and one of them did not fire due to level restrictions. [Bug 1743931] + +2007-06-26 Don Porter + + * generic/tclBasic.c (TclEvalEx): Moved some arrays from the C + stack to the Tcl stack. + +2007-06-26 Miguel Sofer + + * generic/tclVar.c (UnsetVarStruct): more streamlining. + +2007-06-25 Don Porter + + * generic/tclExecute.c: Safety checks to avoid crashes in the + TclStack* routines when called with an incompletely initialized + interp. [Bug 1743302] + +2007-06-25 Miguel Sofer + + * generic/tclVar.c (UnsetVarStruct): fixing incomplete change, more + streamlining. + +2007-06-24 Miguel Sofer + + * generic/tclVar.c (TclDeleteCompiledLocalVars): removed inlining that + ended up not really optimising (limited benchmarks). Now calling + UnsetVarStruct (streamlined old code is #ifdef'ed out, in case better + benchmarks do show a difference). + + * generic/tclVar.c (UnsetVarStruct): fixed a leak introduced in last + commit. + +2007-06-23 Miguel Sofer + + * generic/tclVar.c (UnsetVarStruct, TclDeleteVars): made the logic + slightly clearer, eliminated some duplicated code. + + *** POTENTIAL INCOMPATIBILITY *** (tclInt.h and Var struct users) + The core never builds VAR_LINK variable to have traces. Such a + "monster", should one exist, will now have its unset traces called + *before* it is unlinked. + +2007-06-23 Daniel Steffen + + * macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation + APIs after fork() on systems where that would lead to an abort(). + +2007-06-22 Don Porter + + * generic/tclExecute.c: Revised TclStackRealloc() signature to better + * generic/tclInt.h: parallel (and fall back on) Tcl_Realloc. + + * generic/tclNamesp.c (TclResetShadowesCmdRefs): Replaced + ckrealloc based allocations with TclStackRealloc allocations. + + * generic/tclCmdIL.c: More conversions to use TclStackAlloc. + * generic/tclScan.c: + +2007-06-21 Don Porter + + * generic/tclBasic.c: Move most instances of the Tcl_Parse struct + * generic/tclCompExpr.c: off the C stack and onto the Tcl stack. This + * generic/tclCompile.c: is a rather large struct (> 3kB). + * generic/tclParse.c: + +2007-06-21 Miguel Sofer + + * generic/tclBasic.c (TEOvI): Made sure that leave traces + * generic/tclExecute.c (INST_INVOKE): that were created during + * tests/trace.test (trace-36.2): execution of an originally + untraced command do not fire [Bug 1740962], partial fix. + +2007-06-21 Donal K. Fellows + + * generic/tcl.h, generic/tclCompile.h, generic/tclCompile.c: Remove + references in comments to obsolete {expand} notation. [Bug 1740859] + +2007-06-20 Miguel Sofer + + * generic/tclVar.c: streamline namespace vars deletion: only compute + the variable's full name if the variable is traced. + +2007-06-20 Don Porter + + * generic/tclInt.decls: Revised the interfaces of the routines + * generic/tclExecute.c: TclStackAlloc and TclStackFree to make them + easier for callers to use (or more precisely, harder to misuse). + TclStackFree now takes a (void *) argument which is the pointer + intended to be freed. TclStackFree will panic if that's not actually + the memory the call will free. TSA/TSF also now tolerate receiving + (interp == NULL), in which case they simply fall back to be calls to + Tcl_Alloc/Tcl_Free. + + * generic/tclIntDecls.h: make genstubs + + * generic/tclBasic.c: Updated callers + * generic/tclCmdAH.c: + * generic/tclCmdIL.c: + * generic/tclCompCmds.c: + * generic/tclCompExpr.c: + * generic/tclCompile.c: + * generic/tclFCmd.c: + * generic/tclFileName.c: + * generic/tclIOCmd.c: + * generic/tclIndexObj.c: + * generic/tclInterp.c: + * generic/tclNamesp.c: + * generic/tclProc.c: + * generic/tclTrace.c: + * unix/tclUnixPipe.c: + +2007-06-20 Jeff Hobbs + + * tools/tcltk-man2html.tcl: revamp of html doc output to use CSS, + standardized headers, subheaders, dictionary sorting of names. + +2007-06-18 Jeff Hobbs + + * tools/tcltk-man2html.tcl: clean up copyright merging and output. + clean up coding constructs. + +2007-06-18 Miguel Sofer + + * generic/tclCmdIL.c (InfoFrameCmd): + * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): + * generic/tclCompile.c (TclInitCompileEnv): + * generic/tclProc.c (Tcl_ProcObjCmd, SetLambdaFromAny): Moved the + CmdFrame off the C stack and onto the Tcl stack. + + * generic/tclExecute.c (TEBC): Moved the CmdFrame off the C stack and + onto the Tcl stack, between the catch and the execution stacks + +2007-06-18 Don Porter + + * generic/tclBasic.c (TclEvalEx,TclEvalObjEx): Moved the CmdFrame off + the C stack and onto the Tcl stack. + +2007-06-17 Donal K. Fellows + + * generic/tclProc.c (TclObjInterpProcCore): Minor fixes to make + * generic/tclExecute.c (TclExecuteByteCode): compilation debugging + builds work again. [Bug 1738542] + +2007-06-16 Donal K. Fellows + + * generic/tclProc.c (TclObjInterpProcCore): Use switch instead of a + chain of if's for a modest performance gain and a little more clarity. + +2007-06-15 Miguel Sofer + + * generic/tclCompCmds.c: Simplified [variable] compiler and executor. + * generic/tclExecute.c: Missed updates to "there is always a valid + frame". + + * generic/tclCompile.c: reverted TclEvalObjvInternal and INST_INVOKE + * generic/tclExecute.c: to essentially what they were previous to the + * generic/tclBasic.c: commit of 2007-04-03 [Patch 1693802] and the + subsequent optimisations, as they break the new trace tests described + below. + + * generic/trace.test: added tests 36 to 38 for dynamic trace creation + and addition. These tests expose a change in dynamics due to a recent + round of optimisations. The "correct" behaviour is not described in + docs nor TIP 62. + +2007-06-14 Miguel Sofer + + * generic/tclInt.decls: Modif to the internals of TclObjInterpProc + * generic/tclInt.h: to reduce stack consumption and improve task + * generic/tclIntDecls.h: separation. Changes the interface of + * generic/tclProc.c: TclObjInterpProcCore (patching TclOO + simultaneously). + + * generic/tclProc.c (TclObjInterpProcCore): simplified obj management + in wrongNumArgs calls. + +2007-06-14 Don Porter + + * generic/tclCompile.c: SetByteCodeFromAny() can no longer return any + * generic/tclExecute.c: code other than TCL_OK, so remove code that + * generic/tclProc.c: formerly handled exceptional codes. + +2007-06-13 Miguel Sofer + + * generic/tclExecute.c (TclCompEvalObj): missed update to "there is + always a valid frame". + + * generic/tclProc.c (TclObjInterpProcCore): call TEBC directly instead + of going through TclCompEvalObj - no need to check the compilation's + freshness, this has already been done. This improves speed and should + also provide some relief to [Bug 1066755]. + +2007-06-12 Donal K. Fellows + + * generic/tclBasic.c (Tcl_CreateInterp): Turn the [info] command into + * generic/tclCmdIL.c (TclInitInfoCmd): an ensemble, making it easier + for third-party code to plug into. + + * generic/tclIndexObj.c (Tcl_WrongNumArgs): + * generic/tclNamesp.c, generic/tclInt.h (tclEnsembleCmdType): Make + Tcl_WrongNumArgs do replacement correctly with ensembles and other + sorts of complex replacement strategies. + +2007-06-11 Miguel Sofer + + * generic/tclExecute.c: comments added to explain iPtr->numLevels + management. + + * generic/tclNamesp.c: tweaks to Tcl_GetCommandFromObj and + * generic/tclObj.c: TclGetNamespaceFromObj; modified the usage of + structs ResolvedCmdName and ResolvedNsname so that the field refNsPtr + is NULL for fully qualified names. + +2007-06-10 Miguel Sofer + + * generic/tclBasic.c: Further TEOvI split, creating a new + * generic/tclCompile.h: TclEvalObjvKnownCommand() function to handle + * generic/tclExecute.c: commands that are already known and are not + traced. INST_INVOKE now calls into this function instead of inlining + parts of TEOvI. Same perf, better isolation. + + ***POTENTIAL INCOMPAT*** There is a subtle issue with the timing of + execution traces that is changed here - first change appeared in my + commit of 2007-04-03 [Patch 1693802], which caused some divergence + between compiled and non-compiled code. + ***THIS CHANGE IS UNDER REVIEW*** + +2007-06-10 Jeff Hobbs + + * README: updated links. [Bug 1715081] + + * generic/tclExecute.c (TclExecuteByteCode): restore support for + INST_CALL_BUILTIN_FUNC1 and INST_CALL_FUNC1 bytecodes to support 8.4- + precompiled sources (math functions). [Bug 1720895] + +2007-06-10 Miguel Sofer + + * generic/tclInt.h: + * generic/tclNamesp.c: + * generic/tclObj.c: + * generic/tclvar.c: new macros TclGetCurrentNamespace() and + TclGetGlobalNamespace(); Tcl_GetCommandFromObj and + TclGetNamespaceFromObj rewritten to make the logic clearer; slightly + faster too. + +2007-06-09 Miguel Sofer + + * generic/tclExecute.c (INST_INVOKE): isolated two vars to the small + block where they are actually used. + + * generic/tclObj.c (Tcl_GetCommandFromObj): rewritten to make the + logic clearer; slightly faster too. + + * generic/tclBasic.c: Split TEOv in two, by separating a processor + for non-TCL_OK returns. Also split TEOvI in a full version that + handles non-existing and traced commands, and a separate shorter + version for the regular case. + + * generic/tclBasic.c: Moved the generation of command strings for + * generic/tclTrace.c: traces: previously in Tcl_EvalObjv(), now in + TclCheck[Interp|Execution]Traces(). Also insured that the strings are + properly NUL terminated at the correct length. [Bug 1693986] + + ***POTENTIAL INCOMPATIBILITY in internal API*** + The functions TclCheckInterpTraces() and TclCheckExecutionTraces() (in + internal stubs) used to be noops if the command string was NULL, this + is not true anymore: if the command string is NULL, they generate an + appropriate string from (objc,objv) and use it to call the traces. The + caller might as well not call them with a NULL string if he was + expecting a noop. + + * generic/tclBasic.c: Extend usage of TclLimitReady() and + * generic/tclExecute.c: (new) TclLimitExceeded() macros. + * generic/tclInt.h: + * generic/tclInterp.c: + + * generic/tclInt.h: New TclCleanupCommandMacro for core usage. + * generic/tclBasic.c: + * generic/tclExecute.c: + * generic/tclObj.c: + +2007-06-09 Daniel Steffen + + * macosx/Tcl.xcodeproj/project.pbxproj: add new Tclsh-Info.plist.in. + +2007-06-08 Donal K. Fellows + + * generic/tclCmdMZ.c (Tcl_StringObjCmd): Changed [string first] and + * doc/string.n: [string last] so that they have clearer descriptions + for those people who know the adage about needles and haystacks. This + follows suggestions on comp.lang.tcl... + +2007-06-06 Miguel Sofer + + * generic/tclParse.c: fix for uninit read. [Bug 1732414] + +2007-06-06 Daniel Steffen + + * macosx/Tcl.xcodeproj/project.pbxproj: add settings for Fix&Continue. + + * unix/configure.in (Darwin): add plist for tclsh; link the + * unix/Makefile.in (Darwin): Tcl and tclsh plists into + * macosx/Tclsh-Info.plist.in (new): their binaries in all cases. + * macosx/Tcl-Common.xcconfig: + + * unix/tcl.m4 (Darwin): fix CF checks in fat 32&64bit builds. + * unix/configure: autoconf-2.59 + +2007-06-05 Don Porter + + * generic/tclBasic.c: Added interp flag value ERR_LEGACY_COPY to + * generic/tclInt.h: control the timing with which the global + * generic/tclNamesp.c: variables ::errorCode and ::errorInfo get + * generic/tclProc.c: updated after an error. This keeps more + * generic/tclResult.c: precise compatibility with Tcl 8.4. + * tests/result.test (result-6.2): [Bug 1649062] + +2007-06-05 Miguel Sofer + + * generic/tclInt.h: + * generic/tclExecute.c: Tcl-stack reform, [Patch 1701202] + +2007-06-03 Daniel Steffen + + * unix/Makefile.in: add datarootdir to silence autoconf-2.6x warning. + +2007-05-30 Don Porter + + * generic/tclBasic.c: Removed code that dealt with + * generic/tclCompile.c: TCL_TOKEN_EXPAND_WORD tokens representing + * generic/tclCompile.h: expanded literal words. These sections were + mostly in place to enable [info frame] to discover line information in + expanded literals. Since the parser now generates a token for each + post-expansion word referring to the right location in the original + script string, [info frame] gets all the data it needs. + + * generic/tclInt.h: Revised the parser so that it never produces + * generic/tclParse.c: TCL_TOKEN_EXPAND_WORD tokens when parsing an + * tests/parse.test: expanded literal word; that is, something like + {*}{x y z}. Instead, generate the series of TCL_TOKEN_SIMPLE_WORD + tokens to represent the words that expansion of the literal string + produces. [RFE 1725186] + +2007-05-29 Jeff Hobbs + + * unix/tclUnixThrd.c (Tcl_JoinThread): fix for 64-bit handling of + pthread_join exit return code storage. [Bug 1712723] + +2007-05-22 Don Porter + + [core-stabilizer-branch] + + * unix/configure: autoconf-2.59 (FC6 fork) + * win/configure: + + * README: Bump version number to 8.5b1 + * generic/tcl.h: + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + +2007-05-18 Don Porter + + * unix/configure: autoconf-2.59 (FC6 fork) + * win/configure: + + * README: Bump version number to 8.5a7 + * generic/tcl.h: + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * generic/tclParse.c: Disable and remove the ALLOW_EXPAND sections + * tests/info.test: that continued to support the deprecated + * tests/mathop.test: {expand} syntax. Updated the few remaining + users of that syntax in the test suite. + +2007-05-17 Donal K. Fellows + + * generic/tclExecute.c (TclLimitReady): Created a macro version of + Tcl_LimitReady just for TEBC, to reduce the amount of times that the + bytecode engine calls out to external functions on the critical path. + * generic/tclInterp.c (Tcl_LimitReady): Added note to remind anyone + doing maintenance that there is a macro version to update. + +2007-05-17 Daniel Steffen + + * generic/tcl.decls: workaround 'make checkstubs' failures from + tclStubLib.c MODULE_SCOPE revert. [Bug 1716117] + +2007-05-16 Joe English + + * generic/tclStubLib.c: Change Tcl_InitStubs(), tclStubsPtr, and the + auxilliary stubs table pointers back to public visibility. + + These symbols need to be exported so that stub-enabled extensions may + be statically linked into an extended tclsh or Big Wish with a + dynamically-linked libtcl. [Bug 1716117] + +2007-05-15 Don Porter + + * win/configure: autoconf-2.59 (FC6 fork) + + * library/reg/pkgIndex.tcl: Bump to registry 1.2.1 to account for + * win/configure.in: [Bug 1682211] fix. + * win/makefile.bc: + * win/tclWinReg.c: + +2007-05-11 Pat Thoyts + + * generic/tclInt.h: Removed TclEvalObjEx and TclGetSrcInfoForPc from + tclInt.h now they are in the internal stubs table. + +2007-05-09 Don Porter + + * generic/tclInt.h: TclFinalizeThreadAlloc() is always defined, so + make sure it is also always declared (with MODULE_SCOPE). + +2007-05-09 Daniel Steffen + + * generic/tclInt.h: fix warning when building threaded with -DPURIFY. + + * macosx/Tcl.xcodeproj/project.pbxproj: add 'DebugUnthreaded' & + * macosx/Tcl.xcodeproj/default.pbxuser: 'DebugLeaks' configs and env + var settings needed to run the 'leaks' tool. + +2007-05-07 Don Porter + + [Tcl Bug 1706140] + + * generic/tclLink.c (LinkTraceProc): Update Tcl_VarTraceProcs so + * generic/tclNamesp.c (Error*Read): they call Tcl_InterpDeleted() + * generic/tclTrace.c (Trace*Proc): for themselves, and do not + * generic/tclUtil.c (TclPrecTraceProc): rely on (frequently buggy) + setting of the TCL_INTERP_DESTROYED flag by the trace core. + + * generic/tclVar.c: Update callers of TclCallVarTraces to not pass + in the TCL_INTERP_DESTROYED flag. Also apply filters so that public + routines only pass documented flag values down to lower level routines + + * generic/tclTrace.c (TclCallVarTraces): The setting of the + TCL_INTERP_DESTROYED flag is now done entirely within the + TclCallVarTraces routine, the only place it can be done right. + +2007-05-06 Donal K. Fellows + + * generic/tclInt.h (ExtraFrameInfo): Create a new mechanism for + * generic/tclCmdIL.c (InfoFrameCmd): conveying what information needs + to be added to the results of [info frame] to replace the hack that + was there before. + * generic/tclProc.c (Tcl_ApplyObjCmd): Use the new mechanism for the + [apply] command, the only part of Tcl itself that needs it (so far). + + * generic/tclInt.decls (TclEvalObjEx, TclGetSrcInfoForPc): Expose + these two functions through the internal stubs table, necessary for + extensions that need to integrate deeply with TIP#280. + +2007-05-05 Donal K. Fellows + + * win/tclWinFile.c (TclpGetUserHome): Squelch type-pun warnings in + * win/tclWinInit.c (TclpSetVariables): Win-specific code not found + * win/tclWinReg.c (AppendSystemError): during earlier work on Unix. + +2007-05-04 Kevin B. Kenny + + * generic/tclIO.c (TclFinalizeIOSubsystem): Added an initializer to + silence a spurious gcc warning about use of an uninitialized + variable. + * tests/encoding.test: Modified so that encoding tests happen in a + private namespace, to avoid polluting the global one. This problem was + discovered when running the test suite '-singleproc 1 -skip exec.test' + because the 'path' variable in encoding.test conflicted with the one + in io.test. + * tests/io.test: Made more of the working variables private to the + namespace. + +2007-05-02 Kevin B. Kenny + + * generic/tclTest.c (SimpleMatchInDirectory): Corrected a refcount + imbalance that affected the filesystem-[147]* tests in the test suite. + Thanks to Don Porter for the patch. [Bug 1710707] + * generic/tclPathObj.c (Tcl_FSJoinPath, Tcl_FSGetNormalizedPath): + Corrected several memory leaks that caused refcount imbalances + resulting in memory leaks on Windows. Thanks to Joe Mistachkin for the + patch. + +2007-05-01 Miguel Sofer + + * generic/tclVar.c (TclPtrSetVar): fixed leak whenever newvaluePtr had + refCount 0 and was used for appending (but not lappending). Thanks to + mistachkin and kbk. [Bug 1710710] + +2007-05-01 Kevin B. Kenny + + * generic/tclIO.c (DeleteChannelTable): Made changes so that + DeleteChannelTable tries to close all open channels, not just the + first. [Bug 1710285] + * generic/tclThread.c (TclFinalizeSynchronization): Make sure that TSD + blocks get freed on non-threaded builds. [Bug 1710825] + * tests/utf.test (utf-25.1--utf-25.4): Modified tests to clean up + after the 'testobj' extension to avoid spurious reports of memory + leaks. + +2007-05-01 Don Porter + + * generic/tclCmdMZ.c (STR_MAP): When [string map] has a pure dict map, + a missing Tcl_DictObjDone() call led to a memleak. [Bug 1710709] + +2007-04-30 Daniel Steffen + + * unix/Makefile.in: add 'tclsh' dependency to install targets that + rely on tclsh, fixes parallel 'make install' from empty build dir. + +2007-04-30 Andreas Kupries + + * generic/tclIO.c (FixLevelCode): Corrected reference count + mismanagement of newlevel, newcode. Changed to allocate the Tcl_Obj's + as late as possible, and only when actually needed. [Bug 1705778, leak + K29] + +2007-04-30 Kevin B. Kenny + + * generic/tclProc.c (Tcl_ProcObjCmd, SetLambdaFromAny): Corrected + reference count mismanagement on the name of the source file in the + TIP 280 code. [Bug 1705778, leak K02 among other manifestations] + +2007-04-25 Donal K. Fellows + + *** 8.5a6 TAGGED FOR RELEASE *** + + * generic/tclProc.c (TclObjInterpProcCore): Only allocate objects for + error message generation when associated with argument names that are + really used. [Bug 1705778, leak K15] + +2007-04-25 Kevin B. Kenny + + * generic/tclIOUtil.c (Tcl_FSChdir): Changed the memory management so + that the path returned from Tcl_FSGetNativePath is not duplicated + before being stored as the current directory, to avoid a memory leak. + [Bug 1705778, leak K01 among other manifestations] + +2007-04-25 Don Porter + + * generic/tclCompExpr.c (ParseExpr): Revised to be sure that an + error return doesn't prevent all literals getting placed on the + litList to be returned to the caller for freeing. Corrects some + memleaks. [Bug 1705778, leak K23] + +2007-04-25 Daniel Steffen + + * unix/Makefile.in (dist): add macosx/*.xcconfig files to src dist; + copy license.terms to dist macosx dir; fix autoheader bits. + +2007-04-24 Miguel Sofer + + * generic/tclListObj.c: reverting [Patch 738900] (committed on + 2007-04-20). Causes some Tk test breakage of unknown importance, but + the impact of the patch itself is likely to be so small that it does + not warrant investigation at this time. + +2007-04-24 Donal K. Fellows + + * generic/tclDictObj.c (DictKeysCmd): Rewrote so that the lock on the + internal representation of a dict is only set when necessary. [Bug + 1705778, leak K04] + (DictFilterCmd): Added code to drop the lock in the trivial match + case. [Bug 1705778, leak K05] + +2007-04-24 Kevin B. Kenny + + * generic/tclBinary.c: Addressed several code paths where the error + return from the 'binary format' command leaked the result buffer. + * generic/tclListObj.c (TclLsetFlat): Fixed a bug where the new list + under construction was leaked in the error case. [Bug 1705778, leaks + K13 and K14] + +2007-04-24 Jeff Hobbs + + * unix/Makefile.in (dist): add platform library package to src dist + +2007-04-24 Don Porter + + * generic/tclCompExpr.c (ParseExpr): Memory leak in error case; the + literal Tcl_Obj was not getting freed. [Bug 1705778, leak #1 (new)] + + * generic/tclNamesp.c (Tcl_DeleteNamespace): Corrected flaw in the + flag marking scheme to be sure that global namespaces are freed when + their interp is deleted. [Bug 1705778] + +2007-04-24 Kevin B. Kenny + + * generic/tclExecute.c (TclExecuteByteCode): Plugged six memory leaks + in bignum arithmetic. + * generic/tclIOCmd.c (Tcl_ReadObjCmd): Plugged a leak of the buffer + object if the physical read returned an error and the bypass area had + no message. + * generic/tclIORChan.c (TclChanCreateObjCmd): Plugged a leak of the + return value from the "initialize" method of a channel handler. + (All of the above under [Bug 1705778]) + +2007-04-23 Daniel Steffen + + * generic/tclCkalloc.c: fix warnings from gcc build configured with + * generic/tclCompile.c: --enable-64bit --enable-symbols=all. + * generic/tclExecute.c: + + * unix/tclUnixFCmd.c: add workaround for crashing bug in fts_open() + * unix/tclUnixInit.c: without FTS_NOSTAT on 64bit Darwin 8 or earlier. + + * unix/tclLoadDyld.c (TclpLoadMemory): fix (void*) arithmetic. + + * macosx/Tcl-Common.xcconfig: enable more warnings. + + * macosx/Tcl.xcodeproj/project.pbxproj: add 'DebugMemCompile' build + configuration that calls configure with --enable-symbols=all; override + configure check for __attribute__((__visibility__("hidden"))) in Debug + configuration to restore availability of ZeroLink. + + * macosx/tclMacOSXNotify.c: fix warnings. + + * macosx/tclMacOSXFCmd.c: const fixes. + + * macosx/Tcl-Common.xcconfig: fix whitespace. + * macosx/Tcl-Debug.xcconfig: + * macosx/Tcl-Release.xcconfig: + * macosx/README: + + * macosx/GNUmakefile: fix/add copyright and license refs. + * macosx/tclMacOSXBundle.c: + * macosx/Tcl-Info.plist.in: + * macosx/Tcl.xcode/project.pbxproj: + * macosx/Tcl.xcodeproj/project.pbxproj: + + * unix/configure.in: install license.terms into Tcl.framework. + * unix/configure: autoconf-2.59 + +2007-04-23 Don Porter + + * generic/tclVar.c (UnsetVarStruct): Make sure the + TCL_INTERP_DESTROYED flags gets passed to unset trace routines so they + can respond appropriately. [Bug 1705778, leak #9] + +2007-04-23 Miguel Sofer + + * generic/tclCompile.c (TclFreeCompileEnv): Tip 280's new field + extCmdMapPtr was not being freed. [Bug 1705778, leak #1] + +2007-04-23 Kevin B. Kenny + + * generic/tclCompCmds.c (TclCompileUpvarCmd): Plugged a memory leak in + 'upvar' when compiling (a) upvar outside a proc, (b) upvar with a + syntax error, or (c) upvar where the frame index is not known at + compile time. + * generic/tclCompExpr.c (ParseExpr): Plugged a memory leak when + parsing expressions that contain syntax errors. + * generic/tclEnv.c (ReplaceString): Clear memory correctly when + growing the cache to avoid reads of uninitialised data. + * generic/tclIORChan.c (TclChanCreateObjCmd, FreeReflectedChannel): + Plugged two memory leaks. + * generic/tclStrToD.c (AccumulateDecimalDigit): Fixed a mistake where + we'd run beyond the end of the 'pow10_wide' array if a number begins + with a string of more than 'maxpow10_wide' zeroes. + * generic/tclTest.c (Testregexpobjcmd): Removed an invalid access + beyond the end of 'objv' in 'testregexp -about'. + All of these issues reported under [Bug 1705778] - detected with the + existing test suite, no new regression tests required. + +2007-04-22 Miguel Sofer + + * generic/tclVar.c (TclDeleteNamespaceVars): fixed access to freed + memory detected by valgrind: Tcl_GetCurrentNamespace was being + called after freeing root CallFrame (on interp deletion). + +2007-04-20 Miguel Sofer + + * generic/tclListObj.c (SetListFromAny): avoid discarding internal + reps of objects converted to singleton lists. [Patch 738900] + +2007-04-20 Kevin B. Kenny + + * doc/clock.n: Corrected a silly error (transposed 'uppercase' and + 'lowercase' in clock.n. [Bug 1656002] + Clarified that [clock scan] does not recognize a locale's alternative + calendar. + Deleted an entirely superfluous (and also incorrect) remark about the + effect of Daylight Saving Time on relative times in [clock scan]. [Bug + 1582951] + * library/clock.tcl: Corrected an error in skipping over the %Ey field + on input. + * library/msgs/ja.msg: + * tools/loadICU.tcl: Corrected several localisation faults in the + Japanese locale (most notably, incorrect dates for the Emperors' + eras). Many thanks to SourceForge user 'nyademo' for pointing this out + and developing a fix. [Bug 1637471] + * generic/tclPathObj.c: Corrected a 'const'ness fault that caused + bitter complaints from MSVC. + * tests/clock.test (clock-40.1, clock-58.1, clock-59.1): Corrected a + test case that depended on ":localtime" being able to handle dates + prior to the Posix epoch. [Bug 1618445] Added a test case for the + dates of the Japanese emperors. [Bug 1637471] Added a regression test + for military time zone input conversion. [Bug 1586828] + * generic/tclGetDate.y (MilitaryTable): Fixed an ancient bug where the + military NZA time zones had the signs reversed. [Bug 1586828] + * generic/tclDate.c: Regenerated. + * doc/Notifier.3: Documented Tcl_SetNotifier and Tcl_ServiceModeHook. + Quite against my better judgment. [Bug 414933] + * generic/tclBasic.c, generic/tclCkalloc.c, generic/tclClock.c: + * generic/tclCmdIL.c, generic/tclCmdMZ.c, generic/tclFCmd.c: + * generic/tclFileName.c, generic/tclInterp.c, generic/tclIO.c: + * generic/tclIOUtil.c, generic/tclNamesp.c, generic/tclObj.c: + * generic/tclPathObj.c, generic/tclPipe.c, generic/tclPkg.c: + * generic/tclResult.c, generic/tclTest.c, generic/tclTestObj.c: + * generic/tclVar.c, unix/tclUnixChan.c, unix/tclUnixTest.c: + * win/tclWinLoad.c, win/tclWinSerial.c: Replaced commas in varargs + with string concatenation where possible. [Patch 1515234] + * library/tzdata/America/Tegucigalpa: + * library/tzdata/Asia/Damascus: Olson's tzdata 2007e. + +2007-04-19 Donal K. Fellows + + * generic/regcomp.c, generic/regc_cvec.c, generic/regc_lex.c, + * generic/regc_locale.c: Improve the const-correctness of the RE + compiler. + +2007-04-18 Miguel Sofer + + * generic/tclExecute.c (INST_LSHIFT): fixed a mistake introduced in + version 1.266 ('=' became '=='), which effectively turned the block + that handles native shifts into dead code. This explains why the + testsuite did not pick this mistake. Rewrote to make the intention + clear. + + * generic/tclInt.h (TclDecrRefCount): change the order of the + branches, use empty 'if ; else' to handle use in unbraced outer + if/else conditions (as already done in tcl.h) + + * generic/tclExecute.c: slight changes in Tcl_Obj management. + +2007-04-17 Kevin B. Kenny + + * library/clock.tcl: Fixed the naming of + ::tcl::clock::ReadZoneinfoFile because (yoicks!) it was in the global + namespace. + * doc/clock.n: Clarified the cases in which legacy time zone is + recognized. [Bug 1656002] + +2007-04-17 Miguel Sofer + + * generic/tclExecute.c: fixed checkInterp logic [Bug 1702212] + +2007-04-16 Donal K. Fellows + + * various (including generic/tclTest.c): Complete the purge of K&R + function definitions from manually-written code. + +2007-04-15 Kevin B. Kenny + + * generic/tclCompCmds.c: added a cast to silence a compiler error on + VC2005. + * library/clock.tcl: Restored unique-prefix matching of keywords on + the [clock] command. [Bug 1690041] + * tests/clock.test: Added rudimentary test cases for unique-prefix + matching of keywords. + +2007-04-14 Miguel Sofer + + * generic/tclExecute.c: removed some code at INST_EXPAND_SKTOP that + duplicates functionality already present at checkForCatch. + +2007-04-12 Miguel Sofer + + * generic/tclExecute.c: new macros OBJ_AT_TOS, OBJ_UNDER_TOS, + OBJ_AT_DEPTH(n) and CURR_DEPTH that remove all direct references to + tosPtr from TEBC (after initialisation and the code at the label + cleanupV_pushObjResultPtr). + +2007-04-11 Miguel Sofer + + * generic/tclCompCmds.c: moved all exceptDepth management to the + macros - the decreasing half was managed by hand. + +2007-04-10 Donal K. Fellows + + * generic/tclInt.h (TclNewLiteralStringObj): New macro to make + allocating literal string objects (i.e. objects whose value is a + constant string) easier and more efficient, by allowing the omission + of the length argument. Based on [Patch 1529526] (afredd) + * generic/*.c: Make use of this (in many files). + +2007-04-08 Miguel Sofer + + * generic/tclCompile (tclInstructionTable): Fixed bugs in description + of dict instructions. + +2007-04-07 Miguel Sofer + + * generic/tclCompile (tclInstructionTable): Fixed bug in description + of INST_START_COMMAND. + + * generic/tclExecute.c (TEBC): Small code reduction. + +2007-04-06 Miguel Sofer + + * generic/tclExecute.c (TEBC): + * generic/tclNamespace.c (NsEnsembleImplementationCmd): + * generic/tclProc.c (InitCompiledLocals, ObjInterpProcEx) + (TclObjInterpProcCore, ProcCompileProc): Code reordering to reduce + branching and improve branch prediction (assume that forward branches + are typically not taken). + +2007-04-03 Miguel Sofer + + * generic/tclExecute.c: INST_INVOKE optimisation. [Patch 1693802] + +2007-04-03 Don Porter + + * generic/tclNamesp.c: Revised ErrorCodeRead and ErrorInfoRead trace + routines so they guarantee the ::errorCode and ::errorInfo variable + always appear to exist. [Bug 1693252] + +2007-04-03 Miguel Sofer + + * generic/tclInt.decls: Moved TclGetNamespaceFromObj() to the + * generic/tclInt.h: internal stubs table; regen. + * generic/tclIntDecls.h: + * generic/tclStubInit.c: + +2007-04-02 Miguel Sofer + + * generic/tclBasic.c: Added bytecode compilers for the variable + * generic/tclCompCmds.c: linking commands: 'global', 'variable', + * generic/tclCompile.h: 'upvar', 'namespace upvar' [Patch 1688593] + * generic/tclExecute.c: + * generic/tclInt.h: + * generic/tclVar.c: + +2007-04-02 Don Porter + + * generic/tclBasic.c: Replace arrays on the C stack and ckalloc + * generic/tclExecute.c: calls with TclStackAlloc calls to use memory + * generic/tclFCmd.c: on Tcl's evaluation stack. + * generic/tclFileName.c: + * generic/tclIOCmd.c: + * generic/tclIndexObj.c: + * generic/tclInterp.c: + * generic/tclNamesp.c: + * generic/tclTrace.c: + * unix/tclUnixPipe.c: + +2007-04-01 Donal K. Fellows + + * generic/tclCompile.c (TclCompileScript, TclPrintInstruction): + * generic/tclExecute.c (TclExecuteByteCode): Changed the definition of + INST_START_CMD so that it knows how many commands start at the current + location. This makes the interpreter command counter correct without + requiring a large number of instructions to be issued. (See my change + from 2007-01-19 for what triggered this.) + +2007-03-30 Don Porter + + * generic/tclCompile.c: + * generic/tclCompExpr.c: + * generic/tclCompCmds.c: Replace arrays on the C stack and + ckalloc calls with TclStackAlloc calls to use memory on Tcl's + evaluation stack. + + * generic/tclCmdMZ.c: Revised [string to* $s $first $last] + implementation to reduce number of allocs/copies. + + * tests/string.test: More [string reverse] tests. + +2007-03-30 Miguel Sofer + + * generic/tclExecute.c: optimise the lookup of elements of indexed + arrays. + +2007-03-29 Miguel Sofer + + * generic/tclProc.c (Tcl_ApplyObjCmd): + * tests/apply.test (9.3): Fixed Tcl_Obj leak on error return; an + unneeded ref to lambdaPtr was being set and not released on an error + return path. + +2007-03-28 Don Porter + + * generic/tclCmdMZ.c (STR_REVERSE): Implement the actual [string + reverse] command in terms of the new TclStringObjReverse() routine. + + * generic/tclInt.h (TclStringObjReverse): New internal routine + * generic/tclStringObj.c (TclStringObjReverse): that implements the + [string reverse] operation, making use of knowledge/surgery of the + String intrep to minimize the number of allocs and copies needed to do + the job. + +2007-03-27 Don Porter + + * generic/tclCmdMZ.c (STR_MAP): Replace ckalloc calls with + TclStackAlloc calls. + +2007-03-24 Zoran Vasiljevic + + * win/tclWinThrd.c: Thread exit handler marks the current thread as + un-initialized. This allows exit handlers that are registered later to + re-initialize this subsystem in case they need to use some sync + primitives (cond variables) from this file again. + +2007-03-23 Miguel Sofer + + * generic/tclBasic.c (DeleteInterpProc): pop the root frame pointer + before deleting the global namespace [Bug 1658572] + +2007-03-23 Kevin B. Kenny + + * win/Makefile.in: Added code to keep a Cygwin path name from leaking + into LIBRARY_DIR when doing 'make test' or 'make runtest'. + +2007-03-22 Don Porter + + * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Replaced arrays on the + C stack and ckalloc calls with TclStackAlloc calls to use memory on + Tcl's evaluation stack. + + * generic/tclExecute.c: Revised GrowEvaluationStack to take an + argument specifying the growth required by the caller, so that a + single reallocation / copy is the most that will ever be needed even + when required growth is large. + +2007-03-21 Don Porter + + * generic/tclExecute.c: More ckalloc -> ckrealloc conversions. + * generic/tclLiteral.c: + * generic/tclNamesp.c: + * generic/tclParse.c: + * generic/tclPreserve.c: + * generic/tclStringObj.c: + * generic/tclUtil.c: + +2007-03-20 Don Porter + + * generic/tclEnv.c: Some more ckalloc -> ckrealloc replacements. + * generic/tclLink.c: + +2007-03-20 Kevin B. Kenny + + * generic/tclDate.c: Rebuilt, despite Donal Fellows's comment when + committing it that no rebuild was required. + * generic/tclGetDate.y: According to Donal Fellows, "Introduce modern + formatting standards; no need for rebuild of tclDate.c." + + * library/tzdata/America/Cambridge_Bay: + * library/tzdata/America/Havana: + * library/tzdata/America/Inuvik: + * library/tzdata/America/Iqaluit: + * library/tzdata/America/Pangnirtung: + * library/tzdata/America/Rankin_Inlet: + * library/tzdata/America/Resolute: + * library/tzdata/America/Yellowknife: + * library/tzdata/Asia/Choibalsan: + * library/tzdata/Asia/Dili: + * library/tzdata/Asia/Hovd: + * library/tzdata/Asia/Jakarta: + * library/tzdata/Asia/Jayapura: + * library/tzdata/Asia/Makassar: + * library/tzdata/Asia/Pontianak: + * library/tzdata/Asia/Ulaanbaatar: + * library/tzdata/Europe/Istanbul: Upgraded to Olson's tzdata2007d. + + * generic/tclListObj.c (TclLsetList, TclLsetFlat): + * tests/lset.test: Changes to deal with shared internal representation + for lists passed to the [lset] command. Thanks to Don Porter for + fixing this issue. [Bug 1677512] + +2007-03-19 Don Porter + + * generic/tclCompile.c: Revise the various expansion routines for + CompileEnv fields to use ckrealloc() where appropriate. + + * generic/tclBinary.c (Tcl_SetByteArrayLength): Replaced ckalloc() / + memcpy() sequence with ckrealloc() call. + + * generic/tclBasic.c (Tcl_CreateMathFunc): Replaced some calls to + * generic/tclEvent.c (Tcl_CreateThread): Tcl_Alloc() with calls + * generic/tclObj.c (UpdateStringOfBignum): to ckalloc(), which + * unix/tclUnixTime.c (SetTZIfNecessary): better supports memory + * win/tclAppInit.c (setargv): debugging. + +2007-03-19 Donal K. Fellows + + * doc/regsub.n: Corrected example so that it doesn't recommend + potentially unsafe practice. Many thanks to Konstantin Kushnir + for reporting this. + +2007-03-17 Kevin B. Kenny + + * win/tclWinReg.c (GetKeyNames): Size the buffer for enumerating key + names correctly, so that Unicode names exceeding 127 chars can be + retrieved without crashing. [Bug 1682211] + * tests/registry.test (registry-4.9): Added test case for the above + bug. + +2007-03-15 Mo DeJong + + * generic/tclIOUtil.c (Tcl_Stat): Reimplement workaround to avoid gcc + warning by using local variables. When the macro argument is of type + long long instead of long, the incorrect warning is not generated. + +2007-03-15 Mo DeJong + + * win/Makefile.in: Fully qualify LIBRARY_DIR so that `make test` does + not depend on working dir. + +2007-03-15 Mo DeJong + + * tests/parse.test: Add two backslash newline parse tests. + +2007-03-12 Don Porter + + * generic/tclExecute.c (INST_FOREACH_STEP4): Make private copy of + * tests/foreach.test (foreach-10.1): value list to be assigned to + variables so that shimmering of that list doesn't lead to invalid + pointers. [Bug 1671087] + + * generic/tclEvent.c (HandleBgErrors): Make efficient private copy + * tests/event.test (event-5.3): of the command prefix for the interp's + background error handling command to avoid panics due to pointers to + memory invalid after shimmering. [Bug 1670155] + + * generic/tclNamesp.c (NsEnsembleImplementationCmd): Make efficient + * tests/namespace.test (namespace-42.8): private copy of the + command prefix as we invoke the command appropriate to a particular + subcommand of a particular ensemble to avoid panic due to shimmering + of the List intrep. [Bug 1670091] + + * generic/tclVar.c (TclArraySet): Make efficient private copy of + * tests/var.test (var-17.1): the "list" argument to [array set] to + avoid crash due to shimmering invalidating pointers. [Bug 1669489] + +2007-03-12 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LsortObjCmd): Fix problems with declaration + positioning and memory leaks. [Bug 1679072] + +2007-03-11 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Ensure that a list is + correctly reversed even if its internal representation is shared + without the object itself being shared. [Bug 1675044] + +2007-03-10 Miguel Sofer + + * generic/tclCmdIL (Tcl_LsortObjCmd): changed fix to [Bug 1675116] to + use the cheaper TclListObjCopy() instead of Tcl_DuplicateObj(). + +2007-03-09 Andreas Kupries + + * library/platform/shell.tcl: Made more robust if an older platform + * library/platform/pkgIndex.tcl: package is present in the inspected + * unix/Makefile.in: shell. Package forget it to prevent errors. Bumped + * win/Makefile.in: package version to 1.1.3, and updated the Makefiles + installing it as Tcl Module. + +2007-03-09 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LsortObjCmd): Handle tricky case with loss + * tests/cmdIL.test (cmdIL-1.29): of list rep during sorting due + to shimmering. [Bug 1675116] + +2007-03-09 Kevin B. Kenny + + * library/clock.tcl (ReadZoneinfoFile): Added Y2038 compliance to the + code for version-2 'zoneinfo' files. + * tests/clock.test (clock-56.3): Added a test case for Y2038 and + 'zoneinfo'. Modified test initialisation to use the + 'loadTestedCommands' function of tcltest to bring in the correct path + for the registry library. + +2007-03-08 Don Porter + + * generic/tclListObj.c (TclLsetList): Rewrite so that the routine + itself does not do any direct intrep surgery. Better isolates those + things into the implementation of the "list" Tcl_ObjType. + +2007-03-08 Donal K. Fellows + + * generic/tclListObj.c (TclLindexList, TclLindexFlat): Moved these + functions to tclListObj.c from tclCmdIL.c to mirror the way that the + equivalent functions for [lset]'s guts are arranged. + +2007-03-08 Kevin B. Kenny + + * library/clock.tcl: Further tweaks to the Windows time zone table + (restoring missing Mexican time zones). Added rudimentary handling of + version-2 'zoneinfo' files. Update US DST rules so that zones such as + 'EST5EDT' get the correct transition dates. + * tests/clock.test: Added rudimentary test cases for 'zoneinfo' + parsing. Adjusted several tests that depended on obsolete US DST + transition rules. + +2007-03-07 Daniel Steffen + + * macosx/tclMacOSXNotify.c: add spinlock debugging and sanity checks. + + * macosx/Tcl.xcodeproj/project.pbxproj: ensure gcc version used by + * macosx/Tcl.xcodeproj/default.pbxuser: Xcode and configure/make are + * macosx/Tcl-Common.xcconfig: consistent and independent of + gcc_select default and CC env var; fixes for Xcode 3.0. + + * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check + * unix/configure: autoconf-2.59 + +2007-03-07 Don Porter + + * generic/tclCmdIL.c (TclLindex*): Rewrites to make efficient + private copies of the list and indexlist arguments, so we can operate + on the list elements directly with no fear of shimmering effects. + Replaces defensive coding schemes that are otherwise required. End + result is that TclLindexList is entirely a wrapper around + TclLindexFlat, which is now the core engine of all [lindex] + operations. + + * generic/tclObj.c (Tcl_AppendAllObjTypes): Converted to simpler + list validity test. + +2007-03-07 Donal K. Fellows + + * generic/tclRegexp.c (TclRegAbout): Generate information about a + regexp as a Tcl_Obj instead of as a string, which is more efficient. + +2007-03-07 Kevin B. Kenny + + * library/clock.tcl: Adjusted Windows time zone table to handle new US + DST rules by locale rather than as Posix time zone spec. + * tests/clock.test (clock-39.6, clock-49.2, testclock::registry): + Adjusted tests to simulate new US rules. + * library/tzdata/America/Indiana/Winamac: + * library/tzdata/Europe/Istanbul: + * library/tzdata/Pacific/Easter: + Olson's tzdata2007c. + +2007-03-05 Andreas Kupries + + * library/platform/shell.tcl (::platform::shell::RUN): In the case of + * library/platform/pkgIndex.tcl: a failure put the captured stderr + * unix/Makefile.in: into the error message to aid in debugging. Bumped + * win/Makefile.in: package version to 1.1.2, and updated the makefiles + installing it as Tcl Module. + +2007-03-03 Donal K. Fellows + + * generic/tclLink.c (LinkedVar): Added macro to conceal at least some + of the pointer hackery. + +2007-03-02 Don Porter + + * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Added missing + TclInvalidateStringRep() call when we directly manipulate the intrep + of an unshared "list" Tcl_Obj. [Bug 1672585] + + * generic/tclCmdIL.c (Tcl_JoinObjCmd): Revised [join] implementation + to append Tcl_Obj's instead of strings. [RFE 1669420] + + * generic/tclCmdIL.c (Info*Cmd): Code simplifications and + optimizations. + +2007-03-02 Donal K. Fellows + + * generic/tclCompile.c (TclPrintInstruction): Added a scheme to allow + * generic/tclCompile.h (AuxDataPrintProc): aux-data to be printed + * generic/tclCompCmds.c (Print*Info): out for debugging. For + this to work, immediate operands referring to aux-data must be + identified as such in the instruction descriptor table using + OPERAND_AUX4 (all are always 4 bytes). + + * generic/tclExecute.c (TclExecuteByteCode): Rewrote the compiled + * generic/tclCompCmds.c (TclCompileDictCmd): [dict update] so that it + * generic/tclCompile.h (DictUpdateInfo): stores critical + * tests/dict.test (dict-21.{14,15}): non-varying data in an + aux-data value instead of a (shimmerable) literal. [Bug 1671001] + +2007-03-01 Don Porter + + * generic/tclCmdIL.c (Tcl_LinsertObjCmd): Code simplifications + and optimizations. + + * generic/tclCmdIL.c (Tcl_LreplaceObjCmd): Code simplifications + and optimizations. + + * generic/tclCmdIL.c (Tcl_LrangeObjCmd): Rewrite in the same + spirit; avoid shimmer effects rather than react to them. + + * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Stop throwing away + * tests/foreach.test (foreach-1.14): useful error information when + loop variable sets fail. + + * generic/tclCmdIL.c (Tcl_LassignObjCmd): Rewrite to make an + efficient private copy of the list argument, so we can operate on the + list elements directly with no fear of shimmering effects. Replaces + defensive coding schemes that are otherwise required. + + * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Rewrite to make + efficient private copies of the variable and value lists, so we can + operate on them without any special shimmer defense coding schemes. + +2007-03-01 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileForeachCmd): Prevent an unexpected + * tests/foreach.test (foreach-9.1): infinite loop when the + variable list is empty and the foreach is compiled. [Bug 1671138] + +2007-02-26 Andreas Kupries + + * generic/tclIORChan.c (FreeReflectedChannel): Added the missing + refcount release between NewRC and FreeRC for the channel handle + object, spotted by Don Porter. [Bug 1667990] + +2007-02-26 Don Porter + + * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Removed surplus + copying of the objv array that used to be a workaround for [Bug + 404865]. That bug is long fixed. + +2007-02-24 Don Porter + + * generic/tclBasic.c: Use new interface in Tcl_EvalObjEx so that the + recounting logic of the List internal rep need not be repeated there. + Better encapsulation of internal details. + + * generic/tclInt.h: New internal routine TclListObjCopy() used + * generic/tclListObj.c: to efficiently do the equivalent of [lrange + $list 0 end]. After some experience with this, might be a good + candidate for exposure as a public interface. It's useful for callers + of Tcl_ListObjGetElements() who want to control the ongoing validity + of the returned objv pointer. + +2007-02-22 Andreas Kupries + + * tests/pkg.test: Added tests for the case of an alpha package + satisfying a require for the regular package, demonstrating a corner + case specified in TIP#280. More notes in the comments to the test. + +2007-02-20 Jan Nijtmans + + * generic/tclInt.decls: Added "const" specifiers in TclSockGetPort + * generic/tclIntDecls.h: regenerated + * generic/*.c: + * unix/tclUnixChan.c + * unix/tclUnixPipe.c + * win/tclWinPipe.c + * win/tclWinSock.c: Added many "const" specifiers in implementation. + +2007-02-20 Don Porter + + * doc/tcltest.n: Typo fix. [Bug 1663539] + +2007-02-20 Pat Thoyts + + * generic/tclFileName.c: Handle extended paths on Windows NT and + * generic/tclPathObj.c: above. These have a \\?\ prefix. [Bug + * win/tclWinFile.c: 1479814] + * tests/winFCmd.test: Tests for extended path handling. + +2007-02-19 Jeff Hobbs + + * unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch. + * unix/configure: autoconf-2.59 + + * generic/tclIOUtil.c (Tcl_FSEvalFileEx): safe incr of objPtr ref. + +2007-02-18 Donal K. Fellows + + * doc/chan.n, doc/clock.n, doc/eval.n, doc/exit.n, doc/expr.n: + * doc/interp.n, doc/open.n, doc/platform_shell.n, doc/pwd.n: + * doc/refchan.n, doc/regsub.n, doc/scan.n, doc/tclvars.n, doc/tm.n: + * doc/unload.n: Apply [Bug 1610310] to fix typos. Thanks to Larry + Virden for spotting them. + + * doc/interp.n: Partial fix of [Bug 1662436]; rest requires some + policy decisions on what should and shouldn't be safe commands from + the "new in 8.5" set. + +2007-02-13 Kevin B. Kenny + + * tools/fix_tommath_h.tcl: Further tweaking for the x86-64. The change + is to make 'mp_digit' be an 'unsigned int' on that platform; since + we're using only 32 bits of it, there's no reason to make it a 64-bit + 'unsigned long.' + * generic/tclTomMath.h: Regenerated. + +2007-02-13 Donal K. Fellows + + * doc/re_syntax.n: Corrected description of 'print' class [Bug + 1614687] and enhanced description of 'graph' class. + +2007-02-12 Kevin B. Kenny + + * tools/fix_tommath_h.tcl: Added code to patch out a check for + __x86_64__ that caused Tommath to use __attributes(TI)__ for the + mp_word type. Tetra-int's simply fail on too many gcc-glibc-OS + combinations to be ready for shipment today, even if they work for + some of us. This change allows reversion of das's change of 2006-08-18 + that accomplised the same thing on Darwin. [Bugs 1601380, 1603737, + 1609936, 1656265] + * generic/tclTomMath.h: Regenerated. + * library/tzdata/Africa/Asmara: + * library/tzdata/Africa/Asmera: + * library/tzdata/America/Nassau: + * library/tzdata/Atlantic/Faeroe: + * library/tzdata/Atlantic/Faroe: + * library/tzdata/Australia/Eucla: + * library/tzdata/Pacific/Easter: Rebuilt from Olson's tzdata2007b. + +2007-02-09 Joe Mistachkin + + * win/nmakehlp.c: Properly cleanup after nmakehlp, including the + * win/makefile.vc: vcX0.pch file. + +2007-02-08 Jeff Hobbs + + * unix/tclUnixInit.c (TclpCheckStackSpace): do stack size checks with + unsigned size_t to correctly validate stackSize in the 2^31+ range. + [Bug 1654104] + +2007-02-08 Don Porter + + * generic/tclNamesp.c: Corrected broken logic in Tcl_DeleteNamespace + * tests/namespace.test: introduced in Patch 1577278 that caused + [namespace delete ::] to be effective only at level #0. New test + namespace-7.7 should prevent similar error in the future [Bug 1655305] + +2007-02-06 Don Porter + + * generic/tclNamesp.c: Corrected broken implementation of the + * tests/namespace.test: TclMatchIsTrivial optimization on [namespace + children $namespace $pattern]. + +2007-02-04 Daniel Steffen + + * unix/tcl.m4: use gcc4's __attribute__((__visibility__("hidden"))) if + available to define MODULE_SCOPE effective on all platforms. + * unix/configure.in: add caching to -pipe and zoneinfo checks. + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2007-02-03 Joe Mistachkin + + * win/rules.vc: Fix platform specific file copy macros for downlevel + Windows. + +2007-01-29 Don Porter + + * generic/tclResult.c: Added optimization case to TclTransferResult to + cover common case where there's big savings over the fully general + path. Thanks to Peter MacDonald. [Bug 1626518] + + * generic/tclLink.c: Broken linked float logic corrected. Thanks to + Andy Goth. [Bug 1602538] + + * doc/fcopy.n: Typo fix. [Bug 1630627] + +2007-01-28 Daniel Steffen + + * macosx/Tcl.xcodeproj/project.pbxproj: extract build settings that + * macosx/Tcl.xcodeproj/default.pbxuser: were common to multiple + * macosx/Tcl-Common.xcconfig (new file): configurations into external + * macosx/Tcl-Debug.xcconfig (new file): xcconfig files; add extra + * macosx/Tcl-Release.xcconfig (new file): configurations for building + with SDKs and 64bit; convert legacy jam-based 'Tcl' target to native + target with single script phase; correct syntax of build setting + references to use $() throughout. + + * macosx/README: document new Tcl.xcodeproj configurations; other + minor updates/corrections. + + * generic/tcl.h: update location of version numbers in macosx files. + + * macosx/Tcl.xcode/project.pbxproj: restore 'tcltest' target to + * macosx/Tcl.xcode/default.pbxuser: working order by replicating + applicable changes to Tcl.xcodeproj since 2006-07-20. + +2007-01-25 Daniel Steffen + + * unix/tcl.m4: integrate CPPFLAGS into CFLAGS as late as possible and + move (rather than duplicate) -isysroot flags from CFLAGS to CPPFLAGS + to avoid errors about multiple -isysroot flags from some older gcc + builds. + + * unix/configure: autoconf-2.59 + +2007-01-22 Donal K. Fellows + + * compat/memcmp.c (memcmp): Reworked so that arithmetic is never + performed upon void pointers, since that is illegal. [Bug 1631017] + +2007-01-19 Donal K. Fellows + + * generic/tclCompile.c (TclCompileScript): Reduce the frequency with + which we issue INST_START_CMD, making bytecode both more compact and + somewhat faster. The optimized case is where we would otherwise be + issuing a sequence of those instructions; in those cases, it is only + ever the first one encountered that could possibly trigger. + +2007-01-19 Joe Mistachkin + + * tools/man2tcl.c: Include stdlib.h for exit() and improve comment + detection. + * win/nmakehlp.c: Update usage. + * win/makefile.vc: Properly build man2tcl.c for MSVC8. + +2007-01-19 Daniel Steffen + + * macosx/tclMacOSXFCmd.c (TclMacOSXSetFileAttribute): on some versions + of Mac OS X, truncate() fails on resource forks, in that case use + open() with O_TRUNC instead. + + * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of + OSSpinLock(Un)Lock API. + + * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars + * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running + testsuite from Xcode. + + * tests/env.test: add extra system env vars that need to be preserved + on some Mac OS X versions for testsuite to work. + + * unix/Makefile.in: Move libtommath defines into configure.in to + * unix/configure.in: avoid replicating them across multiple + * macosx/Tcl.xcodeproj/project.pbxproj: buildsystems. + + * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] + (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS + when present in CFLAGS to avoid discrepancies between what headers + configure sees during preprocessing tests and compiling tests. + + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2007-01-18 Donal K. Fellows + + * generic/tclCompile.c (TclCompileScript): Make sure that when parsing + an expanded literal fails, a correct bytecode sequence is still + issued. [Bug 1638414]. Also make sure that the start of the expansion + bytecode sequence falls inside the span of bytecodes for a command. + * tests/compile.test (compile-16.24): Added test for [Bug 1638414] + +2007-01-17 Donal K. Fellows + + * generic/tclIO.c: Added macros to make usage of ChannelBuffers + clearer. + +2007-01-11 Joe English + + * win/tcl.m4(CFLAGS_WARNING): Remove "-Wconversion". This was removed + from unix/tcl.m4 2004-07-16 but not from here. + * win/configure: Regenerated. + +2007-01-11 Pat Thoyts + + * win/makefile.vc: Fixes to work better on Win98. Read version numbers + * win/nmakehlp.c: from package index file to avoid keeping numbers in + * win/rules.vc: the makefile where they may become de-synchronized. + +2007-01-10 Donal K. Fellows + + * generic/regcomp.c (compile, freev): Define a strategy for + * generic/regexec.c (exec): managing the internal + * generic/regguts.h (AllocVars, FreeVars): vars of the RE engine to + * generic/regcustom.h (AllocVars, FreeVars): reduce C stack usage. + This will make Tcl as a whole much less likely to run out of stack + space... + +2007-01-09 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileLindexCmd): + * tests/lindex.test (lindex-9.2): Fix silly bug that ended up + sometimes compiling list arguments in the wrong order. [Bug 1631364] + +2007-01-03 Kevin B. Kenny + + * generic/tclDate.c: Regenerated to recover a lost fix from patthoyts. + [Bug 1618523] + +2006-12-26 Mo DeJong + + * generic/tclIO.c (Tcl_GetsObj): Avoid checking for for the LF in a + possible CRLF sequence when EOF has already been found. + +2006-12-26 Mo DeJong + + * generic/tclEncoding.c (EscapeFromUtfProc): Clear the + TCL_ENCODING_END flag when end bytes are written. This fix keep this + method from writing escape bytes for an encoding like iso2022-jp + multiple times when the escape byte overlap with the end of the IO + buffer. + * tests/io.test: Add test for escape byte overlap issue. + +2006-12-19 Donal K. Fellows + + * unix/tclUnixThrd.c (Tcl_GetAllocMutex, TclpNewAllocMutex): Add + intermediate variables to shut up unwanted warnings. [Bug 1618838] + +2006-12-19 Daniel Steffen + + * unix/tclUnixThrd.c (TclpInetNtoa): fix for 64 bit. + + * unix/tcl.m4 (Darwin): --enable-64bit: verify linking with 64bit + -arch flag succeeds before enabling 64bit build. + * unix/configure: autoconf-2.59 + +2006-12-17 Daniel Steffen + + * tests/macOSXLoad.test (new file): add testing of .bundle loading and + * tests/load.test: unloading on Darwin (in addition + * tests/unload.test: to existing tests of .dylib + loading). + * macosx/Tcl.xcodeproj/project.pbxproj: add building of dltest + binaries so that testsuite run from Xcode can use them; fix testsuite + run script + * unix/configure.in: add support for building dltest binaries as + * unix/dltest/Makefile.in: .bundle (in addition to .dylib) on Darwin. + * unix/Makefile.in: add stub lib dependency to dltest target. + * unix/configure: autoconf-2.59 + + * tests/append.test: fix cleanup failure when all tests are skipped. + + * tests/chan.test (chan-16.9): cleanup chan event handler to avoid + causing error in event.test when running testsuite with -singleproc 1. + + * tests/info.test: add !singleTestInterp constraint to tests that fail + when running testsuite with -singleproc 1. [Bug 1605269] + +2006-12-14 Donal K. Fellows + + * doc/string.n: Fix example. [Bug 1615277] + +2006-12-12 Don Porter + + * generic/tclCompExpr.c: Now that the new internal structs are + in use to support operator commands, might as well make them the + default for [expr] as well and avoid passing every parsed expression + through the inefficient Tcl_Token array format. This addresses most + issues in [RFE 1517602]. Assuming no performance disasters result from + this, much dead code supporting the other implementation might now be + removed. + + * generic/tclBasic.c: Final step routing all direct evaluation forms + * generic/tclCompExpr.c: of the operator commands through TEBC, + * generic/tclCompile.h: dropping all the routines in tclMathOp.c. + * generic/tclMathOp.c: Still needs Engineering Manual attention. + +2006-12-11 Don Porter + + * generic/tclBasic.c: Another step with all sorting operator + * generic/tclCompExpr.c: commands now routing through TEBC via + * generic/tclCompile.h: TclSortingOpCmd(). + +2006-12-08 Don Porter + + * generic/tclBasic.c: Another step down the path of re-using + * generic/tclCompExpr.c: TclExecuteByteCode to implement the TIP 174 + * generic/tclCompile.h: commands instead of using a mass of code + * generic/tclMathOp.c: duplication. Now all operator commands that + * tests/mathop.test: demand exactly one operation are implemented + via TclSingleOpCmd and a call to TEBC. + + * generic/tclCompExpr.c: Revised implementation of TclInvertOpCmd to + * generic/tclMathOp.c: perform a bytecode compile / execute sequence. + This demonstrates a path toward avoiding mountains of code duplication + in tclMathOp.c and tclExecute.c. + + * generic/tclCompile.h: Change TclExecuteByteCode() from static to + * generic/tclExecute.c: MODULE_SCOPE so all files including + tclCompile.h may call it. + + * generic/tclMathOp.c: More revisions to make tests pass. + * tests/mathop.test: + +2006-12-08 Donal K. Fellows + + * generic/tclNamesp.c (TclTeardownNamespace): Ensure that dying + namespaces unstitch themselves from their referents. [Bug 1571056] + (NsEnsembleImplementationCmd): Silence GCC warning. + + * tests/mathop.test: Full tests for & | and ^ operators + +2006-12-08 Daniel Steffen + + * library/tcltest/tcltest.tcl: use [info frame] for "-verbose line". + +2006-12-07 Don Porter + + * generic/tclCompCmds.c: Additional commits correct most + * generic/tclExecute.c: failing tests illustrating bugs + * generic/tclMathOp.c: uncovered in [Patch 1578137]. + + * generic/tclBasic.c: Biggest source of TIP 174 failures was that + the commands were not [namespace export]ed from the ::tcl::mathop + namespace. More bits from [Patch 1578137] correct that. + + * tests/mathop.test: Commmitted several new tests from Peter Spjuth + found in [Patch 1578137]. Many failures now demonstrate issues to fix + in the TIP 174 implementation. + +2006-12-07 Donal K. Fellows + + * tests/mathop.test: Added tests for ! ~ eq operators. + * generic/tclMathOp.c (TclInvertOpCmd): Add in check for non-integral + numeric values. + * generic/tclCompCmds.c (CompileCompareOpCmd): Factor out the code + generation for the chained comparison operators. + +2006-12-07 Pat Thoyts + + * tests/exec.test: Fixed line endings (caused win32 problems). + +2006-12-06 Don Porter + + * generic/tclCompCmds.c: Revised and consolidated into utility + * tests/mathop.test: routines some of routines that compile + the new TIP 174 commands. This corrects some known bugs. More to come. + +2006-12-06 Kevin B. Kenny + + * tests/expr.test (expr-47.12): Improved error reporting in hopes of + having more information to pursue [Bug 1609936]. + +2006-12-05 Andreas Kupries + + TIP#291 IMPLEMENTATION + + * generic/tclBasic.c: Define tcl_platform element for pointerSize. + * doc/tclvars.n: + + * win/Makefile.in: Added installation instructions for the platform + * win/makefile.vc: package. Added the platform package. + * win/makefile.bc: + * unix/Makefile.in: + + * tests/platform.test: + * tests/safe.test: + + * library/platform/platform.tcl: + * library/platform/shell.tcl: + * library/platform/pkgIndex.tcl: + + * doc/platform.n: + * doc/platform_shell.n: + +2006-12-05 Don Porter + + * generic/tclPkg.c: When no requirements are supplied to a + * tests/pkg.test: [package require $pkg] and [package unknown] + is invoked to find a satisfying package, pass the requirement argument + "0-" (which means all versions are acceptable). This permits a + registered [package unknown] command to call [package vsatisfies + $testVersion {*}$args] without any special handling of the empty $args + case. This fixes/avoids a bug in [::tcl::tm::UnknownHandler] that was + causing old TM versions to be provided in preference to newer TM + versions. Thanks to Julian Noble for discovering the issue. + +2006-12-04 Donal K. Fellows + + TIP#267 IMPLEMENTATION + + * generic/tclIOCmd.c (Tcl_ExecObjCmd): Added -ignorestderr option, + * tests/exec.test, doc/exec.n: loosely from [Patch 1476191] + +2006-12-04 Don Porter + + * generic/tclCompExpr.c: Added implementation for the + CompileExprTree() routine that can produce expression bytecode + directly from internal structures with no need to pass through the + Tcl_Token array representation. Still disabled by default. #undef + USE_EXPR_TOKENS to try it out. + +2006-12-03 Don Porter + + * generic/tclCompExpr.c: Added expr parsing routines that + produce a different set of internal structures representing the parsed + expression, as well as routines that go on to convert those structures + into the traditional Tcl_Token array format. Use of these routines is + currently disabled. #undef PARSE_DIRECT_EXPR_TOKENS to enable them. + These routines will only become really useful when more routines that + compile directly from the new internal structures are completed. + +2006-12-02 Donal K. Fellows + + * doc/file.n: Clarification of [file pathtype] docs. [Bug 1606454] + +2006-12-01 Kevin B. Kenny + + * libtommath/bn_mp_add.c: Corrected the effects of a + * libtommath/bn_mp_div.c: bollixed 'cvs merge' operation + * libtommath/bncore.c: that inadvertently committed some + * libtommath/tommath_class.h: half-developed code. + + TIP#299 IMPLEMENTATION + + * doc/mathfunc.n: Added isqrt() function to docs + * generic/tclBasic.c: Added isqrt() math function (ExprIsqrtFunc) + * tests/expr.test (expr-47.*): Added tests for isqrt() + * tests/info.test (info-20.2): Added isqrt() to expected math funcs. + +2006-12-01 Don Porter + + * tests/chan.test: Correct timing sensitivity in new test. [Bug + 1606860] + + TIP#287 IMPLEMENTATION + + * doc/chan.n: New subcommand [chan pending]. + * generic/tclBasic.c: Thanks to Michael Cleverly for proposal + * generic/tclInt.h: and implementation. + * generic/tclIOCmd.c: + * library/init.tcl: + * tests/chan.test: + * tests/ioCmd.test: + + TIP#298 IMPLEMENTATION + + * generic/tcl.decls: Tcl_GetBignumAndClearObj -> Tcl_TakeBignumFromObj + * generic/tclObj.c: + + * generic/tclDecls.h: make genstubs + * generic/tclStubInit.c: + + * generic/tclExecute.c: Update callers. + * generic/tclMathOp.c: + +2006-11-30 Kevin B. Kenny + + * library/tzdata: Olson's tzdata2006p. + * libtommath/bn_mp_sqrt.c: Fixed a bug where the initial approximation + to the square root could be on the wrong side, causing failure of + convergence. + +2006-11-29 Don Porter + + * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Added + Tcl_DecrRefCount() on the objPtr argument to plug memory leaks. This + makes the routine a consumer, which makes it easiest to use. + +2006-11-28 Andreas Kupries + + * generic/tclBasic.c: TIP #280 implementation. + * generic/tclCmdAH.c: + * generic/tclCmdIL.c: + * generic/tclCmdMZ.c: + * generic/tclCompCmds.c: + * generic/tclCompExpr.c: + * generic/tclCompile.c: + * generic/tclCompile.h: + * generic/tclExecute.c: + * generic/tclIOUtil.c: + * generic/tclInt.h: + * generic/tclInterp.c: + * generic/tclNamesp.c: + * generic/tclObj.c: + * generic/tclProc.c: + * tests/compile.test: + * tests/info.test: + * tests/platform.test: + * tests/safe.test: + +2006-11-27 Kevin B. Kenny + + * unix/tclUnixChan.c (TclUnixWaitForFile): + * tests/event.test (event-14.*): Corrected a bug where + TclUnixWaitForFile would present select() with the wrong mask on an + LP64 machine if a fd number exceeds 32. Thanks to Jean-Luc Fontaine + for reporting and diagnosing. [Bug 1602208] + +2006-11-27 Don Porter + + * generic/tclExecute.c (TclIncrObj): Correct failure to detect + floating-point increment values. Thanks to William Coleda [Bug + 1602991] + +2006-11-26 Donal K. Fellows + + * tests/mathop.test, doc/mathop.n: More bits and pieces of the TIP#174 + implementation. Note that the test suite is not yet complete. + +2006-11-26 Daniel Steffen + + * unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389] + * unix/configure: autoconf-2.59 [Bug 1230558] + +2006-11-25 Donal K. Fellows + + TIP#174 IMPLEMENTATION + + * generic/tclMathOp.c (new file): Completed the implementation of the + interpreted versions of all the tcl::mathop commands. Moved to a new + file to make tclCompCmds.c more focused in purpose. + +2006-11-23 Donal K. Fellows + + * generic/tclCompCmds.c (Tcl*OpCmd, TclCompile*OpCmd): + * generic/tclBasic.c (Tcl_CreateInterp): Partial implementation of + TIP#174; the commands are compiled, but (mostly) not interpreted yet. + +2006-11-22 Donal K. Fellows + + TIP#269 IMPLEMENTATION + + * generic/tclCmdMZ.c (Tcl_StringObjCmd): Implementation of the [string + * tests/string.test (string-25.*): is list] command, based on + * doc/string.n: work by Joe Mistachkin, with + enhancements by Donal Fellows for better failindex behaviour. + +2006-11-22 Don Porter + + * tools/genWinImage.tcl (removed): Removed two files used in + * win/README.binary (removed): production of binary distributions + for Windows, a task we no longer perform. [Bug 1476980] + * generic/tcl.h: Remove mention of win/README.binary in comment + + * generic/tcl.h: Moved TCL_REG_BOSONLY #define from tcl.h to + * generic/tclInt.h: tclInt.h. Only know user is Expect, which + already #include's tclInt.h. No need to continue greater exposure. + [Bug 926500] + +2006-11-20 Donal K. Fellows + + * generic/tclBasic.c (Tcl_CreateInterp, TclHideUnsafeCommands): + * library/init.tcl: Refactored the [chan] command's guts so that it + does not use aliases to global commands, making the code more robust. + +2006-11-17 Don Porter + + * generic/tclExecute.c (INST_EXPON): Corrected crash on + [expr 2**(1<<63)]. Was operating on cleared bignum Tcl_Obj. + +2006-11-16 Donal K. Fellows + + * doc/apply.n, doc/chan.n: Added examples. + +2006-11-15 Don Porter + + TIP#270 IMPLEMENTATION + + * generic/tcl.decls: New public routines Tcl_ObjPrintf, + * generic/tclStringObj.c: Tcl_AppendObjToErrorInfo, Tcl_Format, + * generic/tclInt.h: Tcl_AppendLimitedToObj, + Tcl_AppendFormatToObj and Tcl_AppendPrintfToObj. Former internal + versions removed. + + * generic/tclDecls.h: make genstubs + * generic/tclStubInit.c: + + * generic/tclBasic.c: Updated callers. + * generic/tclCkalloc.c: + * generic/tclCmdAH.c: + * generic/tclCmdIL.c: + * generic/tclCmdMZ.c: + * generic/tclCompExpr.c: + * generic/tclCompile.c: + * generic/tclDictObj.c: + * generic/tclExecute.c: + * generic/tclIORChan.c: + * generic/tclIOUtil.c: + * generic/tclMain.c: + * generic/tclNamesp.c: + * generic/tclObj.c: + * generic/tclPkg.c: + * generic/tclProc.c: + * generic/tclStrToD.c: + * generic/tclTimer.c: + * generic/tclUtil.c: + * unix/tclUnixFCmd.c: + + * tools/genStubs.tcl: Updated script to no longer produce the + _ANSI_ARGS_ wrapper in generated declarations. Also revised to accept + variadic prototypes with more than one fixed argument. (This is + possible since TCL_VARARGS and its limitations are no longer in use). + * generic/tcl.h: Some reordering so that macro definitions do + not interfere with the now _ANSI_ARGS_-less stub declarations. + + * generic/tclDecls.h: make genstubs + * generic/tclIntDecls.h: + * generic/tclIntPlatDecls.h: + * generic/tclPlatDecls.h: + * generic/tclTomMathDecls.h: + +2006-11-15 Donal K. Fellows + + * doc/ChnlStack.3, doc/CrtObjCmd.3, doc/GetIndex.3, doc/OpenTcp.3: + * doc/chan.n, doc/fconfigure.n, doc/fcopy.n, doc/foreach.n: + * doc/history.n, doc/http.n, doc/library.n, doc/lindex.n: + * doc/lrepeat.n, doc/lreverse.n, doc/pkgMkIndex.n, doc/re_syntax.n: + Convert \fP to \fR so that man-page scrapers have an easier time. + +2006-11-14 Don Porter + + TIP#261 IMPLEMENTATION + + * generic/tclNamesp.c: [namespace import] with 0 arguments + introspects the list of imported commands. + +2006-11-13 Kevin B. Kenny + + * generic/tclThreadStorage.c (Tcl_InitThreadStorage): + (Tcl_FinalizeThreadStorage): Silence a compiler warning about + presenting a volatile pointer to 'memset'. + +2006-11-13 Don Porter + + * generic/tclIO.c: When [gets] on a binary channel needs to use + the "iso8859-1" encoding, save a copy of that encoding per-thread to + avoid repeated freeing and re-loading of it from the file system. This + replaces the cached copy of this encoding that the platform + initialization code used to keep in pre-8.5 releases. + +2006-11-13 Daniel Steffen + + * generic/tclCompExpr.c: Fix gcc warnings about 'cast to/from + * generic/tclEncoding.c: pointer from/to integer of different + * generic/tclEvent.c: size' on 64-bit platforms by casting + * generic/tclExecute.c: to intermediate types + * generic/tclHash.c: intptr_t/uintptr_t via new PTR2INT(), + * generic/tclIO.c: INT2PTR(), PTR2UINT() and UINT2PTR() + * generic/tclInt.h: macros. [Patch 1592791] + * generic/tclProc.c: + * generic/tclTest.c: + * generic/tclThreadStorage.c: + * generic/tclTimer.c: + * generic/tclUtil.c: + * unix/configure.in: + * unix/tclUnixChan.c: + * unix/tclUnixPipe.c: + * unix/tclUnixPort.h: + * unix/tclUnixTest.c: + * unix/tclUnixThrd.c: + + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2006-11-12 Donal K. Fellows + + * generic/tclInt.h, generic/tclInt.decls: Transfer TclPtrMakeUpvar and + TclObjLookupVar to the internal stubs table. + +2006-11-10 Daniel Steffen + + * tests/fCmd.test (fCmd-6.26): fix failure when env(HOME) path + contains symlinks. + + * macosx/Tcl.xcodeproj/project.pbxproj: remove tclParseExpr.c; when + running testsuite from inside Xcdoe, skip stack-3.1 (it only fails + under those circumstances). + + * unix/tcl.m4 (Darwin): suppress linker arch warnings when building + universal for both 32 & 64 bit and no 64bit CoreFoundation is + available; sync with tk tcl.m4 change. + * unix/configure.in: whitespace. + * unix/configure: autoconf-2.59 + +2006-11-09 Don Porter + + * generic/tclParseExpr.c (removed): Moved all the code of + * generic/tclCompExpr.c: tclParseExpr.c into tclCompExpr.c. + * unix/Makefile.in: This sets the stage for expr compiling to work + * win/Makefile.in: directly with the full parse tree structures, + * win/makefile.bc: and not have to pass through the information + * win/makefile.vc: lossy format of an array of Tcl_Tokens. + * win/tcl.dsp: + +2006-11-09 Donal K. Fellows + + TIP#272 IMPLEMENTATION + + * generic/tclCmdMZ.c (Tcl_StringObjCmd): Implementation of the + * tests/string.test, tests/stringComp.test: [string reverse] command + * doc/string.n: from TIP#272. + + * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Implementation of the + * generic/tclBasic.c, generic/tclInt.h: [lreverse] command from + * tests/cmdIL.test (cmdIL-7.*): TIP#272. + * doc/lreverse.n: + +2006-11-08 Donal K. Fellows + + * generic/tclIO.c, generic/tclPkg.c: Style & clarity rewrites. + +2006-11-07 Andreas Kupries + + * unix/tclUnixFCmd.c (CopyFile): Added code to fall back to a + hardwired default block size should the filesystem report a bogus + value. [Bug 1586470] + +2006-11-04 Don Porter + + * generic/tclStringObj.c: Changed Tcl_ObjPrintf() response to an + invalid format specifier string. No longer panics; now produces an + error message as output. + + TIP#274 IMPLEMENTATION + + * generic/tclParseExpr.c: Exponentiation operator is now right + * tests/expr.test: associative. [Patch 1556802] + +2006-11-03 Miguel Sofer + + * generic/tclBasic.c (TEOVI): fix por possible leak of a Command in + the presence of execution traces that delete it. + + * generic/tclBasic.c (TEOVI): + * tests/trace.test (trace-21.11): fix for [Bug 1590232], execution + traces may cause a second command resolution in the wrong namespace. + +2006-11-03 Donal K. Fellows + + * tests/event.test (event-11.5): Rewrote tests to stop Tcl from + * tests/io.test (multiple tests): opening sockets that are + * tests/ioCmd.test (iocmd-15.1,16,17): reachable from outside hosts + * tests/iogt.test (__echo_srv__.tcl): where not necessary. This is + * tests/socket.test (multiple tests): noticably annoying on some + * tests/unixInit.test (unixInit-1.2): systems (e.g., Windows). + +2006-11-02 Daniel Steffen + + * macosx/Tcl.xcodeproj/project.pbxproj: check autoconf/autoheader exit + status and stop build if they fail. + +2006-11-02 Jeff Hobbs + + * doc/ParseCmd.3, doc/Tcl.n, doc/eval.n, doc/exec.n: + * doc/fconfigure.n, doc/interp.n, doc/unknown.n: + * library/auto.tcl, library/init.tcl, library/package.tcl: + * library/safe.tcl, library/tm.tcl, library/msgcat/msgcat.tcl: + * tests/all.tcl, tests/basic.test, tests/cmdInfo.test: + * tests/compile.test, tests/encoding.test, tests/execute.test: + * tests/fCmd.test, tests/http.test, tests/init.test: + * tests/interp.test, tests/io.test, tests/ioUtil.test: + * tests/iogt.test, tests/namespace-old.test, tests/namespace.test: + * tests/parse.test, tests/pkg.test, tests/pkgMkIndex.test: + * tests/proc.test, tests/reg.test, tests/trace.test: + * tests/upvar.test, tests/winConsole.test, tests/winFCmd.test: + * tools/tclZIC.tcl: + * generic/tclParse.c (Tcl_ParseCommand): Replace {expand} with {*} + officially (TIP #293). Leave -DALLOW_EXPAND=0|1 option to keep + {expand} syntax for transition users. [Bug 1589629] + +2006-11-02 Donal K. Fellows + + * generic/tclBasic.c, generic/tclInterp.c, generic/tclProc.c: Silence + warnings from gcc over signed/unsigned and TclStackAlloc(). + * generic/tclCmdMZ.c: Update to more compact and clearer coding style. + +2006-11-02 Don Porter + + * generic/tclCmdAH.c: Further revisions to produce the routines + * generic/tclInt.h: TclFormat() and TclAppendFormatToObj() that + * generic/tclNamesp.c: accept (objc, objv) arguments rather than + * generic/tclStringObj.c: any varargs stuff. + + * generic/tclBasic.c: Further revised TclAppendPrintToObj() and + * generic/tclCkalloc.c: TclObjPrintf() routines to panic when unable + * generic/tclCmdAH.c: to complete their formatting operations, + * generic/tclCmdIL.c: rather than report an error message. This + * generic/tclCmdMZ.c: means an interp argument for error message + * generic/tclDictObj.c: recording is no longer needed, further + * generic/tclExecute.c: simplifying the interface for callers. + * generic/tclIORChan.c: + * generic/tclIOUtil.c: + * generic/tclInt.h: + * generic/tclMain.c: + * generic/tclNamesp.c: + * generic/tclParseExpr.c: + * generic/tclPkg.c: + * generic/tclProc.c: + * generic/tclStringObj.c: + * generic/tclTimer.c: + * generic/tclUtil.c: + * unix/tclUnixFCmd.c: + +2006-11-02 Donal K. Fellows + + * tests/winPipe.test (winpipe-4.[2345]): Made robust when run in + directory with spaces in its name. + + * generic/tclCmdAH.c: Clean up uses of cast NULLs. + + * generic/tclInterp.c (AliasObjCmd): Added more explanatory comments. + + * generic/tclBasic.c (TclEvalObjvInternal): Rewrote so that comments + are relevant and informative once more. Also made the unknown handler + processing use the Tcl execution stack for working space, and not the + general heap. + +2006-11-01 Daniel Steffen + + * unix/tclUnixPort.h: ensure MODULE_SCOPE is defined before use, so + that tclPort.h can once again be included without tclInt.h. + + * generic/tclEnv.c (Darwin): mark _environ symbol as unexported even + when MODULE_SCOPE != __private_extern__. + +2006-10-31 Don Porter + + * generic/tclBasic.c: Refactored and renamed the routines + * generic/tclCkalloc.c: TclObjPrintf, TclFormatObj, and + * generic/tclCmdAH.c: TclFormatToErrorInfo to a new set of routines + * generic/tclCmdIL.c: TclAppendPrintfToObj, TclAppendFormatToObj, + * generic/tclCmdMZ.c: TclObjPrintf, and TclObjFormat, with the + * generic/tclDictObj.c: intent of making the latter list, plus + * generic/tclExecute.c: TclAppendLimitedToObj and + * generic/tclIORChan.c: TclAppendObjToErrorInfo, public via a revised + * generic/tclIOUtil.c: TIP 270. + * generic/tclInt.h: + * generic/tclMain.c: + * generic/tclNamesp.c: + * generic/tclParseExpr.c: + * generic/tclPkg.c: + * generic/tclProc.c: + * generic/tclStringObj.c: + * generic/tclTimer.c: + * generic/tclUtil.c: + * unix/tclUnixFCmd.c: + +2006-10-31 Miguel Sofer + + * generic/tclBasic.c, generic/tcl.h, generic/tclInterp.c: + * generic/tclNamesp.c: removing the flag bit TCL_EVAL_NOREWRITE, the + last remnant of the callObjc/v fiasco. It is not needed, as it is now + always set and checked or'ed with TCL_EVAL_INVOKE. + +2006-10-31 Pat Thoyts + + * win/rules.vc: Fix for [Bug 1582769] - options conflict with VC2003. + +2006-10-31 Donal K. Fellows + + * generic/tclBasic.c, generic/tclNamesp.c, generic/tclProc.c: + * generic/tclInt.h: Removed the callObjc and callObjv fields from the + Interp structure. They did not function correctly and made other parts + of the core amazingly complex, resulting in a substantive change to + [info level] behaviour. [Bug 1587618] + * library/clock.tcl: Removed use of [info level 0] for calculating the + command name as used by the user and replace with a literal. What's + there now is sucky, but at least appears to be right to most users. + * tests/namespace.test (namespace-42.7,namespace-47.1): Reverted + changes to these tests. + * tests/info.test (info-9.11,info-9.12): Added knownBug constraint + since these tests require a different behaviour of [info level] than + is possible because of other dependencies. + +2006-10-30 Jeff Hobbs + + * tools/tcltk-man2html.tcl (option-toc): handle any kind of options + defined toc section (needed for ttk docs) + +2006-10-30 Miguel Sofer + + * generic/tclBasic.c (TEOVI): insured that the interp's callObjc/v + fields are restored after traces run, as they be spoiled. This was + causing a segfault in tcllib's profiler tests. + +2006-10-30 Don Porter + + * generic/tclExecute.c (INST_MOD): Corrected improper testing of the + * tests/expr.test: sign of bignums when applying Tcl's + division rules. Thanks to Peter Spjuth. [Bug 1585704] + +2006-10-29 Miguel Sofer + + * generic/tclNamesp.c (EnsembleImplementationCmd): + * tests/namespace.test (47.7-8): reverted a wrong "optimisation" that + completely broke snit; added two tests. + +2006-10-28 Donal K. Fellows + + * generic/tclProc.c (ObjInterpProcEx, TclObjInterpProcCore): Split the + core of procedures to make it easier to build procedure-like code + without going through horrible contortions. This is the last critical + component to make advanced OO systems workable as simple loadable + extensions. TOIPC is now in the internal stub table. + (MakeProcError, MakeLambdaError): Refactored ProcessProcResultCode to + be simpler, some of which goes to TclObjInterpProcCore, and the rest + of which is now in these far simpler routines which just do errorInfo + stack generation for different types of procedure-like entity. + * tests/apply.test (apply-5.1): Updated to expect the more informative + form of message. + +2006-10-27 Donal K. Fellows + + * generic/tclVar.c (HasLocalVars): New macro to make various bits and + pieces cleaner. + + * generic/tclNamesp.c (TclSetNsPath): Expose SetNsPath() through + internal stubs table with semi-external name. + + * generic/tclInt.h (CallFrame): Add a field for handling context data + for extensions (like object systems) that should be tied to a call + frame (and not a command or interpreter). + + * generic/tclBasic.c (TclRenameCommand): Change to take CONST args; + they were only ever used in a constant way anyway, so this appears to + be a spot that was missed during TIP#27 work. + +2006-10-26 Miguel Sofer + + * generic/tclProc.c (SetLambdaFromAny): minor change, eliminate + redundant call to Tcl_GetString (thanks aku). + + * generic/tclInterp.c (ApplyObjCmd): + * generic/tclNamesp.c (EnsembleImplementationCmd): replaced ckalloc + (heap) with TclStackAlloc (execution stack). + +2006-10-24 Miguel Sofer + + * tests/info.test (info-9.11-12): tests for [Bug 1577492] + * tests/apply.test (apply-4.3-5): tests for [Bug 1574835] + + * generic/tclProc.c (ObjInterpProcEx): disable itcl hacks for calls + from ApplyObjCmd (islambda==1), as they mess apply's error messages + [Bug 1583266] + +2006-10-23 Miguel Sofer + + * generic/tclProc.c (ApplyObjCmd): fix wrong#args for apply by using + the ensemble rewrite engine. [Bug 1574835] + * generic/tclInterp.c (AliasObjCmd): previous commit missed usage of + TCL_EVAL_NOREWRITE for aliases. + + * generic/tclBasic.c (TclEvalObjvInternal): removed redundant check + for ensembles. [Bug 1577628] + + * library/clock.tcl (format, scan): corrected wrong # args messages to + * tests/clock.test (3.1, 34.1): make use of the new rewrite + capabilities of [info level] + + * generic/tcl.h: Lets TEOV update the iPtr->callObj[cv] new + * generic/tclBasic.c: fields, except when the flag bit + * generic/tclInt.h: TCL_EVAL_NOREWRITE is present. These values + * generic/tclNamesp.c: are used by Tcl_PushCallFrame to initialise + * generic/tclProc.c: the frame's obj[cv] fields, and allows + * tests/namespace.test: [info level] to know and use ensemble + rewrites. [Bug 1577492] + + ***POTENTIAL INCOMPATIBILITY*** + The return value from [info level 0] on interp alias calls is changed: + previously returned the target command (including curried values), now + returns the source - what was actually called. + +2006-10-23 Miguel Sofer + + * generic/tcl.h: Modified the Tcl call stack so there is + * generic/tclBasic.c: always a valid CallFrame, even at level 0 + * generic/tclCmdIL.c: [Patch 1577278]. Most of the changes + * generic/tclInt.h: involve removing tests for a NULL + * generic/tclNamesp.c: iPtr->(var)framePtr. There is now a + * generic/tclObj.c: CallFrame pushed at interp creation with a + * generic/tclProc.c: pointer to it stored in iPtr->rootFramePtr. + * generic/tclTrace.c: A second unused field in Interp is + * generic/tclVar.c: hijacked to enable further functionality, + currently unused (but with several FRQs depending on it). + + ***POTENTIAL INCOMPATIBILITY*** + Any user that includes tclInt.h and needs to determine if it is + running at level 0 should change (iPtr->varFramePtr == NULL) to + (iPtr->varFramePtr == iPtr->rootFramePtr). + +2006-10-23 Don Porter + + * README: Bump version number to 8.5a6 + * generic/tcl.h: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/README.binary: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + +2006-10-21 Miguel Sofer + + * generic/tcl.h, generic/tclHash.c: Tcl_FindHashEntry now calls + Tcl_CreateHashEntry with a newPtr set to NULL: this would have caused + a segfault previously and eliminates duplicated code. A macro has been + added to tcl.h (only used when TCL_PRESERVE_BINARY_COMPATABALITY is + not set - i.e., not by default). + +2006-10-20 Reinhard Max + + * unix/configure.in: Added autodetection for OS-supplied timezone + * unix/Makefile.in: files and configure switches to override the + * unix/configure: detected default. + +2006-10-20 Daniel Steffen + + *** 8.5a5 TAGGED FOR RELEASE *** + + * tools/tcltk-man2html.tcl: add support for alpha & beta versions to + useversion glob pattern. [Bug 1579941] + +2006-10-18 Don Porter + + * changes: 8.5a5 release date set + + * doc/Encoding.3: Missing doc updates (mostly Table of + * doc/Ensemble.3: Contents) exposed by `make checkdoc` + * doc/FileSystem.3: + * doc/GetTime.3: + * doc/PkgRequire.3: + +2006-10-17 Miguel Sofer + + * generic/tclInterp.c (ApplyObjCmd): fixed bad error in 2006-10-12 + commit: interp released too early. Spotted by mistachkin. + +2006-10-16 Miguel Sofer + + * tclProc.c (SetLambdaFromAny): + * tests/apply.test (9.1-9.2): plugged intrep leak [Bug 1578454], + found by mjanssen. + +2006-10-16 Andreas Kupries + + * generic/tclBasic.c: Moved TIP#219 cleanup to DeleteInterpProc. + +2006-10-16 Daniel Steffen + + * changes: updates for 8.5a5 release. + + * unix/tclUnixThrd.c (TclpThreadGetStackSize): Darwin: fix for main + thread, where pthread_get_stacksize_np() returns incorrect info. + + * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires. + +2006-10-16 Don Porter + + * generic/tclPkg.c (ExactRequirement): Plugged memory leak. Also + changed Tcl_Alloc()/Tcl_Free() calls to ckalloc()/ckfree() for easier + memory debugging in the future. [Bug 1568373] + + * library/tcltest/tcltest.tcl: Revise tcltest bump to 2.3a1. + * library/tcltest/pkgIndex.tcl: This permits more features to be + * unix/Makefile.in: added to tcltest before we reach version 2.3.0 + * win/Makefile.in: best timed to match the release of Tcl 8.5.0. + * win/makefile.vc: This also serves as a demo of TIP 268 features + +2006-10-13 Colin McCormack + + * win/tclWinFile.c: corrected erroneous attempt to protect against + NULL return from Tcl_FSGetNormalizedPath per [Bug 1548263] causing + [Bug 1575837]. + * win/tclWinFile.c: alfredd supplied patch to fix [Bug 1575837] + +2006-10-13 Daniel Steffen + + * unix/tclUnixThrd.c (TclpThreadGetStackSize): on Darwin, use + * unix/tcl.m4: pthread_get_stacksize_np() API to get thread stack size + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2006-10-12 Miguel Sofer + + * generic/tclInterp.c (ApplyObjCmd): + * tests/interp.test (interp-14.5-10): made [interp alias] use the + ensemble rewrite machinery to produce better error messages [Bug + 1576006] + +2006-10-12 David Gravereaux + + * win/nmakehlp.c: Replaced all wnsprintf() calls with snprintf(). + wnsprintf was not in my shwlapi header file (VC++6) + +2006-10-11 Don Porter + + * generic/tclPkg.c (Tcl_PackageRequireEx): Corrected crash when + argument version=NULL passed in. + +2006-10-10 Don Porter + + * changes: Updates for 8.5a5 release. + + * generic/tclNamespace.c (TclTeardownNamespace): After the + commandPathSourceList of a namespace is cleared, set the + commandPathSourceList to NULL so we don't try to walk the list a + second time, possibly after it is freed. [Bug 1566526] + * tests/namespace.test (namespace-51.16): Added test. + +2006-10-09 Miguel Sofer + + * doc/UpVar.3: brough the docs in accordance to the code. Ever since + 8.0, Tcl_UpVar(2)? accepts TCL_NAMESPACE_ONLY as a flag value, and + var-3.4 tests for proper behaviour. The docs only allowed 0 and + TCL_GLOBAL_ONLY. [Bug 1574099] + +2006-10-09 Miguel Sofer + + * tests/*.test: updated all tests to refer explicitly to the global + variables ::errorInfo, ::errorCode, ::env and ::tcl_platform: many + were relying on the alternative lookup in the global namespace, that + feature is tested specifically in namespace and variable tests. + + The modified testfiles are: apply.test, basic.test, case.test, + cmdIL.test, cmdMZ.test, compExpr-old.test, error.test, eval.test, + event.test, expr.test, fileSystem.test, for.test, http.test, if.test, + incr-old.test, incr.test, interp.test, io.test, ioCmd.test, load.test, + misc.test, namespace.test, parse.test, parseOld.test, pkg.test, + proc-old.test, set.test, switch.test, tcltest.test, thread.test, + var.test, while-old.test, while.test. + +2006-10-06 Pat Thoyts + + * win/rules.vc: [Bug 1571954] avoid /RTCc flag with MSVC8 + +2006-10-06 Pat Thoyts + + * doc/binary.n: TIP #275: Support unsigned values in binary + * generic/tclBinary.c: command. Tests and documentation updated. + * tests/binary.test: + +2006-10-05 Andreas Kupries + + * library/tm.tcl: Fixed bug in TIP #189 implementation, now allowing + '_' in module names. + +2006-10-05 Jeff Hobbs + + * library/http/http.tcl (http::geturl): only do geturl url rfc 3986 + validity checking if $::http::strict is true (default true for 8.5). + [Bug 1560506] + + * generic/tcl.h: note limitation on changing Tcl_UniChar size + * generic/tclEncoding.c (UtfToUnicodeProc, UnicodeToUtfProc): + * tests/encoding.test (encoding-16.1): fix alignment issues in + unicode <> utf conversion procs. [Bug 1122671] + +2006-10-05 Miguel Sofer + + * generic/tclVar.c (Tcl_LappendObjCmd): + * tests/append.test(4.21-22): fix for longstanding [Bug 1570718], + lappending nothing to non-list. Reported by lvirden + +2006-10-04 Kevin B. Kenny + + * tzdata/: Olson's tzdata2006m. + +2006-10-01 Kevin B. Kenny + + * tests/clock.test (clock-49.2): Removed a locale dependency that + caused a spurious failure in the German locale. [Bug 1567956] + +2006-10-01 Miguel Sofer + + * doc/Eval.3 (TclEvalObjv): added note on refCount management for the + elements of objv. [Bug 730244] + +2006-10-01 Pat Thoyts + + * win/tclWinFile.c: Handle possible missing define. + + * win/tclWinFile.c (TclpUtime): [Bug 1420432] file mtime fails for + * tests/cmdAH.test: directories on windows + + * tests/winFile.test: Handle Msys environment a little differently in + getuser function. [Bug 1567956] + +2006-09-30 Miguel Sofer + + * generic/tclUtil.c (Tcl_SplitList): optimisation, [Patch 1344747] by + dgp. + + * generic/tclInt.decls: + * generic/tclInt.h: + * generic/tclIntDecls.h: + * generic/tclObj.c: + * generic/tclStubInit.c: added an internal function TclObjBeingDeleted + to provide info as to the reason for the loss of an internal rep. [FR + 1512138] + + * generic/tclCompile.c: + * generic/tclHistory.c: + * generic/tclInt.h: + * generic/tclProc.c: made Tcl_RecordAndEvalObj not call "history" if + it has been redefined to an empty proc, in order to reduce the noise + when debugging [FR 1190441]. Moved TclCompileNoOp from tclProc.c to + tclCompile.c + +2006-09-28 Andreas Kupries + + * generic/tclPkg.c (CompareVersions): Bugfix. Check string lengths + * tests/pkg.test: before comparison. The shorter string is the smaller + number. Added testcases as well. Interestingly all existing test cases + for vcompare compared numbers of the same length with each other. [Bug + 1563836] + +2006-09-28 Miguel Sofer + + * generic/tclIO.c (Tcl_GetsObj): added two test'n'panic guards for + possible NULL derefs, [Bug 1566382] and coverity #33. + +2006-09-27 Don Porter + + * generic/tclExecute.c: Corrected error in INST_LSHIFT in the + * tests/expr.test: calculation done to determine whether a shift + in the (long int) type is possible. The calculation had literal value + "1" where it needed a value "1L" to compute the correct result. Error + detected via testing with the math::bigfloat package [Bug 1567222] + + * generic/tclPkg.c (CompareVersion): Flatten strcmp() results to + {-1, 0, 1} to match expectations of CompareVersion() callers. + +2006-09-27 Miguel Sofer + + * generic/regc_color.c (singleton): + * generic/regc_cvec.c (addmcce): + * generic/regcomp.c (compile, dovec): the static function addmcce does + nothing when called with two NULL pointers; the only call is by + compile with two NULL pointers (regcomp.c #includes regc_cvec.c). + Large parts (all?) the code for mcce (multi character collating + element) that we do not use is ifdef'ed out with the macro + REGEXP_MCCE_ENABLE. + This silences coverity bugs 7, 16, 80 + + * generic/regc_color.c (uncolorchain): + * generic/regc_nfa.c (freearc): changed tests and asserts to + equivalent formulation, designed to avoid an explicit comparison to + NULL and satisfy coverity that 6 and 9 are not bugs. + +2006-09-27 Andreas Kupries + + * tests/pkg.test: Added test for version comparison at the 32bit + boundary. [Bug 1563836] + + * generic/tclPkg.c: Rewrote CompareVersion to perform string + comparison instead of numeric. This breaks through the 32bit limit on + version numbers. See code for details (handling of leading zeros, + signs, etc.). un-CONSTed some arguments of CompareVersions, + RequirementSatisfied, and AllRequirementsSatisfied. The new compare + modifies the string (temporary string terminators). All callers use + heap-allocated ver-intreps, so we are good with that. [Bug 1563836] + +2006-09-27 Miguel Sofer + + * generic/tclFileName.c (TclGlob): added a panic for a call with + TCL_GLOBMODE_TAILS and pathPrefix==NULL. This would cause a segfault, + as found by coverity #26. + +2006-09-26 Kevin B. Kenny + + * doc/Encoding.3: Added covariant 'const' qualifier for the + * generic/tcl.decls: Tcl_EncodingType argument to + * generic/tclEncoding.c: Tcl_CreateEncoding. [Further TIP#27 work.] + * generic/tclDecls.h: Reran 'make genstubs'. + +2006-09-26 Pat Thoyts + + * win/makefile.vc: Additional compiler flags and amd64 support. + * win/nmakehlp.c: + * win/rules.vc: + +2006-09-26 Don Porter + + * generic/tcl.h: As 2006-09-22 commit from Donal K. Fellows + demonstrates, "#define NULL 0" is just wrong, and as a quotable chat + figure observed, "If NULL isn't defined, we're not using a C compiler" + Improper fallback definition of NULL removed. + +2006-09-25 Pat Thoyts + + * generic/tcl.h: More fixing which struct stat to refer to. + * generic/tclGetDate.y: Some casts from time_t to int required. + * generic/tclTimer.c: Tcl_Time structure members are longs. + * win/makefile.vc: Support for varying compiler options + * win/rules.vc: and build to platform-specific subdirs. + +2006-09-25 Andreas Kupries + + * generic/tclIO.c (Tcl_StackChannel): Fixed [Bug 1564642], aka + coverity #51. Extended loop condition, added checking for NULL to + prevent seg.fault. + +2006-09-25 Andreas Kupries + + * doc/package.n: Fixed nits reported by Daniel Steffen in the TIP#268 + changes. + +2006-09-25 Kevin B. Kenny + + * generic/tclNotify.c (Tcl_DeleteEvents): Simplified the code in hopes + of making the invariants clearer and proving to Coverity that the + event queue memory is managed correctly. + +2006-09-25 Donal K. Fellows + + * generic/tclNotify.c (Tcl_DeleteEvents): Make it clear what happens + when the event queue is mismanaged. [Bug 1564677], coverity bug #10. + +2006-09-24 Miguel Sofer + + * generic/tclParse.c (Tcl_ParseCommand): also return an error if + start==NULL and numBytes<0. This is coverity's bug #20 + + * generic/tclStringObj.c (STRING_SIZE): fix allocation for 0-length + strings. This is coverity's bugs #54-5 + +2006-09-22 Andreas Kupries + + * generic/tclInt.h: Moved TIP#268's field 'packagePrefer' to the end + of the structure, for better backward compatibility. + +2006-09-22 Andreas Kupries + + TIP#268 IMPLEMENTATION + + * generic/tclDecls.h: Regenerated from tcl.decls. + * generic/tclStubInit.c: + + * doc/PkgRequire.3: Documentation of extended API, extended testsuite. + * doc/package.n: + * tests/pkg.test: + + * generic/tcl.decls: Implementation. + * generic/tclBasic.c: + * generic/tclConfig.c: + * generic/tclInt.h: + * generic/tclPkg.c: + * generic/tclTest.c: + * generic/tclTomMathInterface.c: + * library/init.tcl: + * library/package.tcl: + * library/tm.tcl: + +2006-09-22 Donal K. Fellows + + * generic/tclThreadTest.c (TclCreateThread): Use NULL instead of 0 as + end-of-strings marker to Tcl_AppendResult; the difference matters on + 64-bit machines. [Bug 1562528] + +2006-09-21 Don Porter + + * generic/tclUtil.c: Dropped ParseInteger() routine. TclParseNumber + covers the task just fine. + +2006-09-19 Donal K. Fellows + + * generic/tclEvent.c (Tcl_VwaitObjCmd): Rewrite so that an exceeded + limit trapped in a vwait cannot cause a dangerous dangling trace. + +2006-09-19 Don Porter + + * generic/tclExecute.c (INST_EXPON): Native type overflow detection + * tests/expr.test: was completely broken. Falling back on use of + bignums for all non-trivial ** calculations until + native-type-constrained special cases can be done carefully and + correctly. [Bug 1561260] + +2006-09-15 Jeff Hobbs + + * library/http/http.tcl: Change " " -> "+" url encoding mapping + * library/http/pkgIndex.tcl: to " " -> "%20" as per RFC 3986. + * tests/http.test (http-5.1): bump http to 2.5.3 + * unix/Makefile.in: + * win/Makefile.in: + +2006-09-12 Andreas Kupries + + * unix/configure.in (HAVE_MTSAFE_GETHOST*): Modified to recognize + HP-UX 11.00 and beyond as having mt-safe implementations of the + gethost functions. + * unix/configure: Regenerated, using autoconf 2.59 + + * unix/tclUnixCompat.c (PadBuffer): Fixed bug in calculation of the + increment needed to align the pointer, and added documentation + explaining why the macro is implemented as it is. + +2006-09-11 Pat Thoyts + + * win/rules.vc: Updated to install http, tcltest and msgcat as + * win/makefile.vc: Tcl Modules (as per Makefile.in). + * win/makefile.vc: Added tommath_(super)class headers. + +2006-09-11 Andreas Kupries + + * unix/Makefile.in (install-libraries): Fixed typo tcltest 2.3.9 -> + 2.3.0. + +2006-09-11 Daniel Steffen + + * unix/tclUnixCompat.c: make compatLock static and only declare it + when it will actually be used; #ifdef parts of TSD that are not always + needed; adjust #ifdefs to cover all possible cases; fix whitespace. + +2006-09-11 Andreas Kupries + + * tests/msgcat.test: Bumped version in auxiliary files as well. + * doc/msgcat.n: + +2006-09-11 Kevin B. Kenny + + * unix/Makefile.in: Bumped msgcat version to 1.4.2 to be + * win/Makefile.in: consistent with dgp's commits of 2006-09-10. + +2006-09-11 Don Porter + + * library/msgcat/msgcat.tcl: Removed some unneeded [uplevel]s. + +2006-09-10 Don Porter + + * generic/tclExecute.c: Corrected INST_EXPON flaw that treated + * tests/expr.test: $x**1 as $x**3. [Bug 1555371] + + * doc/tcltest.n: Bump to version tcltest 2.3.0 to + * library/tcltest/pkgIndex.tcl: account for new "-verbose line" + * library/tcltest/tcltest.tcl: feature. + * unix/Makefile.in: + * win/Makefile.in: + * win/makefile.bc: + * win/makefile.vc: + + * library/msgcat/msgcat.tcl: Bump to version msgcat 1.4.2 to + * library/msgcat/pkgIndex.tcl: account for modifications. + +2006-09-10 Daniel Steffen + + * library/msgcat/msgcat.tcl (msgcat::Init): on Darwin, add fallback of + * tests/msgcat.test: default msgcat locale to + * unix/tclUnixInit.c (TclpSetVariables): current CFLocale + identifier if available (via private ::tcl::mac::locale global, set at + interp init when on Mac OS X 10.3 or later with CoreFoundation). + + * library/tcltest/tcltest.tcl: add 'line' verbose level: prints source + * doc/tcltest.n: file line information of failing tests. + + * macosx/Tcl.xcodeproj/project.pbxproj: add new tclUnixCompat.c file; + revise tests target to use new tcltest 'line' verbose level. + + * unix/configure.in: add descriptions to new AC_DEFINEs for MT-safe. + * unix/tcl.m4: add caching to new SC_TCL_* macros for MT-safe wrappers + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2006-09-08 Zoran Vasiljevic + + * unix/tclUnixCompat.c: Added fallback to gethostbyname() and + gethostbyaddr() if the implementation is known to be MT-safe + (currently for Darwin 6 or later only). + + * unix/configure.in: Assume gethostbyname() and gethostbyaddr() are + MT-safe starting with Darwin 6 (Mac OSX 10.2). + + * unix/configure: Regenerated with autoconf V2.59 + +2006-09-08 Andreas Kupries + + * unix/tclUnixCompat.c: Fixed conditions for CopyArray/CopyString, and + CopyHostent. Also fixed bad var names in TclpGetHostByName. + +2006-09-07 Zoran Vasiljevic + + * unix/tclUnixCompat.c: Added fallback to MT-unsafe library calls if + TCL_THREADS is not defined. + Fixed alignment of arrays copied by CopyArray() to be on the + sizeof(char *) boundary. + +2006-09-07 Zoran Vasiljevic + + * unix/tclUnixChan.c: Rewritten MT-safe wrappers to return ptrs to + * unix/tclUnixCompat.c: TSD storage making them all look like their + * unix/tclUnixFCmd.c: MT-unsafe pendants API-wise. + * unix/tclUnixPort.h: + * unix/tclUnixSock.c: + +2006-09-06 Zoran Vasiljevic + + * unix/tclUnixChan.c: Added TCL_THREADS ifdef'ed usage of MT-safe + * unix/tclUnixFCmd.c: calls like: getpwuid, getpwnam, getgrgid, + * unix/tclUnixSock.c: getgrnam, gethostbyname and gethostbyaddr. + * unix/tclUnixPort.h: See [Bug 999544] + * unix/Makefile.in: + * unix/configure.in: + * unix/tcl.m4: + * unix/configure: Regenerated. + + * unix/tclUnixCompat.c: New file containing MT-safe implementation of + some library calls. + +2006-09-04 Don Porter + + * generic/tclCompExpr.c: Removed much complexity that is no + longer needed. + + * tests/main.text (Tcl_Main-4.4): Test corrected to not be + timing sensitive to the Bug 1481986 fix. [Bug 1550858] + +2006-09-04 Jeff Hobbs + + * doc/package.n: correct package example + +2006-08-31 Don Porter + + * generic/tclCompExpr.c: Corrected flawed logic for disabling + the INST_TRY_CVT_TO_NUMERIC instruction at the end of an expression + when function arguments contain operators. [Bug 1541274] + + * tests/expr-old.test: The remaining failing tests reported in + * tests/expr.test: [Bug 1381715] are all new in Tcl 8.5, so + there's really no issue of compatibility with Tcl 8.4 result to deal + with. Fixed by updating tests to expect 8.5 results. + +2006-08-29 Don Porter + + * generic/tclParseExpr.c: Dropped the old expr parser. + +2006-08-30 Jeff Hobbs + + * generic/tclBasic.c (Tcl_CreateInterp): init iPtr->threadId + + * win/tclWinChan.c [Bug 819667] Improve logic for identifying COM + ports. + + * generic/tclIOGT.c (ExecuteCallback): + * generic/tclPkg.c (Tcl_PkgRequireEx): replace Tcl_GlobalEval(Obj) + with more efficient Tcl_Eval(Obj)Ex + + * unix/Makefile.in (valgrindshell): add valgrindshell target and + update default VALGRINDARGS. User can override, or add to it with + VALGRIND_OPTS env var. + + * generic/tclFileName.c (DoGlob): match incrs with decrs. + +2006-08-29 Don Porter + + * generic/tclParseExpr.c: Use the "parent" field of orphan + ExprNodes to store the closure of left pointers. This lets us avoid + repeated re-scanning leftward for the left boundary of subexpressions, + which in worst case led to near O(N^2) runtime. + +2006-08-29 Joe Mistachkin + + * unix/tclUnixInit.c: Fixed the issue (typo) that was causing + * unix/tclUnixThrd.c (TclpThreadGetStackSize): stack.test to fail on + FreeBSD (and possibly other Unix platforms). + +2006-08-29 Colin McCormack + + * generic/tclIOUtil.c: Added test for NULL return from + * generic/tclPathObj.c: Tcl_FSGetNormalizedPath which was causing + * unix/tclUnixFile.c: segv's per [Bug 1548263] + * win/tclWinFCmd.c: + * win/tclWinFile.c: + +2006-08-28 Kevin B. Kenny + + * library/tzdata/America/Havana: Regenerated from Olson's + * library/tzdata/America/Tegucigalpa: tzdata2006k. + * library/tzdata/Asia/Gaza: + +2006-08-28 Don Porter + + * generic/tclStringObj.c: Revised ObjPrintfVA to take care to + * generic/tclParseExpr.c: copy only whole characters when doing + %s formatting. This relieves callers of TclObjPrintf() and + TclFormatToErrorInfo() from needing to fix arguments to character + boundaries. Tcl_ParseExpr() simplified by taking advantage. [Bug + 1547786] + + * generic/tclStringObj.c: Corrected TclFormatObj's failure to + count up the number of arguments required by examining the format + string. [Bug 1547681] + +2006-08-27 Joe Mistachkin + + * generic/tclClock.c (ClockClicksObjCmd): Fix nested macro breakage + with TCL_MEM_DEBUG enabled. [Bug 1547662] + +2006-08-26 Miguel Sofer + + * doc/namespace.n: + * generic/tclNamesp.c: + * tests/upvar.test: bugfix, docs clarification and new tests for + [namespace upvar] as follow up to [Bug 1546833], reported by Will + Duquette. + +2006-08-24 Kevin B. Kenny + + * library/tzdata: Regenerated, including several new files, from + Olson's tzdata2006j. + * library/clock.tcl: + * tests/clock.test: Removed an early testing hack that allowed loading + 'registry' from the build tree rather than an installed one. This is a + workaround for [Bug 15232730], which remains open because it's a + symptom of a deeper underlying problem. + +2006-08-23 Don Porter + + * generic/tclParseExpr.c: Minimal collection of new tests + * tests/parseExpr.test: testing the error messages of the new + expr parser. Several bug fixes and code simplifications that appeared + during that effort. + +2006-08-21 Don Porter + + * generic/tclIOUtil.c: Revisions to complete the thread finalization + of the cwdPathPtr. [Bug 1536142] + + * generic/tclParseExpr.c: Revised mistaken call to + TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same + additional info in error message. + + * tests/compExpr-old.test: Update existing tests to not fail with + * tests/compExpr.test: the new expr parser. + * tests/compile.test: + * tests/expr-old.test: + * tests/expr.test: + * tests/for.test: + * tests/if.test: + * tests/parseExpr.test: + * tests/while.test: + +2006-08-21 Donal K. Fellows + + * win/Makefile.in (gdb): Make this target work so that debugging an + msys build is possible. + +2006-08-21 Daniel Steffen + + * macosx/tclMacOSXNotify.c (Tcl_WaitForEvent): if the run loop is + already running (e.g. if Tcl_WaitForEvent was called recursively), + re-run it in a custom run loop mode containing only the source for the + notifier thread, otherwise wakeups from other sources added to the + common run loop modes might get lost. + + * unix/tclUnixNotfy.c (Tcl_WaitForEvent): on 64-bit Darwin, + pthread_cond_timedwait() appears to have a bug that causes it to wait + forever when passed an absolute time which has already been exceeded + by the system time; as a workaround, when given a very brief timeout, + just do a poll on that platform. [Bug 1457797] + + * generic/tclClock.c (ClockClicksObjCmd): add support for Darwin + * generic/tclCmdMZ.c (Tcl_TimeObjCmd): nanosecond resolution timer + * generic/tclInt.h: to [clock clicks] and [time] + * unix/configure.in (Darwin): when TCL_WIDE_CLICKS defined + * unix/tclUnixTime.c (TclpGetWideClicks, TclpWideClicksToNanoseconds): + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + + * unix/tclUnixPort.h (Darwin): override potentially faulty configure + detection of termios availability in all cases, since termios is known + to be present on all Mac OS X releases since 10.0. [Bug 497147] + +2006-08-18 Daniel Steffen + + * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for + universal builds including x86_64, for 64-bit CoreFoundation on + Leopard and for use of -mmacosx-version-min instead of + MACOSX_DEPLOYMENT_TARGET + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + + * generic/tcl.h: add fixes for building on Leopard and + * unix/tclUnixPort.h: support for 64-bit CoreFoundation on Leopard + * macosx/tclMacOSXFCmd.c: + + * unix/tclUnixPort.h: on Darwin x86_64, disable use of vfork as it + causes execve to fail intermittently. (rdar://4685553) + + * generic/tclTomMath.h: on Darwin 64-bit, for now disable use of + 128-bit arithmetic through __attribute__ ((mode(TI))), as it leads to + link errors due to missing fallbacks. (rdar://4685527) + + * macosx/Tcl.xcodeproj/project.pbxproj: add x86_64 to universal build, + switch native release targets to use DWARF with dSYM, Xcode 3.0 + changes + * macosx/README: updates for x86_64 and Xcode 2.4. + + * macosx/Tcl.xcodeproj/default.pbxuser: add test suite target that + * macosx/Tcl.xcodeproj/project.pbxproj: runs the tcl test suite at + build time and shows clickable test suite errors in the GUI build + window. + + * tests/macOSXFCmd.test: fix use of deprecated resource fork paths. + + * unix/tclUnixInit.c (TclpInitLibraryPath): move code that is only + needed when TCL_LIBRARY is defined to run only in that case. + + * generic/tclLink.c (LinkTraceProc): fix 64-bit signed-with-unsigned + comparison warning from gcc4 -Wextra. + + * unix/tclUnixChan.c (TclUnixWaitForFile): with timeout < 0, if + select() returns early (e.g. due to a signal), call it again instead + of returning a timeout result. Fixes intermittent event-13.8 failures. + +2006-08-17 Don Porter + + * generic/tclCompile.c: Revised the new set of expression + * generic/tclParseExpr.c: parse error messages. + +2006-08-16 Don Porter + + * generic/tclParseExpr.c: Replace PrecedenceOf() function with + prec[] static array. + +2006-08-14 Donal K. Fellows + + * library/clock.tcl (::tcl::clock::add): Added missing braces to + clockval validation code. Pointed out on comp.lang.tcl. + +2006-08-11 Donal K. Fellows + + * generic/tclNamesp.c: Improvements in buffer management to make + namespace creation faster. Plus selected other minor improvements to + code quality. [Patch 1352382] + +2006-08-10 Donal K. Fellows + + Misc patches to make code more efficient. [Bug 1530474] (afredd) + * generic/*.c, macosx/tclMacOSXNotify.c, unix/tclUnixNotfy.c, + * win/tclWinThrd.c: Tidy up invokations of Tcl_Panic() to promote + string constant sharing and consistent style. + * generic/tclBasic.c (Tcl_CreateInterp): More efficient handling of + * generic/tclClock.c (TclClockInit): registration of commands not + in global namespace. + * generic/tclVar.c (Tcl_UnsetObjCmd): Remove unreachable clause. + +2006-08-09 Don Porter + + * generic/tclEncoding.c: Replace buffer copy in for loop with + call to memcpy(). Thanks to afredd. [Patch 1530262] + +2006-08-09 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LassignObjCmd): Make the wrong#args message + a bit more consistent with those used elsewhere. [Bug 1534628] + + * generic/tclDictObj.c (DictForCmd): Stop crash when attempting to + iterate over an invalid dictionary. [Bug 1531184] + + * doc/ParseCmd.3, doc/expr.n, doc/set.n, doc/subst.n, doc/switch.n: + * doc/tclvars.n: Ensure that uses of [expr] in documentation examples + are also good style (with braces) unless otherwise necessary. [Bug + 1526581] + +2006-08-03 Daniel Steffen + + * unix/tclUnixPipe.c (TclpCreateProcess): for USE_VFORK: ensure + standard channels are initialized before vfork() so that the child + doesn't potentially corrupt global state in the parent's address space + + * tests/compExpr-old.test: add 'oldExprParser' constraint to all tests + * tests/compExpr.test: that depend on the exact format of the + * tests/compile.test: error messages of the pre-2006-07-05 + * tests/expr-old.test: expression parser. The constraint is on by + * tests/expr.test: default (i.e those tests still fail), but + * tests/for.test: can be turned off by passing '-constraints + * tests/if.test: newExprParser' to tcltest, which will skip + * tests/parseExpr.test: the 196 failing tests in the testsuite that + * tests/while.test: are caused by the new expression parser + error messages. + +2006-07-31 Kevin B. Kenny + + * generic/tclClock.c (ConvertLocalToUTCUsingC): Corrected a regression + that caused dates before 1969 to be one day off in the :localtime time + zone if TZ is not set. [Bug 1531530] + +2006-07-30 Kevin B. Kenny + + * generic/tclClock.c (GetJulianDayFromEraYearMonthDay): Corrected + several errors in converting dates before the Common Era [Bug 1426279] + * library/clock.tcl: Corrected syntax errors in generated code for %EC + %Ey, and %W format groups [Bug 1505383]. Corrected a bug in cache + management for format strings containing [glob] metacharacters [Bug + 1494664]. Corrected several errors in formatting/scanning of years + prior to the Common Era, and added the missing %EE format group to + indicate the era. + * tools/makeTestCases.tcl: Added code to make sure that %U and %V + format groups are included in the tests. (The code depends on %U and + %V formatting working correctly when 'makeTestCases.tcl' is run, + rather than making a completely independent check.) Added tests for + [glob] metacharacters in strings. Added tests for years prior to the + Common Era. + * tests/clock.test: Rebuilt with new test cases for all the above. + +2006-07-30 Joe English + + * doc/AppInit.3: Fix typo [Bug 1496886] + +2006-07-26 Don Porter + + * generic/tclExecute.c: Corrected flawed overflow detection in + * tests/expr.test: INST_EXPON that caused [expr 2**64] to return + 0 instead of the same value as [expr 1<<64]. + +2006-07-24 Don Porter + + * win/tclWinSock.c: Correct un-initialized Tcl_DString. Thanks to + afredd. [Bug 1518166] + +2006-07-21 Miguel Sofer + + * generic/tclExecute.c: + * tests/execute.test (execute-9.1): dgp's fix for [Bug 1522803]. + +2006-07-20 Daniel Steffen + + * macosx/tclMacOSXNotify.c (Tcl_InitNotifier, Tcl_WaitForEvent): + create notifier thread lazily upon first call to Tcl_WaitForEvent() + rather than in Tcl_InitNotifier(). Allows calling exeve() in processes + where the event loop has not yet been run (Darwin's execve() fails in + processes with more than one thread), in particular allows embedders + to call fork() followed by execve(), previously the pthread_atfork() + child handler's call to Tcl_InitNotifier() would immediately recreate + the notifier thread in the child after a fork. + + * macosx/tclMacOSXFCmd.c (TclMacOSXCopyFileAttributes): add support + * macosx/tclMacOSXNotify.c (Tcl_InitNotifier): for weakly + * unix/tclUnixInit.c (Tcl_GetEncodingNameFromEnvironment): importing + symbols not available on OSX 10.2 or 10.3, enables binaires built on + later OSX versions to run on earlier ones. + * macosx/Tcl.xcodeproj/project.pbxproj: enable weak-linking; turn on + extra warnings. + * macosx/README: document how to enable weak-linking; cleanup. + * unix/tclUnixPort.h: add support for weak-linking; conditionalize + AvailabilityMacros.h inclusion; only disable realpath on 10.2 or + earlier when threads are enabled. + * unix/tclLoadDyld.c (TclpLoadMemoryGetBuffer): change runtime Darwin + * unix/tclUnixInit.c (TclpInitPlatform): release check to use + global initialized + once + * unix/tclUnixFCmd.c (DoRenameFile, TclpObjNormalizePath): add runtime + Darwin release check to determine if realpath is threadsafe. + * unix/configure.in: add check on Darwin for compiler support of weak + * unix/tcl.m4: import and for AvailabilityMacros.h header; move + Darwin specific checks & defines that are only relevant to the tcl + build out of tcl.m4; restrict framework option to Darwin; clean up + quoting and help messages. + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + + * generic/regc_locale.c (cclass): + * generic/tclExecute.c (TclExecuteByteCode): + * generic/tclIOCmd.c (Tcl_ExecObjCmd): + * generic/tclListObj.c (NewListIntRep): + * generic/tclObj.c (Tcl_GetLongFromObj, Tcl_GetWideIntFromObj) + (FreeBignum, Tcl_SetBignumObj): + * generic/tclParseExpr.c (Tcl_ParseExpr): + * generic/tclStrToD.c (TclParseNumber): + * generic/tclStringObj.c (TclAppendFormattedObjs): + * unix/tclLoadDyld.c (TclpLoadMemory): + * unix/tclUnixPipe.c (TclpCreateProcess): fix signed-with-unsigned + comparison and other warnings from gcc4 -Wextra. + +2006-07-13 Andreas Kupries + + * unix/tclUnixPort.h: Added the inclusion of . + The missing header caused the upcoming #if conditions to wrongly + exclude realpath, causing file normalize to ignore symbolic links in + the path. + +2006-07-11 Zoran Vasiljevic + + * generic/tclAsync.c: Made Tcl_AsyncDelete() more tolerant when called + after all thread TSD has been garbage-collected. + +2006-07-05 Don Porter + + * generic/tclParseExpr.c: Completely new expression parser that + builds a parse tree instead of operating with deep recursion. This + corrects reports of stack-blowing crashes parsing long expressions + [Bug 906201] and replaces a fundamentally O(N^2) algorithm with an + O(N) one [RFE 903765]. The new parser is better able to generate error + messages that clearly report both the nature and context of the syntax + error [Bugs 1029267, 1381715]. For now, the code for the old parser is + still present and can be activated with a "#define OLD_EXPR_PARSER + 1". This is for the sake of a clean implementation patch, and for ease + of benchmarking. The new parser is non-recursive, so much lighter in + stack consumption, but it does use more heap, so there may be cases + where parsing of long expressions that succeeded with the old parser + will lead to out of memory panics with the new one. There are still + more improvements possible on that point, though significant progress + may require changes to the Tcl_Token specifications documented for the + public Tcl_Parse*() routines. + ***POTENTIAL INCOMPATIBILITY*** for any callers that rely on the exact + (usually terrible) error messages generated by the old parser. This + includes a large number of tests in the test suite. + + * generic/tclInt.h: Replaced TclParseWhiteSpace() with + * generic/tclParse.c: TclParseAllWhiteSpace() which is what + * generic/tclParseExpr.c: all the callers really needed. + Breaking whitespace runs at newlines is useful only to the command + parsing function, and it can call the file scoped routine + ParseWhiteSpace() to do that. + + * tests/expr-old.test: Removed knownBug constraints that masked + * tests/expr.test: failures due to revised error messages. + * tests/parseExpr.test: + +2006-06-20 Don Porter + + * generic/tclIOUtil.c: Changed default configuration to + * generic/tclInt.decls: #undef USE_OBSOLETE_FS_HOOKS which disables + * generic/tclTest.c: access to the Tcl 8.3 internal routines for + hooking into filesystem operations. Everyone ought to have migrated to + Tcl_Filesystems by now. + ***POTENTIAL INCOMPATIBILITY*** for any code still stuck in the + pre-Tcl_Filesystem era. + + * generic/tclIntDecls.h: make genstubs + * generic/tclStubInit.c: + + * generic/tclStrToD.c: Removed dead code that permitted disabling of + recognition of the new 0b and 0o numeric formats. + + * generic/tclExecute.c: Removed dead code that implemented alternative + * generic/tclObj.c: design where numeric values did not + automatically narrow to the smallest Tcl_ObjType required to hold them + + * generic/tclCmdAH.c: Removed dead code that was old implementation + of [format]. + +2006-06-14 Daniel Steffen + + * unix/tclUnixPort.h (Darwin): support MAC_OS_X_VERSION_MAX_ALLOWED + define from AvailabilityMacros.h: override configure detection and + only use API available in the indicated OS version or earlier. + +2006-06-14 Donal K. Fellows + + * doc/format.n, doc/scan.n: Added examples for converting between + characters and their numeric interpretations following user prompting. + +2006-06-13 Donal K. Fellows + + * unix/tclLoadDl.c (TclpDlopen): Workaround for a compiler bug in Sun + Forte 6. [Bug 1503729] + +2006-06-06 Don Porter + + * doc/GetStdChan.3: Added recommendation that each call to + Tcl_SetStdChannel() be accompanied by a call to Tcl_RegisterChannel(). + +2006-06-05 Donal K. Fellows + + * doc/Alloc.3: Added documentation of promise that Tcl_Realloc(NULL,x) + is the same as Tcl_Alloc(x), as discussed in comp.lang.tcl. Also fixed + nonsense sentence to say something meaningful. + +2006-05-29 Jeff Hobbs + + * generic/tcl.h (Tcl_DecrRefCount): use if/else construct to allow + placement in unbraced outer if/else conditions. (jcw) + +2006-05-27 Daniel Steffen + + * macosx/tclMacOSXNotify.c: implemented pthread_atfork() handler that + * unix/tcl.m4 (Darwin): recreates CoreFoundation state and + notifier thread in the child after a fork(). Note that pthread_atfork + is available starting with Tiger only. Because vfork() is used by the + core on Darwin, [exec]/[open] are not affected by this fix, only + extensions or embedders that call fork() directly (such as TclX). + However, this only makes fork() safe from corefoundation tcl with + --disable-threads; as on all platforms, forked children may deadlock + in threaded tcl due to the potential for stale locked mutexes in the + child. [Patch 923072] + + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2006-05-24 Donal K. Fellows + + * unix/tcl.m4 (SC_CONFIG_SYSTEM): Fixed quoting of command script to + awk; it was a rarely used branch, but it was wrong. [Bug 1494160] + +2006-05-23 Donal K. Fellows + + * doc/chan.n, doc/refchan.n: Tighten up the documentation to follow a + slightly more consistent style with regard to argument capitalization. + +2006-05-13 Don Porter + + * generic/tclProc.c (ProcCompileProc): When a bump of the compile + epoch forces the re-compile of a proc body, take care not to overwrite + any Proc struct that may be referred to on the active call stack. Note + that the fix will not be effective for code that calls the private + routine TclProcCompileProc() directly. [Bug 1482718] + +2006-05-13 Daniel Steffen + + * generic/tclEvent.c (HandleBgErrors): fix leak. [Coverity issue 86] + +2006-05-05 Don Porter + + * generic/tclMain.c (Tcl_Main): Corrected flaw that required + * tests/main.test: (Tcl_Main-4.5): processing of one interactive + command before passing control to the loop routine registered with + Tcl_SetMainLoop(). [Bug 1481986] + +2006-05-04 Don Porter + + * README: Bump version number to 8.5a5 + * generic/tcl.h: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/README.binary: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + + * generic/tclBasic.c (ExprSrandFunc): Restore acceptance of wide/big + * doc/mathfunc.n: integer values by srand(). [Bug 1480509] + +2006-04-26 Don Porter + + *** 8.5a4 TAGGED FOR RELEASE *** + + * changes: Updates for another RC. + + * generic/tclBinary.c: Revised the handling of the Q and q format + * generic/tclInt.h: specifiers for [binary] to account for the + * generic/tclStrToD.c: "middle endian" floating point format used in + Nokia N770. + +2006-04-25 Don Porter + + * doc/DoubleObj.3: More doc updates for TIP 237. + * doc/expr.n: + * doc/format.n: + * doc/mathfunc.n: + * doc/scan.n: + * doc/string.n: + + * generic/tclScan.c: [scan $s %u] is documented to accept only + * tests/scan.test: decimal formatted integers. Fixed to match. + +2006-04-19 Kevin B. Kenny + + * generic/tclStrToD.c: Added code to support the "middle endian" + floating point format used in the Nokia N770's software-based floating + point. Thanks to Bruce Johnson for reporting this bug, originally on + http://wiki.tcl.tk/15408. + * library/clock.tcl: Fixed a bug with Daylight Saving Time and Posix + time zone specifiers reported by Martin Lemburg in + http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/9a8b15a4dfc0b7a0 + (and not at SourceForge). + * tests/clock.test: Added test case for the above bug. + +2006-04-18 Donal K. Fellows + + * doc/IntObj.3: Minor review fixes, including better documentation of + the behaviour of Tcl_GetBignumAndClearObj. + +2006-04-17 Don Porter + + * doc/IntObj.3: Documentation changes to account for TIP 237 changes. + * doc/Object.3: [Bug 1446971] + +2006-04-12 Donal K. Fellows + + * generic/regc_locale.c (cclass): Redefined the meaning of [:print:] + to be exactly UNICODE letters, numbers, punctuation, symbols and + spaces (*not* whitespace). [Bug 1376892] + +2006-04-11 Don Porter + + * generic/tclTrace.c: Stop some interference between enter traces + * tests/trace.test: and enterstep traces. [Bug 1458266] + +2006-04-07 Don Porter + + * generic/tclPathObj.c: Yet another revised fix for the [Bug 1379287] + * tests/fileSystem.test: family of path normalization bugs. + +2006-04-06 Jeff Hobbs + + * generic/tclRegexp.c (FinalizeRegexp): full reset data to indicate + readiness for reinitialization. + +2006-04-06 Don Porter + + * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): It seems there + * tests/indexObj.test: are extensions that rely on the prior behavior + * doc/GetIndex.3: that the empty string cannot succeed as a + unique prefix matcher, so I'm restoring Donal Fellows's solution. + Added mention of this detail to the documentation. [Bug 1464039] + + * tests/compExpr-old.test: Updated testmathfunctions constraint + * tests/compExpr.test: to post-TIP-232 world. + * tests/expr-old.test: + * tests/expr.test: + * tests/info.test: + + * tests/indexObj.test: Corrected other test errors revealed by + * tests/upvar.test: testing outside the tcltest application. + + * generic/tclPathObj.c: Revised fix for the [Bug 1379287] family of + path normalization bugs. + +2006-04-06 Daniel Steffen + + * unix/tcl.m4: removed TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING + define on Darwin. [Bug 1457515] + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + +2006-04-05 Don Porter + + * win/tclWinInit.c: More careful calls to Tcl_DStringSetLength() + * win/tclWinSock.c: to avoid creating invalid DString states. Bump + * win/tclWinDde.c: to version 1.3.2. [RFE 1366195] + * library/dde/pkgIndex.tcl: + + * library/reg/pkgIndex.tcl: Bump to registry 1.2 because + * win/tclWinReg.c: Registry_Unload() is a new public routine + * win/Makefile.in: compared to the 1.1.* releases. + + * win/configure.in: Bump package version numbers. + * win/configure: autoconf 2.59 + +2006-04-05 Donal K. Fellows + + * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Allow empty + strings to be matched by the Tcl_GetIndexFromObj machinery, in the + same manner as any other key. [Bug 1464039] + +2006-04-03 Andreas Kupries + + * generic/tclIO.c (ReadChars): Added check, panic and commentary to a + piece of code which relies on BUFFER_PADDING to create enough space at + the beginning of each buffer for the insertion of partial multibyte + data at the beginning of a buffer. Commentary explains why this code + is OK, and the panic is as a precaution if someone twiddled the + BUFFER_PADDING into uselessness. + + * generic/tclIO.c (ReadChars): Temporarily suppress the use of + TCL_ENCODING_END set when EOF was reached while the buffer we are + converting is not truly the last buffer in the queue. Together with + the Utf bug below it was possible to completely wreck the buffer data + structures, eventually crashing Tcl. [Bug 1462248] + + * generic/tclEncoding.c (UtfToUtfProc): Stop accessing memory beyond + the end of the input buffer when TCL_ENCODING_END is set and the last + bytes of the buffer start a multi-byte sequence. This bug contributed + to [Bug 1462248]. + +2006-03-30 Miguel Sofer + + * generic/tclExecute.c: remove unused var and silence gcc warning + +2006-03-29 Jeff Hobbs + + * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\" + path-as-escape issue. + +2006-03-29 Don Porter + + * changes: Updates for another RC. + + * generic/tclPathObj.c: More fixes for path normalization when /../ + * tests/fileSystem.test: tries to go beyond root.[Bug 1379287] + + * generic/tclExecute.c: Revised INST_MOD implementation to do + calculations in native types as much as possible, moving to mp_ints + only when necessary. + +2006-03-28 Jeff Hobbs + + * win/tclWinPipe.c (TclpCreateProcess): change panics to Tcl errors + and do proper refcounting of noe objPtr. [Bug 1194429] + + * unix/tcl.m4, win/tcl.m4: []-quote AC_DEFUN functions. + +2006-03-28 Daniel Steffen + + * macosx/Tcl.xcode/default.pbxuser: add '-singleproc 1' cli arg to + * macosx/Tcl.xcodeproj/default.pbxuser: tcltest to ease test debugging + + * macosx/Tcl.xcode/project.pbxproj: removed $prefix/share from + * macosx/Tcl.xcodeproj/project.pbxproj: TCL_PACKAGE_PATH as per change + to unix/configure.in of 2006-03-13. + + * unix/tclUnixFCmd.c (TclpObjNormalizePath): deal with *BSD/Darwin + realpath() converting relative paths into absolute paths [Bug 1064247] + +2006-03-28 Vince Darley + + * generic/tclIOUtil.c: fix to nativeFilesystemRecord comparisons + (lesser part of [Bug 1064247]) + +2006-03-27 Pat Thoyts + + * win/tclWinTest.c: Fixes for [Bug 1456373] (mingw-gcc issue) + +2006-03-27 Andreas Kupries + + * doc/CrtChannel.3: Added TCL_CHANNEL_VERSION_5, made it the + * generic/tcl.h: version where the "truncateProc" is defined at, + * generic/tclIO.c: and moved all channel drivers of Tcl to v5. + * generic/tclIOGT.c, generic/tclIORChan.c, unix/tclUnixChan.c: + * unix/tclUnixPipe.c, win/tclWinChan.c, win/tclWinConsole.c: + * win/tclWinPipe.c, win/tclWinSerial.c, win/tclWinSock.c: + +2006-03-27 Don Porter + + * generic/tclExecute.c: Merge INST_MOD computation in with the + INST_?SHIFT instructions, which also operate only on two integral + values. Also corrected flaw that made INST_BITNOT of wide values + require mp_int calculations. Also corrected type that missed optimized + handling of the tclBooleanType by the TclGetBooleanFromObj macro. + + * changes: Updates for another RC. + +2006-03-25 Don Porter + + * generic/tclExecute.c: Corrections to INST_EXPON detection of + overflow to use mp_int calculations. + +2006-03-24 Kevin B. Kenny + + * generic/tclExecute.c (TclExecuteByteCode): Added a couple of missing + casts to 'int' that were affecting compilablity on VC6. + +2006-03-24 Don Porter + + * generic/tclEncoding.c: Reverted latest change [Bug 506653] since it + reportedly killed test performance on Windows. + + * generic/tclExecute.c: Revised INST_EXPON implementation to do + calculations in native types as much as possible, moving to mp_ints + only when necessary. + +2006-03-23 Don Porter + + * generic/tclExecute.c: Merged INST_EXPON handling in with the other + binary operators that operate on all number types (INST_ADD, etc.). + + * tests/env.test: With case preserved (see 2006-03-21 commit) be sure + to do case-insensitive filtering. [Bug 1457065] + +2006-03-23 Reinhard Max + + * unix/tcl.spec: Cleaned up and completed the spec file. An RPM can + now be built from the tcl source distribution with "rpmbuild -tb + " + +2006-03-22 Reinhard Max + + * tests/stack.test: Run the stack tests in subshells, so that they are + reported as failed tests rather than bugs in the test suite if the + recursion causes a segfault. + +2006-03-21 Don Porter + + * changes: Updates for another RC. + + * generic/tclStrToD.c: One of the branches of AccumulateDecimalDigit + * tests/parseExpr.test: did not. [Bug 1451233] + + * tests/env.test: Preserve case of saved env vars. [Bug 1409272] + +2006-03-21 Daniel Steffen + + * generic/tclInt.decls: implement globbing for HFS creator & type + * macosx/tclMacOSXFCmd.c:codes and 'hidden' flag, as documented in + * tests/macOSXFCmd.test: glob.n; objectified OSType handling in [glob] + * unix/tclUnixFile.c: and [file attributes]; fix globbing for + hidden files with pattern==NULL arg. [Bug 823329] + * generic/tclIntPlatDecls.h: + * generic/tclStubInit.c: make genstubs + +2006-03-20 Andreas Kupries + + * win/Makefile.in (install-libraries): Generate tcl8/8.4 directory + under Windows as well (cygwin Makefile). Related entry: 2006-03-07, + dgp. This moved the installation of http from 8.2 to 8.4, partially. A + fix of the required directory creation was done for unix on Mar 10, + without entry in the Changelog. This entry is for the fix of the + directory creation under Windows. + + * unix/installManPage: There is always one even more broken "sed". + Moved the # comment starting character in the sed script to the + beginning of their respective lines. The AIX sed will not recognize + them as comments otherwise :( The actual text stays indented for + better association with the commands they belong to. + +2006-03-20 Donal K. Fellows + + * tests/cmdAH.test, tests/fCmd.test, tests/unixFCmd.test: + * tests/winFCmd.test: Cleanup of some test constraint handling, and a + few other minor issues. + +2006-03-18 Vince Darley + + * generic/tclFileName.c: + * doc/FileSystem.3: + * tests/fileName.test: Fix to [Bug 1084705] so that 'glob -nocomplain' + finally agrees with its documentation and doesn't swallow genuine + errors. + + ***POTENTIAL INCOMPATIBILITY*** for scripts that assumed '-nocomplain' + removes the need for 'catch' to deal with non-understood path names. + + Small optimisation to implementation of pattern==NULL case of TclGlob, + and clarification to the documentation. [Tclvfs bug 1405317] + +2006-03-18 Vince Darley + + * tests/fCmd.test: added knownBug test case for [Bug 1394972] + + * tests/winFCmd.test: + * tests/tcltest.test: corrected tests to better account for behaviour + of writable/non-writable directories on Windows 2000/XP. This, with + the previous patches, closes [Bug 1193497] + +2006-03-17 Andreas Kupries + + * doc/chan.n: Updated with documentation for the commands 'chan + create' and 'chan postevent' (TIP #219). + + * doc/refchan.n: New file. Documentation of the command handler API + for reflected channels (TIP #219). + +2006-03-17 Joe Mistachkin + + * unix/tclUnixPort.h: Include pthread.h prior to pthread_np.h [Bug + 1444692] + + * win/tclWinTest.c: Corrected typo of 'initializeMutex' that prevented + successful compilation. + +2006-03-16 Andreas Kupries + + * doc/open.n: Documented the changed behaviour of 'a'ppend mode. + + * tests/io.test (io-43.1 io-44.[1234]): Rewritten to be self-contained + with regard to setup and cleanup. [Bug 681793] + + * generic/tclIOUtil.c (TclGetOpenMode): Added the flag O_APPEND to the + list of POSIX modes used when opening a file for 'a'ppend. This + enables the proper automatic seek-to-end-on-write by the OS. See [Bug + 680143] for longer discussion. + + * tests/ioCmd.test (iocmd-13.7.*): Extended the testsuite to check the + new handling of 'a'. + +2006-03-15 Andreas Kupries + + * tests/socket.test: Extended the timeout in socket-11.11 from 10 to + 40 seconds to allow for really slow machines. Also extended + actual/expected results with value of variable 'done' to make it + clearer when a test fails due to a timeout. [Bug 792159] + +2006-03-15 Vince Darley + + * win/fCmd.test: add proper test constraints so the new tests don't + run on Unix. + +2006-03-14 Andreas Kupries + + * generic/tclPipe.c (TclCreatePipeline): Modified the processing of + pipebars to fail if the last bar is followed only by redirections. + [Bug 768659] + +2006-03-14 Andreas Kupries + + * doc/fconfigure.n: Clarified that -translation is binary is reported + as lf when queried, because it is identical to lf, except for the + special additional behaviour when setting it. [Bug 666770] + +2006-03-14 Andreas Kupries + + * doc/clock.n: Removed double-quotes around section title NAME; not + needed. + * unix/installManpage: Reverted part to handle double-quotes in + section NAME, chokes older sed installations. + +2006-03-14 Andreas Kupries + + * library/tm.tcl (::tcl::tm::Defaults): Fixed handling of environment + variable TCLX.y_TM_PATH, bad variable reference. Thanks to Julian + Noble. [Bug 1448251] + +2006-03-14 Vince Darley + + * win/tclWinFile.c: updated patch to deal with 'file writable' issues + on Windows XP/2000. + * generic/tclTest.c: + * unix/tclUnixTest.c: + * win/tclWinTest.c: + * tests/fCmd.test: updated test suite to deal with correct permissions + setting and differences between XP/2000 and 95/98 3 tests still fail; + to be dealt with shortly + +2006-03-13 Don Porter + + * generic/tclEncoding.c: Report error when an escape encoding is + missing one of its sub-encodings. [Bug 506653] + + * unix/configure.in: Revert change from 2005-07-26 that sometimes + * unix/configure: added $prefix/share to the tcl_pkgPath. See + [Patch 1231015]. autoconf-2.59. + +2006-03-10 Miguel Sofer + + * generic/tclProc.c (ObjInterpProcEx): + * tests/apply.test (apply-5.1): Fix [apply] error messages so that + they quote the lambda expression. [Bug 1447355] + +2006-03-10 Zoran Vasiljevic + + -- Summary of changes fixing [Bug 1437595] -- + + * generic/tclEvent.c: Cosmetic touches and identation + * generic/tclInt.h: Added TclpFinalizeSockets() call. + + * generic/tclIO.c: Calls TclpFinalizeSockets() as part of the + TclFinalizeIOSubsystem(). + + * unix/tclUnixSock.c: Added no-op TclpFinalizeSockets(). + + * win/tclWinPipe.c, win/tclWinSock.c: Finalization of sockets/pipes is + now solely done in TclpFinalizeSockets() and TclpFinalizePipes() and + not over the thread-exit handler, because the order of actions the Tcl + generic core will impose may result in cores/hangs if the thread exit + handler tears down corresponding subsystem(s) too early. + +2006-03-10 Vince Darley + + * win/tclWinFile.c: previous patch breaks tests, so removed. + +2006-03-09 Vince Darley + + * win/tclWinFile.c: fix to 'file writable' in certain XP directories. + Thanks to fvogel and jfg. [Patch 1344540] Modified patch to make use + of existing use of getSecurityProc. + +2006-03-08 Don Porter + + * generic/tclExecute.c: Complete missing bit of TIP 215 implementation + * tests/incr.test: + +2006-03-07 Joe English + + * unix/tcl.m4: Set SHLIB_LD_FLAGS='${LIBS}' on NetBSD, as per the + other *BSD variants. [Bug 1334613] + * unix/configure: Regenerated. + +2006-03-07 Don Porter + + * changes: Update in prep. for 8.5a4 release. + + * unix/Makefile.in: Package http 2.5.2 requires Tcl 8.4, so the + * win/Makefile.in: *.tm installation has to be placed in an "8.4" + directory, not an "8.2" directory. + +2006-03-06 Don Porter + + * generic/tclBasic.c: Revised handling of TCL_EVAL_* flags to + * tests/parse.test: simplify TclEvalObjvInternal and to correct + the auto-loading of alias targets (parse-8.12). [Bug 1444291] + +2006-03-03 Don Porter + + * generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287] to + work on Windows. + + * generic/tclObj.c: Compatibility support for existing code that + calls Tcl_GetObjType("boolean"). + +2006-03-02 Don Porter + + * generic/tclPathObj.c: Fix for failed normalization of paths + * tests/fileSystem.test: with /../ that lead back to the root + of the filesystem, like /foo/.. [Bug 1379287] + +2006-03-01 Reinhard Max + + * unix/installManPage: Fix the script for manpages that have quotes + around the .SH arguments, as doctools produces them. [Bug 1292145] + Some minor cleanups and improvements. + +2006-02-28 Don Porter + + * generic/tclBasic.c: Corrections to be sure that TCL_EVAL_GLOBAL + * tests/namespace.test: evaluations act the same as [uplevel #0] + * tests/parse.test: evaluations, even when execution traces or + * tests/trace.test: invocations of [::unknown] are present. [Bug + 1439836] + +2006-02-22 Don Porter + + * generic/tclBasic.c: Corrected a few bugs in how [namespace + * tests/namespace.test: unknown] interacts with TCL_EVAL_* flags. + [Patch 958222] + +2006-02-17 Don Porter + + * generic/tclIORChan.c: Revised error message generation and handling + * tests/ioCmd.test: of exceptional return codes in the channel + reflection layer. [Bug 1372348] + +2006-02-16 Don Porter + + * generic/tclIndexObj.c: Disallow the "ambiguous" error message + * tests/indexObj.test: when TCL_EXACT matching is requested. + * tests/ioCmd.test: + +2006-02-15 Don Porter + + * generic/tclIO.c: Made several routines tolerant of + * generic/tclIORChan.c: interp == NULL arguments. [Bug 1380662] + * generic/tclIOUtil.c: + +2006-02-09 Don Porter + + TIP#215 IMPLEMENTATION + + * doc/incr.n: Revised [incr] to auto-initialize when varName + * generic/tclExecute.c: argument is unset. [Patch 1413115] + * generic/tclVar.c: + * tests/compile.test: + * tests/incr-old.test: + * tests/incr.test: + * tests/set.test: + + * tests/main.test (Tcl_Main-6.7): Improved robustness of + command auto-completion test. [Bug 1422736] + +2006-02-08 Donal K. Fellows + + * doc/Encoding.3, doc/encoding.n: Updates due to review at request of + Don Porter. Mostly minor changes. + +2006-02-08 Don Porter + + TIP#258 IMPLEMENTATION + + * doc/Encoding.3: New subcommand [encoding dirs]. + * doc/encoding.n: New routine Tcl_GetEncodingNameFromEnvironment + * generic/tcl.decls: Made public: + * generic/tclBasic.c: TclGetEncodingFromObj + * generic/tclCmdAH.c: -> Tcl_GetEncodingFromObj + * generic/tclEncoding.c:TclGetEncodingSearchPath + * generic/tclInt.decls: -> Tcl_GetEncodingSearchPath + * generic/tclInt.h: TclSetEncodingSearchPath + * generic/tclTest.c: -> Tcl_SetEncodingSearchPath + * library/init.tcl: Removed commands: + * tests/cmdAH.test: [tcl::unsupported::EncodingDirs] + * tests/encoding.test: [testencoding path] (Tcltest) + * unix/tclUnixInit.c: [Patch 1413934] + * win/tclWinInit.c: + + * generic/tclDecls.h: make genstubs + * generic/tclIntDecls.h: + * generic/tclStubInit.c: + +2006-02-01 Miguel Sofer + + * generic/tclProc.c: minor improvements to [apply] + * tests/apply.test: new tests; apply-5.1 currently fails to indicate + missing work in error reporting + +2006-02-01 Don Porter + + TIP#194 IMPLEMENTATION + + * doc/apply.n: (New file) New command [apply]. [Patch 944803] + * doc/uplevel.n: + * generic/tclBasic.c: + * generic/tclInt.h: + * generic/tclProc.c: + * tests/apply.test: (New file) + * tests/proc-old.test: + * tests/proc.test: + + TIP#181 IMPLEMENTATION + + * doc/Namespace.3: New command [namespace unknown]. New public C + * doc/namespace.n: routines Tcl_(Get|Set)NamespaceUnknownHandler. + * doc/unknown.n: [Patch 958222] + * generic/tcl.decls: + * generic/tclBasic.c: + * generic/tclInt.h: + * generic/tclNamesp.c: + * tests/namespace.test: + + * generic/tclDecls.h: make genstubs + * generic/tclStubInit.c: + + TIP#250 IMPLEMENTATION + + * doc/namespace.n: New command [namespace upvar]. [Patch 1275435] + * generic/tclInt.h: + * generic/tclNamesp.c: + * generic/tclVar.c: + * tests/namespace.test: + * tests/upvar.test: + +2006-01-26 Donal K. Fellows + + * doc/dict.n: Fixed silly bug in example. Thanks to Heiner Marxen + for catching this! [Bug 1415725] + +2006-01-26 Donal K. Fellows + + * unix/tclUnixChan.c (TclpOpenFileChannel): Tidy up and comment the + mess to do with setting up serial channels. This (deliberately) breaks + a broken FreeBSD port, indicates what we're really doing, and reduces + the amount of conditional compilation sections for better maintenance. + +2006-01-25 Donal K. Fellows + + * unix/tclUnixInit.c (TclpInitPlatform): Improved conditions on when + to update the FP rounding mode on FreeBSD, taken from FreeBSD port. + +2006-01-23 Donal K. Fellows + + * tests/string.test (string-12.21): Added test for [Bug 1410553] based + on original bug report. + +2006-01-23 Miguel Sofer + + * generic/tclStringObj.c: fixed incorrect handling of internal rep in + Tcl_GetRange. Thanks to twylite and Peter Spjuth. [Bug 1410553] + + * generic/tclProc.c: fixed args handling for precompiled bodies [Bug + 1412695]; thanks to Uwe Traum. + +2006-01-16 Reinhard Max + + * generic/tclPipe.c (FileForRedirect): Prevent nameString from being + freed without having been initialized. + * tests/exec.test: Added a test for the above. + +2006-01-12 Zoran Vasiljevic + + * generic/tclPathObj.c (Tcl_FSGetInternalRep): backported patch from + core-8-4-branch. A freed pointer has been overwritten causing all + sorts of coredumps. + +2006-01-12 Vince Darley + + * win/tclWinFile.c: fix to sharing violation [Bug 1366227] + +2006-01-11 Don Porter + + * generic/tclBasic.c: Moved Tcl_LogCommandInfo from tclBasic.c to + * generic/tclNamesp.c: tclNamesp.c to get access to identifier with + * tests/error.test (error-7.0): file scope. Added check for traces on + ::errorInfo, and when present fall back to contruction of the stack + trace in the variable so that write trace notification timings are + compatible with earlier Tcl releases. This reduces, but does not + completely eliminate the ***POTENTIAL INCOMPATIBILITY*** created by + the 2004-10-15 commit. [Bug 1397843] + +2006-01-10 Daniel Steffen + + * unix/configure: add caching, use AC_CACHE_CHECK instead of + * unix/configure.in: AC_CACHE_VAL where possible, consistent message + * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes + and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with + default argument, Darwin improvements to SC_LOAD_*CONFIG. + +2006-01-09 Don Porter + + * generic/tclNamesp.c (NamespaceInscopeCmd): [namespace inscope] + * tests/namespace.test: commands were not reported by [info level]. + [Bug 1400572] + +2006-01-09 Donal K. Fellows + + * generic/tclTrace.c: Stop exporting the guts of the trace command; + nothing outside this file needs to see it. [Bug 971336] + +2006-01-05 Donal K. Fellows + + * unix/tcl.m4 (TCL_CONFIG_SYSTEM): Factor out the code to determine + the operating system version number, as it was replicated in several + places. + +2006-01-04 David Gravereaux + + * win/tclAppInit.c: WIN32 native console signal handler removed. This + was found to be interfering with TWAPI extension one. IMO, special + services such as signal handlers should best be done with extensions + to the core after discussions on c.l.t. about Roy Terry's tclsh + children of a real windows service shell. + + ****************************************************************** + *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** + *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** + *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** + *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** + *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** + *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** + *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** + ****************************************************************** diff --git a/ChangeLog.2008 b/ChangeLog.2008 new file mode 100644 index 0000000..aaba6c9 --- /dev/null +++ b/ChangeLog.2008 @@ -0,0 +1,1529 @@ + +2008-12-21 Don Porter + + *** 8.5.6 TAGGED FOR RELEASE *** + + * generic/tcl.h: Bump to 8.5.6 for release. + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + * README: + + * unix/configure: autoconf-2.59 + * win/configure: + + * changes: Update for 8.5.6 release. + + * library/tclIndex: Removed reference to no-longer-extant procedure + 'tclLdAout'. + * doc/library.n: Corrected mention of 'auto_exec' to 'auto_execok'. + [Patch 2114900] thanks to Stu Cassoff + Backport of 2008-11-26 commit from Kevin Kenny. + + * win/tclWinThrd.c (TclpThreadCreate): We need to initialize the + thread id variable to 0 as on 64 bit windows this is a pointer sized + field while windows only fills it with a 32 bit value. The result is + an inability to join the threads as the ids cannot be matched. + Backport of 2008-10-13 commit from Pat Thoyts. + +2008-12-15 Donal K. Fellows + + * generic/tclExecute.c (TEBC:INST_DICT_GET): Make sure that the result + is empty when generating an error message. [Bug 2431847] + +2008-12-12 Jan Nijtmans + + * library/clock.tcl (ProcessPosixTimeZone): Fix time change in Eastern + Europe (not 3:00 but 4:00 local time). [Bug 2207436] + +2008-12-11 Andreas Kupries + + * generic/tclIO.c (SetChannelFromAny and related): Modified the + * tests/io.test: internal representation of the tclChannelType to + contain not only the ChannelState pointer, but also a reference to + the interpreter it was made in. Invalidate and recompute the + internal representation when it is used in a different interpreter, + like cmdName intrep's. Added testcase. [Bug 2407783] + +2008-12-11 Jan Nijtmans + + * library/clock.tcl (ProcessPosixTimeZone): Fallback to European time + zone DST rules, when the timezone is between 0 and -12. [Bug 2207436] + * tests/clock.test (clock-52.[23]): Test cases for [Bug 2207436] + +2008-12-10 Kevin B. Kenny + + * library/tzdata/*: Update from Olson's tzdata2008i. + +2008-12-04 Don Porter + + * generic/tclPathObj.c (Tcl_FSGetNormalizedPath): Added another + flag value TCLPATH_NEEDNORM to mark those intreps which need more + complete normalization attention for correct results. [Bug 2385549] + +2008-12-03 Don Porter + + * generic/tclFileName.c (DoGlob): One of the Tcl_FSMatchInDirectory + calls did not have its return code checked. This caused error messages + returned by some Tcl_Filesystem drivers to be swallowed. + +2008-12-02 Andreas Kupries + + * generic/tclIO.c (TclFinalizeIOSubsystem): Replaced Alexandre + Ferrieux's first patch for [Bug 2270477] with a gentler version, also + supplied by him. + +2008-12-01 Don Porter + + * generic/tclParse.c: Backport fix for [Bug 2251175]. + +2008-11-30 Kevin B. Kenny + + * library/clock.tcl (format, ParseClockScanFormat): Added a [string + map] to get rid of namespace delimiters before caching a scan or + format procedure. [Bug 2362156] + * tests/clock.test (clock-64.[12]): Added test cases for the bug that + was tickled by a namespace delimiter inside a format string. + +2008-11-25 Andreas Kupries + + * generic/tclIO.c (TclFinalizeIOSubsystem): Applied Alexandre + Ferrieux's patch for [Bug 2270477] to prevent infinite looping during + finalization of channels not bound to interpreters. + +2008-08-23 Andreas Kupries + + * generic/tclIO.c: Backport of fix for [Bug 2333466]. + +2008-11-18 Jan Nijtmans + + * generic/tcl.decls: Fix signature and implementation of + * generic/tclDecls.h: Tcl_HashStats, such that it conforms to the + * generic/tclHash.c: documentation. [Bug 2308236] + * doc/Hash.3: + +2008-11-13 Jan Nijtmans + + * generic/tclInt.h: Rename static function FSUnloadTempFile to + * generic/tclIOUtil.c: TclFSUnloadTempFile, needed in tclLoad.c + + * generic/tclLoad.c: Fixed [Bug 2269431]: Load of shared + objects leaves temporary files on windows. + +2008-11-10 Andreas Kupries + + * doc/platform_shell.n: Fixed [Bug 2255235], reported by Ulrich + * library/platform/pkgIndex.tcl: Ring . + * library/platform/shell.tcl: Updated the LOCATE command in the + * library/tm.tcl: package 'platform::shell' to handle the new form + * unix/Makefile.in: of 'provide' commands generated by tm.tcl. Bumped + * win/Makefile.in: package to version 1.1.4. Added cross-references + to the relevant parts of the code to avoid future desynchronization. + +2008-11-04 Jeff Hobbs + + * generic/tclPort.h: Remove the ../win/ header dir as the build system + already has it, and it confuses builds when used with private headers + installed. + +2008-10-24 Pat Thoyts + + * library/http/http.tcl: Backported a fix for reading HTTP-like + protocols that used to work and were broken with http 2.7. Now http + 2.7.2 + +2008-10-23 Don Porter + + * generic/tcl.h: Bump version number to 8.5.6b1 to distinguish + * library/init.tcl: CVS development snapshots from the 8.5.5 and + * unix/configure.in: 8.5.6 releases. + * unix/tcl.spec: + * win/configure.in: + * tools/tcl.wse.in: + * README + + * unix/configure: autoconf (2.59) + * win/configure: + +2008-10-19 Don Porter + + * generic/tclProc.c: Reset -level and -code values to defaults + after they are used. [Bug 2152286] + +2008-10-16 Don Porter + + * library/init.tcl: Revised [unknown] so that it carefully + preserves the state of the ::errorInfo and ::errorCode variables at + the start of auto-loading and restores that state before the + autoloaded command is evaluated. [Bug 2140628] + +2008-10-10 Don Porter + + *** 8.5.5 TAGGED FOR RELEASE *** + + * generic/tcl.h: Bump to 8.5.5 for release. + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + + * changes: Update for 8.5.5 release. + +2008-10-08 Don Porter + + * generic/tclTrace.c: Corrected handling of errors returned by + variable traces so that the errorInfo value contains the original + error message. [Bug 2151707] + + * generic/tclVar.c: Revised implementation of TclObjVarErrMsg so + that error message construction does not disturb an existing + iPtr->errorInfo that may be in progress. + +2008-10-06 Jan Nijtmans + + * tclWinTest.c: Fix compiler warning when compiling this file with + mingw gcc: + tclWinTest.c:706: warning: dereferencing type-punned pointer will + break strict-aliasing rules + * generic/tclLoad.c: Make sure that any library which doesn't have an + unloadproc is only really unloaded when no library code is executed + yet. [Bug 2059262] + +2008-10-06 Joe Mistachkin + + * tools/man2tcl.c: Added missing line from patch by Harald Oehlmann. + [Bug 1934200] + +2008-10-05 Kevin B, Kenny + + * libtommath/bn_mp_sqrt.c (bn_mp_sqrt): Handle the case where a + * tests/expr.test (expr-47.13): number's square root is + between n< + + * tools/man2help2.tcl: Integrated patches from Harald Oehlmann. + * tools/man2tcl.c: [Bug 1934200, 1934272] + +2008-09-27 Donal K. Fellows + + * generic/tclCmdIL.c (Tcl_LrepeatObjCmd): Improve the handling of the + case where the combination of number of elements and repeat count + causes the resulting list to be too large. [Bug 2130992] + +2008-09-25 Don Porter + + * doc/global.n: Correct false claim about [info locals]. + +2008-09-17 Don Porter + + * generic/tclInt.h: Correct the TclGetLongFromObj, TclGetIntFromObj, + and TclGetIntForIndexM macros so that they retrieve the longValue + field from the internalRep instead of casting the otherValuePtr field + to type long. + +2008-09-17 Miguel Sofer + + * library/init.tcl: Export min and max commands from the mathfunc + namespace. [Bug 2116053] + +2008-09-10 Donal K. Fellows + + * generic/tclListObj.c (Tcl_ListObjGetElements): Make this list->dict + transformation - encountered when using [foreach] with dicts - not as + expensive as it was before. Spotted by Kieran Elby and reported on + tcl-core. + +2008-09-07 Miguel Sofer + + * doc/namespace.n: Fix [Bug 2098441] + +2008-08-28 Don Porter + + * generic/tcl.h: Bump version number to 8.5.5b1 to distinguish + * library/init.tcl: CVS development snapshots from the 8.5.4 and + * unix/configure.in: 8.5.5 releases. + * unix/tcl.spec: + * win/configure.in: + * tools/tcl.wse.in: + * README + + * unix/configure: autoconf-2.59 + * win/configure: + +2008-08-22 Don Porter + + * generic/tclUtil.c (TclReToGlob): Added missing set of the + *exactPtr value to really fix [Bug 2065115]. Also avoid possible + DString overflow. + * tests/regexpComp.test: Correct duplicate test names. + +2008-08-21 Jeff Hobbs + + * tests/regexp.test, tests/regexpComp.test: Correct re2glob ***= + * generic/tclUtil.c (TclReToGlob): translation from exact + to anywhere-in-string match. [Bug 2065115] + +2008-08-20 Daniel Steffen + + * generic/tclTest.c (TestconcatobjCmd): Fix use of internal-only + TclInvalidateStringRep macro. [Bug 2057479] + +2008-08-17 Miguel Sofer + + * generic/tclTest.c (TestconcatobjCmd): + * generic/tclUtil.c (Tcl_ConcatObj): + * tests/util.test (util-4.7): + Fix [Bug 1447328]; the original "fix" turned Tcl_ConcatObj() into a + hairy monster. This was exposed by [Bug 2055782]. Additionally, + Tcl_ConcatObj could corrupt its input under certain conditions! + + *** NASTY BUG FIXED *** + +2008-08-14 Don Porter + + *** 8.5.4 TAGGED FOR RELEASE *** + + * tests/fileName.test: Revise new tests for portability to case + insensitive filesystems. + +2008-08-14 Daniel Steffen + + * generic/tclCompile.h: Add support for debug logging of DTrace + * generic/tclBasic.c: 'proc', 'cmd' and 'inst' probes (does + _not_ require a platform with DTrace). + + * generic/tclCmdIL.c (TclInfoFrame): Check fPtr->line before + dereferencing as line info may + not exists when TclInfoFrame() + is called from a DTrace probe. + + * tests/msgcat.test: Fix for ::tcl::mac::locale with + @modifier (HEAD backport 2008-06-01). + + * tests/fCmd.test (fCmd-6.23): Made result matching robust when test + workdir and /tmp are not on same FS. + + * unix/Makefile.in: Ensure Makefile shell is /bin/bash for + * unix/configure.in (SunOS): DTrace-enabled build on Solaris. + (followup to 2008-06-12) [Bug 2016584] + + * unix/tcl.m4 (SC_PATH_X): Check for libX11.dylib in addition to + libX11.so et al. + + * unix/configure: autoconf-2.59 + +2008-08-13 Don Porter + + * generic/tclFileName.c: Fix for errors handling -types {} + * tests/fileName.test: option to [glob]. [Bug 1750300] + Thanks to Matthias Kraft and George Peter Staplin. + +2008-08-12 Don Porter + + * changes: Update for 8.5.4 release. + +2008-08-11 Pat Thoyts + + * library/http/http.tcl: Remove 8.5 requirement. + * library/http/pkgIndex.tcl: + * unix/Makefile.in: + * win/Makefile.in: + * win/makefile.vc: + +2008-08-11 Andreas Kupries + + * library/tm.tcl: Added a 'package provide' command to the generated + ifneeded scripts of Tcl Modules, for early detection of conflicts + between the version specified through the file name and a 'provide' + command in the module implementation, if any. Note that this change + also now allows Tcl Modules to not provide a 'provide' command at all, + and declaring their version only through their filename. + + * generic/tclProc.c (Tcl_ProcObjCmd): Fixed memory leak triggered by + * tests/proc.test: procbody::test::proc. See [Bug 2043636]. Added a + test case demonstrating the leak before the fix. Fixed a few spelling + errors in test descriptions as well. + +2008-08-11 Don Porter + + * library/http/http.tcl: Bump http version to 2.7.1 to account + * library/http/pkgIndex.tcl: for [Bug 2046486] bug fix. This + * unix/Makefile.in: release of http now requires a + * win/Makefile.in: dependency on Tcl 8.5 to be able to + * win/makefile.bc: use the unsigned formats in the + * win/makefile.vc: [binary scan] command. + +2008-08-11 Pat Thoyts + + * library/http/http.tcl: CRC field from zlib data should be treated as + unsigned for 64bit support. [Bug 2046846] + +2008-08-08 Don Porter + + * generic/tcl.h: Bump to 8.5.4 for release. + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + + * changes: Update for 8.5.4 release. + +2008-08-08 Kevin Kenny + + * library/tzdata/CET: + * library/tzdata/MET: + * library/tzdata/Africa/Casablanca: + * library/tzdata/America/Eirunepe: + * library/tzdata/America/Rio_Branco: + * library/tzdata/America/Santarem: + * library/tzdata/America/Argentina/San_Luis: + * library/tzdata/Asia/Karachi: + * library/tzdata/Europe/Belgrade: + * library/tzdata/Europe/Berlin: + * library/tzdata/Europe/Budapest: + * library/tzdata/Europe/Sofia: + * library/tzdata/Indian/Mauritius: Olson's tzdata2008e. + +2008-08-06 Don Porter + + * generic/tclVar.c (TclLookupSimpleVar): Retrieve the number of + locals in the localCache from the CallFrame and not from the Proc + which may have been mangled by a (broken?) recompile. Backport from + the HEAD. + +2008-08-04 Don Porter + + * generic/tclExecute.c: Stopped faulty double-logging of errors to + * tests/execute.test: stack trace when a compile epoch bump triggers + fallback to direct evaluation of commands in a compiled script. + [Bug 2037338] + +2008-07-30 Don Porter + + * generic/tclBasic.c: Corrected the timing of when the flag + TCL_ALLOW_EXCEPTIONS is tested. + +2008-07-29 Miguel Sofer + + * generic/tclExecute.c: fix [Bug 2030670] that cause + TclStackRealloc to panic on rare corner cases. Thx ajpasadyn for + diagnose and patch. + +2008-07-28 Andreas Kupries + + * generic/tclBasic.c: Added missing ref count when creating an empty + string as path (TclEvalEx). In 8.4 the missing code caused panics in + the testsuite. It doesn't in 8.5. I am guessing that the code path + with the missing the incr-refcount is not invoked any longer. Because + the bug in itself is certainly the same. + +2008-07-25 Daniel Steffen + + * tests/info.test (info-37.0): Add !singleTestInterp constraint; + (info-22.8, info-23.0): switch to glob matching to avoid sensitivity + to tcltest.tcl line number changes, remove knownBug constraint, fix + expected result. [Bug 1605269] + +2008-07-25 Andreas Kupries + + * tests/info.test: Tests 38.* added, exactly testing the tracking of + location for uplevel scripts. + + * generic/tclCompile.c (TclInitCompileEnv): Reorganized the + initialization of the #280 location information to match the flow in + TclEvalObjEx to get more absolute contexts. + + * generic/tclBasic.c (TclEvalObjEx): Moved the pure-list optimization + out of the eval-direct code path to be done always, i.e. even when a + compile is requested. This way we do not loose the association between + #280 location information and the list elements, if any. + +2008-07-23 Andreas Kupries + + * tests/info.test: Reordered the tests to have monotonously increasing + numbers. + + * generic/tclBasic.c: Modified TclArgumentGet to reject pure lists + * generic/tclCmdIL.c: immediately, without search. Reworked setup of + * generic/tclCompile.c: eoFramePtr, doesn't need the line information, + * tests/info.test: more sensible to have everything on line 1 when + eval'ing a pure list. Updated the users of the line information to + special case this based on the frame type (i.e. + TCL_LOCATION_EVAL_LIST). Added a testcase demonstrating the new + behaviour. + +2008-07-22 Andreas Kupries + + * generic/tclBasic.c: Added missing function comments. + + * generic/tclCompile.c: Made the new TclEnterCmdWordIndex + * generic/tclCompile.h: static, and ansified. + + * generic/tclBasic.c: Reworked the handling of bytecode literals for + * generic/tclCompile.c: #280 to fix the abysmal performance for deep + * generic/tclCompile.h: recursion, replaced the linear search through + * generic/tclExecute.c: the whole stack with another hashtable and + * generic/tclInt.h: simplified the data structure used by the compiler + by using an array instead of a hashtable. Incidentially this also + fixes the memory leak reported via [Bug 2024937]. + +2008-07-21 Don Porter + + * tests/encoding.test: Make failing tests pass again. [Bug 1972867] + +2008-07-21 Andreas Kupries + + * generic/tclBasic.c: Extended the existing TIP #280 system (info + * generic/tclCmdAH.c: frame), added the ability to track the + * generic/tclCompCmds.c: absolute location of literal procedure + * generic/tclCompile.c: arguments, and making this information + * generic/tclCompile.h: available to uplevel, eval, and + * generic/tclInterp.c: siblings. This allows proper tracking of + * generic/tclInt.h: absolute location through custom (Tcl-coded) + * generic/tclNamesp.c: control structures based on uplevel, etc. + * generic/tclProc.c: + +2008-07-21 Pat Thoyts + + * generic/tclFCmd.c: Inodes on windows are unreliable [Bug 2015723] + +2008-07-20 Donal K. Fellows + + * generic/tclDictObj.c (SetDictFromAny): Make the list->dict + transformation a bit more efficient; modern dicts are ordered and so + we can round-trip through lists without needing the string rep at all. + * generic/tclListObj.c (SetListFromAny): Make the dict->list + transformation not lossy of internal representations and hence more + efficient. [Bug 2008248] (ajpasadyn) but using a more efficient patch. + +2008-07-15 Donal K. Fellows + + * doc/DictObj.3: Fix error in example. [Bug 2016740] + +2008-07-08 Don Porter + + * generic/tclGet.c: Corrected out of date comments. + +2008-07-07 Andreas Kupries + + * generic/tclCmdIL.c (InfoFrameCmd): Fixed unsafe idiom of setting + the interp result found by Don Porter. + +2008-07-07 Donal K. Fellows + + * doc/regexp.n, doc/regsub.n: Correct examples. [Bug 1982642] + +2008-07-04 Joe English + + * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension + when converting incomplete UTF-8 sequences. See [Bug 1908443] for + details. + +2008-07-03 Andreas Kupries + + * generic/tclIORChan.c (InvokeTclMethod): Fixed the memory leak + reported in [Bug 1987821]. Thanks to Miguel for the report and Don + Porter for tracking the cause down. + +2008-07-03 Don Porter + + * library/package.tcl: Removed [file readable] testing from + [tclPkgUnknown] and friends. We find out soon enough whether a file is + readable when we try to [source] it, and not testing before allows us + to workaround the bugs on some common filesystems where [file + readable] lies to us. [Patch 1969717] + +2008-06-29 Don Porter + + *** 8.5.3 TAGGED FOR RELEASE *** + + * generic/tcl.h: Bump to 8.5.3 for release. + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + + * doc/ObjectType.3: Updated documentation of the Tcl_ObjType + struct to match expectations of Tcl 8.5 [Bug 1917650]. + + * generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks + Rolf Ade for detecting. + +2008-06-28 Don Porter + + * generic/tclPathObj.c: Plug memory leak in [Bug 1972879] fix. Thanks + to Rolf Ade for detecting and Dan Steffen for the fix. [Bug 2004654] + +2008-06-26 Andreas Kupries + + * unix/Makefile.in: Followup to my change of 2008-06-25, make code + generated by the Makefile and put into the installed tm.tcl + conditional on interpreter safeness as well. Thanks to Daniel Steffen + for reminding me of that code. + +2008-06-25 Don Porter + + * changes: Update for 8.5.3 release. + +2008-06-25 Andreas Kupries + + * library/tm.tcl: Modified the handling of Tcl Modules and of the + * library/safe.tcl: Safe Base to interact nicely with each other, + * library/init.tcl: enabling requiring Tcl Modules in safe + * tests/safe.test: interpreters. [Bug 1999119] + +2008-06-25 Pat Thoyts + + * win/rules.vc: Backported fix for dde/registry versions and + * win/makefile.vc: the staticpkg build option + +2008-06-24 Don Porter + + * generic/tclPathObj.c: Fixed some internals management in the "path" + Tcl_ObjType for the empty string value. Problem led to a crash in the + command [glob -dir {} a]. [Bug 1999176] + +2008-06-23 Don Porter + + * generic/tclPathObj.c: Fixed bug in Tcl_GetTranslatedPath() when + operating on the "Special path" variant of the "path" Tcl_ObjType + intrep. A full normalization was getting done, in particular, coercing + relative paths to absolute, contrary to what the function of producing + the "translated path" is supposed to do. [Bug 1972879] + +2008-06-19 Don Porter + + * changes: Update for 8.5.3 release. + + * generic/tclInterp.c: Fixed completely boneheaded mistake that + * tests/interp.test: [interp bgerror $slave] and [$slave bgerror] + would always act like [interp bgerror {}]. [Bug 1999035] + + * tests/chanio.test: Corrected flawed tests revealed by a -debug 1 + * tests/event.test: -singleproc 1 test suite run. + * tests/io.test: + +2008-06-19 Don Porter + + * changes: Updates for 8.5.3 release. + +2008-06-17 Andreas Kupries + + * generic/tclClock.c (ClockConvertlocaltoutcObjCmd): Removed left + over debug output. + +2008-06-17 Andreas Kupries + + * doc/tm.n: Followup to changelog entry 2008-03-18 regarding + ::tcl::tm::Defaults. Updated the documentation to not only mention the + new (underscored) form of environment variable names, but make it the + encouraged form as well. [Bug 1914604] + +2008-06-17 Kevin Kenny + + * generic/tclClock.c (ConvertLocalToUTC): + * tests/clock.test (clock-63.1): Fixed a bug where the internal + ConvertLocalToUTC command segfaulted if passed a dictionary without + the 'localSeconds' key. To the best of my knowledge, the bug was not + observable in the [clock] command itself. + +2008-06-16 Andreas Kupries + + * generic/tclCmdIL.c (TclInfoFrame): Backport of fix made on the + * tests/info.test: head branch :: Moved the code looking up the + information for key 'proc' out of the TCL_LOCATION_BC branch to + after the switch, this is common to all frame types. Updated the + testsuite to match. This was exposed by the 2008-06-08 commit + (Miguel), switching uplevel from direct eval to compilation. Fixes + [Bug 1987851]. + +2008-06-12 Daniel Steffen + + * unix/Makefile.in: Add complete deps on tclDTrace.h. + + * unix/Makefile.in: Clean generated tclDTrace.h file. + * unix/configure.in (SunOS): Fix static DTrace-enabled build. + + * unix/tcl.m4 (SunOS-5.11): Fix 64bit amd64 support with gcc & Sun cc. + * unix/configure: autoconf-2.59 + + * macosx/Tcl.xcodeproj/project.pbxproj: Add debug configs with gcov, + and with corefoundation disabled; updates and cleanup for Xcode 3.1 and + for Leopard. + * macosx/Tcl.xcode/project.pbxproj: Sync Tcl.xcodeproj changes. + * macosx/README: Document new build configs. + +2008-05-26 Jeff Hobbs + + * tests/io.test (io-53.9): Need to close chan before removing file. + +2008-05-23 Andreas Kupries + + * win/tclWinChan.c (FileWideSeekProc): Accepted a patch by Alexandre + Ferrieux to fix the [Bug 1965787]. + 'tell' now works for locations > 2 GB as well instead of going + negative. + + * generic/tclIO.c (Tcl_SetChannelBufferSize): Accepted a patch by + * tests/io.test: Alexandre Ferrieux + * tests/chanio.test: to fix the [Bug 1969953]. Buffersize outside of + the supported range are now clipped to nearest boundary instead of + ignored. + +2008-05-22 Don Porter + + * generic/tclNamesp.c (Tcl_LogCommandInfo): Restored ability to + handle the argument value length = -1. Thanks to Chris Darroch for + discovering the bug and providing the fix. [Bug 1968245] + +2008-05-21 Don Porter + + * generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace + * tests/parse.test (parse-15.60): routine has no mechanism to + return the "incomplete" status of "\\\n" so calling this routine + anywhere that can be reached within a Tcl_ParseCommand() call is a + mistake. In particular, ParseComment() must not use it. [Bug 1968882] + +2008-05-21 Donal K. Fellows + + * generic/tclNamesp.c (Tcl_SetNamespaceUnknownHandler): Corrected odd + logic for handling installation of namespace unknown handlers which + could lead too very strange things happening in the error case. + +2008-05-16 Miguel Sofer + + * generic/tclCompile.c: Fix crash with tcl_traceExec. Found and fixed + by Alexander Pasadyn. [Bug 1964803] + +2008-05-07 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileDictAppendCmd): Fix silly off-by + one error that caused a crash every time a compiled 'dict append' with + more than one argument was used. Found by Colin McCormack. + +2008-04-26 Zoran Vasiljevic + + * generic/tclAsync.c: Tcl_AsyncDelete(): panic if attempt to locate + handler token fails. Happens when some other thread attempts to delete + somebody else's token. + + Also, panic early if we find out the wrong thread attempting to delete + the async handler (common trap). As, only the one that created the + handler is allowed to delete it. + +2008-04-24 Andreas Kupries + + * tests/ioCmd.test: Extended testsuite for reflected channel + implementation. Added test cases about how it handles if the rug is + pulled out from under a channel (= killing threads, interpreters + containing the tcl command for a channel, and channel sitting in a + different interpreter/thread.) + + * generic/tclIORChan.c: Fixed the bugs exposed by the new testcases, + redone most of the cleanup and exit handling. + +2008-04-15 Andreas Kupries + + * generic/tclIO.c (CopyData): Applied another patch by Alexandre + * io.test (io-53.8a): Ferrieux , + * chanio.test (chan-io-53.8a): to shift EOF handling to the async + part of the command if a callback is specified, should the channel be + at EOF already when fcopy is called. Testcase by myself. + +2008-04-14 Kevin B. Kenny + + * unix/tclUnixTime.c (NativeGetTime): Removed obsolete use of + 'struct timezone' in the call to 'gettimeofday'. [Bug 1942197] + + * tests/clock.test (clock-33.5, clock-33.5a, clock-33.8, clock-33.8a): + Added comments to the test that it can fail on a heavily loaded + system. + +2008-04-11 Don Porter + + * generic/tcl.h: Bump version number to 8.5.3b1 to distinguish + * library/init.tcl: CVS development snapshots from the 8.5.2 and + * unix/configure.in: 8.5.3 releases. + * unix/tcl.spec: + * win/configure.in: + * README + + * unix/configure: autoconf (2.59) + * win/configure: + +2008-04-10 Andreas Kupries + + * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Keeping check for negative + values, changed to not be an error, but behave like the special value + -1 (copy all, default). + + * tests/iocmd.test (iocmd-15.{12,13}): Removed. + + * tests/io.test (io-52.5{,a,b}): Reverted last change, added + * tests/chanio.test (chan-io-52.5{,a,b}): comment regarding the + meaning of -1, added two more testcases for other negative values, + and input wrapped to negative. + +2008-04-09 Andreas Kupries + + * tests/chanio.test (chan-io-52.5): Removed '-size -1' from test, + * tests/io.test (io-52.5): does not seem to have any bearing, and was + an illegal value. + + * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Added checking of -size value + * tests/ioCmd.test (iocmd-15.{13,14}): to reject negative values, and + values overflowing 32-bit signed. Basic patch by Alexandre Ferrieux + , with modifications from me to + separate overflow from true negative value. Extended testsuite. [Bug + 1557855] + +2008-04-08 Andreas Kupries + + * tests/io.test (io-53.8): Fixed ordering of vwait and after + cancel. cancel has to be done after the vwait completes. + +2008-04-09 Daniel Steffen + + * tests/chanio.test (chan-io-53.8,53.9,53.10): fix typo & quoting for + * tests/io.test (io-53.8,53.9,53.10): spaces in builddir path + +2008-04-07 Andreas Kupries + + * tests/io.test (io-53.10): Testcase for bi-directionaly fcopy. + * tests/chanio.test: + * generic/tclIO.c: Additional changes to data structures for fcopy + * generic/tclIO.h: and channels to perform proper cleanup in case + of a channel having two background copy operations running as is + now possible. + + * tests/io.test (io-53.10): Testcase for bi-directionaly fcopy. + * generic/tclIO.c: Additional changes to data structures for fcopy + and channels to perform proper cleanup in case of a channel having + two background copy operations running as is now possible. + +2008-04-07 Andreas Kupries + + * generic/tclIO.c (BUSY_STATE, CheckChannelErrors, + TclCopyChannel): New macro, and the places using it. This change + allows for bi-directional fcopy on channels. [Bug 1350564]. Thanks + to Alexandre Ferrieux for the + patch. + +2008-04-07 Reinhard Max + + * generic/tclStringObj.c (Tcl_AppendFormatToObj): Fix [format {% d}] + so that it behaves the same way as in 8.4 and as C's printf(). + * tests/format.test: Add a test for '% d' and '%+d'. + +2008-04-05 Kevin B. Kenny + + * tests/chanio.test (chan-io-53.9): + * tests/io.test (io-53.9): Made test cleanup robust against the + possibility of slow process shutdown on Windows. + + * win/tcl.m4: Added -D_CRT_SECURE_NO_DEPRECATE and + -DCRT_NONSTDC_NO_DEPRECATE to the MSVC compilation flags so that the + compilation doesn't barf on perfectly reasonable Posix system calls. + * win/configure: Manually patched (don't have the right autoconf to + hand). + + * win/tclWinFile.c: (WinSymLinkDirectory): Fixed a problem that + Tcl was creating an NTFS junction point (IO_REPARSE_TAG_MOUNT_POINT) + but filling in the union member for a Vista symbolic link. We had + gotten away with this error because the union member + (SymbolicLinkReparseBuffer) was misdefined in this file and in the + 'winnt.h' in early versions of MinGW. MinGW 3.4.2 has the correct + definition of SymbolicLinkReparseBuffer, exposing the mismatch, + and making tests cmdAH-19.4.1, fCmd-28.*, and filename-11.* fail. + +2008-04-04 Andreas Kupries + + * tests/io.test (io-53.9): Added testcase for [Bug 780533], based + * tests/chanio.test: on Alexandre's test script. Also fixed problem + with timer in preceding test, was not canceled properly in the ok case + +2008-04-04 Andreas Kupries + + * generic/tclIORChan.c (ReflectOutput): Allow zero return from write + when input was zero-length anyway. Otherwise keept it an error, and + separate the message from 'written too much'. + + * tests/ioCmd.test (iocmd-24.6): Testcase updated for changed message. + + * generic/tclIORChan.c (ReflectClose): Added missing removal of the + now closed channel from the reflection map. Before we could crash the + system by invoking 'chan postevent' on a closed reflected channel, + dereferencing the dangling pointer in the map. + + * tests/ioCmd.test (iocmd-31.8): Testcase for the above. + +2008-04-03 Andreas Kupries + + * generic/tclIO.c (CopyData): Applied patch [Bug 1932639] to + * tests/io.test: prevent fcopy from calling -command synchronously + * tests/chanio.test: the first time. Thanks to Alexandre Ferrieux + for report and patch. + +2008-04-02 Andreas Kupries + + * generic/tclIO.c (CopyData): Applied patch for fcopy problem [Bug + 780533], with many thanks to Alexandre Ferrieux + for tracking it down and providing a + solution. Still have to convert his test script into a proper test + case. + +2008-04-01 Andreas Kupries + + * generic/tclStrToD.c: Applied patch for [Bug 1839067] (fp rounding + * unix/tcl.m4: setup on solaris x86, native cc), provided by + * unix/configure: Michael Schlenker. configure regen'd. + +2008-04-01 Don Porter + + * generic/tclStubLib.c (Tcl_InitStubs): Added missing error message. + * generic/tclPkg.c (Tcl_PkgInitStubsCheck): + +2008-03-30 Kevin Kenny + + * generic/tclInt.h (TclIsNaN): + * unix/configure.in: Added code to the configurator to check for a + standard isnan() macro and use it if one is + found. This change avoids bugs where the test of + ((d) != (d)) is optimized away by an + overaggressive compiler. [Bug 1783544] + * generic/tclObj.c: Added missing #include needed to locate + isnan() after the above change. + + * unix/configure: autoconf-2.61 + + * tests/mathop.test (mathop-25.9, mathop-25.14): Modified tests to + deal with (slightly buggy) math libraries in which pow() returns an + incorrectly rounded result. [Bug 1808174] + +2008-03-26 Don Porter + + *** 8.5.2 TAGGED FOR RELEASE *** + + * generic/tcl.h: Bump to 8.5.2 for release. + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + + * changes: Updated for 8.5.2 release. + +2008-03-28 Donal K. Fellows + + * tests/fCmd.test: Substantial rewrite to use many more tcltest + features. Great reduction in quantity of [catch] gymnastics. Several + buggy tests fixed, including one where the result of the previous test + was being checked! + +2008-03-27 Kevin B. Kenny + + * library/tzdata/America/Marigot: + * library/tztata/America/St_Barthelemy: + * library/tzdata/America/Argentina/San_Luis: + * library/tzdata/Asia/Ho_Chi_Minh: + * library/tzdata/Asia/Kolkata: (new files) + * library/tzdata/America/Caracas: + * library/tzdata/America/Havana: + * library/tzdata/America/Santiago: + * library/tzdata/America/Argentina/Buenos_Aires: + * library/tzdata/America/Argentina/Catamarca: + * library/tzdata/America/Argentina/Cordoba: + * library/tzdata/America/Argentina/Jujuy: + * library/tzdata/America/Argentina/La_Rioja: + * library/tzdata/America/Argentina/Mendoza: + * library/tzdata/America/Argentina/Rio_Gallegos: + * library/tzdata/America/Argentina/San_Juan: + * library/tzdata/America/Argentina/Tucuman: + * library/tzdata/America/Argentina/Ushuaia: + * library/tzdata/Asia/Baghdad: + * library/tzdata/Asia/Calcutta: + * library/tzdata/Asia/Damascus: + * library/tzdata/Asia/Saigon: + * library/tzdata/Pacific/Easter: + Changes up to and including Olson's tzdata2008b. + +2008-03-27 Daniel Steffen + + * unix/tcl.m4 (SunOS-5.1x): Fix 64bit support for Sun cc. [Bug + 1921166] + + * unix/configure: autoconf-2.59 + +2008-03-26 Don Porter + + * changes: Updated for 8.5.2 release. + +2008-03-24 Pat Thoyts + + * generic/tclBinary.c: [Bug 1923966] - crash in binary format + * tests/binary.test: Added tests for the above crash condition. + +2008-03-21 Donal K. Fellows + + * doc/switch.n: Clarified documentation in respect of two-argument + invokation. [Bug 1899962] + + * tests/switch.test: Added more tests of regexp-mode compilation of + the [switch] command. [Bug 1854435] + +2008-03-20 Donal K. Fellows + + * generic/tcl.h, generic/tclThreadAlloc.c: Tidied up the declarations + of Tcl_GetMemoryInfo so that it is always defined. Will panic when + called against a Tcl that was previously built without it at all, + which is OK because that also indicates a serious mismatch between + memory configuration options. + +2008-03-19 Donal K. Fellows + + * generic/tcl.h, generic/tclThreadAlloc.c (Tcl_GetMemoryInfo): Make + sure this function is available when direct linking. [Bug 1868171] + + * tests/reg.test (reg-33.14): Marked nonPortable because some + environments have small default stack sizes. [Bug 1905562] + +2008-03-18 Andreas Kupries + + * library/tm.tcl (::tcl::tm::UnknownHandler): Changed 'source' to + 'source -encoding utf-8'. This fixes a portability problem of Tcl + Modules pointed out by Don Porter. By using plain 'source' we were at + the mercy of 'encoding system', making modules less portable than they + could be. The exact scenario: A writes a TM in some weird encoding + which is A's system encoding, distributes it, and somewhere else it + cannot be read/used because the system encoding is different. Forcing + the use of utf-8 makes the module portable. + + ***INCOMPATIBILITY*** for all Tcl Modules already written in non-utf-8 + compatible encodings. + +2008-03-18 Don Porter + + * generic/tclExecute.c: Patch from Miguel Sofer to correct the + alignment of memory allocated by GrowEvaluationStack(). [Bug 1914503] + +2008-03-18 Andreas Kupries + + * library/tm.tcl (::tcl::tm::Defaults): Modified handling of + environment variables. Solution slightly different than proposed in + the report. Using the underscored form TCLX_y_TM_PATH even if + TCLX.y_TM_PATH exists. Also using a loop to cut prevent code + replication. [Bug 1914604] + +2008-03-16 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileDictForCmd): Correct the handling + of stack space calculation (the jump pattern used was confusing the + simple-minded code doing the calculations). [Bug 1903325] + + * doc/lreplace.n: Clarified documentation of what happens with + negative indices. [Bug 1905809] Added example, tidied up formatting. + +2008-03-14 Don Porter + + * generic/tclBasic.c (OldMathFuncProc): Same workaround protection + from bad TclStackAlloc() alignment. Thanks George Peter Staplin. + + * generic/tclCmdIL.c (Tcl_LsortObjCmd): Use ckalloc() to allocate + SortElement arrays instead of TclStackAlloc() which isn't getting + alignment right. Workaround for [Bug 1914503]. + +2008-03-14 Reinhard Max + + * generic/tclTest.c: Ignore the return value of write() when we are + * unix/tclUnixPipe.c: about to exit anyways. + +2008-03-13 Daniel Steffen + + * unix/configure.in: Use backslash-quoting instead of double-quoting + * unix/tcl.m4: for lib paths in tclConfig.sh. [Bug 1913622] + * unix/configure: autoconf-2.59 + +2008-03-13 Don Porter + + * changes: Updated for 8.5.2 release. + + * generic/tclStrToD.c: Resolve identifier conflict over "pow10" with + libm in Cygwin and DJGPP. Thanks to Gordon Schumacher and Philip + Moore. [Patch 1800636] + +2008-03-12 Daniel Steffen + + * macosx/Tcl.xcodeproj/project.pbxproj: Add support for Xcode 3.1 + * macosx/Tcl.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and + * macosx/Tcl-Common.xcconfig: 'xcodebuild install'. + +2008-03-12 Andreas Kupries + + * doc/info.n: Replaced {expand} with {*}. + +2008-03-12 Jeff Hobbs + + * unix/Makefile.in (install-libraries): Bump http to 2.7 + * win/Makefile.in (install-libraries): Added -myaddr option to allow + * library/http/http.tcl (http::geturl): control of selected socket + * library/http/pkgIndex.tcl: interface. [Bug 559898] + * doc/http.n, tests/http.test: Added -keepalive and + -protocol 1.1 with chunked transfer encoding support. [Bug 1063703, + 1470377, 219225] (default keepalive is 0) + Added ability to override Host in -headers. [Bug 928154] + Added -strict option to control URL validation on per-call basis. + [Bug 1560506] + +2008-03-11 Jeff Hobbs + + * library/http/http.tcl (http::geturl): Add -method option to support + * tests/http.test (http-3.1): http PUT and DELETE requests. + * doc/http.n: [Bug 1599901, 862554] + + * library/http/http.tcl: Whitespace changes, code cleanup. Allow http + to be re-sourced without overwriting http state. + +2008-03-11 Daniel Steffen + + * generic/tclEncoding.c (LoadEscapeEncoding): Avoid leaking escape + sub-encodings, fixes encoding-11.1 failing after iso2022-jp loaded. + [Bug 1893053] + + * macosx/tclMacOSXNotify.c: Avoid using CoreFoundation after fork() on + Darwin 9 even when TclpCreateProcess() uses vfork(). + + * macosx/Tcl.xcodeproj/project.pbxproj: Add support for Xcode 3.1 and + * macosx/Tcl.xcodeproj/default.pbxuser: configs for building with + * macosx/Tcl-Common.xcconfig: gcc-4.2 and llvm-gcc-4.2. + + * unix/tclUnixPort.h: Workaround vfork() problems in + llvm-gcc-4.2.1 -O4 build. + + * unix/tclUnixPort.h: Move MODULE_SCOPE compat + define to top. [Bug 1911102] + + * macosx/GNUmakefile: Fix quoting to allow paths + * macosx/Tcl-Common.xcconfig: to ${builddir} and + * unix/Makefile.in: ${INSTALL_ROOT} to contain + * unix/configure.in: spaces. + * unix/install-sh: + * unix/tcl.m4: + * tests/ioCmd.test: + + * unix/configure: autoconf-2.59 + + * unix/Makefile.in (install-strip): Strip non-global symbols from + dynamic library. + + * unix/tclUnixNotfy.c: Fix warning. + + * tests/exec.test (exec-9.7): Reduce timing sensitivity + * tests/socket.test (socket-2.11): (esp. on multi-proc machines). + + * tests/fCmd.test (fCmd-9.4): Skip on Darwin 9 (xfail). + +2008-03-11 Miguel Sofer + + * generic/tclVar.c (TclDeleteNamespaceVars): + * tests/var.test (var-8.2): Unset traces on vars should be called with + a FQ named during namespace deletion. This was causing infinite loops + when unset traces recreated the var, as reported by Julian Noble. [Bug + 1911919] + +2008-03-10 Don Porter + + * changes: Updated for 8.5.2 release. + + * doc/http.n: Revised to indicate that [package require http 2.5.5] + is needed to get all the documented commands ([http::meta]). + + * generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Added error + * tests/event.test (event-5.*): checking to protect against callers + passing invalid return options dictionaries. [Bug 1901113] + + * generic/tclBasic.c (ExprAbsFunc): Revised so that the abs() + * tests/expr.test: function and the [::tcl::mathfunc::abs] + command do not return the value of -0, or equivalent values with more + alarming string reps like -1e-350. [Bug 1893815] + +2008-03-07 Andreas Kupries + + * generic/tclResult.c (ReleaseKeys): Workaround for [Bug 1904907]. + Reset the return option keys to NULL to allow full re-initialization + by GetKeys(). This introduces a memory leak for the key objects, but + gets us around a crash in the finalization of reflected channels when + handling returns, either at compile- or runtime. In both cases we + access the keys after they have been released by their thread exit + handler. A proper fix is entangled with the untangling of the + finalization ordering and attendant issues. For now we choose the + lesser evil. + +2008-03-07 Don Porter + + * generic/tclExecute.c (Tcl_ExprObj): Revised expression bytecode + compiling so that bytecodes invalid due to changing context or due to + the difference between expressions and scripts are not reused. [Bug + 1899164] + + * generic/tclCmdAH.c: Revised direct evaluation implementation of + [expr] so that [expr $e] caches compiled bytecodes for the expression + as the intrep of $e. + + * tests/execute.test (execute-6.*): More tests checking that + script bytecode is invalidated in the right situations. + +2008-03-07 Donal K. Fellows + + * win/configure.in: Add AC_HEADER_STDC to support msys/win64. + +2008-03-06 Donal K. Fellows + + * doc/namespace.n: Minor tidying up. [Bug 1909019] + +2008-03-04 Don Porter + + * tests/execute.test (6.3,4): Added tests for [Bug 1899164]. + +2008-03-03 Reinhard Max + + * unix/tclUnixChan.c: Fix mark and space parity on Linux, which uses + CMSPAR instead of PAREXT. + +2008-03-02 Miguel Sofer + + * generic/tclNamesp.c (GetNamespaceFromObj): + * tests/interp.test (interp-28.2): Spoil the intrep of an nsNameType + obj when the reference crosses interpreter boundaries. + +2008-02-29 Don Porter + + * generic/tclResult.c (Tcl_SetReturnOptions): Revised the refcount + management of Tcl_SetReturnOptions to become that of a conventional + Consumer routine. Thanks to Peter Spjuth for pointing out the + difficulties calling Tcl_SetReturnOptions with non-0-count value for + options. + * generic/tclExecute.c (INST_RETURN_STK): Revised the one caller + within Tcl itself which passes a non-0-count value to + Tcl_SetReturnOptions(). + + * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Revised the + refcount management of Tcl_AppendObjToErrorInfo to become that of a + conventional Consumer routine. This preserves the ease of use for the + overwhelming common callers who pass in a 0-count value, but makes the + proper call with a non-0-count value less surprising. + * generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Revised the + one caller within Tcl itself which passes a non-0-count value to + Tcl_AppendObjToErrorInfo(). + +2008-02-28 Joe English + + * unix/tclPort.h, unix/tclCompat.h, unix/tclUnixChan.h: Reduce scope + of and #includes. [Patch 1903339] + +2008-02-28 Joe English + + * unix/tclUnixChan.c, unix/tclUnixNotfy.c, unix/tclUnixPipe.c: + Consolidate all code conditionalized on -DUSE_FIONBIO into one place. + * unix/tclUnixPort.h, unix/tclUnixCompat.c: New routine + TclUnixSetBlockingMode(). [Patch 1903339] + +2008-02-28 Don Porter + + * generic/tclBasic.c (TclEvalObjvInternal): Plug memory leak when + an enter trace deletes or changes the command, prompting a reparsing. + Don't let the second pass lose commandPtr value allocated during the + first pass. + + * generic/tclCompExpr.c (ParseExpr): Plug memory leak in error + message generation. + + * generic/tclStringObj.c (Tcl_AppendFormatToObj): [format %llx $big] + leaked an mp_int. + + * generic/tclCompCmds.c (TclCompileReturnCmd): The 2007-10-18 commit + to optimize compiled [return -level 0 $x] [RFE 1794073] introduced a + memory leak of the return options dictionary. Fixing that. + +2008-02-27 Pat Thoyts + + * library/http/http.tcl: [Bug 705956] - fix inverted logic when + cleaning up socket error in geturl. + +2008-02-27 Kevin B. Kenny + + * doc/clock.n: Corrected minor indentation gaffe in the penultimate + paragraph. [Bug 1898025] + * generic/tclClock.c (ParseClockFormatArgs): Changed to check that the + clock value is in the range of a 64-bit integer. [Bug 1862555] + * library/clock.tcl (::tcl::clock::format, ::tcl::clock::scan, + (::tcl::clock::add, ::tcl::clock::LocalizeFormat): Fixed bugs in + caching of localized strings that caused weird results when localized + date/time formats were used. [Bug 1902423] + * tests/clock.test (clock-61.*, clock-62.1): Regression tests for [Bug + 1862555] and [Bug 1902423]. + +2008-02-26 Joe English + + * generic/tclIOUtil.c, unix/tclUnixPort.h, unix/tclUnixChan.c: + Remove dead/unused portability-related #defines and unused conditional + code. See [Patch 1901828] for discussion. + +2008-02-26 Joe English + + * generic/tclIORChan.c (enum MethodName), + * generic/tclCompExpr.c (enum Marks): More stray trailing ","s + +2008-02-26 Joe English + + * unix/configure.in(socklen_t test): Define socklen_t as "int" if + missing, not "unsigned". Use AC_TRY_COMPILE instead of + AC_EGREP_HEADER. + * unix/configure: regenerated. + +2008-02-26 Joe English + + * generic/tclCompile.h: Remove stray trailing "," from enum + InstOperandType definition (C99ism). + +2008-02-26 Jeff Hobbs + + * generic/tclUtil.c (TclReToGlob): Fix the handling of the last star + * tests/regexpComp.test: possibly being escaped in + determining right anchor. [Bug 1902436] + +2008-02-26 Pat Thoyts + + * library/http/pkgIndex.tcl: Set version 2.5.5 + * library/http/http.tcl: It is better to do the [eof] check after + trying to read from the socket. No clashes found in testing. Added + http::meta command to access the http headers. [Bug 1868845] + +2008-02-22 Pat Thoyts + + * library/http/pkgIndex.tcl: Set version 2.5.4 + * library/http/http.tcl: Always check that the state array exists + in the http::status command. [Bug 1818565] + +2008-02-13 Don Porter + + * generic/tcl.h: Bump version number to 8.5.2b1 to distinguish + * library/init.tcl: CVS development snapshots from the 8.5.1 and + * unix/configure.in: 8.5.2 releases. + * unix/tcl.spec: + * win/configure.in: + * README + + * unix/configure: autoconf (2.59) + * win/configure: + +2008-02-12 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileSwitchCmd): Corrected logic for + * tests/switch.test (switch-10.15): handling -nocase compilation; the + -exact -nocase option cannot be compiled currently. [Bug 1891827] + + * unix/README: Documented missing configure flags. [Bug 1799011] + +2008-02-06 Kevin B. Kenny + + * doc/clock.n (%N): Corrected an error in the explanation of the %N + format group. + * generic/tclClock.c (ClockParseformatargsObjCmd): + * library/clock.tcl (::tcl::clock::format): + * tests/clock.test (clock-1.0, clock-1.4): + Performance enhancements in [clock format] (moving the analysis of + $args into C code, holding on to Tcl_Objs with resolved command names, + [lassign] in place of [foreach], avoiding [namespace which] for + command resolution). + +2008-02-04 Don Porter + + *** 8.5.1 TAGGED FOR RELEASE *** + + * changes: Updated for 8.5.1 release. + + * generic/tcl.h: Bump to 8.5.1 for release. + * library/init.tcl: + * tools/tcl.wse.in: + * unix/configure.in: + * unix/tcl.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + +2008-02-04 Miguel Sofer + + * generic/tclExecute.c (INST_CONCAT1): Fix optimisation for in-place + concatenation (was going over String type) + +2008-02-02 Daniel Steffen + + * unix/configure.in (Darwin): Correct Info.plist year substitution + in non-framework builds. + + * unix/configure: autoconf-2.59 + +2008-01-30 Miguel Sofer + + * generic/tclInterp.c (Tcl_GetAlias): Fix for [Bug 1882373], thanks go + to an00na. + +2008-01-30 Donal K. Fellows + + * tools/tcltk-man2html.tcl: Reworked manual page scraper to do a + proper job of handling references to Ttk options. [Tk Bug 1876493] + +2008-01-29 Donal K. Fellows + + * doc/man.macros (SO, SE): Adjusted macros so that it is possible for + Ttk to have its "standard options" on a manual page that is not called + "options". [Tk Bug 1876493] + +2008-01-25 Don Porter + + * changes: Updated for 8.5.1 release. + +2008-01-23 Don Porter + + * generic/tclInt.h: New macro TclGrowParseTokenArray() to + * generic/tclCompCmds.c: simplify code that might need to grow + * generic/tclCompExpr.c: an array of Tcl_Tokens in the parsePtr + * generic/tclParse.c: field of a Tcl_Parse. Replaces the + TclExpandTokenArray() routine via replacing: + int needed = parsePtr->numTokens + growth; + while (needed > parsePtr->tokensAvailable) { + TclExpandTokenArray(parsePtr); + } + with: + TclGrowParseTokenArray(parsePtr, growth); + This revision merged over from dgp-refactor branch. + + * generic/tclCompile.h: Demote TclCompEvalObj() from internal stubs to + * generic/tclInt.decls: a MODULE_SCOPE routine declared in + tclCompile.h. + + * generic/tclIntDecls.h: make genstubs + * generic/tclStubInit.c: + +2008-01-22 Don Porter + + * generic/tclTimer.c (AfterProc): Replace Tcl_EvalEx() with + Tcl_EvalObjEx() to evaluate [after] callbacks. Part of trend to favor + compiled execution over direct evaluation. + +2008-01-22 Miguel Sofer + + * generic/tclCmdIl.c (Tcl_LreverseObjCmd): + * tests/cmdIL.test (cmdIL-7.7): Fix crash on reversing an empty list. + [Bug 1876793] + +2008-01-20 Jeff Hobbs + + * unix/README: Minor typo fixes [Bug 1853072] + + * generic/tclIO.c (TclGetsObjBinary): Operate on topmost channel. + [Bug 1869405] (Ficicchia) + +2008-01-17 Don Porter + + * generic/tclCompExpr.c: Revision to preserve parsed intreps of + numeric and boolean literals when compiling expressions with (optimize + == 1). + +2008-01-15 Miguel Sofer + + * generic/tclCompExpr.c: Add an 'optimize' argument to + * generic/tclCompile.c: TclCompileExpr() to profit from better + * generic/tclCompile.h: literal management according to usage. + * generic/tclExecute.c: + + * generic/tclCompExpr.c: Fix literal leak in exprs [Bug 1869989] (dgp) + * generic/tclExecute.c: + * tests/compExpr.test: + + * doc/proc.n: Changed wording for access to non-local variables; added + mention to [namespace upvar]. Lame attempt at dealing with + documentation. [Bug 1872708] + +2008-01-15 Miguel Sofer + + * generic/tclBasic.c: Replacing 'operator' by 'op' in the def of + * generic/tclCompExpr.c: struct TclOpCmdClientData to accommodate C++ + * generic/tclCompile.h: compilers. [Bug 1855644] + +2008-01-13 Jeff Hobbs + + * win/tclWinSerial.c (SerialCloseProc, TclWinOpenSerialChannel): Use + critical section for read & write side. [Bug 1353846] (newman) + +2008-01-11 Miguel Sofer + + * unix/tclUnixThrd.c (TclpThreadGetStackSize): Restore stack checking + functionality in freebsd. [Bug 1850424] + + * unix/tclUnixThrd.c (TclpThreadGetStackSize): Fix for crash in + freebsd. [Bug 1860425] + +2008-01-10 Don Porter + + * generic/tclStringObj.c (Tcl_AppendFormatToObj): Correct failure to + * tests/format.test: account for big.used == 0 corner case in the + %ll(idox) format directives. [Bug 1867855] + +2008-01-09 George Peter Staplin + + * doc/vwait.n: Add a missing be to fix a typo. + +2008-01-04 Jeff Hobbs + + * tools/tcltk-man2html.tcl (make-man-pages): Make man page title use + more specific info on lhs to improve tabbed browser view titles. + +2008-01-02 Donal K. Fellows + + * doc/binary.n: Fixed documentation bug reported on tcl-core, and + reordered documentation to discourage people from using the hex + formatter that is hardly ever useful. + +2008-01-02 Don Porter + + * generic/tcl.h: Bump version number to 8.5.1b1 to distinguish + * library/init.tcl: CVS development snapshots from the 8.5.0 and + * unix/configure.in: 8.5.1 releases. + * unix/tcl.spec: + * win/configure.in: + * README + + * unix/configure: autoconf (2.59) + * win/configure: + + ****************************************************************** + *** CHANGELOG ENTRIES FOR 2006-2007 IN "ChangeLog.2007" *** + *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** + *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** + *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** + *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** + *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** + *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** + *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** + ****************************************************************** -- cgit v0.12 From 99ea4405aed6acebfa01e202fbf947decdfae5ee Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 25 Apr 2013 07:28:08 +0000 Subject: Update dde to version 1.3.3. Update registry to version 1.2.2. (the same as distributed with Tcl 8.5.14) --- ChangeLog | 7 + library/dde/pkgIndex.tcl | 4 +- library/reg/pkgIndex.tcl | 8 +- tests/winDde.test | 94 ++++--- tools/tcl.wse.in | 124 ++++----- unix/Makefile.in | 18 +- unix/configure | 2 +- unix/tcl.m4 | 2 +- win/configure | 8 +- win/configure.in | 8 +- win/makefile.bc | 8 +- win/makefile.vc | 4 +- win/rules.vc | 8 +- win/tclWinDde.c | 433 ++++++++++++++++++++++++-------- win/tclWinReg.c | 639 +++++++++++++++++++++++++---------------------- 15 files changed, 826 insertions(+), 541 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e159a7..11efb0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-25 Jan Nijtmans + + * win/tclWinDde.c: Update dde to version 1.3.3. + * library/dde/pkgIndex.tcl: + * win/tclWinReg.c: Update registry to version 1.2.2. + * library/reg/pkgIndex.tcl: + 2013-04-18 Jan Nijtmans * generic/tclDecls.h: Implement Tcl_Pkg* functions as diff --git a/library/dde/pkgIndex.tcl b/library/dde/pkgIndex.tcl index 1450276..114dee6 100644 --- a/library/dde/pkgIndex.tcl +++ b/library/dde/pkgIndex.tcl @@ -1,7 +1,7 @@ if {![package vsatisfies [package provide Tcl] 8]} return if {[info sharedlibextension] != ".dll"} return if {[info exists ::tcl_platform(debug)]} { - package ifneeded dde 1.2.5 [list load [file join $dir tcldde12g.dll] dde] + package ifneeded dde 1.3.3 [list load [file join $dir tcldde13g.dll] dde] } else { - package ifneeded dde 1.2.5 [list load [file join $dir tcldde12.dll] dde] + package ifneeded dde 1.3.3 [list load [file join $dir tcldde13.dll] dde] } diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index 40032a5..1241f2a 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,9 +1,9 @@ if {![package vsatisfies [package provide Tcl] 8]} return if {[info sharedlibextension] != ".dll"} return if {[info exists ::tcl_platform(debug)]} { - package ifneeded registry 1.1.5 \ - [list load [file join $dir tclreg11g.dll] registry] + package ifneeded registry 1.2.2 \ + [list load [file join $dir tclreg12g.dll] registry] } else { - package ifneeded registry 1.1.5 \ - [list load [file join $dir tclreg11.dll] registry] + package ifneeded registry 1.2.2 \ + [list load [file join $dir tclreg12.dll] registry] } diff --git a/tests/winDde.test b/tests/winDde.test index 85fb5a6..454e76d 100644 --- a/tests/winDde.test +++ b/tests/winDde.test @@ -2,7 +2,7 @@ # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and -# generates output for errors. No output means no errors were found. +# generates output for errors. No output means no errors were found. # # Copyright (c) 1999 by Scriptics Corporation. # @@ -66,6 +66,8 @@ proc createChildProcess { ddeServerName } { return $f } +# ------------------------------------------------------------------------- + test winDde-1.1 {Settings the server's topic name} {pcOnly} { list [dde servername foobar] [dde servername] [dde servername self] } {foobar foobar self} @@ -84,6 +86,8 @@ test winDde-2.3 {Checking for existence, with only the service specified} \ expr [llength [dde services TclEval {}]] >= 1 } 1 +# ------------------------------------------------------------------------- + test winDde-3.1 {DDE execute locally} {pcOnly} { set a "" dde execute TclEval self {set a "foo"} @@ -114,47 +118,48 @@ test winDde-3.5 {DDE request locally} {pcOnly} { dde request -binary TclEval self a } "foo\x00" +# ------------------------------------------------------------------------- + test winDde-4.1 {DDE execute remotely} {stdio pcOnly} { - list [catch { - set a "" - set child [createChildProcess child] - dde execute TclEval child {set a "foo"} - dde execute TclEval child {set done 1} - set a - } err] $err -} [list 0 ""] - -test winDde-4.2 {DDE execute remotely} {stdio pcOnly} { - list [catch { - set a "" - set child [createChildProcess child] - dde execute -async TclEval child {set a "foo"} - after 400 {set ::_dde_forever 1} ; vwait ::_dde_forever; #update - dde execute TclEval child {set done 1} - set a - } err] $err -} [list 0 ""] - -test winDde-4.3 {DDE request locally} {stdio pcOnly} { - list [catch { - set a "" - set child [createChildProcess child] - dde execute TclEval child {set a "foo"} - set a [dde request TclEval child a] - dde execute TclEval child {set done 1} - set a - } err] $err -} [list 0 foo] - -test winDde-4.4 {DDE eval locally} {stdio pcOnly} { - list [catch { - set a "" - set child [createChildProcess child] - set a [dde eval child set a "foo"] - dde execute TclEval child {set done 1} - set a - } err] $err -} [list 0 foo] + set a "" + set name child-4.1 + set child [createChildProcess $name] + dde execute TclEval $name {set a "foo"} + dde execute TclEval $name {set done 1} + update + set a +} "" +test winDde-4.2 {DDE execute async remotely} {stdio pcOnly} { + set a "" + set name child-4.2 + set child [createChildProcess $name] + dde execute -async TclEval $name {set a "foo"} + update + dde execute TclEval $name {set done 1} + update + set a +} "" +test winDde-4.3 {DDE request remotely} {stdio pcOnly} { + set a "" + set name chile-4.3 + set child [createChildProcess $name] + dde execute TclEval $name {set a "foo"} + set a [dde request TclEval $name a] + dde execute TclEval $name {set done 1} + update + set a +} foo +test winDde-4.4 {DDE eval remotely} {stdio pcOnly} { + set a "" + set name child-4.4 + set child [createChildProcess $name] + set a [dde eval $name set a "foo"] + dde execute TclEval $name {set done 1} + update + set a +} foo + +# ------------------------------------------------------------------------- test winDde-5.1 {check for bad arguments} {pcOnly} { catch {dde execute "" "" "" ""} result @@ -175,7 +180,14 @@ test winDde-5.4 {DDE eval bad arguments} {pcOnly} { list [catch {dde eval "" "foo"} msg] $msg } {1 {invalid service name ""}} +# ------------------------------------------------------------------------- + #cleanup +#catch {interp delete $slave}; # ensure we clean up the slave. file delete -force $::scriptName ::tcltest::cleanupTests return + +# Local Variables: +# mode: tcl +# End: diff --git a/tools/tcl.wse.in b/tools/tcl.wse.in index 1dceec0..a4d8ede 100644 --- a/tools/tcl.wse.in +++ b/tools/tcl.wse.in @@ -162,7 +162,7 @@ item: Custom Dialog Set Title Danish=Velkommen Title Dutch=Welkom Title Norwegian=Velkommen - Title Swedish=Välkommen + Title Swedish=V�lkommen Width=273 Height=250 Font Name=Helv @@ -235,7 +235,7 @@ item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -250,7 +250,7 @@ item: Custom Dialog Set Text=Welcome! Text French=Bienvenue ! Text German=Willkommen! - Text Spanish=¡Bienvenido! + Text Spanish=�Bienvenido! Text Italian=Benvenuti! end item: Push Button @@ -271,8 +271,8 @@ item: Custom Dialog Set Create Flags=01010000000000010000000000000000 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -295,14 +295,14 @@ item: Custom Dialog Set Text=It is strongly recommended that you exit all Windows programs before running this installation program. Text French=Ce programme d'installation va installer %APPTITLE%. Text French= - Text French=Cliquez sur le bouton Suite pour démarrer l'installation. Vous pouvez cliquer sur le bouton Quitter l'installation si vous ne voulez pas installer %APPTITLE% tout de suite. + Text French=Cliquez sur le bouton Suite pour d�marrer l'installation. Vous pouvez cliquer sur le bouton Quitter l'installation si vous ne voulez pas installer %APPTITLE% tout de suite. Text German=Mit diesem Installationsprogramm wird %APPTITLE% installiert. Text German= Text German=Klicken Sie auf "Weiter", um mit der Installation zu beginnen. Klicken Sie auf "Abbrechen", um die Installation von %APPTITLE% abzubrechen. - Text Spanish=Este programa de instalación instalará %APPTITLE%. + Text Spanish=Este programa de instalaci�n instalar� %APPTITLE%. Text Spanish= - Text Spanish=Presione el botón Siguiente para iniciar la instalación. Puede presionar el botón Salir de instalación si no desea instalar %APPTITLE% en este momento. - Text Italian=Questo programma installerà %APPTITLE%. + Text Spanish=Presione el bot�n Siguiente para iniciar la instalaci�n. Puede presionar el bot�n Salir de instalaci�n si no desea instalar %APPTITLE% en este momento. + Text Italian=Questo programma installer� %APPTITLE%. Text Italian= Text Italian=Per avvviare l'installazione premere il pulsante Avanti. Se non si desidera installare %APPTITLE% ora, premere il pulsante Esci dall'installazione. end @@ -320,7 +320,7 @@ item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -345,8 +345,8 @@ item: Custom Dialog Set Flags=0000000000000001 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -371,8 +371,8 @@ item: Custom Dialog Set Name=Times New Roman Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 Text=Select Destination Directory - Text French=Sélectionner le répertoire de destination - Text German=Zielverzeichnis wählen + Text French=S�lectionner le r�pertoire de destination + Text German=Zielverzeichnis w�hlen Text Spanish=Seleccione el directorio de destino Text Italian=Selezionare Directory di destinazione end @@ -384,7 +384,7 @@ item: Custom Dialog Set Text=To install in the default directory below, click Next. Text= Text=To install in a different directory, click Browse and select another directory. - Text French=Veuillez sélectionner le répertoire dans lequel les fichiers %APPTITLE% doivent être installés. + Text French=Veuillez s�lectionner le r�pertoire dans lequel les fichiers %APPTITLE% doivent �tre install�s. Text German=Geben Sie an, in welchem Verzeichnis die %APPTITLE%-Dateien installiert werden sollen. Text Spanish=Por favor seleccione el directorio donde desee instalar los archivos de %APPTITLE%. Text Italian=Selezionare la directory dove verranno installati i file %APPTITLE%. @@ -419,8 +419,8 @@ item: Custom Dialog Set end item: Dialog Title=Select Destination Directory - Title French=Sélectionner le répertoire de destination - Title German=Zielverzeichnis wählen + Title French=S�lectionner le r�pertoire de destination + Title German=Zielverzeichnis w�hlen Title Spanish=Seleccione el directorio de destino Title Italian=Selezionare Directory di destinazione Width=221 @@ -468,7 +468,7 @@ remarked item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -492,8 +492,8 @@ remarked item: Custom Dialog Set Create Flags=01010000000000010000000000000000 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -518,8 +518,8 @@ remarked item: Custom Dialog Set Name=Times New Roman Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 Text=Select Installation Type - Text French=Sélectionner les composants - Text German=Komponenten auswählen + Text French=S�lectionner les composants + Text German=Komponenten ausw�hlen Text Spanish=Seleccione componentes Text Italian=Selezionare i componenti end @@ -562,7 +562,7 @@ remarked item: Custom Dialog Set Create Flags=01010000000000000000000000000000 Text=Choose which type of installation to perform by selecting one of the buttons below. Text French=Choisissez les composants que vous voulez installer en cochant les cases ci-dessous. - Text German=Wählen Sie die zu installierenden Komponenten, indem Sie in die entsprechenden Kästchen klicken. + Text German=W�hlen Sie die zu installierenden Komponenten, indem Sie in die entsprechenden K�stchen klicken. Text Spanish=Elija los componentes que desee instalar marcando los cuadros de abajo. Text Italian=Scegliere quali componenti installare selezionando le caselle sottostanti. end @@ -584,7 +584,7 @@ item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -608,8 +608,8 @@ item: Custom Dialog Set Create Flags=01010000000000010000000000000000 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -634,8 +634,8 @@ item: Custom Dialog Set Name=Times New Roman Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 Text=Select Components - Text French=Sélectionner les composants - Text German=Komponenten auswählen + Text French=S�lectionner les composants + Text German=Komponenten ausw�hlen Text Spanish=Seleccione componentes Text Italian=Selezionare i componenti end @@ -709,7 +709,7 @@ item: Custom Dialog Set Create Flags=01010000000000000000000000000000 Text=Choose which components to install by checking the boxes below. Text French=Choisissez les composants que vous voulez installer en cochant les cases ci-dessous. - Text German=Wählen Sie die zu installierenden Komponenten, indem Sie in die entsprechenden Kästchen klicken. + Text German=W�hlen Sie die zu installierenden Komponenten, indem Sie in die entsprechenden K�stchen klicken. Text Spanish=Elija los componentes que desee instalar marcando los cuadros de abajo. Text Italian=Scegliere quali componenti installare selezionando le caselle sottostanti. end @@ -722,7 +722,7 @@ item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -747,8 +747,8 @@ item: Custom Dialog Set Flags=0000000000000001 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -773,7 +773,7 @@ item: Custom Dialog Set Name=Times New Roman Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 Text=Select ProgMan Group - Text French=Sélectionner le groupe du Gestionnaire de programme + Text French=S�lectionner le groupe du Gestionnaire de programme Text German=Bestimmung der Programm-Managergruppe Text Spanish=Seleccione grupo del Administrador de programas Text Italian=Selezionare il gruppo ProgMan @@ -782,8 +782,8 @@ item: Custom Dialog Set Rectangle=86 44 256 68 Create Flags=01010000000000000000000000000000 Text=Enter the name of the Program Manager group to add the %APPTITLE% icons to: - Text French=Entrez le nom du groupe du Gestionnaire de programme dans lequel vous souhaitez ajouter les icônes de %APPTITLE% : - Text German=Geben Sie den Namen der Programmgruppe ein, der das Symbol %APPTITLE% hinzugefügt werden soll: + Text French=Entrez le nom du groupe du Gestionnaire de programme dans lequel vous souhaitez ajouter les ic�nes de %APPTITLE% : + Text German=Geben Sie den Namen der Programmgruppe ein, der das Symbol %APPTITLE% hinzugef�gt werden soll: Text Spanish=Escriba el nombre del grupo del Administrador de programas en el que desea agregar los iconos de %APPTITLE%: Text Italian=Inserire il nome del gruppo Program Manager per aggiungere le icone %APPTITLE% a: end @@ -807,7 +807,7 @@ item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -831,8 +831,8 @@ item: Custom Dialog Set Create Flags=01010000000000010000000000000000 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -857,9 +857,9 @@ item: Custom Dialog Set Name=Times New Roman Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 Text=Ready to Install! - Text French=Prêt à installer ! + Text French=Pr�t � installer ! Text German=Installationsbereit! - Text Spanish=¡Preparado para la instalación! + Text Spanish=�Preparado para la instalaci�n! Text Italian=Pronto per l'installazione! end item: Static @@ -868,16 +868,16 @@ item: Custom Dialog Set Text=You are now ready to install %APPTITLE%. Text= Text=Press the Next button to begin the installation or the Back button to reenter the installation information. - Text French=Vous êtes maintenant prêt à installer les fichiers %APPTITLE%. + Text French=Vous �tes maintenant pr�t � installer les fichiers %APPTITLE%. Text French= - Text French=Cliquez sur le bouton Suite pour commencer l'installation ou sur le bouton Retour pour entrer les informations d'installation à nouveau. - Text German=Sie können %APPTITLE% nun installieren. + Text French=Cliquez sur le bouton Suite pour commencer l'installation ou sur le bouton Retour pour entrer les informations d'installation � nouveau. + Text German=Sie k�nnen %APPTITLE% nun installieren. Text German= - Text German=Klicken Sie auf "Weiter", um mit der Installation zu beginnen. Klicken Sie auf "Zurück", um die Installationsinformationen neu einzugeben. - Text Spanish=Ya está listo para instalar %APPTITLE%. + Text German=Klicken Sie auf "Weiter", um mit der Installation zu beginnen. Klicken Sie auf "Zur�ck", um die Installationsinformationen neu einzugeben. + Text Spanish=Ya est� listo para instalar %APPTITLE%. Text Spanish= - Text Spanish=Presione el botón Siguiente para comenzar la instalación o presione Atrás para volver a ingresar la información para la instalación. - Text Italian=Ora è possibile installare %APPTITLE%. + Text Spanish=Presione el bot�n Siguiente para comenzar la instalaci�n o presione Atr�s para volver a ingresar la informaci�n para la instalaci�n. + Text Italian=Ora � possibile installare %APPTITLE%. Text Italian= Text Italian=Premere il pulsante Avanti per avviare l'installazione o il pulsante Indietro per reinserire le informazioni di installazione. end @@ -1583,22 +1583,22 @@ item: Install File end item: Install File Source=${__TCLBASEDIR__}\library\reg\pkgIndex.tcl - Destination=%MAINDIR%\lib\tcl%VER%\reg1.0\pkgIndex.tcl + Destination=%MAINDIR%\lib\tcl%VER%\reg1.2\pkgIndex.tcl Flags=0000000000000010 end item: Install File - Source=${__TCLBASEDIR__}\win\release\tclreg10.dll - Destination=%MAINDIR%\lib\tcl%VER%\reg1.0\tclreg10.dll + Source=${__TCLBASEDIR__}\win\release\tclreg12.dll + Destination=%MAINDIR%\lib\tcl%VER%\reg1.2\tclreg10.dll Flags=0000000000000010 end item: Install File Source=${__TCLBASEDIR__}\library\dde\pkgIndex.tcl - Destination=%MAINDIR%\lib\tcl%VER%\dde1.2\pkgIndex.tcl + Destination=%MAINDIR%\lib\tcl%VER%\dde1.3\pkgIndex.tcl Flags=0000000000000010 end item: Install File - Source=${__TCLBASEDIR__}\win\release\tcldde12.dll - Destination=%MAINDIR%\lib\tcl%VER%\dde1.2\tcldde12.dll + Source=${__TCLBASEDIR__}\win\release\tcldde13.dll + Destination=%MAINDIR%\lib\tcl%VER%\dde1.2\tcldde13.dll Flags=0000000000000010 end item: Install File @@ -2257,7 +2257,7 @@ item: Custom Dialog Set Title=%APPTITLE% Installation Title French=Installation de %APPTITLE% Title German=Installation von %APPTITLE% - Title Spanish=Instalación de %APPTITLE% + Title Spanish=Instalaci�n de %APPTITLE% Title Italian=Installazione di %APPTITLE% Width=271 Height=224 @@ -2281,8 +2281,8 @@ item: Custom Dialog Set Create Flags=01010000000000010000000000000000 Text=< &Back Text French=< &Retour - Text German=< &Zurück - Text Spanish=< &Atrás + Text German=< &Zur�ck + Text Spanish=< &Atr�s Text Italian=< &Indietro end item: Push Button @@ -2309,9 +2309,9 @@ item: Custom Dialog Set Name=Times New Roman Font Style=-24 0 0 0 700 255 0 0 0 3 2 1 18 Text=Installation Completed! - Text French=Installation terminée ! + Text French=Installation termin�e ! Text German=Die Installation ist abgeschlossen! - Text Spanish=¡Instalación terminada! + Text Spanish=�Instalaci�n terminada! Text Italian=Installazione completata! end item: Static @@ -2324,16 +2324,16 @@ item: Custom Dialog Set Text=You can learn more about Tcl/Tk %VER%, including release notes, updates, tutorials, and more at %URL%. Check the box below to start your web browser and go there now. Text= Text=The installer may ask you to reboot your computer, this is to update your PATH and is not necessary to do immediately. - Text French=%APPTITLE% est maintenant installé. + Text French=%APPTITLE% est maintenant install�. Text French= Text French=Cliquez sur le bouton Fin pour quitter l'installation. Text German=%APPTITLE% wurde erfolgreich installiert. Text German= Text German=Klicken Sie auf "Weiter", um die Installation zu beenden. - Text Spanish=%APPTITLE% se ha instalado con éxito. + Text Spanish=%APPTITLE% se ha instalado con �xito. Text Spanish= - Text Spanish=Presione el botón Terminar para salir de esta instalación. - Text Italian=L'installazione %APPTITLE% è stata portata a termine con successo. + Text Spanish=Presione el bot�n Terminar para salir de esta instalaci�n. + Text Italian=L'installazione %APPTITLE% � stata portata a termine con successo. Text Italian= Text Italian=Premere il pulsante Fine per uscire dall'installazione. end diff --git a/unix/Makefile.in b/unix/Makefile.in index 72fb215..0752106 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -648,7 +648,7 @@ install-binaries: binaries @INSTALL_STUB_LIB@ ; \ fi @if test "x$(DLL_INSTALL_DIR)" = "x$(BIN_INSTALL_DIR)"; then\ - for i in dde1.2 reg1.1; do \ + for i in dde1.3 reg1.2; do \ if [ ! -d $(LIB_INSTALL_DIR)/$$i ] ; then \ echo "Making directory $(LIB_INSTALL_DIR)/$$i";\ mkdir -p $(LIB_INSTALL_DIR)/$$i;\ @@ -656,14 +656,14 @@ install-binaries: binaries else true;\ fi;\ done;\ - echo "Installing tcldde12.dll";\ - $(INSTALL_DATA) "$(TOP_DIR)/library/dde/pkgIndex.tcl" "$(LIB_INSTALL_DIR)/dde1.2";\ - $(INSTALL_LIBRARY) "$(TOP_DIR)/win/tcldde12.dll" "$(LIB_INSTALL_DIR)/dde1.2";\ - chmod 555 "$(LIB_INSTALL_DIR)/dde1.2/tcldde12.dll";\ - echo "Installing tclreg11.dll";\ - $(INSTALL_DATA) "$(TOP_DIR)/library/reg/pkgIndex.tcl" "$(LIB_INSTALL_DIR)/reg1.1";\ - $(INSTALL_LIBRARY) "$(TOP_DIR)/win/tclreg11.dll" "$(LIB_INSTALL_DIR)/reg1.1";\ - chmod 555 "$(LIB_INSTALL_DIR)/reg1.1/tclreg11.dll";\ + echo "Installing tcldde13.dll";\ + $(INSTALL_DATA) "$(TOP_DIR)/library/dde/pkgIndex.tcl" "$(LIB_INSTALL_DIR)/dde1.3";\ + $(INSTALL_LIBRARY) "$(TOP_DIR)/win/tcldde13.dll" "$(LIB_INSTALL_DIR)/dde1.3";\ + chmod 555 "$(LIB_INSTALL_DIR)/dde1.3/tcldde13.dll";\ + echo "Installing tclreg12.dll";\ + $(INSTALL_DATA) "$(TOP_DIR)/library/reg/pkgIndex.tcl" "$(LIB_INSTALL_DIR)/reg1.2";\ + $(INSTALL_LIBRARY) "$(TOP_DIR)/win/tclreg12.dll" "$(LIB_INSTALL_DIR)/reg1.2";\ + chmod 555 "$(LIB_INSTALL_DIR)/reg1.2/tclreg12.dll";\ fi @EXTRA_INSTALL_BINARIES@ diff --git a/unix/configure b/unix/configure index 39a9e1c..80d747c 100755 --- a/unix/configure +++ b/unix/configure @@ -2884,7 +2884,7 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 if test "x${TCL_THREADS}" = "x0"; then { echo "configure: error: CYGWIN compile is only supported with --enable-threads" 1>&2; exit 1; } fi - if test "x${SHARED_BUILD}" = "x1" -a ! -f "../win/tcldde12.dll" -a ! -f "../win/tk84.dll"; then + if test "x${SHARED_BUILD}" = "x1" -a ! -f "../win/tcldde13.dll" -a ! -f "../win/tk84.dll"; then { echo "configure: error: Please configure and make the ../win directory first." 1>&2; exit 1; } fi ;; diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 360b3a1..db64bbe 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1229,7 +1229,7 @@ dnl AC_CHECK_TOOL(AR, ar) if test "x${TCL_THREADS}" = "x0"; then AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads]) fi - if test "x${SHARED_BUILD}" = "x1" -a ! -f "../win/tcldde12.dll" -a ! -f "../win/tk84.dll"; then + if test "x${SHARED_BUILD}" = "x1" -a ! -f "../win/tcldde13.dll" -a ! -f "../win/tk84.dll"; then AC_MSG_ERROR([Please configure and make the ../win directory first.]) fi ;; diff --git a/win/configure b/win/configure index 51a86a7..0f36f24 100755 --- a/win/configure +++ b/win/configure @@ -541,14 +541,14 @@ TCL_MINOR_VERSION=4 TCL_PATCH_LEVEL=".19" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION -TCL_DDE_VERSION=1.2 +TCL_DDE_VERSION=1.3 TCL_DDE_MAJOR_VERSION=1 -TCL_DDE_MINOR_VERSION=2 +TCL_DDE_MINOR_VERSION=3 DDEVER=$TCL_DDE_MAJOR_VERSION$TCL_DDE_MINOR_VERSION -TCL_REG_VERSION=1.1 +TCL_REG_VERSION=1.2 TCL_REG_MAJOR_VERSION=1 -TCL_REG_MINOR_VERSION=1 +TCL_REG_MINOR_VERSION=2 REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION #------------------------------------------------------------------------ diff --git a/win/configure.in b/win/configure.in index 635469b..99dc334 100644 --- a/win/configure.in +++ b/win/configure.in @@ -12,14 +12,14 @@ TCL_MINOR_VERSION=4 TCL_PATCH_LEVEL=".19" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION -TCL_DDE_VERSION=1.2 +TCL_DDE_VERSION=1.3 TCL_DDE_MAJOR_VERSION=1 -TCL_DDE_MINOR_VERSION=2 +TCL_DDE_MINOR_VERSION=3 DDEVER=$TCL_DDE_MAJOR_VERSION$TCL_DDE_MINOR_VERSION -TCL_REG_VERSION=1.1 +TCL_REG_VERSION=1.2 TCL_REG_MAJOR_VERSION=1 -TCL_REG_MINOR_VERSION=1 +TCL_REG_MINOR_VERSION=2 REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION #------------------------------------------------------------------------ diff --git a/win/makefile.bc b/win/makefile.bc index 3c0ea73..6a3cd9d 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -110,11 +110,11 @@ STUBPREFIX = $(NAMEPREFIX)stub DOTVERSION = 8.4 VERSION = 84 -DDEVERSION = 12 -DDEDOTVERSION = 1.2 +DDEVERSION = 13 +DDEDOTVERSION = 1.3 -REGVERSION = 11 -REGDOTVERSION = 1.1 +REGVERSION = 12 +REGDOTVERSION = 1.2 BINROOT = .. !IF "$(NODEBUG)" == "1" diff --git a/win/makefile.vc b/win/makefile.vc index 94a585b..41a0006 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -159,10 +159,10 @@ STUBPREFIX = $(PROJECT)stub DOTVERSION = 8.4 VERSION = $(DOTVERSION:.=) -DDEDOTVERSION = 1.2 +DDEDOTVERSION = 1.3 DDEVERSION = $(DDEDOTVERSION:.=) -REGDOTVERSION = 1.1 +REGDOTVERSION = 1.2 REGVERSION = $(REGDOTVERSION:.=) BINROOT = . diff --git a/win/rules.vc b/win/rules.vc index 425f5fb..38e8175 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -477,8 +477,8 @@ TCLSH = "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" TCLSTUBLIB = "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib" TCLIMPLIB = "$(_INSTALLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_INSTALLDIR)\lib -TCLREGLIB = "$(_INSTALLDIR)\lib\tclreg11$(SUFX:t=).lib" -TCLDDELIB = "$(_INSTALLDIR)\lib\tcldde12$(SUFX:t=).lib" +TCLREGLIB = "$(_INSTALLDIR)\lib\tclreg12$(SUFX:t=).lib" +TCLDDELIB = "$(_INSTALLDIR)\lib\tcldde13$(SUFX:t=).lib" COFFBASE = \must\have\tcl\sources\to\build\this\target TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target !else @@ -486,8 +486,8 @@ TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_TCLDIR)\library -TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg11$(SUFX:t=).lib" -TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde12$(SUFX:t=).lib" +TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg12$(SUFX:t=).lib" +TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde13$(SUFX:t=).lib" COFFBASE = "$(_TCLDIR)\win\coffbase.txt" TCLTOOLSDIR = $(_TCLDIR)\tools !endif diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 4aa6f71..eef5caa 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -10,6 +10,7 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#include "tclInt.h" #include "tclPort.h" #include #include @@ -34,6 +35,7 @@ typedef struct RegisteredInterp { /* The next interp this application knows * about. */ char *name; /* Interpreter's name (malloc-ed). */ + Tcl_Obj *handlerPtr; /* The server handler command */ Tcl_Interp *interp; /* The interpreter attached to this name. */ } RegisteredInterp; @@ -49,6 +51,14 @@ typedef struct Conversation { Tcl_Obj *returnPackagePtr; /* The result package for this conversation. */ } Conversation; +typedef struct DdeEnumServices { + Tcl_Interp *interp; + int result; + ATOM service; + ATOM topic; + HWND hwnd; +} DdeEnumServices; + typedef struct ThreadSpecificData { Conversation *currentConversations; /* A list of conversations currently being @@ -69,23 +79,33 @@ static DWORD ddeInstance; /* The application instance handle given to us * by DdeInitialize. */ static int ddeIsServer = 0; -#define TCL_DDE_VERSION "1.2.5" #define TCL_DDE_PACKAGE_NAME "dde" #define TCL_DDE_SERVICE_NAME "TclEval" #define TCL_DDE_EXECUTE_RESULT "$TCLEVAL$EXECUTE$RESULT" +#define DDE_FLAG_ASYNC 1 +#define DDE_FLAG_BINARY 2 +#define DDE_FLAG_FORCE 4 + TCL_DECLARE_MUTEX(ddeMutex) /* * Forward declarations for functions defined later in this file. */ +static LRESULT CALLBACK DdeClientWindowProc(HWND hwnd, UINT uMsg, + WPARAM wParam, LPARAM lParam); +static int DdeCreateClient(struct DdeEnumServices *es); +static BOOL CALLBACK DdeEnumWindowsCallback(HWND hwndTarget, + LPARAM lParam); static void DdeExitProc(ClientData clientData); static int DdeGetServicesList(Tcl_Interp *interp, const char *serviceName, const char *topicName); static HDDEDATA CALLBACK DdeServerProc(UINT uType, UINT uFmt, HCONV hConv, HSZ ddeTopic, HSZ ddeItem, HDDEDATA hData, DWORD dwData1, DWORD dwData2); +static LRESULT DdeServicesOnAck(HWND hwnd, WPARAM wParam, + LPARAM lParam); static void DeleteProc(ClientData clientData); static Tcl_Obj * ExecuteRemoteObject(RegisteredInterp *riPtr, Tcl_Obj *ddeObjectPtr); @@ -97,6 +117,7 @@ static int DdeObjCmd(ClientData clientData, Tcl_Obj *const objv[]); EXTERN int Dde_Init(Tcl_Interp *interp); +EXTERN int Dde_SafeInit(Tcl_Interp *interp); /* *---------------------------------------------------------------------- @@ -124,7 +145,34 @@ Dde_Init( Tcl_CreateObjCommand(interp, "dde", DdeObjCmd, NULL, NULL); Tcl_CreateExitHandler(DdeExitProc, NULL); - return Tcl_PkgProvide(interp, TCL_DDE_PACKAGE_NAME, TCL_DDE_VERSION); + return Tcl_PkgProvide(interp, TCL_DDE_PACKAGE_NAME, "1.3.3"); +} + +/* + *---------------------------------------------------------------------- + * + * Dde_SafeInit -- + * + * This function initializes the dde command within a safe interp + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +Dde_SafeInit( + Tcl_Interp *interp) +{ + int result = Dde_Init(interp); + if (result == TCL_OK) { + Tcl_HideCommand(interp, "dde", "dde"); + } + return result; } /* @@ -181,7 +229,7 @@ Initialize(void) ddeIsServer = 1; Tcl_CreateExitHandler(DdeExitProc, NULL); ddeServiceGlobal = DdeCreateStringHandle(ddeInstance, - TCL_DDE_SERVICE_NAME, CP_WINANSI); + TCL_DDE_SERVICE_NAME, 0); DdeNameService(ddeInstance, ddeServiceGlobal, 0L, DNS_REGISTER); } else { ddeIsServer = 0; @@ -218,13 +266,19 @@ Initialize(void) static const char * DdeSetServerName( Tcl_Interp *interp, - const char *name /* The name that will be used to refer to the + const char *name, /* The name that will be used to refer to the * interpreter in later "send" commands. Must * be globally unique. */ - ) + int flags, /* DDE_FLAG_FORCE or 0 */ + Tcl_Obj *handlerPtr) /* Name of the optional proc/command to handle + * incoming Dde eval's */ { + int suffix, offset; RegisteredInterp *riPtr, *prevPtr; Tcl_DString dString; + const char *actualName; + Tcl_Obj *srvListPtr = NULL, **srvPtrPtr = NULL; + int n, srvCount = 0, lastSuffix, r = TCL_OK; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* @@ -263,7 +317,67 @@ DdeSetServerName( return ""; } + /* + * Get the list of currently registered Tcl interpreters by calling the + * internal implementation of the 'dde services' command. + */ + Tcl_DStringInit(&dString); + actualName = name; + + if (!(flags & DDE_FLAG_FORCE)) { + r = DdeGetServicesList(interp, TCL_DDE_SERVICE_NAME, NULL); + if (r == TCL_OK) { + srvListPtr = Tcl_GetObjResult(interp); + } + if (r == TCL_OK) { + r = Tcl_ListObjGetElements(interp, srvListPtr, &srvCount, + &srvPtrPtr); + } + if (r != TCL_OK) { + OutputDebugString(Tcl_GetStringResult(interp)); + return NULL; + } + + /* + * Pick a name to use for the application. Use "name" if it's not + * already in use. Otherwise add a suffix such as " #2", trying larger + * and larger numbers until we eventually find one that is unique. + */ + + offset = lastSuffix = 0; + suffix = 1; + + while (suffix != lastSuffix) { + lastSuffix = suffix; + if (suffix > 1) { + if (suffix == 2) { + Tcl_DStringAppend(&dString, name, -1); + Tcl_DStringAppend(&dString, " #", 2); + offset = Tcl_DStringLength(&dString); + Tcl_DStringSetLength(&dString, offset + TCL_INTEGER_SPACE); + actualName = Tcl_DStringValue(&dString); + } + sprintf(Tcl_DStringValue(&dString) + offset, "%d", suffix); + } + + /* + * See if the name is already in use, if so increment suffix. + */ + + for (n = 0; n < srvCount; ++n) { + Tcl_Obj* namePtr; + + Tcl_ListObjIndex(interp, srvPtrPtr[n], 1, &namePtr); + if (strcmp(actualName, Tcl_GetString(namePtr)) == 0) { + suffix++; + break; + } + } + } + Tcl_DStringSetLength(&dString, + offset + (int)strlen(Tcl_DStringValue(&dString)+offset)); + } /* * We have found a unique name. Now add it to the registry. @@ -271,10 +385,18 @@ DdeSetServerName( riPtr = (RegisteredInterp *) ckalloc(sizeof(RegisteredInterp)); riPtr->interp = interp; - riPtr->name = ckalloc((unsigned int) strlen(name) + 1); + riPtr->name = ckalloc((unsigned int) strlen(actualName) + 1); riPtr->nextPtr = tsdPtr->interpListPtr; + riPtr->handlerPtr = handlerPtr; + if (riPtr->handlerPtr != NULL) { + Tcl_IncrRefCount(riPtr->handlerPtr); + } tsdPtr->interpListPtr = riPtr; - strcpy(riPtr->name, name); + strcpy(riPtr->name, actualName); + + if (Tcl_IsSafe(interp)) { + Tcl_ExposeCommand(interp, "dde", "dde"); + } Tcl_CreateObjCommand(interp, "dde", DdeObjCmd, (ClientData) riPtr, DeleteProc); @@ -295,6 +417,38 @@ DdeSetServerName( /* *---------------------------------------------------------------------- * + * DdeGetRegistrationPtr + * + * Retrieve the registration info for an interpreter. + * + * Results: + * Returns a pointer to the registration structure or NULL + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +static RegisteredInterp * +DdeGetRegistrationPtr( + Tcl_Interp *interp) +{ + RegisteredInterp *riPtr; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + + for (riPtr = tsdPtr->interpListPtr; riPtr != NULL; + riPtr = riPtr->nextPtr) { + if (riPtr->interp == interp) { + break; + } + } + return riPtr; +} + +/* + *---------------------------------------------------------------------- + * * DeleteProc * * This function is called when the command "dde" is destroyed. @@ -333,6 +487,9 @@ DeleteProc( } } ckfree(riPtr->name); + if (riPtr->handlerPtr) { + Tcl_DecrRefCount(riPtr->handlerPtr); + } Tcl_EventuallyFree(clientData, TCL_DYNAMIC); } @@ -365,10 +522,35 @@ ExecuteRemoteObject( Tcl_Obj *ddeObjectPtr) /* The object to execute. */ { Tcl_Obj *returnPackagePtr; - int result; + int result = TCL_OK; + + if (riPtr->handlerPtr == NULL && Tcl_IsSafe(riPtr->interp)) { + Tcl_SetObjResult(riPtr->interp, Tcl_NewStringObj("permission denied: " + "a handler procedure must be defined for use in a safe " + "interp", -1)); + result = TCL_ERROR; + } + + if (riPtr->handlerPtr != NULL) { + /* + * Add the dde request data to the handler proc list. + */ + + Tcl_Obj *cmdPtr = Tcl_DuplicateObj(riPtr->handlerPtr); + + result = Tcl_ListObjAppendElement(riPtr->interp, cmdPtr, + ddeObjectPtr); + if (result == TCL_OK) { + ddeObjectPtr = cmdPtr; + } + } + + if (result == TCL_OK) { + result = Tcl_EvalObjEx(riPtr->interp, ddeObjectPtr, TCL_EVAL_GLOBAL); + } + + returnPackagePtr = Tcl_NewListObj(0, NULL); - result = Tcl_EvalObjEx(riPtr->interp, ddeObjectPtr, TCL_EVAL_GLOBAL); - returnPackagePtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); Tcl_ListObjAppendElement(NULL, returnPackagePtr, Tcl_NewIntObj(result)); Tcl_ListObjAppendElement(NULL, returnPackagePtr, @@ -549,21 +731,27 @@ DdeServerProc( ddeReturn = DdeCreateDataHandle(ddeInstance, (BYTE *)returnString, (DWORD) len+1, 0, ddeItem, uFmt, 0); } else { - Tcl_Obj *variableObjPtr = Tcl_GetVar2Ex( - convPtr->riPtr->interp, utilString, NULL, - TCL_GLOBAL_ONLY); - if (variableObjPtr != NULL) { - if (uFmt == CF_TEXT) { - returnString = Tcl_GetStringFromObj(variableObjPtr, &len); + if (Tcl_IsSafe(convPtr->riPtr->interp)) { + ddeReturn = NULL; + } else { + Tcl_Obj *variableObjPtr = Tcl_GetVar2Ex( + convPtr->riPtr->interp, utilString, NULL, + TCL_GLOBAL_ONLY); + if (variableObjPtr != NULL) { + if (uFmt == CF_TEXT) { + returnString = Tcl_GetStringFromObj( + variableObjPtr, &len); + } else { + returnString = (char *) Tcl_GetUnicodeFromObj( + variableObjPtr, &len); + len = 2 * len + 1; + } + ddeReturn = DdeCreateDataHandle(ddeInstance, + (BYTE *)returnString, (DWORD) len+1, 0, ddeItem, + uFmt, 0); } else { - returnString = (char *) - Tcl_GetUnicodeFromObj(variableObjPtr, &len); - len = 2 * len + 1; + ddeReturn = NULL; } - ddeReturn = DdeCreateDataHandle(ddeInstance, - (BYTE *) returnString, (DWORD) len+1, 0, ddeItem, uFmt, 0); - } else { - ddeReturn = NULL; } } Tcl_DStringFree(&dString); @@ -723,8 +911,8 @@ MakeDdeConnection( HSZ ddeTopic, ddeService; HCONV ddeConv; - ddeService = DdeCreateStringHandle(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINANSI); - ddeTopic = DdeCreateStringHandle(ddeInstance, name, CP_WINANSI); + ddeService = DdeCreateStringHandle(ddeInstance, TCL_DDE_SERVICE_NAME, 0); + ddeTopic = DdeCreateStringHandle(ddeInstance, name, 0); ddeConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -762,21 +950,9 @@ MakeDdeConnection( *---------------------------------------------------------------------- */ -typedef struct ddeEnumServices { - Tcl_Interp *interp; - int result; - ATOM service; - ATOM topic; - HWND hwnd; -} ddeEnumServices; - -static LRESULT CALLBACK -DdeClientWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -static LRESULT -DdeServicesOnAck(HWND hwnd, WPARAM wParam, LPARAM lParam); - static int -DdeCreateClient(ddeEnumServices *es) +DdeCreateClient( + struct DdeEnumServices *es) { WNDCLASSEX wc; static const char *szDdeClientClassName = "TclEval client class"; @@ -786,7 +962,7 @@ DdeCreateClient(ddeEnumServices *es) wc.cbSize = sizeof(wc); wc.lpfnWndProc = DdeClientWindowProc; wc.lpszClassName = szDdeClientClassName; - wc.cbWndExtra = sizeof(ddeEnumServices*); + wc.cbWndExtra = sizeof(struct DdeEnumServices *); /* * Register and create the callback window. @@ -808,8 +984,9 @@ DdeClientWindowProc( switch (uMsg) { case WM_CREATE: { LPCREATESTRUCT lpcs = (LPCREATESTRUCT) lParam; - ddeEnumServices *es = - (ddeEnumServices*) lpcs->lpCreateParams; + struct DdeEnumServices *es = + (struct DdeEnumServices *) lpcs->lpCreateParams; + #ifdef _WIN64 SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) es); #else @@ -833,25 +1010,24 @@ DdeServicesOnAck( HWND hwndRemote = (HWND)wParam; ATOM service = (ATOM)LOWORD(lParam); ATOM topic = (ATOM)HIWORD(lParam); - ddeEnumServices *es; + struct DdeEnumServices *es; char sz[255]; #ifdef _WIN64 - es = (ddeEnumServices *) GetWindowLongPtr(hwnd, GWLP_USERDATA); + es = (struct DdeEnumServices *) GetWindowLongPtr(hwnd, GWLP_USERDATA); #else - es = (ddeEnumServices *) GetWindowLong(hwnd, GWL_USERDATA); + es = (struct DdeEnumServices *) GetWindowLong(hwnd, GWL_USERDATA); #endif if ((es->service == (ATOM)0 || es->service == service) && (es->topic == (ATOM)0 || es->topic == topic)) { Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL); + Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp); GlobalGetAtomName(service, sz, 255); - Tcl_ListObjAppendElement(es->interp, matchPtr, - Tcl_NewStringObj(sz, -1)); + Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(sz, -1)); GlobalGetAtomName(topic, sz, 255); - Tcl_ListObjAppendElement(es->interp, matchPtr, - Tcl_NewStringObj(sz, -1)); + Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(sz, -1)); /* * Adding the hwnd as a third list element provides a unique @@ -864,8 +1040,13 @@ DdeServicesOnAck( * Tcl_NewLongObj((long)hwndRemote)); */ - Tcl_ListObjAppendElement(es->interp, - Tcl_GetObjResult(es->interp), matchPtr); + if (Tcl_IsShared(resultPtr)) { + resultPtr = Tcl_DuplicateObj(resultPtr); + } + if (Tcl_ListObjAppendElement(es->interp, resultPtr, + matchPtr) == TCL_OK) { + Tcl_SetObjResult(es->interp, resultPtr); + } } /* @@ -882,7 +1063,7 @@ DdeEnumWindowsCallback( LPARAM lParam) { DWORD_PTR dwResult = 0; - ddeEnumServices *es = (ddeEnumServices *) lParam; + struct DdeEnumServices *es = (struct DdeEnumServices *) lParam; SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, MAKELONG(es->service, es->topic), SMTO_ABORTIFHUNG, 1000, @@ -896,7 +1077,7 @@ DdeGetServicesList( const char *serviceName, const char *topicName) { - ddeEnumServices es; + struct DdeEnumServices es; es.interp = interp; es.result = TCL_OK; @@ -989,10 +1170,16 @@ DdeObjCmd( static const char *ddeCommands[] = { "servername", "execute", "poke", "request", "services", "eval", (char *) NULL}; - enum { + enum DdeSubcommands { DDE_SERVERNAME, DDE_EXECUTE, DDE_POKE, DDE_REQUEST, DDE_SERVICES, DDE_EVAL }; + static const char *ddeSrvOptions[] = { + "-force", "-handler", "--", NULL + }; + enum DdeSrvOptions { + DDE_SERVERNAME_EXACT, DDE_SERVERNAME_HANDLER, DDE_SERVERNAME_LAST, + }; static const char *ddeExecOptions[] = { "-async", NULL }; @@ -1000,15 +1187,14 @@ DdeObjCmd( "-binary", NULL }; - int index, length, argIndex; - int async = 0, binary = 0; - int result = TCL_OK, firstArg = 0; + int index, i, length, argIndex; + int flags = 0, result = TCL_OK, firstArg = 0; HSZ ddeService = NULL, ddeTopic = NULL, ddeItem = NULL, ddeCookie = NULL; HDDEDATA ddeData = NULL, ddeItemData = NULL, ddeReturn; HCONV hConv = NULL; const char *serviceName = NULL, *topicName = NULL, *string; DWORD ddeResult; - Tcl_Obj *objPtr; + Tcl_Obj *objPtr, *handlerPtr = NULL; /* * Initialize DDE server/client @@ -1024,24 +1210,59 @@ DdeObjCmd( return TCL_ERROR; } - switch (index) { + switch ((enum DdeSubcommands) index) { case DDE_SERVERNAME: - if ((objc != 3) && (objc != 2)) { - Tcl_WrongNumArgs(interp, 1, objv, "servername ?serverName?"); + for (i = 2; i < objc; i++) { + if (Tcl_GetIndexFromObj(interp, objv[i], ddeSrvOptions, + "option", 0, &argIndex) != TCL_OK) { + /* + * If it is the last argument, it might be a server name + * instead of a bad argument. + */ + + if (i != objc-1) { + return TCL_ERROR; + } + Tcl_ResetResult(interp); + break; + } + if (argIndex == DDE_SERVERNAME_EXACT) { + flags |= DDE_FLAG_FORCE; + } else if (argIndex == DDE_SERVERNAME_HANDLER) { + if ((objc - i) == 1) { /* return current handler */ + RegisteredInterp *riPtr = DdeGetRegistrationPtr(interp); + + if (riPtr && riPtr->handlerPtr) { + Tcl_SetObjResult(interp, riPtr->handlerPtr); + } else { + Tcl_ResetResult(interp); + } + return TCL_OK; + } + handlerPtr = objv[++i]; + } else if (argIndex == DDE_SERVERNAME_LAST) { + i++; + break; + } + } + + if ((objc - i) > 1) { + Tcl_ResetResult(interp); + Tcl_WrongNumArgs(interp, 2, objv, + "?-force? ?-handler proc? ?--? ?serverName?"); return TCL_ERROR; } - firstArg = (objc - 1); + firstArg = (objc == i) ? 1 : i; break; case DDE_EXECUTE: if (objc == 5) { firstArg = 2; break; } else if (objc == 6) { - int dummy; if (Tcl_GetIndexFromObj(NULL, objv[2], ddeExecOptions, "option", 0, - &dummy) == TCL_OK) { - async = 1; + &argIndex) == TCL_OK) { + flags |= DDE_FLAG_ASYNC; firstArg = 3; break; } @@ -1066,7 +1287,7 @@ DdeObjCmd( int dummy; if (Tcl_GetIndexFromObj(NULL, objv[2], ddeReqOptions, "option", 0, &dummy) == TCL_OK) { - binary = 1; + flags |= DDE_FLAG_BINARY; firstArg = 3; break; } @@ -1098,7 +1319,7 @@ DdeObjCmd( if (objc < 5) { goto wrongDdeEvalArgs; } - async = 1; + flags |= DDE_FLAG_ASYNC; firstArg++; } break; @@ -1130,9 +1351,10 @@ DdeObjCmd( } } - switch (index) { + switch ((enum DdeSubcommands) index) { case DDE_SERVERNAME: - serviceName = DdeSetServerName(interp, serviceName); + serviceName = DdeSetServerName(interp, serviceName, flags, + handlerPtr); if (serviceName != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(serviceName, -1)); } else { @@ -1152,12 +1374,8 @@ DdeObjCmd( break; } hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); - if (ddeService) { - DdeFreeStringHandle(ddeInstance, ddeService); - } - if (ddeTopic) { - DdeFreeStringHandle(ddeInstance, ddeTopic); - } + DdeFreeStringHandle(ddeInstance, ddeService); + DdeFreeStringHandle(ddeInstance, ddeTopic); if (hConv == NULL) { SetDdeError(interp); @@ -1168,7 +1386,7 @@ DdeObjCmd( ddeData = DdeCreateDataHandle(ddeInstance, dataString, (DWORD) dataLength+1, 0, 0, CF_TEXT, 0); if (ddeData != NULL) { - if (async) { + if (flags & DDE_FLAG_ASYNC) { DdeClientTransaction((LPBYTE) ddeData, 0xFFFFFFFF, hConv, 0, CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, &ddeResult); DdeAbandonTransaction(ddeInstance, hConv, ddeResult); @@ -1198,12 +1416,8 @@ DdeObjCmd( goto cleanup; } hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); - if (ddeService) { - DdeFreeStringHandle(ddeInstance, ddeService); - } - if (ddeTopic) { - DdeFreeStringHandle(ddeInstance, ddeTopic); - } + DdeFreeStringHandle(ddeInstance, ddeService); + DdeFreeStringHandle(ddeInstance, ddeTopic); if (hConv == NULL) { SetDdeError(interp); @@ -1222,9 +1436,9 @@ DdeObjCmd( DWORD tmp; const char *dataString = (const char *) DdeAccessData(ddeData, &tmp); - if (binary) { - returnObjPtr = Tcl_NewByteArrayObj((BYTE *) dataString, - (int) tmp); + if (flags & DDE_FLAG_BINARY) { + returnObjPtr = + Tcl_NewByteArrayObj((BYTE *) dataString, (int) tmp); } else { if (tmp && !dataString[tmp-1]) { --tmp; @@ -1259,12 +1473,8 @@ DdeObjCmd( &length); hConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); - if (ddeService) { DdeFreeStringHandle(ddeInstance, ddeService); - } - if (ddeTopic) { DdeFreeStringHandle(ddeInstance, ddeTopic); - } if (hConv == NULL) { SetDdeError(interp); @@ -1302,8 +1512,8 @@ DdeObjCmd( goto cleanup; } - objc -= (async + 3); - objv += (async + 3); + objc -= firstArg + 1; + objv += firstArg + 1; /* * See if the target interpreter is local. If so, execute the command @@ -1341,11 +1551,34 @@ DdeObjCmd( * referring to deallocated objects. */ - if (objc == 1) { - result = Tcl_EvalObjEx(sendInterp, objv[0], - TCL_EVAL_GLOBAL); - } else { - objPtr = Tcl_ConcatObj(objc, objv); + if (Tcl_IsSafe(riPtr->interp) && riPtr->handlerPtr == NULL) { + Tcl_SetResult(riPtr->interp, "permission denied: " + "a handler procedure must be defined for use in " + "a safe interp", TCL_STATIC); + result = TCL_ERROR; + } + + if (result == TCL_OK) { + if (objc == 1) + objPtr = objv[0]; + else { + objPtr = Tcl_ConcatObj(objc, objv); + } + if (riPtr->handlerPtr != NULL) { + /* add the dde request data to the handler proc list */ + /* + *result = Tcl_ListObjReplace(sendInterp, objPtr, 0, 0, 1, + * &(riPtr->handlerPtr)); + */ + Tcl_Obj *cmdPtr = Tcl_DuplicateObj(riPtr->handlerPtr); + result = Tcl_ListObjAppendElement(sendInterp, cmdPtr, + objPtr); + if (result == TCL_OK) { + objPtr = cmdPtr; + } + } + } + if (result == TCL_OK) { Tcl_IncrRefCount(objPtr); result = Tcl_EvalObjEx(sendInterp, objPtr, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(objPtr); @@ -1384,7 +1617,8 @@ DdeObjCmd( if (MakeDdeConnection(interp, serviceName, &hConv) != TCL_OK) { invalidServerResponse: Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid data returned from server", -1)); + Tcl_NewStringObj("invalid data returned from server", + -1)); result = TCL_ERROR; goto cleanup; } @@ -1394,7 +1628,7 @@ DdeObjCmd( ddeItemData = DdeCreateDataHandle(ddeInstance, (BYTE *) string, (DWORD) length+1, 0, 0, CF_TEXT, 0); - if (async) { + if (flags & DDE_FLAG_ASYNC) { ddeData = DdeClientTransaction((LPBYTE) ddeItemData, 0xFFFFFFFF, hConv, 0, CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, &ddeResult); @@ -1416,10 +1650,9 @@ DdeObjCmd( if (ddeData == 0) { SetDdeError(interp); result = TCL_ERROR; - goto cleanup; } - if (async == 0) { + if (!(flags & DDE_FLAG_ASYNC)) { Tcl_Obj *resultPtr; /* diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 701edfb..a6ce2ce 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -1,18 +1,22 @@ /* * tclWinReg.c -- * - * This file contains the implementation of the "registry" Tcl - * built-in command. This command is built as a dynamically - * loadable extension in a separate DLL. + * This file contains the implementation of the "registry" Tcl built-in + * command. This command is built as a dynamically loadable extension in + * a separate DLL. * * Copyright (c) 1997 by Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#include +#include "tclInt.h" +#include "tclPort.h" +#ifdef _MSC_VER +# pragma comment (lib, "advapi32.lib") +#endif #include /* @@ -25,6 +29,14 @@ #define TCL_STORAGE_CLASS DLLEXPORT /* + * The maximum length of a sub-key name. + */ + +#ifndef MAX_KEY_LENGTH +#define MAX_KEY_LENGTH 256 +#endif + +/* * The following macros convert between different endian ints. */ @@ -32,15 +44,15 @@ #define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x))) /* - * The following flag is used in OpenKeys to indicate that the specified - * key should be created if it doesn't currently exist. + * The following flag is used in OpenKeys to indicate that the specified key + * should be created if it doesn't currently exist. */ #define REG_CREATE 1 /* - * The following tables contain the mapping from registry root names - * to the system predefined keys. + * The following tables contain the mapping from registry root names to the + * system predefined keys. */ static CONST char *rootKeyNames[] = { @@ -54,11 +66,12 @@ static const HKEY rootKeys[] = { HKEY_CURRENT_CONFIG, HKEY_PERFORMANCE_DATA, HKEY_DYN_DATA }; +static CONST char REGISTRY_ASSOC_KEY[] = "registry::command"; + /* - * The following table maps from registry types to strings. Note that - * the indices for this array are the same as the constants for the - * known registry types so we don't need a separate table to hold the - * mapping. + * The following table maps from registry types to strings. Note that the + * indices for this array are the same as the constants for the known registry + * types so we don't need a separate table to hold the mapping. */ static CONST char *typeNames[] = { @@ -70,9 +83,9 @@ static DWORD lastType = REG_RESOURCE_LIST; /* * The following structures allow us to select between the Unicode and ASCII - * interfaces at run time based on whether Unicode APIs are available. The - * Unicode APIs are preferable because they will handle characters outside - * of the current code page. + * interfaces at run time based on whether Unicode APIs are available. The + * Unicode APIs are preferable because they will handle characters outside of + * the current code page. */ typedef struct RegWinProcs { @@ -80,7 +93,7 @@ typedef struct RegWinProcs { LONG (WINAPI *regConnectRegistryProc)(CONST TCHAR *, HKEY, PHKEY); LONG (WINAPI *regCreateKeyExProc)(HKEY, CONST TCHAR *, DWORD, TCHAR *, - DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *, DWORD *); + DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *, DWORD *); LONG (WINAPI *regDeleteKeyProc)(HKEY, CONST TCHAR *); LONG (WINAPI *regDeleteValueProc)(HKEY, CONST TCHAR *); LONG (WINAPI *regEnumKeyProc)(HKEY, DWORD, TCHAR *, DWORD); @@ -90,9 +103,6 @@ typedef struct RegWinProcs { DWORD *, BYTE *, DWORD *); LONG (WINAPI *regOpenKeyExProc)(HKEY, CONST TCHAR *, DWORD, REGSAM, HKEY *); - LONG (WINAPI *regQueryInfoKeyProc)(HKEY, TCHAR *, DWORD *, DWORD *, - DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, - FILETIME *); LONG (WINAPI *regQueryValueExProc)(HKEY, CONST TCHAR *, DWORD *, DWORD *, BYTE *, DWORD *); LONG (WINAPI *regSetValueExProc)(HKEY, CONST TCHAR *, DWORD, DWORD, @@ -107,7 +117,7 @@ static RegWinProcs asciiProcs = { (LONG (WINAPI *)(CONST TCHAR *, HKEY, PHKEY)) RegConnectRegistryA, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, TCHAR *, DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *, - DWORD *)) RegCreateKeyExA, + DWORD *)) RegCreateKeyExA, (LONG (WINAPI *)(HKEY, CONST TCHAR *)) RegDeleteKeyA, (LONG (WINAPI *)(HKEY, CONST TCHAR *)) RegDeleteValueA, (LONG (WINAPI *)(HKEY, DWORD, TCHAR *, DWORD)) RegEnumKeyA, @@ -117,9 +127,6 @@ static RegWinProcs asciiProcs = { DWORD *, BYTE *, DWORD *)) RegEnumValueA, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, REGSAM, HKEY *)) RegOpenKeyExA, - (LONG (WINAPI *)(HKEY, TCHAR *, DWORD *, DWORD *, - DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, - FILETIME *)) RegQueryInfoKeyA, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD *, DWORD *, BYTE *, DWORD *)) RegQueryValueExA, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, DWORD, @@ -132,7 +139,7 @@ static RegWinProcs unicodeProcs = { (LONG (WINAPI *)(CONST TCHAR *, HKEY, PHKEY)) RegConnectRegistryW, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, TCHAR *, DWORD, REGSAM, SECURITY_ATTRIBUTES *, HKEY *, - DWORD *)) RegCreateKeyExW, + DWORD *)) RegCreateKeyExW, (LONG (WINAPI *)(HKEY, CONST TCHAR *)) RegDeleteKeyW, (LONG (WINAPI *)(HKEY, CONST TCHAR *)) RegDeleteValueW, (LONG (WINAPI *)(HKEY, DWORD, TCHAR *, DWORD)) RegEnumKeyW, @@ -142,9 +149,6 @@ static RegWinProcs unicodeProcs = { DWORD *, BYTE *, DWORD *)) RegEnumValueW, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, REGSAM, HKEY *)) RegOpenKeyExW, - (LONG (WINAPI *)(HKEY, TCHAR *, DWORD *, DWORD *, - DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, DWORD *, - FILETIME *)) RegQueryInfoKeyW, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD *, DWORD *, BYTE *, DWORD *)) RegQueryValueExW, (LONG (WINAPI *)(HKEY, CONST TCHAR *, DWORD, DWORD, @@ -160,6 +164,7 @@ static void AppendSystemError(Tcl_Interp *interp, DWORD error); static int BroadcastValue(Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]); static DWORD ConvertDWORD(DWORD type, DWORD value); +static void DeleteCmd(ClientData clientData); static int DeleteKey(Tcl_Interp *interp, Tcl_Obj *keyNameObj); static int DeleteValue(Tcl_Interp *interp, Tcl_Obj *keyNameObj, Tcl_Obj *valueNameObj); @@ -188,14 +193,15 @@ static int SetValue(Tcl_Interp *interp, Tcl_Obj *keyNameObj, Tcl_Obj *valueNameObj, Tcl_Obj *dataObj, Tcl_Obj *typeObj); -EXTERN int Registry_Init(Tcl_Interp *interp); +EXTERN int Registry_Init(Tcl_Interp *interp); +EXTERN int Registry_Unload(Tcl_Interp *interp, int flags); /* *---------------------------------------------------------------------- * * Registry_Init -- * - * This procedure initializes the registry command. + * This function initializes the registry command. * * Results: * A standard Tcl result. @@ -210,7 +216,9 @@ int Registry_Init( Tcl_Interp *interp) { - if (!Tcl_InitStubs(interp, "8.0", 0)) { + Tcl_Command cmd; + + if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; } @@ -225,8 +233,80 @@ Registry_Init( regWinProcs = &asciiProcs; } - Tcl_CreateObjCommand(interp, "registry", RegistryObjCmd, NULL, NULL); - return Tcl_PkgProvide(interp, "registry", "1.1.5"); + cmd = Tcl_CreateObjCommand(interp, "registry", RegistryObjCmd, + (ClientData)interp, DeleteCmd); + Tcl_SetAssocData(interp, REGISTRY_ASSOC_KEY, NULL, (ClientData)cmd); + return Tcl_PkgProvide(interp, "registry", "1.2.2"); +} + +/* + *---------------------------------------------------------------------- + * + * Registry_Unload -- + * + * This function removes the registry command. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * The registry command is deleted and the dll may be unloaded. + * + *---------------------------------------------------------------------- + */ + +int +Registry_Unload( + Tcl_Interp *interp, /* Interpreter for unloading */ + int flags) /* Flags passed by the unload system */ +{ + Tcl_Command cmd; + Tcl_Obj *objv[3]; + + /* + * Unregister the registry package. There is no Tcl_PkgForget() + */ + + objv[0] = Tcl_NewStringObj("package", -1); + objv[1] = Tcl_NewStringObj("forget", -1); + objv[2] = Tcl_NewStringObj("registry", -1); + Tcl_EvalObjv(interp, 3, objv, TCL_EVAL_GLOBAL); + + /* + * Delete the originally registered command. + */ + + cmd = (Tcl_Command)Tcl_GetAssocData(interp, REGISTRY_ASSOC_KEY, NULL); + if (cmd != NULL) { + Tcl_DeleteCommandFromToken(interp, cmd); + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * DeleteCmd -- + * + * Cleanup the interp command token so that unloading doesn't try to + * re-delete the command (which will crash). + * + * Results: + * None. + * + * Side effects: + * The unload command will not attempt to delete this command. + * + *---------------------------------------------------------------------- + */ + +static void +DeleteCmd( + ClientData clientData) +{ + Tcl_Interp *interp = clientData; + Tcl_SetAssocData(interp, REGISTRY_ASSOC_KEY, NULL, (ClientData)NULL); } /* @@ -256,8 +336,7 @@ RegistryObjCmd( char *errString = NULL; static CONST char *subcommands[] = { - "broadcast", "delete", "get", "keys", "set", "type", "values", - (char *) NULL + "broadcast", "delete", "get", "keys", "set", "type", "values", NULL }; enum SubCmdIdx { BroadcastIdx, DeleteIdx, GetIdx, KeysIdx, SetIdx, TypeIdx, ValuesIdx @@ -274,65 +353,64 @@ RegistryObjCmd( } switch (index) { - case BroadcastIdx: /* broadcast */ - return BroadcastValue(interp, objc, objv); - break; - case DeleteIdx: /* delete */ - if (objc == 3) { - return DeleteKey(interp, objv[2]); - } else if (objc == 4) { - return DeleteValue(interp, objv[2], objv[3]); - } - errString = "keyName ?valueName?"; - break; - case GetIdx: /* get */ - if (objc == 4) { - return GetValue(interp, objv[2], objv[3]); - } - errString = "keyName valueName"; - break; - case KeysIdx: /* keys */ - if (objc == 3) { - return GetKeyNames(interp, objv[2], NULL); - } else if (objc == 4) { - return GetKeyNames(interp, objv[2], objv[3]); - } - errString = "keyName ?pattern?"; - break; - case SetIdx: /* set */ - if (objc == 3) { - HKEY key; + case BroadcastIdx: /* broadcast */ + return BroadcastValue(interp, objc, objv); + break; + case DeleteIdx: /* delete */ + if (objc == 3) { + return DeleteKey(interp, objv[2]); + } else if (objc == 4) { + return DeleteValue(interp, objv[2], objv[3]); + } + errString = "keyName ?valueName?"; + break; + case GetIdx: /* get */ + if (objc == 4) { + return GetValue(interp, objv[2], objv[3]); + } + errString = "keyName valueName"; + break; + case KeysIdx: /* keys */ + if (objc == 3) { + return GetKeyNames(interp, objv[2], NULL); + } else if (objc == 4) { + return GetKeyNames(interp, objv[2], objv[3]); + } + errString = "keyName ?pattern?"; + break; + case SetIdx: /* set */ + if (objc == 3) { + HKEY key; - /* - * Create the key and then close it immediately. - */ + /* + * Create the key and then close it immediately. + */ - if (OpenKey(interp, objv[2], KEY_ALL_ACCESS, 1, &key) - != TCL_OK) { - return TCL_ERROR; - } - RegCloseKey(key); - return TCL_OK; - } else if (objc == 5 || objc == 6) { - Tcl_Obj *typeObj = (objc == 5) ? NULL : objv[5]; - return SetValue(interp, objv[2], objv[3], objv[4], typeObj); - } - errString = "keyName ?valueName data ?type??"; - break; - case TypeIdx: /* type */ - if (objc == 4) { - return GetType(interp, objv[2], objv[3]); - } - errString = "keyName valueName"; - break; - case ValuesIdx: /* values */ - if (objc == 3) { - return GetValueNames(interp, objv[2], NULL); - } else if (objc == 4) { - return GetValueNames(interp, objv[2], objv[3]); + if (OpenKey(interp, objv[2], KEY_ALL_ACCESS, 1, &key) != TCL_OK) { + return TCL_ERROR; } - errString = "keyName ?pattern?"; - break; + RegCloseKey(key); + return TCL_OK; + } else if (objc == 5 || objc == 6) { + Tcl_Obj *typeObj = (objc == 5) ? NULL : objv[5]; + return SetValue(interp, objv[2], objv[3], objv[4], typeObj); + } + errString = "keyName ?valueName data ?type??"; + break; + case TypeIdx: /* type */ + if (objc == 4) { + return GetType(interp, objv[2], objv[3]); + } + errString = "keyName valueName"; + break; + case ValuesIdx: /* values */ + if (objc == 3) { + return GetValueNames(interp, objv[2], NULL); + } else if (objc == 4) { + return GetValueNames(interp, objv[2], objv[3]); + } + errString = "keyName ?pattern?"; + break; } Tcl_WrongNumArgs(interp, 2, objv, errString); return TCL_ERROR; @@ -364,7 +442,6 @@ DeleteKey( HKEY rootKey, subkey; DWORD result; int length; - Tcl_Obj *resultPtr; Tcl_DString buf; /* @@ -375,15 +452,15 @@ DeleteKey( buffer = ckalloc((unsigned int) length + 1); strcpy(buffer, keyName); - if (ParseKeyName(interp, buffer, &hostName, &rootKey, &keyName) - != TCL_OK) { + if (ParseKeyName(interp, buffer, &hostName, &rootKey, + &keyName) != TCL_OK) { ckfree(buffer); return TCL_ERROR; } - resultPtr = Tcl_GetObjResult(interp); if (*keyName == '\0') { - Tcl_AppendToObj(resultPtr, "bad key: cannot delete root keys", -1); + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "bad key: cannot delete root keys", -1)); ckfree(buffer); return TCL_ERROR; } @@ -402,11 +479,11 @@ DeleteKey( ckfree(buffer); if (result == ERROR_FILE_NOT_FOUND) { return TCL_OK; - } else { - Tcl_AppendToObj(resultPtr, "unable to delete key: ", -1); - AppendSystemError(interp, result); - return TCL_ERROR; } + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "unable to delete key: ", -1)); + AppendSystemError(interp, result); + return TCL_ERROR; } /* @@ -418,7 +495,8 @@ DeleteKey( Tcl_DStringFree(&buf); if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { - Tcl_AppendToObj(resultPtr, "unable to delete key: ", -1); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unable to delete key: ", -1)); AppendSystemError(interp, result); result = TCL_ERROR; } else { @@ -456,7 +534,6 @@ DeleteValue( char *valueName; int length; DWORD result; - Tcl_Obj *resultPtr; Tcl_DString ds; /* @@ -468,13 +545,12 @@ DeleteValue( return TCL_ERROR; } - resultPtr = Tcl_GetObjResult(interp); valueName = Tcl_GetStringFromObj(valueNameObj, &length); Tcl_WinUtfToTChar(valueName, length, &ds); result = (*regWinProcs->regDeleteValueProc)(key, Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); if (result != ERROR_SUCCESS) { - Tcl_AppendStringsToObj(resultPtr, "unable to delete value \"", + Tcl_AppendResult(interp, "unable to delete value \"", Tcl_GetString(valueNameObj), "\" from key \"", Tcl_GetString(keyNameObj), "\": ", NULL); AppendSystemError(interp, result); @@ -491,13 +567,13 @@ DeleteValue( * * GetKeyNames -- * - * This function enumerates the subkeys of a given key. If the - * optional pattern is supplied, then only keys that match the - * pattern will be returned. + * This function enumerates the subkeys of a given key. If the optional + * pattern is supplied, then only keys that match the pattern will be + * returned. * * Results: - * Returns the list of subkeys in the result object of the - * interpreter, or an error message on failure. + * Returns the list of subkeys in the result object of the interpreter, + * or an error message on failure. * * Side effects: * None. @@ -513,9 +589,7 @@ GetKeyNames( { char *pattern; /* Pattern being matched against subkeys */ HKEY key; /* Handle to the key being examined */ - DWORD subKeyCount; /* Number of subkeys to list */ - DWORD maxSubKeyLen; /* Maximum string length of any subkey */ - char *buffer; /* Buffer to hold the subkey name */ + TCHAR buffer[MAX_KEY_LENGTH*2]; /* Buffer to hold the subkey name */ DWORD bufSize; /* Size of the buffer */ DWORD index; /* Position of the current subkey */ char *name; /* Subkey name */ @@ -537,43 +611,24 @@ GetKeyNames( return TCL_ERROR; } - /* - * Determine how big a buffer is needed for enumerating subkeys, and - * how many subkeys there are - */ - - result = (*regWinProcs->regQueryInfoKeyProc) - (key, NULL, NULL, NULL, &subKeyCount, &maxSubKeyLen, NULL, NULL, - NULL, NULL, NULL, NULL); - if (result != ERROR_SUCCESS) { - Tcl_SetObjResult(interp, Tcl_NewObj()); - Tcl_AppendResult(interp, "unable to query key \"", - Tcl_GetString(keyNameObj), "\": ", NULL); - AppendSystemError(interp, result); - RegCloseKey(key); - return TCL_ERROR; - } - if (regWinProcs->useWide) { - buffer = ckalloc((maxSubKeyLen+1) * sizeof(WCHAR)); - } else { - buffer = ckalloc(maxSubKeyLen+1); - } - /* Enumerate the subkeys */ resultPtr = Tcl_NewObj(); - for (index = 0; index < subKeyCount; ++index) { - bufSize = maxSubKeyLen+1; + for (index = 0;; ++index) { + bufSize = MAX_KEY_LENGTH; result = (*regWinProcs->regEnumKeyExProc) (key, index, buffer, &bufSize, NULL, NULL, NULL, NULL); if (result != ERROR_SUCCESS) { - Tcl_SetObjResult(interp, Tcl_NewObj()); - Tcl_AppendResult(interp, - "unable to enumerate subkeys of \"", - Tcl_GetString(keyNameObj), - "\": ", NULL); - AppendSystemError(interp, result); - result = TCL_ERROR; + if (result == ERROR_NO_MORE_ITEMS) { + result = TCL_OK; + } else { + Tcl_SetObjResult(interp, Tcl_NewObj()); + Tcl_AppendResult(interp, + "unable to enumerate subkeys of \"", + Tcl_GetString(keyNameObj), "\": ", NULL); + AppendSystemError(interp, result); + result = TCL_ERROR; + } break; } if (regWinProcs->useWide) { @@ -599,7 +654,6 @@ GetKeyNames( Tcl_DecrRefCount(resultPtr); /* BUGFIX: Don't leak on failure. */ } - ckfree(buffer); RegCloseKey(key); return result; } @@ -609,8 +663,8 @@ GetKeyNames( * * GetType -- * - * This function gets the type of a given registry value and - * places it in the interpreter result. + * This function gets the type of a given registry value and places it in + * the interpreter result. * * Results: * Returns a normal Tcl result. @@ -628,7 +682,6 @@ GetType( Tcl_Obj *valueNameObj) /* Name of value to get. */ { HKEY key; - Tcl_Obj *resultPtr; DWORD result; DWORD type; Tcl_DString ds; @@ -649,8 +702,6 @@ GetType( * Get the type of the value. */ - resultPtr = Tcl_GetObjResult(interp); - valueName = Tcl_GetStringFromObj(valueNameObj, &length); nativeValue = Tcl_WinUtfToTChar(valueName, length, &ds); result = (*regWinProcs->regQueryValueExProc)(key, nativeValue, NULL, &type, @@ -659,7 +710,7 @@ GetType( RegCloseKey(key); if (result != ERROR_SUCCESS) { - Tcl_AppendStringsToObj(resultPtr, "unable to get type of value \"", + Tcl_AppendResult(interp, "unable to get type of value \"", Tcl_GetString(valueNameObj), "\" from key \"", Tcl_GetString(keyNameObj), "\": ", NULL); AppendSystemError(interp, result); @@ -667,14 +718,14 @@ GetType( } /* - * Set the type into the result. Watch out for unknown types. - * If we don't know about the type, just use the numeric value. + * Set the type into the result. Watch out for unknown types. If we don't + * know about the type, just use the numeric value. */ if (type > lastType) { - Tcl_SetIntObj(resultPtr, (int) type); + Tcl_SetObjResult(interp, Tcl_NewIntObj((int) type)); } else { - Tcl_SetStringObj(resultPtr, typeNames[type], -1); + Tcl_SetObjResult(interp, Tcl_NewStringObj(typeNames[type], -1)); } return TCL_OK; } @@ -684,9 +735,8 @@ GetType( * * GetValue -- * - * This function gets the contents of a registry value and places - * a list containing the data and the type in the interpreter - * result. + * This function gets the contents of a registry value and places a list + * containing the data and the type in the interpreter result. * * Results: * Returns a normal Tcl result. @@ -707,7 +757,6 @@ GetValue( char *valueName; CONST char *nativeValue; DWORD result, length, type; - Tcl_Obj *resultPtr; Tcl_DString data, buf; int nameLen; @@ -715,16 +764,15 @@ GetValue( * Attempt to open the key for reading. */ - if (OpenKey(interp, keyNameObj, KEY_QUERY_VALUE, 0, &key) - != TCL_OK) { + if (OpenKey(interp, keyNameObj, KEY_QUERY_VALUE, 0, &key) != TCL_OK) { return TCL_ERROR; } /* - * Initialize a Dstring to maximum statically allocated size - * we could get one more byte by avoiding Tcl_DStringSetLength() - * and just setting length to TCL_DSTRING_STATIC_SIZE, but this - * should be safer if the implementation of Dstrings changes. + * Initialize a Dstring to maximum statically allocated size we could get + * one more byte by avoiding Tcl_DStringSetLength() and just setting + * length to TCL_DSTRING_STATIC_SIZE, but this should be safer if the + * implementation of Dstrings changes. * * This allows short values to be read from the registy in one call. * Longer values need a second call with an expanded DString. @@ -734,8 +782,6 @@ GetValue( Tcl_DStringSetLength(&data, TCL_DSTRING_STATIC_SIZE - 1); length = TCL_DSTRING_STATIC_SIZE / (regWinProcs->useWide ? 2 : 1) - 1; - resultPtr = Tcl_GetObjResult(interp); - valueName = Tcl_GetStringFromObj(valueNameObj, &nameLen); nativeValue = Tcl_WinUtfToTChar(valueName, nameLen, &buf); @@ -743,11 +789,12 @@ GetValue( (BYTE *) Tcl_DStringValue(&data), &length); while (result == ERROR_MORE_DATA) { /* - * The Windows docs say that in this error case, we just need - * to expand our buffer and request more data. - * Required for HKEY_PERFORMANCE_DATA + * The Windows docs say that in this error case, we just need to + * expand our buffer and request more data. Required for + * HKEY_PERFORMANCE_DATA */ - length *= 2; + + length = Tcl_DStringLength(&data) * (regWinProcs->useWide ? 1 : 2); Tcl_DStringSetLength(&data, (int) length * (regWinProcs->useWide ? 2 : 1)); result = (*regWinProcs->regQueryValueExProc)(key, (char *) nativeValue, NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length); @@ -755,7 +802,7 @@ GetValue( Tcl_DStringFree(&buf); RegCloseKey(key); if (result != ERROR_SUCCESS) { - Tcl_AppendStringsToObj(resultPtr, "unable to get value \"", + Tcl_AppendResult(interp, "unable to get value \"", Tcl_GetString(valueNameObj), "\" from key \"", Tcl_GetString(keyNameObj), "\": ", NULL); AppendSystemError(interp, result); @@ -764,26 +811,27 @@ GetValue( } /* - * If the data is a 32-bit quantity, store it as an integer object. If it - * is a multi-string, store it as a list of strings. For null-terminated - * strings, append up the to first null. Otherwise, store it as a binary + * If the data is a 32-bit quantity, store it as an integer object. If it + * is a multi-string, store it as a list of strings. For null-terminated + * strings, append up the to first null. Otherwise, store it as a binary * string. */ if (type == REG_DWORD || type == REG_DWORD_BIG_ENDIAN) { - Tcl_SetIntObj(resultPtr, (int) ConvertDWORD(type, - *((DWORD*) Tcl_DStringValue(&data)))); + Tcl_SetObjResult(interp, Tcl_NewIntObj((int) ConvertDWORD(type, + *((DWORD*) Tcl_DStringValue(&data))))); } else if (type == REG_MULTI_SZ) { char *p = Tcl_DStringValue(&data); char *end = Tcl_DStringValue(&data) + length; + Tcl_Obj *resultPtr = Tcl_NewObj(); /* * Multistrings are stored as an array of null-terminated strings, - * terminated by two null characters. Also do a bounds check in - * case we get bogus data. + * terminated by two null characters. Also do a bounds check in case + * we get bogus data. */ - - while (p < end && ((regWinProcs->useWide) + + while (p < end && ((regWinProcs->useWide) ? *((Tcl_UniChar *)p) : *p) != 0) { Tcl_WinTCharToUtf((TCHAR *) p, -1, &buf); Tcl_ListObjAppendElement(interp, resultPtr, @@ -798,17 +846,17 @@ GetValue( } Tcl_DStringFree(&buf); } + Tcl_SetObjResult(interp, resultPtr); } else if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) { Tcl_WinTCharToUtf((TCHAR *) Tcl_DStringValue(&data), -1, &buf); - Tcl_SetStringObj(resultPtr, Tcl_DStringValue(&buf), - Tcl_DStringLength(&buf)); - Tcl_DStringFree(&buf); + Tcl_DStringResult(interp, &buf); } else { /* * Save binary data as a byte array. */ - Tcl_SetByteArrayObj(resultPtr, (BYTE *) Tcl_DStringValue(&data), (int) length); + Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( + (BYTE *) Tcl_DStringValue(&data), (int) length)); } Tcl_DStringFree(&data); return result; @@ -819,9 +867,9 @@ GetValue( * * GetValueNames -- * - * This function enumerates the values of the a given key. If - * the optional pattern is supplied, then only value names that - * match the pattern will be returned. + * This function enumerates the values of the a given key. If the + * optional pattern is supplied, then only value names that match the + * pattern will be returned. * * Results: * Returns the list of value names in the result object of the @@ -841,7 +889,7 @@ GetValueNames( { HKEY key; Tcl_Obj *resultPtr; - DWORD index, size, maxSize, result; + DWORD index, size, result; Tcl_DString buffer, ds; char *pattern, *name; @@ -854,29 +902,10 @@ GetValueNames( return TCL_ERROR; } - resultPtr = Tcl_GetObjResult(interp); - - /* - * Query the key to determine the appropriate buffer size to hold the - * largest value name plus the terminating null. - */ - - result = (*regWinProcs->regQueryInfoKeyProc)(key, NULL, NULL, NULL, NULL, - NULL, NULL, &index, &maxSize, NULL, NULL, NULL); - if (result != ERROR_SUCCESS) { - Tcl_AppendStringsToObj(resultPtr, "unable to query key \"", - Tcl_GetString(keyNameObj), "\": ", NULL); - AppendSystemError(interp, result); - RegCloseKey(key); - result = TCL_ERROR; - goto done; - } - maxSize++; - - + resultPtr = Tcl_NewObj(); Tcl_DStringInit(&buffer); Tcl_DStringSetLength(&buffer, - (int) ((regWinProcs->useWide) ? maxSize*2 : maxSize)); + (int) ((regWinProcs->useWide) ? MAX_KEY_LENGTH*2 : MAX_KEY_LENGTH)); index = 0; result = TCL_OK; @@ -888,11 +917,11 @@ GetValueNames( /* * Enumerate the values under the given subkey until we get an error, - * indicating the end of the list. Note that we need to reset size - * after each iteration because RegEnumValue smashes the old value. + * indicating the end of the list. Note that we need to reset size after + * each iteration because RegEnumValue smashes the old value. */ - size = maxSize; + size = MAX_KEY_LENGTH; while ((*regWinProcs->regEnumValueProc)(key, index, Tcl_DStringValue(&buffer), &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { @@ -901,7 +930,8 @@ GetValueNames( size *= 2; } - Tcl_WinTCharToUtf((TCHAR *) Tcl_DStringValue(&buffer), (int) size, &ds); + Tcl_WinTCharToUtf((TCHAR *) Tcl_DStringValue(&buffer), (int) size, + &ds); name = Tcl_DStringValue(&ds); if (!pattern || Tcl_StringMatch(name, pattern)) { result = Tcl_ListObjAppendElement(interp, resultPtr, @@ -914,11 +944,10 @@ GetValueNames( Tcl_DStringFree(&ds); index++; - size = maxSize; + size = MAX_KEY_LENGTH; } + Tcl_SetObjResult(interp, resultPtr); Tcl_DStringFree(&buffer); - - done: RegCloseKey(key); return result; } @@ -928,12 +957,11 @@ GetValueNames( * * OpenKey -- * - * This function opens the specified key. This function is a - * simple wrapper around ParseKeyName and OpenSubKey. + * This function opens the specified key. This function is a simple + * wrapper around ParseKeyName and OpenSubKey. * * Results: - * Returns the opened key in the keyPtr argument and a Tcl - * result code. + * Returns the opened key in the keyPtr argument and a Tcl result code. * * Side effects: * None. @@ -962,8 +990,8 @@ OpenKey( if (result == TCL_OK) { result = OpenSubKey(hostName, rootKey, keyName, mode, flags, keyPtr); if (result != ERROR_SUCCESS) { - Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); - Tcl_AppendToObj(resultPtr, "unable to open key: ", -1); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unable to open key: ", -1)); AppendSystemError(interp, result); result = TCL_ERROR; } else { @@ -980,12 +1008,12 @@ OpenKey( * * OpenSubKey -- * - * This function opens a given subkey of a root key on the - * specified host. + * This function opens a given subkey of a root key on the specified + * host. * * Results: - * Returns the opened key in the keyPtr and a Windows error code - * as the return value. + * Returns the opened key in the keyPtr and a Windows error code as the + * return value. * * Side effects: * None. @@ -1020,8 +1048,8 @@ OpenSubKey( } /* - * Now open the specified key with the requested permissions. Note - * that this key must be closed by the caller. + * Now open the specified key with the requested permissions. Note that + * this key must be closed by the caller. */ keyName = (char *) Tcl_WinUtfToTChar(keyName, -1, &buf); @@ -1029,19 +1057,16 @@ OpenSubKey( DWORD create; result = (*regWinProcs->regCreateKeyExProc)(rootKey, keyName, 0, NULL, REG_OPTION_NON_VOLATILE, mode, NULL, keyPtr, &create); + } else if (rootKey == HKEY_PERFORMANCE_DATA) { + /* + * Here we fudge it for this special root key. See MSDN for more info + * on HKEY_PERFORMANCE_DATA and the peculiarities surrounding it. + */ + *keyPtr = HKEY_PERFORMANCE_DATA; + result = ERROR_SUCCESS; } else { - if (rootKey == HKEY_PERFORMANCE_DATA) { - /* - * Here we fudge it for this special root key. - * See MSDN for more info on HKEY_PERFORMANCE_DATA and - * the peculiarities surrounding it - */ - *keyPtr = HKEY_PERFORMANCE_DATA; - result = ERROR_SUCCESS; - } else { - result = (*regWinProcs->regOpenKeyExProc)(rootKey, keyName, 0, - mode, keyPtr); - } + result = (*regWinProcs->regOpenKeyExProc)(rootKey, keyName, 0, mode, + keyPtr); } Tcl_DStringFree(&buf); @@ -1060,15 +1085,12 @@ OpenSubKey( * * ParseKeyName -- * - * This function parses a key name into the host, root, and subkey - * parts. + * This function parses a key name into the host, root, and subkey parts. * * Results: - * The pointers to the start of the host and subkey names are - * returned in the hostNamePtr and keyNamePtr variables. The - * specified root HKEY is returned in rootKeyPtr. Returns - * a standard Tcl result. - * + * The pointers to the start of the host and subkey names are returned in + * the hostNamePtr and keyNamePtr variables. The specified root HKEY is + * returned in rootKeyPtr. Returns a standard Tcl result. * * Side effects: * Modifies the name string by inserting nulls. @@ -1086,7 +1108,7 @@ ParseKeyName( { char *rootName; int result, index; - Tcl_Obj *rootObj, *resultPtr = Tcl_GetObjResult(interp); + Tcl_Obj *rootObj; /* * Split the key into host and root portions. @@ -1107,7 +1129,7 @@ ParseKeyName( rootName = name; } if (!rootName) { - Tcl_AppendStringsToObj(resultPtr, "bad key \"", name, + Tcl_AppendResult(interp, "bad key \"", name, "\": must start with a valid root", NULL); return TCL_ERROR; } @@ -1144,9 +1166,9 @@ ParseKeyName( * * RecursiveDeleteKey -- * - * This function recursively deletes all the keys below a starting - * key. Although Windows 95 does this automatically, we still need - * to do this for Windows NT. + * This function recursively deletes all the keys below a starting key. + * Although Windows 95 does this automatically, we still need to do this + * for Windows NT. * * Results: * Returns a Windows error code. @@ -1163,7 +1185,7 @@ RecursiveDeleteKey( CONST char *keyName) /* Name of key to be deleted in external * encoding, not UTF. */ { - DWORD result, size, maxSize; + DWORD result, size; Tcl_DString subkey; HKEY hKey; @@ -1180,23 +1202,17 @@ RecursiveDeleteKey( if (result != ERROR_SUCCESS) { return result; } - result = (*regWinProcs->regQueryInfoKeyProc)(hKey, NULL, NULL, NULL, NULL, - &maxSize, NULL, NULL, NULL, NULL, NULL, NULL); - maxSize++; - if (result != ERROR_SUCCESS) { - return result; - } Tcl_DStringInit(&subkey); Tcl_DStringSetLength(&subkey, - (int) ((regWinProcs->useWide) ? maxSize * 2 : maxSize)); + (int) ((regWinProcs->useWide) ? MAX_KEY_LENGTH * 2 : MAX_KEY_LENGTH)); while (result == ERROR_SUCCESS) { /* * Always get index 0 because key deletion changes ordering. */ - size = maxSize; + size = MAX_KEY_LENGTH; result=(*regWinProcs->regEnumKeyExProc)(hKey, 0, Tcl_DStringValue(&subkey), &size, NULL, NULL, NULL, NULL); if (result == ERROR_NO_MORE_ITEMS) { @@ -1216,9 +1232,9 @@ RecursiveDeleteKey( * * SetValue -- * - * This function sets the contents of a registry value. If - * the key or value does not exist, it will be created. If it - * does exist, then the data and type will be replaced. + * This function sets the contents of a registry value. If the key or + * value does not exist, it will be created. If it does exist, then the + * data and type will be replaced. * * Results: * Returns a normal Tcl result. @@ -1237,11 +1253,11 @@ SetValue( Tcl_Obj *dataObj, /* Data to be written. */ Tcl_Obj *typeObj) /* Type of data to be written. */ { - DWORD type, result; + int type; + DWORD result; HKEY key; int length; char *valueName; - Tcl_Obj *resultPtr; Tcl_DString nameBuf; if (typeObj == NULL) { @@ -1259,19 +1275,19 @@ SetValue( valueName = Tcl_GetStringFromObj(valueNameObj, &length); valueName = (char *) Tcl_WinUtfToTChar(valueName, length, &nameBuf); - resultPtr = Tcl_GetObjResult(interp); if (type == REG_DWORD || type == REG_DWORD_BIG_ENDIAN) { - DWORD value; - if (Tcl_GetIntFromObj(interp, dataObj, (int*) &value) != TCL_OK) { + int value; + + if (Tcl_GetIntFromObj(interp, dataObj, &value) != TCL_OK) { RegCloseKey(key); Tcl_DStringFree(&nameBuf); return TCL_ERROR; } - value = ConvertDWORD(type, value); - result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type, - (BYTE*) &value, sizeof(DWORD)); + value = ConvertDWORD((DWORD)type, (DWORD)value); + result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, + (DWORD) type, (BYTE *) &value, sizeof(DWORD)); } else if (type == REG_MULTI_SZ) { Tcl_DString data, buf; int objc, i; @@ -1284,9 +1300,9 @@ SetValue( } /* - * Append the elements as null terminated strings. Note that - * we must not assume the length of the string in case there are - * embedded nulls, which aren't allowed in REG_MULTI_SZ values. + * Append the elements as null terminated strings. Note that we must + * not assume the length of the string in case there are embedded + * nulls, which aren't allowed in REG_MULTI_SZ values. */ Tcl_DStringInit(&data); @@ -1294,8 +1310,8 @@ SetValue( Tcl_DStringAppend(&data, Tcl_GetString(objv[i]), -1); /* - * Add a null character to separate this value from the next. - * We accomplish this by growing the string by one byte. Since the + * Add a null character to separate this value from the next. We + * accomplish this by growing the string by one byte. Since the * DString always tacks on an extra null byte, the new byte will * already be set to null. */ @@ -1305,16 +1321,16 @@ SetValue( Tcl_WinUtfToTChar(Tcl_DStringValue(&data), Tcl_DStringLength(&data)+1, &buf); - result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type, - (BYTE *) Tcl_DStringValue(&buf), + result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, + (DWORD) type, (BYTE *) Tcl_DStringValue(&buf), (DWORD) Tcl_DStringLength(&buf)); Tcl_DStringFree(&data); Tcl_DStringFree(&buf); } else if (type == REG_SZ || type == REG_EXPAND_SZ) { Tcl_DString buf; - char *data = Tcl_GetStringFromObj(dataObj, &length); + CONST char *data = Tcl_GetStringFromObj(dataObj, &length); - data = (char *) Tcl_WinUtfToTChar(data, length, &buf); + data = Tcl_WinUtfToTChar(data, length, &buf); /* * Include the null in the length, padding if needed for Unicode. @@ -1325,8 +1341,8 @@ SetValue( } length = Tcl_DStringLength(&buf) + 1; - result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type, - (BYTE*)data, (DWORD) length); + result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, + (DWORD) type, (BYTE *) data, (DWORD) length); Tcl_DStringFree(&buf); } else { BYTE *data; @@ -1335,14 +1351,17 @@ SetValue( * Store binary data in the registry. */ - data = Tcl_GetByteArrayFromObj(dataObj, &length); - result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, type, - data, (DWORD) length); + data = (BYTE *) Tcl_GetByteArrayFromObj(dataObj, &length); + result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, + (DWORD) type, data, (DWORD) length); } + Tcl_DStringFree(&nameBuf); RegCloseKey(key); + if (result != ERROR_SUCCESS) { - Tcl_AppendToObj(resultPtr, "unable to set value: ", -1); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unable to set value: ", -1)); AppendSystemError(interp, result); return TCL_ERROR; } @@ -1354,9 +1373,8 @@ SetValue( * * BroadcastValue -- * - * This function broadcasts a WM_SETTINGCHANGE message to indicate - * to other programs that we have changed the contents of a registry - * value. + * This function broadcasts a WM_SETTINGCHANGE message to indicate to + * other programs that we have changed the contents of a registry value. * * Results: * Returns a normal Tcl result. @@ -1371,13 +1389,13 @@ static int BroadcastValue( Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj * CONST objv[]) /* Argument values. */ + Tcl_Obj *CONST objv[]) /* Argument values. */ { LRESULT result; DWORD_PTR sendResult; UINT timeout = 3000; int len; - char *str; + CONST char *str; Tcl_Obj *objPtr; if ((objc != 3) && (objc != 5)) { @@ -1387,7 +1405,8 @@ BroadcastValue( if (objc > 3) { str = Tcl_GetStringFromObj(objv[3], &len); - if ((len < 2) || (*str != '-') || strncmp(str, "-timeout", (size_t) len)) { + if ((len < 2) || (*str != '-') + || strncmp(str, "-timeout", (size_t) len)) { Tcl_WrongNumArgs(interp, 2, objv, "keyName ?-timeout millisecs?"); return TCL_ERROR; } @@ -1404,6 +1423,7 @@ BroadcastValue( /* * Use the ignore the result. */ + result = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM) 0, (LPARAM) str, SMTO_ABORTIFHUNG, timeout, &sendResult); @@ -1420,8 +1440,8 @@ BroadcastValue( * * AppendSystemError -- * - * This routine formats a Windows system error message and places - * it into the interpreter result. + * This routine formats a Windows system error message and places it into + * the interpreter result. * * Results: * None. @@ -1438,15 +1458,18 @@ AppendSystemError( DWORD error) /* Result code from error. */ { int length; - WCHAR *wMsgPtr; + WCHAR *wMsgPtr, **wMsgPtrPtr = &wMsgPtr; char *msg; char id[TCL_INTEGER_SPACE], msgBuf[24 + TCL_INTEGER_SPACE]; Tcl_DString ds; Tcl_Obj *resultPtr = Tcl_GetObjResult(interp); + if (Tcl_IsShared(resultPtr)) { + resultPtr = Tcl_DuplicateObj(resultPtr); + } length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) &wMsgPtr, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) wMsgPtrPtr, 0, NULL); if (length == 0) { char *msgPtr; @@ -1483,6 +1506,7 @@ AppendSystemError( /* * Trim the trailing CR/LF from the system message. */ + if (msg[length-1] == '\n') { msg[--length] = 0; } @@ -1492,8 +1516,9 @@ AppendSystemError( } sprintf(id, "%ld", error); - Tcl_SetErrorCode(interp, "WINDOWS", id, msg, (char *) NULL); + Tcl_SetErrorCode(interp, "WINDOWS", id, msg, NULL); Tcl_AppendToObj(resultPtr, msg, length); + Tcl_SetObjResult(interp, resultPtr); if (length != 0) { Tcl_DStringFree(&ds); @@ -1505,8 +1530,8 @@ AppendSystemError( * * ConvertDWORD -- * - * This function determines whether a DWORD needs to be byte - * swapped, and returns the appropriately swapped value. + * This function determines whether a DWORD needs to be byte swapped, and + * returns the appropriately swapped value. * * Results: * Returns a converted DWORD. @@ -1529,6 +1554,14 @@ ConvertDWORD( * Check to see if the low bit is in the first byte. */ - localType = (*((char*)(&order)) == 1) ? REG_DWORD : REG_DWORD_BIG_ENDIAN; - return (type != localType) ? (DWORD)SWAPLONG(value) : value; + localType = (*((char*) &order) == 1) ? REG_DWORD : REG_DWORD_BIG_ENDIAN; + return (type != localType) ? (DWORD) SWAPLONG(value) : value; } + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ -- cgit v0.12 From 1d75b0eb9444d42e7399a40853deb8bb47a88e4d Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 29 Apr 2013 09:31:53 +0000 Subject: Improve code generation for [array set] in a common case. --- ChangeLog | 5 ++++ generic/tclCompCmds.c | 82 ++++++++++++++++++++++++++++++++++++--------------- tests/set-old.test | 5 ++++ 3 files changed, 69 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d8f622..9b2dc51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Donal K. Fellows + + * generic/tclCompCmds.c (TclCompileArraySetCmd): Generate better code + when the list of things to set is a literal. + 2013-04-23 Jan Nijtmans * generic/tclDecls.h: Implement Tcl_NewBooleanObj, Tcl_DbNewBooleanObj diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 40348fa..f6ca0e0 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -286,8 +286,10 @@ TclCompileArraySetCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *dataTokenPtr; int simpleVarName, isScalar, localIndex; + int isDataLiteral, isDataValid, isDataEven, len; int dataVar, iterVar, keyVar, valVar, infoIndex; int back, fwd, offsetBack, offsetFwd, savedStackDepth; + Tcl_Obj *literalObj; ForeachInfo *infoPtr; if (parsePtr->numWords != 3) { @@ -297,18 +299,22 @@ TclCompileArraySetCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, &localIndex, &simpleVarName, &isScalar, 1); - dataTokenPtr = TokenAfter(varTokenPtr); if (!isScalar) { return TCL_ERROR; } + dataTokenPtr = TokenAfter(varTokenPtr); + literalObj = Tcl_NewObj(); + isDataLiteral = TclWordKnownAtCompileTime(dataTokenPtr, literalObj); + isDataValid = (isDataLiteral + && Tcl_ListObjLength(NULL, literalObj, &len) == TCL_OK); + isDataEven = (isDataValid && (len & 1) == 0); /* * Special case: literal empty value argument is just an "ensure array" * operation. */ - if (dataTokenPtr->type == TCL_TOKEN_SIMPLE_WORD - && dataTokenPtr[1].size == 0) { + if (isDataEven && len == 0) { if (localIndex >= 0) { TclEmitInstInt4(INST_ARRAY_EXISTS_IMM, localIndex, envPtr); TclEmitInstInt1(INST_JUMP_TRUE1, 7, envPtr); @@ -324,7 +330,24 @@ TclCompileArraySetCmd( TclEmitOpcode( INST_POP, envPtr); } PushLiteral(envPtr, "", 0); - return TCL_OK; + goto done; + } + + /* + * Special case: literal odd-length argument is always an error. + */ + + if (isDataValid && !isDataEven) { + savedStackDepth = envPtr->currStackDepth; + PushLiteral(envPtr, "list must have an even number of elements", + strlen("list must have an even number of elements")); + PushLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}", + strlen("-errorCode {TCL ARGUMENT FORMAT}")); + TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); + TclEmitInt4( 0, envPtr); + envPtr->currStackDepth = savedStackDepth; + PushLiteral(envPtr, "", 0); + goto done; } /* @@ -359,7 +382,7 @@ TclCompileArraySetCmd( } CompileWord(envPtr, dataTokenPtr, interp, 2); TclEmitInstInt1(INST_INVOKE_STK1, 3, envPtr); - return TCL_OK; + goto done; } infoPtr = ckalloc(sizeof(ForeachInfo) + sizeof(ForeachVarList *)); @@ -377,22 +400,31 @@ TclCompileArraySetCmd( */ CompileWord(envPtr, dataTokenPtr, interp, 2); - TclEmitOpcode( INST_DUP, envPtr); - TclEmitOpcode( INST_LIST_LENGTH, envPtr); - PushLiteral(envPtr, "1", 1); - TclEmitOpcode( INST_BITAND, envPtr); - offsetFwd = CurrentOffset(envPtr); - TclEmitInstInt1( INST_JUMP_FALSE1, 0, envPtr); - savedStackDepth = envPtr->currStackDepth; - PushLiteral(envPtr, "list must have an even number of elements", - strlen("list must have an even number of elements")); - PushLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}", - strlen("-errorCode {TCL ARGUMENT FORMAT}")); - TclEmitInstInt4( INST_RETURN_IMM, 1, envPtr); - TclEmitInt4( 0, envPtr); - envPtr->currStackDepth = savedStackDepth; - fwd = CurrentOffset(envPtr) - offsetFwd; - TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); + if (!isDataLiteral || !isDataValid) { + /* + * Only need this safety check if we're handling a non-literal or list + * containing an invalid literal; with valid list literals, we've + * already checked (worth it because literals are a very common + * use-case with [array set]). + */ + + TclEmitOpcode( INST_DUP, envPtr); + TclEmitOpcode( INST_LIST_LENGTH, envPtr); + PushLiteral(envPtr, "1", 1); + TclEmitOpcode( INST_BITAND, envPtr); + offsetFwd = CurrentOffset(envPtr); + TclEmitInstInt1(INST_JUMP_FALSE1, 0, envPtr); + savedStackDepth = envPtr->currStackDepth; + PushLiteral(envPtr, "list must have an even number of elements", + strlen("list must have an even number of elements")); + PushLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}", + strlen("-errorCode {TCL ARGUMENT FORMAT}")); + TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); + TclEmitInt4( 0, envPtr); + envPtr->currStackDepth = savedStackDepth; + fwd = CurrentOffset(envPtr) - offsetFwd; + TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); + } Emit14Inst( INST_STORE_SCALAR, dataVar, envPtr); TclEmitOpcode( INST_POP, envPtr); @@ -439,9 +471,13 @@ TclCompileArraySetCmd( envPtr->currStackDepth = savedStackDepth; TclEmitOpcode( INST_POP, envPtr); } - TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); - TclEmitInt4( dataVar, envPtr); + if (!isDataLiteral) { + TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); + TclEmitInt4( dataVar, envPtr); + } PushLiteral(envPtr, "", 0); + done: + Tcl_DecrRefCount(literalObj); return TCL_OK; } diff --git a/tests/set-old.test b/tests/set-old.test index 52dc0ff..4c25ec5 100644 --- a/tests/set-old.test +++ b/tests/set-old.test @@ -678,6 +678,11 @@ test set-old-8.57 {array command, array get with trivial pattern} { set a(y) 2 array get a x } {x 1} +test set-old-8.58 {array command, array set with LVT and odd length literal} { + list [catch {apply {{} { + array set a {b c d} + }}} msg] $msg +} {1 {list must have an even number of elements}} test set-old-9.1 {ids for array enumeration} { catch {unset a} -- cgit v0.12 From 9e8ba3b5d77ed44876e3454cbf88fff15687c610 Mon Sep 17 00:00:00 2001 From: andreask Date: Tue, 30 Apr 2013 18:43:28 +0000 Subject: (::platform::LibcVersion): Followup to the 2013-01-30 change. The RE become too restrictive again. SuSe added a timestamp after the version. Loosened up a bit. Bumped package to version 1.0.12. --- ChangeLog | 8 ++++++++ library/platform/platform.tcl | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11efb0f..11ecbf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-04-30 Andreas Kupries + + * library/platform/platform.tcl (::platform::LibcVersion): + * library/platform/pkgIndex.tcl: Followup to the 2013-01-30 + change. The RE become too restrictive again. SuSe added a + timestamp after the version. Loosened up a bit. Bumped package + to version 1.0.12. + 2013-04-25 Jan Nijtmans * win/tclWinDde.c: Update dde to version 1.3.3. diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl index a1a728b..5698425 100644 --- a/library/platform/platform.tcl +++ b/library/platform/platform.tcl @@ -256,7 +256,7 @@ proc ::platform::LibcVersion {base _->_ vv} { if {![catch { set vdata [lindex [split [exec $libc] \n] 0] }]} { - regexp {version ([0-9]+(\.[0-9]+)*), by} $vdata -> v + regexp {version ([0-9]+(\.[0-9]+)*)} $vdata -> v foreach {major minor} [split $v .] break set v glibc${major}.${minor} return 1 @@ -368,7 +368,7 @@ proc ::platform::patterns {id} { # ### ### ### ######### ######### ######### ## Ready -package provide platform 1.0.11 +package provide platform 1.0.12 # ### ### ### ######### ######### ######### ## Demo application -- cgit v0.12 From 899d253b0f46c71c7f85582cacf5f512042ff6c6 Mon Sep 17 00:00:00 2001 From: ferrieux Date: Wed, 1 May 2013 21:13:03 +0000 Subject: Backport 8.6's fix [checkin 5af0d249de] to [Bug 2901998]: Inconsistent buffered I/O. Tcl's I/O now flushes buffered output before reading, discards buffered input before writing, etc. --- generic/tclIO.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 92 insertions(+), 8 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index b16bdbb..1b301e2 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -229,6 +229,7 @@ static int WriteChars(Channel *chanPtr, const char *src, static Tcl_Obj * FixLevelCode(Tcl_Obj *msg); static void SpliceChannel(Tcl_Channel chan); static void CutChannel(Tcl_Channel chan); +static int WillRead(Channel *chanPtr); /* * Simplifying helper macros. All may use their argument(s) multiple times. @@ -344,6 +345,52 @@ static Tcl_ObjType tclChannelType = { #define MAX_CHANNEL_BUFFER_SIZE (1024*1024) /* + * ChanRead, dropped here by a time traveler, see 8.6 + */ +static inline int +ChanRead( + Channel *chanPtr, + char *dst, + int dstSize, + int *errnoPtr) +{ + if (WillRead(chanPtr) < 0) { + return -1; + } + + return chanPtr->typePtr->inputProc(chanPtr->instanceData, dst, dstSize, + errnoPtr); +} + +static inline Tcl_WideInt +ChanSeek( + Channel *chanPtr, + Tcl_WideInt offset, + int mode, + int *errnoPtr) +{ + /* + * Note that we prefer the wideSeekProc if that field is available in the + * type and non-NULL. + */ + + if (HaveVersion(chanPtr->typePtr, TCL_CHANNEL_VERSION_3) && + chanPtr->typePtr->wideSeekProc != NULL) { + return chanPtr->typePtr->wideSeekProc(chanPtr->instanceData, + offset, mode, errnoPtr); + } + + if (offsetTcl_LongAsWide(LONG_MAX)) { + *errnoPtr = EOVERFLOW; + return Tcl_LongAsWide(-1); + } + + return Tcl_LongAsWide(chanPtr->typePtr->seekProc(chanPtr->instanceData, + Tcl_WideAsLong(offset), mode, errnoPtr)); +} + + +/* *--------------------------------------------------------------------------- * * TclInitIOSubsystem -- @@ -3548,6 +3595,33 @@ Tcl_WriteObj( } } +static void WillWrite(Channel *chanPtr) +{ + int inputBuffered; + + if ((chanPtr->typePtr->seekProc != NULL) + && ((inputBuffered = Tcl_InputBuffered((Tcl_Channel) chanPtr)) > 0)) { + int ignore; + DiscardInputQueued(chanPtr->state, 0); + ChanSeek(chanPtr, - inputBuffered, SEEK_CUR, &ignore); + } +} + +static int WillRead(Channel *chanPtr) +{ + if ((chanPtr->typePtr->seekProc != NULL) + && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { + if ((chanPtr->state->curOutPtr != NULL) + && IsBufferReady(chanPtr->state->curOutPtr)) { + SetFlag(chanPtr->state, BUFFER_READY); + } + if (FlushChannel(NULL, chanPtr, 0) != 0) { + return -1; + } + } + return 0; +} + /* *---------------------------------------------------------------------- * @@ -3581,6 +3655,10 @@ WriteBytes( char *dst; int dstMax, sawLF, savedLF, total, dstLen, toWrite, translate; + if (srcLen) { + WillWrite(chanPtr); + } + total = 0; sawLF = 0; savedLF = 0; @@ -3682,6 +3760,10 @@ WriteChars( Tcl_Encoding encoding; char safe[BUFFER_PADDING]; + if (srcLen) { + WillWrite(chanPtr); + } + total = 0; sawLF = 0; savedLF = 0; @@ -5187,8 +5269,8 @@ Tcl_ReadRaw( * The case of 'bytesToRead == 0' at this point cannot happen. */ - nread = (chanPtr->typePtr->inputProc)(chanPtr->instanceData, - bufPtr + copied, bytesToRead - copied, &result); + nread = ChanRead(chanPtr, bufPtr + copied, + bytesToRead - copied, &result); #ifdef TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING } @@ -6353,8 +6435,7 @@ GetInput( } else { #endif /* TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING */ - nread = (chanPtr->typePtr->inputProc)(chanPtr->instanceData, - InsertPoint(bufPtr), toRead, &result); + nread = ChanRead(chanPtr, InsertPoint(bufPtr), toRead, &result); #ifdef TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING } @@ -6657,8 +6738,8 @@ Tcl_Tell( outputBuffered = Tcl_OutputBuffered(chan); if ((inputBuffered != 0) && (outputBuffered != 0)) { - Tcl_SetErrno(EFAULT); - return Tcl_LongAsWide(-1); + //Tcl_SetErrno(EFAULT); + //return Tcl_LongAsWide(-1); } /* @@ -6679,6 +6760,7 @@ Tcl_Tell( Tcl_SetErrno(result); return Tcl_LongAsWide(-1); } + if (inputBuffered != 0) { return curPos - inputBuffered; } @@ -6780,8 +6862,10 @@ Tcl_TruncateChannel( * pre-read input data. */ - if (Tcl_Seek(chan, (Tcl_WideInt)0, SEEK_CUR) == Tcl_LongAsWide(-1)) { - return TCL_ERROR; + WillWrite(chanPtr); + + if (WillRead(chanPtr) < 0) { + return TCL_ERROR; } /* -- cgit v0.12 From 9c28e9130dec0dfd158406aa5997ed811e5f699d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 6 May 2013 06:52:53 +0000 Subject: Add support for Cygwin64, which has a 64-bit "long" type. Binary compatibility with win64 requires that all stub entries use 32-bit long's, therefore the need for various wrapper functions/macros. For Tcl 9 a better solution is needed, but that cannot be done without introducing binary incompatibility. --- ChangeLog | 9 ++++++ generic/tclDecls.h | 48 +++++++++++++++++++++++++++++ generic/tclStubInit.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) diff --git a/ChangeLog b/ChangeLog index 11ecbf8..e200cd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2013-05-06 Jan Nijtmans + + * generic/tclStubInit.c: Add support for Cygwin64, which has a 64-bit + * generic/tclDecls.h: "long" type. Binary compatibility with win64 + requires that all stub entries use 32-bit long's, therefore the + need for various wrapper functions/macros. For Tcl 9 a better + solution is needed, but that cannot be done without introducing + binary incompatibility. + 2013-04-30 Andreas Kupries * library/platform/platform.tcl (::platform::LibcVersion): diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 813c75c..cbfa8ee 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -4551,6 +4551,54 @@ extern TclStubs *tclStubsPtr; #define Tcl_UpVar(interp, frameName, varName, localName, flags) \ Tcl_UpVar2(interp, frameName, varName, NULL, localName, flags) +#if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) +# if defined(__CYGWIN__) && defined(TCL_WIDE_INT_IS_LONG) +/* On Cygwin64, long is 64-bit while on Win64 long is 32-bit. Therefore + * we have to make sure that all stub entries on Cygwin64 follow the + * Win64 signature. Cygwin64 stubbed extensions cannot use those stub + * entries any more, they should use the 64-bit alternatives where + * possible. Tcl 9 must find a better solution, but that cannot be done + * without introducing a binary incompatibility. + */ +# undef Tcl_DbNewLongObj +# undef Tcl_GetLongFromObj +# undef Tcl_NewLongObj +# undef Tcl_SetLongObj +# undef Tcl_ExprLong +# undef Tcl_ExprLongObj +# undef Tcl_UniCharNcmp +# undef Tcl_UtfNcmp +# undef Tcl_UtfNcasecmp +# undef Tcl_UniCharNcasecmp +# define Tcl_DbNewLongObj ((Tcl_Obj*(*)(long,const char*,int))Tcl_DbNewWideIntObj) +# define Tcl_GetLongFromObj ((int(*)(Tcl_Interp*,Tcl_Obj*,long*))Tcl_GetWideIntFromObj) +# define Tcl_NewLongObj ((Tcl_Obj*(*)(long))Tcl_NewWideIntObj) +# define Tcl_SetLongObj ((void(*)(Tcl_Obj*,long))Tcl_SetWideIntObj) +# define Tcl_ExprLong TclExprLong + static inline int TclExprLong(Tcl_Interp *interp, const char *string, long *ptr){ + int intValue; + int result = tclStubsPtr->tcl_ExprLong(interp, string, (long *)&intValue); + if (result == TCL_OK) *ptr = (long)intValue; + return result; + } +# define Tcl_ExprLongObj TclExprLongObj + static inline int TclExprLongObj(Tcl_Interp *interp, Tcl_Obj *obj, long *ptr){ + int intValue; + int result = tclStubsPtr->tcl_ExprLongObj(interp, obj, (long *)&intValue); + if (result == TCL_OK) *ptr = (long)intValue; + return result; + } +# define Tcl_UniCharNcmp(ucs,uct,n) \ + ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcmp)(ucs,uct,(unsigned int)(n)) +# define Tcl_UtfNcmp(s1,s2,n) \ + ((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcmp)(s1,s2,(unsigned int)(n)) +# define Tcl_UtfNcasecmp(s1,s2,n) \ + ((int(*)(const char*,const char*,unsigned int))tclStubsPtr->tcl_UtfNcasecmp)(s1,s2,(unsigned int)(n)) +# define Tcl_UniCharNcasecmp(ucs,uct,n) \ + ((int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned int))tclStubsPtr->tcl_UniCharNcasecmp)(ucs,uct,(unsigned int)(n)) +# endif +#endif + /* * Deprecated Tcl procedures: */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 85dfe1c..d796136 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -189,6 +189,91 @@ Tcl_WinTCharToUtf( string, len, dsPtr); } +#if defined(TCL_WIDE_INT_IS_LONG) +/* On Cygwin64, long is 64-bit while on Win64 long is 32-bit. Therefore + * we have to make sure that all stub entries on Cygwin64 follow the Win64 + * signature. Tcl 9 must find a better solution, but that cannot be done + * without introducing a binary incompatibility. + */ +#define Tcl_DbNewLongObj ((Tcl_Obj*(*)(long,const char*,int))dbNewLongObj) +static Tcl_Obj *dbNewLongObj( + int intValue, + const char *file, + int line +) { +#ifdef TCL_MEM_DEBUG + register Tcl_Obj *objPtr; + + TclDbNewObj(objPtr, file, line); + objPtr->bytes = NULL; + + objPtr->internalRep.longValue = (long) intValue; + objPtr->typePtr = &tclIntType; + return objPtr; +#else + return Tcl_NewIntObj(intValue); +#endif +} +#define Tcl_GetLongFromObj (int(*)(Tcl_Interp*,Tcl_Obj*,long*))Tcl_GetIntFromObj +#define Tcl_NewLongObj (Tcl_Obj*(*)(long))Tcl_NewIntObj +#define Tcl_SetLongObj (void(*)(Tcl_Obj*,long))Tcl_SetIntObj +static int exprInt(Tcl_Interp *interp, const char *expr, int *ptr){ + long longValue; + int result = Tcl_ExprLong(interp, expr, &longValue); + if (result == TCL_OK) { + if ((longValue >= -(long)(UINT_MAX)) + && (longValue <= (long)(UINT_MAX))) { + *ptr = (int)longValue; + } else { + Tcl_SetResult(interp, + "integer value too large to represent as non-long integer", + TCL_STATIC); + result = TCL_ERROR; + } + } + return result; +} +#define Tcl_ExprLong (int(*)(Tcl_Interp*,const char*,long*))exprInt +static int exprIntObj(Tcl_Interp *interp, Tcl_Obj*expr, int *ptr){ + long longValue; + int result = Tcl_ExprLongObj(interp, expr, &longValue); + if (result == TCL_OK) { + if ((longValue >= -(long)(UINT_MAX)) + && (longValue <= (long)(UINT_MAX))) { + *ptr = (int)longValue; + } else { + Tcl_SetResult(interp, + "integer value too large to represent as non-long integer", + TCL_STATIC); + result = TCL_ERROR; + } + } + return result; +} +#define Tcl_ExprLongObj (int(*)(Tcl_Interp*,Tcl_Obj*,long*))exprIntObj +static int uniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){ + return Tcl_UniCharNcmp(ucs, uct, (unsigned long)n); +} +#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcmp +static int utfNcmp(const char *s1, const char *s2, unsigned int n){ + return Tcl_UtfNcmp(s1, s2, (unsigned long)n); +} +#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))utfNcmp +static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){ + return Tcl_UtfNcasecmp(s1, s2, (unsigned long)n); +} +#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))utfNcasecmp +static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){ + return Tcl_UniCharNcasecmp(ucs, uct, (unsigned long)n); +} +#define Tcl_UniCharNcasecmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcasecmp +static int formatInt(char *buffer, int n){ + return TclFormatInt(buffer, (long)n); +} +#define TclFormatInt (int(*)(char *, long))formatInt + +#endif + #else /* UNIX and MAC */ # define TclpGetPid 0 # define TclpLocaltime_unix TclpLocaltime -- cgit v0.12 From ebbffb3ea5b1b5609e3fb86ddea543aa3d24693d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 7 May 2013 11:38:35 +0000 Subject: No longer link Cygwin executables with zlib1.dll, but with cygz.dll. On Cygwin64 this doesn't work, and on Cygwin32 it was a bad idea anyway. --- unix/Makefile.in | 8 -------- unix/configure | 6 +----- unix/configure.in | 6 +----- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 00e694d..3b14752 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -614,9 +614,6 @@ doc: ${LIB_FILE}: ${OBJS} ${STUB_LIB_FILE} rm -f $@ @MAKE_LIB@ - @if test "x$(DLL_INSTALL_DIR)" = "x$(BIN_INSTALL_DIR)"; then\ - cp ${ZLIB_DIR}/win32/zlib1.dll .;\ - fi ${STUB_LIB_FILE}: ${STUB_LIB_OBJS} @@ -787,11 +784,6 @@ install-binaries: binaries else true; \ fi; \ done; - @if test "x$(DLL_INSTALL_DIR)" = "x$(BIN_INSTALL_DIR)"; then\ - echo "Installing zlib1.dll to $(BIN_INSTALL_DIR)/";\ - $(INSTALL_LIBRARY) zlib1.dll "$(BIN_INSTALL_DIR)";\ - chmod 555 "$(BIN_INSTALL_DIR)/zlib1.dll";\ - fi @echo "Installing $(LIB_FILE) to $(DLL_INSTALL_DIR)/" @@INSTALL_LIB@ @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" diff --git a/unix/configure b/unix/configure index c178bf1..8a9a462 100755 --- a/unix/configure +++ b/unix/configure @@ -14384,11 +14384,7 @@ _ACEOF # lack blkcnt_t. #-------------------------------------------------------------------- -if test "$ac_cv_cygwin" = "yes"; then - if test "x${SHARED_BUILD}" = "x1"; then - TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS} \${COMPAT_DIR}/zlib/win32/zdll.lib" - fi -else +if test "$ac_cv_cygwin" != "yes"; then echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then diff --git a/unix/configure.in b/unix/configure.in index 19db579..dca8b8c 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -310,11 +310,7 @@ SC_TIME_HANDLER # lack blkcnt_t. #-------------------------------------------------------------------- -if test "$ac_cv_cygwin" = "yes"; then - if test "x${SHARED_BUILD}" = "x1"; then - TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS} \${COMPAT_DIR}/zlib/win32/zdll.lib" - fi -else +if test "$ac_cv_cygwin" != "yes"; then AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize]) fi AC_CHECK_TYPES([blkcnt_t]) -- cgit v0.12 From c8d7d8d2c4ef013886f128bb047b2c9a496a9608 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 8 May 2013 08:24:54 +0000 Subject: Also get msgcat locale from Vista+ registry key "HCU/Control Panel/Desktop : PreferredUILanguages" to honor installed language packs. msgcat now 1.5.2 --- ChangeLog | 7 +++++++ library/msgcat/msgcat.tcl | 39 ++++++++++++++++++++++----------------- library/msgcat/pkgIndex.tcl | 2 +- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6330666..05754ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-05-08 Harald Oehlmann + + * library/msgcat/msgcat.tcl: [Bug 3036566]: Also get locale from + registry key HCU/Control Panel/Desktop : PreferredUILanguages to + honor installed language packs on Vista+. + Bumped msgcat version to 1.5.2 + 2013-05-06 Jan Nijtmans * generic/tclStubInit.c: Add support for Cygwin64, which has a 64-bit diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 5f0ba2e..cf3b9d7 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -13,7 +13,7 @@ package require Tcl 8.5 # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. -package provide msgcat 1.5.1 +package provide msgcat 1.5.2 namespace eval msgcat { namespace export mc mcload mclocale mcmax mcmset mcpreferences mcset \ @@ -541,8 +541,11 @@ proc msgcat::Init {} { # settings, or fall back on locale of "C". # - # First check registry value LocalName present from Windows Vista - # which contains the local string as RFC5646, composed of: + # On Vista and later: + # HCU/Control Panel/Desktop : PreferredUILanguages is for language packs, + # HCU/Control Pannel/International : localName is the default locale. + # + # They contain the local string as RFC5646, composed of: # [a-z]{2,3} : language # -[a-z]{4} : script (optional, translated by table Latn->latin) # -[a-z]{2}|[0-9]{3} : territory (optional, numerical region codes not used) @@ -550,23 +553,25 @@ proc msgcat::Init {} { # Those are translated to local strings. # Examples: de-CH -> de_ch, sr-Latn-CS -> sr_cs@latin, es-419 -> es # - set key {HKEY_CURRENT_USER\Control Panel\International} - if {![catch {registry get $key LocaleName} localeName] - && [regexp {^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}))?(?:-.+)?$}\ - [string tolower $localeName] match locale script territory]} { - if {"" ne $territory} { - append locale _ $territory - } - set modifierDict [dict create latn latin cyrl cyrillic] - if {[dict exists $modifierDict $script]} { - append locale @ [dict get $modifierDict $script] - } - if {![catch {mclocale [ConvertLocale $locale]}]} { - return + foreach key {{HKEY_CURRENT_USER\Control Panel\Desktop} {HKEY_CURRENT_USER\Control Panel\International}}\ + value {PreferredUILanguages localeName} { + if {![catch {registry get $key $value} localeName] + && [regexp {^([a-z]{2,3})(?:-([a-z]{4}))?(?:-([a-z]{2}))?(?:-.+)?$}\ + [string tolower $localeName] match locale script territory]} { + if {"" ne $territory} { + append locale _ $territory + } + set modifierDict [dict create latn latin cyrl cyrillic] + if {[dict exists $modifierDict $script]} { + append locale @ [dict get $modifierDict $script] + } + if {![catch {mclocale [ConvertLocale $locale]}]} { + return + } } } - # then check key locale which contains a numerical language ID + # then check value locale which contains a numerical language ID if {[catch { set locale [registry get $key "locale"] }]} { diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl index 3fdb25a..5fabfe3 100644 --- a/library/msgcat/pkgIndex.tcl +++ b/library/msgcat/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.5]} {return} -package ifneeded msgcat 1.5.1 [list source [file join $dir msgcat.tcl]] +package ifneeded msgcat 1.5.2 [list source [file join $dir msgcat.tcl]] -- cgit v0.12 From e2a50ce38b041d5de04fe4452ddf710c5a9ea999 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 8 May 2013 08:40:22 +0000 Subject: Add install references and changes entry --- ChangeLog | 2 +- changes | 4 ++++ unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05754ac..81d6507 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2013-05-08 Harald Oehlmann * library/msgcat/msgcat.tcl: [Bug 3036566]: Also get locale from - registry key HCU/Control Panel/Desktop : PreferredUILanguages to + registry key HCU\Control Panel\Desktop : PreferredUILanguages to honor installed language packs on Vista+. Bumped msgcat version to 1.5.2 diff --git a/changes b/changes index 63c3877..d3bbb43 100644 --- a/changes +++ b/changes @@ -8163,3 +8163,7 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows) 2012-12-13 (bug fix) crash: [zlib gunzip $data -header noSuchNs::var] (porter) --- Released 8.6.0, December 20, 2012 --- See ChangeLog for details --- + +2013-05-08 (bug fix)[3036566] Honor language packs on Vista+ to get initial locale (oehlmann) +=> msgcat 1.5.2 + diff --git a/unix/Makefile.in b/unix/Makefile.in index 3b14752..1c84540 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -838,8 +838,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; - @echo "Installing package msgcat 1.5.1 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.5.1.tm; + @echo "Installing package msgcat 1.5.2 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.5.2.tm; @echo "Installing package tcltest 2.3.5 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.3.5.tm; diff --git a/win/Makefile.in b/win/Makefile.in index 6f5211e..12c04bc 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -646,8 +646,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; - @echo "Installing package msgcat 1.5.1 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.1.tm; + @echo "Installing package msgcat 1.5.2 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.2.tm; @echo "Installing package tcltest 2.3.5 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.5.tm; @echo "Installing package platform 1.0.11 as a Tcl Module"; -- cgit v0.12 From 88149255f5ae41c5f0580c6564b56f69087efa73 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 8 May 2013 14:52:51 +0000 Subject: Document mcunknown format parameters --- doc/msgcat.n | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/msgcat.n b/doc/msgcat.n index 47b6bf7..44f96e6 100644 --- a/doc/msgcat.n +++ b/doc/msgcat.n @@ -35,7 +35,7 @@ msgcat \- Tcl message catalog \fB::msgcat::mcflmset \fIsrc-trans-list\fR .VE "TIP 404" .sp -\fB::msgcat::mcunknown \fIlocale src-string\fR +\fB::msgcat::mcunknown \fIlocale src-string \fR?\fargs\fR? .BE .SH DESCRIPTION .PP @@ -157,12 +157,13 @@ translate-string\fR ?\fIsrc-string translate-string ...\fR?} of \fB::msgcat::mcflset\fR. The function returns the number of translations set. .VE "TIP 404" .TP -\fB::msgcat::mcunknown \fIlocale src-string\fR +\fB::msgcat::mcunknown \fIlocale src-string \fR?\fargs\fR? . This routine is called by \fB::msgcat::mc\fR in the case when a translation for \fIsrc-string\fR is not defined in the current locale. The default action is to return -\fIsrc-string\fR. This procedure can be redefined by the +\fIsrc-string\fR passed by format if there are any arguments. This +procedure can be redefined by the application, for example to log error messages for each unknown string. The \fB::msgcat::mcunknown\fR procedure is invoked at the same stack context as the call to \fB::msgcat::mc\fR. The return value -- cgit v0.12 From b5df26a280112129ffcd34f74456cc6f2980e5be Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 8 May 2013 15:47:31 +0000 Subject: Corrected args -> arg arg ... in msgcat doc --- doc/msgcat.n | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/msgcat.n b/doc/msgcat.n index 44f96e6..bfd94ae 100644 --- a/doc/msgcat.n +++ b/doc/msgcat.n @@ -35,7 +35,7 @@ msgcat \- Tcl message catalog \fB::msgcat::mcflmset \fIsrc-trans-list\fR .VE "TIP 404" .sp -\fB::msgcat::mcunknown \fIlocale src-string \fR?\fargs\fR? +\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR? .BE .SH DESCRIPTION .PP @@ -157,7 +157,7 @@ translate-string\fR ?\fIsrc-string translate-string ...\fR?} of \fB::msgcat::mcflset\fR. The function returns the number of translations set. .VE "TIP 404" .TP -\fB::msgcat::mcunknown \fIlocale src-string \fR?\fargs\fR? +\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR? . This routine is called by \fB::msgcat::mc\fR in the case when a translation for \fIsrc-string\fR is not defined in the -- cgit v0.12 From 9571165813914daaf16bd8fb71b4f97e7affa1d6 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 10 May 2013 12:57:38 +0000 Subject: Optimizations and general bytecode generation improvements. --- ChangeLog | 13 +++ generic/tclAssembly.c | 3 +- generic/tclCompCmds.c | 199 +++++++++++++++++++++++++++++----- generic/tclCompile.c | 288 +++++++++++++++++++++++++++++++++++++++++++++++--- generic/tclCompile.h | 36 ++++++- generic/tclExecute.c | 62 +++++++++-- 6 files changed, 548 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6330666..bcd089d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2013-05-10 Donal K. Fellows + + Optimizations and general bytecode generation improvements. + * generic/tclCompCmds.c (TclCompileAppendCmd, TclCompileLappendCmd): + (TclCompileReturnCmd): Make these generate bytecode in more cases. + (TclCompileListCmd): Make this able to push a literal when it can. + * generic/tclCompile.c (TclSetByteCodeFromAny, PeepholeOptimize): + Added checks to see if we can apply some simple cross-command-boundary + optimizations, and defined a small number of such optimizations. + (TclCompileScript): Added the special ability to compile the list + command with expansion ([list {*}blah]) into bytecode that does not + call an external command. + 2013-05-06 Jan Nijtmans * generic/tclStubInit.c: Add support for Cygwin64, which has a 64-bit diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 5786975..cd2ad13 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -20,7 +20,7 @@ *- break and continue - if exception ranges can be sorted out. *- foreach_start4, foreach_step4 *- returnImm, returnStk - *- expandStart, expandStkTop, invokeExpanded + *- expandStart, expandStkTop, invokeExpanded, listExpanded *- dictFirst, dictNext, dictDone *- dictUpdateStart, dictUpdateEnd *- jumpTable testing @@ -437,6 +437,7 @@ static const TalInstDesc TalInstructionTable[] = { {"lindexMulti", ASSEM_LINDEX_MULTI, INST_LIST_INDEX_MULTI, INT_MIN,1}, {"list", ASSEM_LIST, INST_LIST, INT_MIN,1}, + {"listConcat", ASSEM_1BYTE, INST_LIST_CONCAT, 2, 1}, {"listIn", ASSEM_1BYTE, INST_LIST_IN, 2, 1}, {"listIndex", ASSEM_1BYTE, INST_LIST_INDEX, 2, 1}, {"listIndexImm", ASSEM_INDEX, INST_LIST_INDEX_IMM, 1, 1}, diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index f6ca0e0..9ffdbc3 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -155,7 +155,7 @@ TclCompileAppendCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; - int simpleVarName, isScalar, localIndex, numWords; + int simpleVarName, isScalar, localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; @@ -169,10 +169,11 @@ TclCompileAppendCmd( return TclCompileSetCmd(interp, parsePtr, cmdPtr, envPtr); } else if (numWords > 3) { /* - * APPEND instructions currently only handle one value. + * APPEND instructions currently only handle one value, but we can + * handle some multi-value cases by stringing them together. */ - return TCL_ERROR; + goto appendMultiple; } /* @@ -222,6 +223,42 @@ TclCompileAppendCmd( } return TCL_OK; + + appendMultiple: + /* + * Can only handle the case where we are appending to a local scalar when + * there are multiple values to append. Fortunately, this is common. + */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, + &localIndex, &simpleVarName, &isScalar, 1); + if (!isScalar || localIndex < 0) { + return TCL_ERROR; + } + + /* + * Definitely appending to a local scalar; generate the words and append + * them. + */ + + valueTokenPtr = TokenAfter(varTokenPtr); + for (i = 2 ; i < numWords ; i++) { + CompileWord(envPtr, valueTokenPtr, interp, i); + valueTokenPtr = TokenAfter(valueTokenPtr); + } + TclEmitInstInt4( INST_REVERSE, numWords-2, envPtr); + for (i = 2 ; i < numWords ;) { + Emit14Inst( INST_APPEND_SCALAR, localIndex, envPtr); + if (++i < numWords) { + TclEmitOpcode(INST_POP, envPtr); + } + } + + return TCL_OK; } /* @@ -4067,8 +4104,8 @@ TclCompileLappendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Token *varTokenPtr; - int simpleVarName, isScalar, localIndex, numWords; + Tcl_Token *varTokenPtr, *valueTokenPtr; + int simpleVarName, isScalar, localIndex, numWords, i, fwd, offsetFwd; DefineLineInformation; /* TIP #280 */ /* @@ -4085,10 +4122,11 @@ TclCompileLappendCmd( } if (numWords != 3) { /* - * LAPPEND instructions currently only handle one value appends. + * LAPPEND instructions currently only handle one value, but we can + * handle some multi-value cases by stringing them together. */ - return TCL_ERROR; + goto lappendMultiple; } /* @@ -4141,6 +4179,45 @@ TclCompileLappendCmd( } return TCL_OK; + + lappendMultiple: + /* + * Can only handle the case where we are appending to a local scalar when + * there are multiple values to append. Fortunately, this is common. + */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, + &localIndex, &simpleVarName, &isScalar, 1); + if (!isScalar || localIndex < 0) { + return TCL_ERROR; + } + + /* + * Definitely appending to a local scalar; generate the words and append + * them. + */ + + valueTokenPtr = TokenAfter(varTokenPtr); + for (i = 2 ; i < numWords ; i++) { + CompileWord(envPtr, valueTokenPtr, interp, i); + valueTokenPtr = TokenAfter(valueTokenPtr); + } + TclEmitInstInt4( INST_LIST, numWords-2, envPtr); + TclEmitInstInt4( INST_EXIST_SCALAR, localIndex, envPtr); + offsetFwd = CurrentOffset(envPtr); + TclEmitInstInt1( INST_JUMP_FALSE1, 0, envPtr); + Emit14Inst( INST_LOAD_SCALAR, localIndex, envPtr); + TclEmitInstInt4( INST_REVERSE, 2, envPtr); + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + fwd = CurrentOffset(envPtr) - offsetFwd; + TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); + Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); + + return TCL_OK; } /* @@ -4390,14 +4467,7 @@ TclCompileListCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *valueTokenPtr; int i, numWords; - - /* - * If we're not in a procedure, don't compile. - */ - - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } + Tcl_Obj *listObj, *objPtr; if (parsePtr->numWords == 1) { /* @@ -4405,20 +4475,57 @@ TclCompileListCmd( */ PushLiteral(envPtr, "", 0); - } else { - /* - * Push the all values onto the stack. - */ + return TCL_OK; + } + + /* + * Test if all arguments are compile-time known. If they are, we can + * implement with a simple push. + */ - numWords = parsePtr->numWords; - valueTokenPtr = TokenAfter(parsePtr->tokenPtr); - for (i = 1; i < numWords; i++) { - CompileWord(envPtr, valueTokenPtr, interp, i); - valueTokenPtr = TokenAfter(valueTokenPtr); + numWords = parsePtr->numWords; + valueTokenPtr = TokenAfter(parsePtr->tokenPtr); + listObj = Tcl_NewObj(); + for (i = 1; i < numWords && listObj != NULL; i++) { + objPtr = Tcl_NewObj(); + if (TclWordKnownAtCompileTime(valueTokenPtr, objPtr)) { + (void) Tcl_ListObjAppendElement(NULL, listObj, objPtr); + } else { + Tcl_DecrRefCount(objPtr); + Tcl_DecrRefCount(listObj); + listObj = NULL; } - TclEmitInstInt4( INST_LIST, numWords - 1, envPtr); + valueTokenPtr = TokenAfter(valueTokenPtr); } + if (listObj != NULL) { + int len; + const char *bytes = Tcl_GetStringFromObj(listObj, &len); + PushLiteral(envPtr, bytes, len); + Tcl_DecrRefCount(listObj); + if (len > 0) { + /* + * Force list interpretation! + */ + + TclEmitOpcode( INST_DUP, envPtr); + TclEmitOpcode( INST_LIST_LENGTH, envPtr); + TclEmitOpcode( INST_POP, envPtr); + } + return TCL_OK; + } + + /* + * Push the all values onto the stack. + */ + + numWords = parsePtr->numWords; + valueTokenPtr = TokenAfter(parsePtr->tokenPtr); + for (i = 1; i < numWords; i++) { + CompileWord(envPtr, valueTokenPtr, interp, i); + valueTokenPtr = TokenAfter(valueTokenPtr); + } + TclEmitInstInt4( INST_LIST, numWords - 1, envPtr); return TCL_OK; } @@ -5578,15 +5685,20 @@ TclCompileReturnCmd( objv[objc] = Tcl_NewObj(); Tcl_IncrRefCount(objv[objc]); if (!TclWordKnownAtCompileTime(wordTokenPtr, objv[objc])) { - objc++; - status = TCL_ERROR; - goto cleanup; + /* + * Non-literal, so punt to run-time. + */ + + for (; objc>=0 ; objc--) { + TclDecrRefCount(objv[objc]); + } + TclStackFree(interp, objv); + goto issueRuntimeReturn; } wordTokenPtr = TokenAfter(wordTokenPtr); } status = TclMergeReturnOptions(interp, objc, objv, &returnOpts, &code, &level); - cleanup: while (--objc >= 0) { TclDecrRefCount(objv[objc]); } @@ -5667,6 +5779,35 @@ TclCompileReturnCmd( CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts); return TCL_OK; + + issueRuntimeReturn: + /* + * Assemble the option dictionary (as a list as that's good enough). + */ + + wordTokenPtr = TokenAfter(parsePtr->tokenPtr); + for (objc=1 ; objc<=numOptionWords ; objc++) { + CompileWord(envPtr, wordTokenPtr, interp, objc); + wordTokenPtr = TokenAfter(wordTokenPtr); + } + TclEmitInstInt4(INST_LIST, numOptionWords, envPtr); + + /* + * Push the result. + */ + + if (explicitResult) { + CompileWord(envPtr, wordTokenPtr, interp, numWords-1); + } else { + PushLiteral(envPtr, "", 0); + } + + /* + * Issue the RETURN itself. + */ + + TclEmitOpcode(INST_RETURN_STK, envPtr); + return TCL_OK; } static void diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 0e98385..1da6e03 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -14,6 +14,7 @@ #include "tclInt.h" #include "tclCompile.h" +#include /* * Table of all AuxData types. @@ -50,7 +51,7 @@ static int traceInitialized = 0; * existence of a procedure call frame to distinguish these. */ -InstructionDesc const tclInstructionTable[] = { +const InstructionDesc const tclInstructionTable[] = { /* Name Bytes stackEffect #Opnds Operand types */ {"done", 1, -1, 0, {OPERAND_NONE}}, /* Finish ByteCode execution and return stktop (top stack item) */ @@ -279,12 +280,12 @@ InstructionDesc const tclInstructionTable[] = { /* Binary exponentiation operator: push (stknext ** stktop) */ /* - * NOTE: the stack effects of expandStkTop and invokeExpanded are wrong - - * but it cannot be done right at compile time, the stack effect is only - * known at run time. The value for invokeExpanded is estimated better at - * compile time. + * NOTE: the stack effects of expandStkTop, invokeExpanded and + * listExpanded are wrong - but it cannot be done right at compile time, + * the stack effect is only known at run time. The value for both + * invokeExpanded and listExpanded are estimated better at compile time. * See the comments further down in this file, where INST_INVOKE_EXPANDED - * is emitted. + * and INST_LIST_EXPANDED are emitted. */ {"expandStart", 1, 0, 0, {OPERAND_NONE}}, /* Start of command with {*} (expanded) arguments */ @@ -534,6 +535,13 @@ InstructionDesc const tclInstructionTable[] = { * the word at the top of the stack; * = */ + {"listConcat", 1, -1, 0, {OPERAND_NONE}}, + /* Concatenates the two lists at the top of the stack into a single + * list and pushes that resulting list onto the stack. + * Stack: ... list1 list2 => ... [lconcat list1 list2] */ + {"listExpanded", 1, 0, 0, {OPERAND_NONE}}, + /* Construct a list from the words marked by the last 'expandStart' */ + {NULL, 0, 0, 0, {OPERAND_NONE}} }; @@ -554,6 +562,9 @@ static void EnterCmdStartData(CompileEnv *envPtr, static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); +static int IsCompactibleCompileEnv(Tcl_Interp *interp, + CompileEnv *envPtr); +static void PeepholeOptimize(CompileEnv *envPtr); #ifdef TCL_COMPILE_STATS static void RecordByteCodeStats(ByteCode *codePtr); #endif /* TCL_COMPILE_STATS */ @@ -654,6 +665,7 @@ TclSetByteCodeFromAny( * in frame. */ int length, result = TCL_OK; const char *stringPtr; + Proc *procPtr = iPtr->compiledProcPtr; ContLineLoc *clLocPtr; #ifdef TCL_COMPILE_DEBUG @@ -705,6 +717,38 @@ TclSetByteCodeFromAny( TclEmitOpcode(INST_DONE, &compEnv); /* + * Check for optimizations! + * + * Test if the generated code is free of most hazards; if so, recompile + * but with generation of INST_START_CMD disabled. This produces somewhat + * faster code in some cases, and more compact code in more. + */ + + if (Tcl_GetMaster(interp) == NULL && + !Tcl_LimitTypeEnabled(interp, TCL_LIMIT_COMMANDS|TCL_LIMIT_TIME) + && IsCompactibleCompileEnv(interp, &compEnv)) { + TclFreeCompileEnv(&compEnv); + iPtr->compiledProcPtr = procPtr; + TclInitCompileEnv(interp, &compEnv, stringPtr, length, + iPtr->invokeCmdFramePtr, iPtr->invokeWord); + if (clLocPtr) { + compEnv.clLoc = clLocPtr; + compEnv.clNext = &compEnv.clLoc->loc[0]; + Tcl_Preserve(compEnv.clLoc); + } + compEnv.atCmdStart = 2; /* The disabling magic. */ + TclCompileScript(interp, stringPtr, length, &compEnv); + TclEmitOpcode(INST_DONE, &compEnv); + } + + /* + * Apply some peephole optimizations that can cross specific/generic + * instruction generator boundaries. + */ + + PeepholeOptimize(&compEnv); + + /* * Invoke the compilation hook procedure if one exists. */ @@ -973,6 +1017,202 @@ TclCleanupByteCode( } /* + * --------------------------------------------------------------------- + * + * IsCompactibleCompileEnv -- + * + * Checks to see if we may apply some basic compaction optimizations to a + * piece of bytecode. Idempotent. + * + * --------------------------------------------------------------------- + */ + +static int +IsCompactibleCompileEnv( + Tcl_Interp *interp, + CompileEnv *envPtr) +{ + unsigned char *pc; + int size; + + /* + * Special: procedures in the '::tcl' namespace (or its children) are + * considered to be well-behaved and so can have compaction applied even + * if it would otherwise be invalid. + */ + + if (envPtr->procPtr != NULL && envPtr->procPtr->cmdPtr != NULL + && envPtr->procPtr->cmdPtr->nsPtr != NULL) { + Namespace *nsPtr = envPtr->procPtr->cmdPtr->nsPtr; + + if (strcmp(nsPtr->fullName, "::tcl") == 0 + || strncmp(nsPtr->fullName, "::tcl::", 7) == 0) { + return 1; + } + } + + /* + * Go through and ensure that no operation involved can cause a desired + * change of bytecode sequence during running. This comes down to ensuring + * that there are no mapped variables (due to traces) or calls to external + * commands (traces, [uplevel] trickery). This is actually a very + * conservative check; it turns down a lot of code that is OK in practice. + */ + + for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { + switch (*pc) { + /* Invokes */ + case INST_INVOKE_STK1: + case INST_INVOKE_STK4: + case INST_INVOKE_EXPANDED: + case INST_INVOKE_REPLACE: + return 0; + /* Runtime evals */ + case INST_EVAL_STK: + case INST_EXPR_STK: + case INST_YIELD: + return 0; + /* Upvars */ + case INST_UPVAR: + case INST_NSUPVAR: + case INST_VARIABLE: + return 0; + } + size = tclInstructionTable[*pc].numBytes; + assert (size > 0); + } + + return 1; +} + +/* + * ---------------------------------------------------------------------- + * + * PeepholeOptimize -- + * + * A very simple peephole optimizer for bytecode. + * + * ---------------------------------------------------------------------- + */ + +static void +PeepholeOptimize( + CompileEnv *envPtr) +{ + unsigned char *pc, *prev1 = NULL, *prev2 = NULL, *target; + int size, isNew; + Tcl_HashTable targets; + Tcl_HashEntry *hPtr; + Tcl_HashSearch hSearch; + + /* + * Find places where we should be careful about replacing instructions + * because they are the targets of various types of jumps. + */ + + Tcl_InitHashTable(&targets, TCL_ONE_WORD_KEYS); + for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { + size = tclInstructionTable[*pc].numBytes; + switch (*pc) { + case INST_JUMP1: + case INST_JUMP_TRUE1: + case INST_JUMP_FALSE1: + target = pc + TclGetInt1AtPtr(pc+1); + goto storeTarget; + case INST_JUMP4: + case INST_JUMP_TRUE4: + case INST_JUMP_FALSE4: + target = pc + TclGetInt4AtPtr(pc+1); + goto storeTarget; + case INST_BEGIN_CATCH4: + target = envPtr->codeStart + envPtr->exceptArrayPtr[ + TclGetUInt4AtPtr(pc+1)].codeOffset; + storeTarget: + (void) Tcl_CreateHashEntry(&targets, (void *) target, &isNew); + break; + case INST_JUMP_TABLE: + hPtr = Tcl_FirstHashEntry( + &JUMPTABLEINFO(envPtr, pc+1)->hashTable, &hSearch); + for (; hPtr ; hPtr = Tcl_NextHashEntry(&hSearch)) { + target = pc + (int) Tcl_GetHashValue(hPtr); + (void) Tcl_CreateHashEntry(&targets, (void *) target, &isNew); + } + break; + } + } + + /* + * Replace PUSH/POP sequences (when non-hazardous) with NOPs. + */ + + (void) Tcl_CreateHashEntry(&targets, (void *) pc, &isNew); + for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { + int blank = 0, i; + + size = tclInstructionTable[*pc].numBytes; + prev2 = prev1; + prev1 = pc; + if (Tcl_FindHashEntry(&targets, (void *) (pc + size))) { + continue; + } + switch (*pc) { + case INST_PUSH1: + while (*(pc+size) == INST_NOP) { + size++; + } + if (*(pc+size) == INST_POP) { + blank = size + 1; + } else if (*(pc+size) == INST_CONCAT1 + && TclGetUInt1AtPtr(pc + size + 1) == 2) { + Tcl_Obj *litPtr = TclFetchLiteral(envPtr, + TclGetUInt1AtPtr(pc + 1)); + int numBytes; + + (void) Tcl_GetStringFromObj(litPtr, &numBytes); + if (numBytes == 0) { + blank = size + 2; + } + } + break; + case INST_PUSH4: + while (*(pc+size) == INST_NOP) { + size++; + } + if (*(pc+size) == INST_POP) { + blank = size + 1; + } else if (*(pc+size) == INST_CONCAT1 + && TclGetUInt1AtPtr(pc + size + 1) == 2) { + Tcl_Obj *litPtr = TclFetchLiteral(envPtr, + TclGetUInt4AtPtr(pc + 1)); + int numBytes; + + (void) Tcl_GetStringFromObj(litPtr, &numBytes); + if (numBytes == 0) { + blank = size + 2; + } + } + break; + } + if (blank > 0) { + for (i=0 ; icodeNext--; + } + Tcl_DeleteHashTable(&targets); +} + +/* *---------------------------------------------------------------------- * * Tcl_SubstObj -- @@ -1194,6 +1434,8 @@ TclInitCompileEnv( { Interp *iPtr = (Interp *) interp; + assert(tclInstructionTable[LAST_INST_OPCODE].name == NULL); + envPtr->iPtr = iPtr; envPtr->source = stringPtr; envPtr->numSrcBytes = numBytes; @@ -1689,7 +1931,7 @@ TclCompileScript( wordIdx < parsePtr->numWords; wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - expand = 1; + expand = INST_INVOKE_EXPANDED; break; } } @@ -1802,7 +2044,7 @@ TclCompileScript( * command. */ - if (envPtr->atCmdStart) { + if (envPtr->atCmdStart == 1) { if (savedCodeNext != 0) { /* * Increase the number of commands being @@ -1816,7 +2058,7 @@ TclCompileScript( TclStoreInt4AtPtr(TclGetUInt4AtPtr(fixPtr)+1, fixPtr); } - } else { + } else if (envPtr->atCmdStart == 0) { TclEmitInstInt4(INST_START_CMD, 0, envPtr); TclEmitInt4(1, envPtr); update = 1; @@ -1860,7 +2102,7 @@ TclCompileScript( goto finishCommand; } - if (envPtr->atCmdStart && savedCodeNext != 0) { + if (envPtr->atCmdStart == 1 && savedCodeNext != 0) { /* * Decrease the number of commands being started * at the current point. Note that this depends on @@ -1899,6 +2141,25 @@ TclCompileScript( TclFetchLiteral(envPtr, objIndex), cmdPtr); } } else { + if (wordIdx == 0 && expand) { + TclDStringClear(&ds); + TclDStringAppendToken(&ds, &tokenPtr[1]); + cmdPtr = (Command *) Tcl_FindCommand(interp, + Tcl_DStringValue(&ds), + (Tcl_Namespace *) cmdNsPtr, /*flags*/ 0); + if ((cmdPtr != NULL) && + (cmdPtr->compileProc == TclCompileListCmd)) { + /* + * Special case! [list] command can be expanded + * directly provided the first word is not the + * expanded one. + */ + + expand = INST_LIST_EXPANDED; + continue; + } + } + /* * Simple argument word of a command. We reach this if and * only if the command word was not compiled for whatever @@ -1941,9 +2202,12 @@ TclCompileScript( * Note that the estimates are not correct while the command * is being prepared and run, INST_EXPAND_STKTOP is not * stack-neutral in general. + * + * The opcodes that may be issued here (both assumed to be + * non-zero) are INST_INVOKE_EXPANDED and INST_LIST_EXPANDED. */ - TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); + TclEmitOpcode(expand, envPtr); TclAdjustStackDepth((1-wordIdx), envPtr); } else if (wordIdx > 0) { /* @@ -3692,7 +3956,7 @@ TclInitAuxDataTypeTable(void) Tcl_InitHashTable(&auxDataTypeTable, TCL_STRING_KEYS); /* - * There are only two AuxData type at this time, so register them here. + * There are only three AuxData types at this time, so register them here. */ RegisterAuxDataType(&tclForeachInfoType); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 79497d2..c68d3ec 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -309,7 +309,9 @@ typedef struct CompileEnv { int atCmdStart; /* Flag to say whether an INST_START_CMD * should be issued; they should never be * issued repeatedly, as that is significantly - * inefficient. */ + * inefficient. If set to 2, that instruction + * should not be issued at all (by the generic + * part of the command compiler). */ ContLineLoc *clLoc; /* If not NULL, the table holding the * locations of the invisible continuation * lines in the input script, to adjust the @@ -713,8 +715,11 @@ typedef struct ByteCode { #define INST_INVOKE_REPLACE 163 +#define INST_LIST_CONCAT 164 +#define INST_LIST_EXPANDED 165 + /* The last opcode */ -#define LAST_INST_OPCODE 163 +#define LAST_INST_OPCODE 165 /* * Table describing the Tcl bytecode instructions: their name (for displaying @@ -848,6 +853,9 @@ typedef struct ForeachInfo { MODULE_SCOPE const AuxDataType tclForeachInfoType; +#define FOREACHINFO(envPtr, index) \ + ((ForeachInfo*)((envPtr)->auxDataArrayPtr[TclGetUInt4AtPtr(index)].clientData)) + /* * Structure used to hold information about a switch command that is needed * during program execution. These structures are stored in CompileEnv and @@ -861,6 +869,9 @@ typedef struct JumptableInfo { MODULE_SCOPE const AuxDataType tclJumptableInfoType; +#define JUMPTABLEINFO(envPtr, index) \ + ((JumptableInfo*)((envPtr)->auxDataArrayPtr[TclGetUInt4AtPtr(index)].clientData)) + /* * Structure used to hold information about a [dict update] command that is * needed during program execution. These structures are stored in CompileEnv @@ -879,6 +890,9 @@ typedef struct { MODULE_SCOPE const AuxDataType tclDictUpdateInfoType; +#define DICTUPDATEINFO(envPtr, index) \ + ((DictUpdateInfo*)((envPtr)->auxDataArrayPtr[TclGetUInt4AtPtr(index)].clientData)) + /* * ClientData type used by the math operator commands. */ @@ -1090,6 +1104,18 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); } while (0) /* + * Macros used to update the flag that indicates if we are at the start of a + * command, based on whether the opcode is INST_START_COMMAND. + * + * void TclUpdateAtCmdStart(unsigned char op, CompileEnv *envPtr); + */ + +#define TclUpdateAtCmdStart(op, envPtr) \ + if ((envPtr)->atCmdStart < 2) { \ + (envPtr)->atCmdStart = ((op) == INST_START_CMD ? 1 : 0); \ + } + +/* * Macro to emit an opcode byte into a CompileEnv's code array. The ANSI C * "prototype" for this macro is: * @@ -1102,7 +1128,7 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); TclExpandCodeArray(envPtr); \ } \ *(envPtr)->codeNext++ = (unsigned char) (op); \ - (envPtr)->atCmdStart = ((op) == INST_START_CMD); \ + TclUpdateAtCmdStart(op, envPtr); \ TclUpdateStackReqs(op, 0, envPtr); \ } while (0) @@ -1154,7 +1180,7 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); } \ *(envPtr)->codeNext++ = (unsigned char) (op); \ *(envPtr)->codeNext++ = (unsigned char) ((unsigned int) (i)); \ - (envPtr)->atCmdStart = ((op) == INST_START_CMD); \ + TclUpdateAtCmdStart(op, envPtr); \ TclUpdateStackReqs(op, i, envPtr); \ } while (0) @@ -1172,7 +1198,7 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); (unsigned char) ((unsigned int) (i) >> 8); \ *(envPtr)->codeNext++ = \ (unsigned char) ((unsigned int) (i) ); \ - (envPtr)->atCmdStart = ((op) == INST_START_CMD); \ + TclUpdateAtCmdStart(op, envPtr); \ TclUpdateStackReqs(op, i, envPtr); \ } while (0) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 029f402..afde900 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2338,6 +2338,14 @@ TEBCresume( } inst = *(pc += 9); goto peepholeStart; + } else if (inst == INST_NOP) { +#ifndef TCL_COMPILE_DEBUG + while (inst == INST_NOP) +#endif + { + inst = *++pc; + } + goto peepholeStart; } switch (inst) { @@ -2369,14 +2377,28 @@ TEBCresume( TRACE(("=> ")); objResultPtr = POP_OBJECT(); result = Tcl_SetReturnOptions(interp, OBJ_AT_TOS); - Tcl_DecrRefCount(OBJ_AT_TOS); - OBJ_AT_TOS = objResultPtr; if (result == TCL_OK) { + Tcl_DecrRefCount(OBJ_AT_TOS); + OBJ_AT_TOS = objResultPtr; TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")", O2S(objResultPtr))); NEXT_INST_F(1, 0, 0); + } else if (result == TCL_ERROR) { + /* + * BEWARE! Must do this in this order, because an error in the + * option dictionary overrides the result (and can be verified by + * test). + */ + + Tcl_SetObjResult(interp, objResultPtr); + Tcl_SetReturnOptions(interp, OBJ_AT_TOS); + Tcl_DecrRefCount(OBJ_AT_TOS); + OBJ_AT_TOS = objResultPtr; + } else { + Tcl_DecrRefCount(OBJ_AT_TOS); + OBJ_AT_TOS = objResultPtr; + Tcl_SetObjResult(interp, objResultPtr); } - Tcl_SetObjResult(interp, objResultPtr); cleanup = 1; goto processExceptionReturn; @@ -2501,9 +2523,6 @@ TEBCresume( TclDecrRefCount(objPtr); NEXT_INST_F(1, 0, 0); - case INST_NOP: - NEXT_INST_F(1, 0, 0); - case INST_DUP: objResultPtr = OBJ_AT_TOS; TRACE_WITH_OBJ(("=> "), objResultPtr); @@ -4418,6 +4437,14 @@ TEBCresume( TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(5, opnd, 1); + case INST_LIST_EXPANDED: + CLANG_ASSERT(auxObjList); + objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value; + POP_TAUX_OBJ(); + objResultPtr = Tcl_NewListObj(objc, &OBJ_AT_DEPTH(objc-1)); + TRACE_WITH_OBJ(("(%u) => ", objc), objResultPtr); + NEXT_INST_V(1, objc, 1); + case INST_LIST_LENGTH: valuePtr = OBJ_AT_TOS; if (TclListObjLength(interp, valuePtr, &length) != TCL_OK) { @@ -4763,6 +4790,29 @@ TEBCresume( objResultPtr = TCONST(match); NEXT_INST_F(0, 2, 1); + case INST_LIST_CONCAT: + value2Ptr = OBJ_AT_TOS; + valuePtr = OBJ_UNDER_TOS; + TRACE(("\"%.30s\" \"%.30s\" => ", O2S(valuePtr), O2S(value2Ptr))); + if (Tcl_IsShared(valuePtr)) { + objResultPtr = Tcl_DuplicateObj(valuePtr); + if (Tcl_ListObjAppendList(interp, objResultPtr, + value2Ptr) != TCL_OK) { + TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp)))); + TclDecrRefCount(objResultPtr); + goto gotError; + } + TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr))); + NEXT_INST_F(1, 2, 1); + } else { + if (Tcl_ListObjAppendList(interp, valuePtr, value2Ptr) != TCL_OK){ + TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp)))); + goto gotError; + } + TRACE_APPEND(("\"%.30s\"\n", O2S(valuePtr))); + NEXT_INST_F(1, 1, 0); + } + /* * End of INST_LIST and related instructions. * ----------------------------------------------------------------- -- cgit v0.12 From b5dfface8d2bbb92709c3ce349d4f101a4354361 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 11 May 2013 20:02:43 +0000 Subject: Partial fix: still ongoing --- generic/tclCompCmds.c | 3 +++ generic/tclCompile.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 9ffdbc3..c2495bd 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -5761,6 +5761,7 @@ TclCompileReturnCmd( Tcl_DecrRefCount(returnOpts); TclEmitOpcode(INST_DONE, envPtr); + envPtr->currStackDepth = savedStackDepth; return TCL_OK; } } @@ -5778,6 +5779,7 @@ TclCompileReturnCmd( */ CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts); + envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; issueRuntimeReturn: @@ -5807,6 +5809,7 @@ TclCompileReturnCmd( */ TclEmitOpcode(INST_RETURN_STK, envPtr); + envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 1da6e03..838d801 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1434,7 +1434,7 @@ TclInitCompileEnv( { Interp *iPtr = (Interp *) interp; - assert(tclInstructionTable[LAST_INST_OPCODE].name == NULL); + assert(tclInstructionTable[LAST_INST_OPCODE+1].name == NULL); envPtr->iPtr = iPtr; envPtr->source = stringPtr; -- cgit v0.12 From 6b7dccabf9f9804049494bf42d0b72cf5a3f9a90 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 12 May 2013 00:04:27 +0000 Subject: Fix implementation of INST_LIST_EXPANDED. --- generic/tclExecute.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index afde900..f994ba5 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -4443,7 +4443,11 @@ TEBCresume( POP_TAUX_OBJ(); objResultPtr = Tcl_NewListObj(objc, &OBJ_AT_DEPTH(objc-1)); TRACE_WITH_OBJ(("(%u) => ", objc), objResultPtr); - NEXT_INST_V(1, objc, 1); + while (objc--) { + valuePtr = POP_OBJECT(); + TclDecrRefCount(valuePtr); + } + NEXT_INST_F(1, 0, 1); case INST_LIST_LENGTH: valuePtr = OBJ_AT_TOS; -- cgit v0.12 From d7477a9621b19997f770d8df75b8a071704973d0 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 12 May 2013 00:42:53 +0000 Subject: Corrected the stack balancing in the special [list {*} ] compiler. --- generic/tclCompile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 838d801..7f6b7d4 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1879,6 +1879,13 @@ TclCompileScript( if (parsePtr->numWords > 0) { int expand = 0; /* Set if there are dynamic expansions to * handle */ + int expandIgnoredWords = 0; + /* The number of *apparent* words that we are + * generating code from directly during + * expansion processing. For [list {*}blah] + * expansion, we set this to one because we + * ignore the first word and generate code + * directly. */ /* * If not the first command, pop the previous command's result @@ -2156,6 +2163,7 @@ TclCompileScript( */ expand = INST_LIST_EXPANDED; + expandIgnoredWords = 1; continue; } } @@ -2208,7 +2216,7 @@ TclCompileScript( */ TclEmitOpcode(expand, envPtr); - TclAdjustStackDepth((1-wordIdx), envPtr); + TclAdjustStackDepth(1 + expandIgnoredWords - wordIdx, envPtr); } else if (wordIdx > 0) { /* * Save PC -> command map for the TclArgumentBC* functions. -- cgit v0.12 From 9116440cfe8bf52e4ef8174ab27f688247156c00 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 13 May 2013 14:07:56 +0000 Subject: Upgrade to zlib 1.2.8 --- ChangeLog | 4 + compat/zlib/CMakeLists.txt | 52 +- compat/zlib/ChangeLog | 63 ++ compat/zlib/Makefile.in | 20 +- compat/zlib/README | 6 +- compat/zlib/as400/bndsrc | 10 + compat/zlib/as400/compile.clp | 2 +- compat/zlib/as400/readme.txt | 2 +- compat/zlib/as400/zlib.inc | 14 +- compat/zlib/compress.c | 2 +- compat/zlib/configure | 171 ++--- compat/zlib/contrib/README.contrib | 1 + compat/zlib/contrib/blast/blast.c | 8 +- compat/zlib/contrib/blast/blast.h | 8 +- compat/zlib/contrib/delphi/ZLib.pas | 2 +- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs | 4 +- compat/zlib/contrib/infback9/infback9.c | 4 +- compat/zlib/contrib/infback9/inftree9.c | 6 +- compat/zlib/contrib/minizip/configure.ac | 2 +- compat/zlib/contrib/minizip/crypt.h | 8 +- compat/zlib/contrib/minizip/iowin32.c | 98 ++- compat/zlib/contrib/minizip/miniunzip.1 | 63 ++ compat/zlib/contrib/minizip/minizip.1 | 46 ++ compat/zlib/contrib/minizip/unzip.c | 12 +- compat/zlib/contrib/minizip/unzip.h | 4 +- compat/zlib/contrib/minizip/zip.c | 2 +- compat/zlib/contrib/pascal/zlibpas.pas | 4 +- compat/zlib/contrib/puff/puff.c | 7 +- compat/zlib/contrib/puff/puff.h | 4 +- compat/zlib/contrib/puff/pufftest.c | 4 +- compat/zlib/contrib/testzlib/testzlib.c | 4 +- compat/zlib/contrib/vstudio/readme.txt | 7 +- .../zlib/contrib/vstudio/vc10/miniunz.vcxproj.user | 3 - .../zlib/contrib/vstudio/vc10/minizip.vcxproj.user | 3 - .../contrib/vstudio/vc10/testzlib.vcxproj.user | 3 - .../contrib/vstudio/vc10/testzlibdll.vcxproj.user | 3 - compat/zlib/contrib/vstudio/vc10/zlib.rc | 10 +- compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj | 16 + .../contrib/vstudio/vc10/zlibstat.vcxproj.user | 3 - compat/zlib/contrib/vstudio/vc10/zlibvc.def | 12 +- compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj | 30 +- .../zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user | 3 - compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj | 314 ++++++++++ compat/zlib/contrib/vstudio/vc11/minizip.vcxproj | 311 ++++++++++ compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj | 426 +++++++++++++ .../zlib/contrib/vstudio/vc11/testzlibdll.vcxproj | 314 ++++++++++ compat/zlib/contrib/vstudio/vc11/zlib.rc | 32 + compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj | 464 ++++++++++++++ compat/zlib/contrib/vstudio/vc11/zlibvc.def | 143 +++++ compat/zlib/contrib/vstudio/vc11/zlibvc.sln | 117 ++++ compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj | 688 +++++++++++++++++++++ compat/zlib/contrib/vstudio/vc9/zlib.rc | 10 +- compat/zlib/contrib/vstudio/vc9/zlibvc.def | 14 +- compat/zlib/deflate.c | 12 +- compat/zlib/deflate.h | 2 +- compat/zlib/examples/enough.c | 39 +- compat/zlib/examples/gun.c | 11 +- compat/zlib/examples/gzappend.c | 22 +- compat/zlib/examples/gzjoin.c | 13 +- compat/zlib/examples/gzlog.c | 21 +- compat/zlib/examples/gzlog.h | 6 +- compat/zlib/examples/zran.c | 11 +- compat/zlib/gzguts.h | 22 +- compat/zlib/gzlib.c | 40 +- compat/zlib/gzread.c | 21 +- compat/zlib/gzwrite.c | 64 +- compat/zlib/infback.c | 2 +- compat/zlib/inffast.c | 6 +- compat/zlib/inflate.c | 64 +- compat/zlib/inftrees.c | 14 +- compat/zlib/qnx/package.qpg | 10 +- compat/zlib/test/example.c | 8 +- compat/zlib/test/minigzip.c | 20 + compat/zlib/treebuild.xml | 4 +- compat/zlib/trees.c | 14 +- compat/zlib/uncompr.c | 2 +- compat/zlib/win32/Makefile.msc | 77 +-- compat/zlib/win32/README-WIN32.txt | 4 +- compat/zlib/win32/README.txt | 17 +- compat/zlib/win32/zdll.lib | Bin 15256 -> 15658 bytes compat/zlib/win32/zlib.def | 2 + compat/zlib/win32/zlib1.dll | Bin 107520 -> 107520 bytes compat/zlib/win32/zlib1.rc | 2 +- compat/zlib/win64/zdll.lib | Bin 14896 -> 15288 bytes compat/zlib/win64/zlib1.dll | Bin 112640 -> 112640 bytes compat/zlib/zconf.h | 33 +- compat/zlib/zconf.h.cmakein | 33 +- compat/zlib/zconf.h.in | 33 +- compat/zlib/zlib.3 | 6 +- compat/zlib/zlib.3.pdf | Bin 8760 -> 8734 bytes compat/zlib/zlib.h | 48 +- compat/zlib/zlib.map | 5 + compat/zlib/zutil.c | 2 +- compat/zlib/zutil.h | 9 +- 94 files changed, 3768 insertions(+), 494 deletions(-) create mode 100644 compat/zlib/contrib/minizip/miniunzip.1 create mode 100644 compat/zlib/contrib/minizip/minizip.1 delete mode 100644 compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.user delete mode 100644 compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.user delete mode 100644 compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.user delete mode 100644 compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user create mode 100644 compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj create mode 100644 compat/zlib/contrib/vstudio/vc11/minizip.vcxproj create mode 100644 compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj create mode 100644 compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj create mode 100644 compat/zlib/contrib/vstudio/vc11/zlib.rc create mode 100644 compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj create mode 100644 compat/zlib/contrib/vstudio/vc11/zlibvc.def create mode 100644 compat/zlib/contrib/vstudio/vc11/zlibvc.sln create mode 100644 compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj diff --git a/ChangeLog b/ChangeLog index bcd089d..a167b29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-13 Jan Nijtmans + + * compat/zlib/*: Upgrade to zlib 1.2.8 + 2013-05-10 Donal K. Fellows Optimizations and general bytecode generation improvements. diff --git a/compat/zlib/CMakeLists.txt b/compat/zlib/CMakeLists.txt index 7ee3bc4..0c0247c 100644 --- a/compat/zlib/CMakeLists.txt +++ b/compat/zlib/CMakeLists.txt @@ -3,7 +3,10 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.2.7") +set(VERSION "1.2.8") + +option(ASM686 "Enable building i686 assembly implementation") +option(AMD64 "Enable building amd64 assembly implementation") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -121,11 +124,44 @@ set(ZLIB_SRCS ) if(NOT MINGW) - set(ZLIB_SRCS ${ZLIB_SRCS} + set(ZLIB_DLL_SRCS win32/zlib1.rc # If present will override custom build rule below. ) endif() +if(CMAKE_COMPILER_IS_GNUCC) + if(ASM686) + set(ZLIB_ASMS contrib/asm686/match.S) + elseif (AMD64) + set(ZLIB_ASMS contrib/amd64/amd64-match.S) + endif () + + if(ZLIB_ASMS) + add_definitions(-DASMV) + set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) + endif() +endif() + +if(MSVC) + if(ASM686) + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx86/inffas32.asm + contrib/masmx86/match686.asm + ) + elseif (AMD64) + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx64/gvmat64.asm + contrib/masmx64/inffasx64.asm + ) + endif() + + if(ZLIB_ASMS) + add_definitions(-DASMV -DASMINF) + endif() +endif() + # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" @@ -134,7 +170,7 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" if(MINGW) # This gets us DLL resource information when compiling on MinGW. if(NOT CMAKE_RC_COMPILER) - SET(CMAKE_RC_COMPILER windres.exe) + set(CMAKE_RC_COMPILER windres.exe) endif() add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj @@ -144,11 +180,11 @@ if(MINGW) -I ${CMAKE_CURRENT_BINARY_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) @@ -166,7 +202,9 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") + if(NOT APPLE) + set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + endif() elseif(BUILD_SHARED_LIBS AND WIN32) # Creates zlib1.dll when building shared library version set_target_properties(zlib PROPERTIES SUFFIX "1.dll") diff --git a/compat/zlib/ChangeLog b/compat/zlib/ChangeLog index c2c643a..f22aaba 100644 --- a/compat/zlib/ChangeLog +++ b/compat/zlib/ChangeLog @@ -1,6 +1,69 @@ ChangeLog file for zlib +Changes in 1.2.8 (28 Apr 2013) +- Update contrib/minizip/iowin32.c for Windows RT [Vollant] +- Do not force Z_CONST for C++ +- Clean up contrib/vstudio [Ro§] +- Correct spelling error in zlib.h +- Fix mixed line endings in contrib/vstudio + +Changes in 1.2.7.3 (13 Apr 2013) +- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc + +Changes in 1.2.7.2 (13 Apr 2013) +- Change check for a four-byte type back to hexadecimal +- Fix typo in win32/Makefile.msc +- Add casts in gzwrite.c for pointer differences + +Changes in 1.2.7.1 (24 Mar 2013) +- Replace use of unsafe string functions with snprintf if available +- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink] +- Fix gzgetc undefine when Z_PREFIX set [Turk] +- Eliminate use of mktemp in Makefile (not always available) +- Fix bug in 'F' mode for gzopen() +- Add inflateGetDictionary() function +- Correct comment in deflate.h +- Use _snprintf for snprintf in Microsoft C +- On Darwin, only use /usr/bin/libtool if libtool is not Apple +- Delete "--version" file if created by "ar --version" [Richard G.] +- Fix configure check for veracity of compiler error return codes +- Fix CMake compilation of static lib for MSVC2010 x64 +- Remove unused variable in infback9.c +- Fix argument checks in gzlog_compress() and gzlog_write() +- Clean up the usage of z_const and respect const usage within zlib +- Clean up examples/gzlog.[ch] comparisons of different types +- Avoid shift equal to bits in type (caused endless loop) +- Fix unintialized value bug in gzputc() introduced by const patches +- Fix memory allocation error in examples/zran.c [Nor] +- Fix bug where gzopen(), gzclose() would write an empty file +- Fix bug in gzclose() when gzwrite() runs out of memory +- Check for input buffer malloc failure in examples/gzappend.c +- Add note to contrib/blast to use binary mode in stdio +- Fix comparisons of differently signed integers in contrib/blast +- Check for invalid code length codes in contrib/puff +- Fix serious but very rare decompression bug in inftrees.c +- Update inflateBack() comments, since inflate() can be faster +- Use underscored I/O function names for WINAPI_FAMILY +- Add _tr_flush_bits to the external symbols prefixed by --zprefix +- Add contrib/vstudio/vc10 pre-build step for static only +- Quote --version-script argument in CMakeLists.txt +- Don't specify --version-script on Apple platforms in CMakeLists.txt +- Fix casting error in contrib/testzlib/testzlib.c +- Fix types in contrib/minizip to match result of get_crc_table() +- Simplify contrib/vstudio/vc10 with 'd' suffix +- Add TOP support to win32/Makefile.msc +- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h +- Add vc11 and vc12 build files to contrib/vstudio +- Add gzvprintf() as an undocumented function in zlib +- Fix configure for Sun shell +- Remove runtime check in configure for four-byte integer type +- Add casts and consts to ease user conversion to C++ +- Add man pages for minizip and miniunzip +- In Makefile uninstall, don't rm if preceding cd fails +- Do not return Z_BUF_ERROR if deflateParam() has nothing to write + Changes in 1.2.7 (2 May 2012) - Replace use of memmove() with a simple copy for portability - Test for existence of strerror diff --git a/compat/zlib/Makefile.in b/compat/zlib/Makefile.in index 241deed..c61aa30 100644 --- a/compat/zlib/Makefile.in +++ b/compat/zlib/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2011 Jean-loup Gailly. +# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -32,7 +32,7 @@ CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.7 +SHAREDLIBV=libz.so.1.2.8 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -83,7 +83,7 @@ check: test test: all teststatic testshared teststatic: static - @TMPST=`mktemp fooXXXXXX`; \ + @TMPST=tmpst_$$; \ if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ echo ' *** zlib test OK ***'; \ else \ @@ -96,7 +96,7 @@ testshared: shared LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ - TMPSH=`mktemp fooXXXXXX`; \ + TMPSH=tmpsh_$$; \ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ echo ' *** zlib shared test OK ***'; \ else \ @@ -105,7 +105,7 @@ testshared: shared rm -f $$TMPSH test64: all64 - @TMP64=`mktemp fooXXXXXX`; \ + @TMP64=tmp64_$$; \ if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ echo ' *** zlib 64-bit test OK ***'; \ else \ @@ -216,13 +216,13 @@ install: install-libs chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h uninstall: - cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h - cd $(DESTDIR)$(libdir); rm -f libz.a; \ + cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h + cd $(DESTDIR)$(libdir) && rm -f libz.a; \ if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ fi - cd $(DESTDIR)$(man3dir); rm -f zlib.3 - cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc + cd $(DESTDIR)$(man3dir) && rm -f zlib.3 + cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc docs: zlib.3.pdf @@ -230,7 +230,7 @@ zlib.3.pdf: zlib.3 groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf zconf.h.cmakein: zconf.h.in - -@ TEMPFILE=`mktemp __XXXXXX`; \ + -@ TEMPFILE=zconfh_$$; \ echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ sed -f $$TEMPFILE zconf.h.in > zconf.h.cmakein &&\ touch -r zconf.h.in zconf.h.cmakein &&\ diff --git a/compat/zlib/README b/compat/zlib/README index 6f1255f..5ca9d12 100644 --- a/compat/zlib/README +++ b/compat/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.7 is a general purpose data compression library. All the code is +zlib 1.2.8 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.7 are documented in the file ChangeLog. +The changes made in version 1.2.8 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -84,7 +84,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2012 Jean-loup Gailly and Mark Adler + (C) 1995-2013 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/compat/zlib/as400/bndsrc b/compat/zlib/as400/bndsrc index 52cc661..98814fd 100644 --- a/compat/zlib/as400/bndsrc +++ b/compat/zlib/as400/bndsrc @@ -202,4 +202,14 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') EXPORT SYMBOL("inflateResetKeep") +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ +/* Version 1.2.8 additional entry points. */ +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ + +/********************************************************************/ +/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ +/********************************************************************/ + + EXPORT SYMBOL("inflateGetDictionary") + ENDPGMEXP diff --git a/compat/zlib/as400/compile.clp b/compat/zlib/as400/compile.clp index 8d0c58f..e3f47c6 100644 --- a/compat/zlib/as400/compile.clp +++ b/compat/zlib/as400/compile.clp @@ -105,6 +105,6 @@ &MODLIB/TREES &MODLIB/UNCOMPR + &MODLIB/ZUTIL) + SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) + - TEXT('ZLIB 1.2.7') TGTRLS(&TGTRLS) + TEXT('ZLIB 1.2.8') TGTRLS(&TGTRLS) ENDPGM diff --git a/compat/zlib/as400/readme.txt b/compat/zlib/as400/readme.txt index 23cd1b8..7b5d93b 100644 --- a/compat/zlib/as400/readme.txt +++ b/compat/zlib/as400/readme.txt @@ -1,4 +1,4 @@ - ZLIB version 1.2.7 for AS400 installation instructions + ZLIB version 1.2.8 for AS400 installation instructions I) From an AS400 *SAVF file: diff --git a/compat/zlib/as400/zlib.inc b/compat/zlib/as400/zlib.inc index 747c598..7341a6d 100644 --- a/compat/zlib/as400/zlib.inc +++ b/compat/zlib/as400/zlib.inc @@ -1,7 +1,7 @@ * ZLIB.INC - Interface to the general purpose compression library * * ILE RPG400 version by Patrick Monnerat, DATASPHERE. - * Version 1.2.7 + * Version 1.2.8 * * * WARNING: @@ -22,12 +22,12 @@ * * Versioning information. * - D ZLIB_VERSION C '1.2.7' - D ZLIB_VERNUM C X'1270' + D ZLIB_VERSION C '1.2.8' + D ZLIB_VERNUM C X'1280' D ZLIB_VER_MAJOR C 1 D ZLIB_VER_MINOR C 2 D ZLIB_VER_REVISION... - D C 7 + D C 8 D ZLIB_VER_SUBREVISION... D C 0 * @@ -359,6 +359,12 @@ D dictionary 65535 const options(*varsize) Dictionary bytes D dictLength 10U 0 value Dictionary length * + D inflateGetDictionary... + D PR 10I 0 extproc('inflateGetDictionary') Get dictionary + D strm like(z_stream) Expansion stream + D dictionary 65535 options(*varsize) Dictionary bytes + D dictLength 10U 0 Dictionary length + * D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion D strm like(z_stream) Expansion stream * diff --git a/compat/zlib/compress.c b/compat/zlib/compress.c index ea4dfbe..6e97626 100644 --- a/compat/zlib/compress.c +++ b/compat/zlib/compress.c @@ -29,7 +29,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) z_stream stream; int err; - stream.next_in = (Bytef*)source; + stream.next_in = (z_const Bytef *)source; stream.avail_in = (uInt)sourceLen; #ifdef MAXSEG_64K /* Check for source > 64K on 16-bit machine: */ diff --git a/compat/zlib/configure b/compat/zlib/configure index 36c7d8e..b77a8a8 100755 --- a/compat/zlib/configure +++ b/compat/zlib/configure @@ -70,6 +70,7 @@ shared=1 solo=0 cover=0 zprefix=0 +zconst=0 build64=0 gcc=0 old_cc="$CC" @@ -77,13 +78,26 @@ old_cflags="$CFLAGS" OBJC='$(OBJZ) $(OBJG)' PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' +# leave this script, optionally in a bad way +leave() +{ + if test "$*" != "0"; then + echo "** $0 aborting." | tee -a configure.log + fi + rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version + echo -------------------- >> configure.log + echo >> configure.log + echo >> configure.log + exit $1 +} + # process command line options while test $# -ge 1 do case "$1" in -h* | --help) echo 'usage:' | tee -a configure.log - echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log + echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log exit 0 ;; @@ -106,13 +120,18 @@ case "$1" in -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; - *) echo "unknown option: $1"; echo "$0 --help for help" | tee -a configure.log; exit 1 ;; + -c* | --const) zconst=1; shift ;; + *) + echo "unknown option: $1" | tee -a configure.log + echo "$0 --help for help" | tee -a configure.log + leave 1;; esac done -# define functions for testing compiler and library characteristics and logging the results +# temporary file name test=ztest$$ +# put arguments in log, also put test file in log if used in arguments show() { case "$*" in @@ -124,43 +143,6 @@ show() echo $* >> configure.log } -cat > $test.c </dev/null; then - try() - { - show $* - test "`( $* ) 2>&1 | tee -a configure.log`" = "" - } - echo - using any output from compiler to indicate an error >> configure.log -else - try() - { - show $* - ( $* ) >> configure.log 2>&1 - ret=$? - if test $ret -ne 0; then - echo "(exit code "$ret")" >> configure.log - fi - return $ret - } -fi - -tryboth() -{ - show $* - got=`( $* ) 2>&1` - ret=$? - printf %s "$got" >> configure.log - if test $ret -ne 0; then - return $ret - fi - test "$got" = "" -} - -echo >> configure.log - # check for gcc vs. cc and set compile and link flags based on the system identified by uname cat > $test.c <&1` in *gcc*) gcc=1 ;; esac -show $cc -c $cflags $test.c -if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then +show $cc -c $test.c +if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then echo ... using gcc >> configure.log CC="$cc" CFLAGS="${CFLAGS--O3} ${ARCHS}" @@ -191,7 +173,11 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then SFLAGS="${SFLAGS} -m64" fi if test "${ZLIBGCCWARN}" = "YES"; then - CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + if test "$zconst" -eq 1; then + CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" + else + CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + fi fi if test -z "$uname"; then uname=`(uname -s || echo unknown) 2>/dev/null` @@ -208,7 +194,7 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then # temporary bypass rm -f $test.[co] $test $test$shared_ext echo "Please use win32/Makefile.gcc instead." | tee -a configure.log - exit 1 + leave 1 LDSHARED=${LDSHARED-"$cc -shared"} LDSHAREDLIBC="" EXE='.exe' ;; @@ -231,7 +217,11 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then SHAREDLIBV=libz.$VER$shared_ext SHAREDLIBM=libz.$VER1$shared_ext LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} - AR="/usr/bin/libtool" + if libtool -V 2>&1 | grep Apple > /dev/null; then + AR="libtool" + else + AR="/usr/bin/libtool" + fi ARFLAGS="-o" ;; *) LDSHARED=${LDSHARED-"$cc -shared"} ;; esac @@ -334,7 +324,61 @@ SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} echo >> configure.log +# define functions for testing compiler and library characteristics and logging the results + +cat > $test.c </dev/null; then + try() + { + show $* + test "`( $* ) 2>&1 | tee -a configure.log`" = "" + } + echo - using any output from compiler to indicate an error >> configure.log +else +try() +{ + show $* + ( $* ) >> configure.log 2>&1 + ret=$? + if test $ret -ne 0; then + echo "(exit code "$ret")" >> configure.log + fi + return $ret +} +fi + +tryboth() +{ + show $* + got=`( $* ) 2>&1` + ret=$? + printf %s "$got" >> configure.log + if test $ret -ne 0; then + return $ret + fi + test "$got" = "" +} + +cat > $test.c << EOF +int foo() { return 0; } +EOF +echo "Checking for obsessive-compulsive compiler options..." >> configure.log +if try $CC -c $CFLAGS $test.c; then + : +else + echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log + leave 1 +fi + +echo >> configure.log + # see if shared library build supported +cat > $test.c <> configure.log - # check for underscores in external names for use by assembler code CPP=${CPP-"$CC -E"} case $CFLAGS in @@ -698,35 +740,6 @@ EOF fi fi -echo >> configure.log - -# find a four-byte unsiged integer type for crc calculations -cat > $test.c < -#define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;} -int main() { - int k; - unsigned i; - unsigned long l; - unsigned short s; - is32(i, "unsigned") - is32(l, "unsigned long") - is32(s, "unsigned short") - return 1; -} -EOF -Z_U4="" -if try $CC $CFLAGS $test.c -o $test && Z_U4=`./$test` && test -n "$Z_U4"; then - sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo "Looking for a four-byte integer type... Found." | tee -a configure.log -else - echo "Looking for a four-byte integer type... Not found." | tee -a configure.log -fi - -# clean up files produced by running the compiler and linker -rm -f $test.[co] $test $test$shared_ext $test.gcno - # show the results in the log echo >> configure.log echo ALL = $ALL >> configure.log @@ -758,9 +771,6 @@ echo mandir = $mandir >> configure.log echo prefix = $prefix >> configure.log echo sharedlibdir = $sharedlibdir >> configure.log echo uname = $uname >> configure.log -echo -------------------- >> configure.log -echo >> configure.log -echo >> configure.log # udpate Makefile with the configure results sed < Makefile.in " @@ -816,3 +826,6 @@ sed < zlib.pc.in " " | sed -e " s/\@VERSION\@/$VER/g; " > zlib.pc + +# done +leave 0 diff --git a/compat/zlib/contrib/README.contrib b/compat/zlib/contrib/README.contrib index dd2285d..c66349b 100644 --- a/compat/zlib/contrib/README.contrib +++ b/compat/zlib/contrib/README.contrib @@ -75,3 +75,4 @@ untgz/ by Pedro A. Aranda Gutierrez vstudio/ by Gilles Vollant Building a minizip-enhanced zlib with Microsoft Visual Studio + Includes vc11 from kreuzerkrieg and vc12 from davispuh diff --git a/compat/zlib/contrib/blast/blast.c b/compat/zlib/contrib/blast/blast.c index 4ce697a..69ef0fe 100644 --- a/compat/zlib/contrib/blast/blast.c +++ b/compat/zlib/contrib/blast/blast.c @@ -1,7 +1,7 @@ /* blast.c - * Copyright (C) 2003 Mark Adler + * Copyright (C) 2003, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in blast.h - * version 1.1, 16 Feb 2003 + * version 1.2, 24 Oct 2012 * * blast.c decompresses data compressed by the PKWare Compression Library. * This function provides functionality similar to the explode() function of @@ -22,6 +22,8 @@ * * 1.0 12 Feb 2003 - First version * 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data + * 1.2 24 Oct 2012 - Add note about using binary mode in stdio + * - Fix comparisons of differently signed integers */ #include /* for setjmp(), longjmp(), and jmp_buf */ @@ -279,7 +281,7 @@ local int decomp(struct state *s) int dict; /* log2(dictionary size) - 6 */ int symbol; /* decoded symbol, extra bits for distance */ int len; /* length for copy */ - int dist; /* distance for copy */ + unsigned dist; /* distance for copy */ int copy; /* copy counter */ unsigned char *from, *to; /* copy pointers */ static int virgin = 1; /* build tables once */ diff --git a/compat/zlib/contrib/blast/blast.h b/compat/zlib/contrib/blast/blast.h index ce9e541..658cfd3 100644 --- a/compat/zlib/contrib/blast/blast.h +++ b/compat/zlib/contrib/blast/blast.h @@ -1,6 +1,6 @@ /* blast.h -- interface for blast.c - Copyright (C) 2003 Mark Adler - version 1.1, 16 Feb 2003 + Copyright (C) 2003, 2012 Mark Adler + version 1.2, 24 Oct 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -28,6 +28,10 @@ * that library. (Note: PKWare overused the "implode" verb, and the format * used by their library implode() function is completely different and * incompatible with the implode compression method supported by PKZIP.) + * + * The binary mode for stdio functions should be used to assure that the + * compressed data is not corrupted when read or written. For example: + * fopen(..., "rb") and fopen(..., "wb"). */ diff --git a/compat/zlib/contrib/delphi/ZLib.pas b/compat/zlib/contrib/delphi/ZLib.pas index f24bb3e..a579974 100644 --- a/compat/zlib/contrib/delphi/ZLib.pas +++ b/compat/zlib/contrib/delphi/ZLib.pas @@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; const OutBuf: Pointer; BufSize: Integer); const - zlib_version = '1.2.7'; + zlib_version = '1.2.8'; type EZlibError = class(Exception); diff --git a/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs b/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs index 1090288..b273d54 100644 --- a/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +++ b/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs @@ -1,5 +1,5 @@ // -// © Copyright Henrik Ravn 2004 +// © Copyright Henrik Ravn 2004 // // Use, modification and distribution are subject to the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -156,7 +156,7 @@ namespace DotZLibTests public void Info_Version() { Info info = new Info(); - Assert.AreEqual("1.2.7", Info.Version); + Assert.AreEqual("1.2.8", Info.Version); Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfPointer); diff --git a/compat/zlib/contrib/infback9/infback9.c b/compat/zlib/contrib/infback9/infback9.c index 7bbe90c..05fb3e3 100644 --- a/compat/zlib/contrib/infback9/infback9.c +++ b/compat/zlib/contrib/infback9/infback9.c @@ -222,14 +222,13 @@ out_func out; void FAR *out_desc; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have; /* available input */ unsigned long left; /* available output */ inflate_mode mode; /* current inflate mode */ int lastblock; /* true if processing last block */ int wrap; /* true if the window has wrapped */ - unsigned long write; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if needed */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ @@ -259,7 +258,6 @@ void FAR *out_desc; strm->msg = Z_NULL; mode = TYPE; lastblock = 0; - write = 0; wrap = 0; window = state->window; next = strm->next_in; diff --git a/compat/zlib/contrib/infback9/inftree9.c b/compat/zlib/contrib/infback9/inftree9.c index 5a0b328..4a73ad2 100644 --- a/compat/zlib/contrib/infback9/inftree9.c +++ b/compat/zlib/contrib/infback9/inftree9.c @@ -1,5 +1,5 @@ /* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2012 Mark Adler + * Copyright (C) 1995-2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate9_copyright[] = - " inflate9 1.2.7 Copyright 1995-2012 Mark Adler "; + " inflate9 1.2.8 Copyright 1995-2013 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -64,7 +64,7 @@ unsigned short FAR *work; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 78, 68}; + 133, 133, 133, 133, 144, 72, 78}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, diff --git a/compat/zlib/contrib/minizip/configure.ac b/compat/zlib/contrib/minizip/configure.ac index 6a9af21..827a4e0 100644 --- a/compat/zlib/contrib/minizip/configure.ac +++ b/compat/zlib/contrib/minizip/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([minizip], [1.2.7], [bugzilla.redhat.com]) +AC_INIT([minizip], [1.2.8], [bugzilla.redhat.com]) AC_CONFIG_SRCDIR([minizip.c]) AM_INIT_AUTOMAKE([foreign]) LT_INIT diff --git a/compat/zlib/contrib/minizip/crypt.h b/compat/zlib/contrib/minizip/crypt.h index a01d08d..1e9e820 100644 --- a/compat/zlib/contrib/minizip/crypt.h +++ b/compat/zlib/contrib/minizip/crypt.h @@ -32,7 +32,7 @@ /*********************************************************************** * Return the next byte in the pseudo-random sequence */ -static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) +static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) { unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an * unpredictable manner on 16-bit systems; not a problem @@ -45,7 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) /*********************************************************************** * Update the encryption keys with the next byte of plain text */ -static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) +static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) { (*(pkeys+0)) = CRC32((*(pkeys+0)), c); (*(pkeys+1)) += (*(pkeys+0)) & 0xff; @@ -62,7 +62,7 @@ static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int * Initialize the encryption keys and the random header according to * the given password. */ -static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) +static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) { *(pkeys+0) = 305419896L; *(pkeys+1) = 591751049L; @@ -91,7 +91,7 @@ static int crypthead(const char* passwd, /* password string */ unsigned char* buf, /* where to write header */ int bufSize, unsigned long* pkeys, - const unsigned long* pcrc_32_tab, + const z_crc_t* pcrc_32_tab, unsigned long crcForCrypting) { int n; /* index in random header */ diff --git a/compat/zlib/contrib/minizip/iowin32.c b/compat/zlib/contrib/minizip/iowin32.c index 6a2a883..a46d96c 100644 --- a/compat/zlib/contrib/minizip/iowin32.c +++ b/compat/zlib/contrib/minizip/iowin32.c @@ -25,6 +25,13 @@ #define INVALID_SET_FILE_POINTER ((DWORD)-1) #endif + +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define IOWIN32_USING_WINRT_API 1 +#endif +#endif + voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); @@ -93,8 +100,22 @@ voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API +#ifdef UNICODE + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + if ((filename!=NULL) && (dwDesiredAccess != 0)) + { + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); + } +#endif +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -108,8 +129,17 @@ voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API + if ((filename!=NULL) && (dwDesiredAccess != 0)) + { + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); + } +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -123,8 +153,13 @@ voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,NULL); +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -138,8 +173,22 @@ voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mo win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API +#ifdef UNICODE + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + if ((filename!=NULL) && (dwDesiredAccess != 0)) + { + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); + } +#endif +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -188,6 +237,26 @@ uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* b return ret; } +static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) +{ +#ifdef IOWIN32_USING_WINRT_API + return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); +#else + LONG lHigh = pos.HighPart; + DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, FILE_CURRENT); + BOOL fOk = TRUE; + if (dwNewPos == 0xFFFFFFFF) + if (GetLastError() != NO_ERROR) + fOk = FALSE; + if ((newPos != NULL) && (fOk)) + { + newPos->LowPart = dwNewPos; + newPos->HighPart = lHigh; + } + return fOk; +#endif +} + long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) { long ret=-1; @@ -196,15 +265,17 @@ long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) hFile = ((WIN32FILE_IOWIN*)stream) -> hf; if (hFile != NULL) { - DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); - if (dwSet == INVALID_SET_FILE_POINTER) + LARGE_INTEGER pos; + pos.QuadPart = 0; + + if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; ret = -1; } else - ret=(long)dwSet; + ret=(long)pos.LowPart; } return ret; } @@ -218,17 +289,17 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) if (hFile) { - LARGE_INTEGER li; - li.QuadPart = 0; - li.u.LowPart = SetFilePointer(hFile, li.u.LowPart, &li.u.HighPart, FILE_CURRENT); - if ( (li.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) + LARGE_INTEGER pos; + pos.QuadPart = 0; + + if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; ret = (ZPOS64_T)-1; } else - ret=li.QuadPart; + ret=pos.QuadPart; } return ret; } @@ -258,8 +329,9 @@ long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,in if (hFile != NULL) { - DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod); - if (dwSet == INVALID_SET_FILE_POINTER) + LARGE_INTEGER pos; + pos.QuadPart = offset; + if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; @@ -296,9 +368,9 @@ long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T off if (hFile) { - LARGE_INTEGER* li = (LARGE_INTEGER*)&offset; - DWORD dwSet = SetFilePointer(hFile, li->u.LowPart, &li->u.HighPart, dwMoveMethod); - if (dwSet == INVALID_SET_FILE_POINTER) + LARGE_INTEGER pos; + pos.QuadPart = offset; + if (!MySetFilePointerEx(hFile, pos, NULL, FILE_CURRENT)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; diff --git a/compat/zlib/contrib/minizip/miniunzip.1 b/compat/zlib/contrib/minizip/miniunzip.1 new file mode 100644 index 0000000..111ac69 --- /dev/null +++ b/compat/zlib/contrib/minizip/miniunzip.1 @@ -0,0 +1,63 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH miniunzip 1 "Nov 7, 2001" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +miniunzip - uncompress and examine ZIP archives +.SH SYNOPSIS +.B miniunzip +.RI [ -exvlo ] +zipfile [ files_to_extract ] [-d tempdir] +.SH DESCRIPTION +.B minizip +is a simple tool which allows the extraction of compressed file +archives in the ZIP format used by the MS-DOS utility PKZIP. It was +written as a demonstration of the +.IR zlib (3) +library and therefore lack many of the features of the +.IR unzip (1) +program. +.SH OPTIONS +A number of options are supported. With the exception of +.BI \-d\ tempdir +these must be supplied before any +other arguments and are: +.TP +.BI \-l\ ,\ \-\-v +List the files in the archive without extracting them. +.TP +.B \-o +Overwrite files without prompting for confirmation. +.TP +.B \-x +Extract files (default). +.PP +The +.I zipfile +argument is the name of the archive to process. The next argument can be used +to specify a single file to extract from the archive. + +Lastly, the following option can be specified at the end of the command-line: +.TP +.BI \-d\ tempdir +Extract the archive in the directory +.I tempdir +rather than the current directory. +.SH SEE ALSO +.BR minizip (1), +.BR zlib (3), +.BR unzip (1). +.SH AUTHOR +This program was written by Gilles Vollant. This manual page was +written by Mark Brown . The -d tempdir option +was added by Dirk Eddelbuettel . diff --git a/compat/zlib/contrib/minizip/minizip.1 b/compat/zlib/contrib/minizip/minizip.1 new file mode 100644 index 0000000..1154484 --- /dev/null +++ b/compat/zlib/contrib/minizip/minizip.1 @@ -0,0 +1,46 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH minizip 1 "May 2, 2001" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +minizip - create ZIP archives +.SH SYNOPSIS +.B minizip +.RI [ -o ] +zipfile [ " files" ... ] +.SH DESCRIPTION +.B minizip +is a simple tool which allows the creation of compressed file archives +in the ZIP format used by the MS-DOS utility PKZIP. It was written as +a demonstration of the +.IR zlib (3) +library and therefore lack many of the features of the +.IR zip (1) +program. +.SH OPTIONS +The first argument supplied is the name of the ZIP archive to create or +.RI -o +in which case it is ignored and the second argument treated as the +name of the ZIP file. If the ZIP file already exists it will be +overwritten. +.PP +Subsequent arguments specify a list of files to place in the ZIP +archive. If none are specified then an empty archive will be created. +.SH SEE ALSO +.BR miniunzip (1), +.BR zlib (3), +.BR zip (1). +.SH AUTHOR +This program was written by Gilles Vollant. This manual page was +written by Mark Brown . + diff --git a/compat/zlib/contrib/minizip/unzip.c b/compat/zlib/contrib/minizip/unzip.c index affad4b..9093504 100644 --- a/compat/zlib/contrib/minizip/unzip.c +++ b/compat/zlib/contrib/minizip/unzip.c @@ -188,7 +188,7 @@ typedef struct # ifndef NOUNCRYPT unsigned long keys[3]; /* keys defining the pseudo-random sequence */ - const unsigned long* pcrc_32_tab; + const z_crc_t* pcrc_32_tab; # endif } unz64_s; @@ -801,9 +801,9 @@ extern unzFile ZEXPORT unzOpen64 (const void *path) } /* - Close a ZipFile opened with unzipOpen. - If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + Close a ZipFile opened with unzOpen. + If there is files inside the .Zip opened with unzOpenCurrentFile (see later), + these files MUST be closed with unzCloseCurrentFile before call unzClose. return UNZ_OK if there is no problem. */ extern int ZEXPORT unzClose (unzFile file) { @@ -1223,7 +1223,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file) /* Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzipStringFileNameCompare + For the iCaseSensitivity signification, see unzStringFileNameCompare return value : UNZ_OK if the file is found. It becomes the current file. @@ -1998,7 +1998,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) } /* - Close the file in zip opened with unzipOpenCurrentFile + Close the file in zip opened with unzOpenCurrentFile Return UNZ_CRCERROR if all the file was read but the CRC is not good */ extern int ZEXPORT unzCloseCurrentFile (unzFile file) diff --git a/compat/zlib/contrib/minizip/unzip.h b/compat/zlib/contrib/minizip/unzip.h index 3183968..2104e39 100644 --- a/compat/zlib/contrib/minizip/unzip.h +++ b/compat/zlib/contrib/minizip/unzip.h @@ -197,9 +197,9 @@ extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, extern int ZEXPORT unzClose OF((unzFile file)); /* - Close a ZipFile opened with unzipOpen. + Close a ZipFile opened with unzOpen. If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + these files MUST be closed with unzCloseCurrentFile before call unzClose. return UNZ_OK if there is no problem. */ extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, diff --git a/compat/zlib/contrib/minizip/zip.c b/compat/zlib/contrib/minizip/zip.c index 147934c..ea54853 100644 --- a/compat/zlib/contrib/minizip/zip.c +++ b/compat/zlib/contrib/minizip/zip.c @@ -157,7 +157,7 @@ typedef struct ZPOS64_T totalUncompressedData; #ifndef NOCRYPT unsigned long keys[3]; /* keys defining the pseudo-random sequence */ - const unsigned long* pcrc_32_tab; + const z_crc_t* pcrc_32_tab; int crypt_header_size; #endif } curfile64_info; diff --git a/compat/zlib/contrib/pascal/zlibpas.pas b/compat/zlib/contrib/pascal/zlibpas.pas index 7abd862..e6a0782 100644 --- a/compat/zlib/contrib/pascal/zlibpas.pas +++ b/compat/zlib/contrib/pascal/zlibpas.pas @@ -10,8 +10,8 @@ unit zlibpas; interface const - ZLIB_VERSION = '1.2.7'; - ZLIB_VERNUM = $1270; + ZLIB_VERSION = '1.2.8'; + ZLIB_VERNUM = $1280; type alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; diff --git a/compat/zlib/contrib/puff/puff.c b/compat/zlib/contrib/puff/puff.c index df8470c..ba58483 100644 --- a/compat/zlib/contrib/puff/puff.c +++ b/compat/zlib/contrib/puff/puff.c @@ -1,8 +1,8 @@ /* * puff.c - * Copyright (C) 2002-2010 Mark Adler + * Copyright (C) 2002-2013 Mark Adler * For conditions of distribution and use, see copyright notice in puff.h - * version 2.2, 25 Apr 2010 + * version 2.3, 21 Jan 2013 * * puff.c is a simple inflate written to be an unambiguous way to specify the * deflate format. It is not written for speed but rather simplicity. As a @@ -76,6 +76,7 @@ * - Move NIL to puff.h * - Allow incomplete code only if single code length is 1 * - Add full code coverage test to Makefile + * 2.3 21 Jan 2013 - Check for invalid code length codes in dynamic blocks */ #include /* for setjmp(), longjmp(), and jmp_buf */ @@ -704,6 +705,8 @@ local int dynamic(struct state *s) int len; /* last length to repeat */ symbol = decode(s, &lencode); + if (symbol < 0) + return symbol; /* invalid symbol */ if (symbol < 16) /* length in 0..15 */ lengths[index++] = symbol; else { /* repeat instruction */ diff --git a/compat/zlib/contrib/puff/puff.h b/compat/zlib/contrib/puff/puff.h index 6a0080a..e23a245 100644 --- a/compat/zlib/contrib/puff/puff.h +++ b/compat/zlib/contrib/puff/puff.h @@ -1,6 +1,6 @@ /* puff.h - Copyright (C) 2002-2010 Mark Adler, all rights reserved - version 2.2, 25 Apr 2010 + Copyright (C) 2002-2013 Mark Adler, all rights reserved + version 2.3, 21 Jan 2013 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages diff --git a/compat/zlib/contrib/puff/pufftest.c b/compat/zlib/contrib/puff/pufftest.c index 76e35f6..7764814 100644 --- a/compat/zlib/contrib/puff/pufftest.c +++ b/compat/zlib/contrib/puff/pufftest.c @@ -1,8 +1,8 @@ /* * pufftest.c - * Copyright (C) 2002-2010 Mark Adler + * Copyright (C) 2002-2013 Mark Adler * For conditions of distribution and use, see copyright notice in puff.h - * version 2.2, 25 Apr 2010 + * version 2.3, 21 Jan 2013 */ /* Example of how to use puff(). diff --git a/compat/zlib/contrib/testzlib/testzlib.c b/compat/zlib/contrib/testzlib/testzlib.c index 135888e..5f659de 100644 --- a/compat/zlib/contrib/testzlib/testzlib.c +++ b/compat/zlib/contrib/testzlib/testzlib.c @@ -116,10 +116,10 @@ DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPe return dwRet; } -int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr) +int ReadFileMemory(const char* filename,long* plFileSize,unsigned char** pFilePtr) { FILE* stream; - void* ptr; + unsigned char* ptr; int retVal=1; stream=fopen(filename, "rb"); if (stream==NULL) diff --git a/compat/zlib/contrib/vstudio/readme.txt b/compat/zlib/contrib/vstudio/readme.txt index 59c8b8b..bfdcd9d 100644 --- a/compat/zlib/contrib/vstudio/readme.txt +++ b/compat/zlib/contrib/vstudio/readme.txt @@ -1,4 +1,4 @@ -Building instructions for the DLL versions of Zlib 1.2.7 +Building instructions for the DLL versions of Zlib 1.2.8 ======================================================== This directory contains projects that build zlib and minizip using @@ -28,6 +28,11 @@ Build instructions for Visual Studio 2010 (32 bits or 64 bits) - Uncompress current zlib, including all contrib/* files - Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 +Build instructions for Visual Studio 2012 (32 bits or 64 bits) +-------------------------------------------------------------- +- Uncompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 + Important --------- diff --git a/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.user b/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.user b/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.user b/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user b/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/zlib.rc b/compat/zlib/contrib/vstudio/vc10/zlib.rc index 8eca4db..73f6476 100644 --- a/compat/zlib/contrib/vstudio/vc10/zlib.rc +++ b/compat/zlib/contrib/vstudio/vc10/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1.2.7,0 - PRODUCTVERSION 1.2.7,0 + FILEVERSION 1,2,8,0 + PRODUCTVERSION 1,2,8,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.7\0" + VALUE "FileVersion", "1.2.8\0" VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlib.dll\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2012 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj b/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj index 2682fca..b9f2bbe 100644 --- a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj +++ b/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj @@ -182,6 +182,10 @@ $(OutDir)zlibstat.lib true + + cd ..\..\masmx86 +bld_ml32.bat + @@ -210,6 +214,10 @@ $(OutDir)zlibstat.lib true + + cd ..\..\masmx86 +bld_ml32.bat + @@ -266,6 +274,10 @@ $(OutDir)zlibstat.lib true + + cd ..\..\masmx64 +bld_ml64.bat + @@ -326,6 +338,10 @@ $(OutDir)zlibstat.lib true + + cd ..\..\masmx64 +bld_ml64.bat + diff --git a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user b/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.def b/compat/zlib/contrib/vstudio/vc10/zlibvc.def index 18ddf50..6367046 100644 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.def +++ b/compat/zlib/contrib/vstudio/vc10/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.2.7 +VERSION 1.2.8 EXPORTS adler32 @1 @@ -134,6 +134,10 @@ EXPORTS gzgetc_ @161 inflateResetKeep @163 deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj b/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj index 9218fdc..6ff9ddb 100644 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj +++ b/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj @@ -180,10 +180,10 @@ AllRules.ruleset - zlibwapi + zlibwapid zlibwapi zlibwapi - zlibwapi + zlibwapid zlibwapi zlibwapi @@ -220,18 +220,14 @@ /MACHINE:I386 %(AdditionalOptions) ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true .\zlibvc.def true - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows false - $(OutDir)zlibwapi.lib cd ..\..\masmx86 @@ -272,18 +268,14 @@ bld_ml32.bat /MACHINE:I386 %(AdditionalOptions) - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows false - $(OutDir)zlibwapi.lib @@ -321,18 +313,14 @@ bld_ml32.bat /MACHINE:I386 %(AdditionalOptions) ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows false - $(OutDir)zlibwapi.lib cd ..\..\masmx86 @@ -371,19 +359,15 @@ bld_ml32.bat ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true .\zlibvc.def true - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows - $(OutDir)zlibwapi.lib MachineX64 - cd ..\..\contrib\masmx64 + cd ..\..\masmx64 bld_ml64.bat @@ -463,15 +447,11 @@ bld_ml64.bat 0x040c - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows - $(OutDir)zlibwapi.lib MachineX64 @@ -554,15 +534,11 @@ bld_ml64.bat ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows - $(OutDir)zlibwapi.lib MachineX64 diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user b/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user deleted file mode 100644 index 695b5c7..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj b/compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj new file mode 100644 index 0000000..8f9f20b --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj @@ -0,0 +1,314 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694382A} + Win32Proj + + + + Application + MultiByte + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + true + false + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + true + false + ia64\MiniUnzip$(Configuration)\ + ia64\MiniUnzip$(Configuration)\Tmp\ + true + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + false + false + ia64\MiniUnzip$(Configuration)\ + ia64\MiniUnzip$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineX64 + + + + + Itanium + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineIA64 + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineX64 + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineIA64 + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/minizip.vcxproj b/compat/zlib/contrib/vstudio/vc11/minizip.vcxproj new file mode 100644 index 0000000..c93d9e6 --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/minizip.vcxproj @@ -0,0 +1,311 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} + Win32Proj + + + + Application + MultiByte + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + true + false + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + false + x64\$(Configuration)\ + x64\$(Configuration)\ + true + false + ia64\$(Configuration)\ + ia64\$(Configuration)\ + true + false + x64\$(Configuration)\ + x64\$(Configuration)\ + false + ia64\$(Configuration)\ + ia64\$(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineX64 + + + + + Itanium + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineIA64 + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineX64 + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineIA64 + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj b/compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj new file mode 100644 index 0000000..6d55954 --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj @@ -0,0 +1,426 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + Itanium + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} + testzlib + Win32Proj + + + + Application + MultiByte + true + v110 + + + Application + MultiByte + true + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + true + + + Application + MultiByte + true + + + Application + MultiByte + + + Application + true + v110 + + + Application + true + v110 + + + Application + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + true + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + ia64\TestZlib$(Configuration)\ + ia64\TestZlib$(Configuration)\Tmp\ + true + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + ia64\TestZlib$(Configuration)\ + ia64\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + ia64\TestZlib$(Configuration)\ + ia64\TestZlib$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + + + + + Itanium + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + MachineIA64 + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + MachineIA64 + + + + + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + MachineIA64 + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj b/compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj new file mode 100644 index 0000000..9f20c78 --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj @@ -0,0 +1,314 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694366A} + Win32Proj + + + + Application + MultiByte + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + true + false + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + true + false + ia64\TestZlibDll$(Configuration)\ + ia64\TestZlibDll$(Configuration)\Tmp\ + true + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + false + false + ia64\TestZlibDll$(Configuration)\ + ia64\TestZlibDll$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineX64 + + + + + Itanium + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineIA64 + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineX64 + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineIA64 + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/zlib.rc b/compat/zlib/contrib/vstudio/vc11/zlib.rc new file mode 100644 index 0000000..73f6476 --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1,2,8,0 + PRODUCTVERSION 1,2,8,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.2.8\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj b/compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj new file mode 100644 index 0000000..806b76a --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj @@ -0,0 +1,464 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + Itanium + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + Unicode + + + StaticLibrary + false + + + StaticLibrary + false + + + StaticLibrary + false + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + ia64\ZlibStat$(Configuration)\ + ia64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + ia64\ZlibStat$(Configuration)\ + ia64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + ia64\ZlibStat$(Configuration)\ + ia64\ZlibStat$(Configuration)\Tmp\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + Itanium + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + Itanium + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + Itanium + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/zlibvc.def b/compat/zlib/contrib/vstudio/vc11/zlibvc.def new file mode 100644 index 0000000..6367046 --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/zlibvc.def @@ -0,0 +1,143 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.2.8 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 diff --git a/compat/zlib/contrib/vstudio/vc11/zlibvc.sln b/compat/zlib/contrib/vstudio/vc11/zlibvc.sln new file mode 100644 index 0000000..9fcbafd --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/zlibvc.sln @@ -0,0 +1,117 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Itanium = Debug|Itanium + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Itanium = Release|Itanium + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium + ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 + ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj b/compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj new file mode 100644 index 0000000..c65b95f --- /dev/null +++ b/compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj @@ -0,0 +1,688 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + Itanium + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {8FD826F8-3739-44E6-8CC8-997122E53B8D} + + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + v110 + Unicode + + + DynamicLibrary + false + true + + + DynamicLibrary + false + true + + + DynamicLibrary + false + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + true + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + true + false + ia64\ZlibDll$(Configuration)\ + ia64\ZlibDll$(Configuration)\Tmp\ + true + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + ia64\ZlibDll$(Configuration)\ + ia64\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + ia64\ZlibDll$(Configuration)\ + ia64\ZlibDll$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + cd ..\..\masmx86 +bld_ml32.bat + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + cd ..\..\masmx86 +bld_ml32.bat + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + cd ..\..\contrib\masmx64 +bld_ml64.bat + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Itanium + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineIA64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Itanium + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineIA64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + cd ..\..\masmx64 +bld_ml64.bat + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Itanium + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineIA64 + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc9/zlib.rc b/compat/zlib/contrib/vstudio/vc9/zlib.rc index 8eca4db..73f6476 100644 --- a/compat/zlib/contrib/vstudio/vc9/zlib.rc +++ b/compat/zlib/contrib/vstudio/vc9/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1.2.7,0 - PRODUCTVERSION 1.2.7,0 + FILEVERSION 1,2,8,0 + PRODUCTVERSION 1,2,8,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.7\0" + VALUE "FileVersion", "1.2.8\0" VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlib.dll\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2012 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/compat/zlib/contrib/vstudio/vc9/zlibvc.def b/compat/zlib/contrib/vstudio/vc9/zlibvc.def index 2df8bb3..6367046 100644 --- a/compat/zlib/contrib/vstudio/vc9/zlibvc.def +++ b/compat/zlib/contrib/vstudio/vc9/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.2.7 +VERSION 1.2.8 EXPORTS adler32 @1 @@ -133,7 +133,11 @@ EXPORTS ; zlib1 v1.2.6 added: gzgetc_ @161 inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 diff --git a/compat/zlib/deflate.c b/compat/zlib/deflate.c index 9e4c2cb..6969577 100644 --- a/compat/zlib/deflate.c +++ b/compat/zlib/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -305,7 +305,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + strm->msg = ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; } @@ -329,7 +329,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) uInt str, n; int wrap; unsigned avail; - unsigned char *next; + z_const unsigned char *next; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) return Z_STREAM_ERROR; @@ -359,7 +359,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) avail = strm->avail_in; next = strm->next_in; strm->avail_in = dictLength; - strm->next_in = (Bytef *)dictionary; + strm->next_in = (z_const Bytef *)dictionary; fill_window(s); while (s->lookahead >= MIN_MATCH) { str = s->strstart; @@ -513,6 +513,8 @@ int ZEXPORT deflateParams(strm, level, strategy) strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_BLOCK); + if (err == Z_BUF_ERROR && s->pending == 0) + err = Z_OK; } if (s->level != level) { s->level = level; diff --git a/compat/zlib/deflate.h b/compat/zlib/deflate.h index fbac44d..ce0299e 100644 --- a/compat/zlib/deflate.h +++ b/compat/zlib/deflate.h @@ -104,7 +104,7 @@ typedef struct internal_state { int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ gz_headerp gzhead; /* gzip header information to write */ uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ + Byte method; /* can only be DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ /* used by deflate.c: */ diff --git a/compat/zlib/examples/enough.c b/compat/zlib/examples/enough.c index c40410b..b991144 100644 --- a/compat/zlib/examples/enough.c +++ b/compat/zlib/examples/enough.c @@ -1,7 +1,7 @@ /* enough.c -- determine the maximum size of inflate's Huffman code tables over * all possible valid and complete Huffman codes, subject to a length limit. - * Copyright (C) 2007, 2008 Mark Adler - * Version 1.3 17 February 2008 Mark Adler + * Copyright (C) 2007, 2008, 2012 Mark Adler + * Version 1.4 18 August 2012 Mark Adler */ /* Version history: @@ -14,6 +14,9 @@ 1.3 17 Feb 2008 Add argument for initial root table size Fix bug for initial root table size == max - 1 Use a macro to compute the history index + 1.4 18 Aug 2012 Avoid shifts more than bits in type (caused endless loop!) + Clean up comparisons of different types + Clean up code indentation */ /* @@ -236,8 +239,8 @@ local big_t count(int syms, int len, int left) for (use = least; use <= most; use++) { got = count(syms - use, len + 1, (left - use) << 1); sum += got; - if (got == -1 || sum < got) /* overflow */ - return -1; + if (got == (big_t)0 - 1 || sum < got) /* overflow */ + return (big_t)0 - 1; } /* verify that all recursive calls are productive */ @@ -458,6 +461,7 @@ int main(int argc, char **argv) int n; /* number of symbols to code for this run */ big_t got; /* return value of count() */ big_t sum; /* accumulated number of codes over n */ + code_t word; /* for counting bits in code_t */ /* set up globals for cleanup() */ code = NULL; @@ -466,19 +470,19 @@ int main(int argc, char **argv) /* get arguments -- default to the deflate literal/length code */ syms = 286; - root = 9; + root = 9; max = 15; if (argc > 1) { syms = atoi(argv[1]); if (argc > 2) { root = atoi(argv[2]); - if (argc > 3) - max = atoi(argv[3]); - } + if (argc > 3) + max = atoi(argv[3]); + } } if (argc > 4 || syms < 2 || root < 1 || max < 1) { fputs("invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\n", - stderr); + stderr); return 1; } @@ -487,18 +491,17 @@ int main(int argc, char **argv) max = syms - 1; /* determine the number of bits in a code_t */ - n = 0; - while (((code_t)1 << n) != 0) - n++; + for (n = 0, word = 1; word; n++, word <<= 1) + ; /* make sure that the calculation of most will not overflow */ - if (max > n || syms - 2 >= (((code_t)0 - 1) >> (max - 1))) { + if (max > n || (code_t)(syms - 2) >= (((code_t)0 - 1) >> (max - 1))) { fputs("abort: code length too long for internal types\n", stderr); return 1; } /* reject impossible code requests */ - if (syms - 1 > ((code_t)1 << max) - 1) { + if ((code_t)(syms - 1) > ((code_t)1 << max) - 1) { fprintf(stderr, "%d symbols cannot be coded in %d bits\n", syms, max); return 1; @@ -532,7 +535,7 @@ int main(int argc, char **argv) for (n = 2; n <= syms; n++) { got = count(n, 1, 2); sum += got; - if (got == -1 || sum < got) { /* overflow */ + if (got == (big_t)0 - 1 || sum < got) { /* overflow */ fputs("abort: can't count that high!\n", stderr); cleanup(); return 1; @@ -556,9 +559,9 @@ int main(int argc, char **argv) } /* find and show maximum inflate table usage */ - if (root > max) /* reduce root to max length */ - root = max; - if (syms < ((code_t)1 << (root + 1))) + if (root > max) /* reduce root to max length */ + root = max; + if ((code_t)syms < ((code_t)1 << (root + 1))) enough(syms); else puts("cannot handle minimum code lengths > root"); diff --git a/compat/zlib/examples/gun.c b/compat/zlib/examples/gun.c index 72b0882..89e484f 100644 --- a/compat/zlib/examples/gun.c +++ b/compat/zlib/examples/gun.c @@ -1,7 +1,7 @@ /* gun.c -- simple gunzip to give an example of the use of inflateBack() - * Copyright (C) 2003, 2005, 2008, 2010 Mark Adler + * Copyright (C) 2003, 2005, 2008, 2010, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.6 17 January 2010 Mark Adler */ + Version 1.7 12 August 2012 Mark Adler */ /* Version history: 1.0 16 Feb 2003 First version for testing of inflateBack() @@ -18,6 +18,7 @@ 1.4 8 Dec 2006 LZW decompression speed improvements 1.5 9 Feb 2008 Avoid warning in latest version of gcc 1.6 17 Jan 2010 Avoid signed/unsigned comparison warnings + 1.7 12 Aug 2012 Update for z_const usage in zlib 1.2.8 */ /* @@ -85,7 +86,7 @@ struct ind { /* Load input buffer, assumed to be empty, and return bytes loaded and a pointer to them. read() is called until the buffer is full, or until it returns end-of-file or error. Return 0 on error. */ -local unsigned in(void *in_desc, unsigned char **buf) +local unsigned in(void *in_desc, z_const unsigned char **buf) { int ret; unsigned len; @@ -196,7 +197,7 @@ unsigned char match[65280 + 2]; /* buffer for reversed match or gzip file, read error, or write error (a write error indicated by strm->next_in not equal to Z_NULL), or Z_DATA_ERROR for invalid input. */ -local int lunpipe(unsigned have, unsigned char *next, struct ind *indp, +local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, int outfile, z_stream *strm) { int last; /* last byte read by NEXT(), or -1 if EOF */ @@ -383,7 +384,7 @@ local int gunpipe(z_stream *strm, int infile, int outfile) { int ret, first, last; unsigned have, flags, len; - unsigned char *next = NULL; + z_const unsigned char *next = NULL; struct ind ind, *indp; struct outd outd; diff --git a/compat/zlib/examples/gzappend.c b/compat/zlib/examples/gzappend.c index e9e878e..662dec3 100644 --- a/compat/zlib/examples/gzappend.c +++ b/compat/zlib/examples/gzappend.c @@ -1,7 +1,7 @@ /* gzappend -- command to append to a gzip file - Copyright (C) 2003 Mark Adler, all rights reserved - version 1.1, 4 Nov 2003 + Copyright (C) 2003, 2012 Mark Adler, all rights reserved + version 1.2, 11 Oct 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -39,6 +39,8 @@ * - Keep gzip file clean on appended file read errors * - Use in-place rotate instead of auxiliary buffer * (Why you ask? Because it was fun to write!) + * 1.2 11 Oct 2012 - Fix for proper z_const usage + * - Check for input buffer malloc failure */ /* @@ -170,7 +172,7 @@ typedef struct { int size; /* 1 << size is bytes in buf */ unsigned left; /* bytes available at next */ unsigned char *buf; /* buffer */ - unsigned char *next; /* next byte in buffer */ + z_const unsigned char *next; /* next byte in buffer */ char *name; /* file name for error messages */ } file; @@ -399,14 +401,14 @@ local void gztack(char *name, int gd, z_stream *strm, int last) } /* allocate buffers */ - in = fd == -1 ? NULL : malloc(CHUNK); + in = malloc(CHUNK); out = malloc(CHUNK); - if (out == NULL) bye("out of memory", ""); + if (in == NULL || out == NULL) bye("out of memory", ""); /* compress input file and append to gzip file */ do { /* get more input */ - len = fd == -1 ? 0 : read(fd, in, CHUNK); + len = read(fd, in, CHUNK); if (len == -1) { fprintf(stderr, "gzappend warning: error reading %s, skipping rest ...\n", @@ -453,7 +455,7 @@ local void gztack(char *name, int gd, z_stream *strm, int last) /* clean up and return */ free(out); - if (in != NULL) free(in); + free(in); if (fd > 0) close(fd); } @@ -467,11 +469,13 @@ int main(int argc, char **argv) z_stream strm; /* ignore command name */ - argv++; + argc--; argv++; /* provide usage if no arguments */ if (*argv == NULL) { - printf("gzappend 1.1 (4 Nov 2003) Copyright (C) 2003 Mark Adler\n"); + printf( + "gzappend 1.2 (11 Oct 2012) Copyright (C) 2003, 2012 Mark Adler\n" + ); printf( "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n"); return 0; diff --git a/compat/zlib/examples/gzjoin.c b/compat/zlib/examples/gzjoin.c index 129347c..89e8098 100644 --- a/compat/zlib/examples/gzjoin.c +++ b/compat/zlib/examples/gzjoin.c @@ -1,7 +1,7 @@ /* gzjoin -- command to join gzip files into one gzip file - Copyright (C) 2004 Mark Adler, all rights reserved - version 1.0, 11 Dec 2004 + Copyright (C) 2004, 2005, 2012 Mark Adler, all rights reserved + version 1.2, 14 Aug 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -27,6 +27,7 @@ * * 1.0 11 Dec 2004 - First version * 1.1 12 Jun 2005 - Changed ssize_t to long for portability + * 1.2 14 Aug 2012 - Clean up for z_const usage */ /* @@ -308,7 +309,7 @@ local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, /* inflate and copy compressed data, clear last-block bit if requested */ len = 0; zpull(&strm, in); - start = strm.next_in; + start = in->next; last = start[0] & 1; if (last && clr) start[0] &= ~1; @@ -351,7 +352,7 @@ local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, pos = 0x100 >> pos; last = strm.next_in[-1] & pos; if (last && clr) - strm.next_in[-1] &= ~pos; + in->buf[strm.next_in - in->buf - 1] &= ~pos; } else { /* next last-block bit is in next unused byte */ @@ -364,14 +365,14 @@ local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, } last = strm.next_in[0] & 1; if (last && clr) - strm.next_in[0] &= ~1; + in->buf[strm.next_in - in->buf] &= ~1; } } } /* update buffer with unused input */ in->left = strm.avail_in; - in->next = strm.next_in; + in->next = in->buf + (strm.next_in - in->buf); /* copy used input, write empty blocks to get to byte boundary */ pos = strm.data_type & 7; diff --git a/compat/zlib/examples/gzlog.c b/compat/zlib/examples/gzlog.c index d70aaca..922f878 100644 --- a/compat/zlib/examples/gzlog.c +++ b/compat/zlib/examples/gzlog.c @@ -1,8 +1,8 @@ /* * gzlog.c - * Copyright (C) 2004, 2008 Mark Adler, all rights reserved + * Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved * For conditions of distribution and use, see copyright notice in gzlog.h - * version 2.0, 25 Apr 2008 + * version 2.2, 14 Aug 2012 */ /* @@ -750,7 +750,8 @@ local int log_recover(struct log *log, int op) strcpy(log->end, ".add"); if (stat(log->path, &st) == 0 && st.st_size) { len = (size_t)(st.st_size); - if (len != st.st_size || (data = malloc(st.st_size)) == NULL) { + if ((off_t)len != st.st_size || + (data = malloc(st.st_size)) == NULL) { log_log(log, op, "allocation failure"); return -2; } @@ -758,7 +759,7 @@ local int log_recover(struct log *log, int op) log_log(log, op, ".add file read failure"); return -1; } - ret = read(fd, data, len) != len; + ret = (size_t)read(fd, data, len) != len; close(fd); if (ret) { log_log(log, op, ".add file read failure"); @@ -913,7 +914,7 @@ int gzlog_compress(gzlog *logd) struct log *log = logd; /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID) || len < 0) + if (log == NULL || strcmp(log->id, LOGID)) return -3; /* see if we lost the lock -- if so get it again and reload the extra @@ -952,7 +953,7 @@ int gzlog_compress(gzlog *logd) fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) break; - ret = write(fd, data, len) != len; + ret = (size_t)write(fd, data, len) != len; if (ret | close(fd)) break; log_touch(log); @@ -963,7 +964,7 @@ int gzlog_compress(gzlog *logd) if (fd < 0) break; next = DICT > len ? len : DICT; - ret = write(fd, (char *)data + len - next, next) != next; + ret = (size_t)write(fd, (char *)data + len - next, next) != next; if (ret | close(fd)) break; log_touch(log); @@ -997,9 +998,9 @@ int gzlog_write(gzlog *logd, void *data, size_t len) struct log *log = logd; /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID) || len < 0) + if (log == NULL || strcmp(log->id, LOGID)) return -3; - if (data == NULL || len == 0) + if (data == NULL || len <= 0) return 0; /* see if we lost the lock -- if so get it again and reload the extra @@ -1013,7 +1014,7 @@ int gzlog_write(gzlog *logd, void *data, size_t len) fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) return -1; - ret = write(fd, data, len) != len; + ret = (size_t)write(fd, data, len) != len; if (ret | close(fd)) return -1; log_touch(log); diff --git a/compat/zlib/examples/gzlog.h b/compat/zlib/examples/gzlog.h index c461426..86f0cec 100644 --- a/compat/zlib/examples/gzlog.h +++ b/compat/zlib/examples/gzlog.h @@ -1,6 +1,6 @@ /* gzlog.h - Copyright (C) 2004, 2008 Mark Adler, all rights reserved - version 2.0, 25 Apr 2008 + Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved + version 2.2, 14 Aug 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages @@ -27,6 +27,8 @@ Interface changed slightly in that now path is a prefix Compression now occurs as needed during gzlog_write() gzlog_write() now always leaves the log file as valid gzip + 2.1 8 Jul 2012 Fix argument checks in gzlog_compress() and gzlog_write() + 2.2 14 Aug 2012 Clean up signed comparisons */ /* diff --git a/compat/zlib/examples/zran.c b/compat/zlib/examples/zran.c index 617a130..278f9ad 100644 --- a/compat/zlib/examples/zran.c +++ b/compat/zlib/examples/zran.c @@ -1,7 +1,12 @@ /* zran.c -- example of zlib/gzip stream indexing and random access - * Copyright (C) 2005 Mark Adler + * Copyright (C) 2005, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.0 29 May 2005 Mark Adler */ + Version 1.1 29 Sep 2012 Mark Adler */ + +/* Version History: + 1.0 29 May 2005 First version + 1.1 29 Sep 2012 Fix memory reallocation error + */ /* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() for random access of a compressed file. A file containing a zlib or gzip @@ -221,7 +226,7 @@ local int build_index(FILE *in, off_t span, struct access **built) /* clean up and return index (release unused entries in list) */ (void)inflateEnd(&strm); - index = realloc(index, sizeof(struct point) * index->have); + index->list = realloc(index->list, sizeof(struct point) * index->have); index->size = index->have; *built = index; return index->size; diff --git a/compat/zlib/gzguts.h b/compat/zlib/gzguts.h index ee3f281..d87659d 100644 --- a/compat/zlib/gzguts.h +++ b/compat/zlib/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -35,6 +35,13 @@ # include #endif +#ifdef WINAPI_FAMILY +# define open _open +# define read _read +# define write _write +# define close _close +#endif + #ifdef NO_DEFLATE /* for compatibility with old definition */ # define NO_GZCOMPRESS #endif @@ -60,7 +67,7 @@ #ifndef HAVE_VSNPRINTF # ifdef MSDOS /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ + but for now we just assume it doesn't. */ # define NO_vsnprintf # endif # ifdef __TURBOC__ @@ -88,6 +95,14 @@ # endif #endif +/* unlike snprintf (which is required in C99, yet still not supported by + Microsoft more than a decade later!), _snprintf does not guarantee null + termination of the result -- however this is only used in gzlib.c where + the result is assured to fit in the space provided */ +#ifdef _MSC_VER +# define snprintf _snprintf +#endif + #ifndef local # define local static #endif @@ -127,7 +142,8 @@ # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif -/* default i/o buffer size -- double this for output when reading */ +/* default i/o buffer size -- double this for output when reading (this and + twice this must be able to fit in an unsigned type) */ #define GZBUFSIZE 8192 /* gzip modes, also provide a little integrity check on the passed structure */ diff --git a/compat/zlib/gzlib.c b/compat/zlib/gzlib.c index ca55c6e..fae202e 100644 --- a/compat/zlib/gzlib.c +++ b/compat/zlib/gzlib.c @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -108,7 +108,7 @@ local gzFile gz_open(path, fd, mode) return NULL; /* allocate gzFile structure to return */ - state = malloc(sizeof(gz_state)); + state = (gz_statep)malloc(sizeof(gz_state)); if (state == NULL) return NULL; state->size = 0; /* no buffers allocated yet */ @@ -162,8 +162,10 @@ local gzFile gz_open(path, fd, mode) break; case 'F': state->strategy = Z_FIXED; + break; case 'T': state->direct = 1; + break; default: /* could consider as an error, but just ignore */ ; } @@ -194,8 +196,8 @@ local gzFile gz_open(path, fd, mode) } else #endif - len = strlen(path); - state->path = malloc(len + 1); + len = strlen((const char *)path); + state->path = (char *)malloc(len + 1); if (state->path == NULL) { free(state); return NULL; @@ -208,7 +210,11 @@ local gzFile gz_open(path, fd, mode) *(state->path) = 0; else #endif +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(state->path, len + 1, "%s", (const char *)path); +#else strcpy(state->path, path); +#endif /* compute the flags for open() */ oflag = @@ -236,7 +242,7 @@ local gzFile gz_open(path, fd, mode) #ifdef _WIN32 fd == -2 ? _wopen(path, oflag, 0666) : #endif - open(path, oflag, 0666)); + open((const char *)path, oflag, 0666)); if (state->fd == -1) { free(state->path); free(state); @@ -282,9 +288,13 @@ gzFile ZEXPORT gzdopen(fd, mode) char *path; /* identifier for error messages */ gzFile gz; - if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) return NULL; +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(path, 7 + 3 * sizeof(int), "", fd); /* for debugging */ +#else sprintf(path, "", fd); /* for debugging */ +#endif gz = gz_open(path, fd, mode); free(path); return gz; @@ -531,7 +541,8 @@ const char * ZEXPORT gzerror(file, errnum) /* return error information */ if (errnum != NULL) *errnum = state->err; - return state->msg == NULL ? "" : state->msg; + return state->err == Z_MEM_ERROR ? "out of memory" : + (state->msg == NULL ? "" : state->msg); } /* -- see zlib.h -- */ @@ -582,21 +593,24 @@ void ZLIB_INTERNAL gz_error(state, err, msg) if (msg == NULL) return; - /* for an out of memory error, save as static string */ - if (err == Z_MEM_ERROR) { - state->msg = (char *)msg; + /* for an out of memory error, return literal string when requested */ + if (err == Z_MEM_ERROR) return; - } /* construct error message with path */ - if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == + NULL) { state->err = Z_MEM_ERROR; - state->msg = (char *)"out of memory"; return; } +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, + "%s%s%s", state->path, ": ", msg); +#else strcpy(state->msg, state->path); strcat(state->msg, ": "); strcat(state->msg, msg); +#endif return; } diff --git a/compat/zlib/gzread.c b/compat/zlib/gzread.c index 3493d34..bf4538e 100644 --- a/compat/zlib/gzread.c +++ b/compat/zlib/gzread.c @@ -1,5 +1,5 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -58,7 +58,8 @@ local int gz_avail(state) return -1; if (state->eof == 0) { if (strm->avail_in) { /* copy what's there to the start */ - unsigned char *p = state->in, *q = strm->next_in; + unsigned char *p = state->in; + unsigned const char *q = strm->next_in; unsigned n = strm->avail_in; do { *p++ = *q++; @@ -90,8 +91,8 @@ local int gz_look(state) /* allocate read buffers and inflate memory */ if (state->size == 0) { /* allocate buffers */ - state->in = malloc(state->want); - state->out = malloc(state->want << 1); + state->in = (unsigned char *)malloc(state->want); + state->out = (unsigned char *)malloc(state->want << 1); if (state->in == NULL || state->out == NULL) { if (state->out != NULL) free(state->out); @@ -352,14 +353,14 @@ int ZEXPORT gzread(file, buf, len) /* large len -- read directly into user buffer */ else if (state->how == COPY) { /* read directly */ - if (gz_load(state, buf, len, &n) == -1) + if (gz_load(state, (unsigned char *)buf, len, &n) == -1) return -1; } /* large len -- decompress directly into user buffer */ else { /* state->how == GZIP */ strm->avail_out = len; - strm->next_out = buf; + strm->next_out = (unsigned char *)buf; if (gz_decomp(state) == -1) return -1; n = state->x.have; @@ -378,7 +379,11 @@ int ZEXPORT gzread(file, buf, len) } /* -- see zlib.h -- */ -#undef gzgetc +#ifdef Z_PREFIX_SET +# undef z_gzgetc +#else +# undef gzgetc +#endif int ZEXPORT gzgetc(file) gzFile file; { @@ -518,7 +523,7 @@ char * ZEXPORT gzgets(file, buf, len) /* look for end-of-line in current output buffer */ n = state->x.have > left ? left : state->x.have; - eol = memchr(state->x.next, '\n', n); + eol = (unsigned char *)memchr(state->x.next, '\n', n); if (eol != NULL) n = (unsigned)(eol - state->x.next) + 1; diff --git a/compat/zlib/gzwrite.c b/compat/zlib/gzwrite.c index 27cb342..aa767fb 100644 --- a/compat/zlib/gzwrite.c +++ b/compat/zlib/gzwrite.c @@ -1,5 +1,5 @@ /* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -19,7 +19,7 @@ local int gz_init(state) z_streamp strm = &(state->strm); /* allocate input buffer */ - state->in = malloc(state->want); + state->in = (unsigned char *)malloc(state->want); if (state->in == NULL) { gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; @@ -28,7 +28,7 @@ local int gz_init(state) /* only need output buffer and deflate state if compressing */ if (!state->direct) { /* allocate output buffer */ - state->out = malloc(state->want); + state->out = (unsigned char *)malloc(state->want); if (state->out == NULL) { free(state->in); gz_error(state, Z_MEM_ERROR, "out of memory"); @@ -168,7 +168,6 @@ int ZEXPORT gzwrite(file, buf, len) unsigned len; { unsigned put = len; - unsigned n; gz_statep state; z_streamp strm; @@ -208,16 +207,19 @@ int ZEXPORT gzwrite(file, buf, len) if (len < state->size) { /* copy to input buffer, compress when full */ do { + unsigned have, copy; + if (strm->avail_in == 0) strm->next_in = state->in; - n = state->size - strm->avail_in; - if (n > len) - n = len; - memcpy(strm->next_in + strm->avail_in, buf, n); - strm->avail_in += n; - state->x.pos += n; - buf = (char *)buf + n; - len -= n; + have = (unsigned)((strm->next_in + strm->avail_in) - state->in); + copy = state->size - have; + if (copy > len) + copy = len; + memcpy(state->in + have, buf, copy); + strm->avail_in += copy; + state->x.pos += copy; + buf = (const char *)buf + copy; + len -= copy; if (len && gz_comp(state, Z_NO_FLUSH) == -1) return 0; } while (len); @@ -229,7 +231,7 @@ int ZEXPORT gzwrite(file, buf, len) /* directly compress user buffer to file */ strm->avail_in = len; - strm->next_in = (voidp)buf; + strm->next_in = (z_const Bytef *)buf; state->x.pos += len; if (gz_comp(state, Z_NO_FLUSH) == -1) return 0; @@ -244,6 +246,7 @@ int ZEXPORT gzputc(file, c) gzFile file; int c; { + unsigned have; unsigned char buf[1]; gz_statep state; z_streamp strm; @@ -267,12 +270,16 @@ int ZEXPORT gzputc(file, c) /* try writing to input buffer for speed (state->size == 0 if buffer not initialized) */ - if (strm->avail_in < state->size) { + if (state->size) { if (strm->avail_in == 0) strm->next_in = state->in; - strm->next_in[strm->avail_in++] = c; - state->x.pos++; - return c & 0xff; + have = (unsigned)((strm->next_in + strm->avail_in) - state->in); + if (have < state->size) { + state->in[have] = c; + strm->avail_in++; + state->x.pos++; + return c & 0xff; + } } /* no room in buffer or not initialized, use gz_write() */ @@ -300,12 +307,11 @@ int ZEXPORT gzputs(file, str) #include /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) +int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) { int size, len; gz_statep state; z_streamp strm; - va_list va; /* get internal structure */ if (file == NULL) @@ -335,25 +341,20 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) /* do the printf() into the input buffer, put length in len */ size = (int)(state->size); state->in[size - 1] = 0; - va_start(va, format); #ifdef NO_vsnprintf # ifdef HAS_vsprintf_void (void)vsprintf((char *)(state->in), format, va); - va_end(va); for (len = 0; len < size; len++) if (state->in[len] == 0) break; # else len = vsprintf((char *)(state->in), format, va); - va_end(va); # endif #else # ifdef HAS_vsnprintf_void (void)vsnprintf((char *)(state->in), size, format, va); - va_end(va); len = strlen((char *)(state->in)); # else len = vsnprintf((char *)(state->in), size, format, va); - va_end(va); # endif #endif @@ -368,6 +369,17 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) return len; } +int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) +{ + va_list va; + int ret; + + va_start(va, format); + ret = gzvprintf(file, format, va); + va_end(va); + return ret; +} + #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ @@ -547,9 +559,9 @@ int ZEXPORT gzclose_w(file) } /* flush, free memory, and close file */ + if (gz_comp(state, Z_FINISH) == -1) + ret = state->err; if (state->size) { - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; if (!state->direct) { (void)deflateEnd(&(state->strm)); free(state->out); diff --git a/compat/zlib/infback.c b/compat/zlib/infback.c index 981aff1..f3833c2 100644 --- a/compat/zlib/infback.c +++ b/compat/zlib/infback.c @@ -255,7 +255,7 @@ out_func out; void FAR *out_desc; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ diff --git a/compat/zlib/inffast.c b/compat/zlib/inffast.c index 2f1d60b..bda59ce 100644 --- a/compat/zlib/inffast.c +++ b/compat/zlib/inffast.c @@ -1,5 +1,5 @@ /* inffast.c -- fast decoding - * Copyright (C) 1995-2008, 2010 Mark Adler + * Copyright (C) 1995-2008, 2010, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -69,8 +69,8 @@ z_streamp strm; unsigned start; /* inflate()'s starting value for strm->avail_out */ { struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ + z_const unsigned char FAR *in; /* local strm->next_in */ + z_const unsigned char FAR *last; /* have enough input while in < last */ unsigned char FAR *out; /* local strm->next_out */ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ unsigned char FAR *end; /* while out < end, enough space available */ diff --git a/compat/zlib/inflate.c b/compat/zlib/inflate.c index 47418a1..870f89b 100644 --- a/compat/zlib/inflate.c +++ b/compat/zlib/inflate.c @@ -93,11 +93,12 @@ /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); +local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, + unsigned copy)); #ifdef BUILDFIXED void makefixed OF((void)); #endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, +local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateResetKeep(strm) @@ -375,12 +376,13 @@ void makefixed() output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ -local int updatewindow(strm, out) +local int updatewindow(strm, end, copy) z_streamp strm; -unsigned out; +const Bytef *end; +unsigned copy; { struct inflate_state FAR *state; - unsigned copy, dist; + unsigned dist; state = (struct inflate_state FAR *)strm->state; @@ -400,19 +402,18 @@ unsigned out; } /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + zmemcpy(state->window, end - state->wsize, state->wsize); state->wnext = 0; state->whave = state->wsize; } else { dist = state->wsize - state->wnext; if (dist > copy) dist = copy; - zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + zmemcpy(state->window + state->wnext, end - copy, dist); copy -= dist; if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); + zmemcpy(state->window, end - copy, copy); state->wnext = copy; state->whave = state->wsize; } @@ -606,7 +607,7 @@ z_streamp strm; int flush; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ @@ -920,7 +921,7 @@ int flush; while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; - state->lencode = (code const FAR *)(state->next); + state->lencode = (const code FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); @@ -994,7 +995,7 @@ int flush; values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state->next = state->codes; - state->lencode = (code const FAR *)(state->next); + state->lencode = (const code FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); @@ -1003,7 +1004,7 @@ int flush; state->mode = BAD; break; } - state->distcode = (code const FAR *)(state->next); + state->distcode = (const code FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); @@ -1230,7 +1231,7 @@ int flush; RESTORE(); if (state->wsize || (out != strm->avail_out && state->mode < BAD && (state->mode < CHECK || flush != Z_FINISH))) - if (updatewindow(strm, out)) { + if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; } @@ -1264,6 +1265,29 @@ z_streamp strm; return Z_OK; } +int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) +z_streamp strm; +Bytef *dictionary; +uInt *dictLength; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* copy dictionary */ + if (state->whave && dictionary != Z_NULL) { + zmemcpy(dictionary, state->window + state->wnext, + state->whave - state->wnext); + zmemcpy(dictionary + state->whave - state->wnext, + state->window, state->wnext); + } + if (dictLength != Z_NULL) + *dictLength = state->whave; + return Z_OK; +} + int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; @@ -1271,8 +1295,6 @@ uInt dictLength; { struct inflate_state FAR *state; unsigned long dictid; - unsigned char *next; - unsigned avail; int ret; /* check state */ @@ -1291,13 +1313,7 @@ uInt dictLength; /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ - next = strm->next_out; - avail = strm->avail_out; - strm->next_out = (Bytef *)dictionary + dictLength; - strm->avail_out = 0; - ret = updatewindow(strm, dictLength); - strm->avail_out = avail; - strm->next_out = next; + ret = updatewindow(strm, dictionary + dictLength, dictLength); if (ret) { state->mode = MEM; return Z_MEM_ERROR; @@ -1337,7 +1353,7 @@ gz_headerp head; */ local unsigned syncsearch(have, buf, len) unsigned FAR *have; -unsigned char FAR *buf; +const unsigned char FAR *buf; unsigned len; { unsigned got; diff --git a/compat/zlib/inftrees.c b/compat/zlib/inftrees.c index abcd7c4..44d89cf 100644 --- a/compat/zlib/inftrees.c +++ b/compat/zlib/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2012 Mark Adler + * Copyright (C) 1995-2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.7 Copyright 1995-2012 Mark Adler "; + " inflate 1.2.8 Copyright 1995-2013 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, @@ -208,8 +208,8 @@ unsigned short FAR *work; mask = used - 1; /* mask for comparing low */ /* check available table space */ - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) + if ((type == LENS && used > ENOUGH_LENS) || + (type == DISTS && used > ENOUGH_DISTS)) return 1; /* process all codes and make table entries */ @@ -277,8 +277,8 @@ unsigned short FAR *work; /* check for enough space */ used += 1U << curr; - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) + if ((type == LENS && used > ENOUGH_LENS) || + (type == DISTS && used > ENOUGH_DISTS)) return 1; /* point entry in root table to sub-table */ diff --git a/compat/zlib/qnx/package.qpg b/compat/zlib/qnx/package.qpg index 26eed9b..aebf6e3 100644 --- a/compat/zlib/qnx/package.qpg +++ b/compat/zlib/qnx/package.qpg @@ -25,10 +25,10 @@ - - - - + + + + @@ -63,7 +63,7 @@ - 1.2.7 + 1.2.8 Medium Stable diff --git a/compat/zlib/test/example.c b/compat/zlib/test/example.c index f515a48..138a699 100644 --- a/compat/zlib/test/example.c +++ b/compat/zlib/test/example.c @@ -26,7 +26,7 @@ } \ } -const char hello[] = "hello, hello!"; +z_const char hello[] = "hello, hello!"; /* "hello world" would be more standard, but the repeated "hello" * stresses the compression code better, sorry... */ @@ -212,7 +212,7 @@ void test_deflate(compr, comprLen) err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, "deflateInit"); - c_stream.next_in = (Bytef*)hello; + c_stream.next_in = (z_const unsigned char *)hello; c_stream.next_out = compr; while (c_stream.total_in != len && c_stream.total_out < comprLen) { @@ -387,7 +387,7 @@ void test_flush(compr, comprLen) err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, "deflateInit"); - c_stream.next_in = (Bytef*)hello; + c_stream.next_in = (z_const unsigned char *)hello; c_stream.next_out = compr; c_stream.avail_in = 3; c_stream.avail_out = (uInt)*comprLen; @@ -476,7 +476,7 @@ void test_dict_deflate(compr, comprLen) c_stream.next_out = compr; c_stream.avail_out = (uInt)comprLen; - c_stream.next_in = (Bytef*)hello; + c_stream.next_in = (z_const unsigned char *)hello; c_stream.avail_in = (uInt)strlen(hello)+1; err = deflate(&c_stream, Z_FINISH); diff --git a/compat/zlib/test/minigzip.c b/compat/zlib/test/minigzip.c index aa7ac7a..b3025a4 100644 --- a/compat/zlib/test/minigzip.c +++ b/compat/zlib/test/minigzip.c @@ -40,6 +40,10 @@ # define SET_BINARY_MODE(file) #endif +#ifdef _MSC_VER +# define snprintf _snprintf +#endif + #ifdef VMS # define unlink delete # define GZ_SUFFIX "-gz" @@ -463,8 +467,12 @@ void file_compress(file, mode) exit(1); } +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); +#else strcpy(outfile, file); strcat(outfile, GZ_SUFFIX); +#endif in = fopen(file, "rb"); if (in == NULL) { @@ -499,7 +507,11 @@ void file_uncompress(file) exit(1); } +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(buf, sizeof(buf), "%s", file); +#else strcpy(buf, file); +#endif if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { infile = file; @@ -508,7 +520,11 @@ void file_uncompress(file) } else { outfile = file; infile = buf; +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX); +#else strcat(infile, GZ_SUFFIX); +#endif } in = gzopen(infile, "rb"); if (in == NULL) { @@ -546,7 +562,11 @@ int main(argc, argv) gzFile file; char *bname, outmode[20]; +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(outmode, sizeof(outmode), "%s", "wb6 "); +#else strcpy(outmode, "wb6 "); +#endif prog = argv[0]; bname = strrchr(argv[0], '/'); diff --git a/compat/zlib/treebuild.xml b/compat/zlib/treebuild.xml index 1f4d15f..38d29d7 100644 --- a/compat/zlib/treebuild.xml +++ b/compat/zlib/treebuild.xml @@ -1,6 +1,6 @@ - - + + zip compression library diff --git a/compat/zlib/trees.c b/compat/zlib/trees.c index 8c32b21..1fd7759 100644 --- a/compat/zlib/trees.c +++ b/compat/zlib/trees.c @@ -146,8 +146,8 @@ local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree OF((deflate_state *s)); local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); +local void compress_block OF((deflate_state *s, const ct_data *ltree, + const ct_data *dtree)); local int detect_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); @@ -972,7 +972,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+last, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); + compress_block(s, (const ct_data *)static_ltree, + (const ct_data *)static_dtree); #ifdef DEBUG s->compressed_len += 3 + s->static_len; #endif @@ -980,7 +981,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) send_bits(s, (DYN_TREES<<1)+last, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); + compress_block(s, (const ct_data *)s->dyn_ltree, + (const ct_data *)s->dyn_dtree); #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif @@ -1057,8 +1059,8 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) */ local void compress_block(s, ltree, dtree) deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ + const ct_data *ltree; /* literal tree */ + const ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ diff --git a/compat/zlib/uncompr.c b/compat/zlib/uncompr.c index ad98be3..242e949 100644 --- a/compat/zlib/uncompr.c +++ b/compat/zlib/uncompr.c @@ -30,7 +30,7 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen) z_stream stream; int err; - stream.next_in = (Bytef*)source; + stream.next_in = (z_const Bytef *)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; diff --git a/compat/zlib/win32/Makefile.msc b/compat/zlib/win32/Makefile.msc index 59bb0da..67b7731 100644 --- a/compat/zlib/win32/Makefile.msc +++ b/compat/zlib/win32/Makefile.msc @@ -9,6 +9,10 @@ # nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \ # OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64) +# The toplevel directory of the source tree. +# +TOP = . + # optional build flags LOC = @@ -43,8 +47,8 @@ $(STATICLIB): $(OBJS) $(OBJA) $(IMPLIB): $(SHAREDLIB) -$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res - $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \ +$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res + $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \ -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res if exist $@.manifest \ mt -nologo -manifest $@.manifest -outputresource:$@;2 @@ -69,72 +73,71 @@ minigzip_d.exe: minigzip.obj $(IMPLIB) if exist $@.manifest \ mt -nologo -manifest $@.manifest -outputresource:$@;1 -.c.obj: +{$(TOP)}.c.obj: $(CC) -c $(WFLAGS) $(CFLAGS) $< -{test}.c.obj: - $(CC) -c -I. $(WFLAGS) $(CFLAGS) $< +{$(TOP)/test}.c.obj: + $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< -{contrib/masmx64}.c.obj: +{$(TOP)/contrib/masmx64}.c.obj: $(CC) -c $(WFLAGS) $(CFLAGS) $< -{contrib/masmx64}.asm.obj: +{$(TOP)/contrib/masmx64}.asm.obj: $(AS) -c $(ASFLAGS) $< -{contrib/masmx86}.asm.obj: +{$(TOP)/contrib/masmx86}.asm.obj: $(AS) -c $(ASFLAGS) $< -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h +adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h -crc32.obj: crc32.c zlib.h zconf.h crc32.h +compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h +crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h +deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h +gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h -gzread.obj: gzread.c zlib.h zconf.h gzguts.h +gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h +gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h +gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h +infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ + $(TOP)/inffast.h $(TOP)/inffixed.h -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h +inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ + $(TOP)/inffast.h -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h +inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ + $(TOP)/inffast.h $(TOP)/inffixed.h -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h +inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h -uncompr.obj: uncompr.c zlib.h zconf.h +trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h -zutil.obj: zutil.c zutil.h zlib.h zconf.h +uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h -gvmat64.obj: contrib\masmx64\gvmat64.asm +zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h -inffasx64.obj: contrib\masmx64\inffasx64.asm +gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm -inffas8664.obj: contrib\masmx64\inffas8664.c zutil.h zlib.h zconf.h \ - inftrees.h inflate.h inffast.h +inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm -inffas32.obj: contrib\masmx86\inffas32.asm +inffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \ + $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h -match686.obj: contrib\masmx86\match686.asm +inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm -example.obj: test/example.c zlib.h zconf.h +match686.obj: $(TOP)/contrib\masmx86\match686.asm -minigzip.obj: test/minigzip.c zlib.h zconf.h +example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h -zlib1.res: win32/zlib1.rc - $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc +minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h +zlib1.res: $(TOP)/win32/zlib1.rc + $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc # testing test: example.exe minigzip.exe diff --git a/compat/zlib/win32/README-WIN32.txt b/compat/zlib/win32/README-WIN32.txt index 46c5923..3d77d52 100644 --- a/compat/zlib/win32/README-WIN32.txt +++ b/compat/zlib/win32/README-WIN32.txt @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.7 is a general purpose data compression library. All the code is +zlib 1.2.8 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) @@ -22,7 +22,7 @@ before asking for help. Manifest: -The package zlib-1.2.7-win32-x86.zip will contain the following files: +The package zlib-1.2.8-win32-x86.zip will contain the following files: README-WIN32.txt This document ChangeLog Changes since previous zlib packages diff --git a/compat/zlib/win32/README.txt b/compat/zlib/win32/README.txt index fad9f14..34a13b3 100644 --- a/compat/zlib/win32/README.txt +++ b/compat/zlib/win32/README.txt @@ -6,7 +6,7 @@ What's here Source ====== - zlib version 1.2.5 + zlib version 1.2.8 available at http://www.gzip.org/zlib/ @@ -22,17 +22,18 @@ Usage Build info ========== - Contributed by Cosmin Truta. + Contributed by Jan Nijtmans. Compiler: - gcc-4.5.0-1-mingw32 + i686-w64-mingw32-gcc (GCC) 4.5.3 Library: - mingwrt-3.17, w32api-3.14 + mingw64-i686-runtime/headers: 3.0b_svn5747-1 Build commands: - gcc -c -DASMV contrib/asm686/match.S - gcc -c -DASMINF -I. -O3 contrib/inflate86/inffas86.c - make -f win32/Makefile.gcc LOC="-DASMV -DASMINF" OBJA="inffas86.o match.o" - + i686-w64-mingw32-gcc -c -DASMV contrib/asm686/match.S + i686-w64-mingw32-gcc -c -DASMINF -I. -O3 contrib/inflate86/inffas86.c + make -f win32/Makefile.gcc PREFIX=i686-w64-mingw32- LOC="-mms-bitfields -DASMV -DASMINF" OBJA="inffas86.o match.o" + Finally, from VS commandline (VS2005 or higher): + lib -machine:X86 -name:zlib1.dll -def:zlib.def -out:zdll.lib Copyright notice ================ diff --git a/compat/zlib/win32/zdll.lib b/compat/zlib/win32/zdll.lib index 669b186..8e6f719 100644 Binary files a/compat/zlib/win32/zdll.lib and b/compat/zlib/win32/zdll.lib differ diff --git a/compat/zlib/win32/zlib.def b/compat/zlib/win32/zlib.def index 0489615..face655 100644 --- a/compat/zlib/win32/zlib.def +++ b/compat/zlib/win32/zlib.def @@ -17,6 +17,7 @@ EXPORTS deflatePrime deflateSetHeader inflateSetDictionary + inflateGetDictionary inflateSync inflateCopy inflateReset @@ -39,6 +40,7 @@ EXPORTS gzread gzwrite gzprintf + gzvprintf gzputs gzgets gzputc diff --git a/compat/zlib/win32/zlib1.dll b/compat/zlib/win32/zlib1.dll index 9943b3e..9ea38d5 100644 Binary files a/compat/zlib/win32/zlib1.dll and b/compat/zlib/win32/zlib1.dll differ diff --git a/compat/zlib/win32/zlib1.rc b/compat/zlib/win32/zlib1.rc index 0d1d7ff..5c0feed 100644 --- a/compat/zlib/win32/zlib1.rc +++ b/compat/zlib/win32/zlib1.rc @@ -26,7 +26,7 @@ BEGIN VALUE "FileDescription", "zlib data compression library\0" VALUE "FileVersion", ZLIB_VERSION "\0" VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2006 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" VALUE "OriginalFilename", "zlib1.dll\0" VALUE "ProductName", "zlib\0" VALUE "ProductVersion", ZLIB_VERSION "\0" diff --git a/compat/zlib/win64/zdll.lib b/compat/zlib/win64/zdll.lib index d7dfb09..ac9ffc9 100644 Binary files a/compat/zlib/win64/zdll.lib and b/compat/zlib/win64/zdll.lib differ diff --git a/compat/zlib/win64/zlib1.dll b/compat/zlib/win64/zlib1.dll index 631439b..bd1dbc6 100644 Binary files a/compat/zlib/win64/zlib1.dll and b/compat/zlib/win64/zlib1.dll differ diff --git a/compat/zlib/zconf.h b/compat/zlib/zconf.h index 8a46a58..9987a77 100644 --- a/compat/zlib/zconf.h +++ b/compat/zlib/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -21,6 +21,7 @@ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block @@ -77,6 +78,7 @@ # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread @@ -103,6 +105,7 @@ # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine @@ -388,20 +391,14 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif -/* ./configure may #define Z_U4 here */ - #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned -# else -# if (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# else -# if (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -# endif +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short # endif #endif @@ -425,8 +422,16 @@ typedef uLong FAR uLongf; # endif #endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + #ifdef _WIN32 -# include /* for wchar_t */ +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and @@ -435,7 +440,7 @@ typedef uLong FAR uLongf; * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif @@ -443,7 +448,7 @@ typedef uLong FAR uLongf; # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/compat/zlib/zconf.h.cmakein b/compat/zlib/zconf.h.cmakein index b6ca59a..043019c 100644 --- a/compat/zlib/zconf.h.cmakein +++ b/compat/zlib/zconf.h.cmakein @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,7 @@ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block @@ -79,6 +80,7 @@ # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread @@ -105,6 +107,7 @@ # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine @@ -390,20 +393,14 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif -/* ./configure may #define Z_U4 here */ - #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned -# else -# if (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# else -# if (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -# endif +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short # endif #endif @@ -427,8 +424,16 @@ typedef uLong FAR uLongf; # endif #endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + #ifdef _WIN32 -# include /* for wchar_t */ +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and @@ -437,7 +442,7 @@ typedef uLong FAR uLongf; * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif @@ -445,7 +450,7 @@ typedef uLong FAR uLongf; # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/compat/zlib/zconf.h.in b/compat/zlib/zconf.h.in index 8a46a58..9987a77 100644 --- a/compat/zlib/zconf.h.in +++ b/compat/zlib/zconf.h.in @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -21,6 +21,7 @@ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block @@ -77,6 +78,7 @@ # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread @@ -103,6 +105,7 @@ # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine @@ -388,20 +391,14 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif -/* ./configure may #define Z_U4 here */ - #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned -# else -# if (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# else -# if (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -# endif +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short # endif #endif @@ -425,8 +422,16 @@ typedef uLong FAR uLongf; # endif #endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + #ifdef _WIN32 -# include /* for wchar_t */ +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and @@ -435,7 +440,7 @@ typedef uLong FAR uLongf; * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif @@ -443,7 +448,7 @@ typedef uLong FAR uLongf; # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ diff --git a/compat/zlib/zlib.3 b/compat/zlib/zlib.3 index 79d3402..0160e62 100644 --- a/compat/zlib/zlib.3 +++ b/compat/zlib/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "2 May 2012" +.TH ZLIB 3 "28 Apr 2013" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -125,8 +125,8 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS -Version 1.2.7 -Copyright (C) 1995-2012 Jean-loup Gailly (jloup@gzip.org) +Version 1.2.8 +Copyright (C) 1995-2013 Jean-loup Gailly (jloup@gzip.org) and Mark Adler (madler@alumni.caltech.edu). .LP This software is provided "as-is," diff --git a/compat/zlib/zlib.3.pdf b/compat/zlib/zlib.3.pdf index 485306c..a346b5d 100644 Binary files a/compat/zlib/zlib.3.pdf and b/compat/zlib/zlib.3.pdf differ diff --git a/compat/zlib/zlib.h b/compat/zlib/zlib.h index 3edf3ac..3e0c767 100644 --- a/compat/zlib/zlib.h +++ b/compat/zlib/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.7, May 2nd, 2012 + version 1.2.8, April 28th, 2013 - Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.7" -#define ZLIB_VERNUM 0x1270 +#define ZLIB_VERSION "1.2.8" +#define ZLIB_VERNUM 0x1280 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 7 +#define ZLIB_VER_REVISION 8 #define ZLIB_VER_SUBREVISION 0 /* @@ -839,6 +839,21 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, inflate(). */ +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a possible full flush point (see above @@ -846,7 +861,7 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); available input is skipped. No output is provided. inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurences of this + All full flush points have this pattern, but not all occurrences of this pattern are full flush points. inflateSync returns Z_OK if a possible full flush point has been found, @@ -1007,7 +1022,8 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, the version of the header file. */ -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, @@ -1015,11 +1031,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. @@ -1736,6 +1753,13 @@ ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); #endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + const char *format, + va_list va)); +# endif +#endif #ifdef __cplusplus } diff --git a/compat/zlib/zlib.map b/compat/zlib/zlib.map index 771f420..55c6647 100644 --- a/compat/zlib/zlib.map +++ b/compat/zlib/zlib.map @@ -76,3 +76,8 @@ ZLIB_1.2.5.2 { gzgetc_; inflateResetKeep; } ZLIB_1.2.5.1; + +ZLIB_1.2.7.1 { + inflateGetDictionary; + gzvprintf; +} ZLIB_1.2.5.2; diff --git a/compat/zlib/zutil.c b/compat/zlib/zutil.c index 65e0d3b..23d2ebe 100644 --- a/compat/zlib/zutil.c +++ b/compat/zlib/zutil.c @@ -14,7 +14,7 @@ struct internal_state {int dummy;}; /* for buggy compilers */ #endif -const char * const z_errmsg[10] = { +z_const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ diff --git a/compat/zlib/zutil.h b/compat/zlib/zutil.h index 4e3dcc6..24ab06b 100644 --- a/compat/zlib/zutil.h +++ b/compat/zlib/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -44,13 +44,13 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) + return (strm->msg = ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ @@ -168,7 +168,8 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ #endif /* provide prototypes for these when building zlib without LFS */ -#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) +#if !defined(_WIN32) && \ + (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); #endif -- cgit v0.12 From d1756f468478c8b9e0b652ada83fcef2bd8082c0 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 13 May 2013 14:23:45 +0000 Subject: compiler warning --- generic/tclCompile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 7f6b7d4..0844a78 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1134,7 +1134,7 @@ PeepholeOptimize( hPtr = Tcl_FirstHashEntry( &JUMPTABLEINFO(envPtr, pc+1)->hashTable, &hSearch); for (; hPtr ; hPtr = Tcl_NextHashEntry(&hSearch)) { - target = pc + (int) Tcl_GetHashValue(hPtr); + target = pc + PTR2INT(Tcl_GetHashValue(hPtr)); (void) Tcl_CreateHashEntry(&targets, (void *) target, &isNew); } break; -- cgit v0.12 From 5f2257dcfce6b59348bc2baa06635167a7d6a1a6 Mon Sep 17 00:00:00 2001 From: andreask Date: Mon, 13 May 2013 16:51:23 +0000 Subject: Fixed bug in parent revision [832a1994c7] unpredictably breaking the execution of precompiled bytecode (i.e. tbcload'ed bytecode). The semi-inversion of a guard condition dropped the part about TCL_BYTECODE_PRECOMPILED of the original condition, allowing the core to attempt to recompile code for which there are no script sources (anymore), which then fails. --- generic/tclExecute.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 628dfe7..98e150c 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2328,8 +2328,9 @@ TEBCresume( iPtr->cmdCount += TclGetUInt4AtPtr(pc+5); if (checkInterp) { checkInterp = 0; - if ((codePtr->compileEpoch != iPtr->compileEpoch) - || (codePtr->nsEpoch != iPtr->varFramePtr->nsPtr->resolverEpoch)) { + if (((codePtr->compileEpoch != iPtr->compileEpoch) || + (codePtr->nsEpoch != iPtr->varFramePtr->nsPtr->resolverEpoch)) && + !(codePtr->flags & TCL_BYTECODE_PRECOMPILED)) { goto instStartCmdFailed; } } -- cgit v0.12 From 1d99d2af062fbf3e3af72e1347840eb3555250dc Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 14 May 2013 18:44:17 +0000 Subject: make dist --- unix/tclConfig.h.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 8069b68..839c2ab 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -241,6 +241,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + /* Should we use the global timezone variable? */ #undef HAVE_TIMEZONE_VAR -- cgit v0.12 From 20949fc52936f3dc85877fc5ef9183effc013225 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 May 2013 10:27:55 +0000 Subject: Add missing "platform" package to the distribution as well. Reported by Pietro Cerutti. --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 0752106..eb5d6eb 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1322,7 +1322,7 @@ dist: mkdir $(DISTDIR)/library cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \ $(TOP_DIR)/library/tclIndex $(DISTDIR)/library - for i in http1.0 http opt msgcat reg dde tcltest; \ + for i in http1.0 http opt msgcat reg dde tcltest platform; \ do \ mkdir $(DISTDIR)/library/$$i ;\ cp -p $(TOP_DIR)/library/$$i/*.tcl $(DISTDIR)/library/$$i; \ -- cgit v0.12 From 1eacac1aa2e8e1f6a11ad280d4d5ac4774672c81 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 15 May 2013 10:38:25 +0000 Subject: A better technique for [list {*}blah]. Remove the INST_LIST_EXPANDED opcode (and the complex machinery associated with it) as as it is no longer needed. --- generic/tclBasic.c | 156 ++++++++++++++++++++++++++------------------------ generic/tclCompCmds.c | 39 ++++++++++++- generic/tclCompile.c | 134 ++++++++++++++++++++++++------------------- generic/tclCompile.h | 3 +- generic/tclExecute.c | 12 ---- generic/tclInt.h | 4 ++ 6 files changed, 198 insertions(+), 150 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b39d346..bf0639e 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -185,11 +185,16 @@ typedef struct { Tcl_ObjCmdProc *objProc; /* Object-based function for command. */ CompileProc *compileProc; /* Function called to compile command. */ Tcl_ObjCmdProc *nreProc; /* NR-based function for command */ - int isSafe; /* If non-zero, command will be present in - * safe interpreter. Otherwise it will be - * hidden. */ + int flags; /* Various flag bits, as defined below. */ } CmdInfo; +#define CMD_IS_SAFE 1 /* Whether this command is part of the set of + * commands present by default in a safe + * interpreter. */ +/* CMD_COMPILES_EXPANDED - Whether the compiler for this command can handle + * expansion for itself rather than needing the generic layer to take care of + * it for it. Defined in tclInt.h. */ + /* * The built-in commands, and the functions that implement them: */ @@ -199,95 +204,95 @@ static const CmdInfo builtInCmds[] = { * Commands in the generic core. */ - {"append", Tcl_AppendObjCmd, TclCompileAppendCmd, NULL, 1}, - {"apply", Tcl_ApplyObjCmd, NULL, TclNRApplyObjCmd, 1}, - {"break", Tcl_BreakObjCmd, TclCompileBreakCmd, NULL, 1}, + {"append", Tcl_AppendObjCmd, TclCompileAppendCmd, NULL, CMD_IS_SAFE}, + {"apply", Tcl_ApplyObjCmd, NULL, TclNRApplyObjCmd, CMD_IS_SAFE}, + {"break", Tcl_BreakObjCmd, TclCompileBreakCmd, NULL, CMD_IS_SAFE}, #ifndef EXCLUDE_OBSOLETE_COMMANDS - {"case", Tcl_CaseObjCmd, NULL, NULL, 1}, + {"case", Tcl_CaseObjCmd, NULL, NULL, CMD_IS_SAFE}, #endif - {"catch", Tcl_CatchObjCmd, TclCompileCatchCmd, TclNRCatchObjCmd, 1}, - {"concat", Tcl_ConcatObjCmd, NULL, NULL, 1}, - {"continue", Tcl_ContinueObjCmd, TclCompileContinueCmd, NULL, 1}, - {"coroutine", NULL, NULL, TclNRCoroutineObjCmd, 1}, - {"error", Tcl_ErrorObjCmd, TclCompileErrorCmd, NULL, 1}, - {"eval", Tcl_EvalObjCmd, NULL, TclNREvalObjCmd, 1}, - {"expr", Tcl_ExprObjCmd, TclCompileExprCmd, TclNRExprObjCmd, 1}, - {"for", Tcl_ForObjCmd, TclCompileForCmd, TclNRForObjCmd, 1}, - {"foreach", Tcl_ForeachObjCmd, TclCompileForeachCmd, TclNRForeachCmd, 1}, - {"format", Tcl_FormatObjCmd, TclCompileFormatCmd, NULL, 1}, - {"global", Tcl_GlobalObjCmd, TclCompileGlobalCmd, NULL, 1}, - {"if", Tcl_IfObjCmd, TclCompileIfCmd, TclNRIfObjCmd, 1}, - {"incr", Tcl_IncrObjCmd, TclCompileIncrCmd, NULL, 1}, - {"join", Tcl_JoinObjCmd, NULL, NULL, 1}, - {"lappend", Tcl_LappendObjCmd, TclCompileLappendCmd, NULL, 1}, - {"lassign", Tcl_LassignObjCmd, TclCompileLassignCmd, NULL, 1}, - {"lindex", Tcl_LindexObjCmd, TclCompileLindexCmd, NULL, 1}, - {"linsert", Tcl_LinsertObjCmd, NULL, NULL, 1}, - {"list", Tcl_ListObjCmd, TclCompileListCmd, NULL, 1}, - {"llength", Tcl_LlengthObjCmd, TclCompileLlengthCmd, NULL, 1}, - {"lmap", Tcl_LmapObjCmd, TclCompileLmapCmd, TclNRLmapCmd, 1}, - {"lrange", Tcl_LrangeObjCmd, TclCompileLrangeCmd, NULL, 1}, - {"lrepeat", Tcl_LrepeatObjCmd, NULL, NULL, 1}, - {"lreplace", Tcl_LreplaceObjCmd, TclCompileLreplaceCmd, NULL, 1}, - {"lreverse", Tcl_LreverseObjCmd, NULL, NULL, 1}, - {"lsearch", Tcl_LsearchObjCmd, NULL, NULL, 1}, - {"lset", Tcl_LsetObjCmd, TclCompileLsetCmd, NULL, 1}, - {"lsort", Tcl_LsortObjCmd, NULL, NULL, 1}, - {"package", Tcl_PackageObjCmd, NULL, NULL, 1}, - {"proc", Tcl_ProcObjCmd, NULL, NULL, 1}, - {"regexp", Tcl_RegexpObjCmd, TclCompileRegexpCmd, NULL, 1}, - {"regsub", Tcl_RegsubObjCmd, TclCompileRegsubCmd, NULL, 1}, - {"rename", Tcl_RenameObjCmd, NULL, NULL, 1}, - {"return", Tcl_ReturnObjCmd, TclCompileReturnCmd, NULL, 1}, - {"scan", Tcl_ScanObjCmd, NULL, NULL, 1}, - {"set", Tcl_SetObjCmd, TclCompileSetCmd, NULL, 1}, - {"split", Tcl_SplitObjCmd, NULL, NULL, 1}, - {"subst", Tcl_SubstObjCmd, TclCompileSubstCmd, TclNRSubstObjCmd, 1}, - {"switch", Tcl_SwitchObjCmd, TclCompileSwitchCmd, TclNRSwitchObjCmd, 1}, - {"tailcall", NULL, TclCompileTailcallCmd, TclNRTailcallObjCmd, 1}, - {"throw", Tcl_ThrowObjCmd, TclCompileThrowCmd, NULL, 1}, - {"trace", Tcl_TraceObjCmd, NULL, NULL, 1}, - {"try", Tcl_TryObjCmd, TclCompileTryCmd, TclNRTryObjCmd, 1}, - {"unset", Tcl_UnsetObjCmd, TclCompileUnsetCmd, NULL, 1}, - {"uplevel", Tcl_UplevelObjCmd, NULL, TclNRUplevelObjCmd, 1}, - {"upvar", Tcl_UpvarObjCmd, TclCompileUpvarCmd, NULL, 1}, - {"variable", Tcl_VariableObjCmd, TclCompileVariableCmd, NULL, 1}, - {"while", Tcl_WhileObjCmd, TclCompileWhileCmd, TclNRWhileObjCmd, 1}, - {"yield", NULL, TclCompileYieldCmd, TclNRYieldObjCmd, 1}, - {"yieldto", NULL, NULL, TclNRYieldToObjCmd, 1}, + {"catch", Tcl_CatchObjCmd, TclCompileCatchCmd, TclNRCatchObjCmd, CMD_IS_SAFE}, + {"concat", Tcl_ConcatObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"continue", Tcl_ContinueObjCmd, TclCompileContinueCmd, NULL, CMD_IS_SAFE}, + {"coroutine", NULL, NULL, TclNRCoroutineObjCmd, CMD_IS_SAFE}, + {"error", Tcl_ErrorObjCmd, TclCompileErrorCmd, NULL, CMD_IS_SAFE}, + {"eval", Tcl_EvalObjCmd, NULL, TclNREvalObjCmd, CMD_IS_SAFE}, + {"expr", Tcl_ExprObjCmd, TclCompileExprCmd, TclNRExprObjCmd, CMD_IS_SAFE}, + {"for", Tcl_ForObjCmd, TclCompileForCmd, TclNRForObjCmd, CMD_IS_SAFE}, + {"foreach", Tcl_ForeachObjCmd, TclCompileForeachCmd, TclNRForeachCmd, CMD_IS_SAFE}, + {"format", Tcl_FormatObjCmd, TclCompileFormatCmd, NULL, CMD_IS_SAFE}, + {"global", Tcl_GlobalObjCmd, TclCompileGlobalCmd, NULL, CMD_IS_SAFE}, + {"if", Tcl_IfObjCmd, TclCompileIfCmd, TclNRIfObjCmd, CMD_IS_SAFE}, + {"incr", Tcl_IncrObjCmd, TclCompileIncrCmd, NULL, CMD_IS_SAFE}, + {"join", Tcl_JoinObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"lappend", Tcl_LappendObjCmd, TclCompileLappendCmd, NULL, CMD_IS_SAFE}, + {"lassign", Tcl_LassignObjCmd, TclCompileLassignCmd, NULL, CMD_IS_SAFE}, + {"lindex", Tcl_LindexObjCmd, TclCompileLindexCmd, NULL, CMD_IS_SAFE}, + {"linsert", Tcl_LinsertObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"list", Tcl_ListObjCmd, TclCompileListCmd, NULL, CMD_IS_SAFE|CMD_COMPILES_EXPANDED}, + {"llength", Tcl_LlengthObjCmd, TclCompileLlengthCmd, NULL, CMD_IS_SAFE}, + {"lmap", Tcl_LmapObjCmd, TclCompileLmapCmd, TclNRLmapCmd, CMD_IS_SAFE}, + {"lrange", Tcl_LrangeObjCmd, TclCompileLrangeCmd, NULL, CMD_IS_SAFE}, + {"lrepeat", Tcl_LrepeatObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"lreplace", Tcl_LreplaceObjCmd, TclCompileLreplaceCmd, NULL, CMD_IS_SAFE}, + {"lreverse", Tcl_LreverseObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"lsearch", Tcl_LsearchObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"lset", Tcl_LsetObjCmd, TclCompileLsetCmd, NULL, CMD_IS_SAFE}, + {"lsort", Tcl_LsortObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"package", Tcl_PackageObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"proc", Tcl_ProcObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"regexp", Tcl_RegexpObjCmd, TclCompileRegexpCmd, NULL, CMD_IS_SAFE}, + {"regsub", Tcl_RegsubObjCmd, TclCompileRegsubCmd, NULL, CMD_IS_SAFE}, + {"rename", Tcl_RenameObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"return", Tcl_ReturnObjCmd, TclCompileReturnCmd, NULL, CMD_IS_SAFE}, + {"scan", Tcl_ScanObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"set", Tcl_SetObjCmd, TclCompileSetCmd, NULL, CMD_IS_SAFE}, + {"split", Tcl_SplitObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"subst", Tcl_SubstObjCmd, TclCompileSubstCmd, TclNRSubstObjCmd, CMD_IS_SAFE}, + {"switch", Tcl_SwitchObjCmd, TclCompileSwitchCmd, TclNRSwitchObjCmd, CMD_IS_SAFE}, + {"tailcall", NULL, TclCompileTailcallCmd, TclNRTailcallObjCmd, CMD_IS_SAFE}, + {"throw", Tcl_ThrowObjCmd, TclCompileThrowCmd, NULL, CMD_IS_SAFE}, + {"trace", Tcl_TraceObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"try", Tcl_TryObjCmd, TclCompileTryCmd, TclNRTryObjCmd, CMD_IS_SAFE}, + {"unset", Tcl_UnsetObjCmd, TclCompileUnsetCmd, NULL, CMD_IS_SAFE}, + {"uplevel", Tcl_UplevelObjCmd, NULL, TclNRUplevelObjCmd, CMD_IS_SAFE}, + {"upvar", Tcl_UpvarObjCmd, TclCompileUpvarCmd, NULL, CMD_IS_SAFE}, + {"variable", Tcl_VariableObjCmd, TclCompileVariableCmd, NULL, CMD_IS_SAFE}, + {"while", Tcl_WhileObjCmd, TclCompileWhileCmd, TclNRWhileObjCmd, CMD_IS_SAFE}, + {"yield", NULL, TclCompileYieldCmd, TclNRYieldObjCmd, CMD_IS_SAFE}, + {"yieldto", NULL, NULL, TclNRYieldToObjCmd, CMD_IS_SAFE}, /* * Commands in the OS-interface. Note that many of these are unsafe. */ - {"after", Tcl_AfterObjCmd, NULL, NULL, 1}, + {"after", Tcl_AfterObjCmd, NULL, NULL, CMD_IS_SAFE}, {"cd", Tcl_CdObjCmd, NULL, NULL, 0}, - {"close", Tcl_CloseObjCmd, NULL, NULL, 1}, - {"eof", Tcl_EofObjCmd, NULL, NULL, 1}, + {"close", Tcl_CloseObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"eof", Tcl_EofObjCmd, NULL, NULL, CMD_IS_SAFE}, {"encoding", Tcl_EncodingObjCmd, NULL, NULL, 0}, {"exec", Tcl_ExecObjCmd, NULL, NULL, 0}, {"exit", Tcl_ExitObjCmd, NULL, NULL, 0}, - {"fblocked", Tcl_FblockedObjCmd, NULL, NULL, 1}, + {"fblocked", Tcl_FblockedObjCmd, NULL, NULL, CMD_IS_SAFE}, {"fconfigure", Tcl_FconfigureObjCmd, NULL, NULL, 0}, - {"fcopy", Tcl_FcopyObjCmd, NULL, NULL, 1}, - {"fileevent", Tcl_FileEventObjCmd, NULL, NULL, 1}, - {"flush", Tcl_FlushObjCmd, NULL, NULL, 1}, - {"gets", Tcl_GetsObjCmd, NULL, NULL, 1}, + {"fcopy", Tcl_FcopyObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"fileevent", Tcl_FileEventObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"flush", Tcl_FlushObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"gets", Tcl_GetsObjCmd, NULL, NULL, CMD_IS_SAFE}, {"glob", Tcl_GlobObjCmd, NULL, NULL, 0}, {"load", Tcl_LoadObjCmd, NULL, NULL, 0}, {"open", Tcl_OpenObjCmd, NULL, NULL, 0}, - {"pid", Tcl_PidObjCmd, NULL, NULL, 1}, - {"puts", Tcl_PutsObjCmd, NULL, NULL, 1}, + {"pid", Tcl_PidObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"puts", Tcl_PutsObjCmd, NULL, NULL, CMD_IS_SAFE}, {"pwd", Tcl_PwdObjCmd, NULL, NULL, 0}, - {"read", Tcl_ReadObjCmd, NULL, NULL, 1}, - {"seek", Tcl_SeekObjCmd, NULL, NULL, 1}, + {"read", Tcl_ReadObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"seek", Tcl_SeekObjCmd, NULL, NULL, CMD_IS_SAFE}, {"socket", Tcl_SocketObjCmd, NULL, NULL, 0}, {"source", Tcl_SourceObjCmd, NULL, TclNRSourceObjCmd, 0}, - {"tell", Tcl_TellObjCmd, NULL, NULL, 1}, - {"time", Tcl_TimeObjCmd, NULL, NULL, 1}, + {"tell", Tcl_TellObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"time", Tcl_TimeObjCmd, NULL, NULL, CMD_IS_SAFE}, {"unload", Tcl_UnloadObjCmd, NULL, NULL, 0}, - {"update", Tcl_UpdateObjCmd, NULL, NULL, 1}, - {"vwait", Tcl_VwaitObjCmd, NULL, NULL, 1}, + {"update", Tcl_UpdateObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"vwait", Tcl_VwaitObjCmd, NULL, NULL, CMD_IS_SAFE}, {NULL, NULL, NULL, NULL, 0} }; @@ -768,6 +773,9 @@ Tcl_CreateInterp(void) cmdPtr->deleteProc = NULL; cmdPtr->deleteData = NULL; cmdPtr->flags = 0; + if (cmdInfoPtr->flags & CMD_COMPILES_EXPANDED) { + cmdPtr->flags |= CMD_COMPILES_EXPANDED; + } cmdPtr->importRefPtr = NULL; cmdPtr->tracePtr = NULL; cmdPtr->nreProc = cmdInfoPtr->nreProc; @@ -1000,7 +1008,7 @@ TclHideUnsafeCommands( return TCL_ERROR; } for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) { - if (!cmdInfoPtr->isSafe) { + if (!(cmdInfoPtr->flags & CMD_IS_SAFE)) { Tcl_HideCommand(interp, cmdInfoPtr->name, cmdInfoPtr->name); } } diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index c2495bd..a5678bf 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -4466,7 +4466,7 @@ TclCompileListCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *valueTokenPtr; - int i, numWords; + int i, numWords, concat, build; Tcl_Obj *listObj, *objPtr; if (parsePtr->numWords == 1) { @@ -4521,11 +4521,46 @@ TclCompileListCmd( numWords = parsePtr->numWords; valueTokenPtr = TokenAfter(parsePtr->tokenPtr); + concat = build = 0; for (i = 1; i < numWords; i++) { + if (valueTokenPtr->type == TCL_TOKEN_EXPAND_WORD && build > 0) { + TclEmitInstInt4( INST_LIST, build, envPtr); + if (concat) { + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + } + build = 0; + concat = 1; + } CompileWord(envPtr, valueTokenPtr, interp, i); + if (valueTokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + if (concat) { + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + } else { + concat = 1; + } + } else { + build++; + } valueTokenPtr = TokenAfter(valueTokenPtr); } - TclEmitInstInt4( INST_LIST, numWords - 1, envPtr); + if (build > 0) { + TclEmitInstInt4( INST_LIST, build, envPtr); + if (concat) { + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + } + } + + /* + * If there was just one expanded word, we must ensure that it is a list + * at this point. We use an [lrange ... 0 end] for this (instead of + * [llength], as with literals) as we must drop any string representation + * that might be hanging around. + */ + + if (concat && numWords == 2) { + TclEmitInstInt4( INST_LIST_RANGE_IMM, 0, envPtr); + TclEmitInt4( -2, envPtr); + } return TCL_OK; } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 7f6b7d4..1572576 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -280,12 +280,11 @@ const InstructionDesc const tclInstructionTable[] = { /* Binary exponentiation operator: push (stknext ** stktop) */ /* - * NOTE: the stack effects of expandStkTop, invokeExpanded and - * listExpanded are wrong - but it cannot be done right at compile time, - * the stack effect is only known at run time. The value for both - * invokeExpanded and listExpanded are estimated better at compile time. - * See the comments further down in this file, where INST_INVOKE_EXPANDED - * and INST_LIST_EXPANDED are emitted. + * NOTE: the stack effects of expandStkTop and invokeExpanded are wrong - + * but it cannot be done right at compile time, the stack effect is only + * known at run time. The value for invokeExpanded is estimated better at + * compile time. See the comments further down in this file, where + * INST_INVOKE_EXPANDED is emitted. */ {"expandStart", 1, 0, 0, {OPERAND_NONE}}, /* Start of command with {*} (expanded) arguments */ @@ -539,8 +538,6 @@ const InstructionDesc const tclInstructionTable[] = { /* Concatenates the two lists at the top of the stack into a single * list and pushes that resulting list onto the stack. * Stack: ... list1 list2 => ... [lconcat list1 list2] */ - {"listExpanded", 1, 0, 0, {OPERAND_NONE}}, - /* Construct a list from the words marked by the last 'expandStart' */ {NULL, 0, 0, 0, {OPERAND_NONE}} }; @@ -559,6 +556,8 @@ static void EnterCmdExtentData(CompileEnv *envPtr, int cmdNumber, int numSrcBytes, int numCodeBytes); static void EnterCmdStartData(CompileEnv *envPtr, int cmdNumber, int srcOffset, int codeOffset); +static Command * FindCommandFromToken(Tcl_Interp *interp, + Tcl_Token *tokenPtr, Tcl_Namespace *namespacePtr); static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); @@ -1775,6 +1774,49 @@ TclWordKnownAtCompileTime( } /* + * --------------------------------------------------------------------- + * + * FindCommandFromToken -- + * + * A simple helper that looks up a command's compiler from its token. + * + * --------------------------------------------------------------------- + */ + +static Command * +FindCommandFromToken( + Tcl_Interp *interp, + Tcl_Token *tokenPtr, + Tcl_Namespace *namespacePtr) +{ + Tcl_DString ds; + Command *cmdPtr; + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return NULL; + } + + /* + * We copy the string before trying to find the command by name. We used + * to modify the string in place, but this is not safe because the name + * resolution handlers could have side effects that rely on the unmodified + * string. + */ + + Tcl_DStringInit(&ds); + TclDStringAppendToken(&ds, &tokenPtr[1]); + cmdPtr = (Command *) Tcl_FindCommand(interp, Tcl_DStringValue(&ds), + namespacePtr, /*flags*/ 0); + if (cmdPtr != NULL && (cmdPtr->compileProc == NULL + || (cmdPtr->nsPtr->flags & NS_SUPPRESS_COMPILATION) + || (cmdPtr->flags & CMD_HAS_EXEC_TRACES))) { + cmdPtr = NULL; + } + Tcl_DStringFree(&ds); + return cmdPtr; +} + +/* *---------------------------------------------------------------------- * * TclCompileScript -- @@ -1816,7 +1858,6 @@ TclCompileScript( Command *cmdPtr; Tcl_Token *tokenPtr; int bytesLeft, isFirstCmd, wordIdx, currCmdIndex, commandLength, objIndex; - Tcl_DString ds; /* TIP #280 */ ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; int *wlines, wlineat, cmdLine, *clNext; @@ -1826,8 +1867,6 @@ TclCompileScript( Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); } - Tcl_DStringInit(&ds); - if (numBytes < 0) { numBytes = strlen(script); } @@ -1877,15 +1916,9 @@ TclCompileScript( parsePtr->commandStart - envPtr->source); if (parsePtr->numWords > 0) { - int expand = 0; /* Set if there are dynamic expansions to + int expand = 0; /* Set to the relevant expansion instruction + * if there are dynamic expansions to * handle */ - int expandIgnoredWords = 0; - /* The number of *apparent* words that we are - * generating code from directly during - * expansion processing. For [list {*}blah] - * expansion, we set this to one because we - * ignore the first word and generate code - * directly. */ /* * If not the first command, pop the previous command's result @@ -1943,6 +1976,22 @@ TclCompileScript( } } + /* + * If expansion was requested, check if the command declares that + * it knows how to compile it. Note that if expansion is requested + * for the first word, this check will fail as the token type will + * inhibit it. (That check is done inside FindCommandFromToken.) + * This is as it should be. + */ + + if (expand) { + cmdPtr = FindCommandFromToken(interp, parsePtr->tokenPtr, + (Tcl_Namespace *) cmdNsPtr); + if (cmdPtr && (cmdPtr->flags & CMD_COMPILES_EXPANDED)) { + expand = 0; + } + } + envPtr->numCommands++; currCmdIndex = envPtr->numCommands - 1; lastTopLevelCmdIndex = currCmdIndex; @@ -1991,7 +2040,7 @@ TclCompileScript( TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents, envPtr); - if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + if (expand && tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { TclEmitInstInt4(INST_EXPAND_STKTOP, envPtr->currStackDepth, envPtr); } @@ -2006,24 +2055,10 @@ TclCompileScript( */ if ((wordIdx == 0) && !expand) { - /* - * We copy the string before trying to find the command by - * name. We used to modify the string in place, but this - * is not safe because the name resolution handlers could - * have side effects that rely on the unmodified string. - */ - - TclDStringClear(&ds); - TclDStringAppendToken(&ds, &tokenPtr[1]); - - cmdPtr = (Command *) Tcl_FindCommand(interp, - Tcl_DStringValue(&ds), - (Tcl_Namespace *) cmdNsPtr, /*flags*/ 0); + cmdPtr = FindCommandFromToken(interp, tokenPtr, + (Tcl_Namespace *) cmdNsPtr); if ((cmdPtr != NULL) - && (cmdPtr->compileProc != NULL) - && !(cmdPtr->nsPtr->flags&NS_SUPPRESS_COMPILATION) - && !(cmdPtr->flags & CMD_HAS_EXEC_TRACES) && !(iPtr->flags & DONT_COMPILE_CMDS_INLINE)) { int code, savedNumCmds = envPtr->numCommands; unsigned savedCodeNext = @@ -2148,26 +2183,6 @@ TclCompileScript( TclFetchLiteral(envPtr, objIndex), cmdPtr); } } else { - if (wordIdx == 0 && expand) { - TclDStringClear(&ds); - TclDStringAppendToken(&ds, &tokenPtr[1]); - cmdPtr = (Command *) Tcl_FindCommand(interp, - Tcl_DStringValue(&ds), - (Tcl_Namespace *) cmdNsPtr, /*flags*/ 0); - if ((cmdPtr != NULL) && - (cmdPtr->compileProc == TclCompileListCmd)) { - /* - * Special case! [list] command can be expanded - * directly provided the first word is not the - * expanded one. - */ - - expand = INST_LIST_EXPANDED; - expandIgnoredWords = 1; - continue; - } - } - /* * Simple argument word of a command. We reach this if and * only if the command word was not compiled for whatever @@ -2211,12 +2226,12 @@ TclCompileScript( * is being prepared and run, INST_EXPAND_STKTOP is not * stack-neutral in general. * - * The opcodes that may be issued here (both assumed to be - * non-zero) are INST_INVOKE_EXPANDED and INST_LIST_EXPANDED. + * The opcode that may be issued here (assumed to be non-zero) + * is INST_INVOKE_EXPANDED. */ TclEmitOpcode(expand, envPtr); - TclAdjustStackDepth(1 + expandIgnoredWords - wordIdx, envPtr); + TclAdjustStackDepth(1 - wordIdx, envPtr); } else if (wordIdx > 0) { /* * Save PC -> command map for the TclArgumentBC* functions. @@ -2292,7 +2307,6 @@ TclCompileScript( envPtr->numSrcBytes = p - script; TclStackFree(interp, parsePtr); - Tcl_DStringFree(&ds); } /* diff --git a/generic/tclCompile.h b/generic/tclCompile.h index c68d3ec..bf00df9 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -716,10 +716,9 @@ typedef struct ByteCode { #define INST_INVOKE_REPLACE 163 #define INST_LIST_CONCAT 164 -#define INST_LIST_EXPANDED 165 /* The last opcode */ -#define LAST_INST_OPCODE 165 +#define LAST_INST_OPCODE 164 /* * Table describing the Tcl bytecode instructions: their name (for displaying diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f994ba5..c7817f8 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -4437,18 +4437,6 @@ TEBCresume( TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(5, opnd, 1); - case INST_LIST_EXPANDED: - CLANG_ASSERT(auxObjList); - objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value; - POP_TAUX_OBJ(); - objResultPtr = Tcl_NewListObj(objc, &OBJ_AT_DEPTH(objc-1)); - TRACE_WITH_OBJ(("(%u) => ", objc), objResultPtr); - while (objc--) { - valuePtr = POP_OBJECT(); - TclDecrRefCount(valuePtr); - } - NEXT_INST_F(1, 0, 1); - case INST_LIST_LENGTH: valuePtr = OBJ_AT_TOS; if (TclListObjLength(interp, valuePtr, &length) != TCL_OK) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 5b113bf..9e1ba09 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1681,6 +1681,9 @@ typedef struct Command { * CMD_HAS_EXEC_TRACES - 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 + * can handle expansion (provided it is not the + * first word). * TCL_TRACE_RENAME - A rename trace is in progress. Further * recursive renames will not be traced. * TCL_TRACE_DELETE - A delete trace is in progress. Further @@ -1691,6 +1694,7 @@ typedef struct Command { #define CMD_IS_DELETED 0x1 #define CMD_TRACE_ACTIVE 0x2 #define CMD_HAS_EXEC_TRACES 0x4 +#define CMD_COMPILES_EXPANDED 0x8 /* *---------------------------------------------------------------- -- cgit v0.12 From 3c57bdf2836715776785db896771e09c365b0b10 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 15 May 2013 10:56:41 +0000 Subject: Removing a few changes that were not actually needed, and correcting comments. --- generic/tclAssembly.c | 2 +- generic/tclCompile.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index cd2ad13..fff7b43 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -20,7 +20,7 @@ *- break and continue - if exception ranges can be sorted out. *- foreach_start4, foreach_step4 *- returnImm, returnStk - *- expandStart, expandStkTop, invokeExpanded, listExpanded + *- expandStart, expandStkTop, invokeExpanded *- dictFirst, dictNext, dictDone *- dictUpdateStart, dictUpdateEnd *- jumpTable testing diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6d07189..1d1a680 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -283,8 +283,9 @@ const InstructionDesc const tclInstructionTable[] = { * NOTE: the stack effects of expandStkTop and invokeExpanded are wrong - * but it cannot be done right at compile time, the stack effect is only * known at run time. The value for invokeExpanded is estimated better at - * compile time. See the comments further down in this file, where - * INST_INVOKE_EXPANDED is emitted. + * compile time. + * See the comments further down in this file, where INST_INVOKE_EXPANDED + * is emitted. */ {"expandStart", 1, 0, 0, {OPERAND_NONE}}, /* Start of command with {*} (expanded) arguments */ @@ -1916,8 +1917,7 @@ TclCompileScript( parsePtr->commandStart - envPtr->source); if (parsePtr->numWords > 0) { - int expand = 0; /* Set to the relevant expansion instruction - * if there are dynamic expansions to + int expand = 0; /* Set if there are dynamic expansions to * handle */ /* @@ -1971,7 +1971,7 @@ TclCompileScript( wordIdx < parsePtr->numWords; wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - expand = INST_INVOKE_EXPANDED; + expand = 1; break; } } @@ -2225,12 +2225,9 @@ TclCompileScript( * Note that the estimates are not correct while the command * is being prepared and run, INST_EXPAND_STKTOP is not * stack-neutral in general. - * - * The opcode that may be issued here (assumed to be non-zero) - * is INST_INVOKE_EXPANDED. */ - TclEmitOpcode(expand, envPtr); + TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); TclAdjustStackDepth(1 - wordIdx, envPtr); } else if (wordIdx > 0) { /* -- cgit v0.12 From 6a8e707f9e6b7d108220a53ab44030604a690801 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 15 May 2013 15:18:00 +0000 Subject: Disabled some code in TclCompileScript(). Test suite results are unaffected. Does this indicate a gap in the test suite, or is this code truly useless? --- generic/tclCompile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 1d1a680..8891d3f 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1855,7 +1855,7 @@ TclCompileScript( * code. Init. to avoid compiler warning. */ unsigned char *entryCodeNext = envPtr->codeNext; const char *p, *next; - Namespace *cmdNsPtr; + Namespace *cmdNsPtr = NULL; Command *cmdPtr; Tcl_Token *tokenPtr; int bytesLeft, isFirstCmd, wordIdx, currCmdIndex, commandLength, objIndex; @@ -1874,11 +1874,13 @@ TclCompileScript( Tcl_ResetResult(interp); isFirstCmd = 1; +#if 0 if (envPtr->procPtr != NULL) { cmdNsPtr = envPtr->procPtr->cmdPtr->nsPtr; } else { cmdNsPtr = NULL; /* use current NS */ } +#endif /* * Each iteration through the following loop compiles the next command -- cgit v0.12 From 666ba89bc057e3cb71acbd5c7d983d4579969428 Mon Sep 17 00:00:00 2001 From: andreask Date: Wed, 15 May 2013 16:46:15 +0000 Subject: Fix platform version mismatch between code and index. --- library/platform/pkgIndex.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/platform/pkgIndex.tcl b/library/platform/pkgIndex.tcl index b882e4f..23a3408 100644 --- a/library/platform/pkgIndex.tcl +++ b/library/platform/pkgIndex.tcl @@ -1,3 +1,3 @@ -package ifneeded platform 1.0.11 [list source [file join $dir platform.tcl]] +package ifneeded platform 1.0.12 [list source [file join $dir platform.tcl]] package ifneeded platform::shell 1.1.4 [list source [file join $dir shell.tcl]] -- cgit v0.12 From 880f2f98f5cb2c020219b568c53c4e03d4d28633 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 16 May 2013 08:20:16 +0000 Subject: Add support for the latest mingw-4.0-rc1. See: [http://sourceforge.net/p/mingw/mingw-org-wsl/ci/4.0-rc1/tree/NEWS] --- ChangeLog | 8 ++++++++ generic/tclBasic.c | 15 +++++++++++++++ win/configure | 3 +++ win/tcl.m4 | 2 ++ 4 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index e200cd0..507c5d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-05-16 Jan Nijtmans + + * win/tcl.m4: Add support for the latest mingw-4.0-rc1. + * win/configure: (regenerated) + * generic/tclBasic.c: Add panic in order to detect + incompatible mingw32 sys/stat.h and sys/time.h headers, + (which is fixed by defining _HAVE_32BIT_TIME_T). + 2013-05-06 Jan Nijtmans * generic/tclStubInit.c: Add support for Cygwin64, which has a 64-bit diff --git a/generic/tclBasic.c b/generic/tclBasic.c index bd4ad5d..0fd025a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -15,6 +15,10 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#if defined(_WIN32) && !defined(_WIN64) +# define _USE_32BIT_TIME_T +#endif + #include "tclInt.h" #include "tclCompile.h" #ifndef TCL_GENERIC_ONLY @@ -312,6 +316,17 @@ Tcl_CreateInterp() panic("Tcl_CallFrame must not be smaller than CallFrame"); } +#if defined(_WIN32) && !defined(_WIN64) + if (sizeof(time_t) != 4) { + /*NOTREACHED*/ + Tcl_Panic("sys/time.h is not compatible with MSVC"); + } + if (sizeof(Tcl_StatBuf) != 48) { + /*NOTREACHED*/ + Tcl_Panic("sys/stat.h is not compatible with MSVC"); + } +#endif + /* * Initialize support for namespaces and create the global namespace * (whose name is ""; an alias is "::"). This also initializes the diff --git a/win/configure b/win/configure index 0f36f24..cfd28d3 100755 --- a/win/configure +++ b/win/configure @@ -1744,6 +1744,9 @@ echo "$ac_t""$tcl_cv_seh" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_NO_SEH 1 EOF + cat >> confdefs.h <<\EOF +#define _HAVE_32BIT_TIME_T 1 +EOF fi diff --git a/win/tcl.m4 b/win/tcl.m4 index 7c55fc9..e6b6714 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -989,6 +989,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$tcl_cv_seh" = "no" ; then AC_DEFINE(HAVE_NO_SEH, 1, [Defined when mingw does not support SEH]) + AC_DEFINE(_HAVE_32BIT_TIME_T, 1, + [Defined for mingw to use pre-2005 time API]) fi # -- cgit v0.12 From 303d07068735830dccf5632f8be0b526aa63837b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 16 May 2013 12:28:33 +0000 Subject: _USE_32BIT_TIME_T is already defined in tclWinPort.h --- generic/tclBasic.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index c691018..5e6b500 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -15,10 +15,6 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#if defined(_WIN32) && !defined(_WIN64) -# define _USE_32BIT_TIME_T -#endif - #include "tclInt.h" #include "tclCompile.h" #include -- cgit v0.12 From abe2d748971526df4beda6bdf4f59bef33e6e1c5 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 16 May 2013 13:24:28 +0000 Subject: Confirmed that every caller of TclProcCompileProc() arranges for the procPtr and nsPtr arguments: nsPtr == procPtr->cmdPtr->nsPtr. This makes the test in TclCompileScript() useless. TCS() will always compile in the current namespace of the interp. Remove the code that obfuscates that fact. --- generic/tclCompile.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 8891d3f..cb1f806 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1855,7 +1855,6 @@ TclCompileScript( * code. Init. to avoid compiler warning. */ unsigned char *entryCodeNext = envPtr->codeNext; const char *p, *next; - Namespace *cmdNsPtr = NULL; Command *cmdPtr; Tcl_Token *tokenPtr; int bytesLeft, isFirstCmd, wordIdx, currCmdIndex, commandLength, objIndex; @@ -1874,14 +1873,6 @@ TclCompileScript( Tcl_ResetResult(interp); isFirstCmd = 1; -#if 0 - if (envPtr->procPtr != NULL) { - cmdNsPtr = envPtr->procPtr->cmdPtr->nsPtr; - } else { - cmdNsPtr = NULL; /* use current NS */ - } -#endif - /* * Each iteration through the following loop compiles the next command * from the script. @@ -1988,7 +1979,7 @@ TclCompileScript( if (expand) { cmdPtr = FindCommandFromToken(interp, parsePtr->tokenPtr, - (Tcl_Namespace *) cmdNsPtr); + (Tcl_Namespace *) NULL); if (cmdPtr && (cmdPtr->flags & CMD_COMPILES_EXPANDED)) { expand = 0; } @@ -2058,7 +2049,7 @@ TclCompileScript( if ((wordIdx == 0) && !expand) { cmdPtr = FindCommandFromToken(interp, tokenPtr, - (Tcl_Namespace *) cmdNsPtr); + (Tcl_Namespace *) NULL); if ((cmdPtr != NULL) && !(iPtr->flags & DONT_COMPILE_CMDS_INLINE)) { -- cgit v0.12 From 81cee941ae3a471340b22bb98d5b7f66a283cd16 Mon Sep 17 00:00:00 2001 From: andreask Date: Thu, 16 May 2013 17:39:44 +0000 Subject: Sigh. Fix version number of package "platform" in the Makefile.n files. Future: Write a small tcl script tool to extract the version information directly from the code. --- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 071cf94..22656d5 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -778,8 +778,8 @@ install-libraries: libraries $(INSTALL_TZDATA) install-msgs @echo "Installing package tcltest 2.3.5 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.3.5.tm; - @echo "Installing package platform 1.0.11 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.11.tm; + @echo "Installing package platform 1.0.12 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.12.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform/shell-1.1.4.tm; diff --git a/win/Makefile.in b/win/Makefile.in index fec5ff6..3ac7f43 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -653,8 +653,8 @@ install-libraries: libraries install-tzdata install-msgs @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.5.1.tm; @echo "Installing package tcltest 2.3.5 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.3.5.tm; - @echo "Installing package platform 1.0.11 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.11.tm; + @echo "Installing package platform 1.0.12 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.12.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm; @echo "Installing encodings"; -- cgit v0.12 From feb5958816bb507f819c42a0b5b77dc7001a76cd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 May 2013 07:14:13 +0000 Subject: Revert defining _HAVE_32BIT_TIME_T especially for mingw-4.0-rc1: Although it works, it has the side-effect that tcl8?.dll depends on msvcrt.dll symbols which are only available in later versions of msvcrt.dll. This is undesired, it really should be fixed in the mingw headers. --- ChangeLog | 3 --- win/configure | 3 --- win/tcl.m4 | 2 -- 3 files changed, 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 507c5d9..b38a105 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,7 @@ 2013-05-16 Jan Nijtmans - * win/tcl.m4: Add support for the latest mingw-4.0-rc1. - * win/configure: (regenerated) * generic/tclBasic.c: Add panic in order to detect incompatible mingw32 sys/stat.h and sys/time.h headers, - (which is fixed by defining _HAVE_32BIT_TIME_T). 2013-05-06 Jan Nijtmans diff --git a/win/configure b/win/configure index cfd28d3..0f36f24 100755 --- a/win/configure +++ b/win/configure @@ -1744,9 +1744,6 @@ echo "$ac_t""$tcl_cv_seh" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_NO_SEH 1 EOF - cat >> confdefs.h <<\EOF -#define _HAVE_32BIT_TIME_T 1 -EOF fi diff --git a/win/tcl.m4 b/win/tcl.m4 index e6b6714..7c55fc9 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -989,8 +989,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$tcl_cv_seh" = "no" ; then AC_DEFINE(HAVE_NO_SEH, 1, [Defined when mingw does not support SEH]) - AC_DEFINE(_HAVE_32BIT_TIME_T, 1, - [Defined for mingw to use pre-2005 time API]) fi # -- cgit v0.12 From 2e2a7f14b404980bdc7423407ddb866901ca14a5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 May 2013 15:08:48 +0000 Subject: - eliminate compiler warning when compiling with Visual Studio. - Make sure that _ftime() from msvcrt.dll is used, not ftime() from mingw (which might use 64-bit time_t) --- generic/tclBasic.c | 1 + win/tclWinTime.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 0fd025a..757f9ca 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -19,6 +19,7 @@ # define _USE_32BIT_TIME_T #endif +#include #include "tclInt.h" #include "tclCompile.h" #ifndef TCL_GENERIC_ONLY diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 8bbd8fd..8fdc071 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -258,7 +258,7 @@ void Tcl_GetTime(timePtr) Tcl_Time *timePtr; /* Location to store time information. */ { - struct timeb t; + struct _timeb t; int useFtime = 1; /* Flag == TRUE if we need to fall back * on ftime rather than using the perf @@ -431,7 +431,7 @@ Tcl_GetTime(timePtr) if ( useFtime ) { /* High resolution timer is not available. Just use ftime */ - ftime(&t); + _ftime(&t); timePtr->sec = (long)t.time; timePtr->usec = t.millitm * 1000; } -- cgit v0.12 From 747454fc55e9245072dd7689c036322331e747f3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 May 2013 15:12:27 +0000 Subject: inclusion is only needed when compiling for Win32, don't bother for other platforms. --- generic/tclBasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 757f9ca..6e457c0 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -17,9 +17,9 @@ #if defined(_WIN32) && !defined(_WIN64) # define _USE_32BIT_TIME_T +# include #endif -#include #include "tclInt.h" #include "tclCompile.h" #ifndef TCL_GENERIC_ONLY -- cgit v0.12 From 4e4b54aad334a0c55a28cbc05206ded0cebb9dca Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 May 2013 13:25:11 +0000 Subject: Split tclCompCmds.c into two roughly-equal-sized pieces. --- ChangeLog | 9 +- generic/tclCompCmds.c | 2963 +------------------------------------------ generic/tclCompCmdsGR.c | 3244 +++++++++++++++++++++++++++++++++++++++++++++++ unix/Makefile.in | 14 +- win/Makefile.in | 1 + win/makefile.bc | 1 + win/makefile.vc | 1 + 7 files changed, 3295 insertions(+), 2938 deletions(-) create mode 100644 generic/tclCompCmdsGR.c diff --git a/ChangeLog b/ChangeLog index 99d9205..6b9f044 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ +2013-05-18 Donal K. Fellows + + * generic/tclCompCmdsGR.c: Split tclCompCmds.c again to keep size of + code down. + 2013-05-16 Jan Nijtmans - * generic/tclBasic.c: Add panic in order to detect - incompatible mingw32 sys/stat.h and sys/time.h headers, + * generic/tclBasic.c: Add panic in order to detect incompatible + mingw32 sys/stat.h and sys/time.h headers. 2013-05-13 Jan Nijtmans diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index a5678bf..2ac0fe3 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -7,7 +7,7 @@ * Copyright (c) 1997-1998 Sun Microsystems, Inc. * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2002 ActiveState Corporation. - * Copyright (c) 2004-2006 by Donal K. Fellows. + * Copyright (c) 2004-2013 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -31,11 +31,6 @@ static void FreeForeachInfo(ClientData clientData); static void PrintForeachInfo(ClientData clientData, Tcl_Obj *appendObj, ByteCode *codePtr, unsigned int pcOffset); -static void CompileReturnInternal(CompileEnv *envPtr, - unsigned char op, int code, int level, - Tcl_Obj *returnOpts); -static int IndexTailVarIfKnown(Tcl_Interp *interp, - Tcl_Token *varTokenPtr, CompileEnv *envPtr); static int PushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, @@ -2588,6 +2583,37 @@ TclCompileForeachCmd( /* *---------------------------------------------------------------------- * + * TclCompileLmapCmd -- + * + * Procedure called to compile the "lmap" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "lmap" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLmapCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + return CompileEachloopCmd(interp, parsePtr, cmdPtr, envPtr, + TCL_EACH_COLLECT); +} + +/* + *---------------------------------------------------------------------- + * * CompileEachloopCmd -- * * Procedure called to compile the "foreach" and "lmap" commands. @@ -3303,2931 +3329,6 @@ TclCompileFormatCmd( /* *---------------------------------------------------------------------- * - * TclCompileGlobalCmd -- - * - * Procedure called to compile the "global" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "global" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileGlobalCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *varTokenPtr; - int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ - - numWords = parsePtr->numWords; - if (numWords < 2) { - return TCL_ERROR; - } - - /* - * 'global' has no effect outside of proc bodies; handle that at runtime - */ - - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } - - /* - * Push the namespace - */ - - PushLiteral(envPtr, "::", 2); - - /* - * Loop over the variables. - */ - - varTokenPtr = TokenAfter(parsePtr->tokenPtr); - for (i=2; i<=numWords; varTokenPtr = TokenAfter(varTokenPtr),i++) { - localIndex = IndexTailVarIfKnown(interp, varTokenPtr, envPtr); - - if (localIndex < 0) { - return TCL_ERROR; - } - - CompileWord(envPtr, varTokenPtr, interp, 1); - TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); - } - - /* - * Pop the namespace, and set the result to empty - */ - - TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileIfCmd -- - * - * Procedure called to compile the "if" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "if" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileIfCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - JumpFixupArray jumpFalseFixupArray; - /* Used to fix the ifFalse jump after each - * test when its target PC is determined. */ - JumpFixupArray jumpEndFixupArray; - /* Used to fix the jump after each "then" body - * to the end of the "if" when that PC is - * determined. */ - Tcl_Token *tokenPtr, *testTokenPtr; - int jumpIndex = 0; /* Avoid compiler warning. */ - int jumpFalseDist, numWords, wordIdx, numBytes, j, code; - const char *word; - int savedStackDepth = envPtr->currStackDepth; - /* Saved stack depth at the start of the first - * test; the envPtr current depth is restored - * to this value at the start of each test. */ - int realCond = 1; /* Set to 0 for static conditions: - * "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 - * order to insure correct substitution [Bug 219166] - */ - - tokenPtr = parsePtr->tokenPtr; - wordIdx = 0; - numWords = parsePtr->numWords; - - for (wordIdx = 0; wordIdx < numWords; wordIdx++) { - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - tokenPtr = TokenAfter(tokenPtr); - } - - TclInitJumpFixupArray(&jumpFalseFixupArray); - TclInitJumpFixupArray(&jumpEndFixupArray); - code = TCL_OK; - - /* - * Each iteration of this loop compiles one "if expr ?then? body" or - * "elseif expr ?then? body" clause. - */ - - tokenPtr = parsePtr->tokenPtr; - wordIdx = 0; - while (wordIdx < numWords) { - /* - * Stop looping if the token isn't "if" or "elseif". - */ - - word = tokenPtr[1].start; - numBytes = tokenPtr[1].size; - if ((tokenPtr == parsePtr->tokenPtr) - || ((numBytes == 6) && (strncmp(word, "elseif", 6) == 0))) { - tokenPtr = TokenAfter(tokenPtr); - wordIdx++; - } else { - break; - } - if (wordIdx >= numWords) { - code = TCL_ERROR; - goto done; - } - - /* - * Compile the test expression then emit the conditional jump around - * the "then" part. - */ - - envPtr->currStackDepth = savedStackDepth; - testTokenPtr = tokenPtr; - - if (realCond) { - /* - * Find out if the condition is a constant. - */ - - Tcl_Obj *boolObj = Tcl_NewStringObj(testTokenPtr[1].start, - testTokenPtr[1].size); - - Tcl_IncrRefCount(boolObj); - code = Tcl_GetBooleanFromObj(NULL, boolObj, &boolVal); - TclDecrRefCount(boolObj); - if (code == TCL_OK) { - /* - * A static condition. - */ - - realCond = 0; - if (!boolVal) { - compileScripts = 0; - } - } else { - SetLineInformation(wordIdx); - Tcl_ResetResult(interp); - TclCompileExprWords(interp, testTokenPtr, 1, envPtr); - if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) { - TclExpandJumpFixupArray(&jumpFalseFixupArray); - } - jumpIndex = jumpFalseFixupArray.next; - jumpFalseFixupArray.next++; - TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, - jumpFalseFixupArray.fixup+jumpIndex); - } - code = TCL_OK; - } - - /* - * Skip over the optional "then" before the then clause. - */ - - tokenPtr = TokenAfter(testTokenPtr); - wordIdx++; - if (wordIdx >= numWords) { - code = TCL_ERROR; - goto done; - } - if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { - word = tokenPtr[1].start; - numBytes = tokenPtr[1].size; - if ((numBytes == 4) && (strncmp(word, "then", 4) == 0)) { - tokenPtr = TokenAfter(tokenPtr); - wordIdx++; - if (wordIdx >= numWords) { - code = TCL_ERROR; - goto done; - } - } - } - - /* - * Compile the "then" command body. - */ - - if (compileScripts) { - SetLineInformation(wordIdx); - envPtr->currStackDepth = savedStackDepth; - CompileBody(envPtr, tokenPtr, interp); - } - - if (realCond) { - /* - * Jump to the end of the "if" command. Both jumpFalseFixupArray - * and jumpEndFixupArray are indexed by "jumpIndex". - */ - - if (jumpEndFixupArray.next >= jumpEndFixupArray.end) { - TclExpandJumpFixupArray(&jumpEndFixupArray); - } - jumpEndFixupArray.next++; - TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, - jumpEndFixupArray.fixup+jumpIndex); - - /* - * Fix the target of the jumpFalse after the test. Generate a 4 - * byte jump if the distance is > 120 bytes. This is conservative, - * and ensures that we won't have to replace this jump if we later - * also need to replace the proceeding jump to the end of the "if" - * with a 4 byte jump. - */ - - if (TclFixupForwardJumpToHere(envPtr, - jumpFalseFixupArray.fixup+jumpIndex, 120)) { - /* - * Adjust the code offset for the proceeding jump to the end - * of the "if" command. - */ - - jumpEndFixupArray.fixup[jumpIndex].codeOffset += 3; - } - } else if (boolVal) { - /* - * We were processing an "if 1 {...}"; stop compiling scripts. - */ - - compileScripts = 0; - } else { - /* - * We were processing an "if 0 {...}"; reset so that the rest - * (elseif, else) is compiled correctly. - */ - - realCond = 1; - compileScripts = 1; - } - - tokenPtr = TokenAfter(tokenPtr); - wordIdx++; - } - - /* - * Restore the current stack depth in the environment; the "else" clause - * (or its default) will add 1 to this. - */ - - envPtr->currStackDepth = savedStackDepth; - - /* - * Check for the optional else clause. Do not compile anything if this was - * an "if 1 {...}" case. - */ - - if ((wordIdx < numWords) && (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD)) { - /* - * There is an else clause. Skip over the optional "else" word. - */ - - word = tokenPtr[1].start; - numBytes = tokenPtr[1].size; - if ((numBytes == 4) && (strncmp(word, "else", 4) == 0)) { - tokenPtr = TokenAfter(tokenPtr); - wordIdx++; - if (wordIdx >= numWords) { - code = TCL_ERROR; - goto done; - } - } - - if (compileScripts) { - /* - * Compile the else command body. - */ - - SetLineInformation(wordIdx); - CompileBody(envPtr, tokenPtr, interp); - } - - /* - * Make sure there are no words after the else clause. - */ - - wordIdx++; - if (wordIdx < numWords) { - code = TCL_ERROR; - goto done; - } - } else { - /* - * No else clause: the "if" command's result is an empty string. - */ - - if (compileScripts) { - PushLiteral(envPtr, "", 0); - } - } - - /* - * Fix the unconditional jumps to the end of the "if" command. - */ - - for (j = jumpEndFixupArray.next; j > 0; j--) { - jumpIndex = (j - 1); /* i.e. process the closest jump first. */ - if (TclFixupForwardJumpToHere(envPtr, - jumpEndFixupArray.fixup+jumpIndex, 127)) { - /* - * Adjust the immediately preceeding "ifFalse" jump. We moved it's - * target (just after this jump) down three bytes. - */ - - unsigned char *ifFalsePc = envPtr->codeStart - + jumpFalseFixupArray.fixup[jumpIndex].codeOffset; - unsigned char opCode = *ifFalsePc; - - if (opCode == INST_JUMP_FALSE1) { - jumpFalseDist = TclGetInt1AtPtr(ifFalsePc + 1); - jumpFalseDist += 3; - TclStoreInt1AtPtr(jumpFalseDist, (ifFalsePc + 1)); - } else if (opCode == INST_JUMP_FALSE4) { - jumpFalseDist = TclGetInt4AtPtr(ifFalsePc + 1); - jumpFalseDist += 3; - TclStoreInt4AtPtr(jumpFalseDist, (ifFalsePc + 1)); - } else { - Tcl_Panic("TclCompileIfCmd: unexpected opcode \"%d\" updating ifFalse jump", (int) opCode); - } - } - } - - /* - * Free the jumpFixupArray array if malloc'ed storage was used. - */ - - done: - envPtr->currStackDepth = savedStackDepth + 1; - TclFreeJumpFixupArray(&jumpFalseFixupArray); - TclFreeJumpFixupArray(&jumpEndFixupArray); - return code; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileIncrCmd -- - * - * Procedure called to compile the "incr" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "incr" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileIncrCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *varTokenPtr, *incrTokenPtr; - int simpleVarName, isScalar, localIndex, haveImmValue, immValue; - DefineLineInformation; /* TIP #280 */ - - if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { - return TCL_ERROR; - } - - varTokenPtr = TokenAfter(parsePtr->tokenPtr); - - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_LARGE_INDEX, - &localIndex, &simpleVarName, &isScalar, 1); - - /* - * If an increment is given, push it, but see first if it's a small - * integer. - */ - - haveImmValue = 0; - immValue = 1; - if (parsePtr->numWords == 3) { - incrTokenPtr = TokenAfter(varTokenPtr); - if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { - const char *word = incrTokenPtr[1].start; - int numBytes = incrTokenPtr[1].size; - int code; - Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes); - - Tcl_IncrRefCount(intObj); - code = TclGetIntFromObj(NULL, intObj, &immValue); - TclDecrRefCount(intObj); - if ((code == TCL_OK) && (-127 <= immValue) && (immValue <= 127)) { - haveImmValue = 1; - } - if (!haveImmValue) { - PushLiteral(envPtr, word, numBytes); - } - } else { - SetLineInformation(2); - CompileTokens(envPtr, incrTokenPtr, interp); - } - } else { /* No incr amount given so use 1. */ - haveImmValue = 1; - } - - /* - * Emit the instruction to increment the variable. - */ - - if (!simpleVarName) { - if (haveImmValue) { - TclEmitInstInt1( INST_INCR_STK_IMM, immValue, envPtr); - } else { - TclEmitOpcode( INST_INCR_STK, envPtr); - } - } else if (isScalar) { /* Simple scalar variable. */ - if (localIndex >= 0) { - if (haveImmValue) { - TclEmitInstInt1(INST_INCR_SCALAR1_IMM, localIndex, envPtr); - TclEmitInt1(immValue, envPtr); - } else { - TclEmitInstInt1(INST_INCR_SCALAR1, localIndex, envPtr); - } - } else { - if (haveImmValue) { - TclEmitInstInt1(INST_INCR_SCALAR_STK_IMM, immValue, envPtr); - } else { - TclEmitOpcode( INST_INCR_SCALAR_STK, envPtr); - } - } - } else { /* Simple array variable. */ - if (localIndex >= 0) { - if (haveImmValue) { - TclEmitInstInt1(INST_INCR_ARRAY1_IMM, localIndex, envPtr); - TclEmitInt1(immValue, envPtr); - } else { - TclEmitInstInt1(INST_INCR_ARRAY1, localIndex, envPtr); - } - } else { - if (haveImmValue) { - TclEmitInstInt1(INST_INCR_ARRAY_STK_IMM, immValue, envPtr); - } else { - TclEmitOpcode( INST_INCR_ARRAY_STK, envPtr); - } - } - } - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileInfo*Cmd -- - * - * Procedures called to compile "info" subcommands. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "info" subcommand at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileInfoCommandsCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) -{ - DefineLineInformation; /* TIP #280 */ - Tcl_Token *tokenPtr; - Tcl_Obj *objPtr; - char *bytes; - - /* - * We require one compile-time known argument for the case we can compile. - */ - - if (parsePtr->numWords == 1) { - return TclCompileBasic0ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } else if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - tokenPtr = TokenAfter(parsePtr->tokenPtr); - objPtr = Tcl_NewObj(); - Tcl_IncrRefCount(objPtr); - if (!TclWordKnownAtCompileTime(tokenPtr, objPtr)) { - goto notCompilable; - } - bytes = Tcl_GetString(objPtr); - - /* - * We require that the argument start with "::" and not have any of "*\[?" - * in it. (Theoretically, we should look in only the final component, but - * the difference is so slight given current naming practices.) - */ - - if (bytes[0] != ':' || bytes[1] != ':' || !TclMatchIsTrivial(bytes)) { - goto notCompilable; - } - Tcl_DecrRefCount(objPtr); - - /* - * Confirmed as a literal that will not frighten the horses. Compile. Note - * that the result needs to be list-ified. - */ - - CompileWord(envPtr, tokenPtr, interp, 1); - TclEmitOpcode( INST_RESOLVE_COMMAND, envPtr); - TclEmitOpcode( INST_DUP, envPtr); - TclEmitOpcode( INST_STR_LEN, envPtr); - TclEmitInstInt1( INST_JUMP_FALSE1, 7, envPtr); - TclEmitInstInt4( INST_LIST, 1, envPtr); - return TCL_OK; - - notCompilable: - Tcl_DecrRefCount(objPtr); - return TclCompileBasic1ArgCmd(interp, parsePtr, cmdPtr, envPtr); -} - -int -TclCompileInfoCoroutineCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - /* - * Only compile [info coroutine] without arguments. - */ - - if (parsePtr->numWords != 1) { - return TCL_ERROR; - } - - /* - * Not much to do; we compile to a single instruction... - */ - - TclEmitOpcode( INST_COROUTINE_NAME, envPtr); - return TCL_OK; -} - -int -TclCompileInfoExistsCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr; - int isScalar, simpleVarName, localIndex; - DefineLineInformation; /* TIP #280 */ - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - - /* - * Decide if we can use a frame slot for the var/array name or if we need - * to emit code to compute and push the name at runtime. We use a frame - * slot (entry in the array of local vars) if we are compiling a procedure - * body and if the name is simple text that does not include namespace - * qualifiers. - */ - - tokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex, - &simpleVarName, &isScalar, 1); - - /* - * Emit instruction to check the variable for existence. - */ - - if (!simpleVarName) { - TclEmitOpcode( INST_EXIST_STK, envPtr); - } else if (isScalar) { - if (localIndex < 0) { - TclEmitOpcode( INST_EXIST_STK, envPtr); - } else { - TclEmitInstInt4( INST_EXIST_SCALAR, localIndex, envPtr); - } - } else { - if (localIndex < 0) { - TclEmitOpcode( INST_EXIST_ARRAY_STK, envPtr); - } else { - TclEmitInstInt4( INST_EXIST_ARRAY, localIndex, envPtr); - } - } - - return TCL_OK; -} - -int -TclCompileInfoLevelCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - /* - * Only compile [info level] without arguments or with a single argument. - */ - - if (parsePtr->numWords == 1) { - /* - * Not much to do; we compile to a single instruction... - */ - - TclEmitOpcode( INST_INFO_LEVEL_NUM, envPtr); - } else if (parsePtr->numWords != 2) { - return TCL_ERROR; - } else { - DefineLineInformation; /* TIP #280 */ - - /* - * Compile the argument, then add the instruction to convert it into a - * list of arguments. - */ - - SetLineInformation(1); - CompileTokens(envPtr, TokenAfter(parsePtr->tokenPtr), interp); - TclEmitOpcode( INST_INFO_LEVEL_ARGS, envPtr); - } - return TCL_OK; -} - -int -TclCompileInfoObjectClassCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) -{ - DefineLineInformation; /* TIP #280 */ - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - CompileWord(envPtr, tokenPtr, interp, 1); - TclEmitOpcode( INST_TCLOO_CLASS, envPtr); - return TCL_OK; -} - -int -TclCompileInfoObjectIsACmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) -{ - DefineLineInformation; /* TIP #280 */ - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - - /* - * We only handle [info object isa object ]. The first three - * words are compressed to a single token by the ensemble compilation - * engine. - */ - - if (parsePtr->numWords != 3) { - return TCL_ERROR; - } - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size < 1 - || strncmp(tokenPtr[1].start, "object", tokenPtr[1].size)) { - return TCL_ERROR; - } - tokenPtr = TokenAfter(tokenPtr); - - /* - * Issue the code. - */ - - CompileWord(envPtr, tokenPtr, interp, 2); - TclEmitOpcode( INST_TCLOO_IS_OBJECT, envPtr); - return TCL_OK; -} - -int -TclCompileInfoObjectNamespaceCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) -{ - DefineLineInformation; /* TIP #280 */ - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - CompileWord(envPtr, tokenPtr, interp, 1); - TclEmitOpcode( INST_TCLOO_NS, envPtr); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLappendCmd -- - * - * Procedure called to compile the "lappend" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "lappend" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLappendCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *varTokenPtr, *valueTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i, fwd, offsetFwd; - DefineLineInformation; /* TIP #280 */ - - /* - * If we're not in a procedure, don't compile. - */ - - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } - - numWords = parsePtr->numWords; - if (numWords == 1) { - return TCL_ERROR; - } - if (numWords != 3) { - /* - * LAPPEND instructions currently only handle one value, but we can - * handle some multi-value cases by stringing them together. - */ - - goto lappendMultiple; - } - - /* - * Decide if we can use a frame slot for the var/array name or if we - * need to emit code to compute and push the name at runtime. We use a - * frame slot (entry in the array of local vars) if we are compiling a - * procedure body and if the name is simple text that does not include - * namespace qualifiers. - */ - - varTokenPtr = TokenAfter(parsePtr->tokenPtr); - - PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); - - /* - * If we are doing an assignment, push the new value. In the no values - * case, create an empty object. - */ - - if (numWords > 2) { - Tcl_Token *valueTokenPtr = TokenAfter(varTokenPtr); - - CompileWord(envPtr, valueTokenPtr, interp, 2); - } - - /* - * Emit instructions to set/get the variable. - */ - - /* - * The *_STK opcodes should be refactored to make better use of existing - * LOAD/STORE instructions. - */ - - if (!simpleVarName) { - TclEmitOpcode( INST_LAPPEND_STK, envPtr); - } else if (isScalar) { - if (localIndex < 0) { - TclEmitOpcode( INST_LAPPEND_STK, envPtr); - } else { - Emit14Inst( INST_LAPPEND_SCALAR, localIndex, envPtr); - } - } else { - if (localIndex < 0) { - TclEmitOpcode( INST_LAPPEND_ARRAY_STK, envPtr); - } else { - Emit14Inst( INST_LAPPEND_ARRAY, localIndex, envPtr); - } - } - - return TCL_OK; - - lappendMultiple: - /* - * Can only handle the case where we are appending to a local scalar when - * there are multiple values to append. Fortunately, this is common. - */ - - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } - varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); - if (!isScalar || localIndex < 0) { - return TCL_ERROR; - } - - /* - * Definitely appending to a local scalar; generate the words and append - * them. - */ - - valueTokenPtr = TokenAfter(varTokenPtr); - for (i = 2 ; i < numWords ; i++) { - CompileWord(envPtr, valueTokenPtr, interp, i); - valueTokenPtr = TokenAfter(valueTokenPtr); - } - TclEmitInstInt4( INST_LIST, numWords-2, envPtr); - TclEmitInstInt4( INST_EXIST_SCALAR, localIndex, envPtr); - offsetFwd = CurrentOffset(envPtr); - TclEmitInstInt1( INST_JUMP_FALSE1, 0, envPtr); - Emit14Inst( INST_LOAD_SCALAR, localIndex, envPtr); - TclEmitInstInt4( INST_REVERSE, 2, envPtr); - TclEmitOpcode( INST_LIST_CONCAT, envPtr); - fwd = CurrentOffset(envPtr) - offsetFwd; - TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); - Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLassignCmd -- - * - * Procedure called to compile the "lassign" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "lassign" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLassignCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr; - int simpleVarName, isScalar, localIndex, numWords, idx; - DefineLineInformation; /* TIP #280 */ - - numWords = parsePtr->numWords; - - /* - * Check for command syntax error, but we'll punt that to runtime. - */ - - if (numWords < 3) { - return TCL_ERROR; - } - - /* - * Generate code to push list being taken apart by [lassign]. - */ - - tokenPtr = TokenAfter(parsePtr->tokenPtr); - CompileWord(envPtr, tokenPtr, interp, 1); - - /* - * Generate code to assign values from the list to variables. - */ - - for (idx=0 ; idx= 0) { - TclEmitOpcode( INST_DUP, envPtr); - TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); - Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); - TclEmitOpcode( INST_POP, envPtr); - } else { - TclEmitInstInt4(INST_OVER, 1, envPtr); - TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); - TclEmitOpcode( INST_STORE_SCALAR_STK, envPtr); - TclEmitOpcode( INST_POP, envPtr); - } - } else { - if (localIndex >= 0) { - TclEmitInstInt4(INST_OVER, 1, envPtr); - TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); - Emit14Inst( INST_STORE_ARRAY, localIndex, envPtr); - TclEmitOpcode( INST_POP, envPtr); - } else { - TclEmitInstInt4(INST_OVER, 2, envPtr); - TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); - TclEmitOpcode( INST_STORE_ARRAY_STK, envPtr); - TclEmitOpcode( INST_POP, envPtr); - } - } - } - - /* - * Generate code to leave the rest of the list on the stack. - */ - - TclEmitInstInt4( INST_LIST_RANGE_IMM, idx, envPtr); - TclEmitInt4( -2 /* == "end" */, envPtr); - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLindexCmd -- - * - * Procedure called to compile the "lindex" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "lindex" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLindexCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *idxTokenPtr, *valTokenPtr; - int i, numWords = parsePtr->numWords; - DefineLineInformation; /* TIP #280 */ - - /* - * Quit if too few args. - */ - - if (numWords <= 1) { - return TCL_ERROR; - } - - valTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (numWords != 3) { - goto emitComplexLindex; - } - - idxTokenPtr = TokenAfter(valTokenPtr); - if (idxTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { - Tcl_Obj *tmpObj; - int idx, result; - - tmpObj = Tcl_NewStringObj(idxTokenPtr[1].start, idxTokenPtr[1].size); - result = TclGetIntFromObj(NULL, tmpObj, &idx); - if (result == TCL_OK) { - if (idx < 0) { - result = TCL_ERROR; - } - } else { - result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx); - if (result == TCL_OK && idx > -2) { - result = TCL_ERROR; - } - } - TclDecrRefCount(tmpObj); - - if (result == TCL_OK) { - /* - * All checks have been completed, and we have exactly one of - * these constructs: - * lindex - * lindex end- - * This is best compiled as a push of the arbitrary value followed - * by an "immediate lindex" which is the most efficient variety. - */ - - CompileWord(envPtr, valTokenPtr, interp, 1); - TclEmitInstInt4( INST_LIST_INDEX_IMM, idx, envPtr); - return TCL_OK; - } - - /* - * If the conversion failed or the value was negative, we just keep on - * going with the more complex compilation. - */ - } - - /* - * Push the operands onto the stack. - */ - - emitComplexLindex: - for (i=1 ; inumWords == 1) { - /* - * [list] without arguments just pushes an empty object. - */ - - PushLiteral(envPtr, "", 0); - return TCL_OK; - } - - /* - * Test if all arguments are compile-time known. If they are, we can - * implement with a simple push. - */ - - numWords = parsePtr->numWords; - valueTokenPtr = TokenAfter(parsePtr->tokenPtr); - listObj = Tcl_NewObj(); - for (i = 1; i < numWords && listObj != NULL; i++) { - objPtr = Tcl_NewObj(); - if (TclWordKnownAtCompileTime(valueTokenPtr, objPtr)) { - (void) Tcl_ListObjAppendElement(NULL, listObj, objPtr); - } else { - Tcl_DecrRefCount(objPtr); - Tcl_DecrRefCount(listObj); - listObj = NULL; - } - valueTokenPtr = TokenAfter(valueTokenPtr); - } - if (listObj != NULL) { - int len; - const char *bytes = Tcl_GetStringFromObj(listObj, &len); - - PushLiteral(envPtr, bytes, len); - Tcl_DecrRefCount(listObj); - if (len > 0) { - /* - * Force list interpretation! - */ - - TclEmitOpcode( INST_DUP, envPtr); - TclEmitOpcode( INST_LIST_LENGTH, envPtr); - TclEmitOpcode( INST_POP, envPtr); - } - return TCL_OK; - } - - /* - * Push the all values onto the stack. - */ - - numWords = parsePtr->numWords; - valueTokenPtr = TokenAfter(parsePtr->tokenPtr); - concat = build = 0; - for (i = 1; i < numWords; i++) { - if (valueTokenPtr->type == TCL_TOKEN_EXPAND_WORD && build > 0) { - TclEmitInstInt4( INST_LIST, build, envPtr); - if (concat) { - TclEmitOpcode( INST_LIST_CONCAT, envPtr); - } - build = 0; - concat = 1; - } - CompileWord(envPtr, valueTokenPtr, interp, i); - if (valueTokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - if (concat) { - TclEmitOpcode( INST_LIST_CONCAT, envPtr); - } else { - concat = 1; - } - } else { - build++; - } - valueTokenPtr = TokenAfter(valueTokenPtr); - } - if (build > 0) { - TclEmitInstInt4( INST_LIST, build, envPtr); - if (concat) { - TclEmitOpcode( INST_LIST_CONCAT, envPtr); - } - } - - /* - * If there was just one expanded word, we must ensure that it is a list - * at this point. We use an [lrange ... 0 end] for this (instead of - * [llength], as with literals) as we must drop any string representation - * that might be hanging around. - */ - - if (concat && numWords == 2) { - TclEmitInstInt4( INST_LIST_RANGE_IMM, 0, envPtr); - TclEmitInt4( -2, envPtr); - } - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLlengthCmd -- - * - * Procedure called to compile the "llength" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "llength" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLlengthCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *varTokenPtr; - DefineLineInformation; /* TIP #280 */ - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - varTokenPtr = TokenAfter(parsePtr->tokenPtr); - - CompileWord(envPtr, varTokenPtr, interp, 1); - TclEmitOpcode( INST_LIST_LENGTH, envPtr); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLrangeCmd -- - * - * How to compile the "lrange" command. We only bother because we needed - * the opcode anyway for "lassign". - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLrangeCmd( - Tcl_Interp *interp, /* Tcl interpreter for context. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the - * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds the resulting instructions. */ -{ - Tcl_Token *tokenPtr, *listTokenPtr; - DefineLineInformation; /* TIP #280 */ - Tcl_Obj *tmpObj; - int idx1, idx2, result; - - if (parsePtr->numWords != 4) { - return TCL_ERROR; - } - listTokenPtr = TokenAfter(parsePtr->tokenPtr); - - /* - * Parse the first index. Will only compile if it is constant and not an - * _integer_ less than zero (since we reserve negative indices here for - * end-relative indexing). - */ - - tokenPtr = TokenAfter(listTokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); - result = TclGetIntFromObj(NULL, tmpObj, &idx1); - if (result == TCL_OK) { - if (idx1 < 0) { - result = TCL_ERROR; - } - } else { - result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx1); - if (result == TCL_OK && idx1 > -2) { - result = TCL_ERROR; - } - } - TclDecrRefCount(tmpObj); - if (result != TCL_OK) { - return TCL_ERROR; - } - - /* - * Parse the second index. Will only compile if it is constant and not an - * _integer_ less than zero (since we reserve negative indices here for - * end-relative indexing). - */ - - tokenPtr = TokenAfter(tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); - result = TclGetIntFromObj(NULL, tmpObj, &idx2); - if (result == TCL_OK) { - if (idx2 < 0) { - result = TCL_ERROR; - } - } else { - result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx2); - if (result == TCL_OK && idx2 > -2) { - result = TCL_ERROR; - } - } - TclDecrRefCount(tmpObj); - if (result != TCL_OK) { - return TCL_ERROR; - } - - /* - * Issue instructions. It's not safe to skip doing the LIST_RANGE, as - * we've not proved that the 'list' argument is really a list. Not that it - * is worth trying to do that given current knowledge. - */ - - CompileWord(envPtr, listTokenPtr, interp, 1); - TclEmitInstInt4( INST_LIST_RANGE_IMM, idx1, envPtr); - TclEmitInt4( idx2, envPtr); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLreplaceCmd -- - * - * How to compile the "lreplace" command. We only bother with the case - * where there are no elements to insert and where both the 'first' and - * 'last' arguments are constant and one can be deterined to be at the - * end of the list. (This is the case that could also be written with - * "lrange".) - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLreplaceCmd( - Tcl_Interp *interp, /* Tcl interpreter for context. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the - * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds the resulting instructions. */ -{ - Tcl_Token *tokenPtr, *listTokenPtr; - DefineLineInformation; /* TIP #280 */ - Tcl_Obj *tmpObj; - int idx1, idx2, result, guaranteedDropAll = 0; - - if (parsePtr->numWords != 4) { - return TCL_ERROR; - } - listTokenPtr = TokenAfter(parsePtr->tokenPtr); - - /* - * Parse the first index. Will only compile if it is constant and not an - * _integer_ less than zero (since we reserve negative indices here for - * end-relative indexing). - */ - - tokenPtr = TokenAfter(listTokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); - result = TclGetIntFromObj(NULL, tmpObj, &idx1); - if (result == TCL_OK) { - if (idx1 < 0) { - result = TCL_ERROR; - } - } else { - result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx1); - if (result == TCL_OK && idx1 > -2) { - result = TCL_ERROR; - } - } - TclDecrRefCount(tmpObj); - if (result != TCL_OK) { - return TCL_ERROR; - } - - /* - * Parse the second index. Will only compile if it is constant and not an - * _integer_ less than zero (since we reserve negative indices here for - * end-relative indexing). - */ - - tokenPtr = TokenAfter(tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); - result = TclGetIntFromObj(NULL, tmpObj, &idx2); - if (result == TCL_OK) { - if (idx2 < 0) { - result = TCL_ERROR; - } - } else { - result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx2); - if (result == TCL_OK && idx2 > -2) { - result = TCL_ERROR; - } - } - TclDecrRefCount(tmpObj); - if (result != TCL_OK) { - return TCL_ERROR; - } - - /* - * Sanity check: can only issue when we're removing a range at one or - * other end of the list. If we're at one end or the other, convert the - * indices into the equivalent for an [lrange]. - */ - - if (idx1 == 0) { - if (idx2 == -2) { - guaranteedDropAll = 1; - } - idx1 = idx2 + 1; - idx2 = -2; - } else if (idx2 == -2) { - idx2 = idx1 - 1; - idx1 = 0; - } else { - return TCL_ERROR; - } - - /* - * Issue instructions. It's not safe to skip doing the LIST_RANGE, as - * we've not proved that the 'list' argument is really a list. Not that it - * is worth trying to do that given current knowledge. - */ - - CompileWord(envPtr, listTokenPtr, interp, 1); - if (guaranteedDropAll) { - TclEmitOpcode( INST_LIST_LENGTH, envPtr); - TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); - } else { - TclEmitInstInt4( INST_LIST_RANGE_IMM, idx1, envPtr); - TclEmitInt4( idx2, envPtr); - } - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLsetCmd -- - * - * Procedure called to compile the "lset" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "lset" command at - * runtime. - * - * The general template for execution of the "lset" command is: - * (1) Instructions to push the variable name, unless the variable is - * local to the stack frame. - * (2) If the variable is an array element, instructions to push the - * array element name. - * (3) Instructions to push each of zero or more "index" arguments to the - * stack, followed with the "newValue" element. - * (4) Instructions to duplicate the variable name and/or array element - * name onto the top of the stack, if either was pushed at steps (1) - * and (2). - * (5) The appropriate INST_LOAD_* instruction to place the original - * value of the list variable at top of stack. - * (6) At this point, the stack contains: - * varName? arrayElementName? index1 index2 ... newValue oldList - * The compiler emits one of INST_LSET_FLAT or INST_LSET_LIST - * according as whether there is exactly one index element (LIST) or - * either zero or else two or more (FLAT). This instruction removes - * everything from the stack except for the two names and pushes the - * new value of the variable. - * (7) Finally, INST_STORE_* stores the new value in the variable and - * cleans up the stack. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLsetCmd( - Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the - * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds the resulting instructions. */ -{ - int tempDepth; /* Depth used for emitting one part of the - * code burst. */ - Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the - * parse of the variable name. */ - int localIndex; /* Index of var in local var table. */ - int simpleVarName; /* Flag == 1 if var name is simple. */ - int isScalar; /* Flag == 1 if scalar, 0 if array. */ - int i; - DefineLineInformation; /* TIP #280 */ - - /* - * Check argument count. - */ - - if (parsePtr->numWords < 3) { - /* - * Fail at run time, not in compilation. - */ - - return TCL_ERROR; - } - - /* - * Decide if we can use a frame slot for the var/array name or if we need - * to emit code to compute and push the name at runtime. We use a frame - * slot (entry in the array of local vars) if we are compiling a procedure - * body and if the name is simple text that does not include namespace - * qualifiers. - */ - - varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); - - /* - * Push the "index" args and the new element value. - */ - - for (i=2 ; inumWords ; ++i) { - varTokenPtr = TokenAfter(varTokenPtr); - CompileWord(envPtr, varTokenPtr, interp, i); - } - - /* - * Duplicate the variable name if it's been pushed. - */ - - if (!simpleVarName || localIndex < 0) { - if (!simpleVarName || isScalar) { - tempDepth = parsePtr->numWords - 2; - } else { - tempDepth = parsePtr->numWords - 1; - } - TclEmitInstInt4( INST_OVER, tempDepth, envPtr); - } - - /* - * Duplicate an array index if one's been pushed. - */ - - if (simpleVarName && !isScalar) { - if (localIndex < 0) { - tempDepth = parsePtr->numWords - 1; - } else { - tempDepth = parsePtr->numWords - 2; - } - TclEmitInstInt4( INST_OVER, tempDepth, envPtr); - } - - /* - * Emit code to load the variable's value. - */ - - if (!simpleVarName) { - TclEmitOpcode( INST_LOAD_STK, envPtr); - } else if (isScalar) { - if (localIndex < 0) { - TclEmitOpcode( INST_LOAD_SCALAR_STK, envPtr); - } else { - Emit14Inst( INST_LOAD_SCALAR, localIndex, envPtr); - } - } else { - if (localIndex < 0) { - TclEmitOpcode( INST_LOAD_ARRAY_STK, envPtr); - } else { - Emit14Inst( INST_LOAD_ARRAY, localIndex, envPtr); - } - } - - /* - * Emit the correct variety of 'lset' instruction. - */ - - if (parsePtr->numWords == 4) { - TclEmitOpcode( INST_LSET_LIST, envPtr); - } else { - TclEmitInstInt4( INST_LSET_FLAT, parsePtr->numWords-1, envPtr); - } - - /* - * Emit code to put the value back in the variable. - */ - - if (!simpleVarName) { - TclEmitOpcode( INST_STORE_STK, envPtr); - } else if (isScalar) { - if (localIndex < 0) { - TclEmitOpcode( INST_STORE_SCALAR_STK, envPtr); - } else { - Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); - } - } else { - if (localIndex < 0) { - TclEmitOpcode( INST_STORE_ARRAY_STK, envPtr); - } else { - Emit14Inst( INST_STORE_ARRAY, localIndex, envPtr); - } - } - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileLmapCmd -- - * - * Procedure called to compile the "lmap" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "lmap" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileLmapCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - return CompileEachloopCmd(interp, parsePtr, cmdPtr, envPtr, - TCL_EACH_COLLECT); -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileNamespace*Cmd -- - * - * Procedures called to compile the "namespace" command; currently, only - * the subcommands "namespace current" and "namespace upvar" are compiled - * to bytecodes, and the latter only inside a procedure(-like) context. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "namespace upvar" - * command at runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileNamespaceCurrentCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - /* - * Only compile [namespace current] without arguments. - */ - - if (parsePtr->numWords != 1) { - return TCL_ERROR; - } - - /* - * Not much to do; we compile to a single instruction... - */ - - TclEmitOpcode( INST_NS_CURRENT, envPtr); - return TCL_OK; -} - -int -TclCompileNamespaceCodeCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr; - DefineLineInformation; /* TIP #280 */ - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - tokenPtr = TokenAfter(parsePtr->tokenPtr); - - /* - * The specification of [namespace code] is rather shocking, in that it is - * supposed to check if the argument is itself the result of [namespace - * code] and not apply itself in that case. Which is excessively cautious, - * but what the test suite checks for. - */ - - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || (tokenPtr[1].size > 20 - && strncmp(tokenPtr[1].start, "::namespace inscope ", 20) == 0)) { - /* - * Technically, we could just pass a literal '::namespace inscope ' - * term through, but that's something which really shouldn't be - * occurring as something that the user writes so we'll just punt it. - */ - - return TCL_ERROR; - } - - /* - * Now we can compile using the same strategy as [namespace code]'s normal - * implementation does internally. Note that we can't bind the namespace - * name directly here, because TclOO plays complex games with namespaces; - * the value needs to be determined at runtime for safety. - */ - - PushLiteral(envPtr, "::namespace", 11); - PushLiteral(envPtr, "inscope", 7); - TclEmitOpcode( INST_NS_CURRENT, envPtr); - CompileWord(envPtr, tokenPtr, interp, 1); - TclEmitInstInt4( INST_LIST, 4, envPtr); - return TCL_OK; -} - -int -TclCompileNamespaceQualifiersCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - DefineLineInformation; /* TIP #280 */ - int off; - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - - CompileWord(envPtr, tokenPtr, interp, 1); - PushLiteral(envPtr, "0", 1); - PushLiteral(envPtr, "::", 2); - TclEmitInstInt4( INST_OVER, 2, envPtr); - TclEmitOpcode( INST_STR_FIND_LAST, envPtr); - off = CurrentOffset(envPtr); - PushLiteral(envPtr, "1", 1); - TclEmitOpcode( INST_SUB, envPtr); - TclEmitInstInt4( INST_OVER, 2, envPtr); - TclEmitInstInt4( INST_OVER, 1, envPtr); - TclEmitOpcode( INST_STR_INDEX, envPtr); - PushLiteral(envPtr, ":", 1); - TclEmitOpcode( INST_STR_EQ, envPtr); - off = off - CurrentOffset(envPtr); - TclEmitInstInt1( INST_JUMP_TRUE1, off, envPtr); - TclEmitOpcode( INST_STR_RANGE, envPtr); - return TCL_OK; -} - -int -TclCompileNamespaceTailCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - DefineLineInformation; /* TIP #280 */ - JumpFixup jumpFixup; - - if (parsePtr->numWords != 2) { - return TCL_ERROR; - } - - /* - * Take care; only add 2 to found index if the string was actually found. - */ - - CompileWord(envPtr, tokenPtr, interp, 1); - PushLiteral(envPtr, "::", 2); - TclEmitInstInt4( INST_OVER, 1, envPtr); - TclEmitOpcode( INST_STR_FIND_LAST, envPtr); - TclEmitOpcode( INST_DUP, envPtr); - PushLiteral(envPtr, "0", 1); - TclEmitOpcode( INST_GE, envPtr); - TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpFixup); - PushLiteral(envPtr, "2", 1); - TclEmitOpcode( INST_ADD, envPtr); - TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127); - PushLiteral(envPtr, "end", 3); - TclEmitOpcode( INST_STR_RANGE, envPtr); - return TCL_OK; -} - -int -TclCompileNamespaceUpvarCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ - - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } - - /* - * Only compile [namespace upvar ...]: needs an even number of args, >=4 - */ - - numWords = parsePtr->numWords; - if ((numWords % 2) || (numWords < 4)) { - return TCL_ERROR; - } - - /* - * Push the namespace - */ - - tokenPtr = TokenAfter(parsePtr->tokenPtr); - CompileWord(envPtr, tokenPtr, interp, 1); - - /* - * Loop over the (otherVar, thisVar) pairs. If any of the thisVar is not a - * local variable, return an error so that the non-compiled command will - * be called at runtime. - */ - - localTokenPtr = tokenPtr; - for (i=3; i<=numWords; i+=2) { - otherTokenPtr = TokenAfter(localTokenPtr); - localTokenPtr = TokenAfter(otherTokenPtr); - - CompileWord(envPtr, otherTokenPtr, interp, 1); - PushVarNameWord(interp, localTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); - - if ((localIndex < 0) || !isScalar) { - return TCL_ERROR; - } - TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); - } - - /* - * Pop the namespace, and set the result to empty - */ - - TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); - return TCL_OK; -} - -int -TclCompileNamespaceWhichCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - DefineLineInformation; /* TIP #280 */ - Tcl_Token *tokenPtr, *opt; - int idx; - - if (parsePtr->numWords < 2 || parsePtr->numWords > 3) { - return TCL_ERROR; - } - tokenPtr = TokenAfter(parsePtr->tokenPtr); - idx = 1; - - /* - * If there's an option, check that it's "-command". We don't handle - * "-variable" (currently) and anything else is an error. - */ - - if (parsePtr->numWords == 3) { - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - opt = tokenPtr + 1; - if (opt->size < 2 || opt->size > 8 - || strncmp(opt->start, "-command", opt->size) != 0) { - return TCL_ERROR; - } - tokenPtr = TokenAfter(tokenPtr); - idx++; - } - - /* - * Issue the bytecode. - */ - - CompileWord(envPtr, tokenPtr, interp, idx); - TclEmitOpcode( INST_RESOLVE_COMMAND, envPtr); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileRegexpCmd -- - * - * Procedure called to compile the "regexp" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "regexp" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileRegexpCmd( - Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the - * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds the resulting instructions. */ -{ - 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 - * supported compile cases are: - * regexp ?-nocase? ?--? staticString $var - * regexp ?-nocase? ?--? {^staticString$} $var - */ - - if (parsePtr->numWords < 3) { - return TCL_ERROR; - } - - simple = 0; - nocase = 0; - sawLast = 0; - varTokenPtr = parsePtr->tokenPtr; - - /* - * We only look for -nocase and -- as options. Everything else gets pushed - * to runtime execution. This is different than regexp's runtime option - * handling, but satisfies our stricter needs. - */ - - for (i = 1; i < parsePtr->numWords - 2; i++) { - varTokenPtr = TokenAfter(varTokenPtr); - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - /* - * Not a simple string, so punt to runtime. - */ - - return TCL_ERROR; - } - str = varTokenPtr[1].start; - len = varTokenPtr[1].size; - if ((len == 2) && (str[0] == '-') && (str[1] == '-')) { - sawLast++; - i++; - break; - } else if ((len > 1) && (strncmp(str,"-nocase",(unsigned)len) == 0)) { - nocase = 1; - } else { - /* - * Not an option we recognize. - */ - - return TCL_ERROR; - } - } - - if ((parsePtr->numWords - i) != 2) { - /* - * We don't support capturing to variables. - */ - - return TCL_ERROR; - } - - /* - * Get the regexp string. If it is not a simple string or can't be - * converted to a glob pattern, push the word for the INST_REGEXP. - * Keep changes here in sync with TclCompileSwitchCmd Switch_Regexp. - */ - - varTokenPtr = TokenAfter(varTokenPtr); - - if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { - Tcl_DString ds; - - str = varTokenPtr[1].start; - len = varTokenPtr[1].size; - - /* - * If it has a '-', it could be an incorrectly formed regexp command. - */ - - if ((*str == '-') && !sawLast) { - return TCL_ERROR; - } - - if (len == 0) { - /* - * The semantics of regexp are always match on re == "". - */ - - PushLiteral(envPtr, "1", 1); - return TCL_OK; - } - - /* - * Attempt to convert pattern to glob. If successful, push the - * converted pattern as a literal. - */ - - if (TclReToGlob(NULL, varTokenPtr[1].start, len, &ds, &exact) - == TCL_OK) { - simple = 1; - PushLiteral(envPtr, Tcl_DStringValue(&ds),Tcl_DStringLength(&ds)); - Tcl_DStringFree(&ds); - } - } - - if (!simple) { - CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-2); - } - - /* - * Push the string arg. - */ - - varTokenPtr = TokenAfter(varTokenPtr); - CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-1); - - if (simple) { - if (exact && !nocase) { - TclEmitOpcode( INST_STR_EQ, envPtr); - } else { - TclEmitInstInt1( INST_STR_MATCH, nocase, envPtr); - } - } else { - /* - * Pass correct RE compile flags. We use only Int1 (8-bit), but - * that handles all the flags we want to pass. - * Don't use TCL_REG_NOSUB as we may have backrefs. - */ - - int cflags = TCL_REG_ADVANCED | (nocase ? TCL_REG_NOCASE : 0); - - TclEmitInstInt1( INST_REGEXP, cflags, envPtr); - } - - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileRegsubCmd -- - * - * Procedure called to compile the "regsub" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "regsub" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileRegsubCmd( - Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the - * command. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds the resulting instructions. */ -{ - /* - * We only compile the case with [regsub -all] where the pattern is both - * known at compile time and simple (i.e., no RE metacharacters). That is, - * the pattern must be translatable into a glob like "*foo*" with no other - * glob metacharacters inside it; there must be some "foo" in there too. - * The substitution string must also be known at compile time and free of - * metacharacters ("\digit" and "&"). Finally, there must not be a - * variable mentioned in the [regsub] to write the result back to (because - * we can't get the count of substitutions that would be the result in - * that case). The key is that these are the conditions under which a - * [string map] could be used instead, in particular a [string map] of the - * form we can compile to bytecode. - * - * In short, we look for: - * - * regsub -all [--] simpleRE string simpleReplacement - * - * The only optional part is the "--", and no other options are handled. - */ - - DefineLineInformation; /* TIP #280 */ - Tcl_Token *tokenPtr, *stringTokenPtr; - Tcl_Obj *patternObj = NULL, *replacementObj = NULL; - Tcl_DString pattern; - const char *bytes; - int len, exact, result = TCL_ERROR; - - if (parsePtr->numWords < 5 || parsePtr->numWords > 6) { - return TCL_ERROR; - } - - /* - * Parse the "-all", which must be the first argument (other options not - * supported, non-"-all" substitution we can't compile). - */ - - tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size != 4 - || strncmp(tokenPtr[1].start, "-all", 4)) { - return TCL_ERROR; - } - - /* - * Get the pattern into patternObj, checking for "--" in the process. - */ - - Tcl_DStringInit(&pattern); - tokenPtr = TokenAfter(tokenPtr); - patternObj = Tcl_NewObj(); - if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { - goto done; - } - if (Tcl_GetString(patternObj)[0] == '-') { - if (strcmp(Tcl_GetString(patternObj), "--") != 0 - || parsePtr->numWords == 5) { - goto done; - } - tokenPtr = TokenAfter(tokenPtr); - Tcl_DecrRefCount(patternObj); - patternObj = Tcl_NewObj(); - if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { - goto done; - } - } else if (parsePtr->numWords == 6) { - goto done; - } - - /* - * Identify the code which produces the string to apply the substitution - * to (stringTokenPtr), and the replacement string (into replacementObj). - */ - - stringTokenPtr = TokenAfter(tokenPtr); - tokenPtr = TokenAfter(stringTokenPtr); - replacementObj = Tcl_NewObj(); - if (!TclWordKnownAtCompileTime(tokenPtr, replacementObj)) { - goto done; - } - - /* - * Next, higher-level checks. Is the RE a very simple glob? Is the - * replacement "simple"? - */ - - bytes = Tcl_GetStringFromObj(patternObj, &len); - if (TclReToGlob(NULL, bytes, len, &pattern, &exact) != TCL_OK || exact) { - goto done; - } - bytes = Tcl_DStringValue(&pattern); - if (*bytes++ != '*') { - goto done; - } - while (1) { - switch (*bytes) { - case '*': - if (bytes[1] == '\0') { - /* - * OK, we've proved there are no metacharacters except for the - * '*' at each end. - */ - - len = Tcl_DStringLength(&pattern) - 2; - if (len > 0) { - goto isSimpleGlob; - } - - /* - * The pattern is "**"! I believe that should be impossible, - * but we definitely can't handle that at all. - */ - } - case '\0': case '?': case '[': case '\\': - goto done; - } - bytes++; - } - isSimpleGlob: - for (bytes = Tcl_GetString(replacementObj); *bytes; bytes++) { - switch (*bytes) { - case '\\': case '&': - goto done; - } - } - - /* - * Proved the simplicity constraints! Time to issue the code. - */ - - result = TCL_OK; - bytes = Tcl_DStringValue(&pattern) + 1; - PushLiteral(envPtr, bytes, len); - bytes = Tcl_GetStringFromObj(replacementObj, &len); - PushLiteral(envPtr, bytes, len); - CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords-2); - TclEmitOpcode( INST_STR_MAP, envPtr); - - done: - Tcl_DStringFree(&pattern); - if (patternObj) { - Tcl_DecrRefCount(patternObj); - } - if (replacementObj) { - Tcl_DecrRefCount(replacementObj); - } - return result; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileReturnCmd -- - * - * Procedure called to compile the "return" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "return" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileReturnCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - /* - * General syntax: [return ?-option value ...? ?result?] - * An even number of words means an explicit result argument is present. - */ - int level, code, objc, size, status = TCL_OK; - int numWords = parsePtr->numWords; - int explicitResult = (0 == (numWords % 2)); - int numOptionWords = numWords - 1 - explicitResult; - int savedStackDepth = envPtr->currStackDepth; - Tcl_Obj *returnOpts, **objv; - Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); - DefineLineInformation; /* TIP #280 */ - - /* - * Check for special case which can always be compiled: - * return -options - * Unlike the normal [return] compilation, this version does everything at - * runtime so it can handle arbitrary words and not just literals. Note - * that if INST_RETURN_STK wasn't already needed for something else - * ('finally' clause processing) this piece of code would not be present. - */ - - if ((numWords == 4) && (wordTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) - && (wordTokenPtr[1].size == 8) - && (strncmp(wordTokenPtr[1].start, "-options", 8) == 0)) { - Tcl_Token *optsTokenPtr = TokenAfter(wordTokenPtr); - Tcl_Token *msgTokenPtr = TokenAfter(optsTokenPtr); - - CompileWord(envPtr, optsTokenPtr, interp, 2); - CompileWord(envPtr, msgTokenPtr, interp, 3); - TclEmitOpcode(INST_RETURN_STK, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; - return TCL_OK; - } - - /* - * Allocate some working space. - */ - - objv = TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *)); - - /* - * Scan through the return options. If any are unknown at compile time, - * there is no value in bytecompiling. Save the option values known in an - * objv array for merging into a return options dictionary. - */ - - for (objc = 0; objc < numOptionWords; objc++) { - objv[objc] = Tcl_NewObj(); - Tcl_IncrRefCount(objv[objc]); - if (!TclWordKnownAtCompileTime(wordTokenPtr, objv[objc])) { - /* - * Non-literal, so punt to run-time. - */ - - for (; objc>=0 ; objc--) { - TclDecrRefCount(objv[objc]); - } - TclStackFree(interp, objv); - goto issueRuntimeReturn; - } - wordTokenPtr = TokenAfter(wordTokenPtr); - } - status = TclMergeReturnOptions(interp, objc, objv, - &returnOpts, &code, &level); - while (--objc >= 0) { - TclDecrRefCount(objv[objc]); - } - TclStackFree(interp, objv); - if (TCL_ERROR == status) { - /* - * Something was bogus in the return options. Clear the error message, - * and report back to the compiler that this must be interpreted at - * runtime. - */ - - Tcl_ResetResult(interp); - return TCL_ERROR; - } - - /* - * All options are known at compile time, so we're going to bytecompile. - * Emit instructions to push the result on the stack. - */ - - if (explicitResult) { - CompileWord(envPtr, wordTokenPtr, interp, numWords-1); - } else { - /* - * No explict result argument, so default result is empty string. - */ - - PushLiteral(envPtr, "", 0); - } - - /* - * Check for optimization: When [return] is in a proc, and there's no - * enclosing [catch], and there are no return options, then the INST_DONE - * instruction is equivalent, and may be more efficient. - */ - - if (numOptionWords == 0 && envPtr->procPtr != NULL) { - /* - * We have default return options and we're in a proc ... - */ - - int index = envPtr->exceptArrayNext - 1; - int enclosingCatch = 0; - - while (index >= 0) { - ExceptionRange range = envPtr->exceptArrayPtr[index]; - - if ((range.type == CATCH_EXCEPTION_RANGE) - && (range.catchOffset == -1)) { - enclosingCatch = 1; - break; - } - index--; - } - if (!enclosingCatch) { - /* - * ... and there is no enclosing catch. Issue the maximally - * efficient exit instruction. - */ - - Tcl_DecrRefCount(returnOpts); - TclEmitOpcode(INST_DONE, envPtr); - envPtr->currStackDepth = savedStackDepth; - return TCL_OK; - } - } - - /* Optimize [return -level 0 $x]. */ - Tcl_DictObjSize(NULL, returnOpts, &size); - if (size == 0 && level == 0 && code == TCL_OK) { - Tcl_DecrRefCount(returnOpts); - return TCL_OK; - } - - /* - * Could not use the optimization, so we push the return options dict, and - * emit the INST_RETURN_IMM instruction with code and level as operands. - */ - - CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts); - envPtr->currStackDepth = savedStackDepth + 1; - return TCL_OK; - - issueRuntimeReturn: - /* - * Assemble the option dictionary (as a list as that's good enough). - */ - - wordTokenPtr = TokenAfter(parsePtr->tokenPtr); - for (objc=1 ; objc<=numOptionWords ; objc++) { - CompileWord(envPtr, wordTokenPtr, interp, objc); - wordTokenPtr = TokenAfter(wordTokenPtr); - } - TclEmitInstInt4(INST_LIST, numOptionWords, envPtr); - - /* - * Push the result. - */ - - if (explicitResult) { - CompileWord(envPtr, wordTokenPtr, interp, numWords-1); - } else { - PushLiteral(envPtr, "", 0); - } - - /* - * Issue the RETURN itself. - */ - - TclEmitOpcode(INST_RETURN_STK, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; - return TCL_OK; -} - -static void -CompileReturnInternal( - CompileEnv *envPtr, - unsigned char op, - int code, - int level, - Tcl_Obj *returnOpts) -{ - TclEmitPush(TclAddLiteralObj(envPtr, returnOpts, NULL), envPtr); - TclEmitInstInt4(op, code, envPtr); - TclEmitInt4(level, envPtr); -} - -void -TclCompileSyntaxError( - Tcl_Interp *interp, - CompileEnv *envPtr) -{ - Tcl_Obj *msg = Tcl_GetObjResult(interp); - int numBytes; - const char *bytes = TclGetStringFromObj(msg, &numBytes); - - TclErrorStackResetIf(interp, bytes, numBytes); - TclEmitPush(TclRegisterNewLiteral(envPtr, bytes, numBytes), envPtr); - CompileReturnInternal(envPtr, INST_SYNTAX, TCL_ERROR, 0, - TclNoErrorStack(interp, Tcl_GetReturnOptions(interp, TCL_ERROR))); -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileUpvarCmd -- - * - * Procedure called to compile the "upvar" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "upvar" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileUpvarCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ - Tcl_Obj *objPtr = Tcl_NewObj(); - - if (envPtr->procPtr == NULL) { - Tcl_DecrRefCount(objPtr); - return TCL_ERROR; - } - - numWords = parsePtr->numWords; - if (numWords < 3) { - Tcl_DecrRefCount(objPtr); - return TCL_ERROR; - } - - /* - * Push the frame index if it is known at compile time - */ - - tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (TclWordKnownAtCompileTime(tokenPtr, objPtr)) { - CallFrame *framePtr; - const Tcl_ObjType *newTypePtr, *typePtr = objPtr->typePtr; - - /* - * Attempt to convert to a level reference. Note that TclObjGetFrame - * only changes the obj type when a conversion was successful. - */ - - TclObjGetFrame(interp, objPtr, &framePtr); - newTypePtr = objPtr->typePtr; - Tcl_DecrRefCount(objPtr); - - if (newTypePtr != typePtr) { - if (numWords%2) { - return TCL_ERROR; - } - CompileWord(envPtr, tokenPtr, interp, 1); - otherTokenPtr = TokenAfter(tokenPtr); - i = 4; - } else { - if (!(numWords%2)) { - return TCL_ERROR; - } - PushLiteral(envPtr, "1", 1); - otherTokenPtr = tokenPtr; - i = 3; - } - } else { - Tcl_DecrRefCount(objPtr); - return TCL_ERROR; - } - - /* - * Loop over the (otherVar, thisVar) pairs. If any of the thisVar is not a - * local variable, return an error so that the non-compiled command will - * be called at runtime. - */ - - for (; i<=numWords; i+=2, otherTokenPtr = TokenAfter(localTokenPtr)) { - localTokenPtr = TokenAfter(otherTokenPtr); - - CompileWord(envPtr, otherTokenPtr, interp, 1); - PushVarNameWord(interp, localTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); - - if ((localIndex < 0) || !isScalar) { - return TCL_ERROR; - } - TclEmitInstInt4( INST_UPVAR, localIndex, envPtr); - } - - /* - * Pop the frame index, and set the result to empty - */ - - TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TclCompileVariableCmd -- - * - * Procedure called to compile the "variable" command. - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "variable" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -int -TclCompileVariableCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - Tcl_Token *varTokenPtr, *valueTokenPtr; - int localIndex, numWords, i; - DefineLineInformation; /* TIP #280 */ - - numWords = parsePtr->numWords; - if (numWords < 2) { - return TCL_ERROR; - } - - /* - * Bail out if not compiling a proc body - */ - - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } - - /* - * Loop over the (var, value) pairs. - */ - - valueTokenPtr = parsePtr->tokenPtr; - for (i=1; inumComponents; - Tcl_Token *lastTokenPtr; - int full, localIndex; - - /* - * Determine if the tail is (a) known at compile time, and (b) not an - * array element. Should any of these fail, return an error so that the - * non-compiled command will be called at runtime. - * - * In order for the tail to be known at compile time, the last token in - * the word has to be constant and contain "::" if it is not the only one. - */ - - if (!EnvHasLVT(envPtr)) { - return -1; - } - - TclNewObj(tailPtr); - if (TclWordKnownAtCompileTime(varTokenPtr, tailPtr)) { - full = 1; - lastTokenPtr = varTokenPtr; - } else { - full = 0; - lastTokenPtr = varTokenPtr + n; - if (!TclWordKnownAtCompileTime(lastTokenPtr, tailPtr)) { - Tcl_DecrRefCount(tailPtr); - return -1; - } - } - - tailName = TclGetStringFromObj(tailPtr, &len); - - if (len) { - if (*(tailName+len-1) == ')') { - /* - * Possible array: bail out - */ - - Tcl_DecrRefCount(tailPtr); - return -1; - } - - /* - * Get the tail: immediately after the last '::' - */ - - for (p = tailName + len -1; p > tailName; p--) { - if ((*p == ':') && (*(p-1) == ':')) { - p++; - break; - } - } - if (!full && (p == tailName)) { - /* - * No :: in the last component. - */ - - Tcl_DecrRefCount(tailPtr); - return -1; - } - len -= p - tailName; - tailName = p; - } - - localIndex = TclFindCompiledLocal(tailName, len, 1, envPtr); - Tcl_DecrRefCount(tailPtr); - return localIndex; -} - -int -TclCompileObjectSelfCmd( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Parse *parsePtr, /* Points to a parse structure for the command - * created by Tcl_ParseCommand. */ - Command *cmdPtr, /* Points to defintion of command being - * compiled. */ - CompileEnv *envPtr) /* Holds resulting instructions. */ -{ - /* - * We only handle [self] and [self object] (which is the same operation). - * These are the only very common operations on [self] for which - * bytecoding is at all reasonable. - */ - - if (parsePtr->numWords == 1) { - goto compileSelfObject; - } else if (parsePtr->numWords == 2) { - Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr), *subcmd; - - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size==0) { - return TCL_ERROR; - } - - subcmd = tokenPtr + 1; - if (strncmp(subcmd->start, "object", subcmd->size) == 0) { - goto compileSelfObject; - } else if (strncmp(subcmd->start, "namespace", subcmd->size) == 0) { - goto compileSelfNamespace; - } - } - - /* - * Can't compile; handle with runtime call. - */ - - return TCL_ERROR; - - compileSelfObject: - - /* - * This delegates the entire problem to a single opcode. - */ - - TclEmitOpcode( INST_TCLOO_SELF, envPtr); - return TCL_OK; - - compileSelfNamespace: - - /* - * This is formally only correct with TclOO methods as they are currently - * implemented; it assumes that the current namespace is invariably when a - * TclOO context is present is the object's namespace, and that's - * technically only something that's a matter of current policy. But it - * avoids creating another opcode, so that's all good! - */ - - TclEmitOpcode( INST_TCLOO_SELF, envPtr); - TclEmitOpcode( INST_POP, envPtr); - TclEmitOpcode( INST_NS_CURRENT, envPtr); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * * PushVarName -- * * Procedure used in the compiling where pushing a variable name is diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c new file mode 100644 index 0000000..83a84e8 --- /dev/null +++ b/generic/tclCompCmdsGR.c @@ -0,0 +1,3244 @@ +/* + * tclCompCmdsGR.c -- + * + * This file contains compilation procedures that compile various Tcl + * commands (beginning with the letters 'g' through 'r') into a sequence + * of instructions ("bytecodes"). + * + * Copyright (c) 1997-1998 Sun Microsystems, Inc. + * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. + * Copyright (c) 2002 ActiveState Corporation. + * Copyright (c) 2004-2013 by Donal K. Fellows. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclCompile.h" +#include + +/* + * Prototypes for procedures defined later in this file: + */ + +static void CompileReturnInternal(CompileEnv *envPtr, + unsigned char op, int code, int level, + Tcl_Obj *returnOpts); +static int IndexTailVarIfKnown(Tcl_Interp *interp, + Tcl_Token *varTokenPtr, CompileEnv *envPtr); +static int PushVarName(Tcl_Interp *interp, + Tcl_Token *varTokenPtr, CompileEnv *envPtr, + int flags, int *localIndexPtr, + int *simpleVarNamePtr, int *isScalarPtr, + int line, int *clNext); +static int CompileEachloopCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + CompileEnv *envPtr, int collect); +static int CompileDictEachCmd(Tcl_Interp *interp, + Tcl_Parse *parsePtr, Command *cmdPtr, + struct CompileEnv *envPtr, int collect); + + +/* + * Macro that encapsulates an efficiency trick that avoids a function call for + * the simplest of compiles. The ANSI C "prototype" for this macro is: + * + * static void CompileWord(CompileEnv *envPtr, Tcl_Token *tokenPtr, + * Tcl_Interp *interp, int word); + */ + +#define CompileWord(envPtr, tokenPtr, interp, word) \ + if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \ + TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \ + (tokenPtr)[1].size), (envPtr)); \ + } else { \ + envPtr->line = mapPtr->loc[eclIndex].line[word]; \ + envPtr->clNext = mapPtr->loc[eclIndex].next[word]; \ + TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ + (envPtr)); \ + } + +/* + * TIP #280: Remember the per-word line information of the current command. An + * index is used instead of a pointer as recursive compilation may reallocate, + * i.e. move, the array. This is also the reason to save the nuloc now, it may + * change during the course of the function. + * + * Macro to encapsulate the variable definition and setup. + */ + +#define DefineLineInformation \ + ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ + int eclIndex = mapPtr->nuloc - 1 + +#define SetLineInformation(word) \ + envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ + envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] + +#define PushVarNameWord(i,v,e,f,l,s,sc,word) \ + PushVarName(i,v,e,f,l,s,sc, \ + mapPtr->loc[eclIndex].line[(word)], \ + mapPtr->loc[eclIndex].next[(word)]) + +/* + * Often want to issue one of two versions of an instruction based on whether + * the argument will fit in a single byte or not. This makes it much clearer. + */ + +#define Emit14Inst(nm,idx,envPtr) \ + if (idx <= 255) { \ + TclEmitInstInt1(nm##1,idx,envPtr); \ + } else { \ + TclEmitInstInt4(nm##4,idx,envPtr); \ + } + +/* + * Flags bits used by PushVarName. + */ + +#define TCL_NO_LARGE_INDEX 1 /* Do not return localIndex value > 255 */ +#define TCL_NO_ELEMENT 2 /* Do not push the array element. */ + +/* + *---------------------------------------------------------------------- + * + * TclCompileGlobalCmd -- + * + * Procedure called to compile the "global" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "global" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileGlobalCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *varTokenPtr; + int localIndex, numWords, i; + DefineLineInformation; /* TIP #280 */ + + numWords = parsePtr->numWords; + if (numWords < 2) { + return TCL_ERROR; + } + + /* + * 'global' has no effect outside of proc bodies; handle that at runtime + */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + + /* + * Push the namespace + */ + + PushLiteral(envPtr, "::", 2); + + /* + * Loop over the variables. + */ + + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + for (i=2; i<=numWords; varTokenPtr = TokenAfter(varTokenPtr),i++) { + localIndex = IndexTailVarIfKnown(interp, varTokenPtr, envPtr); + + if (localIndex < 0) { + return TCL_ERROR; + } + + CompileWord(envPtr, varTokenPtr, interp, 1); + TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); + } + + /* + * Pop the namespace, and set the result to empty + */ + + TclEmitOpcode( INST_POP, envPtr); + PushLiteral(envPtr, "", 0); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileIfCmd -- + * + * Procedure called to compile the "if" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "if" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileIfCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + JumpFixupArray jumpFalseFixupArray; + /* Used to fix the ifFalse jump after each + * test when its target PC is determined. */ + JumpFixupArray jumpEndFixupArray; + /* Used to fix the jump after each "then" body + * to the end of the "if" when that PC is + * determined. */ + Tcl_Token *tokenPtr, *testTokenPtr; + int jumpIndex = 0; /* Avoid compiler warning. */ + int jumpFalseDist, numWords, wordIdx, numBytes, j, code; + const char *word; + int savedStackDepth = envPtr->currStackDepth; + /* Saved stack depth at the start of the first + * test; the envPtr current depth is restored + * to this value at the start of each test. */ + int realCond = 1; /* Set to 0 for static conditions: + * "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 + * order to insure correct substitution [Bug 219166] + */ + + tokenPtr = parsePtr->tokenPtr; + wordIdx = 0; + numWords = parsePtr->numWords; + + for (wordIdx = 0; wordIdx < numWords; wordIdx++) { + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(tokenPtr); + } + + TclInitJumpFixupArray(&jumpFalseFixupArray); + TclInitJumpFixupArray(&jumpEndFixupArray); + code = TCL_OK; + + /* + * Each iteration of this loop compiles one "if expr ?then? body" or + * "elseif expr ?then? body" clause. + */ + + tokenPtr = parsePtr->tokenPtr; + wordIdx = 0; + while (wordIdx < numWords) { + /* + * Stop looping if the token isn't "if" or "elseif". + */ + + word = tokenPtr[1].start; + numBytes = tokenPtr[1].size; + if ((tokenPtr == parsePtr->tokenPtr) + || ((numBytes == 6) && (strncmp(word, "elseif", 6) == 0))) { + tokenPtr = TokenAfter(tokenPtr); + wordIdx++; + } else { + break; + } + if (wordIdx >= numWords) { + code = TCL_ERROR; + goto done; + } + + /* + * Compile the test expression then emit the conditional jump around + * the "then" part. + */ + + envPtr->currStackDepth = savedStackDepth; + testTokenPtr = tokenPtr; + + if (realCond) { + /* + * Find out if the condition is a constant. + */ + + Tcl_Obj *boolObj = Tcl_NewStringObj(testTokenPtr[1].start, + testTokenPtr[1].size); + + Tcl_IncrRefCount(boolObj); + code = Tcl_GetBooleanFromObj(NULL, boolObj, &boolVal); + TclDecrRefCount(boolObj); + if (code == TCL_OK) { + /* + * A static condition. + */ + + realCond = 0; + if (!boolVal) { + compileScripts = 0; + } + } else { + SetLineInformation(wordIdx); + Tcl_ResetResult(interp); + TclCompileExprWords(interp, testTokenPtr, 1, envPtr); + if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) { + TclExpandJumpFixupArray(&jumpFalseFixupArray); + } + jumpIndex = jumpFalseFixupArray.next; + jumpFalseFixupArray.next++; + TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, + jumpFalseFixupArray.fixup+jumpIndex); + } + code = TCL_OK; + } + + /* + * Skip over the optional "then" before the then clause. + */ + + tokenPtr = TokenAfter(testTokenPtr); + wordIdx++; + if (wordIdx >= numWords) { + code = TCL_ERROR; + goto done; + } + if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + word = tokenPtr[1].start; + numBytes = tokenPtr[1].size; + if ((numBytes == 4) && (strncmp(word, "then", 4) == 0)) { + tokenPtr = TokenAfter(tokenPtr); + wordIdx++; + if (wordIdx >= numWords) { + code = TCL_ERROR; + goto done; + } + } + } + + /* + * Compile the "then" command body. + */ + + if (compileScripts) { + SetLineInformation(wordIdx); + envPtr->currStackDepth = savedStackDepth; + CompileBody(envPtr, tokenPtr, interp); + } + + if (realCond) { + /* + * Jump to the end of the "if" command. Both jumpFalseFixupArray + * and jumpEndFixupArray are indexed by "jumpIndex". + */ + + if (jumpEndFixupArray.next >= jumpEndFixupArray.end) { + TclExpandJumpFixupArray(&jumpEndFixupArray); + } + jumpEndFixupArray.next++; + TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, + jumpEndFixupArray.fixup+jumpIndex); + + /* + * Fix the target of the jumpFalse after the test. Generate a 4 + * byte jump if the distance is > 120 bytes. This is conservative, + * and ensures that we won't have to replace this jump if we later + * also need to replace the proceeding jump to the end of the "if" + * with a 4 byte jump. + */ + + if (TclFixupForwardJumpToHere(envPtr, + jumpFalseFixupArray.fixup+jumpIndex, 120)) { + /* + * Adjust the code offset for the proceeding jump to the end + * of the "if" command. + */ + + jumpEndFixupArray.fixup[jumpIndex].codeOffset += 3; + } + } else if (boolVal) { + /* + * We were processing an "if 1 {...}"; stop compiling scripts. + */ + + compileScripts = 0; + } else { + /* + * We were processing an "if 0 {...}"; reset so that the rest + * (elseif, else) is compiled correctly. + */ + + realCond = 1; + compileScripts = 1; + } + + tokenPtr = TokenAfter(tokenPtr); + wordIdx++; + } + + /* + * Restore the current stack depth in the environment; the "else" clause + * (or its default) will add 1 to this. + */ + + envPtr->currStackDepth = savedStackDepth; + + /* + * Check for the optional else clause. Do not compile anything if this was + * an "if 1 {...}" case. + */ + + if ((wordIdx < numWords) && (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD)) { + /* + * There is an else clause. Skip over the optional "else" word. + */ + + word = tokenPtr[1].start; + numBytes = tokenPtr[1].size; + if ((numBytes == 4) && (strncmp(word, "else", 4) == 0)) { + tokenPtr = TokenAfter(tokenPtr); + wordIdx++; + if (wordIdx >= numWords) { + code = TCL_ERROR; + goto done; + } + } + + if (compileScripts) { + /* + * Compile the else command body. + */ + + SetLineInformation(wordIdx); + CompileBody(envPtr, tokenPtr, interp); + } + + /* + * Make sure there are no words after the else clause. + */ + + wordIdx++; + if (wordIdx < numWords) { + code = TCL_ERROR; + goto done; + } + } else { + /* + * No else clause: the "if" command's result is an empty string. + */ + + if (compileScripts) { + PushLiteral(envPtr, "", 0); + } + } + + /* + * Fix the unconditional jumps to the end of the "if" command. + */ + + for (j = jumpEndFixupArray.next; j > 0; j--) { + jumpIndex = (j - 1); /* i.e. process the closest jump first. */ + if (TclFixupForwardJumpToHere(envPtr, + jumpEndFixupArray.fixup+jumpIndex, 127)) { + /* + * Adjust the immediately preceeding "ifFalse" jump. We moved it's + * target (just after this jump) down three bytes. + */ + + unsigned char *ifFalsePc = envPtr->codeStart + + jumpFalseFixupArray.fixup[jumpIndex].codeOffset; + unsigned char opCode = *ifFalsePc; + + if (opCode == INST_JUMP_FALSE1) { + jumpFalseDist = TclGetInt1AtPtr(ifFalsePc + 1); + jumpFalseDist += 3; + TclStoreInt1AtPtr(jumpFalseDist, (ifFalsePc + 1)); + } else if (opCode == INST_JUMP_FALSE4) { + jumpFalseDist = TclGetInt4AtPtr(ifFalsePc + 1); + jumpFalseDist += 3; + TclStoreInt4AtPtr(jumpFalseDist, (ifFalsePc + 1)); + } else { + Tcl_Panic("TclCompileIfCmd: unexpected opcode \"%d\" updating ifFalse jump", (int) opCode); + } + } + } + + /* + * Free the jumpFixupArray array if malloc'ed storage was used. + */ + + done: + envPtr->currStackDepth = savedStackDepth + 1; + TclFreeJumpFixupArray(&jumpFalseFixupArray); + TclFreeJumpFixupArray(&jumpEndFixupArray); + return code; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileIncrCmd -- + * + * Procedure called to compile the "incr" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "incr" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileIncrCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *varTokenPtr, *incrTokenPtr; + int simpleVarName, isScalar, localIndex, haveImmValue, immValue; + DefineLineInformation; /* TIP #280 */ + + if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { + return TCL_ERROR; + } + + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_LARGE_INDEX, + &localIndex, &simpleVarName, &isScalar, 1); + + /* + * If an increment is given, push it, but see first if it's a small + * integer. + */ + + haveImmValue = 0; + immValue = 1; + if (parsePtr->numWords == 3) { + incrTokenPtr = TokenAfter(varTokenPtr); + if (incrTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + const char *word = incrTokenPtr[1].start; + int numBytes = incrTokenPtr[1].size; + int code; + Tcl_Obj *intObj = Tcl_NewStringObj(word, numBytes); + + Tcl_IncrRefCount(intObj); + code = TclGetIntFromObj(NULL, intObj, &immValue); + TclDecrRefCount(intObj); + if ((code == TCL_OK) && (-127 <= immValue) && (immValue <= 127)) { + haveImmValue = 1; + } + if (!haveImmValue) { + PushLiteral(envPtr, word, numBytes); + } + } else { + SetLineInformation(2); + CompileTokens(envPtr, incrTokenPtr, interp); + } + } else { /* No incr amount given so use 1. */ + haveImmValue = 1; + } + + /* + * Emit the instruction to increment the variable. + */ + + if (!simpleVarName) { + if (haveImmValue) { + TclEmitInstInt1( INST_INCR_STK_IMM, immValue, envPtr); + } else { + TclEmitOpcode( INST_INCR_STK, envPtr); + } + } else if (isScalar) { /* Simple scalar variable. */ + if (localIndex >= 0) { + if (haveImmValue) { + TclEmitInstInt1(INST_INCR_SCALAR1_IMM, localIndex, envPtr); + TclEmitInt1(immValue, envPtr); + } else { + TclEmitInstInt1(INST_INCR_SCALAR1, localIndex, envPtr); + } + } else { + if (haveImmValue) { + TclEmitInstInt1(INST_INCR_SCALAR_STK_IMM, immValue, envPtr); + } else { + TclEmitOpcode( INST_INCR_SCALAR_STK, envPtr); + } + } + } else { /* Simple array variable. */ + if (localIndex >= 0) { + if (haveImmValue) { + TclEmitInstInt1(INST_INCR_ARRAY1_IMM, localIndex, envPtr); + TclEmitInt1(immValue, envPtr); + } else { + TclEmitInstInt1(INST_INCR_ARRAY1, localIndex, envPtr); + } + } else { + if (haveImmValue) { + TclEmitInstInt1(INST_INCR_ARRAY_STK_IMM, immValue, envPtr); + } else { + TclEmitOpcode( INST_INCR_ARRAY_STK, envPtr); + } + } + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileInfo*Cmd -- + * + * Procedures called to compile "info" subcommands. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "info" subcommand at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileInfoCommandsCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) +{ + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr; + Tcl_Obj *objPtr; + char *bytes; + + /* + * We require one compile-time known argument for the case we can compile. + */ + + if (parsePtr->numWords == 1) { + return TclCompileBasic0ArgCmd(interp, parsePtr, cmdPtr, envPtr); + } else if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(parsePtr->tokenPtr); + objPtr = Tcl_NewObj(); + Tcl_IncrRefCount(objPtr); + if (!TclWordKnownAtCompileTime(tokenPtr, objPtr)) { + goto notCompilable; + } + bytes = Tcl_GetString(objPtr); + + /* + * We require that the argument start with "::" and not have any of "*\[?" + * in it. (Theoretically, we should look in only the final component, but + * the difference is so slight given current naming practices.) + */ + + if (bytes[0] != ':' || bytes[1] != ':' || !TclMatchIsTrivial(bytes)) { + goto notCompilable; + } + Tcl_DecrRefCount(objPtr); + + /* + * Confirmed as a literal that will not frighten the horses. Compile. Note + * that the result needs to be list-ified. + */ + + CompileWord(envPtr, tokenPtr, interp, 1); + TclEmitOpcode( INST_RESOLVE_COMMAND, envPtr); + TclEmitOpcode( INST_DUP, envPtr); + TclEmitOpcode( INST_STR_LEN, envPtr); + TclEmitInstInt1( INST_JUMP_FALSE1, 7, envPtr); + TclEmitInstInt4( INST_LIST, 1, envPtr); + return TCL_OK; + + notCompilable: + Tcl_DecrRefCount(objPtr); + return TclCompileBasic1ArgCmd(interp, parsePtr, cmdPtr, envPtr); +} + +int +TclCompileInfoCoroutineCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + /* + * Only compile [info coroutine] without arguments. + */ + + if (parsePtr->numWords != 1) { + return TCL_ERROR; + } + + /* + * Not much to do; we compile to a single instruction... + */ + + TclEmitOpcode( INST_COROUTINE_NAME, envPtr); + return TCL_OK; +} + +int +TclCompileInfoExistsCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr; + int isScalar, simpleVarName, localIndex; + DefineLineInformation; /* TIP #280 */ + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + + /* + * Decide if we can use a frame slot for the var/array name or if we need + * to emit code to compute and push the name at runtime. We use a frame + * slot (entry in the array of local vars) if we are compiling a procedure + * body and if the name is simple text that does not include namespace + * qualifiers. + */ + + tokenPtr = TokenAfter(parsePtr->tokenPtr); + PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex, + &simpleVarName, &isScalar, 1); + + /* + * Emit instruction to check the variable for existence. + */ + + if (!simpleVarName) { + TclEmitOpcode( INST_EXIST_STK, envPtr); + } else if (isScalar) { + if (localIndex < 0) { + TclEmitOpcode( INST_EXIST_STK, envPtr); + } else { + TclEmitInstInt4( INST_EXIST_SCALAR, localIndex, envPtr); + } + } else { + if (localIndex < 0) { + TclEmitOpcode( INST_EXIST_ARRAY_STK, envPtr); + } else { + TclEmitInstInt4( INST_EXIST_ARRAY, localIndex, envPtr); + } + } + + return TCL_OK; +} + +int +TclCompileInfoLevelCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + /* + * Only compile [info level] without arguments or with a single argument. + */ + + if (parsePtr->numWords == 1) { + /* + * Not much to do; we compile to a single instruction... + */ + + TclEmitOpcode( INST_INFO_LEVEL_NUM, envPtr); + } else if (parsePtr->numWords != 2) { + return TCL_ERROR; + } else { + DefineLineInformation; /* TIP #280 */ + + /* + * Compile the argument, then add the instruction to convert it into a + * list of arguments. + */ + + SetLineInformation(1); + CompileTokens(envPtr, TokenAfter(parsePtr->tokenPtr), interp); + TclEmitOpcode( INST_INFO_LEVEL_ARGS, envPtr); + } + return TCL_OK; +} + +int +TclCompileInfoObjectClassCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) +{ + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + CompileWord(envPtr, tokenPtr, interp, 1); + TclEmitOpcode( INST_TCLOO_CLASS, envPtr); + return TCL_OK; +} + +int +TclCompileInfoObjectIsACmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) +{ + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); + + /* + * We only handle [info object isa object ]. The first three + * words are compressed to a single token by the ensemble compilation + * engine. + */ + + if (parsePtr->numWords != 3) { + return TCL_ERROR; + } + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size < 1 + || strncmp(tokenPtr[1].start, "object", tokenPtr[1].size)) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(tokenPtr); + + /* + * Issue the code. + */ + + CompileWord(envPtr, tokenPtr, interp, 2); + TclEmitOpcode( INST_TCLOO_IS_OBJECT, envPtr); + return TCL_OK; +} + +int +TclCompileInfoObjectNamespaceCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) +{ + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + CompileWord(envPtr, tokenPtr, interp, 1); + TclEmitOpcode( INST_TCLOO_NS, envPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLappendCmd -- + * + * Procedure called to compile the "lappend" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "lappend" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLappendCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *varTokenPtr, *valueTokenPtr; + int simpleVarName, isScalar, localIndex, numWords, i, fwd, offsetFwd; + DefineLineInformation; /* TIP #280 */ + + /* + * If we're not in a procedure, don't compile. + */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + + numWords = parsePtr->numWords; + if (numWords == 1) { + return TCL_ERROR; + } + if (numWords != 3) { + /* + * LAPPEND instructions currently only handle one value, but we can + * handle some multi-value cases by stringing them together. + */ + + goto lappendMultiple; + } + + /* + * Decide if we can use a frame slot for the var/array name or if we + * need to emit code to compute and push the name at runtime. We use a + * frame slot (entry in the array of local vars) if we are compiling a + * procedure body and if the name is simple text that does not include + * namespace qualifiers. + */ + + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + + PushVarNameWord(interp, varTokenPtr, envPtr, 0, + &localIndex, &simpleVarName, &isScalar, 1); + + /* + * If we are doing an assignment, push the new value. In the no values + * case, create an empty object. + */ + + if (numWords > 2) { + Tcl_Token *valueTokenPtr = TokenAfter(varTokenPtr); + + CompileWord(envPtr, valueTokenPtr, interp, 2); + } + + /* + * Emit instructions to set/get the variable. + */ + + /* + * The *_STK opcodes should be refactored to make better use of existing + * LOAD/STORE instructions. + */ + + if (!simpleVarName) { + TclEmitOpcode( INST_LAPPEND_STK, envPtr); + } else if (isScalar) { + if (localIndex < 0) { + TclEmitOpcode( INST_LAPPEND_STK, envPtr); + } else { + Emit14Inst( INST_LAPPEND_SCALAR, localIndex, envPtr); + } + } else { + if (localIndex < 0) { + TclEmitOpcode( INST_LAPPEND_ARRAY_STK, envPtr); + } else { + Emit14Inst( INST_LAPPEND_ARRAY, localIndex, envPtr); + } + } + + return TCL_OK; + + lappendMultiple: + /* + * Can only handle the case where we are appending to a local scalar when + * there are multiple values to append. Fortunately, this is common. + */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, + &localIndex, &simpleVarName, &isScalar, 1); + if (!isScalar || localIndex < 0) { + return TCL_ERROR; + } + + /* + * Definitely appending to a local scalar; generate the words and append + * them. + */ + + valueTokenPtr = TokenAfter(varTokenPtr); + for (i = 2 ; i < numWords ; i++) { + CompileWord(envPtr, valueTokenPtr, interp, i); + valueTokenPtr = TokenAfter(valueTokenPtr); + } + TclEmitInstInt4( INST_LIST, numWords-2, envPtr); + TclEmitInstInt4( INST_EXIST_SCALAR, localIndex, envPtr); + offsetFwd = CurrentOffset(envPtr); + TclEmitInstInt1( INST_JUMP_FALSE1, 0, envPtr); + Emit14Inst( INST_LOAD_SCALAR, localIndex, envPtr); + TclEmitInstInt4( INST_REVERSE, 2, envPtr); + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + fwd = CurrentOffset(envPtr) - offsetFwd; + TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); + Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLassignCmd -- + * + * Procedure called to compile the "lassign" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "lassign" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLassignCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr; + int simpleVarName, isScalar, localIndex, numWords, idx; + DefineLineInformation; /* TIP #280 */ + + numWords = parsePtr->numWords; + + /* + * Check for command syntax error, but we'll punt that to runtime. + */ + + if (numWords < 3) { + return TCL_ERROR; + } + + /* + * Generate code to push list being taken apart by [lassign]. + */ + + tokenPtr = TokenAfter(parsePtr->tokenPtr); + CompileWord(envPtr, tokenPtr, interp, 1); + + /* + * Generate code to assign values from the list to variables. + */ + + for (idx=0 ; idx= 0) { + TclEmitOpcode( INST_DUP, envPtr); + TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); + Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); + TclEmitOpcode( INST_POP, envPtr); + } else { + TclEmitInstInt4(INST_OVER, 1, envPtr); + TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); + TclEmitOpcode( INST_STORE_SCALAR_STK, envPtr); + TclEmitOpcode( INST_POP, envPtr); + } + } else { + if (localIndex >= 0) { + TclEmitInstInt4(INST_OVER, 1, envPtr); + TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); + Emit14Inst( INST_STORE_ARRAY, localIndex, envPtr); + TclEmitOpcode( INST_POP, envPtr); + } else { + TclEmitInstInt4(INST_OVER, 2, envPtr); + TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); + TclEmitOpcode( INST_STORE_ARRAY_STK, envPtr); + TclEmitOpcode( INST_POP, envPtr); + } + } + } + + /* + * Generate code to leave the rest of the list on the stack. + */ + + TclEmitInstInt4( INST_LIST_RANGE_IMM, idx, envPtr); + TclEmitInt4( -2 /* == "end" */, envPtr); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLindexCmd -- + * + * Procedure called to compile the "lindex" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "lindex" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLindexCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *idxTokenPtr, *valTokenPtr; + int i, numWords = parsePtr->numWords; + DefineLineInformation; /* TIP #280 */ + + /* + * Quit if too few args. + */ + + if (numWords <= 1) { + return TCL_ERROR; + } + + valTokenPtr = TokenAfter(parsePtr->tokenPtr); + if (numWords != 3) { + goto emitComplexLindex; + } + + idxTokenPtr = TokenAfter(valTokenPtr); + if (idxTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + Tcl_Obj *tmpObj; + int idx, result; + + tmpObj = Tcl_NewStringObj(idxTokenPtr[1].start, idxTokenPtr[1].size); + result = TclGetIntFromObj(NULL, tmpObj, &idx); + if (result == TCL_OK) { + if (idx < 0) { + result = TCL_ERROR; + } + } else { + result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx); + if (result == TCL_OK && idx > -2) { + result = TCL_ERROR; + } + } + TclDecrRefCount(tmpObj); + + if (result == TCL_OK) { + /* + * All checks have been completed, and we have exactly one of + * these constructs: + * lindex + * lindex end- + * This is best compiled as a push of the arbitrary value followed + * by an "immediate lindex" which is the most efficient variety. + */ + + CompileWord(envPtr, valTokenPtr, interp, 1); + TclEmitInstInt4( INST_LIST_INDEX_IMM, idx, envPtr); + return TCL_OK; + } + + /* + * If the conversion failed or the value was negative, we just keep on + * going with the more complex compilation. + */ + } + + /* + * Push the operands onto the stack. + */ + + emitComplexLindex: + for (i=1 ; inumWords == 1) { + /* + * [list] without arguments just pushes an empty object. + */ + + PushLiteral(envPtr, "", 0); + return TCL_OK; + } + + /* + * Test if all arguments are compile-time known. If they are, we can + * implement with a simple push. + */ + + numWords = parsePtr->numWords; + valueTokenPtr = TokenAfter(parsePtr->tokenPtr); + listObj = Tcl_NewObj(); + for (i = 1; i < numWords && listObj != NULL; i++) { + objPtr = Tcl_NewObj(); + if (TclWordKnownAtCompileTime(valueTokenPtr, objPtr)) { + (void) Tcl_ListObjAppendElement(NULL, listObj, objPtr); + } else { + Tcl_DecrRefCount(objPtr); + Tcl_DecrRefCount(listObj); + listObj = NULL; + } + valueTokenPtr = TokenAfter(valueTokenPtr); + } + if (listObj != NULL) { + int len; + const char *bytes = Tcl_GetStringFromObj(listObj, &len); + + PushLiteral(envPtr, bytes, len); + Tcl_DecrRefCount(listObj); + if (len > 0) { + /* + * Force list interpretation! + */ + + TclEmitOpcode( INST_DUP, envPtr); + TclEmitOpcode( INST_LIST_LENGTH, envPtr); + TclEmitOpcode( INST_POP, envPtr); + } + return TCL_OK; + } + + /* + * Push the all values onto the stack. + */ + + numWords = parsePtr->numWords; + valueTokenPtr = TokenAfter(parsePtr->tokenPtr); + concat = build = 0; + for (i = 1; i < numWords; i++) { + if (valueTokenPtr->type == TCL_TOKEN_EXPAND_WORD && build > 0) { + TclEmitInstInt4( INST_LIST, build, envPtr); + if (concat) { + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + } + build = 0; + concat = 1; + } + CompileWord(envPtr, valueTokenPtr, interp, i); + if (valueTokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + if (concat) { + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + } else { + concat = 1; + } + } else { + build++; + } + valueTokenPtr = TokenAfter(valueTokenPtr); + } + if (build > 0) { + TclEmitInstInt4( INST_LIST, build, envPtr); + if (concat) { + TclEmitOpcode( INST_LIST_CONCAT, envPtr); + } + } + + /* + * If there was just one expanded word, we must ensure that it is a list + * at this point. We use an [lrange ... 0 end] for this (instead of + * [llength], as with literals) as we must drop any string representation + * that might be hanging around. + */ + + if (concat && numWords == 2) { + TclEmitInstInt4( INST_LIST_RANGE_IMM, 0, envPtr); + TclEmitInt4( -2, envPtr); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLlengthCmd -- + * + * Procedure called to compile the "llength" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "llength" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLlengthCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *varTokenPtr; + DefineLineInformation; /* TIP #280 */ + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + + CompileWord(envPtr, varTokenPtr, interp, 1); + TclEmitOpcode( INST_LIST_LENGTH, envPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLrangeCmd -- + * + * How to compile the "lrange" command. We only bother because we needed + * the opcode anyway for "lassign". + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLrangeCmd( + Tcl_Interp *interp, /* Tcl interpreter for context. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the + * command. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds the resulting instructions. */ +{ + Tcl_Token *tokenPtr, *listTokenPtr; + DefineLineInformation; /* TIP #280 */ + Tcl_Obj *tmpObj; + int idx1, idx2, result; + + if (parsePtr->numWords != 4) { + return TCL_ERROR; + } + listTokenPtr = TokenAfter(parsePtr->tokenPtr); + + /* + * Parse the first index. Will only compile if it is constant and not an + * _integer_ less than zero (since we reserve negative indices here for + * end-relative indexing). + */ + + tokenPtr = TokenAfter(listTokenPtr); + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return TCL_ERROR; + } + tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); + result = TclGetIntFromObj(NULL, tmpObj, &idx1); + if (result == TCL_OK) { + if (idx1 < 0) { + result = TCL_ERROR; + } + } else { + result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx1); + if (result == TCL_OK && idx1 > -2) { + result = TCL_ERROR; + } + } + TclDecrRefCount(tmpObj); + if (result != TCL_OK) { + return TCL_ERROR; + } + + /* + * Parse the second index. Will only compile if it is constant and not an + * _integer_ less than zero (since we reserve negative indices here for + * end-relative indexing). + */ + + tokenPtr = TokenAfter(tokenPtr); + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return TCL_ERROR; + } + tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); + result = TclGetIntFromObj(NULL, tmpObj, &idx2); + if (result == TCL_OK) { + if (idx2 < 0) { + result = TCL_ERROR; + } + } else { + result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx2); + if (result == TCL_OK && idx2 > -2) { + result = TCL_ERROR; + } + } + TclDecrRefCount(tmpObj); + if (result != TCL_OK) { + return TCL_ERROR; + } + + /* + * Issue instructions. It's not safe to skip doing the LIST_RANGE, as + * we've not proved that the 'list' argument is really a list. Not that it + * is worth trying to do that given current knowledge. + */ + + CompileWord(envPtr, listTokenPtr, interp, 1); + TclEmitInstInt4( INST_LIST_RANGE_IMM, idx1, envPtr); + TclEmitInt4( idx2, envPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLreplaceCmd -- + * + * How to compile the "lreplace" command. We only bother with the case + * where there are no elements to insert and where both the 'first' and + * 'last' arguments are constant and one can be deterined to be at the + * end of the list. (This is the case that could also be written with + * "lrange".) + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLreplaceCmd( + Tcl_Interp *interp, /* Tcl interpreter for context. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the + * command. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds the resulting instructions. */ +{ + Tcl_Token *tokenPtr, *listTokenPtr; + DefineLineInformation; /* TIP #280 */ + Tcl_Obj *tmpObj; + int idx1, idx2, result, guaranteedDropAll = 0; + + if (parsePtr->numWords != 4) { + return TCL_ERROR; + } + listTokenPtr = TokenAfter(parsePtr->tokenPtr); + + /* + * Parse the first index. Will only compile if it is constant and not an + * _integer_ less than zero (since we reserve negative indices here for + * end-relative indexing). + */ + + tokenPtr = TokenAfter(listTokenPtr); + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return TCL_ERROR; + } + tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); + result = TclGetIntFromObj(NULL, tmpObj, &idx1); + if (result == TCL_OK) { + if (idx1 < 0) { + result = TCL_ERROR; + } + } else { + result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx1); + if (result == TCL_OK && idx1 > -2) { + result = TCL_ERROR; + } + } + TclDecrRefCount(tmpObj); + if (result != TCL_OK) { + return TCL_ERROR; + } + + /* + * Parse the second index. Will only compile if it is constant and not an + * _integer_ less than zero (since we reserve negative indices here for + * end-relative indexing). + */ + + tokenPtr = TokenAfter(tokenPtr); + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return TCL_ERROR; + } + tmpObj = Tcl_NewStringObj(tokenPtr[1].start, tokenPtr[1].size); + result = TclGetIntFromObj(NULL, tmpObj, &idx2); + if (result == TCL_OK) { + if (idx2 < 0) { + result = TCL_ERROR; + } + } else { + result = TclGetIntForIndexM(NULL, tmpObj, -2, &idx2); + if (result == TCL_OK && idx2 > -2) { + result = TCL_ERROR; + } + } + TclDecrRefCount(tmpObj); + if (result != TCL_OK) { + return TCL_ERROR; + } + + /* + * Sanity check: can only issue when we're removing a range at one or + * other end of the list. If we're at one end or the other, convert the + * indices into the equivalent for an [lrange]. + */ + + if (idx1 == 0) { + if (idx2 == -2) { + guaranteedDropAll = 1; + } + idx1 = idx2 + 1; + idx2 = -2; + } else if (idx2 == -2) { + idx2 = idx1 - 1; + idx1 = 0; + } else { + return TCL_ERROR; + } + + /* + * Issue instructions. It's not safe to skip doing the LIST_RANGE, as + * we've not proved that the 'list' argument is really a list. Not that it + * is worth trying to do that given current knowledge. + */ + + CompileWord(envPtr, listTokenPtr, interp, 1); + if (guaranteedDropAll) { + TclEmitOpcode( INST_LIST_LENGTH, envPtr); + TclEmitOpcode( INST_POP, envPtr); + PushLiteral(envPtr, "", 0); + } else { + TclEmitInstInt4( INST_LIST_RANGE_IMM, idx1, envPtr); + TclEmitInt4( idx2, envPtr); + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileLsetCmd -- + * + * Procedure called to compile the "lset" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "lset" command at + * runtime. + * + * The general template for execution of the "lset" command is: + * (1) Instructions to push the variable name, unless the variable is + * local to the stack frame. + * (2) If the variable is an array element, instructions to push the + * array element name. + * (3) Instructions to push each of zero or more "index" arguments to the + * stack, followed with the "newValue" element. + * (4) Instructions to duplicate the variable name and/or array element + * name onto the top of the stack, if either was pushed at steps (1) + * and (2). + * (5) The appropriate INST_LOAD_* instruction to place the original + * value of the list variable at top of stack. + * (6) At this point, the stack contains: + * varName? arrayElementName? index1 index2 ... newValue oldList + * The compiler emits one of INST_LSET_FLAT or INST_LSET_LIST + * according as whether there is exactly one index element (LIST) or + * either zero or else two or more (FLAT). This instruction removes + * everything from the stack except for the two names and pushes the + * new value of the variable. + * (7) Finally, INST_STORE_* stores the new value in the variable and + * cleans up the stack. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileLsetCmd( + Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the + * command. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds the resulting instructions. */ +{ + int tempDepth; /* Depth used for emitting one part of the + * code burst. */ + Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the + * parse of the variable name. */ + int localIndex; /* Index of var in local var table. */ + int simpleVarName; /* Flag == 1 if var name is simple. */ + int isScalar; /* Flag == 1 if scalar, 0 if array. */ + int i; + DefineLineInformation; /* TIP #280 */ + + /* + * Check argument count. + */ + + if (parsePtr->numWords < 3) { + /* + * Fail at run time, not in compilation. + */ + + return TCL_ERROR; + } + + /* + * Decide if we can use a frame slot for the var/array name or if we need + * to emit code to compute and push the name at runtime. We use a frame + * slot (entry in the array of local vars) if we are compiling a procedure + * body and if the name is simple text that does not include namespace + * qualifiers. + */ + + varTokenPtr = TokenAfter(parsePtr->tokenPtr); + PushVarNameWord(interp, varTokenPtr, envPtr, 0, + &localIndex, &simpleVarName, &isScalar, 1); + + /* + * Push the "index" args and the new element value. + */ + + for (i=2 ; inumWords ; ++i) { + varTokenPtr = TokenAfter(varTokenPtr); + CompileWord(envPtr, varTokenPtr, interp, i); + } + + /* + * Duplicate the variable name if it's been pushed. + */ + + if (!simpleVarName || localIndex < 0) { + if (!simpleVarName || isScalar) { + tempDepth = parsePtr->numWords - 2; + } else { + tempDepth = parsePtr->numWords - 1; + } + TclEmitInstInt4( INST_OVER, tempDepth, envPtr); + } + + /* + * Duplicate an array index if one's been pushed. + */ + + if (simpleVarName && !isScalar) { + if (localIndex < 0) { + tempDepth = parsePtr->numWords - 1; + } else { + tempDepth = parsePtr->numWords - 2; + } + TclEmitInstInt4( INST_OVER, tempDepth, envPtr); + } + + /* + * Emit code to load the variable's value. + */ + + if (!simpleVarName) { + TclEmitOpcode( INST_LOAD_STK, envPtr); + } else if (isScalar) { + if (localIndex < 0) { + TclEmitOpcode( INST_LOAD_SCALAR_STK, envPtr); + } else { + Emit14Inst( INST_LOAD_SCALAR, localIndex, envPtr); + } + } else { + if (localIndex < 0) { + TclEmitOpcode( INST_LOAD_ARRAY_STK, envPtr); + } else { + Emit14Inst( INST_LOAD_ARRAY, localIndex, envPtr); + } + } + + /* + * Emit the correct variety of 'lset' instruction. + */ + + if (parsePtr->numWords == 4) { + TclEmitOpcode( INST_LSET_LIST, envPtr); + } else { + TclEmitInstInt4( INST_LSET_FLAT, parsePtr->numWords-1, envPtr); + } + + /* + * Emit code to put the value back in the variable. + */ + + if (!simpleVarName) { + TclEmitOpcode( INST_STORE_STK, envPtr); + } else if (isScalar) { + if (localIndex < 0) { + TclEmitOpcode( INST_STORE_SCALAR_STK, envPtr); + } else { + Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); + } + } else { + if (localIndex < 0) { + TclEmitOpcode( INST_STORE_ARRAY_STK, envPtr); + } else { + Emit14Inst( INST_STORE_ARRAY, localIndex, envPtr); + } + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileNamespace*Cmd -- + * + * Procedures called to compile the "namespace" command; currently, only + * the subcommands "namespace current" and "namespace upvar" are compiled + * to bytecodes, and the latter only inside a procedure(-like) context. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "namespace upvar" + * command at runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileNamespaceCurrentCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + /* + * Only compile [namespace current] without arguments. + */ + + if (parsePtr->numWords != 1) { + return TCL_ERROR; + } + + /* + * Not much to do; we compile to a single instruction... + */ + + TclEmitOpcode( INST_NS_CURRENT, envPtr); + return TCL_OK; +} + +int +TclCompileNamespaceCodeCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr; + DefineLineInformation; /* TIP #280 */ + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(parsePtr->tokenPtr); + + /* + * The specification of [namespace code] is rather shocking, in that it is + * supposed to check if the argument is itself the result of [namespace + * code] and not apply itself in that case. Which is excessively cautious, + * but what the test suite checks for. + */ + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || (tokenPtr[1].size > 20 + && strncmp(tokenPtr[1].start, "::namespace inscope ", 20) == 0)) { + /* + * Technically, we could just pass a literal '::namespace inscope ' + * term through, but that's something which really shouldn't be + * occurring as something that the user writes so we'll just punt it. + */ + + return TCL_ERROR; + } + + /* + * Now we can compile using the same strategy as [namespace code]'s normal + * implementation does internally. Note that we can't bind the namespace + * name directly here, because TclOO plays complex games with namespaces; + * the value needs to be determined at runtime for safety. + */ + + PushLiteral(envPtr, "::namespace", 11); + PushLiteral(envPtr, "inscope", 7); + TclEmitOpcode( INST_NS_CURRENT, envPtr); + CompileWord(envPtr, tokenPtr, interp, 1); + TclEmitInstInt4( INST_LIST, 4, envPtr); + return TCL_OK; +} + +int +TclCompileNamespaceQualifiersCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); + DefineLineInformation; /* TIP #280 */ + int off; + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + + CompileWord(envPtr, tokenPtr, interp, 1); + PushLiteral(envPtr, "0", 1); + PushLiteral(envPtr, "::", 2); + TclEmitInstInt4( INST_OVER, 2, envPtr); + TclEmitOpcode( INST_STR_FIND_LAST, envPtr); + off = CurrentOffset(envPtr); + PushLiteral(envPtr, "1", 1); + TclEmitOpcode( INST_SUB, envPtr); + TclEmitInstInt4( INST_OVER, 2, envPtr); + TclEmitInstInt4( INST_OVER, 1, envPtr); + TclEmitOpcode( INST_STR_INDEX, envPtr); + PushLiteral(envPtr, ":", 1); + TclEmitOpcode( INST_STR_EQ, envPtr); + off = off - CurrentOffset(envPtr); + TclEmitInstInt1( INST_JUMP_TRUE1, off, envPtr); + TclEmitOpcode( INST_STR_RANGE, envPtr); + return TCL_OK; +} + +int +TclCompileNamespaceTailCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); + DefineLineInformation; /* TIP #280 */ + JumpFixup jumpFixup; + + if (parsePtr->numWords != 2) { + return TCL_ERROR; + } + + /* + * Take care; only add 2 to found index if the string was actually found. + */ + + CompileWord(envPtr, tokenPtr, interp, 1); + PushLiteral(envPtr, "::", 2); + TclEmitInstInt4( INST_OVER, 1, envPtr); + TclEmitOpcode( INST_STR_FIND_LAST, envPtr); + TclEmitOpcode( INST_DUP, envPtr); + PushLiteral(envPtr, "0", 1); + TclEmitOpcode( INST_GE, envPtr); + TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpFixup); + PushLiteral(envPtr, "2", 1); + TclEmitOpcode( INST_ADD, envPtr); + TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127); + PushLiteral(envPtr, "end", 3); + TclEmitOpcode( INST_STR_RANGE, envPtr); + return TCL_OK; +} + +int +TclCompileNamespaceUpvarCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; + int simpleVarName, isScalar, localIndex, numWords, i; + DefineLineInformation; /* TIP #280 */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + + /* + * Only compile [namespace upvar ...]: needs an even number of args, >=4 + */ + + numWords = parsePtr->numWords; + if ((numWords % 2) || (numWords < 4)) { + return TCL_ERROR; + } + + /* + * Push the namespace + */ + + tokenPtr = TokenAfter(parsePtr->tokenPtr); + CompileWord(envPtr, tokenPtr, interp, 1); + + /* + * Loop over the (otherVar, thisVar) pairs. If any of the thisVar is not a + * local variable, return an error so that the non-compiled command will + * be called at runtime. + */ + + localTokenPtr = tokenPtr; + for (i=3; i<=numWords; i+=2) { + otherTokenPtr = TokenAfter(localTokenPtr); + localTokenPtr = TokenAfter(otherTokenPtr); + + CompileWord(envPtr, otherTokenPtr, interp, 1); + PushVarNameWord(interp, localTokenPtr, envPtr, 0, + &localIndex, &simpleVarName, &isScalar, 1); + + if ((localIndex < 0) || !isScalar) { + return TCL_ERROR; + } + TclEmitInstInt4( INST_NSUPVAR, localIndex, envPtr); + } + + /* + * Pop the namespace, and set the result to empty + */ + + TclEmitOpcode( INST_POP, envPtr); + PushLiteral(envPtr, "", 0); + return TCL_OK; +} + +int +TclCompileNamespaceWhichCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *opt; + int idx; + + if (parsePtr->numWords < 2 || parsePtr->numWords > 3) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(parsePtr->tokenPtr); + idx = 1; + + /* + * If there's an option, check that it's "-command". We don't handle + * "-variable" (currently) and anything else is an error. + */ + + if (parsePtr->numWords == 3) { + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + return TCL_ERROR; + } + opt = tokenPtr + 1; + if (opt->size < 2 || opt->size > 8 + || strncmp(opt->start, "-command", opt->size) != 0) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(tokenPtr); + idx++; + } + + /* + * Issue the bytecode. + */ + + CompileWord(envPtr, tokenPtr, interp, idx); + TclEmitOpcode( INST_RESOLVE_COMMAND, envPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileRegexpCmd -- + * + * Procedure called to compile the "regexp" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "regexp" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileRegexpCmd( + Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the + * command. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds the resulting instructions. */ +{ + 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 + * supported compile cases are: + * regexp ?-nocase? ?--? staticString $var + * regexp ?-nocase? ?--? {^staticString$} $var + */ + + if (parsePtr->numWords < 3) { + return TCL_ERROR; + } + + simple = 0; + nocase = 0; + sawLast = 0; + varTokenPtr = parsePtr->tokenPtr; + + /* + * We only look for -nocase and -- as options. Everything else gets pushed + * to runtime execution. This is different than regexp's runtime option + * handling, but satisfies our stricter needs. + */ + + for (i = 1; i < parsePtr->numWords - 2; i++) { + varTokenPtr = TokenAfter(varTokenPtr); + if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + /* + * Not a simple string, so punt to runtime. + */ + + return TCL_ERROR; + } + str = varTokenPtr[1].start; + len = varTokenPtr[1].size; + if ((len == 2) && (str[0] == '-') && (str[1] == '-')) { + sawLast++; + i++; + break; + } else if ((len > 1) && (strncmp(str,"-nocase",(unsigned)len) == 0)) { + nocase = 1; + } else { + /* + * Not an option we recognize. + */ + + return TCL_ERROR; + } + } + + if ((parsePtr->numWords - i) != 2) { + /* + * We don't support capturing to variables. + */ + + return TCL_ERROR; + } + + /* + * Get the regexp string. If it is not a simple string or can't be + * converted to a glob pattern, push the word for the INST_REGEXP. + * Keep changes here in sync with TclCompileSwitchCmd Switch_Regexp. + */ + + varTokenPtr = TokenAfter(varTokenPtr); + + if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + Tcl_DString ds; + + str = varTokenPtr[1].start; + len = varTokenPtr[1].size; + + /* + * If it has a '-', it could be an incorrectly formed regexp command. + */ + + if ((*str == '-') && !sawLast) { + return TCL_ERROR; + } + + if (len == 0) { + /* + * The semantics of regexp are always match on re == "". + */ + + PushLiteral(envPtr, "1", 1); + return TCL_OK; + } + + /* + * Attempt to convert pattern to glob. If successful, push the + * converted pattern as a literal. + */ + + if (TclReToGlob(NULL, varTokenPtr[1].start, len, &ds, &exact) + == TCL_OK) { + simple = 1; + PushLiteral(envPtr, Tcl_DStringValue(&ds),Tcl_DStringLength(&ds)); + Tcl_DStringFree(&ds); + } + } + + if (!simple) { + CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-2); + } + + /* + * Push the string arg. + */ + + varTokenPtr = TokenAfter(varTokenPtr); + CompileWord(envPtr, varTokenPtr, interp, parsePtr->numWords-1); + + if (simple) { + if (exact && !nocase) { + TclEmitOpcode( INST_STR_EQ, envPtr); + } else { + TclEmitInstInt1( INST_STR_MATCH, nocase, envPtr); + } + } else { + /* + * Pass correct RE compile flags. We use only Int1 (8-bit), but + * that handles all the flags we want to pass. + * Don't use TCL_REG_NOSUB as we may have backrefs. + */ + + int cflags = TCL_REG_ADVANCED | (nocase ? TCL_REG_NOCASE : 0); + + TclEmitInstInt1( INST_REGEXP, cflags, envPtr); + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileRegsubCmd -- + * + * Procedure called to compile the "regsub" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "regsub" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileRegsubCmd( + Tcl_Interp *interp, /* Tcl interpreter for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the + * command. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds the resulting instructions. */ +{ + /* + * We only compile the case with [regsub -all] where the pattern is both + * known at compile time and simple (i.e., no RE metacharacters). That is, + * the pattern must be translatable into a glob like "*foo*" with no other + * glob metacharacters inside it; there must be some "foo" in there too. + * The substitution string must also be known at compile time and free of + * metacharacters ("\digit" and "&"). Finally, there must not be a + * variable mentioned in the [regsub] to write the result back to (because + * we can't get the count of substitutions that would be the result in + * that case). The key is that these are the conditions under which a + * [string map] could be used instead, in particular a [string map] of the + * form we can compile to bytecode. + * + * In short, we look for: + * + * regsub -all [--] simpleRE string simpleReplacement + * + * The only optional part is the "--", and no other options are handled. + */ + + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr, *stringTokenPtr; + Tcl_Obj *patternObj = NULL, *replacementObj = NULL; + Tcl_DString pattern; + const char *bytes; + int len, exact, result = TCL_ERROR; + + if (parsePtr->numWords < 5 || parsePtr->numWords > 6) { + return TCL_ERROR; + } + + /* + * Parse the "-all", which must be the first argument (other options not + * supported, non-"-all" substitution we can't compile). + */ + + tokenPtr = TokenAfter(parsePtr->tokenPtr); + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size != 4 + || strncmp(tokenPtr[1].start, "-all", 4)) { + return TCL_ERROR; + } + + /* + * Get the pattern into patternObj, checking for "--" in the process. + */ + + Tcl_DStringInit(&pattern); + tokenPtr = TokenAfter(tokenPtr); + patternObj = Tcl_NewObj(); + if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { + goto done; + } + if (Tcl_GetString(patternObj)[0] == '-') { + if (strcmp(Tcl_GetString(patternObj), "--") != 0 + || parsePtr->numWords == 5) { + goto done; + } + tokenPtr = TokenAfter(tokenPtr); + Tcl_DecrRefCount(patternObj); + patternObj = Tcl_NewObj(); + if (!TclWordKnownAtCompileTime(tokenPtr, patternObj)) { + goto done; + } + } else if (parsePtr->numWords == 6) { + goto done; + } + + /* + * Identify the code which produces the string to apply the substitution + * to (stringTokenPtr), and the replacement string (into replacementObj). + */ + + stringTokenPtr = TokenAfter(tokenPtr); + tokenPtr = TokenAfter(stringTokenPtr); + replacementObj = Tcl_NewObj(); + if (!TclWordKnownAtCompileTime(tokenPtr, replacementObj)) { + goto done; + } + + /* + * Next, higher-level checks. Is the RE a very simple glob? Is the + * replacement "simple"? + */ + + bytes = Tcl_GetStringFromObj(patternObj, &len); + if (TclReToGlob(NULL, bytes, len, &pattern, &exact) != TCL_OK || exact) { + goto done; + } + bytes = Tcl_DStringValue(&pattern); + if (*bytes++ != '*') { + goto done; + } + while (1) { + switch (*bytes) { + case '*': + if (bytes[1] == '\0') { + /* + * OK, we've proved there are no metacharacters except for the + * '*' at each end. + */ + + len = Tcl_DStringLength(&pattern) - 2; + if (len > 0) { + goto isSimpleGlob; + } + + /* + * The pattern is "**"! I believe that should be impossible, + * but we definitely can't handle that at all. + */ + } + case '\0': case '?': case '[': case '\\': + goto done; + } + bytes++; + } + isSimpleGlob: + for (bytes = Tcl_GetString(replacementObj); *bytes; bytes++) { + switch (*bytes) { + case '\\': case '&': + goto done; + } + } + + /* + * Proved the simplicity constraints! Time to issue the code. + */ + + result = TCL_OK; + bytes = Tcl_DStringValue(&pattern) + 1; + PushLiteral(envPtr, bytes, len); + bytes = Tcl_GetStringFromObj(replacementObj, &len); + PushLiteral(envPtr, bytes, len); + CompileWord(envPtr, stringTokenPtr, interp, parsePtr->numWords-2); + TclEmitOpcode( INST_STR_MAP, envPtr); + + done: + Tcl_DStringFree(&pattern); + if (patternObj) { + Tcl_DecrRefCount(patternObj); + } + if (replacementObj) { + Tcl_DecrRefCount(replacementObj); + } + return result; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileReturnCmd -- + * + * Procedure called to compile the "return" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "return" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileReturnCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + /* + * General syntax: [return ?-option value ...? ?result?] + * An even number of words means an explicit result argument is present. + */ + int level, code, objc, size, status = TCL_OK; + int numWords = parsePtr->numWords; + int explicitResult = (0 == (numWords % 2)); + int numOptionWords = numWords - 1 - explicitResult; + int savedStackDepth = envPtr->currStackDepth; + Tcl_Obj *returnOpts, **objv; + Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); + DefineLineInformation; /* TIP #280 */ + + /* + * Check for special case which can always be compiled: + * return -options + * Unlike the normal [return] compilation, this version does everything at + * runtime so it can handle arbitrary words and not just literals. Note + * that if INST_RETURN_STK wasn't already needed for something else + * ('finally' clause processing) this piece of code would not be present. + */ + + if ((numWords == 4) && (wordTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) + && (wordTokenPtr[1].size == 8) + && (strncmp(wordTokenPtr[1].start, "-options", 8) == 0)) { + Tcl_Token *optsTokenPtr = TokenAfter(wordTokenPtr); + Tcl_Token *msgTokenPtr = TokenAfter(optsTokenPtr); + + CompileWord(envPtr, optsTokenPtr, interp, 2); + CompileWord(envPtr, msgTokenPtr, interp, 3); + TclEmitOpcode(INST_RETURN_STK, envPtr); + envPtr->currStackDepth = savedStackDepth + 1; + return TCL_OK; + } + + /* + * Allocate some working space. + */ + + objv = TclStackAlloc(interp, numOptionWords * sizeof(Tcl_Obj *)); + + /* + * Scan through the return options. If any are unknown at compile time, + * there is no value in bytecompiling. Save the option values known in an + * objv array for merging into a return options dictionary. + */ + + for (objc = 0; objc < numOptionWords; objc++) { + objv[objc] = Tcl_NewObj(); + Tcl_IncrRefCount(objv[objc]); + if (!TclWordKnownAtCompileTime(wordTokenPtr, objv[objc])) { + /* + * Non-literal, so punt to run-time. + */ + + for (; objc>=0 ; objc--) { + TclDecrRefCount(objv[objc]); + } + TclStackFree(interp, objv); + goto issueRuntimeReturn; + } + wordTokenPtr = TokenAfter(wordTokenPtr); + } + status = TclMergeReturnOptions(interp, objc, objv, + &returnOpts, &code, &level); + while (--objc >= 0) { + TclDecrRefCount(objv[objc]); + } + TclStackFree(interp, objv); + if (TCL_ERROR == status) { + /* + * Something was bogus in the return options. Clear the error message, + * and report back to the compiler that this must be interpreted at + * runtime. + */ + + Tcl_ResetResult(interp); + return TCL_ERROR; + } + + /* + * All options are known at compile time, so we're going to bytecompile. + * Emit instructions to push the result on the stack. + */ + + if (explicitResult) { + CompileWord(envPtr, wordTokenPtr, interp, numWords-1); + } else { + /* + * No explict result argument, so default result is empty string. + */ + + PushLiteral(envPtr, "", 0); + } + + /* + * Check for optimization: When [return] is in a proc, and there's no + * enclosing [catch], and there are no return options, then the INST_DONE + * instruction is equivalent, and may be more efficient. + */ + + if (numOptionWords == 0 && envPtr->procPtr != NULL) { + /* + * We have default return options and we're in a proc ... + */ + + int index = envPtr->exceptArrayNext - 1; + int enclosingCatch = 0; + + while (index >= 0) { + ExceptionRange range = envPtr->exceptArrayPtr[index]; + + if ((range.type == CATCH_EXCEPTION_RANGE) + && (range.catchOffset == -1)) { + enclosingCatch = 1; + break; + } + index--; + } + if (!enclosingCatch) { + /* + * ... and there is no enclosing catch. Issue the maximally + * efficient exit instruction. + */ + + Tcl_DecrRefCount(returnOpts); + TclEmitOpcode(INST_DONE, envPtr); + envPtr->currStackDepth = savedStackDepth; + return TCL_OK; + } + } + + /* Optimize [return -level 0 $x]. */ + Tcl_DictObjSize(NULL, returnOpts, &size); + if (size == 0 && level == 0 && code == TCL_OK) { + Tcl_DecrRefCount(returnOpts); + return TCL_OK; + } + + /* + * Could not use the optimization, so we push the return options dict, and + * emit the INST_RETURN_IMM instruction with code and level as operands. + */ + + CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts); + envPtr->currStackDepth = savedStackDepth + 1; + return TCL_OK; + + issueRuntimeReturn: + /* + * Assemble the option dictionary (as a list as that's good enough). + */ + + wordTokenPtr = TokenAfter(parsePtr->tokenPtr); + for (objc=1 ; objc<=numOptionWords ; objc++) { + CompileWord(envPtr, wordTokenPtr, interp, objc); + wordTokenPtr = TokenAfter(wordTokenPtr); + } + TclEmitInstInt4(INST_LIST, numOptionWords, envPtr); + + /* + * Push the result. + */ + + if (explicitResult) { + CompileWord(envPtr, wordTokenPtr, interp, numWords-1); + } else { + PushLiteral(envPtr, "", 0); + } + + /* + * Issue the RETURN itself. + */ + + TclEmitOpcode(INST_RETURN_STK, envPtr); + envPtr->currStackDepth = savedStackDepth + 1; + return TCL_OK; +} + +static void +CompileReturnInternal( + CompileEnv *envPtr, + unsigned char op, + int code, + int level, + Tcl_Obj *returnOpts) +{ + TclEmitPush(TclAddLiteralObj(envPtr, returnOpts, NULL), envPtr); + TclEmitInstInt4(op, code, envPtr); + TclEmitInt4(level, envPtr); +} + +void +TclCompileSyntaxError( + Tcl_Interp *interp, + CompileEnv *envPtr) +{ + Tcl_Obj *msg = Tcl_GetObjResult(interp); + int numBytes; + const char *bytes = TclGetStringFromObj(msg, &numBytes); + + TclErrorStackResetIf(interp, bytes, numBytes); + TclEmitPush(TclRegisterNewLiteral(envPtr, bytes, numBytes), envPtr); + CompileReturnInternal(envPtr, INST_SYNTAX, TCL_ERROR, 0, + TclNoErrorStack(interp, Tcl_GetReturnOptions(interp, TCL_ERROR))); +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileUpvarCmd -- + * + * Procedure called to compile the "upvar" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "upvar" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileUpvarCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; + int simpleVarName, isScalar, localIndex, numWords, i; + DefineLineInformation; /* TIP #280 */ + Tcl_Obj *objPtr = Tcl_NewObj(); + + if (envPtr->procPtr == NULL) { + Tcl_DecrRefCount(objPtr); + return TCL_ERROR; + } + + numWords = parsePtr->numWords; + if (numWords < 3) { + Tcl_DecrRefCount(objPtr); + return TCL_ERROR; + } + + /* + * Push the frame index if it is known at compile time + */ + + tokenPtr = TokenAfter(parsePtr->tokenPtr); + if (TclWordKnownAtCompileTime(tokenPtr, objPtr)) { + CallFrame *framePtr; + const Tcl_ObjType *newTypePtr, *typePtr = objPtr->typePtr; + + /* + * Attempt to convert to a level reference. Note that TclObjGetFrame + * only changes the obj type when a conversion was successful. + */ + + TclObjGetFrame(interp, objPtr, &framePtr); + newTypePtr = objPtr->typePtr; + Tcl_DecrRefCount(objPtr); + + if (newTypePtr != typePtr) { + if (numWords%2) { + return TCL_ERROR; + } + CompileWord(envPtr, tokenPtr, interp, 1); + otherTokenPtr = TokenAfter(tokenPtr); + i = 4; + } else { + if (!(numWords%2)) { + return TCL_ERROR; + } + PushLiteral(envPtr, "1", 1); + otherTokenPtr = tokenPtr; + i = 3; + } + } else { + Tcl_DecrRefCount(objPtr); + return TCL_ERROR; + } + + /* + * Loop over the (otherVar, thisVar) pairs. If any of the thisVar is not a + * local variable, return an error so that the non-compiled command will + * be called at runtime. + */ + + for (; i<=numWords; i+=2, otherTokenPtr = TokenAfter(localTokenPtr)) { + localTokenPtr = TokenAfter(otherTokenPtr); + + CompileWord(envPtr, otherTokenPtr, interp, 1); + PushVarNameWord(interp, localTokenPtr, envPtr, 0, + &localIndex, &simpleVarName, &isScalar, 1); + + if ((localIndex < 0) || !isScalar) { + return TCL_ERROR; + } + TclEmitInstInt4( INST_UPVAR, localIndex, envPtr); + } + + /* + * Pop the frame index, and set the result to empty + */ + + TclEmitOpcode( INST_POP, envPtr); + PushLiteral(envPtr, "", 0); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclCompileVariableCmd -- + * + * Procedure called to compile the "variable" command. + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "variable" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileVariableCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *varTokenPtr, *valueTokenPtr; + int localIndex, numWords, i; + DefineLineInformation; /* TIP #280 */ + + numWords = parsePtr->numWords; + if (numWords < 2) { + return TCL_ERROR; + } + + /* + * Bail out if not compiling a proc body + */ + + if (envPtr->procPtr == NULL) { + return TCL_ERROR; + } + + /* + * Loop over the (var, value) pairs. + */ + + valueTokenPtr = parsePtr->tokenPtr; + for (i=1; inumComponents; + Tcl_Token *lastTokenPtr; + int full, localIndex; + + /* + * Determine if the tail is (a) known at compile time, and (b) not an + * array element. Should any of these fail, return an error so that the + * non-compiled command will be called at runtime. + * + * In order for the tail to be known at compile time, the last token in + * the word has to be constant and contain "::" if it is not the only one. + */ + + if (!EnvHasLVT(envPtr)) { + return -1; + } + + TclNewObj(tailPtr); + if (TclWordKnownAtCompileTime(varTokenPtr, tailPtr)) { + full = 1; + lastTokenPtr = varTokenPtr; + } else { + full = 0; + lastTokenPtr = varTokenPtr + n; + if (!TclWordKnownAtCompileTime(lastTokenPtr, tailPtr)) { + Tcl_DecrRefCount(tailPtr); + return -1; + } + } + + tailName = TclGetStringFromObj(tailPtr, &len); + + if (len) { + if (*(tailName+len-1) == ')') { + /* + * Possible array: bail out + */ + + Tcl_DecrRefCount(tailPtr); + return -1; + } + + /* + * Get the tail: immediately after the last '::' + */ + + for (p = tailName + len -1; p > tailName; p--) { + if ((*p == ':') && (*(p-1) == ':')) { + p++; + break; + } + } + if (!full && (p == tailName)) { + /* + * No :: in the last component. + */ + + Tcl_DecrRefCount(tailPtr); + return -1; + } + len -= p - tailName; + tailName = p; + } + + localIndex = TclFindCompiledLocal(tailName, len, 1, envPtr); + Tcl_DecrRefCount(tailPtr); + return localIndex; +} + +int +TclCompileObjectSelfCmd( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + /* + * We only handle [self] and [self object] (which is the same operation). + * These are the only very common operations on [self] for which + * bytecoding is at all reasonable. + */ + + if (parsePtr->numWords == 1) { + goto compileSelfObject; + } else if (parsePtr->numWords == 2) { + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr), *subcmd; + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size==0) { + return TCL_ERROR; + } + + subcmd = tokenPtr + 1; + if (strncmp(subcmd->start, "object", subcmd->size) == 0) { + goto compileSelfObject; + } else if (strncmp(subcmd->start, "namespace", subcmd->size) == 0) { + goto compileSelfNamespace; + } + } + + /* + * Can't compile; handle with runtime call. + */ + + return TCL_ERROR; + + compileSelfObject: + + /* + * This delegates the entire problem to a single opcode. + */ + + TclEmitOpcode( INST_TCLOO_SELF, envPtr); + return TCL_OK; + + compileSelfNamespace: + + /* + * This is formally only correct with TclOO methods as they are currently + * implemented; it assumes that the current namespace is invariably when a + * TclOO context is present is the object's namespace, and that's + * technically only something that's a matter of current policy. But it + * avoids creating another opcode, so that's all good! + */ + + TclEmitOpcode( INST_TCLOO_SELF, envPtr); + TclEmitOpcode( INST_POP, envPtr); + TclEmitOpcode( INST_NS_CURRENT, envPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * PushVarName -- + * + * Procedure used in the compiling where pushing a variable name is + * necessary (append, lappend, set). + * + * Results: + * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer + * evaluation to runtime. + * + * Side effects: + * Instructions are added to envPtr to execute the "set" command at + * runtime. + * + *---------------------------------------------------------------------- + */ + +static int +PushVarName( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Token *varTokenPtr, /* Points to a variable token. */ + CompileEnv *envPtr, /* Holds resulting instructions. */ + int flags, /* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */ + int *localIndexPtr, /* Must not be NULL. */ + int *simpleVarNamePtr, /* Must not be NULL. */ + int *isScalarPtr, /* Must not be NULL. */ + int line, /* Line the token starts on. */ + int *clNext) /* Reference to offset of next hidden cont. + * line. */ +{ + register const char *p; + const char *name, *elName; + register int i, n; + Tcl_Token *elemTokenPtr = NULL; + int nameChars, elNameChars, simpleVarName, localIndex; + int elemTokenCount = 0, allocedTokens = 0, removedParen = 0; + + /* + * Decide if we can use a frame slot for the var/array name or if we need + * to emit code to compute and push the name at runtime. We use a frame + * slot (entry in the array of local vars) if we are compiling a procedure + * body and if the name is simple text that does not include namespace + * qualifiers. + */ + + simpleVarName = 0; + name = elName = NULL; + nameChars = elNameChars = 0; + localIndex = -1; + + /* + * Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether + * curly braces surround the variable name. This really matters for array + * elements to handle things like + * set {x($foo)} 5 + * which raises an undefined var error if we are not careful here. + */ + + if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && + (varTokenPtr->start[0] != '{')) { + /* + * A simple variable name. Divide it up into "name" and "elName" + * strings. If it is not a local variable, look it up at runtime. + */ + + simpleVarName = 1; + + name = varTokenPtr[1].start; + nameChars = varTokenPtr[1].size; + if (name[nameChars-1] == ')') { + /* + * last char is ')' => potential array reference. + */ + + for (i=0,p=name ; itype = TCL_TOKEN_TEXT; + elemTokenPtr->start = elName; + elemTokenPtr->size = elNameChars; + elemTokenPtr->numComponents = 0; + elemTokenCount = 1; + } + } + } else if (((n = varTokenPtr->numComponents) > 1) + && (varTokenPtr[1].type == TCL_TOKEN_TEXT) + && (varTokenPtr[n].type == TCL_TOKEN_TEXT) + && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) { + /* + * Check for parentheses inside first token. + */ + + simpleVarName = 0; + for (i = 0, p = varTokenPtr[1].start; + i < varTokenPtr[1].size; i++, p++) { + if (*p == '(') { + simpleVarName = 1; + break; + } + } + if (simpleVarName) { + int remainingChars; + + /* + * Check the last token: if it is just ')', do not count it. + * Otherwise, remove the ')' and flag so that it is restored at + * the end. + */ + + if (varTokenPtr[n].size == 1) { + n--; + } else { + varTokenPtr[n].size--; + removedParen = n; + } + + name = varTokenPtr[1].start; + nameChars = p - varTokenPtr[1].start; + elName = p + 1; + remainingChars = (varTokenPtr[2].start - p) - 1; + elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 2; + + if (remainingChars) { + /* + * Make a first token with the extra characters in the first + * token. + */ + + elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token)); + allocedTokens = 1; + elemTokenPtr->type = TCL_TOKEN_TEXT; + elemTokenPtr->start = elName; + elemTokenPtr->size = remainingChars; + elemTokenPtr->numComponents = 0; + elemTokenCount = n; + + /* + * Copy the remaining tokens. + */ + + memcpy(elemTokenPtr+1, varTokenPtr+2, + (n-1) * sizeof(Tcl_Token)); + } else { + /* + * Use the already available tokens. + */ + + elemTokenPtr = &varTokenPtr[2]; + elemTokenCount = n - 1; + } + } + } + + if (simpleVarName) { + /* + * See whether name has any namespace separators (::'s). + */ + + int hasNsQualifiers = 0; + + for (i = 0, p = name; i < nameChars; i++, p++) { + if ((*p == ':') && ((i+1) < nameChars) && (*(p+1) == ':')) { + hasNsQualifiers = 1; + break; + } + } + + /* + * Look up the var name's index in the array of local vars in the proc + * frame. If retrieving the var's value and it doesn't already exist, + * push its name and look it up at runtime. + */ + + if (!hasNsQualifiers) { + localIndex = TclFindCompiledLocal(name, nameChars, + 1, envPtr); + if ((flags & TCL_NO_LARGE_INDEX) && (localIndex > 255)) { + /* + * We'll push the name. + */ + + localIndex = -1; + } + } + if (localIndex < 0) { + PushLiteral(envPtr, name, nameChars); + } + + /* + * Compile the element script, if any, and only if not inhibited. [Bug + * 3600328] + */ + + if (elName != NULL && !(flags & TCL_NO_ELEMENT)) { + if (elNameChars) { + envPtr->line = line; + envPtr->clNext = clNext; + TclCompileTokens(interp, elemTokenPtr, elemTokenCount, + envPtr); + } else { + PushLiteral(envPtr, "", 0); + } + } + } else { + /* + * The var name isn't simple: compile and push it. + */ + + envPtr->line = line; + envPtr->clNext = clNext; + CompileTokens(envPtr, varTokenPtr, interp); + } + + if (removedParen) { + varTokenPtr[removedParen].size++; + } + if (allocedTokens) { + TclStackFree(interp, elemTokenPtr); + } + *localIndexPtr = localIndex; + *simpleVarNamePtr = simpleVarName; + *isScalarPtr = (elName == NULL); + return TCL_OK; +} + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/unix/Makefile.in b/unix/Makefile.in index e0dc608..126fc03 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -291,9 +291,10 @@ XTTEST_OBJS = xtTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ tclThreadTest.o tclUnixTest.o tclXtNotify.o tclXtTest.o GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ - tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o tclClock.o \ - tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclCompCmds.o tclCompCmdsSZ.o \ - tclCompExpr.o tclCompile.o tclConfig.o tclDate.o tclDictObj.o \ + tclAssembly.o tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o \ + tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o \ + tclCompCmds.o tclCompCmdsGR.o tclCompCmdsSZ.o tclCompExpr.o \ + tclCompile.o tclConfig.o tclDate.o tclDictObj.o \ tclEncoding.o tclEnsemble.o \ tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o \ tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o tclIOCmd.o \ @@ -307,8 +308,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ - tclTomMathInterface.o \ - tclAssembly.o + tclTomMathInterface.o OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \ tclOOMethod.o tclOOStubInit.o @@ -395,6 +395,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclCmdIL.c \ $(GENERIC_DIR)/tclCmdMZ.c \ $(GENERIC_DIR)/tclCompCmds.c \ + $(GENERIC_DIR)/tclCompCmdsGR.c \ $(GENERIC_DIR)/tclCompCmdsSZ.c \ $(GENERIC_DIR)/tclCompExpr.c \ $(GENERIC_DIR)/tclCompile.c \ @@ -1077,6 +1078,9 @@ tclDate.o: $(GENERIC_DIR)/tclDate.c tclCompCmds.o: $(GENERIC_DIR)/tclCompCmds.c $(COMPILEHDR) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclCompCmds.c +tclCompCmdsGR.o: $(GENERIC_DIR)/tclCompCmdsGR.c $(COMPILEHDR) + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclCompCmdsGR.c + tclCompCmdsSZ.o: $(GENERIC_DIR)/tclCompCmdsSZ.c $(COMPILEHDR) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclCompCmdsSZ.c diff --git a/win/Makefile.in b/win/Makefile.in index 8b16372..3c9d276 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -225,6 +225,7 @@ GENERIC_OBJS = \ tclCmdIL.$(OBJEXT) \ tclCmdMZ.$(OBJEXT) \ tclCompCmds.$(OBJEXT) \ + tclCompCmdsGR.$(OBJEXT) \ tclCompCmdsSZ.$(OBJEXT) \ tclCompExpr.$(OBJEXT) \ tclCompile.$(OBJEXT) \ diff --git a/win/makefile.bc b/win/makefile.bc index 18bfa28..d148513 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -200,6 +200,7 @@ TCLOBJS = \ $(TMPDIR)\tclCmdIL.obj \ $(TMPDIR)\tclCmdMZ.obj \ $(TMPDIR)\tclCompCmds.obj \ + $(TMPDIR)\tclCompCmdsGR.obj \ $(TMPDIR)\tclCompCmdsSZ.obj \ $(TMPDIR)\tclCompExpr.obj \ $(TMPDIR)\tclCompile.obj \ diff --git a/win/makefile.vc b/win/makefile.vc index 2784140..95d3a9d 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -274,6 +274,7 @@ COREOBJS = \ $(TMP_DIR)\tclCmdIL.obj \ $(TMP_DIR)\tclCmdMZ.obj \ $(TMP_DIR)\tclCompCmds.obj \ + $(TMP_DIR)\tclCompCmdsGR.obj \ $(TMP_DIR)\tclCompCmdsSZ.obj \ $(TMP_DIR)\tclCompExpr.obj \ $(TMP_DIR)\tclCompile.obj \ -- cgit v0.12 From 0381a0636d9cf0732c403ff31d13a8585fffdbfd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 19 May 2013 13:36:42 +0000 Subject: Fix for FreeBSD, and remove support for older FreeBSD versions. Patch by Pietro Cerutti. --- ChangeLog | 5 + unix/configure | 799 ++++++++++++++++++++++++--------------------------------- unix/tcl.m4 | 47 +--- 3 files changed, 350 insertions(+), 501 deletions(-) diff --git a/ChangeLog b/ChangeLog index b38a105..ba702aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-19 Jan Nijtmans + + * unix/tcl.m4: Fix for FreeBSD, and remove support for older + * unix/configure: FreeBSD versions. Patch by Pietro Cerutti. + 2013-05-16 Jan Nijtmans * generic/tclBasic.c: Add panic in order to detect diff --git a/unix/configure b/unix/configure index 80d747c..ec5298c 100755 --- a/unix/configure +++ b/unix/configure @@ -3323,101 +3323,6 @@ EOF CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - NetBSD-1.*|FreeBSD-[1-2].*) - # Not available on all versions: check for include file. - ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:3331: checking for dlfcn.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3341: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - - # NetBSD/SPARC needs -fPIC, -fpic will not do. - SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - if test $doRpath = yes ; then - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' - fi - echo $ac_n "checking for ELF""... $ac_c" 1>&6 -echo "configure:3369: checking for ELF" >&5 -if eval "test \"`echo '$''{'tcl_cv_ld_elf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - cat > conftest.$ac_ext <&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - tcl_cv_ld_elf=yes -else - rm -rf conftest* - tcl_cv_ld_elf=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$tcl_cv_ld_elf" 1>&6 - if test $tcl_cv_ld_elf = yes; then - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' - else - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' - fi - -else - echo "$ac_t""no" 1>&6 - - SHLIB_CFLAGS="" - SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" - SHLIB_SUFFIX=".a" - DL_OBJS="tclLoadAout.o" - DL_LIBS="" - CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' - -fi - - - # FreeBSD doesn't handle version numbers with dots. - - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' - TCL_LIB_VERSIONS_OK=nodots - ;; OpenBSD-*) arch=`arch -s` case "$arch" in @@ -3450,13 +3355,13 @@ fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' echo $ac_n "checking for ELF""... $ac_c" 1>&6 -echo "configure:3454: checking for ELF" >&5 +echo "configure:3359: checking for ELF" >&5 if eval "test \"`echo '$''{'tcl_cv_ld_elf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' TCL_LIB_VERSIONS_OK=nodots ;; - NetBSD-*|FreeBSD-[3-4].*) - # FreeBSD 3.* and greater have ELF. - # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs + NetBSD-*) + # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" @@ -3521,7 +3425,7 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6 # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-soname \$@" + TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$@" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -3558,7 +3462,7 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6 case `arch` in ppc) echo $ac_n "checking if compiler accepts -arch ppc64 flag""... $ac_c" 1>&6 -echo "configure:3562: checking if compiler accepts -arch ppc64 flag" >&5 +echo "configure:3466: checking if compiler accepts -arch ppc64 flag" >&5 if eval "test \"`echo '$''{'tcl_cv_cc_arch_ppc64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3566,14 +3470,14 @@ else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_cc_arch_ppc64=yes else @@ -3593,7 +3497,7 @@ echo "$ac_t""$tcl_cv_cc_arch_ppc64" 1>&6 fi;; i386) echo $ac_n "checking if compiler accepts -arch x86_64 flag""... $ac_c" 1>&6 -echo "configure:3597: checking if compiler accepts -arch x86_64 flag" >&5 +echo "configure:3501: checking if compiler accepts -arch x86_64 flag" >&5 if eval "test \"`echo '$''{'tcl_cv_cc_arch_x86_64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3601,14 +3505,14 @@ else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_cc_arch_x86_64=yes else @@ -3637,7 +3541,7 @@ echo "$ac_t""$tcl_cv_cc_arch_x86_64" 1>&6 fi SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' echo $ac_n "checking if ld accepts -single_module flag""... $ac_c" 1>&6 -echo "configure:3641: checking if ld accepts -single_module flag" >&5 +echo "configure:3545: checking if ld accepts -single_module flag" >&5 if eval "test \"`echo '$''{'tcl_cv_ld_single_module'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3645,14 +3549,14 @@ else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_ld_single_module=yes else @@ -3678,7 +3582,7 @@ echo "$ac_t""$tcl_cv_ld_single_module" 1>&6 LDFLAGS="$LDFLAGS -prebind" LDFLAGS="$LDFLAGS -headerpad_max_install_names" echo $ac_n "checking if ld accepts -search_paths_first flag""... $ac_c" 1>&6 -echo "configure:3682: checking if ld accepts -search_paths_first flag" >&5 +echo "configure:3586: checking if ld accepts -search_paths_first flag" >&5 if eval "test \"`echo '$''{'tcl_cv_ld_search_paths_first'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3686,14 +3590,14 @@ else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_ld_search_paths_first=yes else @@ -3716,7 +3620,7 @@ echo "$ac_t""$tcl_cv_ld_search_paths_first" 1>&6 PLAT_OBJS=\$\(MAC\_OSX_OBJS\) PLAT_SRCS=\$\(MAC\_OSX_SRCS\) echo $ac_n "checking whether to use CoreFoundation""... $ac_c" 1>&6 -echo "configure:3720: checking whether to use CoreFoundation" >&5 +echo "configure:3624: checking whether to use CoreFoundation" >&5 # Check whether --enable-corefoundation or --disable-corefoundation was given. if test "${enable_corefoundation+set}" = set; then enableval="$enable_corefoundation" @@ -3728,7 +3632,7 @@ fi echo "$ac_t""$tcl_corefoundation" 1>&6 if test $tcl_corefoundation = yes; then echo $ac_n "checking for CoreFoundation.framework""... $ac_c" 1>&6 -echo "configure:3732: checking for CoreFoundation.framework" >&5 +echo "configure:3636: checking for CoreFoundation.framework" >&5 if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3742,14 +3646,14 @@ else done; fi LIBS="$LIBS -framework CoreFoundation" cat > conftest.$ac_ext < int main() { CFBundleRef b = CFBundleGetMainBundle(); ; return 0; } EOF -if { (eval echo configure:3753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_lib_corefoundation=yes else @@ -3776,7 +3680,7 @@ EOF fi if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then echo $ac_n "checking for 64-bit CoreFoundation""... $ac_c" 1>&6 -echo "configure:3780: checking for 64-bit CoreFoundation" >&5 +echo "configure:3684: checking for 64-bit CoreFoundation" >&5 if eval "test \"`echo '$''{'tcl_cv_lib_corefoundation_64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3785,14 +3689,14 @@ else eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done cat > conftest.$ac_ext < int main() { CFBundleRef b = CFBundleGetMainBundle(); ; return 0; } EOF -if { (eval echo configure:3796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_lib_corefoundation_64=yes else @@ -4121,7 +4025,7 @@ EOF # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6 -echo "configure:4125: checking for ld accepts -Bexport flag" >&5 +echo "configure:4029: checking for ld accepts -Bexport flag" >&5 if eval "test \"`echo '$''{'tcl_cv_ld_Bexport'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4129,14 +4033,14 @@ else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_ld_Bexport=yes else @@ -4186,13 +4090,13 @@ echo "$ac_t""$tcl_cv_ld_Bexport" 1>&6 if test "x$DL_OBJS" = "xtclLoadAout.o" ; then echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6 -echo "configure:4190: checking sys/exec.h" >&5 +echo "configure:4094: checking sys/exec.h" >&5 if eval "test \"`echo '$''{'tcl_cv_sysexec_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -4210,7 +4114,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_sysexec_h=usable else @@ -4230,13 +4134,13 @@ EOF else echo $ac_n "checking a.out.h""... $ac_c" 1>&6 -echo "configure:4234: checking a.out.h" >&5 +echo "configure:4138: checking a.out.h" >&5 if eval "test \"`echo '$''{'tcl_cv_aout_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -4254,7 +4158,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_aout_h=usable else @@ -4274,13 +4178,13 @@ EOF else echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6 -echo "configure:4278: checking sys/exec_aout.h" >&5 +echo "configure:4182: checking sys/exec_aout.h" >&5 if eval "test \"`echo '$''{'tcl_cv_sysexecaout_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -4298,7 +4202,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_sysexecaout_h=usable else @@ -4416,12 +4320,12 @@ fi # warning when initializing a union member. echo $ac_n "checking for cast to union support""... $ac_c" 1>&6 -echo "configure:4420: checking for cast to union support" >&5 +echo "configure:4324: checking for cast to union support" >&5 if eval "test \"`echo '$''{'tcl_cv_cast_to_union'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_cast_to_union=yes else @@ -4486,7 +4390,7 @@ EOF echo $ac_n "checking for build with symbols""... $ac_c" 1>&6 -echo "configure:4490: checking for build with symbols" >&5 +echo "configure:4394: checking for build with symbols" >&5 # Check whether --enable-symbols or --disable-symbols was given. if test "${enable_symbols+set}" = set; then enableval="$enable_symbols" @@ -4551,21 +4455,21 @@ TCL_DBGX=${DBGX} echo $ac_n "checking for required early compiler flags""... $ac_c" 1>&6 -echo "configure:4555: checking for required early compiler flags" >&5 +echo "configure:4459: checking for required early compiler flags" >&5 tcl_flags="" if eval "test \"`echo '$''{'tcl_cv_flag__isoc99_source'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } EOF -if { (eval echo configure:4569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_flag__isoc99_source=no else @@ -4573,7 +4477,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -4581,7 +4485,7 @@ int main() { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } EOF -if { (eval echo configure:4585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_flag__isoc99_source=yes else @@ -4608,14 +4512,14 @@ EOF echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } EOF -if { (eval echo configure:4619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_flag__largefile64_source=no else @@ -4623,7 +4527,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -4631,7 +4535,7 @@ int main() { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } EOF -if { (eval echo configure:4635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_flag__largefile64_source=yes else @@ -4658,14 +4562,14 @@ EOF echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = (char *)open64; ; return 0; } EOF -if { (eval echo configure:4669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_flag__largefile_source64=no else @@ -4673,7 +4577,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -4681,7 +4585,7 @@ int main() { char *p = (char *)open64; ; return 0; } EOF -if { (eval echo configure:4685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_flag__largefile_source64=yes else @@ -4712,7 +4616,7 @@ EOF echo $ac_n "checking for 64-bit integer type""... $ac_c" 1>&6 -echo "configure:4716: checking for 64-bit integer type" >&5 +echo "configure:4620: checking for 64-bit integer type" >&5 if eval "test \"`echo '$''{'tcl_cv_type_64bit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4720,14 +4624,14 @@ else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4635: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_type_64bit=__int64 else @@ -4741,7 +4645,7 @@ rm -f conftest* # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_type_64bit=${tcl_type_64bit} else @@ -4775,13 +4679,13 @@ EOF # Now check for auxiliary declarations echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6 -echo "configure:4779: checking for struct dirent64" >&5 +echo "configure:4683: checking for struct dirent64" >&5 if eval "test \"`echo '$''{'tcl_cv_struct_dirent64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4789,7 +4693,7 @@ int main() { struct dirent64 p; ; return 0; } EOF -if { (eval echo configure:4793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4697: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_struct_dirent64=yes else @@ -4810,13 +4714,13 @@ EOF fi echo $ac_n "checking for struct stat64""... $ac_c" 1>&6 -echo "configure:4814: checking for struct stat64" >&5 +echo "configure:4718: checking for struct stat64" >&5 if eval "test \"`echo '$''{'tcl_cv_struct_stat64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -4824,7 +4728,7 @@ struct stat64 p; ; return 0; } EOF -if { (eval echo configure:4828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4732: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_struct_stat64=yes else @@ -4847,12 +4751,12 @@ EOF for ac_func in open64 lseek64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4851: checking for $ac_func" >&5 +echo "configure:4755: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4900,13 +4804,13 @@ fi done echo $ac_n "checking for off64_t""... $ac_c" 1>&6 -echo "configure:4904: checking for off64_t" >&5 +echo "configure:4808: checking for off64_t" >&5 if eval "test \"`echo '$''{'tcl_cv_type_off64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -4914,7 +4818,7 @@ off64_t offset; ; return 0; } EOF -if { (eval echo configure:4918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_type_off64_t=yes else @@ -4946,14 +4850,14 @@ EOF #-------------------------------------------------------------------- echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:4950: checking whether byte ordering is bigendian" >&5 +echo "configure:4854: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -4964,11 +4868,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -4979,7 +4883,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:4983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -4999,7 +4903,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -5045,12 +4949,12 @@ fi for ac_func in getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5049: checking for $ac_func" >&5 +echo "configure:4953: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5107,12 +5011,12 @@ done for ac_func in opendir strstr strtol strtoll strtoull tmpnam waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5111: checking for $ac_func" >&5 +echo "configure:5015: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5162,12 +5066,12 @@ done echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:5166: checking for strerror" >&5 +echo "configure:5070: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -5214,12 +5118,12 @@ EOF fi echo $ac_n "checking for getwd""... $ac_c" 1>&6 -echo "configure:5218: checking for getwd" >&5 +echo "configure:5122: checking for getwd" >&5 if eval "test \"`echo '$''{'ac_cv_func_getwd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getwd=yes" else @@ -5266,12 +5170,12 @@ EOF fi echo $ac_n "checking for wait3""... $ac_c" 1>&6 -echo "configure:5270: checking for wait3" >&5 +echo "configure:5174: checking for wait3" >&5 if eval "test \"`echo '$''{'ac_cv_func_wait3'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_wait3=yes" else @@ -5318,12 +5222,12 @@ EOF fi echo $ac_n "checking for uname""... $ac_c" 1>&6 -echo "configure:5322: checking for uname" >&5 +echo "configure:5226: checking for uname" >&5 if eval "test \"`echo '$''{'ac_cv_func_uname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_uname=yes" else @@ -5377,12 +5281,12 @@ if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \ ac_cv_func_realpath=no fi echo $ac_n "checking for realpath""... $ac_c" 1>&6 -echo "configure:5381: checking for realpath" >&5 +echo "configure:5285: checking for realpath" >&5 if eval "test \"`echo '$''{'ac_cv_func_realpath'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_realpath=yes" else @@ -5435,12 +5339,12 @@ fi if test "${TCL_THREADS}" = 1; then echo $ac_n "checking for getpwuid_r""... $ac_c" 1>&6 -echo "configure:5439: checking for getpwuid_r" >&5 +echo "configure:5343: checking for getpwuid_r" >&5 if eval "test \"`echo '$''{'ac_cv_func_getpwuid_r'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getpwuid_r=yes" else @@ -5479,13 +5383,13 @@ if eval "test \"`echo '$ac_cv_func_'getpwuid_r`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for getpwuid_r with 5 args""... $ac_c" 1>&6 -echo "configure:5483: checking for getpwuid_r with 5 args" >&5 +echo "configure:5387: checking for getpwuid_r with 5 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getpwuid_r_5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5502,7 +5406,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getpwuid_r_5=yes else @@ -5523,13 +5427,13 @@ EOF else echo $ac_n "checking for getpwuid_r with 4 args""... $ac_c" 1>&6 -echo "configure:5527: checking for getpwuid_r with 4 args" >&5 +echo "configure:5431: checking for getpwuid_r with 4 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getpwuid_r_4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5546,7 +5450,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5454: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getpwuid_r_4=yes else @@ -5579,12 +5483,12 @@ else fi echo $ac_n "checking for getpwnam_r""... $ac_c" 1>&6 -echo "configure:5583: checking for getpwnam_r" >&5 +echo "configure:5487: checking for getpwnam_r" >&5 if eval "test \"`echo '$''{'ac_cv_func_getpwnam_r'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getpwnam_r=yes" else @@ -5623,13 +5527,13 @@ if eval "test \"`echo '$ac_cv_func_'getpwnam_r`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for getpwnam_r with 5 args""... $ac_c" 1>&6 -echo "configure:5627: checking for getpwnam_r with 5 args" >&5 +echo "configure:5531: checking for getpwnam_r with 5 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getpwnam_r_5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5646,7 +5550,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getpwnam_r_5=yes else @@ -5667,13 +5571,13 @@ EOF else echo $ac_n "checking for getpwnam_r with 4 args""... $ac_c" 1>&6 -echo "configure:5671: checking for getpwnam_r with 4 args" >&5 +echo "configure:5575: checking for getpwnam_r with 4 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getpwnam_r_4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5690,7 +5594,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5694: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5598: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getpwnam_r_4=yes else @@ -5723,12 +5627,12 @@ else fi echo $ac_n "checking for getgrgid_r""... $ac_c" 1>&6 -echo "configure:5727: checking for getgrgid_r" >&5 +echo "configure:5631: checking for getgrgid_r" >&5 if eval "test \"`echo '$''{'ac_cv_func_getgrgid_r'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getgrgid_r=yes" else @@ -5767,13 +5671,13 @@ if eval "test \"`echo '$ac_cv_func_'getgrgid_r`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for getgrgid_r with 5 args""... $ac_c" 1>&6 -echo "configure:5771: checking for getgrgid_r with 5 args" >&5 +echo "configure:5675: checking for getgrgid_r with 5 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getgrgid_r_5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5790,7 +5694,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5698: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getgrgid_r_5=yes else @@ -5811,13 +5715,13 @@ EOF else echo $ac_n "checking for getgrgid_r with 4 args""... $ac_c" 1>&6 -echo "configure:5815: checking for getgrgid_r with 4 args" >&5 +echo "configure:5719: checking for getgrgid_r with 4 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getgrgid_r_4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5834,7 +5738,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5742: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getgrgid_r_4=yes else @@ -5867,12 +5771,12 @@ else fi echo $ac_n "checking for getgrnam_r""... $ac_c" 1>&6 -echo "configure:5871: checking for getgrnam_r" >&5 +echo "configure:5775: checking for getgrnam_r" >&5 if eval "test \"`echo '$''{'ac_cv_func_getgrnam_r'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getgrnam_r=yes" else @@ -5911,13 +5815,13 @@ if eval "test \"`echo '$ac_cv_func_'getgrnam_r`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for getgrnam_r with 5 args""... $ac_c" 1>&6 -echo "configure:5915: checking for getgrnam_r with 5 args" >&5 +echo "configure:5819: checking for getgrnam_r with 5 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getgrnam_r_5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5934,7 +5838,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getgrnam_r_5=yes else @@ -5955,13 +5859,13 @@ EOF else echo $ac_n "checking for getgrnam_r with 4 args""... $ac_c" 1>&6 -echo "configure:5959: checking for getgrnam_r with 4 args" >&5 +echo "configure:5863: checking for getgrnam_r with 4 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_getgrnam_r_4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5978,7 +5882,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5982: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_getgrnam_r_4=yes else @@ -6038,12 +5942,12 @@ EOF else echo $ac_n "checking for gethostbyname_r""... $ac_c" 1>&6 -echo "configure:6042: checking for gethostbyname_r" >&5 +echo "configure:5946: checking for gethostbyname_r" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname_r'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname_r=yes" else @@ -6082,13 +5986,13 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname_r`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gethostbyname_r with 6 args""... $ac_c" 1>&6 -echo "configure:6086: checking for gethostbyname_r with 6 args" >&5 +echo "configure:5990: checking for gethostbyname_r with 6 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_gethostbyname_r_6'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6105,7 +6009,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6109: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_gethostbyname_r_6=yes else @@ -6126,13 +6030,13 @@ EOF else echo $ac_n "checking for gethostbyname_r with 5 args""... $ac_c" 1>&6 -echo "configure:6130: checking for gethostbyname_r with 5 args" >&5 +echo "configure:6034: checking for gethostbyname_r with 5 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_gethostbyname_r_5'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6149,7 +6053,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_gethostbyname_r_5=yes else @@ -6170,13 +6074,13 @@ EOF else echo $ac_n "checking for gethostbyname_r with 3 args""... $ac_c" 1>&6 -echo "configure:6174: checking for gethostbyname_r with 3 args" >&5 +echo "configure:6078: checking for gethostbyname_r with 3 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_gethostbyname_r_3'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6191,7 +6095,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_gethostbyname_r_3=yes else @@ -6225,12 +6129,12 @@ else fi echo $ac_n "checking for gethostbyaddr_r""... $ac_c" 1>&6 -echo "configure:6229: checking for gethostbyaddr_r" >&5 +echo "configure:6133: checking for gethostbyaddr_r" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyaddr_r'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyaddr_r=yes" else @@ -6269,13 +6173,13 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyaddr_r`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gethostbyaddr_r with 7 args""... $ac_c" 1>&6 -echo "configure:6273: checking for gethostbyaddr_r with 7 args" >&5 +echo "configure:6177: checking for gethostbyaddr_r with 7 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_gethostbyaddr_r_7'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6295,7 +6199,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_gethostbyaddr_r_7=yes else @@ -6316,13 +6220,13 @@ EOF else echo $ac_n "checking for gethostbyaddr_r with 8 args""... $ac_c" 1>&6 -echo "configure:6320: checking for gethostbyaddr_r with 8 args" >&5 +echo "configure:6224: checking for gethostbyaddr_r with 8 args" >&5 if eval "test \"`echo '$''{'tcl_cv_api_gethostbyaddr_r_8'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6342,7 +6246,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_api_gethostbyaddr_r_8=yes else @@ -6388,17 +6292,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6392: checking for $ac_hdr" >&5 +echo "configure:6296: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6425,7 +6329,7 @@ fi done echo $ac_n "checking termios vs. termio vs. sgtty""... $ac_c" 1>&6 -echo "configure:6429: checking termios vs. termio vs. sgtty" >&5 +echo "configure:6333: checking termios vs. termio vs. sgtty" >&5 if eval "test \"`echo '$''{'tcl_cv_api_serial'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6434,7 +6338,7 @@ else tcl_cv_api_serial=no else cat > conftest.$ac_ext < @@ -6449,7 +6353,7 @@ int main() { return 1; } EOF -if { (eval echo configure:6453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_api_serial=termios else @@ -6466,7 +6370,7 @@ fi tcl_cv_api_serial=no else cat > conftest.$ac_ext < @@ -6480,7 +6384,7 @@ int main() { return 1; } EOF -if { (eval echo configure:6484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_api_serial=termio else @@ -6498,7 +6402,7 @@ fi tcl_cv_api_serial=no else cat > conftest.$ac_ext < @@ -6513,7 +6417,7 @@ int main() { return 1; } EOF -if { (eval echo configure:6517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_api_serial=sgtty else @@ -6531,7 +6435,7 @@ fi tcl_cv_api_serial=no else cat > conftest.$ac_ext < @@ -6548,7 +6452,7 @@ int main() { return 1; } EOF -if { (eval echo configure:6552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_api_serial=termios else @@ -6566,7 +6470,7 @@ fi tcl_cv_api_serial=no else cat > conftest.$ac_ext < @@ -6582,7 +6486,7 @@ int main() { return 1; } EOF -if { (eval echo configure:6586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_api_serial=termio else @@ -6600,7 +6504,7 @@ fi tcl_cv_api_serial=none else cat > conftest.$ac_ext < @@ -6617,7 +6521,7 @@ int main() { return 1; } EOF -if { (eval echo configure:6621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_api_serial=sgtty else @@ -6660,20 +6564,20 @@ EOF #-------------------------------------------------------------------- echo $ac_n "checking for fd_set in sys/types""... $ac_c" 1>&6 -echo "configure:6664: checking for fd_set in sys/types" >&5 +echo "configure:6568: checking for fd_set in sys/types" >&5 if eval "test \"`echo '$''{'tcl_cv_type_fd_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { fd_set readMask, writeMask; ; return 0; } EOF -if { (eval echo configure:6677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_type_fd_set=yes else @@ -6689,13 +6593,13 @@ echo "$ac_t""$tcl_cv_type_fd_set" 1>&6 tcl_ok=$tcl_cv_type_fd_set if test $tcl_ok = no; then echo $ac_n "checking for fd_mask in sys/select""... $ac_c" 1>&6 -echo "configure:6693: checking for fd_mask in sys/select" >&5 +echo "configure:6597: checking for fd_mask in sys/select" >&5 if eval "test \"`echo '$''{'tcl_cv_grep_fd_mask'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -6732,12 +6636,12 @@ fi #------------------------------------------------------------------------------ echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:6736: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:6640: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6745,7 +6649,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:6749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -6770,17 +6674,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6774: checking for $ac_hdr" >&5 +echo "configure:6678: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6807,12 +6711,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:6811: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:6715: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6821,7 +6725,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:6825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -6842,12 +6746,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:6846: checking for tm_zone in struct tm" >&5 +echo "configure:6750: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -6855,7 +6759,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:6859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -6875,12 +6779,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:6879: checking for tzname" >&5 +echo "configure:6783: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -6890,7 +6794,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:6894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -6915,12 +6819,12 @@ fi for ac_func in gmtime_r localtime_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6919: checking for $ac_func" >&5 +echo "configure:6823: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6969,20 +6873,20 @@ done echo $ac_n "checking tm_tzadj in struct tm""... $ac_c" 1>&6 -echo "configure:6973: checking tm_tzadj in struct tm" >&5 +echo "configure:6877: checking tm_tzadj in struct tm" >&5 if eval "test \"`echo '$''{'tcl_cv_member_tm_tzadj'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct tm tm; tm.tm_tzadj; ; return 0; } EOF -if { (eval echo configure:6986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6890: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_member_tm_tzadj=yes else @@ -7003,20 +6907,20 @@ EOF fi echo $ac_n "checking tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:7007: checking tm_gmtoff in struct tm" >&5 +echo "configure:6911: checking tm_gmtoff in struct tm" >&5 if eval "test \"`echo '$''{'tcl_cv_member_tm_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct tm tm; tm.tm_gmtoff; ; return 0; } EOF -if { (eval echo configure:7020: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_member_tm_gmtoff=yes else @@ -7041,13 +6945,13 @@ EOF # (like convex) have timezone functions, etc. # echo $ac_n "checking long timezone variable""... $ac_c" 1>&6 -echo "configure:7045: checking long timezone variable" >&5 +echo "configure:6949: checking long timezone variable" >&5 if eval "test \"`echo '$''{'tcl_cv_timezone_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -7056,7 +6960,7 @@ extern long timezone; exit (0); ; return 0; } EOF -if { (eval echo configure:7060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_timezone_long=yes else @@ -7079,13 +6983,13 @@ EOF # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # echo $ac_n "checking time_t timezone variable""... $ac_c" 1>&6 -echo "configure:7083: checking time_t timezone variable" >&5 +echo "configure:6987: checking time_t timezone variable" >&5 if eval "test \"`echo '$''{'tcl_cv_timezone_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -7094,7 +6998,7 @@ extern time_t timezone; exit (0); ; return 0; } EOF -if { (eval echo configure:7098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_timezone_time=yes else @@ -7122,12 +7026,12 @@ EOF #-------------------------------------------------------------------- if test "$ac_cv_cygwin" != "yes"; then echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:7126: checking for st_blksize in struct stat" >&5 +echo "configure:7030: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7135,7 +7039,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:7139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -7157,12 +7061,12 @@ fi fi echo $ac_n "checking for fstatfs""... $ac_c" 1>&6 -echo "configure:7161: checking for fstatfs" >&5 +echo "configure:7065: checking for fstatfs" >&5 if eval "test \"`echo '$''{'ac_cv_func_fstatfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_fstatfs=yes" else @@ -7214,7 +7118,7 @@ fi # data, this checks it and add memcmp.o to LIBOBJS if needed #-------------------------------------------------------------------- echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:7218: checking for 8-bit clean memcmp" >&5 +echo "configure:7122: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7222,7 +7126,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -7256,12 +7160,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" # {The replacement define is in compat/string.h} #-------------------------------------------------------------------- echo $ac_n "checking for memmove""... $ac_c" 1>&6 -echo "configure:7260: checking for memmove" >&5 +echo "configure:7164: checking for memmove" >&5 if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_memmove=yes" else @@ -7317,7 +7221,7 @@ fi #-------------------------------------------------------------------- if test "x${ac_cv_func_strstr}" = "xyes"; then echo $ac_n "checking proper strstr implementation""... $ac_c" 1>&6 -echo "configure:7321: checking proper strstr implementation" >&5 +echo "configure:7225: checking proper strstr implementation" >&5 if eval "test \"`echo '$''{'tcl_cv_strstr_unbroken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7326,7 +7230,7 @@ else tcl_cv_strstr_unbroken=broken else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_strstr_unbroken=ok else @@ -7362,12 +7266,12 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for strtoul""... $ac_c" 1>&6 -echo "configure:7366: checking for strtoul" >&5 +echo "configure:7270: checking for strtoul" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtoul'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strtoul=yes" else @@ -7412,7 +7316,7 @@ fi if test $tcl_ok = 1; then echo $ac_n "checking proper strtoul implementation""... $ac_c" 1>&6 -echo "configure:7416: checking proper strtoul implementation" >&5 +echo "configure:7320: checking proper strtoul implementation" >&5 if eval "test \"`echo '$''{'tcl_cv_strtoul_unbroken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7421,7 +7325,7 @@ else tcl_cv_strtoul_unbroken=broken else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_strtoul_unbroken=ok else @@ -7466,12 +7370,12 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for strtod""... $ac_c" 1>&6 -echo "configure:7470: checking for strtod" >&5 +echo "configure:7374: checking for strtod" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strtod=yes" else @@ -7516,7 +7420,7 @@ fi if test $tcl_ok = 1; then echo $ac_n "checking proper strtod implementation""... $ac_c" 1>&6 -echo "configure:7520: checking proper strtod implementation" >&5 +echo "configure:7424: checking proper strtod implementation" >&5 if eval "test \"`echo '$''{'tcl_cv_strtod_unbroken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7525,7 +7429,7 @@ else tcl_cv_strtod_unbroken=broken else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_strtod_unbroken=ok else @@ -7573,12 +7477,12 @@ fi echo $ac_n "checking for strtod""... $ac_c" 1>&6 -echo "configure:7577: checking for strtod" >&5 +echo "configure:7481: checking for strtod" >&5 if eval "test \"`echo '$''{'ac_cv_func_strtod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strtod=yes" else @@ -7623,7 +7527,7 @@ fi if test "$tcl_strtod" = 1; then echo $ac_n "checking for Solaris2.4/Tru64 strtod bugs""... $ac_c" 1>&6 -echo "configure:7627: checking for Solaris2.4/Tru64 strtod bugs" >&5 +echo "configure:7531: checking for Solaris2.4/Tru64 strtod bugs" >&5 if eval "test \"`echo '$''{'tcl_cv_strtod_buggy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7632,7 +7536,7 @@ else tcl_cv_strtod_buggy=buggy else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_strtod_buggy=ok else @@ -7686,12 +7590,12 @@ EOF #-------------------------------------------------------------------- echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:7690: checking for ANSI C header files" >&5 +echo "configure:7594: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7699,7 +7603,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7607: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7716,7 +7620,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -7734,7 +7638,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -7755,7 +7659,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -7766,7 +7670,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:7770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -7790,12 +7694,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:7794: checking for mode_t" >&5 +echo "configure:7698: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -7823,12 +7727,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:7827: checking for pid_t" >&5 +echo "configure:7731: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -7856,12 +7760,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:7860: checking for size_t" >&5 +echo "configure:7764: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -7889,12 +7793,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:7893: checking for uid_t in sys/types.h" >&5 +echo "configure:7797: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -7924,13 +7828,13 @@ fi echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 -echo "configure:7928: checking for socklen_t" >&5 +echo "configure:7832: checking for socklen_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7969,12 +7873,12 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for opendir""... $ac_c" 1>&6 -echo "configure:7973: checking for opendir" >&5 +echo "configure:7877: checking for opendir" >&5 if eval "test \"`echo '$''{'ac_cv_func_opendir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_opendir=yes" else @@ -8030,13 +7934,13 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking union wait""... $ac_c" 1>&6 -echo "configure:8034: checking union wait" >&5 +echo "configure:7938: checking union wait" >&5 if eval "test \"`echo '$''{'tcl_cv_union_wait'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -8048,7 +7952,7 @@ WIFEXITED(x); /* Generates compiler error if WIFEXITED ; return 0; } EOF -if { (eval echo configure:8052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_union_wait=yes else @@ -8075,12 +7979,12 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for strncasecmp""... $ac_c" 1>&6 -echo "configure:8079: checking for strncasecmp" >&5 +echo "configure:7983: checking for strncasecmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strncasecmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strncasecmp=yes" else @@ -8125,7 +8029,7 @@ fi if test "$tcl_ok" = 0; then echo $ac_n "checking for strncasecmp in -lsocket""... $ac_c" 1>&6 -echo "configure:8129: checking for strncasecmp in -lsocket" >&5 +echo "configure:8033: checking for strncasecmp in -lsocket" >&5 ac_lib_var=`echo socket'_'strncasecmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8133,7 +8037,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8168,7 +8072,7 @@ fi fi if test "$tcl_ok" = 0; then echo $ac_n "checking for strncasecmp in -linet""... $ac_c" 1>&6 -echo "configure:8172: checking for strncasecmp in -linet" >&5 +echo "configure:8076: checking for strncasecmp in -linet" >&5 ac_lib_var=`echo inet'_'strncasecmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8176,7 +8080,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8223,12 +8127,12 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6 -echo "configure:8227: checking for gettimeofday" >&5 +echo "configure:8131: checking for gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gettimeofday=yes" else @@ -8275,13 +8179,13 @@ EOF fi echo $ac_n "checking for gettimeofday declaration""... $ac_c" 1>&6 -echo "configure:8279: checking for gettimeofday declaration" >&5 +echo "configure:8183: checking for gettimeofday declaration" >&5 if eval "test \"`echo '$''{'tcl_cv_grep_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -8312,14 +8216,14 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:8316: checking whether char is unsigned" >&5 +echo "configure:8220: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -8375,13 +8279,13 @@ EOF fi echo $ac_n "checking signed char declarations""... $ac_c" 1>&6 -echo "configure:8379: checking signed char declarations" >&5 +echo "configure:8283: checking signed char declarations" >&5 if eval "test \"`echo '$''{'tcl_cv_char_signed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_char_signed=yes else @@ -8416,7 +8320,7 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for a putenv() that copies the buffer""... $ac_c" 1>&6 -echo "configure:8420: checking for a putenv() that copies the buffer" >&5 +echo "configure:8324: checking for a putenv() that copies the buffer" >&5 if eval "test \"`echo '$''{'tcl_cv_putenv_copy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8425,7 +8329,7 @@ else tcl_cv_putenv_copy=no else cat > conftest.$ac_ext < @@ -8447,7 +8351,7 @@ else } EOF -if { (eval echo configure:8451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then tcl_cv_putenv_copy=no else @@ -8487,17 +8391,17 @@ fi if test "$langinfo_ok" = "yes"; then ac_safe=`echo "langinfo.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for langinfo.h""... $ac_c" 1>&6 -echo "configure:8491: checking for langinfo.h" >&5 +echo "configure:8395: checking for langinfo.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8501: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8521,21 +8425,21 @@ fi fi echo $ac_n "checking whether to use nl_langinfo""... $ac_c" 1>&6 -echo "configure:8525: checking whether to use nl_langinfo" >&5 +echo "configure:8429: checking whether to use nl_langinfo" >&5 if test "$langinfo_ok" = "yes"; then if eval "test \"`echo '$''{'tcl_cv_langinfo_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { nl_langinfo(CODESET); ; return 0; } EOF -if { (eval echo configure:8539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_cv_langinfo_h=yes else @@ -8568,17 +8472,17 @@ if test "`uname -s`" = "Darwin" ; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8572: checking for $ac_hdr" >&5 +echo "configure:8476: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8486: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8607,12 +8511,12 @@ done for ac_func in copyfile do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8611: checking for $ac_func" >&5 +echo "configure:8515: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8664,17 +8568,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8668: checking for $ac_hdr" >&5 +echo "configure:8572: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8678: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8703,12 +8607,12 @@ done for ac_func in OSSpinLockLock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8707: checking for $ac_func" >&5 +echo "configure:8611: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8639: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8758,12 +8662,12 @@ done for ac_func in pthread_atfork do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8762: checking for $ac_func" >&5 +echo "configure:8666: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8827,17 +8731,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8831: checking for $ac_hdr" >&5 +echo "configure:8735: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8865,14 +8769,14 @@ done if test "$ac_cv_header_AvailabilityMacros_h" = yes; then echo $ac_n "checking if weak import is available""... $ac_c" 1>&6 -echo "configure:8869: checking if weak import is available" >&5 +echo "configure:8773: checking if weak import is available" >&5 if eval "test \"`echo '$''{'tcl_cv_cc_weak_import'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_cc_weak_import=yes else @@ -8916,13 +8820,13 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for fts""... $ac_c" 1>&6 -echo "configure:8920: checking for fts" >&5 +echo "configure:8824: checking for fts" >&5 if eval "test \"`echo '$''{'tcl_cv_api_fts'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -8937,7 +8841,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_api_fts=yes else @@ -8969,17 +8873,17 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8973: checking for $ac_hdr" >&5 +echo "configure:8877: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8983: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9009,17 +8913,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:9013: checking for $ac_hdr" >&5 +echo "configure:8917: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9047,7 +8951,7 @@ done echo $ac_n "checking system version""... $ac_c" 1>&6 -echo "configure:9051: checking system version" >&5 +echo "configure:8955: checking system version" >&5 if eval "test \"`echo '$''{'tcl_cv_sys_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9078,7 +8982,7 @@ echo "$ac_t""$tcl_cv_sys_version" 1>&6 system=$tcl_cv_sys_version echo $ac_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O""... $ac_c" 1>&6 -echo "configure:9082: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5 +echo "configure:8986: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5 case $system in OSF*) cat >> confdefs.h <<\EOF @@ -9122,17 +9026,17 @@ fi if test $tcl_ok = yes; then ac_safe=`echo "sys/sdt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/sdt.h""... $ac_c" 1>&6 -echo "configure:9126: checking for sys/sdt.h" >&5 +echo "configure:9030: checking for sys/sdt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9159,7 +9063,7 @@ if test $tcl_ok = yes; then # Extract the first word of "dtrace", so it can be a program name with args. set dummy dtrace; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9163: checking for $ac_word" >&5 +echo "configure:9067: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DTRACE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9194,7 +9098,7 @@ fi test -z "$ac_cv_path_DTRACE" && tcl_ok=no fi echo $ac_n "checking whether to enable DTrace support""... $ac_c" 1>&6 -echo "configure:9198: checking whether to enable DTrace support" >&5 +echo "configure:9102: checking whether to enable DTrace support" >&5 MAKEFILE_SHELL='/bin/sh' if test $tcl_ok = yes; then cat >> confdefs.h <<\EOF @@ -9224,13 +9128,13 @@ echo "$ac_t""$tcl_ok" 1>&6 #-------------------------------------------------------------------- echo $ac_n "checking whether the cpuid instruction is usable""... $ac_c" 1>&6 -echo "configure:9228: checking whether the cpuid instruction is usable" >&5 +echo "configure:9132: checking whether the cpuid instruction is usable" >&5 if eval "test \"`echo '$''{'tcl_cv_cpuid'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_cv_cpuid=yes else @@ -9294,7 +9198,7 @@ if test "`uname -s`" = "Darwin" ; then if test "`uname -s`" = "Darwin" ; then echo $ac_n "checking how to package libraries""... $ac_c" 1>&6 -echo "configure:9298: checking how to package libraries" >&5 +echo "configure:9202: checking how to package libraries" >&5 # Check whether --enable-framework or --disable-framework was given. if test "${enable_framework+set}" = set; then enableval="$enable_framework" @@ -9574,34 +9478,15 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs # Without the "./", some shells look in PATH for config.status. diff --git a/unix/tcl.m4 b/unix/tcl.m4 index db64bbe..85b8f82 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1484,46 +1484,6 @@ dnl AC_CHECK_TOOL(AR, ar) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - NetBSD-1.*|FreeBSD-[[1-2]].*) - # Not available on all versions: check for include file. - AC_CHECK_HEADER(dlfcn.h, [ - # NetBSD/SPARC needs -fPIC, -fpic will not do. - SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - if test $doRpath = yes ; then - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' - fi - AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ - AC_EGREP_CPP(yes, [ -#ifdef __ELF__ - yes -#endif - ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) - if test $tcl_cv_ld_elf = yes; then - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' - else - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' - fi - ], [ - SHLIB_CFLAGS="" - SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r" - SHLIB_SUFFIX=".a" - DL_OBJS="tclLoadAout.o" - DL_LIBS="" - CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' - ]) - - # FreeBSD doesn't handle version numbers with dots. - - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' - TCL_LIB_VERSIONS_OK=nodots - ;; OpenBSD-*) arch=`arch -s` case "$arch" in @@ -1573,9 +1533,8 @@ dnl AC_CHECK_TOOL(AR, ar) UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' TCL_LIB_VERSIONS_OK=nodots ;; - NetBSD-*|FreeBSD-[[3-4]].*) - # FreeBSD 3.* and greater have ELF. - # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs + NetBSD-*) + # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" @@ -1605,7 +1564,7 @@ dnl AC_CHECK_TOOL(AR, ar) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-soname \$[@]" + TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$[@]" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" -- cgit v0.12 From 349564d2ad254c318eb5f8ac46ef2597621cd4ee Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 19 May 2013 14:04:07 +0000 Subject: Don't #define VOID on VxWorks, as it is already typdef'd to void Eliminate possibly conflicting LOCAL #define --- generic/regguts.h | 6 +++--- generic/tcl.h | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/generic/regguts.h b/generic/regguts.h index ee5c596..b33753c 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -378,12 +378,12 @@ struct subre { # define CAP 010 /* capturing parens below */ # define BACKR 020 /* back reference below */ # define INUSE 0100 /* in use in final tree */ -# define LOCAL 03 /* bits which may not propagate up */ +# define NOPROP 03 /* bits which may not propagate up */ # define LMIX(f) ((f)<<2) /* LONGER -> MIXED */ # define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */ -# define UP(f) (((f)&~LOCAL) | (LMIX(f) & SMIX(f) & MIXED)) +# define UP(f) (((f)&~NOPROP) | (LMIX(f) & SMIX(f) & MIXED)) # define MESSY(f) ((f)&(MIXED|CAP|BACKR)) -# define PREF(f) ((f)&LOCAL) +# define PREF(f) ((f)&NOPROP) # define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2)) # define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2)) short retry; /* index into retry memory */ diff --git a/generic/tcl.h b/generic/tcl.h index 5f47734..466ddcc 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -294,10 +294,12 @@ typedef long LONG; * non-ANSI systems. */ -#ifndef NO_VOID -# define VOID void -#else -# define VOID char +#ifndef __VXWORKS__ +# ifndef NO_VOID +# define VOID void +# else +# define VOID char +# endif #endif /* -- cgit v0.12 From 0eb5b1db67343f2a0f3ca3acaf567db4f3c7b9cf Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 20 May 2013 14:17:06 +0000 Subject: [3613567]: Corrected sense of test on results of access() in temp file creation. --- ChangeLog | 5 +++++ unix/tclUnixFCmd.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b10acb6..ee43bb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-20 Donal K. Fellows + + * unix/tclUnixFCmd.c (DefaultTempDir): [Bug 3613567]: Corrected logic + for checking return code of access() system call, which was inverted. + 2013-05-19 Jan Nijtmans * unix/tcl.m4: Fix for FreeBSD, and remove support for older diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 6f443a9..e27f78f 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -2226,13 +2226,13 @@ DefaultTempDir(void) dir = getenv("TMPDIR"); if (dir && dir[0] && stat(dir, &buf) == 0 && S_ISDIR(buf.st_mode) - && access(dir, W_OK)) { + && access(dir, W_OK) == 0) { return dir; } #ifdef P_tmpdir dir = P_tmpdir; - if (stat(dir, &buf) == 0 && S_ISDIR(buf.st_mode) && access(dir, W_OK)) { + if (stat(dir, &buf)==0 && S_ISDIR(buf.st_mode) && access(dir, W_OK)==0) { return dir; } #endif -- cgit v0.12 From dca34fd2a8e63fc14396f851889696c3793a2a1d Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 20 May 2013 15:10:18 +0000 Subject: 3613569 Handle case when TclpTempFileNameForLibrary returns NULL. --- generic/tclIOUtil.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 25ed57c..6259216 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -3225,6 +3225,9 @@ Tcl_LoadFile( */ copyToPtr = TclpTempFileNameForLibrary(interp, pathPtr); + if (copyToPtr == NULL) { + return TCL_ERROR; + } Tcl_IncrRefCount(copyToPtr); copyFsPtr = Tcl_FSGetFileSystemForPath(copyToPtr); -- cgit v0.12 From f193acf08ce4f3fe6db1cb79ab3589d037e5853c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 21 May 2013 09:27:15 +0000 Subject: Proposed solution for 3613609: lsort -nocase does not sort non-ASCII correctly --- generic/tclCmdIL.c | 10 +++++----- generic/tclCmdMZ.c | 2 +- generic/tclInt.h | 1 + generic/tclUtf.c | 27 +++++++++++++++++++++++++++ tests/cmdIL.test | 3 +++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 152e61d..98ec8b4 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2807,7 +2807,7 @@ Tcl_LsearchObjCmd( dataType = INTEGER; break; case LSEARCH_NOCASE: /* -nocase */ - strCmpFn = strcasecmp; + strCmpFn = TclUtfCasecmp; noCase = 1; break; case LSEARCH_NOT: /* -not */ @@ -3209,7 +3209,7 @@ Tcl_LsearchObjCmd( */ if (noCase) { - match = (strcasecmp(bytes, patternBytes) == 0); + match = (TclUtfCasecmp(bytes, patternBytes) == 0); } else { match = (memcmp(bytes, patternBytes, (size_t) length) == 0); @@ -3712,7 +3712,7 @@ Tcl_LsortObjCmd( goto done1; } elementArray[i].index.intValue = a; - } else if (sortInfo.sortMode == SORTMODE_REAL) { + } else if (sortMode == SORTMODE_REAL) { double a; if (Tcl_GetDoubleFromObj(sortInfo.interp, indexPtr, &a) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; @@ -3790,7 +3790,7 @@ Tcl_LsortObjCmd( ckfree((char *)elementArray); done: - if (sortInfo.sortMode == SORTMODE_COMMAND) { + if (sortMode == SORTMODE_COMMAND) { TclDecrRefCount(sortInfo.compareCmdPtr); TclDecrRefCount(listObj); sortInfo.compareCmdPtr = NULL; @@ -3932,7 +3932,7 @@ SortCompare( order = strcmp(elemPtr1->index.strValuePtr, elemPtr2->index.strValuePtr); } else if (infoPtr->sortMode == SORTMODE_ASCII_NC) { - order = strcasecmp(elemPtr1->index.strValuePtr, + order = TclUtfCasecmp(elemPtr1->index.strValuePtr, elemPtr2->index.strValuePtr); } else if (infoPtr->sortMode == SORTMODE_DICTIONARY) { order = DictionaryCompare(elemPtr1->index.strValuePtr, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 0ad77aa..6fd468c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3436,7 +3436,7 @@ Tcl_SwitchObjCmd( i++; goto finishedOptions; case OPT_NOCASE: - strCmpFn = strcasecmp; + strCmpFn = TclUtfCasecmp; noCase = 1; break; diff --git a/generic/tclInt.h b/generic/tclInt.h index 92251fe..dc28b97 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2762,6 +2762,7 @@ MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); #endif MODULE_SCOPE Tcl_Obj * TclDisassembleByteCodeObj(Tcl_Obj *objPtr); +MODULE_SCOPE int TclUtfCasecmp(CONST char *cs, CONST char *ct); /* *---------------------------------------------------------------- diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 83900e9..9dacb53 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1101,6 +1101,33 @@ Tcl_UtfNcasecmp( } return 0; } + + +/* Replacement for strcasecmp in Tcl core, in places where UTF-8 should be handled. */ +int +TclUtfCasecmp( + CONST char *cs, /* UTF string to compare to ct. */ + CONST char *ct) /* UTF string cs is compared to. */ +{ + Tcl_UniChar ch1, ch2; + char c; + + do { + + /* If c == '\0', loop should end. */ + c = *cs; + + cs += TclUtfToUniChar(cs, &ch1); + ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + ch2 = Tcl_UniCharToLower(ch2); + if (ch1 != ch2) break; + } + } while (c); + return (ch1 - ch2); +} + /* *---------------------------------------------------------------------- diff --git a/tests/cmdIL.test b/tests/cmdIL.test index b387e71..c9a10b6 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -394,6 +394,9 @@ test cmdIL-4.34 {SortCompare procedure, -ascii option with -nocase option} { test cmdIL-4.35 {SortCompare procedure, -ascii option with -nocase option} { lsort -ascii -nocase {d E c B a D35 d300 100 20} } {100 20 a B c d d300 D35 E} +test cmdIL-4.36 {SortCompare procedure, UTF-8 with -nocase option} { + lsort -ascii -nocase [list \u101 \u100] +} [list \u101 \u100] test cmdIL-5.1 {lsort with list style index} { lsort -ascii -decreasing -index {0 1} { -- cgit v0.12 From 52ae090e68314dd4aad0ba73e0869527bb321db4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 21 May 2013 09:38:05 +0000 Subject: Slight improvement: if cs = "\xC0\x80" and ct = "\x00", loop would continue after NUL-byte, this should not happen. --- generic/tclUtf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 9dacb53..a7a2091 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1110,12 +1110,12 @@ TclUtfCasecmp( CONST char *ct) /* UTF string cs is compared to. */ { Tcl_UniChar ch1, ch2; - char c; + int goOn; do { - /* If c == '\0', loop should end. */ - c = *cs; + /* If *cs == '\0' or *ct == '\0', loop should end. */ + goOn = *cs && *ct; cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); @@ -1124,7 +1124,7 @@ TclUtfCasecmp( ch2 = Tcl_UniCharToLower(ch2); if (ch1 != ch2) break; } - } while (c); + } while (goOn); return (ch1 - ch2); } -- cgit v0.12 From 6ede2e9a9c11a27ad6be06a3eceda2f98be8f8d5 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 22 May 2013 10:36:55 +0000 Subject: * doc/file.n: [Bug 3613671]: Added note to portability section on the fact that [file owned] does not produce useful results on Windows. --- ChangeLog | 5 +++++ doc/file.n | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index ee43bb9..553abbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-22 Donal K. Fellows + + * doc/file.n: [Bug 3613671]: Added note to portability section on the + fact that [file owned] does not produce useful results on Windows. + 2013-05-20 Donal K. Fellows * unix/tclUnixFCmd.c (DefaultTempDir): [Bug 3613567]: Corrected logic diff --git a/doc/file.n b/doc/file.n index eef4647..0b0ee9d 100644 --- a/doc/file.n +++ b/doc/file.n @@ -481,6 +481,13 @@ Returns \fB1\fR if file \fIname\fR is writable by the current user, . These commands always operate using the real user and group identifiers, not the effective ones. +.TP +\fBWindows\fR\0\0\0\0 +. +The \fbfile owned\fR subcommand currently always reports that the current user +is the owner of the file, without regard for what the operating system +believes to be true, making an ownership test useless. This issue (#3613671) +may be fixed in a future release of Tcl. .SH EXAMPLES .PP This procedure shows how to search for C files in a given directory -- cgit v0.12 From 5689a75644f9b109581a5dc3ae15294467c657ab Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 22 May 2013 12:32:28 +0000 Subject: Improved tests. --- tests/cmdIL.test | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/cmdIL.test b/tests/cmdIL.test index c9a10b6..192c10c 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -395,8 +395,11 @@ test cmdIL-4.35 {SortCompare procedure, -ascii option with -nocase option} { lsort -ascii -nocase {d E c B a D35 d300 100 20} } {100 20 a B c d d300 D35 E} test cmdIL-4.36 {SortCompare procedure, UTF-8 with -nocase option} { - lsort -ascii -nocase [list \u101 \u100] -} [list \u101 \u100] + scan [lsort -ascii -nocase [list \u101 \u100]] %c%c%c +} {257 32 256} +test cmdIL-4.37 {SortCompare procedure, UTF-8 with -nocase option} { + scan [lsort -ascii -nocase [list a\u0000a a]] %c%c%c%c%c +} {97 32 97 0 97} test cmdIL-5.1 {lsort with list style index} { lsort -ascii -decreasing -index {0 1} { -- cgit v0.12 From 75b8011dbad373e664a676ed8e3bcfec70313838 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 22 May 2013 12:55:50 +0000 Subject: Fixed the weird edge case. --- generic/tclUtf.c | 37 +++++++++++++++++++++++++------------ tests/cmdIL.test | 3 +++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index a7a2091..f3d1758 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1101,31 +1101,44 @@ Tcl_UtfNcasecmp( } return 0; } + +/* + *---------------------------------------------------------------------- + * + * Tcl_UtfNcasecmp -- + * + * Compare UTF chars of string cs to string ct case insensitively. + * Replacement for strcasecmp in Tcl core, in places where UTF-8 should + * be handled. + * + * Results: + * Return <0 if cs < ct, 0 if cs == ct, or >0 if cs > ct. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ - -/* Replacement for strcasecmp in Tcl core, in places where UTF-8 should be handled. */ int TclUtfCasecmp( CONST char *cs, /* UTF string to compare to ct. */ CONST char *ct) /* UTF string cs is compared to. */ { - Tcl_UniChar ch1, ch2; - int goOn; - - do { - - /* If *cs == '\0' or *ct == '\0', loop should end. */ - goOn = *cs && *ct; + while (*cs && *ct) { + Tcl_UniChar ch1, ch2; cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); - if (ch1 != ch2) break; + if (ch1 != ch2) { + return ch1 - ch2; + } } - } while (goOn); - return (ch1 - ch2); + } + return UCHAR(*cs) - UCHAR(*ct); } diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 192c10c..6fab269 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -400,6 +400,9 @@ test cmdIL-4.36 {SortCompare procedure, UTF-8 with -nocase option} { test cmdIL-4.37 {SortCompare procedure, UTF-8 with -nocase option} { scan [lsort -ascii -nocase [list a\u0000a a]] %c%c%c%c%c } {97 32 97 0 97} +test cmdIL-4.38 {SortCompare procedure, UTF-8 with -nocase option} { + scan [lsort -ascii -nocase [list a a\u0000a]] %c%c%c%c%c +} {97 32 97 0 97} test cmdIL-5.1 {lsort with list style index} { lsort -ascii -decreasing -index {0 1} { -- cgit v0.12 From 376e9d0e30ef379c2c5c8de337f2467cbdb835e8 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 22 May 2013 13:14:18 +0000 Subject: silence compiler warning --- generic/tclCmdIL.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 98ec8b4..ea9c1e4 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3460,7 +3460,8 @@ Tcl_LsortObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - int i, j, index, indices, length, nocase = 0, sortMode, indexc; + int i, j, index, indices, length, nocase = 0, indexc; + int sortMode = SORTMODE_ASCII; Tcl_Obj *resultPtr, *cmdPtr, **listObjPtrs, *listObj, *indexPtr; SortElement *elementArray, *elementPtr; SortInfo sortInfo; /* Information about this sort that needs to -- cgit v0.12 From 3fad6ea7aff79c539045d7ae893fe71696ff3498 Mon Sep 17 00:00:00 2001 From: andreask Date: Wed, 22 May 2013 16:39:01 +0000 Subject: Removed const qualifier causing the HP native cc to error out (error 1675: Duplicate type qualifier "const"). --- ChangeLog | 5 +++++ generic/tclCompile.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34fd231..cd18de0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-22 Andreas Kupries + + * tclCompile.c: Removed duplicate const qualifier causing the HP + native cc to error out. + 2013-05-22 Donal K. Fellows * generic/tclUtf.c (TclUtfCasecmp): [Bug 3613609]: Replace problematic diff --git a/generic/tclCompile.c b/generic/tclCompile.c index f6dfbad..cdaf985 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -51,7 +51,7 @@ static int traceInitialized = 0; * existence of a procedure call frame to distinguish these. */ -const InstructionDesc const tclInstructionTable[] = { +InstructionDesc const tclInstructionTable[] = { /* Name Bytes stackEffect #Opnds Operand types */ {"done", 1, -1, 0, {OPERAND_NONE}}, /* Finish ByteCode execution and return stktop (top stack item) */ -- cgit v0.12 From 3d187689a8b892947e975457d3784bdc50b6ded0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 23 May 2013 11:28:18 +0000 Subject: When compiling Tcl with mingw32/wsl-4.0, make sure that no 64-bit time functions are used, which don't exist in Win95/98/ME. --- compat/strftime.c | 3 +++ win/tclWinTime.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/compat/strftime.c b/compat/strftime.c index 68016ac..d3a1075 100644 --- a/compat/strftime.c +++ b/compat/strftime.c @@ -44,6 +44,9 @@ * SUCH DAMAGE. */ +#if defined(_WIN32) && !defined(_WIN64) +# define _USE_32BIT_TIME_T +#endif #include #include #include diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 8fdc071..1e23459 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -10,6 +10,9 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#if defined(_WIN32) && !defined(_WIN64) +# define _USE_32BIT_TIME_T +#endif #include "tclWinInt.h" #define SECSPERDAY (60L * 60L * 24L) -- cgit v0.12 From 749f9c4ee0a50a7cedec339c2b3a69733fedf172 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 23 May 2013 18:32:19 +0000 Subject: Eliminate code duplication. --- generic/tclCompCmds.c | 72 +----------- generic/tclCompCmdsGR.c | 305 ------------------------------------------------ generic/tclCompCmdsSZ.c | 292 --------------------------------------------- generic/tclCompile.h | 65 +++++++++++ 4 files changed, 68 insertions(+), 666 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 2ac0fe3..e4b1087 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -31,11 +31,6 @@ static void FreeForeachInfo(ClientData clientData); static void PrintForeachInfo(ClientData clientData, Tcl_Obj *appendObj, ByteCode *codePtr, unsigned int pcOffset); -static int PushVarName(Tcl_Interp *interp, - Tcl_Token *varTokenPtr, CompileEnv *envPtr, - int flags, int *localIndexPtr, - int *simpleVarNamePtr, int *isScalarPtr, - int line, int *clNext); static int CompileEachloopCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, CompileEnv *envPtr, int collect); @@ -43,67 +38,6 @@ static int CompileDictEachCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr, int collect); - -/* - * Macro that encapsulates an efficiency trick that avoids a function call for - * the simplest of compiles. The ANSI C "prototype" for this macro is: - * - * static void CompileWord(CompileEnv *envPtr, Tcl_Token *tokenPtr, - * Tcl_Interp *interp, int word); - */ - -#define CompileWord(envPtr, tokenPtr, interp, word) \ - if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \ - TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \ - (tokenPtr)[1].size), (envPtr)); \ - } else { \ - envPtr->line = mapPtr->loc[eclIndex].line[word]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[word]; \ - TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ - (envPtr)); \ - } - -/* - * TIP #280: Remember the per-word line information of the current command. An - * index is used instead of a pointer as recursive compilation may reallocate, - * i.e. move, the array. This is also the reason to save the nuloc now, it may - * change during the course of the function. - * - * Macro to encapsulate the variable definition and setup. - */ - -#define DefineLineInformation \ - ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ - int eclIndex = mapPtr->nuloc - 1 - -#define SetLineInformation(word) \ - envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] - -#define PushVarNameWord(i,v,e,f,l,s,sc,word) \ - PushVarName(i,v,e,f,l,s,sc, \ - mapPtr->loc[eclIndex].line[(word)], \ - mapPtr->loc[eclIndex].next[(word)]) - -/* - * Often want to issue one of two versions of an instruction based on whether - * the argument will fit in a single byte or not. This makes it much clearer. - */ - -#define Emit14Inst(nm,idx,envPtr) \ - if (idx <= 255) { \ - TclEmitInstInt1(nm##1,idx,envPtr); \ - } else { \ - TclEmitInstInt4(nm##4,idx,envPtr); \ - } - -/* - * Flags bits used by PushVarName. - */ - -#define TCL_NO_LARGE_INDEX 1 /* Do not return localIndex value > 255 */ -#define TCL_NO_ELEMENT 2 /* Do not push the array element. */ - /* * The structures below define the AuxData types defined in this file. */ @@ -3329,7 +3263,7 @@ TclCompileFormatCmd( /* *---------------------------------------------------------------------- * - * PushVarName -- + * TclPushVarName -- * * Procedure used in the compiling where pushing a variable name is * necessary (append, lappend, set). @@ -3345,8 +3279,8 @@ TclCompileFormatCmd( *---------------------------------------------------------------------- */ -static int -PushVarName( +int +TclPushVarName( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Token *varTokenPtr, /* Points to a variable token. */ CompileEnv *envPtr, /* Holds resulting instructions. */ diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 26e63e8..2bd43b6 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -27,71 +27,7 @@ static void CompileReturnInternal(CompileEnv *envPtr, Tcl_Obj *returnOpts); static int IndexTailVarIfKnown(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr); -static int PushVarName(Tcl_Interp *interp, - Tcl_Token *varTokenPtr, CompileEnv *envPtr, - int flags, int *localIndexPtr, - int *simpleVarNamePtr, int *isScalarPtr, - int line, int *clNext); -/* - * Macro that encapsulates an efficiency trick that avoids a function call for - * the simplest of compiles. The ANSI C "prototype" for this macro is: - * - * static void CompileWord(CompileEnv *envPtr, Tcl_Token *tokenPtr, - * Tcl_Interp *interp, int word); - */ - -#define CompileWord(envPtr, tokenPtr, interp, word) \ - if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \ - TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \ - (tokenPtr)[1].size), (envPtr)); \ - } else { \ - envPtr->line = mapPtr->loc[eclIndex].line[word]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[word]; \ - TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ - (envPtr)); \ - } - -/* - * TIP #280: Remember the per-word line information of the current command. An - * index is used instead of a pointer as recursive compilation may reallocate, - * i.e. move, the array. This is also the reason to save the nuloc now, it may - * change during the course of the function. - * - * Macro to encapsulate the variable definition and setup. - */ - -#define DefineLineInformation \ - ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ - int eclIndex = mapPtr->nuloc - 1 - -#define SetLineInformation(word) \ - envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] - -#define PushVarNameWord(i,v,e,f,l,s,sc,word) \ - PushVarName(i,v,e,f,l,s,sc, \ - mapPtr->loc[eclIndex].line[(word)], \ - mapPtr->loc[eclIndex].next[(word)]) - -/* - * Often want to issue one of two versions of an instruction based on whether - * the argument will fit in a single byte or not. This makes it much clearer. - */ - -#define Emit14Inst(nm,idx,envPtr) \ - if (idx <= 255) { \ - TclEmitInstInt1(nm##1,idx,envPtr); \ - } else { \ - TclEmitInstInt4(nm##4,idx,envPtr); \ - } - -/* - * Flags bits used by PushVarName. - */ - -#define TCL_NO_LARGE_INDEX 1 /* Do not return localIndex value > 255 */ -#define TCL_NO_ELEMENT 2 /* Do not push the array element. */ /* *---------------------------------------------------------------------- @@ -2988,247 +2924,6 @@ TclCompileObjectSelfCmd( } /* - *---------------------------------------------------------------------- - * - * PushVarName -- - * - * Procedure used in the compiling where pushing a variable name is - * necessary (append, lappend, set). - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "set" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -static int -PushVarName( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Token *varTokenPtr, /* Points to a variable token. */ - CompileEnv *envPtr, /* Holds resulting instructions. */ - int flags, /* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */ - int *localIndexPtr, /* Must not be NULL. */ - int *simpleVarNamePtr, /* Must not be NULL. */ - int *isScalarPtr, /* Must not be NULL. */ - int line, /* Line the token starts on. */ - int *clNext) /* Reference to offset of next hidden cont. - * line. */ -{ - register const char *p; - const char *name, *elName; - register int i, n; - Tcl_Token *elemTokenPtr = NULL; - int nameChars, elNameChars, simpleVarName, localIndex; - int elemTokenCount = 0, allocedTokens = 0, removedParen = 0; - - /* - * Decide if we can use a frame slot for the var/array name or if we need - * to emit code to compute and push the name at runtime. We use a frame - * slot (entry in the array of local vars) if we are compiling a procedure - * body and if the name is simple text that does not include namespace - * qualifiers. - */ - - simpleVarName = 0; - name = elName = NULL; - nameChars = elNameChars = 0; - localIndex = -1; - - /* - * Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether - * curly braces surround the variable name. This really matters for array - * elements to handle things like - * set {x($foo)} 5 - * which raises an undefined var error if we are not careful here. - */ - - if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && - (varTokenPtr->start[0] != '{')) { - /* - * A simple variable name. Divide it up into "name" and "elName" - * strings. If it is not a local variable, look it up at runtime. - */ - - simpleVarName = 1; - - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (name[nameChars-1] == ')') { - /* - * last char is ')' => potential array reference. - */ - - for (i=0,p=name ; itype = TCL_TOKEN_TEXT; - elemTokenPtr->start = elName; - elemTokenPtr->size = elNameChars; - elemTokenPtr->numComponents = 0; - elemTokenCount = 1; - } - } - } else if (((n = varTokenPtr->numComponents) > 1) - && (varTokenPtr[1].type == TCL_TOKEN_TEXT) - && (varTokenPtr[n].type == TCL_TOKEN_TEXT) - && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) { - /* - * Check for parentheses inside first token. - */ - - simpleVarName = 0; - for (i = 0, p = varTokenPtr[1].start; - i < varTokenPtr[1].size; i++, p++) { - if (*p == '(') { - simpleVarName = 1; - break; - } - } - if (simpleVarName) { - int remainingChars; - - /* - * Check the last token: if it is just ')', do not count it. - * Otherwise, remove the ')' and flag so that it is restored at - * the end. - */ - - if (varTokenPtr[n].size == 1) { - n--; - } else { - varTokenPtr[n].size--; - removedParen = n; - } - - name = varTokenPtr[1].start; - nameChars = p - varTokenPtr[1].start; - elName = p + 1; - remainingChars = (varTokenPtr[2].start - p) - 1; - elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 2; - - if (remainingChars) { - /* - * Make a first token with the extra characters in the first - * token. - */ - - elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token)); - allocedTokens = 1; - elemTokenPtr->type = TCL_TOKEN_TEXT; - elemTokenPtr->start = elName; - elemTokenPtr->size = remainingChars; - elemTokenPtr->numComponents = 0; - elemTokenCount = n; - - /* - * Copy the remaining tokens. - */ - - memcpy(elemTokenPtr+1, varTokenPtr+2, - (n-1) * sizeof(Tcl_Token)); - } else { - /* - * Use the already available tokens. - */ - - elemTokenPtr = &varTokenPtr[2]; - elemTokenCount = n - 1; - } - } - } - - if (simpleVarName) { - /* - * See whether name has any namespace separators (::'s). - */ - - int hasNsQualifiers = 0; - - for (i = 0, p = name; i < nameChars; i++, p++) { - if ((*p == ':') && ((i+1) < nameChars) && (*(p+1) == ':')) { - hasNsQualifiers = 1; - break; - } - } - - /* - * Look up the var name's index in the array of local vars in the proc - * frame. If retrieving the var's value and it doesn't already exist, - * push its name and look it up at runtime. - */ - - if (!hasNsQualifiers) { - localIndex = TclFindCompiledLocal(name, nameChars, - 1, envPtr); - if ((flags & TCL_NO_LARGE_INDEX) && (localIndex > 255)) { - /* - * We'll push the name. - */ - - localIndex = -1; - } - } - if (localIndex < 0) { - PushLiteral(envPtr, name, nameChars); - } - - /* - * Compile the element script, if any, and only if not inhibited. [Bug - * 3600328] - */ - - if (elName != NULL && !(flags & TCL_NO_ELEMENT)) { - if (elNameChars) { - envPtr->line = line; - envPtr->clNext = clNext; - TclCompileTokens(interp, elemTokenPtr, elemTokenCount, - envPtr); - } else { - PushLiteral(envPtr, "", 0); - } - } - } else { - /* - * The var name isn't simple: compile and push it. - */ - - envPtr->line = line; - envPtr->clNext = clNext; - CompileTokens(envPtr, varTokenPtr, interp); - } - - if (removedParen) { - varTokenPtr[removedParen].size++; - } - if (allocedTokens) { - TclStackFree(interp, elemTokenPtr); - } - *localIndexPtr = localIndex; - *simpleVarNamePtr = simpleVarName; - *isScalarPtr = (elName == NULL); - return TCL_OK; -} - -/* * Local Variables: * mode: c * c-basic-offset: 4 diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index f73beca..4a7d45b 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -27,11 +27,6 @@ static void FreeJumptableInfo(ClientData clientData); static void PrintJumptableInfo(ClientData clientData, Tcl_Obj *appendObj, ByteCode *codePtr, unsigned int pcOffset); -static int PushVarName(Tcl_Interp *interp, - Tcl_Token *varTokenPtr, CompileEnv *envPtr, - int flags, int *localIndexPtr, - int *simpleVarNamePtr, int *isScalarPtr, - int line, int *clNext); static int CompileAssociativeBinaryOpCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, const char *identity, int instruction, CompileEnv *envPtr); @@ -69,53 +64,6 @@ static int IssueTryInstructions(Tcl_Interp *interp, int *optionVarIndices, Tcl_Token **handlerTokens); /* - * Macro that encapsulates an efficiency trick that avoids a function call for - * the simplest of compiles. The ANSI C "prototype" for this macro is: - * - * static void CompileWord(CompileEnv *envPtr, Tcl_Token *tokenPtr, - * Tcl_Interp *interp, int word); - */ - -#define CompileWord(envPtr, tokenPtr, interp, word) \ - if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \ - TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \ - (tokenPtr)[1].size), (envPtr)); \ - } else { \ - envPtr->line = mapPtr->loc[eclIndex].line[word]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[word]; \ - TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ - (envPtr)); \ - } - -/* - * TIP #280: Remember the per-word line information of the current command. An - * index is used instead of a pointer as recursive compilation may reallocate, - * i.e. move, the array. This is also the reason to save the nuloc now, it may - * change during the course of the function. - * - * Macro to encapsulate the variable definition and setup. - */ - -#define DefineLineInformation \ - ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ - int eclIndex = mapPtr->nuloc - 1 - -#define SetLineInformation(word) \ - envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] - -#define PushVarNameWord(i,v,e,f,l,s,sc,word) \ - PushVarName(i,v,e,f,l,s,sc, \ - mapPtr->loc[eclIndex].line[(word)], \ - mapPtr->loc[eclIndex].next[(word)]) - -/* - * Flags bits used by PushVarName. - */ - -#define TCL_NO_LARGE_INDEX 1 /* Do not return localIndex value > 255 */ - -/* * The structures below define the AuxData types defined in this file. */ @@ -3025,246 +2973,6 @@ TclCompileYieldCmd( /* *---------------------------------------------------------------------- * - * PushVarName -- - * - * Procedure used in the compiling where pushing a variable name is - * necessary (append, lappend, set). - * - * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. - * - * Side effects: - * Instructions are added to envPtr to execute the "set" command at - * runtime. - * - *---------------------------------------------------------------------- - */ - -static int -PushVarName( - Tcl_Interp *interp, /* Used for error reporting. */ - Tcl_Token *varTokenPtr, /* Points to a variable token. */ - CompileEnv *envPtr, /* Holds resulting instructions. */ - int flags, /* TCL_NO_LARGE_INDEX. */ - int *localIndexPtr, /* Must not be NULL. */ - int *simpleVarNamePtr, /* Must not be NULL. */ - int *isScalarPtr, /* Must not be NULL. */ - int line, /* Line the token starts on. */ - int *clNext) /* Reference to offset of next hidden cont. - * line. */ -{ - register const char *p; - const char *name, *elName; - register int i, n; - Tcl_Token *elemTokenPtr = NULL; - int nameChars, elNameChars, simpleVarName, localIndex; - int elemTokenCount = 0, allocedTokens = 0, removedParen = 0; - - /* - * Decide if we can use a frame slot for the var/array name or if we need - * to emit code to compute and push the name at runtime. We use a frame - * slot (entry in the array of local vars) if we are compiling a procedure - * body and if the name is simple text that does not include namespace - * qualifiers. - */ - - simpleVarName = 0; - name = elName = NULL; - nameChars = elNameChars = 0; - localIndex = -1; - - /* - * Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether - * curly braces surround the variable name. This really matters for array - * elements to handle things like - * set {x($foo)} 5 - * which raises an undefined var error if we are not careful here. - */ - - if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && - (varTokenPtr->start[0] != '{')) { - /* - * A simple variable name. Divide it up into "name" and "elName" - * strings. If it is not a local variable, look it up at runtime. - */ - - simpleVarName = 1; - - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (name[nameChars-1] == ')') { - /* - * last char is ')' => potential array reference. - */ - - for (i=0,p=name ; itype = TCL_TOKEN_TEXT; - elemTokenPtr->start = elName; - elemTokenPtr->size = elNameChars; - elemTokenPtr->numComponents = 0; - elemTokenCount = 1; - } - } - } else if (((n = varTokenPtr->numComponents) > 1) - && (varTokenPtr[1].type == TCL_TOKEN_TEXT) - && (varTokenPtr[n].type == TCL_TOKEN_TEXT) - && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) { - /* - * Check for parentheses inside first token. - */ - - simpleVarName = 0; - for (i = 0, p = varTokenPtr[1].start; - i < varTokenPtr[1].size; i++, p++) { - if (*p == '(') { - simpleVarName = 1; - break; - } - } - if (simpleVarName) { - int remainingChars; - - /* - * Check the last token: if it is just ')', do not count it. - * Otherwise, remove the ')' and flag so that it is restored at - * the end. - */ - - if (varTokenPtr[n].size == 1) { - n--; - } else { - varTokenPtr[n].size--; - removedParen = n; - } - - name = varTokenPtr[1].start; - nameChars = p - varTokenPtr[1].start; - elName = p + 1; - remainingChars = (varTokenPtr[2].start - p) - 1; - elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 2; - - if (remainingChars) { - /* - * Make a first token with the extra characters in the first - * token. - */ - - elemTokenPtr = TclStackAlloc(interp, n * sizeof(Tcl_Token)); - allocedTokens = 1; - elemTokenPtr->type = TCL_TOKEN_TEXT; - elemTokenPtr->start = elName; - elemTokenPtr->size = remainingChars; - elemTokenPtr->numComponents = 0; - elemTokenCount = n; - - /* - * Copy the remaining tokens. - */ - - memcpy(elemTokenPtr+1, varTokenPtr+2, - (n-1) * sizeof(Tcl_Token)); - } else { - /* - * Use the already available tokens. - */ - - elemTokenPtr = &varTokenPtr[2]; - elemTokenCount = n - 1; - } - } - } - - if (simpleVarName) { - /* - * See whether name has any namespace separators (::'s). - */ - - int hasNsQualifiers = 0; - - for (i = 0, p = name; i < nameChars; i++, p++) { - if ((*p == ':') && ((i+1) < nameChars) && (*(p+1) == ':')) { - hasNsQualifiers = 1; - break; - } - } - - /* - * Look up the var name's index in the array of local vars in the proc - * frame. If retrieving the var's value and it doesn't already exist, - * push its name and look it up at runtime. - */ - - if (!hasNsQualifiers) { - localIndex = TclFindCompiledLocal(name, nameChars, - 1, envPtr); - if ((flags & TCL_NO_LARGE_INDEX) && (localIndex > 255)) { - /* - * We'll push the name. - */ - - localIndex = -1; - } - } - if (localIndex < 0) { - PushLiteral(envPtr, name, nameChars); - } - - /* - * Compile the element script, if any. - */ - - if (elName != NULL) { - if (elNameChars) { - envPtr->line = line; - envPtr->clNext = clNext; - TclCompileTokens(interp, elemTokenPtr, elemTokenCount, - envPtr); - } else { - PushLiteral(envPtr, "", 0); - } - } - } else { - /* - * The var name isn't simple: compile and push it. - */ - - envPtr->line = line; - envPtr->clNext = clNext; - CompileTokens(envPtr, varTokenPtr, interp); - } - - if (removedParen) { - varTokenPtr[removedParen].size++; - } - if (allocedTokens) { - TclStackFree(interp, elemTokenPtr); - } - *localIndexPtr = localIndex; - *simpleVarNamePtr = simpleVarName; - *isScalarPtr = (elName == NULL); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * * CompileUnaryOpCmd -- * * Utility routine to compile the unary operator commands. diff --git a/generic/tclCompile.h b/generic/tclCompile.h index bf00df9..1cc296e 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -998,6 +998,11 @@ MODULE_SCOPE void TclPrintObject(FILE *outFile, Tcl_Obj *objPtr, int maxChars); MODULE_SCOPE void TclPrintSource(FILE *outFile, const char *string, int maxChars); +MODULE_SCOPE int TclPushVarName(Tcl_Interp *interp, + Tcl_Token *varTokenPtr, CompileEnv *envPtr, + int flags, int *localIndexPtr, + int *simpleVarNamePtr, int *isScalarPtr, + int line, int *clNext); MODULE_SCOPE int TclRegisterLiteral(CompileEnv *envPtr, char *bytes, int length, int flags); MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -1428,6 +1433,66 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); Tcl_DStringLength(dsPtr), /*flags*/ 0) /* + * Macro that encapsulates an efficiency trick that avoids a function call for + * the simplest of compiles. The ANSI C "prototype" for this macro is: + * + * static void CompileWord(CompileEnv *envPtr, Tcl_Token *tokenPtr, + * Tcl_Interp *interp, int word); + */ + +#define CompileWord(envPtr, tokenPtr, interp, word) \ + if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \ + TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \ + (tokenPtr)[1].size), (envPtr)); \ + } else { \ + envPtr->line = mapPtr->loc[eclIndex].line[word]; \ + envPtr->clNext = mapPtr->loc[eclIndex].next[word]; \ + TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ + (envPtr)); \ + } + +/* + * TIP #280: Remember the per-word line information of the current command. An + * index is used instead of a pointer as recursive compilation may reallocate, + * i.e. move, the array. This is also the reason to save the nuloc now, it may + * change during the course of the function. + * + * Macro to encapsulate the variable definition and setup. + */ + +#define DefineLineInformation \ + ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ + int eclIndex = mapPtr->nuloc - 1 + +#define SetLineInformation(word) \ + envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ + envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] + +#define PushVarNameWord(i,v,e,f,l,s,sc,word) \ + TclPushVarName(i,v,e,f,l,s,sc, \ + mapPtr->loc[eclIndex].line[(word)], \ + mapPtr->loc[eclIndex].next[(word)]) + +/* + * Often want to issue one of two versions of an instruction based on whether + * the argument will fit in a single byte or not. This makes it much clearer. + */ + +#define Emit14Inst(nm,idx,envPtr) \ + if (idx <= 255) { \ + TclEmitInstInt1(nm##1,idx,envPtr); \ + } else { \ + TclEmitInstInt4(nm##4,idx,envPtr); \ + } + +/* + * Flags bits used by TclPushVarName. + */ + +#define TCL_NO_LARGE_INDEX 1 /* Do not return localIndex value > 255 */ +#define TCL_NO_ELEMENT 2 /* Do not push the array element. */ + +/* * DTrace probe macros (NOPs if DTrace support is not enabled). */ -- cgit v0.12 From 6075b0d3f07eeac6144d0a6f7af0803cf9705b96 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 23 May 2013 20:24:56 +0000 Subject: Spare developers the burden and error risk of counting bytes in string literals, or having to type them twice. --- generic/tclCompCmds.c | 72 +++++++++++++++++++++++-------------------------- generic/tclCompCmdsGR.c | 44 +++++++++++++++--------------- generic/tclCompCmdsSZ.c | 34 ++++++++++++----------- generic/tclCompile.h | 8 ++++-- 4 files changed, 81 insertions(+), 77 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index e4b1087..10faff7 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -295,7 +295,7 @@ TclCompileArraySetCmd( envPtr->currStackDepth = savedStackDepth; TclEmitOpcode( INST_POP, envPtr); } - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); goto done; } @@ -305,14 +305,12 @@ TclCompileArraySetCmd( if (isDataValid && !isDataEven) { savedStackDepth = envPtr->currStackDepth; - PushLiteral(envPtr, "list must have an even number of elements", - strlen("list must have an even number of elements")); - PushLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}", - strlen("-errorCode {TCL ARGUMENT FORMAT}")); + PushStringLiteral(envPtr, "list must have an even number of elements"); + PushStringLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}"); TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); TclEmitInt4( 0, envPtr); envPtr->currStackDepth = savedStackDepth; - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); goto done; } @@ -376,15 +374,13 @@ TclCompileArraySetCmd( TclEmitOpcode( INST_DUP, envPtr); TclEmitOpcode( INST_LIST_LENGTH, envPtr); - PushLiteral(envPtr, "1", 1); + PushStringLiteral(envPtr, "1"); TclEmitOpcode( INST_BITAND, envPtr); offsetFwd = CurrentOffset(envPtr); TclEmitInstInt1(INST_JUMP_FALSE1, 0, envPtr); savedStackDepth = envPtr->currStackDepth; - PushLiteral(envPtr, "list must have an even number of elements", - strlen("list must have an even number of elements")); - PushLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}", - strlen("-errorCode {TCL ARGUMENT FORMAT}")); + PushStringLiteral(envPtr, "list must have an even number of elements"); + PushStringLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}"); TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); TclEmitInt4( 0, envPtr); envPtr->currStackDepth = savedStackDepth; @@ -441,7 +437,7 @@ TclCompileArraySetCmd( TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( dataVar, envPtr); } - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); done: Tcl_DecrRefCount(literalObj); return TCL_OK; @@ -485,7 +481,7 @@ TclCompileArrayUnsetCmd( envPtr->currStackDepth = savedStackDepth; TclEmitOpcode( INST_POP, envPtr); } - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -525,7 +521,7 @@ TclCompileBreakCmd( */ TclEmitOpcode(INST_BREAK, envPtr); - PushLiteral(envPtr, "", 0); /* Evil hack! */ + PushStringLiteral(envPtr, ""); /* Evil hack! */ return TCL_OK; } @@ -674,7 +670,7 @@ TclCompileCatchCmd( */ TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "0", 1); + PushStringLiteral(envPtr, "0"); TclEmitInstInt1( INST_JUMP1, 3, envPtr); envPtr->currStackDepth = savedStackDepth; ExceptionRangeTarget(envPtr, range, catchOffset); @@ -696,7 +692,7 @@ TclCompileCatchCmd( * and jump around the "error case" code. */ - PushLiteral(envPtr, "0", 1); + PushStringLiteral(envPtr, "0"); TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpFixup); /* Stack at this point: ?script? result TCL_OK */ @@ -832,7 +828,7 @@ TclCompileContinueCmd( */ TclEmitOpcode(INST_CONTINUE, envPtr); - PushLiteral(envPtr, "", 0); /* Evil hack! */ + PushStringLiteral(envPtr, ""); /* Evil hack! */ return TCL_OK; } @@ -1208,7 +1204,7 @@ TclCompileDictCreateCmd( return TclCompileBasicMin0ArgCmd(interp, parsePtr, cmdPtr, envPtr); } - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); Emit14Inst( INST_STORE_SCALAR, worker, envPtr); TclEmitOpcode( INST_POP, envPtr); tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1247,7 +1243,7 @@ TclCompileDictMergeCmd( */ if (parsePtr->numWords < 2) { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } else if (parsePtr->numWords == 2) { tokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -1477,7 +1473,7 @@ CompileDictEachCmd( */ if (collect == TCL_EACH_COLLECT) { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); Emit14Inst( INST_STORE_SCALAR, collectVar, envPtr); TclEmitOpcode( INST_POP, envPtr); } @@ -1615,7 +1611,7 @@ CompileDictEachCmd( TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( collectVar, envPtr); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } return TCL_OK; } @@ -1991,18 +1987,18 @@ TclCompileDictWithCmd( TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitOpcode( INST_DICT_EXPAND, envPtr); TclEmitInstInt4(INST_DICT_RECOMBINE_IMM, dictVar, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } else { /* * Case: Direct dict in LVT with empty body. */ - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); Emit14Inst( INST_LOAD_SCALAR, dictVar, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); TclEmitOpcode( INST_DICT_EXPAND, envPtr); TclEmitInstInt4(INST_DICT_RECOMBINE_IMM, dictVar, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } } else { if (gotPath) { @@ -2021,7 +2017,7 @@ TclCompileDictWithCmd( TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitOpcode( INST_DICT_EXPAND, envPtr); TclEmitOpcode( INST_DICT_RECOMBINE_STK, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } else { /* * Case: Direct dict in non-simple var with empty body. @@ -2030,12 +2026,12 @@ TclCompileDictWithCmd( CompileWord(envPtr, varTokenPtr, interp, 0); TclEmitOpcode( INST_DUP, envPtr); TclEmitOpcode( INST_LOAD_STK, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); TclEmitOpcode( INST_DICT_EXPAND, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); TclEmitInstInt4(INST_REVERSE, 2, envPtr); TclEmitOpcode( INST_DICT_RECOMBINE_STK, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } } envPtr->currStackDepth = savedStackDepth + 1; @@ -2088,7 +2084,7 @@ TclCompileDictWithCmd( if (gotPath) { Emit14Inst( INST_LOAD_SCALAR, pathTmp, envPtr); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } TclEmitOpcode( INST_DICT_EXPAND, envPtr); Emit14Inst( INST_STORE_SCALAR, keysTmp, envPtr); @@ -2119,7 +2115,7 @@ TclCompileDictWithCmd( if (gotPath) { Emit14Inst( INST_LOAD_SCALAR, pathTmp, envPtr); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } Emit14Inst( INST_LOAD_SCALAR, keysTmp, envPtr); if (dictVar == -1) { @@ -2143,7 +2139,7 @@ TclCompileDictWithCmd( if (parsePtr->numWords > 3) { Emit14Inst( INST_LOAD_SCALAR, pathTmp, envPtr); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } Emit14Inst( INST_LOAD_SCALAR, keysTmp, envPtr); if (dictVar == -1) { @@ -2265,7 +2261,7 @@ TclCompileErrorCmd( } messageTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushLiteral(envPtr, "-code error -level 0", 20); + PushStringLiteral(envPtr, "-code error -level 0"); CompileWord(envPtr, messageTokenPtr, interp, 1); TclEmitOpcode(INST_RETURN_STK, envPtr); envPtr->currStackDepth = savedStackDepth + 1; @@ -2478,7 +2474,7 @@ TclCompileForCmd( */ envPtr->currStackDepth = savedStackDepth; - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -2788,7 +2784,7 @@ CompileEachloopCmd( */ if (collect == TCL_EACH_COLLECT) { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); Emit14Inst( INST_STORE_SCALAR, collectVar, envPtr); TclEmitOpcode( INST_POP, envPtr); } @@ -2881,7 +2877,7 @@ CompileEachloopCmd( TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( collectVar, envPtr); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } envPtr->currStackDepth = savedStackDepth + 1; @@ -3253,7 +3249,7 @@ TclCompileFormatCmd( */ TclEmitOpcode(INST_DUP, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); TclEmitOpcode(INST_STR_EQ, envPtr); TclEmitOpcode(INST_POP, envPtr); } @@ -3476,7 +3472,7 @@ TclPushVarName( TclCompileTokens(interp, elemTokenPtr, elemTokenCount, envPtr); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } } } else { diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 2bd43b6..13b874e 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -77,7 +77,7 @@ TclCompileGlobalCmd( * Push the namespace */ - PushLiteral(envPtr, "::", 2); + PushStringLiteral(envPtr, "::"); /* * Loop over the variables. @@ -100,7 +100,7 @@ TclCompileGlobalCmd( */ TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -376,7 +376,7 @@ TclCompileIfCmd( */ if (compileScripts) { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } } @@ -1203,7 +1203,7 @@ TclCompileListCmd( * [list] without arguments just pushes an empty object. */ - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -1545,7 +1545,7 @@ TclCompileLreplaceCmd( if (guaranteedDropAll) { TclEmitOpcode( INST_LIST_LENGTH, envPtr); TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } else { TclEmitInstInt4( INST_LIST_RANGE_IMM, idx1, envPtr); TclEmitInt4( idx2, envPtr); @@ -1811,8 +1811,8 @@ TclCompileNamespaceCodeCmd( * the value needs to be determined at runtime for safety. */ - PushLiteral(envPtr, "::namespace", 11); - PushLiteral(envPtr, "inscope", 7); + PushStringLiteral(envPtr, "::namespace"); + PushStringLiteral(envPtr, "inscope"); TclEmitOpcode( INST_NS_CURRENT, envPtr); CompileWord(envPtr, tokenPtr, interp, 1); TclEmitInstInt4( INST_LIST, 4, envPtr); @@ -1837,17 +1837,17 @@ TclCompileNamespaceQualifiersCmd( } CompileWord(envPtr, tokenPtr, interp, 1); - PushLiteral(envPtr, "0", 1); - PushLiteral(envPtr, "::", 2); + PushStringLiteral(envPtr, "0"); + PushStringLiteral(envPtr, "::"); TclEmitInstInt4( INST_OVER, 2, envPtr); TclEmitOpcode( INST_STR_FIND_LAST, envPtr); off = CurrentOffset(envPtr); - PushLiteral(envPtr, "1", 1); + PushStringLiteral(envPtr, "1"); TclEmitOpcode( INST_SUB, envPtr); TclEmitInstInt4( INST_OVER, 2, envPtr); TclEmitInstInt4( INST_OVER, 1, envPtr); TclEmitOpcode( INST_STR_INDEX, envPtr); - PushLiteral(envPtr, ":", 1); + PushStringLiteral(envPtr, ":"); TclEmitOpcode( INST_STR_EQ, envPtr); off = off - CurrentOffset(envPtr); TclEmitInstInt1( INST_JUMP_TRUE1, off, envPtr); @@ -1877,17 +1877,17 @@ TclCompileNamespaceTailCmd( */ CompileWord(envPtr, tokenPtr, interp, 1); - PushLiteral(envPtr, "::", 2); + PushStringLiteral(envPtr, "::"); TclEmitInstInt4( INST_OVER, 1, envPtr); TclEmitOpcode( INST_STR_FIND_LAST, envPtr); TclEmitOpcode( INST_DUP, envPtr); - PushLiteral(envPtr, "0", 1); + PushStringLiteral(envPtr, "0"); TclEmitOpcode( INST_GE, envPtr); TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpFixup); - PushLiteral(envPtr, "2", 1); + PushStringLiteral(envPtr, "2"); TclEmitOpcode( INST_ADD, envPtr); TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127); - PushLiteral(envPtr, "end", 3); + PushStringLiteral(envPtr, "end"); TclEmitOpcode( INST_STR_RANGE, envPtr); return TCL_OK; } @@ -1951,7 +1951,7 @@ TclCompileNamespaceUpvarCmd( */ TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -2117,7 +2117,7 @@ TclCompileRegexpCmd( * The semantics of regexp are always match on re == "". */ - PushLiteral(envPtr, "1", 1); + PushStringLiteral(envPtr, "1"); return TCL_OK; } @@ -2459,7 +2459,7 @@ TclCompileReturnCmd( * No explict result argument, so default result is empty string. */ - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } /* @@ -2534,7 +2534,7 @@ TclCompileReturnCmd( if (explicitResult) { CompileWord(envPtr, wordTokenPtr, interp, numWords-1); } else { - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); } /* @@ -2646,7 +2646,7 @@ TclCompileUpvarCmd( if (!(numWords%2)) { return TCL_ERROR; } - PushLiteral(envPtr, "1", 1); + PushStringLiteral(envPtr, "1"); otherTokenPtr = tokenPtr; i = 3; } @@ -2679,7 +2679,7 @@ TclCompileUpvarCmd( */ TclEmitOpcode( INST_POP, envPtr); - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -2760,7 +2760,7 @@ TclCompileVariableCmd( * Set the result to empty */ - PushLiteral(envPtr, "", 0); + PushStringLiteral(envPtr, ""); return TCL_OK; } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 4a7d45b..7ce51b6 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -88,7 +88,7 @@ const AuxDataType tclJumptableInfoType = { #define BODY(token,index) \ SetLineInformation((index));CompileBody(envPtr,(token),interp) #define PUSH(str) \ - PushLiteral(envPtr,(str),strlen(str)) + PushStringLiteral(envPtr, str) #define JUMP(var,name) \ (var) = CurrentOffset(envPtr);TclEmitInstInt4(INST_##name,0,envPtr) #define FIXJUMP(var) \ @@ -757,7 +757,7 @@ TclSubstCompile( tokenPtr = parse.tokenPtr; if (tokenPtr->type != TCL_TOKEN_TEXT && tokenPtr->type != TCL_TOKEN_BS) { - PushLiteral(envPtr, "", 0); + PUSH(""); count++; } @@ -1420,7 +1420,7 @@ IssueSwitchChainedTests( * when the RE == "". */ - PushLiteral(envPtr, "1", 1); + PUSH("1"); break; } @@ -1545,7 +1545,7 @@ IssueSwitchChainedTests( if (!foundDefault) { OP( POP); - PushLiteral(envPtr, "", 0); + PUSH(""); } /* @@ -1764,7 +1764,7 @@ IssueSwitchJumpTable( envPtr->currStackDepth = savedStackDepth; TclStoreInt4AtPtr(CurrentOffset(envPtr)-jumpToDefault, envPtr->codeStart+jumpToDefault+1); - PushLiteral(envPtr, "", 0); + PUSH(""); } /* @@ -2338,10 +2338,11 @@ IssueTryInstructions( for (i=0 ; icurrStackDepth = savedStackDepth; - PushLiteral(envPtr, "", 0); + PUSH(""); return TCL_OK; } @@ -2959,7 +2963,7 @@ TclCompileYieldCmd( } if (parsePtr->numWords == 1) { - PushLiteral(envPtr, "", 0); + PUSH(""); } else { DefineLineInformation; /* TIP #280 */ Tcl_Token *valueTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -3125,7 +3129,7 @@ CompileComparisonOpCmd( DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords < 3) { - PushLiteral(envPtr, "1", 1); + PUSH("1"); } else if (parsePtr->numWords == 3) { tokenPtr = TokenAfter(parsePtr->tokenPtr); CompileWord(envPtr, tokenPtr, interp, 1); @@ -3296,7 +3300,7 @@ TclCompilePowOpCmd( CompileWord(envPtr, tokenPtr, interp, words); } if (parsePtr->numWords <= 2) { - PushLiteral(envPtr, "1", 1); + PUSH("1"); words++; } while (--words > 1) { @@ -3514,7 +3518,7 @@ TclCompileDivOpCmd( return TCL_ERROR; } if (parsePtr->numWords == 2) { - PushLiteral(envPtr, "1.0", 3); + PUSH("1.0"); } for (words=1 ; wordsnumWords ; words++) { tokenPtr = TokenAfter(tokenPtr); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 1cc296e..3909fa9 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1358,15 +1358,19 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ (envPtr)); /* - * Convenience macro for use when pushing literals. The ANSI C "prototype" for - * this macro is: + * Convenience macros for use when pushing literals. The ANSI C "prototype" for + * these macros are: * * static void PushLiteral(CompileEnv *envPtr, * const char *string, int length); + * static void PushStringLiteral(CompileEnv *envPtr, + * const char *string); */ #define PushLiteral(envPtr, string, length) \ TclEmitPush(TclRegisterNewLiteral((envPtr), (string), (length)), (envPtr)) +#define PushStringLiteral(envPtr, string) \ + PushLiteral((envPtr), (string), (int) (sizeof(string "") - 1)) /* * Macro to advance to the next token; it is more mnemonic than the address -- cgit v0.12 From 44c1eaa96ca8158ccbb3acddb45eadfadfb9f07a Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 24 May 2013 18:37:19 +0000 Subject: 3613854 - Fixup stack maintenance /code generation for [array set x $oddList]. Postscript - I see that this commit created a memory leak. Will commit a fix within a few days. --- generic/tclCompCmds.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 10faff7..5a5cd88 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -263,11 +263,6 @@ TclCompileArraySetCmd( } varTokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); - if (!isScalar) { - return TCL_ERROR; - } dataTokenPtr = TokenAfter(varTokenPtr); literalObj = Tcl_NewObj(); isDataLiteral = TclWordKnownAtCompileTime(dataTokenPtr, literalObj); @@ -276,6 +271,23 @@ TclCompileArraySetCmd( isDataEven = (isDataValid && (len & 1) == 0); /* + * Special case: literal odd-length argument is always an error. + */ + + if (isDataValid && !isDataEven) { + PushStringLiteral(envPtr, "list must have an even number of elements"); + PushStringLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}"); + TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); + TclEmitInt4( 0, envPtr); + goto done; + } + + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, + &localIndex, &simpleVarName, &isScalar, 1); + if (!isScalar) { + return TCL_ERROR; + } + /* * Special case: literal empty value argument is just an "ensure array" * operation. */ @@ -300,21 +312,6 @@ TclCompileArraySetCmd( } /* - * Special case: literal odd-length argument is always an error. - */ - - if (isDataValid && !isDataEven) { - savedStackDepth = envPtr->currStackDepth; - PushStringLiteral(envPtr, "list must have an even number of elements"); - PushStringLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}"); - TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); - TclEmitInt4( 0, envPtr); - envPtr->currStackDepth = savedStackDepth; - PushStringLiteral(envPtr, ""); - goto done; - } - - /* * Prepare for the internal foreach. */ -- cgit v0.12 From 4a770ed0b5648f58f0ba0b07bb73cc904db339e0 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 25 May 2013 03:26:21 +0000 Subject: Repair some stack depth housekeeping. --- generic/tclCompCmds.c | 1 + generic/tclCompCmdsGR.c | 5 ----- generic/tclCompCmdsSZ.c | 2 +- generic/tclCompile.c | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 5a5cd88..8c88649 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1329,6 +1329,7 @@ TclCompileDictMergeCmd( TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( infoIndex, envPtr); TclEmitOpcode( INST_RETURN_STK, envPtr); + TclAdjustStackDepth(-1, envPtr); return TCL_OK; } diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 13b874e..c6a01e7 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2375,7 +2375,6 @@ TclCompileReturnCmd( int numWords = parsePtr->numWords; int explicitResult = (0 == (numWords % 2)); int numOptionWords = numWords - 1 - explicitResult; - int savedStackDepth = envPtr->currStackDepth; Tcl_Obj *returnOpts, **objv; Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr); DefineLineInformation; /* TIP #280 */ @@ -2398,7 +2397,6 @@ TclCompileReturnCmd( CompileWord(envPtr, optsTokenPtr, interp, 2); CompileWord(envPtr, msgTokenPtr, interp, 3); TclEmitOpcode(INST_RETURN_STK, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; } @@ -2494,7 +2492,6 @@ TclCompileReturnCmd( Tcl_DecrRefCount(returnOpts); TclEmitOpcode(INST_DONE, envPtr); - envPtr->currStackDepth = savedStackDepth; return TCL_OK; } } @@ -2512,7 +2509,6 @@ TclCompileReturnCmd( */ CompileReturnInternal(envPtr, INST_RETURN_IMM, code, level, returnOpts); - envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; issueRuntimeReturn: @@ -2542,7 +2538,6 @@ TclCompileReturnCmd( */ TclEmitOpcode(INST_RETURN_STK, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 7ce51b6..f2017f0 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -938,7 +938,7 @@ TclSubstCompile( * that is too low. Here we manually fix that up. */ - TclAdjustStackDepth(5, envPtr); + TclAdjustStackDepth(4, envPtr); /* OK destination */ if (TclFixupForwardJumpToHere(envPtr, &okFixup, 127)) { diff --git a/generic/tclCompile.c b/generic/tclCompile.c index cdaf985..87e620c 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -310,7 +310,7 @@ InstructionDesc const tclInstructionTable[] = { {"pushReturnOpts", 1, +1, 0, {OPERAND_NONE}}, /* Push the interpreter's return option dictionary as an object on the * stack. */ - {"returnStk", 1, -2, 0, {OPERAND_NONE}}, + {"returnStk", 1, -1, 0, {OPERAND_NONE}}, /* Compiled [return]; options and result are on the stack, code and * level are in the options. */ -- cgit v0.12 From 9eb03d3c23ab2d942ace763871d1674f3884ea9a Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 28 May 2013 14:04:02 +0000 Subject: Missed bits of dup code elimination. --- generic/tclAssembly.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index fff7b43..a84467f 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -324,29 +324,6 @@ static const Tcl_ObjType assembleCodeType = { }; /* - * TIP #280: Remember the per-word line information of the current command. An - * index is used instead of a pointer as recursive compilation may reallocate, - * i.e. move, the array. This is also the reason to save the nuloc now, it may - * change during the course of the function. - * - * Macro to encapsulate the variable definition and setup. - */ - -#define DefineLineInformation \ - ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ - int eclIndex = mapPtr->nuloc - 1 - -#define SetLineInformation(word) \ - envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] - -/* - * Flags bits used by PushVarName. - */ - -#define TCL_NO_LARGE_INDEX 1 /* Do not return localIndex value > 255 */ - -/* * Source instructions recognized in the Tcl Assembly Language (TAL) */ -- cgit v0.12 From 03f2ab38fee4863f2ea67292b07ca9cc56ddee48 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 28 May 2013 14:29:01 +0000 Subject: Plug the memory leak. Greater ambitions to improve this routine are proving more difficult than expected. --- generic/tclCompCmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 8c88649..a325954 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -285,6 +285,7 @@ TclCompileArraySetCmd( PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, &localIndex, &simpleVarName, &isScalar, 1); if (!isScalar) { + Tcl_DecrRefCount(literalObj); return TCL_ERROR; } /* -- cgit v0.12 From 8221c0695aa992657960abbd3d850a9503c633ca Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 28 May 2013 19:21:22 +0000 Subject: Use the routines that provide "basic compile" instead of reinventing them. --- generic/tclCompCmds.c | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index a325954..a966715 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -251,7 +251,7 @@ TclCompileArraySetCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *dataTokenPtr; - int simpleVarName, isScalar, localIndex; + int simpleVarName, isScalar, localIndex, code = TCL_OK; int isDataLiteral, isDataValid, isDataEven, len; int dataVar, iterVar, keyVar, valVar, infoIndex; int back, fwd, offsetBack, offsetFwd, savedStackDepth; @@ -282,11 +282,21 @@ TclCompileArraySetCmd( goto done; } + /* + * Except for the special "ensure array" case below, when we're not in + * a proc, we cannot do a better compile than generic. + */ + + if (envPtr->procPtr == NULL && !(isDataEven && len == 0)) { + code = TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr); + goto done; + } + PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, &localIndex, &simpleVarName, &isScalar, 1); if (!isScalar) { - Tcl_DecrRefCount(literalObj); - return TCL_ERROR; + code = TCL_ERROR; + goto done; } /* * Special case: literal empty value argument is just an "ensure array" @@ -302,10 +312,10 @@ TclCompileArraySetCmd( TclEmitOpcode( INST_DUP, envPtr); TclEmitOpcode( INST_ARRAY_EXISTS_STK, envPtr); TclEmitInstInt1(INST_JUMP_TRUE1, 5, envPtr); - savedStackDepth = envPtr->currStackDepth; TclEmitOpcode( INST_ARRAY_MAKE_STK, envPtr); TclEmitInstInt1(INST_JUMP1, 3, envPtr); - envPtr->currStackDepth = savedStackDepth; + /* Each branch decrements stack depth, but we only take one. */ + TclAdjustStackDepth(1, envPtr); TclEmitOpcode( INST_POP, envPtr); } PushStringLiteral(envPtr, ""); @@ -321,32 +331,6 @@ TclCompileArraySetCmd( keyVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); valVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); - if (dataVar < 0) { - /* - * Right number of arguments, but not compilable as we can't allocate - * (unnamed) local variables to manage the internal iteration. - */ - - Tcl_Obj *objPtr = Tcl_NewObj(); - char *bytes; - int length, cmdLit; - - Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); - bytes = Tcl_GetStringFromObj(objPtr, &length); - cmdLit = TclRegisterNewCmdLiteral(envPtr, bytes, length); - TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr); - TclEmitPush(cmdLit, envPtr); - TclDecrRefCount(objPtr); - if (localIndex >= 0) { - CompileWord(envPtr, varTokenPtr, interp, 1); - } else { - TclEmitInstInt4(INST_REVERSE, 2, envPtr); - } - CompileWord(envPtr, dataTokenPtr, interp, 2); - TclEmitInstInt1(INST_INVOKE_STK1, 3, envPtr); - goto done; - } - infoPtr = ckalloc(sizeof(ForeachInfo) + sizeof(ForeachVarList *)); infoPtr->numLists = 1; infoPtr->firstValueTemp = dataVar; @@ -418,7 +402,6 @@ TclCompileArraySetCmd( TclEmitInstInt4(INST_FOREACH_STEP4, infoIndex, envPtr); offsetFwd = CurrentOffset(envPtr); TclEmitInstInt1(INST_JUMP_FALSE1, 0, envPtr); - savedStackDepth = envPtr->currStackDepth; TclEmitOpcode( INST_DUP, envPtr); Emit14Inst( INST_LOAD_SCALAR, keyVar, envPtr); Emit14Inst( INST_LOAD_SCALAR, valVar, envPtr); @@ -428,7 +411,6 @@ TclCompileArraySetCmd( TclEmitInstInt1(INST_JUMP1, back, envPtr); fwd = CurrentOffset(envPtr) - offsetFwd; TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); - envPtr->currStackDepth = savedStackDepth; TclEmitOpcode( INST_POP, envPtr); } if (!isDataLiteral) { @@ -438,7 +420,7 @@ TclCompileArraySetCmd( PushStringLiteral(envPtr, ""); done: Tcl_DecrRefCount(literalObj); - return TCL_OK; + return code; } int -- cgit v0.12 From 38ae5eca7ffd791e3b3b092969700ef6ee56ba19 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 29 May 2013 14:37:58 +0000 Subject: Stop emitting the instructions INST_*_SCALAR_STK*. They are identical to their INST_*_STK* counterparts. Having done that, it is clear the "simpleVarName" return from TclPushVarName provides nothing of use to any of its callers. Eliminate that. Also make TPVN return void, instead of int. Bring the TPVN header comments up to date; they were quite rotten. --- generic/tclAssembly.c | 9 +++--- generic/tclCompCmds.c | 45 +++++++++++++++-------------- generic/tclCompCmdsGR.c | 77 ++++++++++++++++++------------------------------- generic/tclCompCmdsSZ.c | 19 ++++-------- generic/tclCompile.c | 2 +- generic/tclCompile.h | 9 +++--- 6 files changed, 67 insertions(+), 94 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index a84467f..0fe50b3a 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -387,9 +387,8 @@ static const TalInstDesc TalInstructionTable[] = { {"incrArrayStkImm", ASSEM_SINT1, INST_INCR_ARRAY_STK_IMM,2, 1}, {"incrImm", ASSEM_LVT1_SINT1, INST_INCR_SCALAR1_IMM, 0, 1}, - {"incrStk", ASSEM_1BYTE, INST_INCR_SCALAR_STK, 2, 1}, - {"incrStkImm", ASSEM_SINT1, INST_INCR_SCALAR_STK_IMM, - 1, 1}, + {"incrStk", ASSEM_1BYTE, INST_INCR_STK, 2, 1}, + {"incrStkImm", ASSEM_SINT1, INST_INCR_STK_IMM, 1, 1}, {"infoLevelArgs", ASSEM_1BYTE, INST_INFO_LEVEL_ARGS, 1, 1}, {"infoLevelNumber", ASSEM_1BYTE, INST_INFO_LEVEL_NUM, 0, 1}, {"invokeStk", ASSEM_INVOKE, (INST_INVOKE_STK1 << 8 @@ -425,7 +424,7 @@ static const TalInstDesc TalInstructionTable[] = { {"loadArray", ASSEM_LVT, (INST_LOAD_ARRAY1<<8 | INST_LOAD_ARRAY4), 1, 1}, {"loadArrayStk", ASSEM_1BYTE, INST_LOAD_ARRAY_STK, 2, 1}, - {"loadStk", ASSEM_1BYTE, INST_LOAD_SCALAR_STK, 1, 1}, + {"loadStk", ASSEM_1BYTE, INST_LOAD_STK, 1, 1}, {"lor", ASSEM_1BYTE, INST_LOR, 2, 1}, {"lsetFlat", ASSEM_LSET_FLAT,INST_LSET_FLAT, INT_MIN,1}, {"lsetList", ASSEM_1BYTE, INST_LSET_LIST, 3, 1}, @@ -452,7 +451,7 @@ static const TalInstDesc TalInstructionTable[] = { {"storeArray", ASSEM_LVT, (INST_STORE_ARRAY1<<8 | INST_STORE_ARRAY4), 2, 1}, {"storeArrayStk", ASSEM_1BYTE, INST_STORE_ARRAY_STK, 3, 1}, - {"storeStk", ASSEM_1BYTE, INST_STORE_SCALAR_STK, 2, 1}, + {"storeStk", ASSEM_1BYTE, INST_STORE_STK, 2, 1}, {"strcmp", ASSEM_1BYTE, INST_STR_CMP, 2, 1}, {"streq", ASSEM_1BYTE, INST_STR_EQ, 2, 1}, {"strfind", ASSEM_1BYTE, INST_STR_FIND, 2, 1}, diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index a966715..53b7b32 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -84,7 +84,7 @@ TclCompileAppendCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; + int isScalar, localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; @@ -116,7 +116,7 @@ TclCompileAppendCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); /* * We are doing an assignment, otherwise TclCompileSetCmd was called, so @@ -133,7 +133,6 @@ TclCompileAppendCmd( * Emit instructions to set/get the variable. */ - if (simpleVarName) { if (isScalar) { if (localIndex < 0) { TclEmitOpcode(INST_APPEND_STK, envPtr); @@ -147,9 +146,6 @@ TclCompileAppendCmd( Emit14Inst(INST_APPEND_ARRAY, localIndex, envPtr); } } - } else { - TclEmitOpcode(INST_APPEND_STK, envPtr); - } return TCL_OK; @@ -164,7 +160,7 @@ TclCompileAppendCmd( } varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if (!isScalar || localIndex < 0) { return TCL_ERROR; } @@ -219,7 +215,7 @@ TclCompileArrayExistsCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - int simpleVarName, isScalar, localIndex; + int isScalar, localIndex; if (parsePtr->numWords != 2) { return TCL_ERROR; @@ -227,7 +223,7 @@ TclCompileArrayExistsCmd( tokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, tokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if (!isScalar) { return TCL_ERROR; } @@ -251,7 +247,7 @@ TclCompileArraySetCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *dataTokenPtr; - int simpleVarName, isScalar, localIndex, code = TCL_OK; + int isScalar, localIndex, code = TCL_OK; int isDataLiteral, isDataValid, isDataEven, len; int dataVar, iterVar, keyVar, valVar, infoIndex; int back, fwd, offsetBack, offsetFwd, savedStackDepth; @@ -293,7 +289,7 @@ TclCompileArraySetCmd( } PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if (!isScalar) { code = TCL_ERROR; goto done; @@ -434,14 +430,14 @@ TclCompileArrayUnsetCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - int simpleVarName, isScalar, localIndex, savedStackDepth; + int isScalar, localIndex, savedStackDepth; if (parsePtr->numWords != 2) { return TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr); } PushVarNameWord(interp, tokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if (!isScalar) { return TCL_ERROR; } @@ -3246,24 +3242,33 @@ TclCompileFormatCmd( * necessary (append, lappend, set). * * Results: - * Returns TCL_OK for a successful compile. Returns TCL_ERROR to defer - * evaluation to runtime. + * The values written to *localIndexPtr and *isScalarPtr signal to + * the caller what the instructions emitted by this routine will do: + * + * *isScalarPtr (*localIndexPtr < 0) + * 1 1 Push the varname on the stack. (Stack +1) + * 1 0 *localIndexPtr is the index of the compiled + * local for this varname. No instructions + * emitted. (Stack +0) + * 0 1 Push part1 and part2 names of array element + * on the stack. (Stack +2) + * 0 0 *localIndexPtr is the index of the compiled + * local for this array. Element name is pushed + * on the stack. (Stack +1) * * Side effects: - * Instructions are added to envPtr to execute the "set" command at - * runtime. + * Instructions are added to envPtr. * *---------------------------------------------------------------------- */ -int +void TclPushVarName( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Token *varTokenPtr, /* Points to a variable token. */ CompileEnv *envPtr, /* Holds resulting instructions. */ int flags, /* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */ int *localIndexPtr, /* Must not be NULL. */ - int *simpleVarNamePtr, /* Must not be NULL. */ int *isScalarPtr, /* Must not be NULL. */ int line, /* Line the token starts on. */ int *clNext) /* Reference to offset of next hidden cont. @@ -3473,9 +3478,7 @@ TclPushVarName( TclStackFree(interp, elemTokenPtr); } *localIndexPtr = localIndex; - *simpleVarNamePtr = simpleVarName; *isScalarPtr = (elName == NULL); - return TCL_OK; } /* diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index c6a01e7..d101d82 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -450,7 +450,7 @@ TclCompileIncrCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *incrTokenPtr; - int simpleVarName, isScalar, localIndex, haveImmValue, immValue; + int isScalar, localIndex, haveImmValue, immValue; DefineLineInformation; /* TIP #280 */ if ((parsePtr->numWords != 2) && (parsePtr->numWords != 3)) { @@ -460,7 +460,7 @@ TclCompileIncrCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_LARGE_INDEX, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); /* * If an increment is given, push it, but see first if it's a small @@ -498,13 +498,7 @@ TclCompileIncrCmd( * Emit the instruction to increment the variable. */ - if (!simpleVarName) { - if (haveImmValue) { - TclEmitInstInt1( INST_INCR_STK_IMM, immValue, envPtr); - } else { - TclEmitOpcode( INST_INCR_STK, envPtr); - } - } else if (isScalar) { /* Simple scalar variable. */ + if (isScalar) { /* Simple scalar variable. */ if (localIndex >= 0) { if (haveImmValue) { TclEmitInstInt1(INST_INCR_SCALAR1_IMM, localIndex, envPtr); @@ -514,9 +508,9 @@ TclCompileIncrCmd( } } else { if (haveImmValue) { - TclEmitInstInt1(INST_INCR_SCALAR_STK_IMM, immValue, envPtr); + TclEmitInstInt1(INST_INCR_STK_IMM, immValue, envPtr); } else { - TclEmitOpcode( INST_INCR_SCALAR_STK, envPtr); + TclEmitOpcode( INST_INCR_STK, envPtr); } } } else { /* Simple array variable. */ @@ -652,7 +646,7 @@ TclCompileInfoExistsCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; - int isScalar, simpleVarName, localIndex; + int isScalar, localIndex; DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 2) { @@ -668,16 +662,13 @@ TclCompileInfoExistsCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex, - &simpleVarName, &isScalar, 1); + PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex, &isScalar, 1); /* * Emit instruction to check the variable for existence. */ - if (!simpleVarName) { - TclEmitOpcode( INST_EXIST_STK, envPtr); - } else if (isScalar) { + if (isScalar) { if (localIndex < 0) { TclEmitOpcode( INST_EXIST_STK, envPtr); } else { @@ -834,7 +825,7 @@ TclCompileLappendCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i, fwd, offsetFwd; + int isScalar, localIndex, numWords, i, fwd, offsetFwd; DefineLineInformation; /* TIP #280 */ /* @@ -869,7 +860,7 @@ TclCompileLappendCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); /* * If we are doing an assignment, push the new value. In the no values @@ -891,9 +882,7 @@ TclCompileLappendCmd( * LOAD/STORE instructions. */ - if (!simpleVarName) { - TclEmitOpcode( INST_LAPPEND_STK, envPtr); - } else if (isScalar) { + if (isScalar) { if (localIndex < 0) { TclEmitOpcode( INST_LAPPEND_STK, envPtr); } else { @@ -920,7 +909,7 @@ TclCompileLappendCmd( } varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if (!isScalar || localIndex < 0) { return TCL_ERROR; } @@ -977,7 +966,7 @@ TclCompileLassignCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; - int simpleVarName, isScalar, localIndex, numWords, idx; + int isScalar, localIndex, numWords, idx; DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; @@ -1009,19 +998,14 @@ TclCompileLassignCmd( */ PushVarNameWord(interp, tokenPtr, envPtr, 0, &localIndex, - &simpleVarName, &isScalar, idx+2); + &isScalar, idx+2); /* * Emit instructions to get the idx'th item out of the list value on * the stack and assign it to the variable. */ - if (!simpleVarName) { - TclEmitInstInt4( INST_OVER, 1, envPtr); - TclEmitInstInt4( INST_LIST_INDEX_IMM, idx, envPtr); - TclEmitOpcode( INST_STORE_STK, envPtr); - TclEmitOpcode( INST_POP, envPtr); - } else if (isScalar) { + if (isScalar) { if (localIndex >= 0) { TclEmitOpcode( INST_DUP, envPtr); TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); @@ -1030,7 +1014,7 @@ TclCompileLassignCmd( } else { TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitInstInt4(INST_LIST_INDEX_IMM, idx, envPtr); - TclEmitOpcode( INST_STORE_SCALAR_STK, envPtr); + TclEmitOpcode( INST_STORE_STK, envPtr); TclEmitOpcode( INST_POP, envPtr); } } else { @@ -1607,7 +1591,6 @@ TclCompileLsetCmd( Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the * parse of the variable name. */ int localIndex; /* Index of var in local var table. */ - int simpleVarName; /* Flag == 1 if var name is simple. */ int isScalar; /* Flag == 1 if scalar, 0 if array. */ int i; DefineLineInformation; /* TIP #280 */ @@ -1634,7 +1617,7 @@ TclCompileLsetCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); /* * Push the "index" args and the new element value. @@ -1649,8 +1632,8 @@ TclCompileLsetCmd( * Duplicate the variable name if it's been pushed. */ - if (!simpleVarName || localIndex < 0) { - if (!simpleVarName || isScalar) { + if (localIndex < 0) { + if (isScalar) { tempDepth = parsePtr->numWords - 2; } else { tempDepth = parsePtr->numWords - 1; @@ -1662,7 +1645,7 @@ TclCompileLsetCmd( * Duplicate an array index if one's been pushed. */ - if (simpleVarName && !isScalar) { + if (!isScalar) { if (localIndex < 0) { tempDepth = parsePtr->numWords - 1; } else { @@ -1675,11 +1658,9 @@ TclCompileLsetCmd( * Emit code to load the variable's value. */ - if (!simpleVarName) { - TclEmitOpcode( INST_LOAD_STK, envPtr); - } else if (isScalar) { + if (isScalar) { if (localIndex < 0) { - TclEmitOpcode( INST_LOAD_SCALAR_STK, envPtr); + TclEmitOpcode( INST_LOAD_STK, envPtr); } else { Emit14Inst( INST_LOAD_SCALAR, localIndex, envPtr); } @@ -1705,11 +1686,9 @@ TclCompileLsetCmd( * Emit code to put the value back in the variable. */ - if (!simpleVarName) { - TclEmitOpcode( INST_STORE_STK, envPtr); - } else if (isScalar) { + if (isScalar) { if (localIndex < 0) { - TclEmitOpcode( INST_STORE_SCALAR_STK, envPtr); + TclEmitOpcode( INST_STORE_STK, envPtr); } else { Emit14Inst( INST_STORE_SCALAR, localIndex, envPtr); } @@ -1902,7 +1881,7 @@ TclCompileNamespaceUpvarCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; + int isScalar, localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ if (envPtr->procPtr == NULL) { @@ -1938,7 +1917,7 @@ TclCompileNamespaceUpvarCmd( CompileWord(envPtr, otherTokenPtr, interp, 1); PushVarNameWord(interp, localTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if ((localIndex < 0) || !isScalar) { return TCL_ERROR; @@ -2597,7 +2576,7 @@ TclCompileUpvarCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr; - int simpleVarName, isScalar, localIndex, numWords, i; + int isScalar, localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ Tcl_Obj *objPtr = Tcl_NewObj(); @@ -2661,7 +2640,7 @@ TclCompileUpvarCmd( CompileWord(envPtr, otherTokenPtr, interp, 1); PushVarNameWord(interp, localTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); if ((localIndex < 0) || !isScalar) { return TCL_ERROR; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index f2017f0..3fb8712 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -126,7 +126,7 @@ TclCompileSetCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr, *valueTokenPtr; - int isAssignment, isScalar, simpleVarName, localIndex, numWords; + int isAssignment, isScalar, localIndex, numWords; DefineLineInformation; /* TIP #280 */ numWords = parsePtr->numWords; @@ -145,7 +145,7 @@ TclCompileSetCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); /* * If we are doing an assignment, push the new value. @@ -160,12 +160,10 @@ TclCompileSetCmd( * Emit instructions to set/get the variable. */ - if (simpleVarName) { if (isScalar) { if (localIndex < 0) { TclEmitOpcode((isAssignment? - INST_STORE_SCALAR_STK : INST_LOAD_SCALAR_STK), - envPtr); + INST_STORE_STK : INST_LOAD_STK), envPtr); } else if (localIndex <= 255) { TclEmitInstInt1((isAssignment? INST_STORE_SCALAR1 : INST_LOAD_SCALAR1), @@ -189,9 +187,6 @@ TclCompileSetCmd( localIndex, envPtr); } } - } else { - TclEmitOpcode((isAssignment? INST_STORE_STK : INST_LOAD_STK), envPtr); - } return TCL_OK; } @@ -2683,7 +2678,7 @@ TclCompileUnsetCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *varTokenPtr; - int isScalar, simpleVarName, localIndex, numWords, flags, i; + int isScalar, localIndex, numWords, flags, i; Tcl_Obj *leadingWord; DefineLineInformation; /* TIP #280 */ @@ -2724,15 +2719,13 @@ TclCompileUnsetCmd( */ PushVarNameWord(interp, varTokenPtr, envPtr, 0, - &localIndex, &simpleVarName, &isScalar, 1); + &localIndex, &isScalar, 1); /* * Emit instructions to unset the variable. */ - if (!simpleVarName) { - OP1( UNSET_STK, flags); - } else if (isScalar) { + if (isScalar) { if (localIndex < 0) { OP1( UNSET_STK, flags); } else { diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 87e620c..dd179ea 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2376,7 +2376,7 @@ TclCompileVarSubst( if (tokenPtr->numComponents == 1) { if (localVar < 0) { - TclEmitOpcode(INST_LOAD_SCALAR_STK, envPtr); + TclEmitOpcode(INST_LOAD_STK, envPtr); } else if (localVar <= 255) { TclEmitInstInt1(INST_LOAD_SCALAR1, localVar, envPtr); } else { diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 3909fa9..0be5d1d 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -998,11 +998,10 @@ MODULE_SCOPE void TclPrintObject(FILE *outFile, Tcl_Obj *objPtr, int maxChars); MODULE_SCOPE void TclPrintSource(FILE *outFile, const char *string, int maxChars); -MODULE_SCOPE int TclPushVarName(Tcl_Interp *interp, +MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, - int *simpleVarNamePtr, int *isScalarPtr, - int line, int *clNext); + int *isScalarPtr, int line, int *clNext); MODULE_SCOPE int TclRegisterLiteral(CompileEnv *envPtr, char *bytes, int length, int flags); MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -1472,8 +1471,8 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] -#define PushVarNameWord(i,v,e,f,l,s,sc,word) \ - TclPushVarName(i,v,e,f,l,s,sc, \ +#define PushVarNameWord(i,v,e,f,l,sc,word) \ + TclPushVarName(i,v,e,f,l,sc, \ mapPtr->loc[eclIndex].line[(word)], \ mapPtr->loc[eclIndex].next[(word)]) -- cgit v0.12 From cd0b45e3e49b8571a05590350a80980f3cc2e1b3 Mon Sep 17 00:00:00 2001 From: andreask Date: Wed, 29 May 2013 16:24:34 +0000 Subject: Fix C99 comment-ism breaking the native AIX compiler. HPUX likely as well. --- generic/tclIO.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 1b301e2..f1d8909 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -6738,8 +6738,8 @@ Tcl_Tell( outputBuffered = Tcl_OutputBuffered(chan); if ((inputBuffered != 0) && (outputBuffered != 0)) { - //Tcl_SetErrno(EFAULT); - //return Tcl_LongAsWide(-1); + /*Tcl_SetErrno(EFAULT);*/ + /*return Tcl_LongAsWide(-1);*/ } /* -- cgit v0.12 From 4489ec6866f73246dd1654e0e98fc5fb431a170d Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 29 May 2013 17:20:29 +0000 Subject: 3614102 - Reset stack housekeeping when compileProc fails. --- generic/tclCompile.c | 8 ++++++-- tests/compile.test | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index dd179ea..039a694 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2069,9 +2069,7 @@ TclCompileScript( unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart; int update = 0; -#ifdef TCL_COMPILE_DEBUG int startStackDepth = envPtr->currStackDepth; -#endif /* * Mark the start of the command; the proper bytecode @@ -2164,6 +2162,12 @@ TclCompileScript( envPtr->numCommands = savedNumCmds; envPtr->codeNext = envPtr->codeStart + savedCodeNext; + + /* + * And the stack depth too!! [Bug 3614102]. + */ + + envPtr->currStackDepth = startStackDepth; } /* diff --git a/tests/compile.test b/tests/compile.test index 4d91940..51db0a2 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -707,6 +707,12 @@ test compile-18.19 {disassembler - basics} -setup { } -cleanup { foo destroy } -match glob -result * + +test compile-19.0 {Bug 3614102: reset stack housekeeping} -body { + # This will panic in a --enable-symbols=compile build, unless bug is fixed. + apply {{} {list [if 1]}} +} -returnCodes error -match glob -result * + # TODO sometime - check that bytecode from tbcload is *not* disassembled. # cleanup -- cgit v0.12 From 5ec1884853d19825ef0f6f5d7f85e5daec1d8e6e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 29 May 2013 20:36:05 +0000 Subject: Simplifications and tidying up of stack management issues. Work in progress. --- generic/tclCompCmds.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 53b7b32..7046e54 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -124,10 +124,8 @@ TclCompileAppendCmd( * each argument. */ - if (numWords > 2) { valueTokenPtr = TokenAfter(varTokenPtr); CompileWord(envPtr, valueTokenPtr, interp, 2); - } /* * Emit instructions to set/get the variable. @@ -155,9 +153,6 @@ TclCompileAppendCmd( * there are multiple values to append. Fortunately, this is common. */ - if (envPtr->procPtr == NULL) { - return TCL_ERROR; - } varTokenPtr = TokenAfter(parsePtr->tokenPtr); PushVarNameWord(interp, varTokenPtr, envPtr, TCL_NO_ELEMENT, &localIndex, &isScalar, 1); @@ -250,7 +245,7 @@ TclCompileArraySetCmd( int isScalar, localIndex, code = TCL_OK; int isDataLiteral, isDataValid, isDataEven, len; int dataVar, iterVar, keyVar, valVar, infoIndex; - int back, fwd, offsetBack, offsetFwd, savedStackDepth; + int back, fwd, offsetBack, offsetFwd; Tcl_Obj *literalObj; ForeachInfo *infoPtr; @@ -356,12 +351,11 @@ TclCompileArraySetCmd( TclEmitOpcode( INST_BITAND, envPtr); offsetFwd = CurrentOffset(envPtr); TclEmitInstInt1(INST_JUMP_FALSE1, 0, envPtr); - savedStackDepth = envPtr->currStackDepth; PushStringLiteral(envPtr, "list must have an even number of elements"); PushStringLiteral(envPtr, "-errorCode {TCL ARGUMENT FORMAT}"); TclEmitInstInt4(INST_RETURN_IMM, 1, envPtr); TclEmitInt4( 0, envPtr); - envPtr->currStackDepth = savedStackDepth; + TclAdjustStackDepth(-1, envPtr); fwd = CurrentOffset(envPtr) - offsetFwd; TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); } @@ -377,7 +371,6 @@ TclCompileArraySetCmd( TclEmitInstInt4(INST_FOREACH_STEP4, infoIndex, envPtr); offsetFwd = CurrentOffset(envPtr); TclEmitInstInt1(INST_JUMP_FALSE1, 0, envPtr); - savedStackDepth = envPtr->currStackDepth; Emit14Inst( INST_LOAD_SCALAR, keyVar, envPtr); Emit14Inst( INST_LOAD_SCALAR, valVar, envPtr); Emit14Inst( INST_STORE_ARRAY, localIndex, envPtr); @@ -386,7 +379,6 @@ TclCompileArraySetCmd( TclEmitInstInt1(INST_JUMP1, back, envPtr); fwd = CurrentOffset(envPtr) - offsetFwd; TclStoreInt1AtPtr(fwd, envPtr->codeStart+offsetFwd+1); - envPtr->currStackDepth = savedStackDepth; } else { TclEmitOpcode( INST_DUP, envPtr); TclEmitOpcode( INST_ARRAY_EXISTS_STK, envPtr); @@ -430,7 +422,7 @@ TclCompileArrayUnsetCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); - int isScalar, localIndex, savedStackDepth; + int isScalar, localIndex; if (parsePtr->numWords != 2) { return TclCompileBasic2ArgCmd(interp, parsePtr, cmdPtr, envPtr); @@ -451,10 +443,10 @@ TclCompileArrayUnsetCmd( TclEmitOpcode( INST_DUP, envPtr); TclEmitOpcode( INST_ARRAY_EXISTS_STK, envPtr); TclEmitInstInt1(INST_JUMP_FALSE1, 6, envPtr); - savedStackDepth = envPtr->currStackDepth; TclEmitInstInt1(INST_UNSET_STK, 1, envPtr); TclEmitInstInt1(INST_JUMP1, 3, envPtr); - envPtr->currStackDepth = savedStackDepth; + /* Each branch decrements stack depth, but we only take one. */ + TclAdjustStackDepth(1, envPtr); TclEmitOpcode( INST_POP, envPtr); } PushStringLiteral(envPtr, ""); @@ -497,7 +489,14 @@ TclCompileBreakCmd( */ TclEmitOpcode(INST_BREAK, envPtr); - PushStringLiteral(envPtr, ""); /* Evil hack! */ +#ifdef TCL_COMPILE_DEBUG + /* + * Instructions that raise exceptions don't really have to follow + * the usual stack management rules. But the checker wants them + * followed, so lie about stack usage to make it happy. + */ + TclAdjustStackDepth(1, envPtr); +#endif return TCL_OK; } -- cgit v0.12 From f85fd4d0e85bc96fdb38e4d2ea70ea05da1c0530 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 30 May 2013 10:29:41 +0000 Subject: Corrected code generation when doing the second run with an 'infinite' loop. --- generic/tclCompCmdsSZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 3fb8712..ed4d962 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2859,7 +2859,7 @@ TclCompileWhileCmd( * INST_START_CMD, and hence counted properly. [Bug 1752146] */ - envPtr->atCmdStart = 0; + envPtr->atCmdStart &= ~1; testCodeOffset = CurrentOffset(envPtr); } -- cgit v0.12 From 8430c2dada2e781cff07e2534fb7fbd11dcf1958 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 30 May 2013 10:55:39 +0000 Subject: Working towards the next batch of optimizations. --- generic/tclCompCmds.c | 81 +++++++++++++++++++++++++++++++++++++++++ generic/tclCompCmdsSZ.c | 4 +++ generic/tclCompile.c | 96 +++++++++++++++++++++++++++++++++++++++---------- generic/tclCompile.h | 6 ++++ 4 files changed, 168 insertions(+), 19 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7046e54..1f99a22 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -480,11 +480,45 @@ TclCompileBreakCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + int i, exnIdx; + ExceptionRange *rangePtr; + if (parsePtr->numWords != 1) { return TCL_ERROR; } /* + * Find the innermost exception range that contains this command. Relies + * on the fact that the range has a numCodeBytes = -1 when it is being + * populated and that inner ranges come after outer ranges. + */ + + exnIdx = -1; + for (i=0 ; iexceptArrayNext ; i++) { + rangePtr = &envPtr->exceptArrayPtr[i]; + if (envPtr->codeStart+rangePtr->codeOffset <= envPtr->codeNext + && rangePtr->numCodeBytes == -1) { + exnIdx = i; + } + } + if (exnIdx != -1) { + rangePtr = &envPtr->exceptArrayPtr[exnIdx]; + if (rangePtr->type == LOOP_EXCEPTION_RANGE) { + int toPop = envPtr->currStackDepth - + envPtr->exnStackDepthArrayPtr[exnIdx]; + + /* + * Pop off the extra stack frames. + */ + + while (toPop > 0) { + TclEmitOpcode(INST_POP, envPtr); + toPop--; + } + } + } + + /* * Emit a break instruction. */ @@ -790,6 +824,9 @@ TclCompileContinueCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { + int i, exnIdx; + ExceptionRange *rangePtr; + /* * There should be no argument after the "continue". */ @@ -799,6 +836,50 @@ TclCompileContinueCmd( } /* + * See if we can find a valid continueOffset (i.e., not -1) in the + * innermost containing exception range. Relies on the fact that the range + * has a numCodeBytes = -1 when it is being populated and that inner + * ranges come after outer ranges. + */ + + exnIdx = -1; + for (i=0 ; iexceptArrayNext ; i++) { + rangePtr = &envPtr->exceptArrayPtr[i]; + if (envPtr->codeStart+rangePtr->codeOffset <= envPtr->codeNext + && rangePtr->numCodeBytes == -1) { + exnIdx = i; + } + } + if (exnIdx >= 0) { + rangePtr = &envPtr->exceptArrayPtr[exnIdx]; + if (rangePtr->type == LOOP_EXCEPTION_RANGE) { + int toPop = envPtr->currStackDepth - + envPtr->exnStackDepthArrayPtr[exnIdx]; + + /* + * Pop off the extra stack frames. + */ + + while (toPop > 0) { + TclEmitOpcode(INST_POP, envPtr); + toPop--; + } + } + if (rangePtr->type == LOOP_EXCEPTION_RANGE + && rangePtr->continueOffset != -1) { + int offset = (rangePtr->continueOffset - CurrentOffset(envPtr)); + + /* + * Found the target! No need for a nasty INST_CONTINUE here. + */ + + TclEmitInstInt4(INST_JUMP4, offset, envPtr); + PushStringLiteral(envPtr, ""); /* Evil hack! */ + return TCL_OK; + } + } + + /* * Emit a continue instruction. */ diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index ed4d962..4f4286e 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2869,6 +2869,10 @@ TclCompileWhileCmd( SetLineInformation(2); bodyCodeOffset = ExceptionRangeStarts(envPtr, range); + if (!loopMayEnd) { + envPtr->exceptArrayPtr[range].continueOffset = testCodeOffset; + envPtr->exceptArrayPtr[range].codeOffset = bodyCodeOffset; + } CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); envPtr->currStackDepth = savedStackDepth + 1; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 039a694..631ff58 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -562,7 +562,7 @@ static Command * FindCompiledCommandFromToken(Tcl_Interp *interp, static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); -static int IsCompactibleCompileEnv(Tcl_Interp *interp, +/* static */ int IsCompactibleCompileEnv(Tcl_Interp *interp, CompileEnv *envPtr); static void PeepholeOptimize(CompileEnv *envPtr); #ifdef TCL_COMPILE_STATS @@ -745,7 +745,9 @@ TclSetByteCodeFromAny( } compEnv.atCmdStart = 2; /* The disabling magic. */ TclCompileScript(interp, stringPtr, length, &compEnv); + assert (compEnv.atCmdStart > 1); TclEmitOpcode(INST_DONE, &compEnv); + assert (compEnv.atCmdStart > 1); } /* @@ -1034,7 +1036,7 @@ TclCleanupByteCode( * --------------------------------------------------------------------- */ -static int +/* static */ int IsCompactibleCompileEnv( Tcl_Interp *interp, CompileEnv *envPtr) @@ -1084,9 +1086,11 @@ IsCompactibleCompileEnv( case INST_NSUPVAR: case INST_VARIABLE: return 0; + default: + size = tclInstructionTable[*pc].numBytes; + assert (size > 0); + break; } - size = tclInstructionTable[*pc].numBytes; - assert (size > 0); } return 1; @@ -1145,31 +1149,39 @@ PeepholeOptimize( (void) Tcl_CreateHashEntry(&targets, (void *) target, &isNew); } break; + case INST_START_CMD: + assert (envPtr->atCmdStart < 2); } } /* - * Replace PUSH/POP sequences (when non-hazardous) with NOPs. + * Replace PUSH/POP sequences (when non-hazardous) with NOPs. Also replace + * PUSH empty/CONCAT and TRY_CVT_NUMERIC (when followed by an operation + * that guarantees the check for arithmeticity). */ (void) Tcl_CreateHashEntry(&targets, (void *) pc, &isNew); for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { - int blank = 0, i; + int blank = 0, i, inst; size = tclInstructionTable[*pc].numBytes; prev2 = prev1; prev1 = pc; + while (*(pc+size) == INST_NOP) { + if (Tcl_FindHashEntry(&targets, (void *) (pc + size))) { + break; + } + size += tclInstructionTable[INST_NOP].numBytes; + } if (Tcl_FindHashEntry(&targets, (void *) (pc + size))) { continue; } + inst = *(pc + size); switch (*pc) { case INST_PUSH1: - while (*(pc+size) == INST_NOP) { - size++; - } - if (*(pc+size) == INST_POP) { - blank = size + 1; - } else if (*(pc+size) == INST_CONCAT1 + if (inst == INST_POP) { + blank = size + tclInstructionTable[inst].numBytes; + } else if (inst == INST_CONCAT1 && TclGetUInt1AtPtr(pc + size + 1) == 2) { Tcl_Obj *litPtr = TclFetchLiteral(envPtr, TclGetUInt1AtPtr(pc + 1)); @@ -1177,17 +1189,14 @@ PeepholeOptimize( (void) Tcl_GetStringFromObj(litPtr, &numBytes); if (numBytes == 0) { - blank = size + 2; + blank = size + tclInstructionTable[inst].numBytes; } } break; case INST_PUSH4: - while (*(pc+size) == INST_NOP) { - size++; - } - if (*(pc+size) == INST_POP) { + if (inst == INST_POP) { blank = size + 1; - } else if (*(pc+size) == INST_CONCAT1 + } else if (inst == INST_CONCAT1 && TclGetUInt1AtPtr(pc + size + 1) == 2) { Tcl_Obj *litPtr = TclFetchLiteral(envPtr, TclGetUInt4AtPtr(pc + 1)); @@ -1195,10 +1204,49 @@ PeepholeOptimize( (void) Tcl_GetStringFromObj(litPtr, &numBytes); if (numBytes == 0) { - blank = size + 2; + blank = size + tclInstructionTable[inst].numBytes; } } break; + case INST_TRY_CVT_TO_NUMERIC: + switch (inst) { + case INST_JUMP_TRUE1: + case INST_JUMP_TRUE4: + case INST_JUMP_FALSE1: + case INST_JUMP_FALSE4: + case INST_INCR_SCALAR1: + case INST_INCR_ARRAY1: + case INST_INCR_ARRAY_STK: + case INST_INCR_SCALAR_STK: + case INST_INCR_STK: + case INST_LOR: + case INST_LAND: + case INST_EQ: + case INST_NEQ: + case INST_LT: + case INST_LE: + case INST_GT: + case INST_GE: + case INST_MOD: + case INST_LSHIFT: + case INST_RSHIFT: + case INST_BITOR: + case INST_BITXOR: + case INST_BITAND: + case INST_EXPON: + case INST_ADD: + case INST_SUB: + case INST_DIV: + case INST_MULT: + case INST_LNOT: + case INST_BITNOT: + case INST_UMINUS: + case INST_UPLUS: + case INST_TRY_CVT_TO_NUMERIC: + blank = size; + break; + } + break; } if (blank > 0) { for (i=0 ; imallocedLiteralArray = 0; envPtr->exceptArrayPtr = envPtr->staticExceptArraySpace; + envPtr->exnStackDepthArrayPtr = envPtr->staticExnStackDepthArraySpace; envPtr->exceptArrayNext = 0; envPtr->exceptArrayEnd = COMPILEENV_INIT_EXCEPT_RANGES; envPtr->mallocedExceptArray = 0; @@ -1678,6 +1727,7 @@ TclFreeCompileEnv( } if (envPtr->mallocedExceptArray) { ckfree(envPtr->exceptArrayPtr); + ckfree(envPtr->exnStackDepthArrayPtr); } if (envPtr->mallocedCmdMap) { ckfree(envPtr->cmdMapPtr); @@ -3371,12 +3421,16 @@ TclCreateExceptRange( size_t currBytes = envPtr->exceptArrayNext * sizeof(ExceptionRange); + size_t currBytes2 = envPtr->exceptArrayNext * sizeof(int); int newElems = 2*envPtr->exceptArrayEnd; size_t newBytes = newElems * sizeof(ExceptionRange); + size_t newBytes2 = newElems * sizeof(int); if (envPtr->mallocedExceptArray) { envPtr->exceptArrayPtr = ckrealloc(envPtr->exceptArrayPtr, newBytes); + envPtr->exnStackDepthArrayPtr = + ckrealloc(envPtr->exnStackDepthArrayPtr, newBytes2); } else { /* * envPtr->exceptArrayPtr isn't a ckalloc'd pointer, so we must @@ -3384,9 +3438,12 @@ TclCreateExceptRange( */ ExceptionRange *newPtr = ckalloc(newBytes); + int *newPtr2 = ckalloc(newBytes2); memcpy(newPtr, envPtr->exceptArrayPtr, currBytes); + memcpy(newPtr2, envPtr->exnStackDepthArrayPtr, currBytes2); envPtr->exceptArrayPtr = newPtr; + envPtr->exnStackDepthArrayPtr = newPtr2; envPtr->mallocedExceptArray = 1; } envPtr->exceptArrayEnd = newElems; @@ -3401,6 +3458,7 @@ TclCreateExceptRange( rangePtr->breakOffset = -1; rangePtr->continueOffset = -1; rangePtr->catchOffset = -1; + envPtr->exnStackDepthArrayPtr[index] = envPtr->currStackDepth; return index; } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 0be5d1d..c380823 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -275,6 +275,9 @@ typedef struct CompileEnv { * entry. */ int mallocedExceptArray; /* 1 if ExceptionRange array was expanded and * exceptArrayPtr points in heap, else 0. */ + int *exnStackDepthArrayPtr; /* Array of stack depths to restore to when + * processing BREAK/CONTINUE exceptions. Must + * be the same size as the exceptArrayPtr. */ CmdLocation *cmdMapPtr; /* Points to start of CmdLocation array. * numCommands is the index of the next entry * to use; (numCommands-1) is the entry index @@ -296,6 +299,9 @@ typedef struct CompileEnv { /* Initial storage of LiteralEntry array. */ ExceptionRange staticExceptArraySpace[COMPILEENV_INIT_EXCEPT_RANGES]; /* Initial ExceptionRange array storage. */ + int staticExnStackDepthArraySpace[COMPILEENV_INIT_EXCEPT_RANGES]; + /* Initial static except stack depth array + * storage. */ CmdLocation staticCmdMapSpace[COMPILEENV_INIT_CMD_MAP_SIZE]; /* Initial storage for cmd location map. */ AuxData staticAuxDataArraySpace[COMPILEENV_INIT_AUX_DATA_SIZE]; -- cgit v0.12 From 8d03d462d4d27ee4a2d6fec72a8d2efe9e90f94a Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 30 May 2013 10:57:13 +0000 Subject: derp --- generic/tclCompile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 631ff58..54946ee 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -562,7 +562,7 @@ static Command * FindCompiledCommandFromToken(Tcl_Interp *interp, static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); -/* static */ int IsCompactibleCompileEnv(Tcl_Interp *interp, +static int IsCompactibleCompileEnv(Tcl_Interp *interp, CompileEnv *envPtr); static void PeepholeOptimize(CompileEnv *envPtr); #ifdef TCL_COMPILE_STATS @@ -1036,7 +1036,7 @@ TclCleanupByteCode( * --------------------------------------------------------------------- */ -/* static */ int +static int IsCompactibleCompileEnv( Tcl_Interp *interp, CompileEnv *envPtr) -- cgit v0.12 From d09727e7ff46a2abd069caac727159c92f6c9436 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 1 Jun 2013 21:05:55 +0000 Subject: Getting better at doing more efficient break/continue instruction handling. --- generic/tclCompCmds.c | 113 ++++++++++++++++++++++++++++---------------------- generic/tclCompile.c | 42 +++++++++++++++++++ generic/tclCompile.h | 6 +++ 3 files changed, 111 insertions(+), 50 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 1f99a22..6e5d187 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -480,7 +480,7 @@ TclCompileBreakCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - int i, exnIdx; + int depth; ExceptionRange *rangePtr; if (parsePtr->numWords != 1) { @@ -488,33 +488,40 @@ TclCompileBreakCmd( } /* - * Find the innermost exception range that contains this command. Relies - * on the fact that the range has a numCodeBytes = -1 when it is being - * populated and that inner ranges come after outer ranges. + * Find the innermost exception range that contains this command. */ - exnIdx = -1; - for (i=0 ; iexceptArrayNext ; i++) { - rangePtr = &envPtr->exceptArrayPtr[i]; - if (envPtr->codeStart+rangePtr->codeOffset <= envPtr->codeNext - && rangePtr->numCodeBytes == -1) { - exnIdx = i; + rangePtr = TclGetInnermostExceptionRange(envPtr, &depth); + if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { + int toPop = envPtr->currStackDepth - depth; + + /* + * Pop off the extra stack frames. + */ + + while (toPop > 0) { + TclEmitOpcode(INST_POP, envPtr); + toPop--; +#ifdef TCL_COMPILE_DEBUG + /* + * Instructions that raise exceptions don't really have to follow + * the usual stack management rules. But the checker wants them + * followed, so lie about stack usage to make it happy. + */ + TclAdjustStackDepth(1, envPtr); +#endif } - } - if (exnIdx != -1) { - rangePtr = &envPtr->exceptArrayPtr[exnIdx]; - if (rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - - envPtr->exnStackDepthArrayPtr[exnIdx]; + + if (envPtr->expandCount == 0 && rangePtr->breakOffset != -1) { + int offset = (rangePtr->breakOffset - CurrentOffset(envPtr)); /* - * Pop off the extra stack frames. + * Found the target! Also, no built-up expansion stack. No need + * for a nasty INST_BREAK here. */ - while (toPop > 0) { - TclEmitOpcode(INST_POP, envPtr); - toPop--; - } + TclEmitInstInt4(INST_JUMP4, offset, envPtr); + goto done; } } @@ -523,6 +530,8 @@ TclCompileBreakCmd( */ TclEmitOpcode(INST_BREAK, envPtr); + + done: #ifdef TCL_COMPILE_DEBUG /* * Instructions that raise exceptions don't really have to follow @@ -824,7 +833,7 @@ TclCompileContinueCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - int i, exnIdx; + int depth; ExceptionRange *rangePtr; /* @@ -837,45 +846,40 @@ TclCompileContinueCmd( /* * See if we can find a valid continueOffset (i.e., not -1) in the - * innermost containing exception range. Relies on the fact that the range - * has a numCodeBytes = -1 when it is being populated and that inner - * ranges come after outer ranges. + * innermost containing exception range. */ - exnIdx = -1; - for (i=0 ; iexceptArrayNext ; i++) { - rangePtr = &envPtr->exceptArrayPtr[i]; - if (envPtr->codeStart+rangePtr->codeOffset <= envPtr->codeNext - && rangePtr->numCodeBytes == -1) { - exnIdx = i; - } - } - if (exnIdx >= 0) { - rangePtr = &envPtr->exceptArrayPtr[exnIdx]; - if (rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - - envPtr->exnStackDepthArrayPtr[exnIdx]; + rangePtr = TclGetInnermostExceptionRange(envPtr, &depth); + if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { + int toPop = envPtr->currStackDepth - depth; + + /* + * Pop off the extra stack frames. + */ + while (toPop > 0) { + TclEmitOpcode(INST_POP, envPtr); + toPop--; +#ifdef TCL_COMPILE_DEBUG /* - * Pop off the extra stack frames. + * Instructions that raise exceptions don't really have to follow + * the usual stack management rules. But the checker wants them + * followed, so lie about stack usage to make it happy. */ - - while (toPop > 0) { - TclEmitOpcode(INST_POP, envPtr); - toPop--; - } + TclAdjustStackDepth(1, envPtr); +#endif } - if (rangePtr->type == LOOP_EXCEPTION_RANGE - && rangePtr->continueOffset != -1) { + + if (envPtr->expandCount == 0 && rangePtr->continueOffset != -1) { int offset = (rangePtr->continueOffset - CurrentOffset(envPtr)); /* - * Found the target! No need for a nasty INST_CONTINUE here. + * Found the target! Also, no built-up expansion stack. No need + * for a nasty INST_CONTINUE here. */ TclEmitInstInt4(INST_JUMP4, offset, envPtr); - PushStringLiteral(envPtr, ""); /* Evil hack! */ - return TCL_OK; + goto done; } } @@ -884,7 +888,16 @@ TclCompileContinueCmd( */ TclEmitOpcode(INST_CONTINUE, envPtr); - PushStringLiteral(envPtr, ""); /* Evil hack! */ + + done: +#ifdef TCL_COMPILE_DEBUG + /* + * Instructions that raise exceptions don't really have to follow + * the usual stack management rules. But the checker wants them + * followed, so lie about stack usage to make it happy. + */ + TclAdjustStackDepth(1, envPtr); +#endif return TCL_OK; } diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 54946ee..c56b67f 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1523,6 +1523,7 @@ TclInitCompileEnv( envPtr->cmdMapEnd = COMPILEENV_INIT_CMD_MAP_SIZE; envPtr->mallocedCmdMap = 0; envPtr->atCmdStart = 1; + envPtr->expandCount = 0; /* * TIP #280: Set up the extended command location information, based on @@ -2060,6 +2061,7 @@ TclCompileScript( if (expand) { TclEmitOpcode(INST_EXPAND_START, envPtr); + envPtr->expandCount++; } /* @@ -2279,6 +2281,7 @@ TclCompileScript( */ TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); + envPtr->expandCount--; TclAdjustStackDepth(1 - wordIdx, envPtr); } else if (wordIdx > 0) { /* @@ -3463,6 +3466,45 @@ TclCreateExceptRange( } /* + * --------------------------------------------------------------------- + * + * TclGetInnermostExceptionRange -- + * + * Returns the innermost exception range that covers the current code + * creation point, and (optionally) the stack depth that is expected at + * that point. Relies on the fact that the range has a numCodeBytes = -1 + * when it is being populated and that inner ranges come after outer + * ranges. + * + * --------------------------------------------------------------------- + */ + +ExceptionRange * +TclGetInnermostExceptionRange( + CompileEnv *envPtr, + int *stackDepthPtr) +{ + int exnIdx = -1, i; + + for (i=0 ; iexceptArrayNext ; i++) { + ExceptionRange *rangePtr = &envPtr->exceptArrayPtr[i]; + + if (CurrentOffset(envPtr) >= rangePtr->codeOffset && + (rangePtr->numCodeBytes == -1 || CurrentOffset(envPtr) < + rangePtr->codeOffset+rangePtr->numCodeBytes)) { + exnIdx = i; + } + } + if (exnIdx == -1) { + return NULL; + } + if (stackDepthPtr) { + *stackDepthPtr = envPtr->exnStackDepthArrayPtr[exnIdx]; + } + return &envPtr->exceptArrayPtr[exnIdx]; +} + +/* *---------------------------------------------------------------------- * * TclCreateAuxData -- diff --git a/generic/tclCompile.h b/generic/tclCompile.h index c380823..c9cbbd4 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -318,6 +318,10 @@ typedef struct CompileEnv { * inefficient. If set to 2, that instruction * should not be issued at all (by the generic * part of the command compiler). */ + int expandCount; /* Number of INST_EXPAND_START instructions + * encountered that have not yet been paired + * with a corresponding + * INST_INVOKE_EXPANDED. */ ContLineLoc *clLoc; /* If not NULL, the table holding the * locations of the invisible continuation * lines in the input script, to adjust the @@ -990,6 +994,8 @@ MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp, int numBytes, const CmdFrame *invoker, int word); MODULE_SCOPE void TclInitJumpFixupArray(JumpFixupArray *fixupArrayPtr); MODULE_SCOPE void TclInitLiteralTable(LiteralTable *tablePtr); +MODULE_SCOPE ExceptionRange *TclGetInnermostExceptionRange(CompileEnv *envPtr, + int *depthPtr); #ifdef TCL_COMPILE_STATS MODULE_SCOPE char * TclLiteralStats(LiteralTable *tablePtr); MODULE_SCOPE int TclLog2(int value); -- cgit v0.12 From 8bd69e27f28e6a4927f6df9aacd29694d76c0dca Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 2 Jun 2013 17:41:14 +0000 Subject: Many improvements to code generation of efficient break and continue. --- generic/tclCompCmds.c | 93 +++++++++++----------------- generic/tclCompCmdsSZ.c | 11 ++-- generic/tclCompile.c | 160 ++++++++++++++++++++++++++++++++++++++++++++---- generic/tclCompile.h | 52 ++++++++++++++-- 4 files changed, 235 insertions(+), 81 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 6e5d187..f2d2963 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -480,8 +480,8 @@ TclCompileBreakCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - int depth; ExceptionRange *rangePtr; + ExceptionAux *auxPtr; if (parsePtr->numWords != 1) { return TCL_ERROR; @@ -491,9 +491,9 @@ TclCompileBreakCmd( * Find the innermost exception range that contains this command. */ - rangePtr = TclGetInnermostExceptionRange(envPtr, &depth); + rangePtr = TclGetInnermostExceptionRange(envPtr, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - depth; + int toPop = envPtr->currStackDepth - auxPtr->stackDepth; /* * Pop off the extra stack frames. @@ -501,26 +501,18 @@ TclCompileBreakCmd( while (toPop > 0) { TclEmitOpcode(INST_POP, envPtr); - toPop--; -#ifdef TCL_COMPILE_DEBUG - /* - * Instructions that raise exceptions don't really have to follow - * the usual stack management rules. But the checker wants them - * followed, so lie about stack usage to make it happy. - */ TclAdjustStackDepth(1, envPtr); -#endif + toPop--; } - if (envPtr->expandCount == 0 && rangePtr->breakOffset != -1) { - int offset = (rangePtr->breakOffset - CurrentOffset(envPtr)); - + if (envPtr->expandCount == 0) { /* * Found the target! Also, no built-up expansion stack. No need * for a nasty INST_BREAK here. */ - TclEmitInstInt4(INST_JUMP4, offset, envPtr); + TclAddLoopBreakFixup(envPtr, auxPtr); + TclEmitInstInt4(INST_JUMP4, 0, envPtr); goto done; } } @@ -532,14 +524,12 @@ TclCompileBreakCmd( TclEmitOpcode(INST_BREAK, envPtr); done: -#ifdef TCL_COMPILE_DEBUG /* - * Instructions that raise exceptions don't really have to follow - * the usual stack management rules. But the checker wants them - * followed, so lie about stack usage to make it happy. + * Instructions that raise exceptions don't really have to follow the + * usual stack management rules, but the cleanup code does. */ + TclAdjustStackDepth(1, envPtr); -#endif return TCL_OK; } @@ -645,7 +635,7 @@ TclCompileCatchCmd( * uses. */ - range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); /* * If the body is a simple word, compile a BEGIN_CATCH instruction, @@ -833,8 +823,8 @@ TclCompileContinueCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - int depth; ExceptionRange *rangePtr; + ExceptionAux *auxPtr; /* * There should be no argument after the "continue". @@ -849,9 +839,9 @@ TclCompileContinueCmd( * innermost containing exception range. */ - rangePtr = TclGetInnermostExceptionRange(envPtr, &depth); + rangePtr = TclGetInnermostExceptionRange(envPtr, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - depth; + int toPop = envPtr->currStackDepth - auxPtr->stackDepth; /* * Pop off the extra stack frames. @@ -859,26 +849,18 @@ TclCompileContinueCmd( while (toPop > 0) { TclEmitOpcode(INST_POP, envPtr); - toPop--; -#ifdef TCL_COMPILE_DEBUG - /* - * Instructions that raise exceptions don't really have to follow - * the usual stack management rules. But the checker wants them - * followed, so lie about stack usage to make it happy. - */ TclAdjustStackDepth(1, envPtr); -#endif + toPop--; } - if (envPtr->expandCount == 0 && rangePtr->continueOffset != -1) { - int offset = (rangePtr->continueOffset - CurrentOffset(envPtr)); - + if (envPtr->expandCount == 0) { /* * Found the target! Also, no built-up expansion stack. No need * for a nasty INST_CONTINUE here. */ - TclEmitInstInt4(INST_JUMP4, offset, envPtr); + TclAddLoopContinueFixup(envPtr, auxPtr); + TclEmitInstInt4(INST_JUMP4, 0, envPtr); goto done; } } @@ -890,14 +872,12 @@ TclCompileContinueCmd( TclEmitOpcode(INST_CONTINUE, envPtr); done: -#ifdef TCL_COMPILE_DEBUG /* - * Instructions that raise exceptions don't really have to follow - * the usual stack management rules. But the checker wants them - * followed, so lie about stack usage to make it happy. + * Instructions that raise exceptions don't really have to follow the + * usual stack management rules, but the cleanup code does. */ + TclAdjustStackDepth(1, envPtr); -#endif return TCL_OK; } @@ -1350,7 +1330,7 @@ TclCompileDictMergeCmd( * For each of the remaining dictionaries... */ - outLoop = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + outLoop = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); TclEmitInstInt4( INST_BEGIN_CATCH4, outLoop, envPtr); ExceptionRangeStarts(envPtr, outLoop); for (i=2 ; inumWords ; i++) { @@ -1563,7 +1543,7 @@ CompileDictEachCmd( * started by Tcl_DictObjFirst above. */ - catchRange = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + catchRange = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); TclEmitInstInt4( INST_BEGIN_CATCH4, catchRange, envPtr); ExceptionRangeStarts(envPtr, catchRange); @@ -1581,7 +1561,7 @@ CompileDictEachCmd( * Set up the loop exception targets. */ - loopRange = DeclareExceptionRange(envPtr, LOOP_EXCEPTION_RANGE); + loopRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); ExceptionRangeStarts(envPtr, loopRange); /* @@ -1629,6 +1609,7 @@ CompileDictEachCmd( */ ExceptionRangeTarget(envPtr, loopRange, breakOffset); + TclFinalizeLoopExceptionRange(envPtr, loopRange); TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( infoIndex, envPtr); TclEmitOpcode( INST_END_CATCH, envPtr); @@ -1807,7 +1788,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_DICT_UPDATE_START, dictIndex, envPtr); TclEmitInt4( infoIndex, envPtr); - range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); @@ -2164,7 +2145,7 @@ TclCompileDictWithCmd( * Now the body of the [dict with]. */ - range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); @@ -2446,15 +2427,6 @@ TclCompileForCmd( } /* - * Create ExceptionRange records for the body and the "next" command. The - * "next" command's ExceptionRange supports break but not continue (and - * has a -1 continueOffset). - */ - - bodyRange = DeclareExceptionRange(envPtr, LOOP_EXCEPTION_RANGE); - nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); - - /* * Inline compile the initial command. */ @@ -2480,6 +2452,7 @@ TclCompileForCmd( * Compile the loop body. */ + bodyRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); bodyCodeOffset = ExceptionRangeStarts(envPtr, bodyRange); SetLineInformation(4); CompileBody(envPtr, bodyTokenPtr, interp); @@ -2488,9 +2461,12 @@ TclCompileForCmd( TclEmitOpcode(INST_POP, envPtr); /* - * Compile the "next" subcommand. + * Compile the "next" subcommand. Note that this exception range will not + * have a continueOffset (other than -1) connected to it; it won't trap + * TCL_CONTINUE but rather just TCL_BREAK. */ + nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); envPtr->currStackDepth = savedStackDepth; nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange); SetLineInformation(3); @@ -2538,6 +2514,8 @@ TclCompileForCmd( ExceptionRangeTarget(envPtr, bodyRange, breakOffset); ExceptionRangeTarget(envPtr, nextRange, breakOffset); + TclFinalizeLoopExceptionRange(envPtr, bodyRange); + TclFinalizeLoopExceptionRange(envPtr, nextRange); /* * The for command's result is an empty string. @@ -2829,7 +2807,7 @@ CompileEachloopCmd( * Create an exception record to handle [break] and [continue]. */ - range = DeclareExceptionRange(envPtr, LOOP_EXCEPTION_RANGE); + range = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); /* * Evaluate then store each value list in the associated temporary. @@ -2935,6 +2913,7 @@ CompileEachloopCmd( */ ExceptionRangeTarget(envPtr, range, breakOffset); + TclFinalizeLoopExceptionRange(envPtr, range); /* * The command's result is an empty string if not collecting, or the diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 4f4286e..721f59a 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -834,7 +834,7 @@ TclSubstCompile( } envPtr->line = bline; - catchRange = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + catchRange = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); OP4( BEGIN_CATCH4, catchRange); ExceptionRangeStarts(envPtr, catchRange); @@ -2302,7 +2302,7 @@ IssueTryInstructions( * (and it's never called when there's a finally clause). */ - range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); OP4( BEGIN_CATCH4, range); ExceptionRangeStarts(envPtr, range); BODY( bodyToken, 1); @@ -2455,7 +2455,7 @@ IssueTryFinallyInstructions( * (if any trap matches) and run a finally clause. */ - range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); OP4( BEGIN_CATCH4, range); ExceptionRangeStarts(envPtr, range); envPtr->currStackDepth = savedStackDepth; @@ -2522,7 +2522,7 @@ IssueTryFinallyInstructions( */ if (resultVars[i] >= 0 || handlerTokens[i]) { - range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE); + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); OP4( BEGIN_CATCH4, range); ExceptionRangeStarts(envPtr, range); } @@ -2833,7 +2833,7 @@ TclCompileWhileCmd( * implement break and continue. */ - range = DeclareExceptionRange(envPtr, LOOP_EXCEPTION_RANGE); + range = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); /* * Jump to the evaluation of the condition. This code uses the "loop @@ -2917,6 +2917,7 @@ TclCompileWhileCmd( envPtr->exceptArrayPtr[range].continueOffset = testCodeOffset; envPtr->exceptArrayPtr[range].codeOffset = bodyCodeOffset; ExceptionRangeTarget(envPtr, range, breakOffset); + TclFinalizeLoopExceptionRange(envPtr, range); /* * The while command's result is an empty string. diff --git a/generic/tclCompile.c b/generic/tclCompile.c index c56b67f..96f8683 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1514,7 +1514,7 @@ TclInitCompileEnv( envPtr->mallocedLiteralArray = 0; envPtr->exceptArrayPtr = envPtr->staticExceptArraySpace; - envPtr->exnStackDepthArrayPtr = envPtr->staticExnStackDepthArraySpace; + envPtr->exceptAuxArrayPtr = envPtr->staticExAuxArraySpace; envPtr->exceptArrayNext = 0; envPtr->exceptArrayEnd = COMPILEENV_INIT_EXCEPT_RANGES; envPtr->mallocedExceptArray = 0; @@ -1728,7 +1728,7 @@ TclFreeCompileEnv( } if (envPtr->mallocedExceptArray) { ckfree(envPtr->exceptArrayPtr); - ckfree(envPtr->exnStackDepthArrayPtr); + ckfree(envPtr->exceptAuxArrayPtr); } if (envPtr->mallocedCmdMap) { ckfree(envPtr->cmdMapPtr); @@ -3413,6 +3413,7 @@ TclCreateExceptRange( * new ExceptionRange structure. */ { register ExceptionRange *rangePtr; + register ExceptionAux *auxPtr; int index = envPtr->exceptArrayNext; if (index >= envPtr->exceptArrayEnd) { @@ -3424,16 +3425,16 @@ TclCreateExceptRange( size_t currBytes = envPtr->exceptArrayNext * sizeof(ExceptionRange); - size_t currBytes2 = envPtr->exceptArrayNext * sizeof(int); + size_t currBytes2 = envPtr->exceptArrayNext * sizeof(ExceptionAux); int newElems = 2*envPtr->exceptArrayEnd; size_t newBytes = newElems * sizeof(ExceptionRange); - size_t newBytes2 = newElems * sizeof(int); + size_t newBytes2 = newElems * sizeof(ExceptionAux); if (envPtr->mallocedExceptArray) { envPtr->exceptArrayPtr = ckrealloc(envPtr->exceptArrayPtr, newBytes); - envPtr->exnStackDepthArrayPtr = - ckrealloc(envPtr->exnStackDepthArrayPtr, newBytes2); + envPtr->exceptAuxArrayPtr = + ckrealloc(envPtr->exceptAuxArrayPtr, newBytes2); } else { /* * envPtr->exceptArrayPtr isn't a ckalloc'd pointer, so we must @@ -3441,12 +3442,12 @@ TclCreateExceptRange( */ ExceptionRange *newPtr = ckalloc(newBytes); - int *newPtr2 = ckalloc(newBytes2); + ExceptionAux *newPtr2 = ckalloc(newBytes2); memcpy(newPtr, envPtr->exceptArrayPtr, currBytes); - memcpy(newPtr2, envPtr->exnStackDepthArrayPtr, currBytes2); + memcpy(newPtr2, envPtr->exceptAuxArrayPtr, currBytes2); envPtr->exceptArrayPtr = newPtr; - envPtr->exnStackDepthArrayPtr = newPtr2; + envPtr->exceptAuxArrayPtr = newPtr2; envPtr->mallocedExceptArray = 1; } envPtr->exceptArrayEnd = newElems; @@ -3461,7 +3462,14 @@ TclCreateExceptRange( rangePtr->breakOffset = -1; rangePtr->continueOffset = -1; rangePtr->catchOffset = -1; - envPtr->exnStackDepthArrayPtr[index] = envPtr->currStackDepth; + auxPtr = &envPtr->exceptAuxArrayPtr[index]; + auxPtr->stackDepth = envPtr->currStackDepth; + auxPtr->numBreakTargets = 0; + auxPtr->breakTargets = NULL; + auxPtr->allocBreakTargets = 0; + auxPtr->numContinueTargets = 0; + auxPtr->continueTargets = NULL; + auxPtr->allocContinueTargets = 0; return index; } @@ -3482,7 +3490,7 @@ TclCreateExceptRange( ExceptionRange * TclGetInnermostExceptionRange( CompileEnv *envPtr, - int *stackDepthPtr) + ExceptionAux **auxPtrPtr) { int exnIdx = -1, i; @@ -3498,12 +3506,122 @@ TclGetInnermostExceptionRange( if (exnIdx == -1) { return NULL; } - if (stackDepthPtr) { - *stackDepthPtr = envPtr->exnStackDepthArrayPtr[exnIdx]; + if (auxPtrPtr) { + *auxPtrPtr = &envPtr->exceptAuxArrayPtr[exnIdx]; } return &envPtr->exceptArrayPtr[exnIdx]; } +void +TclAddLoopBreakFixup( + CompileEnv *envPtr, + ExceptionAux *auxPtr) +{ + int range = auxPtr - envPtr->exceptAuxArrayPtr; + + if (envPtr->exceptArrayPtr[range].type != LOOP_EXCEPTION_RANGE) { + Tcl_Panic("trying to add 'break' fixup to full exception range"); + } + + if (++auxPtr->numBreakTargets > auxPtr->allocBreakTargets) { + auxPtr->allocBreakTargets *= 2; + auxPtr->allocBreakTargets += 2; + if (auxPtr->breakTargets) { + auxPtr->breakTargets = ckrealloc(auxPtr->breakTargets, + sizeof(int) * auxPtr->allocBreakTargets); + } else { + auxPtr->breakTargets = + ckalloc(sizeof(int) * auxPtr->allocBreakTargets); + } + } + auxPtr->breakTargets[auxPtr->numBreakTargets - 1] = CurrentOffset(envPtr); +} + +void +TclAddLoopContinueFixup( + CompileEnv *envPtr, + ExceptionAux *auxPtr) +{ + int range = auxPtr - envPtr->exceptAuxArrayPtr; + + if (envPtr->exceptArrayPtr[range].type != LOOP_EXCEPTION_RANGE) { + Tcl_Panic("trying to add 'continue' fixup to full exception range"); + } + + if (++auxPtr->numContinueTargets > auxPtr->allocContinueTargets) { + auxPtr->allocContinueTargets *= 2; + auxPtr->allocContinueTargets += 2; + if (auxPtr->continueTargets) { + auxPtr->continueTargets = ckrealloc(auxPtr->continueTargets, + sizeof(int) * auxPtr->allocContinueTargets); + } else { + auxPtr->continueTargets = + ckalloc(sizeof(int) * auxPtr->allocContinueTargets); + } + } + auxPtr->continueTargets[auxPtr->numContinueTargets - 1] = + CurrentOffset(envPtr); +} + +void +TclFinalizeLoopExceptionRange( + CompileEnv *envPtr, + int range) +{ + ExceptionRange *rangePtr = &envPtr->exceptArrayPtr[range]; + ExceptionAux *auxPtr = &envPtr->exceptAuxArrayPtr[range]; + int i, offset; + unsigned char *site; + + if (rangePtr->type != LOOP_EXCEPTION_RANGE) { + Tcl_Panic("trying to finalize a loop exception range"); + } + + /* + * Do the jump fixups. Note that these are always issued as INST_JUMP4 so + * there is no need to fuss around with updating code offsets. + */ + + for (i=0 ; inumBreakTargets ; i++) { + site = envPtr->codeStart + auxPtr->breakTargets[i]; + offset = rangePtr->breakOffset - auxPtr->breakTargets[i]; + TclUpdateInstInt4AtPc(INST_JUMP4, offset, site); + } + for (i=0 ; inumContinueTargets ; i++) { + site = envPtr->codeStart + auxPtr->continueTargets[i]; + if (rangePtr->continueOffset == -1) { + int j; + + /* + * WTF? Can't bind, so revert to an INST_CONTINUE. + */ + + *site = INST_CONTINUE; + for (j=0 ; j<4 ; j++) { + *++site = INST_NOP; + } + } else { + offset = rangePtr->continueOffset - auxPtr->continueTargets[i]; + TclUpdateInstInt4AtPc(INST_JUMP4, offset, site); + } + } + + /* + * Drop the arrays we were holding the only reference to. + */ + + if (auxPtr->breakTargets) { + ckfree(auxPtr->breakTargets); + auxPtr->breakTargets = NULL; + auxPtr->numBreakTargets = 0; + } + if (auxPtr->continueTargets) { + ckfree(auxPtr->continueTargets); + auxPtr->continueTargets = NULL; + auxPtr->numContinueTargets = 0; + } +} + /* *---------------------------------------------------------------------- * @@ -3864,6 +3982,22 @@ TclFixupForwardJump( } } + for (k = 0 ; k < envPtr->exceptArrayNext ; k++) { + ExceptionAux *auxPtr = &envPtr->exceptAuxArrayPtr[k]; + int i; + + for (i=0 ; inumBreakTargets ; i++) { + if (jumpFixupPtr->codeOffset < auxPtr->breakTargets[i]) { + auxPtr->breakTargets[i] += 3; + } + } + for (i=0 ; inumContinueTargets ; i++) { + if (jumpFixupPtr->codeOffset < auxPtr->continueTargets[i]) { + auxPtr->continueTargets[i] += 3; + } + } + } + /* * TIP #280: Adjust the mapping from PC values to the per-command * information about arguments and their line numbers. diff --git a/generic/tclCompile.h b/generic/tclCompile.h index c9cbbd4..8430da3 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -100,6 +100,38 @@ typedef struct ExceptionRange { } ExceptionRange; /* + * Auxiliary data used when issuing (currently just loop) exception ranges, + * but which is not required during execution. + */ + +typedef struct ExceptionAux { + int stackDepth; /* The stack depth at the point where the + * exception range was created. This is used + * to calculate the number of POPs required to + * restore the stack to its prior state. */ + int numBreakTargets; /* The number of [break]s that want to be + * targeted to the place where this loop + * exception will be bound to. */ + int *breakTargets; /* The offsets of the INST_JUMP4 instructions + * issued by the [break]s that we must + * update. Note that resizing a jump (via + * TclFixupForwardJump) can cause the contents + * of this array to be updated. When + * numBreakTargets==0, this is NULL. */ + int allocBreakTargets; /* The size of the breakTargets array. */ + int numContinueTargets; /* The number of [continue]s that want to be + * targeted to the place where this loop + * exception will be bound to. */ + int *continueTargets; /* The offsets of the INST_JUMP4 instructions + * issued by the [continue]s that we must + * update. Note that resizing a jump (via + * TclFixupForwardJump) can cause the contents + * of this array to be updated. When + * numContinueTargets==0, this is NULL. */ + int allocContinueTargets; /* The size of the continueTargets array. */ +} ExceptionAux; + +/* * Structure used to map between instruction pc and source locations. It * defines for each compiled Tcl command its code's starting offset and its * source's starting offset and length. Note that the code offset increases @@ -275,9 +307,11 @@ typedef struct CompileEnv { * entry. */ int mallocedExceptArray; /* 1 if ExceptionRange array was expanded and * exceptArrayPtr points in heap, else 0. */ - int *exnStackDepthArrayPtr; /* Array of stack depths to restore to when - * processing BREAK/CONTINUE exceptions. Must - * be the same size as the exceptArrayPtr. */ + ExceptionAux *exceptAuxArrayPtr; + /* Array of information used to restore the + * state when processing BREAK/CONTINUE + * exceptions. Must be the same size as the + * exceptArrayPtr. */ CmdLocation *cmdMapPtr; /* Points to start of CmdLocation array. * numCommands is the index of the next entry * to use; (numCommands-1) is the entry index @@ -299,8 +333,8 @@ typedef struct CompileEnv { /* Initial storage of LiteralEntry array. */ ExceptionRange staticExceptArraySpace[COMPILEENV_INIT_EXCEPT_RANGES]; /* Initial ExceptionRange array storage. */ - int staticExnStackDepthArraySpace[COMPILEENV_INIT_EXCEPT_RANGES]; - /* Initial static except stack depth array + ExceptionAux staticExAuxArraySpace[COMPILEENV_INIT_EXCEPT_RANGES]; + /* Initial static except auxiliary info array * storage. */ CmdLocation staticCmdMapSpace[COMPILEENV_INIT_CMD_MAP_SIZE]; /* Initial storage for cmd location map. */ @@ -995,7 +1029,13 @@ MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp, MODULE_SCOPE void TclInitJumpFixupArray(JumpFixupArray *fixupArrayPtr); MODULE_SCOPE void TclInitLiteralTable(LiteralTable *tablePtr); MODULE_SCOPE ExceptionRange *TclGetInnermostExceptionRange(CompileEnv *envPtr, - int *depthPtr); + ExceptionAux **auxPtrPtr); +MODULE_SCOPE void TclAddLoopBreakFixup(CompileEnv *envPtr, + ExceptionAux *auxPtr); +MODULE_SCOPE void TclAddLoopContinueFixup(CompileEnv *envPtr, + ExceptionAux *auxPtr); +MODULE_SCOPE void TclFinalizeLoopExceptionRange(CompileEnv *envPtr, + int range); #ifdef TCL_COMPILE_STATS MODULE_SCOPE char * TclLiteralStats(LiteralTable *tablePtr); MODULE_SCOPE int TclLog2(int value); -- cgit v0.12 From 77f3ad2fcd5b1383a5a9e38441c20bbb4227fd03 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 2 Jun 2013 18:54:09 +0000 Subject: Remove useless macro, use existing macro where it makes sense. --- generic/tclAssembly.c | 4 ++-- generic/tclCompile.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 0fe50b3a..d1af8c6 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -650,7 +650,7 @@ BBEmitOpcode( } TclEmitInt1(op, envPtr); - envPtr->atCmdStart = ((op) == INST_START_CMD); + TclUpdateAtCmdStart(op, envPtr); BBUpdateStackReqs(bbPtr, tblIdx, count); } @@ -711,7 +711,7 @@ BBEmitInst1or4( } else { TclEmitInt4(param, envPtr); } - envPtr->atCmdStart = ((op) == INST_START_CMD); + TclUpdateAtCmdStart(op, envPtr); BBUpdateStackReqs(bbPtr, tblIdx, count); } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 8430da3..4b50710 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1450,14 +1450,11 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); * of LOOP ranges is an interesting datum for debugging purposes, and that is * what we compute now. * - * static int DeclareExceptionRange(CompileEnv *envPtr, int type); * static int ExceptionRangeStarts(CompileEnv *envPtr, int index); * static void ExceptionRangeEnds(CompileEnv *envPtr, int index); * static void ExceptionRangeTarget(CompileEnv *envPtr, int index, LABEL); */ -#define DeclareExceptionRange(envPtr, type) \ - (TclCreateExceptRange((type), (envPtr))) #define ExceptionRangeStarts(envPtr, index) \ (((envPtr)->exceptDepth++), \ ((envPtr)->maxExceptDepth = \ -- cgit v0.12 From c72504b5e8f17039d8438be6e3f41d5b8e2928eb Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 2 Jun 2013 21:32:16 +0000 Subject: Fix a stack depth calculation. --- generic/tclCompCmdsSZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 721f59a..7831198 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -1518,7 +1518,7 @@ IssueSwitchChainedTests( */ OP( POP); - envPtr->currStackDepth = savedStackDepth + 1; + envPtr->currStackDepth = savedStackDepth; envPtr->line = bodyLines[i+1]; /* TIP #280 */ envPtr->clNext = bodyContLines[i+1]; /* TIP #280 */ TclCompileCmdWord(interp, bodyToken[i+1], 1, envPtr); -- cgit v0.12 From ae411458670d6ca50c9516ed742f9b06855637a9 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 3 Jun 2013 09:37:14 +0000 Subject: Generate [continue] optimally in [for] next clauses. Add tests for Bug 3614226. --- generic/tclCompCmds.c | 11 ++++---- generic/tclCompile.c | 35 +++++++++++++++++++++++- generic/tclCompile.h | 13 ++++++++- tests/for.test | 74 ++++++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 119 insertions(+), 14 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index f2d2963..3046841 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -491,7 +491,7 @@ TclCompileBreakCmd( * Find the innermost exception range that contains this command. */ - rangePtr = TclGetInnermostExceptionRange(envPtr, &auxPtr); + rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_BREAK, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { int toPop = envPtr->currStackDepth - auxPtr->stackDepth; @@ -505,14 +505,13 @@ TclCompileBreakCmd( toPop--; } - if (envPtr->expandCount == 0) { + if (envPtr->expandCount == auxPtr->expandTarget) { /* * Found the target! Also, no built-up expansion stack. No need * for a nasty INST_BREAK here. */ TclAddLoopBreakFixup(envPtr, auxPtr); - TclEmitInstInt4(INST_JUMP4, 0, envPtr); goto done; } } @@ -839,7 +838,7 @@ TclCompileContinueCmd( * innermost containing exception range. */ - rangePtr = TclGetInnermostExceptionRange(envPtr, &auxPtr); + rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_CONTINUE, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { int toPop = envPtr->currStackDepth - auxPtr->stackDepth; @@ -853,14 +852,13 @@ TclCompileContinueCmd( toPop--; } - if (envPtr->expandCount == 0) { + if (envPtr->expandCount == auxPtr->expandTarget) { /* * Found the target! Also, no built-up expansion stack. No need * for a nasty INST_CONTINUE here. */ TclAddLoopContinueFixup(envPtr, auxPtr); - TclEmitInstInt4(INST_JUMP4, 0, envPtr); goto done; } } @@ -2467,6 +2465,7 @@ TclCompileForCmd( */ nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); + envPtr->exceptAuxArrayPtr[nextRange].supportsContinue = 0; envPtr->currStackDepth = savedStackDepth; nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange); SetLineInformation(3); diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 96f8683..f2e9329 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -3463,7 +3463,9 @@ TclCreateExceptRange( rangePtr->continueOffset = -1; rangePtr->catchOffset = -1; auxPtr = &envPtr->exceptAuxArrayPtr[index]; + auxPtr->supportsContinue = 1; auxPtr->stackDepth = envPtr->currStackDepth; + auxPtr->expandTarget = envPtr->expandCount; auxPtr->numBreakTargets = 0; auxPtr->breakTargets = NULL; auxPtr->allocBreakTargets = 0; @@ -3490,6 +3492,7 @@ TclCreateExceptRange( ExceptionRange * TclGetInnermostExceptionRange( CompileEnv *envPtr, + int returnCode, ExceptionAux **auxPtrPtr) { int exnIdx = -1, i; @@ -3499,7 +3502,9 @@ TclGetInnermostExceptionRange( if (CurrentOffset(envPtr) >= rangePtr->codeOffset && (rangePtr->numCodeBytes == -1 || CurrentOffset(envPtr) < - rangePtr->codeOffset+rangePtr->numCodeBytes)) { + rangePtr->codeOffset+rangePtr->numCodeBytes) && + (returnCode != TCL_CONTINUE || + envPtr->exceptAuxArrayPtr[i].supportsContinue)) { exnIdx = i; } } @@ -3512,6 +3517,19 @@ TclGetInnermostExceptionRange( return &envPtr->exceptArrayPtr[exnIdx]; } +/* + * --------------------------------------------------------------------- + * + * TclAddLoopBreakFixup, TclAddLoopContinueFixup -- + * + * Adds a place that wants to break/continue to the loop exception range + * tracking that will be fixed up once the loop can be finalized. These + * functions will generate an INST_JUMP4 that will be fixed up during the + * loop finalization. + * + * --------------------------------------------------------------------- + */ + void TclAddLoopBreakFixup( CompileEnv *envPtr, @@ -3535,6 +3553,7 @@ TclAddLoopBreakFixup( } } auxPtr->breakTargets[auxPtr->numBreakTargets - 1] = CurrentOffset(envPtr); + TclEmitInstInt4(INST_JUMP4, 0, envPtr); } void @@ -3561,7 +3580,21 @@ TclAddLoopContinueFixup( } auxPtr->continueTargets[auxPtr->numContinueTargets - 1] = CurrentOffset(envPtr); + TclEmitInstInt4(INST_JUMP4, 0, envPtr); } + +/* + * --------------------------------------------------------------------- + * + * TclFinalizeLoopExceptionRange -- + * + * Finalizes a loop exception range, binding the registered [break] and + * [continue] implementations so that they jump to the correct place. + * Note that this must only be called after *all* the exception range + * target offsets have been set. + * + * --------------------------------------------------------------------- + */ void TclFinalizeLoopExceptionRange( diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 4b50710..957c724 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -105,10 +105,21 @@ typedef struct ExceptionRange { */ typedef struct ExceptionAux { + int supportsContinue; /* Whether this exception range will have a + * continueOffset created for it; if it is a + * loop exception range that *doesn't* have + * one (see [for] next-clause) then we must + * not pick up the range when scanning for a + * target to continue to. */ int stackDepth; /* The stack depth at the point where the * exception range was created. This is used * to calculate the number of POPs required to * restore the stack to its prior state. */ + int expandTarget; /* The number of expansions expected on the + * auxData stack at the time the loop starts; + * we can't currently discard them except by + * doing INST_INVOKE_EXPANDED; this is a known + * problem. */ int numBreakTargets; /* The number of [break]s that want to be * targeted to the place where this loop * exception will be bound to. */ @@ -1029,7 +1040,7 @@ MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp, MODULE_SCOPE void TclInitJumpFixupArray(JumpFixupArray *fixupArrayPtr); MODULE_SCOPE void TclInitLiteralTable(LiteralTable *tablePtr); MODULE_SCOPE ExceptionRange *TclGetInnermostExceptionRange(CompileEnv *envPtr, - ExceptionAux **auxPtrPtr); + int returnCode, ExceptionAux **auxPtrPtr); MODULE_SCOPE void TclAddLoopBreakFixup(CompileEnv *envPtr, ExceptionAux *auxPtr); MODULE_SCOPE void TclAddLoopContinueFixup(CompileEnv *envPtr, diff --git a/tests/for.test b/tests/for.test index ff4dc0e..3f4d2b7 100644 --- a/tests/for.test +++ b/tests/for.test @@ -14,6 +14,12 @@ if {[lsearch [namespace children] ::tcltest] == -1} { namespace import -force ::tcltest::* } +# Used for constraining memory leak tests +testConstraint memory [llength [info commands memory]] +if {[testConstraint memory]} { + proc meminfo {} {lindex [split [memory info] "\n"] 3 3} +} + # Basic "for" operation. test for-1.1 {TclCompileForCmd: missing initial command} { @@ -345,7 +351,6 @@ proc formatMail {} { 64 { UNIX (Solaris 2.* and SunOS, other systems soon to follow). Easy to install} \ 65 { binary packages are now for sale at the Sun Labs Tcl/Tk Shop. Check it out!} \ } - set result "" set NL " " @@ -365,7 +370,6 @@ proc formatMail {} { } else { set break 1 } - set xmailer 0 set inheaders 1 set last [array size lines] @@ -386,9 +390,7 @@ proc formatMail {} { set limit 55 } else { set limit 55 - # Decide whether or not to break the body line - if {$plen > 0} { if {[string first {> } $line] == 0} { # This is quoted text from previous message, don't reformat @@ -431,7 +433,7 @@ proc formatMail {} { set climit [expr $limit-1] set cutoff 50 set continuation 0 - + while {[string length $line] > $limit} { for {set c [expr $limit-1]} {$c >= $cutoff} {incr c -1} { set char [string index $line $c] @@ -824,7 +826,67 @@ test for-6.18 {Tcl_ForObjCmd: for command result} { 1 {invoked "continue" outside of a loop} \ ] - +test for-7.1 {Bug 3614226: ensure that break cleans up the stack} memory { + apply {{} { + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + for {set x 0} {$x < 5} {incr x} { + list a b c [break] d e f + } + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 +test for-7.2 {Bug 3614226: ensure that continue cleans up the stack} memory { + apply {{} { + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + for {set x 0} {$x < 5} {incr x} { + list a b c [continue] d e f + } + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 +test for-7.3 {Bug 3614226: ensure that break cleans up the expansion stack} {memory knownBug} { + apply {{} { + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + for {set x 0} {[incr x]<50} {} { + puts {*}[puts a b c {*}[break] d e f] + } + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 +test for-7.4 {Bug 3614226: ensure that continue cleans up the expansion stack} {memory knownBug} { + apply {{} { + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + for {set x 0} {[incr x]<50} {} { + puts {*}[puts a b c {*}[continue] d e f] + } + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 + # cleanup ::tcltest::cleanupTests return + +# Local Variables: +# mode: tcl +# End: -- cgit v0.12 From 69c9746bd1fb5d903ee327444835805a4a99786f Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 3 Jun 2013 14:01:24 +0000 Subject: Improve reliability of test httpold-4.12. Thanks AF! --- tests/httpd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/httpd b/tests/httpd index 3ea8024..7ba07af 100644 --- a/tests/httpd +++ b/tests/httpd @@ -39,7 +39,7 @@ proc httpdAccept {newsock ipaddr port} { fconfigure $newsock -blocking 0 -translation {auto crlf} httpd_log $newsock Connect $ipaddr $port set data(ipaddr) $ipaddr - fileevent $newsock readable [list httpdRead $newsock] + after 50 [list fileevent $newsock readable [list httpdRead $newsock]] } # read data from a client request -- cgit v0.12 From 596b5e9c70fd7bbef2a6d801c647bb939482961a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 3 Jun 2013 14:19:43 +0000 Subject: last-moment fix for FreeBSD from Pietro Cerutti --- unix/configure | 4 ++-- unix/tcl.m4 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index ec5298c..36d7b8d 100755 --- a/unix/configure +++ b/unix/configure @@ -3425,14 +3425,14 @@ echo "$ac_t""$tcl_cv_ld_elf" 1>&6 # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$@" + TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\$@" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" if test $doRpath = yes ; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi if test "${TCL_THREADS}" = "1" ; then # The -pthread needs to go in the LDFLAGS, not LIBS diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 85b8f82..45d19ae 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1564,14 +1564,14 @@ dnl AC_CHECK_TOOL(AR, ar) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-Wl,-soname \$[@]" + TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\$[@]" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" if test $doRpath = yes ; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi if test "${TCL_THREADS}" = "1" ; then # The -pthread needs to go in the LDFLAGS, not LIBS -- cgit v0.12 From 63a81f0f749c1cc9965874146ba78f865ad5393a Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 3 Jun 2013 14:57:48 +0000 Subject: Next stage of fixing the break/continue generation. --- generic/tclCompCmds.c | 76 +++++++++++++++++++++++++++++---------------------- generic/tclCompile.c | 3 ++ generic/tclCompile.h | 4 ++- generic/tclExecute.c | 11 ++++++++ tests/for.test | 4 +-- 5 files changed, 63 insertions(+), 35 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 3046841..3d6abcf 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -493,36 +493,42 @@ TclCompileBreakCmd( rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_BREAK, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - auxPtr->stackDepth; + int toPop; + + /* + * Ditch the extra elements from the auxiliary stack. + */ + + toPop = envPtr->expandCount - auxPtr->expandTarget; + while (toPop > 0) { + TclEmitOpcode(INST_EXPAND_DROP, envPtr); + toPop--; + } /* * Pop off the extra stack frames. */ + toPop = envPtr->currStackDepth - auxPtr->stackDepth; while (toPop > 0) { TclEmitOpcode(INST_POP, envPtr); TclAdjustStackDepth(1, envPtr); toPop--; } - if (envPtr->expandCount == auxPtr->expandTarget) { - /* - * Found the target! Also, no built-up expansion stack. No need - * for a nasty INST_BREAK here. - */ - - TclAddLoopBreakFixup(envPtr, auxPtr); - goto done; - } - } + /* + * Found the target! No need for a nasty INST_BREAK here. + */ - /* - * Emit a break instruction. - */ + TclAddLoopBreakFixup(envPtr, auxPtr); + } else { + /* + * Emit a break instruction. + */ - TclEmitOpcode(INST_BREAK, envPtr); + TclEmitOpcode(INST_BREAK, envPtr); + } - done: /* * Instructions that raise exceptions don't really have to follow the * usual stack management rules, but the cleanup code does. @@ -840,36 +846,42 @@ TclCompileContinueCmd( rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_CONTINUE, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop = envPtr->currStackDepth - auxPtr->stackDepth; + int toPop; + + /* + * Ditch the extra elements from the auxiliary stack. + */ + + toPop = envPtr->expandCount - auxPtr->expandTarget; + while (toPop > 0) { + TclEmitOpcode(INST_EXPAND_DROP, envPtr); + toPop--; + } /* * Pop off the extra stack frames. */ + toPop = envPtr->currStackDepth - auxPtr->stackDepth; while (toPop > 0) { TclEmitOpcode(INST_POP, envPtr); TclAdjustStackDepth(1, envPtr); toPop--; } - if (envPtr->expandCount == auxPtr->expandTarget) { - /* - * Found the target! Also, no built-up expansion stack. No need - * for a nasty INST_CONTINUE here. - */ - - TclAddLoopContinueFixup(envPtr, auxPtr); - goto done; - } - } + /* + * Found the target! No need for a nasty INST_CONTINUE here. + */ - /* - * Emit a continue instruction. - */ + TclAddLoopContinueFixup(envPtr, auxPtr); + } else { + /* + * Emit a continue instruction. + */ - TclEmitOpcode(INST_CONTINUE, envPtr); + TclEmitOpcode(INST_CONTINUE, envPtr); + } - done: /* * Instructions that raise exceptions don't really have to follow the * usual stack management rules, but the cleanup code does. diff --git a/generic/tclCompile.c b/generic/tclCompile.c index f2e9329..f8dd504 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -540,6 +540,9 @@ InstructionDesc const tclInstructionTable[] = { * list and pushes that resulting list onto the stack. * Stack: ... list1 list2 => ... [lconcat list1 list2] */ + {"expandDrop", 1, 0, 0, {OPERAND_NONE}}, + /* Drops an element from the auxiliary stack. */ + {NULL, 0, 0, 0, {OPERAND_NONE}} }; diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 957c724..75de025 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -772,8 +772,10 @@ typedef struct ByteCode { #define INST_LIST_CONCAT 164 +#define INST_EXPAND_DROP 165 + /* The last opcode */ -#define LAST_INST_OPCODE 164 +#define LAST_INST_OPCODE 165 /* * Table describing the Tcl bytecode instructions: their name (for displaying diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 7c645e7..559df0b 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2718,6 +2718,17 @@ TEBCresume( PUSH_TAUX_OBJ(objPtr); NEXT_INST_F(1, 0, 0); + case INST_EXPAND_DROP: + /* + * Drops an element of the auxObjList. Does not do any clean up of the + * actual stack. + * + * TODO: POP MAIN STACK BACK TO MARKER + */ + + POP_TAUX_OBJ(); + NEXT_INST_F(1, 0, 0); + case INST_EXPAND_STKTOP: { int i; ptrdiff_t moved; diff --git a/tests/for.test b/tests/for.test index 3f4d2b7..cfba1fe 100644 --- a/tests/for.test +++ b/tests/for.test @@ -854,7 +854,7 @@ test for-7.2 {Bug 3614226: ensure that continue cleans up the stack} memory { expr {$end - $tmp} }} } 0 -test for-7.3 {Bug 3614226: ensure that break cleans up the expansion stack} {memory knownBug} { +test for-7.3 {Bug 3614226: ensure that break cleans up the expansion stack} memory { apply {{} { # Can't use [memtest]; must be careful when we change stack frames set end [meminfo] @@ -868,7 +868,7 @@ test for-7.3 {Bug 3614226: ensure that break cleans up the expansion stack} {mem expr {$end - $tmp} }} } 0 -test for-7.4 {Bug 3614226: ensure that continue cleans up the expansion stack} {memory knownBug} { +test for-7.4 {Bug 3614226: ensure that continue cleans up the expansion stack} memory { apply {{} { # Can't use [memtest]; must be careful when we change stack frames set end [meminfo] -- cgit v0.12 From 312d727024ac9e43d8989d411361cb1d0b50b9b5 Mon Sep 17 00:00:00 2001 From: mig Date: Mon, 3 Jun 2013 16:10:30 +0000 Subject: fix for perf bug detected by Kieran (https://groups.google.com/forum/?fromgroups#!topic/comp.lang.tcl/vfpI3bc-DkQ) --- ChangeLog | 8 ++++++++ generic/tclExecute.c | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0661925..9d5e542 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-06-03 Miguel Sofer + + * generic/tclExecute.c: fix for perf bug detected by Kieran + (https://groups.google.com/forum/?fromgroups#!topic/comp.lang.tcl/vfpI3bc-DkQ), + diagnosed by dgp to be a close relative of [Bug 781585], which was + fixed by commit [f46fb50cb3]. This bug was introduced by myself in + commit [cbfe055d8c]. + 2013-05-28 Harald Oehlmann * library/msgcat/msgcat.tcl: [Bug 3036566]: Also get locale from diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 0de8e3c..8fb8e63 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2424,11 +2424,6 @@ TclExecuteByteCode( if (result == TCL_OK) { Tcl_Obj *objPtr; -#ifndef TCL_COMPILE_DEBUG - if (*(pc+pcAdjustment) == INST_POP) { - NEXT_INST_V((pcAdjustment+1), objc, 0); - } -#endif /* * Push the call's object result and continue execution with * the next instruction. @@ -2455,6 +2450,12 @@ TclExecuteByteCode( TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); iPtr->objResultPtr = objPtr; +#ifndef TCL_COMPILE_DEBUG + if (*(pc+pcAdjustment) == INST_POP) { + TclDecrRefCount(objResultPtr); + NEXT_INST_V((pcAdjustment+1), objc, 0); + } +#endif NEXT_INST_V(pcAdjustment, objc, -1); } else { cleanup = objc; -- cgit v0.12 From 6f640f9e5701a60ac0fbde981742fd3a80f59d18 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 4 Jun 2013 08:33:16 +0000 Subject: Eliminate NO_VIZ macro as current zlib uses HAVE_HIDDEN in stead. One more last-moment fix for FreeBSD by Pietro Cerutti --- ChangeLog | 6 ++++++ unix/configure | 20 ++++++-------------- unix/tcl.m4 | 12 ++---------- unix/tclConfig.h.in | 4 ++-- win/configure | 4 ---- win/configure.in | 1 - 6 files changed, 16 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2a8c44..53bcb80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-06-04 Jan Nijtmans + + * unix/tcl.m4: Eliminate NO_VIZ macro as current + zlib uses HAVE_HIDDEN in stead. One more last-moment + fix for FreeBSD by Pietro Cerutti + 2013-06-03 Miguel Sofer * generic/tclExecute.c: fix for perf bug detected by Kieran diff --git a/unix/configure b/unix/configure index 583cd01..7626343 100755 --- a/unix/configure +++ b/unix/configure @@ -6617,6 +6617,11 @@ cat >>confdefs.h <<\_ACEOF _ACEOF +cat >>confdefs.h <<\_ACEOF +#define HAVE_HIDDEN 1 +_ACEOF + + fi @@ -7827,20 +7832,12 @@ fi fi - case $system in - FreeBSD-3.*) - # FreeBSD-3 doesn't handle version numbers with dots. - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - TCL_LIB_VERSIONS_OK=nodots - ;; - esac ;; FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\$@" + TCL_SHLIB_LD_EXTRAS="-Wl,-soname=\$@" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -9057,11 +9054,6 @@ cat >>confdefs.h <<\_ACEOF _ACEOF -cat >>confdefs.h <<\_ACEOF -#define NO_VIZ -_ACEOF - - fi diff --git a/unix/tcl.m4 b/unix/tcl.m4 index cc7c936..43e2b78 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1067,6 +1067,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_DEFINE(MODULE_SCOPE, [extern __attribute__((__visibility__("hidden")))], [Compiler support for module scope symbols]) + AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols]) ]) ]) @@ -1537,20 +1538,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ]) - case $system in - FreeBSD-3.*) - # FreeBSD-3 doesn't handle version numbers with dots. - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' - TCL_LIB_VERSIONS_OK=nodots - ;; - esac ;; FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" - TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\$[@]" + TCL_SHLIB_LD_EXTRAS="-Wl,-soname=\$[@]" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -2048,7 +2041,6 @@ dnl # preprocessing tests use only CPPFLAGS. AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ AC_DEFINE(MODULE_SCOPE, [extern], [No Compiler support for module scope symbols]) - AC_DEFINE(NO_VIZ, [], [No visibility attribute]) ]) AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [ diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 839c2ab..23d6026 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -343,8 +343,8 @@ /* Do we have ? */ #undef NO_VALUES_H -/* No visibility attribute */ -#undef NO_VIZ +/* Compiler support for module scope symbols */ +#undef HAVE_HIDDEN /* Do we have wait3() */ #undef NO_WAIT3 diff --git a/win/configure b/win/configure index 0b07e9f..bad344c 100755 --- a/win/configure +++ b/win/configure @@ -4377,10 +4377,6 @@ else ZLIB_OBJS=\${ZLIB_OBJS} - cat >>confdefs.h <<_ACEOF -#define NO_VIZ 1 -_ACEOF - fi diff --git a/win/configure.in b/win/configure.in index b0c007a..574fce2 100644 --- a/win/configure.in +++ b/win/configure.in @@ -135,7 +135,6 @@ AS_IF([test "$tcl_ok" = "yes"], [ ]) ], [ AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}]) - AC_DEFINE_UNQUOTED(NO_VIZ, 1) ]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) -- cgit v0.12 From e2aebdd0bfef45036c0e1242c55efd86773ecca4 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2013 07:19:02 +0000 Subject: Stack cleanup works now even in the most evil expansion cases. --- generic/tclAssembly.c | 2 +- generic/tclCompCmds.c | 62 ++++++----------------------- generic/tclCompile.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++-- generic/tclCompile.h | 7 ++++ generic/tclExecute.c | 11 ++--- tests/for.test | 30 ++++++++++++++ 6 files changed, 160 insertions(+), 60 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index d1af8c6..62641e6 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -20,7 +20,7 @@ *- break and continue - if exception ranges can be sorted out. *- foreach_start4, foreach_step4 *- returnImm, returnStk - *- expandStart, expandStkTop, invokeExpanded + *- expandStart, expandStkTop, invokeExpanded, expandDrop *- dictFirst, dictNext, dictDone *- dictUpdateStart, dictUpdateEnd *- jumpTable testing diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 3d6abcf..365e647 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -493,40 +493,21 @@ TclCompileBreakCmd( rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_BREAK, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop; - - /* - * Ditch the extra elements from the auxiliary stack. - */ - - toPop = envPtr->expandCount - auxPtr->expandTarget; - while (toPop > 0) { - TclEmitOpcode(INST_EXPAND_DROP, envPtr); - toPop--; - } - - /* - * Pop off the extra stack frames. - */ - - toPop = envPtr->currStackDepth - auxPtr->stackDepth; - while (toPop > 0) { - TclEmitOpcode(INST_POP, envPtr); - TclAdjustStackDepth(1, envPtr); - toPop--; - } - /* * Found the target! No need for a nasty INST_BREAK here. */ + TclCleanupStackForBreakContinue(envPtr, auxPtr); TclAddLoopBreakFixup(envPtr, auxPtr); } else { /* - * Emit a break instruction. + * Emit a real break. */ - TclEmitOpcode(INST_BREAK, envPtr); + PushStringLiteral(envPtr, ""); + TclEmitOpcode(INST_DUP, envPtr); + TclEmitInstInt4(INST_RETURN_IMM, TCL_BREAK, envPtr); + TclEmitInt4(0, envPtr); } /* @@ -846,40 +827,21 @@ TclCompileContinueCmd( rangePtr = TclGetInnermostExceptionRange(envPtr, TCL_CONTINUE, &auxPtr); if (rangePtr && rangePtr->type == LOOP_EXCEPTION_RANGE) { - int toPop; - - /* - * Ditch the extra elements from the auxiliary stack. - */ - - toPop = envPtr->expandCount - auxPtr->expandTarget; - while (toPop > 0) { - TclEmitOpcode(INST_EXPAND_DROP, envPtr); - toPop--; - } - - /* - * Pop off the extra stack frames. - */ - - toPop = envPtr->currStackDepth - auxPtr->stackDepth; - while (toPop > 0) { - TclEmitOpcode(INST_POP, envPtr); - TclAdjustStackDepth(1, envPtr); - toPop--; - } - /* * Found the target! No need for a nasty INST_CONTINUE here. */ + TclCleanupStackForBreakContinue(envPtr, auxPtr); TclAddLoopContinueFixup(envPtr, auxPtr); } else { /* - * Emit a continue instruction. + * Emit a real continue. */ - TclEmitOpcode(INST_CONTINUE, envPtr); + PushStringLiteral(envPtr, ""); + TclEmitOpcode(INST_DUP, envPtr); + TclEmitInstInt4(INST_RETURN_IMM, TCL_CONTINUE, envPtr); + TclEmitInt4(0, envPtr); } /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index f8dd504..69517bc 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -541,7 +541,8 @@ InstructionDesc const tclInstructionTable[] = { * Stack: ... list1 list2 => ... [lconcat list1 list2] */ {"expandDrop", 1, 0, 0, {OPERAND_NONE}}, - /* Drops an element from the auxiliary stack. */ + /* Drops an element from the auxiliary stack, popping stack elements + * until the matching stack depth is reached. */ {NULL, 0, 0, 0, {OPERAND_NONE}} }; @@ -574,6 +575,7 @@ static void RecordByteCodeStats(ByteCode *codePtr); static void RegisterAuxDataType(const AuxDataType *typePtr); static int SetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +static void StartExpanding(CompileEnv *envPtr); static int FormatInstruction(ByteCode *codePtr, const unsigned char *pc, Tcl_Obj *bufferObj); static void PrintSourceToObj(Tcl_Obj *appendObj, @@ -2063,8 +2065,7 @@ TclCompileScript( */ if (expand) { - TclEmitOpcode(INST_EXPAND_START, envPtr); - envPtr->expandCount++; + StartExpanding(envPtr); } /* @@ -3469,6 +3470,7 @@ TclCreateExceptRange( auxPtr->supportsContinue = 1; auxPtr->stackDepth = envPtr->currStackDepth; auxPtr->expandTarget = envPtr->expandCount; + auxPtr->expandTargetDepth = -1; auxPtr->numBreakTargets = 0; auxPtr->breakTargets = NULL; auxPtr->allocBreakTargets = 0; @@ -3589,6 +3591,103 @@ TclAddLoopContinueFixup( /* * --------------------------------------------------------------------- * + * TclCleanupStackForBreakContinue -- + * + * Ditch the extra elements from the auxiliary stack and the main + * stack. How to do this exactly depends on whether there are any + * elements on the auxiliary stack to pop. + * + * --------------------------------------------------------------------- + */ + +void +TclCleanupStackForBreakContinue( + CompileEnv *envPtr, + ExceptionAux *auxPtr) +{ + int toPop = envPtr->expandCount - auxPtr->expandTarget; + + if (toPop > 0) { + while (toPop > 0) { + TclEmitOpcode(INST_EXPAND_DROP, envPtr); + toPop--; + } + toPop = auxPtr->expandTargetDepth - auxPtr->stackDepth; + while (toPop > 0) { + TclEmitOpcode(INST_POP, envPtr); + TclAdjustStackDepth(1, envPtr); + toPop--; + } + } else { + toPop = envPtr->currStackDepth - auxPtr->stackDepth; + while (toPop > 0) { + TclEmitOpcode(INST_POP, envPtr); + TclAdjustStackDepth(1, envPtr); + toPop--; + } + } +} + +/* + * --------------------------------------------------------------------- + * + * StartExpanding -- + * + * Pushes an INST_EXPAND_START and does some additional housekeeping so + * that the [break] and [continue] compilers can use an exception-free + * issue to discard it. + * + * --------------------------------------------------------------------- + */ + +static void +StartExpanding( + CompileEnv *envPtr) +{ + int i; + + TclEmitOpcode(INST_EXPAND_START, envPtr); + + /* + * Update inner exception ranges with information about the environment + * where this expansion started. + */ + + for (i=0 ; iexceptArrayNext ; i++) { + ExceptionRange *rangePtr = &envPtr->exceptArrayPtr[i]; + ExceptionAux *auxPtr = &envPtr->exceptAuxArrayPtr[i]; + + /* + * Ignore loops unless they're still being built. + */ + + if (rangePtr->codeOffset > CurrentOffset(envPtr)) { + continue; + } + if (rangePtr->numCodeBytes != -1) { + continue; + } + + /* + * Adequate condition: further out loops and further in exceptions + * don't actually need this information. + */ + + if (auxPtr->expandTarget == envPtr->expandCount) { + auxPtr->expandTargetDepth = envPtr->currStackDepth; + } + } + + /* + * There's now one more expansion being processed on the auxiliary stack. + */ + + envPtr->expandCount++; +} + +/* + * --------------------------------------------------------------------- + * * TclFinalizeLoopExceptionRange -- * * Finalizes a loop exception range, binding the registered [break] and @@ -3629,7 +3728,8 @@ TclFinalizeLoopExceptionRange( int j; /* - * WTF? Can't bind, so revert to an INST_CONTINUE. + * WTF? Can't bind, so revert to an INST_CONTINUE. Not enough + * space to do anything else. */ *site = INST_CONTINUE; diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 75de025..15b5477 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -120,6 +120,11 @@ typedef struct ExceptionAux { * we can't currently discard them except by * doing INST_INVOKE_EXPANDED; this is a known * problem. */ + int expandTargetDepth; /* The stack depth expected at the outermost + * expansion within the loop. Not meaningful + * if there have are no open expansions + * between the looping level and the point of + * jump issue. */ int numBreakTargets; /* The number of [break]s that want to be * targeted to the place where this loop * exception will be bound to. */ @@ -987,6 +992,8 @@ MODULE_SCOPE ByteCode * TclCompileObj(Tcl_Interp *interp, Tcl_Obj *objPtr, */ MODULE_SCOPE void TclCleanupByteCode(ByteCode *codePtr); +MODULE_SCOPE void TclCleanupStackForBreakContinue(CompileEnv *envPtr, + ExceptionAux *auxPtr); MODULE_SCOPE void TclCompileCmdWord(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, CompileEnv *envPtr); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 559df0b..fc50a74 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2720,14 +2720,15 @@ TEBCresume( case INST_EXPAND_DROP: /* - * Drops an element of the auxObjList. Does not do any clean up of the - * actual stack. - * - * TODO: POP MAIN STACK BACK TO MARKER + * Drops an element of the auxObjList, popping stack elements to + * restore the stack to the state before the point where the aux + * element was created. */ + CLANG_ASSERT(auxObjList); + objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value; POP_TAUX_OBJ(); - NEXT_INST_F(1, 0, 0); + NEXT_INST_V(1, objc, 0); case INST_EXPAND_STKTOP: { int i; diff --git a/tests/for.test b/tests/for.test index cfba1fe..c5803ee 100644 --- a/tests/for.test +++ b/tests/for.test @@ -882,6 +882,36 @@ test for-7.4 {Bug 3614226: ensure that continue cleans up the expansion stack} m expr {$end - $tmp} }} } 0 +test for-7.5 {Bug 3614226: ensure that break cleans up the expansion stack} memory { + apply {{} { + set l [lrepeat 50 p q r] + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + for {set x 0} {[incr x]<50} {} { + puts [puts {*}$l {*}[puts a b c {*}$l {*}[break] d e f]] + } + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 +test for-7.6 {Bug 3614226: ensure that continue cleans up the expansion stack} memory { + apply {{} { + set l [lrepeat 50 p q r] + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + for {set x 0} {[incr x]<50} {} { + puts [puts {*}$l {*}[puts a b c {*}$l {*}[continue] d e f]] + } + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 4d139bcdd3359f4e4d35db3d5fce67c6b528532c Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2013 07:51:06 +0000 Subject: Even better tests --- tests/for.test | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/tests/for.test b/tests/for.test index c5803ee..8936682 100644 --- a/tests/for.test +++ b/tests/for.test @@ -882,7 +882,7 @@ test for-7.4 {Bug 3614226: ensure that continue cleans up the expansion stack} m expr {$end - $tmp} }} } 0 -test for-7.5 {Bug 3614226: ensure that break cleans up the expansion stack} memory { +test for-7.5 {Bug 3614226: ensure that break cleans up the combination of main and expansion stack} memory { apply {{} { set l [lrepeat 50 p q r] # Can't use [memtest]; must be careful when we change stack frames @@ -897,7 +897,7 @@ test for-7.5 {Bug 3614226: ensure that break cleans up the expansion stack} memo expr {$end - $tmp} }} } 0 -test for-7.6 {Bug 3614226: ensure that continue cleans up the expansion stack} memory { +test for-7.6 {Bug 3614226: ensure that continue cleans up the combination of main and expansion stack} memory { apply {{} { set l [lrepeat 50 p q r] # Can't use [memtest]; must be careful when we change stack frames @@ -912,6 +912,36 @@ test for-7.6 {Bug 3614226: ensure that continue cleans up the expansion stack} m expr {$end - $tmp} }} } 0 +test for-7.7 {Bug 3614226: ensure that break only cleans up the right amount} memory { + apply {{} { + set l [lrepeat 50 p q r] + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + unset -nocomplain {*}[for {set x 0} {[incr x]<50} {} { + puts [puts {*}$l {*}[puts a b c {*}$l {*}[break] d e f]] + }] + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 +test for-7.8 {Bug 3614226: ensure that continue only cleans up the right amount} memory { + apply {{} { + set l [lrepeat 50 p q r] + # Can't use [memtest]; must be careful when we change stack frames + set end [meminfo] + for {set i 0} {$i < 5} {incr i} { + unset -nocomplain {*}[for {set x 0} {[incr x]<50} {} { + puts [puts {*}$l {*}[puts a b c {*}$l {*}[continue] d e f]] + }] + set tmp $end + set end [meminfo] + } + expr {$end - $tmp} + }} +} 0 # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 64edc0ede7a6c7770bc5f152e97aa48674ed6682 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2013 12:34:21 +0000 Subject: More cleaning up; factor out optimizer to new file. Some weird problems still. --- generic/tclCompCmds.c | 30 +++++---- generic/tclCompile.c | 174 +------------------------------------------------- generic/tclCompile.h | 1 + unix/Makefile.in | 6 +- win/Makefile.in | 1 + win/makefile.bc | 1 + win/makefile.vc | 1 + 7 files changed, 26 insertions(+), 188 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 365e647..8cb5fcd 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -499,6 +499,13 @@ TclCompileBreakCmd( TclCleanupStackForBreakContinue(envPtr, auxPtr); TclAddLoopBreakFixup(envPtr, auxPtr); + + /* + * Instructions that raise exceptions don't really have to follow the + * usual stack management rules, but the cleanup code does. + */ + + TclAdjustStackDepth(1, envPtr); } else { /* * Emit a real break. @@ -510,12 +517,6 @@ TclCompileBreakCmd( TclEmitInt4(0, envPtr); } - /* - * Instructions that raise exceptions don't really have to follow the - * usual stack management rules, but the cleanup code does. - */ - - TclAdjustStackDepth(1, envPtr); return TCL_OK; } @@ -833,6 +834,13 @@ TclCompileContinueCmd( TclCleanupStackForBreakContinue(envPtr, auxPtr); TclAddLoopContinueFixup(envPtr, auxPtr); + + /* + * Instructions that raise exceptions don't really have to follow the + * usual stack management rules, but the cleanup code does. + */ + + TclAdjustStackDepth(1, envPtr); } else { /* * Emit a real continue. @@ -844,12 +852,6 @@ TclCompileContinueCmd( TclEmitInt4(0, envPtr); } - /* - * Instructions that raise exceptions don't really have to follow the - * usual stack management rules, but the cleanup code does. - */ - - TclAdjustStackDepth(1, envPtr); return TCL_OK; } @@ -2121,10 +2123,10 @@ TclCompileDictWithCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - envPtr->currStackDepth++; + //envPtr->currStackDepth++; SetLineInformation(parsePtr->numWords-1); CompileBody(envPtr, tokenPtr, interp); - envPtr->currStackDepth = savedStackDepth; + //envPtr->currStackDepth = savedStackDepth; ExceptionRangeEnds(envPtr, range); /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 69517bc..4a989c7 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -568,7 +568,6 @@ static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); static int IsCompactibleCompileEnv(Tcl_Interp *interp, CompileEnv *envPtr); -static void PeepholeOptimize(CompileEnv *envPtr); #ifdef TCL_COMPILE_STATS static void RecordByteCodeStats(ByteCode *codePtr); #endif /* TCL_COMPILE_STATS */ @@ -760,7 +759,7 @@ TclSetByteCodeFromAny( * instruction generator boundaries. */ - PeepholeOptimize(&compEnv); + TclOptimizeBytecode(&compEnv); /* * Invoke the compilation hook procedure if one exists. @@ -1102,177 +1101,6 @@ IsCompactibleCompileEnv( } /* - * ---------------------------------------------------------------------- - * - * PeepholeOptimize -- - * - * A very simple peephole optimizer for bytecode. - * - * ---------------------------------------------------------------------- - */ - -static void -PeepholeOptimize( - CompileEnv *envPtr) -{ - unsigned char *pc, *prev1 = NULL, *prev2 = NULL, *target; - int size, isNew; - Tcl_HashTable targets; - Tcl_HashEntry *hPtr; - Tcl_HashSearch hSearch; - - /* - * Find places where we should be careful about replacing instructions - * because they are the targets of various types of jumps. - */ - - Tcl_InitHashTable(&targets, TCL_ONE_WORD_KEYS); - for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { - size = tclInstructionTable[*pc].numBytes; - switch (*pc) { - case INST_JUMP1: - case INST_JUMP_TRUE1: - case INST_JUMP_FALSE1: - target = pc + TclGetInt1AtPtr(pc+1); - goto storeTarget; - case INST_JUMP4: - case INST_JUMP_TRUE4: - case INST_JUMP_FALSE4: - target = pc + TclGetInt4AtPtr(pc+1); - goto storeTarget; - case INST_BEGIN_CATCH4: - target = envPtr->codeStart + envPtr->exceptArrayPtr[ - TclGetUInt4AtPtr(pc+1)].codeOffset; - storeTarget: - (void) Tcl_CreateHashEntry(&targets, (void *) target, &isNew); - break; - case INST_JUMP_TABLE: - hPtr = Tcl_FirstHashEntry( - &JUMPTABLEINFO(envPtr, pc+1)->hashTable, &hSearch); - for (; hPtr ; hPtr = Tcl_NextHashEntry(&hSearch)) { - target = pc + PTR2INT(Tcl_GetHashValue(hPtr)); - (void) Tcl_CreateHashEntry(&targets, (void *) target, &isNew); - } - break; - case INST_START_CMD: - assert (envPtr->atCmdStart < 2); - } - } - - /* - * Replace PUSH/POP sequences (when non-hazardous) with NOPs. Also replace - * PUSH empty/CONCAT and TRY_CVT_NUMERIC (when followed by an operation - * that guarantees the check for arithmeticity). - */ - - (void) Tcl_CreateHashEntry(&targets, (void *) pc, &isNew); - for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { - int blank = 0, i, inst; - - size = tclInstructionTable[*pc].numBytes; - prev2 = prev1; - prev1 = pc; - while (*(pc+size) == INST_NOP) { - if (Tcl_FindHashEntry(&targets, (void *) (pc + size))) { - break; - } - size += tclInstructionTable[INST_NOP].numBytes; - } - if (Tcl_FindHashEntry(&targets, (void *) (pc + size))) { - continue; - } - inst = *(pc + size); - switch (*pc) { - case INST_PUSH1: - if (inst == INST_POP) { - blank = size + tclInstructionTable[inst].numBytes; - } else if (inst == INST_CONCAT1 - && TclGetUInt1AtPtr(pc + size + 1) == 2) { - Tcl_Obj *litPtr = TclFetchLiteral(envPtr, - TclGetUInt1AtPtr(pc + 1)); - int numBytes; - - (void) Tcl_GetStringFromObj(litPtr, &numBytes); - if (numBytes == 0) { - blank = size + tclInstructionTable[inst].numBytes; - } - } - break; - case INST_PUSH4: - if (inst == INST_POP) { - blank = size + 1; - } else if (inst == INST_CONCAT1 - && TclGetUInt1AtPtr(pc + size + 1) == 2) { - Tcl_Obj *litPtr = TclFetchLiteral(envPtr, - TclGetUInt4AtPtr(pc + 1)); - int numBytes; - - (void) Tcl_GetStringFromObj(litPtr, &numBytes); - if (numBytes == 0) { - blank = size + tclInstructionTable[inst].numBytes; - } - } - break; - case INST_TRY_CVT_TO_NUMERIC: - switch (inst) { - case INST_JUMP_TRUE1: - case INST_JUMP_TRUE4: - case INST_JUMP_FALSE1: - case INST_JUMP_FALSE4: - case INST_INCR_SCALAR1: - case INST_INCR_ARRAY1: - case INST_INCR_ARRAY_STK: - case INST_INCR_SCALAR_STK: - case INST_INCR_STK: - case INST_LOR: - case INST_LAND: - case INST_EQ: - case INST_NEQ: - case INST_LT: - case INST_LE: - case INST_GT: - case INST_GE: - case INST_MOD: - case INST_LSHIFT: - case INST_RSHIFT: - case INST_BITOR: - case INST_BITXOR: - case INST_BITAND: - case INST_EXPON: - case INST_ADD: - case INST_SUB: - case INST_DIV: - case INST_MULT: - case INST_LNOT: - case INST_BITNOT: - case INST_UMINUS: - case INST_UPLUS: - case INST_TRY_CVT_TO_NUMERIC: - blank = size; - break; - } - break; - } - if (blank > 0) { - for (i=0 ; icodeNext--; - } - Tcl_DeleteHashTable(&targets); -} - -/* *---------------------------------------------------------------------- * * Tcl_SubstObj -- diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 15b5477..fdb281b 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1060,6 +1060,7 @@ MODULE_SCOPE void TclFinalizeLoopExceptionRange(CompileEnv *envPtr, MODULE_SCOPE char * TclLiteralStats(LiteralTable *tablePtr); MODULE_SCOPE int TclLog2(int value); #endif +MODULE_SCOPE void TclOptimizeBytecode(CompileEnv *envPtr); #ifdef TCL_COMPILE_DEBUG MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp, Tcl_Obj *objPtr); diff --git a/unix/Makefile.in b/unix/Makefile.in index 9bf8b43..3e4a6f6 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -301,7 +301,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclIORChan.o tclIORTrans.o tclIOGT.o tclIOSock.o tclIOUtil.o \ tclLink.o tclListObj.o \ tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \ - tclObj.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o \ + tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o \ tclPkg.o tclPkgConfig.o tclPosixStr.o \ tclPreserve.o tclProc.o tclRegexp.o \ tclResolve.o tclResult.o tclScan.o tclStringObj.o \ @@ -429,6 +429,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclNamesp.c \ $(GENERIC_DIR)/tclNotify.c \ $(GENERIC_DIR)/tclObj.c \ + $(GENERIC_DIR)/tclOptimize.c \ $(GENERIC_DIR)/tclParse.c \ $(GENERIC_DIR)/tclPathObj.c \ $(GENERIC_DIR)/tclPipe.c \ @@ -1165,6 +1166,9 @@ tclLiteral.o: $(GENERIC_DIR)/tclLiteral.c $(COMPILEHDR) tclObj.o: $(GENERIC_DIR)/tclObj.c $(COMPILEHDR) $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclObj.c +tclOptimize.o: $(GENERIC_DIR)/tclOptimize.c $(COMPILEHDR) + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclOptimize.c + tclLoad.o: $(GENERIC_DIR)/tclLoad.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclLoad.c diff --git a/win/Makefile.in b/win/Makefile.in index 047b0b5..18993fe 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -267,6 +267,7 @@ GENERIC_OBJS = \ tclOOMethod.$(OBJEXT) \ tclOOStubInit.$(OBJEXT) \ tclObj.$(OBJEXT) \ + tclOptimize.$(OBJEXT) \ tclPanic.$(OBJEXT) \ tclParse.$(OBJEXT) \ tclPathObj.$(OBJEXT) \ diff --git a/win/makefile.bc b/win/makefile.bc index d148513..0b17cea 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -239,6 +239,7 @@ TCLOBJS = \ $(TMPDIR)\tclOOMethod.obj \ $(TMPDIR)\tclOOStubInit.obj \ $(TMPDIR)\tclObj.obj \ + $(TMPDIR)\tclOptimize.obj \ $(TMPDIR)\tclPanic.obj \ $(TMPDIR)\tclParse.obj \ $(TMPDIR)\tclPipe.obj \ diff --git a/win/makefile.vc b/win/makefile.vc index 95d3a9d..cddb253 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -316,6 +316,7 @@ COREOBJS = \ $(TMP_DIR)\tclOOMethod.obj \ $(TMP_DIR)\tclOOStubInit.obj \ $(TMP_DIR)\tclObj.obj \ + $(TMP_DIR)\tclOptimize.obj \ $(TMP_DIR)\tclPanic.obj \ $(TMP_DIR)\tclParse.obj \ $(TMP_DIR)\tclPathObj.obj \ -- cgit v0.12 From e8976518be1b4f26d965c08e0229d31ed7bcb101 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 5 Jun 2013 14:50:39 +0000 Subject: Stack Depth fixups. --- generic/tclCompCmds.c | 14 ++------------ generic/tclExecute.c | 2 ++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 365e647..10a789e 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -499,6 +499,7 @@ TclCompileBreakCmd( TclCleanupStackForBreakContinue(envPtr, auxPtr); TclAddLoopBreakFixup(envPtr, auxPtr); + TclAdjustStackDepth(1, envPtr); } else { /* * Emit a real break. @@ -510,12 +511,6 @@ TclCompileBreakCmd( TclEmitInt4(0, envPtr); } - /* - * Instructions that raise exceptions don't really have to follow the - * usual stack management rules, but the cleanup code does. - */ - - TclAdjustStackDepth(1, envPtr); return TCL_OK; } @@ -833,6 +828,7 @@ TclCompileContinueCmd( TclCleanupStackForBreakContinue(envPtr, auxPtr); TclAddLoopContinueFixup(envPtr, auxPtr); + TclAdjustStackDepth(1, envPtr); } else { /* * Emit a real continue. @@ -844,12 +840,6 @@ TclCompileContinueCmd( TclEmitInt4(0, envPtr); } - /* - * Instructions that raise exceptions don't really have to follow the - * usual stack management rules, but the cleanup code does. - */ - - TclAdjustStackDepth(1, envPtr); return TCL_OK; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 98ce51e..6ee3cae 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2728,6 +2728,8 @@ TEBCresume( CLANG_ASSERT(auxObjList); objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value; POP_TAUX_OBJ(); + /* Ugly abuse! */ + starting = 1; NEXT_INST_V(1, objc, 0); case INST_EXPAND_STKTOP: { -- cgit v0.12 From ad80ea28de240aaa62b0140e919648ac3081d54f Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 5 Jun 2013 15:07:40 +0000 Subject: Repair TCL_COMPILE_DEBUG guards --- generic/tclExecute.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 6ee3cae..443fb85 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -257,7 +257,7 @@ VarHashCreateVar( /* Verify the stack depth, only when no expansion is in progress */ -#if TCL_COMPILE_DEBUG +#ifdef TCL_COMPILE_DEBUG #define CHECK_STACK() \ do { \ ValidatePcAndStackTop(codePtr, pc, CURR_DEPTH, \ @@ -2630,7 +2630,7 @@ TEBCresume( Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } -#if !TCL_COMPILE_DEBUG +#ifndef TCL_COMPILE_DEBUG if (bytes != tclEmptyStringRep && !Tcl_IsShared(objResultPtr)) { TclFreeIntRep(objResultPtr); objResultPtr->bytes = ckrealloc(bytes, length+appendLen+1); @@ -2666,7 +2666,7 @@ TEBCresume( Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } -#if !TCL_COMPILE_DEBUG +#ifndef TCL_COMPILE_DEBUG if (!Tcl_IsShared(objResultPtr)) { bytes = (char *) Tcl_SetByteArrayLength(objResultPtr, length + appendLen); @@ -2728,8 +2728,10 @@ TEBCresume( CLANG_ASSERT(auxObjList); objc = CURR_DEPTH - auxObjList->internalRep.ptrAndLongRep.value; POP_TAUX_OBJ(); +#ifdef TCL_COMPILE_DEBUG /* Ugly abuse! */ starting = 1; +#endif NEXT_INST_V(1, objc, 0); case INST_EXPAND_STKTOP: { @@ -6838,7 +6840,7 @@ TEBCresume( */ processExceptionReturn: -#if TCL_COMPILE_DEBUG +#ifdef TCL_COMPILE_DEBUG switch (*pc) { case INST_INVOKE_STK1: opnd = TclGetUInt1AtPtr(pc+1); @@ -6895,7 +6897,7 @@ TEBCresume( rangePtr->codeOffset, rangePtr->continueOffset)); NEXT_INST_F(0, 0, 0); } -#if TCL_COMPILE_DEBUG +#ifdef TCL_COMPILE_DEBUG if (traceInstructions) { objPtr = Tcl_GetObjResult(interp); if ((result != TCL_ERROR) && (result != TCL_RETURN)) { -- cgit v0.12 From 24d2ee6791fc464e86c2aecbd60376628796af06 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2013 20:55:29 +0000 Subject: Corrected wrong information about instruction width that was causing an optimizer crash. --- generic/tclCompile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 4a989c7..572f660 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -431,7 +431,7 @@ InstructionDesc const tclInstructionTable[] = { /* Map variable contents back into a dictionary in a variable. Part of * [dict with]. * Stack: ... dictVarName path keyList => ... */ - {"dictRecombineImm", 1, -2, 1, {OPERAND_LVT4}}, + {"dictRecombineImm", 5, -2, 1, {OPERAND_LVT4}}, /* Map variable contents back into a dictionary in the local variable * indicated by the LVT index. Part of [dict with]. * Stack: ... path keyList => ... */ -- cgit v0.12 From 38cbf3feb975cb1a1a9bffc69cf773f4f2d2c11c Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2013 21:05:41 +0000 Subject: Added the optimizer... --- generic/tclOptimize.c | 287 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100644 generic/tclOptimize.c diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c new file mode 100644 index 0000000..18dc208 --- /dev/null +++ b/generic/tclOptimize.c @@ -0,0 +1,287 @@ +/* + * tclOptimize.c -- + * + * This file contains the bytecode optimizer. + * + * Copyright (c) 2013 by Donal Fellows. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclCompile.h" +#include + +#define DefineTargetAddress(tablePtr, address) \ + ((void) Tcl_CreateHashEntry((tablePtr), (void *) (address), &isNew)) +#define IsTargetAddress(tablePtr, address) \ + (Tcl_FindHashEntry((tablePtr), (void *) (address)) != NULL) + +static void +LocateTargetAddresses( + CompileEnv *envPtr, + Tcl_HashTable *tablePtr) +{ + unsigned char *pc, *target; + int size, isNew, i; + Tcl_HashEntry *hPtr; + Tcl_HashSearch hSearch; + + Tcl_InitHashTable(tablePtr, TCL_ONE_WORD_KEYS); + + /* + * The starts of commands represent target addresses. + */ + + for (i=0 ; inumCommands ; i++) { + DefineTargetAddress(tablePtr, + envPtr->codeStart + envPtr->cmdMapPtr[i].codeOffset); + } + + /* + * Find places where we should be careful about replacing instructions + * because they are the targets of various types of jumps. + */ + + for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { + size = tclInstructionTable[*pc].numBytes; + switch (*pc) { + case INST_JUMP1: + case INST_JUMP_TRUE1: + case INST_JUMP_FALSE1: + target = pc + TclGetInt1AtPtr(pc+1); + goto storeTarget; + case INST_JUMP4: + case INST_JUMP_TRUE4: + case INST_JUMP_FALSE4: + target = pc + TclGetInt4AtPtr(pc+1); + goto storeTarget; + case INST_BEGIN_CATCH4: + target = envPtr->codeStart + envPtr->exceptArrayPtr[ + TclGetUInt4AtPtr(pc+1)].codeOffset; + storeTarget: + DefineTargetAddress(tablePtr, target); + break; + case INST_JUMP_TABLE: + hPtr = Tcl_FirstHashEntry( + &JUMPTABLEINFO(envPtr, pc+1)->hashTable, &hSearch); + for (; hPtr ; hPtr = Tcl_NextHashEntry(&hSearch)) { + target = pc + PTR2INT(Tcl_GetHashValue(hPtr)); + DefineTargetAddress(tablePtr, target); + } + break; + case INST_RETURN_CODE_BRANCH: + for (i=TCL_ERROR ; iatCmdStart < 2); + } + } + + /* + * Add a marker *after* the last bytecode instruction. WARNING: points to + * one past the end! + */ + + DefineTargetAddress(tablePtr, pc); + + /* + * Enter in the targets of exception ranges. + */ + + for (i=0 ; iexceptArrayNext ; i++) { + ExceptionRange *rangePtr = &envPtr->exceptArrayPtr[i]; + + if (rangePtr->type == CATCH_EXCEPTION_RANGE) { + target = envPtr->codeStart + rangePtr->catchOffset; + DefineTargetAddress(tablePtr, target); + } else { + target = envPtr->codeStart + rangePtr->breakOffset; + DefineTargetAddress(tablePtr, target); + if (rangePtr->continueOffset >= 0) { + target = envPtr->codeStart + rangePtr->continueOffset; + DefineTargetAddress(tablePtr, target); + } + } + } +} + +/* + * ---------------------------------------------------------------------- + * + * TclOptimizeBytecode -- + * + * A very simple peephole optimizer for bytecode. + * + * ---------------------------------------------------------------------- + */ + +void +TclOptimizeBytecode( + CompileEnv *envPtr) +{ + unsigned char *pc; + int size; + Tcl_HashTable targets; + + /* + * Replace PUSH/POP sequences (when non-hazardous) with NOPs. Also replace + * PUSH empty/CONCAT and TRY_CVT_NUMERIC (when followed by an operation + * that guarantees the check for arithmeticity) and eliminate LNOT when we + * can invert the following JUMP condition. + */ + + LocateTargetAddresses(envPtr, &targets); + for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { + int blank = 0, i, inst; + + size = tclInstructionTable[*pc].numBytes; + while (*(pc+size) == INST_NOP) { + if (IsTargetAddress(&targets, pc + size)) { + break; + } + size += tclInstructionTable[INST_NOP].numBytes; + } + if (IsTargetAddress(&targets, pc + size)) { + continue; + } + inst = *(pc + size); + switch (*pc) { + case INST_PUSH1: + if (inst == INST_POP) { + blank = size + tclInstructionTable[inst].numBytes; + } else if (inst == INST_CONCAT1 + && TclGetUInt1AtPtr(pc + size + 1) == 2) { + Tcl_Obj *litPtr = TclFetchLiteral(envPtr, + TclGetUInt1AtPtr(pc + 1)); + int numBytes; + + (void) Tcl_GetStringFromObj(litPtr, &numBytes); + if (numBytes == 0) { + blank = size + tclInstructionTable[inst].numBytes; + } + } + break; + case INST_PUSH4: + if (inst == INST_POP) { + blank = size + 1; + } else if (inst == INST_CONCAT1 + && TclGetUInt1AtPtr(pc + size + 1) == 2) { + Tcl_Obj *litPtr = TclFetchLiteral(envPtr, + TclGetUInt4AtPtr(pc + 1)); + int numBytes; + + (void) Tcl_GetStringFromObj(litPtr, &numBytes); + if (numBytes == 0) { + blank = size + tclInstructionTable[inst].numBytes; + } + } + break; + case INST_LNOT: + switch (inst) { + case INST_JUMP_TRUE1: + blank = size; + *(pc + size) = INST_JUMP_FALSE1; + break; + case INST_JUMP_FALSE1: + blank = size; + *(pc + size) = INST_JUMP_TRUE1; + break; + case INST_JUMP_TRUE4: + blank = size; + *(pc + size) = INST_JUMP_FALSE4; + break; + case INST_JUMP_FALSE4: + blank = size; + *(pc + size) = INST_JUMP_TRUE4; + break; + } + break; + case INST_TRY_CVT_TO_NUMERIC: + switch (inst) { + case INST_JUMP_TRUE1: + case INST_JUMP_TRUE4: + case INST_JUMP_FALSE1: + case INST_JUMP_FALSE4: + case INST_INCR_SCALAR1: + case INST_INCR_ARRAY1: + case INST_INCR_ARRAY_STK: + case INST_INCR_SCALAR_STK: + case INST_INCR_STK: + case INST_LOR: + case INST_LAND: + case INST_EQ: + case INST_NEQ: + case INST_LT: + case INST_LE: + case INST_GT: + case INST_GE: + case INST_MOD: + case INST_LSHIFT: + case INST_RSHIFT: + case INST_BITOR: + case INST_BITXOR: + case INST_BITAND: + case INST_EXPON: + case INST_ADD: + case INST_SUB: + case INST_DIV: + case INST_MULT: + case INST_LNOT: + case INST_BITNOT: + case INST_UMINUS: + case INST_UPLUS: + case INST_TRY_CVT_TO_NUMERIC: + blank = size; + break; + } + break; + } + if (blank > 0) { + for (i=0 ; icodeStart ; pc < envPtr->codeNext-1 ; pc += size) { + int clear = 0; + + size = tclInstructionTable[*pc].numBytes; + if (*pc != INST_DONE) { + continue; + } + assert (size == 1); + while (!IsTargetAddress(&targets, pc + 1 + clear)) { + clear += tclInstructionTable[*(pc + 1 + clear)].numBytes; + } + if (pc + 1 + clear == envPtr->codeNext) { + envPtr->codeNext -= clear; + } else { + while (clear --> 0) { + *(pc + 1 + clear) = INST_NOP; + } + } + } + + Tcl_DeleteHashTable(&targets); +} + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * tab-width: 8 + * End: + */ -- cgit v0.12 From 7759a4f4afa6448af2ba2495a40816b70683748d Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 5 Jun 2013 23:05:58 +0000 Subject: Added optimizing of jump-to-nop and jump-to-jump cases. Ta to AK for suggesting. --- generic/tclOptimize.c | 209 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 152 insertions(+), 57 deletions(-) diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c index 18dc208..3e0d351 100644 --- a/generic/tclOptimize.c +++ b/generic/tclOptimize.c @@ -13,18 +13,45 @@ #include "tclCompile.h" #include +/* + * Forward declarations. + */ + +static void LocateTargetAddresses(CompileEnv *envPtr, + Tcl_HashTable *tablePtr); + +/* + * Helper macros. + */ + #define DefineTargetAddress(tablePtr, address) \ ((void) Tcl_CreateHashEntry((tablePtr), (void *) (address), &isNew)) #define IsTargetAddress(tablePtr, address) \ (Tcl_FindHashEntry((tablePtr), (void *) (address)) != NULL) +#define AddrLength(address) \ + (tclInstructionTable[*(unsigned char *)(address)].numBytes) +#define InstLength(instruction) \ + (tclInstructionTable[(unsigned char)(instruction)].numBytes) +/* + * ---------------------------------------------------------------------- + * + * LocateTargetAddresses -- + * + * Populate a hash table with places that we need to be careful around + * because they're the targets of various kinds of jumps and other + * non-local behavior. + * + * ---------------------------------------------------------------------- + */ + static void LocateTargetAddresses( CompileEnv *envPtr, Tcl_HashTable *tablePtr) { - unsigned char *pc, *target; - int size, isNew, i; + unsigned char *currentInstPtr, *targetInstPtr; + int isNew, i; Tcl_HashEntry *hPtr; Tcl_HashSearch hSearch; @@ -44,36 +71,39 @@ LocateTargetAddresses( * because they are the targets of various types of jumps. */ - for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { - size = tclInstructionTable[*pc].numBytes; - switch (*pc) { + for (currentInstPtr = envPtr->codeStart ; + currentInstPtr < envPtr->codeNext ; + currentInstPtr += AddrLength(currentInstPtr)) { + switch (*currentInstPtr) { case INST_JUMP1: case INST_JUMP_TRUE1: case INST_JUMP_FALSE1: - target = pc + TclGetInt1AtPtr(pc+1); + targetInstPtr = currentInstPtr+TclGetInt1AtPtr(currentInstPtr+1); goto storeTarget; case INST_JUMP4: case INST_JUMP_TRUE4: case INST_JUMP_FALSE4: - target = pc + TclGetInt4AtPtr(pc+1); + targetInstPtr = currentInstPtr+TclGetInt4AtPtr(currentInstPtr+1); goto storeTarget; case INST_BEGIN_CATCH4: - target = envPtr->codeStart + envPtr->exceptArrayPtr[ - TclGetUInt4AtPtr(pc+1)].codeOffset; + targetInstPtr = envPtr->codeStart + envPtr->exceptArrayPtr[ + TclGetUInt4AtPtr(currentInstPtr+1)].codeOffset; storeTarget: - DefineTargetAddress(tablePtr, target); + DefineTargetAddress(tablePtr, targetInstPtr); break; case INST_JUMP_TABLE: hPtr = Tcl_FirstHashEntry( - &JUMPTABLEINFO(envPtr, pc+1)->hashTable, &hSearch); + &JUMPTABLEINFO(envPtr, currentInstPtr+1)->hashTable, + &hSearch); for (; hPtr ; hPtr = Tcl_NextHashEntry(&hSearch)) { - target = pc + PTR2INT(Tcl_GetHashValue(hPtr)); - DefineTargetAddress(tablePtr, target); + targetInstPtr = currentInstPtr + + PTR2INT(Tcl_GetHashValue(hPtr)); + DefineTargetAddress(tablePtr, targetInstPtr); } break; case INST_RETURN_CODE_BRANCH: for (i=TCL_ERROR ; iexceptArrayPtr[i]; if (rangePtr->type == CATCH_EXCEPTION_RANGE) { - target = envPtr->codeStart + rangePtr->catchOffset; - DefineTargetAddress(tablePtr, target); + targetInstPtr = envPtr->codeStart + rangePtr->catchOffset; + DefineTargetAddress(tablePtr, targetInstPtr); } else { - target = envPtr->codeStart + rangePtr->breakOffset; - DefineTargetAddress(tablePtr, target); + targetInstPtr = envPtr->codeStart + rangePtr->breakOffset; + DefineTargetAddress(tablePtr, targetInstPtr); if (rangePtr->continueOffset >= 0) { - target = envPtr->codeStart + rangePtr->continueOffset; - DefineTargetAddress(tablePtr, target); + targetInstPtr = envPtr->codeStart + rangePtr->continueOffset; + DefineTargetAddress(tablePtr, targetInstPtr); } } } @@ -123,7 +153,7 @@ void TclOptimizeBytecode( CompileEnv *envPtr) { - unsigned char *pc; + unsigned char *currentInstPtr; int size; Tcl_HashTable targets; @@ -135,73 +165,74 @@ TclOptimizeBytecode( */ LocateTargetAddresses(envPtr, &targets); - for (pc = envPtr->codeStart ; pc < envPtr->codeNext ; pc += size) { - int blank = 0, i, inst; + for (currentInstPtr = envPtr->codeStart ; + currentInstPtr < envPtr->codeNext ; currentInstPtr += size) { + int blank = 0, i, nextInst; - size = tclInstructionTable[*pc].numBytes; - while (*(pc+size) == INST_NOP) { - if (IsTargetAddress(&targets, pc + size)) { + size = AddrLength(currentInstPtr); + while (*(currentInstPtr+size) == INST_NOP) { + if (IsTargetAddress(&targets, currentInstPtr + size)) { break; } - size += tclInstructionTable[INST_NOP].numBytes; + size += InstLength(INST_NOP); } - if (IsTargetAddress(&targets, pc + size)) { + if (IsTargetAddress(&targets, currentInstPtr + size)) { continue; } - inst = *(pc + size); - switch (*pc) { + nextInst = *(currentInstPtr + size); + switch (*currentInstPtr) { case INST_PUSH1: - if (inst == INST_POP) { - blank = size + tclInstructionTable[inst].numBytes; - } else if (inst == INST_CONCAT1 - && TclGetUInt1AtPtr(pc + size + 1) == 2) { + if (nextInst == INST_POP) { + blank = size + InstLength(nextInst); + } else if (nextInst == INST_CONCAT1 + && TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) { Tcl_Obj *litPtr = TclFetchLiteral(envPtr, - TclGetUInt1AtPtr(pc + 1)); + TclGetUInt1AtPtr(currentInstPtr + 1)); int numBytes; (void) Tcl_GetStringFromObj(litPtr, &numBytes); if (numBytes == 0) { - blank = size + tclInstructionTable[inst].numBytes; + blank = size + InstLength(nextInst); } } break; case INST_PUSH4: - if (inst == INST_POP) { + if (nextInst == INST_POP) { blank = size + 1; - } else if (inst == INST_CONCAT1 - && TclGetUInt1AtPtr(pc + size + 1) == 2) { + } else if (nextInst == INST_CONCAT1 + && TclGetUInt1AtPtr(currentInstPtr + size + 1) == 2) { Tcl_Obj *litPtr = TclFetchLiteral(envPtr, - TclGetUInt4AtPtr(pc + 1)); + TclGetUInt4AtPtr(currentInstPtr + 1)); int numBytes; (void) Tcl_GetStringFromObj(litPtr, &numBytes); if (numBytes == 0) { - blank = size + tclInstructionTable[inst].numBytes; + blank = size + InstLength(nextInst); } } break; case INST_LNOT: - switch (inst) { + switch (nextInst) { case INST_JUMP_TRUE1: blank = size; - *(pc + size) = INST_JUMP_FALSE1; + *(currentInstPtr + size) = INST_JUMP_FALSE1; break; case INST_JUMP_FALSE1: blank = size; - *(pc + size) = INST_JUMP_TRUE1; + *(currentInstPtr + size) = INST_JUMP_TRUE1; break; case INST_JUMP_TRUE4: blank = size; - *(pc + size) = INST_JUMP_FALSE4; + *(currentInstPtr + size) = INST_JUMP_FALSE4; break; case INST_JUMP_FALSE4: blank = size; - *(pc + size) = INST_JUMP_TRUE4; + *(currentInstPtr + size) = INST_JUMP_TRUE4; break; } break; case INST_TRY_CVT_TO_NUMERIC: - switch (inst) { + switch (nextInst) { case INST_JUMP_TRUE1: case INST_JUMP_TRUE4: case INST_JUMP_FALSE1: @@ -242,7 +273,7 @@ TclOptimizeBytecode( } if (blank > 0) { for (i=0 ; icodeStart ; + currentInstPtr < envPtr->codeNext-1 ; + currentInstPtr += AddrLength(currentInstPtr)) { + int offset, delta; + + switch (*currentInstPtr) { + case INST_JUMP1: + case INST_JUMP_TRUE1: + case INST_JUMP_FALSE1: + offset = TclGetInt1AtPtr(currentInstPtr + 1); + delta = 0; + advanceNext1: + if (offset + delta == 0) { + continue; + } + if (offset + delta < -128 || offset + delta > 127) { + TclStoreInt1AtPtr(offset, currentInstPtr + 1); + continue; + } + offset += delta; + switch (*(currentInstPtr + offset)) { + case INST_NOP: + delta = InstLength(INST_NOP); + goto advanceNext1; + case INST_JUMP1: + delta = TclGetInt1AtPtr(currentInstPtr + offset + 1); + goto advanceNext1; + case INST_JUMP4: + delta = TclGetInt4AtPtr(currentInstPtr + offset + 1); + goto advanceNext1; + default: + TclStoreInt1AtPtr(offset, currentInstPtr + 1); + continue; + } + case INST_JUMP4: + case INST_JUMP_TRUE4: + case INST_JUMP_FALSE4: + offset = TclGetInt4AtPtr(currentInstPtr + 1); + advanceNext4: + if (offset == 0) { + continue; + } + switch (*(currentInstPtr + offset)) { + case INST_NOP: + offset += InstLength(INST_NOP); + goto advanceNext4; + case INST_JUMP1: + offset += TclGetInt1AtPtr(currentInstPtr + offset + 1); + goto advanceNext4; + case INST_JUMP4: + offset += TclGetInt4AtPtr(currentInstPtr + offset + 1); + goto advanceNext4; + default: + TclStoreInt4AtPtr(offset, currentInstPtr + 1); + continue; + } + } + } + + /* * Trim unreachable instructions after a DONE. */ LocateTargetAddresses(envPtr, &targets); - for (pc = envPtr->codeStart ; pc < envPtr->codeNext-1 ; pc += size) { + for (currentInstPtr = envPtr->codeStart ; + currentInstPtr < envPtr->codeNext-1 ; + currentInstPtr += AddrLength(currentInstPtr)) { int clear = 0; - size = tclInstructionTable[*pc].numBytes; - if (*pc != INST_DONE) { + if (*currentInstPtr != INST_DONE) { continue; } - assert (size == 1); - while (!IsTargetAddress(&targets, pc + 1 + clear)) { - clear += tclInstructionTable[*(pc + 1 + clear)].numBytes; + + while (!IsTargetAddress(&targets, currentInstPtr + 1 + clear)) { + clear += AddrLength(currentInstPtr + 1 + clear); } - if (pc + 1 + clear == envPtr->codeNext) { + if (currentInstPtr + 1 + clear == envPtr->codeNext) { envPtr->codeNext -= clear; } else { while (clear --> 0) { - *(pc + 1 + clear) = INST_NOP; + *(currentInstPtr + 1 + clear) = INST_NOP; } } } -- cgit v0.12 From d2874a90b95a1cac70a0c8e84908154356a9a18d Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 6 Jun 2013 06:53:55 +0000 Subject: Split the optimizer up. Remove the dreaded 'goto' from which doesn't need it. --- generic/tclOptimize.c | 208 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 127 insertions(+), 81 deletions(-) diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c index 3e0d351..7d4226e 100644 --- a/generic/tclOptimize.c +++ b/generic/tclOptimize.c @@ -17,8 +17,11 @@ * Forward declarations. */ +static void AdvanceJumps(CompileEnv *envPtr); +static void ConvertZeroEffectToNOP(CompileEnv *envPtr); static void LocateTargetAddresses(CompileEnv *envPtr, Tcl_HashTable *tablePtr); +static void TrimUnreachable(CompileEnv *envPtr); /* * Helper macros. @@ -142,27 +145,67 @@ LocateTargetAddresses( /* * ---------------------------------------------------------------------- * - * TclOptimizeBytecode -- + * TrimUnreachable -- * - * A very simple peephole optimizer for bytecode. + * Converts code that provably can't be executed into NOPs and reduces + * the overall reported length of the bytecode where that is possible. * * ---------------------------------------------------------------------- */ -void -TclOptimizeBytecode( +static void +TrimUnreachable( CompileEnv *envPtr) { unsigned char *currentInstPtr; - int size; Tcl_HashTable targets; - /* - * Replace PUSH/POP sequences (when non-hazardous) with NOPs. Also replace - * PUSH empty/CONCAT and TRY_CVT_NUMERIC (when followed by an operation - * that guarantees the check for arithmeticity) and eliminate LNOT when we - * can invert the following JUMP condition. - */ + LocateTargetAddresses(envPtr, &targets); + + for (currentInstPtr = envPtr->codeStart ; + currentInstPtr < envPtr->codeNext-1 ; + currentInstPtr += AddrLength(currentInstPtr)) { + int clear = 0; + + if (*currentInstPtr != INST_DONE) { + continue; + } + + while (!IsTargetAddress(&targets, currentInstPtr + 1 + clear)) { + clear += AddrLength(currentInstPtr + 1 + clear); + } + if (currentInstPtr + 1 + clear == envPtr->codeNext) { + envPtr->codeNext -= clear; + } else { + while (clear --> 0) { + *(currentInstPtr + 1 + clear) = INST_NOP; + } + } + } + + Tcl_DeleteHashTable(&targets); +} + +/* + * ---------------------------------------------------------------------- + * + * ConvertZeroEffectToNOP -- + * + * Replace PUSH/POP sequences (when non-hazardous) with NOPs. Also + * replace PUSH empty/CONCAT and TRY_CVT_NUMERIC (when followed by an + * operation that guarantees the check for arithmeticity) and eliminate + * LNOT when we can invert the following JUMP condition. + * + * ---------------------------------------------------------------------- + */ + +static void +ConvertZeroEffectToNOP( + CompileEnv *envPtr) +{ + unsigned char *currentInstPtr; + int size; + Tcl_HashTable targets; LocateTargetAddresses(envPtr, &targets); for (currentInstPtr = envPtr->codeStart ; @@ -211,6 +254,7 @@ TclOptimizeBytecode( } } break; + case INST_LNOT: switch (nextInst) { case INST_JUMP_TRUE1: @@ -231,6 +275,7 @@ TclOptimizeBytecode( break; } break; + case INST_TRY_CVT_TO_NUMERIC: switch (nextInst) { case INST_JUMP_TRUE1: @@ -271,6 +316,7 @@ TclOptimizeBytecode( } break; } + if (blank > 0) { for (i=0 ; icodeStart ; currentInstPtr < envPtr->codeNext-1 ; @@ -294,82 +355,67 @@ TclOptimizeBytecode( case INST_JUMP_TRUE1: case INST_JUMP_FALSE1: offset = TclGetInt1AtPtr(currentInstPtr + 1); - delta = 0; - advanceNext1: - if (offset + delta == 0) { - continue; - } - if (offset + delta < -128 || offset + delta > 127) { - TclStoreInt1AtPtr(offset, currentInstPtr + 1); - continue; - } - offset += delta; - switch (*(currentInstPtr + offset)) { - case INST_NOP: - delta = InstLength(INST_NOP); - goto advanceNext1; - case INST_JUMP1: - delta = TclGetInt1AtPtr(currentInstPtr + offset + 1); - goto advanceNext1; - case INST_JUMP4: - delta = TclGetInt4AtPtr(currentInstPtr + offset + 1); - goto advanceNext1; - default: - TclStoreInt1AtPtr(offset, currentInstPtr + 1); - continue; + for (delta=0 ; offset+delta != 0 ;) { + if (offset + delta < -128 || offset + delta > 127) { + break; + } + offset += delta; + switch (*(currentInstPtr + offset)) { + case INST_NOP: + delta = InstLength(INST_NOP); + continue; + case INST_JUMP1: + delta = TclGetInt1AtPtr(currentInstPtr + offset + 1); + continue; + case INST_JUMP4: + delta = TclGetInt4AtPtr(currentInstPtr + offset + 1); + continue; + } + break; } + TclStoreInt1AtPtr(offset, currentInstPtr + 1); + continue; + case INST_JUMP4: case INST_JUMP_TRUE4: case INST_JUMP_FALSE4: - offset = TclGetInt4AtPtr(currentInstPtr + 1); - advanceNext4: - if (offset == 0) { - continue; - } - switch (*(currentInstPtr + offset)) { - case INST_NOP: - offset += InstLength(INST_NOP); - goto advanceNext4; - case INST_JUMP1: - offset += TclGetInt1AtPtr(currentInstPtr + offset + 1); - goto advanceNext4; - case INST_JUMP4: - offset += TclGetInt4AtPtr(currentInstPtr + offset + 1); - goto advanceNext4; - default: - TclStoreInt4AtPtr(offset, currentInstPtr + 1); - continue; + for (offset = TclGetInt4AtPtr(currentInstPtr + 1); offset!=0 ;) { + switch (*(currentInstPtr + offset)) { + case INST_NOP: + offset += InstLength(INST_NOP); + continue; + case INST_JUMP1: + offset += TclGetInt1AtPtr(currentInstPtr + offset + 1); + continue; + case INST_JUMP4: + offset += TclGetInt4AtPtr(currentInstPtr + offset + 1); + continue; + } + break; } - } - } - - /* - * Trim unreachable instructions after a DONE. - */ - - LocateTargetAddresses(envPtr, &targets); - for (currentInstPtr = envPtr->codeStart ; - currentInstPtr < envPtr->codeNext-1 ; - currentInstPtr += AddrLength(currentInstPtr)) { - int clear = 0; - - if (*currentInstPtr != INST_DONE) { + TclStoreInt4AtPtr(offset, currentInstPtr + 1); continue; } - - while (!IsTargetAddress(&targets, currentInstPtr + 1 + clear)) { - clear += AddrLength(currentInstPtr + 1 + clear); - } - if (currentInstPtr + 1 + clear == envPtr->codeNext) { - envPtr->codeNext -= clear; - } else { - while (clear --> 0) { - *(currentInstPtr + 1 + clear) = INST_NOP; - } - } } +} + +/* + * ---------------------------------------------------------------------- + * + * TclOptimizeBytecode -- + * + * A very simple peephole optimizer for bytecode. + * + * ---------------------------------------------------------------------- + */ - Tcl_DeleteHashTable(&targets); +void +TclOptimizeBytecode( + CompileEnv *envPtr) +{ + ConvertZeroEffectToNOP(envPtr); + AdvanceJumps(envPtr); + TrimUnreachable(envPtr); } /* -- cgit v0.12 From 6f9ac2478c554fbf3fff18e76b690199ade088cb Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 6 Jun 2013 06:56:20 +0000 Subject: Minor grammar fix. --- generic/tclCompile.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclCompile.h b/generic/tclCompile.h index fdb281b..908dceb 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -122,9 +122,9 @@ typedef struct ExceptionAux { * problem. */ int expandTargetDepth; /* The stack depth expected at the outermost * expansion within the loop. Not meaningful - * if there have are no open expansions - * between the looping level and the point of - * jump issue. */ + * if there are no open expansions between the + * looping level and the point of jump + * issue. */ int numBreakTargets; /* The number of [break]s that want to be * targeted to the place where this loop * exception will be bound to. */ -- cgit v0.12 From deb30edf39eedf62f9b626a56fa6fa428cb46825 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 6 Jun 2013 14:24:35 +0000 Subject: 3614360 Repair stack demands of optimized compiled [return LITERAL]. --- generic/tclCompCmdsGR.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index d101d82..5e3d456 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2471,6 +2471,7 @@ TclCompileReturnCmd( Tcl_DecrRefCount(returnOpts); TclEmitOpcode(INST_DONE, envPtr); + TclAdjustStackDepth(1, envPtr); return TCL_OK; } } -- cgit v0.12 From 1486f60b5f64b30894635c951cc50d6aeb2cc8a1 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 6 Jun 2013 16:55:08 +0000 Subject: 3614382 Fix stack management of compiled [dict for] by shifting limits of the catch range. --- generic/tclCompCmds.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7324360..92dfcb4 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1496,9 +1496,6 @@ CompileDictEachCmd( */ CompileWord(envPtr, dictTokenPtr, interp, 3); - TclEmitInstInt4( INST_DICT_FIRST, infoIndex, envPtr); - emptyTargetOffset = CurrentOffset(envPtr); - TclEmitInstInt4( INST_JUMP_TRUE4, 0, envPtr); /* * Now we catch errors from here on so that we can finalize the search @@ -1509,6 +1506,10 @@ CompileDictEachCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, catchRange, envPtr); ExceptionRangeStarts(envPtr, catchRange); + TclEmitInstInt4( INST_DICT_FIRST, infoIndex, envPtr); + emptyTargetOffset = CurrentOffset(envPtr); + TclEmitInstInt4( INST_JUMP_TRUE4, 0, envPtr); + /* * Inside the iteration, write the loop variables. */ -- cgit v0.12 From 89472a2027d1ef3616e36b9067d5b2ccca84b3e0 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 6 Jun 2013 21:01:04 +0000 Subject: More efficient instruction sequence for [dict for] with correct exception depth handling. --- generic/tclCompCmds.c | 33 ++++++++++----------------------- tests/dict.test | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 92dfcb4..86e9987 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1560,24 +1560,8 @@ CompileDictEachCmd( TclEmitInstInt4( INST_DICT_NEXT, infoIndex, envPtr); jumpDisplacement = bodyTargetOffset - CurrentOffset(envPtr); TclEmitInstInt4( INST_JUMP_FALSE4, jumpDisplacement, envPtr); - TclEmitOpcode( INST_POP, envPtr); - TclEmitOpcode( INST_POP, envPtr); - - /* - * Now do the final cleanup for the no-error case (this is where we break - * out of the loop to) by force-terminating the iteration (if not already - * terminated), ditching the exception info and jumping to the last - * instruction for this command. In theory, this could be done using the - * "finally" clause (next generated) but this is faster. - */ - - ExceptionRangeTarget(envPtr, loopRange, breakOffset); - TclFinalizeLoopExceptionRange(envPtr, loopRange); - TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); - TclEmitInt4( infoIndex, envPtr); - TclEmitOpcode( INST_END_CATCH, envPtr); endTargetOffset = CurrentOffset(envPtr); - TclEmitInstInt4( INST_JUMP4, 0, envPtr); + TclEmitInstInt1( INST_JUMP1, 0, envPtr); /* * Error handler "finally" clause, which force-terminates the iteration @@ -1587,9 +1571,9 @@ CompileDictEachCmd( ExceptionRangeTarget(envPtr, catchRange, catchOffset); TclEmitOpcode( INST_PUSH_RETURN_OPTIONS, envPtr); TclEmitOpcode( INST_PUSH_RESULT, envPtr); + TclEmitOpcode( INST_END_CATCH, envPtr); TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( infoIndex, envPtr); - TclEmitOpcode( INST_END_CATCH, envPtr); if (collect == TCL_EACH_COLLECT) { TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( collectVar, envPtr); @@ -1606,10 +1590,14 @@ CompileDictEachCmd( jumpDisplacement = CurrentOffset(envPtr) - emptyTargetOffset; TclUpdateInstInt4AtPc(INST_JUMP_TRUE4, jumpDisplacement, envPtr->codeStart + emptyTargetOffset); + jumpDisplacement = CurrentOffset(envPtr) - endTargetOffset; + TclUpdateInstInt1AtPc(INST_JUMP1, jumpDisplacement, + envPtr->codeStart + endTargetOffset); TclEmitOpcode( INST_POP, envPtr); TclEmitOpcode( INST_POP, envPtr); - TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); - TclEmitInt4( infoIndex, envPtr); + ExceptionRangeTarget(envPtr, loopRange, breakOffset); + TclFinalizeLoopExceptionRange(envPtr, loopRange); + TclEmitOpcode( INST_END_CATCH, envPtr); /* * Final stage of the command (normal case) is that we push an empty @@ -1617,9 +1605,8 @@ CompileDictEachCmd( * last to promote peephole optimization when it's dropped immediately. */ - jumpDisplacement = CurrentOffset(envPtr) - endTargetOffset; - TclUpdateInstInt4AtPc(INST_JUMP4, jumpDisplacement, - envPtr->codeStart + endTargetOffset); + TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); + TclEmitInt4( infoIndex, envPtr); if (collect == TCL_EACH_COLLECT) { Emit14Inst( INST_LOAD_SCALAR, collectVar, envPtr); TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); diff --git a/tests/dict.test b/tests/dict.test index 72a336c..02c9050 100644 --- a/tests/dict.test +++ b/tests/dict.test @@ -668,6 +668,24 @@ test dict-14.20 {dict for stack space compilation: bug 1903325} { concat "c=$y,$args" }} {} 1 2 3 } {c=1,2 3} +test dict-14.21 {compiled dict for and break} { + apply {{} { + dict for {a b} {c d e f} { + lappend result $a,$b + break + } + return $result + }} +} c,d +test dict-14.22 {dict for and exception range depths: Bug 3614382} { + apply {{} { + dict for {a b} {c d} { + dict for {e f} {g h} { + return 5 + } + } + }} +} 5 # There's probably a lot more tests to add here. Really ought to use a # coverage tool for this job... -- cgit v0.12 From 61b945b1318228d66f41c3352fd8134372acd70b Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 7 Jun 2013 12:48:58 +0000 Subject: Simplify stack depth management. --- generic/tclCompCmds.c | 64 ++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 86e9987..2c1198d 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1630,7 +1630,6 @@ TclCompileDictUpdateCmd( const char *name; int i, nameChars, dictIndex, numVars, range, infoIndex; Tcl_Token **keyTokenPtrs, *dictVarTokenPtr, *bodyTokenPtr, *tokenPtr; - int savedStackDepth = envPtr->currStackDepth; DictUpdateInfo *duiPtr; JumpFixup jumpFixup; @@ -1660,16 +1659,16 @@ TclCompileDictUpdateCmd( dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr); if (dictVarTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); + goto issueFallback; } name = dictVarTokenPtr[1].start; nameChars = dictVarTokenPtr[1].size; if (!TclIsLocalScalar(name, nameChars)) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); + goto issueFallback; } dictIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); if (dictIndex < 0) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); + goto issueFallback; } /* @@ -1680,8 +1679,7 @@ TclCompileDictUpdateCmd( duiPtr = ckalloc(sizeof(DictUpdateInfo) + sizeof(int) * (numVars - 1)); duiPtr->length = numVars; - keyTokenPtrs = TclStackAlloc(interp, - sizeof(Tcl_Token *) * numVars); + keyTokenPtrs = TclStackAlloc(interp, sizeof(Tcl_Token *) * numVars); tokenPtr = TokenAfter(dictVarTokenPtr); for (i=0 ; itype != TCL_TOKEN_SIMPLE_WORD) { - failedUpdateInfoAssembly: - ckfree(duiPtr); - TclStackFree(interp, keyTokenPtrs); - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); + goto failedUpdateInfoAssembly; } bodyTokenPtr = tokenPtr; @@ -1736,16 +1731,14 @@ TclCompileDictUpdateCmd( } TclEmitInstInt4( INST_LIST, numVars, envPtr); TclEmitInstInt4( INST_DICT_UPDATE_START, dictIndex, envPtr); - TclEmitInt4( infoIndex, envPtr); + TclEmitInt4( infoIndex, envPtr); range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - envPtr->currStackDepth++; SetLineInformation(parsePtr->numWords - 1); CompileBody(envPtr, bodyTokenPtr, interp); - envPtr->currStackDepth = savedStackDepth; ExceptionRangeEnds(envPtr, range); /* @@ -1756,7 +1749,7 @@ TclCompileDictUpdateCmd( TclEmitOpcode( INST_END_CATCH, envPtr); TclEmitInstInt4( INST_REVERSE, 2, envPtr); TclEmitInstInt4( INST_DICT_UPDATE_END, dictIndex, envPtr); - TclEmitInt4( infoIndex, envPtr); + TclEmitInt4( infoIndex, envPtr); /* * Jump around the exceptional termination code. @@ -1777,7 +1770,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_REVERSE, 3, envPtr); TclEmitInstInt4( INST_DICT_UPDATE_END, dictIndex, envPtr); - TclEmitInt4( infoIndex, envPtr); + TclEmitInt4( infoIndex, envPtr); TclEmitOpcode( INST_RETURN_STK, envPtr); if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) { @@ -1785,8 +1778,17 @@ TclCompileDictUpdateCmd( (int) (CurrentOffset(envPtr) - jumpFixup.codeOffset)); } TclStackFree(interp, keyTokenPtrs); - envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; + + /* + * Clean up after a failure to create the DictUpdateInfo structure. + */ + + failedUpdateInfoAssembly: + ckfree(duiPtr); + TclStackFree(interp, keyTokenPtrs); + issueFallback: + return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); } int @@ -1875,6 +1877,10 @@ TclCompileDictLappendCmd( return TCL_ERROR; } + /* + * Parse the arguments. + */ + varTokenPtr = TokenAfter(parsePtr->tokenPtr); keyTokenPtr = TokenAfter(varTokenPtr); valueTokenPtr = TokenAfter(keyTokenPtr); @@ -1890,6 +1896,11 @@ TclCompileDictLappendCmd( if (dictVarIndex < 0) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } + + /* + * Issue the implementation. + */ + CompileWord(envPtr, keyTokenPtr, interp, 3); CompileWord(envPtr, valueTokenPtr, interp, 4); TclEmitInstInt4( INST_DICT_LAPPEND, dictVarIndex, envPtr); @@ -1906,10 +1917,9 @@ TclCompileDictWithCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ - int i, range, varNameTmp, pathTmp, keysTmp, gotPath, dictVar = -1; + int i, range, varNameTmp = -1, pathTmp, keysTmp, gotPath, dictVar = -1; int bodyIsEmpty = 1; Tcl_Token *varTokenPtr, *tokenPtr; - int savedStackDepth = envPtr->currStackDepth; JumpFixup jumpFixup; const char *ptr, *end; @@ -1988,7 +1998,6 @@ TclCompileDictWithCmd( TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitOpcode( INST_DICT_EXPAND, envPtr); TclEmitInstInt4(INST_DICT_RECOMBINE_IMM, dictVar, envPtr); - PushStringLiteral(envPtr, ""); } else { /* * Case: Direct dict in LVT with empty body. @@ -1999,7 +2008,6 @@ TclCompileDictWithCmd( PushStringLiteral(envPtr, ""); TclEmitOpcode( INST_DICT_EXPAND, envPtr); TclEmitInstInt4(INST_DICT_RECOMBINE_IMM, dictVar, envPtr); - PushStringLiteral(envPtr, ""); } } else { if (gotPath) { @@ -2018,7 +2026,6 @@ TclCompileDictWithCmd( TclEmitInstInt4(INST_OVER, 1, envPtr); TclEmitOpcode( INST_DICT_EXPAND, envPtr); TclEmitOpcode( INST_DICT_RECOMBINE_STK, envPtr); - PushStringLiteral(envPtr, ""); } else { /* * Case: Direct dict in non-simple var with empty body. @@ -2032,10 +2039,9 @@ TclCompileDictWithCmd( PushStringLiteral(envPtr, ""); TclEmitInstInt4(INST_REVERSE, 2, envPtr); TclEmitOpcode( INST_DICT_RECOMBINE_STK, envPtr); - PushStringLiteral(envPtr, ""); } } - envPtr->currStackDepth = savedStackDepth + 1; + PushStringLiteral(envPtr, ""); return TCL_OK; } @@ -2049,8 +2055,6 @@ TclCompileDictWithCmd( if (dictVar == -1) { varNameTmp = TclFindCompiledLocal(NULL, 0, 1, envPtr); - } else { - varNameTmp = -1; } if (gotPath) { pathTmp = TclFindCompiledLocal(NULL, 0, 1, envPtr); @@ -2063,7 +2067,7 @@ TclCompileDictWithCmd( * Issue instructions. First, the part to expand the dictionary. */ - if (varNameTmp > -1) { + if (dictVar == -1) { CompileWord(envPtr, varTokenPtr, interp, 0); Emit14Inst( INST_STORE_SCALAR, varNameTmp, envPtr); } @@ -2108,7 +2112,7 @@ TclCompileDictWithCmd( */ TclEmitOpcode( INST_END_CATCH, envPtr); - if (varNameTmp > -1) { + if (dictVar == -1) { Emit14Inst( INST_LOAD_SCALAR, varNameTmp, envPtr); } if (gotPath) { @@ -2128,11 +2132,12 @@ TclCompileDictWithCmd( * Now fold the results back into the dictionary in the exception case. */ + TclAdjustStackDepth(-1, envPtr); ExceptionRangeTarget(envPtr, range, catchOffset); TclEmitOpcode( INST_PUSH_RETURN_OPTIONS, envPtr); TclEmitOpcode( INST_PUSH_RESULT, envPtr); TclEmitOpcode( INST_END_CATCH, envPtr); - if (varNameTmp > -1) { + if (dictVar == -1) { Emit14Inst( INST_LOAD_SCALAR, varNameTmp, envPtr); } if (parsePtr->numWords > 3) { @@ -2152,7 +2157,6 @@ TclCompileDictWithCmd( * Prepare for the start of the next command. */ - envPtr->currStackDepth = savedStackDepth + 1; if (TclFixupForwardJumpToHere(envPtr, &jumpFixup, 127)) { Tcl_Panic("TclCompileDictCmd(update): bad jump distance %d", (int) (CurrentOffset(envPtr) - jumpFixup.codeOffset)); @@ -2252,7 +2256,6 @@ TclCompileErrorCmd( * However, we only deal with the case where there is just a message. */ Tcl_Token *messageTokenPtr; - int savedStackDepth = envPtr->currStackDepth; DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 2) { @@ -2263,7 +2266,6 @@ TclCompileErrorCmd( PushStringLiteral(envPtr, "-code error -level 0"); CompileWord(envPtr, messageTokenPtr, interp, 1); TclEmitOpcode(INST_RETURN_STK, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; } -- cgit v0.12 From 10c2a79550f9ca620b2c90fe2b4d1490980de7a7 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 8 Jun 2013 13:17:26 +0000 Subject: Factor out stereotypical ways of getting variable indices. --- generic/tclCompCmds.c | 189 ++++++++++-------------------------------------- generic/tclCompCmdsSZ.c | 20 +++-- generic/tclCompile.h | 14 ++++ 3 files changed, 63 insertions(+), 160 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 2c1198d..25c4bac 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -317,10 +317,10 @@ TclCompileArraySetCmd( * Prepare for the internal foreach. */ - dataVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); - iterVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); - keyVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); - valVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); + dataVar = AnonymousLocal(envPtr); + iterVar = AnonymousLocal(envPtr); + keyVar = AnonymousLocal(envPtr); + valVar = AnonymousLocal(envPtr); infoPtr = ckalloc(sizeof(ForeachInfo) + sizeof(ForeachVarList *)); infoPtr->numLists = 1; @@ -543,8 +543,7 @@ TclCompileCatchCmd( { JumpFixup jumpFixup; Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; - const char *name; - int resultIndex, optsIndex, nameChars, range; + int resultIndex, optsIndex, range; int initStackDepth = envPtr->currStackDepth; int savedStackDepth; DefineLineInformation; /* TIP #280 */ @@ -577,17 +576,7 @@ TclCompileCatchCmd( if (parsePtr->numWords >= 3) { resultNameTokenPtr = TokenAfter(cmdTokenPtr); /* DGP */ - if (resultNameTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - - name = resultNameTokenPtr[1].start; - nameChars = resultNameTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - resultIndex = TclFindCompiledLocal(resultNameTokenPtr[1].start, - resultNameTokenPtr[1].size, /*create*/ 1, envPtr); + resultIndex = LocalScalarFromToken(resultNameTokenPtr, envPtr); if (resultIndex < 0) { return TCL_ERROR; } @@ -595,16 +584,7 @@ TclCompileCatchCmd( /* DKF */ if (parsePtr->numWords == 4) { optsNameTokenPtr = TokenAfter(resultNameTokenPtr); - if (optsNameTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = optsNameTokenPtr[1].start; - nameChars = optsNameTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - optsIndex = TclFindCompiledLocal(optsNameTokenPtr[1].start, - optsNameTokenPtr[1].size, /*create*/ 1, envPtr); + optsIndex = LocalScalarFromToken(optsNameTokenPtr, envPtr); if (optsIndex < 0) { return TCL_ERROR; } @@ -871,11 +851,9 @@ TclCompileDictSetCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; - int numWords, i; + int numWords, i, dictVarIndex; DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; - int dictVarIndex, nameChars; - const char *name; /* * There must be at least one argument after the command. @@ -892,15 +870,7 @@ TclCompileDictSetCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TCL_ERROR; - } - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); + dictVarIndex = LocalScalarFromToken(varTokenPtr, envPtr); if (dictVarIndex < 0) { return TCL_ERROR; } @@ -937,8 +907,7 @@ TclCompileDictIncrCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *keyTokenPtr; - int dictVarIndex, nameChars, incrAmount; - const char *name; + int dictVarIndex, incrAmount; /* * There must be at least two arguments after the command. @@ -984,15 +953,7 @@ TclCompileDictIncrCmd( * discover what the index is. */ - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TclCompileBasic2Or3ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TclCompileBasic2Or3ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); + dictVarIndex = LocalScalarFromToken(varTokenPtr, envPtr); if (dictVarIndex < 0) { return TclCompileBasic2Or3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1092,8 +1053,7 @@ TclCompileDictUnsetCmd( { Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ - int i, dictVarIndex, nameChars; - const char *name; + int i, dictVarIndex; /* * There must be at least one argument after the variable name for us to @@ -1111,15 +1071,7 @@ TclCompileDictUnsetCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - name = tokenPtr[1].start; - nameChars = tokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); + dictVarIndex = LocalScalarFromToken(tokenPtr, envPtr); if (dictVarIndex < 0) { return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1210,7 +1162,7 @@ TclCompileDictCreateCmd( */ nonConstant: - worker = TclFindCompiledLocal(NULL, 0, 1, envPtr); + worker = AnonymousLocal(envPtr); if (worker < 0) { return TclCompileBasicMin0ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1271,11 +1223,11 @@ TclCompileDictMergeCmd( * command when there's an LVT present. */ - workerIndex = TclFindCompiledLocal(NULL, 0, 1, envPtr); + workerIndex = AnonymousLocal(envPtr); if (workerIndex < 0) { return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); } - infoIndex = TclFindCompiledLocal(NULL, 0, 1, envPtr); + infoIndex = AnonymousLocal(envPtr); /* * Get the first dictionary and verify that it is so. @@ -1421,8 +1373,7 @@ CompileDictEachCmd( */ if (collect == TCL_EACH_COLLECT) { - collectVar = TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, - envPtr); + collectVar = AnonymousLocal(envPtr); if (collectVar < 0) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1447,18 +1398,9 @@ CompileDictEachCmd( } nameChars = strlen(argv[0]); - if (!TclIsLocalScalar(argv[0], nameChars)) { - ckfree(argv); - return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - keyVarIndex = TclFindCompiledLocal(argv[0], nameChars, 1, envPtr); - + keyVarIndex = LocalScalar(argv[0], nameChars, envPtr); nameChars = strlen(argv[1]); - if (!TclIsLocalScalar(argv[1], nameChars)) { - ckfree(argv); - return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - valueVarIndex = TclFindCompiledLocal(argv[1], nameChars, 1, envPtr); + valueVarIndex = LocalScalar(argv[1], nameChars, envPtr); ckfree(argv); if ((keyVarIndex < 0) || (valueVarIndex < 0)) { @@ -1472,7 +1414,7 @@ CompileDictEachCmd( * (at which point it should also have been finished with). */ - infoIndex = TclFindCompiledLocal(NULL, 0, 1, envPtr); + infoIndex = AnonymousLocal(envPtr); if (infoIndex < 0) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1627,8 +1569,7 @@ TclCompileDictUpdateCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ - const char *name; - int i, nameChars, dictIndex, numVars, range, infoIndex; + int i, dictIndex, numVars, range, infoIndex; Tcl_Token **keyTokenPtrs, *dictVarTokenPtr, *bodyTokenPtr, *tokenPtr; DictUpdateInfo *duiPtr; JumpFixup jumpFixup; @@ -1658,15 +1599,7 @@ TclCompileDictUpdateCmd( */ dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr); - if (dictVarTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - goto issueFallback; - } - name = dictVarTokenPtr[1].start; - nameChars = dictVarTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - goto issueFallback; - } - dictIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); + dictIndex = LocalScalarFromToken(dictVarTokenPtr, envPtr); if (dictIndex < 0) { goto issueFallback; } @@ -1688,27 +1621,14 @@ TclCompileDictUpdateCmd( */ keyTokenPtrs[i] = tokenPtr; - - /* - * Variables first need to be checked for sanity. - */ - tokenPtr = TokenAfter(tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - goto failedUpdateInfoAssembly; - } - name = tokenPtr[1].start; - nameChars = tokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - goto failedUpdateInfoAssembly; - } /* - * Stash the index in the auxiliary data. + * Stash the index in the auxiliary data (if it is indeed a local + * scalar that is resolvable at compile-time). */ - duiPtr->varIndices[i] = - TclFindCompiledLocal(name, nameChars, 1, envPtr); + duiPtr->varIndices[i] = LocalScalarFromToken(tokenPtr, envPtr); if (duiPtr->varIndices[i] < 0) { goto failedUpdateInfoAssembly; } @@ -1819,19 +1739,9 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } else { - register const char *name = tokenPtr[1].start; - register int nameChars = tokenPtr[1].size; - - if (!TclIsLocalScalar(name, nameChars)) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr,cmdPtr, envPtr); - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); - if (dictVarIndex < 0) { - return TclCompileBasicMin2ArgCmd(interp, parsePtr,cmdPtr, envPtr); - } + dictVarIndex = LocalScalarFromToken(tokenPtr, envPtr); + if (dictVarIndex < 0) { + return TclCompileBasicMin2ArgCmd(interp, parsePtr,cmdPtr, envPtr); } /* @@ -1866,8 +1776,7 @@ TclCompileDictLappendCmd( { DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *keyTokenPtr, *valueTokenPtr; - int dictVarIndex, nameChars; - const char *name; + int dictVarIndex; /* * There must be three arguments after the command. @@ -1884,15 +1793,7 @@ TclCompileDictLappendCmd( varTokenPtr = TokenAfter(parsePtr->tokenPtr); keyTokenPtr = TokenAfter(varTokenPtr); valueTokenPtr = TokenAfter(keyTokenPtr); - if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - name = varTokenPtr[1].start; - nameChars = varTokenPtr[1].size; - if (!TclIsLocalScalar(name, nameChars)) { - return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); + dictVarIndex = LocalScalarFromToken(varTokenPtr, envPtr); if (dictVarIndex < 0) { return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr); } @@ -1917,8 +1818,8 @@ TclCompileDictWithCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { DefineLineInformation; /* TIP #280 */ - int i, range, varNameTmp = -1, pathTmp, keysTmp, gotPath, dictVar = -1; - int bodyIsEmpty = 1; + int i, range, varNameTmp = -1, pathTmp = -1, keysTmp, gotPath; + int dictVar, bodyIsEmpty = 1; Tcl_Token *varTokenPtr, *tokenPtr; JumpFixup jumpFixup; const char *ptr, *end; @@ -1967,11 +1868,7 @@ TclCompileDictWithCmd( */ gotPath = (parsePtr->numWords > 3); - if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD && - TclIsLocalScalar(varTokenPtr[1].start, varTokenPtr[1].size)) { - dictVar = TclFindCompiledLocal(varTokenPtr[1].start, - varTokenPtr[1].size, 1, envPtr); - } + dictVar = LocalScalarFromToken(varTokenPtr, envPtr); /* * Special case: an empty body means we definitely have no need to issue @@ -2054,14 +1951,12 @@ TclCompileDictWithCmd( */ if (dictVar == -1) { - varNameTmp = TclFindCompiledLocal(NULL, 0, 1, envPtr); + varNameTmp = AnonymousLocal(envPtr); } if (gotPath) { - pathTmp = TclFindCompiledLocal(NULL, 0, 1, envPtr); - } else { - pathTmp = -1; + pathTmp = AnonymousLocal(envPtr); } - keysTmp = TclFindCompiledLocal(NULL, 0, 1, envPtr); + keysTmp = AnonymousLocal(envPtr); /* * Issue instructions. First, the part to expand the dictionary. @@ -2696,8 +2591,7 @@ CompileEachloopCmd( } if (collect == TCL_EACH_COLLECT) { - collectVar = TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, - envPtr); + collectVar = AnonymousLocal(envPtr); if (collectVar < 0) { return TCL_ERROR; } @@ -2716,14 +2610,12 @@ CompileEachloopCmd( code = TCL_OK; firstValueTemp = -1; for (loopIndex = 0; loopIndex < numLists; loopIndex++) { - tempVar = TclFindCompiledLocal(NULL, /*nameChars*/ 0, - /*create*/ 1, envPtr); + tempVar = AnonymousLocal(envPtr); if (loopIndex == 0) { firstValueTemp = tempVar; } } - loopCtTemp = TclFindCompiledLocal(NULL, /*nameChars*/ 0, - /*create*/ 1, envPtr); + loopCtTemp = AnonymousLocal(envPtr); /* * Create and initialize the ForeachInfo and ForeachVarList data @@ -3455,8 +3347,7 @@ TclPushVarName( */ if (!hasNsQualifiers) { - localIndex = TclFindCompiledLocal(name, nameChars, - 1, envPtr); + localIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr); if ((flags & TCL_NO_LARGE_INDEX) && (localIndex > 255)) { /* * We'll push the name. diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 7831198..381703b 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2159,12 +2159,11 @@ TclCompileTryCmd( int len; const char *varname = Tcl_GetStringFromObj(objv[0], &len); - if (!TclIsLocalScalar(varname, len)) { + resultVarIndices[i] = LocalScalar(varname, len, envPtr); + if (resultVarIndices[i] < 0) { TclDecrRefCount(tmpObj); goto failedToCompile; } - resultVarIndices[i] = - TclFindCompiledLocal(varname, len, 1, envPtr); } else { resultVarIndices[i] = -1; } @@ -2172,12 +2171,11 @@ TclCompileTryCmd( int len; const char *varname = Tcl_GetStringFromObj(objv[1], &len); - if (!TclIsLocalScalar(varname, len)) { + optionVarIndices[i] = LocalScalar(varname, len, envPtr); + if (optionVarIndices[i] < 0) { TclDecrRefCount(tmpObj); goto failedToCompile; } - optionVarIndices[i] = - TclFindCompiledLocal(varname, len, 1, envPtr); } else { optionVarIndices[i] = -1; } @@ -2289,8 +2287,8 @@ IssueTryInstructions( int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; char buf[TCL_INTEGER_SPACE]; - resultVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); - optionsVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); + resultVar = AnonymousLocal(envPtr); + optionsVar = AnonymousLocal(envPtr); if (resultVar < 0 || optionsVar < 0) { return TCL_ERROR; } @@ -2444,8 +2442,8 @@ IssueTryFinallyInstructions( int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; char buf[TCL_INTEGER_SPACE]; - resultVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); - optionsVar = TclFindCompiledLocal(NULL, 0, 1, envPtr); + resultVar = AnonymousLocal(envPtr); + optionsVar = AnonymousLocal(envPtr); if (resultVar < 0 || optionsVar < 0) { return TCL_ERROR; } @@ -3141,7 +3139,7 @@ CompileComparisonOpCmd( return TCL_ERROR; } else { - int tmpIndex = TclFindCompiledLocal(NULL, 0, 1, envPtr); + int tmpIndex = AnonymousLocal(envPtr); int words; tokenPtr = TokenAfter(parsePtr->tokenPtr); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 908dceb..9af4911 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1559,6 +1559,20 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); } /* + * How to get an anonymous local variable (used for holding temporary values + * off the stack) or a local simple scalar. + */ + +#define AnonymousLocal(envPtr) \ + (TclFindCompiledLocal(NULL, /*nameChars*/ 0, /*create*/ 1, (envPtr))) +#define LocalScalar(chars,len,envPtr) \ + (!TclIsLocalScalar((chars), (len)) ? -1 : \ + TclFindCompiledLocal((chars), (len), /*create*/ 1, (envPtr))) +#define LocalScalarFromToken(tokenPtr,envPtr) \ + ((tokenPtr)->type != TCL_TOKEN_SIMPLE_WORD ? -1 : \ + LocalScalar((tokenPtr)[1].start, (tokenPtr)[1].size, (envPtr))) + +/* * Flags bits used by TclPushVarName. */ -- cgit v0.12 From 77789d0ff1cb366d39f99f465f385a589bd70061 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 8 Jun 2013 23:35:02 +0000 Subject: More informative comment describing INST_SYNTAX. --- generic/tclCompile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 572f660..c361430 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -383,7 +383,8 @@ InstructionDesc const tclInstructionTable[] = { /* finds namespace and otherName in stack, links to local variable at * index op1. Leaves the namespace on stack. */ {"syntax", 9, -1, 2, {OPERAND_INT4, OPERAND_UINT4}}, - /* Compiled bytecodes to signal syntax error. */ + /* Compiled bytecodes to signal syntax error. Equivalent to returnImm + * except for the ERR_ALREADY_LOGGED flag in the interpreter. */ {"reverse", 5, 0, 1, {OPERAND_UINT4}}, /* Reverse the order of the arg elements at the top of stack */ -- cgit v0.12 From e054370d5ffba0ae4cf54604e09dec1fe22ccaa0 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 8 Jun 2013 23:43:29 +0000 Subject: Working on a better compiler for [try]; found some bugs in previous compilation code which aren't resolved yet. --- generic/tclCompCmdsSZ.c | 146 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 123 insertions(+), 23 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 381703b..f166a7a 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -51,17 +51,20 @@ static void IssueSwitchJumpTable(Tcl_Interp *interp, Tcl_Token *valueTokenPtr, int numWords, Tcl_Token **bodyToken, int *bodyLines, int **bodyContLines); -static int IssueTryFinallyInstructions(Tcl_Interp *interp, +static int IssueTryClausesInstructions(Tcl_Interp *interp, CompileEnv *envPtr, Tcl_Token *bodyToken, int numHandlers, int *matchCodes, Tcl_Obj **matchClauses, int *resultVarIndices, - int *optionVarIndices, Tcl_Token **handlerTokens, - Tcl_Token *finallyToken); -static int IssueTryInstructions(Tcl_Interp *interp, + int *optionVarIndices, Tcl_Token **handlerTokens); +static int IssueTryClausesFinallyInstructions(Tcl_Interp *interp, CompileEnv *envPtr, Tcl_Token *bodyToken, int numHandlers, int *matchCodes, Tcl_Obj **matchClauses, int *resultVarIndices, - int *optionVarIndices, Tcl_Token **handlerTokens); + int *optionVarIndices, Tcl_Token **handlerTokens, + Tcl_Token *finallyToken); +static int IssueTryFinallyInstructions(Tcl_Interp *interp, + CompileEnv *envPtr, Tcl_Token *bodyToken, + Tcl_Token *finallyToken); /* * The structures below define the AuxData types defined in this file. @@ -2223,14 +2226,17 @@ TclCompileTryCmd( * Issue the bytecode. */ - if (finallyToken) { + if (!finallyToken) { + result = IssueTryClausesInstructions(interp, envPtr, bodyToken, + numHandlers, matchCodes, matchClauses, resultVarIndices, + optionVarIndices, handlerTokens); + } else if (numHandlers == 0) { result = IssueTryFinallyInstructions(interp, envPtr, bodyToken, + finallyToken); + } else { + result = IssueTryClausesFinallyInstructions(interp, envPtr, bodyToken, numHandlers, matchCodes, matchClauses, resultVarIndices, optionVarIndices, handlerTokens, finallyToken); - } else { - result = IssueTryInstructions(interp, envPtr, bodyToken, numHandlers, - matchCodes, matchClauses, resultVarIndices, optionVarIndices, - handlerTokens); } /* @@ -2256,12 +2262,13 @@ TclCompileTryCmd( /* *---------------------------------------------------------------------- * - * IssueTryInstructions, IssueTryFinallyInstructions -- + * IssueTryClausesInstructions, IssueTryClausesFinallyInstructions, + * IssueTryFinallyInstructions -- * * The code generators for [try]. Split from the parsing engine for - * reasons of developer sanity, and also split between no-finally and - * with-finally cases because so many of the details of generation vary - * between the two. + * reasons of developer sanity, and also split between no-finally, + * just-finally and with-finally cases because so many of the details of + * generation vary between the three. * * The macros below make the instruction issuing easier to follow. * @@ -2269,7 +2276,7 @@ TclCompileTryCmd( */ static int -IssueTryInstructions( +IssueTryClausesInstructions( Tcl_Interp *interp, CompileEnv *envPtr, Tcl_Token *bodyToken, @@ -2283,7 +2290,7 @@ IssueTryInstructions( DefineLineInformation; /* TIP #280 */ int range, resultVar, optionsVar; int savedStackDepth = envPtr->currStackDepth; - int i, j, len, forwardsNeedFixing = 0; + int i, j, len, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0; int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; char buf[TCL_INTEGER_SPACE]; @@ -2294,6 +2301,18 @@ IssueTryInstructions( } /* + * Check if we're supposed to trap a normal TCL_OK completion of the body. + * If not, we can handle that case much more efficiently. + */ + + for (i=0 ; icurrStackDepth; int range, resultVar, optionsVar, i, j, len, forwardsNeedFixing = 0; + int trapZero = 0, afterBody = 0; int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; char buf[TCL_INTEGER_SPACE]; @@ -2449,6 +2479,18 @@ IssueTryFinallyInstructions( } /* + * Check if we're supposed to trap a normal TCL_OK completion of the body. + * If not, we can handle that case much more efficiently. + */ + + for (i=0 ; icurrStackDepth = savedStackDepth; BODY( bodyToken, 1); ExceptionRangeEnds(envPtr, range); - PUSH( "0"); - OP4( REVERSE, 2); - OP1( JUMP1, 4); + if (!trapZero) { + OP( END_CATCH); + STORE( resultVar); + OP( POP); + PUSH( "-level 0 -code 0"); + STORE( optionsVar); + OP( POP); + JUMP(afterBody, JUMP4); + } else { + PUSH( "0"); + OP4( REVERSE, 2); + OP1( JUMP1, 4); + } ExceptionRangeTarget(envPtr, range, catchOffset); OP( PUSH_RETURN_CODE); OP( PUSH_RESULT); @@ -2637,6 +2689,9 @@ IssueTryFinallyInstructions( * next command (or some inter-command manipulation). */ + if (!trapZero) { + FIXJUMP(afterBody); + } envPtr->currStackDepth = savedStackDepth; BODY( finallyToken, 3 + 4*numHandlers); OP( POP); @@ -2647,6 +2702,51 @@ IssueTryFinallyInstructions( return TCL_OK; } + +static int +IssueTryFinallyInstructions( + Tcl_Interp *interp, + CompileEnv *envPtr, + Tcl_Token *bodyToken, + Tcl_Token *finallyToken) +{ + DefineLineInformation; /* TIP #280 */ + int range; + + /* + * Note that this one is simple enough that we can issue it without + * needing a local variable table, making it a universal compilation. + */ + + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); + OP4( BEGIN_CATCH4, range); + ExceptionRangeStarts(envPtr, range); + BODY( bodyToken, 1); + ExceptionRangeEnds(envPtr, range); + OP1( JUMP1, 3); + TclAdjustStackDepth(-1, envPtr); + ExceptionRangeTarget(envPtr, range, catchOffset); + OP( PUSH_RESULT); + OP( PUSH_RETURN_OPTIONS); + OP( END_CATCH); + + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); + OP4( BEGIN_CATCH4, range); + ExceptionRangeStarts(envPtr, range); + BODY( finallyToken, 3); + OP( END_CATCH); + OP( POP); + OP1( JUMP1, 3); + TclAdjustStackDepth(-1, envPtr); + OP( PUSH_RESULT); + OP( PUSH_RETURN_OPTIONS); + OP( PUSH_RETURN_CODE); + OP( END_CATCH); + OP( POP); + OP4( REVERSE, 2); + OP( RETURN_STK); + return TCL_OK; +} /* *---------------------------------------------------------------------- -- cgit v0.12 From a50030aabb66d09343bddd7c2e6cf846ccc010e7 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 9 Jun 2013 08:15:43 +0000 Subject: Improving tests, fixed one case. --- generic/tclCompCmdsSZ.c | 71 ++++++++++++++--------- tests/error.test | 146 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 181 insertions(+), 36 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index f166a7a..cbe36d1 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -92,10 +92,14 @@ const AuxDataType tclJumptableInfoType = { SetLineInformation((index));CompileBody(envPtr,(token),interp) #define PUSH(str) \ PushStringLiteral(envPtr, str) -#define JUMP(var,name) \ - (var) = CurrentOffset(envPtr);TclEmitInstInt4(INST_##name,0,envPtr) -#define FIXJUMP(var) \ +#define JUMP4(name,var) \ + (var) = CurrentOffset(envPtr);TclEmitInstInt4(INST_##name##4,0,envPtr) +#define FIXJUMP4(var) \ TclStoreInt4AtPtr(CurrentOffset(envPtr)-(var),envPtr->codeStart+(var)+1) +#define JUMP1(name,var) \ + (var) = CurrentOffset(envPtr);TclEmitInstInt1(INST_##name##1,0,envPtr) +#define FIXJUMP1(var) \ + TclStoreInt1AtPtr(CurrentOffset(envPtr)-(var),envPtr->codeStart+(var)+1) #define LOAD(idx) \ if ((idx)<256) {OP1(LOAD_SCALAR1,(idx));} else {OP4(LOAD_SCALAR4,(idx));} #define STORE(idx) \ @@ -2326,7 +2330,7 @@ IssueTryClausesInstructions( ExceptionRangeEnds(envPtr, range); if (!trapZero) { OP( END_CATCH); - JUMP(afterBody, JUMP4); + JUMP4( JUMP, afterBody); TclAdjustStackDepth(-1, envPtr); } else { PUSH( "0"); @@ -2359,7 +2363,7 @@ IssueTryClausesInstructions( OP( DUP); PushLiteral(envPtr, buf, strlen(buf)); OP( EQ); - JUMP(notCodeJumpSource, JUMP_FALSE4); + JUMP4( JUMP_FALSE, notCodeJumpSource); if (matchClauses[i]) { const char *p; Tcl_ListObjLength(NULL, matchClauses[i], &len); @@ -2376,7 +2380,7 @@ IssueTryClausesInstructions( p = Tcl_GetStringFromObj(matchClauses[i], &len); PushLiteral(envPtr, p, len); OP( STR_EQ); - JUMP(notECJumpSource, JUMP_FALSE4); + JUMP4( JUMP_FALSE, notECJumpSource); } else { notECJumpSource = -1; /* LINT */ } @@ -2400,7 +2404,7 @@ IssueTryClausesInstructions( } if (!handlerTokens[i]) { forwardsNeedFixing = 1; - JUMP(forwardsToFix[i], JUMP4); + JUMP4( JUMP, forwardsToFix[i]); } else { forwardsToFix[i] = -1; if (forwardsNeedFixing) { @@ -2409,7 +2413,7 @@ IssueTryClausesInstructions( if (forwardsToFix[j] == -1) { continue; } - FIXJUMP(forwardsToFix[j]); + FIXJUMP4(forwardsToFix[j]); forwardsToFix[j] = -1; } } @@ -2417,11 +2421,11 @@ IssueTryClausesInstructions( BODY( handlerTokens[i], 5+i*4); } - JUMP(addrsToFix[i], JUMP4); + JUMP4( JUMP, addrsToFix[i]); if (matchClauses[i]) { - FIXJUMP(notECJumpSource); + FIXJUMP4( notECJumpSource); } - FIXJUMP(notCodeJumpSource); + FIXJUMP4( notCodeJumpSource); } /* @@ -2441,10 +2445,10 @@ IssueTryClausesInstructions( */ if (!trapZero) { - FIXJUMP(afterBody); + FIXJUMP4(afterBody); } for (i=0 ; icurrStackDepth = savedStackDepth; BODY( finallyToken, 3 + 4*numHandlers); @@ -2711,7 +2715,7 @@ IssueTryFinallyInstructions( Tcl_Token *finallyToken) { DefineLineInformation; /* TIP #280 */ - int range; + int range, jumpOK, jumpSplice; /* * Note that this one is simple enough that we can issue it without @@ -2734,15 +2738,28 @@ IssueTryFinallyInstructions( OP4( BEGIN_CATCH4, range); ExceptionRangeStarts(envPtr, range); BODY( finallyToken, 3); + ExceptionRangeEnds(envPtr, range); OP( END_CATCH); OP( POP); - OP1( JUMP1, 3); - TclAdjustStackDepth(-1, envPtr); + JUMP1( JUMP, jumpOK); + ExceptionRangeTarget(envPtr, range, catchOffset); OP( PUSH_RESULT); OP( PUSH_RETURN_OPTIONS); OP( PUSH_RETURN_CODE); OP( END_CATCH); + PUSH( "1"); + OP( EQ); + JUMP1( JUMP_FALSE, jumpSplice); + PUSH( "-during"); + OP4( OVER, 3); + OP4( LIST, 2); + OP( LIST_CONCAT); + FIXJUMP1( jumpSplice); + OP4( REVERSE, 4); + OP( POP); OP( POP); + OP1( JUMP1, 7); + FIXJUMP1( jumpOK); OP4( REVERSE, 2); OP( RETURN_STK); return TCL_OK; diff --git a/tests/error.test b/tests/error.test index 97bcc0a..273577a 100644 --- a/tests/error.test +++ b/tests/error.test @@ -17,6 +17,9 @@ if {[lsearch [namespace children] ::tcltest] == -1} { } testConstraint memory [llength [info commands memory]] +customMatch pairwise {apply {{a b} { + string equal [lindex $b 0] [lindex $b 1] +}}} namespace eval ::tcl::test::error { if {[testConstraint memory]} { proc getbytes {} { @@ -601,21 +604,21 @@ test error-16.7 {try with variable assignment and propagation #2} { } list $em [dict get $opts -errorcode] } {bar FOO} -test error-16.8 {exception chaining (try=ok, handler=error)} { +test error-16.8 {exception chaining (try=ok, handler=error)} -body { #FIXME is the intent of this test correct? catch { try { list a b c } on ok {em opts} { throw BAR baz } } tryem tryopts - string equal $opts [dict get $tryopts -during] -} {1} -test error-16.9 {exception chaining (try=error, handler=error)} { + list $opts [dict get $tryopts -during] +} -match pairwise -result equal +test error-16.9 {exception chaining (try=error, handler=error)} -body { # The exception off the handler should chain to the exception off the # try-body (using the -during option) catch { try { throw FOO bar } trap {} {em opts} { throw BAR baz } } tryem tryopts - string equal $opts [dict get $tryopts -during] -} {1} + list $opts [dict get $tryopts -during] +} -match pairwise -result equal test error-16.10 {no exception chaining when handler is successful} { catch { try { throw FOO bar } trap {} {em opts} { list d e f } @@ -628,6 +631,131 @@ test error-16.11 {no exception chaining when handler is a non-error exception} { } tryem tryopts dict exists $tryopts -during } {0} +test error-16.12 {compiled try with successfully executed handler} { + apply {{} { + try { throw FOO bar } trap FOO {} { list a b c } + }} +} {a b c} +test error-16.13 {compiled try with exception (error) in handler} -body { + apply {{} { + try { throw FOO bar } trap FOO {} { throw BAR foo } + }} +} -returnCodes error -result {foo} +test error-16.14 {compiled try with exception (return) in handler} -body { + apply {{} { + list [catch { + try { throw FOO bar } trap FOO {} { return BAR } + } msg] $msg + }} +} -result {2 BAR} +test error-16.15 {compiled try with exception (break) in handler} { + apply {{} { + for { set i 5 } { $i < 10 } { incr i } { + try { throw FOO bar } trap FOO {} { break } + } + return $i + }} +} {5} +test error-16.16 {compiled try with exception (continue) in handler} { + apply {{} { + for { set i 5 } { $i < 10 } { incr i } { + try { throw FOO bar } trap FOO {} { continue } + incr i 20 + } + return $i + }} +} {10} +test error-16.17 {compiled try with variable assignment and propagation #1} { + # Ensure that the handler variables preserve the exception off the + # try-body, and are not modified by the exception off the handler + apply {{} { + catch { + try { throw FOO bar } trap FOO {em} { throw BAR baz } + } + return $em + }} +} {bar} +test error-16.18 {compiled try with variable assignment and propagation #2} { + apply {{} { + catch { + try { throw FOO bar } trap FOO {em opts} { throw BAR baz } + } + list $em [dict get $opts -errorcode] + }} +} {bar FOO} +test error-16.19 {compiled try exception chaining (try=ok, handler=error)} -body { + #FIXME is the intent of this test correct? + apply {{} { + catch { + try { list a b c } on ok {em opts} { throw BAR baz } + } tryem tryopts + list $opts [dict get $tryopts -during] + }} +} -match pairwise -result equal +test error-16.20 {compiled try exception chaining (try=error, handler=error)} -body { + # The exception off the handler should chain to the exception off the + # try-body (using the -during option) + apply {{} { + catch { + try { throw FOO bar } trap {} {em opts} { throw BAR baz } + } tryem tryopts + list $opts [dict get $tryopts -during] + }} +} -match pairwise -result equal +test error-16.21 {compiled try exception chaining (try=error, finally=error)} { + # The exception off the handler should chain to the exception off the + # try-body (using the -during option) + apply {{} { + catch { + try { throw FOO bar } finally { throw BAR baz } + } tryem tryopts + dict get $tryopts -during -errorcode + }} +} FOO +test error-16.22 {compiled try: no exception chaining when handler is successful} { + apply {{} { + catch { + try { throw FOO bar } trap {} {em opts} { list d e f } + } tryem tryopts + dict exists $tryopts -during + }} +} {0} +test error-16.23 {compiled try: no exception chaining when handler is a non-error exception} { + apply {{} { + catch { + try { throw FOO bar } trap {} {em opts} { break } + } tryem tryopts + dict exists $tryopts -during + }} +} {0} +test error-16.24 {compiled try exception chaining (try=ok, handler=error, finally=error)} -body { + apply {{} { + catch { + try { + list a b c + } on ok {em opts} { + throw BAR baz + } finally { + throw DING dong + } + } tryem tryopts + list $opts [dict get $tryopts -during -during] + }} +} -match pairwise -result equal +test error-16.25 {compiled try exception chaining (all errors)} -body { + apply {{} { + catch { + try { + throw FOO bar + } on error {em opts} { + throw BAR baz + } finally { + throw DING dong + } + } tryem tryopts + list $opts [dict get $tryopts -during -during] + }} +} -match pairwise -result equal # try tests - finally @@ -709,15 +837,15 @@ test error-18.5 {exception in finally doesn't affect variable assignment} { } list $em [dict get $opts -errorcode] } {bar FOO} -test error-18.6 {exception chaining in finally (try=ok)} { +test error-18.6 {exception chaining in finally (try=ok)} -body { catch { list a b c } em expopts catch { try { list a b c } finally { throw BAR foo } } em opts - string equal $expopts [dict get $opts -during] -} {1} + list $expopts [dict get $opts -during] +} -match pairwise -result equal test error-18.7 {exception chaining in finally (try=error)} { catch { try { throw FOO bar } finally { throw BAR baz } -- cgit v0.12 From c5f23415aa4481746a0e6127f92fc112a9594068 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 9 Jun 2013 17:21:07 +0000 Subject: Fix the problems with code generation; behavior now appears correct. --- generic/tclCompCmdsSZ.c | 333 +++++++++++++++++++++++++++++------------------- 1 file changed, 204 insertions(+), 129 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index cbe36d1..5d67166 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2293,9 +2293,9 @@ IssueTryClausesInstructions( { DefineLineInformation; /* TIP #280 */ int range, resultVar, optionsVar; - int savedStackDepth = envPtr->currStackDepth; int i, j, len, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0; int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; + int *noError; char buf[TCL_INTEGER_SPACE]; resultVar = AnonymousLocal(envPtr); @@ -2357,8 +2357,10 @@ IssueTryClausesInstructions( addrsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers); forwardsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers); + noError = TclStackAlloc(interp, sizeof(int)*numHandlers); for (i=0 ; icurrStackDepth = savedStackDepth; + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); + OP4( BEGIN_CATCH4, range); + ExceptionRangeStarts(envPtr, range); BODY( handlerTokens[i], 5+i*4); + ExceptionRangeEnds(envPtr, range); + OP( END_CATCH); + JUMP4( JUMP, noError[i]); + ExceptionRangeTarget(envPtr, range, catchOffset); + TclAdjustStackDepth(-1, envPtr); + OP( PUSH_RESULT); + OP( PUSH_RETURN_OPTIONS); + OP( PUSH_RETURN_CODE); + OP( END_CATCH); + PUSH( "1"); + OP( EQ); + JUMP1( JUMP_FALSE, dontChangeOptions); + LOAD( optionsVar); + OP4( REVERSE, 2); + STORE( optionsVar); + OP( POP); + PUSH( "-during"); + OP4( REVERSE, 2); + OP44( DICT_SET, 1, optionsVar); + TclAdjustStackDepth(-1, envPtr); + FIXJUMP1( dontChangeOptions); + OP4( REVERSE, 2); + OP( RETURN_STK); } JUMP4( JUMP, addrsToFix[i]); @@ -2449,10 +2478,13 @@ IssueTryClausesInstructions( } for (i=0 ; icurrStackDepth = savedStackDepth + 1; return TCL_OK; } @@ -2470,9 +2502,8 @@ IssueTryClausesFinallyInstructions( Tcl_Token *finallyToken) /* Not NULL */ { DefineLineInformation; /* TIP #280 */ - int savedStackDepth = envPtr->currStackDepth; int range, resultVar, optionsVar, i, j, len, forwardsNeedFixing = 0; - int trapZero = 0, afterBody = 0; + int trapZero = 0, afterBody = 0, finalOK, finalError, noFinalError; int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; char buf[TCL_INTEGER_SPACE]; @@ -2502,7 +2533,6 @@ IssueTryClausesFinallyInstructions( range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); OP4( BEGIN_CATCH4, range); ExceptionRangeStarts(envPtr, range); - envPtr->currStackDepth = savedStackDepth; BODY( bodyToken, 1); ExceptionRangeEnds(envPtr, range); if (!trapZero) { @@ -2517,6 +2547,7 @@ IssueTryClausesFinallyInstructions( PUSH( "0"); OP4( REVERSE, 2); OP1( JUMP1, 4); + TclAdjustStackDepth(-2, envPtr); } ExceptionRangeTarget(envPtr, range, catchOffset); OP( PUSH_RETURN_CODE); @@ -2527,163 +2558,178 @@ IssueTryClausesFinallyInstructions( OP( POP); STORE( resultVar); OP( POP); - envPtr->currStackDepth = savedStackDepth + 1; /* * Now we handle all the registered 'on' and 'trap' handlers in order. + * + * Slight overallocation, but reduces size of this function. */ - if (numHandlers) { - /* - * Slight overallocation, but reduces size of this function. - */ - - addrsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers); - forwardsToFix = TclStackAlloc(interp, sizeof(int)*numHandlers); - - for (i=0 ; i= 0 || handlerTokens[i]) { - range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); - OP4( BEGIN_CATCH4, range); - ExceptionRangeStarts(envPtr, range); - } - if (resultVars[i] >= 0) { - LOAD( resultVar); - STORE( resultVars[i]); - OP( POP); - if (optionVars[i] >= 0) { - LOAD( optionsVar); - STORE( optionVars[i]); - OP( POP); - } + LOAD( optionsVar); + PUSH( "-errorcode"); + OP4( DICT_GET, 1); + TclAdjustStackDepth(-1, envPtr); + OP44( LIST_RANGE_IMM, 0, len-1); + p = Tcl_GetStringFromObj(matchClauses[i], &len); + PushLiteral(envPtr, p, len); + OP( STR_EQ); + JUMP4( JUMP_FALSE, notECJumpSource); + } else { + notECJumpSource = -1; /* LINT */ + } + OP( POP); - if (!handlerTokens[i]) { - /* - * No handler. Will not be the last handler (that is a - * condition that is checked by the caller). Chain to the - * next one. - */ + /* + * There is a finally clause, so we need a fairly complex sequence of + * instructions to deal with an on/trap handler because we must call + * the finally handler *and* we need to substitute the result from a + * failed trap for the result from the main script. + */ - ExceptionRangeEnds(envPtr, range); - OP( END_CATCH); - forwardsNeedFixing = 1; - JUMP4( JUMP, forwardsToFix[i]); - goto finishTrapCatchHandling; - } - } else if (!handlerTokens[i]) { + if (resultVars[i] >= 0 || handlerTokens[i]) { + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); + OP4( BEGIN_CATCH4, range); + ExceptionRangeStarts(envPtr, range); + } + if (resultVars[i] >= 0) { + LOAD( resultVar); + STORE( resultVars[i]); + OP( POP); + if (optionVars[i] >= 0) { + LOAD( optionsVar); + STORE( optionVars[i]); + OP( POP); + } + + if (!handlerTokens[i]) { /* - * No handler. Will not be the last handler (that condition is - * checked by the caller). Chain to the next one. + * No handler. Will not be the last handler (that is a + * condition that is checked by the caller). Chain to the next + * one. */ + ExceptionRangeEnds(envPtr, range); + OP( END_CATCH); forwardsNeedFixing = 1; JUMP4( JUMP, forwardsToFix[i]); - goto endOfThisArm; + goto finishTrapCatchHandling; } - + } else if (!handlerTokens[i]) { /* - * Got a handler. Make sure that any pending patch-up actions from - * previous unprocessed handlers are dealt with now that we know - * where they are to jump to. + * No handler. Will not be the last handler (that condition is + * checked by the caller). Chain to the next one. */ - if (forwardsNeedFixing) { - forwardsNeedFixing = 0; - OP1( JUMP1, 7); - for (j=0 ; jcurrStackDepth = savedStackDepth; - BODY( handlerTokens[i], 5+i*4); - ExceptionRangeEnds(envPtr, range); - OP( PUSH_RETURN_OPTIONS); - OP4( REVERSE, 2); - OP1( JUMP1, 4); - forwardsToFix[i] = -1; - - /* - * Error in handler or setting of variables; replace the stored - * exception with the new one. Note that we only push this if we - * have either a body or some variable setting here. Otherwise - * this code is unreachable. - */ + forwardsNeedFixing = 1; + JUMP4( JUMP, forwardsToFix[i]); + goto endOfThisArm; + } - finishTrapCatchHandling: - ExceptionRangeTarget(envPtr, range, catchOffset); - OP( PUSH_RETURN_OPTIONS); - OP( PUSH_RESULT); - OP( END_CATCH); - STORE( resultVar); - OP( POP); - STORE( optionsVar); - OP( POP); + /* + * Got a handler. Make sure that any pending patch-up actions from + * previous unprocessed handlers are dealt with now that we know where + * they are to jump to. + */ - endOfThisArm: - if (i+1 < numHandlers) { - JUMP4( JUMP, addrsToFix[i]); - } - if (matchClauses[i]) { - FIXJUMP4(notECJumpSource); + if (forwardsNeedFixing) { + forwardsNeedFixing = 0; + OP1( JUMP1, 7); + for (j=0 ; jcurrStackDepth = savedStackDepth; + range = TclCreateExceptRange(CATCH_EXCEPTION_RANGE, envPtr); + OP4( BEGIN_CATCH4, range); + ExceptionRangeStarts(envPtr, range); BODY( finallyToken, 3 + 4*numHandlers); + ExceptionRangeEnds(envPtr, range); + OP( END_CATCH); OP( POP); + JUMP1( JUMP, finalOK); + ExceptionRangeTarget(envPtr, range, catchOffset); + OP( PUSH_RESULT); + OP( PUSH_RETURN_OPTIONS); + OP( PUSH_RETURN_CODE); + OP( END_CATCH); + PUSH( "1"); + OP( EQ); + JUMP1( JUMP_FALSE, noFinalError); + LOAD( optionsVar); + PUSH( "-during"); + OP4( REVERSE, 3); + STORE( optionsVar); + OP( POP); + OP44( DICT_SET, 1, optionsVar); + TclAdjustStackDepth(-1, envPtr); + OP( POP); + JUMP1( JUMP, finalError); + TclAdjustStackDepth(1, envPtr); + FIXJUMP1( noFinalError); + STORE( optionsVar); + OP( POP); + FIXJUMP1( finalError); + STORE( resultVar); + OP( POP); + FIXJUMP1( finalOK); LOAD( optionsVar); LOAD( resultVar); OP( RETURN_STK); - envPtr->currStackDepth = savedStackDepth + 1; return TCL_OK; } -- cgit v0.12 From a9614d87b805cb106c4876c73858300e3c4359a3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 11 Jun 2013 07:58:01 +0000 Subject: Improve compatibility detection for and : - Move before other includes on Windows, so we are sure the time_t definition being checked doesn't come from . - Padding at the end of Tcl_StatBuf doesn't influcence binary compatibility, so relax panic check accordingly. --- generic/tclBasic.c | 7 ++++--- win/tclWinPort.h | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 5e6b500..4f24515 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -413,11 +413,12 @@ Tcl_CreateInterp(void) #if defined(_WIN32) && !defined(_WIN64) if (sizeof(time_t) != 4) { /*NOTREACHED*/ - Tcl_Panic("sys/time.h is not compatible with MSVC"); + Tcl_Panic(" is not compatible with MSVC"); } - if (sizeof(Tcl_StatBuf) != 48) { + if ((TclOffset(Tcl_StatBuf,st_atime) != 32) + || (TclOffset(Tcl_StatBuf,st_ctime) != 40)) { /*NOTREACHED*/ - Tcl_Panic("sys/stat.h is not compatible with MSVC"); + Tcl_Panic(" is not compatible with MSVC"); } #endif diff --git a/win/tclWinPort.h b/win/tclWinPort.h index f58014c..987d45b 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -51,6 +51,7 @@ typedef DWORD_PTR * PDWORD_PTR; *--------------------------------------------------------------------------- */ +#include #include #include #include @@ -85,8 +86,6 @@ typedef DWORD_PTR * PDWORD_PTR; # endif /* __BORLANDC__ */ #endif /* __MWERKS__ */ -#include - /* * Define EINPROGRESS in terms of WSAEINPROGRESS. */ -- cgit v0.12 From eee0c67ac8f3ae799c0222a6b0c4ad25c757b7e5 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 11 Jun 2013 16:44:34 +0000 Subject: [33b7abb8a2] [7174354ecb] Rewrite TclCompileThrowCmd(). --- generic/tclCompCmdsSZ.c | 105 +++++++++++++++++++++--------------------------- tests/error.test | 6 +++ 2 files changed, 52 insertions(+), 59 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 5d67166..b9ee1d4 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -1942,9 +1942,9 @@ TclCompileThrowCmd( { DefineLineInformation; /* TIP #280 */ int numWords = parsePtr->numWords; - int savedStackDepth = envPtr->currStackDepth; Tcl_Token *codeToken, *msgToken; Tcl_Obj *objPtr; + int codeKnown, codeIsList, codeIsValid, len; if (numWords != 3) { return TCL_ERROR; @@ -1954,77 +1954,64 @@ TclCompileThrowCmd( TclNewObj(objPtr); Tcl_IncrRefCount(objPtr); - if (TclWordKnownAtCompileTime(codeToken, objPtr)) { - Tcl_Obj *errPtr, *dictPtr; - const char *string; - int len; - /* - * The code is known at compilation time. This allows us to issue a - * very efficient sequence of instructions. - */ + codeKnown = TclWordKnownAtCompileTime(codeToken, objPtr); - if (Tcl_ListObjLength(interp, objPtr, &len) != TCL_OK) { - /* - * Must still do this; might generate an error when getting this - * "ignored" value prepared as an argument. - */ + /* + * First we must emit the code to substitute the arguments. This + * must come first in case substitution raises errors. + */ + if (!codeKnown) { + CompileWord(envPtr, codeToken, interp, 1); + PUSH( "-errorcode"); + } + CompileWord(envPtr, msgToken, interp, 2); - CompileWord(envPtr, msgToken, interp, 2); - TclCompileSyntaxError(interp, envPtr); - Tcl_DecrRefCount(objPtr); - envPtr->currStackDepth = savedStackDepth + 1; - return TCL_OK; - } - if (len == 0) { - /* - * Must still do this; might generate an error when getting this - * "ignored" value prepared as an argument. - */ + codeIsList = codeKnown && (TCL_OK == + Tcl_ListObjLength(interp, objPtr, &len)); + codeIsValid = codeIsList && (len != 0); + + if (codeIsValid) { + Tcl_Obj *errPtr, *dictPtr; - CompileWord(envPtr, msgToken, interp, 2); - goto issueErrorForEmptyCode; - } TclNewLiteralStringObj(errPtr, "-errorcode"); TclNewObj(dictPtr); Tcl_DictObjPut(NULL, dictPtr, errPtr, objPtr); - Tcl_IncrRefCount(dictPtr); - string = Tcl_GetStringFromObj(dictPtr, &len); - CompileWord(envPtr, msgToken, interp, 2); - PushLiteral(envPtr, string, len); - TclDecrRefCount(dictPtr); - OP44( RETURN_IMM, 1, 0); - envPtr->currStackDepth = savedStackDepth + 1; - } else { - /* - * When the code token is not known at compilation time, we need to do - * a little bit more work. The main tricky bit here is that the error - * code has to be a list (a [throw] restriction) so we must emit extra - * instructions to enforce that condition. - */ + TclEmitPush(TclAddLiteralObj(envPtr, dictPtr, NULL), envPtr); + } + TclDecrRefCount(objPtr); - CompileWord(envPtr, codeToken, interp, 1); - PUSH( "-errorcode"); - CompileWord(envPtr, msgToken, interp, 2); - OP4( REVERSE, 3); - OP( DUP); - OP( LIST_LENGTH); - OP1( JUMP_FALSE1, 16); - OP4( LIST, 2); - OP44( RETURN_IMM, 1, 0); + /* + * Simpler bytecodes when we detect invalid arguments at compile time. + */ + if (codeKnown && !codeIsValid) { + OP( POP); + if (codeIsList) { + /* Must be an empty list */ + goto issueErrorForEmptyCode; + } + TclCompileSyntaxError(interp, envPtr); + return TCL_OK; + } + if (!codeKnown) { /* - * Generate an error for being an empty list. Can't leverage anything - * else to do this for us. + * Argument validity checking has to be done by bytecode at + * run time. */ - + OP4( REVERSE, 3); + OP( DUP); + OP( LIST_LENGTH); + OP1( JUMP_FALSE1, 16); + OP4( LIST, 2); + OP44( RETURN_IMM, 1, 0); + OP( POP); + OP( POP); issueErrorForEmptyCode: - PUSH( "type must be non-empty list"); - PUSH( ""); - OP44( RETURN_IMM, 1, 0); + PUSH( "type must be non-empty list"); + PUSH( "-errorcode {TCL OPERATION THROW BADEXCEPTION}"); } - envPtr->currStackDepth = savedStackDepth + 1; - TclDecrRefCount(objPtr); + OP44( RETURN_IMM, 1, 0); return TCL_OK; } diff --git a/tests/error.test b/tests/error.test index 273577a..06f8eca 100644 --- a/tests/error.test +++ b/tests/error.test @@ -317,6 +317,12 @@ test error-8.8 {throw syntax checks} -returnCodes error -body { test error-8.9 {throw syntax checks} -returnCodes error -body { throw {} foo } -result {type must be non-empty list} +test error-8.10 {Bug 33b7abb8a2: throw stack usage} -returnCodes error -body { + apply {code {throw $code foo}} {} +} -result {type must be non-empty list} +test error-8.11 {Bug 7174354ecb: throw error message} -returnCodes error -body { + throw {not {}a list} x[]y +} -result {list element in braces followed by "a" instead of space} # simple try tests: body completes with code ok -- cgit v0.12 From d29536641dcd82c9373cc5835f9fd879194620e8 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 11 Jun 2013 17:58:49 +0000 Subject: Stack housekeeping repair for last checkin. --- generic/tclCompCmdsSZ.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index b9ee1d4..6897b9b 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2005,6 +2005,8 @@ TclCompileThrowCmd( OP1( JUMP_FALSE1, 16); OP4( LIST, 2); OP44( RETURN_IMM, 1, 0); + TclAdjustStackDepth(2, envPtr); + OP( POP); OP( POP); OP( POP); issueErrorForEmptyCode: -- cgit v0.12 From 236502157da38dfe3835d0daf426c2d2a0664160 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 11 Jun 2013 19:41:55 +0000 Subject: Repairs to compile/exec debugging output. --- generic/tclCompile.c | 7 ++++++- generic/tclExecute.c | 17 ++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index c361430..f6e0554 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1232,7 +1232,12 @@ CompileSubstObj( codePtr->localCachePtr = iPtr->varFramePtr->localCachePtr; codePtr->localCachePtr->refCount++; } - /* TODO: Debug printing? */ +#ifdef TCL_COMPILE_DEBUG + if (tclTraceCompile >= 2) { + TclPrintByteCodeObj(interp, objPtr); + fflush(stdout); + } +#endif /* TCL_COMPILE_DEBUG */ } return codePtr; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 443fb85..f5737b5 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2320,7 +2320,7 @@ TEBCresume( goto instLoadScalar1; } else if (inst == INST_PUSH1) { PUSH_OBJECT(codePtr->objArrayPtr[TclGetUInt1AtPtr(pc+1)]); - TRACE_WITH_OBJ(("%u => ", TclGetInt1AtPtr(pc+1)), OBJ_AT_TOS); + TRACE_WITH_OBJ(("%u => ", TclGetUInt1AtPtr(pc+1)), OBJ_AT_TOS); inst = *(pc += 2); goto peepholeStart; } else if (inst == INST_START_CMD) { @@ -2362,7 +2362,7 @@ TEBCresume( TRACE(("%u %u => ", code, level)); result = TclProcessReturn(interp, code, level, OBJ_AT_TOS); if (result == TCL_OK) { - TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")", + TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")\n", O2S(objResultPtr))); NEXT_INST_F(9, 1, 0); } @@ -2371,6 +2371,7 @@ TEBCresume( iPtr->flags &= ~ERR_ALREADY_LOGGED; } cleanup = 2; + TRACE_APPEND(("\n")); goto processExceptionReturn; } @@ -2381,7 +2382,7 @@ TEBCresume( if (result == TCL_OK) { Tcl_DecrRefCount(OBJ_AT_TOS); OBJ_AT_TOS = objResultPtr; - TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")", + TRACE_APPEND(("continuing to next instruction (result=\"%.30s\")\n", O2S(objResultPtr))); NEXT_INST_F(1, 0, 0); } else if (result == TCL_ERROR) { @@ -2401,6 +2402,7 @@ TEBCresume( Tcl_SetObjResult(interp, objResultPtr); } cleanup = 1; + TRACE_APPEND(("\n")); goto processExceptionReturn; case INST_YIELD: { @@ -3662,7 +3664,7 @@ TEBCresume( arrayPtr = NULL; part1Ptr = part2Ptr = NULL; cleanup = 0; - TRACE(("%u %ld => ", opnd, increment)); + TRACE(("%u %s => ", opnd, Tcl_GetString(incrPtr))); doIncrVar: if (TclIsVarDirectModifyable2(varPtr, arrayPtr)) { @@ -4227,7 +4229,7 @@ TEBCresume( } else { TRACE(("%d => %.20s false, new pc %u\n", jmpOffset[0], O2S(valuePtr), - (unsigned)(pc + jmpOffset[1] - codePtr->codeStart))); + (unsigned)(pc + jmpOffset[0] - codePtr->codeStart))); } } #endif @@ -6610,7 +6612,7 @@ TEBCresume( } #endif - TRACE_APPEND(("\"%.30s\" \"%.30s\" %d", + TRACE_APPEND(("\"%.30s\" \"%.30s\" %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), done)); objResultPtr = TCONST(done); /* TODO: consider opt like INST_FOREACH_STEP4 */ @@ -6624,7 +6626,7 @@ TEBCresume( while (TclIsVarLink(varPtr)) { varPtr = varPtr->value.linkPtr; } - TRACE(("%u => ", opnd)); + TRACE(("%u => \n", opnd)); if (TclIsVarDirectReadable(varPtr)) { dictPtr = varPtr->value.objPtr; } else { @@ -6753,6 +6755,7 @@ TEBCresume( O2S(dictPtr), O2S(listPtr)), Tcl_GetObjResult(interp)); goto gotError; } + TRACE((" => ")); TRACE_APPEND(("%.30s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); -- cgit v0.12 From 9ca9c6da3a55c6358a221f006c6cc846bd8d9922 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 11 Jun 2013 20:38:00 +0000 Subject: Select improvements in stack depth estimates brought over from mig-review. Mostly these are just simplifications, removing code that wasn't needed. Some changes make the stack depth estimate more accurate instruction by instruction. --- generic/tclCompCmds.c | 26 ++++---------------------- generic/tclCompCmdsGR.c | 15 +-------------- generic/tclCompCmdsSZ.c | 34 ++++++---------------------------- generic/tclCompExpr.c | 1 + generic/tclCompile.c | 12 +++++------- 5 files changed, 17 insertions(+), 71 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 25c4bac..fddf152 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -545,7 +545,6 @@ TclCompileCatchCmd( Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; int resultIndex, optsIndex, range; int initStackDepth = envPtr->currStackDepth; - int savedStackDepth; DefineLineInformation; /* TIP #280 */ /* @@ -613,13 +612,11 @@ TclCompileCatchCmd( SetLineInformation(1); if (cmdTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { - savedStackDepth = envPtr->currStackDepth; TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); CompileBody(envPtr, cmdTokenPtr, interp); } else { CompileTokens(envPtr, cmdTokenPtr, interp); - savedStackDepth = envPtr->currStackDepth; TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); TclEmitOpcode( INST_DUP, envPtr); @@ -641,7 +638,7 @@ TclCompileCatchCmd( TclEmitOpcode( INST_POP, envPtr); PushStringLiteral(envPtr, "0"); TclEmitInstInt1( INST_JUMP1, 3, envPtr); - envPtr->currStackDepth = savedStackDepth; + TclAdjustStackDepth(-1, envPtr); ExceptionRangeTarget(envPtr, range, catchOffset); TclEmitOpcode( INST_PUSH_RETURN_CODE, envPtr); ExceptionRangeEnds(envPtr, range); @@ -670,7 +667,7 @@ TclCompileCatchCmd( * return code. */ - envPtr->currStackDepth = savedStackDepth; + TclAdjustStackDepth(-2, envPtr); ExceptionRangeTarget(envPtr, range, catchOffset); /* Stack at this point: ?script? */ TclEmitOpcode( INST_PUSH_RESULT, envPtr); @@ -1286,6 +1283,7 @@ TclCompileDictMergeCmd( * subsequent) dicts. This is strictly not necessary, but it is nice. */ + TclAdjustStackDepth(-1, envPtr); ExceptionRangeTarget(envPtr, outLoop, catchOffset); TclEmitOpcode( INST_PUSH_RETURN_OPTIONS, envPtr); TclEmitOpcode( INST_PUSH_RESULT, envPtr); @@ -1295,7 +1293,6 @@ TclCompileDictMergeCmd( TclEmitInstInt1( INST_UNSET_SCALAR, 0, envPtr); TclEmitInt4( infoIndex, envPtr); TclEmitOpcode( INST_RETURN_STK, envPtr); - TclAdjustStackDepth(-1, envPtr); return TCL_OK; } @@ -1345,9 +1342,6 @@ CompileDictEachCmd( int numVars, endTargetOffset; int collectVar = -1; /* Index of temp var holding the result * dict. */ - int savedStackDepth = envPtr->currStackDepth; - /* Needed because jumps confuse the stack - * space calculator. */ const char **argv; Tcl_DString buffer; @@ -1510,6 +1504,7 @@ CompileDictEachCmd( * and rethrows the error. */ + TclAdjustStackDepth(-1, envPtr); ExceptionRangeTarget(envPtr, catchRange, catchOffset); TclEmitOpcode( INST_PUSH_RETURN_OPTIONS, envPtr); TclEmitOpcode( INST_PUSH_RESULT, envPtr); @@ -1528,7 +1523,6 @@ CompileDictEachCmd( * easy!) Note that we skip the END_CATCH. [Bug 1382528] */ - envPtr->currStackDepth = savedStackDepth + 2; jumpDisplacement = CurrentOffset(envPtr) - emptyTargetOffset; TclUpdateInstInt4AtPc(INST_JUMP_TRUE4, jumpDisplacement, envPtr->codeStart + emptyTargetOffset); @@ -2240,7 +2234,6 @@ TclCompileForCmd( JumpFixup jumpEvalCondFixup; int testCodeOffset, bodyCodeOffset, nextCodeOffset, jumpDist; int bodyRange, nextRange; - int savedStackDepth = envPtr->currStackDepth; DefineLineInformation; /* TIP #280 */ if (parsePtr->numWords != 5) { @@ -2302,7 +2295,6 @@ TclCompileForCmd( SetLineInformation(4); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, bodyRange); - envPtr->currStackDepth = savedStackDepth + 1; TclEmitOpcode(INST_POP, envPtr); /* @@ -2313,14 +2305,11 @@ TclCompileForCmd( nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); envPtr->exceptAuxArrayPtr[nextRange].supportsContinue = 0; - envPtr->currStackDepth = savedStackDepth; nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange); SetLineInformation(3); CompileBody(envPtr, nextTokenPtr, interp); ExceptionRangeEnds(envPtr, nextRange); - envPtr->currStackDepth = savedStackDepth + 1; TclEmitOpcode(INST_POP, envPtr); - envPtr->currStackDepth = savedStackDepth; /* * Compile the test expression then emit the conditional jump that @@ -2337,9 +2326,7 @@ TclCompileForCmd( } SetLineInformation(2); - envPtr->currStackDepth = savedStackDepth; TclCompileExprWords(interp, testTokenPtr, 1, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; jumpDist = CurrentOffset(envPtr) - bodyCodeOffset; if (jumpDist > 127) { @@ -2367,7 +2354,6 @@ TclCompileForCmd( * The for command's result is an empty string. */ - envPtr->currStackDepth = savedStackDepth; PushStringLiteral(envPtr, ""); return TCL_OK; @@ -2480,7 +2466,6 @@ CompileEachloopCmd( JumpFixup jumpFalseFixup; int jumpBackDist, jumpBackOffset, infoIndex, range, bodyIndex; int numWords, numLists, numVars, loopIndex, tempVar, i, j, code; - int savedStackDepth = envPtr->currStackDepth; DefineLineInformation; /* TIP #280 */ /* @@ -2703,7 +2688,6 @@ CompileEachloopCmd( ExceptionRangeStarts(envPtr, range); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); - envPtr->currStackDepth = savedStackDepth + 1; if (collect == TCL_EACH_COLLECT) { Emit14Inst( INST_LAPPEND_SCALAR, collectVar,envPtr); @@ -2763,7 +2747,6 @@ CompileEachloopCmd( * list of results from evaluating the loop body. */ - envPtr->currStackDepth = savedStackDepth; if (collect == TCL_EACH_COLLECT) { Emit14Inst( INST_LOAD_SCALAR, collectVar, envPtr); TclEmitInstInt1(INST_UNSET_SCALAR, 0, envPtr); @@ -2771,7 +2754,6 @@ CompileEachloopCmd( } else { PushStringLiteral(envPtr, ""); } - envPtr->currStackDepth = savedStackDepth + 1; done: for (loopIndex = 0; loopIndex < numLists; loopIndex++) { diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 5e3d456..f7c15e6 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -142,10 +142,6 @@ TclCompileIfCmd( int jumpIndex = 0; /* Avoid compiler warning. */ int jumpFalseDist, numWords, wordIdx, numBytes, j, code; const char *word; - int savedStackDepth = envPtr->currStackDepth; - /* Saved stack depth at the start of the first - * test; the envPtr current depth is restored - * to this value at the start of each test. */ int realCond = 1; /* Set to 0 for static conditions: * "if 0 {..}" */ int boolVal; /* Value of static condition. */ @@ -203,7 +199,6 @@ TclCompileIfCmd( * the "then" part. */ - envPtr->currStackDepth = savedStackDepth; testTokenPtr = tokenPtr; if (realCond) { @@ -270,7 +265,6 @@ TclCompileIfCmd( if (compileScripts) { SetLineInformation(wordIdx); - envPtr->currStackDepth = savedStackDepth; CompileBody(envPtr, tokenPtr, interp); } @@ -295,6 +289,7 @@ TclCompileIfCmd( * with a 4 byte jump. */ + TclAdjustStackDepth(-1, envPtr); if (TclFixupForwardJumpToHere(envPtr, jumpFalseFixupArray.fixup+jumpIndex, 120)) { /* @@ -325,13 +320,6 @@ TclCompileIfCmd( } /* - * Restore the current stack depth in the environment; the "else" clause - * (or its default) will add 1 to this. - */ - - envPtr->currStackDepth = savedStackDepth; - - /* * Check for the optional else clause. Do not compile anything if this was * an "if 1 {...}" case. */ @@ -416,7 +404,6 @@ TclCompileIfCmd( */ done: - envPtr->currStackDepth = savedStackDepth + 1; TclFreeJumpFixupArray(&jumpFalseFixupArray); TclFreeJumpFixupArray(&jumpEndFixupArray); return code; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 6897b9b..855dd8f 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -865,6 +865,7 @@ TclSubstCompile( /* Substitution produced TCL_OK */ OP( END_CATCH); TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &okFixup); + TclAdjustStackDepth(-1, envPtr); /* Exceptional return codes processed here */ ExceptionRangeTarget(envPtr, catchRange, catchOffset); @@ -890,6 +891,7 @@ TclSubstCompile( /* OTHER */ TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &otherFixup); + TclAdjustStackDepth(1, envPtr); /* BREAK destination */ if (TclFixupForwardJumpToHere(envPtr, &breakFixup, 127)) { Tcl_Panic("TclCompileSubstCmd: bad break jump distance %d", @@ -905,6 +907,7 @@ TclSubstCompile( OP1(JUMP1, -breakJump); } + TclAdjustStackDepth(2, envPtr); /* CONTINUE destination */ if (TclFixupForwardJumpToHere(envPtr, &continueFixup, 127)) { Tcl_Panic("TclCompileSubstCmd: bad continue jump distance %d", @@ -914,6 +917,7 @@ TclSubstCompile( OP( POP); TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &endFixup); + TclAdjustStackDepth(2, envPtr); /* RETURN + other destination */ if (TclFixupForwardJumpToHere(envPtr, &returnFixup, 127)) { Tcl_Panic("TclCompileSubstCmd: bad return jump distance %d", @@ -931,17 +935,6 @@ TclSubstCompile( OP4( REVERSE, 2); OP( POP); - /* - * We've emitted several POP instructions, and the automatic - * computations for stack depth requirements have been decrementing - * for every one. However, we know that every branch actually taken - * only encounters some of those instructions. No branch passes - * through them all. So, we now have a stack requirements estimate - * that is too low. Here we manually fix that up. - */ - - TclAdjustStackDepth(4, envPtr); - /* OK destination */ if (TclFixupForwardJumpToHere(envPtr, &okFixup, 127)) { Tcl_Panic("TclCompileSubstCmd: bad ok jump distance %d", @@ -1353,7 +1346,6 @@ IssueSwitchChainedTests( int **bodyContLines) /* Array of continuation line info. */ { enum {Switch_Exact, Switch_Glob, Switch_Regexp}; - int savedStackDepth = envPtr->currStackDepth; int foundDefault; /* Flag to indicate whether a "default" clause * is present. */ JumpFixup *fixupArray; /* Array of forward-jump fixup records. */ @@ -1388,7 +1380,6 @@ IssueSwitchChainedTests( foundDefault = 0; for (i=0 ; icurrStackDepth = savedStackDepth + 1; if (i!=numBodyTokens-2 || bodyToken[numBodyTokens-2]->size != 7 || memcmp(bodyToken[numBodyTokens-2]->start, "default", 7)) { /* @@ -1525,7 +1516,6 @@ IssueSwitchChainedTests( */ OP( POP); - envPtr->currStackDepth = savedStackDepth; envPtr->line = bodyLines[i+1]; /* TIP #280 */ envPtr->clNext = bodyContLines[i+1]; /* TIP #280 */ TclCompileCmdWord(interp, bodyToken[i+1], 1, envPtr); @@ -1583,8 +1573,6 @@ IssueSwitchChainedTests( } TclStackFree(interp, fixupTargetArray); TclStackFree(interp, fixupArray); - - envPtr->currStackDepth = savedStackDepth + 1; } /* @@ -1618,7 +1606,6 @@ IssueSwitchJumpTable( int **bodyContLines) /* Array of continuation line info. */ { JumptableInfo *jtPtr; - int savedStackDepth = envPtr->currStackDepth; int infoIndex, isNew, *finalFixups, numRealBodies = 0, jumpLocation; int mustGenerate, foundDefault, jumpToDefault, i; Tcl_DString buffer; @@ -1731,7 +1718,6 @@ IssueSwitchJumpTable( * Compile the body of the arm. */ - envPtr->currStackDepth = savedStackDepth; envPtr->line = bodyLines[i+1]; /* TIP #280 */ envPtr->clNext = bodyContLines[i+1]; /* TIP #280 */ TclCompileCmdWord(interp, bodyToken[i+1], 1, envPtr); @@ -1753,6 +1739,7 @@ IssueSwitchJumpTable( */ OP4( JUMP4, 0); + TclAdjustStackDepth(-1, envPtr); } } @@ -1763,7 +1750,6 @@ IssueSwitchJumpTable( */ if (!foundDefault) { - envPtr->currStackDepth = savedStackDepth; TclStoreInt4AtPtr(CurrentOffset(envPtr)-jumpToDefault, envPtr->codeStart+jumpToDefault+1); PUSH(""); @@ -1784,7 +1770,6 @@ IssueSwitchJumpTable( */ TclStackFree(interp, finalFixups); - envPtr->currStackDepth = savedStackDepth + 1; } /* @@ -2692,15 +2677,13 @@ IssueTryClausesFinallyInstructions( /* Skip POP at end; can clean up with subsequent POP */ if (i+1 < numHandlers) { OP( POP); - } else { - TclAdjustStackDepth(-1, envPtr); } endOfThisArm: if (i+1 < numHandlers) { JUMP4( JUMP, addrsToFix[i]); + TclAdjustStackDepth(1, envPtr); } - TclAdjustStackDepth(1, envPtr); if (matchClauses[i]) { FIXJUMP4( notECJumpSource); } @@ -2954,7 +2937,6 @@ TclCompileWhileCmd( Tcl_Token *testTokenPtr, *bodyTokenPtr; JumpFixup jumpEvalCondFixup; int testCodeOffset, bodyCodeOffset, jumpDist, range, code, boolVal; - int savedStackDepth = envPtr->currStackDepth; int loopMayEnd = 1; /* This is set to 0 if it is recognized as an * infinite loop. */ Tcl_Obj *boolObj; @@ -3054,7 +3036,6 @@ TclCompileWhileCmd( } CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); - envPtr->currStackDepth = savedStackDepth + 1; OP( POP); /* @@ -3069,10 +3050,8 @@ TclCompileWhileCmd( bodyCodeOffset += 3; testCodeOffset += 3; } - envPtr->currStackDepth = savedStackDepth; SetLineInformation(1); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); - envPtr->currStackDepth = savedStackDepth + 1; jumpDist = CurrentOffset(envPtr) - bodyCodeOffset; if (jumpDist > 127) { @@ -3103,7 +3082,6 @@ TclCompileWhileCmd( */ pushResult: - envPtr->currStackDepth = savedStackDepth; PUSH(""); return TCL_OK; } diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 3597abe..efdc2b0 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2401,6 +2401,7 @@ CompileExprTree( (nodePtr->lexeme == AND) ? "1" : "0", 1), envPtr); TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpPtr->next->next->jump); + TclAdjustStackDepth(-1, envPtr); TclFixupForwardJumpToHere(envPtr, &jumpPtr->next->jump, 127); if (TclFixupForwardJumpToHere(envPtr, &jumpPtr->jump, 127)) { jumpPtr->next->next->jump.codeOffset += 3; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index f6e0554..be5bedf 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2009,8 +2009,7 @@ TclCompileScript( #ifdef TCL_COMPILE_DEBUG int diff = envPtr->currStackDepth-startStackDepth; - if (diff != 1 && (diff != 0 || - *(envPtr->codeNext-1) != INST_DONE)) { + if (diff != 1) { Tcl_Panic("bad stack adjustment when compiling" " %.*s (was %d instead of 1)", parsePtr->tokenPtr->size, @@ -2628,12 +2627,10 @@ TclCompileNoOp( { Tcl_Token *tokenPtr; int i; - int savedStackDepth = envPtr->currStackDepth; tokenPtr = parsePtr->tokenPtr; for (i = 1; i < parsePtr->numWords; i++) { tokenPtr = tokenPtr + tokenPtr->numComponents + 1; - envPtr->currStackDepth = savedStackDepth; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents, @@ -2641,7 +2638,6 @@ TclCompileNoOp( TclEmitOpcode(INST_POP, envPtr); } } - envPtr->currStackDepth = savedStackDepth; TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); return TCL_OK; } @@ -3439,6 +3435,7 @@ TclCleanupStackForBreakContinue( CompileEnv *envPtr, ExceptionAux *auxPtr) { + int savedStackDepth = envPtr->currStackDepth; int toPop = envPtr->expandCount - auxPtr->expandTarget; if (toPop > 0) { @@ -3446,20 +3443,21 @@ TclCleanupStackForBreakContinue( TclEmitOpcode(INST_EXPAND_DROP, envPtr); toPop--; } + TclAdjustStackDepth(auxPtr->expandTargetDepth - envPtr->currStackDepth, + envPtr); toPop = auxPtr->expandTargetDepth - auxPtr->stackDepth; while (toPop > 0) { TclEmitOpcode(INST_POP, envPtr); - TclAdjustStackDepth(1, envPtr); toPop--; } } else { toPop = envPtr->currStackDepth - auxPtr->stackDepth; while (toPop > 0) { TclEmitOpcode(INST_POP, envPtr); - TclAdjustStackDepth(1, envPtr); toPop--; } } + envPtr->currStackDepth = savedStackDepth; } /* -- cgit v0.12 From b028eea89ffe9a3c009dff8b8f7dde6421d2743b Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 11 Jun 2013 22:47:22 +0000 Subject: Revise INST_EXPAND_STKTOP so that it no longer makes use of its operand. All the information required to do a proper expansion of the exec stack to support expanded command invocation is already present. The operand doesn't provide any essential information. By ignoring it, we eliminate the risk that the compiler might fill in the operand with a bad stack depth estimate value. INST_EXPAND_STKTOP doesn't need an operand, but in order to support loading of existing bytecodes we cannot change it now. There's also no need to change what the compiler tries to place in the operand, though changing it to always be zeros would be acceptable now. --- generic/tclExecute.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f5737b5..98f1ed8 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -202,6 +202,9 @@ typedef struct TEBCdata { #define PUSH_TAUX_OBJ(objPtr) \ do { \ + if (auxObjList) { \ + objPtr->length += auxObjList->length; \ + } \ objPtr->internalRep.ptrAndLongRep.ptr = auxObjList; \ auxObjList = objPtr; \ } while (0) @@ -2717,6 +2720,7 @@ TEBCresume( TclNewObj(objPtr); objPtr->internalRep.ptrAndLongRep.value = CURR_DEPTH; + objPtr->length = 0; PUSH_TAUX_OBJ(objPtr); NEXT_INST_F(1, 0, 0); @@ -2761,22 +2765,27 @@ TEBCresume( * stack depth, as seen by the compiler. */ - length = objc + (codePtr->maxStackDepth - TclGetInt4AtPtr(pc+1)); - DECACHE_STACK_INFO(); - moved = GrowEvaluationStack(iPtr->execEnvPtr, length, 1) - - (Tcl_Obj **) TD; - if (moved) { - /* - * Change the global data to point to the new stack: move the - * TEBCdataPtr TD, recompute the position of every other - * stack-allocated parameter, update the stack pointers. - */ + auxObjList->length += objc - 1; + if ((objc > 1) && (auxObjList-length > 0)) { + length = auxObjList->length /* Total expansion room we need */ + + codePtr->maxStackDepth /* Beyond the original max */ + - CURR_DEPTH; /* Relative to where we are */ + DECACHE_STACK_INFO(); + moved = GrowEvaluationStack(iPtr->execEnvPtr, length, 1) + - (Tcl_Obj **) TD; + if (moved) { + /* + * Change the global data to point to the new stack: move the + * TEBCdataPtr TD, recompute the position of every other + * stack-allocated parameter, update the stack pointers. + */ - esPtr = iPtr->execEnvPtr->execStackPtr; - TD = (TEBCdata *) (((Tcl_Obj **)TD) + moved); + esPtr = iPtr->execEnvPtr->execStackPtr; + TD = (TEBCdata *) (((Tcl_Obj **)TD) + moved); - catchTop += moved; - tosPtr += moved; + catchTop += moved; + tosPtr += moved; + } } /* -- cgit v0.12 From c90aa17e6ef729c6cab8a8f6a1ca988c9c3d4b62 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Jun 2013 10:24:52 +0000 Subject: Silence various warnings when doing a 64-bit build with MSVC: Those warnings can only _really_ be fixed in "novem" (so, don't silence them there) --- win/tclWinPort.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 987d45b..b545a09 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -350,9 +350,9 @@ typedef DWORD_PTR * PDWORD_PTR; #if defined(_MSC_VER) || defined(__MINGW32__) # define environ _environ -# if defined(_MSC_VER) && (_MSC_VER < 1600) +# if defined(_MSC_VER) && (_MSC_VER < 1600) # define hypot _hypot -# endif +# endif # define exception _exception # undef EDEADLOCK # if defined(__MINGW32__) && !defined(__MSVCRT__) @@ -381,8 +381,10 @@ typedef DWORD_PTR * PDWORD_PTR; * including the *printf family and others. Tell it to shut up. * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0) */ -#if _MSC_VER >= 1400 -#pragma warning(disable:4996) +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# pragma warning(disable:4244) +# pragma warning(disable:4267) +# pragma warning(disable:4996) #endif -- cgit v0.12 From cd31de89b083f0dc02aee63895b89d45e6c1ffb9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Jun 2013 12:24:23 +0000 Subject: Workaround for mingw-w64 (AMD64-only) bug: It appears that zdll.lib (as produced by Microsoft tools) doesn't import the zlib symbols correctly, so use "libz.dll.a" produced with mingw-w64 tools in stead. --- compat/zlib/win64/libz.dll.a | Bin 0 -> 46874 bytes win/Makefile.in | 2 +- win/configure | 12 +++++++++++- win/configure.in | 6 +++++- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 compat/zlib/win64/libz.dll.a diff --git a/compat/zlib/win64/libz.dll.a b/compat/zlib/win64/libz.dll.a new file mode 100644 index 0000000..a3ae403 Binary files /dev/null and b/compat/zlib/win64/libz.dll.a differ diff --git a/win/Makefile.in b/win/Makefile.in index 18993fe..47f3fdd 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -458,7 +458,7 @@ ${TEST_DLL_FILE}: ${TCLTEST_OBJS} ${TCL_STUB_LIB_FILE} # use pre-built zlib1.dll ${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE} - @if test "@ZLIB_LIBS@set" == "${ZLIB_DIR}/win64/zdll.libset" ; then \ + @if test "@ZLIB_LIBS@set" != "${ZLIB_DIR}/win32/zdll.libset" ; then \ $(COPY) $(ZLIB_DIR)/win64/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \ else \ $(COPY) $(ZLIB_DIR)/win32/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \ diff --git a/win/configure b/win/configure index bad344c..fc453f8 100755 --- a/win/configure +++ b/win/configure @@ -4362,7 +4362,17 @@ if test "$tcl_ok" = "yes"; then if test "$do64bit" = "yes"; then - ZLIB_LIBS=\${ZLIB_DIR}/win64/zdll.lib + if test "$GCC" == "yes"; then + + ZLIB_LIBS=\${ZLIB_DIR}/win64/libz.dll.a + + +else + + ZLIB_LIBS=\${ZLIB_DIR}/win64/zdll.lib + + +fi else diff --git a/win/configure.in b/win/configure.in index 574fce2..373cfcc 100644 --- a/win/configure.in +++ b/win/configure.in @@ -129,7 +129,11 @@ AS_IF([test "${enable_shared+set}" = "set"], [ AS_IF([test "$tcl_ok" = "yes"], [ AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}]) AS_IF([test "$do64bit" = "yes"], [ - AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/zdll.lib]) + AS_IF([test "$GCC" == "yes"],[ + AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/libz.dll.a]) + ], [ + AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/zdll.lib]) + ]) ], [ AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib]) ]) -- cgit v0.12 From b59537759a964c286781a6e052893f1f55e7c7b1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Jun 2013 19:36:49 +0000 Subject: Fix env.test when running mingw-w64 (AMD64 build) test-suite on wine64 --- tests/env.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/env.test b/tests/env.test index c42e49d..ee13b7f 100644 --- a/tests/env.test +++ b/tests/env.test @@ -86,7 +86,7 @@ set printenvScript [makeFile { SHLIB_PATH SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING __CF_USER_TEXT_ENCODING SECURITYSESSIONID LANG WINDIR TERM - CommonProgramFiles ProgramFiles + CommonProgramFiles ProgramFiles CommonProgramW6432 ProgramW6432 } { lrem names $name } @@ -118,7 +118,7 @@ foreach name [array names env] { SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING SECURITYSESSIONID LANG WINDIR TERM - CommonProgramFiles ProgramFiles + CONNOMPROGRAMFILES PROGRAMFILES COMMONPROGRAMW6432 PROGRAMW6432 }} { unset env($name) } -- cgit v0.12 From 232d48bde8d33fd790e47e94cf9f239db3099505 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 13 Jun 2013 07:13:09 +0000 Subject: Fix some gcc warnings which become visible with -Wextra --- generic/tclIOCmd.c | 34 +++++++++++++++++----------------- generic/tclThreadTest.c | 22 +++++++++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 21dcd71..2958bc8 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1823,24 +1823,24 @@ TclInitChanCmd( * function at the moment. */ static const EnsembleImplMap initMap[] = { - {"blocked", Tcl_FblockedObjCmd}, - {"close", Tcl_CloseObjCmd}, - {"copy", Tcl_FcopyObjCmd}, - {"create", TclChanCreateObjCmd}, /* TIP #219 */ - {"eof", Tcl_EofObjCmd}, - {"event", Tcl_FileEventObjCmd}, - {"flush", Tcl_FlushObjCmd}, - {"gets", Tcl_GetsObjCmd}, - {"pending", ChanPendingObjCmd}, /* TIP #287 */ - {"postevent", TclChanPostEventObjCmd}, /* TIP #219 */ - {"puts", Tcl_PutsObjCmd}, - {"read", Tcl_ReadObjCmd}, - {"seek", Tcl_SeekObjCmd}, - {"tell", Tcl_TellObjCmd}, - {"truncate", ChanTruncateObjCmd}, /* TIP #208 */ - {NULL} + {"blocked", Tcl_FblockedObjCmd, NULL}, + {"close", Tcl_CloseObjCmd, NULL}, + {"copy", Tcl_FcopyObjCmd, NULL}, + {"create", TclChanCreateObjCmd, NULL}, /* TIP #219 */ + {"eof", Tcl_EofObjCmd, NULL}, + {"event", Tcl_FileEventObjCmd, NULL}, + {"flush", Tcl_FlushObjCmd, NULL}, + {"gets", Tcl_GetsObjCmd, NULL}, + {"pending", ChanPendingObjCmd, NULL}, /* TIP #287 */ + {"postevent", TclChanPostEventObjCmd, NULL}, /* TIP #219 */ + {"puts", Tcl_PutsObjCmd, NULL}, + {"read", Tcl_ReadObjCmd, NULL}, + {"seek", Tcl_SeekObjCmd, NULL}, + {"tell", Tcl_TellObjCmd, NULL}, + {"truncate", ChanTruncateObjCmd, NULL}, /* TIP #208 */ + {NULL,NULL, NULL} }; - static const char *extras[] = { + static const char *const extras[] = { "configure", "::fconfigure", "names", "::file channels", NULL diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index d032cc6..f899779 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -292,7 +292,7 @@ Tcl_ThreadObjCmd( return TCL_OK; case THREAD_ID: if (objc == 2) { - Tcl_Obj *idObj = Tcl_NewLongObj((long) Tcl_GetCurrentThread()); + Tcl_Obj *idObj = Tcl_NewWideIntObj((Tcl_WideInt)(size_t) Tcl_GetCurrentThread()); Tcl_SetObjResult(interp, idObj); return TCL_OK; @@ -301,24 +301,24 @@ Tcl_ThreadObjCmd( return TCL_ERROR; } case THREAD_JOIN: { - long id; + Tcl_WideInt id; int result, status; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "id"); return TCL_ERROR; } - if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) { + if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) { return TCL_ERROR; } - result = Tcl_JoinThread ((Tcl_ThreadId) id, &status); + result = Tcl_JoinThread ((Tcl_ThreadId)(size_t)id, &status); if (result == TCL_OK) { Tcl_SetIntObj (Tcl_GetObjResult (interp), status); } else { char buf [20]; - sprintf(buf, "%ld", id); + sprintf(buf, "%" TCL_LL_MODIFIER "d", id); Tcl_AppendResult(interp, "cannot join thread ", buf, NULL); } return result; @@ -330,7 +330,7 @@ Tcl_ThreadObjCmd( } return TclThreadList(interp); case THREAD_SEND: { - long id; + Tcl_WideInt id; const char *script; int wait, arg; @@ -349,12 +349,12 @@ Tcl_ThreadObjCmd( wait = 1; arg = 2; } - if (Tcl_GetLongFromObj(interp, objv[arg], &id) != TCL_OK) { + if (Tcl_GetWideIntFromObj(interp, objv[arg], &id) != TCL_OK) { return TCL_ERROR; } arg++; script = Tcl_GetString(objv[arg]); - return TclThreadSend(interp, (Tcl_ThreadId) id, script, wait); + return TclThreadSend(interp, (Tcl_ThreadId)(size_t)id, script, wait); } case THREAD_ERRORPROC: { /* @@ -434,7 +434,7 @@ TclCreateThread( Tcl_ConditionWait(&ctrl.condWait, &threadMutex, NULL); Tcl_MutexUnlock(&threadMutex); Tcl_ConditionFinalize(&ctrl.condWait); - Tcl_SetObjResult(interp, Tcl_NewLongObj((long)id)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)(size_t)id)); return TCL_OK; } @@ -560,7 +560,7 @@ ThreadErrorProc( const char *errorInfo, *argv[3]; char *script; char buf[TCL_DOUBLE_SPACE+1]; - sprintf(buf, "%ld", (long) Tcl_GetCurrentThread()); + sprintf(buf, "%" TCL_LL_MODIFIER "d", (Tcl_WideInt)(size_t)Tcl_GetCurrentThread()); errorInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY); if (errorProcString == NULL) { @@ -677,7 +677,7 @@ TclThreadList( Tcl_MutexLock(&threadMutex); for (tsdPtr = threadList ; tsdPtr ; tsdPtr = tsdPtr->nextPtr) { Tcl_ListObjAppendElement(interp, listPtr, - Tcl_NewLongObj((long) tsdPtr->threadId)); + Tcl_NewWideIntObj((Tcl_WideInt)(size_t)tsdPtr->threadId)); } Tcl_MutexUnlock(&threadMutex); Tcl_SetObjResult(interp, listPtr); -- cgit v0.12 From c3bb908ec5427846f355b333087a3e4c19e71d4e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 14 Jun 2013 10:11:08 +0000 Subject: Don't use deprecated stricmp/strnicmp any more, but underscored variant for non-GNU compilers. --- win/tclWinPort.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/win/tclWinPort.h b/win/tclWinPort.h index b545a09..ec9e867 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -64,11 +64,9 @@ typedef DWORD_PTR * PDWORD_PTR; #include #include -#ifndef strncasecmp -# define strncasecmp strnicmp -#endif -#ifndef strcasecmp -# define strcasecmp stricmp +#ifndef __GNUC__ +# define strncasecmp _strnicmp +# define strcasecmp _stricmp #endif /* -- cgit v0.12 From 68292a6506ecddc2460b6f47f7589f8ad66a4858 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 16 Jun 2013 20:32:50 +0000 Subject: split off TclInitStubTable() as separate function - which does the actual stub table initialization - previously part of Tcl_InitStubs(). --- generic/tclInt.h | 8 ++++++ generic/tclStubLib.c | 27 +++---------------- generic/tclStubLibTbl.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ unix/Makefile.in | 6 ++++- win/Makefile.in | 4 +++ win/makefile.bc | 4 +++ win/makefile.vc | 4 +++ win/tcl.dsp | 4 +++ 8 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 generic/tclStubLibTbl.c diff --git a/generic/tclInt.h b/generic/tclInt.h index e60b627..1cf0337 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3831,6 +3831,14 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); +/* Used internally in stub library. */ +typedef struct { + char version[16]; + ClientData data; +} TclStubInfoType; + +MODULE_SCOPE const char *TclInitStubTable(const char *version); + /* * Functions defined in generic/tclVar.c and currenttly exported only for use * by the bytecode compiler and engine. Some of these could later be placed in diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index 859cbf9..e617515 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -13,16 +13,6 @@ #include "tclInt.h" -MODULE_SCOPE const TclStubs *tclStubsPtr; -MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr; -MODULE_SCOPE const TclIntStubs *tclIntStubsPtr; -MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr; - -const TclStubs *tclStubsPtr = NULL; -const TclPlatStubs *tclPlatStubsPtr = NULL; -const TclIntStubs *tclIntStubsPtr = NULL; -const TclIntPlatStubs *tclIntPlatStubsPtr = NULL; - /* * Use our own isDigit to avoid linking to libc on windows */ @@ -58,7 +48,7 @@ Tcl_InitStubs( { Interp *iPtr = (Interp *) interp; const char *actualVersion = NULL; - ClientData pkgData = NULL; + TclStubInfoType stub; const TclStubs *stubsPtr = iPtr->stubTable; /* @@ -73,7 +63,7 @@ Tcl_InitStubs( return NULL; } - actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData); + actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &stub.data); if (actualVersion == NULL) { return NULL; } @@ -103,18 +93,7 @@ Tcl_InitStubs( } } } - tclStubsPtr = (TclStubs *)pkgData; - - if (tclStubsPtr->hooks) { - tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; - tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; - tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; - } else { - tclPlatStubsPtr = NULL; - tclIntStubsPtr = NULL; - tclIntPlatStubsPtr = NULL; - } - + TclInitStubTable(stub.version); return actualVersion; } diff --git a/generic/tclStubLibTbl.c b/generic/tclStubLibTbl.c new file mode 100644 index 0000000..0ed057f --- /dev/null +++ b/generic/tclStubLibTbl.c @@ -0,0 +1,69 @@ +/* + * tclStubLibTbl.c -- + * + * Stub object that will be statically linked into extensions that want + * to access Tcl. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * Copyright (c) 1998 Paul Duffin. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" + +MODULE_SCOPE const TclStubs *tclStubsPtr; +MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr; +MODULE_SCOPE const TclIntStubs *tclIntStubsPtr; +MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr; + +const TclStubs *tclStubsPtr = NULL; +const TclPlatStubs *tclPlatStubsPtr = NULL; +const TclIntStubs *tclIntStubsPtr = NULL; +const TclIntPlatStubs *tclIntPlatStubsPtr = NULL; + + +/* + *---------------------------------------------------------------------- + * + * TclInitStubTable -- + * + * Initialize the stub table, using the structure pointed at + * by the "version" argument. + * + * Results: + * Outputs the value of the "version" argument. + * + * Side effects: + * Sets the stub table pointers. + * + *---------------------------------------------------------------------- + */ +MODULE_SCOPE const char * +TclInitStubTable( + const char *version) /* points to the version field of a + TclStubInfoType structure variable. */ +{ + const TclStubInfoType *ptr = (const TclStubInfoType *) version; + tclStubsPtr = (const TclStubs *) ptr->data; + + if (tclStubsPtr->hooks) { + tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; + tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; + tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; + } else { + tclPlatStubsPtr = NULL; + tclIntStubsPtr = NULL; + tclIntPlatStubsPtr = NULL; + } + return version; +} + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/unix/Makefile.in b/unix/Makefile.in index 3e4a6f6..94a5473 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -335,7 +335,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o \ bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o -STUB_LIB_OBJS = tclStubLib.o tclTomMathStubLib.o tclOOStubLib.o ${COMPAT_OBJS} +STUB_LIB_OBJS = tclStubLib.o tclStubLibTbl.o tclTomMathStubLib.o tclOOStubLib.o ${COMPAT_OBJS} UNIX_OBJS = tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \ tclUnixFile.o tclUnixPipe.o tclUnixSock.o \ @@ -470,6 +470,7 @@ OO_SRCS = \ STUB_SRCS = \ $(GENERIC_DIR)/tclStubLib.c \ + $(GENERIC_DIR)/tclStubLibTbl.c \ $(GENERIC_DIR)/tclTomMathStubLib.c \ $(GENERIC_DIR)/tclOOStubLib.c @@ -1685,6 +1686,9 @@ Zzutil.o: $(ZLIB_DIR)/zutil.c tclStubLib.o: $(GENERIC_DIR)/tclStubLib.c $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclStubLib.c +tclStubLibTbl.o: $(GENERIC_DIR)/tclStubLibTbl.c + $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclStubLibTbl.c + tclTomMathStubLib.o: $(GENERIC_DIR)/tclTomMathStubLib.c $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclTomMathStubLib.c diff --git a/win/Makefile.in b/win/Makefile.in index 47f3fdd..d7b25b7 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -385,6 +385,7 @@ REG_OBJS = tclWinReg.$(OBJEXT) STUB_OBJS = \ tclStubLib.$(OBJEXT) \ + tclStubLibTbl.$(OBJEXT) \ tclTomMathStubLib.$(OBJEXT) \ tclOOStubLib.$(OBJEXT) @@ -515,6 +516,9 @@ tclPkgConfig.${OBJEXT}: tclPkgConfig.c tclStubLib.${OBJEXT}: tclStubLib.c $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) +tclStubLibTbl.${OBJEXT}: tclStubLibTbl.c + $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) + tclTomMathStubLib.${OBJEXT}: tclTomMathStubLib.c $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) diff --git a/win/makefile.bc b/win/makefile.bc index 0b17cea..2726dad 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -279,6 +279,7 @@ TCLOBJS = \ TCLSTUBOBJS = \ $(TMPDIR)\tclStubLib.obj \ + $(TMPDIR)\tclStubLibTbl.obj \ $(TMPDIR)\tclTomMathStubLib.obj \ $(TMPDIR)\tclOOStubLib.obj @@ -528,6 +529,9 @@ $(TMPDIR)\tclWinDde.obj : $(WINDIR)\tclWinDde.c $(TMPDIR)\tclStubLib.obj : $(GENERICDIR)\tclStubLib.c $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -o$(TMPDIR)\$@ $? +$(TMPDIR)\tclStubLibTbl.obj : $(GENERICDIR)\tclStubLibTbl.c + $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -o$(TMPDIR)\$@ $? + $(TMPDIR)\tclTomMathStubLib.obj : $(GENERICDIR)\tclTomMathStubLib.c $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -o$(TMPDIR)\$@ $? diff --git a/win/makefile.vc b/win/makefile.vc index cddb253..c24534a 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -450,6 +450,7 @@ TCLOBJS = $(COREOBJS) $(ZLIBOBJS) $(TOMMATHOBJS) $(PLATFORMOBJS) TCLSTUBOBJS = \ $(TMP_DIR)\tclStubLib.obj \ + $(TMP_DIR)\tclStubLibTbl.obj \ $(TMP_DIR)\tclTomMathStubLib.obj \ $(TMP_DIR)\tclOOStubLib.obj @@ -979,6 +980,9 @@ $(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c $(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? +$(TMP_DIR)\tclStubLibTbl.obj: $(GENERICDIR)\tclStubLibTbl.c + $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? + $(TMP_DIR)\tclTomMathStubLib.obj: $(GENERICDIR)\tclTomMathStubLib.c $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? diff --git a/win/tcl.dsp b/win/tcl.dsp index 57ec6bf..2708051 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -1300,6 +1300,10 @@ SOURCE=..\generic\tclStubLib.c # End Source File # Begin Source File +SOURCE=..\generic\tclStubLibTbl.c +# End Source File +# Begin Source File + SOURCE=..\generic\tclOOStubLib.c # End Source File # Begin Source File -- cgit v0.12 From be5d1b00c4af601c562154ca455e2c0e9801d8c1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 16 Jun 2013 20:48:57 +0000 Subject: link tclsh with stub library, just like xttest and tcltest, in order to allow additional static stub-enabled libraries to be linked with it. --- unix/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 94a5473..5295a45 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -633,9 +633,9 @@ tclLibObjs: # This targets actually build the objects needed for the lib in the above case objs: ${OBJS} -${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} +${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} \ - @TCL_BUILD_LIB_SPEC@ ${LIBS} @EXTRA_TCLSH_LIBS@ \ + @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCL_EXE} # Must be empty so it doesn't conflict with rule for ${TCL_EXE} above -- cgit v0.12 From 259d5037ca4b4dc37c6e6b01d6d2ffee9c249d52 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Jun 2013 04:41:57 +0000 Subject: On 32-bit platforms, 12 characters for version is enough, on 64-bit platforms it will be aligned to 16 characters anyway. --- generic/tclInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 1cf0337..2d3a248 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3833,7 +3833,7 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, /* Used internally in stub library. */ typedef struct { - char version[16]; + char version[12]; ClientData data; } TclStubInfoType; -- cgit v0.12 From f6678bdedc2a7668eb984f7e375886da59a63888 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Jun 2013 04:52:01 +0000 Subject: Fix [a876646efe]: re_expr character class [:cntrl:] should contain \u0000 - \u001f --- ChangeLog | 5 +++++ generic/regc_locale.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d5e542..54c3b99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-06-17 Jan Nijtmans + + * generic/regc_locale.c: Bug [a876646efe]: re_expr character class + [:cntrl:] should contain \u0000 - \u001f + 2013-06-03 Miguel Sofer * generic/tclExecute.c: fix for perf bug detected by Kieran diff --git a/generic/regc_locale.c b/generic/regc_locale.c index 40791f4..dd1c01c 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -259,8 +259,9 @@ static const chr alphaCharTable[] = { */ static const crange controlRangeTable[] = { - {0x7f, 0x9f}, {0x600, 0x604}, {0x200b, 0x200f}, {0x202a, 0x202e}, - {0x2060, 0x2064}, {0x206a, 0x206f}, {0xe000, 0xf8ff}, {0xfff9, 0xfffb} + {0x0, 0x1f}, {0x7f, 0x9f}, {0x600, 0x604}, {0x200b, 0x200f}, + {0x202a, 0x202e}, {0x2060, 0x2064}, {0x206a, 0x206f}, {0xe000, 0xf8ff}, + {0xfff9, 0xfffb} #if TCL_UTF_MAX > 4 ,{0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd}, {0x100000, 0x10fffd} #endif -- cgit v0.12 From 70024494041b53923a32939fa834efcfd2f1f888 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Jun 2013 13:23:29 +0000 Subject: Use more portable TclIsSpaceProc() in stead of isspace(). Make sure that "string is space \u180e" continues to return 1 for whatever unicode version. --- generic/tclCmdAH.c | 7 +++---- generic/tclDate.c | 2 +- generic/tclUtf.c | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 44f08a3..7f0df83 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -130,8 +130,7 @@ Tcl_CaseObjCmd( for (i = 0; i < caseObjc; i += 2) { int patObjc, j; const char **patObjv; - char *pat; - unsigned char *p; + char *pat, *p; if (i == (caseObjc - 1)) { Tcl_ResetResult(interp); @@ -145,8 +144,8 @@ Tcl_CaseObjCmd( */ pat = TclGetString(caseObjv[i]); - for (p = (unsigned char *) pat; *p != '\0'; p++) { - if (isspace(*p) || (*p == '\\')) { /* INTL: ISO space, UCHAR */ + for (p = pat; *p != '\0'; p++) { + if (TclIsSpaceProc(*p) || (*p == '\\')) { break; } } diff --git a/generic/tclDate.c b/generic/tclDate.c index 59da2ea..0bda22f 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2690,7 +2690,7 @@ TclDatelex( location->first_column = yyInput - info->dateStart; for ( ; ; ) { - while (isspace(UCHAR(*yyInput))) { + while (TclIsSpaceProc(*yyInput)) { yyInput++; } diff --git a/generic/tclUtf.c b/generic/tclUtf.c index f3d1758..a122685 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1554,7 +1554,9 @@ Tcl_UniCharIsSpace( */ if (((Tcl_UniChar) ch) < ((Tcl_UniChar) 0x80)) { - return isspace(UCHAR(ch)); /* INTL: ISO space */ + return TclIsSpaceProc(ch); + } else if ((Tcl_UniChar) ch == 0x180e) { + return 1; } else { return ((SPACE_BITS >> GetCategory(ch)) & 1); } -- cgit v0.12 From 5298476c8a9dce4f5b1e2519220df640ba3c7046 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 17 Jun 2013 17:03:18 +0000 Subject: Updates to redirect bug reports to the new tracker location. --- README | 29 ++++++++++++++--------------- macosx/README | 4 ++-- unix/README | 5 +++-- win/README | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/README b/README index 8cc9b9a..0b3cf05 100644 --- a/README +++ b/README @@ -1,8 +1,7 @@ README: Tcl This is the Tcl 8.5.14 source distribution. - http://tcl.sourceforge.net/ - You can get any source release of Tcl from the file distributions - link at the above URL. + http://sourceforge.net/projects/tcl/files/Tcl/ + You can get any source release of Tcl from the URL above. Contents -------- @@ -27,9 +26,14 @@ Tcl can also be used for a variety of web-related tasks and for creating powerful command languages for applications. Tcl is maintained, enhanced, and distributed freely by the Tcl community. -The home for Tcl/Tk releases and bug/patch database is on SourceForge: +Source code development and tracking of bug reports and feature requests +takes place at: - http://tcl.sourceforge.net/ + http://core.tcl.tk/ + +Tcl/Tk release and mailing list services are hosted by SourceForge: + + http://sourceforge.net/projects/tcl/ with the Tcl Developer Xchange hosted at: @@ -49,7 +53,7 @@ The home page for this release, including new features, is Detailed release notes can be found at the file distributions page by clicking on the relevant version. - http://sourceforge.net/projects/tcl/files/ + http://sourceforge.net/projects/tcl/files/Tcl/ Information about Tcl itself can be found at http://www.tcl.tk/about/ @@ -146,18 +150,13 @@ and go to the Mailing Lists page. ------------------------ We are very interested in receiving bug reports, patches, and suggestions -for improvements. We prefer that you send this information to us via the -bug form at SourceForge, rather than emailing us directly. The bug -database is at: - - http://tcl.sourceforge.net/ +for improvements. We prefer that you send this information to us as +tickets entered into our tracker at: -The bug form was designed to give uniform structure to bug reports as -well as to solicit enough information to minimize followup questions. + http://core.tcl.tk/tcl/reportlist We will log and follow-up on each bug, although we cannot promise a -specific turn-around time. Enhancements, reported via the Feature -Requests form at the same web site, may take longer and may not happen +specific turn-around time. Enhancements may take longer and may not happen at all unless there is widespread support for them (we're trying to slow the rate at which Tcl/Tk turns into a kitchen sink). It's very difficult to make incompatible changes to Tcl/Tk at this point, due to diff --git a/macosx/README b/macosx/README index 80bed14..06e797e 100644 --- a/macosx/README +++ b/macosx/README @@ -20,8 +20,8 @@ before asking on the list, many questions have already been answered). http://wiki.tcl.tk/_/ref?N=3753 http://wiki.tcl.tk/_/ref?N=8361 -- Please report bugs with Tcl or Tk on Mac OS X to the sourceforge bug trackers: - http://tcl.sourceforge.net/ +- Please report bugs with Tcl on Mac OS X to the tracker: + http://core.tcl.tk/tcl/reportlist 2. Using Tcl on Mac OS X ------------------------ diff --git a/unix/README b/unix/README index 87b151a..d8f1090 100644 --- a/unix/README +++ b/unix/README @@ -163,6 +163,7 @@ you'll see a much more substantial printout for each error. See the README file in the "tests" directory for more information on the test suite. Note: don't run the tests as superuser: this will cause several of them to fail. If a test is failing consistently, please send us a bug report with as much -detail as you can manage. Please use the online database at - http://tcl.sourceforge.net/ +detail as you can manage to our tracker: + + http://core.tcl.tk/tcl/reportlist diff --git a/win/README b/win/README index 1cb04f3..8288e3d 100644 --- a/win/README +++ b/win/README @@ -91,9 +91,9 @@ Note: Tcl no longer provides support for Win32s. This distribution contains an extensive test suite for Tcl. Some of the tests are timing dependent and will fail from time to time. If a test is failing consistently, please send us a bug report with as much detail as -you can manage. Please use the online database at +you can manage to our tracker: - http://tcl.sourceforge.net/ + http://core.tcl.tk/tcl/reportlist In order to run the test suite, you build the "test" target using the appropriate makefile for your compiler. -- cgit v0.12 From 37cc146f7519bf3d0dda8573a541121f0465b035 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Jun 2013 17:03:49 +0000 Subject: Fix [42b8083613] --- win/tclWinFile.c | 4 ++++ win/tclWinPort.h | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 1d9f93a..31fa603 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -18,6 +18,10 @@ #include #include /* For TclpGetUserHome(). */ +#if defined(_MSC_VER) +# define vsnprintf _vsnprintf +#endif + /* * The number of 100-ns intervals between the Windows system epoch (1601-01-01 * on the proleptic Gregorian calendar) and the Posix epoch (1970-01-01). diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 026cf9e..61f149b 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -466,16 +466,12 @@ typedef DWORD_PTR * PDWORD_PTR; * including the *printf family and others. Tell it to shut up. * (_MSC_VER is 1200 for VC6, 1300 or 1310 for vc7.net, 1400 for 8.0) */ -#if defined(_MSC_VER) -# if _MSC_VER >= 1400 -# pragma warning(disable:4244) -# pragma warning(disable:4267) -# pragma warning(disable:4996) -# endif -# define vsnprintf _vsnprintf +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# pragma warning(disable:4244) +# pragma warning(disable:4267) +# pragma warning(disable:4996) #endif - /* *--------------------------------------------------------------------------- * The following macros and declarations represent the interface between -- cgit v0.12 From c694b80895cefb1f73e090593b507dfa7f6a213e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 18 Jun 2013 07:00:04 +0000 Subject: Better place to put vsnprintf switch, so it is usable by all *.c files. Fix comment on _ANSI_ARGS_ which is no longer true since 8.6. --- generic/tclInt.h | 7 +++++-- win/tclWinFile.c | 4 ---- win/tclWinInt.h | 6 ------ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 2d3a248..3432b37 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -30,8 +30,7 @@ * here, so that system-dependent personalizations for the include files only * have to be made in once place. This results in a few extra includes, but * greater modularity. The order of the three groups of #includes is - * important. For example, stdio.h is needed by tcl.h, and the _ANSI_ARGS_ - * declaration in tcl.h is needed by stdlib.h in some configurations. + * important. For example, stdio.h is needed by tcl.h. */ #include "tclPort.h" @@ -119,6 +118,10 @@ typedef int ptrdiff_t; # endif #endif +#if defined(_WIN32) && defined(_MSC_VER) +# define vsnprintf _vsnprintf +#endif + /* * The following procedures allow namespaces to be customized to support * special name resolution rules for commands/variables. diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 31fa603..1d9f93a 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -18,10 +18,6 @@ #include #include /* For TclpGetUserHome(). */ -#if defined(_MSC_VER) -# define vsnprintf _vsnprintf -#endif - /* * The number of 100-ns intervals between the Windows system epoch (1601-01-01 * on the proleptic Gregorian calendar) and the Posix epoch (1970-01-01). diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 22ad8e9..882b811 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -33,12 +33,6 @@ # define TCL_I_MODIFIER "" #endif -#ifdef _WIN64 -# define TCL_I_MODIFIER "I" -#else -# define TCL_I_MODIFIER "" -#endif - /* * Declarations of functions that are not accessible by way of the * stubs table. -- cgit v0.12 From 914227b03938ff6da7a4b35ef2e9a2b495df3ba0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 18 Jun 2013 07:43:59 +0000 Subject: Fix uniClass tool which was the real cause for [a876646efe], and add test-case for it. --- tests/utf.test | 4 ++-- tools/uniClass.tcl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/utf.test b/tests/utf.test index ad1e7b8..35c5f73 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -322,8 +322,8 @@ test utf-21.11 {TclUniCharIsControl} { string is control \u00ad } {1} test utf-21.12 {unicode control char in regc_locale.c} { - # [Bug 3464428] - regexp {^[[:cntrl:]]$} \u00ad + # [Bug 3464428], [Bug a876646efe] + regexp {^[[:cntrl:]]*$} \u0000\u001f\u00ad } {1} test utf-22.1 {TclUniCharIsWordChar} { diff --git a/tools/uniClass.tcl b/tools/uniClass.tcl index 32b40e9..9b4819d 100644 --- a/tools/uniClass.tcl +++ b/tools/uniClass.tcl @@ -72,7 +72,7 @@ proc genTable {type} { if {$i == ($last + 1)} { set last $i } else { - if {$first > 0} { + if {$first >= 0} { emitRange $first $last } set first $i -- cgit v0.12 From c605707c6bdc1d617272e87d0d7cb15b11a5d41c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 18 Jun 2013 10:33:33 +0000 Subject: Fix [3611974]: InitSubsystems multiple thread issue --- ChangeLog | 4 ++++ generic/tclEvent.c | 13 ++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 54c3b99..247dca4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-06-18 Jan Nijtmans + + * generic/tclEvent.c: Bug [3611974]: InitSubsystems multiple thread issue. + 2013-06-17 Jan Nijtmans * generic/regc_locale.c: Bug [a876646efe]: re_expr character class diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 7daa7bb..d98685a 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -949,14 +949,8 @@ TclInitSubsystems(void) TclpInitLock(); if (subsystemsInitialized == 0) { - /* - * Have to set this bit here to avoid deadlock with the routines - * below us that call into TclInitSubsystems. - */ - - subsystemsInitialized = 1; - /* + /* * Initialize locks used by the memory allocators before anything * interesting happens so we can use the allocators in the * implementation of self-initializing locks. @@ -974,12 +968,13 @@ TclInitSubsystems(void) TclpInitPlatform(); /* Creates signal handler(s) */ TclInitDoubleConversion(); /* Initializes constants for * converting to/from double. */ - TclInitObjSubsystem(); /* Register obj types, create + TclInitObjSubsystem(); /* Register obj types, create * mutexes. */ TclInitIOSubsystem(); /* Inits a tsd key (noop). */ TclInitEncodingSubsystem(); /* Process wide encoding init. */ TclpSetInterfaces(); - TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */ + TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */ + subsystemsInitialized = 1; } TclpInitUnlock(); } -- cgit v0.12 From cf557ca4a54a4f8d0ca476e5326675a9ab56f7f9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 19 Jun 2013 12:53:53 +0000 Subject: Eliminate a lot of dead code (for Windows 95/98/ME only). Eliminate all usage of TclWinSetInterfaces(), which does exactly the same as TclpSetInterfaces(), but keep exported symbol and stub entry. --- win/tclWin32Dll.c | 28 +--- win/tclWinFCmd.c | 43 ----- win/tclWinFile.c | 464 ++++++++++++++++++------------------------------------ win/tclWinInit.c | 9 +- win/tclWinPipe.c | 13 +- 5 files changed, 164 insertions(+), 393 deletions(-) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 019d76f..0d3b683 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -281,16 +281,9 @@ TclWinNoBackslash( /* *--------------------------------------------------------------------------- * - * TclWinSetInterfaces -- + * TclpSetInterfaces -- * - * A helper proc that allows the test library to change the tclWinProcs - * structure to dispatch to either the wide-character or multi-byte - * versions of the operating system calls, depending on whether Unicode - * is the system encoding. - * - * As well as this, we can also try to load in some additional procs - * which may/may not be present depending on the current Windows version - * (e.g. Win95 will not have the procs below). + * A helper proc that initializes winTCharEncoding. * * Results: * None. @@ -302,15 +295,10 @@ TclWinNoBackslash( */ void -TclWinSetInterfaces( - int wide) /* Non-zero to use wide interfaces, 0 - * otherwise. */ +TclpSetInterfaces(void) { - TclWinResetInterfaces(); - - if (wide) { - winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); - } + TclWinResetInterfaces(); + winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); } /* @@ -318,9 +306,7 @@ TclWinSetInterfaces( * * TclWinEncodingsCleanup -- * - * Called during finalization to free up any encodings we use. The - * tclWinProcs-> look up table is still ok to use after this call, - * provided no encoding conversion is required. + * Called during finalization to free up any encodings we use. * * We also clean up any memory allocated in our mount point map which is * used to follow certain kinds of symlinks. That code should never be @@ -363,8 +349,6 @@ TclWinEncodingsCleanup(void) * TclWinResetInterfaces -- * * Called during finalization to reset us to a safe state for reuse. - * After this call, it is best not to use the tclWinProcs-> look up table - * since it is likely to be different to what is expected. * * Results: * None. diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index ac88861..0476915 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1105,49 +1105,6 @@ DoRemoveJustDirectory( SetFileAttributes(nativePath, attr | FILE_ATTRIBUTE_READONLY); } - - /* - * Windows 95 reports removing a non-empty directory as - * EACCES, not EEXIST. If the directory is not empty, change errno - * so caller knows what's going on. - */ - - if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_WINDOWS) { - const char *path, *find; - HANDLE handle; - WIN32_FIND_DATAA data; - Tcl_DString buffer; - int len; - - path = (const char *) nativePath; - - Tcl_DStringInit(&buffer); - len = strlen(path); - find = Tcl_DStringAppend(&buffer, path, len); - if ((len > 0) && (find[len - 1] != '\\')) { - TclDStringAppendLiteral(&buffer, "\\"); - } - find = TclDStringAppendLiteral(&buffer, "*.*"); - handle = FindFirstFileA(find, &data); - if (handle != INVALID_HANDLE_VALUE) { - while (1) { - if ((strcmp(data.cFileName, ".") != 0) - && (strcmp(data.cFileName, "..") != 0)) { - /* - * Found something in this directory. - */ - - Tcl_SetErrno(EEXIST); - break; - } - if (FindNextFileA(handle, &data) == FALSE) { - break; - } - } - FindClose(handle); - } - Tcl_DStringFree(&buffer); - } } } diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 1d9f93a..f69ad23 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -2415,373 +2415,213 @@ TclpObjNormalizePath( Tcl_DStringInit(&dsNorm); path = Tcl_GetString(pathPtr); - if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_WINDOWS) { - /* - * We're on Win95, 98 or ME. There are two assumptions in this block - * of code. First that the native (NULL) encoding is basically ascii, - * and second that symbolic links are not possible. Both of these - * assumptions appear to be true of these operating systems. - * - * FIXME: This code branch may be derelict as those are not supported - * platforms any more. - */ - - currentPathEndPosition = path + nextCheckpoint; - if (*currentPathEndPosition == '/') { - currentPathEndPosition++; - } - - while (1) { - char cur = *currentPathEndPosition; + currentPathEndPosition = path + nextCheckpoint; + if (*currentPathEndPosition == '/') { + currentPathEndPosition++; + } + while (1) { + char cur = *currentPathEndPosition; - if ((cur=='/' || cur==0) && (path != currentPathEndPosition)) { - /* - * Reached directory separator, or end of string. - */ + if ((cur=='/' || cur==0) && (path != currentPathEndPosition)) { + /* + * Reached directory separator, or end of string. + */ - const char *nativePath = Tcl_UtfToExternalDString(NULL, path, - currentPathEndPosition - path, &ds); + WIN32_FILE_ATTRIBUTE_DATA data; + const TCHAR *nativePath = Tcl_WinUtfToTChar(path, + currentPathEndPosition - path, &ds); + if (GetFileAttributesEx(nativePath, + GetFileExInfoStandard, &data) != TRUE) { /* - * Now we convert the tail of the current path to its 'long - * form', and append it to 'dsNorm' which holds the current - * normalized path, if the file exists. + * File doesn't exist. */ if (isDrive) { - if (GetFileAttributesA(nativePath) - == INVALID_FILE_ATTRIBUTES) { - /* - * File doesn't exist. - */ - - if (isDrive) { - int len = WinIsReserved(path); - - if (len > 0) { - /* - * Actually it does exist - COM1, etc. - */ - - int i; - - for (i=0 ; i= 'a') { - ((char *) nativePath)[i] -= ('a'-'A'); - } - } - Tcl_DStringAppend(&dsNorm, nativePath, len); - lastValidPathEnd = currentPathEndPosition; - } else if (nextCheckpoint == 0) { - /* Path starts with a drive designation - * that's not actually on the system. - * We still must normalize up past the - * first separator. [Bug 3603434] */ - currentPathEndPosition++; - } - } - Tcl_DStringFree(&ds); - break; - } - if (nativePath[0] >= 'a') { - ((char *) nativePath)[0] -= ('a' - 'A'); - } - Tcl_DStringAppend(&dsNorm, nativePath, - Tcl_DStringLength(&ds)); - } else { - char *checkDots = NULL; - - if (lastValidPathEnd[1] == '.') { - checkDots = lastValidPathEnd + 1; - while (checkDots < currentPathEndPosition) { - if (*checkDots != '.') { - checkDots = NULL; - break; - } - checkDots++; - } - } - if (checkDots != NULL) { - int dotLen = currentPathEndPosition-lastValidPathEnd; + int len = WinIsReserved(path); + if (len > 0) { /* - * Path is just dots. We shouldn't really ever see a - * path like that. However, to be nice we at least - * don't mangle the path - we just add the dots as a - * path segment and continue + * Actually it does exist - COM1, etc. */ - Tcl_DStringAppend(&dsNorm, (const char *) - (nativePath + Tcl_DStringLength(&ds)-dotLen), - dotLen); - } else { - /* - * Normal path. - */ + int i; - WIN32_FIND_DATAA fData; - HANDLE handle; + for (i=0 ; i= L'a') { + wc -= (L'a' - L'A'); + ((WCHAR *) nativePath)[i] = wc; } - - /* - * This is usually the '/' in 'c:/' at end of - * string. - */ - - TclDStringAppendLiteral(&dsNorm, "/"); - } else { - char *nativeName; - - if (fData.cFileName[0] != '\0') { - nativeName = fData.cFileName; - } else { - nativeName = fData.cAlternateFileName; - } - FindClose(handle); - TclDStringAppendLiteral(&dsNorm, "/"); - Tcl_DStringAppend(&dsNorm, nativeName, -1); } + Tcl_DStringAppend(&dsNorm, + (const char *)nativePath, + (int)(sizeof(WCHAR) * len)); + lastValidPathEnd = currentPathEndPosition; + } else if (nextCheckpoint == 0) { + /* Path starts with a drive designation + * that's not actually on the system. + * We still must normalize up past the + * first separator. [Bug 3603434] */ + currentPathEndPosition++; } } Tcl_DStringFree(&ds); - lastValidPathEnd = currentPathEndPosition; - if (cur == 0) { - break; - } - - /* - * If we get here, we've got past one directory delimiter, so - * we know it is no longer a drive. - */ - - isDrive = 0; + break; } - currentPathEndPosition++; - } - } else { - /* - * We're on WinNT (or 2000 or XP; something with an NT core). - */ - currentPathEndPosition = path + nextCheckpoint; - if (*currentPathEndPosition == '/') { - currentPathEndPosition++; - } - while (1) { - char cur = *currentPathEndPosition; + /* + * File 'nativePath' does exist if we get here. We now want to + * check if it is a symlink and otherwise continue with the + * rest of the path. + */ - if ((cur=='/' || cur==0) && (path != currentPathEndPosition)) { - /* - * Reached directory separator, or end of string. - */ + /* + * Check for symlinks, except at last component of path (we + * don't follow final symlinks). Also a drive (C:/) for + * example, may sometimes have the reparse flag set for some + * reason I don't understand. We therefore don't perform this + * check for drives. + */ - WIN32_FILE_ATTRIBUTE_DATA data; - const TCHAR *nativePath = Tcl_WinUtfToTChar(path, - currentPathEndPosition - path, &ds); + if (cur != 0 && !isDrive && + data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT){ + Tcl_Obj *to = WinReadLinkDirectory(nativePath); - if (GetFileAttributesEx(nativePath, - GetFileExInfoStandard, &data) != TRUE) { + if (to != NULL) { /* - * File doesn't exist. + * Read the reparse point ok. Now, reparse points need + * not be normalized, otherwise we could use: + * + * Tcl_GetStringFromObj(to, &pathLen); + * nextCheckpoint = pathLen; + * + * So, instead we have to start from the beginning. */ - if (isDrive) { - int len = WinIsReserved(path); - - if (len > 0) { - /* - * Actually it does exist - COM1, etc. - */ - - int i; + nextCheckpoint = 0; + Tcl_AppendToObj(to, currentPathEndPosition, -1); - for (i=0 ; i= L'a') { - wc -= (L'a' - L'A'); - ((WCHAR *) nativePath)[i] = wc; - } - } - Tcl_DStringAppend(&dsNorm, - (const char *)nativePath, - (int)(sizeof(WCHAR) * len)); - lastValidPathEnd = currentPathEndPosition; - } else if (nextCheckpoint == 0) { - /* Path starts with a drive designation - * that's not actually on the system. - * We still must normalize up past the - * first separator. [Bug 3603434] */ - currentPathEndPosition++; + for (path = Tcl_GetString(to); *path != 0; path++) { + if (*path == '\\') { + *path = '/'; } } - Tcl_DStringFree(&ds); - break; - } - - /* - * File 'nativePath' does exist if we get here. We now want to - * check if it is a symlink and otherwise continue with the - * rest of the path. - */ - - /* - * Check for symlinks, except at last component of path (we - * don't follow final symlinks). Also a drive (C:/) for - * example, may sometimes have the reparse flag set for some - * reason I don't understand. We therefore don't perform this - * check for drives. - */ + path = Tcl_GetString(to); + currentPathEndPosition = path + nextCheckpoint; + if (temp != NULL) { + Tcl_DecrRefCount(temp); + } + temp = to; - if (cur != 0 && !isDrive && - data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT){ - Tcl_Obj *to = WinReadLinkDirectory(nativePath); + /* + * Reset variables so we can restart normalization. + */ - if (to != NULL) { - /* - * Read the reparse point ok. Now, reparse points need - * not be normalized, otherwise we could use: - * - * Tcl_GetStringFromObj(to, &pathLen); - * nextCheckpoint = pathLen; - * - * So, instead we have to start from the beginning. - */ + isDrive = 1; + Tcl_DStringFree(&dsNorm); + Tcl_DStringFree(&ds); + continue; + } + } - nextCheckpoint = 0; - Tcl_AppendToObj(to, currentPathEndPosition, -1); +#ifndef TclNORM_LONG_PATH + /* + * Now we convert the tail of the current path to its 'long + * form', and append it to 'dsNorm' which holds the current + * normalized path + */ - /* - * Convert link to forward slashes. - */ + if (isDrive) { + WCHAR drive = ((WCHAR *) nativePath)[0]; - for (path = Tcl_GetString(to); *path != 0; path++) { - if (*path == '\\') { - *path = '/'; - } - } - path = Tcl_GetString(to); - currentPathEndPosition = path + nextCheckpoint; - if (temp != NULL) { - Tcl_DecrRefCount(temp); + if (drive >= L'a') { + drive -= (L'a' - L'A'); + ((WCHAR *) nativePath)[0] = drive; + } + Tcl_DStringAppend(&dsNorm, (const char *)nativePath, + Tcl_DStringLength(&ds)); + } else { + char *checkDots = NULL; + + if (lastValidPathEnd[1] == '.') { + checkDots = lastValidPathEnd + 1; + while (checkDots < currentPathEndPosition) { + if (*checkDots != '.') { + checkDots = NULL; + break; } - temp = to; - - /* - * Reset variables so we can restart normalization. - */ - - isDrive = 1; - Tcl_DStringFree(&dsNorm); - Tcl_DStringFree(&ds); - continue; + checkDots++; } } + if (checkDots != NULL) { + int dotLen = currentPathEndPosition-lastValidPathEnd; -#ifndef TclNORM_LONG_PATH - /* - * Now we convert the tail of the current path to its 'long - * form', and append it to 'dsNorm' which holds the current - * normalized path - */ - - if (isDrive) { - WCHAR drive = ((WCHAR *) nativePath)[0]; + /* + * Path is just dots. We shouldn't really ever see a + * path like that. However, to be nice we at least + * don't mangle the path - we just add the dots as a + * path segment and continue. + */ - if (drive >= L'a') { - drive -= (L'a' - L'A'); - ((WCHAR *) nativePath)[0] = drive; - } - Tcl_DStringAppend(&dsNorm, (const char *)nativePath, - Tcl_DStringLength(&ds)); + Tcl_DStringAppend(&dsNorm, ((const char *)nativePath) + + Tcl_DStringLength(&ds) + - (dotLen * sizeof(TCHAR)), + (int)(dotLen * sizeof(TCHAR))); } else { - char *checkDots = NULL; - - if (lastValidPathEnd[1] == '.') { - checkDots = lastValidPathEnd + 1; - while (checkDots < currentPathEndPosition) { - if (*checkDots != '.') { - checkDots = NULL; - break; - } - checkDots++; - } - } - if (checkDots != NULL) { - int dotLen = currentPathEndPosition-lastValidPathEnd; + /* + * Normal path. + */ - /* - * Path is just dots. We shouldn't really ever see a - * path like that. However, to be nice we at least - * don't mangle the path - we just add the dots as a - * path segment and continue. - */ + WIN32_FIND_DATAW fData; + HANDLE handle; - Tcl_DStringAppend(&dsNorm, ((const char *)nativePath) - + Tcl_DStringLength(&ds) - - (dotLen * sizeof(TCHAR)), - (int)(dotLen * sizeof(TCHAR))); - } else { + handle = FindFirstFileW((WCHAR *) nativePath, &fData); + if (handle == INVALID_HANDLE_VALUE) { /* - * Normal path. + * This is usually the '/' in 'c:/' at end of + * string. */ - WIN32_FIND_DATAW fData; - HANDLE handle; - - handle = FindFirstFileW((WCHAR *) nativePath, &fData); - if (handle == INVALID_HANDLE_VALUE) { - /* - * This is usually the '/' in 'c:/' at end of - * string. - */ + Tcl_DStringAppend(&dsNorm, (const char *) L"/", + sizeof(WCHAR)); + } else { + WCHAR *nativeName; - Tcl_DStringAppend(&dsNorm, (const char *) L"/", - sizeof(WCHAR)); + if (fData.cFileName[0] != '\0') { + nativeName = fData.cFileName; } else { - WCHAR *nativeName; - - if (fData.cFileName[0] != '\0') { - nativeName = fData.cFileName; - } else { - nativeName = fData.cAlternateFileName; - } - FindClose(handle); - Tcl_DStringAppend(&dsNorm, (const char *) L"/", - sizeof(WCHAR)); - Tcl_DStringAppend(&dsNorm, - (const char *) nativeName, - (int) (wcslen(nativeName)*sizeof(WCHAR))); + nativeName = fData.cAlternateFileName; } + FindClose(handle); + Tcl_DStringAppend(&dsNorm, (const char *) L"/", + sizeof(WCHAR)); + Tcl_DStringAppend(&dsNorm, + (const char *) nativeName, + (int) (wcslen(nativeName)*sizeof(WCHAR))); } } + } #endif /* !TclNORM_LONG_PATH */ - Tcl_DStringFree(&ds); - lastValidPathEnd = currentPathEndPosition; - if (cur == 0) { - break; - } + Tcl_DStringFree(&ds); + lastValidPathEnd = currentPathEndPosition; + if (cur == 0) { + break; + } - /* - * If we get here, we've got past one directory delimiter, so - * we know it is no longer a drive. - */ + /* + * If we get here, we've got past one directory delimiter, so + * we know it is no longer a drive. + */ - isDrive = 0; - } - currentPathEndPosition++; + isDrive = 0; } + currentPathEndPosition++; #ifdef TclNORM_LONG_PATH /* diff --git a/win/tclWinInit.c b/win/tclWinInit.c index f552e2c..d82944e 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -486,13 +486,10 @@ TclpSetInitialEncodings(void) Tcl_DStringFree(&encodingName); } -void -TclpSetInterfaces(void) +void TclWinSetInterfaces( + int dummy) /* Not used. */ { - int useWide; - - useWide = (TclWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS); - TclWinSetInterfaces(useWide); + TclpSetInterfaces(); } const char * diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index d418a3e..13caba9 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1049,15 +1049,8 @@ TclpCreateProcess( * sink. */ - if ((TclWinGetPlatformId() == VER_PLATFORM_WIN32_WINDOWS) - && (applType == APPL_DOS)) { - if (CreatePipe(&h, &startInfo.hStdOutput, &secAtts, 0) != FALSE) { - CloseHandle(h); - } - } else { - startInfo.hStdOutput = CreateFileA("NUL:", GENERIC_WRITE, 0, - &secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - } + startInfo.hStdOutput = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0, + &secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); } else { DuplicateHandle(hProcess, outputHandle, hProcess, &startInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); @@ -1076,7 +1069,7 @@ TclpCreateProcess( * sink. */ - startInfo.hStdError = CreateFileA("NUL:", GENERIC_WRITE, 0, + startInfo.hStdError = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0, &secAtts, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); } else { DuplicateHandle(hProcess, errorHandle, hProcess, &startInfo.hStdError, -- cgit v0.12 From e05de40e35185e3d3f0dfea4f61f03ce09fb7277 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 19 Jun 2013 19:33:21 +0000 Subject: More use of simplifying macros. Replace dynamic allocation with automatic storage on the call stack. --- generic/tclCompile.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index be5bedf..92875a2 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1762,7 +1762,7 @@ TclCompileScript( /* TIP #280 */ ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; int *wlines, wlineat, cmdLine, *clNext; - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse parse, *parsePtr = &parse; if (envPtr->iPtr == NULL) { Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); @@ -2190,11 +2190,10 @@ TclCompileScript( */ if (envPtr->codeNext == entryCodeNext) { - TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + PushStringLiteral(envPtr, ""); } envPtr->numSrcBytes = p - script; - TclStackFree(interp, parsePtr); } /* @@ -2258,7 +2257,7 @@ TclCompileVarSubst( localVar = TclFindCompiledLocal(name, nameBytes, localVarName, envPtr); } if (localVar < 0) { - TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameBytes), envPtr); + PushLiteral(envPtr, name, nameBytes); } /* @@ -2466,7 +2465,7 @@ TclCompileTokens( */ if (envPtr->codeNext == entryCodeNext) { - TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + PushStringLiteral(envPtr, ""); } Tcl_DStringFree(&textBuffer); @@ -2583,7 +2582,7 @@ TclCompileExprWords( for (i = 0; i < numWords; i++) { TclCompileTokens(interp, wordPtr+1, wordPtr->numComponents, envPtr); if (i < (numWords - 1)) { - TclEmitPush(TclRegisterNewLiteral(envPtr, " ", 1), envPtr); + PushStringLiteral(envPtr, " "); } wordPtr += wordPtr->numComponents + 1; } @@ -2638,7 +2637,7 @@ TclCompileNoOp( TclEmitOpcode(INST_POP, envPtr); } } - TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + PushStringLiteral(envPtr, ""); return TCL_OK; } -- cgit v0.12 From 5539977620b9c358a365280e4d0db6a816537b71 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 19 Jun 2013 22:44:42 +0000 Subject: Fixed bug with optimizing with INST_START_CMD about. --- generic/tclOptimize.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c index 7d4226e..cd37a6a 100644 --- a/generic/tclOptimize.c +++ b/generic/tclOptimize.c @@ -86,6 +86,7 @@ LocateTargetAddresses( case INST_JUMP4: case INST_JUMP_TRUE4: case INST_JUMP_FALSE4: + case INST_START_CMD: targetInstPtr = currentInstPtr+TclGetInt4AtPtr(currentInstPtr+1); goto storeTarget; case INST_BEGIN_CATCH4: @@ -109,8 +110,6 @@ LocateTargetAddresses( DefineTargetAddress(tablePtr, currentInstPtr + 2*i - 1); } break; - case INST_START_CMD: - assert (envPtr->atCmdStart < 2); } } -- cgit v0.12 From 21cf159ca75e16fe0d396af83f2c0342fa7c9913 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 20 Jun 2013 14:17:05 +0000 Subject: TclCompileScript() should not overwrite envPtr->numSrcBytes. The envPtr already has the right value stored in it. --- generic/tclCompile.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index cba659d..f982359 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1631,7 +1631,6 @@ TclCompileScript( TclEmitPush(TclAddLiteralObj(envPtr, Tcl_NewObj(), NULL), envPtr); } - envPtr->numSrcBytes = (p - script); TclStackFree(interp, parsePtr); Tcl_DStringFree(&ds); } -- cgit v0.12 From c12c83e799a79e5d1faa3dc446e1ef322eaa31fd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 21 Jun 2013 11:53:11 +0000 Subject: Modify internal TclStubInfoType type: use TclStubs * in stead of ClientData, so less type casts are needed in the code. Disadvantage: somewhat more code duplication, but it makes the code much more understandable. --- generic/tclInt.h | 2 +- generic/tclStubLib.c | 27 ++++++++++++++++++++++++--- generic/tclStubLibTbl.c | 15 ++------------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 3432b37..c350d15 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3837,7 +3837,7 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, /* Used internally in stub library. */ typedef struct { char version[12]; - ClientData data; + const TclStubs *stubs; } TclStubInfoType; MODULE_SCOPE const char *TclInitStubTable(const char *version); diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index e617515..859cbf9 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -13,6 +13,16 @@ #include "tclInt.h" +MODULE_SCOPE const TclStubs *tclStubsPtr; +MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr; +MODULE_SCOPE const TclIntStubs *tclIntStubsPtr; +MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr; + +const TclStubs *tclStubsPtr = NULL; +const TclPlatStubs *tclPlatStubsPtr = NULL; +const TclIntStubs *tclIntStubsPtr = NULL; +const TclIntPlatStubs *tclIntPlatStubsPtr = NULL; + /* * Use our own isDigit to avoid linking to libc on windows */ @@ -48,7 +58,7 @@ Tcl_InitStubs( { Interp *iPtr = (Interp *) interp; const char *actualVersion = NULL; - TclStubInfoType stub; + ClientData pkgData = NULL; const TclStubs *stubsPtr = iPtr->stubTable; /* @@ -63,7 +73,7 @@ Tcl_InitStubs( return NULL; } - actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &stub.data); + actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData); if (actualVersion == NULL) { return NULL; } @@ -93,7 +103,18 @@ Tcl_InitStubs( } } } - TclInitStubTable(stub.version); + tclStubsPtr = (TclStubs *)pkgData; + + if (tclStubsPtr->hooks) { + tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; + tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs; + tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs; + } else { + tclPlatStubsPtr = NULL; + tclIntStubsPtr = NULL; + tclIntPlatStubsPtr = NULL; + } + return actualVersion; } diff --git a/generic/tclStubLibTbl.c b/generic/tclStubLibTbl.c index 0ed057f..0391502 100644 --- a/generic/tclStubLibTbl.c +++ b/generic/tclStubLibTbl.c @@ -13,17 +13,6 @@ #include "tclInt.h" -MODULE_SCOPE const TclStubs *tclStubsPtr; -MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr; -MODULE_SCOPE const TclIntStubs *tclIntStubsPtr; -MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr; - -const TclStubs *tclStubsPtr = NULL; -const TclPlatStubs *tclPlatStubsPtr = NULL; -const TclIntStubs *tclIntStubsPtr = NULL; -const TclIntPlatStubs *tclIntPlatStubsPtr = NULL; - - /* *---------------------------------------------------------------------- * @@ -45,8 +34,7 @@ TclInitStubTable( const char *version) /* points to the version field of a TclStubInfoType structure variable. */ { - const TclStubInfoType *ptr = (const TclStubInfoType *) version; - tclStubsPtr = (const TclStubs *) ptr->data; + tclStubsPtr = ((const TclStubInfoType *) version)->stubs; if (tclStubsPtr->hooks) { tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs; @@ -57,6 +45,7 @@ TclInitStubTable( tclIntStubsPtr = NULL; tclIntPlatStubsPtr = NULL; } + return version; } -- cgit v0.12 From 694837ab79cb2b7f05fccf857081bb8a7579079e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 21 Jun 2013 11:57:59 +0000 Subject: Don't use TclpInetNtoa any more, use inet_ntoa in stead. Since IP6 support it's even not necessary any more (except for fake-rfc2553, but mutexes are used here already) , but it's in the internal stub table so we cannot remove it until 9.0 --- generic/tclIntPlatDecls.h | 2 ++ generic/tclStubInit.c | 1 + unix/tclUnixPort.h | 2 -- unix/tclUnixThrd.c | 1 + win/tclWinSock.c | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index dcf1753..3181d4e 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -545,6 +545,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #undef TclpGmtime_unix #undef TclWinConvertWSAError #define TclWinConvertWSAError TclWinConvertError +#undef TclpInetNtoa +#define TclpInetNtoa inet_ntoa #if defined(__WIN32__) || defined(__CYGWIN__) # undef TclWinNToHS diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 1b04542..782bbdf 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -43,6 +43,7 @@ #undef TclSockMinimumBuffers #define TclBackgroundException Tcl_BackgroundException #undef Tcl_SetIntObj +#undef TclpInetNtoa /* See bug 510001: TclSockMinimumBuffers needs plat imp */ #ifdef _WIN64 diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index fde1909..2ade1c0 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -700,8 +700,6 @@ typedef int socklen_t; #ifdef TCL_THREADS # include -# undef inet_ntoa -# define inet_ntoa(x) TclpInetNtoa(x) #endif /* TCL_THREADS */ /* FIXME - Hyper-enormous platform assumption! */ diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 789dbb6..f469341 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -659,6 +659,7 @@ TclpReaddir( return TclOSreaddir(dir); } +#undef TclpInetNtoa char * TclpInetNtoa( struct in_addr addr) diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 1a74354..4ced0e7 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2735,6 +2735,7 @@ TclWinSetSockOpt( return setsockopt(s, level, optname, optval, optlen); } +#undef TclpInetNtoa char * TclpInetNtoa( struct in_addr addr) -- cgit v0.12 From 4b9c60ce47062894652d4db2156a9643a9b80bb2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2013 10:02:14 +0000 Subject: Remove TclInitStubTable() function (but keep it in the "initsubsystems" branch). --- generic/tclInt.h | 8 -------- unix/Makefile.in | 6 +----- win/Makefile.in | 4 ---- win/makefile.bc | 4 ---- win/makefile.vc | 4 ---- win/tcl.dsp | 4 ---- 6 files changed, 1 insertion(+), 29 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index c350d15..fdd577a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3834,14 +3834,6 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); -/* Used internally in stub library. */ -typedef struct { - char version[12]; - const TclStubs *stubs; -} TclStubInfoType; - -MODULE_SCOPE const char *TclInitStubTable(const char *version); - /* * Functions defined in generic/tclVar.c and currenttly exported only for use * by the bytecode compiler and engine. Some of these could later be placed in diff --git a/unix/Makefile.in b/unix/Makefile.in index 5295a45..f0a729f 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -335,7 +335,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o \ bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o -STUB_LIB_OBJS = tclStubLib.o tclStubLibTbl.o tclTomMathStubLib.o tclOOStubLib.o ${COMPAT_OBJS} +STUB_LIB_OBJS = tclStubLib.o tclTomMathStubLib.o tclOOStubLib.o ${COMPAT_OBJS} UNIX_OBJS = tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \ tclUnixFile.o tclUnixPipe.o tclUnixSock.o \ @@ -470,7 +470,6 @@ OO_SRCS = \ STUB_SRCS = \ $(GENERIC_DIR)/tclStubLib.c \ - $(GENERIC_DIR)/tclStubLibTbl.c \ $(GENERIC_DIR)/tclTomMathStubLib.c \ $(GENERIC_DIR)/tclOOStubLib.c @@ -1686,9 +1685,6 @@ Zzutil.o: $(ZLIB_DIR)/zutil.c tclStubLib.o: $(GENERIC_DIR)/tclStubLib.c $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclStubLib.c -tclStubLibTbl.o: $(GENERIC_DIR)/tclStubLibTbl.c - $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclStubLibTbl.c - tclTomMathStubLib.o: $(GENERIC_DIR)/tclTomMathStubLib.c $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclTomMathStubLib.c diff --git a/win/Makefile.in b/win/Makefile.in index d7b25b7..47f3fdd 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -385,7 +385,6 @@ REG_OBJS = tclWinReg.$(OBJEXT) STUB_OBJS = \ tclStubLib.$(OBJEXT) \ - tclStubLibTbl.$(OBJEXT) \ tclTomMathStubLib.$(OBJEXT) \ tclOOStubLib.$(OBJEXT) @@ -516,9 +515,6 @@ tclPkgConfig.${OBJEXT}: tclPkgConfig.c tclStubLib.${OBJEXT}: tclStubLib.c $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) -tclStubLibTbl.${OBJEXT}: tclStubLibTbl.c - $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) - tclTomMathStubLib.${OBJEXT}: tclTomMathStubLib.c $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) diff --git a/win/makefile.bc b/win/makefile.bc index 2726dad..0b17cea 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -279,7 +279,6 @@ TCLOBJS = \ TCLSTUBOBJS = \ $(TMPDIR)\tclStubLib.obj \ - $(TMPDIR)\tclStubLibTbl.obj \ $(TMPDIR)\tclTomMathStubLib.obj \ $(TMPDIR)\tclOOStubLib.obj @@ -529,9 +528,6 @@ $(TMPDIR)\tclWinDde.obj : $(WINDIR)\tclWinDde.c $(TMPDIR)\tclStubLib.obj : $(GENERICDIR)\tclStubLib.c $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -o$(TMPDIR)\$@ $? -$(TMPDIR)\tclStubLibTbl.obj : $(GENERICDIR)\tclStubLibTbl.c - $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -o$(TMPDIR)\$@ $? - $(TMPDIR)\tclTomMathStubLib.obj : $(GENERICDIR)\tclTomMathStubLib.c $(cc32) $(TCL_CFLAGS) -DSTATIC_BUILD -o$(TMPDIR)\$@ $? diff --git a/win/makefile.vc b/win/makefile.vc index c24534a..cddb253 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -450,7 +450,6 @@ TCLOBJS = $(COREOBJS) $(ZLIBOBJS) $(TOMMATHOBJS) $(PLATFORMOBJS) TCLSTUBOBJS = \ $(TMP_DIR)\tclStubLib.obj \ - $(TMP_DIR)\tclStubLibTbl.obj \ $(TMP_DIR)\tclTomMathStubLib.obj \ $(TMP_DIR)\tclOOStubLib.obj @@ -980,9 +979,6 @@ $(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c $(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? -$(TMP_DIR)\tclStubLibTbl.obj: $(GENERICDIR)\tclStubLibTbl.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? - $(TMP_DIR)\tclTomMathStubLib.obj: $(GENERICDIR)\tclTomMathStubLib.c $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? diff --git a/win/tcl.dsp b/win/tcl.dsp index 2708051..57ec6bf 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -1300,10 +1300,6 @@ SOURCE=..\generic\tclStubLib.c # End Source File # Begin Source File -SOURCE=..\generic\tclStubLibTbl.c -# End Source File -# Begin Source File - SOURCE=..\generic\tclOOStubLib.c # End Source File # Begin Source File -- cgit v0.12 From 61ab4e7385f66e8fbbfdae5b63d6548c62875ceb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2013 12:02:56 +0000 Subject: Don't use deprecated Tcl_DStringTrunc any more. --- generic/tclTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 1ba73e7..9ef7805 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1848,7 +1848,7 @@ TestdstringCmd( if (Tcl_GetInt(interp, argv[2], &count) != TCL_OK) { return TCL_ERROR; } - Tcl_DStringTrunc(&dstring, count); + Tcl_DStringSetLength(&dstring, count); } else if (strcmp(argv[1], "start") == 0) { if (argc != 2) { goto wrongNumArgs; -- cgit v0.12 From 0e6dbfcf9977281189ce5a639d1ea673a6a29eda Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Jun 2013 14:19:39 +0000 Subject: Branch for rewriting TclCompileScript() and related routines, with the intent to generally simplify and make more readable, as well as find and eliminate duplication with ensemble machinery and improve mergeability to other branches. Work in Progress. Doesn't work at all right now. --- generic/tclCompile.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 8cb53f5..eafecbc 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1737,6 +1737,37 @@ FindCompiledCommandFromToken( *---------------------------------------------------------------------- */ +#if 1 +static void +CompileCommandTokens( + Tcl_Interp *interp, + Tcl_Parse *parsePtr, + CompileEnv *envPtr) +{ + Tcl_Obj *cmdObj; + Tcl_Token *cmdTokenPtr = parsePtr->tokenPtr; + + + if (parsePtr->numWords == 0) { + return 0; + } + + if (!TclWordKnownAtCompileTime(cmdTokenPtr, cmdObj)) { + /* + * Command is not known until runtime substitution is complete. + * Emit instructions to perform that substitution. + */ + CompileTokens(interp, cmdTokenPtr, envPtr); + + } + + + + TclEmitOpcode(INST_POP, envPtr); + +} +#endif + void TclCompileScript( Tcl_Interp *interp, /* Used for error and status reporting. Also @@ -1748,6 +1779,98 @@ TclCompileScript( * first null character. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { +#if 1 + unsigned char *entryCodeNext = envPtr->codeNext; + const char *p; + int cmdLine, *clNext; + + if (envPtr->iPtr == NULL) { + Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); + } + + /* + * Each iteration through the following loop compiles the next command + * from the script. + */ + + p = script; + cmdLine = envPtr->line; + clNext = envPtr->clNext; + while (numBytes > 0) { + Tcl_Parse parse; + const char *next; + + /* TODO: can we relocate this to happen less frequently? */ + Tcl_ResetResult(interp); + if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, &parse)) { + /* + * Compile bytecodes to report the parse error at runtime. + */ + + Tcl_LogCommandInfo(interp, script, parse.commandStart, + parse.term - parse.commandStart); + TclCompileSyntaxError(interp, envPtr); + break; + } + + /* + * TIP #280: Count newlines before the command start. + * (See test info-30.33). + */ + + TclAdvanceLines(&cmdLine, p, parse.commandStart); + TclAdvanceContinuations(&cmdLine, &clNext, + parse.commandStart - envPtr->source); + +#ifdef TCL_COMPILE_DEBUG + /* + * If tracing, print a line for each top level command compiled. + */ + + if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { + fprintf(stdout, " Compiling: "); + TclPrintSource(stdout, parse.commandStart, + TclMin(parse.term - parse.commandStart, 55)); + fprintf(stdout, "\n"); + } +#endif + + CompileCommandTokens(interp, &parse, envPtr); + + /* + * Advance to the next command in the script. + */ + + next = parse.commandStart + parse.commandSize; + numBytes -= next - p; + p = next; + + /* + * TIP #280: Track lines in the just compiled command. + */ + + TclAdvanceLines(&cmdLine, parsePtr->commandStart, p); + TclAdvanceContinuations(&cmdLine, &clNext, p - envPtr->source); + Tcl_FreeParse(&parse); + } + + /* + * TIP #280: Bring the line counts in the CompEnv up to date. + * See tests info-30.33,34,35 . + */ + + envPtr->line = cmdLine; + envPtr->clNext = clNext; + + /* + * If the source script yielded no instructions (e.g., if it was empty), + * push an empty string as the command's result. + */ + + if (envPtr->codeNext == entryCodeNext) { + PushStringLiteral(envPtr, ""); + } +#else int lastTopLevelCmdIndex = -1; /* Index of most recent toplevel command in * the command location table. Initialized to @@ -2192,6 +2315,7 @@ TclCompileScript( if (envPtr->codeNext == entryCodeNext) { PushStringLiteral(envPtr, ""); } +#endif } /* -- cgit v0.12 From edc81d994ec2f31a92dec97ec8dd28d5de990c93 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Jun 2013 15:01:03 +0000 Subject: Make more use of the CompileTokens() macro. --- generic/tclCompExpr.c | 3 +-- generic/tclCompile.c | 8 +++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index efdc2b0..2a48117 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2486,8 +2486,7 @@ CompileExprTree( break; } case OT_TOKENS: - TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents, - envPtr); + CompileTokens(envPtr, tokenPtr, interp); tokenPtr += tokenPtr->numComponents + 1; break; default: diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 8cb53f5..ccf8938 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1936,8 +1936,7 @@ TclCompileScript( * The word is not a simple string of characters. */ - TclCompileTokens(interp, tokenPtr+1, - tokenPtr->numComponents, envPtr); + CompileTokens(envPtr, tokenPtr, interp); if (expand && tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { TclEmitInstInt4(INST_EXPAND_STKTOP, envPtr->currStackDepth, envPtr); @@ -2578,7 +2577,7 @@ TclCompileExprWords( wordPtr = tokenPtr; for (i = 0; i < numWords; i++) { - TclCompileTokens(interp, wordPtr+1, wordPtr->numComponents, envPtr); + CompileTokens(envPtr, wordPtr, interp); if (i < (numWords - 1)) { PushStringLiteral(envPtr, " "); } @@ -2630,8 +2629,7 @@ TclCompileNoOp( tokenPtr = tokenPtr + tokenPtr->numComponents + 1; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents, - envPtr); + CompileTokens(envPtr, tokenPtr, interp); TclEmitOpcode(INST_POP, envPtr); } } -- cgit v0.12 From 6ed69603db59ee390437a9eb54685869393a243c Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Jun 2013 19:23:24 +0000 Subject: Replace always true test with assertion. --- generic/tclCompile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index ccf8938..633966e 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2098,6 +2098,7 @@ TclCompileScript( * Emit an invoke instruction for the command. We skip this if a * compile procedure was found for the command. */ + assert(wordIdx > 0); if (expand) { /* @@ -2119,7 +2120,7 @@ TclCompileScript( TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); envPtr->expandCount--; TclAdjustStackDepth(1 - wordIdx, envPtr); - } else if (wordIdx > 0) { + } else { /* * Save PC -> command map for the TclArgumentBC* functions. */ -- cgit v0.12 From 9b8f81698635aaedfb4f36d41d4d8779e754ce11 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Jun 2013 20:22:31 +0000 Subject: Nearly functional now, but leaky and not yet as tidy as I'm hoping for. --- generic/tclCompile.c | 301 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 289 insertions(+), 12 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 01320cf..2c6af46 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1744,27 +1744,295 @@ CompileCommandTokens( Tcl_Parse *parsePtr, CompileEnv *envPtr) { - Tcl_Obj *cmdObj; - Tcl_Token *cmdTokenPtr = parsePtr->tokenPtr; - + Interp *iPtr = (Interp *) interp; + Tcl_Obj *cmdObj = Tcl_NewObj(); + Tcl_Token *tokenPtr = parsePtr->tokenPtr; + Command *cmdPtr = NULL; + int wordIdx, cmdKnown, expand = 0, numWords = parsePtr->numWords; + ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + int *wlines, wlineat; - if (parsePtr->numWords == 0) { - return 0; + if (numWords == 0) { + return; + } + + for (wordIdx = 0; wordIdx < numWords; + wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { + if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + expand = 1; + break; + } } - if (!TclWordKnownAtCompileTime(cmdTokenPtr, cmdObj)) { + Tcl_IncrRefCount(cmdObj); + tokenPtr = parsePtr->tokenPtr; + cmdKnown = TclWordKnownAtCompileTime(tokenPtr, cmdObj); + + if (cmdKnown && !(iPtr->flags & DONT_COMPILE_CMDS_INLINE)) { + cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); + if (cmdPtr) { + /* + * Found a command. Test all the ways we can be told + * not to attempt to compile it. + */ + if ((cmdPtr->compileProc == NULL) + || (cmdPtr->nsPtr->flags & NS_SUPPRESS_COMPILATION) + || (cmdPtr->flags & CMD_HAS_EXEC_TRACES) + || (expand && !(cmdPtr->flags & CMD_COMPILES_EXPANDED))) { + cmdPtr = NULL; + } + } + } + + /* Pre-Compile */ +int lastTopLevelCmdIndex, currCmdIndex, startCodeOffset; + +int cmdLine = envPtr->line; +int *clNext = envPtr->clNext; + + lastTopLevelCmdIndex = currCmdIndex = envPtr->numCommands; + envPtr->numCommands++; + startCodeOffset = envPtr->codeNext - envPtr->codeStart; + EnterCmdStartData(envPtr, currCmdIndex, + parsePtr->commandStart - envPtr->source, startCodeOffset); + + if (expand && !cmdPtr) { + StartExpanding(envPtr); + } + + /* + * TIP #280. Scan the words and compute the extended location + * information. The map first contain full per-word line + * information for use by the compiler. This is later replaced by + * a reduced form which signals non-literal words, stored in + * 'wlines'. + */ + + EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source, + parsePtr->tokenPtr, parsePtr->commandStart, + parsePtr->commandSize, parsePtr->numWords, cmdLine, + clNext, &wlines, envPtr); + wlineat = eclPtr->nuloc - 1; + + envPtr->line = eclPtr->loc[wlineat].line[0]; + envPtr->clNext = eclPtr->loc[wlineat].next[0]; + + if (cmdPtr) { + int savedNumCmds = envPtr->numCommands; + int update = 0; + int startStackDepth = envPtr->currStackDepth; + + /* + * Mark the start of the command; the proper bytecode + * length will be updated later. There is no need to + * do this for the first bytecode in the compile env, + * as the check is done before calling + * TclNRExecuteByteCode(). Do emit an INST_START_CMD + * in special cases where the first bytecode is in a + * loop, to insure that the corresponding command is + * counted properly. Compilers for commands able to + * produce such a beast (currently 'while 1' only) set + * envPtr->atCmdStart to 0 in order to signal this + * case. [Bug 1752146] + * + * Note that the environment is initialised with + * atCmdStart=1 to avoid emitting ISC for the first + * command. + */ + + if (envPtr->atCmdStart == 1) { + if (startCodeOffset) { + /* + * Increase the number of commands being + * started at the current point. Note that + * this depends on the exact layout of the + * INST_START_CMD's operands, so be careful! + */ + + TclIncrUInt4AtPtr(envPtr->codeNext - 4, 1) + } + } else if (envPtr->atCmdStart == 0) { + TclEmitInstInt4(INST_START_CMD, 0, envPtr); + TclEmitInt4(1, envPtr); + update = 1; + } + + if (TCL_OK == cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr)) { + +#ifdef TCL_COMPILE_DEBUG + /* + * Confirm that the command compiler generated a + * single value on the stack as its result. This + * is only done in debugging mode, as it *should* + * be correct and normal users have no reasonable + * way to fix it anyway. + */ + + int diff = envPtr->currStackDepth - startStackDepth; + + if (diff != 1) { + Tcl_Panic("bad stack adjustment when compiling" + " %.*s (was %d instead of 1)", + parsePtr->tokenPtr->size, + parsePtr->tokenPtr->start, diff); + } +#endif + if (update) { + /* + * Fix the bytecode length. + */ + + unsigned char *fixPtr = envPtr->codeStart + startCodeOffset + 1; + unsigned fixLen = envPtr->codeNext - fixPtr + 1; + + TclStoreInt4AtPtr(fixLen, fixPtr); + } + goto finishCommand; + } + + if (envPtr->atCmdStart == 1 && startCodeOffset != 0) { + /* + * Decrease the number of commands being started + * at the current point. Note that this depends on + * the exact layout of the INST_START_CMD's + * operands, so be careful! + */ + + TclIncrUInt4AtPtr(envPtr->codeNext - 4, -1); + } + /* - * Command is not known until runtime substitution is complete. - * Emit instructions to perform that substitution. + * Restore numCommands, codeNext, and currStackDepth to their + * correct values, removing any commands compiled before the + * failure to produce bytecode got reported. + * [Bugs 705406, 735055, 3614102] */ - CompileTokens(interp, cmdTokenPtr, envPtr); + envPtr->numCommands = savedNumCmds; + envPtr->codeNext = envPtr->codeStart + startCodeOffset; + envPtr->currStackDepth = startStackDepth; + + envPtr->line = eclPtr->loc[wlineat].line[0]; + envPtr->clNext = eclPtr->loc[wlineat].next[0]; + + /* TODO: Can this happen? If so, is this right? */ + if (expand) { + StartExpanding(envPtr); + } } - + /* + * No complile attempted, or it failed. + * Need to emit instructions to invoke, with expansion if needed. + */ + + wordIdx = 0; + tokenPtr = parsePtr->tokenPtr; + if (cmdKnown) { + int cmdLitIdx, numBytes; + const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); + + cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); + cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); + if (cmdPtr) { + TclSetCmdNameObj(interp, + TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr); + } + TclEmitPush(cmdLitIdx, envPtr); + wordIdx = 1; + tokenPtr += tokenPtr->numComponents + 1; + } + + for (; wordIdx < numWords; + wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { + int objIdx; + + envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; + envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + CompileTokens(envPtr, tokenPtr, interp); + if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + TclEmitInstInt4(INST_EXPAND_STKTOP, + envPtr->currStackDepth, envPtr); + } + continue; + } + + objIdx = TclRegisterNewLiteral(envPtr, + tokenPtr[1].start, tokenPtr[1].size); + if (envPtr->clNext) { + TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), + tokenPtr[1].start - envPtr->source, + eclPtr->loc[wlineat].next[wordIdx]); + } + TclEmitPush(objIdx, envPtr); + } + + /* + * Emit an invoke instruction for the command. We skip this if a + * compile procedure was found for the command. + */ + + if (expand) { + /* + * The stack depth during argument expansion can only be + * managed at runtime, as the number of elements in the + * expanded lists is not known at compile time. We adjust here + * the stack depth estimate so that it is correct after the + * command with expanded arguments returns. + * + * The end effect of this command's invocation is that all the + * words of the command are popped from the stack, and the + * result is pushed: the stack top changes by (1-wordIdx). + * + * Note that the estimates are not correct while the command + * is being prepared and run, INST_EXPAND_STKTOP is not + * stack-neutral in general. + */ + + TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); + envPtr->expandCount--; + TclAdjustStackDepth(1 - wordIdx, envPtr); + } else { + /* + * Save PC -> command map for the TclArgumentBC* functions. + */ + + int isnew; + Tcl_HashEntry *hePtr = Tcl_CreateHashEntry(&eclPtr->litInfo, + INT2PTR(envPtr->codeNext - envPtr->codeStart), &isnew); + + Tcl_SetHashValue(hePtr, INT2PTR(wlineat)); + if (wordIdx <= 255) { + TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); + } else { + TclEmitInstInt4(INST_INVOKE_STK4, wordIdx, envPtr); + } + } + +finishCommand: TclEmitOpcode(INST_POP, envPtr); + EnterCmdExtentData(envPtr, currCmdIndex, + parsePtr->term - parsePtr->commandStart, + (envPtr->codeNext-envPtr->codeStart) - startCodeOffset); + if (cmdKnown) { + Tcl_DecrRefCount(cmdObj); + } + + /* + * TIP #280: Free full form of per-word line data and insert the + * reduced form now + */ + + envPtr->line = cmdLine; + envPtr->clNext = clNext; + ckfree(eclPtr->loc[wlineat].line); + ckfree(eclPtr->loc[wlineat].next); + eclPtr->loc[wlineat].line = wlines; + eclPtr->loc[wlineat].next = NULL; } #endif @@ -1828,14 +2096,19 @@ TclCompileScript( */ if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { + int commandLength = parse.term - parse.commandStart; fprintf(stdout, " Compiling: "); TclPrintSource(stdout, parse.commandStart, - TclMin(parse.term - parse.commandStart, 55)); + TclMin(commandLength, 55)); fprintf(stdout, "\n"); } #endif + envPtr->line = cmdLine; + envPtr->clNext = clNext; CompileCommandTokens(interp, &parse, envPtr); + cmdLine = envPtr->line; + clNext = envPtr->clNext; /* * Advance to the next command in the script. @@ -1849,7 +2122,7 @@ TclCompileScript( * TIP #280: Track lines in the just compiled command. */ - TclAdvanceLines(&cmdLine, parsePtr->commandStart, p); + TclAdvanceLines(&cmdLine, parse.commandStart, p); TclAdvanceContinuations(&cmdLine, &clNext, p - envPtr->source); Tcl_FreeParse(&parse); } @@ -1869,6 +2142,10 @@ TclCompileScript( if (envPtr->codeNext == entryCodeNext) { PushStringLiteral(envPtr, ""); + } else { + /* Remove the surplus INST_POP */ + envPtr->codeNext--; + TclAdjustStackDepth(1, envPtr); } #else int lastTopLevelCmdIndex = -1; -- cgit v0.12 From a0860b63fb252ca05d70706533db45c410b95c0e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 26 Jun 2013 03:46:54 +0000 Subject: A few bug fixes from failing tests; still leaky. --- generic/tclCompile.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 955078c..626c5ae 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2076,7 +2076,10 @@ TclCompileScript( */ Tcl_LogCommandInfo(interp, script, parse.commandStart, - parse.term - parse.commandStart); + /* Drop the command terminator (";","]") if appropriate */ + (parse.term == + parse.commandStart + parse.commandSize - 1)? + parse.commandSize - 1 : parse.commandSize); TclCompileSyntaxError(interp, envPtr); break; } @@ -2142,7 +2145,7 @@ TclCompileScript( if (envPtr->codeNext == entryCodeNext) { PushStringLiteral(envPtr, ""); - } else { + } else if (envPtr->codeNext[-1] == INST_POP) { /* Remove the surplus INST_POP */ envPtr->codeNext--; TclAdjustStackDepth(1, envPtr); -- cgit v0.12 From b7baefb37be1711dc8aefbbed9e9670b0926e1be Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Jun 2013 07:42:53 +0000 Subject: Proposed solution for [9b2e636361] --- generic/tclConfig.c | 44 +++++++++++++++++++------------------------- generic/tclMain.c | 5 +++-- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 28549ed..ffed6f2 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -26,14 +26,15 @@ #define ASSOC_KEY "tclPackageAboutDict" /* - * A ClientData struct for the QueryConfig command. Store the two bits + * A ClientData struct for the QueryConfig command. Store the three bits * of data we need; the package name for which we store a config dict, - * and the (Tcl_Interp *) in which it is stored. + * the (Tcl_Interp *) in which it is stored, and the encoding. */ typedef struct QCCD { Tcl_Obj *pkg; Tcl_Interp *interp; + CONST char *encoding; } QCCD; /* @@ -78,10 +79,10 @@ Tcl_RegisterConfig( Tcl_Obj *pDB, *pkgDict; Tcl_DString cmdName; Tcl_Config *cfg; - Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding); QCCD *cdPtr = (QCCD *)ckalloc(sizeof(QCCD)); cdPtr->interp = interp; + cdPtr->encoding = valEncoding; cdPtr->pkg = Tcl_NewStringObj(pkgName, -1); /* @@ -104,7 +105,6 @@ Tcl_RegisterConfig( * dictionaries visible at Tcl level. I.e. they are not filled */ - if (venc != NULL) { /* * Retrieve package specific configuration... */ @@ -123,32 +123,15 @@ Tcl_RegisterConfig( */ for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) { - Tcl_DString conv; - CONST char *convValue = - Tcl_ExternalToUtfDString(venc, cfg->value, -1, &conv); - - /* - * We know that the keys are in ASCII/UTF-8, so for them is no - * conversion required. - */ - Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, -1), - Tcl_NewStringObj(convValue, -1)); - Tcl_DStringFree(&conv); + Tcl_NewStringObj(cfg->value, -1)); } /* - * We're now done with the encoding, so drop it. - */ - - Tcl_FreeEncoding(venc); - - /* * Write the changes back into the overall database. */ Tcl_DictObjPut(interp, pDB, cdPtr->pkg, pkgDict); - } /* * Now create the interface command for retrieval of the package @@ -219,6 +202,9 @@ QueryConfigObjCmd( enum subcmds { CFG_GET, CFG_LIST }; + Tcl_DString conv; + Tcl_Encoding venc = NULL; + CONST char *value; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?argument?"); @@ -237,7 +223,7 @@ QueryConfigObjCmd( * present. */ - Tcl_SetResult(interp, "package not known", TCL_STATIC); + Tcl_SetResult(interp, "package not known", TCL_STATIC); return TCL_ERROR; } @@ -254,7 +240,15 @@ QueryConfigObjCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, val); + if (cdPtr->encoding) { + venc = Tcl_GetEncoding(interp, cdPtr->encoding); + if (!venc) { + return TCL_ERROR; + } + } + value = Tcl_ExternalToUtfDString(venc, Tcl_GetString(val), -1, &conv); + Tcl_SetObjResult(interp, Tcl_NewStringObj(value, -1)); + Tcl_DStringFree(&conv); return TCL_OK; case CFG_LIST: @@ -361,7 +355,7 @@ GetConfigDict( * * This function is associated with the "Package About dict" assoc data * for an interpreter; it is invoked when the interpreter is deleted in - * order to free the information assoicated with any pending error + * order to free the information associated with any pending error * reports. * * Results: diff --git a/generic/tclMain.c b/generic/tclMain.c index 7a19a38..5e5109b 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -342,9 +342,10 @@ Tcl_Main( Tcl_Interp *interp; Tcl_DString appName; - Tcl_FindExecutable(argv[0]); - interp = Tcl_CreateInterp(); + TclpSetInitialEncodings(); + TclpFindExecutable(argv[0]); + Tcl_InitMemory(interp); /* -- cgit v0.12 From e0e8990257bc75fdafa895f309145353c400923e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Jun 2013 08:10:36 +0000 Subject: Allocate encoding name, so caller of Tcl_RegisterConfig() doesn't need to keep it forever. Fix some comments. --- generic/tclConfig.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/generic/tclConfig.c b/generic/tclConfig.c index ffed6f2..702ab82 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -34,7 +34,7 @@ typedef struct QCCD { Tcl_Obj *pkg; Tcl_Interp *interp; - CONST char *encoding; + char *encoding; } QCCD; /* @@ -82,15 +82,20 @@ Tcl_RegisterConfig( QCCD *cdPtr = (QCCD *)ckalloc(sizeof(QCCD)); cdPtr->interp = interp; - cdPtr->encoding = valEncoding; + if (valEncoding) { + cdPtr->encoding = ckalloc(strlen(valEncoding)+1); + strcpy(cdPtr->encoding, valEncoding); + } else { + cdPtr->encoding = NULL; + } cdPtr->pkg = Tcl_NewStringObj(pkgName, -1); /* * Phase I: Adding the provided information to the internal database of - * package meta data. Only if we have an ok encoding. + * package meta data. * * Phase II: Create a command for querying this database, specific to the - * package registerting its configuration. This is the approved interface + * package registering its configuration. This is the approved interface * in TIP 59. In the future a more general interface should be done, as * followup to TIP 59. Simply because our database is now general across * packages, and not a structure tied to one package. @@ -313,6 +318,9 @@ QueryConfigDelete( Tcl_Obj *pDB = GetConfigDict(cdPtr->interp); Tcl_DictObjRemove(NULL, pDB, pkgName); Tcl_DecrRefCount(pkgName); + if (cdPtr->encoding) { + ckfree((char *)cdPtr->encoding); + } ckfree((char *)cdPtr); } -- cgit v0.12 From 75b009d2316ab41a1ff6bd841da8fd207aba7b9d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Jun 2013 14:20:26 +0000 Subject: formatting, typo --- generic/tclConfig.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 28549ed..c6baa2f 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -75,7 +75,6 @@ Tcl_RegisterConfig( CONST char *valEncoding) /* Name of the encoding used to store the * configuration values, ASCII, thus UTF-8. */ { - Tcl_Obj *pDB, *pkgDict; Tcl_DString cmdName; Tcl_Config *cfg; Tcl_Encoding venc = Tcl_GetEncoding(NULL, valEncoding); @@ -89,9 +88,9 @@ Tcl_RegisterConfig( * package meta data. Only if we have an ok encoding. * * Phase II: Create a command for querying this database, specific to the - * package registerting its configuration. This is the approved interface + * package registering its configuration. This is the approved interface * in TIP 59. In the future a more general interface should be done, as - * followup to TIP 59. Simply because our database is now general across + * follow-up to TIP 59. Simply because our database is now general across * packages, and not a structure tied to one package. * * Note, the created command will have a reference through its clientdata. @@ -105,14 +104,14 @@ Tcl_RegisterConfig( */ if (venc != NULL) { + Tcl_Obj *pkgDict, *pDB = GetConfigDict(interp); + /* * Retrieve package specific configuration... */ - pDB = GetConfigDict(interp); - if (Tcl_DictObjGet(interp, pDB, cdPtr->pkg, &pkgDict) != TCL_OK - || (pkgDict == NULL)) { + || (pkgDict == NULL)) { pkgDict = Tcl_NewDictObj(); } else if (Tcl_IsShared(pkgDict)) { pkgDict = Tcl_DuplicateObj(pkgDict); @@ -125,7 +124,7 @@ Tcl_RegisterConfig( for (cfg=configuration ; cfg->key!=NULL && cfg->key[0]!='\0' ; cfg++) { Tcl_DString conv; CONST char *convValue = - Tcl_ExternalToUtfDString(venc, cfg->value, -1, &conv); + Tcl_ExternalToUtfDString(venc, cfg->value, -1, &conv); /* * We know that the keys are in ASCII/UTF-8, so for them is no @@ -133,7 +132,7 @@ Tcl_RegisterConfig( */ Tcl_DictObjPut(interp, pkgDict, Tcl_NewStringObj(cfg->key, -1), - Tcl_NewStringObj(convValue, -1)); + Tcl_NewStringObj(convValue, -1)); Tcl_DStringFree(&conv); } @@ -178,7 +177,7 @@ Tcl_RegisterConfig( if (Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName), QueryConfigObjCmd, (ClientData) cdPtr, QueryConfigDelete) == NULL) { - Tcl_Panic("%s: %s", "Tcl_RegisterConfig", + Tcl_Panic("%s: %s", "Tcl_RegisterConfig", "Unable to create query command for package configuration"); } @@ -213,7 +212,7 @@ QueryConfigObjCmd( Tcl_Obj *pkgName = cdPtr->pkg; Tcl_Obj *pDB, *pkgDict, *val, *listPtr; int n, index; - static const char *subcmdStrings[] = { + static CONST char *subcmdStrings[] = { "get", "list", NULL }; enum subcmds { @@ -232,12 +231,12 @@ QueryConfigObjCmd( pDB = GetConfigDict(interp); if (Tcl_DictObjGet(interp, pDB, pkgName, &pkgDict) != TCL_OK || pkgDict == NULL) { - /* + /* * Maybe a Tcl_Panic is better, because the package data has to be * present. */ - Tcl_SetResult(interp, "package not known", TCL_STATIC); + Tcl_SetResult(interp, "package not known", TCL_STATIC); return TCL_ERROR; } @@ -248,7 +247,7 @@ QueryConfigObjCmd( return TCL_ERROR; } - if (Tcl_DictObjGet(interp, pkgDict, objv [2], &val) != TCL_OK + if (Tcl_DictObjGet(interp, pkgDict, objv[2], &val) != TCL_OK || val == NULL) { Tcl_SetResult(interp, "key not known", TCL_STATIC); return TCL_ERROR; @@ -317,6 +316,7 @@ QueryConfigDelete( QCCD *cdPtr = (QCCD *) clientData; Tcl_Obj *pkgName = cdPtr->pkg; Tcl_Obj *pDB = GetConfigDict(cdPtr->interp); + Tcl_DictObjRemove(NULL, pDB, pkgName); Tcl_DecrRefCount(pkgName); ckfree((char *)cdPtr); -- cgit v0.12 From 33e20f17a6f8a5fddafb1a39563a04aed53705e1 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 26 Jun 2013 16:06:44 +0000 Subject: Fix bytecode ranges in the cmdMapPtr. still leaky. --- generic/tclCompile.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 626c5ae..62943b2 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1742,7 +1742,8 @@ static void CompileCommandTokens( Tcl_Interp *interp, Tcl_Parse *parsePtr, - CompileEnv *envPtr) + CompileEnv *envPtr, + int *lastPopPtr) { Interp *iPtr = (Interp *) interp; Tcl_Obj *cmdObj = Tcl_NewObj(); @@ -2017,6 +2018,8 @@ finishCommand: EnterCmdExtentData(envPtr, currCmdIndex, parsePtr->term - parsePtr->commandStart, (envPtr->codeNext-envPtr->codeStart) - startCodeOffset); + *lastPopPtr = currCmdIndex; + if (cmdKnown) { Tcl_DecrRefCount(cmdObj); @@ -2051,6 +2054,7 @@ TclCompileScript( unsigned char *entryCodeNext = envPtr->codeNext; const char *p; int cmdLine, *clNext; + int lastPop = -1; if (envPtr->iPtr == NULL) { Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); @@ -2081,6 +2085,7 @@ TclCompileScript( parse.commandStart + parse.commandSize - 1)? parse.commandSize - 1 : parse.commandSize); TclCompileSyntaxError(interp, envPtr); + lastPop = -1; break; } @@ -2109,7 +2114,7 @@ TclCompileScript( envPtr->line = cmdLine; envPtr->clNext = clNext; - CompileCommandTokens(interp, &parse, envPtr); + CompileCommandTokens(interp, &parse, envPtr, &lastPop); cmdLine = envPtr->line; clNext = envPtr->clNext; @@ -2145,8 +2150,8 @@ TclCompileScript( if (envPtr->codeNext == entryCodeNext) { PushStringLiteral(envPtr, ""); - } else if (envPtr->codeNext[-1] == INST_POP) { - /* Remove the surplus INST_POP */ + } else if (lastPop >= 0) { + envPtr->cmdMapPtr[lastPop].numCodeBytes--; envPtr->codeNext--; TclAdjustStackDepth(1, envPtr); } -- cgit v0.12 From d586d955ce5e6ebbd9b670d848ef7c4f4935f9f3 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 26 Jun 2013 17:26:16 +0000 Subject: Correct typo detected by valgrind. --- generic/tclExecute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 98f1ed8..d3a0d32 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2766,7 +2766,7 @@ TEBCresume( */ auxObjList->length += objc - 1; - if ((objc > 1) && (auxObjList-length > 0)) { + if ((objc > 1) && (auxObjList->length > 0)) { length = auxObjList->length /* Total expansion room we need */ + codePtr->maxStackDepth /* Beyond the original max */ - CURR_DEPTH; /* Relative to where we are */ -- cgit v0.12 From d8e108cc4748d02d928366cc07447b2e738e796b Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 26 Jun 2013 20:13:57 +0000 Subject: Stop buffer overrun into undefined values detected by valgrind. --- generic/tclOptimize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclOptimize.c b/generic/tclOptimize.c index cd37a6a..b7f4173 100644 --- a/generic/tclOptimize.c +++ b/generic/tclOptimize.c @@ -212,7 +212,8 @@ ConvertZeroEffectToNOP( int blank = 0, i, nextInst; size = AddrLength(currentInstPtr); - while (*(currentInstPtr+size) == INST_NOP) { + while ((currentInstPtr + size < envPtr->codeNext) + && *(currentInstPtr+size) == INST_NOP) { if (IsTargetAddress(&targets, currentInstPtr + size)) { break; } -- cgit v0.12 From 4afe34c9b3d9bc56352470e7f7dc61304bb71201 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 27 Jun 2013 12:34:49 +0000 Subject: Fix [34538ba43f] --- library/clock.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/clock.tcl b/library/clock.tcl index 32911b3..49aad23 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -3947,7 +3947,7 @@ proc ::tcl::clock::ProcessPosixTimeZone { z } { # Put DST in effect in all years from 1916 to 2099. - for { set y 1916 } { $y < 2099 } { incr y } { + for { set y 1916 } { $y < 2100 } { incr y } { set startTime [DeterminePosixDSTTime $z start $y] incr startTime [expr { - wide($stdOffset) }] set endTime [DeterminePosixDSTTime $z end $y] -- cgit v0.12 From e72d24628cda082e00cafb1ec1e95ea027dc66c8 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 27 Jun 2013 13:11:53 +0000 Subject: plug memory leaks --- generic/tclCompile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 62943b2..416078c 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1746,7 +1746,7 @@ CompileCommandTokens( int *lastPopPtr) { Interp *iPtr = (Interp *) interp; - Tcl_Obj *cmdObj = Tcl_NewObj(); + Tcl_Obj *cmdObj; Tcl_Token *tokenPtr = parsePtr->tokenPtr; Command *cmdPtr = NULL; int wordIdx, cmdKnown, expand = 0, numWords = parsePtr->numWords; @@ -1765,6 +1765,7 @@ CompileCommandTokens( } } + cmdObj = Tcl_NewObj(); Tcl_IncrRefCount(cmdObj); tokenPtr = parsePtr->tokenPtr; cmdKnown = TclWordKnownAtCompileTime(tokenPtr, cmdObj); @@ -2085,6 +2086,7 @@ TclCompileScript( parse.commandStart + parse.commandSize - 1)? parse.commandSize - 1 : parse.commandSize); TclCompileSyntaxError(interp, envPtr); + Tcl_FreeParse(&parse); lastPop = -1; break; } -- cgit v0.12 From 7924f4a694c43ca8fe4260041d090795b0791a96 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 27 Jun 2013 20:10:41 +0000 Subject: Stop the compileProc routines leaving behind error messages in interp. (Nicer way to solve [Bug 20a81392ec].) Make simplifications in TclCompileScript() make possible by the new structure. Still a work in progress. --- generic/tclAssembly.c | 32 +++++++++++++- generic/tclCompCmds.c | 5 ++- generic/tclCompCmdsGR.c | 1 + generic/tclCompile.c | 109 ++++++++++++++++++++++-------------------------- 4 files changed, 83 insertions(+), 64 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 62641e6..1a061f0 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -930,6 +930,12 @@ TclCompileAssembleCmd( { Tcl_Token *tokenPtr; /* Token in the input script */ +#if 0 + int numCommands = envPtr->numCommands; + int offset = envPtr->codeNext - envPtr->codeStart; + int depth = envPtr->currStackDepth; +#endif + /* * Make sure that the command has a single arg that is a simple word. */ @@ -943,10 +949,32 @@ TclCompileAssembleCmd( } /* - * Compile the code and return any error from the compilation. + * Compile the code and convert any error from the compilation into + * bytecode reporting the error; */ - return TclAssembleCode(envPtr, tokenPtr[1].start, tokenPtr[1].size, 0); + if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start, + tokenPtr[1].size, TCL_EVAL_DIRECT)) { + + /* + * TODO: Finish working out how to capture syntax errors captured + * during compile and make them bytecode reporting the error. + */ +#if 0 + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"%.*s\" body, line %d)", + parsePtr->tokenPtr->size, parsePtr->tokenPtr->start, + Tcl_GetErrorLine(interp))); + envPtr->numCommands = numCommands; + envPtr->codeNext = envPtr->codeStart + offset; + envPtr->currStackDepth = depth; + TclCompileSyntaxError(interp, envPtr); +#else + Tcl_ResetResult(interp); + return TCL_ERROR; +#endif + } + return TCL_OK; } /* diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index fddf152..18295eb 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -2544,7 +2544,7 @@ CompileEachloopCmd( Tcl_DStringInit(&varList); TclDStringAppendToken(&varList, &tokenPtr[1]); - code = Tcl_SplitList(interp, Tcl_DStringValue(&varList), + code = Tcl_SplitList(NULL, Tcl_DStringValue(&varList), &varcList[loopIndex], &varvList[loopIndex]); Tcl_DStringFree(&varList); if (code != TCL_OK) { @@ -2988,7 +2988,8 @@ TclCompileFormatCmd( ckfree(objv); Tcl_DecrRefCount(formatObj); if (tmpObj == NULL) { - return TCL_ERROR; + TclCompileSyntaxError(interp, envPtr); + return TCL_OK; } /* diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index f7c15e6..4de8cf2 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2534,6 +2534,7 @@ TclCompileSyntaxError( TclEmitPush(TclRegisterNewLiteral(envPtr, bytes, numBytes), envPtr); CompileReturnInternal(envPtr, INST_SYNTAX, TCL_ERROR, 0, TclNoErrorStack(interp, Tcl_GetReturnOptions(interp, TCL_ERROR))); + Tcl_ResetResult(interp); } /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 416078c..5a8524c 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1738,24 +1738,25 @@ FindCompiledCommandFromToken( */ #if 1 -static void +static int CompileCommandTokens( Tcl_Interp *interp, Tcl_Parse *parsePtr, - CompileEnv *envPtr, - int *lastPopPtr) + CompileEnv *envPtr) { Interp *iPtr = (Interp *) interp; - Tcl_Obj *cmdObj; Tcl_Token *tokenPtr = parsePtr->tokenPtr; + ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + Tcl_Obj *cmdObj = Tcl_NewObj(); Command *cmdPtr = NULL; int wordIdx, cmdKnown, expand = 0, numWords = parsePtr->numWords; - ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; int *wlines, wlineat; + int cmdLine = envPtr->line; + int *clNext = envPtr->clNext; + int cmdIdx = envPtr->numCommands; + int startCodeOffset = envPtr->codeNext - envPtr->codeStart; - if (numWords == 0) { - return; - } + assert (numWords > 0); for (wordIdx = 0; wordIdx < numWords; wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { @@ -1765,7 +1766,6 @@ CompileCommandTokens( } } - cmdObj = Tcl_NewObj(); Tcl_IncrRefCount(cmdObj); tokenPtr = parsePtr->tokenPtr; cmdKnown = TclWordKnownAtCompileTime(tokenPtr, cmdObj); @@ -1787,15 +1787,9 @@ CompileCommandTokens( } /* Pre-Compile */ -int lastTopLevelCmdIndex, currCmdIndex, startCodeOffset; - -int cmdLine = envPtr->line; -int *clNext = envPtr->clNext; - lastTopLevelCmdIndex = currCmdIndex = envPtr->numCommands; envPtr->numCommands++; - startCodeOffset = envPtr->codeNext - envPtr->codeStart; - EnterCmdStartData(envPtr, currCmdIndex, + EnterCmdStartData(envPtr, cmdIdx, parsePtr->commandStart - envPtr->source, startCodeOffset); if (expand && !cmdPtr) { @@ -2016,11 +2010,9 @@ int *clNext = envPtr->clNext; finishCommand: TclEmitOpcode(INST_POP, envPtr); - EnterCmdExtentData(envPtr, currCmdIndex, + EnterCmdExtentData(envPtr, cmdIdx, parsePtr->term - parsePtr->commandStart, (envPtr->codeNext-envPtr->codeStart) - startCodeOffset); - *lastPopPtr = currCmdIndex; - if (cmdKnown) { Tcl_DecrRefCount(cmdObj); @@ -2037,6 +2029,8 @@ finishCommand: ckfree(eclPtr->loc[wlineat].next); eclPtr->loc[wlineat].line = wlines; eclPtr->loc[wlineat].next = NULL; + + return cmdIdx; } #endif @@ -2052,10 +2046,8 @@ TclCompileScript( CompileEnv *envPtr) /* Holds resulting instructions. */ { #if 1 - unsigned char *entryCodeNext = envPtr->codeNext; - const char *p; - int cmdLine, *clNext; - int lastPop = -1; + int lastCmdIdx = -1; + const char *p = script; if (envPtr->iPtr == NULL) { Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); @@ -2066,40 +2058,34 @@ TclCompileScript( * from the script. */ - p = script; - cmdLine = envPtr->line; - clNext = envPtr->clNext; + /* TODO: Figure out when/why we need this */ +#if 0 +if (Tcl_GetStringResult(interp)[0] != '\0') { + fprintf(stdout, "INIT: '%s'\n", Tcl_GetStringResult(interp)); + fflush(stdout); +} +#endif + Tcl_ResetResult(interp); while (numBytes > 0) { Tcl_Parse parse; const char *next; - /* TODO: can we relocate this to happen less frequently? */ - Tcl_ResetResult(interp); if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, &parse)) { /* * Compile bytecodes to report the parse error at runtime. */ Tcl_LogCommandInfo(interp, script, parse.commandStart, +/* TODO: Make this more sensible, f. ex. [eval {foo \$x(}] */ /* Drop the command terminator (";","]") if appropriate */ (parse.term == parse.commandStart + parse.commandSize - 1)? parse.commandSize - 1 : parse.commandSize); TclCompileSyntaxError(interp, envPtr); Tcl_FreeParse(&parse); - lastPop = -1; - break; + return; } - /* - * TIP #280: Count newlines before the command start. - * (See test info-30.33). - */ - - TclAdvanceLines(&cmdLine, p, parse.commandStart); - TclAdvanceContinuations(&cmdLine, &clNext, - parse.commandStart - envPtr->source); - #ifdef TCL_COMPILE_DEBUG /* * If tracing, print a line for each top level command compiled. @@ -2114,48 +2100,51 @@ TclCompileScript( } #endif - envPtr->line = cmdLine; - envPtr->clNext = clNext; - CompileCommandTokens(interp, &parse, envPtr, &lastPop); - cmdLine = envPtr->line; - clNext = envPtr->clNext; + /* + * TIP #280: Count newlines before the command start. + * (See test info-30.33). + */ + + TclAdvanceLines(&envPtr->line, p, parse.commandStart); + TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, + parse.commandStart - envPtr->source); /* - * Advance to the next command in the script. + * Advance parser to the next command in the script. */ next = parse.commandStart + parse.commandSize; numBytes -= next - p; p = next; + if (parse.numWords == 0) { + /* TODO: Document justification */ + continue; + } + + lastCmdIdx = CompileCommandTokens(interp, &parse, envPtr); + /* * TIP #280: Track lines in the just compiled command. */ - TclAdvanceLines(&cmdLine, parse.commandStart, p); - TclAdvanceContinuations(&cmdLine, &clNext, p - envPtr->source); + TclAdvanceLines(&envPtr->line, parse.commandStart, p); + TclAdvanceContinuations(&envPtr->line, &envPtr->clNext, + p - envPtr->source); Tcl_FreeParse(&parse); } /* - * TIP #280: Bring the line counts in the CompEnv up to date. - * See tests info-30.33,34,35 . - */ - - envPtr->line = cmdLine; - envPtr->clNext = clNext; - - /* * If the source script yielded no instructions (e.g., if it was empty), * push an empty string as the command's result. */ - if (envPtr->codeNext == entryCodeNext) { - PushStringLiteral(envPtr, ""); - } else if (lastPop >= 0) { - envPtr->cmdMapPtr[lastPop].numCodeBytes--; + if (lastCmdIdx >= 0) { + envPtr->cmdMapPtr[lastCmdIdx].numCodeBytes--; envPtr->codeNext--; - TclAdjustStackDepth(1, envPtr); + envPtr->currStackDepth++; + } else { + PushStringLiteral(envPtr, ""); } #else int lastTopLevelCmdIndex = -1; -- cgit v0.12 From d896ae28d39cbaeb363e3b84c58c26e31bd0c56d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 28 Jun 2013 02:58:15 +0000 Subject: More elimination of error message litter to fix [Bug 20a81392ec]. --- generic/tclCompCmdsSZ.c | 3 +++ generic/tclCompile.c | 8 -------- generic/tclExecute.c | 18 +++++++----------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 855dd8f..026b214 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -748,6 +748,9 @@ TclSubstCompile( Tcl_InterpState state = NULL; TclSubstParse(interp, bytes, numBytes, flags, &parse, &state); + if (state != NULL) { + Tcl_ResetResult(interp); + } /* * Tricky point! If the first token does not result in a *guaranteed* push diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 5a8524c..1f72aa7 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2058,14 +2058,6 @@ TclCompileScript( * from the script. */ - /* TODO: Figure out when/why we need this */ -#if 0 -if (Tcl_GetStringResult(interp)[0] != '\0') { - fprintf(stdout, "INIT: '%s'\n", Tcl_GetStringResult(interp)); - fflush(stdout); -} -#endif - Tcl_ResetResult(interp); while (numBytes > 0) { Tcl_Parse parse; const char *next; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d3a0d32..37bf072 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1426,17 +1426,12 @@ Tcl_NRExprObj( Tcl_Obj *resultPtr) { ByteCode *codePtr; + Tcl_InterpState state = Tcl_SaveInterpState(interp, TCL_OK); - /* TODO: consider saving whole state? */ - Tcl_Obj *saveObjPtr = Tcl_GetObjResult(interp); - - Tcl_IncrRefCount(saveObjPtr); - + Tcl_ResetResult(interp); codePtr = CompileExprObj(interp, objPtr); - /* TODO: Confirm reset not required? */ - /*Tcl_ResetResult(interp);*/ - Tcl_NRAddCallback(interp, ExprObjCallback, saveObjPtr, resultPtr, + Tcl_NRAddCallback(interp, ExprObjCallback, state, resultPtr, NULL, NULL); return TclNRExecuteByteCode(interp, codePtr); } @@ -1447,14 +1442,15 @@ ExprObjCallback( Tcl_Interp *interp, int result) { - Tcl_Obj *saveObjPtr = data[0]; + Tcl_InterpState state = data[0]; Tcl_Obj *resultPtr = data[1]; if (result == TCL_OK) { TclSetDuplicateObj(resultPtr, Tcl_GetObjResult(interp)); - Tcl_SetObjResult(interp, saveObjPtr); + (void) Tcl_RestoreInterpState(interp, state); + } else { + Tcl_DiscardInterpState(state); } - TclDecrRefCount(saveObjPtr); return result; } -- cgit v0.12 From 5d46ba8b3ec614cfb931011d5b6c35d9eb046d75 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 1 Jul 2013 20:58:15 +0000 Subject: More Work In Progress. --- generic/tclCompile.c | 55 ++++++++++++++++++++++++++++++++-------------------- tests/misc.test | 7 +------ 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 1f72aa7..6f5ef50 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -16,6 +16,8 @@ #include "tclCompile.h" #include +#define REWRITE + /* * Table of all AuxData types. */ @@ -562,8 +564,10 @@ static void EnterCmdExtentData(CompileEnv *envPtr, int cmdNumber, int numSrcBytes, int numCodeBytes); static void EnterCmdStartData(CompileEnv *envPtr, int cmdNumber, int srcOffset, int codeOffset); +#ifndef REWRITE static Command * FindCompiledCommandFromToken(Tcl_Interp *interp, Tcl_Token *tokenPtr); +#endif static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); @@ -1671,6 +1675,7 @@ TclWordKnownAtCompileTime( return 1; } +#ifndef REWRITE /* * --------------------------------------------------------------------- * @@ -1718,6 +1723,7 @@ FindCompiledCommandFromToken( Tcl_DStringFree(&ds); return cmdPtr; } +#endif /* *---------------------------------------------------------------------- @@ -1737,7 +1743,7 @@ FindCompiledCommandFromToken( *---------------------------------------------------------------------- */ -#if 1 +#ifdef REWRITE static int CompileCommandTokens( Tcl_Interp *interp, @@ -2045,18 +2051,18 @@ TclCompileScript( * first null character. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { -#if 1 - int lastCmdIdx = -1; - const char *p = script; +#ifdef REWRITE + int lastCmdIdx = -1; /* Index into envPtr->cmdMapPtr of the last + * command this routine compiles into bytecode. + * Initial value of -1 indicates this routine + * has not yet generated any bytecode. */ + const char *p = script; /* Where we are in our compile. */ if (envPtr->iPtr == NULL) { Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); } - /* - * Each iteration through the following loop compiles the next command - * from the script. - */ + /* Each iteration compiles one command from the script. */ while (numBytes > 0) { Tcl_Parse parse; @@ -2068,11 +2074,7 @@ TclCompileScript( */ Tcl_LogCommandInfo(interp, script, parse.commandStart, -/* TODO: Make this more sensible, f. ex. [eval {foo \$x(}] */ - /* Drop the command terminator (";","]") if appropriate */ - (parse.term == - parse.commandStart + parse.commandSize - 1)? - parse.commandSize - 1 : parse.commandSize); + parse.term + 1 - parse.commandStart); TclCompileSyntaxError(interp, envPtr); Tcl_FreeParse(&parse); return; @@ -2126,17 +2128,28 @@ TclCompileScript( Tcl_FreeParse(&parse); } - /* - * If the source script yielded no instructions (e.g., if it was empty), - * push an empty string as the command's result. - */ - - if (lastCmdIdx >= 0) { + if (lastCmdIdx == -1) { + /* + * Compiling the script yielded no bytecode. The script must be + * all whitespace, comments, and empty commands. Such scripts + * are defined to successfully produce the empty string result, + * so we emit the simple bytecode that makes that happen. + */ + PushStringLiteral(envPtr, ""); + } else { + /* + * We compiled at least one command to bytecode. The routine + * CompileCommandTokens() follows the bytecode of each compiled + * command with an INST_POP, so that stack balance is maintained + * when several commands are in sequence. (The result of each + * command is thrown away before moving on to the next command). + * For the last command compiled, we need to undo that INST_POP + * so that the result of the last command becomes the result of + * the script. These code here removes that trailing INST_POP. + */ envPtr->cmdMapPtr[lastCmdIdx].numCodeBytes--; envPtr->codeNext--; envPtr->currStackDepth++; - } else { - PushStringLiteral(envPtr, ""); } #else int lastTopLevelCmdIndex = -1; diff --git a/tests/misc.test b/tests/misc.test index 6ddc718..d4ece74 100644 --- a/tests/misc.test +++ b/tests/misc.test @@ -59,12 +59,7 @@ test misc-1.2 {error in variable ref. in command in array reference} { missing close-brace for variable name missing close-brace for variable name while executing -"set tst $a([winfo name $\{zz) - # this is a bogus comment - # this is a bogus comment - # this is a bogus comment - # this is a bogus comment - # this is a ..." +"set tst $a([winfo name $\{" (procedure "tstProc" line 4) invoked from within "tstProc"}] -- cgit v0.12 From 6126629e09afa73afc95abe698873234c68c643c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 Jul 2013 07:14:59 +0000 Subject: Bug [32afa6e256]: dirent64 check is incorrect in tcl.m4. Thanks to Brian Griffin. --- unix/configure | 2 +- unix/tcl.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index 61c2247..3e04284 100755 --- a/unix/configure +++ b/unix/configure @@ -9619,7 +9619,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include -#include +#include int main () { diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 850e940..bac5ebe 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2776,7 +2776,7 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ # Now check for auxiliary declarations AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ AC_TRY_COMPILE([#include -#include ],[struct dirent64 p;], +#include ],[struct dirent64 p;], tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in ?]) -- cgit v0.12 From 4fe87442ab9dc726e56daa494f7f60c2cb0efc75 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 Jul 2013 07:16:22 +0000 Subject: Don't forget ChangeLog for previous commit --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 10d21d0..e877bd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-07-02 Jan Nijtmans + + * unix/tcl.m4: Bug [32afa6e256]: dirent64 check is incorrect in tcl.m4 + * unix/configure: (thanks to Brian Griffin) + 2013-06-27 Jan Nijtmans * generic/tclConfig.c: Bug [9b2e636361]: Tcl_CreateInterp() needs initialized -- cgit v0.12 From 5599b1864958a90b4754b554eadb41722bdc9246 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 2 Jul 2013 10:36:32 +0000 Subject: comment improvements --- generic/tclCompile.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6f5ef50..05daabf 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1764,6 +1764,7 @@ CompileCommandTokens( assert (numWords > 0); + /* Determine whether any words of the command require expansion */ for (wordIdx = 0; wordIdx < numWords; wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { @@ -1772,6 +1773,7 @@ CompileCommandTokens( } } + /* Do we know the command word? */ Tcl_IncrRefCount(cmdObj); tokenPtr = parsePtr->tokenPtr; cmdKnown = TclWordKnownAtCompileTime(tokenPtr, cmdObj); @@ -1791,6 +1793,7 @@ CompileCommandTokens( } } } + /* If cmdPtr != NULL, we will try to call cmdPtr->compileProc */ /* Pre-Compile */ @@ -2112,7 +2115,22 @@ TclCompileScript( p = next; if (parse.numWords == 0) { - /* TODO: Document justification */ + /* + * The "command" parsed has no words. In this case + * we can skip the rest of the loop body. With no words, + * clearly CompileCommandTokens() has nothing to do. Since + * the parser aggressively sucks up leading comment and white + * space, including newlines, parse.commandStart must be + * pointing at either the end of script, or a command-terminating + * semi-colon. In either case, the TclAdvance*() calls have + * nothing to do. Finally, when no words are parsed, no + * tokens have been allocated at parse.tokenPtr so there's + * also nothing for Tcl_FreeParse() to do. + * + * The advantage of this shortcut is that CompileCommandTokens() + * can be written with an assumption that parse.numWords > 0, + * with the implication the CCT() always generates bytecode. + */ continue; } @@ -2145,7 +2163,7 @@ TclCompileScript( * command is thrown away before moving on to the next command). * For the last command compiled, we need to undo that INST_POP * so that the result of the last command becomes the result of - * the script. These code here removes that trailing INST_POP. + * the script. The code here removes that trailing INST_POP. */ envPtr->cmdMapPtr[lastCmdIdx].numCodeBytes--; envPtr->codeNext--; -- cgit v0.12 From 897293c4c13d94223af9ebf03798a5ddcf08dcb6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 3 Jul 2013 08:56:34 +0000 Subject: Fix compiler warning when compiling Cygwin port with -Wwrite-strings --- unix/tclUnixNotfy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index b87af1b..aacc8d2d 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -96,7 +96,7 @@ typedef struct ThreadSpecificData { * that an event is ready to be processed * by sending this event. */ void *hwnd; /* Messaging window. */ -#else +#else /* !__CYGWIN__ */ Tcl_Condition waitCV; /* Any other thread alerts a notifier that an * event is ready to be processed by signaling * this condition variable. */ @@ -184,9 +184,9 @@ static Tcl_ThreadId notifierThread; */ #ifdef TCL_THREADS -static void NotifierThreadProc(ClientData clientData); +static void NotifierThreadProc(ClientData clientData); #endif -static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); +static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); /* * Import of Windows API when building threaded with Cygwin. @@ -213,14 +213,14 @@ typedef struct { void *hCursor; void *hbrBackground; void *lpszMenuName; - void *lpszClassName; + const void *lpszClassName; } WNDCLASS; extern void __stdcall CloseHandle(void *); extern void *__stdcall CreateEventW(void *, unsigned char, unsigned char, void *); -extern void * __stdcall CreateWindowExW(void *, void *, void *, DWORD, int, - int, int, int, void *, void *, void *, void *); +extern void * __stdcall CreateWindowExW(void *, const void *, const void *, + DWORD, int, int, int, int, void *, void *, void *, void *); extern DWORD __stdcall DefWindowProcW(void *, int, void *, void *); extern unsigned char __stdcall DestroyWindow(void *); extern int __stdcall DispatchMessageW(const MSG *); -- cgit v0.12 From 950488656e09b8da52835a7abe385816f571e607 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 3 Jul 2013 08:59:09 +0000 Subject: =?UTF-8?q?Fix=20compiler=20warning=20when=20compiling=20Itcl=204.?= =?UTF-8?q?0:=20In=20file=20included=20from=20./generic/itcl2TclOO.c:12:0:?= =?UTF-8?q?=20/Tcl/include/tclInt.h:3012:8:=20warning:=20=E2=80=98struct?= =?UTF-8?q?=20addrinfo=E2=80=99=20declared=20inside=20parameter=20list=20[?= =?UTF-8?q?enabled=20by=20default]=20=20=20=20=20=20=20=20=20const=20char?= =?UTF-8?q?=20**errorMsgPtr);=20=20=20=20=20=20=20=20=20^?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tclIOSock.c | 4 ++-- generic/tclInt.h | 5 ++--- unix/tclUnixSock.c | 5 +++-- win/tclWinSock.c | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 694501f..7d6c462 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -139,7 +139,7 @@ int TclCreateSocketAddress( Tcl_Interp *interp, /* Interpreter for querying * the desired socket family */ - struct addrinfo **addrlist, /* Socket address list */ + void **addrlist, /* Socket address list */ const char *host, /* Host. NULL implies INADDR_ANY */ int port, /* Port number */ int willBind, /* Is this an address to bind() to or @@ -213,7 +213,7 @@ TclCreateSocketAddress( hints.ai_flags |= AI_PASSIVE; } - result = getaddrinfo(native, portstring, &hints, addrlist); + result = getaddrinfo(native, portstring, &hints, (struct addrinfo **) addrlist); if (host != NULL) { Tcl_DStringFree(&ds); diff --git a/generic/tclInt.h b/generic/tclInt.h index fdd577a..b940225 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3010,9 +3010,8 @@ MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr); MODULE_SCOPE void TclpFinalizePipes(void); MODULE_SCOPE void TclpFinalizeSockets(void); MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp, - struct addrinfo **addrlist, - const char *host, int port, int willBind, - const char **errorMsgPtr); + void **addrlist, const char *host, int port, + int willBind, const char **errorMsgPtr); MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, ClientData clientData, int stackSize, int flags); diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 528f009..9c3d7eb 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -1131,7 +1131,7 @@ Tcl_OpenTcpClient( { TcpState *state; const char *errorMsg = NULL; - struct addrinfo *addrlist = NULL, *myaddrlist = NULL; + void *addrlist = NULL, *myaddrlist = NULL; char channelName[SOCK_CHAN_LENGTH]; /* @@ -1276,7 +1276,8 @@ Tcl_OpenTcpServer( ClientData acceptProcData) /* Data for the callback. */ { int status = 0, sock = -1, reuseaddr = 1, chosenport = 0; - struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ + void *addrlist = NULL; + struct addrinfo *addrPtr; /* socket address */ TcpState *statePtr = NULL; char channelName[SOCK_CHAN_LENGTH]; const char *errorMsg = NULL; diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 4ced0e7..f4d5a90 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1131,9 +1131,10 @@ CreateSocket( int asyncConnect = 0; /* Will be 1 if async connect is in * progress. */ unsigned short chosenport = 0; - struct addrinfo *addrlist = NULL, *addrPtr; + void *addrlist = NULL, *myaddrlist = NULL; + struct addrinfo *addrPtr; /* Socket address to connect to. */ - struct addrinfo *myaddrlist = NULL, *myaddrPtr; + struct addrinfo *myaddrPtr; /* Socket address for our side. */ const char *errorMsg = NULL; SOCKET sock = INVALID_SOCKET; -- cgit v0.12 From 843b98eacf8b17269d37cbc8d6e446dad9fe6f73 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 3 Jul 2013 10:39:50 +0000 Subject: Bug [817249]: bring tclXtNotify.c up to date with Tcl_SetNotifier() change --- ChangeLog | 5 +++++ unix/tclXtNotify.c | 38 +++++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e877bd7..97509e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-07-03 Jan Nijtmans + + * unix/tclXtNotify.c: Bug [817249]: bring tclXtNotify.c up to date with + Tcl_SetNotifier() change. + 2013-07-02 Jan Nijtmans * unix/tcl.m4: Bug [32afa6e256]: dirent64 check is incorrect in tcl.m4 diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index 6a11c0d..b2d1f4d 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.c @@ -74,13 +74,12 @@ static int initialized = 0; */ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); -static void FileProc(caddr_t clientData, int *source, +static void FileProc(XtPointer clientData, int *source, XtInputId *id); -void InitNotifier(void); static void NotifierExitHandler(ClientData clientData); -static void TimerProc(caddr_t clientData, XtIntervalId *id); +static void TimerProc(XtPointer clientData, XtIntervalId *id); static void CreateFileHandler(int fd, int mask, - Tcl_FileProc * proc, ClientData clientData); + Tcl_FileProc *proc, ClientData clientData); static void DeleteFileHandler(int fd); static void SetTimer(Tcl_Time * timePtr); static int WaitForEvent(Tcl_Time * timePtr); @@ -89,7 +88,8 @@ static int WaitForEvent(Tcl_Time * timePtr); * Functions defined in this file for use by users of the Xt Notifier: */ -EXTERN XtAppContext TclSetAppContext(XtAppContext ctx); +MODULE_SCOPE void InitNotifier(void); +MODULE_SCOPE XtAppContext TclSetAppContext(XtAppContext ctx); /* *---------------------------------------------------------------------- @@ -178,7 +178,7 @@ TclSetAppContext( void InitNotifier(void) { - Tcl_NotifierProcs notifier; + Tcl_NotifierProcs np; /* * Only reinitialize if we are not in exit handling. The notifier can get @@ -190,11 +190,15 @@ InitNotifier(void) return; } - notifier.createFileHandlerProc = CreateFileHandler; - notifier.deleteFileHandlerProc = DeleteFileHandler; - notifier.setTimerProc = SetTimer; - notifier.waitForEventProc = WaitForEvent; - Tcl_SetNotifier(¬ifier); + np.createFileHandlerProc = CreateFileHandler; + np.deleteFileHandlerProc = DeleteFileHandler; + np.setTimerProc = SetTimer; + np.waitForEventProc = WaitForEvent; + np.initNotifierProc = Tcl_InitNotifier; + np.finalizeNotifierProc = Tcl_FinalizeNotifier; + np.alertNotifierProc = Tcl_AlertNotifier; + np.serviceModeHookProc = Tcl_ServiceModeHook; + Tcl_SetNotifier(&np); /* * DO NOT create the application context yet; doing so would prevent @@ -202,7 +206,7 @@ InitNotifier(void) */ initialized = 1; - memset(¬ifier, 0, sizeof(notifier)); + memset(&np, 0, sizeof(np)); Tcl_CreateExitHandler(NotifierExitHandler, NULL); } @@ -298,7 +302,7 @@ SetTimer( static void TimerProc( - caddr_t data, /* Not used. */ + XtPointer clientData, /* Not used. */ XtIntervalId *id) { if (*id != notifier.currentTimeout) { @@ -372,7 +376,7 @@ CreateFileHandler( if (mask & TCL_READABLE) { if (!(filePtr->mask & TCL_READABLE)) { filePtr->read = XtAppAddInput(notifier.appContext, fd, - XtInputReadMask, FileProc, filePtr); + INT2PTR(XtInputReadMask), FileProc, filePtr); } } else { if (filePtr->mask & TCL_READABLE) { @@ -382,7 +386,7 @@ CreateFileHandler( if (mask & TCL_WRITABLE) { if (!(filePtr->mask & TCL_WRITABLE)) { filePtr->write = XtAppAddInput(notifier.appContext, fd, - XtInputWriteMask, FileProc, filePtr); + INT2PTR(XtInputWriteMask), FileProc, filePtr); } } else { if (filePtr->mask & TCL_WRITABLE) { @@ -392,7 +396,7 @@ CreateFileHandler( if (mask & TCL_EXCEPTION) { if (!(filePtr->mask & TCL_EXCEPTION)) { filePtr->except = XtAppAddInput(notifier.appContext, fd, - XtInputExceptMask, FileProc, filePtr); + INT2PTR(XtInputExceptMask), FileProc, filePtr); } } else { if (filePtr->mask & TCL_EXCEPTION) { @@ -485,7 +489,7 @@ DeleteFileHandler( static void FileProc( - caddr_t clientData, + XtPointer clientData, int *fd, XtInputId *id) { -- cgit v0.12 From e27613d051d663dca9388efda64d8cdf2263ba1d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 5 Jul 2013 14:02:59 +0000 Subject: Allow successfull compilation, even if Tcl_GetErrorLine/Tcl_SetErrorLine are redefined as macros. --- generic/tclResult.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclResult.c b/generic/tclResult.c index 014ea1b..2f2563a 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -1112,6 +1112,7 @@ Tcl_SetObjErrorCode( *---------------------------------------------------------------------- */ +#undef Tcl_GetErrorLine int Tcl_GetErrorLine( Tcl_Interp *interp) @@ -1129,6 +1130,7 @@ Tcl_GetErrorLine( *---------------------------------------------------------------------- */ +#undef Tcl_SetErrorLine void Tcl_SetErrorLine( Tcl_Interp *interp, -- cgit v0.12 From db6da56aeed8fd3ef50c82f06e1a488fb5d57e3b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 5 Jul 2013 14:04:03 +0000 Subject: CONST -> const in one place --- generic/tclConfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclConfig.c b/generic/tclConfig.c index e5acf5e..2fb3e92 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -211,7 +211,7 @@ QueryConfigObjCmd( }; Tcl_DString conv; Tcl_Encoding venc = NULL; - CONST char *value; + const char *value; if ((objc < 2) || (objc > 3)) { Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg?"); -- cgit v0.12 From eca681b804474b740e51f8be8a67a7b2ceea6e13 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 5 Jul 2013 14:52:07 +0000 Subject: Use X11/Xlib.h for checking where X11 can be found in stead of X11/XIntrinsic.h. Suggested by Pietro Cerutti. (Backported from tclconfig) --- unix/tcl.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index bac5ebe..cdc5f99 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2386,9 +2386,9 @@ AC_DEFUN([SC_PATH_X], [ not_really_there="" if test "$no_x" = ""; then if test "$x_includes" = ""; then - AC_TRY_CPP([#include ], , not_really_there="yes") + AC_TRY_CPP([#include ], , not_really_there="yes") else - if test ! -r $x_includes/X11/Intrinsic.h; then + if test ! -r $x_includes/X11/Xlib.h; then not_really_there="yes" fi fi @@ -2396,11 +2396,11 @@ AC_DEFUN([SC_PATH_X], [ if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING([for X11 header files]) found_xincludes="no" - AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no") + AC_TRY_CPP([#include ], found_xincludes="yes", found_xincludes="no") if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do - if test -r $i/X11/Intrinsic.h; then + if test -r $i/X11/Xlib.h; then AC_MSG_RESULT([$i]) XINCLUDES=" -I$i" found_xincludes="yes" -- cgit v0.12 From a0e82d9b9595aa285fde27fda9722e8bbab3cd4f Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Sat, 6 Jul 2013 22:22:01 +0000 Subject: http://www.iana.org/time-zones/repository/releases/tzdata2013d.tar.gz --- ChangeLog | 10 ++ library/tzdata/Africa/Casablanca | 4 +- library/tzdata/America/Asuncion | 173 ++++++++++++++++----------------- library/tzdata/Antarctica/Macquarie | 9 +- library/tzdata/Asia/Gaza | 189 ++++++++++++++++++++++++++++++++++-- library/tzdata/Asia/Hebron | 185 +++++++++++++++++++++++++++++++++-- library/tzdata/Asia/Jerusalem | 178 ++++++++++++++++----------------- 7 files changed, 551 insertions(+), 197 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97509e2..71015ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-07-05 Kevin B. Kenny + + * library/tzdata/Africa/Casablanca: + * library/tzdata/America/Asuncion: + * library/tzdata/Antarctica/Macquarie: + * library/tzdata/Asia/Gaza: + * library/tzdata/Asia/Hebron: + * library/tzdata/Asia/Jerusalem: + http://www.iana.org/time-zones/repository/releases/tzdata2013d.tar.gz + 2013-07-03 Jan Nijtmans * unix/tclXtNotify.c: Bug [817249]: bring tclXtNotify.c up to date with diff --git a/library/tzdata/Africa/Casablanca b/library/tzdata/Africa/Casablanca index 74b767a..757007c 100644 --- a/library/tzdata/Africa/Casablanca +++ b/library/tzdata/Africa/Casablanca @@ -34,8 +34,8 @@ set TZData(:Africa/Casablanca) { {1345428000 3600 1 WEST} {1348970400 0 0 WET} {1367114400 3600 1 WEST} - {1373335200 0 0 WET} - {1375927200 3600 1 WEST} + {1373162400 0 0 WET} + {1376100000 3600 1 WEST} {1380420000 0 0 WET} {1398564000 3600 1 WEST} {1404007200 0 0 WET} diff --git a/library/tzdata/America/Asuncion b/library/tzdata/America/Asuncion index d530193..9ea30da 100644 --- a/library/tzdata/America/Asuncion +++ b/library/tzdata/America/Asuncion @@ -83,178 +83,177 @@ set TZData(:America/Asuncion) { {1333854000 -14400 0 PYT} {1349582400 -10800 1 PYST} {1364094000 -14400 0 PYT} - {1365912000 -14400 0 PYT} {1381032000 -10800 1 PYST} - {1397358000 -14400 0 PYT} + {1395543600 -14400 0 PYT} {1412481600 -10800 1 PYST} - {1428807600 -14400 0 PYT} + {1426993200 -14400 0 PYT} {1443931200 -10800 1 PYST} - {1460257200 -14400 0 PYT} + {1459047600 -14400 0 PYT} {1475380800 -10800 1 PYST} - {1491706800 -14400 0 PYT} + {1490497200 -14400 0 PYT} {1506830400 -10800 1 PYST} - {1523156400 -14400 0 PYT} + {1521946800 -14400 0 PYT} {1538884800 -10800 1 PYST} - {1555210800 -14400 0 PYT} + {1553396400 -14400 0 PYT} {1570334400 -10800 1 PYST} - {1586660400 -14400 0 PYT} + {1584846000 -14400 0 PYT} {1601784000 -10800 1 PYST} - {1618110000 -14400 0 PYT} + {1616900400 -14400 0 PYT} {1633233600 -10800 1 PYST} - {1649559600 -14400 0 PYT} + {1648350000 -14400 0 PYT} {1664683200 -10800 1 PYST} - {1681009200 -14400 0 PYT} + {1679799600 -14400 0 PYT} {1696132800 -10800 1 PYST} - {1713063600 -14400 0 PYT} + {1711249200 -14400 0 PYT} {1728187200 -10800 1 PYST} - {1744513200 -14400 0 PYT} + {1742698800 -14400 0 PYT} {1759636800 -10800 1 PYST} - {1775962800 -14400 0 PYT} + {1774148400 -14400 0 PYT} {1791086400 -10800 1 PYST} - {1807412400 -14400 0 PYT} + {1806202800 -14400 0 PYT} {1822536000 -10800 1 PYST} - {1838862000 -14400 0 PYT} + {1837652400 -14400 0 PYT} {1853985600 -10800 1 PYST} - {1870311600 -14400 0 PYT} + {1869102000 -14400 0 PYT} {1886040000 -10800 1 PYST} - {1902366000 -14400 0 PYT} + {1900551600 -14400 0 PYT} {1917489600 -10800 1 PYST} - {1933815600 -14400 0 PYT} + {1932001200 -14400 0 PYT} {1948939200 -10800 1 PYST} - {1965265200 -14400 0 PYT} + {1964055600 -14400 0 PYT} {1980388800 -10800 1 PYST} - {1996714800 -14400 0 PYT} + {1995505200 -14400 0 PYT} {2011838400 -10800 1 PYST} - {2028164400 -14400 0 PYT} + {2026954800 -14400 0 PYT} {2043288000 -10800 1 PYST} - {2059614000 -14400 0 PYT} + {2058404400 -14400 0 PYT} {2075342400 -10800 1 PYST} - {2091668400 -14400 0 PYT} + {2089854000 -14400 0 PYT} {2106792000 -10800 1 PYST} - {2123118000 -14400 0 PYT} + {2121303600 -14400 0 PYT} {2138241600 -10800 1 PYST} - {2154567600 -14400 0 PYT} + {2153358000 -14400 0 PYT} {2169691200 -10800 1 PYST} - {2186017200 -14400 0 PYT} + {2184807600 -14400 0 PYT} {2201140800 -10800 1 PYST} - {2217466800 -14400 0 PYT} + {2216257200 -14400 0 PYT} {2233195200 -10800 1 PYST} - {2249521200 -14400 0 PYT} + {2247706800 -14400 0 PYT} {2264644800 -10800 1 PYST} - {2280970800 -14400 0 PYT} + {2279156400 -14400 0 PYT} {2296094400 -10800 1 PYST} - {2312420400 -14400 0 PYT} + {2310606000 -14400 0 PYT} {2327544000 -10800 1 PYST} - {2343870000 -14400 0 PYT} + {2342660400 -14400 0 PYT} {2358993600 -10800 1 PYST} - {2375319600 -14400 0 PYT} + {2374110000 -14400 0 PYT} {2390443200 -10800 1 PYST} - {2406769200 -14400 0 PYT} + {2405559600 -14400 0 PYT} {2422497600 -10800 1 PYST} - {2438823600 -14400 0 PYT} + {2437009200 -14400 0 PYT} {2453947200 -10800 1 PYST} - {2470273200 -14400 0 PYT} + {2468458800 -14400 0 PYT} {2485396800 -10800 1 PYST} - {2501722800 -14400 0 PYT} + {2500513200 -14400 0 PYT} {2516846400 -10800 1 PYST} - {2533172400 -14400 0 PYT} + {2531962800 -14400 0 PYT} {2548296000 -10800 1 PYST} - {2564622000 -14400 0 PYT} + {2563412400 -14400 0 PYT} {2579745600 -10800 1 PYST} - {2596676400 -14400 0 PYT} + {2594862000 -14400 0 PYT} {2611800000 -10800 1 PYST} - {2628126000 -14400 0 PYT} + {2626311600 -14400 0 PYT} {2643249600 -10800 1 PYST} - {2659575600 -14400 0 PYT} + {2657761200 -14400 0 PYT} {2674699200 -10800 1 PYST} - {2691025200 -14400 0 PYT} + {2689815600 -14400 0 PYT} {2706148800 -10800 1 PYST} - {2722474800 -14400 0 PYT} + {2721265200 -14400 0 PYT} {2737598400 -10800 1 PYST} - {2753924400 -14400 0 PYT} + {2752714800 -14400 0 PYT} {2769652800 -10800 1 PYST} - {2785978800 -14400 0 PYT} + {2784164400 -14400 0 PYT} {2801102400 -10800 1 PYST} - {2817428400 -14400 0 PYT} + {2815614000 -14400 0 PYT} {2832552000 -10800 1 PYST} - {2848878000 -14400 0 PYT} + {2847668400 -14400 0 PYT} {2864001600 -10800 1 PYST} - {2880327600 -14400 0 PYT} + {2879118000 -14400 0 PYT} {2895451200 -10800 1 PYST} - {2911777200 -14400 0 PYT} + {2910567600 -14400 0 PYT} {2926900800 -10800 1 PYST} - {2943226800 -14400 0 PYT} + {2942017200 -14400 0 PYT} {2958955200 -10800 1 PYST} - {2975281200 -14400 0 PYT} + {2973466800 -14400 0 PYT} {2990404800 -10800 1 PYST} - {3006730800 -14400 0 PYT} + {3004916400 -14400 0 PYT} {3021854400 -10800 1 PYST} - {3038180400 -14400 0 PYT} + {3036970800 -14400 0 PYT} {3053304000 -10800 1 PYST} - {3069630000 -14400 0 PYT} + {3068420400 -14400 0 PYT} {3084753600 -10800 1 PYST} - {3101079600 -14400 0 PYT} + {3099870000 -14400 0 PYT} {3116808000 -10800 1 PYST} - {3133134000 -14400 0 PYT} + {3131319600 -14400 0 PYT} {3148257600 -10800 1 PYST} - {3164583600 -14400 0 PYT} + {3162769200 -14400 0 PYT} {3179707200 -10800 1 PYST} - {3196033200 -14400 0 PYT} + {3194218800 -14400 0 PYT} {3211156800 -10800 1 PYST} - {3227482800 -14400 0 PYT} + {3226273200 -14400 0 PYT} {3242606400 -10800 1 PYST} - {3258932400 -14400 0 PYT} + {3257722800 -14400 0 PYT} {3274056000 -10800 1 PYST} - {3290382000 -14400 0 PYT} + {3289172400 -14400 0 PYT} {3306110400 -10800 1 PYST} - {3322436400 -14400 0 PYT} + {3320622000 -14400 0 PYT} {3337560000 -10800 1 PYST} - {3353886000 -14400 0 PYT} + {3352071600 -14400 0 PYT} {3369009600 -10800 1 PYST} - {3385335600 -14400 0 PYT} + {3384126000 -14400 0 PYT} {3400459200 -10800 1 PYST} - {3416785200 -14400 0 PYT} + {3415575600 -14400 0 PYT} {3431908800 -10800 1 PYST} - {3448234800 -14400 0 PYT} + {3447025200 -14400 0 PYT} {3463358400 -10800 1 PYST} - {3480289200 -14400 0 PYT} + {3478474800 -14400 0 PYT} {3495412800 -10800 1 PYST} - {3511738800 -14400 0 PYT} + {3509924400 -14400 0 PYT} {3526862400 -10800 1 PYST} - {3543188400 -14400 0 PYT} + {3541374000 -14400 0 PYT} {3558312000 -10800 1 PYST} - {3574638000 -14400 0 PYT} + {3573428400 -14400 0 PYT} {3589761600 -10800 1 PYST} - {3606087600 -14400 0 PYT} + {3604878000 -14400 0 PYT} {3621211200 -10800 1 PYST} - {3637537200 -14400 0 PYT} + {3636327600 -14400 0 PYT} {3653265600 -10800 1 PYST} - {3669591600 -14400 0 PYT} + {3667777200 -14400 0 PYT} {3684715200 -10800 1 PYST} - {3701041200 -14400 0 PYT} + {3699226800 -14400 0 PYT} {3716164800 -10800 1 PYST} - {3732490800 -14400 0 PYT} + {3731281200 -14400 0 PYT} {3747614400 -10800 1 PYST} - {3763940400 -14400 0 PYT} + {3762730800 -14400 0 PYT} {3779064000 -10800 1 PYST} - {3795390000 -14400 0 PYT} + {3794180400 -14400 0 PYT} {3810513600 -10800 1 PYST} - {3826839600 -14400 0 PYT} + {3825630000 -14400 0 PYT} {3842568000 -10800 1 PYST} - {3858894000 -14400 0 PYT} + {3857079600 -14400 0 PYT} {3874017600 -10800 1 PYST} - {3890343600 -14400 0 PYT} + {3888529200 -14400 0 PYT} {3905467200 -10800 1 PYST} - {3921793200 -14400 0 PYT} + {3920583600 -14400 0 PYT} {3936916800 -10800 1 PYST} - {3953242800 -14400 0 PYT} + {3952033200 -14400 0 PYT} {3968366400 -10800 1 PYST} - {3984692400 -14400 0 PYT} + {3983482800 -14400 0 PYT} {4000420800 -10800 1 PYST} - {4016746800 -14400 0 PYT} + {4014932400 -14400 0 PYT} {4031870400 -10800 1 PYST} - {4048196400 -14400 0 PYT} + {4046382000 -14400 0 PYT} {4063320000 -10800 1 PYST} - {4079646000 -14400 0 PYT} + {4077831600 -14400 0 PYT} {4094769600 -10800 1 PYST} } diff --git a/library/tzdata/Antarctica/Macquarie b/library/tzdata/Antarctica/Macquarie index 9877ee8..bd5cf8a 100644 --- a/library/tzdata/Antarctica/Macquarie +++ b/library/tzdata/Antarctica/Macquarie @@ -2,16 +2,11 @@ set TZData(:Antarctica/Macquarie) { {-9223372036854775808 0 0 zzz} - {-1861920000 36000 0 EST} + {-2214259200 36000 0 EST} {-1680508800 39600 1 EST} {-1669892400 39600 0 EST} {-1665392400 36000 0 EST} - {-883641600 39600 1 EST} - {-876128400 36000 0 EST} - {-860400000 39600 1 EST} - {-844678800 36000 0 EST} - {-828345600 39600 1 EST} - {-813229200 36000 0 EST} + {-1601719200 0 0 zzz} {-94730400 36000 0 EST} {-71136000 39600 1 EST} {-55411200 36000 0 EST} diff --git a/library/tzdata/Asia/Gaza b/library/tzdata/Asia/Gaza index 43e1847..a0636e2 100644 --- a/library/tzdata/Asia/Gaza +++ b/library/tzdata/Asia/Gaza @@ -88,14 +88,191 @@ set TZData(:Asia/Gaza) { {1158872400 7200 0 EET} {1175378400 10800 1 EEST} {1189638000 7200 0 EET} - {1207000800 10800 1 EEST} - {1219957200 7200 0 EET} + {1206655200 10800 1 EEST} + {1219960800 7200 0 EET} + {1220220000 7200 0 EET} {1238104800 10800 1 EEST} - {1252018800 7200 0 EET} - {1269640860 10800 1 EEST} + {1252015200 7200 0 EET} + {1262296800 7200 0 EET} + {1269640860 10800 0 EEST} {1281474000 7200 0 EET} - {1301738460 10800 1 EEST} - {1312146000 7200 0 EET} + {1301608860 10800 1 EEST} + {1312149600 7200 0 EET} + {1325368800 7200 0 EET} {1333058400 10800 1 EEST} {1348178400 7200 0 EET} + {1364508000 10800 1 EEST} + {1380232800 7200 0 EET} + {1395957600 10800 1 EEST} + {1411682400 7200 0 EET} + {1427407200 10800 1 EEST} + {1443132000 7200 0 EET} + {1459461600 10800 1 EEST} + {1474581600 7200 0 EET} + {1490911200 10800 1 EEST} + {1506031200 7200 0 EET} + {1522360800 10800 1 EEST} + {1537480800 7200 0 EET} + {1553810400 10800 1 EEST} + {1569535200 7200 0 EET} + {1585260000 10800 1 EEST} + {1600984800 7200 0 EET} + {1616709600 10800 1 EEST} + {1632434400 7200 0 EET} + {1648764000 10800 1 EEST} + {1663884000 7200 0 EET} + {1680213600 10800 1 EEST} + {1695333600 7200 0 EET} + {1711663200 10800 1 EEST} + {1727388000 7200 0 EET} + {1743112800 10800 1 EEST} + {1758837600 7200 0 EET} + {1774562400 10800 1 EEST} + {1790287200 7200 0 EET} + {1806012000 10800 1 EEST} + {1821736800 7200 0 EET} + {1838066400 10800 1 EEST} + {1853186400 7200 0 EET} + {1869516000 10800 1 EEST} + {1884636000 7200 0 EET} + {1900965600 10800 1 EEST} + {1916690400 7200 0 EET} + {1932415200 10800 1 EEST} + {1948140000 7200 0 EET} + {1963864800 10800 1 EEST} + {1979589600 7200 0 EET} + {1995919200 10800 1 EEST} + {2011039200 7200 0 EET} + {2027368800 10800 1 EEST} + {2042488800 7200 0 EET} + {2058818400 10800 1 EEST} + {2073938400 7200 0 EET} + {2090268000 10800 1 EEST} + {2105992800 7200 0 EET} + {2121717600 10800 1 EEST} + {2137442400 7200 0 EET} + {2153167200 10800 1 EEST} + {2168892000 7200 0 EET} + {2185221600 10800 1 EEST} + {2200341600 7200 0 EET} + {2216671200 10800 1 EEST} + {2231791200 7200 0 EET} + {2248120800 10800 1 EEST} + {2263845600 7200 0 EET} + {2279570400 10800 1 EEST} + {2295295200 7200 0 EET} + {2311020000 10800 1 EEST} + {2326744800 7200 0 EET} + {2343074400 10800 1 EEST} + {2358194400 7200 0 EET} + {2374524000 10800 1 EEST} + {2389644000 7200 0 EET} + {2405973600 10800 1 EEST} + {2421093600 7200 0 EET} + {2437423200 10800 1 EEST} + {2453148000 7200 0 EET} + {2468872800 10800 1 EEST} + {2484597600 7200 0 EET} + {2500322400 10800 1 EEST} + {2516047200 7200 0 EET} + {2532376800 10800 1 EEST} + {2547496800 7200 0 EET} + {2563826400 10800 1 EEST} + {2578946400 7200 0 EET} + {2595276000 10800 1 EEST} + {2611000800 7200 0 EET} + {2626725600 10800 1 EEST} + {2642450400 7200 0 EET} + {2658175200 10800 1 EEST} + {2673900000 7200 0 EET} + {2689624800 10800 1 EEST} + {2705349600 7200 0 EET} + {2721679200 10800 1 EEST} + {2736799200 7200 0 EET} + {2753128800 10800 1 EEST} + {2768248800 7200 0 EET} + {2784578400 10800 1 EEST} + {2800303200 7200 0 EET} + {2816028000 10800 1 EEST} + {2831752800 7200 0 EET} + {2847477600 10800 1 EEST} + {2863202400 7200 0 EET} + {2879532000 10800 1 EEST} + {2894652000 7200 0 EET} + {2910981600 10800 1 EEST} + {2926101600 7200 0 EET} + {2942431200 10800 1 EEST} + {2957551200 7200 0 EET} + {2973880800 10800 1 EEST} + {2989605600 7200 0 EET} + {3005330400 10800 1 EEST} + {3021055200 7200 0 EET} + {3036780000 10800 1 EEST} + {3052504800 7200 0 EET} + {3068834400 10800 1 EEST} + {3083954400 7200 0 EET} + {3100284000 10800 1 EEST} + {3115404000 7200 0 EET} + {3131733600 10800 1 EEST} + {3147458400 7200 0 EET} + {3163183200 10800 1 EEST} + {3178908000 7200 0 EET} + {3194632800 10800 1 EEST} + {3210357600 7200 0 EET} + {3226687200 10800 1 EEST} + {3241807200 7200 0 EET} + {3258136800 10800 1 EEST} + {3273256800 7200 0 EET} + {3289586400 10800 1 EEST} + {3304706400 7200 0 EET} + {3321036000 10800 1 EEST} + {3336760800 7200 0 EET} + {3352485600 10800 1 EEST} + {3368210400 7200 0 EET} + {3383935200 10800 1 EEST} + {3399660000 7200 0 EET} + {3415989600 10800 1 EEST} + {3431109600 7200 0 EET} + {3447439200 10800 1 EEST} + {3462559200 7200 0 EET} + {3478888800 10800 1 EEST} + {3494613600 7200 0 EET} + {3510338400 10800 1 EEST} + {3526063200 7200 0 EET} + {3541788000 10800 1 EEST} + {3557512800 7200 0 EET} + {3573237600 10800 1 EEST} + {3588962400 7200 0 EET} + {3605292000 10800 1 EEST} + {3620412000 7200 0 EET} + {3636741600 10800 1 EEST} + {3651861600 7200 0 EET} + {3668191200 10800 1 EEST} + {3683916000 7200 0 EET} + {3699640800 10800 1 EEST} + {3715365600 7200 0 EET} + {3731090400 10800 1 EEST} + {3746815200 7200 0 EET} + {3763144800 10800 1 EEST} + {3778264800 7200 0 EET} + {3794594400 10800 1 EEST} + {3809714400 7200 0 EET} + {3826044000 10800 1 EEST} + {3841164000 7200 0 EET} + {3857493600 10800 1 EEST} + {3873218400 7200 0 EET} + {3888943200 10800 1 EEST} + {3904668000 7200 0 EET} + {3920392800 10800 1 EEST} + {3936117600 7200 0 EET} + {3952447200 10800 1 EEST} + {3967567200 7200 0 EET} + {3983896800 10800 1 EEST} + {3999016800 7200 0 EET} + {4015346400 10800 1 EEST} + {4031071200 7200 0 EET} + {4046796000 10800 1 EEST} + {4062520800 7200 0 EET} + {4078245600 10800 1 EEST} + {4093970400 7200 0 EET} } diff --git a/library/tzdata/Asia/Hebron b/library/tzdata/Asia/Hebron index 98bb353..a8a9019 100644 --- a/library/tzdata/Asia/Hebron +++ b/library/tzdata/Asia/Hebron @@ -88,17 +88,190 @@ set TZData(:Asia/Hebron) { {1158872400 7200 0 EET} {1175378400 10800 1 EEST} {1189638000 7200 0 EET} - {1207000800 10800 1 EEST} - {1217541600 10800 1 EEST} + {1206655200 10800 1 EEST} {1220216400 7200 0 EET} {1238104800 10800 1 EEST} - {1252018800 7200 0 EET} - {1269640860 10800 1 EEST} + {1252015200 7200 0 EET} + {1269554400 10800 1 EEST} {1281474000 7200 0 EET} - {1301652060 10800 1 EEST} + {1301608860 10800 1 EEST} {1312146000 7200 0 EET} {1314655200 10800 1 EEST} - {1317340800 7200 0 EET} + {1317330000 7200 0 EET} {1333058400 10800 1 EEST} {1348178400 7200 0 EET} + {1364508000 10800 1 EEST} + {1380232800 7200 0 EET} + {1395957600 10800 1 EEST} + {1411682400 7200 0 EET} + {1427407200 10800 1 EEST} + {1443132000 7200 0 EET} + {1459461600 10800 1 EEST} + {1474581600 7200 0 EET} + {1490911200 10800 1 EEST} + {1506031200 7200 0 EET} + {1522360800 10800 1 EEST} + {1537480800 7200 0 EET} + {1553810400 10800 1 EEST} + {1569535200 7200 0 EET} + {1585260000 10800 1 EEST} + {1600984800 7200 0 EET} + {1616709600 10800 1 EEST} + {1632434400 7200 0 EET} + {1648764000 10800 1 EEST} + {1663884000 7200 0 EET} + {1680213600 10800 1 EEST} + {1695333600 7200 0 EET} + {1711663200 10800 1 EEST} + {1727388000 7200 0 EET} + {1743112800 10800 1 EEST} + {1758837600 7200 0 EET} + {1774562400 10800 1 EEST} + {1790287200 7200 0 EET} + {1806012000 10800 1 EEST} + {1821736800 7200 0 EET} + {1838066400 10800 1 EEST} + {1853186400 7200 0 EET} + {1869516000 10800 1 EEST} + {1884636000 7200 0 EET} + {1900965600 10800 1 EEST} + {1916690400 7200 0 EET} + {1932415200 10800 1 EEST} + {1948140000 7200 0 EET} + {1963864800 10800 1 EEST} + {1979589600 7200 0 EET} + {1995919200 10800 1 EEST} + {2011039200 7200 0 EET} + {2027368800 10800 1 EEST} + {2042488800 7200 0 EET} + {2058818400 10800 1 EEST} + {2073938400 7200 0 EET} + {2090268000 10800 1 EEST} + {2105992800 7200 0 EET} + {2121717600 10800 1 EEST} + {2137442400 7200 0 EET} + {2153167200 10800 1 EEST} + {2168892000 7200 0 EET} + {2185221600 10800 1 EEST} + {2200341600 7200 0 EET} + {2216671200 10800 1 EEST} + {2231791200 7200 0 EET} + {2248120800 10800 1 EEST} + {2263845600 7200 0 EET} + {2279570400 10800 1 EEST} + {2295295200 7200 0 EET} + {2311020000 10800 1 EEST} + {2326744800 7200 0 EET} + {2343074400 10800 1 EEST} + {2358194400 7200 0 EET} + {2374524000 10800 1 EEST} + {2389644000 7200 0 EET} + {2405973600 10800 1 EEST} + {2421093600 7200 0 EET} + {2437423200 10800 1 EEST} + {2453148000 7200 0 EET} + {2468872800 10800 1 EEST} + {2484597600 7200 0 EET} + {2500322400 10800 1 EEST} + {2516047200 7200 0 EET} + {2532376800 10800 1 EEST} + {2547496800 7200 0 EET} + {2563826400 10800 1 EEST} + {2578946400 7200 0 EET} + {2595276000 10800 1 EEST} + {2611000800 7200 0 EET} + {2626725600 10800 1 EEST} + {2642450400 7200 0 EET} + {2658175200 10800 1 EEST} + {2673900000 7200 0 EET} + {2689624800 10800 1 EEST} + {2705349600 7200 0 EET} + {2721679200 10800 1 EEST} + {2736799200 7200 0 EET} + {2753128800 10800 1 EEST} + {2768248800 7200 0 EET} + {2784578400 10800 1 EEST} + {2800303200 7200 0 EET} + {2816028000 10800 1 EEST} + {2831752800 7200 0 EET} + {2847477600 10800 1 EEST} + {2863202400 7200 0 EET} + {2879532000 10800 1 EEST} + {2894652000 7200 0 EET} + {2910981600 10800 1 EEST} + {2926101600 7200 0 EET} + {2942431200 10800 1 EEST} + {2957551200 7200 0 EET} + {2973880800 10800 1 EEST} + {2989605600 7200 0 EET} + {3005330400 10800 1 EEST} + {3021055200 7200 0 EET} + {3036780000 10800 1 EEST} + {3052504800 7200 0 EET} + {3068834400 10800 1 EEST} + {3083954400 7200 0 EET} + {3100284000 10800 1 EEST} + {3115404000 7200 0 EET} + {3131733600 10800 1 EEST} + {3147458400 7200 0 EET} + {3163183200 10800 1 EEST} + {3178908000 7200 0 EET} + {3194632800 10800 1 EEST} + {3210357600 7200 0 EET} + {3226687200 10800 1 EEST} + {3241807200 7200 0 EET} + {3258136800 10800 1 EEST} + {3273256800 7200 0 EET} + {3289586400 10800 1 EEST} + {3304706400 7200 0 EET} + {3321036000 10800 1 EEST} + {3336760800 7200 0 EET} + {3352485600 10800 1 EEST} + {3368210400 7200 0 EET} + {3383935200 10800 1 EEST} + {3399660000 7200 0 EET} + {3415989600 10800 1 EEST} + {3431109600 7200 0 EET} + {3447439200 10800 1 EEST} + {3462559200 7200 0 EET} + {3478888800 10800 1 EEST} + {3494613600 7200 0 EET} + {3510338400 10800 1 EEST} + {3526063200 7200 0 EET} + {3541788000 10800 1 EEST} + {3557512800 7200 0 EET} + {3573237600 10800 1 EEST} + {3588962400 7200 0 EET} + {3605292000 10800 1 EEST} + {3620412000 7200 0 EET} + {3636741600 10800 1 EEST} + {3651861600 7200 0 EET} + {3668191200 10800 1 EEST} + {3683916000 7200 0 EET} + {3699640800 10800 1 EEST} + {3715365600 7200 0 EET} + {3731090400 10800 1 EEST} + {3746815200 7200 0 EET} + {3763144800 10800 1 EEST} + {3778264800 7200 0 EET} + {3794594400 10800 1 EEST} + {3809714400 7200 0 EET} + {3826044000 10800 1 EEST} + {3841164000 7200 0 EET} + {3857493600 10800 1 EEST} + {3873218400 7200 0 EET} + {3888943200 10800 1 EEST} + {3904668000 7200 0 EET} + {3920392800 10800 1 EEST} + {3936117600 7200 0 EET} + {3952447200 10800 1 EEST} + {3967567200 7200 0 EET} + {3983896800 10800 1 EEST} + {3999016800 7200 0 EET} + {4015346400 10800 1 EEST} + {4031071200 7200 0 EET} + {4046796000 10800 1 EEST} + {4062520800 7200 0 EET} + {4078245600 10800 1 EEST} + {4093970400 7200 0 EET} } diff --git a/library/tzdata/Asia/Jerusalem b/library/tzdata/Asia/Jerusalem index 613eadd..7662680 100644 --- a/library/tzdata/Asia/Jerusalem +++ b/library/tzdata/Asia/Jerusalem @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Jerusalem) { - {-9223372036854775808 8456 0 LMT} - {-2840149256 8440 0 JMT} + {-9223372036854775808 8454 0 LMT} + {-2840149254 8440 0 JMT} {-1641003640 7200 0 IST} {-933645600 10800 1 IDT} {-857358000 7200 0 IST} @@ -96,177 +96,177 @@ set TZData(:Asia/Jerusalem) { {1333065600 10800 1 IDT} {1348354800 7200 0 IST} {1364515200 10800 1 IDT} - {1381014000 7200 0 IST} + {1382828400 7200 0 IST} {1395964800 10800 1 IDT} - {1412463600 7200 0 IST} + {1414278000 7200 0 IST} {1427414400 10800 1 IDT} - {1443913200 7200 0 IST} + {1445727600 7200 0 IST} {1458864000 10800 1 IDT} - {1475362800 7200 0 IST} + {1477782000 7200 0 IST} {1490313600 10800 1 IDT} - {1507417200 7200 0 IST} + {1509231600 7200 0 IST} {1521763200 10800 1 IDT} - {1538866800 7200 0 IST} + {1540681200 7200 0 IST} {1553817600 10800 1 IDT} - {1570316400 7200 0 IST} + {1572130800 7200 0 IST} {1585267200 10800 1 IDT} - {1601766000 7200 0 IST} + {1603580400 7200 0 IST} {1616716800 10800 1 IDT} - {1633215600 7200 0 IST} + {1635634800 7200 0 IST} {1648166400 10800 1 IDT} - {1664665200 7200 0 IST} + {1667084400 7200 0 IST} {1679616000 10800 1 IDT} - {1696719600 7200 0 IST} + {1698534000 7200 0 IST} {1711670400 10800 1 IDT} - {1728169200 7200 0 IST} + {1729983600 7200 0 IST} {1743120000 10800 1 IDT} - {1759618800 7200 0 IST} + {1761433200 7200 0 IST} {1774569600 10800 1 IDT} - {1791068400 7200 0 IST} + {1792882800 7200 0 IST} {1806019200 10800 1 IDT} - {1822604400 7200 0 IST} + {1824937200 7200 0 IST} {1837468800 10800 1 IDT} - {1854572400 7200 0 IST} + {1856386800 7200 0 IST} {1868918400 10800 1 IDT} - {1886022000 7200 0 IST} + {1887836400 7200 0 IST} {1900972800 10800 1 IDT} - {1917471600 7200 0 IST} + {1919286000 7200 0 IST} {1932422400 10800 1 IDT} - {1948921200 7200 0 IST} + {1950735600 7200 0 IST} {1963872000 10800 1 IDT} - {1980370800 7200 0 IST} + {1982790000 7200 0 IST} {1995321600 10800 1 IDT} - {2011820400 7200 0 IST} + {2014239600 7200 0 IST} {2026771200 10800 1 IDT} - {2043874800 7200 0 IST} + {2045689200 7200 0 IST} {2058220800 10800 1 IDT} - {2075324400 7200 0 IST} + {2077138800 7200 0 IST} {2090275200 10800 1 IDT} - {2106774000 7200 0 IST} + {2108588400 7200 0 IST} {2121724800 10800 1 IDT} - {2138223600 7200 0 IST} + {2140038000 7200 0 IST} {2153174400 10800 1 IDT} - {2169673200 7200 0 IST} + {2172092400 7200 0 IST} {2184624000 10800 1 IDT} - {2201122800 7200 0 IST} + {2203542000 7200 0 IST} {2216073600 10800 1 IDT} - {2233177200 7200 0 IST} + {2234991600 7200 0 IST} {2248128000 10800 1 IDT} - {2264626800 7200 0 IST} + {2266441200 7200 0 IST} {2279577600 10800 1 IDT} - {2296076400 7200 0 IST} + {2297890800 7200 0 IST} {2311027200 10800 1 IDT} - {2327526000 7200 0 IST} + {2329340400 7200 0 IST} {2342476800 10800 1 IDT} - {2358975600 7200 0 IST} + {2361394800 7200 0 IST} {2373926400 10800 1 IDT} - {2391030000 7200 0 IST} + {2392844400 7200 0 IST} {2405376000 10800 1 IDT} - {2422479600 7200 0 IST} + {2424294000 7200 0 IST} {2437430400 10800 1 IDT} - {2453929200 7200 0 IST} + {2455743600 7200 0 IST} {2468880000 10800 1 IDT} - {2485378800 7200 0 IST} + {2487193200 7200 0 IST} {2500329600 10800 1 IDT} - {2516828400 7200 0 IST} + {2519247600 7200 0 IST} {2531779200 10800 1 IDT} - {2548278000 7200 0 IST} + {2550697200 7200 0 IST} {2563228800 10800 1 IDT} - {2580332400 7200 0 IST} + {2582146800 7200 0 IST} {2595283200 10800 1 IDT} - {2611782000 7200 0 IST} + {2613596400 7200 0 IST} {2626732800 10800 1 IDT} - {2643231600 7200 0 IST} + {2645046000 7200 0 IST} {2658182400 10800 1 IDT} - {2674681200 7200 0 IST} + {2676495600 7200 0 IST} {2689632000 10800 1 IDT} - {2706130800 7200 0 IST} + {2708550000 7200 0 IST} {2721081600 10800 1 IDT} - {2738185200 7200 0 IST} + {2739999600 7200 0 IST} {2752531200 10800 1 IDT} - {2769634800 7200 0 IST} + {2771449200 7200 0 IST} {2784585600 10800 1 IDT} - {2801084400 7200 0 IST} + {2802898800 7200 0 IST} {2816035200 10800 1 IDT} - {2832534000 7200 0 IST} + {2834348400 7200 0 IST} {2847484800 10800 1 IDT} - {2863983600 7200 0 IST} + {2866402800 7200 0 IST} {2878934400 10800 1 IDT} - {2895433200 7200 0 IST} + {2897852400 7200 0 IST} {2910384000 10800 1 IDT} - {2927487600 7200 0 IST} + {2929302000 7200 0 IST} {2941833600 10800 1 IDT} - {2958937200 7200 0 IST} + {2960751600 7200 0 IST} {2973888000 10800 1 IDT} - {2990386800 7200 0 IST} + {2992201200 7200 0 IST} {3005337600 10800 1 IDT} - {3021836400 7200 0 IST} + {3023650800 7200 0 IST} {3036787200 10800 1 IDT} - {3053286000 7200 0 IST} + {3055705200 7200 0 IST} {3068236800 10800 1 IDT} - {3084735600 7200 0 IST} + {3087154800 7200 0 IST} {3099686400 10800 1 IDT} - {3116790000 7200 0 IST} + {3118604400 7200 0 IST} {3131740800 10800 1 IDT} - {3148239600 7200 0 IST} + {3150054000 7200 0 IST} {3163190400 10800 1 IDT} - {3179689200 7200 0 IST} + {3181503600 7200 0 IST} {3194640000 10800 1 IDT} - {3211138800 7200 0 IST} + {3212953200 7200 0 IST} {3226089600 10800 1 IDT} - {3242588400 7200 0 IST} + {3245007600 7200 0 IST} {3257539200 10800 1 IDT} - {3274642800 7200 0 IST} + {3276457200 7200 0 IST} {3288988800 10800 1 IDT} - {3306092400 7200 0 IST} + {3307906800 7200 0 IST} {3321043200 10800 1 IDT} - {3337542000 7200 0 IST} + {3339356400 7200 0 IST} {3352492800 10800 1 IDT} - {3368991600 7200 0 IST} + {3370806000 7200 0 IST} {3383942400 10800 1 IDT} - {3400441200 7200 0 IST} + {3402860400 7200 0 IST} {3415392000 10800 1 IDT} - {3431890800 7200 0 IST} + {3434310000 7200 0 IST} {3446841600 10800 1 IDT} - {3463945200 7200 0 IST} + {3465759600 7200 0 IST} {3478896000 10800 1 IDT} - {3495394800 7200 0 IST} + {3497209200 7200 0 IST} {3510345600 10800 1 IDT} - {3526844400 7200 0 IST} + {3528658800 7200 0 IST} {3541795200 10800 1 IDT} - {3558294000 7200 0 IST} + {3560108400 7200 0 IST} {3573244800 10800 1 IDT} - {3589743600 7200 0 IST} + {3592162800 7200 0 IST} {3604694400 10800 1 IDT} - {3621798000 7200 0 IST} + {3623612400 7200 0 IST} {3636144000 10800 1 IDT} - {3653247600 7200 0 IST} + {3655062000 7200 0 IST} {3668198400 10800 1 IDT} - {3684697200 7200 0 IST} + {3686511600 7200 0 IST} {3699648000 10800 1 IDT} - {3716146800 7200 0 IST} + {3717961200 7200 0 IST} {3731097600 10800 1 IDT} - {3747596400 7200 0 IST} + {3750015600 7200 0 IST} {3762547200 10800 1 IDT} - {3779046000 7200 0 IST} + {3781465200 7200 0 IST} {3793996800 10800 1 IDT} - {3811100400 7200 0 IST} + {3812914800 7200 0 IST} {3825446400 10800 1 IDT} - {3842550000 7200 0 IST} + {3844364400 7200 0 IST} {3857500800 10800 1 IDT} - {3873999600 7200 0 IST} + {3875814000 7200 0 IST} {3888950400 10800 1 IDT} - {3905449200 7200 0 IST} + {3907263600 7200 0 IST} {3920400000 10800 1 IDT} - {3936898800 7200 0 IST} + {3939318000 7200 0 IST} {3951849600 10800 1 IDT} - {3968348400 7200 0 IST} + {3970767600 7200 0 IST} {3983299200 10800 1 IDT} - {4000402800 7200 0 IST} + {4002217200 7200 0 IST} {4015353600 10800 1 IDT} - {4031852400 7200 0 IST} + {4033666800 7200 0 IST} {4046803200 10800 1 IDT} - {4063302000 7200 0 IST} + {4065116400 7200 0 IST} {4078252800 10800 1 IDT} - {4094751600 7200 0 IST} + {4096566000 7200 0 IST} } -- cgit v0.12 From e7f11f7a27708f18bf22dd756d62b5365591b4ce Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Sat, 6 Jul 2013 22:24:52 +0000 Subject: http://www.iana.org/time-zones/repository/releases/tzdata2013d.tar.gz --- ChangeLog | 10 ++ library/tzdata/Africa/Casablanca | 4 +- library/tzdata/America/Asuncion | 173 ++++++++++++++++----------------- library/tzdata/Antarctica/Macquarie | 9 +- library/tzdata/Asia/Gaza | 189 ++++++++++++++++++++++++++++++++++-- library/tzdata/Asia/Hebron | 185 +++++++++++++++++++++++++++++++++-- library/tzdata/Asia/Jerusalem | 178 ++++++++++++++++----------------- 7 files changed, 551 insertions(+), 197 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2da02a7..d7ada95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-07-05 Kevin B. Kenny + + * library/tzdata/Africa/Casablanca: + * library/tzdata/America/Asuncion: + * library/tzdata/Antarctica/Macquarie: + * library/tzdata/Asia/Gaza: + * library/tzdata/Asia/Hebron: + * library/tzdata/Asia/Jerusalem: + http://www.iana.org/time-zones/repository/releases/tzdata2013d.tar.gz + 2013-07-03 Jan Nijtmans * unix/tclXtNotify.c: Bug [817249]: bring tclXtNotify.c up to date with diff --git a/library/tzdata/Africa/Casablanca b/library/tzdata/Africa/Casablanca index 74b767a..757007c 100644 --- a/library/tzdata/Africa/Casablanca +++ b/library/tzdata/Africa/Casablanca @@ -34,8 +34,8 @@ set TZData(:Africa/Casablanca) { {1345428000 3600 1 WEST} {1348970400 0 0 WET} {1367114400 3600 1 WEST} - {1373335200 0 0 WET} - {1375927200 3600 1 WEST} + {1373162400 0 0 WET} + {1376100000 3600 1 WEST} {1380420000 0 0 WET} {1398564000 3600 1 WEST} {1404007200 0 0 WET} diff --git a/library/tzdata/America/Asuncion b/library/tzdata/America/Asuncion index d530193..9ea30da 100644 --- a/library/tzdata/America/Asuncion +++ b/library/tzdata/America/Asuncion @@ -83,178 +83,177 @@ set TZData(:America/Asuncion) { {1333854000 -14400 0 PYT} {1349582400 -10800 1 PYST} {1364094000 -14400 0 PYT} - {1365912000 -14400 0 PYT} {1381032000 -10800 1 PYST} - {1397358000 -14400 0 PYT} + {1395543600 -14400 0 PYT} {1412481600 -10800 1 PYST} - {1428807600 -14400 0 PYT} + {1426993200 -14400 0 PYT} {1443931200 -10800 1 PYST} - {1460257200 -14400 0 PYT} + {1459047600 -14400 0 PYT} {1475380800 -10800 1 PYST} - {1491706800 -14400 0 PYT} + {1490497200 -14400 0 PYT} {1506830400 -10800 1 PYST} - {1523156400 -14400 0 PYT} + {1521946800 -14400 0 PYT} {1538884800 -10800 1 PYST} - {1555210800 -14400 0 PYT} + {1553396400 -14400 0 PYT} {1570334400 -10800 1 PYST} - {1586660400 -14400 0 PYT} + {1584846000 -14400 0 PYT} {1601784000 -10800 1 PYST} - {1618110000 -14400 0 PYT} + {1616900400 -14400 0 PYT} {1633233600 -10800 1 PYST} - {1649559600 -14400 0 PYT} + {1648350000 -14400 0 PYT} {1664683200 -10800 1 PYST} - {1681009200 -14400 0 PYT} + {1679799600 -14400 0 PYT} {1696132800 -10800 1 PYST} - {1713063600 -14400 0 PYT} + {1711249200 -14400 0 PYT} {1728187200 -10800 1 PYST} - {1744513200 -14400 0 PYT} + {1742698800 -14400 0 PYT} {1759636800 -10800 1 PYST} - {1775962800 -14400 0 PYT} + {1774148400 -14400 0 PYT} {1791086400 -10800 1 PYST} - {1807412400 -14400 0 PYT} + {1806202800 -14400 0 PYT} {1822536000 -10800 1 PYST} - {1838862000 -14400 0 PYT} + {1837652400 -14400 0 PYT} {1853985600 -10800 1 PYST} - {1870311600 -14400 0 PYT} + {1869102000 -14400 0 PYT} {1886040000 -10800 1 PYST} - {1902366000 -14400 0 PYT} + {1900551600 -14400 0 PYT} {1917489600 -10800 1 PYST} - {1933815600 -14400 0 PYT} + {1932001200 -14400 0 PYT} {1948939200 -10800 1 PYST} - {1965265200 -14400 0 PYT} + {1964055600 -14400 0 PYT} {1980388800 -10800 1 PYST} - {1996714800 -14400 0 PYT} + {1995505200 -14400 0 PYT} {2011838400 -10800 1 PYST} - {2028164400 -14400 0 PYT} + {2026954800 -14400 0 PYT} {2043288000 -10800 1 PYST} - {2059614000 -14400 0 PYT} + {2058404400 -14400 0 PYT} {2075342400 -10800 1 PYST} - {2091668400 -14400 0 PYT} + {2089854000 -14400 0 PYT} {2106792000 -10800 1 PYST} - {2123118000 -14400 0 PYT} + {2121303600 -14400 0 PYT} {2138241600 -10800 1 PYST} - {2154567600 -14400 0 PYT} + {2153358000 -14400 0 PYT} {2169691200 -10800 1 PYST} - {2186017200 -14400 0 PYT} + {2184807600 -14400 0 PYT} {2201140800 -10800 1 PYST} - {2217466800 -14400 0 PYT} + {2216257200 -14400 0 PYT} {2233195200 -10800 1 PYST} - {2249521200 -14400 0 PYT} + {2247706800 -14400 0 PYT} {2264644800 -10800 1 PYST} - {2280970800 -14400 0 PYT} + {2279156400 -14400 0 PYT} {2296094400 -10800 1 PYST} - {2312420400 -14400 0 PYT} + {2310606000 -14400 0 PYT} {2327544000 -10800 1 PYST} - {2343870000 -14400 0 PYT} + {2342660400 -14400 0 PYT} {2358993600 -10800 1 PYST} - {2375319600 -14400 0 PYT} + {2374110000 -14400 0 PYT} {2390443200 -10800 1 PYST} - {2406769200 -14400 0 PYT} + {2405559600 -14400 0 PYT} {2422497600 -10800 1 PYST} - {2438823600 -14400 0 PYT} + {2437009200 -14400 0 PYT} {2453947200 -10800 1 PYST} - {2470273200 -14400 0 PYT} + {2468458800 -14400 0 PYT} {2485396800 -10800 1 PYST} - {2501722800 -14400 0 PYT} + {2500513200 -14400 0 PYT} {2516846400 -10800 1 PYST} - {2533172400 -14400 0 PYT} + {2531962800 -14400 0 PYT} {2548296000 -10800 1 PYST} - {2564622000 -14400 0 PYT} + {2563412400 -14400 0 PYT} {2579745600 -10800 1 PYST} - {2596676400 -14400 0 PYT} + {2594862000 -14400 0 PYT} {2611800000 -10800 1 PYST} - {2628126000 -14400 0 PYT} + {2626311600 -14400 0 PYT} {2643249600 -10800 1 PYST} - {2659575600 -14400 0 PYT} + {2657761200 -14400 0 PYT} {2674699200 -10800 1 PYST} - {2691025200 -14400 0 PYT} + {2689815600 -14400 0 PYT} {2706148800 -10800 1 PYST} - {2722474800 -14400 0 PYT} + {2721265200 -14400 0 PYT} {2737598400 -10800 1 PYST} - {2753924400 -14400 0 PYT} + {2752714800 -14400 0 PYT} {2769652800 -10800 1 PYST} - {2785978800 -14400 0 PYT} + {2784164400 -14400 0 PYT} {2801102400 -10800 1 PYST} - {2817428400 -14400 0 PYT} + {2815614000 -14400 0 PYT} {2832552000 -10800 1 PYST} - {2848878000 -14400 0 PYT} + {2847668400 -14400 0 PYT} {2864001600 -10800 1 PYST} - {2880327600 -14400 0 PYT} + {2879118000 -14400 0 PYT} {2895451200 -10800 1 PYST} - {2911777200 -14400 0 PYT} + {2910567600 -14400 0 PYT} {2926900800 -10800 1 PYST} - {2943226800 -14400 0 PYT} + {2942017200 -14400 0 PYT} {2958955200 -10800 1 PYST} - {2975281200 -14400 0 PYT} + {2973466800 -14400 0 PYT} {2990404800 -10800 1 PYST} - {3006730800 -14400 0 PYT} + {3004916400 -14400 0 PYT} {3021854400 -10800 1 PYST} - {3038180400 -14400 0 PYT} + {3036970800 -14400 0 PYT} {3053304000 -10800 1 PYST} - {3069630000 -14400 0 PYT} + {3068420400 -14400 0 PYT} {3084753600 -10800 1 PYST} - {3101079600 -14400 0 PYT} + {3099870000 -14400 0 PYT} {3116808000 -10800 1 PYST} - {3133134000 -14400 0 PYT} + {3131319600 -14400 0 PYT} {3148257600 -10800 1 PYST} - {3164583600 -14400 0 PYT} + {3162769200 -14400 0 PYT} {3179707200 -10800 1 PYST} - {3196033200 -14400 0 PYT} + {3194218800 -14400 0 PYT} {3211156800 -10800 1 PYST} - {3227482800 -14400 0 PYT} + {3226273200 -14400 0 PYT} {3242606400 -10800 1 PYST} - {3258932400 -14400 0 PYT} + {3257722800 -14400 0 PYT} {3274056000 -10800 1 PYST} - {3290382000 -14400 0 PYT} + {3289172400 -14400 0 PYT} {3306110400 -10800 1 PYST} - {3322436400 -14400 0 PYT} + {3320622000 -14400 0 PYT} {3337560000 -10800 1 PYST} - {3353886000 -14400 0 PYT} + {3352071600 -14400 0 PYT} {3369009600 -10800 1 PYST} - {3385335600 -14400 0 PYT} + {3384126000 -14400 0 PYT} {3400459200 -10800 1 PYST} - {3416785200 -14400 0 PYT} + {3415575600 -14400 0 PYT} {3431908800 -10800 1 PYST} - {3448234800 -14400 0 PYT} + {3447025200 -14400 0 PYT} {3463358400 -10800 1 PYST} - {3480289200 -14400 0 PYT} + {3478474800 -14400 0 PYT} {3495412800 -10800 1 PYST} - {3511738800 -14400 0 PYT} + {3509924400 -14400 0 PYT} {3526862400 -10800 1 PYST} - {3543188400 -14400 0 PYT} + {3541374000 -14400 0 PYT} {3558312000 -10800 1 PYST} - {3574638000 -14400 0 PYT} + {3573428400 -14400 0 PYT} {3589761600 -10800 1 PYST} - {3606087600 -14400 0 PYT} + {3604878000 -14400 0 PYT} {3621211200 -10800 1 PYST} - {3637537200 -14400 0 PYT} + {3636327600 -14400 0 PYT} {3653265600 -10800 1 PYST} - {3669591600 -14400 0 PYT} + {3667777200 -14400 0 PYT} {3684715200 -10800 1 PYST} - {3701041200 -14400 0 PYT} + {3699226800 -14400 0 PYT} {3716164800 -10800 1 PYST} - {3732490800 -14400 0 PYT} + {3731281200 -14400 0 PYT} {3747614400 -10800 1 PYST} - {3763940400 -14400 0 PYT} + {3762730800 -14400 0 PYT} {3779064000 -10800 1 PYST} - {3795390000 -14400 0 PYT} + {3794180400 -14400 0 PYT} {3810513600 -10800 1 PYST} - {3826839600 -14400 0 PYT} + {3825630000 -14400 0 PYT} {3842568000 -10800 1 PYST} - {3858894000 -14400 0 PYT} + {3857079600 -14400 0 PYT} {3874017600 -10800 1 PYST} - {3890343600 -14400 0 PYT} + {3888529200 -14400 0 PYT} {3905467200 -10800 1 PYST} - {3921793200 -14400 0 PYT} + {3920583600 -14400 0 PYT} {3936916800 -10800 1 PYST} - {3953242800 -14400 0 PYT} + {3952033200 -14400 0 PYT} {3968366400 -10800 1 PYST} - {3984692400 -14400 0 PYT} + {3983482800 -14400 0 PYT} {4000420800 -10800 1 PYST} - {4016746800 -14400 0 PYT} + {4014932400 -14400 0 PYT} {4031870400 -10800 1 PYST} - {4048196400 -14400 0 PYT} + {4046382000 -14400 0 PYT} {4063320000 -10800 1 PYST} - {4079646000 -14400 0 PYT} + {4077831600 -14400 0 PYT} {4094769600 -10800 1 PYST} } diff --git a/library/tzdata/Antarctica/Macquarie b/library/tzdata/Antarctica/Macquarie index 9877ee8..bd5cf8a 100644 --- a/library/tzdata/Antarctica/Macquarie +++ b/library/tzdata/Antarctica/Macquarie @@ -2,16 +2,11 @@ set TZData(:Antarctica/Macquarie) { {-9223372036854775808 0 0 zzz} - {-1861920000 36000 0 EST} + {-2214259200 36000 0 EST} {-1680508800 39600 1 EST} {-1669892400 39600 0 EST} {-1665392400 36000 0 EST} - {-883641600 39600 1 EST} - {-876128400 36000 0 EST} - {-860400000 39600 1 EST} - {-844678800 36000 0 EST} - {-828345600 39600 1 EST} - {-813229200 36000 0 EST} + {-1601719200 0 0 zzz} {-94730400 36000 0 EST} {-71136000 39600 1 EST} {-55411200 36000 0 EST} diff --git a/library/tzdata/Asia/Gaza b/library/tzdata/Asia/Gaza index 43e1847..a0636e2 100644 --- a/library/tzdata/Asia/Gaza +++ b/library/tzdata/Asia/Gaza @@ -88,14 +88,191 @@ set TZData(:Asia/Gaza) { {1158872400 7200 0 EET} {1175378400 10800 1 EEST} {1189638000 7200 0 EET} - {1207000800 10800 1 EEST} - {1219957200 7200 0 EET} + {1206655200 10800 1 EEST} + {1219960800 7200 0 EET} + {1220220000 7200 0 EET} {1238104800 10800 1 EEST} - {1252018800 7200 0 EET} - {1269640860 10800 1 EEST} + {1252015200 7200 0 EET} + {1262296800 7200 0 EET} + {1269640860 10800 0 EEST} {1281474000 7200 0 EET} - {1301738460 10800 1 EEST} - {1312146000 7200 0 EET} + {1301608860 10800 1 EEST} + {1312149600 7200 0 EET} + {1325368800 7200 0 EET} {1333058400 10800 1 EEST} {1348178400 7200 0 EET} + {1364508000 10800 1 EEST} + {1380232800 7200 0 EET} + {1395957600 10800 1 EEST} + {1411682400 7200 0 EET} + {1427407200 10800 1 EEST} + {1443132000 7200 0 EET} + {1459461600 10800 1 EEST} + {1474581600 7200 0 EET} + {1490911200 10800 1 EEST} + {1506031200 7200 0 EET} + {1522360800 10800 1 EEST} + {1537480800 7200 0 EET} + {1553810400 10800 1 EEST} + {1569535200 7200 0 EET} + {1585260000 10800 1 EEST} + {1600984800 7200 0 EET} + {1616709600 10800 1 EEST} + {1632434400 7200 0 EET} + {1648764000 10800 1 EEST} + {1663884000 7200 0 EET} + {1680213600 10800 1 EEST} + {1695333600 7200 0 EET} + {1711663200 10800 1 EEST} + {1727388000 7200 0 EET} + {1743112800 10800 1 EEST} + {1758837600 7200 0 EET} + {1774562400 10800 1 EEST} + {1790287200 7200 0 EET} + {1806012000 10800 1 EEST} + {1821736800 7200 0 EET} + {1838066400 10800 1 EEST} + {1853186400 7200 0 EET} + {1869516000 10800 1 EEST} + {1884636000 7200 0 EET} + {1900965600 10800 1 EEST} + {1916690400 7200 0 EET} + {1932415200 10800 1 EEST} + {1948140000 7200 0 EET} + {1963864800 10800 1 EEST} + {1979589600 7200 0 EET} + {1995919200 10800 1 EEST} + {2011039200 7200 0 EET} + {2027368800 10800 1 EEST} + {2042488800 7200 0 EET} + {2058818400 10800 1 EEST} + {2073938400 7200 0 EET} + {2090268000 10800 1 EEST} + {2105992800 7200 0 EET} + {2121717600 10800 1 EEST} + {2137442400 7200 0 EET} + {2153167200 10800 1 EEST} + {2168892000 7200 0 EET} + {2185221600 10800 1 EEST} + {2200341600 7200 0 EET} + {2216671200 10800 1 EEST} + {2231791200 7200 0 EET} + {2248120800 10800 1 EEST} + {2263845600 7200 0 EET} + {2279570400 10800 1 EEST} + {2295295200 7200 0 EET} + {2311020000 10800 1 EEST} + {2326744800 7200 0 EET} + {2343074400 10800 1 EEST} + {2358194400 7200 0 EET} + {2374524000 10800 1 EEST} + {2389644000 7200 0 EET} + {2405973600 10800 1 EEST} + {2421093600 7200 0 EET} + {2437423200 10800 1 EEST} + {2453148000 7200 0 EET} + {2468872800 10800 1 EEST} + {2484597600 7200 0 EET} + {2500322400 10800 1 EEST} + {2516047200 7200 0 EET} + {2532376800 10800 1 EEST} + {2547496800 7200 0 EET} + {2563826400 10800 1 EEST} + {2578946400 7200 0 EET} + {2595276000 10800 1 EEST} + {2611000800 7200 0 EET} + {2626725600 10800 1 EEST} + {2642450400 7200 0 EET} + {2658175200 10800 1 EEST} + {2673900000 7200 0 EET} + {2689624800 10800 1 EEST} + {2705349600 7200 0 EET} + {2721679200 10800 1 EEST} + {2736799200 7200 0 EET} + {2753128800 10800 1 EEST} + {2768248800 7200 0 EET} + {2784578400 10800 1 EEST} + {2800303200 7200 0 EET} + {2816028000 10800 1 EEST} + {2831752800 7200 0 EET} + {2847477600 10800 1 EEST} + {2863202400 7200 0 EET} + {2879532000 10800 1 EEST} + {2894652000 7200 0 EET} + {2910981600 10800 1 EEST} + {2926101600 7200 0 EET} + {2942431200 10800 1 EEST} + {2957551200 7200 0 EET} + {2973880800 10800 1 EEST} + {2989605600 7200 0 EET} + {3005330400 10800 1 EEST} + {3021055200 7200 0 EET} + {3036780000 10800 1 EEST} + {3052504800 7200 0 EET} + {3068834400 10800 1 EEST} + {3083954400 7200 0 EET} + {3100284000 10800 1 EEST} + {3115404000 7200 0 EET} + {3131733600 10800 1 EEST} + {3147458400 7200 0 EET} + {3163183200 10800 1 EEST} + {3178908000 7200 0 EET} + {3194632800 10800 1 EEST} + {3210357600 7200 0 EET} + {3226687200 10800 1 EEST} + {3241807200 7200 0 EET} + {3258136800 10800 1 EEST} + {3273256800 7200 0 EET} + {3289586400 10800 1 EEST} + {3304706400 7200 0 EET} + {3321036000 10800 1 EEST} + {3336760800 7200 0 EET} + {3352485600 10800 1 EEST} + {3368210400 7200 0 EET} + {3383935200 10800 1 EEST} + {3399660000 7200 0 EET} + {3415989600 10800 1 EEST} + {3431109600 7200 0 EET} + {3447439200 10800 1 EEST} + {3462559200 7200 0 EET} + {3478888800 10800 1 EEST} + {3494613600 7200 0 EET} + {3510338400 10800 1 EEST} + {3526063200 7200 0 EET} + {3541788000 10800 1 EEST} + {3557512800 7200 0 EET} + {3573237600 10800 1 EEST} + {3588962400 7200 0 EET} + {3605292000 10800 1 EEST} + {3620412000 7200 0 EET} + {3636741600 10800 1 EEST} + {3651861600 7200 0 EET} + {3668191200 10800 1 EEST} + {3683916000 7200 0 EET} + {3699640800 10800 1 EEST} + {3715365600 7200 0 EET} + {3731090400 10800 1 EEST} + {3746815200 7200 0 EET} + {3763144800 10800 1 EEST} + {3778264800 7200 0 EET} + {3794594400 10800 1 EEST} + {3809714400 7200 0 EET} + {3826044000 10800 1 EEST} + {3841164000 7200 0 EET} + {3857493600 10800 1 EEST} + {3873218400 7200 0 EET} + {3888943200 10800 1 EEST} + {3904668000 7200 0 EET} + {3920392800 10800 1 EEST} + {3936117600 7200 0 EET} + {3952447200 10800 1 EEST} + {3967567200 7200 0 EET} + {3983896800 10800 1 EEST} + {3999016800 7200 0 EET} + {4015346400 10800 1 EEST} + {4031071200 7200 0 EET} + {4046796000 10800 1 EEST} + {4062520800 7200 0 EET} + {4078245600 10800 1 EEST} + {4093970400 7200 0 EET} } diff --git a/library/tzdata/Asia/Hebron b/library/tzdata/Asia/Hebron index 98bb353..a8a9019 100644 --- a/library/tzdata/Asia/Hebron +++ b/library/tzdata/Asia/Hebron @@ -88,17 +88,190 @@ set TZData(:Asia/Hebron) { {1158872400 7200 0 EET} {1175378400 10800 1 EEST} {1189638000 7200 0 EET} - {1207000800 10800 1 EEST} - {1217541600 10800 1 EEST} + {1206655200 10800 1 EEST} {1220216400 7200 0 EET} {1238104800 10800 1 EEST} - {1252018800 7200 0 EET} - {1269640860 10800 1 EEST} + {1252015200 7200 0 EET} + {1269554400 10800 1 EEST} {1281474000 7200 0 EET} - {1301652060 10800 1 EEST} + {1301608860 10800 1 EEST} {1312146000 7200 0 EET} {1314655200 10800 1 EEST} - {1317340800 7200 0 EET} + {1317330000 7200 0 EET} {1333058400 10800 1 EEST} {1348178400 7200 0 EET} + {1364508000 10800 1 EEST} + {1380232800 7200 0 EET} + {1395957600 10800 1 EEST} + {1411682400 7200 0 EET} + {1427407200 10800 1 EEST} + {1443132000 7200 0 EET} + {1459461600 10800 1 EEST} + {1474581600 7200 0 EET} + {1490911200 10800 1 EEST} + {1506031200 7200 0 EET} + {1522360800 10800 1 EEST} + {1537480800 7200 0 EET} + {1553810400 10800 1 EEST} + {1569535200 7200 0 EET} + {1585260000 10800 1 EEST} + {1600984800 7200 0 EET} + {1616709600 10800 1 EEST} + {1632434400 7200 0 EET} + {1648764000 10800 1 EEST} + {1663884000 7200 0 EET} + {1680213600 10800 1 EEST} + {1695333600 7200 0 EET} + {1711663200 10800 1 EEST} + {1727388000 7200 0 EET} + {1743112800 10800 1 EEST} + {1758837600 7200 0 EET} + {1774562400 10800 1 EEST} + {1790287200 7200 0 EET} + {1806012000 10800 1 EEST} + {1821736800 7200 0 EET} + {1838066400 10800 1 EEST} + {1853186400 7200 0 EET} + {1869516000 10800 1 EEST} + {1884636000 7200 0 EET} + {1900965600 10800 1 EEST} + {1916690400 7200 0 EET} + {1932415200 10800 1 EEST} + {1948140000 7200 0 EET} + {1963864800 10800 1 EEST} + {1979589600 7200 0 EET} + {1995919200 10800 1 EEST} + {2011039200 7200 0 EET} + {2027368800 10800 1 EEST} + {2042488800 7200 0 EET} + {2058818400 10800 1 EEST} + {2073938400 7200 0 EET} + {2090268000 10800 1 EEST} + {2105992800 7200 0 EET} + {2121717600 10800 1 EEST} + {2137442400 7200 0 EET} + {2153167200 10800 1 EEST} + {2168892000 7200 0 EET} + {2185221600 10800 1 EEST} + {2200341600 7200 0 EET} + {2216671200 10800 1 EEST} + {2231791200 7200 0 EET} + {2248120800 10800 1 EEST} + {2263845600 7200 0 EET} + {2279570400 10800 1 EEST} + {2295295200 7200 0 EET} + {2311020000 10800 1 EEST} + {2326744800 7200 0 EET} + {2343074400 10800 1 EEST} + {2358194400 7200 0 EET} + {2374524000 10800 1 EEST} + {2389644000 7200 0 EET} + {2405973600 10800 1 EEST} + {2421093600 7200 0 EET} + {2437423200 10800 1 EEST} + {2453148000 7200 0 EET} + {2468872800 10800 1 EEST} + {2484597600 7200 0 EET} + {2500322400 10800 1 EEST} + {2516047200 7200 0 EET} + {2532376800 10800 1 EEST} + {2547496800 7200 0 EET} + {2563826400 10800 1 EEST} + {2578946400 7200 0 EET} + {2595276000 10800 1 EEST} + {2611000800 7200 0 EET} + {2626725600 10800 1 EEST} + {2642450400 7200 0 EET} + {2658175200 10800 1 EEST} + {2673900000 7200 0 EET} + {2689624800 10800 1 EEST} + {2705349600 7200 0 EET} + {2721679200 10800 1 EEST} + {2736799200 7200 0 EET} + {2753128800 10800 1 EEST} + {2768248800 7200 0 EET} + {2784578400 10800 1 EEST} + {2800303200 7200 0 EET} + {2816028000 10800 1 EEST} + {2831752800 7200 0 EET} + {2847477600 10800 1 EEST} + {2863202400 7200 0 EET} + {2879532000 10800 1 EEST} + {2894652000 7200 0 EET} + {2910981600 10800 1 EEST} + {2926101600 7200 0 EET} + {2942431200 10800 1 EEST} + {2957551200 7200 0 EET} + {2973880800 10800 1 EEST} + {2989605600 7200 0 EET} + {3005330400 10800 1 EEST} + {3021055200 7200 0 EET} + {3036780000 10800 1 EEST} + {3052504800 7200 0 EET} + {3068834400 10800 1 EEST} + {3083954400 7200 0 EET} + {3100284000 10800 1 EEST} + {3115404000 7200 0 EET} + {3131733600 10800 1 EEST} + {3147458400 7200 0 EET} + {3163183200 10800 1 EEST} + {3178908000 7200 0 EET} + {3194632800 10800 1 EEST} + {3210357600 7200 0 EET} + {3226687200 10800 1 EEST} + {3241807200 7200 0 EET} + {3258136800 10800 1 EEST} + {3273256800 7200 0 EET} + {3289586400 10800 1 EEST} + {3304706400 7200 0 EET} + {3321036000 10800 1 EEST} + {3336760800 7200 0 EET} + {3352485600 10800 1 EEST} + {3368210400 7200 0 EET} + {3383935200 10800 1 EEST} + {3399660000 7200 0 EET} + {3415989600 10800 1 EEST} + {3431109600 7200 0 EET} + {3447439200 10800 1 EEST} + {3462559200 7200 0 EET} + {3478888800 10800 1 EEST} + {3494613600 7200 0 EET} + {3510338400 10800 1 EEST} + {3526063200 7200 0 EET} + {3541788000 10800 1 EEST} + {3557512800 7200 0 EET} + {3573237600 10800 1 EEST} + {3588962400 7200 0 EET} + {3605292000 10800 1 EEST} + {3620412000 7200 0 EET} + {3636741600 10800 1 EEST} + {3651861600 7200 0 EET} + {3668191200 10800 1 EEST} + {3683916000 7200 0 EET} + {3699640800 10800 1 EEST} + {3715365600 7200 0 EET} + {3731090400 10800 1 EEST} + {3746815200 7200 0 EET} + {3763144800 10800 1 EEST} + {3778264800 7200 0 EET} + {3794594400 10800 1 EEST} + {3809714400 7200 0 EET} + {3826044000 10800 1 EEST} + {3841164000 7200 0 EET} + {3857493600 10800 1 EEST} + {3873218400 7200 0 EET} + {3888943200 10800 1 EEST} + {3904668000 7200 0 EET} + {3920392800 10800 1 EEST} + {3936117600 7200 0 EET} + {3952447200 10800 1 EEST} + {3967567200 7200 0 EET} + {3983896800 10800 1 EEST} + {3999016800 7200 0 EET} + {4015346400 10800 1 EEST} + {4031071200 7200 0 EET} + {4046796000 10800 1 EEST} + {4062520800 7200 0 EET} + {4078245600 10800 1 EEST} + {4093970400 7200 0 EET} } diff --git a/library/tzdata/Asia/Jerusalem b/library/tzdata/Asia/Jerusalem index 613eadd..7662680 100644 --- a/library/tzdata/Asia/Jerusalem +++ b/library/tzdata/Asia/Jerusalem @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Jerusalem) { - {-9223372036854775808 8456 0 LMT} - {-2840149256 8440 0 JMT} + {-9223372036854775808 8454 0 LMT} + {-2840149254 8440 0 JMT} {-1641003640 7200 0 IST} {-933645600 10800 1 IDT} {-857358000 7200 0 IST} @@ -96,177 +96,177 @@ set TZData(:Asia/Jerusalem) { {1333065600 10800 1 IDT} {1348354800 7200 0 IST} {1364515200 10800 1 IDT} - {1381014000 7200 0 IST} + {1382828400 7200 0 IST} {1395964800 10800 1 IDT} - {1412463600 7200 0 IST} + {1414278000 7200 0 IST} {1427414400 10800 1 IDT} - {1443913200 7200 0 IST} + {1445727600 7200 0 IST} {1458864000 10800 1 IDT} - {1475362800 7200 0 IST} + {1477782000 7200 0 IST} {1490313600 10800 1 IDT} - {1507417200 7200 0 IST} + {1509231600 7200 0 IST} {1521763200 10800 1 IDT} - {1538866800 7200 0 IST} + {1540681200 7200 0 IST} {1553817600 10800 1 IDT} - {1570316400 7200 0 IST} + {1572130800 7200 0 IST} {1585267200 10800 1 IDT} - {1601766000 7200 0 IST} + {1603580400 7200 0 IST} {1616716800 10800 1 IDT} - {1633215600 7200 0 IST} + {1635634800 7200 0 IST} {1648166400 10800 1 IDT} - {1664665200 7200 0 IST} + {1667084400 7200 0 IST} {1679616000 10800 1 IDT} - {1696719600 7200 0 IST} + {1698534000 7200 0 IST} {1711670400 10800 1 IDT} - {1728169200 7200 0 IST} + {1729983600 7200 0 IST} {1743120000 10800 1 IDT} - {1759618800 7200 0 IST} + {1761433200 7200 0 IST} {1774569600 10800 1 IDT} - {1791068400 7200 0 IST} + {1792882800 7200 0 IST} {1806019200 10800 1 IDT} - {1822604400 7200 0 IST} + {1824937200 7200 0 IST} {1837468800 10800 1 IDT} - {1854572400 7200 0 IST} + {1856386800 7200 0 IST} {1868918400 10800 1 IDT} - {1886022000 7200 0 IST} + {1887836400 7200 0 IST} {1900972800 10800 1 IDT} - {1917471600 7200 0 IST} + {1919286000 7200 0 IST} {1932422400 10800 1 IDT} - {1948921200 7200 0 IST} + {1950735600 7200 0 IST} {1963872000 10800 1 IDT} - {1980370800 7200 0 IST} + {1982790000 7200 0 IST} {1995321600 10800 1 IDT} - {2011820400 7200 0 IST} + {2014239600 7200 0 IST} {2026771200 10800 1 IDT} - {2043874800 7200 0 IST} + {2045689200 7200 0 IST} {2058220800 10800 1 IDT} - {2075324400 7200 0 IST} + {2077138800 7200 0 IST} {2090275200 10800 1 IDT} - {2106774000 7200 0 IST} + {2108588400 7200 0 IST} {2121724800 10800 1 IDT} - {2138223600 7200 0 IST} + {2140038000 7200 0 IST} {2153174400 10800 1 IDT} - {2169673200 7200 0 IST} + {2172092400 7200 0 IST} {2184624000 10800 1 IDT} - {2201122800 7200 0 IST} + {2203542000 7200 0 IST} {2216073600 10800 1 IDT} - {2233177200 7200 0 IST} + {2234991600 7200 0 IST} {2248128000 10800 1 IDT} - {2264626800 7200 0 IST} + {2266441200 7200 0 IST} {2279577600 10800 1 IDT} - {2296076400 7200 0 IST} + {2297890800 7200 0 IST} {2311027200 10800 1 IDT} - {2327526000 7200 0 IST} + {2329340400 7200 0 IST} {2342476800 10800 1 IDT} - {2358975600 7200 0 IST} + {2361394800 7200 0 IST} {2373926400 10800 1 IDT} - {2391030000 7200 0 IST} + {2392844400 7200 0 IST} {2405376000 10800 1 IDT} - {2422479600 7200 0 IST} + {2424294000 7200 0 IST} {2437430400 10800 1 IDT} - {2453929200 7200 0 IST} + {2455743600 7200 0 IST} {2468880000 10800 1 IDT} - {2485378800 7200 0 IST} + {2487193200 7200 0 IST} {2500329600 10800 1 IDT} - {2516828400 7200 0 IST} + {2519247600 7200 0 IST} {2531779200 10800 1 IDT} - {2548278000 7200 0 IST} + {2550697200 7200 0 IST} {2563228800 10800 1 IDT} - {2580332400 7200 0 IST} + {2582146800 7200 0 IST} {2595283200 10800 1 IDT} - {2611782000 7200 0 IST} + {2613596400 7200 0 IST} {2626732800 10800 1 IDT} - {2643231600 7200 0 IST} + {2645046000 7200 0 IST} {2658182400 10800 1 IDT} - {2674681200 7200 0 IST} + {2676495600 7200 0 IST} {2689632000 10800 1 IDT} - {2706130800 7200 0 IST} + {2708550000 7200 0 IST} {2721081600 10800 1 IDT} - {2738185200 7200 0 IST} + {2739999600 7200 0 IST} {2752531200 10800 1 IDT} - {2769634800 7200 0 IST} + {2771449200 7200 0 IST} {2784585600 10800 1 IDT} - {2801084400 7200 0 IST} + {2802898800 7200 0 IST} {2816035200 10800 1 IDT} - {2832534000 7200 0 IST} + {2834348400 7200 0 IST} {2847484800 10800 1 IDT} - {2863983600 7200 0 IST} + {2866402800 7200 0 IST} {2878934400 10800 1 IDT} - {2895433200 7200 0 IST} + {2897852400 7200 0 IST} {2910384000 10800 1 IDT} - {2927487600 7200 0 IST} + {2929302000 7200 0 IST} {2941833600 10800 1 IDT} - {2958937200 7200 0 IST} + {2960751600 7200 0 IST} {2973888000 10800 1 IDT} - {2990386800 7200 0 IST} + {2992201200 7200 0 IST} {3005337600 10800 1 IDT} - {3021836400 7200 0 IST} + {3023650800 7200 0 IST} {3036787200 10800 1 IDT} - {3053286000 7200 0 IST} + {3055705200 7200 0 IST} {3068236800 10800 1 IDT} - {3084735600 7200 0 IST} + {3087154800 7200 0 IST} {3099686400 10800 1 IDT} - {3116790000 7200 0 IST} + {3118604400 7200 0 IST} {3131740800 10800 1 IDT} - {3148239600 7200 0 IST} + {3150054000 7200 0 IST} {3163190400 10800 1 IDT} - {3179689200 7200 0 IST} + {3181503600 7200 0 IST} {3194640000 10800 1 IDT} - {3211138800 7200 0 IST} + {3212953200 7200 0 IST} {3226089600 10800 1 IDT} - {3242588400 7200 0 IST} + {3245007600 7200 0 IST} {3257539200 10800 1 IDT} - {3274642800 7200 0 IST} + {3276457200 7200 0 IST} {3288988800 10800 1 IDT} - {3306092400 7200 0 IST} + {3307906800 7200 0 IST} {3321043200 10800 1 IDT} - {3337542000 7200 0 IST} + {3339356400 7200 0 IST} {3352492800 10800 1 IDT} - {3368991600 7200 0 IST} + {3370806000 7200 0 IST} {3383942400 10800 1 IDT} - {3400441200 7200 0 IST} + {3402860400 7200 0 IST} {3415392000 10800 1 IDT} - {3431890800 7200 0 IST} + {3434310000 7200 0 IST} {3446841600 10800 1 IDT} - {3463945200 7200 0 IST} + {3465759600 7200 0 IST} {3478896000 10800 1 IDT} - {3495394800 7200 0 IST} + {3497209200 7200 0 IST} {3510345600 10800 1 IDT} - {3526844400 7200 0 IST} + {3528658800 7200 0 IST} {3541795200 10800 1 IDT} - {3558294000 7200 0 IST} + {3560108400 7200 0 IST} {3573244800 10800 1 IDT} - {3589743600 7200 0 IST} + {3592162800 7200 0 IST} {3604694400 10800 1 IDT} - {3621798000 7200 0 IST} + {3623612400 7200 0 IST} {3636144000 10800 1 IDT} - {3653247600 7200 0 IST} + {3655062000 7200 0 IST} {3668198400 10800 1 IDT} - {3684697200 7200 0 IST} + {3686511600 7200 0 IST} {3699648000 10800 1 IDT} - {3716146800 7200 0 IST} + {3717961200 7200 0 IST} {3731097600 10800 1 IDT} - {3747596400 7200 0 IST} + {3750015600 7200 0 IST} {3762547200 10800 1 IDT} - {3779046000 7200 0 IST} + {3781465200 7200 0 IST} {3793996800 10800 1 IDT} - {3811100400 7200 0 IST} + {3812914800 7200 0 IST} {3825446400 10800 1 IDT} - {3842550000 7200 0 IST} + {3844364400 7200 0 IST} {3857500800 10800 1 IDT} - {3873999600 7200 0 IST} + {3875814000 7200 0 IST} {3888950400 10800 1 IDT} - {3905449200 7200 0 IST} + {3907263600 7200 0 IST} {3920400000 10800 1 IDT} - {3936898800 7200 0 IST} + {3939318000 7200 0 IST} {3951849600 10800 1 IDT} - {3968348400 7200 0 IST} + {3970767600 7200 0 IST} {3983299200 10800 1 IDT} - {4000402800 7200 0 IST} + {4002217200 7200 0 IST} {4015353600 10800 1 IDT} - {4031852400 7200 0 IST} + {4033666800 7200 0 IST} {4046803200 10800 1 IDT} - {4063302000 7200 0 IST} + {4065116400 7200 0 IST} {4078252800 10800 1 IDT} - {4094751600 7200 0 IST} + {4096566000 7200 0 IST} } -- cgit v0.12 From 8f192fb2d5bb99a3eba996b1dae5fb1b52e13496 Mon Sep 17 00:00:00 2001 From: stwo Date: Sun, 7 Jul 2013 02:11:57 +0000 Subject: OpenBSD/m88k is now elf. Remove unneeded elf check. --- unix/configure | 43 ++++--------------------------------------- unix/tcl.m4 | 15 ++++----------- 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/unix/configure b/unix/configure index d37aa4f..f219255 100755 --- a/unix/configure +++ b/unix/configure @@ -7727,11 +7727,12 @@ fi OpenBSD-*) arch=`arch -s` case "$arch" in - m88k|vax) + vax) # Equivalent using configure option --disable-load # Step 4 will set the necessary variables DL_OBJS="" SHLIB_LD_LIBS="" + LDFLAGS="" ;; *) SHLIB_CFLAGS="-fPIC" @@ -7746,10 +7747,11 @@ fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" ;; esac case "$arch" in - m88k|vax) + vax) CFLAGS_OPTIMIZE="-O1" ;; sh) @@ -7759,43 +7761,6 @@ fi CFLAGS_OPTIMIZE="-O2" ;; esac - echo "$as_me:$LINENO: checking for ELF" >&5 -echo $ECHO_N "checking for ELF... $ECHO_C" >&6 -if test "${tcl_cv_ld_elf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef __ELF__ - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - tcl_cv_ld_elf=yes -else - tcl_cv_ld_elf=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 -echo "${ECHO_T}$tcl_cv_ld_elf" >&6 - if test $tcl_cv_ld_elf = yes; then - - LDFLAGS=-Wl,-export-dynamic - -else - LDFLAGS="" -fi - if test "${TCL_THREADS}" = "1"; then # On OpenBSD: Compile with -pthread diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 4656e61..b9b6532 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1473,11 +1473,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ OpenBSD-*) arch=`arch -s` case "$arch" in - m88k|vax) + vax) # Equivalent using configure option --disable-load # Step 4 will set the necessary variables DL_OBJS="" SHLIB_LD_LIBS="" + LDFLAGS="" ;; *) SHLIB_CFLAGS="-fPIC" @@ -1489,10 +1490,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" ;; esac case "$arch" in - m88k|vax) + vax) CFLAGS_OPTIMIZE="-O1" ;; sh) @@ -1502,15 +1504,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_OPTIMIZE="-O2" ;; esac - AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ - AC_EGREP_CPP(yes, [ -#ifdef __ELF__ - yes -#endif - ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) - AS_IF([test $tcl_cv_ld_elf = yes], [ - LDFLAGS=-Wl,-export-dynamic - ], [LDFLAGS=""]) AS_IF([test "${TCL_THREADS}" = "1"], [ # On OpenBSD: Compile with -pthread # Don't link with -lpthread -- cgit v0.12 From 29bb4e46858b3dc971489d3c6c633ae3028304fc Mon Sep 17 00:00:00 2001 From: stwo Date: Sun, 7 Jul 2013 02:19:20 +0000 Subject: OpenBSD/m88k is now elf. Remove unneeded elf check. --- unix/configure | 43 ++++--------------------------------------- unix/tcl.m4 | 15 ++++----------- 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/unix/configure b/unix/configure index 3e04284..6faa7d8 100755 --- a/unix/configure +++ b/unix/configure @@ -7562,11 +7562,12 @@ fi OpenBSD-*) arch=`arch -s` case "$arch" in - m88k|vax) + vax) # Equivalent using configure option --disable-load # Step 4 will set the necessary variables DL_OBJS="" SHLIB_LD_LIBS="" + LDFLAGS="" ;; *) SHLIB_CFLAGS="-fPIC" @@ -7581,10 +7582,11 @@ fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" ;; esac case "$arch" in - m88k|vax) + vax) CFLAGS_OPTIMIZE="-O1" ;; sh) @@ -7594,43 +7596,6 @@ fi CFLAGS_OPTIMIZE="-O2" ;; esac - echo "$as_me:$LINENO: checking for ELF" >&5 -echo $ECHO_N "checking for ELF... $ECHO_C" >&6 -if test "${tcl_cv_ld_elf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef __ELF__ - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - tcl_cv_ld_elf=yes -else - tcl_cv_ld_elf=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5 -echo "${ECHO_T}$tcl_cv_ld_elf" >&6 - if test $tcl_cv_ld_elf = yes; then - - LDFLAGS=-Wl,-export-dynamic - -else - LDFLAGS="" -fi - if test "${TCL_THREADS}" = "1"; then # On OpenBSD: Compile with -pthread diff --git a/unix/tcl.m4 b/unix/tcl.m4 index cdc5f99..879d810 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1484,11 +1484,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ OpenBSD-*) arch=`arch -s` case "$arch" in - m88k|vax) + vax) # Equivalent using configure option --disable-load # Step 4 will set the necessary variables DL_OBJS="" SHLIB_LD_LIBS="" + LDFLAGS="" ;; *) SHLIB_CFLAGS="-fPIC" @@ -1500,10 +1501,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" ;; esac case "$arch" in - m88k|vax) + vax) CFLAGS_OPTIMIZE="-O1" ;; sh) @@ -1513,15 +1515,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_OPTIMIZE="-O2" ;; esac - AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [ - AC_EGREP_CPP(yes, [ -#ifdef __ELF__ - yes -#endif - ], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)]) - AS_IF([test $tcl_cv_ld_elf = yes], [ - LDFLAGS=-Wl,-export-dynamic - ], [LDFLAGS=""]) AS_IF([test "${TCL_THREADS}" = "1"], [ # On OpenBSD: Compile with -pthread # Don't link with -lpthread -- cgit v0.12 From 2a8fc2f6742ccb70838789cfb3c3713cc6fe681d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Jul 2013 06:49:44 +0000 Subject: Build stub objects with -DSTATIC_BUILD on all platforms. Only important on win32 (already done) and cygwin, on other platforms it should not have any effect. --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 34c7165..f6c4424 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1529,7 +1529,7 @@ waitpid.o: $(COMPAT_DIR)/waitpid.c # even though they will be placed in a static archive tclStubLib.o: $(GENERIC_DIR)/tclStubLib.c - $(CC) -c $(STUB_CC_SWITCHES) $(GENERIC_DIR)/tclStubLib.c + $(CC) -c $(STUB_CC_SWITCHES) -DSTATIC_BUILD $(GENERIC_DIR)/tclStubLib.c .c.o: $(CC) -c $(CC_SWITCHES) $< -- cgit v0.12 From 4e5f3c749a2ed1b7c44cb7d1040ed19b03898b18 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 14:31:14 +0000 Subject: The routines StartExpanding() and EnterCmdWordData() are orthogonal, so it's ok to reverse the order in which they are called. --- generic/tclCompile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 5aab69c..0dc30e2 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1802,10 +1802,6 @@ CompileCommandTokens( EnterCmdStartData(envPtr, cmdIdx, parsePtr->commandStart - envPtr->source, startCodeOffset); - if (expand && !cmdPtr) { - StartExpanding(envPtr); - } - /* * TIP #280. Scan the words and compute the extended location * information. The map first contain full per-word line @@ -1823,6 +1819,9 @@ CompileCommandTokens( envPtr->line = eclPtr->loc[wlineat].line[0]; envPtr->clNext = eclPtr->loc[wlineat].next[0]; + if (expand && !cmdPtr) { + StartExpanding(envPtr); + } if (cmdPtr) { int savedNumCmds = envPtr->numCommands; int update = 0; -- cgit v0.12 From edb7dfc419cc7a8a06ed06669400e1e192a47c09 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 15:00:02 +0000 Subject: Consolidate the StartExpanding() calls. --- generic/tclCompile.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 0dc30e2..cbb93d9 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1819,9 +1819,6 @@ CompileCommandTokens( envPtr->line = eclPtr->loc[wlineat].line[0]; envPtr->clNext = eclPtr->loc[wlineat].next[0]; - if (expand && !cmdPtr) { - StartExpanding(envPtr); - } if (cmdPtr) { int savedNumCmds = envPtr->numCommands; int update = 0; @@ -1919,11 +1916,10 @@ CompileCommandTokens( envPtr->line = eclPtr->loc[wlineat].line[0]; envPtr->clNext = eclPtr->loc[wlineat].next[0]; + } - /* TODO: Can this happen? If so, is this right? */ - if (expand) { - StartExpanding(envPtr); - } + if (expand) { + StartExpanding(envPtr); } /* -- cgit v0.12 From d8459f08677700f376c5e39328895bd98bb5d7d1 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 15:24:56 +0000 Subject: Defer expansion request detection as much as possible. --- generic/tclCompile.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index cbb93d9..052dc8e 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1744,6 +1744,22 @@ FindCompiledCommandFromToken( */ #ifdef REWRITE + +static int +ExpandRequested( + Tcl_Token *tokenPtr, + int numWords) +{ + /* Determine whether any words of the command require expansion */ + while (numWords--) { + if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + return 1; + } + tokenPtr += tokenPtr->numComponents + 1; + } + return 0; +} + static int CompileCommandTokens( Tcl_Interp *interp, @@ -1755,7 +1771,7 @@ CompileCommandTokens( ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; Tcl_Obj *cmdObj = Tcl_NewObj(); Command *cmdPtr = NULL; - int wordIdx, cmdKnown, expand = 0, numWords = parsePtr->numWords; + int wordIdx, cmdKnown, expand = -1, numWords = parsePtr->numWords; int *wlines, wlineat; int cmdLine = envPtr->line; int *clNext = envPtr->clNext; @@ -1763,15 +1779,6 @@ CompileCommandTokens( int startCodeOffset = envPtr->codeNext - envPtr->codeStart; assert (numWords > 0); - - /* Determine whether any words of the command require expansion */ - for (wordIdx = 0; wordIdx < numWords; - wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { - if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - expand = 1; - break; - } - } /* Do we know the command word? */ Tcl_IncrRefCount(cmdObj); @@ -1783,13 +1790,19 @@ CompileCommandTokens( cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); if (cmdPtr) { /* - * Found a command. Test all the ways we can be told + * Found a command. Test the ways we can be told * not to attempt to compile it. */ if ((cmdPtr->compileProc == NULL) || (cmdPtr->nsPtr->flags & NS_SUPPRESS_COMPILATION) - || (cmdPtr->flags & CMD_HAS_EXEC_TRACES) - || (expand && !(cmdPtr->flags & CMD_COMPILES_EXPANDED))) { + || (cmdPtr->flags & CMD_HAS_EXEC_TRACES)) { + cmdPtr = NULL; + } + } + if (cmdPtr && !(cmdPtr->flags & CMD_COMPILES_EXPANDED)) { + expand = ExpandRequested(parsePtr->tokenPtr, parsePtr->numWords); + if (expand) { + /* We need to expand, but compileProc cannot. */ cmdPtr = NULL; } } @@ -1918,6 +1931,10 @@ CompileCommandTokens( envPtr->clNext = eclPtr->loc[wlineat].next[0]; } + if (expand < 0) { + expand = ExpandRequested(parsePtr->tokenPtr, parsePtr->numWords); + } + if (expand) { StartExpanding(envPtr); } -- cgit v0.12 From c5f6c28026fcea560f1ca456c9ac4f8b7239e902 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 15:39:55 +0000 Subject: Move TIP 280 and command extent housekeeping to the periphery. --- generic/tclCompile.c | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 052dc8e..388b8a0 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1780,6 +1780,29 @@ CompileCommandTokens( assert (numWords > 0); + /* Pre-Compile */ + + envPtr->numCommands++; + EnterCmdStartData(envPtr, cmdIdx, + parsePtr->commandStart - envPtr->source, startCodeOffset); + + /* + * TIP #280. Scan the words and compute the extended location + * information. The map first contain full per-word line + * information for use by the compiler. This is later replaced by + * a reduced form which signals non-literal words, stored in + * 'wlines'. + */ + + EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source, + parsePtr->tokenPtr, parsePtr->commandStart, + parsePtr->commandSize, parsePtr->numWords, cmdLine, + clNext, &wlines, envPtr); + wlineat = eclPtr->nuloc - 1; + + envPtr->line = eclPtr->loc[wlineat].line[0]; + envPtr->clNext = eclPtr->loc[wlineat].next[0]; + /* Do we know the command word? */ Tcl_IncrRefCount(cmdObj); tokenPtr = parsePtr->tokenPtr; @@ -1809,29 +1832,6 @@ CompileCommandTokens( } /* If cmdPtr != NULL, we will try to call cmdPtr->compileProc */ - /* Pre-Compile */ - - envPtr->numCommands++; - EnterCmdStartData(envPtr, cmdIdx, - parsePtr->commandStart - envPtr->source, startCodeOffset); - - /* - * TIP #280. Scan the words and compute the extended location - * information. The map first contain full per-word line - * information for use by the compiler. This is later replaced by - * a reduced form which signals non-literal words, stored in - * 'wlines'. - */ - - EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source, - parsePtr->tokenPtr, parsePtr->commandStart, - parsePtr->commandSize, parsePtr->numWords, cmdLine, - clNext, &wlines, envPtr); - wlineat = eclPtr->nuloc - 1; - - envPtr->line = eclPtr->loc[wlineat].line[0]; - envPtr->clNext = eclPtr->loc[wlineat].next[0]; - if (cmdPtr) { int savedNumCmds = envPtr->numCommands; int update = 0; @@ -2031,15 +2031,15 @@ CompileCommandTokens( } finishCommand: + if (cmdKnown) { + Tcl_DecrRefCount(cmdObj); + } + TclEmitOpcode(INST_POP, envPtr); EnterCmdExtentData(envPtr, cmdIdx, parsePtr->term - parsePtr->commandStart, (envPtr->codeNext-envPtr->codeStart) - startCodeOffset); - if (cmdKnown) { - Tcl_DecrRefCount(cmdObj); - } - /* * TIP #280: Free full form of per-word line data and insert the * reduced form now -- cgit v0.12 From d668a84e6108d23992a0dcfa20714ce1c4be3037 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 18:08:01 +0000 Subject: Plug memory leak; Break three compilation mechanisms into routines. --- generic/tclCompile.c | 462 +++++++++++++++++++++++++++++---------------------- 1 file changed, 266 insertions(+), 196 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 388b8a0..1958d47 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1760,6 +1760,255 @@ ExpandRequested( return 0; } +static void +CompileInvocation( + Tcl_Interp *interp, + Tcl_Token *tokenPtr, + Tcl_Obj *cmdObj, + int numWords, + int wlineat, + CompileEnv *envPtr) +{ + int isnew, wordIdx = 0; + ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + + if (cmdObj) { + int numBytes; + const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); + int cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); + Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); + + if (cmdPtr) { + TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), + cmdPtr); + } + TclEmitPush(cmdLitIdx, envPtr); + + wordIdx = 1; + tokenPtr += tokenPtr->numComponents + 1; + } + + for (; wordIdx < numWords; + wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { + int objIdx; + + envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; + envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + CompileTokens(envPtr, tokenPtr, interp); + continue; + } + + objIdx = TclRegisterNewLiteral(envPtr, + tokenPtr[1].start, tokenPtr[1].size); + if (envPtr->clNext) { + TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), + tokenPtr[1].start - envPtr->source, + eclPtr->loc[wlineat].next[wordIdx]); + } + TclEmitPush(objIdx, envPtr); + } + + /* + * Save PC -> command map for the TclArgumentBC* functions. + */ + + Tcl_SetHashValue(Tcl_CreateHashEntry(&eclPtr->litInfo, + INT2PTR(envPtr->codeNext - envPtr->codeStart), &isnew), + INT2PTR(wlineat)); + + if (wordIdx <= 255) { + TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); + } else { + TclEmitInstInt4(INST_INVOKE_STK4, wordIdx, envPtr); + } +} + +static void +CompileExpanded( + Tcl_Interp *interp, + Tcl_Token *tokenPtr, + Tcl_Obj *cmdObj, + int numWords, + int wlineat, + CompileEnv *envPtr) +{ + int wordIdx = 0; + ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + + StartExpanding(envPtr); + if (cmdObj) { + int numBytes; + const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); + int cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); + Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); + + if (cmdPtr) { + TclSetCmdNameObj(interp, + TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr); + } + TclEmitPush(cmdLitIdx, envPtr); + + wordIdx = 1; + tokenPtr += tokenPtr->numComponents + 1; + } + + for (; wordIdx < numWords; + wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { + int objIdx; + + envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; + envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + CompileTokens(envPtr, tokenPtr, interp); + if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { + TclEmitInstInt4(INST_EXPAND_STKTOP, + envPtr->currStackDepth, envPtr); + } + continue; + } + + objIdx = TclRegisterNewLiteral(envPtr, + tokenPtr[1].start, tokenPtr[1].size); + if (envPtr->clNext) { + TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), + tokenPtr[1].start - envPtr->source, + eclPtr->loc[wlineat].next[wordIdx]); + } + TclEmitPush(objIdx, envPtr); + } + + /* + * The stack depth during argument expansion can only be + * managed at runtime, as the number of elements in the + * expanded lists is not known at compile time. We adjust here + * the stack depth estimate so that it is correct after the + * command with expanded arguments returns. + * + * The end effect of this command's invocation is that all the + * words of the command are popped from the stack, and the + * result is pushed: the stack top changes by (1-wordIdx). + * + * Note that the estimates are not correct while the command + * is being prepared and run, INST_EXPAND_STKTOP is not + * stack-neutral in general. + */ + + TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); + envPtr->expandCount--; + TclAdjustStackDepth(1 - wordIdx, envPtr); +} + +static int +CompileCmdCompileProc( + Tcl_Interp *interp, + Tcl_Parse *parsePtr, + Command *cmdPtr, + int startCodeOffset, + CompileEnv *envPtr) +{ + ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + int savedNumCmds = envPtr->numCommands; + int startStackDepth = envPtr->currStackDepth; + int wlineat = eclPtr->nuloc - 1; + int update = 0; + + /* + * Mark the start of the command; the proper bytecode + * length will be updated later. There is no need to + * do this for the first bytecode in the compile env, + * as the check is done before calling + * TclNRExecuteByteCode(). Do emit an INST_START_CMD + * in special cases where the first bytecode is in a + * loop, to insure that the corresponding command is + * counted properly. Compilers for commands able to + * produce such a beast (currently 'while 1' only) set + * envPtr->atCmdStart to 0 in order to signal this + * case. [Bug 1752146] + * + * Note that the environment is initialised with + * atCmdStart=1 to avoid emitting ISC for the first + * command. + */ + + if (envPtr->atCmdStart == 1) { + if (startCodeOffset) { + /* + * Increase the number of commands being + * started at the current point. Note that + * this depends on the exact layout of the + * INST_START_CMD's operands, so be careful! + */ + + TclIncrUInt4AtPtr(envPtr->codeNext - 4, 1) + } + } else if (envPtr->atCmdStart == 0) { + TclEmitInstInt4(INST_START_CMD, 0, envPtr); + TclEmitInt4(1, envPtr); + update = 1; + } + + if (TCL_OK == cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr)) { + +#ifdef TCL_COMPILE_DEBUG + /* + * Confirm that the command compiler generated a + * single value on the stack as its result. This + * is only done in debugging mode, as it *should* + * be correct and normal users have no reasonable + * way to fix it anyway. + */ + + int diff = envPtr->currStackDepth - startStackDepth; + + if (diff != 1) { + Tcl_Panic("bad stack adjustment when compiling" + " %.*s (was %d instead of 1)", parsePtr->tokenPtr->size, + parsePtr->tokenPtr->start, diff); + } +#endif + if (update) { + /* + * Fix the bytecode length. + */ + + unsigned char *fixPtr = envPtr->codeStart + startCodeOffset + 1; + unsigned fixLen = envPtr->codeNext - fixPtr + 1; + + TclStoreInt4AtPtr(fixLen, fixPtr); + } + return TCL_OK; + } + + if (envPtr->atCmdStart == 1 && startCodeOffset != 0) { + /* + * Decrease the number of commands being started + * at the current point. Note that this depends on + * the exact layout of the INST_START_CMD's + * operands, so be careful! + */ + + TclIncrUInt4AtPtr(envPtr->codeNext - 4, -1); + } + + /* + * Restore numCommands, codeNext, and currStackDepth to their + * correct values, removing any commands compiled before the + * failure to produce bytecode got reported. + * [Bugs 705406, 735055, 3614102] + */ + + envPtr->numCommands = savedNumCmds; + envPtr->codeNext = envPtr->codeStart + startCodeOffset; + envPtr->currStackDepth = startStackDepth; + + envPtr->line = eclPtr->loc[wlineat].line[0]; + envPtr->clNext = eclPtr->loc[wlineat].next[0]; + return TCL_ERROR; +} + static int CompileCommandTokens( Tcl_Interp *interp, @@ -1771,14 +2020,15 @@ CompileCommandTokens( ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; Tcl_Obj *cmdObj = Tcl_NewObj(); Command *cmdPtr = NULL; - int wordIdx, cmdKnown, expand = -1, numWords = parsePtr->numWords; + int code = TCL_ERROR; + int cmdKnown, expand = -1; int *wlines, wlineat; int cmdLine = envPtr->line; int *clNext = envPtr->clNext; int cmdIdx = envPtr->numCommands; int startCodeOffset = envPtr->codeNext - envPtr->codeStart; - assert (numWords > 0); + assert (parsePtr->numWords > 0); /* Pre-Compile */ @@ -1830,210 +2080,30 @@ CompileCommandTokens( } } } - /* If cmdPtr != NULL, we will try to call cmdPtr->compileProc */ + /* If cmdPtr != NULL, we will try to call cmdPtr->compileProc */ if (cmdPtr) { - int savedNumCmds = envPtr->numCommands; - int update = 0; - int startStackDepth = envPtr->currStackDepth; - - /* - * Mark the start of the command; the proper bytecode - * length will be updated later. There is no need to - * do this for the first bytecode in the compile env, - * as the check is done before calling - * TclNRExecuteByteCode(). Do emit an INST_START_CMD - * in special cases where the first bytecode is in a - * loop, to insure that the corresponding command is - * counted properly. Compilers for commands able to - * produce such a beast (currently 'while 1' only) set - * envPtr->atCmdStart to 0 in order to signal this - * case. [Bug 1752146] - * - * Note that the environment is initialised with - * atCmdStart=1 to avoid emitting ISC for the first - * command. - */ - - if (envPtr->atCmdStart == 1) { - if (startCodeOffset) { - /* - * Increase the number of commands being - * started at the current point. Note that - * this depends on the exact layout of the - * INST_START_CMD's operands, so be careful! - */ - - TclIncrUInt4AtPtr(envPtr->codeNext - 4, 1) - } - } else if (envPtr->atCmdStart == 0) { - TclEmitInstInt4(INST_START_CMD, 0, envPtr); - TclEmitInt4(1, envPtr); - update = 1; - } - - if (TCL_OK == cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr)) { - -#ifdef TCL_COMPILE_DEBUG - /* - * Confirm that the command compiler generated a - * single value on the stack as its result. This - * is only done in debugging mode, as it *should* - * be correct and normal users have no reasonable - * way to fix it anyway. - */ - - int diff = envPtr->currStackDepth - startStackDepth; - - if (diff != 1) { - Tcl_Panic("bad stack adjustment when compiling" - " %.*s (was %d instead of 1)", - parsePtr->tokenPtr->size, - parsePtr->tokenPtr->start, diff); - } -#endif - if (update) { - /* - * Fix the bytecode length. - */ - - unsigned char *fixPtr = envPtr->codeStart + startCodeOffset + 1; - unsigned fixLen = envPtr->codeNext - fixPtr + 1; - - TclStoreInt4AtPtr(fixLen, fixPtr); - } - goto finishCommand; - } - - if (envPtr->atCmdStart == 1 && startCodeOffset != 0) { - /* - * Decrease the number of commands being started - * at the current point. Note that this depends on - * the exact layout of the INST_START_CMD's - * operands, so be careful! - */ - - TclIncrUInt4AtPtr(envPtr->codeNext - 4, -1); - } - - /* - * Restore numCommands, codeNext, and currStackDepth to their - * correct values, removing any commands compiled before the - * failure to produce bytecode got reported. - * [Bugs 705406, 735055, 3614102] - */ - - envPtr->numCommands = savedNumCmds; - envPtr->codeNext = envPtr->codeStart + startCodeOffset; - envPtr->currStackDepth = startStackDepth; - - envPtr->line = eclPtr->loc[wlineat].line[0]; - envPtr->clNext = eclPtr->loc[wlineat].next[0]; - } - - if (expand < 0) { - expand = ExpandRequested(parsePtr->tokenPtr, parsePtr->numWords); - } - - if (expand) { - StartExpanding(envPtr); - } - - /* - * No complile attempted, or it failed. - * Need to emit instructions to invoke, with expansion if needed. - */ - - wordIdx = 0; - tokenPtr = parsePtr->tokenPtr; - if (cmdKnown) { - int cmdLitIdx, numBytes; - const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); - - cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); - cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); - if (cmdPtr) { - TclSetCmdNameObj(interp, - TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr); - } - TclEmitPush(cmdLitIdx, envPtr); - - wordIdx = 1; - tokenPtr += tokenPtr->numComponents + 1; + code = CompileCmdCompileProc(interp, parsePtr, cmdPtr, + startCodeOffset, envPtr); } - for (; wordIdx < numWords; - wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { - int objIdx; - - envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; - envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; - - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - CompileTokens(envPtr, tokenPtr, interp); - if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - TclEmitInstInt4(INST_EXPAND_STKTOP, - envPtr->currStackDepth, envPtr); - } - continue; - } - - objIdx = TclRegisterNewLiteral(envPtr, - tokenPtr[1].start, tokenPtr[1].size); - if (envPtr->clNext) { - TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), - tokenPtr[1].start - envPtr->source, - eclPtr->loc[wlineat].next[wordIdx]); + if (code == TCL_ERROR) { + if (expand < 0) { + expand = ExpandRequested(parsePtr->tokenPtr, parsePtr->numWords); } - TclEmitPush(objIdx, envPtr); - } - - /* - * Emit an invoke instruction for the command. We skip this if a - * compile procedure was found for the command. - */ - if (expand) { - /* - * The stack depth during argument expansion can only be - * managed at runtime, as the number of elements in the - * expanded lists is not known at compile time. We adjust here - * the stack depth estimate so that it is correct after the - * command with expanded arguments returns. - * - * The end effect of this command's invocation is that all the - * words of the command are popped from the stack, and the - * result is pushed: the stack top changes by (1-wordIdx). - * - * Note that the estimates are not correct while the command - * is being prepared and run, INST_EXPAND_STKTOP is not - * stack-neutral in general. - */ - - TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); - envPtr->expandCount--; - TclAdjustStackDepth(1 - wordIdx, envPtr); - } else { - /* - * Save PC -> command map for the TclArgumentBC* functions. - */ - - int isnew; - Tcl_HashEntry *hePtr = Tcl_CreateHashEntry(&eclPtr->litInfo, - INT2PTR(envPtr->codeNext - envPtr->codeStart), &isnew); - - Tcl_SetHashValue(hePtr, INT2PTR(wlineat)); - if (wordIdx <= 255) { - TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); + if (expand) { + CompileExpanded(interp, parsePtr->tokenPtr, + cmdKnown ? cmdObj : NULL, parsePtr->numWords, wlineat, + envPtr); } else { - TclEmitInstInt4(INST_INVOKE_STK4, wordIdx, envPtr); + CompileInvocation(interp, parsePtr->tokenPtr, + cmdKnown ? cmdObj : NULL, parsePtr->numWords, wlineat, + envPtr); } } -finishCommand: - if (cmdKnown) { - Tcl_DecrRefCount(cmdObj); - } + Tcl_DecrRefCount(cmdObj); TclEmitOpcode(INST_POP, envPtr); EnterCmdExtentData(envPtr, cmdIdx, -- cgit v0.12 From ae8d32e17d3ddc932def49dc45643928d7fe97ea Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Jul 2013 18:55:23 +0000 Subject: Unbreak MSVC6 debug build (thanks Andreas Kupries!) --- generic/tclUtf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index a122685..a038f8a 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1554,7 +1554,7 @@ Tcl_UniCharIsSpace( */ if (((Tcl_UniChar) ch) < ((Tcl_UniChar) 0x80)) { - return TclIsSpaceProc(ch); + return TclIsSpaceProc((char) ch); } else if ((Tcl_UniChar) ch == 0x180e) { return 1; } else { -- cgit v0.12 From 8127bc5dd162ce6a44aa4bdcb28f378ae8663514 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 19:29:01 +0000 Subject: Factor out compiling the Command literal. --- generic/tclCompile.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 1958d47..a1ad5c8 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1761,6 +1761,23 @@ ExpandRequested( } static void +CompileCmdLiteral( + Tcl_Interp *interp, + Tcl_Obj *cmdObj, + CompileEnv *envPtr) +{ + int numBytes; + const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); + int cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); + Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); + + if (cmdPtr) { + TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr); + } + TclEmitPush(cmdLitIdx, envPtr); +} + +static void CompileInvocation( Tcl_Interp *interp, Tcl_Token *tokenPtr, @@ -1773,17 +1790,7 @@ CompileInvocation( ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; if (cmdObj) { - int numBytes; - const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); - int cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); - Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); - - if (cmdPtr) { - TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLitIdx), - cmdPtr); - } - TclEmitPush(cmdLitIdx, envPtr); - + CompileCmdLiteral(interp, cmdObj, envPtr); wordIdx = 1; tokenPtr += tokenPtr->numComponents + 1; } @@ -1839,17 +1846,7 @@ CompileExpanded( StartExpanding(envPtr); if (cmdObj) { - int numBytes; - const char *bytes = Tcl_GetStringFromObj(cmdObj, &numBytes); - int cmdLitIdx = TclRegisterNewCmdLiteral(envPtr, bytes, numBytes); - Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdObj); - - if (cmdPtr) { - TclSetCmdNameObj(interp, - TclFetchLiteral(envPtr, cmdLitIdx), cmdPtr); - } - TclEmitPush(cmdLitIdx, envPtr); - + CompileCmdLiteral(interp, cmdObj, envPtr); wordIdx = 1; tokenPtr += tokenPtr->numComponents + 1; } -- cgit v0.12 From 13eca0490a3b888d3858a8a27f12a779d4a8235f Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 22:36:55 +0000 Subject: Use TIP 280 macros. --- generic/tclCompile.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index a1ad5c8..656f700 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1906,11 +1906,10 @@ CompileCmdCompileProc( int startCodeOffset, CompileEnv *envPtr) { - ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; int savedNumCmds = envPtr->numCommands; int startStackDepth = envPtr->currStackDepth; - int wlineat = eclPtr->nuloc - 1; int update = 0; + DefineLineInformation; /* * Mark the start of the command; the proper bytecode @@ -2001,8 +2000,7 @@ CompileCmdCompileProc( envPtr->codeNext = envPtr->codeStart + startCodeOffset; envPtr->currStackDepth = startStackDepth; - envPtr->line = eclPtr->loc[wlineat].line[0]; - envPtr->clNext = eclPtr->loc[wlineat].next[0]; + SetLineInformation(0); return TCL_ERROR; } -- cgit v0.12 From 05741eb1bdedbef1fd4b526cd8ddd3f887d59490 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 8 Jul 2013 23:02:44 +0000 Subject: Use the TokenAfter() macro. --- generic/tclCompile.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 656f700..afe34b0 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1755,7 +1755,7 @@ ExpandRequested( if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { return 1; } - tokenPtr += tokenPtr->numComponents + 1; + tokenPtr = TokenAfter(tokenPtr); } return 0; } @@ -1792,11 +1792,10 @@ CompileInvocation( if (cmdObj) { CompileCmdLiteral(interp, cmdObj, envPtr); wordIdx = 1; - tokenPtr += tokenPtr->numComponents + 1; + tokenPtr = TokenAfter(tokenPtr); } - for (; wordIdx < numWords; - wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { + for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) { int objIdx; envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; @@ -1848,11 +1847,10 @@ CompileExpanded( if (cmdObj) { CompileCmdLiteral(interp, cmdObj, envPtr); wordIdx = 1; - tokenPtr += tokenPtr->numComponents + 1; + tokenPtr = TokenAfter(tokenPtr); } - for (; wordIdx < numWords; - wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { + for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) { int objIdx; envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; -- cgit v0.12 From c2d2ec2ecab6696829da18c4e7174a90e42f9138 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 9 Jul 2013 20:37:37 +0000 Subject: Tentative Work In Progress unwinding TIP 280 line information. --- generic/tclCompile.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index afe34b0..777c03e 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1787,7 +1787,8 @@ CompileInvocation( CompileEnv *envPtr) { int isnew, wordIdx = 0; - ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; +// ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + DefineLineInformation; if (cmdObj) { CompileCmdLiteral(interp, cmdObj, envPtr); @@ -1798,8 +1799,9 @@ CompileInvocation( for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) { int objIdx; - envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; - envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; +// envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; +// envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; + SetLineInformation(wordIdx); if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { CompileTokens(envPtr, tokenPtr, interp); @@ -1811,7 +1813,8 @@ CompileInvocation( if (envPtr->clNext) { TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), tokenPtr[1].start - envPtr->source, - eclPtr->loc[wlineat].next[wordIdx]); +// eclPtr->loc[wlineat].next[wordIdx]); + mapPtr->loc[eclIndex].next[wordIdx]); } TclEmitPush(objIdx, envPtr); } @@ -1820,9 +1823,11 @@ CompileInvocation( * Save PC -> command map for the TclArgumentBC* functions. */ - Tcl_SetHashValue(Tcl_CreateHashEntry(&eclPtr->litInfo, +// Tcl_SetHashValue(Tcl_CreateHashEntry(&eclPtr->litInfo, + Tcl_SetHashValue(Tcl_CreateHashEntry(&mapPtr->litInfo, INT2PTR(envPtr->codeNext - envPtr->codeStart), &isnew), - INT2PTR(wlineat)); +// INT2PTR(wlineat)); + INT2PTR(eclIndex)); if (wordIdx <= 255) { TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); @@ -1841,7 +1846,9 @@ CompileExpanded( CompileEnv *envPtr) { int wordIdx = 0; - ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + DefineLineInformation; +// ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + StartExpanding(envPtr); if (cmdObj) { @@ -1853,8 +1860,9 @@ CompileExpanded( for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) { int objIdx; - envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; - envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; + SetLineInformation(wordIdx); +// envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; +// envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { CompileTokens(envPtr, tokenPtr, interp); @@ -1870,7 +1878,8 @@ CompileExpanded( if (envPtr->clNext) { TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), tokenPtr[1].start - envPtr->source, - eclPtr->loc[wlineat].next[wordIdx]); +// eclPtr->loc[wlineat].next[wordIdx]); + mapPtr->loc[eclIndex].next[wordIdx]); } TclEmitPush(objIdx, envPtr); } @@ -1998,6 +2007,16 @@ CompileCmdCompileProc( envPtr->codeNext = envPtr->codeStart + startCodeOffset; envPtr->currStackDepth = startStackDepth; + /* + * Throw out any line information generated by the failed + * compile attempt. + */ + while (mapPtr->nuloc - 1 > eclIndex) { + mapPtr->nuloc--; + ckfree(mapPtr->loc[mapPtr->nuloc].line); + mapPtr->loc[mapPtr->nuloc].line = NULL; + } + SetLineInformation(0); return TCL_ERROR; } -- cgit v0.12 From ea62135f72eea3a5096735196d59c2b6785e942e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 03:17:57 +0000 Subject: Revise the litInfo table so that it gets built later (in TclInitByteCodeObj) from a simpler store of data that can unwind. --- generic/tclCompile.c | 79 +++++++++++++--------------------------------------- generic/tclCompile.h | 1 + 2 files changed, 20 insertions(+), 60 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 777c03e..c31d256 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1786,8 +1786,7 @@ CompileInvocation( int wlineat, CompileEnv *envPtr) { - int isnew, wordIdx = 0; -// ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; + int wordIdx = 0; DefineLineInformation; if (cmdObj) { @@ -1799,8 +1798,6 @@ CompileInvocation( for (; wordIdx < numWords; wordIdx++, tokenPtr = TokenAfter(tokenPtr)) { int objIdx; -// envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; -// envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; SetLineInformation(wordIdx); if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { @@ -1813,7 +1810,6 @@ CompileInvocation( if (envPtr->clNext) { TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), tokenPtr[1].start - envPtr->source, -// eclPtr->loc[wlineat].next[wordIdx]); mapPtr->loc[eclIndex].next[wordIdx]); } TclEmitPush(objIdx, envPtr); @@ -1823,11 +1819,7 @@ CompileInvocation( * Save PC -> command map for the TclArgumentBC* functions. */ -// Tcl_SetHashValue(Tcl_CreateHashEntry(&eclPtr->litInfo, - Tcl_SetHashValue(Tcl_CreateHashEntry(&mapPtr->litInfo, - INT2PTR(envPtr->codeNext - envPtr->codeStart), &isnew), -// INT2PTR(wlineat)); - INT2PTR(eclIndex)); + mapPtr->loc[eclIndex].invokePc = envPtr->codeNext - envPtr->codeStart; if (wordIdx <= 255) { TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); @@ -1847,7 +1839,6 @@ CompileExpanded( { int wordIdx = 0; DefineLineInformation; -// ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; StartExpanding(envPtr); @@ -1861,8 +1852,6 @@ CompileExpanded( int objIdx; SetLineInformation(wordIdx); -// envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; -// envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { CompileTokens(envPtr, tokenPtr, interp); @@ -1878,7 +1867,6 @@ CompileExpanded( if (envPtr->clNext) { TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), tokenPtr[1].start - envPtr->source, -// eclPtr->loc[wlineat].next[wordIdx]); mapPtr->loc[eclIndex].next[wordIdx]); } TclEmitPush(objIdx, envPtr); @@ -2015,6 +2003,7 @@ CompileCmdCompileProc( mapPtr->nuloc--; ckfree(mapPtr->loc[mapPtr->nuloc].line); mapPtr->loc[mapPtr->nuloc].line = NULL; + mapPtr->loc[mapPtr->nuloc].invokePc = -1; } SetLineInformation(0); @@ -3340,6 +3329,17 @@ TclInitByteCodeObj( * byte code object (internal rep), for use with the bc compiler. */ + for (i = 0; i < envPtr->extCmdMapPtr->nuloc; i++) { + int isnew, pc = envPtr->extCmdMapPtr->loc[i].invokePc; + + if (pc < 0) { + continue; + } + + Tcl_SetHashValue(Tcl_CreateHashEntry(&envPtr->extCmdMapPtr->litInfo, + INT2PTR(pc), &isnew), INT2PTR(i)); + } + Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->lineBCPtr, codePtr, &isNew), envPtr->extCmdMapPtr); envPtr->extCmdMapPtr = NULL; @@ -3710,6 +3710,7 @@ EnterCmdWordData( ePtr = &eclPtr->loc[eclPtr->nuloc]; ePtr->srcOffset = srcOffset; + ePtr->invokePc = -1; ePtr->line = ckalloc(numWords * sizeof(int)); ePtr->next = ckalloc(numWords * sizeof(int *)); ePtr->nline = numWords; @@ -4493,54 +4494,12 @@ TclFixupForwardJump( { ExtCmdLoc* eclPtr = envPtr->extCmdMapPtr; - - /* A helper structure */ - - typedef struct { - int pc; - int cmd; - } MAP; - - /* - * And the helper array. At most the whole hashtable is placed into - * this. - */ - - MAP *map = (MAP*) ckalloc (sizeof(MAP) * eclPtr->litInfo.numEntries); - - Tcl_HashSearch hSearch; - Tcl_HashEntry* hPtr; - int n, k, isnew; - - /* - * Phase I: Locate the affected entries, and save them in adjusted - * form to the array. This removes them from the hash. - */ - - for (n = 0, hPtr = Tcl_FirstHashEntry(&eclPtr->litInfo, &hSearch); - hPtr != NULL; - hPtr = Tcl_NextHashEntry(&hSearch)) { - - map [n].cmd = PTR2INT(Tcl_GetHashValue(hPtr)); - map [n].pc = PTR2INT(Tcl_GetHashKey (&eclPtr->litInfo,hPtr)); - - if (map[n].pc >= (jumpFixupPtr->codeOffset + 2)) { - Tcl_DeleteHashEntry(hPtr); - map [n].pc += 3; - n++; + for (k = eclPtr->nuloc - 1; k >= 0; k--) { + if (eclPtr->loc[k].invokePc < (jumpFixupPtr->codeOffset + 2)) { + continue; } + eclPtr->loc[k].invokePc += 3; } - - /* - * Phase II: Re-insert the modified entries into the hash. - */ - - for (k=0;klitInfo, INT2PTR(map[k].pc), &isnew); - Tcl_SetHashValue(hPtr, INT2PTR(map[k].cmd)); - } - - ckfree (map); } return 1; /* the jump was grown */ diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 9af4911..cbe104c 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -175,6 +175,7 @@ typedef struct CmdLocation { typedef struct ECL { int srcOffset; /* Command location to find the entry. */ + int invokePc; int nline; /* Number of words in the command */ int *line; /* Line information for all words in the * command. */ -- cgit v0.12 From 98b5a1b51d301f8712ef1dd7e9a321804d93ba02 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 03:28:37 +0000 Subject: Remove the (now unused) wlineat arguments. --- generic/tclCompile.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index c31d256..5f4acff 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1783,7 +1783,6 @@ CompileInvocation( Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords, - int wlineat, CompileEnv *envPtr) { int wordIdx = 0; @@ -1834,7 +1833,6 @@ CompileExpanded( Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords, - int wlineat, CompileEnv *envPtr) { int wordIdx = 0; @@ -2095,12 +2093,10 @@ CompileCommandTokens( if (expand) { CompileExpanded(interp, parsePtr->tokenPtr, - cmdKnown ? cmdObj : NULL, parsePtr->numWords, wlineat, - envPtr); + cmdKnown ? cmdObj : NULL, parsePtr->numWords, envPtr); } else { CompileInvocation(interp, parsePtr->tokenPtr, - cmdKnown ? cmdObj : NULL, parsePtr->numWords, wlineat, - envPtr); + cmdKnown ? cmdObj : NULL, parsePtr->numWords, envPtr); } } -- cgit v0.12 From 79cd9409e13c0854f7eb3f04d970e44b30c3ec7d Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 16:17:12 +0000 Subject: Disabling the SetLineInformation() macro entirely causes only 3 tests in the test suite to fail. Restoring just 2 SetLineInformation() calls fixes those failures. The need for all the other SLI() calls is not demonstrated by any test. Without more complete test coverage, it is difficult to confidently tweak the TIP 280 implementation without fear that changes are introducing breakage. --- generic/tclCompCmdsGR.c | 2 ++ generic/tclCompCmdsSZ.c | 2 ++ generic/tclCompile.h | 9 ++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index f7c15e6..3cd0da6 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -265,6 +265,8 @@ TclCompileIfCmd( if (compileScripts) { SetLineInformation(wordIdx); +envPtr->line = mapPtr->loc[eclIndex].line[wordIdx]; +envPtr->clNext = mapPtr->loc[eclIndex].next[wordIdx]; CompileBody(envPtr, tokenPtr, interp); } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 855dd8f..8723a4f 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -726,6 +726,8 @@ TclCompileSubstCmd( } SetLineInformation(numArgs); +envPtr->line = mapPtr->loc[eclIndex].line[numArgs]; +envPtr->clNext = mapPtr->loc[eclIndex].next[numArgs]; TclSubstCompile(interp, wordTokenPtr[1].start, wordTokenPtr[1].size, flags, mapPtr->loc[eclIndex].line[numArgs], envPtr); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 9af4911..6fe14f2 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1537,9 +1537,12 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ int eclIndex = mapPtr->nuloc - 1 -#define SetLineInformation(word) \ - envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] +//#define SetLineInformation(word) \ +// envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ +// envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] + +#define SetLineInformation(word) + #define PushVarNameWord(i,v,e,f,l,sc,word) \ TclPushVarName(i,v,e,f,l,sc, \ -- cgit v0.12 From 55deb86ee331985bbfedb4d5211968c4dbe1decd Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 16:27:09 +0000 Subject: First additional test. Remove dup macros in tclEnsemble.c. --- generic/tclCompCmds.c | 2 +- generic/tclCompCmdsGR.c | 4 +--- generic/tclCompCmdsSZ.c | 4 +--- generic/tclCompile.h | 6 +++--- generic/tclEnsemble.c | 10 ---------- tests/info.test | 15 +++++++++++++++ 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index fddf152..7ed9006 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -610,7 +610,7 @@ TclCompileCatchCmd( * begin by undeflowing the stack below the mark set by BEGIN_CATCH4. */ - SetLineInformation(1); + LineInformation(1); if (cmdTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 3cd0da6..cc3f694 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -264,9 +264,7 @@ TclCompileIfCmd( */ if (compileScripts) { - SetLineInformation(wordIdx); -envPtr->line = mapPtr->loc[eclIndex].line[wordIdx]; -envPtr->clNext = mapPtr->loc[eclIndex].next[wordIdx]; + LineInformation(wordIdx); CompileBody(envPtr, tokenPtr, interp); } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 8723a4f..34c24f9 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -725,9 +725,7 @@ TclCompileSubstCmd( return TCL_ERROR; } - SetLineInformation(numArgs); -envPtr->line = mapPtr->loc[eclIndex].line[numArgs]; -envPtr->clNext = mapPtr->loc[eclIndex].next[numArgs]; + LineInformation(numArgs); TclSubstCompile(interp, wordTokenPtr[1].start, wordTokenPtr[1].size, flags, mapPtr->loc[eclIndex].line[numArgs], envPtr); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 6fe14f2..5043f65 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1537,9 +1537,9 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ int eclIndex = mapPtr->nuloc - 1 -//#define SetLineInformation(word) \ -// envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ -// envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] +#define LineInformation(word) \ + envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ + envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] #define SetLineInformation(word) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 813e056..e0aa0c4 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -88,16 +88,6 @@ const Tcl_ObjType tclEnsembleCmdType = { NULL /* setFromAnyProc */ }; -/* - * Copied from tclCompCmds.c - */ - -#define DefineLineInformation \ - ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ - int eclIndex = mapPtr->nuloc - 1 -#define SetLineInformation(word) \ - envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] static inline Tcl_Obj * NewNsObj( diff --git a/tests/info.test b/tests/info.test index ebc853a..a1d3b1a 100644 --- a/tests/info.test +++ b/tests/info.test @@ -1962,6 +1962,21 @@ test info-9.13 {info level option, value in global context} -body { } -returnCodes error -result {bad level "2"} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + catch {*}{ + {info frame 0} + res + } + return $res +} +test info-33.4 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 1968 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From acd32d6e7090b829a7d5e1aec2e6b09f987aaccc Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 16:43:01 +0000 Subject: Next attempt. Appears to have uncovered a bug. --- generic/tclCompCmds.c | 2 +- tests/info.test | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7ed9006..13318a3 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1467,7 +1467,7 @@ CompileDictEachCmd( * Compile the loop body itself. It should be stack-neutral. */ - SetLineInformation(3); + LineInformation(3); CompileBody(envPtr, bodyTokenPtr, interp); if (collect == TCL_EACH_COLLECT) { Emit14Inst( INST_LOAD_SCALAR, keyVarIndex, envPtr); diff --git a/tests/info.test b/tests/info.test index a1d3b1a..ba31159 100644 --- a/tests/info.test +++ b/tests/info.test @@ -1977,6 +1977,20 @@ test info-33.4 {{*}, literal, simple, bytecompiled} -body { } -result {type source line 1968 file info.test cmd {info frame 0} proc ::foo::bar level 0} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + dict for {a b} {c d} {*}{ + {set res [info frame 0]} + } + return $res +} +test info-33.5 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 1983 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From fceaf9997d7c45ba92c6c61930207823446f1e50 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 17:58:45 +0000 Subject: Fix for [86fb5ea28e]. Test will eventually merge in from tip280-test-coverage. --- generic/tclEnsemble.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 813e056..a718d0e 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3059,6 +3059,7 @@ CompileToCompiledCommand( int savedNumCmds = envPtr->numCommands; int savedStackDepth = envPtr->currStackDepth; unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart; + DefineLineInformation; if (cmdPtr->compileProc == NULL) { return TCL_ERROR; @@ -3107,12 +3108,27 @@ CompileToCompiledCommand( } /* + * Shift the line information arrays to account for different word + * index values. + */ + + mapPtr->loc[eclIndex].line += (depth - 1); + mapPtr->loc[eclIndex].next += (depth - 1); + + /* * Hand off compilation to the subcommand compiler. At last! */ result = cmdPtr->compileProc(interp, &synthetic, cmdPtr, envPtr); /* + * Undo the shift. + */ + + mapPtr->loc[eclIndex].line -= (depth - 1); + mapPtr->loc[eclIndex].next -= (depth - 1); + + /* * If our target fails to compile, revert the number of commands and the * pointer to the place to issue the next instruction. [Bug 3600328] */ -- cgit v0.12 From 6f87f7f3302077aa68a48258e328bbf2ee5abd51 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 19:34:55 +0000 Subject: Add tests for, and fix bugs in, the SetLineInformation() calls in tclCompCmds.c. --- generic/tclCompCmds.c | 20 ++++----- tests/info.test | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 11 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 13318a3..28a3e64 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1651,7 +1651,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - SetLineInformation(parsePtr->numWords - 1); + LineInformation(parsePtr->numWords - 1); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); @@ -1992,7 +1992,7 @@ TclCompileDictWithCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - SetLineInformation(parsePtr->numWords-1); + LineInformation(parsePtr->numWords-1); CompileBody(envPtr, tokenPtr, interp); ExceptionRangeEnds(envPtr, range); @@ -2268,7 +2268,7 @@ TclCompileForCmd( * Inline compile the initial command. */ - SetLineInformation(1); + LineInformation(1); CompileBody(envPtr, startTokenPtr, interp); TclEmitOpcode(INST_POP, envPtr); @@ -2292,7 +2292,7 @@ TclCompileForCmd( bodyRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); bodyCodeOffset = ExceptionRangeStarts(envPtr, bodyRange); - SetLineInformation(4); + LineInformation(4); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, bodyRange); TclEmitOpcode(INST_POP, envPtr); @@ -2306,7 +2306,7 @@ TclCompileForCmd( nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); envPtr->exceptAuxArrayPtr[nextRange].supportsContinue = 0; nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange); - SetLineInformation(3); + LineInformation(3); CompileBody(envPtr, nextTokenPtr, interp); ExceptionRangeEnds(envPtr, nextRange); TclEmitOpcode(INST_POP, envPtr); @@ -2325,7 +2325,7 @@ TclCompileForCmd( testCodeOffset += 3; } - SetLineInformation(2); + LineInformation(2); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); jumpDist = CurrentOffset(envPtr) - bodyCodeOffset; @@ -2464,7 +2464,7 @@ CompileEachloopCmd( Tcl_Token *tokenPtr, *bodyTokenPtr; unsigned char *jumpPc; JumpFixup jumpFalseFixup; - int jumpBackDist, jumpBackOffset, infoIndex, range, bodyIndex; + int jumpBackDist, jumpBackOffset, infoIndex, range; int numWords, numLists, numVars, loopIndex, tempVar, i, j, code; DefineLineInformation; /* TIP #280 */ @@ -2504,8 +2504,6 @@ CompileEachloopCmd( return TCL_ERROR; } - bodyIndex = i-1; - /* * Allocate storage for the varcList and varvList arrays if necessary. */ @@ -2646,7 +2644,7 @@ CompileEachloopCmd( i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { if ((i%2 == 0) && (i > 0)) { - SetLineInformation(i); + LineInformation(i); CompileTokens(envPtr, tokenPtr, interp); tempVar = (firstValueTemp + loopIndex); Emit14Inst( INST_STORE_SCALAR, tempVar, envPtr); @@ -2684,7 +2682,7 @@ CompileEachloopCmd( * Inline compile the loop body. */ - SetLineInformation(bodyIndex); + LineInformation(numWords - 1); ExceptionRangeStarts(envPtr, range); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); diff --git a/tests/info.test b/tests/info.test index ba31159..98bb724 100644 --- a/tests/info.test +++ b/tests/info.test @@ -1991,6 +1991,124 @@ test info-33.5 {{*}, literal, simple, bytecompiled} -body { } -result {type source line 1983 file info.test cmd {info frame 0} proc ::foo::bar level 0} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + set d {a b} + dict update d x y {*}{ + {set res [info frame 0]} + } + return $res +} +test info-33.6 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 1998 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + set d {} + dict with d {*}{ + {set res [info frame 0]} + } + return $res +} +test info-33.7 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2013 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + for {*}{ + {set res [info frame 0]} + {1} {} {break} + } + return $res +} +test info-33.8 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2027 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + for {*}{ + {} {1} {} + {set res [info frame 0]; break} + } + return $res +} +test info-33.9 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2043 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + for {*}{ + {} {1} + {return [info frame 0]} + {} + } +} +test info-33.10 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2058 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + for {*}{ + {} + {[return [info frame 0]]} + {} {} + } +} +test info-33.11 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2073 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + foreach {*}{ + x + } [return [info frame 0]] {} +} +test info-33.12 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2088 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + foreach {*}{ + x y + {set res [info frame 0]} + } + return $res +} +test info-33.13 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2101 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From ef77c88392ff7b5d78b792b9d684a4ba30d175cc Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 19:43:56 +0000 Subject: Add tests for SetLineInformation() calls in tclCompCmdsGR.c. --- generic/tclCompCmdsGR.c | 8 ++++---- tests/info.test | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index cc3f694..32514ab 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -222,7 +222,7 @@ TclCompileIfCmd( compileScripts = 0; } } else { - SetLineInformation(wordIdx); + LineInformation(wordIdx); Tcl_ResetResult(interp); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) { @@ -345,7 +345,7 @@ TclCompileIfCmd( * Compile the else command body. */ - SetLineInformation(wordIdx); + LineInformation(wordIdx); CompileBody(envPtr, tokenPtr, interp); } @@ -474,7 +474,7 @@ TclCompileIncrCmd( PushLiteral(envPtr, word, numBytes); } } else { - SetLineInformation(2); + LineInformation(2); CompileTokens(envPtr, incrTokenPtr, interp); } } else { /* No incr amount given so use 1. */ @@ -701,7 +701,7 @@ TclCompileInfoLevelCmd( * list of arguments. */ - SetLineInformation(1); + LineInformation(1); CompileTokens(envPtr, TokenAfter(parsePtr->tokenPtr), interp); TclEmitOpcode( INST_INFO_LEVEL_ARGS, envPtr); } diff --git a/tests/info.test b/tests/info.test index 98bb724..98f6ea7 100644 --- a/tests/info.test +++ b/tests/info.test @@ -2109,6 +2109,59 @@ test info-33.13 {{*}, literal, simple, bytecompiled} -body { } -result {type source line 2101 file info.test cmd {info frame 0} proc ::foo::bar level 0} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + if {*}{ + {[return [info frame 0]]} + {} + } +} +test info-33.14 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2115 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + if 0 {*}{ + {} else + {return [info frame 0]} + } +} +test info-33.15 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2130 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + incr {*}{ + x + } [return [info frame 0]] +} +test info-33.16 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2144 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + info level {*}{ + } [return [info frame 0]] +} +test info-33.16 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2156 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From fe3f5136f96353b1b0d77700e4c4ef6256eb1e55 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 10 Jul 2013 20:33:45 +0000 Subject: Add tests for SetLineInformation() calls in tclCompCmdsSZ.c as well as some obvious refactoring improvements. --- generic/tclCompCmdsSZ.c | 66 ++++++----------- tests/info.test | 186 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 206 insertions(+), 46 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 34c24f9..d5208e6 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -40,17 +40,14 @@ static int CompileUnaryOpCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, int instruction, CompileEnv *envPtr); static void IssueSwitchChainedTests(Tcl_Interp *interp, - CompileEnv *envPtr, ExtCmdLoc *mapPtr, - int eclIndex, int mode, int noCase, - int valueIndex, Tcl_Token *valueTokenPtr, - int numWords, Tcl_Token **bodyToken, - int *bodyLines, int **bodyNext); -static void IssueSwitchJumpTable(Tcl_Interp *interp, - CompileEnv *envPtr, ExtCmdLoc *mapPtr, - int eclIndex, int valueIndex, - Tcl_Token *valueTokenPtr, int numWords, + CompileEnv *envPtr, int mode, int noCase, + int valueIndex, int numWords, Tcl_Token **bodyToken, int *bodyLines, - int **bodyContLines); + int **bodyNext); +static void IssueSwitchJumpTable(Tcl_Interp *interp, + CompileEnv *envPtr, int valueIndex, + int numWords, Tcl_Token **bodyToken, + int *bodyLines, int **bodyContLines); static int IssueTryClausesInstructions(Tcl_Interp *interp, CompileEnv *envPtr, Tcl_Token *bodyToken, int numHandlers, int *matchCodes, @@ -89,7 +86,7 @@ const AuxDataType tclJumptableInfoType = { #define OP44(name,val1,val2) \ TclEmitInstInt4(INST_##name,(val1),envPtr);TclEmitInt4((val2),envPtr) #define BODY(token,index) \ - SetLineInformation((index));CompileBody(envPtr,(token),interp) + LineInformation((index));CompileBody(envPtr,(token),interp) #define PUSH(str) \ PushStringLiteral(envPtr, str) #define JUMP4(name,var) \ @@ -436,7 +433,7 @@ TclCompileStringMatchCmd( } PushLiteral(envPtr, str, length); } else { - SetLineInformation(i+1+nocase); + LineInformation(i+1+nocase); CompileTokens(envPtr, tokenPtr, interp); } tokenPtr = TokenAfter(tokenPtr); @@ -486,7 +483,7 @@ TclCompileStringLenCmd( len = sprintf(buf, "%d", len); PushLiteral(envPtr, buf, len); } else { - SetLineInformation(1); + LineInformation(1); CompileTokens(envPtr, tokenPtr, interp); TclEmitOpcode(INST_STR_LEN, envPtr); } @@ -1286,13 +1283,16 @@ TclCompileSwitchCmd( * but it handles the most common case well enough. */ + /* Both methods push the value to match against onto the stack. */ + LineInformation(valueIndex); + CompileTokens(envPtr, valueTokenPtr, interp); + if (mode == Switch_Exact) { - IssueSwitchJumpTable(interp, envPtr, mapPtr, eclIndex, valueIndex, - valueTokenPtr, numWords, bodyToken, bodyLines, bodyContLines); + IssueSwitchJumpTable(interp, envPtr, valueIndex, numWords, bodyToken, + bodyLines, bodyContLines); } else { - IssueSwitchChainedTests(interp, envPtr, mapPtr, eclIndex, mode,noCase, - valueIndex, valueTokenPtr, numWords, bodyToken, bodyLines, - bodyContLines); + IssueSwitchChainedTests(interp, envPtr, mode, noCase, valueIndex, + numWords, bodyToken, bodyLines, bodyContLines); } result = TCL_OK; @@ -1330,13 +1330,9 @@ static void IssueSwitchChainedTests( Tcl_Interp *interp, /* Context for compiling script bodies. */ CompileEnv *envPtr, /* Holds resulting instructions. */ - ExtCmdLoc *mapPtr, /* For mapping tokens to their source code - * location. */ - int eclIndex, int mode, /* Exact, Glob or Regexp */ int noCase, /* Case-insensitivity flag. */ int valueIndex, /* The value to match against. */ - Tcl_Token *valueTokenPtr, int numBodyTokens, /* Number of tokens describing things the * switch can match against and bodies to * execute when the match succeeds. */ @@ -1361,13 +1357,6 @@ IssueSwitchChainedTests( int i; /* - * First, we push the value we're matching against on the stack. - */ - - SetLineInformation(valueIndex); - CompileTokens(envPtr, valueTokenPtr, interp); - - /* * Generate a test for each arm. */ @@ -1592,11 +1581,7 @@ static void IssueSwitchJumpTable( Tcl_Interp *interp, /* Context for compiling script bodies. */ CompileEnv *envPtr, /* Holds resulting instructions. */ - ExtCmdLoc *mapPtr, /* For mapping tokens to their source code - * location. */ - int eclIndex, int valueIndex, /* The value to match against. */ - Tcl_Token *valueTokenPtr, int numBodyTokens, /* Number of tokens describing things the * switch can match against and bodies to * execute when the match succeeds. */ @@ -1612,13 +1597,6 @@ IssueSwitchJumpTable( Tcl_HashEntry *hPtr; /* - * First, we push the value we're matching against on the stack. - */ - - SetLineInformation(valueIndex); - CompileTokens(envPtr, valueTokenPtr, interp); - - /* * Compile the switch by using a jump table, which is basically a * hashtable that maps from literal values to match against to the offset * (relative to the INST_JUMP_TABLE instruction) to jump to. The jump @@ -2048,8 +2026,7 @@ TclCompileTryCmd( */ DefineLineInformation; /* TIP #280 */ - SetLineInformation(1); - CompileBody(envPtr, bodyToken, interp); + BODY(bodyToken, 1); return TCL_OK; } @@ -3028,13 +3005,12 @@ TclCompileWhileCmd( * Compile the loop body. */ - SetLineInformation(2); bodyCodeOffset = ExceptionRangeStarts(envPtr, range); if (!loopMayEnd) { envPtr->exceptArrayPtr[range].continueOffset = testCodeOffset; envPtr->exceptArrayPtr[range].codeOffset = bodyCodeOffset; } - CompileBody(envPtr, bodyTokenPtr, interp); + BODY(bodyTokenPtr, 2); ExceptionRangeEnds(envPtr, range); OP( POP); @@ -3050,7 +3026,7 @@ TclCompileWhileCmd( bodyCodeOffset += 3; testCodeOffset += 3; } - SetLineInformation(1); + LineInformation(1); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); jumpDist = CurrentOffset(envPtr) - bodyCodeOffset; diff --git a/tests/info.test b/tests/info.test index 98f6ea7..a68fb43 100644 --- a/tests/info.test +++ b/tests/info.test @@ -2155,13 +2155,197 @@ proc foo::bar {} { info level {*}{ } [return [info frame 0]] } -test info-33.16 {{*}, literal, simple, bytecompiled} -body { +test info-33.17 {{*}, literal, simple, bytecompiled} -body { reduce [foo::bar] } -cleanup { namespace delete foo } -result {type source line 2156 file info.test cmd {info frame 0} proc ::foo::bar level 0} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + string match {*}{ + } [return [info frame 0]] {} +} +test info-33.18 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2168 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + string match {*}{ + {} + } [return [info frame 0]] +} +test info-33.19 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2181 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + string length {*}{ + } [return [info frame 0]] +} +test info-33.20 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2193 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + while {*}{ + {[return [info frame 0]]} + } {} +} +test info-33.21 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2205 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + switch -- {*}{ + } [return [info frame 0]] {*}{ + } x y +} +test info-33.22 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2218 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {*}{ + {set res [info frame 0]} + } + return $res +} +test info-33.23 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2231 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {*}{ + {set res [info frame 0]} + } finally {} + return $res +} +test info-33.24 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2245 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {*}{ + {set res [info frame 0]} + } on ok {} {} + return $res +} +test info-33.25 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2259 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {*}{ + {set res [info frame 0]} + } on ok {} {} finally {} + return $res +} +test info-33.26 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2273 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + while 1 {*}{ + {return [info frame 0]} + } +} +test info-33.27 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2287 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {} finally {*}{ + {return [info frame 0]} + } +} +test info-33.28 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2300 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {} on ok {} {} finally {*}{ + {return [info frame 0]} + } +} +test info-33.29 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2313 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {} on ok {} {*}{ + {return [info frame 0]} + } +} +test info-33.30 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2326 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + try {} on ok {} {*}{ + {return [info frame 0]} + } finally {} +} +test info-33.31 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2339 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From f3a1a26516d79b15224325941f72deb7dfda25f6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Jul 2013 03:48:40 +0000 Subject: Add tests for the SetLineInformation() calls in tclEnsemble.c, and fix the bugs around those calls exposed by the tests. --- generic/tclEnsemble.c | 9 +++------ tests/info.test | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index d654bbf..794a059 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3168,6 +3168,7 @@ CompileToInvokedCommand( bytes = Tcl_GetStringFromObj(words[i-1], &length); PushLiteral(envPtr, bytes, length); } else if (tokPtr->type == TCL_TOKEN_SIMPLE_WORD) { + /* TODO: Check about registering Cmd Literals here */ int literal = TclRegisterNewLiteral(envPtr, tokPtr[1].start, tokPtr[1].size); @@ -3179,9 +3180,7 @@ CompileToInvokedCommand( } TclEmitPush(literal, envPtr); } else { - if (envPtr->clNext) { - SetLineInformation(i); - } + LineInformation(i); CompileTokens(envPtr, tokPtr, interp); } tokPtr = TokenAfter(tokPtr); @@ -3255,12 +3254,10 @@ CompileBasicNArgCommand( tokenPtr = TokenAfter(parsePtr->tokenPtr); for (i=1 ; inumWords ; i++) { - if (envPtr->clNext) { - SetLineInformation(i); - } if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { PushLiteral(envPtr, tokenPtr[1].start, tokenPtr[1].size); } else { + LineInformation(i); CompileTokens(envPtr, tokenPtr, interp); } tokenPtr = TokenAfter(tokenPtr); diff --git a/tests/info.test b/tests/info.test index a68fb43..afdaaee 100644 --- a/tests/info.test +++ b/tests/info.test @@ -2346,6 +2346,31 @@ test info-33.31 {{*}, literal, simple, bytecompiled} -body { } -result {type source line 2339 file info.test cmd {info frame 0} proc ::foo::bar level 0} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + binary format {*}{ + } [return [info frame 0]] +} +test info-33.32 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2352 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + set format format + binary $format {*}{ + } [return [info frame 0]] +} +test info-33.33 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2365 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From ac62d0c4970dfe3fa03f4fa77c05d23943a20671 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Jul 2013 04:00:57 +0000 Subject: Revert the revised macros used in developing the new tests. --- generic/tclCompCmds.c | 20 ++++++++++---------- generic/tclCompCmdsGR.c | 10 +++++----- generic/tclCompCmdsSZ.c | 12 ++++++------ generic/tclCompile.h | 5 +---- generic/tclEnsemble.c | 4 ++-- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 28a3e64..a56727d 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -610,7 +610,7 @@ TclCompileCatchCmd( * begin by undeflowing the stack below the mark set by BEGIN_CATCH4. */ - LineInformation(1); + SetLineInformation(1); if (cmdTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); @@ -1467,7 +1467,7 @@ CompileDictEachCmd( * Compile the loop body itself. It should be stack-neutral. */ - LineInformation(3); + SetLineInformation(3); CompileBody(envPtr, bodyTokenPtr, interp); if (collect == TCL_EACH_COLLECT) { Emit14Inst( INST_LOAD_SCALAR, keyVarIndex, envPtr); @@ -1651,7 +1651,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - LineInformation(parsePtr->numWords - 1); + SetLineInformation(parsePtr->numWords - 1); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); @@ -1992,7 +1992,7 @@ TclCompileDictWithCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - LineInformation(parsePtr->numWords-1); + SetLineInformation(parsePtr->numWords-1); CompileBody(envPtr, tokenPtr, interp); ExceptionRangeEnds(envPtr, range); @@ -2268,7 +2268,7 @@ TclCompileForCmd( * Inline compile the initial command. */ - LineInformation(1); + SetLineInformation(1); CompileBody(envPtr, startTokenPtr, interp); TclEmitOpcode(INST_POP, envPtr); @@ -2292,7 +2292,7 @@ TclCompileForCmd( bodyRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); bodyCodeOffset = ExceptionRangeStarts(envPtr, bodyRange); - LineInformation(4); + SetLineInformation(4); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, bodyRange); TclEmitOpcode(INST_POP, envPtr); @@ -2306,7 +2306,7 @@ TclCompileForCmd( nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); envPtr->exceptAuxArrayPtr[nextRange].supportsContinue = 0; nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange); - LineInformation(3); + SetLineInformation(3); CompileBody(envPtr, nextTokenPtr, interp); ExceptionRangeEnds(envPtr, nextRange); TclEmitOpcode(INST_POP, envPtr); @@ -2325,7 +2325,7 @@ TclCompileForCmd( testCodeOffset += 3; } - LineInformation(2); + SetLineInformation(2); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); jumpDist = CurrentOffset(envPtr) - bodyCodeOffset; @@ -2644,7 +2644,7 @@ CompileEachloopCmd( i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { if ((i%2 == 0) && (i > 0)) { - LineInformation(i); + SetLineInformation(i); CompileTokens(envPtr, tokenPtr, interp); tempVar = (firstValueTemp + loopIndex); Emit14Inst( INST_STORE_SCALAR, tempVar, envPtr); @@ -2682,7 +2682,7 @@ CompileEachloopCmd( * Inline compile the loop body. */ - LineInformation(numWords - 1); + SetLineInformation(numWords - 1); ExceptionRangeStarts(envPtr, range); CompileBody(envPtr, bodyTokenPtr, interp); ExceptionRangeEnds(envPtr, range); diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 32514ab..f7c15e6 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -222,7 +222,7 @@ TclCompileIfCmd( compileScripts = 0; } } else { - LineInformation(wordIdx); + SetLineInformation(wordIdx); Tcl_ResetResult(interp); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) { @@ -264,7 +264,7 @@ TclCompileIfCmd( */ if (compileScripts) { - LineInformation(wordIdx); + SetLineInformation(wordIdx); CompileBody(envPtr, tokenPtr, interp); } @@ -345,7 +345,7 @@ TclCompileIfCmd( * Compile the else command body. */ - LineInformation(wordIdx); + SetLineInformation(wordIdx); CompileBody(envPtr, tokenPtr, interp); } @@ -474,7 +474,7 @@ TclCompileIncrCmd( PushLiteral(envPtr, word, numBytes); } } else { - LineInformation(2); + SetLineInformation(2); CompileTokens(envPtr, incrTokenPtr, interp); } } else { /* No incr amount given so use 1. */ @@ -701,7 +701,7 @@ TclCompileInfoLevelCmd( * list of arguments. */ - LineInformation(1); + SetLineInformation(1); CompileTokens(envPtr, TokenAfter(parsePtr->tokenPtr), interp); TclEmitOpcode( INST_INFO_LEVEL_ARGS, envPtr); } diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index d5208e6..0497e8a 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -86,7 +86,7 @@ const AuxDataType tclJumptableInfoType = { #define OP44(name,val1,val2) \ TclEmitInstInt4(INST_##name,(val1),envPtr);TclEmitInt4((val2),envPtr) #define BODY(token,index) \ - LineInformation((index));CompileBody(envPtr,(token),interp) + SetLineInformation((index));CompileBody(envPtr,(token),interp) #define PUSH(str) \ PushStringLiteral(envPtr, str) #define JUMP4(name,var) \ @@ -433,7 +433,7 @@ TclCompileStringMatchCmd( } PushLiteral(envPtr, str, length); } else { - LineInformation(i+1+nocase); + SetLineInformation(i+1+nocase); CompileTokens(envPtr, tokenPtr, interp); } tokenPtr = TokenAfter(tokenPtr); @@ -483,7 +483,7 @@ TclCompileStringLenCmd( len = sprintf(buf, "%d", len); PushLiteral(envPtr, buf, len); } else { - LineInformation(1); + SetLineInformation(1); CompileTokens(envPtr, tokenPtr, interp); TclEmitOpcode(INST_STR_LEN, envPtr); } @@ -722,7 +722,7 @@ TclCompileSubstCmd( return TCL_ERROR; } - LineInformation(numArgs); + SetLineInformation(numArgs); TclSubstCompile(interp, wordTokenPtr[1].start, wordTokenPtr[1].size, flags, mapPtr->loc[eclIndex].line[numArgs], envPtr); @@ -1284,7 +1284,7 @@ TclCompileSwitchCmd( */ /* Both methods push the value to match against onto the stack. */ - LineInformation(valueIndex); + SetLineInformation(valueIndex); CompileTokens(envPtr, valueTokenPtr, interp); if (mode == Switch_Exact) { @@ -3026,7 +3026,7 @@ TclCompileWhileCmd( bodyCodeOffset += 3; testCodeOffset += 3; } - LineInformation(1); + SetLineInformation(1); TclCompileExprWords(interp, testTokenPtr, 1, envPtr); jumpDist = CurrentOffset(envPtr) - bodyCodeOffset; diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 5043f65..9af4911 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1537,13 +1537,10 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); ExtCmdLoc *mapPtr = envPtr->extCmdMapPtr; \ int eclIndex = mapPtr->nuloc - 1 -#define LineInformation(word) \ +#define SetLineInformation(word) \ envPtr->line = mapPtr->loc[eclIndex].line[(word)]; \ envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] -#define SetLineInformation(word) - - #define PushVarNameWord(i,v,e,f,l,sc,word) \ TclPushVarName(i,v,e,f,l,sc, \ mapPtr->loc[eclIndex].line[(word)], \ diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 794a059..0bb7cb6 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3180,7 +3180,7 @@ CompileToInvokedCommand( } TclEmitPush(literal, envPtr); } else { - LineInformation(i); + SetLineInformation(i); CompileTokens(envPtr, tokPtr, interp); } tokPtr = TokenAfter(tokPtr); @@ -3257,7 +3257,7 @@ CompileBasicNArgCommand( if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { PushLiteral(envPtr, tokenPtr[1].start, tokenPtr[1].size); } else { - LineInformation(i); + SetLineInformation(i); CompileTokens(envPtr, tokenPtr, interp); } tokenPtr = TokenAfter(tokenPtr); -- cgit v0.12 From 6da16cce5001da699a5d43e075eaf706b8d68d63 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Jul 2013 17:06:35 +0000 Subject: Have TclMakeEnsemble() set ENSEMBLE_COMPILE at creation, not as a separate epoch-bumping step. --- generic/tclEnsemble.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 0bb7cb6..680ab45d 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -1527,6 +1527,14 @@ TclMakeEnsemble( cmdName = nameParts[nameCount - 1]; } } + + /* + * Switch on compilation always for core ensembles now that we can do + * nice bytecode things with them. Do it now. Waiting until later will + * just cause pointless epoch bumps. + */ + + ensembleFlags |= ENSEMBLE_COMPILE; ensemble = Tcl_CreateEnsemble(interp, cmdName, ns, ensembleFlags); /* @@ -1578,14 +1586,6 @@ TclMakeEnsemble( } } Tcl_SetEnsembleMappingDict(interp, ensemble, mapDict); - - /* - * Switch on compilation always for core ensembles now that we can do - * nice bytecode things with them. - */ - - Tcl_SetEnsembleFlags(interp, ensemble, - ensembleFlags | ENSEMBLE_COMPILE); } Tcl_DStringFree(&buf); -- cgit v0.12 From 906e3c456afb4ee425936e01ffb768ae30271da4 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 11 Jul 2013 23:19:14 +0000 Subject: Revise the CompileWord() and PushVarNameWord() macros to make explicit the SetLineInformation() that's in each of them. --- generic/tclCompCmds.c | 9 +-------- generic/tclCompile.h | 16 ++++++---------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index a56727d..0a1a739 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3164,10 +3164,7 @@ TclPushVarName( CompileEnv *envPtr, /* Holds resulting instructions. */ int flags, /* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */ int *localIndexPtr, /* Must not be NULL. */ - int *isScalarPtr, /* Must not be NULL. */ - int line, /* Line the token starts on. */ - int *clNext) /* Reference to offset of next hidden cont. - * line. */ + int *isScalarPtr) /* Must not be NULL. */ { register const char *p; const char *name, *elName; @@ -3347,8 +3344,6 @@ TclPushVarName( if (elName != NULL && !(flags & TCL_NO_ELEMENT)) { if (elNameChars) { - envPtr->line = line; - envPtr->clNext = clNext; TclCompileTokens(interp, elemTokenPtr, elemTokenCount, envPtr); } else { @@ -3360,8 +3355,6 @@ TclPushVarName( * The var name isn't simple: compile and push it. */ - envPtr->line = line; - envPtr->clNext = clNext; CompileTokens(envPtr, varTokenPtr, interp); } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 9af4911..a4ebd96 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1074,7 +1074,7 @@ MODULE_SCOPE void TclPrintSource(FILE *outFile, MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, - int *isScalarPtr, int line, int *clNext); + int *isScalarPtr); MODULE_SCOPE int TclRegisterLiteral(CompileEnv *envPtr, char *bytes, int length, int flags); MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -1515,13 +1515,10 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); #define CompileWord(envPtr, tokenPtr, interp, word) \ if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \ - TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \ - (tokenPtr)[1].size), (envPtr)); \ + PushLiteral((envPtr), (tokenPtr)[1].start, (tokenPtr)[1].size); \ } else { \ - envPtr->line = mapPtr->loc[eclIndex].line[word]; \ - envPtr->clNext = mapPtr->loc[eclIndex].next[word]; \ - TclCompileTokens((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ - (envPtr)); \ + SetLineInformation((word)); \ + CompileTokens((envPtr), (tokenPtr), (interp)); \ } /* @@ -1542,9 +1539,8 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); envPtr->clNext = mapPtr->loc[eclIndex].next[(word)] #define PushVarNameWord(i,v,e,f,l,sc,word) \ - TclPushVarName(i,v,e,f,l,sc, \ - mapPtr->loc[eclIndex].line[(word)], \ - mapPtr->loc[eclIndex].next[(word)]) + SetLineInformation(word); \ + TclPushVarName(i,v,e,f,l,sc) /* * Often want to issue one of two versions of an instruction based on whether -- cgit v0.12 From 979b26b406c0679a35edba070797e94d3ecb656a Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 12 Jul 2013 16:25:51 +0000 Subject: Tests demonstrating the need for the last two SetLineInformation() calls. --- tests/info.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/info.test b/tests/info.test index afdaaee..3057dd2 100644 --- a/tests/info.test +++ b/tests/info.test @@ -2371,6 +2371,31 @@ test info-33.33 {{*}, literal, simple, bytecompiled} -body { } -result {type source line 2365 file info.test cmd {info frame 0} proc ::foo::bar level 0} # ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + append x {*}{ + } [return [info frame 0]] +} +test info-33.34 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2377 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- +namespace eval foo {} +proc foo::bar {} { + append {*}{ + } x([return [info frame 0]]) {*}{ + } a +} +test info-33.35 {{*}, literal, simple, bytecompiled} -body { + reduce [foo::bar] +} -cleanup { + namespace delete foo +} -result {type source line 2389 file info.test cmd {info frame 0} proc ::foo::bar level 0} + +# ------------------------------------------------------------------------- unset -nocomplain res # cleanup -- cgit v0.12 From 5e4c2308ce99d3d1349d0defd0585b05cd11e3fe Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 12 Jul 2013 18:44:15 +0000 Subject: Global replace: CompileBody() -> BODY(). --- generic/tclCompCmds.c | 25 +++++++++---------------- generic/tclCompCmdsGR.c | 6 ++---- generic/tclCompCmdsSZ.c | 4 +--- generic/tclCompile.h | 14 +++++++------- 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 0a1a739..561d816 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -610,12 +610,12 @@ TclCompileCatchCmd( * begin by undeflowing the stack below the mark set by BEGIN_CATCH4. */ - SetLineInformation(1); if (cmdTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - CompileBody(envPtr, cmdTokenPtr, interp); + BODY(cmdTokenPtr, 1); } else { + SetLineInformation(1); CompileTokens(envPtr, cmdTokenPtr, interp); TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); @@ -1467,8 +1467,7 @@ CompileDictEachCmd( * Compile the loop body itself. It should be stack-neutral. */ - SetLineInformation(3); - CompileBody(envPtr, bodyTokenPtr, interp); + BODY(bodyTokenPtr, 3); if (collect == TCL_EACH_COLLECT) { Emit14Inst( INST_LOAD_SCALAR, keyVarIndex, envPtr); TclEmitInstInt4(INST_OVER, 1, envPtr); @@ -1651,8 +1650,7 @@ TclCompileDictUpdateCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - SetLineInformation(parsePtr->numWords - 1); - CompileBody(envPtr, bodyTokenPtr, interp); + BODY(bodyTokenPtr, parsePtr->numWords - 1); ExceptionRangeEnds(envPtr, range); /* @@ -1992,8 +1990,7 @@ TclCompileDictWithCmd( TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr); ExceptionRangeStarts(envPtr, range); - SetLineInformation(parsePtr->numWords-1); - CompileBody(envPtr, tokenPtr, interp); + BODY(tokenPtr, parsePtr->numWords - 1); ExceptionRangeEnds(envPtr, range); /* @@ -2268,8 +2265,7 @@ TclCompileForCmd( * Inline compile the initial command. */ - SetLineInformation(1); - CompileBody(envPtr, startTokenPtr, interp); + BODY(startTokenPtr, 1); TclEmitOpcode(INST_POP, envPtr); /* @@ -2292,8 +2288,7 @@ TclCompileForCmd( bodyRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); bodyCodeOffset = ExceptionRangeStarts(envPtr, bodyRange); - SetLineInformation(4); - CompileBody(envPtr, bodyTokenPtr, interp); + BODY(bodyTokenPtr, 4); ExceptionRangeEnds(envPtr, bodyRange); TclEmitOpcode(INST_POP, envPtr); @@ -2306,8 +2301,7 @@ TclCompileForCmd( nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr); envPtr->exceptAuxArrayPtr[nextRange].supportsContinue = 0; nextCodeOffset = ExceptionRangeStarts(envPtr, nextRange); - SetLineInformation(3); - CompileBody(envPtr, nextTokenPtr, interp); + BODY(nextTokenPtr, 3); ExceptionRangeEnds(envPtr, nextRange); TclEmitOpcode(INST_POP, envPtr); @@ -2682,9 +2676,8 @@ CompileEachloopCmd( * Inline compile the loop body. */ - SetLineInformation(numWords - 1); ExceptionRangeStarts(envPtr, range); - CompileBody(envPtr, bodyTokenPtr, interp); + BODY(bodyTokenPtr, numWords - 1); ExceptionRangeEnds(envPtr, range); if (collect == TCL_EACH_COLLECT) { diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index f7c15e6..0572cd3 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -264,8 +264,7 @@ TclCompileIfCmd( */ if (compileScripts) { - SetLineInformation(wordIdx); - CompileBody(envPtr, tokenPtr, interp); + BODY(tokenPtr, wordIdx); } if (realCond) { @@ -345,8 +344,7 @@ TclCompileIfCmd( * Compile the else command body. */ - SetLineInformation(wordIdx); - CompileBody(envPtr, tokenPtr, interp); + BODY(tokenPtr, wordIdx); } /* diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 0497e8a..19e636d 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -85,8 +85,6 @@ const AuxDataType tclJumptableInfoType = { TclEmitInstInt1(INST_##name,(val1),envPtr);TclEmitInt4((val2),envPtr) #define OP44(name,val1,val2) \ TclEmitInstInt4(INST_##name,(val1),envPtr);TclEmitInt4((val2),envPtr) -#define BODY(token,index) \ - SetLineInformation((index));CompileBody(envPtr,(token),interp) #define PUSH(str) \ PushStringLiteral(envPtr, str) #define JUMP4(name,var) \ @@ -1499,7 +1497,7 @@ IssueSwitchChainedTests( } /* - * Now do the actual compilation. Note that we do not use CompileBody + * Now do the actual compilation. Note that we do not use BODY() * because we may have synthesized the tokens in a non-standard * pattern. */ diff --git a/generic/tclCompile.h b/generic/tclCompile.h index a4ebd96..cf8475d 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1407,16 +1407,16 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); #define TclMax(i, j) ((((int) i) > ((int) j))? (i) : (j)) /* - * Convenience macro for use when compiling bodies of commands. The ANSI C - * "prototype" for this macro is: + * Convenience macros for use when compiling bodies of commands. The ANSI C + * "prototype" for these macros are: * - * static void CompileBody(CompileEnv *envPtr, Tcl_Token *tokenPtr, - * Tcl_Interp *interp); + * static void BODY(Tcl_Token *tokenPtr, int word); */ -#define CompileBody(envPtr, tokenPtr, interp) \ - TclCompileCmdWord((interp), (tokenPtr)+1, (tokenPtr)->numComponents, \ - (envPtr)) +#define BODY(tokenPtr, word) \ + SetLineInformation((word)); \ + TclCompileCmdWord(interp, (tokenPtr)+1, (tokenPtr)->numComponents, \ + envPtr) /* * Convenience macro for use when compiling tokens to be pushed. The ANSI C -- cgit v0.12 From a398b126a43e46efa6d6044b0bcf57a4b9385c4e Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 15 Jul 2013 17:07:51 +0000 Subject: Prefer CompileWord() over CompileTokens() when possible. --- generic/tclCompCmds.c | 3 +-- generic/tclCompCmdsGR.c | 3 +-- generic/tclCompCmdsSZ.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 561d816..37ce335 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -2638,8 +2638,7 @@ CompileEachloopCmd( i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { if ((i%2 == 0) && (i > 0)) { - SetLineInformation(i); - CompileTokens(envPtr, tokenPtr, interp); + CompileWord(envPtr, tokenPtr, interp, i); tempVar = (firstValueTemp + loopIndex); Emit14Inst( INST_STORE_SCALAR, tempVar, envPtr); TclEmitOpcode( INST_POP, envPtr); diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 0572cd3..2c71dc5 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -699,8 +699,7 @@ TclCompileInfoLevelCmd( * list of arguments. */ - SetLineInformation(1); - CompileTokens(envPtr, TokenAfter(parsePtr->tokenPtr), interp); + CompileWord(envPtr, TokenAfter(parsePtr->tokenPtr), interp, 1); TclEmitOpcode( INST_INFO_LEVEL_ARGS, envPtr); } return TCL_OK; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 19e636d..3a91c83 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -1282,8 +1282,7 @@ TclCompileSwitchCmd( */ /* Both methods push the value to match against onto the stack. */ - SetLineInformation(valueIndex); - CompileTokens(envPtr, valueTokenPtr, interp); + CompileWord(envPtr, valueTokenPtr, interp, valueIndex); if (mode == Switch_Exact) { IssueSwitchJumpTable(interp, envPtr, valueIndex, numWords, bodyToken, -- cgit v0.12 From 59d8c6ba4b9cc7f77258e0cdae09b6d786f19fc4 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 15 Jul 2013 20:16:11 +0000 Subject: Build CompileBasicNArgCommand on top of TclCompileInvocation. --- generic/tclBasic.c | 22 ++++++++++++++++++---- generic/tclCompile.c | 6 +++--- generic/tclCompile.h | 3 +++ generic/tclEnsemble.c | 10 ++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b2a505a..963b53a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5633,6 +5633,24 @@ TclArgumentBCEnter( CFWordBC *lastPtr = NULL; /* + * ePtr->nline is the number of words originally parsed. + * + * objc is the number of elements getting invoked. + * + * If they are not the same, we arrived here by compiling an + * ensemble dispatch. Ensemble subcommands that lead to script + * evaluation are not supposed to get compiled, because a command + * such as [info level] in the script can expose some of the dispatch + * shenanigans. This means that we don't have to tend to the + * housekeeping, and can escape now. + */ + + if (ePtr->nline != objc) { + return; + } + + /* + * Having disposed of the ensemble cases, we can state... * A few truths ... * (1) ePtr->nline == objc * (2) (ePtr->line[word] < 0) => !literal, for all words @@ -5642,10 +5660,6 @@ TclArgumentBCEnter( * have to save them at compile time. */ - if (ePtr->nline != objc) { - Tcl_Panic ("TIP 280 data structure inconsistency"); - } - for (word = 1; word < objc; word++) { if (ePtr->line[word] >= 0) { int isnew; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 5f4acff..a2c7131 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1777,8 +1777,8 @@ CompileCmdLiteral( TclEmitPush(cmdLitIdx, envPtr); } -static void -CompileInvocation( +void +TclCompileInvocation( Tcl_Interp *interp, Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, @@ -2095,7 +2095,7 @@ CompileCommandTokens( CompileExpanded(interp, parsePtr->tokenPtr, cmdKnown ? cmdObj : NULL, parsePtr->numWords, envPtr); } else { - CompileInvocation(interp, parsePtr->tokenPtr, + TclCompileInvocation(interp, parsePtr->tokenPtr, cmdKnown ? cmdObj : NULL, parsePtr->numWords, envPtr); } } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 0bcd84e..b94bd93 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1003,6 +1003,9 @@ MODULE_SCOPE void TclCompileExpr(Tcl_Interp *interp, const char *script, MODULE_SCOPE void TclCompileExprWords(Tcl_Interp *interp, Tcl_Token *tokenPtr, int numWords, CompileEnv *envPtr); +MODULE_SCOPE void TclCompileInvocation(Tcl_Interp *interp, + Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords, + CompileEnv *envPtr); MODULE_SCOPE void TclCompileScript(Tcl_Interp *interp, const char *script, int numBytes, CompileEnv *envPtr); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 680ab45d..9b6ca92 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3229,6 +3229,15 @@ CompileBasicNArgCommand( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { +#if 1 + Tcl_Obj *objPtr = Tcl_NewObj(); + + Tcl_IncrRefCount(objPtr); + Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); + TclCompileInvocation(interp, parsePtr->tokenPtr, objPtr, + parsePtr->numWords, envPtr); + Tcl_DecrRefCount(objPtr); +#else Tcl_Token *tokenPtr; Tcl_Obj *objPtr; char *bytes; @@ -3272,6 +3281,7 @@ CompileBasicNArgCommand( } else { TclEmitInstInt4(INST_INVOKE_STK4, i, envPtr); } +#endif return TCL_OK; } -- cgit v0.12 From 2d98ee0f477ef33bb0a8473efbd44ef203463c32 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 16 Jul 2013 14:07:41 +0000 Subject: Eliminate the litInfo table and all the code tending to its care and feeding. The pc -> command index mapping function it provided can be achieved using other data already in the ByteCode struct. --- generic/tclBasic.c | 134 +++++++++++++++++++++++++-------------------------- generic/tclCompile.c | 43 ----------------- generic/tclCompile.h | 8 --- generic/tclExecute.c | 44 ++++++++++++----- generic/tclInt.h | 2 +- 5 files changed, 97 insertions(+), 134 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 963b53a..bd4f157 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1609,8 +1609,6 @@ DeleteInterpProc( ckfree(eclPtr->loc); } - Tcl_DeleteHashTable(&eclPtr->litInfo); - ckfree(eclPtr); Tcl_DeleteHashEntry(hPtr); } @@ -5614,90 +5612,88 @@ TclArgumentBCEnter( int objc, void *codePtr, CmdFrame *cfPtr, + int cmd, int pc) { + ExtCmdLoc *eclPtr; + int word; + ECL *ePtr; + CFWordBC *lastPtr = NULL; Interp *iPtr = (Interp *) interp; Tcl_HashEntry *hePtr = Tcl_FindHashEntry(iPtr->lineBCPtr, (char *) codePtr); - ExtCmdLoc *eclPtr; if (!hePtr) { return; } eclPtr = Tcl_GetHashValue(hePtr); - hePtr = Tcl_FindHashEntry(&eclPtr->litInfo, INT2PTR(pc)); - if (hePtr) { - int word; - int cmd = PTR2INT(Tcl_GetHashValue(hePtr)); - ECL *ePtr = &eclPtr->loc[cmd]; - CFWordBC *lastPtr = NULL; + ePtr = &eclPtr->loc[cmd]; - /* - * ePtr->nline is the number of words originally parsed. - * - * objc is the number of elements getting invoked. - * - * If they are not the same, we arrived here by compiling an - * ensemble dispatch. Ensemble subcommands that lead to script - * evaluation are not supposed to get compiled, because a command - * such as [info level] in the script can expose some of the dispatch - * shenanigans. This means that we don't have to tend to the - * housekeeping, and can escape now. - */ + /* + * ePtr->nline is the number of words originally parsed. + * + * objc is the number of elements getting invoked. + * + * If they are not the same, we arrived here by compiling an + * ensemble dispatch. Ensemble subcommands that lead to script + * evaluation are not supposed to get compiled, because a command + * such as [info level] in the script can expose some of the dispatch + * shenanigans. This means that we don't have to tend to the + * housekeeping, and can escape now. + */ - if (ePtr->nline != objc) { - return; - } + if (ePtr->nline != objc) { + return; + } - /* - * Having disposed of the ensemble cases, we can state... - * A few truths ... - * (1) ePtr->nline == objc - * (2) (ePtr->line[word] < 0) => !literal, for all words - * (3) (word == 0) => !literal - * - * Item (2) is why we can use objv to get the literals, and do not - * have to save them at compile time. - */ + /* + * Having disposed of the ensemble cases, we can state... + * A few truths ... + * (1) ePtr->nline == objc + * (2) (ePtr->line[word] < 0) => !literal, for all words + * (3) (word == 0) => !literal + * + * Item (2) is why we can use objv to get the literals, and do not + * have to save them at compile time. + */ - for (word = 1; word < objc; word++) { - if (ePtr->line[word] >= 0) { - int isnew; - Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(iPtr->lineLABCPtr, - objv[word], &isnew); - CFWordBC *cfwPtr = ckalloc(sizeof(CFWordBC)); - - cfwPtr->framePtr = cfPtr; - cfwPtr->obj = objv[word]; - cfwPtr->pc = pc; - cfwPtr->word = word; - cfwPtr->nextPtr = lastPtr; - lastPtr = cfwPtr; - - if (isnew) { - /* - * The word is not on the stack yet, remember the current - * location and initialize references. - */ - - cfwPtr->prevPtr = NULL; - } else { - /* - * The object is already on the stack, however it may have - * a different location now (literal sharing may map - * multiple location to a single Tcl_Obj*. Save the old - * information in the new structure. - */ - - cfwPtr->prevPtr = Tcl_GetHashValue(hPtr); - } + for (word = 1; word < objc; word++) { + if (ePtr->line[word] >= 0) { + int isnew; + Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(iPtr->lineLABCPtr, + objv[word], &isnew); + CFWordBC *cfwPtr = ckalloc(sizeof(CFWordBC)); - Tcl_SetHashValue(hPtr, cfwPtr); + cfwPtr->framePtr = cfPtr; + cfwPtr->obj = objv[word]; + cfwPtr->pc = pc; + cfwPtr->word = word; + cfwPtr->nextPtr = lastPtr; + lastPtr = cfwPtr; + + if (isnew) { + /* + * The word is not on the stack yet, remember the current + * location and initialize references. + */ + + cfwPtr->prevPtr = NULL; + } else { + /* + * The object is already on the stack, however it may have + * a different location now (literal sharing may map + * multiple location to a single Tcl_Obj*. Save the old + * information in the new structure. + */ + + cfwPtr->prevPtr = Tcl_GetHashValue(hPtr); } - } /* for */ - cfPtr->litarg = lastPtr; - } /* if */ + Tcl_SetHashValue(hPtr, cfwPtr); + } + } /* for */ + + cfPtr->litarg = lastPtr; } /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index a2c7131..7e0be76 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1296,8 +1296,6 @@ ReleaseCmdWordData( ckfree((char *) eclPtr->loc); } - Tcl_DeleteHashTable (&eclPtr->litInfo); - ckfree((char *) eclPtr); } @@ -1382,7 +1380,6 @@ TclInitCompileEnv( envPtr->extCmdMapPtr->nloc = 0; envPtr->extCmdMapPtr->nuloc = 0; envPtr->extCmdMapPtr->path = NULL; - Tcl_InitHashTable(&envPtr->extCmdMapPtr->litInfo, TCL_ONE_WORD_KEYS); if ((invoker == NULL) || (invoker->type == TCL_LOCATION_EVAL_LIST)) { /* @@ -1814,12 +1811,6 @@ TclCompileInvocation( TclEmitPush(objIdx, envPtr); } - /* - * Save PC -> command map for the TclArgumentBC* functions. - */ - - mapPtr->loc[eclIndex].invokePc = envPtr->codeNext - envPtr->codeStart; - if (wordIdx <= 255) { TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); } else { @@ -2001,7 +1992,6 @@ CompileCmdCompileProc( mapPtr->nuloc--; ckfree(mapPtr->loc[mapPtr->nuloc].line); mapPtr->loc[mapPtr->nuloc].line = NULL; - mapPtr->loc[mapPtr->nuloc].invokePc = -1; } SetLineInformation(0); @@ -3325,17 +3315,6 @@ TclInitByteCodeObj( * byte code object (internal rep), for use with the bc compiler. */ - for (i = 0; i < envPtr->extCmdMapPtr->nuloc; i++) { - int isnew, pc = envPtr->extCmdMapPtr->loc[i].invokePc; - - if (pc < 0) { - continue; - } - - Tcl_SetHashValue(Tcl_CreateHashEntry(&envPtr->extCmdMapPtr->litInfo, - INT2PTR(pc), &isnew), INT2PTR(i)); - } - Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->lineBCPtr, codePtr, &isNew), envPtr->extCmdMapPtr); envPtr->extCmdMapPtr = NULL; @@ -3706,7 +3685,6 @@ EnterCmdWordData( ePtr = &eclPtr->loc[eclPtr->nuloc]; ePtr->srcOffset = srcOffset; - ePtr->invokePc = -1; ePtr->line = ckalloc(numWords * sizeof(int)); ePtr->next = ckalloc(numWords * sizeof(int *)); ePtr->nline = numWords; @@ -4477,27 +4455,6 @@ TclFixupForwardJump( } } - /* - * TIP #280: Adjust the mapping from PC values to the per-command - * information about arguments and their line numbers. - * - * Note: We cannot simply remove an out-of-date entry and then reinsert - * with the proper PC, because then we might overwrite another entry which - * was at that location. Therefore we pull (copy + delete) all effected - * entries (beyond the fixed PC) into an array, update them there, and at - * last reinsert them all. - */ - - { - ExtCmdLoc* eclPtr = envPtr->extCmdMapPtr; - for (k = eclPtr->nuloc - 1; k >= 0; k--) { - if (eclPtr->loc[k].invokePc < (jumpFixupPtr->codeOffset + 2)) { - continue; - } - eclPtr->loc[k].invokePc += 3; - } - } - return 1; /* the jump was grown */ } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index b94bd93..f70f8f7 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -175,7 +175,6 @@ typedef struct CmdLocation { typedef struct ECL { int srcOffset; /* Command location to find the entry. */ - int invokePc; int nline; /* Number of words in the command */ int *line; /* Line information for all words in the * command. */ @@ -194,13 +193,6 @@ typedef struct ExtCmdLoc { ECL *loc; /* Command word locations (lines). */ int nloc; /* Number of allocated entries in 'loc'. */ int nuloc; /* Number of used entries in 'loc'. */ - Tcl_HashTable litInfo; /* Indexed by bytecode 'PC', to have the - * information accessible per command and - * argument, not per whole bytecode. Value is - * index of command in 'loc', giving us the - * literals to associate with line information - * as command argument, see - * TclArgumentBCEnter() */ } ExtCmdLoc; /* diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 37bf072..f8ed667 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -721,7 +721,7 @@ static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc, int catchOnly, ByteCode *codePtr); static const char * GetSrcInfoForPc(const unsigned char *pc, ByteCode *codePtr, int *lengthPtr, - const unsigned char **pcBeg); + const unsigned char **pcBeg, int *cmdIdxPtr); static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, int growth, int move); static void IllegalExprOperandType(Tcl_Interp *interp, @@ -2431,8 +2431,11 @@ TEBCresume( iPtr->cmdFramePtr = bcFramePtr; if (iPtr->flags & INTERP_DEBUG_FRAME) { - TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc, - codePtr, bcFramePtr, pc - codePtr->codeStart); + int cmd; + if (GetSrcInfoForPc(pc, codePtr, NULL, NULL, &cmd)) { + TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc, + codePtr, bcFramePtr, cmd, pc - codePtr->codeStart); + } } pc++; @@ -2885,8 +2888,11 @@ TEBCresume( iPtr->cmdFramePtr = bcFramePtr; if (iPtr->flags & INTERP_DEBUG_FRAME) { - TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc, - codePtr, bcFramePtr, pc - codePtr->codeStart); + int cmd; + if (GetSrcInfoForPc(pc, codePtr, NULL, NULL, &cmd)) { + TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc, + codePtr, bcFramePtr, cmd, pc - codePtr->codeStart); + } } DECACHE_STACK_INFO(); @@ -3031,8 +3037,11 @@ TEBCresume( bcFramePtr->data.tebc.pc = (char *) pc; iPtr->cmdFramePtr = bcFramePtr; if (iPtr->flags & INTERP_DEBUG_FRAME) { - TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc, - codePtr, bcFramePtr, pc - codePtr->codeStart); + int cmd; + if (GetSrcInfoForPc(pc, codePtr, NULL, NULL, &cmd)) { + TclArgumentBCEnter((Tcl_Interp *) iPtr, objv, objc, + codePtr, bcFramePtr, cmd, pc - codePtr->codeStart); + } } iPtr->ensembleRewrite.sourceObjs = objv; iPtr->ensembleRewrite.numRemovedObjs = opnd; @@ -6967,7 +6976,7 @@ TEBCresume( if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) { const unsigned char *pcBeg; - bytes = GetSrcInfoForPc(pc, codePtr, &length, &pcBeg); + bytes = GetSrcInfoForPc(pc, codePtr, &length, &pcBeg, NULL); DECACHE_STACK_INFO(); TclLogCommandInfo(interp, codePtr->source, bytes, bytes ? length : 0, pcBeg, tosPtr); @@ -7149,7 +7158,7 @@ TEBCresume( } codePtr->flags |= TCL_BYTECODE_RECOMPILE; - bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL); + bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL); opnd = TclGetUInt4AtPtr(pc+1); pc += (opnd-1); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); @@ -8642,7 +8651,7 @@ ValidatePcAndStackTop( if (checkStack && ((stackTop < 0) || (stackTop > stackUpperBound))) { int numChars; - const char *cmd = GetSrcInfoForPc(pc, codePtr, &numChars, NULL); + const char *cmd = GetSrcInfoForPc(pc, codePtr, &numChars, NULL, NULL); fprintf(stderr, "\nBad stack top %d at pc %u in TclNRExecuteByteCode (min 0, max %i)", stackTop, relativePc, stackUpperBound); @@ -8756,7 +8765,7 @@ TclGetSrcInfoForCmd( ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, - codePtr, lenPtr, NULL); + codePtr, lenPtr, NULL, NULL); } void @@ -8768,7 +8777,7 @@ TclGetSrcInfoForPc( if (cfPtr->cmd.str.cmd == NULL) { cfPtr->cmd.str.cmd = GetSrcInfoForPc( (unsigned char *) cfPtr->data.tebc.pc, codePtr, - &cfPtr->cmd.str.len, NULL); + &cfPtr->cmd.str.len, NULL, NULL); } if (cfPtr->cmd.str.cmd != NULL) { @@ -8828,9 +8837,12 @@ GetSrcInfoForPc( int *lengthPtr, /* If non-NULL, the location where the length * of the command's source should be stored. * If NULL, no length is stored. */ - const unsigned char **pcBeg)/* If non-NULL, the bytecode location + const unsigned char **pcBeg,/* If non-NULL, the bytecode location * where the current instruction starts. * If NULL; no pointer is stored. */ + int *cmdIdxPtr) /* If non-NULL, the location where the index + * of the command containing the pc should + * be stored. */ { register int pcOffset = (pc - codePtr->codeStart); int numCmds = codePtr->numCommands; @@ -8840,6 +8852,7 @@ GetSrcInfoForPc( int bestDist = INT_MAX; /* Distance of pc to best cmd's start pc. */ int bestSrcOffset = -1; /* Initialized to avoid compiler warning. */ int bestSrcLength = -1; /* Initialized to avoid compiler warning. */ + int bestCmdIdx = -1; if ((pcOffset < 0) || (pcOffset >= codePtr->numCodeBytes)) { if (pcBeg != NULL) *pcBeg = NULL; @@ -8907,6 +8920,7 @@ GetSrcInfoForPc( bestDist = dist; bestSrcOffset = srcOffset; bestSrcLength = srcLen; + bestCmdIdx = i; } } } @@ -8936,6 +8950,10 @@ GetSrcInfoForPc( *lengthPtr = bestSrcLength; } + if (cmdIdxPtr != NULL) { + *cmdIdxPtr = bestCmdIdx; + } + return (codePtr->source + bestSrcOffset); } diff --git a/generic/tclInt.h b/generic/tclInt.h index b940225..da09366 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2828,7 +2828,7 @@ MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp, Tcl_Obj *objv[], int objc); MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp, Tcl_Obj *objv[], int objc, - void *codePtr, CmdFrame *cfPtr, int pc); + void *codePtr, CmdFrame *cfPtr, int cmd, int pc); MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp, CmdFrame *cfPtr); MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj, -- cgit v0.12 From e783ef57ec6e0ab2d08f1524e86cbc849e36f763 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 16 Jul 2013 14:52:33 +0000 Subject: Simplify arguments to TclContinuationsEnterDerived(). --- generic/tclCompile.c | 6 ++---- generic/tclEnsemble.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 7e0be76..bc7501a 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1805,8 +1805,7 @@ TclCompileInvocation( tokenPtr[1].start, tokenPtr[1].size); if (envPtr->clNext) { TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), - tokenPtr[1].start - envPtr->source, - mapPtr->loc[eclIndex].next[wordIdx]); + tokenPtr[1].start - envPtr->source, envPtr->clNext); } TclEmitPush(objIdx, envPtr); } @@ -1855,8 +1854,7 @@ CompileExpanded( tokenPtr[1].start, tokenPtr[1].size); if (envPtr->clNext) { TclContinuationsEnterDerived(TclFetchLiteral(envPtr, objIdx), - tokenPtr[1].start - envPtr->source, - mapPtr->loc[eclIndex].next[wordIdx]); + tokenPtr[1].start - envPtr->source, envPtr->clNext); } TclEmitPush(objIdx, envPtr); } diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 9b6ca92..864283b 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3163,12 +3163,16 @@ CompileToInvokedCommand( */ Tcl_ListObjGetElements(NULL, replacements, &numWords, &words); - for (i=0,tokPtr=parsePtr->tokenPtr ; inumWords ; i++) { + for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords; + i++, tokPtr = TokenAfter(tokPtr)) { if (i > 0 && i < numWords+1) { bytes = Tcl_GetStringFromObj(words[i-1], &length); PushLiteral(envPtr, bytes, length); - } else if (tokPtr->type == TCL_TOKEN_SIMPLE_WORD) { - /* TODO: Check about registering Cmd Literals here */ + continue; + } + + SetLineInformation(i); + if (tokPtr->type == TCL_TOKEN_SIMPLE_WORD) { int literal = TclRegisterNewLiteral(envPtr, tokPtr[1].start, tokPtr[1].size); @@ -3176,14 +3180,12 @@ CompileToInvokedCommand( TclContinuationsEnterDerived( TclFetchLiteral(envPtr, literal), tokPtr[1].start - envPtr->source, - mapPtr->loc[eclIndex].next[i]); + envPtr->clNext); } TclEmitPush(literal, envPtr); } else { - SetLineInformation(i); CompileTokens(envPtr, tokPtr, interp); } - tokPtr = TokenAfter(tokPtr); } /* -- cgit v0.12 From 01f1692c1f639eeb817ce6c51928195620872173 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 16 Jul 2013 17:21:12 +0000 Subject: Simplify the ensemble subcommand compile. There's no need to be crafting synthetic Tcl_Parse and copying tokens. Some pointer shifts will do. --- generic/tclCompile.c | 1 - generic/tclEnsemble.c | 70 +++++++++++---------------------------------------- 2 files changed, 15 insertions(+), 56 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index bc7501a..d82d728 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1992,7 +1992,6 @@ CompileCmdCompileProc( mapPtr->loc[mapPtr->nuloc].line = NULL; } - SetLineInformation(0); return TCL_ERROR; } diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 864283b..e4f96c0 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3029,12 +3029,6 @@ TclCompileEnsemble( return ourResult; } -/* - * How to compile a subcommand using its own command compiler. To do that, we - * have to perform some trickery to rewrite the arguments, as compilers *must* - * have parse tokens that refer to addresses in the original script. - */ - static int CompileToCompiledCommand( Tcl_Interp *interp, @@ -3043,10 +3037,8 @@ CompileToCompiledCommand( Command *cmdPtr, CompileEnv *envPtr) /* Holds resulting instructions. */ { - Tcl_Parse synthetic; - Tcl_Token *tokenPtr; int result, i; - int savedNumCmds = envPtr->numCommands; + Tcl_Token *saveTokenPtr = parsePtr->tokenPtr; int savedStackDepth = envPtr->currStackDepth; unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart; DefineLineInformation; @@ -3055,47 +3047,17 @@ CompileToCompiledCommand( return TCL_ERROR; } - TclParseInit(interp, NULL, 0, &synthetic); - synthetic.numWords = parsePtr->numWords - depth + 1; - TclGrowParseTokenArray(&synthetic, 2); - synthetic.numTokens = 2; - - /* - * Now we have the space to work in, install something rewritten. The - * first word will "officially" be the bytes of the structured ensemble - * name. That's technically wrong, but nobody will care; we just need - * *something* here... - */ - - synthetic.tokenPtr[0].type = TCL_TOKEN_SIMPLE_WORD; - synthetic.tokenPtr[0].start = parsePtr->tokenPtr[0].start; - synthetic.tokenPtr[0].numComponents = 1; - synthetic.tokenPtr[1].type = TCL_TOKEN_TEXT; - synthetic.tokenPtr[1].start = parsePtr->tokenPtr[0].start; - synthetic.tokenPtr[1].numComponents = 0; - for (i=0,tokenPtr=parsePtr->tokenPtr ; istart - synthetic.tokenPtr[0].start) - + tokenPtr->size; - - synthetic.tokenPtr[0].size = sclen; - synthetic.tokenPtr[1].size = sclen; - tokenPtr = TokenAfter(tokenPtr); - } - /* - * Copy over the real argument tokens. + * 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. */ - for (i=1; inumComponents + 1; - TclGrowParseTokenArray(&synthetic, toCopy); - memcpy(synthetic.tokenPtr + synthetic.numTokens, tokenPtr, - sizeof(Tcl_Token) * toCopy); - synthetic.numTokens += toCopy; - tokenPtr = TokenAfter(tokenPtr); + for (i = 0; i < depth - 1; i++) { + parsePtr->tokenPtr = TokenAfter(parsePtr->tokenPtr); } + parsePtr->numWords -= (depth - 1); /* * Shift the line information arrays to account for different word @@ -3109,7 +3071,7 @@ CompileToCompiledCommand( * Hand off compilation to the subcommand compiler. At last! */ - result = cmdPtr->compileProc(interp, &synthetic, cmdPtr, envPtr); + result = cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr); /* * Undo the shift. @@ -3118,22 +3080,20 @@ CompileToCompiledCommand( mapPtr->loc[eclIndex].line -= (depth - 1); mapPtr->loc[eclIndex].next -= (depth - 1); + parsePtr->numWords += (depth - 1); + parsePtr->tokenPtr = saveTokenPtr; + /* - * If our target fails to compile, revert the number of commands and the - * pointer to the place to issue the next instruction. [Bug 3600328] + * If our target failed to compile, revert any data from failed partial + * compiles. Note that envPtr->numCommands need not be checked because + * we avoid compiling subcommands that recursively call TclCompileScript(). */ if (result != TCL_OK) { - envPtr->numCommands = savedNumCmds; envPtr->currStackDepth = savedStackDepth; envPtr->codeNext = envPtr->codeStart + savedCodeNext; } - /* - * Clean up if necessary. - */ - - Tcl_FreeParse(&synthetic); return result; } -- cgit v0.12 From 945323c68b1aaa265a1467ae1d1101a618e871a9 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 16 Jul 2013 20:48:37 +0000 Subject: Streamline the housekeeping on the operands of INST_START_CMD. For example, do only incr on success, not incr on attempt + decr on error. --- generic/tclCompile.c | 81 +++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 49 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index d82d728..6ac5fb9 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1885,47 +1885,41 @@ CompileCmdCompileProc( Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, - int startCodeOffset, CompileEnv *envPtr) { int savedNumCmds = envPtr->numCommands; int startStackDepth = envPtr->currStackDepth; - int update = 0; + int startCodeOffset = envPtr->codeNext - envPtr->codeStart; + int incrOffset = -1; DefineLineInformation; /* - * Mark the start of the command; the proper bytecode - * length will be updated later. There is no need to - * do this for the first bytecode in the compile env, - * as the check is done before calling - * TclNRExecuteByteCode(). Do emit an INST_START_CMD - * in special cases where the first bytecode is in a - * loop, to insure that the corresponding command is - * counted properly. Compilers for commands able to - * produce such a beast (currently 'while 1' only) set - * envPtr->atCmdStart to 0 in order to signal this - * case. [Bug 1752146] + * Emit of the INST_START_CMD instruction is controlled by + * the value of envPtr->atCmdStart: * - * Note that the environment is initialised with - * atCmdStart=1 to avoid emitting ISC for the first - * command. + * atCmdStart == 2 : We are not using the INST_START_CMD instruction. + * atCmdStart == 1 : INST_START_CMD was the last instruction emitted. + * : We do not need to emit another. Instead we + * : increment the number of cmds started at it (except + * : for the special case at the start of a script.) + * atCmdStart == 0 : The last instruction was something else. We need + * : to emit INST_START_CMD here. */ - if (envPtr->atCmdStart == 1) { - if (startCodeOffset) { - /* - * Increase the number of commands being - * started at the current point. Note that - * this depends on the exact layout of the - * INST_START_CMD's operands, so be careful! - */ - - TclIncrUInt4AtPtr(envPtr->codeNext - 4, 1) - } - } else if (envPtr->atCmdStart == 0) { + switch (envPtr->atCmdStart) { + case 0: TclEmitInstInt4(INST_START_CMD, 0, envPtr); - TclEmitInt4(1, envPtr); - update = 1; + incrOffset = envPtr->codeNext - envPtr->codeStart; + TclEmitInt4(0, envPtr); + break; + case 1: + if (envPtr->codeNext > envPtr->codeStart) { + incrOffset = envPtr->codeNext - 4 - envPtr->codeStart; + } + break; + case 2: + /* Nothing to do */ + ; } if (TCL_OK == cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr)) { @@ -1947,30 +1941,20 @@ CompileCmdCompileProc( parsePtr->tokenPtr->start, diff); } #endif - if (update) { + if (incrOffset >= 0) { /* - * Fix the bytecode length. + * We successfully compiled a command. Increment the number + * of commands that start at the currently active INST_START_CMD. */ + unsigned char *incrPtr = envPtr->codeStart + incrOffset; + unsigned char *startPtr = incrPtr - 5; - unsigned char *fixPtr = envPtr->codeStart + startCodeOffset + 1; - unsigned fixLen = envPtr->codeNext - fixPtr + 1; - - TclStoreInt4AtPtr(fixLen, fixPtr); + TclIncrUInt4AtPtr(incrPtr, 1); + TclStoreInt4AtPtr(envPtr->codeNext - startPtr, startPtr + 1); } return TCL_OK; } - if (envPtr->atCmdStart == 1 && startCodeOffset != 0) { - /* - * Decrease the number of commands being started - * at the current point. Note that this depends on - * the exact layout of the INST_START_CMD's - * operands, so be careful! - */ - - TclIncrUInt4AtPtr(envPtr->codeNext - 4, -1); - } - /* * Restore numCommands, codeNext, and currStackDepth to their * correct values, removing any commands compiled before the @@ -2069,8 +2053,7 @@ CompileCommandTokens( /* If cmdPtr != NULL, we will try to call cmdPtr->compileProc */ if (cmdPtr) { - code = CompileCmdCompileProc(interp, parsePtr, cmdPtr, - startCodeOffset, envPtr); + code = CompileCmdCompileProc(interp, parsePtr, cmdPtr, envPtr); } if (code == TCL_ERROR) { -- cgit v0.12 From 6d2beac7e80048bcc4d4d46c68ec4f55d90986b3 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 17 Jul 2013 13:57:23 +0000 Subject: Factor out the call to a compileProc into one place used by both ensemble subcommand compiles and toplevel command compiles in TclCompileScript. --- generic/tclCompile.c | 48 ++++++++++++++---------------------------------- generic/tclCompile.h | 3 +++ generic/tclEnsemble.c | 28 +++++++++++++++++++++------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6ac5fb9..763e8f1 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1887,10 +1887,7 @@ CompileCmdCompileProc( Command *cmdPtr, CompileEnv *envPtr) { - int savedNumCmds = envPtr->numCommands; - int startStackDepth = envPtr->currStackDepth; - int startCodeOffset = envPtr->codeNext - envPtr->codeStart; - int incrOffset = -1; + int unwind = 0, incrOffset = -1; DefineLineInformation; /* @@ -1908,6 +1905,7 @@ CompileCmdCompileProc( switch (envPtr->atCmdStart) { case 0: + unwind = tclInstructionTable[INST_START_CMD].numBytes; TclEmitInstInt4(INST_START_CMD, 0, envPtr); incrOffset = envPtr->codeNext - envPtr->codeStart; TclEmitInt4(0, envPtr); @@ -1922,25 +1920,7 @@ CompileCmdCompileProc( ; } - if (TCL_OK == cmdPtr->compileProc(interp, parsePtr, cmdPtr, envPtr)) { - -#ifdef TCL_COMPILE_DEBUG - /* - * Confirm that the command compiler generated a - * single value on the stack as its result. This - * is only done in debugging mode, as it *should* - * be correct and normal users have no reasonable - * way to fix it anyway. - */ - - int diff = envPtr->currStackDepth - startStackDepth; - - if (diff != 1) { - Tcl_Panic("bad stack adjustment when compiling" - " %.*s (was %d instead of 1)", parsePtr->tokenPtr->size, - parsePtr->tokenPtr->start, diff); - } -#endif + if (TCL_OK == TclAttemptCompileProc(interp, parsePtr, 1, cmdPtr, envPtr)) { if (incrOffset >= 0) { /* * We successfully compiled a command. Increment the number @@ -1950,21 +1930,15 @@ CompileCmdCompileProc( unsigned char *startPtr = incrPtr - 5; TclIncrUInt4AtPtr(incrPtr, 1); - TclStoreInt4AtPtr(envPtr->codeNext - startPtr, startPtr + 1); + if (unwind) { + /* We started the INST_START_CMD. Record the code length. */ + TclStoreInt4AtPtr(envPtr->codeNext - startPtr, startPtr + 1); + } } return TCL_OK; } - /* - * Restore numCommands, codeNext, and currStackDepth to their - * correct values, removing any commands compiled before the - * failure to produce bytecode got reported. - * [Bugs 705406, 735055, 3614102] - */ - - envPtr->numCommands = savedNumCmds; - envPtr->codeNext = envPtr->codeStart + startCodeOffset; - envPtr->currStackDepth = startStackDepth; + envPtr->codeNext -= unwind; /* Unwind INST_START_CMD */ /* * Throw out any line information generated by the failed @@ -1976,6 +1950,12 @@ CompileCmdCompileProc( mapPtr->loc[mapPtr->nuloc].line = NULL; } + /* + * Reset the index of next command. + * Toss out any from failed nested partial compiles. + */ + envPtr->numCommands = mapPtr->nuloc; + return TCL_ERROR; } diff --git a/generic/tclCompile.h b/generic/tclCompile.h index f70f8f7..56315db 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -984,6 +984,9 @@ MODULE_SCOPE ByteCode * TclCompileObj(Tcl_Interp *interp, Tcl_Obj *objPtr, *---------------------------------------------------------------- */ +MODULE_SCOPE int TclAttemptCompileProc(Tcl_Interp *interp, + Tcl_Parse *parsePtr, int depth, Command *cmdPtr, + CompileEnv *envPtr); MODULE_SCOPE void TclCleanupByteCode(ByteCode *codePtr); MODULE_SCOPE void TclCleanupStackForBreakContinue(CompileEnv *envPtr, ExceptionAux *auxPtr); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index e4f96c0..bab63c9 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -35,9 +35,6 @@ static void MakeCachedEnsembleCommand(Tcl_Obj *objPtr, static void FreeEnsembleCmdRep(Tcl_Obj *objPtr); static void DupEnsembleCmdRep(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); static void StringOfEnsembleCmdRep(Tcl_Obj *objPtr); -static int CompileToCompiledCommand(Tcl_Interp *interp, - Tcl_Parse *parsePtr, int depth, Command *cmdPtr, - CompileEnv *envPtr); static void CompileToInvokedCommand(Tcl_Interp *interp, Tcl_Parse *parsePtr, Tcl_Obj *replacements, Command *cmdPtr, CompileEnv *envPtr); @@ -2994,8 +2991,8 @@ TclCompileEnsemble( */ invokeAnyway = 1; - if (CompileToCompiledCommand(interp, parsePtr, depth, cmdPtr, - envPtr) == TCL_OK) { + if (TCL_OK == TclAttemptCompileProc(interp, parsePtr, depth, cmdPtr, + envPtr)) { ourResult = TCL_OK; goto cleanup; } @@ -3029,8 +3026,8 @@ TclCompileEnsemble( return ourResult; } -static int -CompileToCompiledCommand( +int +TclAttemptCompileProc( Tcl_Interp *interp, Tcl_Parse *parsePtr, int depth, @@ -3092,6 +3089,23 @@ CompileToCompiledCommand( if (result != TCL_OK) { envPtr->currStackDepth = savedStackDepth; envPtr->codeNext = envPtr->codeStart + savedCodeNext; +#ifdef TCL_COMPILE_DEBUG + } else { + /* + * Confirm that the command compiler generated a single value on + * the stack as its result. This is only done in debugging mode, + * as it *should* be correct and normal users have no reasonable + * way to fix it anyway. + */ + + int diff = envPtr->currStackDepth - savedStackDepth; + + if (diff != 1) { + Tcl_Panic("bad stack adjustment when compiling" + " %.*s (was %d instead of 1)", parsePtr->tokenPtr->size, + parsePtr->tokenPtr->start, diff); + } +#endif } return result; -- cgit v0.12 From 6b9dcf87ecc79d795e79e3d6d8e03b894f36a6cc Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 17 Jul 2013 16:02:36 +0000 Subject: Start notifier thread again if we were forked, to solve Rivet bug 55153 - RFE [a0bc856dcd] --- ChangeLog | 6 ++++++ unix/tclUnixNotfy.c | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index d7ada95..bdbbd4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-07-17 Harald Oehlmann + + * tclUnixNotify.c Tcl_InitNotifier: RFE [a0bc856dcd] + Start notifier thread again if we were forked, to solve Rivet bug + 55153. + 2013-07-05 Kevin B. Kenny * library/tzdata/Africa/Casablanca: diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index aacc8d2d..2ad1932 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -120,6 +120,15 @@ static Tcl_ThreadDataKey dataKey; static int notifierCount = 0; /* + * The following static stores the process ID of the initialized notifier + * thread. If it changes, we have passed a fork and we should start a new + * notifier thread. + * + * You must hold the notifierMutex lock before accessing this variable. + */ +static pid_t processIDInitialized = 0; + +/* * The following variable points to the head of a doubly-linked list of * ThreadSpecificData structures for all threads that are currently waiting on * an event. @@ -275,11 +284,23 @@ Tcl_InitNotifier(void) */ Tcl_MutexLock(¬ifierMutex); + /* + * Check if my process id changed, e.g. I was forked + * In this case, restart the notifier thread and close the + * pipe to the original notifier thread + */ + if (notifierCount > 0 && processIDInitialized != getpid()) { + notifierCount = 0; + processIDInitialized = 0; + close(triggerPipe); + triggerPipe = -1; + } if (notifierCount == 0) { if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread"); } + processIDInitialized = getpid(); } notifierCount++; -- cgit v0.12 From 517197f8571ca5ff1c51b2cadc771505922d9137 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Jul 2013 15:05:18 +0000 Subject: [Bug 1c17fbba5d] Fix -errorinfo from syntax errors so that the error is not obscured. Instead highlight it by making it the last character quoted. --- generic/tclAssembly.c | 15 ++++++++------- generic/tclBasic.c | 5 ++++- generic/tclCompile.c | 5 +---- tests/assemble.test | 3 +-- tests/misc.test | 7 +------ 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 62641e6..416ee10 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -985,8 +985,6 @@ TclAssembleCode( const char* instPtr = codePtr; /* Where to start looking for a line of code */ - int instLen; /* Length in bytes of the current line of - * code */ const char* nextPtr; /* Pointer to the end of the line of code */ int bytesLeft = codeLen; /* Number of bytes of source code remaining to * be parsed */ @@ -1000,10 +998,6 @@ TclAssembleCode( */ status = Tcl_ParseCommand(interp, instPtr, bytesLeft, 0, parsePtr); - instLen = parsePtr->commandSize; - if (parsePtr->term == parsePtr->commandStart + instLen - 1) { - --instLen; - } /* * Report errors in the parse. @@ -1012,7 +1006,7 @@ TclAssembleCode( if (status != TCL_OK) { if (flags & TCL_EVAL_DIRECT) { Tcl_LogCommandInfo(interp, codePtr, parsePtr->commandStart, - instLen); + parsePtr->term + 1 - parsePtr->commandStart); } FreeAssemblyEnv(assemEnvPtr); return TCL_ERROR; @@ -1032,6 +1026,13 @@ TclAssembleCode( */ if (parsePtr->numWords > 0) { + int instLen = parsePtr->commandSize; + /* Length in bytes of the current command */ + + if (parsePtr->term == parsePtr->commandStart + instLen - 1) { + --instLen; + } + /* * If tracing, show each line assembled as it happens. */ diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b2a505a..1d35034 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5084,7 +5084,9 @@ TclEvalEx( do { if (Tcl_ParseCommand(interp, p, bytesLeft, 0, parsePtr) != TCL_OK) { code = TCL_ERROR; - goto error; + Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, + parsePtr->term + 1 - parsePtr->commandStart); + goto posterror; } /* @@ -5340,6 +5342,7 @@ TclEvalEx( Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, commandLength); } + posterror: iPtr->flags &= ~ERR_ALREADY_LOGGED; /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 633966e..6a2a318 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1790,10 +1790,7 @@ TclCompileScript( */ Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, - /* Drop the command terminator (";","]") if appropriate */ - (parsePtr->term == - parsePtr->commandStart + parsePtr->commandSize - 1)? - parsePtr->commandSize - 1 : parsePtr->commandSize); + parsePtr->term + 1 - parsePtr->commandStart); TclCompileSyntaxError(interp, envPtr); break; } diff --git a/tests/assemble.test b/tests/assemble.test index 7d4e5d1..b0487e6 100644 --- a/tests/assemble.test +++ b/tests/assemble.test @@ -175,8 +175,7 @@ test assemble-4.1 {syntax error} { -match glob -result {1 {extra characters after close-brace} {extra characters after close-brace while executing -"{}extra - " +"{}e" ("assemble" body, line 2)*}} } test assemble-4.2 {null command} { diff --git a/tests/misc.test b/tests/misc.test index 6ddc718..d4ece74 100644 --- a/tests/misc.test +++ b/tests/misc.test @@ -59,12 +59,7 @@ test misc-1.2 {error in variable ref. in command in array reference} { missing close-brace for variable name missing close-brace for variable name while executing -"set tst $a([winfo name $\{zz) - # this is a bogus comment - # this is a bogus comment - # this is a bogus comment - # this is a bogus comment - # this is a ..." +"set tst $a([winfo name $\{" (procedure "tstProc" line 4) invoked from within "tstProc"}] -- cgit v0.12 From f06af4fe86a953a20b9ef90f5605331707370765 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 Jul 2013 18:25:24 +0000 Subject: [assemble] compile syntax error into bytecode reporting syntax error message. --- generic/tclAssembly.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 0722eb9..9b9b6f8 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -930,7 +930,7 @@ TclCompileAssembleCmd( { Tcl_Token *tokenPtr; /* Token in the input script */ -#if 0 +#if 1 int numCommands = envPtr->numCommands; int offset = envPtr->codeNext - envPtr->codeStart; int depth = envPtr->currStackDepth; @@ -956,11 +956,7 @@ TclCompileAssembleCmd( if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start, tokenPtr[1].size, TCL_EVAL_DIRECT)) { - /* - * TODO: Finish working out how to capture syntax errors captured - * during compile and make them bytecode reporting the error. - */ -#if 0 +#if 1 Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (\"%.*s\" body, line %d)", parsePtr->tokenPtr->size, parsePtr->tokenPtr->start, @@ -1136,7 +1132,7 @@ NewAssemblyEnv( assemEnvPtr->envPtr = envPtr; assemEnvPtr->parsePtr = parsePtr; - assemEnvPtr->cmdLine = envPtr->line; + assemEnvPtr->cmdLine = 1; assemEnvPtr->clNext = envPtr->clNext; /* -- cgit v0.12 From ec06295d4ed7d6f865b8d73925bfb24d8f478f45 Mon Sep 17 00:00:00 2001 From: oehhar Date: Mon, 22 Jul 2013 08:45:37 +0000 Subject: Test file tests/unixForkEvent.test added --- tests/unixForkEvent.test | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/unixForkEvent.test diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test new file mode 100644 index 0000000..fee45fd --- /dev/null +++ b/tests/unixForkEvent.test @@ -0,0 +1,50 @@ +# This file contains a collection of tests for the procedures in the file +# tclEvent.c, which includes the "update", and "vwait" Tcl +# commands. Sourcing this file into Tcl runs the tests and generates +# output for errors. No output means no errors were found. +# +# Copyright (c) 1995-1997 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +package require tcltest 2 +namespace import -force ::tcltest::* + +testConstraint testfork [llength [info commands testfork]] +testConstraint threaded [expr { + ([info exist tcl_platform(threaded)] && $tcl_platform(threaded)) + && $tcl_platform(os) ne "Darwin" +}] + +# Test if the notifier thread is well initialized in a forked interpreter +# by Tcl_InitNotifier +test unixforkevent-1.1 {fork and test writeable event} \ + -constraints {threaded testfork} \ + -body { + set folder [makeDirectory unixtestfork] + set pid [testfork] + if {$pid == 0} { + # we are the forked process + set result initialized + set h [open [file join $folder test.txt] w] + fileevent $h writable\ + "set result writable;\ + after cancel [after 1000 {set result timeout}]" + vwait result + close $h + makeFile $result result.txt $folder + exit + } + # we are the original process + while {![file readable [file join $folder result.txt]]} {} + viewFile result.txt $folder + } \ + -result {writable} \ + -cleanup { + catch { removeFolder $folder } + } + +::tcltest::cleanupTests +return -- cgit v0.12 From 978b54229dc68812a5ccaa0050324d215db91520 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 Jul 2013 10:10:00 +0000 Subject: Fix bug which hangs iocmd.tf-32.1 --- unix/tclUnixNotfy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 88e290e..6e8b5fa 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -291,8 +291,8 @@ Tcl_InitNotifier(void) if (TclpThreadCreate(¬ifierThread, NotifierThreadProc, NULL, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_JOINABLE) != TCL_OK) { Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread"); - processIDInitialized = getpid(); } + processIDInitialized = getpid(); } notifierCount++; -- cgit v0.12 From f9820a2863b758aa1d07274355cd62f9ecbddae1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 Jul 2013 10:11:05 +0000 Subject: Test-case should pass on Darwin or with non-threaded build as well. --- tests/unixForkEvent.test | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test index fee45fd..a0c3f19 100644 --- a/tests/unixForkEvent.test +++ b/tests/unixForkEvent.test @@ -1,7 +1,6 @@ # This file contains a collection of tests for the procedures in the file -# tclEvent.c, which includes the "update", and "vwait" Tcl -# commands. Sourcing this file into Tcl runs the tests and generates -# output for errors. No output means no errors were found. +# tclUnixNotify.c. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. # # Copyright (c) 1995-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. @@ -13,15 +12,11 @@ package require tcltest 2 namespace import -force ::tcltest::* testConstraint testfork [llength [info commands testfork]] -testConstraint threaded [expr { - ([info exist tcl_platform(threaded)] && $tcl_platform(threaded)) - && $tcl_platform(os) ne "Darwin" -}] # Test if the notifier thread is well initialized in a forked interpreter # by Tcl_InitNotifier test unixforkevent-1.1 {fork and test writeable event} \ - -constraints {threaded testfork} \ + -constraints testfork \ -body { set folder [makeDirectory unixtestfork] set pid [testfork] -- cgit v0.12 From a038288139470e7a32c1e711fcfdbd64212e87e4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 Jul 2013 10:57:44 +0000 Subject: Use pthread_atfork() when available. --- unix/configure | 209 +++++++++++++++++++++++++++------------------------- unix/configure.in | 7 +- unix/tclUnixNotfy.c | 90 +++++++++++++++++++++- 3 files changed, 202 insertions(+), 104 deletions(-) diff --git a/unix/configure b/unix/configure index 6faa7d8..ee194b7 100755 --- a/unix/configure +++ b/unix/configure @@ -16759,6 +16759,113 @@ done #-------------------------------------------------------------------- +# Check for support of pthread_atfork function +#-------------------------------------------------------------------- + + +for ac_func in pthread_atfork +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +#-------------------------------------------------------------------- # Check for support of isnan() function or macro #-------------------------------------------------------------------- @@ -17439,108 +17546,6 @@ _ACEOF fi done - -for ac_func in pthread_atfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - fi cat >>confdefs.h <<\_ACEOF diff --git a/unix/configure.in b/unix/configure.in index e22a7d3..f47b882 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -491,6 +491,12 @@ SC_ENABLE_LANGINFO AC_CHECK_FUNCS(chflags) #-------------------------------------------------------------------- +# Check for support of pthread_atfork function +#-------------------------------------------------------------------- + +AC_CHECK_FUNCS(pthread_atfork) + +#-------------------------------------------------------------------- # Check for support of isnan() function or macro #-------------------------------------------------------------------- @@ -513,7 +519,6 @@ if test "`uname -s`" = "Darwin" ; then if test $tcl_corefoundation = yes; then AC_CHECK_HEADERS(libkern/OSAtomic.h) AC_CHECK_FUNCS(OSSpinLockLock) - AC_CHECK_FUNCS(pthread_atfork) fi AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?]) AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8", diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 6e8b5fa..f414c3f 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -202,7 +202,13 @@ static Tcl_ThreadId notifierThread; #ifdef TCL_THREADS static void NotifierThreadProc(ClientData clientData); -#endif +#ifdef HAVE_PTHREAD_ATFORK +static int atForkInit = 0; +static void AtForkPrepare(void); +static void AtForkParent(void); +static void AtForkChild(void); +#endif /* HAVE_PTHREAD_ATFORK */ +#endif /* TCL_THREADS */ static int FileHandlerEventProc(Tcl_Event *evPtr, int flags); /* @@ -276,6 +282,21 @@ Tcl_InitNotifier(void) */ Tcl_MutexLock(¬ifierMutex); +#ifdef HAVE_PTHREAD_ATFORK + /* + * Install pthread_atfork handlers to reinitialize the notifier in the + * child of a fork. + */ + + if (!atForkInit) { + int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild); + + if (result) { + Tcl_Panic("Tcl_InitNotifier: pthread_atfork failed"); + } + atForkInit = 1; + } +#endif /* * Check if my process id changed, e.g. I was forked * In this case, restart the notifier thread and close the @@ -1251,6 +1272,73 @@ NotifierThreadProc( TclpThreadExit (0); } + +#ifdef HAVE_PTHREAD_ATFORK +/* + *---------------------------------------------------------------------- + * + * AtForkPrepare -- + * + * Lock the notifier in preparation for a fork. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +AtForkPrepare(void) +{ +} + +/* + *---------------------------------------------------------------------- + * + * AtForkParent -- + * + * Unlock the notifier in the parent after a fork. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +AtForkParent(void) +{ +} + +/* + *---------------------------------------------------------------------- + * + * AtForkChild -- + * + * Unlock and reinstall the notifier in the child after a fork. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +AtForkChild(void) +{ + Tcl_InitNotifier(); +} +#endif /* HAVE_PTHREAD_ATFORK */ + #endif /* TCL_THREADS */ #endif /* HAVE_COREFOUNDATION */ -- cgit v0.12 From 7a32d8f6e8b39e52c94b3a375a95bd3b6669c12e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 Jul 2013 11:11:10 +0000 Subject: Tcl_InitNotifier() call in TestforkObjCmd() is only necessary when pthread_atfork() is not available. --- unix/tclUnixTest.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 39cddef..2fc1647 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -574,9 +574,12 @@ TestforkObjCmd( "Cannot fork", NULL); return TCL_ERROR; } +#ifndef HAVE_PTHREAD_ATFORK + /* Only needed when pthread_atfork is not present. */ if (pid==0) { Tcl_InitNotifier(); } +#endif Tcl_SetObjResult(interp, Tcl_NewIntObj(pid)); return TCL_OK; } -- cgit v0.12 From c81da08d4a5ddf07bf70bab9be966473b2520644 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Jul 2013 09:07:21 +0000 Subject: Add "testfork" test command. Not used in any test-case yet --- unix/configure | 204 ++++++++++++++++++++++++++--------------------------- unix/configure.in | 2 +- unix/tclUnixTest.c | 50 +++++++++++++ 3 files changed, 153 insertions(+), 103 deletions(-) diff --git a/unix/configure b/unix/configure index 6faa7d8..9fa5673 100755 --- a/unix/configure +++ b/unix/configure @@ -5303,6 +5303,108 @@ echo "${ECHO_T}no (default)" >&6 +for ac_func in pthread_atfork +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 #------------------------------------------------------------------------ @@ -17439,108 +17541,6 @@ _ACEOF fi done - -for ac_func in pthread_atfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - fi cat >>confdefs.h <<\_ACEOF diff --git a/unix/configure.in b/unix/configure.in index e22a7d3..5a7125e 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -93,6 +93,7 @@ fi #------------------------------------------------------------------------ SC_ENABLE_THREADS +AC_CHECK_FUNCS(pthread_atfork) #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 @@ -513,7 +514,6 @@ if test "`uname -s`" = "Darwin" ; then if test $tcl_corefoundation = yes; then AC_CHECK_HEADERS(libkern/OSAtomic.h) AC_CHECK_FUNCS(OSSpinLockLock) - AC_CHECK_FUNCS(pthread_atfork) fi AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?]) AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8", diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index b6529c2..2fc1647 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -66,6 +66,8 @@ static int TestfilewaitCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); static int TestfindexecutableCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); +static int TestforkObjCmd(ClientData dummy, + Tcl_Interp *interp, int objc, Tcl_Obj *CONST *argv); static int TestgetopenfileCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv); static int TestgetdefencdirCmd(ClientData dummy, @@ -110,6 +112,8 @@ TclplatformtestInit( (ClientData) 0, NULL); Tcl_CreateCommand(interp, "testfindexecutable", TestfindexecutableCmd, (ClientData) 0, NULL); + Tcl_CreateObjCommand(interp, "testfork", TestforkObjCmd, + (ClientData) 0, NULL); Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd, (ClientData) 0, NULL); Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd, @@ -533,6 +537,52 @@ TestsetdefencdirCmd( Tcl_SetDefaultEncodingDir(argv[1]); return TCL_OK; } + +/* + *---------------------------------------------------------------------- + * + * TestforkObjCmd -- + * + * This function implements the "testfork" command. It is used to + * fork the Tcl process for specific test cases. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TestforkObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *CONST *objv) /* Argument strings. */ +{ + pid_t pid; + + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, ""); + return TCL_ERROR; + } + pid = fork(); + if (pid == -1) { + Tcl_AppendResult(interp, + "Cannot fork", NULL); + return TCL_ERROR; + } +#ifndef HAVE_PTHREAD_ATFORK + /* Only needed when pthread_atfork is not present. */ + if (pid==0) { + Tcl_InitNotifier(); + } +#endif + Tcl_SetObjResult(interp, Tcl_NewIntObj(pid)); + return TCL_OK; +} /* *---------------------------------------------------------------------- -- cgit v0.12 From c75e578cb3af78543a31ac6ad4676324c9ce6b6c Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 Jul 2013 18:01:36 +0000 Subject: Stop checking stack depth in [catch] compiler. Stack depth is checked in compiles of *all* Tcl commands/scripts/bodies in debug builds already. --- generic/tclCompCmds.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7fe0728..bde6f96 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -544,7 +544,6 @@ TclCompileCatchCmd( JumpFixup jumpFixup; Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr; int resultIndex, optsIndex, range; - int initStackDepth = envPtr->currStackDepth; DefineLineInformation; /* TIP #280 */ /* @@ -742,15 +741,6 @@ TclCompileCatchCmd( TclEmitOpcode( INST_POP, envPtr); } - /* - * Result of all this, on either branch, should have been to leave one - * operand -- the return code -- on the stack. - */ - - if (envPtr->currStackDepth != initStackDepth + 1) { - Tcl_Panic("in TclCompileCatchCmd, currStackDepth = %d should be %d", - envPtr->currStackDepth, initStackDepth+1); - } return TCL_OK; } -- cgit v0.12 From 717285df9ed06247a6236610722e8fd22d124464 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 Jul 2013 18:03:39 +0000 Subject: Remove outdated comment. Stack depths are well checked now. --- generic/tclCompCmdsSZ.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 320ed57..d8587be 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -991,9 +991,6 @@ TclSubstCompile( * Instructions are added to envPtr to execute the "switch" command at * runtime. * - * FIXME: - * Stack depths are probably not calculated correctly. - * *---------------------------------------------------------------------- */ -- cgit v0.12 From 1ea19bb4bad3984855b928d2a5213314b1111e47 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 Jul 2013 20:11:00 +0000 Subject: Remove outdated, disabled code. --- generic/tclCompile.c | 503 --------------------------------------------------- 1 file changed, 503 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index a52ad3e..e4da2ba 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -16,8 +16,6 @@ #include "tclCompile.h" #include -#define REWRITE - /* * Table of all AuxData types. */ @@ -564,10 +562,6 @@ static void EnterCmdExtentData(CompileEnv *envPtr, int cmdNumber, int numSrcBytes, int numCodeBytes); static void EnterCmdStartData(CompileEnv *envPtr, int cmdNumber, int srcOffset, int codeOffset); -#ifndef REWRITE -static Command * FindCompiledCommandFromToken(Tcl_Interp *interp, - Tcl_Token *tokenPtr); -#endif static void FreeByteCodeInternalRep(Tcl_Obj *objPtr); static void FreeSubstCodeInternalRep(Tcl_Obj *objPtr); static int GetCmdLocEncodingSize(CompileEnv *envPtr); @@ -1672,56 +1666,6 @@ TclWordKnownAtCompileTime( return 1; } -#ifndef REWRITE -/* - * --------------------------------------------------------------------- - * - * FindCompiledCommandFromToken -- - * - * A simple helper that looks up a command's compiler from its token. - * - * --------------------------------------------------------------------- - */ - -static Command * -FindCompiledCommandFromToken( - Tcl_Interp *interp, - Tcl_Token *tokenPtr) -{ - Tcl_DString ds; - Command *cmdPtr; - - /* - * If we have a non-trivial token or are suppressing compilation, we stop - * right now. - */ - - if ((tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) - || (((Interp *) interp)->flags & DONT_COMPILE_CMDS_INLINE)) { - return NULL; - } - - /* - * We copy the string before trying to find the command by name. We used - * to modify the string in place, but this is not safe because the name - * resolution handlers could have side effects that rely on the unmodified - * string. - */ - - Tcl_DStringInit(&ds); - TclDStringAppendToken(&ds, &tokenPtr[1]); - cmdPtr = (Command *) Tcl_FindCommand(interp, Tcl_DStringValue(&ds), NULL, - /*flags*/ 0); - if (cmdPtr != NULL && (cmdPtr->compileProc == NULL - || (cmdPtr->nsPtr->flags & NS_SUPPRESS_COMPILATION) - || (cmdPtr->flags & CMD_HAS_EXEC_TRACES))) { - cmdPtr = NULL; - } - Tcl_DStringFree(&ds); - return cmdPtr; -} -#endif - /* *---------------------------------------------------------------------- * @@ -1740,8 +1684,6 @@ FindCompiledCommandFromToken( *---------------------------------------------------------------------- */ -#ifdef REWRITE - static int ExpandRequested( Tcl_Token *tokenPtr, @@ -2071,7 +2013,6 @@ CompileCommandTokens( return cmdIdx; } -#endif void TclCompileScript( @@ -2084,7 +2025,6 @@ TclCompileScript( * first null character. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { -#ifdef REWRITE int lastCmdIdx = -1; /* Index into envPtr->cmdMapPtr of the last * command this routine compiles into bytecode. * Initial value of -1 indicates this routine @@ -2198,449 +2138,6 @@ TclCompileScript( envPtr->codeNext--; envPtr->currStackDepth++; } -#else - int lastTopLevelCmdIndex = -1; - /* Index of most recent toplevel command in - * the command location table. Initialized to - * avoid compiler warning. */ - int startCodeOffset = -1; /* Offset of first byte of current command's - * code. Init. to avoid compiler warning. */ - unsigned char *entryCodeNext = envPtr->codeNext; - const char *p, *next; - Command *cmdPtr; - Tcl_Token *tokenPtr; - int bytesLeft, isFirstCmd, wordIdx, currCmdIndex, commandLength, objIndex; - /* TIP #280 */ - ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; - int *wlines, wlineat, cmdLine, *clNext; - Tcl_Parse parse, *parsePtr = &parse; - - if (envPtr->iPtr == NULL) { - Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); - } - - if (numBytes < 0) { - numBytes = strlen(script); - } - Tcl_ResetResult(interp); - isFirstCmd = 1; - - /* - * Each iteration through the following loop compiles the next command - * from the script. - */ - - p = script; - bytesLeft = numBytes; - cmdLine = envPtr->line; - clNext = envPtr->clNext; - do { - if (Tcl_ParseCommand(interp, p, bytesLeft, 0, parsePtr) != TCL_OK) { - /* - * Compile bytecodes to report the parse error at runtime. - */ - - Tcl_LogCommandInfo(interp, script, parsePtr->commandStart, - parsePtr->term + 1 - parsePtr->commandStart); - TclCompileSyntaxError(interp, envPtr); - break; - } - - /* - * TIP #280: We have to count newlines before the command even in the - * degenerate case when the command has no words. (See test - * info-30.33). - * So make that counting here, and not in the (numWords > 0) branch - * below. - */ - - TclAdvanceLines(&cmdLine, p, parsePtr->commandStart); - TclAdvanceContinuations(&cmdLine, &clNext, - parsePtr->commandStart - envPtr->source); - - if (parsePtr->numWords > 0) { - int expand = 0; /* Set if there are dynamic expansions to - * handle */ - - /* - * If not the first command, pop the previous command's result - * and, if we're compiling a top level command, update the last - * command's code size to account for the pop instruction. - */ - - if (!isFirstCmd) { - TclEmitOpcode(INST_POP, envPtr); - envPtr->cmdMapPtr[lastTopLevelCmdIndex].numCodeBytes = - (envPtr->codeNext - envPtr->codeStart) - - startCodeOffset; - } - - /* - * Determine the actual length of the command. - */ - - commandLength = parsePtr->commandSize; - if (parsePtr->term == parsePtr->commandStart + commandLength-1) { - /* - * The command terminator character (such as ; or ]) is the - * last character in the parsed command. Reduce the length by - * one so that the trace message doesn't include the - * terminator character. - */ - - commandLength -= 1; - } - -#ifdef TCL_COMPILE_DEBUG - /* - * If tracing, print a line for each top level command compiled. - */ - - if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { - fprintf(stdout, " Compiling: "); - TclPrintSource(stdout, parsePtr->commandStart, - TclMin(commandLength, 55)); - fprintf(stdout, "\n"); - } -#endif - - /* - * Check whether expansion has been requested for any of the - * words. - */ - - for (wordIdx = 0, tokenPtr = parsePtr->tokenPtr; - wordIdx < parsePtr->numWords; - wordIdx++, tokenPtr += tokenPtr->numComponents + 1) { - if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - expand = 1; - break; - } - } - - /* - * If expansion was requested, check if the command declares that - * it knows how to compile it. Note that if expansion is requested - * for the first word, this check will fail as the token type will - * inhibit it. (Checked inside FindCompiledCommandFromToken.) This - * is as it should be. - */ - - if (expand) { - cmdPtr = FindCompiledCommandFromToken(interp, - parsePtr->tokenPtr); - if (cmdPtr && (cmdPtr->flags & CMD_COMPILES_EXPANDED)) { - expand = 0; - } - } - - envPtr->numCommands++; - currCmdIndex = envPtr->numCommands - 1; - lastTopLevelCmdIndex = currCmdIndex; - startCodeOffset = envPtr->codeNext - envPtr->codeStart; - EnterCmdStartData(envPtr, currCmdIndex, - parsePtr->commandStart - envPtr->source, startCodeOffset); - - /* - * Should only start issuing instructions after the "command has - * started" so that the command range is correct in the bytecode. - */ - - if (expand) { - StartExpanding(envPtr); - } - - /* - * TIP #280. Scan the words and compute the extended location - * information. The map first contain full per-word line - * information for use by the compiler. This is later replaced by - * a reduced form which signals non-literal words, stored in - * 'wlines'. - */ - - EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source, - parsePtr->tokenPtr, parsePtr->commandStart, - parsePtr->commandSize, parsePtr->numWords, cmdLine, - clNext, &wlines, envPtr); - wlineat = eclPtr->nuloc - 1; - - /* - * Each iteration of the following loop compiles one word from the - * command. - */ - - for (wordIdx = 0, tokenPtr = parsePtr->tokenPtr; - wordIdx < parsePtr->numWords; wordIdx++, - tokenPtr += tokenPtr->numComponents + 1) { - /* - * Note the parse location information. - */ - - envPtr->line = eclPtr->loc[wlineat].line[wordIdx]; - envPtr->clNext = eclPtr->loc[wlineat].next[wordIdx]; - - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { - /* - * The word is not a simple string of characters. - */ - - CompileTokens(envPtr, tokenPtr, interp); - if (expand && tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - TclEmitInstInt4(INST_EXPAND_STKTOP, - envPtr->currStackDepth, envPtr); - } - continue; - } - - /* - * This is a simple string of literal characters (i.e. we know - * it absolutely and can use it directly). If this is the - * first word and the command has a compile procedure, let it - * compile the command. - */ - - if ((wordIdx == 0) && !expand) { - cmdPtr = FindCompiledCommandFromToken(interp, tokenPtr); - if (cmdPtr) { - int savedNumCmds = envPtr->numCommands; - unsigned savedCodeNext = - envPtr->codeNext - envPtr->codeStart; - int update = 0; - int startStackDepth = envPtr->currStackDepth; - - /* - * Mark the start of the command; the proper bytecode - * length will be updated later. There is no need to - * do this for the first bytecode in the compile env, - * as the check is done before calling - * TclNRExecuteByteCode(). Do emit an INST_START_CMD - * in special cases where the first bytecode is in a - * loop, to insure that the corresponding command is - * counted properly. Compilers for commands able to - * produce such a beast (currently 'while 1' only) set - * envPtr->atCmdStart to 0 in order to signal this - * case. [Bug 1752146] - * - * Note that the environment is initialised with - * atCmdStart=1 to avoid emitting ISC for the first - * command. - */ - - if (envPtr->atCmdStart == 1) { - if (savedCodeNext != 0) { - /* - * Increase the number of commands being - * started at the current point. Note that - * this depends on the exact layout of the - * INST_START_CMD's operands, so be careful! - */ - - TclIncrUInt4AtPtr(envPtr->codeNext - 4, 1) - } - } else if (envPtr->atCmdStart == 0) { - TclEmitInstInt4(INST_START_CMD, 0, envPtr); - TclEmitInt4(1, envPtr); - update = 1; - } - - if (cmdPtr->compileProc(interp, parsePtr, cmdPtr, - envPtr) == TCL_OK) { - /* - * Confirm that the command compiler generated a - * single value on the stack as its result. This - * is only done in debugging mode, as it *should* - * be correct and normal users have no reasonable - * way to fix it anyway. - */ - -#ifdef TCL_COMPILE_DEBUG - int diff = envPtr->currStackDepth-startStackDepth; - - if (diff != 1) { - Tcl_Panic("bad stack adjustment when compiling" - " %.*s (was %d instead of 1)", - parsePtr->tokenPtr->size, - parsePtr->tokenPtr->start, diff); - } -#endif - if (update) { - /* - * Fix the bytecode length. - */ - - unsigned char *fixPtr = envPtr->codeStart - + savedCodeNext + 1; - unsigned fixLen = envPtr->codeNext - - envPtr->codeStart - savedCodeNext; - - TclStoreInt4AtPtr(fixLen, fixPtr); - } - goto finishCommand; - } - - if (envPtr->atCmdStart == 1 && savedCodeNext != 0) { - /* - * Decrease the number of commands being started - * at the current point. Note that this depends on - * the exact layout of the INST_START_CMD's - * operands, so be careful! - */ - - TclIncrUInt4AtPtr(envPtr->codeNext - 4, -1); - } - - /* - * Restore numCommands and codeNext to their correct - * values, removing any commands compiled before the - * failure to produce bytecode got reported. [Bugs - * 705406 and 735055] - */ - - envPtr->numCommands = savedNumCmds; - envPtr->codeNext = envPtr->codeStart + savedCodeNext; - - /* - * And the stack depth too!! [Bug 3614102]. - */ - - envPtr->currStackDepth = startStackDepth; - } - - /* - * No compile procedure so push the word. If the command - * was found, push a CmdName object to reduce runtime - * lookups. Mark this as a command name literal to reduce - * shimmering. - */ - - objIndex = TclRegisterNewCmdLiteral(envPtr, - tokenPtr[1].start, tokenPtr[1].size); - if (cmdPtr) { - TclSetCmdNameObj(interp, - TclFetchLiteral(envPtr, objIndex), cmdPtr); - } - } else { - /* - * Simple argument word of a command. We reach this if and - * only if the command word was not compiled for whatever - * reason. Register the literal's location for use by - * uplevel, etc. commands, should they encounter it - * unmodified. We care only if the we are in a context - * which already allows absolute counting. - */ - - objIndex = TclRegisterNewLiteral(envPtr, - tokenPtr[1].start, tokenPtr[1].size); - - if (envPtr->clNext) { - TclContinuationsEnterDerived( - TclFetchLiteral(envPtr, objIndex), - tokenPtr[1].start - envPtr->source, - eclPtr->loc[wlineat].next[wordIdx]); - } - } - TclEmitPush(objIndex, envPtr); - } /* for loop */ - - /* - * Emit an invoke instruction for the command. We skip this if a - * compile procedure was found for the command. - */ - assert(wordIdx > 0); - - if (expand) { - /* - * The stack depth during argument expansion can only be - * managed at runtime, as the number of elements in the - * expanded lists is not known at compile time. We adjust here - * the stack depth estimate so that it is correct after the - * command with expanded arguments returns. - * - * The end effect of this command's invocation is that all the - * words of the command are popped from the stack, and the - * result is pushed: the stack top changes by (1-wordIdx). - * - * Note that the estimates are not correct while the command - * is being prepared and run, INST_EXPAND_STKTOP is not - * stack-neutral in general. - */ - - TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr); - envPtr->expandCount--; - TclAdjustStackDepth(1 - wordIdx, envPtr); - } else { - /* - * Save PC -> command map for the TclArgumentBC* functions. - */ - - int isnew; - Tcl_HashEntry *hePtr = Tcl_CreateHashEntry(&eclPtr->litInfo, - INT2PTR(envPtr->codeNext - envPtr->codeStart), - &isnew); - - Tcl_SetHashValue(hePtr, INT2PTR(wlineat)); - if (wordIdx <= 255) { - TclEmitInstInt1(INST_INVOKE_STK1, wordIdx, envPtr); - } else { - TclEmitInstInt4(INST_INVOKE_STK4, wordIdx, envPtr); - } - } - - /* - * Update the compilation environment structure and record the - * offsets of the source and code for the command. - */ - - finishCommand: - EnterCmdExtentData(envPtr, currCmdIndex, commandLength, - (envPtr->codeNext-envPtr->codeStart) - startCodeOffset); - isFirstCmd = 0; - - /* - * TIP #280: Free full form of per-word line data and insert the - * reduced form now - */ - - ckfree(eclPtr->loc[wlineat].line); - ckfree(eclPtr->loc[wlineat].next); - eclPtr->loc[wlineat].line = wlines; - eclPtr->loc[wlineat].next = NULL; - } /* end if parsePtr->numWords > 0 */ - - /* - * Advance to the next command in the script. - */ - - next = parsePtr->commandStart + parsePtr->commandSize; - bytesLeft -= next - p; - p = next; - - /* - * TIP #280: Track lines in the just compiled command. - */ - - TclAdvanceLines(&cmdLine, parsePtr->commandStart, p); - TclAdvanceContinuations(&cmdLine, &clNext, p - envPtr->source); - Tcl_FreeParse(parsePtr); - } while (bytesLeft > 0); - - /* - * TIP #280: Bring the line counts in the CompEnv up to date. - * See tests info-30.33,34,35 . - */ - - envPtr->line = cmdLine; - envPtr->clNext = clNext; - - /* - * If the source script yielded no instructions (e.g., if it was empty), - * push an empty string as the command's result. - */ - - if (envPtr->codeNext == entryCodeNext) { - PushStringLiteral(envPtr, ""); - } -#endif } /* -- cgit v0.12 From 8f13e41a87de841f8b7552e04e74caeaca8b4b5b Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 24 Jul 2013 12:13:01 +0000 Subject: more disabled code removal --- generic/tclAssembly.c | 7 ------- generic/tclEnsemble.c | 46 ---------------------------------------------- 2 files changed, 53 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 9b9b6f8..6bf2fa8 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -930,11 +930,9 @@ TclCompileAssembleCmd( { Tcl_Token *tokenPtr; /* Token in the input script */ -#if 1 int numCommands = envPtr->numCommands; int offset = envPtr->codeNext - envPtr->codeStart; int depth = envPtr->currStackDepth; -#endif /* * Make sure that the command has a single arg that is a simple word. @@ -956,7 +954,6 @@ TclCompileAssembleCmd( if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start, tokenPtr[1].size, TCL_EVAL_DIRECT)) { -#if 1 Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (\"%.*s\" body, line %d)", parsePtr->tokenPtr->size, parsePtr->tokenPtr->start, @@ -965,10 +962,6 @@ TclCompileAssembleCmd( envPtr->codeNext = envPtr->codeStart + offset; envPtr->currStackDepth = depth; TclCompileSyntaxError(interp, envPtr); -#else - Tcl_ResetResult(interp); - return TCL_ERROR; -#endif } return TCL_OK; } diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index bab63c9..ad11785 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -3205,7 +3205,6 @@ CompileBasicNArgCommand( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { -#if 1 Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_IncrRefCount(objPtr); @@ -3213,51 +3212,6 @@ CompileBasicNArgCommand( TclCompileInvocation(interp, parsePtr->tokenPtr, objPtr, parsePtr->numWords, envPtr); Tcl_DecrRefCount(objPtr); -#else - Tcl_Token *tokenPtr; - Tcl_Obj *objPtr; - char *bytes; - int length, i, literal; - DefineLineInformation; - - /* - * Push the name of the command we're actually dispatching to as part of - * the implementation. - */ - - objPtr = Tcl_NewObj(); - Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr); - bytes = Tcl_GetStringFromObj(objPtr, &length); - literal = TclRegisterNewCmdLiteral(envPtr, bytes, length); - TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, literal), cmdPtr); - TclEmitPush(literal, envPtr); - TclDecrRefCount(objPtr); - - /* - * Push the words of the command. - */ - - tokenPtr = TokenAfter(parsePtr->tokenPtr); - for (i=1 ; inumWords ; i++) { - if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { - PushLiteral(envPtr, tokenPtr[1].start, tokenPtr[1].size); - } else { - SetLineInformation(i); - CompileTokens(envPtr, tokenPtr, interp); - } - tokenPtr = TokenAfter(tokenPtr); - } - - /* - * Do the standard dispatch. - */ - - if (i <= 255) { - TclEmitInstInt1(INST_INVOKE_STK1, i, envPtr); - } else { - TclEmitInstInt4(INST_INVOKE_STK4, i, envPtr); - } -#endif return TCL_OK; } -- cgit v0.12 From f9e25fe5e7e67249f73b8f5926b3b5549c0e212e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 24 Jul 2013 13:58:35 +0000 Subject: Mark commands with potential to compile expansion arguments (as [list] does). --- generic/tclCompCmds.c | 9 +++++++++ generic/tclCompCmdsGR.c | 4 ++++ generic/tclCompCmdsSZ.c | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index bde6f96..8edb2d9 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -87,6 +87,7 @@ TclCompileAppendCmd( int isScalar, localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ + /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; if (numWords == 1) { return TCL_ERROR; @@ -973,6 +974,7 @@ TclCompileDictGetCmd( * case is legal, but too special and magic for us to deal with here). */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { return TCL_ERROR; } @@ -1010,6 +1012,7 @@ TclCompileDictExistsCmd( * case is legal, but too special and magic for us to deal with here). */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { return TCL_ERROR; } @@ -1047,6 +1050,7 @@ TclCompileDictUnsetCmd( * compile to bytecode. */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { return TCL_ERROR; } @@ -1192,6 +1196,7 @@ TclCompileDictMergeCmd( * argument, the only thing to do is to verify the dict-ness. */ + /* TODO: Consider support for compiling expanded args. (less likely) */ if (parsePtr->numWords < 2) { PushStringLiteral(envPtr, ""); return TCL_OK; @@ -1712,6 +1717,7 @@ TclCompileDictAppendCmd( * speed quite so much. ;-) */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords<4 || parsePtr->numWords>100) { return TCL_ERROR; } @@ -1764,6 +1770,8 @@ TclCompileDictLappendCmd( * There must be three arguments after the command. */ + /* TODO: Consider support for compiling expanded args. */ + /* Probably not. Why is INST_DICT_LAPPEND limited to one value? */ if (parsePtr->numWords != 4) { return TCL_ERROR; } @@ -1810,6 +1818,7 @@ TclCompileDictWithCmd( * There must be at least one argument after the command. */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { return TCL_ERROR; } diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index fc68509..150c378 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -60,6 +60,7 @@ TclCompileGlobalCmd( int localIndex, numWords, i; DefineLineInformation; /* TIP #280 */ + /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; if (numWords < 2) { return TCL_ERROR; @@ -820,6 +821,7 @@ TclCompileLappendCmd( return TCL_ERROR; } + /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords; if (numWords == 1) { return TCL_ERROR; @@ -1061,6 +1063,7 @@ TclCompileLindexCmd( * Quit if too few args. */ + /* TODO: Consider support for compiling expanded args. */ if (numWords <= 1) { return TCL_ERROR; } @@ -1583,6 +1586,7 @@ TclCompileLsetCmd( * Check argument count. */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { /* * Fail at run time, not in compilation. diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index d8587be..d1eb9db 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -2818,6 +2818,7 @@ TclCompileUnsetCmd( Tcl_Obj *leadingWord; DefineLineInformation; /* TIP #280 */ + /* TODO: Consider support for compiling expanded args. */ numWords = parsePtr->numWords-1; flags = 1; varTokenPtr = TokenAfter(parsePtr->tokenPtr); @@ -3173,6 +3174,7 @@ CompileAssociativeBinaryOpCmd( DefineLineInformation; /* TIP #280 */ int words; + /* TODO: Consider support for compiling expanded args. */ for (words=1 ; wordsnumWords ; words++) { tokenPtr = TokenAfter(tokenPtr); CompileWord(envPtr, tokenPtr, interp, words); @@ -3256,6 +3258,7 @@ CompileComparisonOpCmd( Tcl_Token *tokenPtr; DefineLineInformation; /* TIP #280 */ + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords < 3) { PUSH("1"); } else if (parsePtr->numWords == 3) { @@ -3593,6 +3596,7 @@ TclCompileMinusOpCmd( DefineLineInformation; /* TIP #280 */ int words; + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords == 1) { /* * Fallback to direct eval to report syntax error. @@ -3638,6 +3642,7 @@ TclCompileDivOpCmd( DefineLineInformation; /* TIP #280 */ int words; + /* TODO: Consider support for compiling expanded args. */ if (parsePtr->numWords == 1) { /* * Fallback to direct eval to report syntax error. -- cgit v0.12 From 7682f9c4cd7dfb3439a27d03b4531358798ff443 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 24 Jul 2013 16:51:04 +0000 Subject: Demonstrate and fix memory leak in Tcl_ParseVar(). --- generic/tclParse.c | 1 + tests/parse.test | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/generic/tclParse.c b/generic/tclParse.c index 96c2a10..e475fb8 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -1566,6 +1566,7 @@ Tcl_ParseVar( code = TclSubstTokens(interp, parsePtr->tokenPtr, parsePtr->numTokens, NULL, 1, NULL, NULL); + Tcl_FreeParse(parsePtr); TclStackFree(interp, parsePtr); if (code != TCL_OK) { return NULL; diff --git a/tests/parse.test b/tests/parse.test index 4605914..d7de5ff 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -23,6 +23,7 @@ testConstraint testparsevarname [llength [info commands testparsevarname]] testConstraint testparsevar [llength [info commands testparsevar]] testConstraint testasync [llength [info commands testasync]] testConstraint testcmdtrace [llength [info commands testcmdtrace]] +testConstraint memory [llength [info commands memory]] test parse-1.1 {Tcl_ParseCommand procedure, computing string length} testparser { testparser [bytestring "foo\0 bar"] -1 @@ -674,6 +675,26 @@ test parse-13.5 {Tcl_ParseVar procedure, error looking up variable} testparsevar unset -nocomplain abc list [catch {testparsevar {$abc([bogus x y z])}} msg] $msg } {1 {invalid command name "bogus"}} +test parse-13.6 {Tcl_ParseVar memory leak} -constraints memory -setup { + proc getbytes {} { + return [lindex [split [memory info] \n] 3 3] + } +} -body { + set a() foo + set end [getbytes] + for {set i 0} {$i < 5} {incr i} { + set vn {} + set res [testparsevar [append vn $ a([string repeat {[]} 19]) bar]] + if {$res ne {foo bar}} {error "Unexpected result: $res"} + + set tmp $end + set end [getbytes] + } + expr {$end - $tmp} +} -cleanup { + unset -nocomplain a end i vn res tmp + rename getbytes {} +} -result 0 test parse-14.1 {Tcl_ParseBraces procedure, computing string length} testparser { testparser [bytestring "foo\0 bar"] -1 -- cgit v0.12 From e048f90718b9ad348b7ea46ad2196e19502042c1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 25 Jul 2013 06:59:08 +0000 Subject: Put Cygwin's tclWinError.o in PLAT_OBJS, not in DL_OBJS --- unix/Makefile.in | 5 ++++- unix/configure | 3 ++- unix/tcl.m4 | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index b5ca879..163f4b5 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -335,7 +335,10 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_unsigned_bin_size.o bn_mp_xor.o bn_mp_zero.o bn_s_mp_add.o \ bn_s_mp_mul_digs.o bn_s_mp_sqr.o bn_s_mp_sub.o -STUB_LIB_OBJS = tclStubLib.o tclTomMathStubLib.o tclOOStubLib.o ${COMPAT_OBJS} +STUB_LIB_OBJS = tclStubLib.o \ + tclTomMathStubLib.o \ + tclOOStubLib.o \ + ${COMPAT_OBJS} UNIX_OBJS = tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o \ tclUnixFile.o tclUnixPipe.o tclUnixSock.o \ diff --git a/unix/configure b/unix/configure index ef47ac5..4d0ecef 100755 --- a/unix/configure +++ b/unix/configure @@ -7170,7 +7170,8 @@ fi SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" - DL_OBJS="tclLoadDl.o tclWinError.o" + DL_OBJS="tclLoadDl.o" + PLAT_OBJS="tclWinError.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index b9b6532..a95cf63 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1224,7 +1224,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" - DL_OBJS="tclLoadDl.o tclWinError.o" + DL_OBJS="tclLoadDl.o" + PLAT_OBJS="tclWinError.o" DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" -- cgit v0.12 From 69fbd6c489ee246d40067e6a6394419ecb9a6b07 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 25 Jul 2013 08:29:56 +0000 Subject: Make sure that the notifierMutex and notifierCV in a forked child cannot block anything, even though the initialization of the Notifier Thread in the parent is not finished yet. --- unix/tclUnixNotfy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index f414c3f..ec721ca 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1335,6 +1335,8 @@ AtForkParent(void) static void AtForkChild(void) { + notifierMutex = NULL; + notifierCV = NULL; Tcl_InitNotifier(); } #endif /* HAVE_PTHREAD_ATFORK */ -- cgit v0.12 From 7fb69e61c80a0f943d0cbc01e7f4ba39eb2cb737 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 25 Jul 2013 14:24:39 +0000 Subject: Move test for pthread_atfork inside SC_ENABLE_THREADS --- unix/configure | 105 ++---------------------------------------------------- unix/configure.in | 1 - unix/tcl.m4 | 2 +- 3 files changed, 3 insertions(+), 105 deletions(-) diff --git a/unix/configure b/unix/configure index 9fa5673..217e5d4 100755 --- a/unix/configure +++ b/unix/configure @@ -4796,7 +4796,8 @@ echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you m ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" -for ac_func in pthread_attr_setstacksize + +for ac_func in pthread_attr_setstacksize pthread_atfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -5303,108 +5304,6 @@ echo "${ECHO_T}no (default)" >&6 -for ac_func in pthread_atfork -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 #------------------------------------------------------------------------ diff --git a/unix/configure.in b/unix/configure.in index 5a7125e..37de8be 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -93,7 +93,6 @@ fi #------------------------------------------------------------------------ SC_ENABLE_THREADS -AC_CHECK_FUNCS(pthread_atfork) #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 879d810..f484989 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -679,7 +679,7 @@ AC_DEFUN([SC_ENABLE_THREADS], [ ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" - AC_CHECK_FUNCS(pthread_attr_setstacksize) + AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork) AC_CHECK_FUNC(pthread_attr_get_np,tcl_ok=yes,tcl_ok=no) if test $tcl_ok = yes ; then AC_DEFINE(HAVE_PTHREAD_ATTR_GET_NP, 1, -- cgit v0.12 From 9b087e12907c940eed87b510213ca363ef8d5a4b Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 25 Jul 2013 17:20:02 +0000 Subject: Fixed test case variable clash with 'folder' --- tests/unixForkEvent.test | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test index a0c3f19..cbe582e 100644 --- a/tests/unixForkEvent.test +++ b/tests/unixForkEvent.test @@ -18,27 +18,27 @@ testConstraint testfork [llength [info commands testfork]] test unixforkevent-1.1 {fork and test writeable event} \ -constraints testfork \ -body { - set folder [makeDirectory unixtestfork] + set myFolder [makeDirectory unixtestfork] set pid [testfork] if {$pid == 0} { # we are the forked process set result initialized - set h [open [file join $folder test.txt] w] + set h [open [file join $myFolder test.txt] w] fileevent $h writable\ "set result writable;\ after cancel [after 1000 {set result timeout}]" vwait result close $h - makeFile $result result.txt $folder + makeFile $result result.txt $myFolder exit } # we are the original process - while {![file readable [file join $folder result.txt]]} {} - viewFile result.txt $folder + while {![file readable [file join $myFolder result.txt]]} {} + viewFile result.txt $myFolder } \ -result {writable} \ -cleanup { - catch { removeFolder $folder } + catch { removeFolder $myFolder } } ::tcltest::cleanupTests -- cgit v0.12 From c86bd1b78ad2eec0899db1c0927048cf9f0ed435 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 26 Jul 2013 13:21:30 +0000 Subject: [6585b21ca8] [regexp {(\w).*?\1} abb] failed to match. Thanks to Tom Lane for passing on the discovery in Postgres. --- generic/regexec.c | 7 +------ tests/regexp.test | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/generic/regexec.c b/generic/regexec.c index c902209..205fcc2 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -512,12 +512,7 @@ cfindloop( return er; } if ((shorter) ? end == estop : end == begin) { - /* - * No point in trying again. - */ - - *coldp = cold; - return REG_NOMATCH; + break; } /* diff --git a/tests/regexp.test b/tests/regexp.test index 8138054..362f425 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -728,6 +728,10 @@ test regexp-22.5 {Bug 3610026} -setup { } -cleanup { unset -nocomplain e cp } -returnCodes error -match glob -result {*too many colors*} +test regexp-22.6 {Bug 6585b21ca8} { + expr {[regexp {(\w).*?\1} Programmer m] ? $m : ""} +} rogr + test regexp-23.1 {regexp -all and -line} { set string "" -- cgit v0.12 From 83bd34e627b2f9c0c0b5fe3917e82f3428dc9565 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 27 Jul 2013 20:29:42 +0000 Subject: Simplify AuxData access with a macro. --- generic/tclAssembly.c | 2 +- generic/tclCompile.c | 1 + generic/tclCompile.h | 9 +++++++++ tests/subst.test | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 6bf2fa8..100e9ef 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -3047,7 +3047,7 @@ ResolveJumpTableTargets( auxDataIndex = TclGetInt4AtPtr(envPtr->codeStart + bbPtr->jumpOffset + 1); DEBUG_PRINT("bbPtr = %p jumpOffset = %d auxDataIndex = %d\n", bbPtr, bbPtr->jumpOffset, auxDataIndex); - realJumpTablePtr = envPtr->auxDataArrayPtr[auxDataIndex].clientData; + realJumpTablePtr = TclFetchAuxData(envPtr, auxDataIndex); realJumpHashPtr = &realJumpTablePtr->hashTable; /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index e4da2ba..772ce22 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -2055,6 +2055,7 @@ TclCompileScript( #ifdef TCL_COMPILE_DEBUG /* * If tracing, print a line for each top level command compiled. + * TODO: Suppress when numWords == 0 ? */ if ((tclTraceCompile >= 1) && (envPtr->procPtr == NULL)) { diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 56315db..beb28fd 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1113,6 +1113,15 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); *---------------------------------------------------------------- */ +/* + * Simplified form to access AuxData. + * + * ClientData TclFetchAuxData(CompileEng *envPtr, int index); + */ + +#define TclFetchAuxData(envPtr, index) \ + (envPtr)->auxDataArrayPtr[(index)].clientData + #define LITERAL_ON_HEAP 0x01 #define LITERAL_CMD_NAME 0x02 diff --git a/tests/subst.test b/tests/subst.test index 4be4798..7466895 100644 --- a/tests/subst.test +++ b/tests/subst.test @@ -293,6 +293,10 @@ test subst-13.1 {Bug 3081065} -setup { } -cleanup { removeFile subst13.tcl } +test subst-13.2 {Test for segfault} -body { + subst {[} +} -returnCodes error -result * -match glob + # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 35f064fd91f1a987c493f4740df59d3a0f162a42 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 29 Jul 2013 09:29:16 +0000 Subject: Make sure that "string is space \u202f" will continue to return "1", even if in future Unicode this character (NARROW_NO_BREAK_SPACE) will cease to be a space. See: [http://www.unicode.org/review/pri249/] --- generic/tclUtf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index a038f8a..e5497a4 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1555,7 +1555,7 @@ Tcl_UniCharIsSpace( if (((Tcl_UniChar) ch) < ((Tcl_UniChar) 0x80)) { return TclIsSpaceProc((char) ch); - } else if ((Tcl_UniChar) ch == 0x180e) { + } else if ((Tcl_UniChar) ch == 0x180e || (Tcl_UniChar) ch == 0x202f) { return 1; } else { return ((SPACE_BITS >> GetCategory(ch)) & 1); -- cgit v0.12 From 2145004977c06c1989ad5ad0ee2d800da3353001 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 1 Aug 2013 19:18:02 +0000 Subject: [1905562] [8d2c0da36d] Raise the recursion limits on regexps to allow existing regexps "in the wild" to continue working with Tcl 8.6. Latest example comes from DejaGnu. --- generic/regc_nfa.c | 2 +- tests/reg.test | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/regc_nfa.c b/generic/regc_nfa.c index fc0c823..42489dd 100644 --- a/generic/regc_nfa.c +++ b/generic/regc_nfa.c @@ -824,7 +824,7 @@ duptraverse( * make all normal tests (not reg-33.14) pass. */ #ifndef DUPTRAVERSE_MAX_DEPTH -#define DUPTRAVERSE_MAX_DEPTH 700 +#define DUPTRAVERSE_MAX_DEPTH 15000 #endif if (depth++ > DUPTRAVERSE_MAX_DEPTH) { diff --git a/tests/reg.test b/tests/reg.test index 559f549..e6ce42c 100644 --- a/tests/reg.test +++ b/tests/reg.test @@ -1155,6 +1155,9 @@ test reg-33.15 {Bug 3603557 - an "in the wild" RE} { (.*) # ConditionalFields }] 0 } 68 +test reg-33.16 {Bug [8d2c0da36d]- another "in the wild" RE} { + lindex [regexp -about "^MRK:client1: =1339 14HKelly Talisman 10011000 (\[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]*) \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 8 0 8 0 0 0 77 77 1 1 2 0 11 { 1 3 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 13HC6 My Creator 2 3 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 31HC7 Slightly offensive name, huh 3 8 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 23HE-mail:kelly@hotbox.com 4 9 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 17Hcompface must die 5 10 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 0 3HAir 6 12 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 14HPGP public key 7 13 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 16Hkelly@hotbox.com 8 30 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 0 12H2 text/plain 9 30 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 0 13H2 x-kom/basic 10 33 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 1H0 11 14 8 \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* \[0-9\]* 00000000 1 1H3 }\r?"] 0 +} 1 # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 6af366a7dcf18d187e53d5e58264b34675b31d22 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 2 Aug 2013 14:58:58 +0000 Subject: [9d61624b3d]: Stop crashes when emptying the superclass slot. --- generic/tclOODefineCmds.c | 48 ++++++++++++++++++++++++++++------------------- tests/oo.test | 17 +++++++++++++++++ 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index bacab38..1a5058c 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -2206,29 +2206,39 @@ ClassSuperSet( /* * Parse the arguments to get the class to use as superclasses. + * + * Note that zero classes is special, as it is equivalent to just the + * class of objects. [Bug 9d61624b3d] */ - for (i=0 ; ifPtr->objectCls; + superc = 1; + } else { + for (i=0 ; iclassPtr, superclasses[i])) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "attempt to form circular dependency graph", -1)); - Tcl_SetErrorCode(interp, "TCL", "OO", "CIRCULARITY", NULL); - failedAfterAlloc: - ckfree((char *) superclasses); - return TCL_ERROR; + for (j=0 ; jclassPtr, superclasses[i])) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "attempt to form circular dependency graph", -1)); + Tcl_SetErrorCode(interp, "TCL", "OO", "CIRCULARITY", NULL); + failedAfterAlloc: + ckfree((char *) superclasses); + return TCL_ERROR; + } } } diff --git a/tests/oo.test b/tests/oo.test index 49fe150..6f16a8d 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -3374,6 +3374,23 @@ test oo-34.8 {TIP 380: slots - presence} { test oo-34.9 {TIP 380: slots - presence} { getMethods oo::objdefine::variable } {{-append -clear -set} {Get Set}} + +test oo-35.1 {Bug 9d61624b3d: Empty superclass must not cause crash} -setup { + oo::class create fruit { + method eat {} {} + } + set result {} +} -body { + lappend result [fruit create ::apple] [info class superclasses fruit] + oo::define fruit superclass + lappend result [info class superclasses fruit] \ + [info object class apple oo::object] \ + [info class call fruit destroy] \ + [catch { apple }] +} -cleanup { + unset -nocomplain result + fruit destroy +} -result {::apple ::oo::object ::oo::object 1 {{method destroy ::oo::object {core method: "destroy"}}} 1} cleanupTests return -- cgit v0.12 From ed2e06d4526c12d6cb4c559b6746216396ca4a10 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 2 Aug 2013 20:19:44 +0000 Subject: Deal with the elaborate rip-apart-a-metaclass case as well. --- ChangeLog | 11 ++++++++--- generic/tclOODefineCmds.c | 3 +++ tests/oo.test | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b794da5..a82dbfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,13 @@ +2013-08-02 Donal Fellows + + * generic/tclOODefineCmds.c (ClassSuperSet): Bug [9d61624b3d]: Stop + crashes when emptying the superclass slot, even when doing elaborate + things with metaclasses. + 2013-08-01 Harald Oehlmann - * tclUnixNotify.c Tcl_InitNotifier: Bug [a0bc856dcd] - Start notifier thread again if we were forked, to solve Rivet bug - 55153. + * tclUnixNotify.c (Tcl_InitNotifier): Bug [a0bc856dcd]: Start notifier + thread again if we were forked, to solve Rivet bug 55153. 2013-07-05 Kevin B. Kenny diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 1a5058c..f0983cc 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -2215,6 +2215,9 @@ ClassSuperSet( superclasses = ckrealloc(superclasses, sizeof(Class *)); superclasses[0] = oPtr->fPtr->objectCls; superc = 1; + if (TclOOIsReachable(oPtr->fPtr->classCls, oPtr->classPtr)) { + superclasses[0] = oPtr->fPtr->classCls; + } } else { for (i=0 ; i Date: Sat, 3 Aug 2013 15:27:40 +0000 Subject: [3611643fff]: Support TclOO in autoload mechanism. --- ChangeLog | 5 +++++ library/auto.tcl | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index a82dbfd..ddde893 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-08-03 Donal Fellows + + * library/auto.tcl: [Patch 3611643]: Allow TclOO classes to be found + by the autoloading mechanism. + 2013-08-02 Donal Fellows * generic/tclOODefineCmds.c (ClassSuperSet): Bug [9d61624b3d]: Stop diff --git a/library/auto.tcl b/library/auto.tcl index 0848bb1..78c219e 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -617,4 +617,18 @@ auto_mkindex_parser::command namespace {op args} { } } +# AUTO MKINDEX: oo::class create name ?definition? +# Adds an entry to the auto index list for the given class name. +foreach cmd {oo::class class} { + auto_mkindex_parser::command $cmd {ecmd name {body ""}} { + if {$cmd eq "create"} { + variable index + variable scriptFile + append index [format "set %s \[list source \[%s]]\n" \ + [list auto_index([fullname $name])] \ + [list file join $dir {*}[file split $scriptFile]]] + } + } +} + return -- cgit v0.12 From 4fa8d0b58071c8c666a320ef21813e12303c3564 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 5 Aug 2013 21:58:21 +0000 Subject: Mark unixforkevent-1.1 nonPortable, until proven on more platforms. --- tests/unixForkEvent.test | 2 +- unix/tclUnixTest.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test index cbe582e..120f362 100644 --- a/tests/unixForkEvent.test +++ b/tests/unixForkEvent.test @@ -16,7 +16,7 @@ testConstraint testfork [llength [info commands testfork]] # Test if the notifier thread is well initialized in a forked interpreter # by Tcl_InitNotifier test unixforkevent-1.1 {fork and test writeable event} \ - -constraints testfork \ + -constraints {testfork nonPortable} \ -body { set myFolder [makeDirectory unixtestfork] set pid [testfork] diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 2fc1647..d2b729d 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -574,8 +574,8 @@ TestforkObjCmd( "Cannot fork", NULL); return TCL_ERROR; } -#ifndef HAVE_PTHREAD_ATFORK - /* Only needed when pthread_atfork is not present. */ +#if !defined(HAVE_PTHREAD_ATFORK) || defined(MAC_OSX_TCL) + /* Only needed when pthread_atfork is not present or on OSX. */ if (pid==0) { Tcl_InitNotifier(); } -- cgit v0.12 From b3b497f42cfe1a533488c23fb8dfd706e7bb59a6 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Aug 2013 04:15:16 +0000 Subject: The value TCL_LOCATION_EVAL_LIST in the type field of a CmdFrame appears to exist only for the sake of taking great pains to make sure that pure list values remain pure list values. The value of pure list values is no longer what it once was. For a long long time now, any canonical list values have been equally good. This branch is Work In Progress eliminating the complication of the additional type value. Currently some minor botches are breaking execution tracing tests. --- generic/tclBasic.c | 67 ++++++++++++++++++---------------------------------- generic/tclCmdIL.c | 25 ++++---------------- generic/tclCompile.c | 2 +- generic/tclInt.h | 41 +++++++++++++++----------------- 4 files changed, 48 insertions(+), 87 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 82affb0..280835c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -128,7 +128,7 @@ static Tcl_ObjCmdProc ExprSrandFunc; static Tcl_ObjCmdProc ExprUnaryFunc; static Tcl_ObjCmdProc ExprWideFunc; static Tcl_Obj * GetCommandSource(Interp *iPtr, int objc, - Tcl_Obj *const objv[], int lookup); + Tcl_Obj *const objv[]); static void MathFuncWrongNumArgs(Tcl_Interp *interp, int expected, int actual, Tcl_Obj *const *objv); static Tcl_NRPostProc NRCoroutineCallerCallback; @@ -3358,15 +3358,6 @@ CancelEvalProc( * This function returns a Tcl_Obj with the full source string for the * command. This insures that traces get a correct NUL-terminated command * string. The Tcl_Obj has refCount==1. - * - * *** MAINTAINER WARNING *** - * The returned Tcl_Obj is all wrong for any purpose but getting the - * source string for an objc/objv command line in the stringRep (no - * stringRep if no source is available) and the corresponding substituted - * version in the List intrep. - * This means that the intRep and stringRep DO NOT COINCIDE! Using these - * Tcl_Objs normally is likely to break things. - * *---------------------------------------------------------------------- */ @@ -3374,37 +3365,27 @@ static Tcl_Obj * GetCommandSource( Interp *iPtr, int objc, - Tcl_Obj *const objv[], - int lookup) + Tcl_Obj *const objv[]) { - Tcl_Obj *objPtr, *obj2Ptr; + Tcl_Obj *objPtr = NULL; CmdFrame *cfPtr = iPtr->cmdFramePtr; - const char *command = NULL; - int numChars; - objPtr = Tcl_NewListObj(objc, objv); - if (lookup && cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) { + if (cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) { switch (cfPtr->type) { case TCL_LOCATION_EVAL: case TCL_LOCATION_SOURCE: - command = cfPtr->cmd.str.cmd; - numChars = cfPtr->cmd.str.len; + objPtr = Tcl_NewStringObj(cfPtr->cmd.str.cmd, cfPtr->cmd.str.len); break; case TCL_LOCATION_BC: - case TCL_LOCATION_PREBC: - command = TclGetSrcInfoForCmd(iPtr, &numChars); - break; - case TCL_LOCATION_EVAL_LIST: - /* Got it already */ + case TCL_LOCATION_PREBC: { + int numChars; + objPtr = Tcl_NewStringObj(TclGetSrcInfoForCmd(iPtr, &numChars), + numChars); break; } - if (command) { - obj2Ptr = Tcl_NewStringObj(command, numChars); - objPtr->bytes = obj2Ptr->bytes; - objPtr->length = numChars; - obj2Ptr->bytes = NULL; - Tcl_DecrRefCount(obj2Ptr); } + } else { + objPtr = Tcl_NewListObj(objc, objv); } Tcl_IncrRefCount(objPtr); return objPtr; @@ -4692,7 +4673,7 @@ TEOV_RunEnterTraces( int length; Tcl_Obj *commandPtr; - commandPtr = GetCommandSource(iPtr, objc, objv, 1); + commandPtr = GetCommandSource(iPtr, objc, objv); command = Tcl_GetStringFromObj(commandPtr, &length); /* @@ -4731,7 +4712,7 @@ TEOV_RunEnterTraces( */ TclNRAddCallback(interp, TEOV_RunLeaveTraces, INT2PTR(traceCode), - commandPtr, cmdPtr, NULL); + commandPtr, cmdPtr, Tcl_NewListObj(objc, objv)); cmdPtr->refCount++; } else { Tcl_DecrRefCount(commandPtr); @@ -4752,10 +4733,11 @@ TEOV_RunLeaveTraces( int traceCode = PTR2INT(data[0]); Tcl_Obj *commandPtr = data[1]; Command *cmdPtr = data[2]; + Tcl_Obj *wordsPtr = data[3]; command = Tcl_GetStringFromObj(commandPtr, &length); - if (TCL_OK != Tcl_ListObjGetElements(interp, commandPtr, &objc, &objv)) { - Tcl_Panic("Who messed with commandPtr?"); + if (TCL_OK != Tcl_ListObjGetElements(interp, wordsPtr, &objc, &objv)) { + Tcl_Panic("What happened with wordsPtr?!"); } if (!(cmdPtr->flags & CMD_IS_DELETED)) { @@ -4769,6 +4751,7 @@ TEOV_RunLeaveTraces( } } Tcl_DecrRefCount(commandPtr); + Tcl_DecrRefCount(wordsPtr); /* * As cmdPtr is set, TclNRRunCallbacks is about to reduce the numlevels. @@ -5974,13 +5957,12 @@ TclNREvalObjEx( */ if (TclListObjIsCanonical(objPtr)) { - Tcl_Obj *listPtr = objPtr; CmdFrame *eoFramePtr = NULL; int objc; - Tcl_Obj **objv; + Tcl_Obj *listPtr, **objv; /* - * Pure List Optimization (no string representation). In this case, we + * Canonical List Optimization: In this case, we * can safely use Tcl_EvalObjv instead and get an appreciable * improvement in execution speed. This is because it allows us to * avoid a setFromAny step that would just pack everything into a @@ -5988,11 +5970,6 @@ TclNREvalObjEx( * * This also preserves any associations between list elements and * location information for such elements. - * - * This restriction has been relaxed a bit by storing in lists whether - * they are "canonical" or not (a canonical list being one that is - * either pure or that has its string rep derived by - * UpdateStringOfList from the internal rep). */ /* @@ -6001,6 +5978,7 @@ TclNREvalObjEx( * we always make a copy. The callback takes care od the refCounts for * both listPtr and objPtr. * + * TODO: Create a test to demo this need, or eliminate it. * FIXME OPT: preserve just the internal rep? */ @@ -6030,14 +6008,15 @@ TclNREvalObjEx( eoFramePtr->nline = 0; eoFramePtr->line = NULL; - eoFramePtr->type = TCL_LOCATION_EVAL_LIST; + eoFramePtr->type = TCL_LOCATION_EVAL; eoFramePtr->level = (iPtr->cmdFramePtr == NULL? 1 : iPtr->cmdFramePtr->level + 1); eoFramePtr->numLevels = iPtr->numLevels; eoFramePtr->framePtr = iPtr->framePtr; eoFramePtr->nextPtr = iPtr->cmdFramePtr; - eoFramePtr->cmd.listPtr = listPtr; + eoFramePtr->cmd.str.cmd = Tcl_GetStringFromObj(listPtr, + &(eoFramePtr->cmd.str.len)); eoFramePtr->data.eval.path = NULL; iPtr->cmdFramePtr = eoFramePtr; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 0e33392..4046903 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1302,30 +1302,15 @@ TclInfoFrame( */ ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1)); - ADD_PAIR("line", Tcl_NewIntObj(framePtr->line[0])); + if (framePtr->line) { + ADD_PAIR("line", Tcl_NewIntObj(framePtr->line[0])); + } else { + ADD_PAIR("line", Tcl_NewIntObj(1)); + } ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd.str.cmd, framePtr->cmd.str.len)); break; - case TCL_LOCATION_EVAL_LIST: - /* - * List optimized evaluation. Type, line, cmd, the latter through - * listPtr, possibly a frame. - */ - - ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1)); - ADD_PAIR("line", Tcl_NewIntObj(1)); - - /* - * We put a duplicate of the command list obj into the result to - * ensure that the 'pure List'-property of the command itself is not - * destroyed. Otherwise the query here would disable the list - * optimization path in Tcl_EvalObjEx. - */ - - ADD_PAIR("cmd", Tcl_DuplicateObj(framePtr->cmd.listPtr)); - break; - case TCL_LOCATION_PREBC: /* * Precompiled. Result contains the type as signal, nothing else. diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 772ce22..618b6fa 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1375,7 +1375,7 @@ TclInitCompileEnv( envPtr->extCmdMapPtr->nuloc = 0; envPtr->extCmdMapPtr->path = NULL; - if ((invoker == NULL) || (invoker->type == TCL_LOCATION_EVAL_LIST)) { + if (invoker == NULL) { /* * Initialize the compiler for relative counting in case of a * dynamic context. diff --git a/generic/tclInt.h b/generic/tclInt.h index da09366..1df09b3 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1175,29 +1175,27 @@ typedef struct CmdFrame { * * EXECUTION CONTEXTS and usage of CmdFrame * - * Field TEBC EvalEx EvalObjEx - * ======= ==== ====== ========= - * level yes yes yes - * type BC/PREBC SRC/EVAL EVAL_LIST - * line0 yes yes yes - * framePtr yes yes yes - * ======= ==== ====== ========= + * Field TEBC EvalEx + * ======= ==== ====== + * level yes yes + * type BC/PREBC SRC/EVAL + * line0 yes yes + * framePtr yes yes + * ======= ==== ====== * - * ======= ==== ====== ========= union data - * line1 - yes - - * line3 - yes - - * path - yes - - * ------- ---- ------ --------- - * codePtr yes - - - * pc yes - - - * ======= ==== ====== ========= + * ======= ==== ========= union data + * line1 - yes + * line3 - yes + * path - yes + * ------- ---- ------ + * codePtr yes - + * pc yes - + * ======= ==== ====== * - * ======= ==== ====== ========= | union cmd - * listPtr - - yes | - * ------- ---- ------ --------- | - * cmd yes yes - | - * cmdlen yes yes - | - * ------- ---- ------ --------- | + * ======= ==== ========= union cmd + * str.cmd yes yes + * str.len yes yes + * ------- ---- ------ */ union { @@ -1215,7 +1213,6 @@ typedef struct CmdFrame { const char *cmd; /* The executed command, if possible... */ int len; /* ... and its length. */ } str; - Tcl_Obj *listPtr; /* Tcl_EvalObjEx, cmd list. */ } cmd; int numLevels; /* Value of interp's numLevels when the frame * was pushed. */ -- cgit v0.12 From 90aed79bb65a5df8dfc953a51ed832a8da563df4 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Aug 2013 13:08:54 +0000 Subject: Revert the changes that went too far and broke things. --- generic/tclBasic.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 280835c..ea08f88 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3358,6 +3358,15 @@ CancelEvalProc( * This function returns a Tcl_Obj with the full source string for the * command. This insures that traces get a correct NUL-terminated command * string. The Tcl_Obj has refCount==1. + * + * *** MAINTAINER WARNING *** + * The returned Tcl_Obj is all wrong for any purpose but getting the + * source string for an objc/objv command line in the stringRep (no + * stringRep if no source is available) and the corresponding substituted + * version in the List intrep. + * This means that the intRep and stringRep DO NOT COINCIDE! Using these + * Tcl_Objs normally is likely to break things. + * *---------------------------------------------------------------------- */ @@ -3367,25 +3376,31 @@ GetCommandSource( int objc, Tcl_Obj *const objv[]) { - Tcl_Obj *objPtr = NULL; + Tcl_Obj *objPtr, *obj2Ptr; CmdFrame *cfPtr = iPtr->cmdFramePtr; + const char *command = NULL; + int numChars; + objPtr = Tcl_NewListObj(objc, objv); if (cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) { switch (cfPtr->type) { case TCL_LOCATION_EVAL: case TCL_LOCATION_SOURCE: - objPtr = Tcl_NewStringObj(cfPtr->cmd.str.cmd, cfPtr->cmd.str.len); + command = cfPtr->cmd.str.cmd; + numChars = cfPtr->cmd.str.len; break; case TCL_LOCATION_BC: - case TCL_LOCATION_PREBC: { - int numChars; - objPtr = Tcl_NewStringObj(TclGetSrcInfoForCmd(iPtr, &numChars), - numChars); + case TCL_LOCATION_PREBC: + command = TclGetSrcInfoForCmd(iPtr, &numChars); break; } + if (command) { + obj2Ptr = Tcl_NewStringObj(command, numChars); + objPtr->bytes = obj2Ptr->bytes; + objPtr->length = numChars; + obj2Ptr->bytes = NULL; + Tcl_DecrRefCount(obj2Ptr); } - } else { - objPtr = Tcl_NewListObj(objc, objv); } Tcl_IncrRefCount(objPtr); return objPtr; @@ -4712,7 +4727,7 @@ TEOV_RunEnterTraces( */ TclNRAddCallback(interp, TEOV_RunLeaveTraces, INT2PTR(traceCode), - commandPtr, cmdPtr, Tcl_NewListObj(objc, objv)); + commandPtr, cmdPtr, NULL); cmdPtr->refCount++; } else { Tcl_DecrRefCount(commandPtr); @@ -4733,11 +4748,10 @@ TEOV_RunLeaveTraces( int traceCode = PTR2INT(data[0]); Tcl_Obj *commandPtr = data[1]; Command *cmdPtr = data[2]; - Tcl_Obj *wordsPtr = data[3]; command = Tcl_GetStringFromObj(commandPtr, &length); - if (TCL_OK != Tcl_ListObjGetElements(interp, wordsPtr, &objc, &objv)) { - Tcl_Panic("What happened with wordsPtr?!"); + if (TCL_OK != Tcl_ListObjGetElements(interp, commandPtr, &objc, &objv)) { + Tcl_Panic("Who messed with commandPtr?"); } if (!(cmdPtr->flags & CMD_IS_DELETED)) { @@ -4751,7 +4765,6 @@ TEOV_RunLeaveTraces( } } Tcl_DecrRefCount(commandPtr); - Tcl_DecrRefCount(wordsPtr); /* * As cmdPtr is set, TclNRRunCallbacks is about to reduce the numlevels. -- cgit v0.12 From 2fa3c7789bf50168600e5ba432c5bcb1ea3a5c81 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Aug 2013 13:20:36 +0000 Subject: Eliminate the union that is no longer needed. --- generic/tclBasic.c | 13 ++++++------- generic/tclCmdIL.c | 9 +++------ generic/tclExecute.c | 14 +++++++------- generic/tclInt.h | 8 ++------ generic/tclOOMethod.c | 8 ++++---- generic/tclProc.c | 8 ++++---- 6 files changed, 26 insertions(+), 34 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index ea08f88..baa2f2c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3386,8 +3386,8 @@ GetCommandSource( switch (cfPtr->type) { case TCL_LOCATION_EVAL: case TCL_LOCATION_SOURCE: - command = cfPtr->cmd.str.cmd; - numChars = cfPtr->cmd.str.len; + command = cfPtr->cmd; + numChars = cfPtr->len; break; case TCL_LOCATION_BC: case TCL_LOCATION_PREBC: @@ -5246,12 +5246,12 @@ TclEvalEx( * have been executed. */ - eeFramePtr->cmd.str.cmd = parsePtr->commandStart; - eeFramePtr->cmd.str.len = parsePtr->commandSize; + eeFramePtr->cmd = parsePtr->commandStart; + eeFramePtr->len = parsePtr->commandSize; if (parsePtr->term == parsePtr->commandStart + parsePtr->commandSize - 1) { - eeFramePtr->cmd.str.len--; + eeFramePtr->len--; } eeFramePtr->nline = objectsUsed; @@ -6028,8 +6028,7 @@ TclNREvalObjEx( eoFramePtr->framePtr = iPtr->framePtr; eoFramePtr->nextPtr = iPtr->cmdFramePtr; - eoFramePtr->cmd.str.cmd = Tcl_GetStringFromObj(listPtr, - &(eoFramePtr->cmd.str.len)); + eoFramePtr->cmd = Tcl_GetStringFromObj(listPtr, &(eoFramePtr->len)); eoFramePtr->data.eval.path = NULL; iPtr->cmdFramePtr = eoFramePtr; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 4046903..180d814 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1307,8 +1307,7 @@ TclInfoFrame( } else { ADD_PAIR("line", Tcl_NewIntObj(1)); } - ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd.str.cmd, - framePtr->cmd.str.len)); + ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd, framePtr->len)); break; case TCL_LOCATION_PREBC: @@ -1356,8 +1355,7 @@ TclInfoFrame( Tcl_DecrRefCount(fPtr->data.eval.path); } - ADD_PAIR("cmd", - Tcl_NewStringObj(fPtr->cmd.str.cmd, fPtr->cmd.str.len)); + ADD_PAIR("cmd", Tcl_NewStringObj(fPtr->cmd, fPtr->len)); TclStackFree(interp, fPtr); break; } @@ -1376,8 +1374,7 @@ TclInfoFrame( * the result list object. */ - ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd.str.cmd, - framePtr->cmd.str.len)); + ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd, framePtr->len)); break; case TCL_LOCATION_PROC: diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f8ed667..11e9920 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2006,8 +2006,8 @@ TclNRExecuteByteCode( bcFramePtr->litarg = NULL; bcFramePtr->data.tebc.codePtr = codePtr; bcFramePtr->data.tebc.pc = NULL; - bcFramePtr->cmd.str.cmd = NULL; - bcFramePtr->cmd.str.len = 0; + bcFramePtr->cmd = NULL; + bcFramePtr->len = 0; #ifdef TCL_COMPILE_STATS iPtr->stats.numExecutions++; @@ -8774,13 +8774,13 @@ TclGetSrcInfoForPc( { ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; - if (cfPtr->cmd.str.cmd == NULL) { - cfPtr->cmd.str.cmd = GetSrcInfoForPc( + if (cfPtr->cmd == NULL) { + cfPtr->cmd = GetSrcInfoForPc( (unsigned char *) cfPtr->data.tebc.pc, codePtr, - &cfPtr->cmd.str.len, NULL, NULL); + &cfPtr->len, NULL, NULL); } - if (cfPtr->cmd.str.cmd != NULL) { + if (cfPtr->cmd != NULL) { /* * We now have the command. We can get the srcOffset back and from * there find the list of word locations for this command. @@ -8797,7 +8797,7 @@ TclGetSrcInfoForPc( return; } - srcOffset = cfPtr->cmd.str.cmd - codePtr->source; + srcOffset = cfPtr->cmd - codePtr->source; eclPtr = Tcl_GetHashValue(hePtr); for (i=0; i < eclPtr->nuloc; i++) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 1df09b3..d398591 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1208,12 +1208,8 @@ typedef struct CmdFrame { const char *pc; /* ... and instruction pointer. */ } tebc; } data; - union { - struct { - const char *cmd; /* The executed command, if possible... */ - int len; /* ... and its length. */ - } str; - } cmd; + const char *cmd; /* The executed command, if possible... */ + int len; /* ... and its length. */ int numLevels; /* Value of interp's numLevels when the frame * was pushed. */ const struct CFWordBC *litarg; diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 98b4078..b91fdfd 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -513,8 +513,8 @@ TclOOMakeProcInstanceMethod( cfPtr->data.eval.path = context.data.eval.path; Tcl_IncrRefCount(cfPtr->data.eval.path); - cfPtr->cmd.str.cmd = NULL; - cfPtr->cmd.str.len = 0; + cfPtr->cmd = NULL; + cfPtr->len = 0; hPtr = Tcl_CreateHashEntry(iPtr->linePBodyPtr, (char *) procPtr, &isNew); @@ -626,8 +626,8 @@ TclOOMakeProcMethod( cfPtr->data.eval.path = context.data.eval.path; Tcl_IncrRefCount(cfPtr->data.eval.path); - cfPtr->cmd.str.cmd = NULL; - cfPtr->cmd.str.len = 0; + cfPtr->cmd = NULL; + cfPtr->len = 0; hPtr = Tcl_CreateHashEntry(iPtr->linePBodyPtr, (char *) procPtr, &isNew); diff --git a/generic/tclProc.c b/generic/tclProc.c index 18985a1..1314719 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -271,8 +271,8 @@ Tcl_ProcObjCmd( cfPtr->data.eval.path = contextPtr->data.eval.path; Tcl_IncrRefCount(cfPtr->data.eval.path); - cfPtr->cmd.str.cmd = NULL; - cfPtr->cmd.str.len = 0; + cfPtr->cmd = NULL; + cfPtr->len = 0; hePtr = Tcl_CreateHashEntry(iPtr->linePBodyPtr, procPtr, &isNew); @@ -2595,8 +2595,8 @@ SetLambdaFromAny( cfPtr->data.eval.path = contextPtr->data.eval.path; Tcl_IncrRefCount(cfPtr->data.eval.path); - cfPtr->cmd.str.cmd = NULL; - cfPtr->cmd.str.len = 0; + cfPtr->cmd = NULL; + cfPtr->len = 0; } /* -- cgit v0.12 From c13bb10d72906770febda3135e8407326a24663c Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Aug 2013 13:30:36 +0000 Subject: Drop TCL_LOCATION_EVAL_LIST now that it is unused. --- generic/tclInt.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index d398591..cd4ab7d 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1275,8 +1275,6 @@ typedef struct ContLineLoc { * location data referenced via the 'baseLocPtr'. * * TCL_LOCATION_EVAL : Frame is for a script evaluated by EvalEx. - * TCL_LOCATION_EVAL_LIST : Frame is for a script evaluated by the list - * optimization path of EvalObjEx. * TCL_LOCATION_BC : Frame is for bytecode. * TCL_LOCATION_PREBC : Frame is for precompiled bytecode. * TCL_LOCATION_SOURCE : Frame is for a script evaluated by EvalEx, from a @@ -1288,8 +1286,6 @@ typedef struct ContLineLoc { */ #define TCL_LOCATION_EVAL (0) /* Location in a dynamic eval script. */ -#define TCL_LOCATION_EVAL_LIST (1) /* Location in a dynamic eval script, - * list-path. */ #define TCL_LOCATION_BC (2) /* Location in byte code. */ #define TCL_LOCATION_PREBC (3) /* Location in precompiled byte code, no * location. */ -- cgit v0.12 From f56c89a9c1633b26c4f2ef5a898a92e0331ce678 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Aug 2013 16:20:59 +0000 Subject: Add assertions that will guide and protect more discovery of dead code for elimination. --- generic/tclBasic.c | 2 ++ generic/tclExecute.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index baa2f2c..1889dfd 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6109,6 +6109,8 @@ TclNREvalObjEx( ContLineLoc *saveCLLocPtr = iPtr->scriptCLLocPtr; ContLineLoc *clLocPtr = TclContinuationsGet(objPtr); + assert(invoker == NULL); + if (clLocPtr) { iPtr->scriptCLLocPtr = clLocPtr; Tcl_Preserve(iPtr->scriptCLLocPtr); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 11e9920..f6072a1 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8774,13 +8774,15 @@ TclGetSrcInfoForPc( { ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; - if (cfPtr->cmd == NULL) { + assert(cfPtr->type == TCL_LOCATION_BC); + assert(cfPtr->cmd == NULL); + cfPtr->cmd = GetSrcInfoForPc( (unsigned char *) cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL); - } - if (cfPtr->cmd != NULL) { + assert(cfPtr->cmd != NULL); + { /* * We now have the command. We can get the srcOffset back and from * there find the list of word locations for this command. -- cgit v0.12 From 854ba0e8ca16a91d958a52579e03b86d868fc8ca Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Aug 2013 17:24:40 +0000 Subject: All use of the evalFlag value TCL_EVAL_CTX is unused by the code and unreachable by extensions. This checkin removes all the code supporting that flag value. The consequence is that all the calls to TclNREvalObjEx() and its callers that are currently choosing not to pass the TCL_EVAL_DIRECT flag in when they pass in a non-NULL invoker will no longer be free to change their mind. That might be reason not to adopt this change. --- generic/tclBasic.c | 98 ++++++------------------------------------------------ generic/tclInt.h | 1 - 2 files changed, 11 insertions(+), 88 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 1889dfd..00ae24e 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5011,12 +5011,11 @@ TclEvalEx( /* * TIP #280 Initialize tracking. Do not push on the frame stack yet. * - * We may continue counting based on a specific context (CTX), or open a - * new context, either for a sourced script, or 'eval'. For sourced files - * we always have a path object, even if nothing was specified in the - * interp itself. That makes code using it simpler as NULL checks can be - * left out. Sourced file without path in the 'scriptFile' is possible - * during Tcl initialization. + * We open a new context, either for a sourced script, or 'eval'. + * For sourced files we always have a path object, even if nothing was + * specified in the interp itself. That makes code using it simpler as + * NULL checks can be left out. Sourced file without path in the + * 'scriptFile' is possible during Tcl initialization. */ eeFramePtr->level = iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level + 1 : 1; @@ -5027,15 +5026,7 @@ TclEvalEx( eeFramePtr->line = NULL; iPtr->cmdFramePtr = eeFramePtr; - if (iPtr->evalFlags & TCL_EVAL_CTX) { - /* - * Path information comes out of the context. - */ - - eeFramePtr->type = TCL_LOCATION_SOURCE; - eeFramePtr->data.eval.path = iPtr->invokeCmdFramePtr->data.eval.path; - Tcl_IncrRefCount(eeFramePtr->data.eval.path); - } else if (iPtr->evalFlags & TCL_EVAL_FILE) { + if (iPtr->evalFlags & TCL_EVAL_FILE) { /* * Set up for a sourced file. */ @@ -6076,14 +6067,6 @@ TclNREvalObjEx( * We're not supposed to use the compiler or byte-code * interpreter. Let Tcl_EvalEx evaluate the command directly (and * probably more slowly). - * - * TIP #280. Propagate context as much as we can. Especially if the - * script to evaluate is a single literal it makes sense to look if - * our context is one with absolute line numbers we can then track - * into the literal itself too. - * - * See also tclCompile.c, TclInitCompileEnv, for the equivalent code - * in the bytecode compiler. */ const char *script; @@ -6104,6 +6087,8 @@ TclNREvalObjEx( * Another important action is to save (and later restore) the * continuation line information of the caller, in case we are * executing nested commands in the eval/direct path. + * + * TODO: Get test coverage in here. */ ContLineLoc *saveCLLocPtr = iPtr->scriptCLLocPtr; @@ -6119,71 +6104,11 @@ TclNREvalObjEx( } Tcl_IncrRefCount(objPtr); - if (invoker == NULL) { - /* - * No context, force opening of our own. - */ - script = Tcl_GetStringFromObj(objPtr, &numSrcBytes); - result = Tcl_EvalEx(interp, script, numSrcBytes, flags); - } else { - /* - * We have an invoker, describing the command asking for the - * evaluation of a subordinate script. This script may originate - * in a literal word, or from a variable, etc. Using the line - * array we now check if we have good line information for the - * relevant word. The type of context is relevant as well. In a - * non-'source' context we don't have to try tracking lines. - * - * First see if the word exists and is a literal. If not we go - * through the easy dynamic branch. No need to perform more - * complex invokations. - */ + script = Tcl_GetStringFromObj(objPtr, &numSrcBytes); + result = Tcl_EvalEx(interp, script, numSrcBytes, flags); - int pc = 0; - CmdFrame *ctxPtr = TclStackAlloc(interp, sizeof(CmdFrame)); - - *ctxPtr = *invoker; - if (invoker->type == TCL_LOCATION_BC) { - /* - * Note: Type BC => ctxPtr->data.eval.path is not used. - * ctxPtr->data.tebc.codePtr is used instead. - */ - - TclGetSrcInfoForPc(ctxPtr); - pc = 1; - } - - script = Tcl_GetStringFromObj(objPtr, &numSrcBytes); - - if ((invoker->nline <= word) || - (invoker->line[word] < 0) || - (ctxPtr->type != TCL_LOCATION_SOURCE)) { - /* - * Dynamic script, or dynamic context, force our own context. - */ - - result = Tcl_EvalEx(interp, script, numSrcBytes, flags); - } else { - /* - * Absolute context to reuse. - */ - - iPtr->invokeCmdFramePtr = ctxPtr; - iPtr->evalFlags |= TCL_EVAL_CTX; - - result = TclEvalEx(interp, script, numSrcBytes, flags, - ctxPtr->line[word], NULL, script); - } - if (pc && (ctxPtr->type == TCL_LOCATION_SOURCE)) { - /* - * Death of SrcInfo reference. - */ - - Tcl_DecrRefCount(ctxPtr->data.eval.path); - } - TclStackFree(interp, ctxPtr); - } + TclDecrRefCount(objPtr); /* * Now release the lock on the continuation line information, if any, @@ -6194,7 +6119,6 @@ TclNREvalObjEx( Tcl_Release(iPtr->scriptCLLocPtr); } iPtr->scriptCLLocPtr = saveCLLocPtr; - TclDecrRefCount(objPtr); return result; } } diff --git a/generic/tclInt.h b/generic/tclInt.h index cd4ab7d..99f1305 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2201,7 +2201,6 @@ typedef struct Interp { #define TCL_ALLOW_EXCEPTIONS 4 #define TCL_EVAL_FILE 2 -#define TCL_EVAL_CTX 8 /* * Flag bits for Interp structures: -- cgit v0.12 From 47750cf97411377b0562db3816394c12707d8590 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Aug 2013 12:44:42 +0000 Subject: Add comment stating new limitation on Tcl(NR)EvalObjEx() interface. --- generic/tclBasic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 00ae24e..8ba3825 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -5893,6 +5893,11 @@ Tcl_GlobalEvalObj( * compiled into bytecodes if necessary, unless TCL_EVAL_DIRECT is * specified. * + * If the flag TCL_EVAL_DIRECT is passed in, the value of invoker + * must be NULL. Support for non-NULL invokers in that mode has + * been removed since it was unused and untested. Failure to + * follow this limitation will lead to an assertion panic. + * * Results: * The return value is one of the return codes defined in tcl.h (such as * TCL_OK), and the interpreter's result contains a value to supplement -- cgit v0.12 From 9923dc2908c517db587b6cbb398398ab3e45ec16 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Aug 2013 14:41:46 +0000 Subject: Replace potentially memleak creating safety check of a "cannot happen" condition with an assertion. --- generic/tclParse.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/generic/tclParse.c b/generic/tclParse.c index 6723d39..c5cb1d1 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -13,6 +13,7 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#include #include "tclInt.h" #include "tclParse.h" @@ -1578,16 +1579,13 @@ Tcl_ParseVar( * At this point we should have an object containing the value of a * variable. Just return the string from that object. * - * This should have returned the object for the user to manage, but - * instead we have some weak reference to the string value in the object, - * which is why we make sure the object exists after resetting the result. - * This isn't ideal, but it's the best we can do with the current - * documented interface. -- hobbs + * Since TclSubstTokens above returned TCL_OK, we know that objPtr + * is shared. It is in both the interp result and the value of the + * variable. Returning the string relies on that to be true. */ - if (!Tcl_IsShared(objPtr)) { - Tcl_IncrRefCount(objPtr); - } + assert( Tcl_IsShared(objPtr) ); + Tcl_ResetResult(interp); return TclGetString(objPtr); } -- cgit v0.12 From fd31090a583e76ccb81747a37f56e865669aebae Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Aug 2013 16:01:53 +0000 Subject: Test for TclContinuationsGet() usage, and simplifications. --- generic/tclBasic.c | 18 +----------------- tests/parse.test | 6 ++++++ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 8ba3825..7110025 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6092,21 +6092,13 @@ TclNREvalObjEx( * Another important action is to save (and later restore) the * continuation line information of the caller, in case we are * executing nested commands in the eval/direct path. - * - * TODO: Get test coverage in here. */ ContLineLoc *saveCLLocPtr = iPtr->scriptCLLocPtr; - ContLineLoc *clLocPtr = TclContinuationsGet(objPtr); assert(invoker == NULL); - if (clLocPtr) { - iPtr->scriptCLLocPtr = clLocPtr; - Tcl_Preserve(iPtr->scriptCLLocPtr); - } else { - iPtr->scriptCLLocPtr = NULL; - } + iPtr->scriptCLLocPtr = TclContinuationsGet(objPtr); Tcl_IncrRefCount(objPtr); @@ -6115,14 +6107,6 @@ TclNREvalObjEx( TclDecrRefCount(objPtr); - /* - * Now release the lock on the continuation line information, if any, - * and restore the caller's settings. - */ - - if (iPtr->scriptCLLocPtr) { - Tcl_Release(iPtr->scriptCLLocPtr); - } iPtr->scriptCLLocPtr = saveCLLocPtr; return result; } diff --git a/tests/parse.test b/tests/parse.test index 9f2d50b..01443c9 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -1118,6 +1118,12 @@ test parse-21.0 {Bug 1884496} testevent { testevent queue a head $::script vwait done } {} +test parse-21.1 {TCL_EVAL_DIRECT coverage} testevent { + testevent queue a head {testevent delete a; \ + set ::done [dict get [info frame 0] line]} + vwait done + set ::done +} 2 cleanupTests } -- cgit v0.12 From 77c1bfb88bf69b0a55d43eca6a0029d82458a377 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Aug 2013 16:44:03 +0000 Subject: Remove Tcl_Preserve support for ContLineLoc values. It's not needed. This allows the clLoc field of CompileEnv struct to go away too. --- generic/tclCompile.c | 19 ++----------------- generic/tclCompile.h | 4 ---- generic/tclObj.c | 38 +++----------------------------------- 3 files changed, 5 insertions(+), 56 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 618b6fa..f5c8d41 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -713,9 +713,7 @@ TclSetByteCodeFromAny( clLocPtr = TclContinuationsGet(objPtr); if (clLocPtr) { - compEnv.clLoc = clLocPtr; - compEnv.clNext = &compEnv.clLoc->loc[0]; - Tcl_Preserve(compEnv.clLoc); + compEnv.clNext = &clLocPtr->loc[0]; } TclCompileScript(interp, stringPtr, length, &compEnv); @@ -742,9 +740,7 @@ TclSetByteCodeFromAny( TclInitCompileEnv(interp, &compEnv, stringPtr, length, iPtr->invokeCmdFramePtr, iPtr->invokeWord); if (clLocPtr) { - compEnv.clLoc = clLocPtr; - compEnv.clNext = &compEnv.clLoc->loc[0]; - Tcl_Preserve(compEnv.clLoc); + compEnv.clNext = &clLocPtr->loc[0]; } compEnv.atCmdStart = 2; /* The disabling magic. */ TclCompileScript(interp, stringPtr, length, &compEnv); @@ -1489,7 +1485,6 @@ TclInitCompileEnv( * data is available. */ - envPtr->clLoc = NULL; envPtr->clNext = NULL; envPtr->auxDataArrayPtr = envPtr->staticAuxDataArraySpace; @@ -1574,16 +1569,6 @@ TclFreeCompileEnv( ReleaseCmdWordData(envPtr->extCmdMapPtr); envPtr->extCmdMapPtr = NULL; } - - /* - * If we used data about invisible continuation lines, then now is the - * time to release on our hold on it. The lock was set in function - * TclSetByteCodeFromAny(), found in this file. - */ - - if (envPtr->clLoc) { - Tcl_Release(envPtr->clLoc); - } } /* diff --git a/generic/tclCompile.h b/generic/tclCompile.h index beb28fd..5660055 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -365,10 +365,6 @@ typedef struct CompileEnv { * encountered that have not yet been paired * with a corresponding * INST_INVOKE_EXPANDED. */ - ContLineLoc *clLoc; /* If not NULL, the table holding the - * locations of the invisible continuation - * lines in the input script, to adjust the - * line counter. */ int *clNext; /* If not NULL, it refers to the next slot in * clLoc to check for an invisible * continuation line. */ diff --git a/generic/tclObj.c b/generic/tclObj.c index 542d6d1..930e1fd 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -97,7 +97,6 @@ typedef struct ThreadSpecificData { static Tcl_ThreadDataKey dataKey; -static void ContLineLocFree(char *clientData); static void TclThreadFinalizeContLines(ClientData clientData); static ThreadSpecificData *TclGetContLineTable(void); @@ -805,14 +804,7 @@ TclThreadFinalizeContLines( for (hPtr = Tcl_FirstHashEntry(tsdPtr->lineCLPtr, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { - /* - * We are not using Tcl_EventuallyFree (as in TclFreeObj()) because - * here we can be sure that the compiler will not hold references to - * the data in the hashtable, and using TEF might bork the - * finalization sequence. - */ - - ContLineLocFree(Tcl_GetHashValue(hPtr)); + ckfree(Tcl_GetHashValue(hPtr)); Tcl_DeleteHashEntry(hPtr); } Tcl_DeleteHashTable(tsdPtr->lineCLPtr); @@ -821,30 +813,6 @@ TclThreadFinalizeContLines( } /* - *---------------------------------------------------------------------- - * - * ContLineLocFree -- - * - * The freProc for continuation line location tables. - * - * Results: - * None. - * - * Side effects: - * Releases memory. - * - * TIP #280 - *---------------------------------------------------------------------- - */ - -static void -ContLineLocFree( - char *clientData) -{ - ckfree(clientData); -} - -/* *-------------------------------------------------------------- * * Tcl_RegisterObjType -- @@ -1405,7 +1373,7 @@ TclFreeObj( if (tsdPtr->lineCLPtr) { hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr); if (hPtr) { - Tcl_EventuallyFree(Tcl_GetHashValue(hPtr), ContLineLocFree); + ckfree(Tcl_GetHashValue(hPtr)); Tcl_DeleteHashEntry(hPtr); } } @@ -1496,7 +1464,7 @@ TclFreeObj( if (tsdPtr->lineCLPtr) { hPtr = Tcl_FindHashEntry(tsdPtr->lineCLPtr, objPtr); if (hPtr) { - Tcl_EventuallyFree(Tcl_GetHashValue(hPtr), ContLineLocFree); + ckfree(Tcl_GetHashValue(hPtr)); Tcl_DeleteHashEntry(hPtr); } } -- cgit v0.12 From 4536322b256c1539a134ea7ecc4a7c32e7b05451 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Aug 2013 19:45:13 +0000 Subject: Give (objc, objv) their own ride from enter to leave traces. --- generic/tclBasic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 7110025..067da63 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4727,7 +4727,7 @@ TEOV_RunEnterTraces( */ TclNRAddCallback(interp, TEOV_RunLeaveTraces, INT2PTR(traceCode), - commandPtr, cmdPtr, NULL); + commandPtr, cmdPtr, Tcl_NewListObj(objc, objv)); cmdPtr->refCount++; } else { Tcl_DecrRefCount(commandPtr); @@ -4748,11 +4748,10 @@ TEOV_RunLeaveTraces( int traceCode = PTR2INT(data[0]); Tcl_Obj *commandPtr = data[1]; Command *cmdPtr = data[2]; + Tcl_Obj *wordsPtr = data[3]; command = Tcl_GetStringFromObj(commandPtr, &length); - if (TCL_OK != Tcl_ListObjGetElements(interp, commandPtr, &objc, &objv)) { - Tcl_Panic("Who messed with commandPtr?"); - } + Tcl_ListObjGetElements(NULL, wordsPtr, &objc, &objv); if (!(cmdPtr->flags & CMD_IS_DELETED)) { if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && traceCode == TCL_OK){ @@ -4765,6 +4764,7 @@ TEOV_RunLeaveTraces( } } Tcl_DecrRefCount(commandPtr); + Tcl_DecrRefCount(wordsPtr); /* * As cmdPtr is set, TclNRRunCallbacks is about to reduce the numlevels. -- cgit v0.12 From dddbd100aedbc995c1a203715479978f79e82ba6 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 7 Aug 2013 20:27:30 +0000 Subject: Revise GetCommandSource() to return a normal Tcl_Obj value. --- generic/tclBasic.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 067da63..6542726 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3358,15 +3358,6 @@ CancelEvalProc( * This function returns a Tcl_Obj with the full source string for the * command. This insures that traces get a correct NUL-terminated command * string. The Tcl_Obj has refCount==1. - * - * *** MAINTAINER WARNING *** - * The returned Tcl_Obj is all wrong for any purpose but getting the - * source string for an objc/objv command line in the stringRep (no - * stringRep if no source is available) and the corresponding substituted - * version in the List intrep. - * This means that the intRep and stringRep DO NOT COINCIDE! Using these - * Tcl_Objs normally is likely to break things. - * *---------------------------------------------------------------------- */ @@ -3376,13 +3367,13 @@ GetCommandSource( int objc, Tcl_Obj *const objv[]) { - Tcl_Obj *objPtr, *obj2Ptr; + Tcl_Obj *objPtr = NULL; CmdFrame *cfPtr = iPtr->cmdFramePtr; - const char *command = NULL; - int numChars; - objPtr = Tcl_NewListObj(objc, objv); if (cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) { + const char *command = NULL; + int numChars; + switch (cfPtr->type) { case TCL_LOCATION_EVAL: case TCL_LOCATION_SOURCE: @@ -3395,13 +3386,12 @@ GetCommandSource( break; } if (command) { - obj2Ptr = Tcl_NewStringObj(command, numChars); - objPtr->bytes = obj2Ptr->bytes; - objPtr->length = numChars; - obj2Ptr->bytes = NULL; - Tcl_DecrRefCount(obj2Ptr); + objPtr = Tcl_NewStringObj(command, numChars); } } + if (objPtr == NULL) { + objPtr = Tcl_NewListObj(objc, objv); + } Tcl_IncrRefCount(objPtr); return objPtr; } -- cgit v0.12 From fec32bb50c597bfbb21ad55211339355034f6d55 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 9 Aug 2013 16:48:30 +0000 Subject: Revised GetCommandSource() can (and thus should) return a normal zero refcount value. --- generic/tclBasic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 6542726..9755a21 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3357,7 +3357,7 @@ CancelEvalProc( * * This function returns a Tcl_Obj with the full source string for the * command. This insures that traces get a correct NUL-terminated command - * string. The Tcl_Obj has refCount==1. + * string. *---------------------------------------------------------------------- */ @@ -3392,7 +3392,6 @@ GetCommandSource( if (objPtr == NULL) { objPtr = Tcl_NewListObj(objc, objv); } - Tcl_IncrRefCount(objPtr); return objPtr; } -- cgit v0.12 From de857ca207e4dceea586bf2dbfe497df4d9d02c8 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 10 Aug 2013 05:16:38 +0000 Subject: Arrange for both execution traces and [info frame] to get their pre-subst source strings from a common routine, with care taken to reduce copying by that routine. --- generic/tclBasic.c | 41 +++++++++++++++-------------------------- generic/tclCmdIL.c | 25 ++++++++++++++++++++++--- generic/tclExecute.c | 19 +++++++++++++++++-- generic/tclInt.h | 5 +++++ 4 files changed, 59 insertions(+), 31 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 9755a21..1cd2eae 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3367,32 +3367,12 @@ GetCommandSource( int objc, Tcl_Obj *const objv[]) { - Tcl_Obj *objPtr = NULL; CmdFrame *cfPtr = iPtr->cmdFramePtr; - if (cfPtr && (cfPtr->numLevels == iPtr->numLevels-1)) { - const char *command = NULL; - int numChars; - - switch (cfPtr->type) { - case TCL_LOCATION_EVAL: - case TCL_LOCATION_SOURCE: - command = cfPtr->cmd; - numChars = cfPtr->len; - break; - case TCL_LOCATION_BC: - case TCL_LOCATION_PREBC: - command = TclGetSrcInfoForCmd(iPtr, &numChars); - break; - } - if (command) { - objPtr = Tcl_NewStringObj(command, numChars); - } + if (cfPtr && (cfPtr->numLevels != iPtr->numLevels-1)) { + cfPtr = NULL; } - if (objPtr == NULL) { - objPtr = Tcl_NewListObj(objc, objv); - } - return objPtr; + return TclGetSourceFromFrame(cfPtr, objc, objv); } /* @@ -4678,6 +4658,7 @@ TEOV_RunEnterTraces( Tcl_Obj *commandPtr; commandPtr = GetCommandSource(iPtr, objc, objv); + Tcl_IncrRefCount(commandPtr); command = Tcl_GetStringFromObj(commandPtr, &length); /* @@ -5013,6 +4994,7 @@ TclEvalEx( eeFramePtr->nextPtr = iPtr->cmdFramePtr; eeFramePtr->nline = 0; eeFramePtr->line = NULL; + eeFramePtr->cmdObj = NULL; iPtr->cmdFramePtr = eeFramePtr; if (iPtr->evalFlags & TCL_EVAL_FILE) { @@ -5243,6 +5225,10 @@ TclEvalEx( eeFramePtr->line = NULL; eeFramePtr->nline = 0; + if (eeFramePtr->cmdObj) { + Tcl_DecrRefCount(eeFramePtr->cmdObj); + eeFramePtr->cmdObj = NULL; + } if (code != TCL_OK) { goto error; @@ -5983,7 +5969,6 @@ TclNREvalObjEx( Tcl_IncrRefCount(objPtr); listPtr = TclListObjCopy(interp, objPtr); Tcl_IncrRefCount(listPtr); - TclDecrRefCount(objPtr); if (word != INT_MIN) { /* @@ -6013,7 +5998,9 @@ TclNREvalObjEx( eoFramePtr->framePtr = iPtr->framePtr; eoFramePtr->nextPtr = iPtr->cmdFramePtr; - eoFramePtr->cmd = Tcl_GetStringFromObj(listPtr, &(eoFramePtr->len)); + eoFramePtr->cmdObj = objPtr; + eoFramePtr->cmd = NULL; + eoFramePtr->len = 0; eoFramePtr->data.eval.path = NULL; iPtr->cmdFramePtr = eoFramePtr; @@ -6021,7 +6008,7 @@ TclNREvalObjEx( TclMarkTailcall(interp); TclNRAddCallback(interp, TEOEx_ListCallback, listPtr, eoFramePtr, - NULL, NULL); + objPtr, NULL); ListObjGetElements(listPtr, objc, objv); return TclNREvalObjv(interp, objc, objv, flags, NULL); @@ -6156,6 +6143,7 @@ TEOEx_ListCallback( Interp *iPtr = (Interp *) interp; Tcl_Obj *listPtr = data[0]; CmdFrame *eoFramePtr = data[1]; + Tcl_Obj *objPtr = data[2]; /* * Remove the cmdFrame @@ -6165,6 +6153,7 @@ TEOEx_ListCallback( iPtr->cmdFramePtr = eoFramePtr->nextPtr; TclStackFree(interp, eoFramePtr); } + TclDecrRefCount(objPtr); TclDecrRefCount(listPtr); return result; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 180d814..da9edd6 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1266,6 +1266,25 @@ InfoFrameCmd( */ Tcl_Obj * +TclGetSourceFromFrame( + CmdFrame *cfPtr, + int objc, + Tcl_Obj *const objv[]) +{ + if (cfPtr == NULL) { + return Tcl_NewListObj(objc, objv); + } + if (cfPtr->cmdObj == NULL) { + if (cfPtr->cmd == NULL) { + cfPtr->cmd = TclGetSrcInfoForCmdFrame(cfPtr, &cfPtr->len); + } + cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + Tcl_IncrRefCount(cfPtr->cmdObj); + } + return cfPtr->cmdObj; +} + +Tcl_Obj * TclInfoFrame( Tcl_Interp *interp, /* Current interpreter. */ CmdFrame *framePtr) /* Frame to get info for. */ @@ -1307,7 +1326,7 @@ TclInfoFrame( } else { ADD_PAIR("line", Tcl_NewIntObj(1)); } - ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd, framePtr->len)); + ADD_PAIR("cmd", TclGetSourceFromFrame(framePtr, 0, NULL)); break; case TCL_LOCATION_PREBC: @@ -1355,7 +1374,7 @@ TclInfoFrame( Tcl_DecrRefCount(fPtr->data.eval.path); } - ADD_PAIR("cmd", Tcl_NewStringObj(fPtr->cmd, fPtr->len)); + ADD_PAIR("cmd", TclGetSourceFromFrame(fPtr, 0, NULL)); TclStackFree(interp, fPtr); break; } @@ -1374,7 +1393,7 @@ TclInfoFrame( * the result list object. */ - ADD_PAIR("cmd", Tcl_NewStringObj(framePtr->cmd, framePtr->len)); + ADD_PAIR("cmd", TclGetSourceFromFrame(framePtr, 0, NULL)); break; case TCL_LOCATION_PROC: diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f6072a1..d8ccf40 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2006,6 +2006,7 @@ TclNRExecuteByteCode( bcFramePtr->litarg = NULL; bcFramePtr->data.tebc.codePtr = codePtr; bcFramePtr->data.tebc.pc = NULL; + bcFramePtr->cmdObj = NULL; bcFramePtr->cmd = NULL; bcFramePtr->len = 0; @@ -2130,6 +2131,11 @@ TEBCresume( result = TCL_ERROR; } NRE_ASSERT(iPtr->cmdFramePtr == bcFramePtr); + if (bcFramePtr->cmdObj) { + Tcl_DecrRefCount(bcFramePtr->cmdObj); + bcFramePtr->cmdObj = NULL; + bcFramePtr->cmd = NULL; + } iPtr->cmdFramePtr = bcFramePtr->nextPtr; if (iPtr->flags & INTERP_DEBUG_FRAME) { TclArgumentBCRelease((Tcl_Interp *) iPtr, bcFramePtr); @@ -8761,7 +8767,14 @@ TclGetSrcInfoForCmd( Interp *iPtr, int *lenPtr) { - CmdFrame *cfPtr = iPtr->cmdFramePtr; + return TclGetSrcInfoForCmdFrame(iPtr->cmdFramePtr, lenPtr); +} + +const char * +TclGetSrcInfoForCmdFrame( + CmdFrame *cfPtr, + int *lenPtr) +{ ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, @@ -8775,11 +8788,13 @@ TclGetSrcInfoForPc( ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; assert(cfPtr->type == TCL_LOCATION_BC); - assert(cfPtr->cmd == NULL); + + if (cfPtr->cmd == NULL) { cfPtr->cmd = GetSrcInfoForPc( (unsigned char *) cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL); + } assert(cfPtr->cmd != NULL); { diff --git a/generic/tclInt.h b/generic/tclInt.h index 99f1305..161d166 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1208,6 +1208,7 @@ typedef struct CmdFrame { const char *pc; /* ... and instruction pointer. */ } tebc; } data; + Tcl_Obj *cmdObj; const char *cmd; /* The executed command, if possible... */ int len; /* ... and its length. */ int numLevels; /* Value of interp's numLevels when the frame @@ -2907,7 +2908,11 @@ MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp, const char *modeString, int *seekFlagPtr, int *binaryPtr); MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr); +MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE const char *TclGetSrcInfoForCmd(Interp *iPtr, int *lenPtr); +MODULE_SCOPE const char *TclGetSrcInfoForCmdFrame(CmdFrame *cfPtr, + int *lenPtr); MODULE_SCOPE int TclGlob(Tcl_Interp *interp, char *pattern, Tcl_Obj *unquotedPrefix, int globFlags, Tcl_GlobTypeData *types); -- cgit v0.12 From 420294d3ed2faf23f5b57ed32e1bf869c4f71b8f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 11 Aug 2013 14:41:10 +0000 Subject: Never guess non-existing timezone name "America/Brasilia" on Windows. Reported by Arnulf Wiedemann --- library/clock.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/clock.tcl b/library/clock.tcl index 49aad23..1f83716 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -325,7 +325,7 @@ proc ::tcl::clock::Initialize {} { {-10800 0 3600 0 2 0 2 2 0 0 0 0 10 0 3 2 0 0 0} :America/Sao_Paulo {-10800 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Godthab {-10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Buenos_Aires - {-10800 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Brasilia + {-10800 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Bahia {-10800 0 3600 0 3 0 2 2 0 0 0 0 10 0 1 2 0 0 0} :America/Montevideo {-7200 0 3600 0 9 0 5 2 0 0 0 0 3 0 5 2 0 0 0} :America/Noronha {-3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Atlantic/Azores -- cgit v0.12 From 9d7666659bb7ba5dcf54394bb4c2a555b2f46f7c Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 12 Aug 2013 20:00:14 +0000 Subject: Use a new flag value TCL_EVAL_SOURCE_IN_FRAME passed in by callers to determine whether the pre-subst source information in a CmdFrame is to be used. This takes the place of numLevels cross checking, so that field is removed. Routines are consolidated as well. --- generic/tclBasic.c | 43 +++++++++---------------------------------- generic/tclExecute.c | 13 ++----------- generic/tclInt.h | 8 +++----- 3 files changed, 14 insertions(+), 50 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 1cd2eae..b6c6f38 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -127,8 +127,6 @@ static Tcl_ObjCmdProc ExprSqrtFunc; static Tcl_ObjCmdProc ExprSrandFunc; static Tcl_ObjCmdProc ExprUnaryFunc; static Tcl_ObjCmdProc ExprWideFunc; -static Tcl_Obj * GetCommandSource(Interp *iPtr, int objc, - Tcl_Obj *const objv[]); static void MathFuncWrongNumArgs(Tcl_Interp *interp, int expected, int actual, Tcl_Obj *const *objv); static Tcl_NRPostProc NRCoroutineCallerCallback; @@ -149,7 +147,7 @@ static inline Command * TEOV_LookupCmdFromObj(Tcl_Interp *interp, static int TEOV_NotFound(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Namespace *lookupNsPtr); static int TEOV_RunEnterTraces(Tcl_Interp *interp, - Command **cmdPtrPtr, int objc, + Command **cmdPtrPtr, Tcl_Obj *commandPtr, int objc, Tcl_Obj *const objv[], Namespace *lookupNsPtr); static Tcl_NRPostProc RewindCoroutineCallback; static Tcl_NRPostProc TailcallCleanup; @@ -3353,31 +3351,6 @@ CancelEvalProc( /* *---------------------------------------------------------------------- * - * GetCommandSource -- - * - * This function returns a Tcl_Obj with the full source string for the - * command. This insures that traces get a correct NUL-terminated command - * string. - *---------------------------------------------------------------------- - */ - -static Tcl_Obj * -GetCommandSource( - Interp *iPtr, - int objc, - Tcl_Obj *const objv[]) -{ - CmdFrame *cfPtr = iPtr->cmdFramePtr; - - if (cfPtr && (cfPtr->numLevels != iPtr->numLevels-1)) { - cfPtr = NULL; - } - return TclGetSourceFromFrame(cfPtr, objc, objv); -} - -/* - *---------------------------------------------------------------------- - * * TclCleanupCommand -- * * This function frees up a Command structure unless it is still @@ -4230,7 +4203,9 @@ TclNREvalObjv( * necessary. */ - result = TEOV_RunEnterTraces(interp, &cmdPtr, objc, objv, lookupNsPtr); + result = TEOV_RunEnterTraces(interp, &cmdPtr, TclGetSourceFromFrame( + flags & TCL_EVAL_SOURCE_IN_FRAME ? iPtr->cmdFramePtr : NULL, + objc, objv), objc, objv, lookupNsPtr); if (!cmdPtr) { return TEOV_NotFound(interp, objc, objv, lookupNsPtr); } @@ -4644,6 +4619,7 @@ static int TEOV_RunEnterTraces( Tcl_Interp *interp, Command **cmdPtrPtr, + Tcl_Obj *commandPtr, int objc, Tcl_Obj *const objv[], Namespace *lookupNsPtr) @@ -4655,9 +4631,7 @@ TEOV_RunEnterTraces( int newEpoch; const char *command; int length; - Tcl_Obj *commandPtr; - commandPtr = GetCommandSource(iPtr, objc, objv); Tcl_IncrRefCount(commandPtr); command = Tcl_GetStringFromObj(commandPtr, &length); @@ -4989,7 +4963,6 @@ TclEvalEx( */ eeFramePtr->level = iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level + 1 : 1; - eeFramePtr->numLevels = iPtr->numLevels; eeFramePtr->framePtr = iPtr->framePtr; eeFramePtr->nextPtr = iPtr->cmdFramePtr; eeFramePtr->nline = 0; @@ -5220,7 +5193,8 @@ TclEvalEx( eeFramePtr->line = lines; TclArgumentEnter(interp, objv, objectsUsed, eeFramePtr); - code = Tcl_EvalObjv(interp, objectsUsed, objv, TCL_EVAL_NOERR); + code = Tcl_EvalObjv(interp, objectsUsed, objv, + TCL_EVAL_NOERR | TCL_EVAL_SOURCE_IN_FRAME); TclArgumentRelease(interp, objv, objectsUsed); eeFramePtr->line = NULL; @@ -5994,7 +5968,6 @@ TclNREvalObjEx( eoFramePtr->type = TCL_LOCATION_EVAL; eoFramePtr->level = (iPtr->cmdFramePtr == NULL? 1 : iPtr->cmdFramePtr->level + 1); - eoFramePtr->numLevels = iPtr->numLevels; eoFramePtr->framePtr = iPtr->framePtr; eoFramePtr->nextPtr = iPtr->cmdFramePtr; @@ -6004,6 +5977,8 @@ TclNREvalObjEx( eoFramePtr->data.eval.path = NULL; iPtr->cmdFramePtr = eoFramePtr; + + flags |= TCL_EVAL_SOURCE_IN_FRAME; } TclMarkTailcall(interp); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d8ccf40..58e4d3d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1998,7 +1998,6 @@ TclNRExecuteByteCode( bcFramePtr->type = ((codePtr->flags & TCL_BYTECODE_PRECOMPILED) ? TCL_LOCATION_PREBC : TCL_LOCATION_BC); bcFramePtr->level = (iPtr->cmdFramePtr ? iPtr->cmdFramePtr->level+1 : 1); - bcFramePtr->numLevels = iPtr->numLevels; bcFramePtr->framePtr = iPtr->framePtr; bcFramePtr->nextPtr = iPtr->cmdFramePtr; bcFramePtr->nline = 0; @@ -2906,7 +2905,7 @@ TEBCresume( pc += pcAdjustment; TEBC_YIELD(); return TclNREvalObjv(interp, objc, objv, - TCL_EVAL_NOERR, NULL); + TCL_EVAL_NOERR | TCL_EVAL_SOURCE_IN_FRAME, NULL); #if TCL_SUPPORT_84_BYTECODE case INST_CALL_BUILTIN_FUNC1: @@ -8741,7 +8740,7 @@ IllegalExprOperandType( /* *---------------------------------------------------------------------- * - * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSrcInfoForCmd -- + * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSrcInfoForCmdFrame -- * * Given a program counter value, finds the closest command in the * bytecode code unit's CmdLocation array and returns information about @@ -8763,14 +8762,6 @@ IllegalExprOperandType( */ const char * -TclGetSrcInfoForCmd( - Interp *iPtr, - int *lenPtr) -{ - return TclGetSrcInfoForCmdFrame(iPtr->cmdFramePtr, lenPtr); -} - -const char * TclGetSrcInfoForCmdFrame( CmdFrame *cfPtr, int *lenPtr) diff --git a/generic/tclInt.h b/generic/tclInt.h index 161d166..19cd883 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1211,8 +1211,6 @@ typedef struct CmdFrame { Tcl_Obj *cmdObj; const char *cmd; /* The executed command, if possible... */ int len; /* ... and its length. */ - int numLevels; /* Value of interp's numLevels when the frame - * was pushed. */ const struct CFWordBC *litarg; /* Link to set of literal arguments which have * ben pushed on the lineLABCPtr stack by @@ -2200,8 +2198,9 @@ typedef struct Interp { * other than these should be turned into errors. */ -#define TCL_ALLOW_EXCEPTIONS 4 -#define TCL_EVAL_FILE 2 +#define TCL_ALLOW_EXCEPTIONS 0x04 +#define TCL_EVAL_FILE 0x02 +#define TCL_EVAL_SOURCE_IN_FRAME 0x10 /* * Flag bits for Interp structures: @@ -2910,7 +2909,6 @@ MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr); MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE const char *TclGetSrcInfoForCmd(Interp *iPtr, int *lenPtr); MODULE_SCOPE const char *TclGetSrcInfoForCmdFrame(CmdFrame *cfPtr, int *lenPtr); MODULE_SCOPE int TclGlob(Tcl_Interp *interp, char *pattern, -- cgit v0.12 From 9c15217967a7614ac17d324144b8e39d788b6eef Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 14 Aug 2013 04:13:21 +0000 Subject: Only schedule leave traces if enter traces complete successfully. This avoids a memleak, and opens a data slot, so we can pass objc, objv without the need to copy them into a list value. --- generic/tclBasic.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b6c6f38..f852b44 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4665,13 +4665,13 @@ TEOV_RunEnterTraces( *cmdPtrPtr = cmdPtr; } - if (cmdPtr) { + if (cmdPtr && (traceCode == TCL_OK)) { /* * Command was found: push a record to schedule the leave traces. */ - TclNRAddCallback(interp, TEOV_RunLeaveTraces, INT2PTR(traceCode), - commandPtr, cmdPtr, Tcl_NewListObj(objc, objv)); + TclNRAddCallback(interp, TEOV_RunLeaveTraces, INT2PTR(objc), + commandPtr, cmdPtr, objv); cmdPtr->refCount++; } else { Tcl_DecrRefCount(commandPtr); @@ -4686,19 +4686,18 @@ TEOV_RunLeaveTraces( int result) { Interp *iPtr = (Interp *) interp; - const char *command; - int length, objc; - Tcl_Obj **objv; - int traceCode = PTR2INT(data[0]); + int traceCode = TCL_OK; + int objc = PTR2INT(data[0]); Tcl_Obj *commandPtr = data[1]; Command *cmdPtr = data[2]; - Tcl_Obj *wordsPtr = data[3]; + Tcl_Obj **objv = data[3]; - command = Tcl_GetStringFromObj(commandPtr, &length); - Tcl_ListObjGetElements(NULL, wordsPtr, &objc, &objv); if (!(cmdPtr->flags & CMD_IS_DELETED)) { - if ((cmdPtr->flags & CMD_HAS_EXEC_TRACES) && traceCode == TCL_OK){ + int length; + const char *command = Tcl_GetStringFromObj(commandPtr, &length); + + if (cmdPtr->flags & CMD_HAS_EXEC_TRACES){ traceCode = TclCheckExecutionTraces(interp, command, length, cmdPtr, result, TCL_TRACE_LEAVE_EXEC, objc, objv); } @@ -4708,7 +4707,6 @@ TEOV_RunLeaveTraces( } } Tcl_DecrRefCount(commandPtr); - Tcl_DecrRefCount(wordsPtr); /* * As cmdPtr is set, TclNRRunCallbacks is about to reduce the numlevels. -- cgit v0.12 From b2d7315f923bd7c0eae390595466fcf0ff1388ac Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 14 Aug 2013 12:15:59 +0000 Subject: Consolidate some helper routines. --- generic/tclCmdIL.c | 19 ------------------- generic/tclExecute.c | 27 +++++++++++++++++++-------- generic/tclInt.h | 2 -- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index da9edd6..fa4ead4 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1266,25 +1266,6 @@ InfoFrameCmd( */ Tcl_Obj * -TclGetSourceFromFrame( - CmdFrame *cfPtr, - int objc, - Tcl_Obj *const objv[]) -{ - if (cfPtr == NULL) { - return Tcl_NewListObj(objc, objv); - } - if (cfPtr->cmdObj == NULL) { - if (cfPtr->cmd == NULL) { - cfPtr->cmd = TclGetSrcInfoForCmdFrame(cfPtr, &cfPtr->len); - } - cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); - Tcl_IncrRefCount(cfPtr->cmdObj); - } - return cfPtr->cmdObj; -} - -Tcl_Obj * TclInfoFrame( Tcl_Interp *interp, /* Current interpreter. */ CmdFrame *framePtr) /* Frame to get info for. */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 58e4d3d..d066476 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8740,7 +8740,7 @@ IllegalExprOperandType( /* *---------------------------------------------------------------------- * - * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSrcInfoForCmdFrame -- + * TclGetSrcInfoForPc, GetSrcInfoForPc, TclGetSourceFromFrame -- * * Given a program counter value, finds the closest command in the * bytecode code unit's CmdLocation array and returns information about @@ -8761,15 +8761,26 @@ IllegalExprOperandType( *---------------------------------------------------------------------- */ -const char * -TclGetSrcInfoForCmdFrame( +Tcl_Obj * +TclGetSourceFromFrame( CmdFrame *cfPtr, - int *lenPtr) + int objc, + Tcl_Obj *const objv[]) { - ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; - - return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, - codePtr, lenPtr, NULL, NULL); + if (cfPtr == NULL) { + return Tcl_NewListObj(objc, objv); + } + if (cfPtr->cmdObj == NULL) { + if (cfPtr->cmd == NULL) { + ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr; + + cfPtr->cmd = GetSrcInfoForPc((unsigned char *) + cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL); + } + cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + Tcl_IncrRefCount(cfPtr->cmdObj); + } + return cfPtr->cmdObj; } void diff --git a/generic/tclInt.h b/generic/tclInt.h index 19cd883..6056119 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2909,8 +2909,6 @@ MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr); MODULE_SCOPE Tcl_Obj * TclGetSourceFromFrame(CmdFrame *cfPtr, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE const char *TclGetSrcInfoForCmdFrame(CmdFrame *cfPtr, - int *lenPtr); MODULE_SCOPE int TclGlob(Tcl_Interp *interp, char *pattern, Tcl_Obj *unquotedPrefix, int globFlags, Tcl_GlobTypeData *types); -- cgit v0.12 From 2916d083d8e80db13d25190cdc1534aad0cf67ad Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 14 Aug 2013 17:02:41 +0000 Subject: [a16752c252] Correct failure to call cmd deletion callbacks. --- generic/tclBasic.c | 28 +++++----------------------- generic/tclTest.c | 6 +++--- tests/rename.test | 7 +++++++ 3 files changed, 15 insertions(+), 26 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4f24515..8ab3acb 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1966,12 +1966,8 @@ Tcl_CreateCommand( * future calls to Tcl_GetCommandName. * * Side effects: - * If no command named "cmdName" already exists for interp, one is - * created. Otherwise, if a command does exist, then if the object-based - * Tcl_ObjCmdProc is TclInvokeStringCommand, we assume Tcl_CreateCommand - * was called previously for the same command and just set its - * Tcl_ObjCmdProc to the argument "proc"; otherwise, we delete the old - * command. + * If a command named "cmdName" already exists for interp, it is + * first deleted. Then the new command is created from the arguments. * * In the future, during bytecode evaluation when "cmdName" is seen as * the name of a command by Tcl_EvalObj or Tcl_Eval, the object-based @@ -2039,21 +2035,7 @@ Tcl_CreateObjCommand( cmdPtr = Tcl_GetHashValue(hPtr); /* - * Command already exists. If its object-based Tcl_ObjCmdProc is - * TclInvokeStringCommand, we just set its Tcl_ObjCmdProc to the - * argument "proc". Otherwise, we delete the old command. - */ - - if (cmdPtr->objProc == TclInvokeStringCommand) { - cmdPtr->objProc = proc; - cmdPtr->objClientData = clientData; - cmdPtr->deleteProc = deleteProc; - cmdPtr->deleteData = clientData; - return (Tcl_Command) cmdPtr; - } - - /* - * Otherwise, we delete the old command. Be careful to preserve any + * Command already exists; delete it. Be careful to preserve any * existing import links so we can restore them down below. That way, * you can redefine a command and its import status will remain * intact. @@ -2188,8 +2170,8 @@ TclInvokeStringCommand( * A standard Tcl string result value. * * Side effects: - * Besides those side effects of the called Tcl_CmdProc, - * TclInvokeStringCommand allocates and frees storage. + * Besides those side effects of the called Tcl_ObjCmdProc, + * TclInvokeObjectCommand allocates and frees storage. * *---------------------------------------------------------------------- */ diff --git a/generic/tclTest.c b/generic/tclTest.c index 9ef7805..5b51baa 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1545,14 +1545,14 @@ DelCallbackProc( * * TestdelCmd -- * - * This procedure implements the "testdcall" command. It is used - * to test Tcl_CallWhenDeleted. + * This procedure implements the "testdel" command. It is used + * to test calling of command deletion callbacks. * * Results: * A standard Tcl result. * * Side effects: - * Creates and deletes interpreters. + * Creates a command. * *---------------------------------------------------------------------- */ diff --git a/tests/rename.test b/tests/rename.test index bd14578..cd90b55 100644 --- a/tests/rename.test +++ b/tests/rename.test @@ -135,6 +135,13 @@ test rename-4.7 {reentrancy issues with command deletion and renaming} testdel { if {[info exists env(value)]} { unset env(value) } +test rename-4.8 {Bug a16752c252} testdel { + set x broken + testdel {} foo {set x ok} + proc foo args {} + rename foo {} + return -level 0 $x[unset x] +} ok # Save the unknown procedure which is modified by the following test. -- cgit v0.12