1//===- MsgPack.def - MessagePack definitions --------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// Macros for running through MessagePack enumerators.
11///
12//===----------------------------------------------------------------------===//
13
14#if !( \
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*"
19#endif
20
21#ifndef HANDLE_MP_FIRST_BYTE
22#define HANDLE_MP_FIRST_BYTE(ID, NAME)
23#endif
24
25#ifndef HANDLE_MP_FIX_BITS
26#define HANDLE_MP_FIX_BITS(ID, NAME)
27#endif
28
29#ifndef HANDLE_MP_FIX_BITS_MASK
30#define HANDLE_MP_FIX_BITS_MASK(ID, NAME)
31#endif
32
33#ifndef HANDLE_MP_FIX_MAX
34#define HANDLE_MP_FIX_MAX(ID, NAME)
35#endif
36
37#ifndef HANDLE_MP_FIX_LEN
38#define HANDLE_MP_FIX_LEN(ID, NAME)
39#endif
40
41#ifndef HANDLE_MP_FIX_MIN
42#define HANDLE_MP_FIX_MIN(ID, NAME)
43#endif
44
45HANDLE_MP_FIRST_BYTE(0xc0, Nil)
46HANDLE_MP_FIRST_BYTE(0xc2, False)
47HANDLE_MP_FIRST_BYTE(0xc3, True)
48HANDLE_MP_FIRST_BYTE(0xc4, Bin8)
49HANDLE_MP_FIRST_BYTE(0xc5, Bin16)
50HANDLE_MP_FIRST_BYTE(0xc6, Bin32)
51HANDLE_MP_FIRST_BYTE(0xc7, Ext8)
52HANDLE_MP_FIRST_BYTE(0xc8, Ext16)
53HANDLE_MP_FIRST_BYTE(0xc9, Ext32)
54HANDLE_MP_FIRST_BYTE(0xca, Float32)
55HANDLE_MP_FIRST_BYTE(0xcb, Float64)
56HANDLE_MP_FIRST_BYTE(0xcc, UInt8)
57HANDLE_MP_FIRST_BYTE(0xcd, UInt16)
58HANDLE_MP_FIRST_BYTE(0xce, UInt32)
59HANDLE_MP_FIRST_BYTE(0xcf, UInt64)
60HANDLE_MP_FIRST_BYTE(0xd0, Int8)
61HANDLE_MP_FIRST_BYTE(0xd1, Int16)
62HANDLE_MP_FIRST_BYTE(0xd2, Int32)
63HANDLE_MP_FIRST_BYTE(0xd3, Int64)
64HANDLE_MP_FIRST_BYTE(0xd4, FixExt1)
65HANDLE_MP_FIRST_BYTE(0xd5, FixExt2)
66HANDLE_MP_FIRST_BYTE(0xd6, FixExt4)
67HANDLE_MP_FIRST_BYTE(0xd7, FixExt8)
68HANDLE_MP_FIRST_BYTE(0xd8, FixExt16)
69HANDLE_MP_FIRST_BYTE(0xd9, Str8)
70HANDLE_MP_FIRST_BYTE(0xda, Str16)
71HANDLE_MP_FIRST_BYTE(0xdb, Str32)
72HANDLE_MP_FIRST_BYTE(0xdc, Array16)
73HANDLE_MP_FIRST_BYTE(0xdd, Array32)
74HANDLE_MP_FIRST_BYTE(0xde, Map16)
75HANDLE_MP_FIRST_BYTE(0xdf, Map32)
76
77HANDLE_MP_FIX_BITS(0x00, PositiveInt)
78HANDLE_MP_FIX_BITS(0x80, Map)
79HANDLE_MP_FIX_BITS(0x90, Array)
80HANDLE_MP_FIX_BITS(0xa0, String)
81HANDLE_MP_FIX_BITS(0xe0, NegativeInt)
82
83HANDLE_MP_FIX_BITS_MASK(0x80, PositiveInt)
84HANDLE_MP_FIX_BITS_MASK(0xf0, Map)
85HANDLE_MP_FIX_BITS_MASK(0xf0, Array)
86HANDLE_MP_FIX_BITS_MASK(0xe0, String)
87HANDLE_MP_FIX_BITS_MASK(0xe0, NegativeInt)
88
89HANDLE_MP_FIX_MAX(0x7f, PositiveInt)
90HANDLE_MP_FIX_MAX(0x0f, Map)
91HANDLE_MP_FIX_MAX(0x0f, Array)
92HANDLE_MP_FIX_MAX(0x1f, String)
93
94HANDLE_MP_FIX_LEN(0x01, Ext1)
95HANDLE_MP_FIX_LEN(0x02, Ext2)
96HANDLE_MP_FIX_LEN(0x04, Ext4)
97HANDLE_MP_FIX_LEN(0x08, Ext8)
98HANDLE_MP_FIX_LEN(0x10, Ext16)
99
100HANDLE_MP_FIX_MIN(-0x20, NegativeInt)
101
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
108