Tor Andersson [Mon, 30 Nov 2009 22:25:50 +0000 (14:25 -0800)]
A first stab at porting the XCB X11 protocol bindings to go.
The python script needs a checkout of xcb/proto to generate
an xproto.go file, which together with xgb.go provide functions
to access all of the core X11 protocol requests. I have included the
generated file.
Extensions and authentication methods are not implemented.
Russ Cox [Mon, 30 Nov 2009 18:29:14 +0000 (10:29 -0800)]
template: two bug fixes / nits
* diagnose template not created with New
(current code just crashes)
* write []byte uninterpreted
(current code writes fmt format: "[65 65 65 65]")
Eden Li [Mon, 30 Nov 2009 02:14:39 +0000 (18:14 -0800)]
cgo: use C type void for opaque types if dwarf.Common().Type returns nothing
Ideally, the C name would come from the typedef or pointer that
references the Size<0 type, but we can't easily generate this without
performing a look-ahead to see if any referencing type will become opaque.
Rob Pike [Wed, 25 Nov 2009 05:07:05 +0000 (21:07 -0800)]
fix weird all.bash failures by running deps.bash before make clean runs in pkg directory.
before this change, if pkg/Make.deps is missing or broken, clean.bash fails and the build dies
but not until much later.
add freebsd to error message about valid values of $GOOS
TODO: would be nice if this process exited when an error occurred. subshells make it hard
Robert Griesemer [Wed, 25 Nov 2009 01:20:13 +0000 (17:20 -0800)]
Replace sort.Sort call with heapify algorithm in Init.
Fixed package comment.
Renamed some variables for symmetry, added more internal comments and more tests.
Fixes #304.
Rob Pike [Tue, 24 Nov 2009 22:04:43 +0000 (14:04 -0800)]
change the rules for maintaining AUTHORS and CONTRIBUTORS files.
the current system is too painful, so instead let's just have the coders tell us the details.
we can update the files ourselves.
Robert Griesemer [Tue, 24 Nov 2009 21:43:18 +0000 (13:43 -0800)]
Change to container/vector interface:
- removed New(len int) in favor of new(Vector).Resize(len, cap)
- removed Init(len int) in favor of Resize(len, cap)
- runs all.bash
Sergio Luis O. B. Correia [Tue, 24 Nov 2009 01:32:51 +0000 (17:32 -0800)]
go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.
this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.
Sergio Luis O. B. Correia [Tue, 24 Nov 2009 00:00:26 +0000 (16:00 -0800)]
cmd/cc: change getquoted() to accept whitespaces.
getquoted() currently checks for whitespaces and returns nil
if it finds one. this prevents us from having go in a path
containing whitespaces, as the #pragma dynld directives are
processed through the said function.
this commit makes getquoted() accept whitespaces, and this is
also needed for solving issue #115.
Robert Griesemer [Fri, 20 Nov 2009 19:50:11 +0000 (11:50 -0800)]
Support for basic try-catch style exception handling.
Meant as illustration of the Go pattern that is using
goroutines and channels to handle exceptional situations.
Note: There is no need for "Finally" since the
"try block" (the function f supplied to Try)
cannot do a Smalltalk-style non-local return
and terminate the function surrounding Try.
Russ Cox [Fri, 20 Nov 2009 17:11:46 +0000 (09:11 -0800)]
x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
* remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
* port cgen_inline into 8g, 5g.
* use native memmove in maps
Russ Cox [Fri, 20 Nov 2009 16:59:11 +0000 (08:59 -0800)]
test/bench revisions;
* reverse-complement: port C algorithm to Go
saves 30% on my MacBook Pro and makes it a fairer comparison.
* test reverse-complement with and without GC (another 15%)
* revise timing.sh to work on more systems
* avoid two glibcisms in fasta.c
James Meneghello [Fri, 20 Nov 2009 05:08:05 +0000 (21:08 -0800)]
Map support for template.Execute().
Allows the developer to pass a map either by itself for
evaluation, or inside a struct. Access to data inside
maps is identical to the current system for structs, ie.
-Psuedocode-
mp map[string]string = {
"header" : "A fantastic header!",
"footer" : "A not-so-fantastic footer!",
}
template.Execute(mp)
...can be accessed using {header} and {footer} in
the template. Similarly, for maps inside structs:
type s struct {
mp map[string]string,
}
s1 = new s
s1.mp["header"] = "A fantastic header!";
template.Execute(s1)
...is accessed using {mp.header}. Multi-maps, ie.
map[string](map[string]string) and maps of structs
containing more maps are unsupported, but then, I'm
not even sure if that's supported by the language.
Map elements can be of any type that can be written
by the formatters. Keys should really only be strings.
Evan Shaw [Fri, 20 Nov 2009 04:43:30 +0000 (20:43 -0800)]
archive/tar: Make Reader and Writer more closely follow io.Reader and io.Writer interfaces
There's no functional change here. io gives the Read and Write methods byte slice arguments, but tar called them uint8. It's the same thing, but I think this is clearer and it matches what other packages do.
Rob Pike [Fri, 20 Nov 2009 00:45:50 +0000 (16:45 -0800)]
two easy optimizations for regexp:
1) if char class contains a single character, make it a single character.
(this is used to quote, e.g. [.] rather than \.
2) if regexp begins with ordinary text substring, use plain string match to start engine
Trevor Strohman [Fri, 20 Nov 2009 00:35:34 +0000 (16:35 -0800)]
Adds benchmark support to gotest.
No benchmarks are run unless the --benchmarks=<regexp> flag
is specified on the gotest command line. This change includes
sample benchmarks for regexp.