-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathmsgpack.go
61 lines (57 loc) · 1.33 KB
/
msgpack.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package msgpack
// Codes from the MessagePack specification.
const (
fixIntCodeMin = 0x00
fixIntCodeMax = 0x7f
fixMapCodeMin = 0x80
fixMapCodeMax = 0x8f
fixArrayCodeMin = 0x90
fixArrayCodeMax = 0x9f
fixStringCodeMin = 0xa0
fixStringCodeMax = 0xbf
nilCode = 0xc0
unusedCode = 0xc1 // never used
falseCode = 0xc2
trueCode = 0xc3
binary8Code = 0xc4
binary16Code = 0xc5
binary32Code = 0xc6
ext8Code = 0xc7
ext16Code = 0xc8
ext32Code = 0xc9
float32Code = 0xca
float64Code = 0xcb
uint8Code = 0xcc
uint16Code = 0xcd
uint32Code = 0xce
uint64Code = 0xcf
int8Code = 0xd0
int16Code = 0xd1
int32Code = 0xd2
int64Code = 0xd3
fixExt1Code = 0xd4
fixExt2Code = 0xd5
fixExt4Code = 0xd6
fixExt8Code = 0xd7
fixExt16Code = 0xd8
string8Code = 0xd9
string16Code = 0xda
string32Code = 0xdb
array16Code = 0xdc
array32Code = 0xdd
map16Code = 0xde
map32Code = 0xdf
negFixIntCodeMin = 0xe0
negFixIntCodeMax = 0xff
)
type aborted struct{ err error }
func abort(err error) { panic(aborted{err}) }
func handleAbort(err *error) {
if r := recover(); r != nil {
if a, ok := r.(aborted); ok {
*err = a.err
} else {
panic(r)
}
}
}