diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-01-26 14:02:44 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-01-26 14:02:44 (GMT) |
commit | 1507f0dd1ea0cf16c5bb8694af1a1702bb4183f6 (patch) | |
tree | 9959cbbf236b4517e05de481b8cf73d405026370 /generic/tclCmdIL.c | |
parent | 9aefb192c71805b6be041d37310d24b5c44914cd (diff) | |
parent | 94afc59c4d9536471f338429cfb6b924e960fef0 (diff) | |
download | tcl-tip_440_alt.zip tcl-tip_440_alt.tar.gz tcl-tip_440_alt.tar.bz2 |
Redo TIP #440 alternative again, now using "info runtime".tip_440_alt
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 739dca9..e5378f0 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -142,6 +142,8 @@ static int InfoPatchLevelCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int InfoProcsCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int InfoRuntimeCmd(ClientData dummy, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static int InfoScriptCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int InfoSharedlibCmd(ClientData dummy, Tcl_Interp *interp, @@ -181,6 +183,7 @@ static const EnsembleImplMap defaultInfoMap[] = { {"nameofexecutable", InfoNameOfExecutableCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, {"patchlevel", InfoPatchLevelCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, {"procs", InfoProcsCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0}, + {"runtime", InfoRuntimeCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0}, {"script", InfoScriptCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0}, {"sharedlibextension", InfoSharedlibCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, {"tclversion", InfoTclVersionCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, @@ -2004,6 +2007,42 @@ InfoProcsCmd( /* *---------------------------------------------------------------------- * + * InfoRuntimeCmd -- + * + * Called to implement the "info runtime" command that returns the + * runtime. For the Tcl Core implementation, it always returns "core". + * Handles the following syntax: + * + * info runtime + * + * Results: + * Returns TCL_OK. + * + * Side effects: + * Returns a result ("core") in the interpreter's result object. + * + *---------------------------------------------------------------------- + */ + +static int +InfoRuntimeCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return TCL_ERROR; + } + + Tcl_SetObjResult(interp, Tcl_NewStringObj("core", -1)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * InfoScriptCmd -- * * Called to implement the "info script" command that returns the script |