diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-07-08 12:37:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-07-08 12:37:00 (GMT) |
commit | cf4533c3f4a7f7c8d4460198dd698cf551a86626 (patch) | |
tree | c5fc725672fbf6ef8734010295fdda420eb74ed5 | |
parent | 60d0329208c534212988f39381ed9d26975da493 (diff) | |
parent | 9b295677e26deba1c3dc4f2fb521cd49e4b46fa3 (diff) | |
download | tcl-cf4533c3f4a7f7c8d4460198dd698cf551a86626.zip tcl-cf4533c3f4a7f7c8d4460198dd698cf551a86626.tar.gz tcl-cf4533c3f4a7f7c8d4460198dd698cf551a86626.tar.bz2 |
Rebase.
Remove usability of -DUSE_TCL_STUBS
-rw-r--r-- | doc/InitSubSyst.3 | 41 | ||||
-rw-r--r-- | generic/tcl.h | 7 | ||||
-rw-r--r-- | generic/tclEncoding.c | 25 |
3 files changed, 69 insertions, 4 deletions
diff --git a/doc/InitSubSyst.3 b/doc/InitSubSyst.3 new file mode 100644 index 0000000..3abdba3 --- /dev/null +++ b/doc/InitSubSyst.3 @@ -0,0 +1,41 @@ +'\" +'\" Copyright (c) 2013 Tcl Core Team +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.so man.macros +.TH Tcl_InitSubsystems 3 8.6.1 Tcl "Tcl Library Procedures" +.BS +.SH NAME +Tcl_InitSubsystems \- initialize the Tcl library. +.SH SYNOPSIS +.nf +\fB#include <tcl.h>\fR +.sp +const char * +\fBTcl_InitSubsystems\fR(\fIpanicProc\fR) +.SH ARGUMENTS +.SH ARGUMENTS +.AS Tcl_PanicProc *panicProc +.AP Tcl_PanicProc *panicProc in +Desired panic function, for error reporting. If NULL, the default +panicProc is used, which normally writes the message to stderr. +.BE + +.SH DESCRIPTION +.PP +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. +.PP +\fBTcl_InitSubsystems\fR is very similar in use to +\fBTcl_FindExecutable\fR. It can be used when Tcl is +used as utility library, no other encodings than utf8, +iso8859-1 or unicode are used, and no interest exists in the +value of \fBinfo nameofexecutable\fR. The system encoding will not +be extracted from the environment, but falls back to iso8859-1. +.PP +The return value is the Tcl version. +.SH KEYWORDS +binary, executable file diff --git a/generic/tcl.h b/generic/tcl.h index a833218..bc98109 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2398,6 +2398,7 @@ const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version, const char * TclTomMathInitializeStubs(Tcl_Interp *interp, const char *version, int epoch, int revision); + /* * When not using stubs, make it a macro. */ @@ -2411,6 +2412,12 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, * TODO - tommath stubs export goes here! */ +/* Tcl_InitSubsystems, see TIP #414 */ + +#ifndef USE_TCL_STUBS + EXTERN const char *Tcl_InitSubsystems(Tcl_PanicProc *panicProc); +#endif + /* * Public functions that are not accessible via the stubs table. * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 2cc55d6..69d3280 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1411,20 +1411,37 @@ Tcl_UtfToExternal( /* *--------------------------------------------------------------------------- * - * Tcl_FindExecutable -- + * Tcl_InitSubsystems/Tcl_FindExecutable -- * - * This function computes the absolute path name of the current - * application, given its argv[0] value. + * This function initializes everything needed for the Tcl library + * to be able to operate. * * Results: * None. * * Side effects: * The absolute pathname for the application is computed and stored to be - * returned later be [info nameofexecutable]. + * returned later by [info nameofexecutable]. * *--------------------------------------------------------------------------- */ +MODULE_SCOPE const TclStubs tclStubs; + +static const struct { + const TclStubs *stubs; + const char version[12]; +} stubInfo = { + &tclStubs, TCL_PATCH_LEVEL +}; + +const char * +Tcl_InitSubsystems(Tcl_PanicProc *panicProc) +{ + Tcl_SetPanicProc(panicProc); + TclInitSubsystems(); + return stubInfo.version; +} + #undef Tcl_FindExecutable void Tcl_FindExecutable( |