func RunTclRepl(in io.Reader, out io.Writer) { i := gotcl.NewInterp() setArgs(i, flag.Args(), true) RunRepl(in, out, func(ln string) (string, error) { res, e := i.EvalString(ln) i.ClearError() if e != nil { return "", e } return res.AsString(), e }) }
func main() { flag.Parse() if *nogc { runtime.MemStats.EnableGC = false println("GC disabled.") } args := flag.Args() if len(args) == 1 { filename := args[0] file, e := os.Open(filename) if e != nil { panic(e.Error()) } defer file.Close() i := gotcl.NewInterp() setArgs(i, args, false) _, err := i.Run(file) if err != nil { fmt.Println("Error: " + err.Error()) } } else { RunTclRepl(os.Stdin, os.Stdout) } }
func main() { gotcl.NewInterp().EvalString(code) }