tcl::interpreter Class Reference

tcl::interpreter provides a wrapper around Tcl_Interp calls. More...

#include <tcl/interp.h>

List of all members.

Public Member Functions

 interpreter (Tcl_Interp *interp)
 interpreter (const interpreter &other) throw ()
bool is_valid () const throw ()
Tcl_Interp * intp () const
 Get the interpreter (if valid), otherwise throw an exception.
bool is_deleted () const throw ()
void forget_interp () throw ()
void destroy () throw ()
void pkg_provide (const char *name, const char *version)
 Wrapper around Tcl_PkgProvide().
bool eval_boolean_expr (const tcl::obj &obj) const
 Evaluate the given expression, return its result as a bool.
bool eval (const char *code, error_strategy strategy=THROW_ERROR)
 Evaluates code.
bool eval (const rutz::fstring &code, error_strategy strategy=THROW_ERROR)
 Evaluates code.
bool eval (const tcl::obj &code, error_strategy strategy=THROW_ERROR)
 Evaluates code.
bool eval_objv (const tcl::list &objv, error_strategy strategy=THROW_ERROR)
 Evaluates code using Tcl_EvalObjv(), exploiting the fact that the object is already a list.
bool eval_file (const char *fname)
 Evaluate the tcl code in the named file.
void source_rc_file ()
void reset_result () const
void append_result (const char *msg) const
void append_result (const rutz::fstring &msg) const
template<class T >
get_result () const
template<class T >
void set_result (const T &x)
void set_global_var (const char *var_name, const tcl::obj &var) const
void unset_global_var (const char *var_name) const
template<class T >
get_global_var (const char *name1, const char *name2=0) const
void link_int (const char *var_name, int *addr, bool read_only)
void link_double (const char *var_name, double *addr, bool read_only)
void link_boolean (const char *var_name, int *addr, bool read_only)
void handle_live_exception (const char *where, const rutz::file_pos &pos) throw ()
void background_error () throw ()
void add_error_info (const char *info)
bool has_command (const char *cmd_name) const
void delete_command (const char *cmd_name)
rutz::fstring get_proc_body (const char *proc_name)
void create_proc (const char *namesp, const char *proc_name, const char *args, const char *body)
void delete_proc (const char *namesp, const char *proc_name)

Static Public Member Functions

static void clear_event_queue ()

Detailed Description

tcl::interpreter provides a wrapper around Tcl_Interp calls.

The advantage over using the raw Tcl C API is that certain error conditions are handled in a more C++-ish way, by throwing exceptions.

Definition at line 72 of file interp.h.


Member Function Documentation

bool tcl::interpreter::eval ( const tcl::obj code,
tcl::error_strategy  strategy = THROW_ERROR 
)

Evaluates code.

If strategy is THROW_ERROR, then an exception is thrown if the evaluation produces an error. If strategy is IGNORE_ERROR, then a return value of true indicates a successful evaluation, and a return value of false indicates an error during evaluation.

Definition at line 222 of file interp.cc.

References intp(), and SRC_POS.

bool tcl::interpreter::eval ( const rutz::fstring code,
tcl::error_strategy  strategy = THROW_ERROR 
)

Evaluates code.

If strategy is THROW_ERROR, then an exception is thrown if the evaluation produces an error. If strategy is IGNORE_ERROR, then a return value of true indicates a successful evaluation, and a return value of false indicates an error during evaluation.

Definition at line 215 of file interp.cc.

References eval().

bool tcl::interpreter::eval ( const char *  code,
tcl::error_strategy  strategy = THROW_ERROR 
)

Evaluates code.

If strategy is THROW_ERROR, then an exception is thrown if the evaluation produces an error. If strategy is IGNORE_ERROR, then a return value of true indicates a successful evaluation, and a return value of false indicates an error during evaluation.

Definition at line 208 of file interp.cc.

Referenced by tcl::pkg::eval(), eval(), and tcl::command_group::lookup_original().

bool tcl::interpreter::eval_boolean_expr ( const tcl::obj obj  )  const

Evaluate the given expression, return its result as a bool.

Definition at line 188 of file interp.cc.

References intp(), and SRC_POS.

bool tcl::interpreter::eval_file ( const char *  fname  ) 

Evaluate the tcl code in the named file.

Returns true on success, or false on failure.

Definition at line 264 of file interp.cc.

References intp().

bool tcl::interpreter::eval_objv ( const tcl::list objv,
tcl::error_strategy  strategy = THROW_ERROR 
)

Evaluates code using Tcl_EvalObjv(), exploiting the fact that the object is already a list.

If strategy is THROW_ERROR, then an exception is thrown if the evaluation produces an error. If strategy is IGNORE_ERROR, then a return value of true indicates a successful evaluation, and a return value of false indicates an error during evaluation.

Definition at line 246 of file interp.cc.

References intp(), and SRC_POS.

Tcl_Interp * tcl::interpreter::intp (  )  const

Get the interpreter (if valid), otherwise throw an exception.

Definition at line 137 of file interp.cc.

References SRC_POS.

Referenced by eval(), eval_boolean_expr(), eval_file(), eval_objv(), tcl::pkg::finish_init(), tcl::pkg::lookup(), and pkg_provide().

void tcl::interpreter::pkg_provide ( const char *  name,
const char *  version 
)

Wrapper around Tcl_PkgProvide().

Definition at line 176 of file interp.cc.

References intp().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:31:33 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3