1
0
mirror of https://github.com/golang/go synced 2024-10-04 03:21:22 -06:00
Commit Graph

2060 Commits

Author SHA1 Message Date
Ken Thompson
ed124a971e segfault
R=rsc
OCL=31467
CL=31467
2009-07-10 16:12:21 -07:00
Rob Pike
8a9e395f5f one more piece of testing: 2nd send should not send type info.
R=rsc
DELTA=25  (25 added, 0 deleted, 0 changed)
OCL=31460
CL=31460
2009-07-10 13:50:44 -07:00
Rob Pike
f0a9840d04 a better encoder test, with a couple of fixes for bugs it uncovered.
R=rsc
DELTA=84  (65 added, 9 deleted, 10 changed)
OCL=31458
CL=31458
2009-07-10 13:44:37 -07:00
Rob Pike
1880b90aff DeepEqual for maps
R=rsc
DELTA=47  (30 added, 16 deleted, 1 changed)
OCL=31455
CL=31455
2009-07-10 11:20:10 -07:00
Robert Griesemer
981f4b43ac mention file name only once in error message
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31450
CL=31452
2009-07-10 10:01:08 -07:00
Robert Griesemer
a47404bc1c fix error messages
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=31449
CL=31451
2009-07-10 10:00:25 -07:00
Rob Pike
3928a4e11b printing maps
R=rsc
DELTA=57  (39 added, 3 deleted, 15 changed)
OCL=31424
CL=31430
2009-07-09 17:30:07 -07:00
Russ Cox
12ebbe7463 reflection for methods
R=r
DELTA=156  (135 added, 8 deleted, 13 changed)
OCL=31407
CL=31428
2009-07-09 17:27:49 -07:00
Robert Griesemer
f7b92bb45d fix to scanner_test after change to //-style comment token
R=rsc
OCL=31421
CL=31421
2009-07-09 16:54:08 -07:00
Robert Griesemer
38e7fddc21 Show BUG comments in godoc:
ast.go:
- rename Comments -> CommentGroup (less confusion)
- change all comments/docs to be *CommentGroup

filter.go:
- do not remove unassociated comments from program as part
  of export filtering (they are needed by doc.go for BUG comments)

scanner.go:
- exclude '\n' from //-style comments

parser.go:
- rewrote collection of comments: now all collected comments
  are *ast.CommentGroups
- clarified distinction between leading and trailing comments
- fixed a bug in comment collection (parseGenDecl);
  corresponding test case is in printer/testdata
- extra documentation

doc.go:
- collect BUG comments
- corresponding fix for parser bug in comment collection

comment.go:
- simplified regex

printer.go:
- adjust comment printing to new representation

printer_test.go, testdata/*:
- enable printing of doc comments
- extended tests

package.html, package.txt:
- added Bugs section

gofmt:
- enable printing of doc comments

R=rsc
DELTA=339  (126 added, 38 deleted, 175 changed)
OCL=31403
CL=31416
2009-07-09 16:38:17 -07:00
Rob Pike
ec23467e65 store ids rather than Types in the structs so they can be encoded.
change Type to gobType.
fix some bugs around recursive structures.
lots of cleanup.
add the first cut at a type encoder.

R=rsc
DELTA=400  (287 added, 11 deleted, 102 changed)
OCL=31401
CL=31406
2009-07-09 14:33:43 -07:00
Russ Cox
7472f4c951 bug168 (dsymonds) + fix
R=ken
OCL=31399
CL=31399
2009-07-09 12:08:50 -07:00
Ken Thompson
5ff7d84892 segment fault
R=rsc
OCL=31396
CL=31396
2009-07-09 11:41:06 -07:00
David Symonds
600d7828a7 archive/tar cleanups:
- rename untar{,_test}.go to reader{,_test}.go.
  - fix up some comments.
  - improve test output if it fails.

R=rsc
APPROVED=rsc
DELTA=821  (400 added, 392 deleted, 29 changed)
OCL=31376
CL=31378
2009-07-08 18:31:14 -07:00
Russ Cox
bba278a43b reflection for functions
add channel send type check (thanks austin).
fix type mismatch message.

R=r
DELTA=241  (225 added, 5 deleted, 11 changed)
OCL=31370
CL=31375
2009-07-08 18:16:09 -07:00
Ken Thompson
a68b1da3cc another nil reference
R=rsc
OCL=31373
CL=31373
2009-07-08 17:58:15 -07:00
David Symonds
d6d0a39050 Basic POSIX-compatible tar writer.
R=rsc
APPROVED=rsc
DELTA=456  (382 added, 66 deleted, 8 changed)
OCL=31246
CL=31372
2009-07-08 17:15:18 -07:00
Russ Cox
903d28bd1e ANY is already checked separately,
so remove code from go.y.

show original types in badtype; don't remove pointers.
not sure why this was here but it confuses things
if the bad part involves two named pointer types
with different names but the same pointed-at type.

R=ken
OCL=31369
CL=31369
2009-07-08 16:39:19 -07:00
Russ Cox
5ddaf9a098 reflection for channels
R=r
DELTA=188  (171 added, 6 deleted, 11 changed)
OCL=31352
CL=31361
2009-07-08 15:00:54 -07:00
Robert Griesemer
2ad7958b7e - update functionality for printer test
- moved test files from data to testdata
- use tabs instead of spaces for layout

R=rsc
DELTA=129  (67 added, 60 deleted, 2 changed)
OCL=31353
CL=31360
2009-07-08 14:57:51 -07:00
Robert Griesemer
e7af3b8e05 comment change
R=r
OCL=31359
CL=31359
2009-07-08 14:56:20 -07:00
Robert Griesemer
ff9e657fb3 WriteFile util function
R=rsc
DELTA=41  (41 added, 0 deleted, 0 changed)
OCL=31349
CL=31358
2009-07-08 14:48:09 -07:00
Russ Cox
764b6ec1aa reflection for maps
R=r
DELTA=304  (248 added, 34 deleted, 22 changed)
OCL=31345
CL=31347
2009-07-08 13:55:57 -07:00
Rob Pike
0ae7882b5c bug fix: encOpFor etc. need to indirect
R=rsc
DELTA=28  (7 added, 7 deleted, 14 changed)
OCL=31312
CL=31322
2009-07-07 21:05:24 -07:00
Robert Griesemer
d7f1f53e86 printer_test: first cut
R=rsc
DELTA=169  (168 added, 0 deleted, 1 changed)
OCL=31319
CL=31321
2009-07-07 18:09:26 -07:00
Russ Cox
7c534e1bd2 the ld-supplied typestrings are now obsolete
R=r
DELTA=167  (0 added, 167 deleted, 0 changed)
OCL=31304
CL=31316
2009-07-07 17:35:45 -07:00
Robert Griesemer
9809d73868 - print comments associated with declarations
- fix a bug w/ optional semicolons

R=rsc
DELTA=46  (24 added, 0 deleted, 22 changed)
OCL=31306
CL=31311
2009-07-07 16:07:34 -07:00
Russ Cox
42af80348c method expansion bugs
R=ken
OCL=31310
CL=31310
2009-07-07 16:05:55 -07:00
Austin Clements
17bc836127 Add entry points for parsing statements and expressions.
R=gri
APPROVED=gri
DELTA=73  (48 added, 0 deleted, 25 changed)
OCL=31302
CL=31308
2009-07-07 15:47:01 -07:00
Ian Lance Taylor
668fa7f677 Update the unsafe docs for the new type implementation.
Please correct as needed.

R=rsc,r
DELTA=10  (4 added, 1 deleted, 5 changed)
OCL=31305
CL=31305
2009-07-07 15:06:29 -07:00
Ian Lance Taylor
dbc6d91d70 typestring.c is no longer needed.
R=rsc
DELTA=35  (0 added, 34 deleted, 1 changed)
OCL=31301
CL=31303
2009-07-07 14:50:39 -07:00
Robert Griesemer
61824ff3a4 - ast.FilterExports: filter non-exported anonymous fields
- fixed typo in parser.go
- removed test w/ syntax errors from gofmt test script

R=rsc
DELTA=25  (21 added, 0 deleted, 4 changed)
OCL=31296
CL=31298
2009-07-07 12:02:54 -07:00
Russ Cox
a1b64821f8 bug167
R=ken
OCL=31295
CL=31295
2009-07-07 11:48:22 -07:00
Russ Cox
877839333e gob: use new reflect
R=r
DELTA=242  (68 added, 69 deleted, 105 changed)
OCL=31239
CL=31289
2009-07-07 11:04:42 -07:00
Russ Cox
e37f81b49c template: use new reflect interface (CL 31107)
R=r
DELTA=16  (3 added, 1 deleted, 12 changed)
OCL=31121
CL=31288
2009-07-07 11:04:34 -07:00
Russ Cox
f1bc712035 net: use new reflect interface (CL 31107)
R=r
DELTA=186  (55 added, 8 deleted, 123 changed)
OCL=31117
CL=31287
2009-07-07 11:04:26 -07:00
Russ Cox
1b35969871 json: use new reflect interface (CL 31107)
R=r
DELTA=192  (52 added, 43 deleted, 97 changed)
OCL=31116
CL=31286
2009-07-07 11:04:18 -07:00
Russ Cox
65dbe76532 go/printer: use new reflect interface (CL 31107)
R=gri
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=31115
CL=31285
2009-07-07 11:04:10 -07:00
Russ Cox
b9b32cab58 datafmt: use new reflect interface (CL 31107)
R=gri
DELTA=70  (7 added, 17 deleted, 46 changed)
OCL=31113
CL=31283
2009-07-07 11:03:50 -07:00
Russ Cox
f3ec39d1ea base64_test: use new reflect interface (CL 31107)
R=austin
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=31112
CL=31282
2009-07-07 11:03:40 -07:00
Russ Cox
0d400a7dea fmt: use new reflect interface (CL 31107)
R=r
DELTA=208  (37 added, 63 deleted, 108 changed)
OCL=31111
CL=31281
2009-07-07 11:03:31 -07:00
Russ Cox
64f4e0b197 update reflect supporting functions,
tests to use new reflect interface.

also make tests a real gotest.

depends on CL 31107

R=r
DELTA=582  (56 added, 194 deleted, 332 changed)
OCL=31108
CL=31279
2009-07-07 11:03:12 -07:00
Russ Cox
541e638f9b 6g, 8g: generate data structures for new reflect interface (CL 31107)
R=ken
OCL=31122
CL=31278
2009-07-07 11:03:04 -07:00
Russ Cox
c7513eac88 runtime: use new reflect data structures (CL 31107)
in place of sigi, sigt.

R=ken
OCL=31118
CL=31277
2009-07-07 11:02:54 -07:00
Russ Cox
ce2e450c6b install new reflect:
rename ntype.go and nvalue.go to type.go and value.go

R=r
DELTA=4295  (761 added, 2819 deleted, 715 changed)
OCL=31238
CL=31276
2009-07-07 11:02:44 -07:00
Ian Lance Taylor
5abf395be7 Avoid race condition. Following the left to right rule,
s.output.Data() was being retrieved before the synchronization
point, which meant that it could be retrieved before the
goroutine wrote it.  Using gccgo this caused random errors.

R=gri
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=31046
CL=31267
2009-07-07 10:15:01 -07:00
Russ Cox
27432d67ec move 6c/pgen.c, 6c/pswt.c into cc
and make 5c, 8c use them.

centralizes reachability analysis
and switch generation.

now 8c doesn't have spurious warnings
in pkg/runtime.

R=ken
OCL=31266
CL=31266
2009-07-07 10:07:15 -07:00
Robert Griesemer
8afeb52cac - removed implementation restrictions for creation of small
Natural, Integer, and Rational numbers
- added Value() methods to access small Natural and Integers
  as uint64 or int64 respectively, and to get the components
  of Rational numbers
- fixed a bug with Integer creation
- removed some _'s from names
- added more comments in places
- added test cases

R=rsc
DELTA=184  (127 added, 11 deleted, 46 changed)
OCL=31210
CL=31265
2009-07-07 10:03:42 -07:00
Russ Cox
0417aafe75 insert ODCL in type switch case.
needed for heap allocation if variable escapes.

package main
func main(){
	var i interface{} = 42;
	switch v := i.(type) {
	case int:
		println(&v, v);
	}
}

R=ken
OCL=31245
CL=31245
2009-07-06 23:42:57 -07:00
Russ Cox
0aa1b1508a shift typechecking bugs
x << "a"
	1 << int(2)

R=ken
OCL=31244
CL=31244
2009-07-06 23:33:17 -07:00
Kai Backman
908cd8f857 cleaned up data generation in 5g, reverted 5l handling of D_ADDR.
R=rsc
APPROVED=rsc
DELTA=46  (0 added, 5 deleted, 41 changed)
OCL=31241
CL=31243
2009-07-06 23:04:56 -07:00
David Symonds
52ccdf3510 Add support for v7 tar.
R=rsc
APPROVED=rsc
DELTA=32  (26 added, 4 deleted, 2 changed)
OCL=31172
CL=31242
2009-07-06 22:59:31 -07:00
Russ Cox
2acbc37166 various 6g cleanup:
* give genwrapper and genembedtramp the same signature.
* move duint8, duint16, duint32, duint64, duintptr into gc.
* tidy genwrapper.
* bug involving struct field symbols in signature list.
  (hash-order dependent so hard to trigger)
* new Type print format %#-T like %#T but omits
  names on function arguments.

R=ken
OCL=31237
CL=31237
2009-07-06 22:31:20 -07:00
Russ Cox
74b546aefd statements after panicln are unreachable, just like after panic.
missing break after error.

dot symbol bug fix: leave sym alone
(was incorrect for inserted cross-package dots).

R=ken
OCL=31234
CL=31236
2009-07-06 22:25:54 -07:00
Russ Cox
58c4142e74 new reflect Value implementations.
for now, canSet stays.
i will look into getting rid of it in
a future CL.

R=r
DELTA=420  (419 added, 0 deleted, 1 changed)
OCL=31231
CL=31235
2009-07-06 22:10:40 -07:00
Russ Cox
ef4ddd63f8 another piece for cross-file forward struct declarations.
R=ken
OCL=31233
CL=31233
2009-07-06 21:39:18 -07:00
Russ Cox
a14b28a24d fix bug involving typed nil constants:
interface = (*int)(nil) is not the same as
interface = nil.

package main
func main() {
	var x interface{} = (*int)(nil);
	println(x.(*int));
}

R=ken
OCL=31232
CL=31232
2009-07-06 21:37:29 -07:00
Russ Cox
7af032b87b fix forward struct declarations
R=ken
OCL=31230
CL=31230
2009-07-06 18:05:11 -07:00
Russ Cox
d436a70193 allow conversion to interface type
when implicit assignment would have been okay.

R=ken
OCL=31225
CL=31227
2009-07-06 17:20:48 -07:00
Russ Cox
53ebd163c6 more precise error message
package main

func main() {
       var x interface {} = 42;
       switch x := x.(type) {
       case int:
       case foo:
       }
}

before:
x.go:7: non-type case in type switch
x.go:7: inappropriate case for a type switch

now:
x.go:7: foo: undefined

R=ken
OCL=31221
CL=31221
2009-07-06 16:29:28 -07:00
Russ Cox
a7b4e9f03e new reflect type.go implementation
R=r
DELTA=179  (172 added, 6 deleted, 1 changed)
OCL=31215
CL=31220
2009-07-06 16:06:31 -07:00
Russ Cox
769919c4ee better error message + line numbers
package main
func main() {
       var x interface{};
       switch x {
       case 41:
       case "b":
       }
}

before:
x.go:5: fatal error: exprcmp

now:
x.go:5: illegal types for operand: EQ
	interface { }
	int
x.go:6: illegal types for operand: EQ
	interface { }
	string

R=ken
OCL=31217
CL=31219
2009-07-06 16:05:48 -07:00
Russ Cox
4793400bd1 new reflect library data structures and code declarations
* use structs instead of interfaces
  * compiler lays out data structures ahead of time,
    so no more parsing of strings.
  * unified reflect data structures with interface
    runtime data structures.
  * richer data structures should enable reflection
    on chans and maps, but not implemented here.

R=r,iant
DELTA=1179  (1179 added, 0 deleted, 0 changed)
OCL=31107
CL=31213
2009-07-06 15:34:04 -07:00
Robert Griesemer
4f40f5eaab - bug fix: do not strip lower-case parameter and result names in signatures
- display: show '...' if a struct/interface has fields/methods removed; show
  struct/interface w/o {}'s if all fields/methods were removed; and show the
  {}'s if the struct/interface was empty to begin with

R=rsc
DELTA=41  (36 added, 0 deleted, 5 changed)
OCL=31201
CL=31204
2009-07-06 11:39:48 -07:00
Rob Pike
d3a2925bb2 catch corruption - avoid crash
R=rsc
DELTA=4  (4 added, 0 deleted, 0 changed)
OCL=31192
CL=31198
2009-07-06 10:58:55 -07:00
Robert Griesemer
deb954772d - ast.FilterExports: strips all non-exported nodes from an AST
- use FilterExports instead of the various predicates in printer.go and doc.go
  which simplifies a lot of code and makes it easier to deal with complex cases

R=rsc
DELTA=445  (197 added, 190 deleted, 58 changed)
OCL=31110
CL=31196
2009-07-06 10:37:33 -07:00
Kai Backman
cd4aab62e3 sudoaddable odot
R=rsc
APPROVED=rsc
DELTA=7  (0 added, 1 deleted, 6 changed)
OCL=31189
CL=31191
2009-07-06 09:23:41 -07:00
Russ Cox
6da41be2d3 fix float32 comparison. was doing l op l instead of l op r.
R=ken
OCL=31190
CL=31190
2009-07-06 09:05:33 -07:00
Kai Backman
86987055a3 agen, sgen, cgen_callret, cgen_asop, D_ADDR handling, gmove
8bit and 16bit, some optoas, replaced Addr.index with
Addr.name

empty function compiles, mutex compiles

R=rsc
APPROVED=rsc
DELTA=908  (83 added, 41 deleted, 784 changed)
OCL=31127
CL=31188
2009-07-06 06:42:37 -07:00
Kai Backman
a7735f8a16 fixed bug that cause -g to segfault
R=rsc
APPROVED=rsc
DELTA=48  (30 added, 16 deleted, 2 changed)
OCL=31152
CL=31187
2009-07-06 06:36:25 -07:00
David Symonds
c1edbe9a10 Remove assumption about google.com being the default search domain.
R=rsc
APPROVED=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31151
CL=31168
2009-07-05 15:00:11 -07:00
Ken Thompson
6bb3c48d3d another seg fault
R=r
OCL=31156
CL=31156
2009-07-04 13:59:08 -07:00
Russ Cox
db312fa8de bug163
R=ken
OCL=31149
CL=31149
2009-07-03 13:34:05 -07:00
Rob Pike
3dab3e65d8 put gob into the standard build
R=rsc
DELTA=77  (76 added, 0 deleted, 1 changed)
OCL=31147
CL=31147
2009-07-03 12:54:59 -07:00
Russ Cox
75fe1303c1 maps have == so maps are okay as map keys.
alignment issue is fixed.

R=ken
OCL=31124
CL=31144
2009-07-03 09:44:59 -07:00
Kai Backman
84ded32817 sys.cas for mutex
R=rsc
APPROVED=rsc
DELTA=28  (28 added, 0 deleted, 0 changed)
OCL=31128
CL=31130
2009-07-02 22:05:06 -07:00
Kai Backman
84ef63b9d5 minor comment and debug flag for dumping all oplooks.
R=rsc
APPROVED=rsc
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=31016
CL=31126
2009-07-02 21:35:39 -07:00
Russ Cox
29aa3ffbf6 move Structrnd to runtime.h
R=ken
OCL=31125
CL=31125
2009-07-02 21:25:46 -07:00
Rob Pike
265674fa57 slices
R=rsc
DELTA=59  (44 added, 13 deleted, 2 changed)
OCL=31105
CL=31105
2009-07-02 18:02:42 -07:00
Rob Pike
c1fc4c8f37 indirection on array elements.
R=rsc
DELTA=57  (34 added, 10 deleted, 13 changed)
OCL=31098
CL=31101
2009-07-02 17:21:48 -07:00
Russ Cox
b5666a123a add Uitoa etc.
R=r
DELTA=113  (89 added, 9 deleted, 15 changed)
OCL=31087
CL=31096
2009-07-02 16:57:46 -07:00
Rob Pike
0c33d4353e arrays, not slices, and only with non-pointer elements.
(actually slices encode but do not decode yet)

R=rsc
DELTA=221  (82 added, 65 deleted, 74 changed)
OCL=31095
CL=31095
2009-07-02 16:43:46 -07:00
Rob Pike
29e6eb21ec make a description of the slice header public
R=rsc
DELTA=18  (3 added, 0 deleted, 15 changed)
OCL=31086
CL=31094
2009-07-02 16:28:04 -07:00
Russ Cox
c7a9d9818a fix atoi test
R=r
DELTA=28  (5 added, 0 deleted, 23 changed)
OCL=31093
CL=31093
2009-07-02 16:24:44 -07:00
Robert Griesemer
b70563aa0a - store trailing comments after top-level declarations in ast
- remove a test case w/ syntax errors from test suite

R=rsc
DELTA=104  (44 added, 5 deleted, 55 changed)
OCL=31078
CL=31085
2009-07-02 15:38:36 -07:00
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
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
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
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
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
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
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
Kai Backman
190b5c9ad2 fixes to 5g object file generation. arm specific regalloc.
R=rsc
APPROVED=rsc
DELTA=976  (164 added, 237 deleted, 575 changed)
OCL=30705
CL=30743
2009-06-25 11:01:17 -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
Ken Thompson
466dd8da4e 6g crash re mail from gri jun 18.
R=r
OCL=30719
CL=30719
2009-06-24 17:50:25 -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
Kai Backman
354e61cc52 Fix compile warnings in 5l.
R=rsc
APPROVED=rsc
DELTA=8  (0 added, 0 deleted, 8 changed)
OCL=30692
CL=30695
2009-06-24 11:44:06 -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
Russ Cox
a45c54d1a5 fix gobuild.
errors introduced in CL 30601

R=austin
DELTA=6  (3 added, 0 deleted, 3 changed)
OCL=30663
CL=30665
2009-06-23 16:21:05 -07:00
Russ Cox
0aef57e37f fix a 6g crash after type errors.
do not bother warning about marks left
on stack after syntax errors.

leave OCONV nodes in tree to avoid type errors
arising from multiple walks.

R=ken
OCL=30639
CL=30662
2009-06-23 15:30:59 -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
Russ Cox
bede992dd3 set -e does not apply to ( ) blocks,
so implement the check manually.
sigh.

R=r
DELTA=17  (6 added, 0 deleted, 11 changed)
OCL=30606
CL=30612
2009-06-22 15:43:50 -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
Russ Cox
2fcc8f2fb6 avoid pointer-to-slice operations in gobuild
R=r
DELTA=19  (3 added, 1 deleted, 15 changed)
OCL=30591
CL=30601
2009-06-22 14:24:32 -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
Russ Cox
7f3eb2738f implement new spec language regarding conversions
R=ken
OCL=30519
CL=30534
2009-06-19 14:00:53 -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
05240bb290 use multiline string literal in gobuild
R=r
DELTA=76  (1 added, 0 deleted, 75 changed)
OCL=30497
CL=30510
2009-06-18 16:32:26 -07:00
Ken Thompson
eba82f4391 better diagnostics for eof in a string.
this assumes that embedded newlines are
legal in back-quote strings.

R=r
OCL=30502
CL=30502
2009-06-18 15:49:41 -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
Rob Pike
e15b64e87e clean gofmt
R=rsc
OCL=30363
CL=30363
2009-06-16 14:03:13 -07:00
Rob Pike
6202b0e287 add godoc to clean.bash
R=rsc
OCL=30361
CL=30361
2009-06-16 13:57:08 -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
Robert Griesemer
d8e4446d12 - install gofmt in src/cmd/gofmt
- remove some left-over files

R=rsc
DELTA=1465  (281 added, 1181 deleted, 3 changed)
OCL=30350
CL=30353
2009-06-16 12:03:32 -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
Robert Griesemer
d45442ed65 fix build
R=rsc
DELTA=5  (0 added, 1 deleted, 4 changed)
OCL=30343
CL=30343
2009-06-16 09:39:57 -07:00
Robert Griesemer
f05c04146e forgot to adjust tmproot
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=30342
CL=30342
2009-06-16 09:30:16 -07:00
Robert Griesemer
5071a5a572 move godoc to src/cmd/godoc
R=rsc
DELTA=945  (944 added, 0 deleted, 1 changed)
OCL=30315
CL=30341
2009-06-16 09:14:06 -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
Russ Cox
30a28aec25 b/1909731
package main
func f(a *c.b) {}
func main() {}

BUG=1909731
R=ken
OCL=30322
CL=30322
2009-06-15 20:15:59 -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
Kai Backman
f2201185ab Added ld/go.c functionality into 5l, primarily dead code
removal and typesigs and strings.

Also added new header support to 5c/5a/5l.

R=rsc
APPROVED=rsc
DELTA=98  (66 added, 10 deleted, 22 changed)
OCL=30103
CL=30123
2009-06-09 20:51:53 -07:00
Kai Backman
1faf06eabf make 5g use 1 byte per binary asm statement.
R=rsc
APPROVED=rsc
DELTA=4  (0 added, 4 deleted, 0 changed)
OCL=30110
CL=30112
2009-06-09 11:34:35 -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
David Symonds
b05c6fe23a A basic tar package.
R=rsc
APPROVED=rsc
DELTA=371  (370 added, 0 deleted, 1 changed)
OCL=30029
CL=30084
2009-06-08 23:22:56 -07:00
Russ Cox
01b695dbff mksyscall was treating 64-bit systems as 32-bit,
so 64-bit args like the offset in Seek were being
mishandled.  fix.

R=dsymonds
DELTA=1269  (645 added, 611 deleted, 13 changed)
OCL=30082
CL=30082
2009-06-08 22:10:48 -07:00
Kai Backman
83632c7359 initial morestack support for 5l. still disabled, doesn't work.
R=rsc
APPROVED=rsc
DELTA=245  (167 added, 63 deleted, 15 changed)
OCL=30039
CL=30081
2009-06-08 20:20:35 -07:00
Robert Griesemer
9b480bb78a bug fix: literals can be empty
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=30080
CL=30080
2009-06-08 19:25:26 -07:00
Russ Cox
0f62ac42a4 add new function io.ReadAll
R=gri
DELTA=14  (6 added, 4 deleted, 4 changed)
OCL=30072
CL=30074
2009-06-08 17:22:28 -07:00
Russ Cox
34038e7368 Pad error text for browsers that are too smart.
404 page not found

Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.
Chrome would ignore this error page if this text weren't here.

R=presotto
APPROVED=p
DELTA=50  (50 added, 0 deleted, 0 changed)
OCL=30056
CL=30061
2009-06-08 14:15:13 -07:00
Russ Cox
925183cf1a Add comment.
R=gri
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=30058
CL=30060
2009-06-08 14:09:04 -07:00
Robert Griesemer
eec4991863 - bug fix: no need to add extra '.' when renaming custom formatters
- added corresponding test case

R=rsc
DELTA=10  (7 added, 1 deleted, 2 changed)
OCL=30055
CL=30059
2009-06-08 14:07:20 -07:00
Russ Cox
cd80000d8d add exec example to http triv.go.
fix darwin interrupt bug (race with SIGCHLD).

R=gri
DELTA=46  (40 added, 0 deleted, 6 changed)
OCL=30052
CL=30057
2009-06-08 14:03:21 -07:00
Kai Backman
63c2d52117 Fix Makefile in runtime to create proper /pkg subdir.
R=rsc
APPROVED=rsc
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=30043
CL=30043
2009-06-08 10:38:49 -07:00
Russ Cox
b7f0580274 move src/runtime -> src/lib/runtime;
hand-edited files.

R=r
DELTA=125  (77 added, 16 deleted, 32 changed)
OCL=30001
CL=30008
2009-06-06 22:04:50 -07:00
Russ Cox
3f6acf1120 move src/runtime -> src/lib/runtime;
only automatic g4 mv here.

R=r
OCL=30002
CL=30007
2009-06-06 22:04:39 -07:00
Russ Cox
f52c02641e gzip package
R=dsymonds
DELTA=559  (559 added, 0 deleted, 0 changed)
OCL=29993
CL=30005
2009-06-06 21:56:04 -07:00
Russ Cox
38801e55db flate package
R=dsymonds
DELTA=858  (858 added, 0 deleted, 0 changed)
OCL=29992
CL=30004
2009-06-06 21:51:47 -07:00
Russ Cox
6defc25c83 Publish types PipeReader and PipeWriter
to expose new CloseWithError methods.

R=r
DELTA=161  (72 added, 15 deleted, 74 changed)
OCL=29980
CL=30003
2009-06-06 21:51:05 -07:00
Russ Cox
3c06bd6201 an 8g checkpoint.
needs cleanup, optimizer,
but all.bash works.

R=ken
OCL=29974
CL=30000
2009-06-06 19:28:16 -07:00
Russ Cox
8abcdee175 implement optional semicolons with help from the lexer,
instead of having to double the type and statement grammars.

R=ken
OCL=29987
CL=29998
2009-06-06 19:27:48 -07:00
Russ Cox
e9e388412c 6g: add TODO about float constants back
R=ken
OCL=29984
CL=29997
2009-06-06 19:27:30 -07:00
Russ Cox
25a738234e fix build: testing depends on regexp now; re-ran deps.bash
TBR=r
OCL=29991
CL=29994
2009-06-06 19:03:00 -07:00
David Symonds
0cb585f970 Basic HTTP POST support.
R=rsc
APPROVED=rsc
DELTA=45  (37 added, 1 deleted, 7 changed)
OCL=29964
CL=29990
2009-06-06 17:30:17 -07:00
Russ Cox
8f4af6d205 gc: grammar cleanup:
* no longer distinguishes const, var, type, package names.
  * all the predefined names are not tokens anymore.

R=ken
OCL=29326
CL=29985
2009-06-06 12:46:38 -07:00
Russ Cox
ea33ff4067 delete unnecessary newline
R=gri
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29971
CL=29975
2009-06-06 00:01:47 -07:00
Russ Cox
b28d84f644 8l: add AIMULW
R=ken
OCL=29972
CL=29972
2009-06-05 23:52:43 -07:00
Russ Cox
8720b4721f use cc provided xlog2 instead of system log2.
(on plan 9 cc calls it log2, but that conflicts here.)
the difference is that xlog2 returns -1 on non powers of 2.
8c was rewriting /10 into /8.

R=ken
OCL=29968
CL=29968
2009-06-05 23:12:07 -07:00
Russ Cox
01fe6a9c58 more build refinements:
* use new Make.$GOARCH files in gobuild.
 * rename 6ar to arch-generic gopack.
 * place objects in $GOROOT/pkg/$GOOS_$GOARCH
   (makes cross-compiling easier, and no one
   ever types these paths by hand anyway).

R=r
DELTA=29  (6 added, 8 deleted, 15 changed)
OCL=29923
CL=29967
2009-06-05 22:18:32 -07:00
Russ Cox
b90960e01e rebuilt Makefiles for CL 29923
R=r
DELTA=761  (1 added, 433 deleted, 327 changed)
OCL=29927
CL=29966
2009-06-05 22:18:21 -07:00
Steve Newman
031bf2c88b Add Upper, Lower, Trim methods to strings package.
APPROVED=rsc
DELTA=110  (110 added, 0 deleted, 0 changed)
OCL=29766
CL=29951
2009-06-05 13:09:03 -07:00
Russ Cox
6609d2f88d restructure makefiles, scripts to factor out O= logic.
remove a few hardcoded paths elsewhere too.

R=r,gri
DELTA=123  (44 added, 15 deleted, 64 changed)
OCL=29914
CL=29945
2009-06-05 10:59:55 -07:00
Russ Cox
b014be75d2 fix 386 malloc tests,
detect 386 darwin breakpoint line.

R=r
DELTA=22  (4 added, 0 deleted, 18 changed)
OCL=29929
CL=29944
2009-06-05 10:59:37 -07:00
Russ Cox
4f30ec7fcb fix 386 log test
R=r
DELTA=13  (0 added, 1 deleted, 12 changed)
OCL=29928
CL=29943
2009-06-05 10:59:25 -07:00
Kai Backman
25ac4d07a2 Rolling galign back to 32 bit.
R=rsc
APPROVED=rsc
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=29532
CL=29917
2009-06-04 21:11:55 -07:00
Russ Cox
f6402313d3 don't need these anymore;
R=kaib
DELTA=36  (0 added, 36 deleted, 0 changed)
OCL=29908
CL=29916
2009-06-04 21:10:49 -07:00
Russ Cox
a52fb815e4 386-related fixes and guards
R=r
DELTA=44  (19 added, 1 deleted, 24 changed)
OCL=29912
CL=29915
2009-06-04 21:09:06 -07:00
Russ Cox
2f2577a4f6 bug161, fixed
R=ken
OCL=29907
CL=29907
2009-06-04 16:18:13 -07:00
Robert Griesemer
4019259411 - interpret form feed char as newline + flush
- cleanups:
  - replaced internal byte buffer implementation with io.ByteBuffer (now that we have one)
  - removed all uses of goto statements in favor of structured code
  - converted tests into a table-driven test

R=r
DELTA=277  (48 added, 67 deleted, 162 changed)
OCL=29890
CL=29901
2009-06-04 15:47:57 -07:00
Russ Cox
d30f80bad2 rename -chatty to more conventional -v.
add -match flag to select tests.

gotest -match 'TestDeepEqual$'

R=r
DELTA=13  (12 added, 0 deleted, 1 changed)
OCL=29900
CL=29900
2009-06-04 15:40:28 -07:00
Rob Pike
424f4f0ff5 use the new bytes package
R=rsc
DELTA=61  (8 added, 31 deleted, 22 changed)
OCL=29897
CL=29899
2009-06-04 15:28:09 -07:00
Russ Cox
9a9ffb2b0e more 8g progress.
likely to go back to registers for most temporaries.

most tests in lib pass.  these fail:

	datafmt
	fmt
	go/scanner
	log
	reflect
	strconv
	template

R=ken
OCL=29896
CL=29898
2009-06-04 15:24:01 -07:00
Rob Pike
52e5d061c7 bytes.Copy
R=rsc
DELTA=38  (38 added, 0 deleted, 0 changed)
OCL=29895
CL=29895
2009-06-04 15:00:15 -07:00
Rob Pike
78933226f1 add a bytes package analogous to the strings package.
also has Equal and Compare

R=rsc
DELTA=348  (348 added, 0 deleted, 0 changed)
OCL=29892
CL=29894
2009-06-04 14:41:31 -07:00
Robert Griesemer
bd8495f973 - report an error if format is nil instead of crashing
- treat '\f' like '\n' ('\f' has special meaning in the
  tabwriter now)

R=rsc
DELTA=7  (4 added, 0 deleted, 3 changed)
OCL=29790
CL=29893
2009-06-04 14:31:11 -07:00
Robert Griesemer
becf6222cc allow &^= in assignments
R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=29889
CL=29889
2009-06-04 13:43:19 -07:00
Russ Cox
f30fcf32ac missing darwin files; g4 nothave.
R=r
DELTA=115  (115 added, 0 deleted, 0 changed)
OCL=29884
CL=29888
2009-06-04 13:33:57 -07:00
Russ Cox
4be7067f42 machine-generated files for CL 29882
R=r
DELTA=1652  (1652 added, 0 deleted, 0 changed)
OCL=29883
CL=29887
2009-06-04 13:33:48 -07:00
Russ Cox
802d6d4455 linux 386 support; now in same state as darwin 386
(stuck on 8l bug).

R=r
DELTA=349  (342 added, 1 deleted, 6 changed)
OCL=29882
CL=29886
2009-06-04 13:33:40 -07:00
Russ Cox
f0e6a3caac dangling pointer bug (thanks valgrind)
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29881
CL=29885
2009-06-04 13:33:29 -07:00
Russ Cox
3a0df4c451 more 386 runtime fixes.
can pass many tests;
current stumbling block is an 8l bug.

R=r
DELTA=122  (83 added, 8 deleted, 31 changed)
OCL=29872
CL=29876
2009-06-04 11:16:03 -07:00
Russ Cox
f51ca384eb fix handling of floating point zero constant 0p+0
R=r
DELTA=25  (25 added, 0 deleted, 0 changed)
OCL=29875
CL=29875
2009-06-04 11:06:37 -07:00
Russ Cox
ea7f5505d1 zero struct in T{}
R=ken
OCL=29849
CL=29849
2009-06-03 16:10:13 -07:00
Russ Cox
024c83f2f8 fix build. i would love to know why my other client
didn't see this as a diff.

TBR=r
OCL=29827
CL=29831
2009-06-03 10:18:45 -07:00
David Symonds
e02d3e8ed1 Define os.PageSize and syscall.PageSize.
R=rsc
APPROVED=rsc
DELTA=13  (13 added, 0 deleted, 0 changed)
OCL=29429
CL=29819
2009-06-03 03:25:34 -07:00
Russ Cox
ab3d40b271 trivial cut and paste: move 64-bit simulation into cgen64.c
R=ken
OCL=29812
CL=29812
2009-06-02 23:26:02 -07:00
Russ Cox
a00bfb5b49 8g:
* floating point -> integer conversions.
    x86 defines that overflow/underflow
    results in 1<<15, 1<<31, 1<<63 for
    int16, int32, int64.  when building the
    unsigned conversions out of the native signed
    ones, 8g turns overflow/underflow into zero.
    the spec does not say what should happen.

  * many tiny bug fixes.  can run a large number
    of files from go/test now, and can fmt.Printf.

  * struggling with byte register allocation
    and float32 computation.

R=ken
OCL=29642
CL=29811
2009-06-02 23:25:17 -07:00
Russ Cox
7f9d2c8264 mechanically-generated syscall files
R=r
DELTA=1615  (1615 added, 0 deleted, 0 changed)
OCL=29803
CL=29810
2009-06-02 23:22:25 -07:00
Russ Cox
73c10dd967 386 library updates
R=r
DELTA=161  (153 added, 0 deleted, 8 changed)
OCL=29802
CL=29809
2009-06-02 23:22:12 -07:00
Russ Cox
f1f970ad21 minor cleanup, 64-bit /= and %= on 32-bit
R=ken
OCL=29806
CL=29808
2009-06-02 23:21:58 -07:00
Russ Cox
69623890cc for consistency with syscall, rename files
from GOARCH_GOOS -> GOOS_GOARCH.

update os_test and add test of Time.

R=r
DELTA=490  (247 added, 233 deleted, 10 changed)
OCL=29730
CL=29805
2009-06-02 23:02:20 -07:00
Russ Cox
aa3222d88f 32-bit fixes in lessstack.
avoid tight coupling between deferreturn and jmpdefer.
before, jmpdefer knew the exact frame size of deferreturn
in order to pop it off the stack.  now, deferreturn passes
jmpdefer a pointer to the frame above it explicitly.
that avoids a magic constant and should be less fragile.

R=r
DELTA=32  (6 added, 3 deleted, 23 changed)
OCL=29801
CL=29804
2009-06-02 23:02:12 -07:00
Russ Cox
07393f8706 8l fixes, cut and paste from 6l.
move PtrSize value into 6l/8l files.

R=r
DELTA=78  (47 added, 15 deleted, 16 changed)
OCL=29729
CL=29798
2009-06-02 22:33:21 -07:00
David Symonds
bf0a339bf3 Add container/list package.
This is imported from //cacheserving/gash/cache/list*.go,
but with style changes to suit the Go standard library.

R=r,rsc
APPROVED=r
DELTA=286  (286 added, 0 deleted, 0 changed)
OCL=29438
CL=29796
2009-06-02 20:26:14 -07:00
Robert Griesemer
aa9ce6148a change datafmt syntax to use '@' instead of '^' (to match
convention used in template.go)

R=rsc
DELTA=22  (3 added, 1 deleted, 18 changed)
OCL=29780
CL=29782
2009-06-02 18:03:47 -07:00
Robert Griesemer
43456b4a7a remove superfluous indirection
R=rsc
DELTA=7  (0 added, 0 deleted, 7 changed)
OCL=29776
CL=29778
2009-06-02 17:47:20 -07:00
Robert Griesemer
8083467d62 - renamed format -> datafmt
- factored out datafmt-specifics from pretty to ast

R=rsc
DELTA=3580  (1810 added, 1763 deleted, 7 changed)
OCL=29770
CL=29774
2009-06-02 17:18:27 -07:00
Steve Newman
da0a582564 Fixes to URL functionality:
- Extend http.URLUnescape to convert '+' to space
- Add http.URLEscape
- Rename URL.Query to EncodedQuery (and stop decoding it, as decoding this field
  before separating key/value pairs loses important information)
- Report a clean error on incomplete hex escapes
- Update existing tests, add new ones

APPROVED=rsc
DELTA=293  (256 added, 3 deleted, 34 changed)
OCL=29685
CL=29759
2009-06-02 12:48:18 -07:00
Russ Cox
e11f833bed auto-generated, renamed, and deleted files
associated with CL 29709.

R=r
DELTA=6444  (3476 added, 2958 deleted, 10 changed)
OCL=29710
CL=29724
2009-06-01 22:15:08 -07:00
Russ Cox
602a446b74 new syscall package: manually maintained files and scripts.
auto-generated files and deletions are in another CL.

goals for new syscall:
	* automate as much as possible
	* do not let clients do unsafe things
	* use simple types (int not int64)
	* fewer files

the files are renamed from foo_amd64_linux to foo_linux_amd64,
both because it reads better (all the linux are related, all the amd64 less so)
and because it made it easier to replace the existing ones.

R=r
DELTA=2336  (2260 added, 6 deleted, 70 changed)
OCL=29709
CL=29723
2009-06-01 22:14:57 -07:00
Russ Cox
9e0fec9c9c update Go tree to use new syscall package.
R=r
DELTA=713  (109 added, 386 deleted, 218 changed)
OCL=29707
CL=29722
2009-06-01 22:14:39 -07:00
Russ Cox
278b1ab053 make godefs work better for generating Go.
R=r
DELTA=121  (92 added, 4 deleted, 25 changed)
OCL=29706
CL=29721
2009-06-01 22:14:25 -07:00
Robert Griesemer
d7acfc75cd format package
R=r,rsc
DELTA=2871  (1712 added, 1118 deleted, 41 changed)
OCL=29222
CL=29704
2009-06-01 19:13:44 -07:00
Robert Griesemer
2494bcb4b1 - enable scanner to handle illegal chars w/o returning an error
so that it can be used for non-Go chars
- adjust parser accordingly

R=rsc
DELTA=58  (42 added, 2 deleted, 14 changed)
OCL=29688
CL=29703
2009-06-01 19:12:10 -07:00
Robert Griesemer
34d12bfbae io.ReadFile
R=r,rsc
DELTA=64  (63 added, 0 deleted, 1 changed)
OCL=29702
CL=29702
2009-06-01 19:00:07 -07:00
Ken Thompson
c17ce9f94f prevent multiple similar errors
in complex literals. side effect is
fix of error in initializerr.go

R=r
OCL=29667
CL=29667
2009-05-31 13:02:24 -07:00
Russ Cox
d6a9817051 bug157
R=ken
OCL=29651
CL=29653
2009-05-30 21:18:15 -07:00
Ken Thompson
be63b6dc44 bug 158
R=r
OCL=29646
CL=29646
2009-05-30 17:06:51 -07:00
Russ Cox
91395ae689 make gobuild failures more readable.
1. ar reports names of objects with duplicate text symbols.
2. gobuild only shows first line of error output for each failed command.
3. gobuild ignores files that begin with ascii non-alphanumeric non _.

; gobuild
$ 6g -I _obj gobuild.go
  gobuild.go:150: PackageImports: undefined
$ 6g -I _obj makefile.go
  makefile.go:102: ShellString: undefined
$ 6g -I _obj util.go
  util.go:114: syntax error near zzz
gobuild: stalemate
;

; gobuild
$ 6ar grc _obj/gobuild.a util.6 util1.6
  duplicate text symbol: util1.6 and util.6: gobuild·Build
$ 6g -I _obj gobuild.go
  gobuild.go:150: PackageImports: undefined
$ 6g -I _obj makefile.go
  makefile.go:102: ShellString: undefined
gobuild: stalemate
;

R=r
DELTA=95  (49 added, 9 deleted, 37 changed)
OCL=29625
CL=29640
2009-05-29 18:12:04 -07:00
Ken Thompson
fbcbcdbb1d bug 156
R=r
OCL=29623
CL=29623
2009-05-29 15:34:47 -07:00
Ken Thompson
1c7bee0567 bug 155
R=r
OCL=29619
CL=29619
2009-05-29 14:42:24 -07:00
Ken Thompson
3b37b02834 bug 149
R=r
OCL=29612
CL=29612
2009-05-29 13:44:30 -07:00
Russ Cox
47fe18bf36 Fix godoc deadlock.
The code was already careful not to use malloc/free
for stack growth during calls to malloc.
Avoid them during calls to free too.

R=r
DELTA=9  (7 added, 0 deleted, 2 changed)
OCL=29606
CL=29610
2009-05-29 13:31:53 -07:00
Russ Cox
5d1d8a8258 integer conversions and test.
R=ken
OCL=29577
CL=29589
2009-05-29 09:17:35 -07:00
Russ Cox
6e1762c06e 64-bit integer arithmetic.
passes ridiculous test from CL 29569.

R=ken
OCL=29571
CL=29573
2009-05-29 00:13:09 -07:00
Russ Cox
0a6d83567e print uint64 as uint64.
R=ken
OCL=29568
CL=29570
2009-05-28 22:24:03 -07:00
Ken Thompson
e2613711aa detect recursive initialization
R=r
OCL=29544
CL=29544
2009-05-28 16:00:55 -07:00
Russ Cox
3aa006b8cd better 64-bit handling in 8g.
fewer moves, fewer stupid LEALs.
powser1 runs (with evaln commented out).
beginnings of floating point.

R=ken
OCL=29540
CL=29543
2009-05-28 15:48:47 -07:00
Kai Backman
63e1b714de Rebooted 5g effort from 6g. Tons of minor fixes and tweaks to
get the code going.

R=rsc
APPROVED=rsc
DELTA=4752  (1723 added, 948 deleted, 2081 changed)
OCL=29403
CL=29530
2009-05-28 14:25:54 -07:00
Kai Backman
97fe55720d Change 5l to use Biobufs for IO.
R=rsc
APPROVED=rsc
DELTA=132  (16 added, 45 deleted, 71 changed)
OCL=29468
CL=29497
2009-05-28 07:41:23 -07:00
Russ Cox
e81d97ea84 clean up gmove:
* conversions all in one place.
	* no separate load, store phases;
	  direct memory addressing when possible
	  (this is the x86 after all!).
	  avoids extra registers, extra MOVQs.
	* fixes int32 -> uint64 bug
	  (was zero-extending)

R=ken
OCL=29482
CL=29484
2009-05-27 23:55:14 -07:00
Ken Thompson
b3f303ec9a bug 153
R=r
OCL=29479
CL=29479
2009-05-27 18:37:02 -07:00
Russ Cox
5e53270a6c attach package comment
R=r
DELTA=1  (0 added, 1 deleted, 0 changed)
OCL=29473
CL=29477
2009-05-27 18:20:26 -07:00
Ken Thompson
77f668a0f1 added protection against race condition
between first and second pass of converting
[]int to string.

R=r
OCL=29467
CL=29467
2009-05-27 15:56:44 -07:00
Ken Thompson
64c3fe05bf string([]int) conversion
R=r
OCL=29466
CL=29466
2009-05-27 15:38:02 -07:00
Russ Cox
18890eebbf fix bug154; tweak bug153 exit status
R=ken
OCL=29448
CL=29448
2009-05-27 10:16:13 -07:00
Russ Cox
5f460b38f9 getrusage on darwin; untested but builds.
R=dsymonds
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=29424
CL=29447
2009-05-27 10:05:23 -07:00
Russ Cox
51bb8795cd 8g: missing change from last CL
R=ken
OCL=29426
CL=29426
2009-05-26 21:11:31 -07:00
Russ Cox
a8e4ed6a3d 8g: 64-bit arithmetic and assorted bug fixes;
can run 64-bit sieve and powser.
interfaces are limping along.
next hurdle is floating point.

R=ken
OCL=29418
CL=29423
2009-05-26 21:07:26 -07:00
David Symonds
afba16f469 Getrusage for linux.
R=rsc
APPROVED=rsc
DELTA=40  (38 added, 0 deleted, 2 changed)
OCL=29351
CL=29422
2009-05-26 20:38:57 -07:00
Ken Thompson
b46e7c4d3c bug 152
R=r
OCL=29419
CL=29419
2009-05-26 19:48:39 -07:00
Russ Cox
1a0a6f9d50 add NUL when allocating strings, to make use
of getenv by low-level runtime easier.
fix 32-bit bug in gc (there are still more).

R=ken
OCL=29415
CL=29415
2009-05-26 17:39:25 -07:00
Russ Cox
7d73075511 darwin support for 32-bit debugging
R=r
DELTA=129  (78 added, 1 deleted, 50 changed)
OCL=29411
CL=29413
2009-05-26 17:20:57 -07:00
Russ Cox
5273868f67 32-bit stack switching bug fix
R=ken
OCL=29412
CL=29412
2009-05-26 17:13:39 -07:00
Ken Thompson
51ddddc67e bug 151
R=r
OCL=29409
CL=29409
2009-05-26 16:30:35 -07:00
Russ Cox
5ecd010beb more 8g.
test/turing.go runs if you move the big array off its stack.

finally remembered to g4 add cgen.c gsubr.c

R=ken
OCL=29408
CL=29408
2009-05-26 16:23:54 -07:00
Ken Thompson
850cd6a2fe bug 150
R=r
OCL=29405
CL=29405
2009-05-26 15:56:37 -07:00
Russ Cox
021abfbd28 8g: hello world works again
* string format changed
	* files got renamed
	* new files that i forgot to check in last time
updates are all copy and paste from 6g

R=ken
OCL=29385
CL=29400
2009-05-26 14:46:06 -07:00
Russ Cox
1f0f2e44a9 6ar: explain why __.SYMDEF didn't get put in.
people using ar for non-object archives
will just have to deal with the warnings.

R=r
DELTA=3  (2 added, 0 deleted, 1 changed)
OCL=29384
CL=29398
2009-05-26 14:34:32 -07:00
Kai Backman
3c7a1ef208 Added automatic detection of system libraries to 5l.
R=rsc
APPROVED=rsc
DELTA=83  (73 added, 3 deleted, 7 changed)
OCL=29276
CL=29382
2009-05-26 12:14:55 -07:00
Kai Backman
7943556970 Added enough arm related scaffolding to create a simple
hello.c program linking against the runtime.

R=rsc
APPROVED=rsc
DELTA=178  (175 added, 0 deleted, 3 changed)
OCL=29283
CL=29380
2009-05-26 11:18:42 -07:00
Ken Thompson
802e1a6104 static init reenabled
R=r
OCL=29358
CL=29358
2009-05-25 19:40:41 -07:00
David Symonds
ce5bcbe37f Add os.Getpid and os.Getppid.
R=rsc
APPROVED=rsc
DELTA=11  (11 added, 0 deleted, 0 changed)
OCL=29352
CL=29357
2009-05-25 14:38:38 -07:00
David Symonds
5a12b1828d Add exvar.FuncInt for exporting indirect integer variables.
R=r
APPROVED=r
DELTA=21  (21 added, 0 deleted, 0 changed)
OCL=29320
CL=29338
2009-05-24 15:04:43 -07:00
David Symonds
bef1a6439d If Make.deps is not writable (e.g. in Perforce client and not opened for editing), bail out immediately.
R=rsc,r
APPROVED=r
DELTA=7  (5 added, 1 deleted, 1 changed)
OCL=29319
CL=29319
2009-05-23 19:39:25 -07:00
Ken Thompson
798b19bf77 improvement in registerization
R=r
OCL=29317
CL=29317
2009-05-23 16:36:43 -07:00
Ken Thompson
4238b18344 1. check for dups in complex literals
structtype{a:1, a:2}
   maptypetype{"xx":1, "xx":2}
   arraytypetype{5:1, 5:2}
2. bug in registerization concerning
   alias of a struct and one of its elements
3. code optimization of struct.field
   (which exposed bug in 2)

R=r
OCL=29315
CL=29315
2009-05-23 15:34:29 -07:00
Rob Pike
368b42103e add crypto/hmac to makefile
R=rsc
DELTA=4  (3 added, 0 deleted, 1 changed)
OCL=29314
CL=29314
2009-05-23 13:53:36 -07:00
Russ Cox
b3de351681 update Make.deps
R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=29305
CL=29308
2009-05-22 23:30:48 -07:00
Russ Cox
224b89cafa typo in hmac comment
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29307
CL=29307
2009-05-22 23:30:31 -07:00
Russ Cox
4beac9985b simplifying grammar: delete LBASETYPE and LACONST.
take 2

R=ken
OCL=29304
CL=29306
2009-05-22 22:46:06 -07:00
Russ Cox
ca2fe5d8bd Automated g4 rollback of changelist 29302.
*** Reason for rollback ***

too many files included

*** Original change description ***

simplifying grammar: delete LBASETYPE and LACONST

R=ken
OCL=29303
CL=29303
2009-05-22 22:43:57 -07:00
Russ Cox
2a4dcfffc9 simplifying grammar: delete LBASETYPE and LACONST
R=ken
OCL=29300
CL=29302
2009-05-22 22:42:12 -07:00
Russ Cox
b112d42ad6 add hmac.NewSHA1 and hmac.NewMD5.
fix Reset bug in sha1.
add hmac, sha1, md5 tests.
document hmac.

R=r
DELTA=146  (111 added, 6 deleted, 29 changed)
OCL=29294
CL=29299
2009-05-22 22:40:26 -07:00
Russ Cox
da59dd41c2 simple logging shim reader and writers
R=r
DELTA=53  (52 added, 0 deleted, 1 changed)
OCL=29295
CL=29298
2009-05-22 22:40:08 -07:00
Russ Cox
99128fc7ab move pretty/comment.go into go/doc.
extract comment text code out of go/doc/doc.go into comment.go.
no code changes, just rearrangement.

first step so i can write tests.

R=gri
DELTA=633  (318 added, 301 deleted, 14 changed)
OCL=29269
CL=29293
2009-05-22 21:42:16 -07:00
Kai Backman
9c6fd4c144 Added support for .5 files in libmach_64. Copied 5obj.c from
plan9 libmach.

R=rsc
APPROVED=rsc
DELTA=142  (139 added, 3 deleted, 0 changed)
OCL=29281
CL=29281
2009-05-22 16:29:22 -07:00
Russ Cox
76f2a9fa48 md5 Reset fix; preliminary hmac
TBR=r
OCL=29279
CL=29279
2009-05-22 15:44:29 -07:00
Kai Backman
9a2a2474c6 Force usage of dollar signs to circumvent arm-gcc balking at them.
R=rsc
APPROVED=rsc
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=29275
CL=29278
2009-05-22 15:32:43 -07:00
Robert Griesemer
531e3fe311 - fix regexp once more in doc.go:
comment markers must only be stripped if they are
  at the very beginning otherwise comments that contain
  code with comments get screwed up (the ast delivers clean
  comments with no junk before or after)

- fix indentation in google/net/rpc/rpc.go which screwed up
  godoc formatting

R=rsc
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=29223
CL=29267
2009-05-22 12:40:56 -07:00
Robert Griesemer
fad7791b07 fix regexp to strip comment markers
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29221
CL=29221
2009-05-21 20:29:22 -07:00
Robert Griesemer
ad8527c4dc adjustments for relaxed composite literal syntax
R=r
DELTA=41  (0 added, 21 deleted, 20 changed)
OCL=29219
CL=29219
2009-05-21 19:50:25 -07:00
Russ Cox
f4d3d22a94 enforce channel direction
R=ken
OCL=29209
CL=29216
2009-05-21 17:32:44 -07:00
Russ Cox
a3c17d58df channel direction fixes
R=dsymonds
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=29210
CL=29215
2009-05-21 17:31:13 -07:00
Russ Cox
c2fa45b973 allow type name as key to accomodate anonymous fields.
update tests.

R=ken
OCL=29207
CL=29207
2009-05-21 16:31:10 -07:00
Ken Thompson
bba10b3f49 some array init bugs
renamed 6g/(gen|align|obj).c

R=r
OCL=29205
CL=29205
2009-05-21 15:44:06 -07:00
Russ Cox
f96662324e related reflect bug: make copies of big values
so that callers cannot edit large values inside interfaces.

R=r
DELTA=52  (42 added, 1 deleted, 9 changed)
OCL=29180
CL=29195
2009-05-21 14:06:43 -07:00
Russ Cox
8b6b380605 stricter rules for assignment.
when assigning a multifield object
(structs or arrays of structs) they
must not contain any fields that could
not be assigned individually.

R=ken
OCL=29192
CL=29194
2009-05-21 14:06:24 -07:00
Ken Thompson
a016081f43 added key:val extension to
structure and array literals

R=r
OCL=29190
CL=29190
2009-05-21 13:46:07 -07:00
Russ Cox
f2dfc55f34 I guess I forgot there was a unary ^ operator.
R=r
DELTA=3  (0 added, 1 deleted, 2 changed)
OCL=29151
CL=29176
2009-05-21 11:52:20 -07:00
Russ Cox
96cfd154d8 direct all interface extraction to InterfaceValue.Get.
delete unnecessary reflect. throughout

R=r
DELTA=124  (18 added, 0 deleted, 106 changed)
OCL=29173
CL=29175
2009-05-21 11:50:20 -07:00
Russ Cox
fb5aa46e65 fix build again; this time for sure.
(this time i ran g4 nothave)

TBR=r
OCL=29156
CL=29156
2009-05-21 06:54:00 -07:00
Russ Cox
ff45e7bcbd missed Makefile before; fix build
TBR=dsymonds
OCL=29155
CL=29155
2009-05-21 06:49:56 -07:00
Russ Cox
23e62d169f stricter interface conversion rule: i.(T)
must have non-nil i.

R=ken
OCL=29136
CL=29136
2009-05-20 18:23:19 -07:00
Russ Cox
140aed9ab7 hash reorg.
* new package hash defining interfaces Hash and Hash32.
* adler32 and crc32 return Hash32 instead of specific types.
* adler32 and crc32 provide non-allocating methods for single slices.
* sha1 and md5 move to crypto, return Hash.
* sum.go, a simple test program, moves to /usr/rsc.
* refresh Make.deps

R=r
DELTA=1908  (935 added, 923 deleted, 50 changed)
OCL=29095
CL=29135
2009-05-20 18:16:38 -07:00
Russ Cox
2d5d4a1b41 reflect bug: NewZeroValue was refusing to create slices.
as far as I can tell there's no reason not to.

the Nillable test was succeeding because NewZeroValue
returned the nil interface value and the type guard
was letting it through.  the only change in the test is
more detail in the print.

R=r
DELTA=8  (0 added, 7 deleted, 1 changed)
OCL=29124
CL=29126
2009-05-20 15:42:14 -07:00
Russ Cox
a39bae095a ifaceop was being called with integers
that came from two different enums.
spilt into ifacecvt and ifaceop depending
on which enum the argument is.

R=ken
OCL=29122
CL=29122
2009-05-20 15:09:50 -07:00
Russ Cox
2da5022bcf change representation of interface values.
this is not a user-visible change.

before, all interface values were

	struct Itype {
		Sigt *type;
		Sigi *inter;
		void *method[n];
	}

	struct Iface {
		void *addr;
		Itype *itype;
	}

the itype is basically a vtable, but it's unnecessary
if the static type is interface{ }.
for interface values with static type empty, the
new representation is

	struct Eface {
		void *addr;
		Sigt *type;
	}

this complicates the code somewhat, but
it reduces the number of Itypes that
have to be computed and cached,
it opens up opportunities to avoid function
calls in a few common cases,
and it will make it possible to lay out
interface{} values at compile time,
which i think i'll need for the new reflection.

R=ken
OCL=28701
CL=29121
2009-05-20 14:57:55 -07:00
Russ Cox
47e5152790 fix implicit star for range on *map, *[].
do not update lineno from ONAME nodes,
	because they have declaration lineno not use.
show actual name in top-level statement error.

before
runtime.a:7: x.go:5: walkstate: NAME not a top level statement

after
x.go:14: walkstate: runtime.Goexit not a top level statement

R=ken
OCL=29113
CL=29116
2009-05-20 14:24:23 -07:00
Russ Cox
04d8605c21 clear out pkg tree in clean.bash.
rename place-holder to _place_holder_ so it can be avoided.

R=r
DELTA=5  (2 added, 2 deleted, 1 changed)
OCL=29093
CL=29097
2009-05-20 11:12:05 -07:00
Robert Griesemer
1b3b51f7db more useful error string
R=r
DELTA=5  (4 added, 0 deleted, 1 changed)
OCL=29088
CL=29090
2009-05-20 11:02:12 -07:00
Russ Cox
02f13e4764 build crypto/block.
deps.bash tweak.

R=r
DELTA=95  (95 added, 0 deleted, 0 changed)
OCL=29046
CL=29059
2009-05-19 15:42:00 -07:00