]> Cypherpunks repositories - gostls13.git/commitdiff
convert tests; nothing interesting.
authorRuss Cox <rsc@golang.org>
Sat, 17 Jan 2009 00:12:14 +0000 (16:12 -0800)
committerRuss Cox <rsc@golang.org>
Sat, 17 Jan 2009 00:12:14 +0000 (16:12 -0800)
R=r
OCL=23012
CL=23014

82 files changed:
src/lib/malloc.go
test/235.go
test/bigalg.go
test/bugs/bug041.go
test/bugs/bug117.go
test/bugs/bug121.go
test/bugs/bug123.go
test/bugs/bug130.go
test/chan/fifo.go
test/chan/powser1.go
test/chan/powser2.go
test/chan/select.go
test/chan/sieve.go
test/complit.go
test/convlit1.go
test/export.go
test/fixedbugs/bug007.go
test/fixedbugs/bug011.go
test/fixedbugs/bug023.go
test/fixedbugs/bug025.go
test/fixedbugs/bug026.go
test/fixedbugs/bug027.go
test/fixedbugs/bug028.go
test/fixedbugs/bug044.go
test/fixedbugs/bug045.go
test/fixedbugs/bug046.go
test/fixedbugs/bug054.go
test/fixedbugs/bug057.go
test/fixedbugs/bug058.go
test/fixedbugs/bug059.go
test/fixedbugs/bug066.go
test/fixedbugs/bug075.go
test/fixedbugs/bug083.dir/bug0.go
test/fixedbugs/bug084.go
test/fixedbugs/bug088.dir/bug0.go
test/fixedbugs/bug088.dir/bug1.go
test/fixedbugs/bug089.go
test/fixedbugs/bug093.go
test/fixedbugs/bug096.go
test/fixedbugs/bug097.go
test/fixedbugs/bug098.go
test/fixedbugs/bug099.go
test/fixedbugs/bug110.go
test/fixedbugs/bug112.go
test/fixedbugs/bug113.go
test/fixedbugs/bug114.go
test/fixedbugs/bug120.go
test/func.go
test/golden.out
test/hashmap.go
test/hilbert.go
test/interface.go
test/interface1.go
test/interface2.go
test/interface3.go
test/interface4.go
test/interface5.go
test/interface6.go
test/iota.go
test/ken/array.go
test/ken/chan.go
test/ken/embed.go
test/ken/interbasic.go
test/ken/interfun.go
test/ken/intervar.go
test/ken/ptrfun.go
test/ken/rob1.go
test/ken/rob2.go
test/ken/robfunc.go
test/mallocrand.go
test/mallocrep.go
test/mallocrep1.go
test/map.go
test/method.go
test/method1.go
test/method2.go
test/method3.go
test/nil.go
test/peano.go
test/sieve.go
test/test0.go
test/vectors.go

index 3b81b4ed02898a5d858e688dde65dc5a898d05d4..3d3f420d055f726e86b1a3563bb1ce0039914d55 100644 (file)
@@ -9,8 +9,8 @@
 package malloc
 
 export type Stats struct {
-       alloc   uint64;
-       sys     uint64;
+       Alloc   uint64;
+       Sys     uint64;
 };
 
 export func Alloc(uint64) *byte;
index e24106dd00cca538d72fc677bd0055565d6d6b56..b0381f35bcd412b263b2b0b666c6a9e7c277641e 100644 (file)
@@ -6,9 +6,9 @@
 
 package main
 
-type T chan uint64;
+export type T chan uint64;
 
-func M(f uint64) (in, out T) {
+export func M(f uint64) (in, out T) {
        in = make(T, 100);
        out = make(T, 100);
        go func(in, out T, f uint64) {
index 434eecf5d26fde11411d17fb896e59ed41caa503..a77a9ec8d1afcb6f14936b0a0f1e4c30f6568290 100644 (file)
@@ -11,7 +11,7 @@ import (
        "fmt";
 )
 
-type T struct {
+export type T struct {
        a float64;
        b int64;
        c string;
@@ -19,7 +19,7 @@ type T struct {
 }
 
 var a = []int{ 1, 2, 3 }
-var NIL []int;
+export var NIL []int;
 
 func arraycmptest() {
        a1 := a;
@@ -34,7 +34,7 @@ func arraycmptest() {
        }
 }
 
-func SameArray(a, b []int) bool {
+export func SameArray(a, b []int) bool {
        if len(a) != len(b) || cap(a) != cap(b) {
                return false;
        }
@@ -103,7 +103,7 @@ func chantest() {
        }
 }
 
-type E struct { }
+export type E struct { }
 var e E
 
 func interfacetest() {
index f5656666913c8cfbe423b92cfbacc6eca9f1f973..da708ab980cf603068bfee8f34bbc47363145757 100644 (file)
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// $G $D/$F.go && echo BUG: compilation succeeds incorrectly
+// ! $G $D/$F.go || echo BUG: compilation succeeds incorrectly
 
 package main
 
-type T struct
-type S struct {
-  p *T  // BUG T never declared
+type t struct
+type s struct {
+  p *t  // BUG t never declared
 }
 
 func main() {
-  var s S;
+  var s1 s;
 }
index a18e68849aa63f13f51c8ae525cc5da11e9259a2..2707350cc6b619cf97b72e05fe67a0927a53bce0 100644 (file)
@@ -5,8 +5,8 @@
 // license that can be found in the LICENSE file.
 
 package main
-type S struct { a int }
-type PS *S
+export type S struct { a int }
+export type PS *S
 func (p *S) get() int {
   return p.a
 }
index cc960e318c35a2f91e73f76ead2ec7a7fcb60e8e..815faeffd6a17c618bc54002f876aa616fc85ad4 100644 (file)
@@ -6,14 +6,14 @@
 
 package main
 
-type T ()
+export type T ()
 
-type I interface {
+export type I interface {
        f, g ();
        h T;  // should only allow FunctionType here
 }
 
-type S struct {
+export type S struct {
 }
 
 func (s *S) f() {}
index 0576de37d6cf7fc41919d6c6615ab7dbee5e7a38..c3b8ff51cdb6f5e523e036dbce9409c4e74f8dc5 100644 (file)
@@ -5,7 +5,7 @@
 // license that can be found in the LICENSE file.
 
 package main
-const ( F = 1 )
+export const ( F = 1 )
 func fn(i int) int {
   if i == F() {                // ERROR "function"
     return 0
index aa3f0dd70e2c9d4f479e0351095200f14223c024..1bcf05a9d4a2ddb69d85cacdd8da1991a0ead831 100644 (file)
@@ -6,9 +6,9 @@
 
 package main
 
-type I interface { send(chan <- int) }
+export type I interface { send(chan <- int) }
 
-type S struct { v int }
+export type S struct { v int }
 func (p *S) send(c chan <- int) { c <- p.v }
 
 func main() {
index ad53ab6558c77626c526e169732d438edd8543b8..5df491845321051bf3100acf40300e32a20864b6 100644 (file)
@@ -8,9 +8,9 @@
 
 package main
 
-const N = 10
+export const N = 10
 
-func AsynchFifo() {
+export func AsynchFifo() {
        ch := make(chan int, N);
        for i := 0; i < N; i++ {
                ch <- i
@@ -23,7 +23,7 @@ func AsynchFifo() {
        }
 }
 
-func Chain(ch <-chan int, val int, in <-chan int, out chan<- int) {
+export func Chain(ch <-chan int, val int, in <-chan int, out chan<- int) {
        <-in;
        if <-ch != val {
                panic(val)
@@ -32,7 +32,7 @@ func Chain(ch <-chan int, val int, in <-chan int, out chan<- int) {
 }
 
 // thread together a daisy chain to read the elements in sequence
-func SynchFifo() {
+export func SynchFifo() {
        ch := make(chan int);
        in := make(chan int);
        start := in;
index 3b638916968ddded643cd6153f40c5b3495952a4..6326fb241aca5634b9bdb159ee5cef974cda7057 100644 (file)
@@ -41,7 +41,7 @@ var chnames string
 var chnameserial int
 var seqno int
 
-func Init();
+export func Init();
 
 func mkdch() *dch {
        c := chnameserial % len(chnames);
@@ -176,11 +176,11 @@ func repeat(dat item, out *dch){
        }
 }
 
-type PS *dch;  // power series
-type PS2 *[2] PS; // pair of power series
+export type PS *dch;   // power series
+export type PS2 *[2] PS; // pair of power series
 
-var Ones PS
-var Twos PS
+export var Ones PS
+export var Twos PS
 
 func mkPS() *dch {
        return mkdch()
@@ -266,8 +266,7 @@ func inv(u *rat) *rat{      // invert a rat
 }
 
 // print eval in floating point of PS at x=c to n terms
-func
-Evaln(c *rat, U PS, n int)
+export func Evaln(c *rat, U PS, n int)
 {
        xn := float64(1);
        x := float64(c.num)/float64(c.den);
@@ -284,7 +283,7 @@ Evaln(c *rat, U PS, n int)
 }
 
 // Print n terms of a power series
-func Printn(U PS, n int){
+export func Printn(U PS, n int){
        done := false;
        for ; !done && n>0; n-- {
                u := get(U);
@@ -294,7 +293,7 @@ func Printn(U PS, n int){
        print(("\n"));
 }
 
-func Print(U PS){
+export func Print(U PS){
        Printn(U,1000000000);
 }
 
@@ -312,14 +311,14 @@ func eval(c *rat, U PS, n int) *rat{
 
 // Make a pair of power series identical to a given power series
 
-func Split(U PS) *dch2{
+export func Split(U PS) *dch2{
        UU := mkdch2();
        go split(U,UU);
        return UU;
 }
 
 // Add two power series
-func Add(U, V PS) PS{
+export func Add(U, V PS) PS{
        Z := mkPS();
        go func(U, V, Z PS){
                var uv [] *rat;
@@ -344,7 +343,7 @@ func Add(U, V PS) PS{
 }
 
 // Multiply a power series by a constant
-func Cmul(c *rat,U PS) PS{
+export func Cmul(c *rat,U PS) PS{
        Z := mkPS();
        go func(c *rat, U, Z PS){
                done := false;
@@ -361,13 +360,13 @@ func Cmul(c *rat,U PS) PS{
 
 // Subtract
 
-func Sub(U, V PS) PS{
+export func Sub(U, V PS) PS{
        return Add(U, Cmul(neg(one), V));
 }
 
 // Multiply a power series by the monomial x^n
 
-func Monmul(U PS, n int) PS{
+export func Monmul(U PS, n int) PS{
        Z := mkPS();
        go func(n int, U PS, Z PS){
                for ; n>0; n-- { put(zero,Z) }
@@ -378,11 +377,11 @@ func Monmul(U PS, n int) PS{
 
 // Multiply by x
 
-func Xmul(U PS) PS{
+export func Xmul(U PS) PS{
        return Monmul(U,1);
 }
 
-func Rep(c *rat) PS{
+export func Rep(c *rat) PS{
        Z := mkPS();
        go repeat(c,Z);
        return Z;
@@ -390,7 +389,7 @@ func Rep(c *rat) PS{
 
 // Monomial c*x^n
 
-func Mon(c *rat, n int) PS{
+export func Mon(c *rat, n int) PS{
        Z:=mkPS();
        go func(c *rat, n int, Z PS){
                if(c.num!=0) {
@@ -402,7 +401,7 @@ func Mon(c *rat, n int) PS{
        return Z;
 }
 
-func Shift(c *rat, U PS) PS{
+export func Shift(c *rat, U PS) PS{
        Z := mkPS();
        go func(c *rat, U, Z PS){
                put(c,Z);
@@ -417,7 +416,7 @@ func Shift(c *rat, U PS) PS{
 // to a (finite) power series
 
 /* BUG: NEED LEN OF ARRAY
-func Poly(a [] *rat) PS{
+export func Poly(a [] *rat) PS{
        Z:=mkPS();
        begin func(a [] *rat, Z PS){
                j:=0;
@@ -437,7 +436,7 @@ func Poly(a [] *rat) PS{
 //     let V = v + x*VV
 //     then UV = u*v + x*(u*VV+v*UU) + x*x*UU*VV
 
-func Mul(U, V PS) PS{
+export func Mul(U, V PS) PS{
        Z:=mkPS();
        go func(U, V, Z PS){
                <-Z.req;
@@ -459,7 +458,7 @@ func Mul(U, V PS) PS{
 
 // Differentiate
 
-func Diff(U PS) PS{
+export func Diff(U PS) PS{
        Z:=mkPS();
        go func(U, Z PS){
                <-Z.req;
@@ -481,7 +480,7 @@ func Diff(U PS) PS{
 }
 
 // Integrate, with const of integration
-func Integ(c *rat,U PS) PS{
+export func Integ(c *rat,U PS) PS{
        Z:=mkPS();
        go func(c *rat, U, Z PS){
                put(c,Z);
@@ -499,7 +498,7 @@ func Integ(c *rat,U PS) PS{
 
 // Binomial theorem (1+x)^c
 
-func Binom(c *rat) PS{
+export func Binom(c *rat) PS{
        Z:=mkPS();
        go func(c *rat, Z PS){
                n := 1;
@@ -523,7 +522,7 @@ func Binom(c *rat) PS{
 //     u*ZZ + z*UU +x*UU*ZZ = 0
 //     ZZ = -UU*(z+x*ZZ)/u;
 
-func Recip(U PS) PS{
+export func Recip(U PS) PS{
        Z:=mkPS();
        go func(U, Z PS){
                ZZ:=mkPS2();
@@ -543,7 +542,7 @@ func Recip(U PS) PS{
 //     DZ = Z*DU
 //     integrate to get Z
 
-func Exp(U PS) PS{
+export func Exp(U PS) PS{
        ZZ := mkPS2();
        split(Integ(one,Mul(ZZ[0],Diff(U))),ZZ);
        return ZZ[1];
@@ -555,7 +554,7 @@ func Exp(U PS) PS{
 //     then S(U,V) = u + VV*S(V,UU)
 // bug: a nonzero constant term is ignored
 
-func Subst(U, V PS) PS {
+export func Subst(U, V PS) PS {
        Z:= mkPS();
        go func(U, V, Z PS) {
                VV := Split(V);
@@ -573,7 +572,7 @@ func Subst(U, V PS) PS {
 // Monomial Substition: U(c x^n)
 // Each Ui is multiplied by c^i and followed by n-1 zeros
 
-func MonSubst(U PS, c0 *rat, n int) PS {
+export func MonSubst(U PS, c0 *rat, n int) PS {
        Z:= mkPS();
        go func(U, Z PS, c0 *rat, n int) {
                c := one;
@@ -596,7 +595,7 @@ func MonSubst(U PS, c0 *rat, n int) PS {
 }
 
 
-func Init() {
+export func Init() {
        chnameserial = -1;
        seqno = 0;
        chnames = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -621,7 +620,7 @@ func check(U PS, c *rat, count int, str string) {
        }
 }
 
-const N=10
+export const N=10
 func checka(U PS, a []*rat, str string) {
        for i := 0; i < N; i++ {
                check(U, a[i], 1, str);
index 094bd2bfe0d9d9d99912bab515933dfdc3e9f55d..0867025191d800e393a5f7f1e79160c798ebeca4 100644 (file)
@@ -46,7 +46,7 @@ var chnames string
 var chnameserial int
 var seqno int
 
-func Init();
+export func Init();
 
 func mkdch() *dch {
        c := chnameserial % len(chnames);
@@ -181,11 +181,11 @@ func repeat(dat item, out *dch){
        }
 }
 
-type PS *dch;  // power series
-type PS2 *[2] PS; // pair of power series
+export type PS *dch;   // power series
+export type PS2 *[2] PS; // pair of power series
 
-var Ones PS
-var Twos PS
+export var Ones PS
+export var Twos PS
 
 func mkPS() *dch {
        return mkdch()
@@ -271,8 +271,7 @@ func inv(u *rat) *rat{      // invert a rat
 }
 
 // print eval in floating point of PS at x=c to n terms
-func
-Evaln(c *rat, U PS, n int)
+export func Evaln(c *rat, U PS, n int)
 {
        xn := float64(1);
        x := float64(c.num)/float64(c.den);
@@ -289,7 +288,7 @@ Evaln(c *rat, U PS, n int)
 }
 
 // Print n terms of a power series
-func Printn(U PS, n int){
+export func Printn(U PS, n int){
        done := false;
        for ; !done && n>0; n-- {
                u := get(U);
@@ -299,7 +298,7 @@ func Printn(U PS, n int){
        print(("\n"));
 }
 
-func Print(U PS){
+export func Print(U PS){
        Printn(U,1000000000);
 }
 
@@ -317,14 +316,14 @@ func eval(c *rat, U PS, n int) *rat{
 
 // Make a pair of power series identical to a given power series
 
-func Split(U PS) *dch2{
+export func Split(U PS) *dch2{
        UU := mkdch2();
        go split(U,UU);
        return UU;
 }
 
 // Add two power series
-func Add(U, V PS) PS{
+export func Add(U, V PS) PS{
        Z := mkPS();
        go func(U, V, Z PS){
                var uv [] item;
@@ -349,7 +348,7 @@ func Add(U, V PS) PS{
 }
 
 // Multiply a power series by a constant
-func Cmul(c *rat,U PS) PS{
+export func Cmul(c *rat,U PS) PS{
        Z := mkPS();
        go func(c *rat, U, Z PS){
                done := false;
@@ -366,13 +365,13 @@ func Cmul(c *rat,U PS) PS{
 
 // Subtract
 
-func Sub(U, V PS) PS{
+export func Sub(U, V PS) PS{
        return Add(U, Cmul(neg(one), V));
 }
 
 // Multiply a power series by the monomial x^n
 
-func Monmul(U PS, n int) PS{
+export func Monmul(U PS, n int) PS{
        Z := mkPS();
        go func(n int, U PS, Z PS){
                for ; n>0; n-- { put(zero,Z) }
@@ -383,11 +382,11 @@ func Monmul(U PS, n int) PS{
 
 // Multiply by x
 
-func Xmul(U PS) PS{
+export func Xmul(U PS) PS{
        return Monmul(U,1);
 }
 
-func Rep(c *rat) PS{
+export func Rep(c *rat) PS{
        Z := mkPS();
        go repeat(c,Z);
        return Z;
@@ -395,7 +394,7 @@ func Rep(c *rat) PS{
 
 // Monomial c*x^n
 
-func Mon(c *rat, n int) PS{
+export func Mon(c *rat, n int) PS{
        Z:=mkPS();
        go func(c *rat, n int, Z PS){
                if(c.num!=0) {
@@ -407,7 +406,7 @@ func Mon(c *rat, n int) PS{
        return Z;
 }
 
-func Shift(c *rat, U PS) PS{
+export func Shift(c *rat, U PS) PS{
        Z := mkPS();
        go func(c *rat, U, Z PS){
                put(c,Z);
@@ -422,7 +421,7 @@ func Shift(c *rat, U PS) PS{
 // to a (finite) power series
 
 /* BUG: NEED LEN OF ARRAY
-func Poly(a [] *rat) PS{
+export func Poly(a [] *rat) PS{
        Z:=mkPS();
        begin func(a [] *rat, Z PS){
                j:=0;
@@ -442,7 +441,7 @@ func Poly(a [] *rat) PS{
 //     let V = v + x*VV
 //     then UV = u*v + x*(u*VV+v*UU) + x*x*UU*VV
 
-func Mul(U, V PS) PS{
+export func Mul(U, V PS) PS{
        Z:=mkPS();
        go func(U, V, Z PS){
                <-Z.req;
@@ -464,7 +463,7 @@ func Mul(U, V PS) PS{
 
 // Differentiate
 
-func Diff(U PS) PS{
+export func Diff(U PS) PS{
        Z:=mkPS();
        go func(U, Z PS){
                <-Z.req;
@@ -486,7 +485,7 @@ func Diff(U PS) PS{
 }
 
 // Integrate, with const of integration
-func Integ(c *rat,U PS) PS{
+export func Integ(c *rat,U PS) PS{
        Z:=mkPS();
        go func(c *rat, U, Z PS){
                put(c,Z);
@@ -504,7 +503,7 @@ func Integ(c *rat,U PS) PS{
 
 // Binomial theorem (1+x)^c
 
-func Binom(c *rat) PS{
+export func Binom(c *rat) PS{
        Z:=mkPS();
        go func(c *rat, Z PS){
                n := 1;
@@ -528,7 +527,7 @@ func Binom(c *rat) PS{
 //     u*ZZ + z*UU +x*UU*ZZ = 0
 //     ZZ = -UU*(z+x*ZZ)/u;
 
-func Recip(U PS) PS{
+export func Recip(U PS) PS{
        Z:=mkPS();
        go func(U, Z PS){
                ZZ:=mkPS2();
@@ -548,7 +547,7 @@ func Recip(U PS) PS{
 //     DZ = Z*DU
 //     integrate to get Z
 
-func Exp(U PS) PS{
+export func Exp(U PS) PS{
        ZZ := mkPS2();
        split(Integ(one,Mul(ZZ[0],Diff(U))),ZZ);
        return ZZ[1];
@@ -560,7 +559,7 @@ func Exp(U PS) PS{
 //     then S(U,V) = u + VV*S(V,UU)
 // bug: a nonzero constant term is ignored
 
-func Subst(U, V PS) PS {
+export func Subst(U, V PS) PS {
        Z:= mkPS();
        go func(U, V, Z PS) {
                VV := Split(V);
@@ -578,7 +577,7 @@ func Subst(U, V PS) PS {
 // Monomial Substition: U(c x^n)
 // Each Ui is multiplied by c^i and followed by n-1 zeros
 
-func MonSubst(U PS, c0 *rat, n int) PS {
+export func MonSubst(U PS, c0 *rat, n int) PS {
        Z:= mkPS();
        go func(U, Z PS, c0 *rat, n int) {
                c := one;
@@ -601,7 +600,7 @@ func MonSubst(U PS, c0 *rat, n int) PS {
 }
 
 
-func Init() {
+export func Init() {
        chnameserial = -1;
        seqno = 0;
        chnames = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -626,7 +625,7 @@ func check(U PS, c *rat, count int, str string) {
        }
 }
 
-const N=10
+export const N=10
 func checka(U PS, a []*rat, str string) {
        for i := 0; i < N; i++ {
                check(U, a[i], 1, str);
index d8a462551acd117a50adc42379bd4f591dce0a6e..009ee35c727138dd70f57787f35129b52f9b3294 100644 (file)
@@ -9,12 +9,12 @@ package main
 var counter uint
 var shift uint
 
-func GetValue() uint {
+export func GetValue() uint {
   counter++;
   return 1 << shift
 }
 
-func Send(a, b chan uint) int {
+export func Send(a, b chan uint) int {
   var i int;
   LOOP:
     for {
index 0cebdc6412b7b4a11bb936917423ed9f712ef643..b5330e7f8648c8ff56ab15ad02ceacfc03fa7d2b 100644 (file)
@@ -10,7 +10,7 @@
 package main
 
 // Send the sequence 2, 3, 4, ... to channel 'ch'.
-func Generate(ch chan<- int) {
+export func Generate(ch chan<- int) {
        for i := 2; ; i++ {
                ch <- i  // Send 'i' to channel 'ch'.
        }
@@ -18,7 +18,7 @@ func Generate(ch chan<- int) {
 
 // Copy the values from channel 'in' to channel 'out',
 // removing those divisible by 'prime'.
-func Filter(in <-chan int, out chan<- int, prime int) {
+export func Filter(in <-chan int, out chan<- int, prime int) {
        for {
                i := <-in;  // Receive value of new variable 'i' from 'in'.
                if i % prime != 0 {
@@ -28,7 +28,7 @@ func Filter(in <-chan int, out chan<- int, prime int) {
 }
 
 // The prime sieve: Daisy-chain Filter processes together.
-func Sieve(primes chan<- int) {
+export func Sieve(primes chan<- int) {
        ch := make(chan int);  // Create a new channel.
        go Generate(ch);  // Start Generate() as a subprocess.
        for {
index d9b94885195cfa1c5901b2272202e1827a2d0a53..55159be855b84e962b8856463f03ac9f5e875731 100644 (file)
@@ -6,9 +6,9 @@
 
 package main
 
-type T struct { i int; f float; s string; next *T }
+export type T struct { i int; f float; s string; next *T }
 
-type R struct { num int }
+export type R struct { num int }
 
 func itor(a int) *R {
        r := new(R);
@@ -22,8 +22,8 @@ func eq(a []*R) {
        }
 }
 
-type P struct { a, b int };
-func NewP(a, b int) *P {
+export type P struct { a, b int };
+export func NewP(a, b int) *P {
        return &P{a, b}
 }
 
index 063a1e504dfd39bd6dd6df3bd45e145a1eb1ad35..94d28969b793c0b0f51bddc244faf99671971305 100644 (file)
@@ -10,6 +10,8 @@ var a = []int { "a" };        // ERROR "conver|incompatible"
 var b = int { 1 };     // ERROR "compos"
 
 
+func f() int
+
 func main() {
-       if sys.argc < 1 { }     // ERROR "conver|incompatible"
+       if f < 1 { }    // ERROR "conver|incompatible"
 }
index 7ac04244210eeb309c4dab184d6690aab7181d2c..b1f033a160ebbe33179f9888a107eb3dc26307df 100644 (file)
@@ -12,5 +12,5 @@ export type B interface       // ERROR "incomplete"
 export type C struct
 export type D interface
 
-type C struct { }
-type D interface { }
+export type C struct { }
+export type D interface { }
index bd970de5f92a08720ca11285e187f39166bd0e62..992276c6789315fa4f4659fe86f3d7f58dd21350 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type (
+export type (
        Point struct { x, y float };
        Polar Point
 )
index 63673c0865ddca8e80229c3cb1eaac6dd3c150be..aaa920a6bb8df5c9e3e16c9236bd427883c00872 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 
-type T struct {
+export type T struct {
        x, y int;
 }
 
index cce8c4543ebc40c1ae380e731f237ef03982c454..6a189b4701ff26e3126be3962c34426285be93ad 100644 (file)
@@ -6,11 +6,11 @@
 
 package main
 
-type Type interface {
+export type Type interface {
        TypeName() string;
 }
 
-type TInt struct {
+export type TInt struct {
 }
 
 // TInt
index f8aa68d5dd752f37ff59be42bb98f7a6448ef5e9..4d4e954bf357455aed1c00a392304bcaec64980d 100644 (file)
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// ! $G $D/$F.go
+// ! $G $D/$F.go
 
 package main
 
-export Foo
+export foo
 
 func main() {}
 
index 1d97c18ae571ed7e42538ed876ad1fc04ceac30b..d64d0627ebee6818eb1dcc5b748eba5c41dc0ad0 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type Element interface {
+export type Element interface {
 }
 
 export type Vector struct {
index 16300502b88e3a3430164d371059ce16a03a2005..9de26af2fac242c64f5d5214983d3282c52c0bd7 100644 (file)
@@ -6,15 +6,15 @@
 
 package main
 
-type Element interface {
+export type Element interface {
 }
 
-type Vector struct {
+export type Vector struct {
        nelem int;
        elem []Element;
 }
 
-func New() *Vector {
+export func New() *Vector {
        v := new(Vector);
        v.nelem = 0;
        v.elem = make([]Element, 10);
index 0488ad2cba8d3e46f9f5a5840ad4d1f2d947e572..4990ac286697f718ed5871f6c486dd635eef52d8 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 
-func Alloc(i int) int {
+export func Alloc(i int) int {
        switch i {
        default:
                return 5;
index 789237abe6574349cab4955bd0190df34be712a7..52ee0330845c0aadb18be60133ad3550d8d7d64f 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type S struct {
+export type S struct {
 };
 
 func (p *S) M1a() ;
index 88c005d32da67d1f6e5c3d11a662812d76e18c62..b4ae6de0a5381ea68f5735cedb1183caf20c26b2 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type T struct {
+export type T struct {
        i int
 }
 
index 8a9b797074d6f831d39f40b3b6b071ac70d626af..bd3a1e2f90b026d7e228f8aec5e0f051d4985664 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type T *struct {}
+export type T *struct {}
 
 func (x T) M () {}  // ERROR "pointer|receiver"
 
index 0ed5d07082f6d78b601e657b612bf9b1bfce361a..35cfc9204da4ed9c7040c422725d4e6f38092116 100644 (file)
@@ -6,10 +6,10 @@
 
 package main
 
-type Element interface {
+export type Element interface {
 }
 
-type Vector struct {
+export type Vector struct {
        elem []Element;
 }
 
@@ -17,7 +17,7 @@ func (v *Vector) At(i int) Element {
        return v.elem[i];
 }
 
-type TStruct struct {
+export type TStruct struct {
        name string;
        fields *Vector;
 }
index dd6df5c315c154a6614d0fed21dee878b8c46163..e0a60dc377c5bee16c0fb17c3e911cd94d8d334c 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type T struct {
+export type T struct {
   s string;
 }
 
index da47ae568701090dd7ed16d10b63fedcbd89a02e..3765dfc35cd4d1f59bd27668d8259dc19a16f75a 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type Box struct {};
+export type Box struct {};
 var m map[string] *Box;
 
 func main() {
index 21c078361bb75ae4c7f424071ff01e429d495ce3..d1f3b13b25971e598c6f416569001718fe9822cd 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-func P(a []string) string {
+export func P(a []string) string {
        s := "{";
        for i := 0; i < 2; i++ {
                if i > 0 {
index 4f64152aec01e29ec5b4d627dd0f51fe1b20e9d2..ce021af3f1825435d9a541eee094180405b4fba5 100644 (file)
@@ -6,26 +6,26 @@
 
 package main
 
-type (
+export type (
        Type struct;
        Object struct;
 )
 
-type Scope struct {
+export type Scope struct {
        entries map[string] *Object;
 }
 
 
-type Type struct {
+export type Type struct {
        scope *Scope;
 }
 
 
-type Object struct {
+export type Object struct {
        typ *Type;
 }
 
 
-func Lookup(scope *Scope) *Object {
+export func Lookup(scope *Scope) *Object {
        return scope.entries["foo"];
 }
index fceeef8cba5f48b89d50b870f34471409021c061..76b5189343596fd73f3cfcf0a09b2cc7d79c156f 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type T struct { m map[int]int }
+export type T struct { m map[int]int }
 func main() {
        t := new(T);
        t.m = make(map[int]int);
index 3636a7aa358f9d71cb9f867b43d3b4f57bdf40f1..58c4c49717c93b5b8f9b220f294a9fe68e07b07f 100644 (file)
@@ -4,8 +4,7 @@
 
 package bug0
 
-type T0 struct {
+export type T0 struct {
 }
 
-export v0
-var v0 T0
+export var V0 T0
index 2897593dcd1a69b6ab33f5a43726682807565f9a..23e5e00ca381b10558df3a0d225342e6eed7b41e 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type Service struct {
+export type Service struct {
        rpc [2]int;
 }
 
index 0336e78150c335c8d411c8b7028be7b8ff8f148a..3536e81cb7af59e98d8a4e437bb6a8cadc65f23d 100644 (file)
@@ -4,6 +4,6 @@
 
 package bug0
 
-export var v0 *() int;
-export var v1 *() (a int);
-export var v2 *() (a, b int);
+export var V0 *() int;
+export var V1 *() (a int);
+export var V2 *() (a, b int);
index 7b78ad2459b82a1c88adcab0ae1f1bf4764f51a9..7c21c25dea17bf92cbac1e8cc318fd8b554f5957 100644 (file)
@@ -7,9 +7,9 @@ package main
 import P "bug0"
 
 func main() {
-       a0 := P.v0();  // works
-       a1 := P.v1();  // works
-       a2, b2 := P.v2();  // doesn't work
+       a0 := P.V0();  // works
+       a1 := P.V1();  // works
+       a2, b2 := P.V2();  // doesn't work
 }
 
 /*
index 296e9e6d6d45888d24cce16b7d74c1bc7c975aae..55d4dfba700825de9fa8261e86cb536538e54b04 100644 (file)
@@ -6,8 +6,8 @@
 
 package main
 
-type   I1      interface {}
-type   I2      interface { pr() }
+export type    I1      interface {}
+export type    I2      interface { pr() }
 
 func   e()     I1;
 
index f80eee01fa7fb09815273a44f0a94ab51a1341c7..3adbc5abbb37041cc1ecf906c7cb9bd01323aef7 100644 (file)
@@ -6,14 +6,14 @@
 
 package main
 
-type S struct {
+export type S struct {
 }
 
 func (p *S) M() {
        print("M\n");
 }
 
-type I interface {
+export type I interface {
        M();
 }
 
index f66caa5c0160e2434ce43d37e41794f61678ff46..418f9f27c02d2cc57f33c524bc25df513dcadbac 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type A []int;
+export type A []int;
 
 func main() {
        a := &A{0};
index 70bd6e2b47e0c51913a34dbebdddb1831f59ed35..cd815d766482bfd659b3c8e058b489ea50290688 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type A []int;
+export type A []int;
 
 func main() {
        var a [3]A;
index 8e790a709a1f9acfc9253b964fa04abec1567356..7c20d926be7b70bb87ae38ddbb4ecb81ed2b10ff 100644 (file)
@@ -6,8 +6,8 @@
 
 package main
 
-type A []int;
-type M map[int] int;
+export type A []int;
+export type M map[int] int;
 
 func main() {
        var a *A = &A{0};
index f76f0e873cf8d1f81ca0c175c14815a89e2cd5b7..9bf3525e64d6270bb3d9e51a1adea6161f897825 100644 (file)
@@ -7,22 +7,22 @@
 package main
 
 // Interface
-type I interface { F() int }
+export type I interface { F() int }
 
 // Implements interface
-type S struct { }
+export type S struct { }
 func (s *S) F() int { return 1 }
 
 // Allocates S but returns I
 // Arg is unused but important:
 // if you take it out (and the 0s below)
 // then the bug goes away.
-func NewI(i int) I {
+export func NewI(i int) I {
        return new(S)
 }
 
 // Uses interface method.
-func Use(x I) {
+export func Use(x I) {
        x.F()
 }
 
index 84273b475800c5d1dd22d6b0eff4de408f42739c..b5e5875919e75729109641815fac5c95b57f2b89 100644 (file)
@@ -6,14 +6,14 @@
 
 package main
 
-const A = 0
+const a = 0
 
 func f() {
-       const A = 5
+       const a = 5
 }
 
 func main() {
-       if A != 0 {
-               panic("A=", A)
+       if a != 0 {
+               panic("a=", a)
        }
 }
index 3c932843c7de9c7aaab951676792e4ee052e576c..b8d3357f0d5a51113d20295711bddc3a1fb49c30 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type T struct { s string }
+export type T struct { s string }
 var t = T{"hi"}
 
 func main() {}
index ea75260cf28c3b54a328b126d70c69cd7cba05f1..f2f8ee7b349a699f5f1012fcbb1ffd619b23ac97 100644 (file)
@@ -5,7 +5,7 @@
 // license that can be found in the LICENSE file.
 
 package main
-type I interface { };
+export type I interface { };
 func foo1(i int) int { return i }
 func foo2(i int32) int32 { return i }
 func main() {
index 33330fff8e7de65608aa04dcd1965a62e258aa83..431d7bb2dc3af4bb188da3aeb1580aa8d2179a44 100644 (file)
@@ -6,9 +6,9 @@
 
 package main
 
-const B32 = 1<<32 - 1
-const C32 = (-1) & ((1<<32) - 1)
-const D32 = ^0
+export const B32 = 1<<32 - 1
+export const C32 = (-1) & ((1<<32) - 1)
+export const D32 = ^0
 
 func main() {
        if B32 != 0xFFFFFFFF {
index 10e28034dca052bbc5832c92db029dcbf9bd917d..dae78e91cdcb250205ef65cb73c31d93df896dc1 100644 (file)
@@ -8,7 +8,7 @@ package main
 
 import "strconv";
 
-type Test struct {
+export type Test struct {
        f float64;
        in string;
        out string;
index ee9414ddc407b4e89ae285da0e210e27d1c6a334..3a357f895cb6f69176bdfd9d88da8a055e3dfa10 100644 (file)
@@ -45,7 +45,7 @@ func f8(a int) (x int, y float) {
        return 8, 8.0;
 }
 
-type T struct {
+export type T struct {
        x, y int;
 }
 
index 326327bbc1838287f06260782a76e6ba9d430abe..ac8c788b077f52465c3fec752290f122e4d3145c 100644 (file)
@@ -19,7 +19,7 @@ errchk: ./convlit.go: unmatched error messages:
 hello, world
 
 =========== ./interface2.go
-cannot convert type *main.S·interface2 to interface main.I·interface2: missing method Foo
+cannot convert type *main.S to interface main.I: missing method Foo
 throw: interface conversion
 SIGSEGV: segmentation violation
 Faulting address: 0x0
@@ -27,7 +27,7 @@ pc: xxx
 
 
 =========== ./interface3.go
-cannot convert type *main.S·interface3 to interface main.I2·interface3: missing method Name
+cannot convert type *main.S to interface main.I2: missing method Name
 throw: interface conversion
 SIGSEGV: segmentation violation
 Faulting address: 0x0
@@ -86,7 +86,7 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
 PASS
 
 =========== bugs/bug041.go
-BUG: compilation succeeds incorrectly
+bugs/bug041.go:5: export of incomplete type t
 
 =========== bugs/bug064.go
 bugs/bug064.go:15: illegal types for operand: CALL
@@ -149,9 +149,6 @@ BUG: should not compile
 =========== fixedbugs/bug016.go
 fixedbugs/bug016.go:7: overflow converting constant to uint
 
-=========== fixedbugs/bug025.go
-fixedbugs/bug025.go:7: variable exported but not defined: Foo
-
 =========== fixedbugs/bug027.go
 hi
 0 44444
@@ -232,7 +229,7 @@ fixedbugs/bug074.go:7: x: undefined
 fixedbugs/bug081.go:5: no type x
 
 =========== fixedbugs/bug083.go
-fixedbugs/bug083.dir/bug1.go:5: syntax error near T0
+BUG: succeeds incorrectly
 
 =========== fixedbugs/bug086.go
 fixedbugs/bug086.go:5: function ends without a return statement
@@ -261,7 +258,7 @@ M
 fixedbugs/bug103.go:8: function requires a return type
 
 =========== fixedbugs/bug113.go
-main.I·bug113 is int, not int32
+main.I is int, not int32
 throw: interface conversion
 SIGSEGV: segmentation violation
 Faulting address: 0x0
index 6f70f2b50c60dc5e892c1aac030b87655774d4be..4fe36f339f93dd17f966410c92c5b5ec8f492906 100755 (executable)
@@ -9,7 +9,7 @@ package main
 // ----------------------------------------------------------------------------
 // Helper functions
 
-func ASSERT(p bool) {
+export func ASSERT(p bool) {
        if !p {
                // panic 0;
        }
@@ -19,18 +19,18 @@ func ASSERT(p bool) {
 // ----------------------------------------------------------------------------
 // Implementation of the HashMap
 
-type KeyType interface {
+export type KeyType interface {
        Hash() uint32;
        Match(other *KeyType) bool
 }
 
 
-type ValueType interface {
+export type ValueType interface {
        // empty interface
 }
 
 
-type Entry struct {
+export type Entry struct {
        key *KeyType;
        value *ValueType;
 }
@@ -39,7 +39,7 @@ type Entry struct {
 // Using the Array type below doesn't seem to work
 //type Array array [1024] Entry;
 
-type HashMap struct {
+export type HashMap struct {
        map_ *[1024] Entry;
        log2_capacity_ uint32;
        occupancy_ uint32;
@@ -139,7 +139,7 @@ func (m *HashMap) Resize() {
 // ----------------------------------------------------------------------------
 // Test code
 
-type Number struct {
+export type Number struct {
        x uint32;
 }
 
@@ -156,7 +156,7 @@ func (n *Number) Match(other *KeyType) bool {
 }
 
 
-func MakeNumber (x uint32) *Number {
+export func MakeNumber (x uint32) *Number {
        var n *Number = new(Number);
        n.x = x;
        return n;
index 163313e852246836c413e7181f740fa51a5b3cd5..311ed9b2c4b832a85fd56833878cd89d19e681f2 100644 (file)
@@ -21,13 +21,13 @@ func assert(p bool) {
 }
 
 
-var (
+export var (
        Zero = Big.Rat(0, 1);
        One = Big.Rat(1, 1);
 )
 
 
-type Matrix struct {
+export type Matrix struct {
        n, m int;
        a []*Big.Rational;
 }
@@ -45,7 +45,7 @@ func (a *Matrix) set(i, j int, x *Big.Rational) {
 }
 
 
-func NewMatrix(n, m int) *Matrix {
+export func NewMatrix(n, m int) *Matrix {
        assert(0 <= n && 0 <= m);
        a := new(Matrix);
        a.n = n;
@@ -55,7 +55,7 @@ func NewMatrix(n, m int) *Matrix {
 }
 
 
-func NewUnit(n int) *Matrix {
+export func NewUnit(n int) *Matrix {
        a := NewMatrix(n, n);
        for i := 0; i < n; i++ {
                for j := 0; j < n; j++ {
@@ -70,7 +70,7 @@ func NewUnit(n int) *Matrix {
 }
 
 
-func NewHilbert(n int) *Matrix {
+export func NewHilbert(n int) *Matrix {
        a := NewMatrix(n, n);
        for i := 0; i < n; i++ {
                for j := 0; j < n; j++ {
@@ -82,12 +82,12 @@ func NewHilbert(n int) *Matrix {
 }
 
 
-func MakeRat(x Big.Natural) *Big.Rational {
+export func MakeRat(x Big.Natural) *Big.Rational {
        return Big.MakeRat(Big.MakeInt(false, x), Big.Nat(1));
 }
 
 
-func NewInverseHilbert(n int) *Matrix {
+export func NewInverseHilbert(n int) *Matrix {
        a := NewMatrix(n, n);
        for i := 0; i < n; i++ {
                for j := 0; j < n; j++ {
index ee03f67f03b3be97176553bc0aa61dbdf1bc9882..530d2883fab34f06b7609d0325e7fd24c7a7dce9 100644 (file)
@@ -6,17 +6,17 @@
 
 package main
 
-type I2 interface
+export type I2 interface
 
-type I1 interface {
+export type I1 interface {
        foo() I2
 }
 
-type I2 interface {
+export type I2 interface {
        bar() I1
 }
 
-type T int
+export type T int
 func (t T) bar() I1;
 func (t T) foo() I2 { return t }
 func (t T) bar() I1 { return t }
index 649a955f6d7bb03a31f79f2c311477ce1f681909..819829c7212406fd8e7bd9b8e048917d9a5a0bad 100644 (file)
@@ -6,23 +6,23 @@
 
 package main
 
-type Inst interface {
+export type Inst interface {
        Next()  *Inst;
 }
 
-type Regexp struct {
+export type Regexp struct {
        code []Inst;
        start   Inst;
 }
 
-type Start struct {
+export type Start struct {
        foo     *Inst;
 }
 
 func (start *Start) Next() *Inst { return nil }
 
 
-func AddInst(Inst) *Inst {
+export func AddInst(Inst) *Inst {
        print("ok in addinst\n");
        return nil
 }
index 1db033887f30c3073cd2eb933c924cfbb8a02d17..601c285bafaa6db9678f89a639785d29e221f741 100644 (file)
@@ -6,9 +6,9 @@
 
 package main
 
-type S struct
+export type S struct
 
-type I interface {
+export type I interface {
        Foo()
 }
 
@@ -21,5 +21,5 @@ func main() {
 }
 
 // hide S down here to avoid static warning
-type S struct {
+export type S struct {
 }
index 04af91a0290b3d08b4c2bd04d3b0a225ca827a85..85cd02e13de38e1ca410183bd3ec66ad4a4da4a4 100644 (file)
@@ -6,14 +6,14 @@
 
 package main
 
-type S struct { a int }
-type T struct { b string }
+export type S struct { a int }
+export type T struct { b string }
 
 func (s *S) Name() int8 { return 1 }
 func (t *T) Name() int64 { return 64 }
 
-type I1 interface { Name() int8 }
-type I2 interface { Name() int64 }
+export type I1 interface { Name() int8 }
+export type I2 interface { Name() int64 }
 
 func main() {
        var i1 I1;
index a55936df841d640843ce31f516aea9ae9424c43c..9df502b2152429dc73c712d474538884d7a32ed6 100644 (file)
@@ -9,15 +9,15 @@
 
 package main
 
-type I interface { M() int64 }
+export type I interface { M() int64 }
 
-type BigPtr struct { a, b, c, d int64 }
+export type BigPtr struct { a, b, c, d int64 }
 func (z *BigPtr) M() int64 { return z.a+z.b+z.c+z.d }
 
-type SmallPtr struct { a int32 }
+export type SmallPtr struct { a int32 }
 func (z *SmallPtr) M() int64 { return int64(z.a) }
 
-type IntPtr int32
+export type IntPtr int32
 func (z *IntPtr) M() int64 { return int64(*z) }
 
 var bad bool
@@ -43,13 +43,13 @@ func ptrs() {
        test("&intptr", &intptr);
 }
 
-type Big struct { a, b, c, d int64 }
+export type Big struct { a, b, c, d int64 }
 func (z Big) M() int64 { return z.a+z.b+z.c+z.d }
 
-type Small struct { a int32 }
+export type Small struct { a int32 }
 func (z Small) M() int64 { return int64(z.a) }
 
-type Int int32
+export type Int int32
 func (z Int) M() int64 { return int64(z) }
 
 func nonptrs() {
index 2e273ddddb5a614222129dd3e289d3bdf3c3ecb3..3e816abfcc1f8d91ca10cb5f212746e911bef83f 100644 (file)
@@ -6,10 +6,10 @@
 
 package main
 
-type T struct { a int }
+export type T struct { a int }
 var t *T
 
-type I interface { M() }
+export type I interface { M() }
 var i I
 
 func main() {
index 6053e51d64159532d97bd652d6181d961c7c543d..27b5740aded5bb49c8bb33464db99434672d0ec7 100644 (file)
@@ -15,9 +15,9 @@ func check(b bool, msg string) {
   }
 }
 
-type I1 interface { Get() int; Put(int); }
+export type I1 interface { Get() int; Put(int); }
 
-type S1 struct { i int }
+export type S1 struct { i int }
 func (p S1) Get() int { return p.i }
 func (p S1) Put(i int) { p.i = i }
 
@@ -45,7 +45,7 @@ func f3() {
   check(s.i == 1, "f3 s");
 }
 
-type S2 struct { i int }
+export type S2 struct { i int }
 func (p *S2) Get() int { return p.i }
 func (p *S2) Put(i int) { p.i = i }
 
@@ -73,9 +73,9 @@ func f6() {
   check(s.i == 2, "f6 s");
 }
 
-type I2 interface { Get() int64; Put(int64); }
+export type I2 interface { Get() int64; Put(int64); }
 
-type S3 struct { i, j, k, l int64 }
+export type S3 struct { i, j, k, l int64 }
 func (p S3) Get() int64 { return p.l }
 func (p S3) Put(i int64) { p.l = i }
 
@@ -103,7 +103,7 @@ func f9() {
   check(s.l == 4, "f9 s");
 }
 
-type S4 struct { i, j, k, l int64 }
+export type S4 struct { i, j, k, l int64 }
 func (p *S4) Get() int64 { return p.l }
 func (p *S4) Put(i int64) { p.l = i }
 
index 393edac804eca0a0d3a38949743cd9e38f70149b..d6c0026a90a6a03eb0b19fade1674be50d4238da 100644 (file)
@@ -21,13 +21,13 @@ const (
        g float = 4.5 * float(iota);
 )
 
-const (
+export const (
        X = 0;
        Y;
        Z;
 )
 
-const (
+export const (
        A = 1 << iota;
        B;
        C;
index 2969f3669324ed1c435512f393a45ca09b87cf70..e1a3aed3a86dd865e370ec7f0658a19ec1b0d075 100644 (file)
@@ -6,7 +6,7 @@
 
 package        main
 
-export func
+func
 setpd(a []int)
 {
 //     print("setpd a=", a, " len=", len(a), " cap=", cap(a), "\n");
@@ -15,7 +15,7 @@ setpd(a []int)
        }
 }
 
-export func
+func
 sumpd(a []int) int
 {
 //     print("sumpd a=", a, " len=", len(a), " cap=", cap(a), "\n");
@@ -27,7 +27,7 @@ sumpd(a []int) int
        return t;
 }
 
-export func
+func
 setpf(a *[20]int)
 {
 //     print("setpf a=", a, " len=", len(a), " cap=", cap(a), "\n");
@@ -36,7 +36,7 @@ setpf(a *[20]int)
        }
 }
 
-export func
+func
 sumpf(a *[20]int) int
 {
 //     print("sumpf a=", a, " len=", len(a), " cap=", cap(a), "\n");
index a272c2bbc8f9183f49426058c0efa5f37bd2c8b3..3bc3094975021e4e9ddc17ddf92f22094667dfc7 100644 (file)
@@ -19,7 +19,7 @@ nrand(n int) int
        return randx%n;
 }
 
-type   Chan
+export type    Chan
 struct
 {
        sc,rc   chan int;       // send and recv chan
@@ -30,7 +30,7 @@ var
 (
        nproc           int;
        cval            int;
-       End             int     = 10000;
+       end             int     = 10000;
        totr,tots       int;
        nc              *Chan;
 )
@@ -62,7 +62,7 @@ expect(v, v0 int) (newv int)
 {
        if v == v0 {
                if v%100 == 75 {
-                       return End;
+                       return end;
                }
                return v+1;
        }
@@ -75,7 +75,7 @@ send() bool
 //     print("send ", c.sv, "\n");
        tots++;
        c.sv = expect(c.sv, c.sv);
-       if c.sv == End {
+       if c.sv == end {
                c.sc = nil;
                return true;
        }
@@ -104,7 +104,7 @@ recv(v int) bool
 //     print("recv ", v, "\n");
        totr++;
        c.rv = expect(c.rv, v);
-       if c.rv == End {
+       if c.rv == end {
                c.rc = nil;
                return true;
        }
index f0c9f4ec2bc239cb003f2f8e805c7251603b1e78..bc8240819ba24b052b5951684e56249559888d97 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 
-type
+export type
 I      interface
 {
        test1,
@@ -23,7 +23,7 @@ I     interface
  ******
  ******/
 
-type
+export type
 SubpSubp       struct
 {
        a7      int;
@@ -45,7 +45,7 @@ testx()
  ******
  ******/
 
-type
+export type
 SubpSub        struct
 {
        a6      int;
@@ -68,7 +68,7 @@ testx()
  ******
  ******/
 
-type
+export type
 SubSubp        struct
 {
        a5      int;
@@ -85,7 +85,7 @@ test5() int
  ******
  ******/
 
-type
+export type
 SubSub struct
 {
        a4      int;
@@ -102,7 +102,7 @@ test4() int
  ******
  ******/
 
-type
+export type
 Subp   struct
 {
        a3      int;
@@ -121,7 +121,7 @@ test3() int
  ******
  ******/
 
-type
+export type
 Sub    struct
 {
        a2      int;
@@ -140,7 +140,7 @@ test2() int
  ******
  ******/
 
-type
+export type
 S      struct
 {
        a1      int;
index 05eea395bbecf82c5eabe983e6b1f88e1975dfe8..54ce6ffbccd2a4392d7d65ea3f221382210a6ac9 100644 (file)
@@ -8,7 +8,7 @@ package main
 
 type   myint           int;
 type   mystring        string;
-type   I0              interface {};
+export type    I0              interface {};
 
 func
 f()
index 97db89316843a2638e433610650b7d6fbfa86e1b..55d2d442a0485170f885a9cc7884d11be4d83b7e 100644 (file)
@@ -6,17 +6,17 @@
 
 package main
 
-type S struct
+export type S struct
 {
        a,b     int;
 }
 
-type I1 interface
+export type I1 interface
 {
        f       ()int;
 }
 
-type I2 interface
+export type I2 interface
 {
        g,f     ()int;
 }
index 1c3d65000668f0ed5ad571065d5b819bd9da7fd2..31e7d986924cf6ab3b902eb4e308990268400465 100644 (file)
@@ -6,14 +6,14 @@
 
 package main
 
-type   Iputs   interface
+export type    Iputs   interface
 {
        puts    (s string);
 }
 
 // ---------
 
-type   Print   struct
+export type    Print   struct
 {
        whoami  int;
        put     Iputs;
@@ -28,7 +28,7 @@ dop()
 
 // ---------
 
-type   Bio     struct
+export type    Bio     struct
 {
        whoami  int;
        put     Iputs;
@@ -43,7 +43,7 @@ puts(s string)
 
 // ---------
 
-type   File    struct
+export type    File    struct
 {
        whoami  int;
        put     Iputs;
index e7db3a94d3f1700903e54c2f832407f42288e97b..e2307cf509badd8b7edefcced31f1ac89d7dfe71 100644 (file)
@@ -7,7 +7,7 @@
 
 package main
 
-type C struct
+export type C struct
 {
        a       int;
        x       *(p *C)int;
index a75878b1f5e3e777b51a79316a8270b224b9ecc4..b6d72c8bdcec52fc708b68f0d0bbb785be8e96b4 100644 (file)
@@ -6,18 +6,18 @@
 
 package main
 
-type Item interface
+export type Item interface
 {
        Print();
 }
 
-type ListItem struct
+export type ListItem struct
 {
        item    Item;
        next    *ListItem;
 }
 
-type List struct
+export type List struct
 {
        head    *ListItem;
 }
@@ -48,7 +48,7 @@ Print()
 }
 
 // Something to put in a list
-type Integer struct
+export type Integer struct
 {
        val             int;
 }
index 1b4d86e6f2a516f007599c3df97cc504a97b192e..313ae586fc455017d8e154c5e0dd87e9ccc79deb 100644 (file)
@@ -9,24 +9,24 @@ package main
 
 const nilchar = 0;
 
-type (
+export type (
        Atom struct;
        List struct;
        Slist struct;
 )
 
-type Atom struct {
+export type Atom struct {
        str             string;
        integer         int;
        next            *Slist; /* in hash bucket */
 }
 
-type List struct {
+export type List struct {
        car             *Slist;
        cdr*Slist;
 }
 
-type Slist struct {
+export type Slist struct {
        isatom          bool;
        isstring        bool;
        //union {
@@ -67,8 +67,8 @@ func (slist *Slist) Free() {
 //     free(slist);
 }
 
-func OpenFile();
-func Parse() *Slist;
+export func OpenFile();
+export func Parse() *Slist;
 
 //Slist* atom(byte *s, int i);
 
@@ -81,7 +81,7 @@ var inputindex int = 0;
 var tokenbuf [100]byte;
 var tokenlen int = 0;
 
-const EOF int = -1;
+export const EOF int = -1;
 
 func main()
 {
@@ -131,7 +131,7 @@ func (slist *Slist) Print()
        print("\n");
 }
 
-func Get() int
+export func Get() int
 {
        var c int;
 
@@ -152,12 +152,12 @@ func Get() int
        return c;
 }
 
-func WhiteSpace(c int) bool
+export func WhiteSpace(c int) bool
 {
        return c == ' ' || c == '\t' || c == '\r' || c == '\n';
 }
 
-func NextToken()
+export func NextToken()
 {
        var i, c int;
        var backslash bool;
@@ -199,7 +199,7 @@ func NextToken()
        }
 }
 
-func Expect(c int)
+export func Expect(c int)
 {
        if token != c {
                print("parse error: expected ", c, "\n");
@@ -209,7 +209,7 @@ func Expect(c int)
 }
 
 // Parse a non-parenthesized list up to a closing paren or EOF
-func ParseList() *Slist
+export func ParseList() *Slist
 {
        var slist, retval *Slist;
 
@@ -257,7 +257,7 @@ func atoi() int     // BUG: uses tokenbuf; should take argument
        return v;
 }
 
-func Parse() *Slist
+export func Parse() *Slist
 {
        var slist *Slist;
 
@@ -288,7 +288,7 @@ func Parse() *Slist
        return nil;
 }
 
-func OpenFile()
+export func OpenFile()
 {
        input = "(defn foo (add 12 34))\n\x00";
        inputindex = 0;
index 12b4b6d7b660941f13da916547bba342af154d2e..5d4cfd2afb03dd234cebf3214f8054505c7d091f 100644 (file)
@@ -44,7 +44,7 @@ func f8(a int) (x int, y float) {
        return 8, 8.0;
 }
 
-type T struct {
+export type T struct {
        x, y int;
 }
 
index aafa90e6a80b8b57abe2992e9b53f77678a449f1..e4f06cad2b400971c685854615bd6fed4fb899b0 100644 (file)
@@ -20,7 +20,7 @@ var chatty = flag.Bool("v", false, "chatty");
 var footprint uint64;
 var allocated uint64;
 func bigger() {
-       if f := malloc.GetStats().sys; footprint < f {
+       if f := malloc.GetStats().Sys; footprint < f {
                footprint = f;
                if *chatty {
                        println("Footprint", footprint, " for ", allocated);
@@ -60,7 +60,7 @@ func main() {
                if i%(1<<10) == 0 && *chatty {
                        println(i);
                }
-               b := rand.rand() % len(blocks);
+               b := rand.Int() % len(blocks);
                if blocks[b].base != nil {
                //      println("Free", blocks[b].siz, blocks[b].base);
                        malloc.Free(blocks[b].base);
@@ -68,7 +68,7 @@ func main() {
                        allocated -= blocks[b].siz;
                        continue
                }
-               siz := uint64(rand.rand() >> (11 + rand.urand32() % 20));
+               siz := uint64(rand.Int() >> (11 + rand.Uint32() % 20));
                base := malloc.Alloc(siz);
        //      ptr := uint64(syscall.BytePtr(base))+uint64(siz/2);
        //      obj, size, ref, ok := allocator.find(ptr);
index 26537a0bfcb1ff3a84925e45ad6996bb381e8b20..6aa8fdf8cbde67b2d1c9933d78fb5868eddf2531 100644 (file)
@@ -17,12 +17,12 @@ var chatty = flag.Bool("v", false, "chatty");
 
 var oldsys uint64;
 func bigger() {
-       if st := malloc.GetStats(); oldsys < st.sys {
-               oldsys = st.sys;
+       if st := malloc.GetStats(); oldsys < st.Sys {
+               oldsys = st.Sys;
                if *chatty {
-                       println(st.sys, " system bytes for ", st.alloc, " Go bytes");
+                       println(st.Sys, " system bytes for ", st.Alloc, " Go bytes");
                }
-               if st.sys > 1e9 {
+               if st.Sys > 1e9 {
                        panicln("too big");
                }
        }
@@ -30,16 +30,16 @@ func bigger() {
 
 func main() {
        flag.Parse();
-       malloc.GetStats().alloc = 0;    // ignore stacks
+       malloc.GetStats().Alloc = 0;    // ignore stacks
        for i := 0; i < 1<<8; i++ {
                for j := 1; j <= 1<<22; j<<=1 {
                        if i == 0 && *chatty {
                                println("First alloc:", j);
                        }
                        b := malloc.Alloc(uint64(j));
-                       during := malloc.GetStats().alloc;
+                       during := malloc.GetStats().Alloc;
                        malloc.Free(b);
-                       if a := malloc.GetStats().alloc; a != 0 {
+                       if a := malloc.GetStats().Alloc; a != 0 {
                                panicln("malloc wrong count", a, "after", j, "during", during);
                        }
                        bigger();
index 7ae6b36829821d5b3cab4e11078b3ae6e57e711a..ebb1741994670084881029d66903e26d028ad014 100644 (file)
@@ -22,7 +22,7 @@ var longtest = flag.Bool("l", false, "long test");
 var b []*byte;
 var stats = malloc.GetStats();
 
-func OkAmount(size, n uintptr) bool {
+export func OkAmount(size, n uintptr) bool {
        if n < size {
                return false
        }
@@ -38,45 +38,45 @@ func OkAmount(size, n uintptr) bool {
        return true
 }
 
-func AllocAndFree(size, count int) {
+export func AllocAndFree(size, count int) {
        if *chatty {
                fmt.Printf("size=%d count=%d ...\n", size, count);
        }
-       n1 := stats.alloc;
+       n1 := stats.Alloc;
        for i := 0; i < count; i++ {
                b[i] = malloc.Alloc(uint64(size));
                base, n := malloc.Lookup(b[i]);
                if base != b[i] || !OkAmount(uintptr(size), n) {
                        panicln("lookup failed: got", base, n, "for", b[i]);
                }
-               if malloc.GetStats().sys > 1e9 {
+               if malloc.GetStats().Sys > 1e9 {
                        panicln("too much memory allocated");
                }
        }
-       n2 := stats.alloc;
+       n2 := stats.Alloc;
        if *chatty {
                fmt.Printf("size=%d count=%d stats=%+v\n", size, count, *stats);
        }
-       n3 := stats.alloc;
+       n3 := stats.Alloc;
        for j := 0; j < count; j++ {
                i := j;
                if *reverse {
                        i = count - 1 - j;
                }
-               alloc := stats.alloc;
+               alloc := stats.Alloc;
                base, n := malloc.Lookup(b[i]);
                if base != b[i] || !OkAmount(uintptr(size), n) {
                        panicln("lookup failed: got", base, n, "for", b[i]);
                }
                malloc.Free(b[i]);
-               if stats.alloc != alloc - uint64(n) {
-                       panicln("free alloc got", stats.alloc, "expected", alloc - uint64(n), "after free of", n);
+               if stats.Alloc != alloc - uint64(n) {
+                       panicln("free alloc got", stats.Alloc, "expected", alloc - uint64(n), "after free of", n);
                }
-               if malloc.GetStats().sys > 1e9 {
+               if malloc.GetStats().Sys > 1e9 {
                        panicln("too much memory allocated");
                }
        }
-       n4 := stats.alloc;
+       n4 := stats.Alloc;
 
        if *chatty {
                fmt.Printf("size=%d count=%d stats=%+v\n", size, count, *stats);
index 51c6fe5f5b4d9dd3e76bdeb9346dffb4f1a14202..18a401cf756accfca15b7da597d9b76cb53f60f8 100644 (file)
@@ -13,7 +13,7 @@ import (
 
 const arraylen = 2; // BUG: shouldn't need this
 
-func P(a []string) string {
+export func P(a []string) string {
        s := "{";
        for i := 0; i < len(a); i++ {
                if i > 0 {
index 6dba3d178160c259b49781b24703ee6b7b595637..f57c26907434f261ae855c5ee11874b4a4971011 100644 (file)
@@ -6,12 +6,12 @@
 
 package main
 
-type S string
-type S1 string
-type I int
-type I1 int
-type T struct { x int }
-type T1 T
+export type S string
+export type S1 string
+export type I int
+export type I1 int
+export type T struct { x int }
+export type T1 T
 
 func (s S) val() int { return 1 }
 func (s *S1) val() int { return 2 }
@@ -20,7 +20,7 @@ func (i *I1) val() int { return 4 }
 //func (t T) val() int { return 7 }
 func (t *T1) val() int { return 8 }
 
-type Val interface {
+export type Val interface {
        val() int
 }
 
index c88607d425d8415c7d50be5e4b2829c4827aa8eb..d279c50ddfef3e4cd001fb16821383a1744053f9 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type T struct { }
+export type T struct { }
 func (t *T) M(int, string);    // GCCGO_ERROR "previous"
 func (t *T) M(int, float) { }   // ERROR "redeclared|redefinition"
 
index 3ee0ae1364f123688f080251379f3e5e96423d26..9a32dd6b6a61293d1ca5f99e1cb0fe10d67815d3 100644 (file)
@@ -6,9 +6,9 @@
 
 package main
 
-type T struct {a int}
-type P *T
-type P1 *T
+export type T struct {a int}
+export type P *T
+export type P1 *T
 
 func (p P) val() int { return 1 }  // ERROR "receiver"
 func (p *P1) val() int { return 1 }  // ERROR "receiver"
index 491bcdad33e298fd1d8371343bf2e8a66077ee7e..0b93af0e1282a3119a43ba709e19fd741aa45868 100644 (file)
@@ -8,10 +8,10 @@
 
 package main
 
-type T [] int
+export type T [] int
 func (t T) Len() int { return len(t) }
 
-type I interface {
+export type I interface {
        Len() int
 }
 
index 1aef54ba9bd891f8bcdfbf2a83d76ea8d9ab3bef..e59d473176c516ba1ded13878983724f60115774 100644 (file)
@@ -6,11 +6,11 @@
 
 package main
 
-type T struct {
+export type T struct {
        i int
 }
 
-type IN interface {
+export type IN interface {
 }
 
 func main() {
index 07e5f0ed370cbaed2823bd3e750e7a83e5fe5e97..3195761983b58b8ee2886affb0fa6ee029c4e210 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-type Number struct {
+export type Number struct {
        next *Number
 }
 
index e163456176d05b134b122bc83cc83b3a9a682b97..f6a07277fbdc359c5c2c1cd93dc87869aad4596e 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 // Send the sequence 2, 3, 4, ... to channel 'ch'.
-func Generate(ch chan<- int) {
+export func Generate(ch chan<- int) {
        for i := 2; ; i++ {
                ch <- i  // Send 'i' to channel 'ch'.
        }
@@ -15,7 +15,7 @@ func Generate(ch chan<- int) {
 
 // Copy the values from channel 'in' to channel 'out',
 // removing those divisible by 'prime'.
-func Filter(in <-chan int, out chan<- int, prime int) {
+export func Filter(in <-chan int, out chan<- int, prime int) {
        for {
                i := <-in;  // Receive value of new variable 'i' from 'in'.
                if i % prime != 0 {
@@ -25,7 +25,7 @@ func Filter(in <-chan int, out chan<- int, prime int) {
 }
 
 // The prime sieve: Daisy-chain Filter processes together.
-func Sieve() {
+export func Sieve() {
        ch := make(chan int);  // Create a new channel.
        go Generate(ch);  // Start Generate() as a subprocess.
        for {
index 95d225444fa1d8854e2b4fd128c291dfdccd8245..bb9f10f9cb9d9fc19fb906b29db79bbe4d303d48 100644 (file)
@@ -18,7 +18,7 @@ const (
   mask4 = 1 << iota;
 )
 
-type (
+export type (
   Empty interface {};
   Point struct {
     x, y int;
index e5cbde2d534e6070a1054f11bd114887634df6c0..f468f4b29ad9cf88c118258c84a22caa938b9248 100644 (file)
@@ -9,7 +9,7 @@ package main
 import "array"
 
 
-type S struct {
+export type S struct {
        val int
 }