tcl instruction : Evaluate a string with scilab interpreter
ScilabEval instruction
ScilabEval instruction "seq"
ScilabEval instruction "sync"
ScilabEval instruction "sync" "seq"
ScilabEval "flush"
:
This function must be called in a tcl/tk script executed from Scilab. It allows to associate Scilab actions to tcl/tk widgets (graphic objects) or to use Scilab to perform some computations within a tcl script.
:
The evaluation context of all these cases is the current Scilab context when the instruction evaluation starts.
More information about Tcl/Tk: http://www.tcl.tk/doc/
//Callbacks and "seq" option usage
//create tcl instructions
tcl_script=['toplevel .w1'
'button .w1.b -text ""Click here to execute without seq option"" -command WithoutSeq'
'button .w1.b1 -text ""Click here to execute with seq option"" -command WithSeq'
'pack .w1.b .w1.b1'
'proc WithoutSeq {} { ';
' ScilabEval ""cont=%f;;cont=%t;"" '
' ScilabEval ""if cont then disp(''ok''),else disp(''wrong'');end;cont=%f;"" '
'}'
'proc WithSeq {} { ';
' ScilabEval ""cont=%f;;cont=%t;"" ""seq""'
' ScilabEval ""if cont then disp(''ok''),else disp(''wrong'');end;cont=%f;"" '
'}'];
`mputl`_(tcl_script,TMPDIR+'/test.tcl') //write them to a file
// Execute the tcl script
cont=%f;
`TCL_EvalFile`_(TMPDIR+'/test.tcl');;
//scripts and "sync" option usage
//----------------without "sync"----------------
tcl_script=[' set t ""0""'
' while {$t != ""10""} {'
' ScilabEval ""a=$t;mprintf(''%d '',a);""'
' incr t'
' }'];
`mputl`_(tcl_script,TMPDIR+'/test.tcl') //write them to a file
// Execute the tcl script
`TCL_EvalFile`_(TMPDIR+'/test.tcl');`mprintf`_('TCL_EvalFile finished\n');
// The ScilabEval are executed after the and of TCL_EvalFile
//----------------with "sync"----------------
tcl_script=[' set t ""0""'
' while {$t != ""10""} {'
' ScilabEval ""a=$t;mprintf(''%d '',a);"" ""sync""'
' incr t'
' }'];
`mputl`_(tcl_script,TMPDIR+'/test.tcl') //write them to a file
// Execute the tcl script
`TCL_EvalFile`_(TMPDIR+'/test.tcl');`mprintf`_('TCL_EvalFile finished\n');
// The ScilabEval are executed synchronously with TCL_EvalFile