1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:41:28 -06:00
Commit Graph

885 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
ae11e9eb88 fix build
TBR=r
OCL=30757
CL=30757
2009-06-25 15:15:44 -07:00
Russ Cox
4866223c2e add reflect.Typeof; test for and fix nil interface bug in DeepEqual
R=r
DELTA=40  (30 added, 2 deleted, 8 changed)
OCL=30742
CL=30753
2009-06-25 14:25:38 -07:00
Russ Cox
6af5775d74 dreg
R=r
DELTA=19  (0 added, 19 deleted, 0 changed)
OCL=30739
CL=30751
2009-06-25 14:25:11 -07:00
Kai Backman
111005d32b Add Gobuf.r0 that stores arg0 or return value of
goroutine. arm only.

R=rsc
APPROVED=rsc
DELTA=5  (3 added, 2 deleted, 0 changed)
OCL=30644
CL=30746
2009-06-25 11:26:10 -07:00
Russ Cox
a50cbf6c73 style police: parens in if, for, switch, range
R=r
DELTA=32  (0 added, 3 deleted, 29 changed)
OCL=30718
CL=30725
2009-06-24 20:12:50 -07:00
David Symonds
30533d607a Change strings.Split, bytes.Split to take a maximum substring count argument.
R=rsc
APPROVED=r
DELTA=131  (39 added, 10 deleted, 82 changed)
OCL=30669
CL=30723
2009-06-24 19:02:29 -07:00
Russ Cox
2ce8b444b9 base64: cut out some middle layers
R=austin
DELTA=352  (67 added, 196 deleted, 89 changed)
OCL=30694
CL=30713
2009-06-24 15:52:31 -07:00
Russ Cox
a1646fd50e make bytes.Copy both src- and dst- limited
and return the number of bytes copied.

R=r
DELTA=18  (6 added, 0 deleted, 12 changed)
OCL=30693
CL=30712
2009-06-24 15:35:35 -07:00
Austin Clements
c3a087a088 Base64 encoder/decoder package.
R=rsc
APPROVED=rsc
DELTA=722  (722 added, 0 deleted, 0 changed)
OCL=30660
CL=30691
2009-06-24 11:09:43 -07:00
David Symonds
e6ff6c8e56 Fix http client handling of status messages with spaces (e.g. "HTTP/1.1 400 Bad
Request".
Use chunked Transfer-Encoding for all POSTs.
Implement chunked reading.
Change http.Request.write to be HTTP/1.1 only.

R=rsc
APPROVED=rsc
DELTA=178  (123 added, 26 deleted, 29 changed)
OCL=30563
CL=30673
2009-06-23 18:49:47 -07:00
Russ Cox
0d77947a3e publish strconv.UnquoteChar
R=r
DELTA=69  (37 added, 3 deleted, 29 changed)
OCL=30661
CL=30667
2009-06-23 16:44:01 -07:00
Rob Pike
5766553380 fix io.Bytebuffer.Read for new EOF semantics
R=rsc
DELTA=7  (5 added, 0 deleted, 2 changed)
OCL=30657
CL=30659
2009-06-23 15:20:40 -07:00
Rob Pike
28ba9777e6 rename Formatter to State and Format to Formatter, for nomenclatural consistency
R=rsc
DELTA=9  (0 added, 0 deleted, 9 changed)
OCL=30658
CL=30658
2009-06-23 15:20:30 -07:00
Kai Backman
be639b9a51 Runtime is now starting up with a dummy c program as target:
- morestack and gosave/gogo/gocall support
- memclr and memset from inferno
- bugfixes in _rt0_arm

R=rsc
APPROVED=rsc
DELTA=304  (174 added, 36 deleted, 94 changed)
OCL=30636
CL=30642
2009-06-23 11:54:23 -07:00
Rob Pike
b6ce2a72e1 document the verbs for Printf
R=rsc
DELTA=61  (48 added, 0 deleted, 13 changed)
OCL=30616
CL=30619
2009-06-22 18:09:40 -07:00
David Symonds
343bfcfca7 Don't prefix Url.Path with a slash in Request.write,
because Url.Path already starts with one.
Avoid crashing in Request.ParseForm if there is no body.

R=rsc
APPROVED=rsc
DELTA=5  (4 added, 0 deleted, 1 changed)
OCL=30552
CL=30607
2009-06-22 14:50:12 -07:00
Russ Cox
71f19d66d4 document requirements on Write method
R=r
DELTA=7  (6 added, 0 deleted, 1 changed)
OCL=30596
CL=30605
2009-06-22 14:44:07 -07:00
Rob Pike
8d343e2d49 a couple of cosmetic tweaks.
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=30599
CL=30602
2009-06-22 14:26:07 -07:00
Kai Backman
d281748a6d add arm support to mkasmh
R=rsc
APPROVED=rsc
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=30587
CL=30595
2009-06-22 14:08:00 -07:00
Russ Cox
da5abb9fb3 changes required if we disallow the implicit *
in cap, len, [], and range on maps, strings, and slices.

R=r
DELTA=57  (2 added, 12 deleted, 43 changed)
OCL=30549
CL=30590
2009-06-22 13:34:21 -07:00
Russ Cox
64684cc2a2 introduce os.EOF and io.ErrUnexpectedEOF.
remove io.ErrEOF.
rename io.FullRead to io.ReadFull, to match
   ReadAtLeast and ReadAll.
remove io.FullReader, because it is now unused.

R=r
DELTA=295  (88 added, 105 deleted, 102 changed)
OCL=30544
CL=30588
2009-06-22 13:26:13 -07:00
David Symonds
022ee0c26f Add form body parsing to http.Request.
better error handling throughout.

R=r,rsc
APPROVED=r
DELTA=254  (201 added, 3 deleted, 50 changed)
OCL=30515
CL=30545
2009-06-19 18:02:15 -07:00
Rob Pike
2805eb9a5e fix build
R=rsc
OCL=30542
CL=30542
2009-06-19 16:45:04 -07:00
Scott Schwartz
08aab44e48 Add ReadByte to bytebuffer
R=rsc
APPROVED=rsc
DELTA=24  (24 added, 0 deleted, 0 changed)
OCL=30459
CL=30540
2009-06-19 16:29:30 -07:00
Rob Pike
efc4088ccd make IP address available
R=rsc
DELTA=30  (30 added, 0 deleted, 0 changed)
OCL=30536
CL=30536
2009-06-19 16:03:59 -07:00
Steve Newman
a6c7a80b5b Add a ReplaceAll method to Regexp.
APPROVED=r,rsc
DELTA=189  (187 added, 0 deleted, 2 changed)
OCL=30205
CL=30517
2009-06-18 17:55:47 -07:00
Robert Griesemer
1b9734b995 1) Fix a problem with tabwriter.Flush: any pending text not yet
in a cell makes a final cell in that line
   (this showed up as occasionally missing single spaces in
   godoc-formatted declarations that fit on a single line)

2) Cleaned up tabwriter implementation a bit:
   - replaced local unicodeLen() with utf8.RuneCount()
   - instead of having 2 parallel arrays for line widths and sizes,
     have a single array of cells containing a width and size
   - factored code a bit better
   - added more comments
   - added testnames to tabwriter tests
   - added more test cases and fixed a broken test case that
     now works correctly

R=r
DELTA=279  (133 added, 62 deleted, 84 changed)
OCL=30509
CL=30514
2009-06-18 17:06:08 -07:00
Robert Griesemer
5eb5d4d3c0 `` strings may span multiple lines
R=rsc
DELTA=3  (2 added, 0 deleted, 1 changed)
OCL=30511
CL=30513
2009-06-18 17:04:39 -07:00
Russ Cox
ab7a8d43a4 make pkg/runtime/Makefile behave like the others:
make builds; make install installs.

R=r
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=30489
CL=30491
2009-06-18 13:33:28 -07:00
Russ Cox
5d2ee9d90a add Addr() string to net.Listener interface.
use it to avoid use of fixed ports in tests.
convert google/net/rpc to gotest

R=r
DELTA=523  (275 added, 229 deleted, 19 changed)
OCL=30458
CL=30460
2009-06-17 21:44:26 -07:00
Russ Cox
f39fcd7e42 fix 386 build.
some day...

TBR=r
OCL=30453
CL=30453
2009-06-17 16:34:13 -07:00
Russ Cox
380200953a Forgot to check in 386/asm.h.
Rather than do that, fix build by
generating asm.h automatically.

R=r
DELTA=97  (48 added, 36 deleted, 13 changed)
OCL=30449
CL=30452
2009-06-17 16:31:02 -07:00
Russ Cox
da5e962e49 shuffle some Linux system calls around for 386
R=r
DELTA=37  (17 added, 15 deleted, 5 changed)
OCL=30428
CL=30444
2009-06-17 15:16:06 -07:00
Russ Cox
8522a478bb update 386 to new runtime (CL 30381)
R=r
DELTA=298  (119 added, 81 deleted, 98 changed)
OCL=30427
CL=30443
2009-06-17 15:15:55 -07:00
Russ Cox
7343e03c43 runtime: stack growth adjustments, cleanup
* keep coherent SP/PC in gobuf
	  (i.e., SP that would be in use at that PC)
	* gogocall replaces setspgoto,
	  should work better in presence of link registers
	* delete unused system calls

only amd64; 386 is now broken

R=r
DELTA=548  (183 added, 183 deleted, 182 changed)
OCL=30381
CL=30442
2009-06-17 15:12:16 -07:00
Russ Cox
76c87d58cd 386 system call fixes:
* use 64-bit file system calls (Linux, Darwin)
  * use 32-bit [sic] uid/gid calls (Linux)
  * fix sockets on Linux

Darwin/386 works again.

Linux/386 is better but must never have worked;
there are still bugs surrounding the creation of new
threads in the runtime package.

R=austin
DELTA=1332  (673 added, 614 deleted, 45 changed)
OCL=30327
CL=30380
2009-06-16 17:17:02 -07:00
Robert Griesemer
cb897436eb fix nesting level for parameters
R=rsc
DELTA=8  (4 added, 2 deleted, 2 changed)
OCL=30365
CL=30368
2009-06-16 14:39:19 -07:00
Robert Griesemer
4c8fe766af - some fine-tuning of godoc templates per r's suggestion
- removed gratuitous newline in go/printer

R=r
DELTA=15  (2 added, 13 deleted, 0 changed)
OCL=30358
CL=30358
2009-06-16 13:44:15 -07:00
Jacob Baskin
536c2aa6ae URL should have an empty Scheme if there is an invalid character (i.e.
not [a-zA-Z0-9+-.]) before there is a ":".

This is particularly helpful in the erroneous-but-relatively-common
case of relative URLs containing an unescaped colon in the query
string--see the added test for an example.

R=rsc
APPROVED=rsc
DELTA=15  (15 added, 0 deleted, 0 changed)
OCL=30354
CL=30356
2009-06-16 13:23:42 -07:00
Kai Backman
1ac2cfc720 grab bag of changes aimed at getting stack splitting to work:
- morestack support for 5l and arm runtime
- argsize support in 5c, 5l, ar and nm. assembly code from 5a
  will break in interesting ways unless NOSPLIT is specified
- explicit cond execution constants
- fix 5l output to use %d instead of %ld so that negative
  values show.
- added a lot of code to arm/asm.s. runtime entry code almost
  working currently aborts at gogo not implemented

R=rsc
APPROVED=rsc
DELTA=305  (125 added, 29 deleted, 151 changed)
OCL=30246
CL=30347
2009-06-16 11:25:58 -07:00
Russ Cox
8c357ce269 fix another gc bug, one that i have only imagined,
not observed: do not use malloc to allocate stacks
during garbage collection, because it would make the
malloc data structures change underfoot.

R=r
DELTA=6  (3 added, 0 deleted, 3 changed)
OCL=30323
CL=30326
2009-06-15 21:31:56 -07:00
Russ Cox
36835c7a47 fix garbage collection race: save stack trace
when changing process state to Gsyscall, not after.

R=r
DELTA=8  (4 added, 3 deleted, 1 changed)
OCL=30320
CL=30325
2009-06-15 21:30:53 -07:00
David Symonds
d4e57ff248 Fix a proto encoding crasher whereby a nil in a repeated group field would crash the server.
Also fix the reflect bug that was exposed by this bug.

R=r
APPROVED=rsc
DELTA=162  (103 added, 32 deleted, 27 changed)
OCL=30125
CL=30319
2009-06-15 18:35:04 -07:00
Robert Griesemer
a893db8767 gofmt (final resting place TBD):
- replacement for pretty; app to format a single .go file

printer.go (pkg/go/printer):
- replacement for astprinter.go; implements AST printing
- also replaces pkg/go/ast/format.go for now

cleanups:
- removed/saved away old code

R=r,rsc,iant
DELTA=2833  (1183 added, 1628 deleted, 22 changed)
OCL=30226
CL=30306
2009-06-15 16:23:16 -07:00
Robert Griesemer
c2faeac8c4 fixed typo (slipped in with previous submit)
TBR=rsc
OCL=30300
CL=30300
2009-06-15 15:47:15 -07:00
Robert Griesemer
4a50434a36 Support for line comments trailing a field or declaration:
- ast: added extra fields
- parser: extended comment parsing to capture potential trailing comments

Cleanups:
- parser: more documentation, changed various identifiers from _-style to camelCase

R=r,rsc
DELTA=214  (84 added, 13 deleted, 117 changed)
OCL=30259
CL=30299
2009-06-15 15:43:11 -07:00
Robert Griesemer
be87e33b1f removed bogus if-statement
R=iant
DELTA=3  (0 added, 3 deleted, 0 changed)
OCL=30251
CL=30251
2009-06-12 15:17:39 -07:00
David Symonds
cbd0092173 Switch http client_test to use google.com/robots.txt to avoid redirect loop.
www.google.com seems to be redirecting requests in an infinite loop. I haven't tracked down whether it's their code or this code that is causing it. This is just a quick fix so that this test passes.

APPROVED=r
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=30178
CL=30210
2009-06-11 15:55:03 -07:00
David Symonds
61d6ad3178 Add support for the basic extension done by Schilling's star.
Compute checksums in both ways (unsigned and signed).

R=rsc
APPROVED=rsc
DELTA=188  (145 added, 21 deleted, 22 changed)
OCL=30126
CL=30179
2009-06-10 21:32:36 -07:00
Robert Griesemer
7fd9cfd0cc - parser bug: return keyword may be followed by case or default keyword as well
- fixed unrelated typo

R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=30175
CL=30175
2009-06-10 15:40:19 -07:00
Kai Backman
528919520d Adding a batch of missing system calls.
R=rsc
APPROVED=rsc
DELTA=1329  (1264 added, 1 deleted, 64 changed)
OCL=30040
CL=30158
2009-06-10 11:53:07 -07:00
Steve Newman
f315fb3d56 Basic HTTP client.
R=rsc
APPROVED=rsc
DELTA=392  (386 added, 2 deleted, 4 changed)
OCL=29963
CL=30107
2009-06-09 10:58:58 -07:00
Russ Cox
c4aa021733 bring over deps.bash
TBR=r
OCL=30106
CL=30106
2009-06-09 10:47:13 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00
Robert Griesemer
2e777b44b8 - created staging area for getting bignum package up-to-speed again,
now using up-to-date language features
- moved old code away from pkg (defunct anyway because of language changes)

R=r
OCL=17916
CL=17916
2008-10-27 15:44:32 -07:00
Russ Cox
76036192b9 make Makefiles safe for parallel make
use -j4 (4-way parallel) in make.bash.

halves time for make.bash on r45

also add libregexp, acid to default build

R=r
DELTA=90  (39 added, 37 deleted, 14 changed)
OCL=15485
CL=15487
2008-09-18 15:06:43 -07:00
Robert Griesemer
0ba1db7475 - fixed missing return issues
R=r
OCL=15168
CL=15168
2008-09-11 15:38:22 -07:00
Robert Griesemer
683ded80c9 - changed go-in-go parser to require ()'s for panic and print
- adjusted much of the existing go code
- missing: tests

R=r
DELTA=229  (1 added, 17 deleted, 211 changed)
OCL=14103
CL=14103
2008-08-11 21:20:42 -07:00
Robert Griesemer
2f4352a26d - switched most of existing Go code to new export syntax
- adjusted lang doc

R=r
DELTA=192  (26 added, 65 deleted, 101 changed)
OCL=13844
CL=13848
2008-08-04 17:17:59 -07:00
Robert Griesemer
553771314c - moved integer code into src/pkg
SVN=125003
2008-06-26 16:52:15 -07:00
Brian Kernighan
d82b11e4a4 last-minute fix: convert to ANSI C
R=dmr
DELTA=3  (2 added, 0 deleted, 1 changed)
1988-04-01 02:03:04 -05:00
Brian Kernighan
0744ac9691 convert to Draft-Proposed ANSI C
R=dmr
DELTA=5  (2 added, 0 deleted, 3 changed)
1988-04-01 02:02:04 -05:00
Brian Kernighan
0bb0b61d6a convert to C
R=dmr
DELTA=6  (0 added, 3 deleted, 3 changed)
1974-01-20 01:02:03 -04:00
Brian Kernighan
7d7c6a97f8 hello, world
R=ken
DELTA=7  (7 added, 0 deleted, 0 changed)
1972-07-18 19:05:45 -05:00