Пример #1
0
func main() {
	input, inerr := lib.ReadSimPkt(os.Stdin)
	if inerr != nil {
		fatal(inerr)
	}

	extensions := ext.StdExtensions()
	outch, simerr := lib.Simulate(input, extensions)

	if simerr != nil {
		fatal(simerr)
	}

	for out := range outch {
		werr := lib.WriteSimPkt(out, os.Stdout)
		if werr != nil {
			break
		}
	}
}
Пример #2
0
func runFrameTunnel(fact animate.RenderFactory) <-chan chan animate.Frame {
	outch := make(chan chan animate.Frame)
	go func() {
		scanner := bufio.NewScanner(os.Stdin)
		for scanner.Scan() {
			r := strings.NewReader(scanner.Text())
			pkt, perr := core.ReadSimPkt(r)
			if perr != nil {
				fatal(perr)
			}
			frch := make(chan animate.Frame)
			go func() {
				render(frch, fact, pkt)
			}()
			outch <- frch
		}
		close(outch)
	}()
	return outch
}