diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-20 12:47:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-20 12:47:12 (GMT) |
commit | f361c1805c0b26ffab9cd3bf43b69456847a619c (patch) | |
tree | 7fb7e41734b19d337d2fc8a6fd249adfdfda5ce7 | |
parent | 52b8ad45d1d3762f5608d906c8e8b2e00472f76b (diff) | |
parent | e878a050b2e76ce58af3e5bc9db745831986bd04 (diff) | |
download | tcl-f361c1805c0b26ffab9cd3bf43b69456847a619c.zip tcl-f361c1805c0b26ffab9cd3bf43b69456847a619c.tar.gz tcl-f361c1805c0b26ffab9cd3bf43b69456847a619c.tar.bz2 |
merge trunk.
doc improvements
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | doc/InitSubSyst.3 | 44 | ||||
-rw-r--r-- | generic/tcl.h | 2 | ||||
-rw-r--r-- | generic/tclDecls.h | 3 | ||||
-rw-r--r-- | generic/tclTrace.c | 6 | ||||
-rw-r--r-- | tests/trace.test | 10 | ||||
-rw-r--r-- | unix/tclAppInit.c | 8 | ||||
-rw-r--r-- | win/tclAppInit.c | 10 | ||||
-rw-r--r-- | win/tclWinDde.c | 8 | ||||
-rw-r--r-- | win/tclWinReg.c | 6 |
10 files changed, 71 insertions, 36 deletions
@@ -1,3 +1,13 @@ +2013-02-20 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tclWinDde.c: [Bug 3605401]: Compiler error with latest mingw-w64 + headers. + +2013-02-19 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclTrace.c: [Bug 2438181]: Incorrect error reporting in + * tests/trace.test: traces. Test-case and fix provided by Poor Yorick. + 2013-02-15 Don Porter <dgp@users.sourceforge.net> * generic/regc_nfa.c: [Bug 3604074] Fix regexp optimization to diff --git a/doc/InitSubSyst.3 b/doc/InitSubSyst.3 index efe4861..c23f2a3 100644 --- a/doc/InitSubSyst.3 +++ b/doc/InitSubSyst.3 @@ -5,7 +5,7 @@ '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .so man.macros -.TH Tcl_InitSubsystems 3 8.6 Tcl "Tcl Library Procedures" +.TH Tcl_InitSubsystems 3 8.6.1 Tcl "Tcl Library Procedures" .BS .SH NAME Tcl_InitSubsystems \- initialize the Tcl library. @@ -25,7 +25,7 @@ The value 0 can be used if Tcl is used as utility library only. .SH DESCRIPTION .PP -The \fBfBTcl_InitSubsystems\fR procedure initializes the Tcl +The \fBTcl_InitSubsystems\fR procedure initializes the Tcl library. This procedure is typically invoked as the very first thing in the application's main program. Its \fBflags\fR argument controls exactly what is initialized, @@ -40,23 +40,23 @@ load the Tcl shared library and use functions in it without ever creating an interpreter. E.g. the following code can be compiled with -DUSE_TCL_STUBS: .CS - Tcl_Interp *interp, *(*initSubSystems)(int, ...); - const char *version; - void *handle = dlopen("libtcl8.6.so", RTLD_NOW|RTLD_LOCAL); - initSubSystems = dlsym(handle, "Tcl_InitSubsystems"); - version = Tcl_InitStubs(initSubSystems(0), NULL, 0); - /* At this point, Tcl C API calls without interp are ready for use */ - interp = Tcl_CreateInterp(); /* Now we have a real interpreter */ - Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */ +Tcl_Interp *interp, *(*initSubSystems)(int, ...); +const char *version; +void *handle = dlopen("libtcl8.6.so", RTLD_NOW|RTLD_LOCAL); +initSubSystems = dlsym(handle, "Tcl_InitSubsystems"); +version = Tcl_InitStubs(initSubSystems(0), NULL, 0); +/* At this point, Tcl C API calls without interp are ready for use */ +interp = Tcl_CreateInterp(); /* Now we have a real interpreter */ +Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */ .CE This is equivalent to (without dynamical loading) .CS - Tcl_Interp *interp; - const char *version; - version = Tcl_InitStubs(Tcl_InitSubSystems(0), NULL, 0); - /* At this point, Tcl C API calls without interp are ready for use */ - interp = Tcl_CreateInterp(); /* Now we have a real interpreter */ - Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */ +Tcl_Interp *interp; +const char *version; +version = Tcl_InitStubs(Tcl_InitSubSystems(0), NULL, 0); +/* At this point, Tcl C API calls without interp are ready for use */ +interp = Tcl_CreateInterp(); /* Now we have a real interpreter */ +Tcl_InitStubs(interp, version, 0); /* Initialize the stub table again */ .CE The function \fBTcl_CreateInterp\fR, or any other Tcl function you would like to call, no longer needs to be searched for in the @@ -83,18 +83,18 @@ variants assume a different encoding for the arguments, except for \fIargv[0]\fR which is always assumed to be in the system encoding. So, the above example code could be simplified to: .CS - Tcl_Interp *interp = Tcl_InitSubSystems(TCL_INIT_CREATE, 0, NULL); - Tcl_InitStubs(interp, TCL_VERSION, 0); /* initialize the stub table */ +Tcl_Interp *interp = Tcl_InitSubSystems(TCL_INIT_CREATE, 0, NULL); +Tcl_InitStubs(interp, TCL_VERSION, 0); /* initialize the stub table */ .CE .PP If the \fBTCL_INIT_PANIC\fR and one of the \fBTCL_INIT_CREATE\fR flags are used in combination, the \fBpanicProc\fR argument comes -before the \fBargc\fR/\fBargv\fR arguments. +before the argc/argv arguments. .PP -The reason for \fBargv0\fR always using the system encoding is that this way, -argv0 can be derived directly from the main() (or mainw, on Windows) +The reason for \fBargv[0]\fR always using the system encoding is that this way, +argv[0] can be derived directly from the main() (or mainw, on Windows) arguments without any processing. \fBTCL_INIT_CREATE_UNICODE\fR is really only -useful on Windows. But on Windows, the argv0 parameter is not used for +useful on Windows. But on Windows, the argv[0] parameter is not used for determining the value of [info executable] anyway. Modern UNIX system already have UTF-8 as system encoding, so \fBTCL_INIT_CREATE_UTF8\fR would have the same effect as \fBTCL_INIT_CREATE\fR, only slightly faster. Other parameters can be diff --git a/generic/tcl.h b/generic/tcl.h index 5f956b0..0790274 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2409,7 +2409,7 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, * TODO - tommath stubs export goes here! */ -/* Tcl_InitSubsystems, see TIP ??? */ +/* Tcl_InitSubsystems, see TIP 414 */ #define TCL_INIT_PANIC (1) /* Set Panic proc */ #define TCL_INIT_CREATE (48) /* Call Tcl_CreateInterp(), and set argc/argv */ diff --git a/generic/tclDecls.h b/generic/tclDecls.h index fe9ba2b..d931873 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3783,6 +3783,7 @@ extern const TclStubs *tclStubsPtr; # undef Tcl_Init # undef Tcl_SetPanicProc # undef Tcl_SetVar +# undef Tcl_ObjSetVar2 # undef Tcl_StaticPackage # undef TclFSGetNativePath # define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp()) @@ -3791,6 +3792,8 @@ extern const TclStubs *tclStubsPtr; # define Tcl_SetPanicProc(proc) (tclStubsPtr->tcl_SetPanicProc(proc)) # define Tcl_SetVar(interp, varName, newValue, flags) \ (tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags)) +# define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \ + (tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags)) #endif #if defined(_WIN32) && defined(UNICODE) diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 0f297a4..d7430ca 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -1485,7 +1485,11 @@ TclCheckExecutionTraces( } iPtr->activeCmdTracePtr = active.nextPtr; if (state) { - Tcl_RestoreInterpState(interp, state); + if (traceCode == TCL_OK) { + (void) Tcl_RestoreInterpState(interp, state); + } else { + Tcl_DiscardInterpState(state); + } } return traceCode; diff --git a/tests/trace.test b/tests/trace.test index b4957c0..41ad00d 100644 --- a/tests/trace.test +++ b/tests/trace.test @@ -1670,6 +1670,16 @@ test trace-21.11 {trace execution and alias} -setup { rename ::x {} } -result {:: ::} +proc set2 args { + set {*}$args +} + +test trace-21.12 {bug 2438181} -setup { + trace add execution set2 leave {puts one two three #;} +} -body { + set2 a hello +} -returnCodes 1 -result {wrong # args: should be "puts ?-nonewline? ?channelId? string"} + proc factorial {n} { if {$n != 1} { return [expr {$n * [factorial [expr {$n -1 }]]}] } return 1 diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 159bbd8..f3edcff 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -48,7 +48,7 @@ MODULE_SCOPE int main(int, char **); */ #ifdef TCL_LOCAL_MAIN_HOOK -extern int TCL_LOCAL_MAIN_HOOK(int *argc, char ***argv); +MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, char ***argv); #endif /* @@ -150,9 +150,11 @@ Tcl_AppInit( */ #ifdef DJGPP - (Tcl_SetVar)(interp, "tcl_rcFileName", "~/tclsh.rc", TCL_GLOBAL_ONLY); + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/tclsh.rc", -1), TCL_GLOBAL_ONLY); #else - (Tcl_SetVar)(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/.tclshrc", -1), TCL_GLOBAL_ONLY); #endif return TCL_OK; diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 56f45a0..753eaff 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -45,7 +45,10 @@ static void setargv(int *argcPtr, TCHAR ***argvPtr); #ifndef TCL_LOCAL_APPINIT #define TCL_LOCAL_APPINIT Tcl_AppInit #endif -extern int TCL_LOCAL_APPINIT(Tcl_Interp *interp); +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif +MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); /* * The following #if block allows you to change how Tcl finds the startup @@ -54,7 +57,7 @@ extern int TCL_LOCAL_APPINIT(Tcl_Interp *interp); */ #ifdef TCL_LOCAL_MAIN_HOOK -extern int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv); +MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv); #endif /* @@ -193,7 +196,8 @@ Tcl_AppInit( * specific startup file will be run under any conditions. */ - (Tcl_SetVar)(interp, "tcl_rcFileName", "~/tclshrc.tcl", TCL_GLOBAL_ONLY); + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/tclshrc.tcl", -1), TCL_GLOBAL_ONLY); return TCL_OK; } diff --git a/win/tclWinDde.c b/win/tclWinDde.c index d0600e6..ce0b413 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -11,8 +11,9 @@ */ #undef STATIC_BUILD -#undef USE_TCL_STUBS -#define USE_TCL_STUBS +#ifndef USE_TCL_STUBS +# define USE_TCL_STUBS +#endif #include "tclInt.h" #include <dde.h> #include <ddeml.h> @@ -385,7 +386,8 @@ DdeSetServerName( Tcl_DStringSetLength(&dString, offset + sizeof(TCHAR) * TCL_INTEGER_SPACE); actualName = (TCHAR *) Tcl_DStringValue(&dString); } - _stprintf((TCHAR *) (Tcl_DStringValue(&dString) + offset), TEXT("%d"), suffix); + _sntprintf((TCHAR *) (Tcl_DStringValue(&dString) + offset), + TCL_INTEGER_SPACE, TEXT("%d"), suffix); } /* diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 6ac5caf..327e4a3 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -13,9 +13,9 @@ */ #undef STATIC_BUILD -#undef USE_TCL_STUBS -#define USE_TCL_STUBS - +#ifndef USE_TCL_STUBS +# define USE_TCL_STUBS +#endif #include "tclInt.h" #ifdef _MSC_VER # pragma comment (lib, "advapi32.lib") |