# HG changeset patch # User yiyus@1936 # Date 1259091090 -3600 # Node ID ddcf4bca3fd680f67b3e4c850a668fda446b320e # Parent fb4dee2a5872ca812ff02d3f61191555d624bbf0 Capitalized diff -r fb4dee2a5872 -r ddcf4bca3fd6 bf.go --- a/bf.go Mon Nov 23 19:22:31 2009 +0100 +++ b/bf.go Tue Nov 24 20:31:30 2009 +0100 @@ -28,8 +28,8 @@ // BrainFuckVM represents the input and output of the virtual machine type BrainFuckVM struct { - in chan byte; - out chan byte; + In chan byte; + Out chan byte; } func (bf BrainFuckVM) core(prog []byte, size int) { @@ -50,10 +50,10 @@ case '-': a[p]-- case '.': - bf.out <- a[p] + bf.Out<- a[p] case ',': // test/turing.go cannot do this! - a[p] = <-bf.in + a[p] = <-bf.In case '[': if a[p] == 0 { for nest := 1; nest > 0; pc++ { @@ -89,8 +89,8 @@ // access to its I/O ports func BrainFucker(prog []byte, size int) *BrainFuckVM { bf := new(BrainFuckVM); - bf.in = make(chan byte); - bf.out = make(chan byte); + bf.In = make(chan byte); + bf.Out= make(chan byte); go bf.core(prog, size); return bf; } diff -r fb4dee2a5872 -r ddcf4bca3fd6 bf_test.go --- a/bf_test.go Mon Nov 23 19:22:31 2009 +0100 +++ b/bf_test.go Tue Nov 24 20:31:30 2009 +0100 @@ -17,7 +17,7 @@ >.+++.------.--------.>+.>.!"); bf := BrainFucker(prog, 30000); for { - b, ok := <-bf.out; + b, ok := <-bf.Out; if !ok { return; } @@ -31,15 +31,15 @@ bi := "43"; i := 0; for { - b, oki := <-bf.out; + oki := i