Robert Griesemer [Thu, 20 Jan 2011 04:07:21 +0000 (23:07 -0500)]
go spec: remove float, complex in favor of float64 and complex128
The default float type is not very useful but for the most basic applications.
For instance, as it is now, using the math package requires conversions for float
variables (the arguments for math functions are usually float64). Typical real
applications tend to specify the floating point precision required.
This proposal removes the predeclared types float and complex. Variable declarations
without type specification but with constant floating point or complex initializer
expressions will assume the type float64 or complex128 respectively.
The predeclared function cmplx is renamed to complex.
Robert Griesemer [Wed, 19 Jan 2011 22:33:05 +0000 (14:33 -0800)]
godoc: enable fulltext index by default
- added flag -maxresults (default: 10000) to limit the max.
number of full text results shown
- removed flag -fulltext; use -maxresults=0 to disable fulltext
index
- better indication on result page if not all results are shown
(... after line list)
Robert Griesemer [Wed, 19 Jan 2011 20:48:10 +0000 (12:48 -0800)]
godoc: enable qualified identifiers ("math.Sin") as query strings again
A query string of the form ident.ident will be used both as a qualified
identifier for identifier search and as a regular expression.
Qualified identifier lookup got broken accidentally when introducing
regexp full text search. Cleaned up surrounding logic a bit.
Gustavo Niemeyer [Wed, 19 Jan 2011 20:43:58 +0000 (15:43 -0500)]
xml: handle tag paths through the same element
With the current implementation, xml unmarshalling
will silently fail to unmarshal any paths passing
through the same element, such as:
type T struct {
A string "dummy>a"
B string "dummy>b"
}
This change tweaks the algorithm so that this works
correctly.
Also, using paths that would cause the same element to
unmarshal twice will error out ahead of time explaining
the problem, rather than silently misbehaving.
Roger Peppe [Wed, 19 Jan 2011 20:28:49 +0000 (12:28 -0800)]
netchan: do not block sends; implement flow control.
When data is received for a channel, but that channel
is not ready to receive it, the central run() loop
is currently blocked, but this can lead to deadlock
and interference between independent channels.
This CL adds an explicit buffer size to netchan
channels (an API change) - the sender will not
send values until the buffer is non empty.
The protocol changes to send ids rather than channel names
because acks can still be sent after a channel is hung up,
we we need an identifier that can be ignored.
Eoghan Sherry [Wed, 19 Jan 2011 19:23:59 +0000 (14:23 -0500)]
math: handle denormals in Frexp, Ilogb, Ldexp, and Logb
Also:
* document special cases for Frexp and Ldexp
* handle ±Inf in Ldexp
* correctly return -0 on underflow in Ldexp
* test special cases for Ldexp
* test boundary cases for Frexp, Ilogb, Ldexp, and Logb
Ben Lynn [Wed, 19 Jan 2011 18:47:04 +0000 (13:47 -0500)]
regexp: reject bare ?
Minor cleanup:
- removed a duplicate test case
- added a function to remove repeated code
- for consistency, replaced "return nil" with a panic at an
unreachable point
Yasuhiro Matsumoto [Wed, 19 Jan 2011 07:00:19 +0000 (23:00 -0800)]
syscall: fix build. WUNTRACED isn't defined for win32.
For Windows, the options for syscall.Wait4() aren't used.
Then this will be dummy value like WNOHANG, WSTOPPED.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4075041
Gustavo Niemeyer [Tue, 18 Jan 2011 20:39:38 +0000 (15:39 -0500)]
xml: support for > in tags
This introduces support for selecting which subelement
to unmarshal into a given struct field by providing a
nesting path separated by the > character.
Russ Cox [Fri, 14 Jan 2011 19:05:20 +0000 (14:05 -0500)]
runtime: fix arm reflect.call boundary case
The fault was lucky: when it wasn't faulting it was silently
copying a word from some other block and later putting
that same word back. If some other goroutine had changed
that word of memory in the interim, too bad.
The ARM code was inconsistent about whether the
"argument frame" included the saved LR. Including it made
some things more regular but mostly just caused confusion
in the places where the regularity broke. Now the rule
reflects reality: argp is always a pointer to arguments,
never a saved link register.
Renamed struct fields to make meaning clearer.
Running ARM in QEMU, package time's gotest:
* before: 27/58 failed
* after: 0/50
Ian Lance Taylor [Fri, 14 Jan 2011 18:52:08 +0000 (10:52 -0800)]
cgo: In _cgo_main.c define all provided symbols as functions.
This defines crosscall2 in a way that matches that real
definition, and also defines _cgo_allocate and _cgo_panic to
indicate that they are available to be called by code compiled
with gcc.
Robert Griesemer [Fri, 14 Jan 2011 17:42:37 +0000 (09:42 -0800)]
gofmt, go/printer: do not insert extra linebreaks where they may break the code
Introduced a printer mode (pmode) type and corresponding
pmode values which permit easy toggling of the current
printer mode for fine-tuning of layout.
Use the printer mode to disable potential introduction of
line breaks before a closing '}' in composite literals.
Added extra test case. Applied gofmt to src and misc.
Robert Griesemer [Fri, 14 Jan 2011 01:20:26 +0000 (17:20 -0800)]
go/scanner: Make Init take a *token.File instead of a *token.FileSet.
Until now, each scan of a file added a new file to the file set.
With this change, a file can be re-scanned using the same *token.File
w/o changing the file set. Eventually this will enable the re-use of
cached source code in godoc (for the fulltext index). At the moment,
source files are read over and over again from disk.
Robert Griesemer [Thu, 13 Jan 2011 18:23:42 +0000 (10:23 -0800)]
godoc: peephole optimization for generated HTML
When searching for regular expressions such as
".", there are many consecutive matches.
In the generated HTML, combine them instead of
generating a new <span> for each adjacent text
segment highlighting a match.
Massively reduces the size of the generated
HTML in those cases.
Eric Eisner [Wed, 12 Jan 2011 05:46:50 +0000 (21:46 -0800)]
suffixarray: faster creation algorithm
This implements the algorithm qsufsort using the sort package
as a sorting primitive. Its worst-case performance is O(N*log(N)), and it
uses only an additional slice of N ints of memory during creation.
Benchmarks (seconds):
old new
10k nulls 149 0.044
1M English corpus 32.0 3.6
Adam Langley [Wed, 12 Jan 2011 01:54:30 +0000 (20:54 -0500)]
crypto/openpgp: add error and armor
error is needed by all the OpenPGP packages as they return a shared
family of error types.
armor implements OpenPGP armoring. It's very like PEM except:
a) it includes a CRC24 checksum
b) PEM values are small (a few KB) and so encoding/pem assumes that
they fit in memory. Armored data can be very large and so this
package presents a streaming interface.
Berengar Lehr [Wed, 12 Jan 2011 01:51:35 +0000 (20:51 -0500)]
crypto: add twofish package
The code was (as annotated in the source code) adopted from Tom's
LibCrypt (public domain code, [1]). It was neither optimised for speed
nor were any security features added.
I missed that environment is used during runtime setup,
well before go init() functions run. Implemented os-dependent
runtime.goenvs functions to allow for different unix, plan9 and
windows versions of environment discovery.