From 0e5b62601e1b369ad78f4eee43d473e74702cbd6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Jan 2013 09:51:01 +0000 Subject: Eliminate all usage of deprecated Tcl_EvalObj, Tcl_GlobalEval and Tcl_GlobalEvalObj functions. Add [file normalize] to pkgIndex.tcl, in order to prevent '..' in file paths. Remove unused TCLPATCHL, it should be ".0" for all final releases. --- generic/tkConsole.c | 10 +++++----- generic/tkTest.c | 4 ++-- generic/tkTextWind.c | 2 +- macosx/tkMacOSXHLEvents.c | 10 +++++----- macosx/tkMacOSXWindowEvent.c | 6 +++--- unix/Makefile.in | 7 +++---- unix/tkUnixSend.c | 6 +++--- unix/tkUnixWm.c | 2 +- win/Makefile.in | 13 ++++++------- win/tkWinScrlbr.c | 2 +- win/tkWinWm.c | 2 +- 11 files changed, 31 insertions(+), 33 deletions(-) diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 7d9da77..e93c0fc 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -444,7 +444,7 @@ Tk_CreateConsoleWindow(interp) } Tcl_Preserve((ClientData) consoleInterp); - result = Tcl_GlobalEval(consoleInterp, initCmd); + result = Tcl_EvalEx(consoleInterp, initCmd, -1, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_Obj *objPtr = Tcl_GetVar2Ex(consoleInterp, "errorCode", NULL, TCL_GLOBAL_ONLY); @@ -548,7 +548,7 @@ ConsoleOutput(instanceData, buf, toWrite, errorCode) Tcl_DStringFree(&ds); Tcl_IncrRefCount(cmd); - Tcl_GlobalEvalObj(consoleInterp, cmd); + Tcl_EvalObjEx(consoleInterp, cmd, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(cmd); } } @@ -754,7 +754,7 @@ ConsoleObjCmd(clientData, interp, objc, objv) Tcl_IncrRefCount(cmd); if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_Preserve((ClientData) consoleInterp); - result = Tcl_GlobalEvalObj(consoleInterp, cmd); + result = Tcl_EvalObjEx(consoleInterp, cmd, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_Obj *objPtr = Tcl_GetVar2Ex(consoleInterp, "errorCode", NULL, TCL_GLOBAL_ONLY); @@ -830,7 +830,7 @@ InterpreterObjCmd(clientData, interp, objc, objv) Tcl_Preserve((ClientData) otherInterp); switch ((enum option) index) { case OTHER_EVAL: - result = Tcl_GlobalEvalObj(otherInterp, objv[2]); + result = Tcl_EvalObjEx(otherInterp, objv[2], TCL_EVAL_GLOBAL); /* * TODO: Should exceptions be filtered here? */ @@ -973,7 +973,7 @@ ConsoleEventProc(clientData, eventPtr) Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { - Tcl_GlobalEval(consoleInterp, "tk::ConsoleExit"); + Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); } if (--info->refCount <= 0) { diff --git a/generic/tkTest.c b/generic/tkTest.c index 78496e6..e8d8d88 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -410,7 +410,7 @@ CBindingEvalProc(clientData, interp, eventPtr, tkwin, keySym) cbindPtr = (CBinding *) clientData; - return Tcl_GlobalEval(interp, cbindPtr->command); + return Tcl_EvalEx(interp, cbindPtr->command, -1, TCL_EVAL_GLOBAL); } static void @@ -420,7 +420,7 @@ CBindingFreeProc(clientData) CBinding *cbindPtr = (CBinding *) clientData; if (cbindPtr->delete != NULL) { - Tcl_GlobalEval(cbindPtr->interp, cbindPtr->delete); + Tcl_EvalEx(cbindPtr->interp, cbindPtr->delete, -1, TCL_EVAL_GLOBAL); ckfree((char *) cbindPtr->delete); } ckfree((char *) cbindPtr->command); diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 9f2582e..999febe 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -769,7 +769,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars, * the window. */ - code = Tcl_GlobalEval(textPtr->interp, ewPtr->body.ew.create); + code = Tcl_EvalEx(textPtr->interp, ewPtr->body.ew.create, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { createError: Tcl_BackgroundError(textPtr->interp); diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 985c85f..3c6ffd0 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -204,7 +204,7 @@ OappHandler( if (interp && Tcl_GetCommandInfo(interp, "::tk::mac::OpenApplication", &dummy)) { - Tcl_GlobalEval(interp, "::tk::mac::OpenApplication"); + Tcl_EvalEx(interp, "::tk::mac::OpenApplication", -1, TCL_EVAL_GLOBAL); } return noErr; } @@ -238,7 +238,7 @@ RappHandler( if (interp && Tcl_GetCommandInfo(interp, "::tk::mac::ReopenApplication", &dummy)) { - Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication"); + Tcl_EvalEx(interp, "::tk::mac::ReopenApplication", -1, TCL_EVAL_GLOBAL); } return err; } @@ -271,7 +271,7 @@ PrefsHandler( if (interp && Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)) { - Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences"); + Tcl_EvalEx(interp, "::tk::mac::ShowPreferences", -1, TCL_EVAL_GLOBAL); } return noErr; } @@ -590,9 +590,9 @@ ReallyKillMe( Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; Tcl_CmdInfo dummy; if (Tcl_GetCommandInfo(interp, "::tk::mac::Quit", &dummy)) { - Tcl_GlobalEval(interp, "::tk::mac::Quit"); + Tcl_EvalEx(interp, "::tk::mac::Quit", -1, TCL_EVAL_GLOBAL); } else { - Tcl_GlobalEval(interp, "exit"); + Tcl_EvalEx(interp, "exit", -1, TCL_EVAL_GLOBAL); } return 1; } diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 369932c..4d2f477 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -125,7 +125,7 @@ TkMacOSXProcessApplicationEvent( toggleHide = 1; if (eventPtr->interp && Tcl_GetCommandInfo(eventPtr->interp, "::tk::mac::OnHide", &dummy)) { - Tcl_GlobalEval(eventPtr->interp, "::tk::mac::OnHide"); + Tcl_EvalEx(eventPtr->interp, "::tk::mac::OnHide", -1, TCL_EVAL_GLOBAL); } } statusPtr->stopProcessing = 1; @@ -135,7 +135,7 @@ TkMacOSXProcessApplicationEvent( toggleHide = 0; if (eventPtr->interp && Tcl_GetCommandInfo(eventPtr->interp, "::tk::mac::OnShow", &dummy)) { - Tcl_GlobalEval(eventPtr->interp, "::tk::mac::OnShow"); + Tcl_EvalEx(eventPtr->interp, "::tk::mac::OnShow", -1, TCL_EVAL_GLOBAL); } } statusPtr->stopProcessing = 1; @@ -896,7 +896,7 @@ TkWmProtocolEventProc( Tcl_Preserve((ClientData) protPtr); interp = protPtr->interp; Tcl_Preserve((ClientData) interp); - result = Tcl_GlobalEval(interp, protPtr->command); + result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command for \""); Tcl_AddErrorInfo(interp, diff --git a/unix/Makefile.in b/unix/Makefile.in index e2c0289..3748571 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -8,7 +8,6 @@ # Current Tk version; used in various names. TCLVERSION = @TCL_VERSION@ -TCLPATCHL = @TCL_PATCH_LEVEL@ VERSION = @TK_VERSION@ MAJOR_VERSION = @TK_MAJOR_VERSION@ MINOR_VERSION = @TK_MINOR_VERSION@ @@ -662,15 +661,15 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) ${WISH rm -f "$(PKG_INDEX)"; \ (\ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ - echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\ + echo "if {[package vcompare [package provide Tcl] 8.4] != 0} return";\ if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ else \ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && [lsearch -exact \$$::argv -display] > -1))} {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]]";\ echo "} else {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll] Tk]";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file normalize [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll]] Tk]";\ echo "}";\ fi \ ) > "$(PKG_INDEX)"; \ diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index f6ad7b5..089d6a4 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -982,7 +982,7 @@ Tk_SendCmd(clientData, interp, argc, argv) localInterp = riPtr->interp; Tcl_Preserve((ClientData) localInterp); if (firstArg == (argc-1)) { - result = Tcl_GlobalEval(localInterp, argv[firstArg]); + result = Tcl_EvalEx(localInterp, argv[firstArg], -1, TCL_EVAL_GLOBAL); } else { Tcl_DStringInit(&request); Tcl_DStringAppend(&request, argv[firstArg], -1); @@ -990,7 +990,7 @@ Tk_SendCmd(clientData, interp, argc, argv) Tcl_DStringAppend(&request, " ", 1); Tcl_DStringAppend(&request, argv[i], -1); } - result = Tcl_GlobalEval(localInterp, Tcl_DStringValue(&request)); + result = Tcl_EvalEx(localInterp, Tcl_DStringValue(&request), -1, TCL_EVAL_GLOBAL); Tcl_DStringFree(&request); } if (interp != localInterp) { @@ -1523,7 +1523,7 @@ SendEventProc(clientData, eventPtr) remoteInterp = riPtr->interp; Tcl_Preserve((ClientData) remoteInterp); - result = Tcl_GlobalEval(remoteInterp, script); + result = Tcl_EvalEx(remoteInterp, script, -1, TCL_EVAL_GLOBAL); /* * The call to Tcl_Release may have released the interpreter diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 1fe1174..233c881 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -5721,7 +5721,7 @@ TkWmProtocolEventProc(winPtr, eventPtr) Tcl_Preserve((ClientData) protPtr); interp = protPtr->interp; Tcl_Preserve((ClientData) interp); - result = Tcl_GlobalEval(interp, protPtr->command); + result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command for \""); Tcl_AddErrorInfo(interp, protocolName); diff --git a/win/Makefile.in b/win/Makefile.in index b4a06a0..1c47ad2 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -5,7 +5,6 @@ # actual Makefile. TCLVERSION = @TCL_VERSION@ -TCLPATCHL = @TCL_PATCH_LEVEL@ VERSION = @TK_VERSION@ #---------------------------------------------------------------- @@ -143,7 +142,7 @@ MAN2TCL = man2tcl$(EXEEXT) @SET_MAKE@ -# Setting the VPATH variable to a list of paths will cause the +# Setting the VPATH variable to a list of paths will cause the # makefile to look into these paths when resolving .c to .obj # dependencies. @@ -366,7 +365,7 @@ SHELL_ENV = \ TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \ PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; -# Main targets. The default target -- all -- builds the binaries, +# Main targets. The default target -- all -- builds the binaries, # performs any post processing on libraries or documents. all: binaries libraries doc @@ -437,15 +436,15 @@ install-binaries: binaries $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done - @echo "Creating package index $(PKG_INDEX)"; + @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ - echo "if {[package vcompare [package provide Tcl] $(TCLVERSION)] != 0} { return }";\ + echo "if {[package vcompare [package provide Tcl] 8.4] != 0} return";\ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && [lsearch -exact \$$::argv -display] > -1))} {";\ - echo " package ifneeded Tk $(VERSION) [list load [file join \$$dir .. .. bin libtk$(VERSION).dll] Tk]";\ + echo " package ifneeded Tk $(VERSION) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]] Tk]";\ echo "} else {";\ - echo " package ifneeded Tk $(VERSION) [list load [file join \$$dir .. .. bin $(TK_DLL_FILE)] Tk]";\ + echo " package ifneeded Tk $(VERSION) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]] Tk]";\ echo "}";\ ) > $(PKG_INDEX); @for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \ diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 130daa6..2145ff0 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -582,7 +582,7 @@ ScrollbarProc(hwnd, message, wParam, lParam) } interp = scrollPtr->info.interp; - code = Tcl_GlobalEval(interp, cmdString.string); + code = Tcl_EvalEx(interp, cmdString.string, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (scrollbar command)"); Tcl_BackgroundError(interp); diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 32768cf..b8dfd8d 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -6123,7 +6123,7 @@ TkWmProtocolEventProc(winPtr, eventPtr) Tcl_Preserve((ClientData) protPtr); interp = protPtr->interp; Tcl_Preserve((ClientData) interp); - result = Tcl_GlobalEval(interp, protPtr->command); + result = Tcl_EvalEx(interp, protPtr->command, -1, TCL_EVAL_GLOBAL); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command for \""); Tcl_AddErrorInfo(interp, name); -- cgit v0.12 From cc3054648b226f5a00a89e60df98ec33cd0c3bb4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Jan 2013 10:28:39 +0000 Subject: wrong end brace location --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 3748571..1c5c42a 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -667,7 +667,7 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) ${WISH else \ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && [lsearch -exact \$$::argv -display] > -1))} {";\ - echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)] Tk]]";\ + echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)]] Tk]";\ echo "} else {";\ echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file normalize [file join \$$dir $${relative}.. bin tk${MAJOR_VERSION}${MINOR_VERSION}.dll]] Tk]";\ echo "}";\ -- cgit v0.12 From e64bb74c70d8f231c8e599823f28ee88aa60dcb3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Jan 2013 10:32:45 +0000 Subject: add [file normalize] to UNIX pkgIndex.tcl too --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 1c5c42a..3f99fd8 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -663,7 +663,7 @@ install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) ${WISH relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ echo "if {[package vcompare [package provide Tcl] 8.4] != 0} return";\ if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \ - echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\ + echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE)]] Tk]";\ else \ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && [lsearch -exact \$$::argv -display] > -1))} {";\ -- cgit v0.12