MsgPack.def 3.2 KB

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