diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /appl/cmd/tclsh.b | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'appl/cmd/tclsh.b')
| -rw-r--r-- | appl/cmd/tclsh.b | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/appl/cmd/tclsh.b b/appl/cmd/tclsh.b new file mode 100644 index 00000000..9a2664a9 --- /dev/null +++ b/appl/cmd/tclsh.b @@ -0,0 +1,48 @@ +implement Tclsh; + +include "sys.m"; + sys: Sys; + +include "draw.m"; + +include "bufio.m"; + bufmod : Bufio; +Iobuf : import bufmod; + +include "tk.m"; + +include "../lib/tcl.m"; + tcl : Tcl_Core; + +Tclsh: module { + init: fn(ctxt: ref Draw->Context, argv: list of string); +}; + +init(ctxt: ref Draw->Context, argv : list of string){ + sys=load Sys Sys->PATH; + tcl=load Tcl_Core Tcl_Core->PATH; + if (tcl==nil){ + sys->print("Cannot load Tcl (%r)\n"); + exit; + } + bufmod=load Bufio Bufio->PATH; + if (bufmod==nil){ + sys->print("Cannot load Bufio (%r)\n"); + exit; + } + lines:=chan of string; + tcl->init(ctxt,argv); + new_inp := "tcl%"; + spawn tcl->grab_lines(nil,nil,lines); + for(;;){ + alt{ + line := <-lines => + line = tcl->prepass(line); + msg:= tcl->evalcmd(line,0); + if (msg!=nil) + sys->print("%s\n",msg); + sys->print("%s ", new_inp); + tcl->clear_error(); + } + } +} |
