TCL_EvalStr - Evaluate a string whithin the Tcl/Tk interpreter
TK_EvalStr - Evaluate a string whithin the Tcl/Tk interpreter (obsolete)
This routine allows to evaluate Tcl/Tk instructions with the Tcl/Tk interpreter launched with Scilab (when the interp parameter is not given), or in a slave interpreter.
When Tcl/Tk support is enabled in Scilab, you can evaluate Tcl/Tk expression from Scilab interpreter. In fact, Scilab launches a main Tcl/Tk interpreter. The Scilab instruction TCL_EvalStr can be used to evaluate expressions without having to write Tcl/Tk instructions in a separated file (this capability is provided by TCL_EvalFile ).
//with one call TCL_EvalStr(["toplevel .foo1" "label .foo1.l -text ""TK married Scilab !!!""" "pack .foo1.l" "button .foo1.b -text close -command {destroy .foo1}" "pack .foo1.b"]) //step by step (debugging) TCL_EvalStr("toplevel .foo2"); // creates a toplevel TK window. TCL_EvalStr("label .foo2.l -text ""TK married Scilab !!!"""); // create a static label TCL_EvalStr("pack .foo2.l"); // pack the label widget. It appears on the screen. text="button .foo2.b -text close -command {destroy .foo2}"; TCL_EvalStr(text); TCL_EvalStr("pack .foo2.b"); //kill the windows by program TCL_EvalStr("destroy .foo1"); TCL_EvalStr("destroy .foo2"); //with one call, and in a slave interpreter TCL_CreateSlave('TCLSlave'); TCL_EvalStr('set test ""in Slave TCL Interp""','TCLSlave'); TCL_GetVar('test','TCLSlave') TCL_DeleteInterp('TCLSlave') // return a result res = TCL_EvalStr("expr 1+1") res = TCL_EvalStr("tk_messageBox -message Hello -type okcancel") res = TCL_EvalStr(["expr 4+5" "lsearch -all {a b c a b c} c" ; "list [list a b c] [list d e f] [list g h i]" "llength {a b c d e}"])
ScilabEval , TCL_EvalFile , TCL_GetVar , TCL_SetVar , TCL_ExistVar , TCL_UnsetVar , TCL_UpVar ,
Allan CORNET