summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-26 00:45:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-26 00:45:01 (GMT)
commite8c69aa65400fd70a846835460c27f6a5f4d962e (patch)
tree43f3e9801c0684f6cf854db1e56cda2f515c6026
parentb2b37d97cf1e542ec98b18b3d314cf87e098cb59 (diff)
parent28bc611c7bc112677d438e3218b16ea9778917f6 (diff)
downloadtcl-e8c69aa65400fd70a846835460c27f6a5f4d962e.zip
tcl-e8c69aa65400fd70a846835460c27f6a5f4d962e.tar.gz
tcl-e8c69aa65400fd70a846835460c27f6a5f4d962e.tar.bz2
merge trunk
doc improvements
-rw-r--r--doc/FindExec.349
-rw-r--r--generic/tclBasic.c3
2 files changed, 30 insertions, 22 deletions
diff --git a/doc/FindExec.3 b/doc/FindExec.3
index 4ad815f..1b3c7c5 100644
--- a/doc/FindExec.3
+++ b/doc/FindExec.3
@@ -66,9 +66,10 @@ equivalent to the \fBinfo nameofexecutable\fR command. NULL
is returned if the internal full path name has not been
computed or unknown.
.PP
-The \fBTcl_InitSubsystems\fR can be used as alternative to
+The \fBTcl_InitSubsystems\fR can be used as an alternative to
\fBTcl_FindExecutable\fR, when more flexibility is required.
-Its flags control exactly what is initialized.
+Its flags control exactly what is initialized, and what
+additional arguments are expected.
.PP
The call \fBTcl_InitSubsystems(0)\fR does the same as
\fBTcl_FindExecutable(NULL)\fR, except that a Tcl_Interp *
@@ -79,23 +80,32 @@ 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, ...)
+ Tcl_Interp *interp, *(*initSubSystems)(int, ...);
const char *version;
void *handle = dlopen("libtcl8.6.so", RTLD_NOW|RTLD_LOCAL);
initSubSystems = dlsym(handle, "Tcl_InitSubsystems");
- interp = initSubSystems(0); /* Not a real interpreter */
- version = Tcl_InitStubs(interp, NULL, 0); /* initialize the stub table */
+ 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 */
.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
-shared library. It can be called directly though the stub table.
+shared library. It can be called directly through the stub table.
Note that the stub table needs to be initialized twice, in order
to be sure that you can call all functions without limitations
after the real interpreter is created.
.PP
-If you supply the flag TCL_INIT_PANIC to \fBTcl_InitSubsystems\fR,
+If you supply the flag \fBTCL_INIT_PANIC\fR to \fBTcl_InitSubsystems\fR,
the function expects an additional argument, a custom panicProc.
This is equivalent to calling \fBTcl_SetPanicProc\fR immediately
before \fBTcl_InitSubsystems\fR, except that you possibly cannot do
@@ -104,8 +114,8 @@ could call \fBTcl_SetPanicProc\fR immediately after \fBTcl_InitSubsystems\fR,
but then panics which could be produced by the initialization
itself still use the default panic procedure.
.PP
-If you supply one of the flags TCL_INIT_CREATE, TCL_INIT_CREATE_UTF8 or
-TCL_INIT_CREATE_UNICODE to \fBTcl_InitSubsystems\fR, the function
+If you supply one of the flags \fBTCL_INIT_CREATE\fR, \fBTCL_INIT_CREATE_UTF8\fR or
+\fBTCL_INIT_CREATE_UNICODE\fR to \fBTcl_InitSubsystems\fR, the function
gets two additional parameters, argc and argv. Then a real
Tcl interpreter will be created. If argc > 0 then the variables
\fBargc\fR and \fBargv\fR will be set in this interpreter. The 3
@@ -113,22 +123,23 @@ 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, *(*initSubSystems)(int, ...)
- void *handle = dlopen("libtcl8.6.so", RTLD_NOW|RTLD_LOCAL);
- initSubSystems = dlsym(handle, "Tcl_InitSubsystems");
- interp = initSubSystems(TCL_INIT_CREATE, 0, NULL); /* Real interpreter */
- Tcl_InitStubs(interp, NULL, 0); /* initialize the stub table */
+ interp = Tcl_InitSubSystems(TCL_INIT_CREATE, 0, NULL);
+ Tcl_InitStubs(interp, TCL_VERSION, 0); /* initialize the stub table */
.CE
.PP
-The reason for argv0 always using the system encoding is that this way,
+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.
+.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)
-arguments without any processing. TCL_INIT_CREATE_UNICODE is really only
+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
determining the value of [info executable] anyway. Modern UNIX system already
-have UTF-8 as system encoding, so TCL_INIT_CREATE_UTF8 would have the same
-effect as TCL_INIT_CREATE, only slightly faster. Other parameters can be
+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
preprocessed at will by the application, and if the application uses unicode
-or utf-8 internally there is no need to convert it back to the system encoding.
+or UTF-8 internally there is no need to convert it back to the system encoding.
.PP
The interpreter returned by Tcl_InitSubsystems(0) cannot be passed to
any other function than Tcl_InitStubs(). Tcl functions with an "interp"
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 6c53547..4d5b715 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -4181,9 +4181,6 @@ TclNREvalObjv(
}
cmdPtrPtr = (Command **) &(callbackPtr->data[0]);
- callbackPtr->data[2] = INT2PTR(objc);
- callbackPtr->data[3] = (ClientData) objv;
-
iPtr->numLevels++;
result = TclInterpReady(interp);