Esempio n. 1
0
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
	})
}
Esempio n. 2
0
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)
	}
}
Esempio n. 3
0
func main() {
	gotcl.NewInterp().EvalString(code)
}