3.3.2 Invoking OTcl Procedures
There are four different methods to invoke an OTcl command
through the instance, tcl.
They differ essentially in their calling arguments.
Each function passes a string to the interpreter,
that then evaluates the string in a global context.
These methods will return to the caller if the interpreter returns TCL_OK.
On the other hand, if the interpreter returns TCL_ERROR,
the methods will call tkerror.
The user can overload this procedure to selectively disregard
certain types of errors.
Such intricacies of OTcl programming are outside the
scope of this document.
The next sectionSectionsec:Result
describes methods to access the result returned by the interpreter.
As an example, here are some of the ways of using the above methods:
Tcl& tcl = {\bfseries{}Tcl::instance}();
char wrk[128];
strcpy(wrk, "Simulator set NumberInterfaces_ 1");
{\bfseries{}tcl.eval}(wrk);
sprintf({\bfseries{}tcl.buffer}(), "Agent/SRM set requestFunction_ %s", "Fixed");
{\bfseries{}tcl.eval}();
{\bfseries{}tcl.evalc}("puts stdout {hello world}");
{\bfseries{}tcl.evalf}("%s request %d %d", name_, sender, msgid);
Tom Henderson
2014-12-17