A tclcmd allows Tcl commands to be executed by a simple x <<
Tcl command syntax. The commands can be stacked, or
accumulated. Each time a linefeed is obtained, the command is
evaluated.
For example:
tclcmd cmd; cmd << "set a 1\n puts stdout $a"; cmd << "for {set i 0} {$i < 10} {incr i}" cmd << "{set a [expr $a+$i]; puts stdout $a}\n";
The behaviour of this command is slightly different from the usual
stream classes (but identical to eco_strstream from which it is derived, as a space is
automatically inserted between arguments of a <<
. This means
that arguments can be easily given - eg
cmd << "plot" << 1.2 << 3.4 << "\n";will perform the command plot 1.2 3.4. In order to build up a symbol from multiple arguments, use the append operator. So
(cmd << "plot"|3) << "\n";executes the command plot3.