1 //===- MsgPack.def
- MessagePack definitions
--------------------*- C
++ -*-===//
3 // Part of the LLVM Project
, under the Apache License v2.0 with LLVM Exceptions.
4 // See https
://llvm.org
/LICENSE.txt for license information.
5 // SPDX
-License
-Identifier
: Apache
-2.0 WITH LLVM
-exception
7 //===----------------------------------------------------------------------===//
10 /// Macros for running through MessagePack enumerators.
12 //===----------------------------------------------------------------------===//
15 defined HANDLE_MP_FIRST_BYTE || defined HANDLE_MP_FIX_BITS || \
16 defined HANDLE_MP_FIX_BITS_MASK || defined HANDLE_MP_FIX_MAX || \
17 defined HANDLE_MP_FIX_LEN || defined HANDLE_MP_FIX_MIN
)
18 #error
"Missing macro definition of HANDLE_MP*"
21 #ifndef HANDLE_MP_FIRST_BYTE
22 #define
HANDLE_MP_FIRST_BYTE(ID
, NAME
)
25 #ifndef HANDLE_MP_FIX_BITS
26 #define
HANDLE_MP_FIX_BITS(ID
, NAME
)
29 #ifndef HANDLE_MP_FIX_BITS_MASK
30 #define
HANDLE_MP_FIX_BITS_MASK(ID
, NAME
)
33 #ifndef HANDLE_MP_FIX_MAX
34 #define
HANDLE_MP_FIX_MAX(ID
, NAME
)
37 #ifndef HANDLE_MP_FIX_LEN
38 #define
HANDLE_MP_FIX_LEN(ID
, NAME
)
41 #ifndef HANDLE_MP_FIX_MIN
42 #define
HANDLE_MP_FIX_MIN(ID
, NAME
)
45 HANDLE_MP_FIRST_BYTE(0xc0, Nil
)
46 HANDLE_MP_FIRST_BYTE(0xc2, False
)
47 HANDLE_MP_FIRST_BYTE(0xc3, True
)
48 HANDLE_MP_FIRST_BYTE(0xc4, Bin8
)
49 HANDLE_MP_FIRST_BYTE(0xc5, Bin16
)
50 HANDLE_MP_FIRST_BYTE(0xc6, Bin32
)
51 HANDLE_MP_FIRST_BYTE(0xc7, Ext8
)
52 HANDLE_MP_FIRST_BYTE(0xc8, Ext16
)
53 HANDLE_MP_FIRST_BYTE(0xc9, Ext32
)
54 HANDLE_MP_FIRST_BYTE(0xca, Float32
)
55 HANDLE_MP_FIRST_BYTE(0xcb, Float64
)
56 HANDLE_MP_FIRST_BYTE(0xcc, UInt8
)
57 HANDLE_MP_FIRST_BYTE(0xcd, UInt16
)
58 HANDLE_MP_FIRST_BYTE(0xce, UInt32
)
59 HANDLE_MP_FIRST_BYTE(0xcf, UInt64
)
60 HANDLE_MP_FIRST_BYTE(0xd0, Int8
)
61 HANDLE_MP_FIRST_BYTE(0xd1, Int16
)
62 HANDLE_MP_FIRST_BYTE(0xd2, Int32
)
63 HANDLE_MP_FIRST_BYTE(0xd3, Int64
)
64 HANDLE_MP_FIRST_BYTE(0xd4, FixExt1
)
65 HANDLE_MP_FIRST_BYTE(0xd5, FixExt2
)
66 HANDLE_MP_FIRST_BYTE(0xd6, FixExt4
)
67 HANDLE_MP_FIRST_BYTE(0xd7, FixExt8
)
68 HANDLE_MP_FIRST_BYTE(0xd8, FixExt16
)
69 HANDLE_MP_FIRST_BYTE(0xd9, Str8
)
70 HANDLE_MP_FIRST_BYTE(0xda, Str16
)
71 HANDLE_MP_FIRST_BYTE(0xdb, Str32
)
72 HANDLE_MP_FIRST_BYTE(0xdc, Array16
)
73 HANDLE_MP_FIRST_BYTE(0xdd, Array32
)
74 HANDLE_MP_FIRST_BYTE(0xde, Map16
)
75 HANDLE_MP_FIRST_BYTE(0xdf, Map32
)
77 HANDLE_MP_FIX_BITS(0x00, PositiveInt
)
78 HANDLE_MP_FIX_BITS(0x80, Map
)
79 HANDLE_MP_FIX_BITS(0x90, Array
)
80 HANDLE_MP_FIX_BITS(0xa0, String
)
81 HANDLE_MP_FIX_BITS(0xe0, NegativeInt
)
83 HANDLE_MP_FIX_BITS_MASK(0x80, PositiveInt
)
84 HANDLE_MP_FIX_BITS_MASK(0xf0, Map
)
85 HANDLE_MP_FIX_BITS_MASK(0xf0, Array
)
86 HANDLE_MP_FIX_BITS_MASK(0xe0, String
)
87 HANDLE_MP_FIX_BITS_MASK(0xe0, NegativeInt
)
89 HANDLE_MP_FIX_MAX(0x7f, PositiveInt
)
90 HANDLE_MP_FIX_MAX(0x0f, Map
)
91 HANDLE_MP_FIX_MAX(0x0f, Array
)
92 HANDLE_MP_FIX_MAX(0x1f, String
)
94 HANDLE_MP_FIX_LEN(0x01, Ext1
)
95 HANDLE_MP_FIX_LEN(0x02, Ext2
)
96 HANDLE_MP_FIX_LEN(0x04, Ext4
)
97 HANDLE_MP_FIX_LEN(0x08, Ext8
)
98 HANDLE_MP_FIX_LEN(0x10, Ext16
)
100 HANDLE_MP_FIX_MIN(-0x20, NegativeInt
)
102 #undef HANDLE_MP_FIRST_BYTE
103 #undef HANDLE_MP_FIX_BITS
104 #undef HANDLE_MP_FIX_BITS_MASK
105 #undef HANDLE_MP_FIX_MAX
106 #undef HANDLE_MP_FIX_LEN
107 #undef HANDLE_MP_FIX_MIN