NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | FILES | ATTRIBUTES | SEE ALSO | NOTES
rsh target tclsh
Tcl is a high-level programming language whose syntax resembles that of csh and C.
tclsh is the Tcl interpreter for ChorusOS.
To download and run a Tcl interpreter on the target , follow the procedure below:
Make sure /var/tmp under the exported tree is writable from the target system.
If you run
tclsh
as a supervisor actor,
make sure your system has enough stack space.
kern.exec.dflSysStackSize
= 0x4000
(at least)
Run the interpreter:
host% rsh target tclsh |
The example Tcl resource file ( .tclshrc ) below simulates very simple versions of ls , cat , cp and more commands. Remember to place the .tclshrc file in the HOME directory.
proc ls args {
if {$args == ""} {set args "*"}
foreach i [lsort [glob $args]] {
puts stdout $i
}
}
proc cat args {
set f [open $args]
set x [read $f]
puts stdout $x
close $f
}
proc cp {f1 f2} {
set f [open $f1]
set g [open $f2 "w"]
set x [read $f]
puts $g $x
close $f
close $g
}
proc more args {
set count 0
set f [open $args]
while {[gets $f line] >= 0} {
incr count 1
puts stdout $line
if {$count == 24} {
puts -nonewline stdout "--More--"
gets stdin order
if {$order == "q"} {
close $f
return
}
if {$order == " "} {
set count 0
} else {
set count 23
}
}
}
close $f
}
These Tcl interpreter source files have been adapted for ChorusOS:
tcl.h
tclExpr.c
tclGlob.c
tclInt.h
tclMain.c
tclPort.h
tclUnixAZ.c
tclUnixUtil.c
Modifications to the original sources are under #ifdef CLASSIX .
These files have been added:
clxStubs.c
Imakefile
tclPort.h
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|---|---|
| Interface Stability | Evolving |
Tcl and the Tk Toolkit , by John Ousterhout, Addison-Wesley, 1994, ISBN 0-201-63337-X.
Practical Programming in Tcl and Tk , by Brent Welch, Prentice-Hall, 1995, ISBN 0-13-182007-9.
This release of ChorusOS supports Tcl 7.4.
NAME | SYNOPSIS | DESCRIPTION | EXAMPLES | FILES | ATTRIBUTES | SEE ALSO | NOTES