Re: Access commands list and vars list from C API
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Access commands list and vars list from C API

From: Eckhard Lehmann <ecky-l@web.de>
Date: Fri Feb 17 2006 - 12:23:00 CET

fabrice wrote:
> Hi all,
>
> It is easy to access vars list and commands list from tcl by using
> "info commands" and "info vars". Now I want to get the list from the C
> API. How can I do this ?
>

The easiest way is to use Tcl_Eval*() and deal with the result from a
subsequent Tcl_GetObjResult():

Tcl_Obj *script, *res;

script = Tcl_NewStringObj(interp, "info commands;", -1);
if (Tcl_EvalObjEx(interp, script, TCL_EVAL_GLOBAL) != TCL_OK)
  return TCL_ERROR;
res = Tcl_GetObjResult(interp);

Eckhard
Received on Sun Apr 30 02:08:29 2006