summaryrefslogtreecommitdiffstats
path: root/libgo/go/gob/doc.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-21 18:19:03 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-21 18:19:03 +0000
commit48080209fa53b6ea88c86e9f445c431b4cd1e47b (patch)
tree27d8768fb1d25696d3c40b42535eb5e073c278da /libgo/go/gob/doc.go
parentbff898fbbe4358a4b7e337852df4d6043e0bd3f5 (diff)
downloadppe42-gcc-48080209fa53b6ea88c86e9f445c431b4cd1e47b.tar.gz
ppe42-gcc-48080209fa53b6ea88c86e9f445c431b4cd1e47b.zip
Remove the types float and complex.
Update to current version of Go library. Update testsuite for removed types. * go-lang.c (go_langhook_init): Omit float_type_size when calling go_create_gogo. * go-c.h: Update declaration of go_create_gogo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/gob/doc.go')
-rw-r--r--libgo/go/gob/doc.go58
1 files changed, 33 insertions, 25 deletions
diff --git a/libgo/go/gob/doc.go b/libgo/go/gob/doc.go
index 2e7232db51d..31253f16d09 100644
--- a/libgo/go/gob/doc.go
+++ b/libgo/go/gob/doc.go
@@ -70,7 +70,7 @@ operation will fail.
Structs, arrays and slices are also supported. Strings and arrays of bytes are
supported with a special, efficient representation (see below).
-Interfaces, functions, and channels cannot be sent in a gob. Attempting
+Functions and channels cannot be sent in a gob. Attempting
to encode a value that contains one will fail.
The rest of this comment documents the encoding, details that are not important
@@ -149,31 +149,34 @@ pair (-type id, encoded-type) where encoded-type is the gob encoding of a wireTy
description, constructed from these types:
type wireType struct {
- s structType
+ ArrayT *ArrayType
+ SliceT *SliceType
+ StructT *StructType
+ MapT *MapType
}
- type arrayType struct {
- commonType
+ type ArrayType struct {
+ CommonType
Elem typeId
Len int
}
- type commonType {
- name string // the name of the struct type
- _id int // the id of the type, repeated for so it's inside the type
+ type CommonType {
+ Name string // the name of the struct type
+ Id int // the id of the type, repeated so it's inside the type
}
- type sliceType struct {
- commonType
+ type SliceType struct {
+ CommonType
Elem typeId
}
- type structType struct {
- commonType
- field []*fieldType // the fields of the struct.
+ type StructType struct {
+ CommonType
+ Field []*fieldType // the fields of the struct.
}
- type fieldType struct {
- name string // the name of the field.
- id int // the type id of the field, which must be already defined
+ type FieldType struct {
+ Name string // the name of the field.
+ Id int // the type id of the field, which must be already defined
}
- type mapType struct {
- commonType
+ type MapType struct {
+ CommonType
Key typeId
Elem typeId
}
@@ -193,18 +196,23 @@ priori, as well as the basic gob types int, uint, etc. Their ids are:
complex 7
interface 8
// gap for reserved ids.
- wireType 16
- arrayType 17
- commonType 18
- sliceType 19
- structType 20
- fieldType 21
+ WireType 16
+ ArrayType 17
+ CommonType 18
+ SliceType 19
+ StructType 20
+ FieldType 21
// 22 is slice of fieldType.
- mapType 23
+ MapType 23
+
+Finally, each message created by a call to Encode is preceded by an encoded
+unsigned integer count of the number of bytes remaining in the message. After
+the initial type name, interface values are wrapped the same way; in effect, the
+interface value acts like a recursive invocation of Encode.
In summary, a gob stream looks like
- ((-type id, encoding of a wireType)* (type id, encoding of a value))*
+ (byteCount (-type id, encoding of a wireType)* (type id, encoding of a value))*
where * signifies zero or more repetitions and the type id of a value must
be predefined or be defined before the value in the stream.
OpenPOWER on IntegriCloud