diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-04 13:38:56 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-04 13:38:56 (GMT) |
commit | 98cb2bfc19d4903738442df6575ee97ee131e2aa (patch) | |
tree | f6c3951a6770d483163e28feb3aa28892e5a7053 /generic/tclInterp.c | |
parent | 1aef6cddbf5ff7fe047f3a0a1a0e5e9ab45c6a86 (diff) | |
parent | 328461c6cf73105f97aee07048a22741b4d2cc2b (diff) | |
download | tcl-98cb2bfc19d4903738442df6575ee97ee131e2aa.zip tcl-98cb2bfc19d4903738442df6575ee97ee131e2aa.tar.gz tcl-98cb2bfc19d4903738442df6575ee97ee131e2aa.tar.bz2 |
TIP [http://www.tcl.tk/cgi-bin/tct/tip/459|459] implementation, but (for now) without the "source -nopkg" part.
Diffstat (limited to 'generic/tclInterp.c')
-rw-r--r-- | generic/tclInterp.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 6983cc6..af9f1bf 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -331,13 +331,24 @@ TclSetPreInitScript( *---------------------------------------------------------------------- */ +typedef struct PkgName { + struct PkgName *nextPtr; /* Next in list of package names being initialized. */ + char name[4]; +} PkgName; + int Tcl_Init( Tcl_Interp *interp) /* Interpreter to initialize. */ { + PkgName pkgName = {NULL, "Tcl"}; + PkgName **names = TclInitPkgFiles(interp); + int result = TCL_ERROR; + + pkgName.nextPtr = *names; + *names = &pkgName; if (tclPreInitScript != NULL) { if (Tcl_EvalEx(interp, tclPreInitScript, -1, 0) == TCL_ERROR) { - return TCL_ERROR; + goto end; } } @@ -382,7 +393,7 @@ Tcl_Init( * alternate tclInit command before calling Tcl_Init(). */ - return Tcl_EvalEx(interp, + result = Tcl_EvalEx(interp, "if {[namespace which -command tclInit] eq \"\"} {\n" " proc tclInit {} {\n" " global tcl_libPath tcl_library env tclDefaultLibrary\n" @@ -446,6 +457,10 @@ Tcl_Init( " }\n" "}\n" "tclInit", -1, 0); + +end: + *names = (*names)->nextPtr; + return result; } /* |