diff options
author | dgp <dgp@users.sourceforge.net> | 2017-06-22 13:26:31 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-06-22 13:26:31 (GMT) |
commit | a0af7d5841f6a8fbf03f748e9e1a5827a29d6a6a (patch) | |
tree | 0399533a04774cd225f1e61c826c6b04e0981618 /generic/tclCmdMZ.c | |
parent | 9a0f3fc06f63ce3a77d1257877bc079fa5d33d99 (diff) | |
parent | f57dacd4955b9dd474cfd9d4e4d55cac22990f6c (diff) | |
download | tcl-unwanted.zip tcl-unwanted.tar.gz tcl-unwanted.tar.bz2 |
merge trunkunwanted
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 23e6bd1..e24dd58 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -989,8 +989,11 @@ TclNRSourceObjCmd( { const char *encodingName = NULL; Tcl_Obj *fileName; + int result; + void **pkgFiles = NULL; + void *names = NULL; - if (objc != 2 && objc !=4) { + if (objc < 2 || objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, "?-encoding name? fileName"); return TCL_ERROR; } @@ -1008,9 +1011,30 @@ TclNRSourceObjCmd( return TCL_ERROR; } encodingName = TclGetString(objv[2]); - } + } else if (objc == 3) { + /* Handle undocumented -nopkg option. This should only be + * used by the internal ::tcl::Pkg::source utility function. */ + static const char *const nopkgoptions[] = { + "-nopkg", NULL + }; + int index; - return TclNREvalFile(interp, fileName, encodingName); + if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], nopkgoptions, + "option", TCL_EXACT, &index)) { + return TCL_ERROR; + } + pkgFiles = Tcl_GetAssocData(interp, "tclPkgFiles", NULL); + /* Make sure that during the following TclNREvalFile no filenames + * are recorded for inclusion in the "package files" command */ + names = *pkgFiles; + *pkgFiles = NULL; + } + result = TclNREvalFile(interp, fileName, encodingName); + if (pkgFiles) { + /* restore "tclPkgFiles" assocdata to how it was. */ + *pkgFiles = names; + } + return result; } /* @@ -1541,7 +1565,7 @@ StringIsCmd( } break; case STR_IS_WIDE: - if (TCL_OK == Tcl_GetWideIntFromObj(NULL, objPtr, &w)) { + if (TCL_OK == TclGetWideIntFromObj(NULL, objPtr, &w)) { break; } |