1
0
mirror of https://github.com/golang/go synced 2024-09-25 13:20:13 -06:00
Commit Graph

414 Commits

Author SHA1 Message Date
Austin Clements
7c9b9af76e Convert interpreter to whole-package compilation.
R=rsc
APPROVED=rsc
DELTA=334  (110 added, 211 deleted, 13 changed)
OCL=33135
CL=33137
2009-08-12 17:24:05 -07:00
Austin Clements
ceaa7741a2 Convert ptrace to whole-package compilation.
R=rsc
APPROVED=rsc
DELTA=15  (9 added, 6 deleted, 0 changed)
OCL=33136
CL=33136
2009-08-12 17:22:47 -07:00
Russ Cox
5b62b19d43 convert non-pkg go files to whole-package compilation.
mostly removing forward declarations.

R=r
DELTA=138  (2 added, 127 deleted, 9 changed)
OCL=33068
CL=33099
2009-08-12 13:18:54 -07:00
Austin Clements
64193fcaa2 Implement switch statement. Can now extract effects from
non-addressable expressions.

R=rsc
APPROVED=rsc
DELTA=241  (202 added, 15 deleted, 24 changed)
OCL=32790
CL=32995
2009-08-10 16:27:54 -07:00
Austin Clements
e2e6becf3a Make ptrace_linux compile with recent changes to switch type
checking.

R=rsc
APPROVED=rsc
DELTA=11  (0 added, 0 deleted, 11 changed)
OCL=32839
CL=32841
2009-08-06 13:54:13 -07:00
Austin Clements
6adadeb3ab Implement struct types, selector expressions, and type
declarations.

R=rsc
APPROVED=rsc
DELTA=587  (519 added, 21 deleted, 47 changed)
OCL=32754
CL=32788
2009-08-05 11:49:51 -07:00
Austin Clements
458e23e151 Implement type compatibility and fix places where I thought
types were supposed to be identical but only needed to be
compatible.  This gets rid of the Type.literal method.  I
renamed the Type.rep method to Type.lit because I believe it
corresponds to the term "literal" as used in the spec.

R=rsc
APPROVED=rsc
DELTA=228  (57 added, 35 deleted, 136 changed)
OCL=32606
CL=32608
2009-07-31 17:11:34 -07:00
Austin Clements
d11173d452 Implement var declarations. Variables, constants, and types now carry
the position where they were defined so I can produce good
error messages on redefinitions.

R=rsc
APPROVED=rsc
DELTA=204  (126 added, 13 deleted, 65 changed)
OCL=32599
CL=32605
2009-07-31 15:51:27 -07:00
Austin Clements
36ca5fde68 Implement labels, goto, labeled break, and labeled continue.
Return checking is now done as a general flow check at the end
of function compilation, since break and goto complicated the
way I was doing return checking before.  Goto-over-declaration
checking is also done as a final flow check.

Temporary variables used for effect extraction are now
actually temporary.  Otherwise "op=", "++", and "--" appear as
declarations that cannot be jumped over.

R=rsc
APPROVED=rsc
DELTA=421  (344 added, 38 deleted, 39 changed)
OCL=32527
CL=32535
2009-07-30 14:39:27 -07:00
Austin Clements
8f694f6661 Flatten the Frame tree. Now each function call produces a
single frame and non-overlapping variables reuse frame slots.
As a result, entering and exiting blocks no longer requires
code execution, which means jumps across block boundaries
should be doable now.  Frame slot initialization happens at
definition time now, instead of at frame creation time.  As an
added bonus, Scope's are now exclusively compile-time objects
and we no longer need to specially track the function
activation frame for access to out vars.

R=rsc
APPROVED=rsc
DELTA=313  (102 added, 90 deleted, 121 changed)
OCL=32416
CL=32420
2009-07-29 11:57:46 -07:00
Austin Clements
27b0c351af Implement comparison operators.
R=rsc
APPROVED=rsc
DELTA=304  (281 added, 0 deleted, 23 changed)
OCL=32361
CL=32382
2009-07-28 16:40:23 -07:00
Austin Clements
f62585118c Fix segfault on unnamed function arguments. Make continue
jump to the post statement instead of the condition check.

R=rsc
APPROVED=rsc
DELTA=10  (6 added, 1 deleted, 3 changed)
OCL=32359
CL=32379
2009-07-28 16:38:41 -07:00
Austin Clements
709e75e3a1 Implement if, for (modulo ranges), break, continue, increment,
and decrement.  blockCompilers now form a tree the mimics the
nesting of scopes and provide convenient ways to enter and
exit scopes.  blockCompilers also track the break and continue
PC for the current block.  The statement testing interface now
works in lists of statements, which simplifies a bunch of
things.

R=rsc
APPROVED=rsc
DELTA=401  (335 added, 44 deleted, 22 changed)
OCL=32308
CL=32317
2009-07-28 14:37:06 -07:00
Phil Pennock
d6f89c69c4 Support use of $GOBINDIR to override $HOME/bin
R=r,gri,rsc
APPROVED=rsc
DELTA=53  (12 added, 6 deleted, 35 changed)
OCL=31822
CL=32282
2009-07-28 11:23:24 -07:00
Austin Clements
eaa25ac16b Fix bug where typeArrayMap was using the address of the
pointer to the Type instead of the address of the Type.

R=rsc
APPROVED=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=32265
CL=32279
2009-07-28 09:58:31 -07:00
Austin Clements
75760a4b5d Implement multi-valued functions, multi-valued return, and
unpacking for assignments, call arguments, and returns.  This
change revamps the whole assignment compilation system to be
multi-valued, using the new MultiType type and multiV value.
Function calls, returns, and assignments now share a lot of
code and produce very consistent error messages.

R=rsc
APPROVED=rsc
DELTA=510  (335 added, 74 deleted, 101 changed)
OCL=32248
CL=32258
2009-07-27 17:32:35 -07:00
Austin Clements
33c1045056 Fix bug where nothing could ever be added to a code buffer.
R=rsc
APPROVED=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=32245
CL=32247
2009-07-27 15:21:32 -07:00
Austin Clements
d3888fe8a3 Implement single-valued, non-variadic function literals and
function calling.  Implement a type compiler and named types.
Implement a universal scope containing built-in named types,
and some built-in constants.  Implement a simple virtual
machine for executing statements and single-valued return.

Fix many places that incorrectly dealt with named types.  In
particular, the Type.Zero methods now use the type's bit count
to determine the appropriate value representation.  As a
result, a bit count of 0 now means architecture-dependent and
bounded types use unsafe.Sizeof to determine the correct
bounds.  Previously, the bounds on a 32-bit machine would have
been wrong.

Eliminated Type.compatible, since the implementation is
equivalent for all types.  Added Type.rep that shallowly
strips named types.  Replaced almost all uses of Type.literal
with Type.rep.

Fix implementation of assign-op's so it only evaluates the
left side once.  As part of this, there is now a generic way
to separate out the effect and value of an expression.

R=rsc
APPROVED=rsc
DELTA=1530  (1244 added, 68 deleted, 218 changed)
OCL=32184
CL=32230
2009-07-27 13:01:23 -07:00
Austin Clements
d426b6389e Implement assignment. Move convertTo.
R=rsc
APPROVED=rsc
DELTA=591  (497 added, 76 deleted, 18 changed)
OCL=31933
CL=31955
2009-07-21 15:40:41 -07:00
Austin Clements
90ffb7b8f5 Cleanup of Type/Value interface. Add Type.ZeroVal, replace
all type-specific value functions, and use ZeroVal to create
new frames.  Remove Value.Type; it was unused and difficult
for values with composite types.  Add Value.Assign methods.

R=rsc
APPROVED=rsc
DELTA=282  (135 added, 90 deleted, 57 changed)
OCL=31894
CL=31930
2009-07-21 13:31:23 -07:00
Austin Clements
79fac7ca86 Implement array types and index expressions.
Some cleanup.  Elem() on PtrType is now just Elem and matches
with ArrayType.  Generators now switch over the result type
instead of the operand type.  Delete unused diag function.

R=rsc
APPROVED=rsc
DELTA=281  (219 added, 18 deleted, 44 changed)
OCL=31876
CL=31891
2009-07-20 17:41:40 -07:00
Austin Clements
51c0a84175 Gather errors in a go.scanner.ErrorList instead of printing
them as we go.

Lots of bug fixes.  Let the parser toss illegal character and
string literals.  Compile unary + correctly.  Allow float OP
ideal.  Compile unary * correctly.  Implement min and max float
values.

R=rsc
APPROVED=rsc
DELTA=64  (29 added, 7 deleted, 28 changed)
OCL=31811
CL=31814
2009-07-17 16:58:59 -07:00
Austin Clements
2ac1528e55 Finish shift implementation for ideals.
R=rsc
APPROVED=rsc
DELTA=65  (29 added, 17 deleted, 19 changed)
OCL=31775
CL=31777
2009-07-17 11:50:32 -07:00
Austin Clements
b751be4cf5 Cleanup func literals. "func (" -> "func("
R=rsc
APPROVED=rsc
DELTA=41  (0 added, 0 deleted, 41 changed)
OCL=31773
CL=31773
2009-07-17 10:45:53 -07:00
Austin Clements
96e844393e Implement all unary and binary arithmetic operators.
R=rsc
APPROVED=rsc
DELTA=689  (497 added, 169 deleted, 23 changed)
OCL=31755
CL=31772
2009-07-17 10:38:44 -07:00
Austin Clements
1902283053 Fix handling of non-waitable zombie threads. Now they are not
considered running, so WaitStop doesn't lock up and
breakpoints get installed and uninstalled.  We also don't try
to detach from them, since that will fail.

R=rsc
APPROVED=rsc
DELTA=35  (26 added, 2 deleted, 7 changed)
OCL=31683
CL=31731
2009-07-16 09:48:37 -07:00
Austin Clements
816e3da26d Make Value always represent an l-value and never a generic
container for values.

Instead of having one evaluator function that returns a
generic Value, there is now an evaluator function for each
generalized type that simply returns a native type.

The compiler is more type-safe now because there are almost no
type conversions at evaluation time and it's impossible to
invoke a nil evaluator function during evaluation.  This also
makes ideals and pointers really clean.

As an added bonus, expression evaluation should be faster
because it doesn't require heap allocation for every
intermediate value, type switches, or lots of conversions to
and from Value.  It also involves fewer function calls.

R=rsc
APPROVED=rsc
DELTA=431  (280 added, 115 deleted, 36 changed)
OCL=31705
CL=31709
2009-07-15 17:56:17 -07:00
Austin Clements
9211a7d413 Beginnings of a Go interpreter. This implements basic and
pointer types, supports literals, identifiers, type-checking
most unary and binary operators, "compiling" a few unary and
binary operators, and assignment and declaration statements.

R=rsc
APPROVED=rsc
DELTA=1751  (1751 added, 0 deleted, 0 changed)
OCL=31309
CL=31691
2009-07-15 11:59:13 -07:00
Austin Clements
8b7951495c Implement forking debugged processes.
R=rsc
APPROVED=rsc
DELTA=81  (53 added, 3 deleted, 25 changed)
OCL=31651
CL=31675
2009-07-15 10:17:56 -07:00
Austin Clements
c105de748d Implementation of process tracing using Linux's ptrace.
R=rsc
APPROVED=rsc
DELTA=1543  (1528 added, 0 deleted, 15 changed)
OCL=31570
CL=31630
2009-07-14 15:12:10 -07:00
Austin Clements
9de5df89c3 Give ptrace code a real home.
R=rsc
APPROVED=rsc
DELTA=422  (211 added, 211 deleted, 0 changed)
OCL=31425
CL=31431
2009-07-09 17:35:32 -07:00
Austin Clements
76fef1deec Process tracing interface.
This is meant to be implemented per platform and used by
higher-level debugging libraries.

R=rsc
APPROVED=rsc
DELTA=211  (211 added, 0 deleted, 0 changed)
OCL=31003
CL=31423
2009-07-09 17:10:12 -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
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
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
bbc2c03852 - godoc periodic sync for Linux and Darwin
- support debug/sync (if automatic sync is enabled in the first place)
- removed debug/restart feature

R=rsc
DELTA=97  (37 added, 27 deleted, 33 changed)
OCL=30068
CL=30079
2009-06-08 18:09:33 -07:00
Robert Griesemer
80ca2afd08 issue http redirect when needed
R=rsc
DELTA=31  (6 added, 8 deleted, 17 changed)
OCL=30046
CL=30051
2009-06-08 11:49:29 -07:00
Robert Griesemer
b71598f704 set reasonable initial time stamp (instead of begin of epoch)
R=rsc
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=29970
CL=29973
2009-06-05 23:54:44 -07:00
Robert Griesemer
bd61c4e56e disable automatic p4 sync (new default)
TBR=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29969
CL=29969
2009-06-05 23:28:02 -07:00
Robert Griesemer
ebf38bf33f - cleanup: remove use of local ReadFile in favor of io.ReadFile
- don't show p4 sync output if -verbose is not set

R=rsc
DELTA=25  (5 added, 15 deleted, 5 changed)
OCL=29962
CL=29962
2009-06-05 17:55:55 -07:00
Robert Griesemer
42cf59a752 show remote addr instead of host in log lines
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29961
CL=29961
2009-06-05 17:08:22 -07:00
Robert Griesemer
8604e18093 - added goroutine to automatically p4 sync the current workspace
- set "Updated" timestamp on served pages to p4 sync time

R=rsc
DELTA=72  (66 added, 3 deleted, 3 changed)
OCL=29959
CL=29959
2009-06-05 16:48:20 -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
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
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
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
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
Robert Griesemer
7d4765e2d3 show subdirectories if present in a package dir
R=rsc
DELTA=184  (69 added, 73 deleted, 42 changed)
OCL=29178
CL=29253
2009-05-22 10:24:28 -07:00
Robert Griesemer
787dd4d3f3 semi-weekly snapshot:
- format.go implementation complete
- lots of documentation added (not quite complete)

TBR=r
OCL=29130
CL=29130
2009-05-20 17:09:59 -07:00
Robert Griesemer
500f6b8e84 fix typo
TBR=rsc
OCL=29010
CL=29010
2009-05-18 16:48:38 -07:00
Robert Griesemer
7ff2536633 - make godoc restart feature work properly
R=rsc
DELTA=11  (10 added, 0 deleted, 1 changed)
OCL=29007
CL=29009
2009-05-18 16:26:34 -07:00
Robert Griesemer
1ed725d7cd - changed parser to return os.Error, removed ErrorHandler
- added IsValid predicate to token.Position
- updated pretty, godoc, gobuild
- updated/expanded test cases

R=rsc
DELTA=265  (97 added, 78 deleted, 90 changed)
OCL=28961
CL=29005
2009-05-18 14:59:16 -07:00
Robert Griesemer
e8c1e2b93a get rid of unused files in my home dir
TBR=r
DELTA=9270  (0 added, 9270 deleted, 0 changed)
OCL=28958
CL=28958
2009-05-15 19:15:45 -07:00
Robert Griesemer
b7585a31b7 weekly snapshot:
format.go:
- better error handling, indentation, support for defaults,
  environments for custom formatters, cleanups (more functionality, less code)

pretty.go:
- better comment printing using format.go

made test script more robust

TBR=r
DELTA=622  (175 added, 305 deleted, 142 changed)
OCL=28956
CL=28956
2009-05-15 18:52:59 -07:00
Robert Griesemer
8ee8fdea3c restart functionality
R=rsc
DELTA=21  (19 added, 0 deleted, 2 changed)
OCL=28938
CL=28941
2009-05-15 15:45:35 -07:00
Robert Griesemer
05851636f3 godoc fix: relative paths were incorrect
R=r
DELTA=13  (1 added, 6 deleted, 6 changed)
OCL=28840
CL=28844
2009-05-14 14:59:51 -07:00
Robert Griesemer
f3b08744a2 Simplified AST:
- one node for array and slice types
- one node for index and slice expressions
- simplified parser, astprinter, and ast.txt

R=r
DELTA=71  (0 added, 43 deleted, 28 changed)
OCL=28768
CL=28768
2009-05-13 15:18:05 -07:00
David Symonds
6c384d2268 Allow http.Redirect to do both temporary (307) and permanent (301) redirects.
This also adds a missing 'return' when a malformed URL is passed to it.

R=rsc
APPROVED=rsc
DELTA=30  (13 added, 2 deleted, 15 changed)
OCL=28598
CL=28710
2009-05-12 15:41:19 -07:00
Robert Griesemer
c6da3e5a69 A couple of godoc improvements:
- sort directories before printing
- apply filtering to factory functions and methods
- remove a couple of unused files

R=r
DELTA=84  (34 added, 40 deleted, 10 changed)
OCL=28657
CL=28657
2009-05-11 16:52:59 -07:00
Robert Griesemer
5a11a46e2d weekly snapshot
- godoc updated to work w/new directory structure

TBR=r
OCL=28624
CL=28624
2009-05-11 09:47:53 -07:00
Russ Cox
917aa35f8f implications of stricter type equality:
if both types are named, they must be
the same type (arising from the same
declaration).

R=r,gri
DELTA=44  (21 added, 4 deleted, 19 changed)
OCL=28436
CL=28577
2009-05-08 15:40:14 -07:00
Russ Cox
918afd9491 move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Rob Pike
01712ae7d3 embeddability: change bufio.BufRead to bufio.Reader etc.
R=rsc
DELTA=112  (0 added, 4 deleted, 108 changed)
OCL=28537
CL=28543
2009-05-08 11:52:39 -07:00
Rob Pike
c8b47c6fce Name change to improve embeddability:
io.Read->io.Reader
	io.Write,Close,etc.->io.Writer,Closer etc.

R=rsc
DELTA=190  (0 added, 0 deleted, 190 changed)
OCL=28525
CL=28535
2009-05-08 11:22:57 -07:00
Russ Cox
63629d5307 minor cleanup, not required by compiler changes
R=r
DELTA=14  (1 added, 4 deleted, 9 changed)
OCL=28447
CL=28509
2009-05-08 10:14:55 -07:00
Robert Griesemer
d76f095750 semi-weekly snapshot:
- format-driven pretty printing now handles all of Go code
- better error handling

R=r
OCL=28370
CL=28372
2009-05-06 16:28:18 -07:00
Robert Griesemer
19c239c9af - remove wrong fix
(this corresponds to the currently running version of godoc)

R=r
DELTA=11  (0 added, 10 deleted, 1 changed)
OCL=28238
CL=28238
2009-05-04 15:04:32 -07:00
Robert Griesemer
0d6a5f417f weekly snapshot:
- template-driven ast printing now can successfully
  reproduce entire Go programs

next steps:
- fine-tuning of output
- print interspersed comments
- cleanup and testing against all Go programs
- replace astprinter

R=r
OCL=28181
CL=28181
2009-05-01 19:32:41 -07:00
Robert Griesemer
22301e8cea Some adjustments to godoc:
- work-around for incorrect import path
- added tmpl root in order to run against a goroot w/o templates
- clarifications

Daily snapshot of syntax-driven formatter. Some progress.

Updated gccgo Makefile.

TBR=r
OCL=28004
CL=28004
2009-04-28 19:11:37 -07:00
Robert Griesemer
bf53e16f6d - install doc in lib/go
- adjust dependent files

R=rsc
DELTA=1132  (567 added, 562 deleted, 3 changed)
OCL=27862
CL=27862
2009-04-25 17:01:41 -07:00
Robert Griesemer
9b6009b651 - minor formatting and capitalization (export) changes
TBR=rsc
OCL=27861
CL=27861
2009-04-25 16:52:30 -07:00
Robert Griesemer
af8036aa6b - renamed docprinter.go -> doc.go
- adjusted dependent files
  (no changes in doc.go)

TBR=rsc
OCL=27860
CL=27860
2009-04-25 16:48:00 -07:00
Robert Griesemer
f8ff3b1055 daily snapshot:
- more work on template-driven ast formatting
- added preliminary test suite
- added documentation

TBR=r
OCL=27858
CL=27858
2009-04-25 16:36:17 -07:00
Robert Griesemer
3aa892c4f9 daily snapshot:
- more work on template-driven ast printing

R=r
OCL=27851
CL=27851
2009-04-24 17:22:58 -07:00
Robert Griesemer
448a7b46a9 daily snapshot:
- minor bug fixes in pretty, godoc
- first cut at template-driven printing of ast

TBR=r
OCL=27825
CL=27825
2009-04-23 21:53:01 -07:00
Rob Pike
9d70646fcf allow godoc to match on regular expressions.
if the name contains a metacharacter, use regexp matching;
otherwise require strict equality.

now
	godoc flag '.*Var'
can give you all the FooVar functions.

R=gri
DELTA=19  (19 added, 0 deleted, 0 changed)
OCL=27711
CL=27713
2009-04-21 22:46:19 -07:00
Rob Pike
4b62e8d7ef fix template.
.or works in .repeated so remove the comment.
the bug was in the template: .section executes iff the field is non-empty.

R=gri
DELTA=13  (6 added, 7 deleted, 0 changed)
OCL=27710
CL=27712
2009-04-21 22:26:08 -07:00
Robert Griesemer
dc08ad4f37 remove lots of accumulated crud:
- delete utility files which contained functionality that is now elsewhere
  (or saved the files away for now)
- cleanup Makefile (remove unnecessary deps)
- minor adjustments to godoc, fixed a couple of bugs
- make pretty.go self-contained

TBR=r
DELTA=625  (81 added, 510 deleted, 34 changed)
OCL=27700
CL=27702
2009-04-21 18:37:48 -07:00
David Symonds
8e4b65d041 Move iterable package to usr/dsymonds/.
R=r
APPROVED=r
DELTA=598  (330 added, 266 deleted, 2 changed)
OCL=27627
CL=27649
2009-04-20 18:13:14 -07:00
Rob Pike
7e1cfa7432 Readn is a silly name when there's no n. Change to FullRead.
R=gri
DELTA=15  (0 added, 0 deleted, 15 changed)
OCL=27619
CL=27619
2009-04-19 21:02:29 -07:00
Rob Pike
aaf63f8d06 Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated.

Step 2 will make os's error support internally much cleaner.

R=rsc
OCL=27586
CL=27586
2009-04-17 00:08:24 -07:00
Russ Cox
1f6463f823 Convert go tree to hierarchical pkg directory:
import (
		"vector" -> "container/vector"
		"ast" -> "go/ast"
		"sha1" -> "hash/sha1"
		etc.
	)

and update Makefiles.  Because I did the conversion
semi-automatically, I sorted all the import blocks
as a post-processing.  Some files have therefore
changed that didn't strictly need to.

Rename local packages to lower case.
The upper/lower distinction doesn't work on OS X
and complicates the "single-package directories
with the same package name as directory name"
heuristic used by gobuild and godoc to create
the correlation between source and binary locations.
Now that we have a plan to avoid globally unique
names, the upper/lower is unnecessary.

The renamings will cause trouble for a few users,
but so will the change in import paths.
This way, the two maintenance fixes are rolled into
one inconvenience.

R=r
OCL=27573
CL=27575
2009-04-16 20:52:37 -07:00
Russ Cox
60ce95d7a1 code changes for array conversion.
as a reminder, the old conversion
was that you could write

	var arr [10]byte;
	var slice []byte;
	slice = arr;

but now you have to write

	slice = &arr;

the change eliminates an implicit &, so that
the only implicit &s left are in the . operator
and in string(arr).

also, removed utf8.EncodeRuneToString
in favor of string(rune).

R=r
DELTA=83  (1 added, 23 deleted, 59 changed)
OCL=27531
CL=27534
2009-04-15 20:27:45 -07:00
Russ Cox
1605176e25 godoc: use data-driven templates for html, text generation
R=gri
DELTA=1341  (668 added, 282 deleted, 391 changed)
OCL=27485
CL=27526
2009-04-15 18:53:43 -07:00
Russ Cox
457b0030f7 godoc: supporting data
R=gri
DELTA=252  (240 added, 3 deleted, 9 changed)
OCL=27482
CL=27521
2009-04-15 18:38:37 -07:00
Rob Pike
ff12f2effd add (stub) parser to template code, enabling rewrite.
update pretty to use it.
change stdout to stderr in pretty.

R=rsc
DELTA=173  (52 added, 24 deleted, 97 changed)
OCL=27405
CL=27409
2009-04-14 00:06:49 -07:00
Russ Cox
3d0e4741eb godoc: switch to go library template system
R=gri
DELTA=272  (38 added, 139 deleted, 95 changed)
OCL=27372
CL=27390
2009-04-13 15:25:50 -07:00
Russ Cox
e97121a187 working checkpoint.
add comment describing new web server tree.
make room for command line interface.
use new path package to get rid of doubled slashes.
use new Chdir function to avoid goroot + everything.

implement new /pkg/ tree instead of using regexps.

R=gri
DELTA=267  (103 added, 72 deleted, 92 changed)
OCL=27150
CL=27367
2009-04-13 13:28:53 -07:00
Robert Griesemer
2a9f1ee215 Daily snapshot.
- godoc now supports the following url prefixes:
  /doc/ for package documentation
  /file/ for files (directories, html, and .go files)
  /spec for the spec
  /mem for the memory model
- formatting of comments has been fixed
- tons of minor cleanups (still more to do)

Still missing:
- pretty printing of source is not as pretty as it used to be
(still a relict from the massive AST cleanup which has't quite made it's way everywhere)
- documentation entries should be sorted
- comments in code is not printed or not properly printed

TBR=r
DELTA=416  (182 added, 100 deleted, 134 changed)
OCL=27078
CL=27078
2009-04-03 16:19:22 -07:00
Robert Griesemer
bfea141ca8 - don't show methods of non-exported types
(even if the methods are exported)

R=rsc
OCL=27056
CL=27056
2009-04-02 22:39:52 -07:00
Robert Griesemer
184c623e6b - renamed hasPostfix -> hasSuffix
- fixed printing of function literals (require separating ";")

R=rsc
OCL=27055
CL=27055
2009-04-02 22:24:52 -07:00
Robert Griesemer
91238c5bfe - moved functions before types in doc output (per rsc)
- use /src and /doc prefix in URL to distinguish output type (per rsc)
- fixed a bug in an internal string function
- ignore files ending in _test.go (consider them test files)

R=rsc
OCL=27054
CL=27054
2009-04-02 21:59:37 -07:00
Robert Griesemer
9ef3d8e2e7 Daily snapshot:
first round of cleanups:
- removed extra .html templates (reduced to one)
- removed dependencies on various local files
- minor fixes throughout

Basic docserver is now operational: Automatically finds all
(multi-file) packages under a root and serves either file
or package documentation.

R=r
OCL=27049
CL=27049
2009-04-02 18:25:18 -07:00
Robert Griesemer
695c90daa0 - adjustments for changed AST
- renamed gds -> godoc
- functionality to find and serve packages
  (to get a list of packages provide dir path + "?p")

Next steps: cleanups, better formatting, fine-tuning of output

R=r
OCL=27037
CL=27039
2009-04-02 15:58:58 -07:00
Robert Griesemer
2d543d0c14 Adjustements related to AST changes.
R=r
OCL=27026
CL=27028
2009-04-02 10:16:17 -07:00
Robert Griesemer
6d5bba5148 More gds functionality:
- package headers
- constants
- variables
- formatted comments

Next steps:
- sorted output
- collection of all files belonging to a package
- fine-tuning of output

R=r
OCL=26997
CL=26997
2009-04-01 15:00:22 -07:00
Russ Cox
a9c1a3b620 change smoketest from parser.go to astprinter.go,
the largest remaining source file in this directory.

TBR=gri
OCL=26984
CL=26984
2009-04-01 03:32:44 -07:00
Robert Griesemer
78f7063d9d - also associate factory methods to a type in documentation
R=r
OCL=26974
CL=26976
2009-03-31 18:46:21 -07:00
Robert Griesemer
8f628f4955 daily snapshot:
- adjustments to match new ast/parser interface
- removed printer.go; functionality now in astprinter.go and docprinter.go
  (more cleanups pending)
- enabled new doc printing in gds
  (lots of fine tuning missing, but pieces falling into place; e.g. methods
  associated with types. Consts, Vars, to come. Collection of all files
  belonging to a package to come)

R=r
OCL=26970
CL=26972
2009-03-31 16:53:58 -07:00
Robert Griesemer
3f42f44227 - incorporation of suggestions by rsc
R=rsc
OCL=26959
CL=26959
2009-03-31 13:28:01 -07:00