#include <tcl/interp.h>
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> | |
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> | |
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 () |
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.
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 eval(), and tcl::command_group::lookup_original().
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 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 tcl::obj::get(), intp(), and SRC_POS.
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 tcl::list::as_obj(), tcl::list::elements(), intp(), tcl::list::length(), and SRC_POS.
bool tcl::interpreter::eval_file | ( | const char * | fname | ) |