Rob Pike
77baac11e1
encode and decode for nested structures.
...
fix a bug in delta encoding: only update the delta-base if something is marshaled.
R=rsc
DELTA=154 (94 added, 56 deleted, 4 changed)
OCL=31069
CL=31071
2009-07-02 13:43:47 -07:00
Rob Pike
1ca1e1befa
encoders and decoders for string, []uint8
...
R=rsc
DELTA=165 (145 added, 6 deleted, 14 changed)
OCL=31051
CL=31056
2009-07-02 11:21:01 -07:00
Rob Pike
519a70da54
fix bug in $GOROOT handling: error calling Getenv.
...
R=gri
OCL=31047
CL=31047
2009-07-02 09:47:25 -07:00
Rob Pike
22b93dfb5c
now that we have a separate indirection test, simplify the scalar tests.
...
R=rsc
DELTA=562 (8 added, 424 deleted, 130 changed)
OCL=31039
CL=31045
2009-07-02 09:22:38 -07:00
Rob Pike
671f807e2e
simplify decoders. error checking is done higher up.
...
if there is an error, we will write one more value into the struct but in return
we do fewer tests in the decode.
R=rsc
DELTA=56 (0 added, 42 deleted, 14 changed)
OCL=31041
CL=31044
2009-07-02 09:22:30 -07:00
Rob Pike
c0271c4bc2
fix bug in decoders: got indirection wrong when allocation not required.
...
write indirection test.
next step: cut down scalar tests since indirection is centralized.
R=rsc
DELTA=114 (83 added, 3 deleted, 28 changed)
OCL=31020
CL=31037
2009-07-02 08:21:42 -07:00
Rob Pike
b1e64585b6
move dereference code out of the ops and into the interpreter loops.
...
R=rsc
DELTA=574 (40 added, 149 deleted, 385 changed)
OCL=31017
CL=31019
2009-07-01 23:04:27 -07:00
Rob Pike
c701af8c80
Encode and decode engines for gobs.
...
R=rsc
DELTA=468 (292 added, 18 deleted, 158 changed)
OCL=31008
CL=31012
2009-07-01 18:25:13 -07:00
Russ Cox
a439f66228
add test, fix bug: structs that differ in their
...
first field were not being handled correctly
because the visited map did not include the type.
R=r
OCL=31006
CL=31006
2009-07-01 16:45:09 -07:00
David Symonds
25706fec19
Fix a doc typo.
...
R=rsc
APPROVED=rsc
DELTA=1 (0 added, 0 deleted, 1 changed)
OCL=30967
CL=30990
2009-07-01 15:07:20 -07:00
Russ Cox
55e790a160
clean up some BUG/TODO in go code
...
R=r
DELTA=23 (1 added, 12 deleted, 10 changed)
OCL=30957
CL=30980
2009-07-01 07:32:04 -07:00
Russ Cox
20cfa4a568
change alignment rules: roll receiver into
...
input parameters, move output parameters
into their own struct.
R=ken
OCL=30954
CL=30966
2009-06-30 20:02:07 -07:00
Russ Cox
150a64572b
remove declarations for functions that cannot be called from c
...
(because they return values in the input parameters).
R=iant
DELTA=12 (0 added, 11 deleted, 1 changed)
OCL=30952
CL=30965
2009-06-30 20:01:59 -07:00
Russ Cox
fa40c856ac
convert string runtime to use cgo.
...
now that cgo2c can handle it,
merge x.c and x_go.cgo into
a single x.cgo, for x=float,malloc,sema.
R=r
DELTA=1950 (954 added, 996 deleted, 0 changed)
OCL=30951
CL=30964
2009-06-30 20:01:50 -07:00
Russ Cox
88e7fd5410
in preparation for changing 6g's behavior to
...
align the output args separately from the input args,
change cgo2c to insert the necessary padding
when the two arg lists are concatenated in the c
translation.
for example, there is a runtime
func indexstring(s string, i int32) (b byte)
right now in 6g those arguments are aligned in one
struct with s at offset 0, i at 16, and b at 20.
soon the b byte will be in its own struct and structs
are 8 aligned, so it will be b at 24.
right now cgo2c generates:
void indexstring(string s, int32 i, byte b)
this CL makes it generate, in --6g mode:
void indexstring(string s, int32 i, uint32, byte b)
this is valid 6c input, although not valid gcc input.
(the code is being generated for 6c only anyway.)
also, allow C code to be mixed in among the Go funcs.
every instance of the token `func' is expected to start
a new go func.
R=iant
DELTA=145 (118 added, 0 deleted, 27 changed)
OCL=30949
CL=30963
2009-06-30 20:01:41 -07:00
Rob Pike
b968943332
scalar decoders
...
R=rsc
DELTA=897 (728 added, 14 deleted, 155 changed)
OCL=30955
CL=30955
2009-06-30 17:59:41 -07:00
Rob Pike
79b2cf92d9
pass the state to the encoders and decoders so error handling can be centralized.
...
R=rsc
DELTA=172 (40 added, 6 deleted, 126 changed)
OCL=30941
CL=30944
2009-06-30 16:20:31 -07:00
Rob Pike
f6f825141a
encoders for booleans and numbers.
...
R=rsc
DELTA=610 (597 added, 5 deleted, 8 changed)
OCL=30934
CL=30939
2009-06-30 15:37:46 -07:00
Russ Cox
832e72beff
delete io.ByteBuffer
...
R=r
DELTA=25 (0 added, 15 deleted, 10 changed)
OCL=30892
CL=30892
2009-06-29 20:53:05 -07:00
Russ Cox
5d5904bb4d
bug163 bug164 bug166
...
R=ken
OCL=30889
CL=30889
2009-06-29 17:46:22 -07:00
Russ Cox
df36629d76
bug041 not a bug.
...
can now forward declare across files
R=r
DELTA=15 (0 added, 15 deleted, 0 changed)
OCL=30873
CL=30880
2009-06-29 17:21:33 -07:00
Russ Cox
d3a412a5ab
io.StringBytes -> strings.Bytes
...
io.ByteBuffer -> bytes.Buffer
left io.ByteBuffer stub around for now,
for protocol compiler.
R=r
OCL=30861
CL=30872
2009-06-29 15:24:23 -07:00
Rob Pike
b948c437a1
integer encode/decode
...
R=rsc
DELTA=185 (175 added, 10 deleted, 0 changed)
OCL=30863
CL=30871
2009-06-29 15:15:07 -07:00
Russ Cox
8f9a953760
make use of forward method declaration
...
R=r
DELTA=11 (0 added, 6 deleted, 5 changed)
OCL=30862
CL=30870
2009-06-29 15:13:56 -07:00
Russ Cox
9435dc2bdf
allow forward declaration of struct in another file
...
(in the same package).
allow forward method declaration to be satisfied
by implementation in another file (in the same package).
all methods must be declared in the same file
as the receiver type.
R=ken
OCL=30864
CL=30869
2009-06-29 15:13:37 -07:00
Russ Cox
3119221ed8
bogus test: planning to allow forward declarations
...
of structs/interfaces in other files in the package.
R=r
DELTA=12 (0 added, 12 deleted, 0 changed)
OCL=30865
CL=30868
2009-06-29 15:13:18 -07:00
Russ Cox
b32769b1a3
add os.Hostname
...
R=r
DELTA=188 (182 added, 3 deleted, 3 changed)
OCL=30856
CL=30860
2009-06-29 13:44:46 -07:00
Ian Lance Taylor
6a71f43f82
6g appears to permit semicolons to be omitted after qualified
...
identifiers. This is not one of the exceptions permitted by
th spec.
R=ken,rsc
DELTA=11 (11 added, 0 deleted, 0 changed)
OCL=30844
CL=30852
2009-06-29 12:52:08 -07:00
Rob Pike
2b08372710
add []byte as a special case: it will have a special, efficient encoding.
...
R=rsc
DELTA=16 (9 added, 1 deleted, 6 changed)
OCL=30846
CL=30846
2009-06-29 11:29:47 -07:00
Rob Pike
104d0246ea
fix gobuild bug
...
R=rsc
DELTA=4 (3 added, 0 deleted, 1 changed)
OCL=30845
CL=30845
2009-06-29 11:19:38 -07:00
Kai Backman
b2871b727e
working on bgen
...
- removed smallint optimizations
- lifted raddr from 5c
- add back %R, was used in gc/* causing -g to crash
- changed naddr OREGISTER to emit D_REG instead of D_OREG
R=rsc
APPROVED=rsc
DELTA=74 (38 added, 28 deleted, 8 changed)
OCL=30799
CL=30822
2009-06-26 22:04:30 -07:00
Rob Pike
d330c712c1
Getenv: almost no one wants the error, so make it return a string that may be empty.
...
Getenverror is the new name for the old routine that returns an error too.
R=rsc
DELTA=35 (7 added, 7 deleted, 21 changed)
OCL=30818
CL=30821
2009-06-26 20:28:41 -07:00
Rob Pike
ac7f2152eb
the first time a structure type appears when printing, identify it by name:
...
type Foo struct { a int; next *Foo }
produces
"Foo = struct { a int; next Foo }"
R=rsc
OCL=30797
CL=30820
2009-06-26 20:28:06 -07:00
Kai Backman
d6197d94b5
Adding more debug output when 5l encounters a bad op
...
combination.
R=rsc
APPROVED=rsc
DELTA=69 (68 added, 0 deleted, 1 changed)
OCL=30798
CL=30801
2009-06-26 13:44:25 -07:00
Kai Backman
4556c04d8b
more changes to make 5g code generation arm compatible.
...
R=rsc
APPROVED=rsc
DELTA=72 (12 added, 52 deleted, 8 changed)
OCL=30748
CL=30793
2009-06-26 04:08:20 -07:00
Rob Pike
7986de6e51
gobs part 1: types.
...
not ready to be part of the standard build yet; this is just a checkpoint.
R=rsc
DELTA=361 (361 added, 0 deleted, 0 changed)
OCL=30782
CL=30785
2009-06-25 22:08:51 -07:00
David Symonds
a2a827542a
http Request parsing, plus a convenient accessor.
...
R=rsc
APPROVED=rsc
DELTA=95 (40 added, 14 deleted, 41 changed)
OCL=30727
CL=30784
2009-06-25 21:05:44 -07:00
Russ Cox
480f51243c
bug165
...
R=ken
OCL=30783
CL=30783
2009-06-25 21:02:39 -07:00
Russ Cox
a0bcaf4c00
Change os.Error convention:
...
echo back context of call in error if likely to be useful.
For example, if os.Open("/etc/passwd", os.O_RDONLY)
fails with syscall.EPERM, it returns as the os.Error
&PathError{
Op: "open",
Path: "/etc/passwd"
Error: os.EPERM
}
which formats as
open /etc/passwd: permission denied
Not converted:
datafmt
go/...
google/...
regexp
tabwriter
template
R=r
DELTA=1153 (561 added, 156 deleted, 436 changed)
OCL=30738
CL=30781
2009-06-25 20:24:55 -07:00
Russ Cox
70e232e668
separate local path lookup from standard package directories
...
R=ken
OCL=30760
CL=30779
2009-06-25 20:15:56 -07:00
Russ Cox
cf370a6206
add ./ to imports where necessary
...
R=r
DELTA=51 (4 added, 4 deleted, 43 changed)
OCL=30759
CL=30778
2009-06-25 20:13:56 -07:00
Rob Pike
7de4883412
cannot have interfaces refer to themselves as map keys
...
R=rsc
DELTA=11 (11 added, 0 deleted, 0 changed)
OCL=30774
CL=30774
2009-06-25 18:44:28 -07:00
Russ Cox
5851a1b5ad
allow
...
package main
type t interface
type t interface{ m(map[t]bool) }
type m map[t] int
making it work without the forward declaration will require a second pass.
R=ken
OCL=30773
CL=30773
2009-06-25 18:19:05 -07:00
Russ Cox
1ea28570ec
the any fix was too aggressive; allow any in any import.
...
R=ken
OCL=30768
CL=30768
2009-06-25 16:57:56 -07:00
Russ Cox
fa6df47986
package main
...
const foo = []int{1,2}
x.go:3: expression must be a constant
instead of
x.go:3: fatal error: gettype: addtop
R=ken
OCL=30767
CL=30767
2009-06-25 16:42:08 -07:00
Russ Cox
70a273476b
better error; clean up lineno in a few places
...
wreck.mtv=; cat x.go
package main
var x = string.Split()
wreck.mtv=; 6g x.go
x.go:2: type string used as expression
x.go:2: undefined DOT Split on string
x.go:3: illegal types for operand: AS
undefined
wreck.mtv=;
BUG=1938751
R=ken
OCL=30766
CL=30766
2009-06-25 16:32:33 -07:00
Russ Cox
4bce6d455f
package main
...
func foo(y) { }
was:
x.go:2: NONAME-y G0 u(1) a(1) l(77) x(-1000000000) is not a type
now:
x.go:2: y is not a type
R=ken
OCL=30764
CL=30764
2009-06-25 16:25:06 -07:00
Russ Cox
30f2799f88
disable "any" except during canned imports.
...
new flag -A enables it during mkbuiltin.
avoids mysterious errors in programs
that refer to any accidentally.
R=ken
OCL=30763
CL=30763
2009-06-25 16:22:46 -07:00
Russ Cox
ae11e9eb88
fix build
...
TBR=r
OCL=30757
CL=30757
2009-06-25 15:15:44 -07:00
Russ Cox
111ae83bb7
6g: update for spec change CL 30586
...
R=ken
OCL=30593
CL=30756
2009-06-25 14:44:45 -07:00