yeptris 0.6.7.1 → 0.6.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libyeptris/extconf.rb +57 -0
  3. data/lib/yeptris.rb +10 -8
  4. data/vendor/libyeptris/CMakeLists.txt +254 -0
  5. data/vendor/libyeptris/cmake/yeptris-config.cmake.in +5 -0
  6. data/vendor/libyeptris/cmake/yeptris.pc.in +11 -0
  7. data/vendor/libyeptris/src/CMakeLists.txt +167 -0
  8. data/vendor/libyeptris/src/include/yeptris/api.h +32 -0
  9. data/vendor/libyeptris/src/include/yeptris/cbor.h +101 -0
  10. data/vendor/libyeptris/src/include/yeptris/dom.h +181 -0
  11. data/vendor/libyeptris/src/include/yeptris/emit.h +81 -0
  12. data/vendor/libyeptris/src/include/yeptris/error.h +41 -0
  13. data/vendor/libyeptris/src/include/yeptris/events.h +157 -0
  14. data/vendor/libyeptris/src/include/yeptris/json.h +45 -0
  15. data/vendor/libyeptris/src/include/yeptris/json.hpp +258 -0
  16. data/vendor/libyeptris/src/include/yeptris/jsonc_compat.h +115 -0
  17. data/vendor/libyeptris/src/include/yeptris/marshal.h +52 -0
  18. data/vendor/libyeptris/src/include/yeptris/parse.h +48 -0
  19. data/vendor/libyeptris/src/include/yeptris/plan.h +100 -0
  20. data/vendor/libyeptris/src/include/yeptris/resolve.h +71 -0
  21. data/vendor/libyeptris/src/include/yeptris/schema.h +119 -0
  22. data/vendor/libyeptris/src/include/yeptris/tape.h +99 -0
  23. data/vendor/libyeptris/src/include/yeptris/types.h +38 -0
  24. data/vendor/libyeptris/src/include/yeptris/values.h +102 -0
  25. data/vendor/libyeptris/src/include/yeptris/version.h.in +29 -0
  26. data/vendor/libyeptris/src/include/yeptris/visit.h +77 -0
  27. data/vendor/libyeptris/src/include/yeptris/yajl_compat.h +135 -0
  28. data/vendor/libyeptris/src/include/yeptris.h +23 -0
  29. data/vendor/libyeptris/src/yeptris/build.c +371 -0
  30. data/vendor/libyeptris/src/yeptris/cbor/cbor.h +25 -0
  31. data/vendor/libyeptris/src/yeptris/cbor/decode.c +846 -0
  32. data/vendor/libyeptris/src/yeptris/cbor/encode.c +824 -0
  33. data/vendor/libyeptris/src/yeptris/common/chartype.c +41 -0
  34. data/vendor/libyeptris/src/yeptris/common/chartype.h +77 -0
  35. data/vendor/libyeptris/src/yeptris/common/cpu.c +81 -0
  36. data/vendor/libyeptris/src/yeptris/common/cpu.h +40 -0
  37. data/vendor/libyeptris/src/yeptris/common/error.c +65 -0
  38. data/vendor/libyeptris/src/yeptris/common/error.h +79 -0
  39. data/vendor/libyeptris/src/yeptris/common/mutex.h +45 -0
  40. data/vendor/libyeptris/src/yeptris/common/nametab.c +275 -0
  41. data/vendor/libyeptris/src/yeptris/common/nametab.h +68 -0
  42. data/vendor/libyeptris/src/yeptris/common/port.h +74 -0
  43. data/vendor/libyeptris/src/yeptris/common/simd_text.c +49 -0
  44. data/vendor/libyeptris/src/yeptris/common/simd_text.h +295 -0
  45. data/vendor/libyeptris/src/yeptris/common/simd_text_avx2.c +534 -0
  46. data/vendor/libyeptris/src/yeptris/common/simd_text_neon.c +662 -0
  47. data/vendor/libyeptris/src/yeptris/common/simd_text_scalar.c +298 -0
  48. data/vendor/libyeptris/src/yeptris/common/string_view.c +34 -0
  49. data/vendor/libyeptris/src/yeptris/common/string_view.h +93 -0
  50. data/vendor/libyeptris/src/yeptris/doc.h +37 -0
  51. data/vendor/libyeptris/src/yeptris/dom/dom.c +973 -0
  52. data/vendor/libyeptris/src/yeptris/dom/dom.h +290 -0
  53. data/vendor/libyeptris/src/yeptris/dom/hpool.c +107 -0
  54. data/vendor/libyeptris/src/yeptris/dom/mapindex.c +173 -0
  55. data/vendor/libyeptris/src/yeptris/dom/mapindex.h +61 -0
  56. data/vendor/libyeptris/src/yeptris/dom/mutate.c +429 -0
  57. data/vendor/libyeptris/src/yeptris/emit/emit.c +349 -0
  58. data/vendor/libyeptris/src/yeptris/emit/float/api.h +38 -0
  59. data/vendor/libyeptris/src/yeptris/emit/float/dragon.c +405 -0
  60. data/vendor/libyeptris/src/yeptris/emit/float/floatint.h +203 -0
  61. data/vendor/libyeptris/src/yeptris/emit/float/print.c +396 -0
  62. data/vendor/libyeptris/src/yeptris/emit/style.c +81 -0
  63. data/vendor/libyeptris/src/yeptris/emit/style.h +24 -0
  64. data/vendor/libyeptris/src/yeptris/emit/writer.c +746 -0
  65. data/vendor/libyeptris/src/yeptris/emit/writer.h +61 -0
  66. data/vendor/libyeptris/src/yeptris/encoding/bom.c +31 -0
  67. data/vendor/libyeptris/src/yeptris/encoding/encoding.h +63 -0
  68. data/vendor/libyeptris/src/yeptris/encoding/transcode.c +148 -0
  69. data/vendor/libyeptris/src/yeptris/encoding/utf8_validate.c +178 -0
  70. data/vendor/libyeptris/src/yeptris/events/capture.c +150 -0
  71. data/vendor/libyeptris/src/yeptris/events/capture.h +39 -0
  72. data/vendor/libyeptris/src/yeptris/events/iterparse.c +208 -0
  73. data/vendor/libyeptris/src/yeptris/events/pull.c +97 -0
  74. data/vendor/libyeptris/src/yeptris/events/push.c +104 -0
  75. data/vendor/libyeptris/src/yeptris/events/recorder.c +107 -0
  76. data/vendor/libyeptris/src/yeptris/events/values.c +527 -0
  77. data/vendor/libyeptris/src/yeptris/events/values_priv.h +51 -0
  78. data/vendor/libyeptris/src/yeptris/events/yaml_compat.c +86 -0
  79. data/vendor/libyeptris/src/yeptris/events/yaml_compat.h +90 -0
  80. data/vendor/libyeptris/src/yeptris/jsonapi/jsonc_compat.c +687 -0
  81. data/vendor/libyeptris/src/yeptris/jsonapi/yajl_compat.c +728 -0
  82. data/vendor/libyeptris/src/yeptris/marshal.c +744 -0
  83. data/vendor/libyeptris/src/yeptris/memory/allocator.c +20 -0
  84. data/vendor/libyeptris/src/yeptris/memory/allocator.h +43 -0
  85. data/vendor/libyeptris/src/yeptris/memory/arena.c +134 -0
  86. data/vendor/libyeptris/src/yeptris/memory/arena.h +52 -0
  87. data/vendor/libyeptris/src/yeptris/memory/pool.c +115 -0
  88. data/vendor/libyeptris/src/yeptris/memory/pool.h +36 -0
  89. data/vendor/libyeptris/src/yeptris/parse/engine.c +3689 -0
  90. data/vendor/libyeptris/src/yeptris/parse/engine.h +65 -0
  91. data/vendor/libyeptris/src/yeptris/parse/events.h +124 -0
  92. data/vendor/libyeptris/src/yeptris/parse/numbers.c +349 -0
  93. data/vendor/libyeptris/src/yeptris/parse/numbers.h +33 -0
  94. data/vendor/libyeptris/src/yeptris/parse/scalars.c +416 -0
  95. data/vendor/libyeptris/src/yeptris/parse/scalars.h +75 -0
  96. data/vendor/libyeptris/src/yeptris/parse.c +650 -0
  97. data/vendor/libyeptris/src/yeptris/plan.c +817 -0
  98. data/vendor/libyeptris/src/yeptris/resolve/compat11.c +334 -0
  99. data/vendor/libyeptris/src/yeptris/resolve/core12.c +143 -0
  100. data/vendor/libyeptris/src/yeptris/resolve/resolver.h +56 -0
  101. data/vendor/libyeptris/src/yeptris/resolve/tags.c +58 -0
  102. data/vendor/libyeptris/src/yeptris/scan/json.c +792 -0
  103. data/vendor/libyeptris/src/yeptris/scan/json.h +109 -0
  104. data/vendor/libyeptris/src/yeptris/scan/scan.c +463 -0
  105. data/vendor/libyeptris/src/yeptris/scan/scan.h +150 -0
  106. data/vendor/libyeptris/src/yeptris/schema.c +238 -0
  107. data/vendor/libyeptris/src/yeptris/tape.c +1292 -0
  108. data/vendor/libyeptris/src/yeptris/version.c +7 -0
  109. data/vendor/libyeptris/src/yeptris/visit/dom_visit.c +115 -0
  110. data/vendor/libyeptris/src/yeptris/visit/json_visit.c +293 -0
  111. data/vendor/libyeptris/src/yeptris/visit/yaml_visit.c +127 -0
  112. metadata +113 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8192f177ce03a9524f7ec6bd078d1a5854bbcf533b53ed8c8d2d7982d07c1761
4
- data.tar.gz: 470e8b180e8f1f632c2e616dc9e6b1762ec99b93fc642aa25a988ea3d1214722
3
+ metadata.gz: 562defed959ebe427cd0277fdca5ce5f52b78a058579bb923f9152e33d9340eb
4
+ data.tar.gz: 8c0901a625e4fcd630f34a786d024e2cef08294a1dcbfa2bb592972811bbf19e
5
5
  SHA512:
6
- metadata.gz: acac433987243971017823d89f3ab5edefd89b3b3770d9a85555c71c0296ed50d144c543a7cc2fbbdb2c432b0c5482209db680e1dc8a89ba5e9b4b6a5dc97c9d
7
- data.tar.gz: 5dbed07e836272d52b90c1e398ba0bdbb6e82b324498a66e053dd267a0cdba68c6f59f888eaab220270a2e1f05f2c298022899b9716030280396a88218cc6454
6
+ metadata.gz: c980ada1d2df39e7d49650b6fb99e1833fc8ee808d8f49782bb4c813a9b3313e0307776c60559652565a5ba5bcf45085a1b20058b7d17c200820ed3b919d4167
7
+ data.tar.gz: bba1b2afdd36e1dba731b01af5d524811b54cebb17a9b212d27138824435f4a3434651cbab6082acb05c487def219736de51157cfed0153365fae1cda9060bc2
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Builds the vendored libyeptris at gem-install time so EVERY install
4
+ # carries the engine (the pure `ruby`-platform gem has no prebuilt
5
+ # binary). Platform gems vendor the prebuilt lib at the gem root —
6
+ # when one is present this extension no-ops.
7
+
8
+ require "mkmf"
9
+ require "fileutils"
10
+
11
+ gem_root = File.expand_path("../..", __dir__)
12
+ vendored = File.join(gem_root, "vendor", "libyeptris")
13
+
14
+ prebuilt = ["libyeptris.so", "libyeptris.dylib", "libyeptris.dll",
15
+ "yeptris.dll"].any? { |n| File.exist?(File.join(gem_root, n)) }
16
+
17
+ def write_dummy_makefile(reason)
18
+ File.write("Makefile", <<~MAKE)
19
+ all:
20
+ \t@echo "#{reason}"
21
+ install:
22
+ clean:
23
+ MAKE
24
+ end
25
+
26
+ if prebuilt
27
+ write_dummy_makefile("yeptris: prebuilt libyeptris ships in this gem; source build skipped")
28
+ elsif !File.directory?(vendored)
29
+ write_dummy_makefile("yeptris: no vendored libyeptris sources; set YEPTRIS_LIB_PATH at require time")
30
+ elsif find_executable("cmake").nil?
31
+ write_dummy_makefile("yeptris: cmake not found; set YEPTRIS_LIB_PATH at require time")
32
+ else
33
+ # Out-of-source into the ext workdir; the shared lib then moves to
34
+ # the GEM ROOT, where ffi.rb's ladder probes it.
35
+ build = File.join(Dir.pwd, "libyeptris-build")
36
+ # BUILD_TESTING (the CMake standard) gates test/ — the vendored
37
+ # tree ships no test dir; the static target must build because the
38
+ # unconditional install(TARGETS yeptris_static) expects it
39
+ args = [
40
+ "-DCMAKE_BUILD_TYPE=Release",
41
+ "-DBUILD_TESTING=OFF",
42
+ "-DYEPTRIS_BUILD_CLI=OFF",
43
+ "-DYEPTRIS_BUILD_BENCHMARKS=OFF",
44
+ "-DYEPTRIS_BUILD_SHARED=ON",
45
+ ]
46
+ ok = system("cmake", "-S", vendored, "-B", build, *args) &&
47
+ system("cmake", "--build", build, "--config", "Release")
48
+ lib = Dir.glob(File.join(build, "**", "libyeptris.{so,dylib}")).first
49
+ if ok && lib
50
+ FileUtils.cp(lib, File.join(gem_root, File.basename(lib)))
51
+ write_dummy_makefile("yeptris: built vendored libyeptris at gem install")
52
+ else
53
+ # a failed build must not abort the install — require-time raises
54
+ # the informative ladder error instead
55
+ write_dummy_makefile("yeptris: libyeptris source build failed; set YEPTRIS_LIB_PATH at require time")
56
+ end
57
+ end
data/lib/yeptris.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Yeptris
4
4
  # The gem's version lives in the parent namespace's file — the last
5
5
  # internal require (yeptris/version) retired with it.
6
- VERSION = "0.6.7.1".freeze
6
+ VERSION = "0.6.7.3".freeze
7
7
  # The error hierarchy lives in THIS file (the parent namespace's
8
8
  # own file): nested constants do not trigger a parent-constant
9
9
  # autoload, and the law forbids internal requires — defining the
@@ -95,16 +95,18 @@ end
95
95
  # DLL per supported minor ships and RUBY_VERSION selects. A missing
96
96
  # cell (Ruby 3.3 arm64 has no build) falls back LOUDLY to the ladder.
97
97
  begin
98
- if Gem.win_platform?
99
- require "yeptris/native-#{RUBY_VERSION[/\A\d+\.\d+/]}"
100
- else
98
+ # per-minor FIRST everywhere: a single version-agnostic native.so
99
+ # loads under ANY Ruby (symbols resolve from the host process), and
100
+ # one built for a different minor is an ABI gamble — Ruby 3.0 ran
101
+ # a 3.3-built ext and the JSON parse failed. The plain name stays
102
+ # as the dev-checkout fallback (built for the running Ruby).
103
+ require "yeptris/native-#{RUBY_VERSION[/\A\d+\.\d+/]}"
104
+ rescue LoadError
105
+ begin
101
106
  require "yeptris/native"
102
- end
103
- rescue LoadError => e
104
- if Gem.win_platform?
107
+ rescue LoadError => e
105
108
  warn "yeptris: no precompiled native materializer for Ruby " \
106
109
  "#{RUBY_VERSION[/\A\d+\.\d+/]} on this platform " \
107
110
  "(#{e.message}); the FFI ladder carries the load"
108
111
  end
109
- # FFI ladder only
110
112
  end
@@ -0,0 +1,254 @@
1
+ # yeptris — Ultra-fast YAML 1.2 parser, emitter and streamer in C
2
+ # The YAML counterpart of libleptris. Pure C library with CLI and bindings.
3
+ cmake_minimum_required(VERSION 3.20)
4
+
5
+ project(yeptris
6
+ VERSION 0.6.7
7
+ DESCRIPTION "Ultra-fast YAML 1.2 parser, emitter and streamer in C"
8
+ LANGUAGES C CXX
9
+ )
10
+
11
+ # C11 (the standard question, settled with evidence 2026-09-18): going
12
+ # C99 needs FOUR downgrades, not one — _Static_assert (fixed: the
13
+ # typedef-array YEPTRIS_CT_ASSERT), typedef redefinition (mapindex.c),
14
+ # _Thread_local (the per-thread error channel) and <stdatomics> (the
15
+ # lock-free handle pool). The last two are architecture-critical and
16
+ # absent from MSVC's C99 mode; pthread TLS / lock-based pools would
17
+ # regress the hot paths and weaken the concurrency contract.
18
+ set(CMAKE_C_STANDARD 11)
19
+ set(CMAKE_C_STANDARD_REQUIRED ON)
20
+ set(CMAKE_C_EXTENSIONS OFF)
21
+
22
+ # C++11 standard for tests and benchmarks.
23
+ set(CMAKE_CXX_STANDARD 11)
24
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
25
+ set(CMAKE_CXX_EXTENSIONS OFF)
26
+
27
+ # MSVC (the windows CI leg): the C++ suites use designated initializers
28
+ # (a GCC/Clang extension at C++11; MSVC requires C++20), and the test
29
+ # targets — test_conformance included — need test/compat on the include
30
+ # path for the dirent surface.
31
+ if(MSVC)
32
+ set(CMAKE_CXX_STANDARD 20)
33
+ endif()
34
+
35
+ # MSVC multi-config: one runtime home so ctest -C Release and the CLI
36
+ # smoke find every exe (the per-target default scattered them)
37
+ if(MSVC)
38
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
39
+ endif()
40
+
41
+ # MSVC's default stack is 1 MiB; the Unix builds run on 8 MiB — deep
42
+ # document paths (the depth guard's teardown) measured against the
43
+ # Unix default get the same room here
44
+ if(MSVC)
45
+ add_link_options(/STACK:8388608)
46
+ endif()
47
+
48
+ # ---------------------------------------------------------------- options --
49
+ option(BUILD_TESTING "Build tests" ON)
50
+ option(YEPTRIS_BUILD_CLI "Build the yeptris CLI tool" ON)
51
+ option(YEPTRIS_BUILD_STATIC "Build the static library" ON)
52
+ option(YEPTRIS_BUILD_SHARED "Build the shared library" OFF)
53
+ option(YEPTRIS_BUILD_BENCHMARKS "Build performance benchmarks (TODO.impl/18)" OFF)
54
+ option(YEPTRIS_BUILD_JSONC_COMPAT
55
+ "Build libyeptris-jsonc: the json-c drop-in migration layer (TODO.impl/21)" ON)
56
+ option(YEPTRIS_WITH_CBOR "Build the CBOR (RFC 8949) codec surface" ON)
57
+ option(YEPTRIS_ENABLE_ASAN "Enable AddressSanitizer" OFF)
58
+ option(YEPTRIS_ENABLE_TSAN "Enable ThreadSanitizer (requires all-TSAN build)" OFF)
59
+ option(YEPTRIS_ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
60
+ option(YEPTRIS_ENABLE_FUZZING "Build libFuzzer harnesses (TODO.impl/19; requires clang)" OFF)
61
+ option(YEPTRIS_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
62
+
63
+ # LTO: ON for Release/RelWithDebInfo by default (libleptris measured
64
+ # 1.3-3.5x on parse paths); override with -DYEPTRIS_ENABLE_LTO=OFF.
65
+ if(NOT DEFINED YEPTRIS_ENABLE_LTO)
66
+ if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
67
+ set(YEPTRIS_ENABLE_LTO_DEFAULT ON)
68
+ else()
69
+ set(YEPTRIS_ENABLE_LTO_DEFAULT OFF)
70
+ endif()
71
+ else()
72
+ set(YEPTRIS_ENABLE_LTO_DEFAULT ${YEPTRIS_ENABLE_LTO})
73
+ endif()
74
+ option(YEPTRIS_ENABLE_LTO "Enable link-time optimization (default ON for Release)" ${YEPTRIS_ENABLE_LTO_DEFAULT})
75
+
76
+ # ------------------------------------------------------------- sanitizers --
77
+ if(YEPTRIS_ENABLE_ASAN AND YEPTRIS_ENABLE_TSAN)
78
+ message(FATAL_ERROR "ASAN and TSAN are mutually exclusive")
79
+ endif()
80
+
81
+ if(YEPTRIS_ENABLE_ASAN)
82
+ add_compile_options(-fsanitize=address -fno-omit-frame-pointer -g)
83
+ add_link_options(-fsanitize=address)
84
+ message(STATUS "AddressSanitizer: ENABLED")
85
+ endif()
86
+
87
+ if(YEPTRIS_ENABLE_TSAN)
88
+ add_compile_options(-fsanitize=thread -fno-omit-frame-pointer -g)
89
+ add_link_options(-fsanitize=thread)
90
+ message(STATUS "ThreadSanitizer: ENABLED")
91
+ endif()
92
+
93
+ if(YEPTRIS_ENABLE_UBSAN)
94
+ add_compile_options(
95
+ -fsanitize=undefined -fsanitize=float-cast-overflow
96
+ -fno-sanitize-recover=undefined -fno-omit-frame-pointer -g)
97
+ add_link_options(-fsanitize=undefined -fsanitize=float-cast-overflow)
98
+ message(STATUS "UndefinedBehaviorSanitizer: ENABLED (fatal)")
99
+ endif()
100
+
101
+ # libFuzzer implies ASAN (libleptris TODO 40 pattern).
102
+ if(YEPTRIS_ENABLE_FUZZING)
103
+ add_compile_options(-fsanitize=fuzzer-no-link,address -fno-omit-frame-pointer -g)
104
+ add_link_options(-fsanitize=fuzzer,address)
105
+ message(STATUS "libFuzzer: ENABLED (implies ASAN)")
106
+ endif()
107
+
108
+ # -------------------------------------------------------------------- LTO --
109
+ if(YEPTRIS_ENABLE_LTO)
110
+ include(CheckIPOSupported)
111
+ check_ipo_supported(RESULT yeptris_lto_supported OUTPUT yeptris_lto_error)
112
+ if(yeptris_lto_supported)
113
+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
114
+ message(STATUS "Link-time optimization: ENABLED")
115
+ else()
116
+ message(WARNING "YEPTRIS_ENABLE_LTO requested but not supported: ${yeptris_lto_error}")
117
+ endif()
118
+ endif()
119
+
120
+ # -------------------------------------------------------------- visibility --
121
+ # Position-independent code for static libraries (embeddable in DSOs).
122
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
123
+
124
+ # Hide all symbols by default; the public surface is exactly the
125
+ # YEPTRIS_API-marked functions (libleptris TODO 80 pattern).
126
+ set(CMAKE_C_VISIBILITY_PRESET hidden)
127
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
128
+ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
129
+
130
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
131
+
132
+ # ---------------------------------------------------------------- warnings --
133
+ # Scoped per-target so fetched dependencies (GTest) keep their own flags.
134
+ function(yeptris_set_warnings target)
135
+ if(MSVC)
136
+ # /wd4100 mirrors -Wno-unused-parameter; /experimental:c11atomics
137
+ # un-breaks the C11 headers' stdatomic gate (the windows sentinel
138
+ # surfaced both — the leg rides in the test matrix now)
139
+ target_compile_options(${target} PRIVATE /W4 /wd4100 /wd4996 /experimental:c11atomics)
140
+ if(YEPTRIS_WARNINGS_AS_ERRORS)
141
+ target_compile_options(${target} PRIVATE /WX)
142
+ endif()
143
+ else()
144
+ target_compile_options(${target} PRIVATE -Wall -Wextra -Wno-unused-parameter)
145
+ if(YEPTRIS_WARNINGS_AS_ERRORS)
146
+ target_compile_options(${target} PRIVATE -Werror)
147
+ endif()
148
+ endif()
149
+ endfunction()
150
+
151
+ # ------------------------------------------------------------- versioning --
152
+ # CMakeLists project(VERSION) is the single source of truth (TODO.impl/01);
153
+ # scripts/bump-version.sh syncs vcpkg.json and CHANGELOG.md from it.
154
+ configure_file(
155
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/include/yeptris/version.h.in
156
+ ${CMAKE_BINARY_DIR}/generated/yeptris/version.h
157
+ @ONLY
158
+ )
159
+
160
+ # --------------------------------------------------------------- subdirs --
161
+ enable_testing()
162
+
163
+ add_subdirectory(src)
164
+
165
+ if(YEPTRIS_BUILD_CLI)
166
+ add_subdirectory(cli)
167
+ endif()
168
+
169
+ if(BUILD_TESTING)
170
+ if(MSVC)
171
+ add_compile_options(-I${CMAKE_SOURCE_DIR}/test/compat)
172
+ endif()
173
+ add_subdirectory(test)
174
+
175
+ # Conformance runner (TODO.impl/16): builds on demand; the corpus
176
+ # arrives via scripts/fetch-corpora.sh.
177
+ add_executable(test_conformance
178
+ test/conformance/main.c
179
+ test/conformance/suite.c
180
+ test/conformance/tree.c)
181
+ # Runs in CI after fetch-corpora.sh; passes-as-skip when absent.
182
+ add_test(NAME conformance
183
+ COMMAND test_conformance ${CMAKE_SOURCE_DIR}/test/conformance/data/yaml-test-suite/src)
184
+ # strict: the suite is at 100% — a regression must fail CI, not hide
185
+ # behind the non-strict exit (a tree-mismatch once slipped through)
186
+ set_tests_properties(conformance PROPERTIES ENVIRONMENT "YEP_STRICT=1")
187
+ # psych-pure's parse-{block,flow,scalar,props,stream} corpora,
188
+ # ported by scripts/port-pure-tml.py (checked-in fixtures)
189
+ add_test(NAME conformance-pure
190
+ COMMAND test_conformance ${CMAKE_SOURCE_DIR}/test/conformance/data/psych-pure)
191
+ set_tests_properties(conformance-pure PROPERTIES ENVIRONMENT "YEP_STRICT=1")
192
+ target_link_libraries(test_conformance PRIVATE yeptris_static)
193
+ target_include_directories(test_conformance PRIVATE
194
+ ${CMAKE_SOURCE_DIR}/src/yeptris
195
+ ${CMAKE_SOURCE_DIR}/src/include
196
+ ${CMAKE_BINARY_DIR}/generated)
197
+ yeptris_set_warnings(test_conformance)
198
+ endif()
199
+
200
+ if(YEPTRIS_BUILD_BENCHMARKS)
201
+ add_subdirectory(benchmarks)
202
+ endif()
203
+
204
+ # --------------------------------------------------------------- install --
205
+ # (TODO.impl/20) targets, headers, pkg-config, and the find_package
206
+ # config; relative paths keep relocatable installs.
207
+ include(GNUInstallDirs)
208
+
209
+ install(TARGETS yeptris_static
210
+ EXPORT yeptris-targets
211
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
212
+ )
213
+ if(TARGET yeptris_jsonc)
214
+ install(TARGETS yeptris_jsonc
215
+ EXPORT yeptris-targets
216
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
217
+ )
218
+ endif()
219
+ if(YEPTRIS_BUILD_CLI AND TARGET yeptris)
220
+ install(TARGETS yeptris DESTINATION ${CMAKE_INSTALL_BINDIR})
221
+ endif()
222
+
223
+ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/include/
224
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
225
+ FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
226
+ )
227
+ install(FILES ${CMAKE_BINARY_DIR}/generated/yeptris/version.h
228
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/yeptris
229
+ )
230
+
231
+ # pkg-config
232
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/yeptris.pc.in
233
+ ${CMAKE_BINARY_DIR}/yeptris.pc @ONLY)
234
+ install(FILES ${CMAKE_BINARY_DIR}/yeptris.pc
235
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
236
+
237
+ # find_package(yeptris) config
238
+ include(CMakePackageConfigHelpers)
239
+ write_basic_package_version_file(
240
+ ${CMAKE_BINARY_DIR}/yeptris-config-version.cmake
241
+ VERSION ${PROJECT_VERSION}
242
+ COMPATIBILITY SameMajorVersion
243
+ )
244
+ install(EXPORT yeptris-targets
245
+ NAMESPACE yeptris::
246
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/yeptris)
247
+ configure_package_config_file(
248
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/yeptris-config.cmake.in
249
+ ${CMAKE_BINARY_DIR}/yeptris-config.cmake
250
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/yeptris)
251
+ install(FILES ${CMAKE_BINARY_DIR}/yeptris-config.cmake
252
+ ${CMAKE_BINARY_DIR}/yeptris-config-version.cmake
253
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/yeptris)
254
+
@@ -0,0 +1,5 @@
1
+ @PACKAGE_INIT@
2
+
3
+ include("${CMAKE_CURRENT_LIST_DIR}/yeptris-targets.cmake")
4
+
5
+ check_required_components(yeptris)
@@ -0,0 +1,11 @@
1
+ prefix=@CMAKE_INSTALL_PREFIX@
2
+ exec_prefix=${prefix}
3
+ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
4
+ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
5
+
6
+ Name: yeptris
7
+ Description: @PROJECT_DESCRIPTION@
8
+ Version: @PROJECT_VERSION@
9
+ URL: https://github.com/leptris/yeptris
10
+ Cflags: -I${includedir}
11
+ Libs: -L${libdir} -lyeptris
@@ -0,0 +1,167 @@
1
+ # libyeptris — core library sources.
2
+ #
3
+ # Subsystems land with their TODO.impl items (common/ 02, memory/ 03,
4
+ # simd/ 04, encoding/ 05, scan/ 06, parse/ 07+). The SIMD per-ISA TUs get
5
+ # their own -m flags here when item 04 lands.
6
+
7
+ set(YEPTRIS_SOURCES
8
+ yeptris/version.c
9
+ yeptris/common/cpu.c
10
+ yeptris/common/chartype.c
11
+ yeptris/common/string_view.c
12
+ yeptris/common/error.c
13
+ yeptris/common/nametab.c
14
+ yeptris/common/simd_text.c
15
+ yeptris/common/simd_text_scalar.c
16
+ yeptris/memory/allocator.c
17
+ yeptris/memory/pool.c
18
+ yeptris/memory/arena.c
19
+ yeptris/encoding/bom.c
20
+ yeptris/encoding/transcode.c
21
+ yeptris/encoding/utf8_validate.c
22
+ yeptris/scan/json.c
23
+ yeptris/scan/scan.c
24
+ yeptris/parse/scalars.c
25
+ yeptris/parse/engine.c
26
+ yeptris/dom/dom.c
27
+ yeptris/dom/hpool.c
28
+ yeptris/dom/mapindex.c
29
+ yeptris/dom/mutate.c
30
+ yeptris/parse.c
31
+ yeptris/build.c
32
+ yeptris/events/capture.c
33
+ yeptris/events/push.c
34
+ yeptris/events/pull.c
35
+ yeptris/events/recorder.c
36
+ yeptris/events/iterparse.c
37
+ yeptris/events/yaml_compat.c
38
+ yeptris/resolve/tags.c
39
+ yeptris/resolve/core12.c
40
+ yeptris/resolve/compat11.c
41
+ yeptris/parse/numbers.c
42
+ yeptris/events/values.c
43
+ yeptris/schema.c
44
+ yeptris/tape.c
45
+ yeptris/plan.c
46
+
47
+ yeptris/marshal.c
48
+ yeptris/visit/json_visit.c
49
+ yeptris/visit/yaml_visit.c
50
+ yeptris/visit/dom_visit.c
51
+ yeptris/emit/style.c
52
+ yeptris/emit/writer.c
53
+ yeptris/emit/emit.c
54
+ yeptris/emit/float/print.c
55
+ yeptris/emit/float/dragon.c
56
+ )
57
+
58
+ if(YEPTRIS_WITH_CBOR)
59
+ list(APPEND YEPTRIS_SOURCES yeptris/cbor/decode.c yeptris/cbor/encode.c)
60
+ endif()
61
+
62
+ # AOT SIMD TUs (TODO.impl/04): per-ISA compile flags; the TUs and the
63
+ # dispatch share architecture guards, so links resolve on every platform.
64
+ # CMAKE_OSX_ARCHITECTURES participates: an -arch x86_64 cross-build on
65
+ # an arm Mac compiles the dispatch for x86 — the source pick must
66
+ # follow the TARGET arch, not the host (the all-platform wheels ride
67
+ # this; host-processor-only selection linked NEON objects into an
68
+ # x86_64 image).
69
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64|i[3-6]86)$" OR
70
+ CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
71
+ list(APPEND YEPTRIS_SOURCES yeptris/common/simd_text_avx2.c)
72
+ if(MSVC)
73
+ set_source_files_properties(yeptris/common/simd_text_avx2.c
74
+ PROPERTIES COMPILE_OPTIONS "/arch:AVX2")
75
+ else()
76
+ set_source_files_properties(yeptris/common/simd_text_avx2.c
77
+ PROPERTIES COMPILE_OPTIONS "-mavx2;-mpopcnt")
78
+ endif()
79
+ elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$" OR
80
+ CMAKE_OSX_ARCHITECTURES MATCHES "arm64") AND NOT CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
81
+ list(APPEND YEPTRIS_SOURCES yeptris/common/simd_text_neon.c)
82
+ endif()
83
+
84
+ set(YEPTRIS_PUBLIC_HEADERS
85
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris.h
86
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/api.h
87
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/dom.h
88
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/error.h
89
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/events.h
90
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/emit.h
91
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/resolve.h
92
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/parse.h
93
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/values.h
94
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/schema.h
95
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/tape.h
96
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/plan.h
97
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/marshal.h
98
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/visit.h
99
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/json.h
100
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/yeptris/types.h
101
+ )
102
+
103
+ set(YEPTRIS_INCLUDE_DIRS
104
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
105
+ $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated>
106
+ )
107
+
108
+ # json-c drop-in (TODO.impl/21): REAL json-c symbol names in its own
109
+ # library — users link -lyeptris-jsonc instead of -ljson-c.
110
+ option(YEPTRIS_BUILD_YAJL_COMPAT
111
+ "Build libyeptris-yajl: the yajl generator drop-in (TODO.impl/21)" ON)
112
+ if(YEPTRIS_BUILD_YAJL_COMPAT AND YEPTRIS_BUILD_STATIC)
113
+ add_library(yeptris_yajl STATIC yeptris/jsonapi/yajl_compat.c)
114
+ set_target_properties(yeptris_yajl PROPERTIES OUTPUT_NAME yeptris-yajl)
115
+ target_link_libraries(yeptris_yajl PUBLIC yeptris_static)
116
+ target_include_directories(yeptris_yajl PUBLIC
117
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
118
+ target_include_directories(yeptris_yajl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/yeptris)
119
+ yeptris_set_warnings(yeptris_yajl)
120
+ add_library(yeptris::yajl ALIAS yeptris_yajl)
121
+ endif()
122
+
123
+ if(YEPTRIS_BUILD_JSONC_COMPAT AND YEPTRIS_BUILD_STATIC)
124
+ add_library(yeptris_jsonc STATIC yeptris/jsonapi/jsonc_compat.c)
125
+ set_target_properties(yeptris_jsonc PROPERTIES OUTPUT_NAME yeptris-jsonc)
126
+ target_link_libraries(yeptris_jsonc PUBLIC yeptris_static)
127
+ target_include_directories(yeptris_jsonc PUBLIC
128
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
129
+ # internal headers (emit/writer.h, float/api.h): PRIVATE — they
130
+ # never leak into the compat library's public interface
131
+ target_include_directories(yeptris_jsonc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/yeptris)
132
+ yeptris_set_warnings(yeptris_jsonc)
133
+ add_library(yeptris::jsonc ALIAS yeptris_jsonc)
134
+ endif()
135
+
136
+ if(YEPTRIS_BUILD_STATIC)
137
+ find_package(Threads REQUIRED)
138
+
139
+ add_library(yeptris_static STATIC ${YEPTRIS_SOURCES})
140
+ add_library(yeptris::yeptris ALIAS yeptris_static)
141
+ set_target_properties(yeptris_static PROPERTIES OUTPUT_NAME yeptris)
142
+ target_include_directories(yeptris_static
143
+ PUBLIC ${YEPTRIS_INCLUDE_DIRS}
144
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/yeptris) # internal root-relative includes
145
+ target_compile_definitions(yeptris_static PRIVATE YEPTRIS_BUILDING)
146
+ if(YEPTRIS_WITH_CBOR)
147
+ target_compile_definitions(yeptris_static PUBLIC YEPTRIS_WITH_CBOR)
148
+ endif()
149
+ target_link_libraries(yeptris_static PRIVATE Threads::Threads)
150
+ yeptris_set_warnings(yeptris_static)
151
+ endif()
152
+
153
+ if(YEPTRIS_BUILD_SHARED)
154
+ add_library(yeptris_shared SHARED ${YEPTRIS_SOURCES})
155
+ set_target_properties(yeptris_shared
156
+ PROPERTIES OUTPUT_NAME yeptris
157
+ SOVERSION ${PROJECT_VERSION_MAJOR})
158
+ target_include_directories(yeptris_shared
159
+ PUBLIC ${YEPTRIS_INCLUDE_DIRS}
160
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/yeptris
161
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/yeptris/emit/float)
162
+ target_compile_definitions(yeptris_shared PRIVATE YEPTRIS_BUILDING)
163
+ if(YEPTRIS_WITH_CBOR)
164
+ target_compile_definitions(yeptris_shared PUBLIC YEPTRIS_WITH_CBOR)
165
+ endif()
166
+ yeptris_set_warnings(yeptris_shared)
167
+ endif()
@@ -0,0 +1,32 @@
1
+ /* api.h — export control for libyeptris.
2
+ *
3
+ * The library is built with hidden visibility; exactly the YEPTRIS_API-marked
4
+ * surface is exported. Define YEPTRIS_BUILDING when compiling libyeptris
5
+ * itself; define YEPTRIS_SHARED when consuming the shared library on Windows.
6
+ */
7
+ #ifndef YEPTRIS_API_H
8
+ /* YEPTRIS_CT_ASSERT — the compile-time layout gate, C99/MSVC-C-mode/
9
+ * C++ portable (typedef-array; libleptris's same migration): the old
10
+ * C11 _Static_assert was the ONE C11 feature pinning the standard. */
11
+ #define YEPTRIS_CT_ASSERT_(cond, line) typedef char yeptris_ct_assert_##line[(cond) ? 1 : -1]
12
+ #define YEPTRIS_CT_ASSERT(cond) YEPTRIS_CT_ASSERT_(cond, __LINE__)
13
+
14
+ #define YEPTRIS_API_H
15
+
16
+ #if defined(YEPTRIS_BUILDING) && defined(YEPTRIS_SHARED)
17
+ #error "define YEPTRIS_BUILDING (building) or YEPTRIS_SHARED (consuming), not both"
18
+ #endif
19
+
20
+ #if defined(YEPTRIS_BUILDING)
21
+ #if defined(_WIN32) || defined(__CYGWIN__)
22
+ #define YEPTRIS_API __declspec(dllexport)
23
+ #else
24
+ #define YEPTRIS_API __attribute__((visibility("default")))
25
+ #endif
26
+ #elif defined(YEPTRIS_SHARED) && (defined(_WIN32) || defined(__CYGWIN__))
27
+ #define YEPTRIS_API __declspec(dllimport)
28
+ #else
29
+ #define YEPTRIS_API
30
+ #endif
31
+
32
+ #endif /* YEPTRIS_API_H */
@@ -0,0 +1,101 @@
1
+ /* cbor.h — the CBOR (RFC 8949) public surface (TODO.cbor).
2
+ *
3
+ * CBOR is the JSON data model in binary: decode builds the same DOM
4
+ * yeptris_parse_json builds, so every query, emit, and binding API
5
+ * applies unchanged. The surface compiles only when the library was
6
+ * built with YEPTRIS_WITH_CBOR (the default). */
7
+ #ifndef YEPTRIS_CBOR_H
8
+ #define YEPTRIS_CBOR_H
9
+
10
+ #include <stddef.h>
11
+
12
+ #include <yeptris/api.h>
13
+ #include <yeptris/error.h>
14
+ #include <yeptris/types.h>
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ /* Flags. */
21
+ #define YEPTRIS_CBOR_STRICT \
22
+ 0x1u /* decode: reject non-minimal length \
23
+ arguments and non-text-string map keys \
24
+ (the deterministic profile's input side) */
25
+ #define YEPTRIS_CBOR_CANONICAL \
26
+ 0x2u /* encode: RFC 8949 s4.2.1 core \
27
+ deterministic profile — minimal lengths, \
28
+ definite lengths, preferred floats, map \
29
+ keys sorted bytewise on their encoded \
30
+ forms (the length-first variant of \
31
+ s4.2.3 is NOT selected) */
32
+
33
+ /* Decodes ONE CBOR data item (RFC 8949). buf must remain valid for the
34
+ * lifetime of the returned document (string values are borrowed
35
+ * zero-copy views; indefinite-length chunks concatenate in the
36
+ * document's arena). Trailing bytes after the item are an error —
37
+ * CBOR Sequences (RFC 8742) get their own entry point.
38
+ *
39
+ * Representation notes (full ledger in src/yeptris/cbor/decode.c):
40
+ * integers beyond int64 materialize as shortest-double text; bignums
41
+ * (tags 2/3) stay tag+bytes; byte and text strings are tag-str
42
+ * scalars; undefined and unassigned simple values are diagnostic text
43
+ * ("undefined", "simple(N)"); tag chains ride the node's tag field as
44
+ * a space-separated decimal chain, outermost first.
45
+ *
46
+ * On failure returns NULL; *status (may be NULL) receives the code
47
+ * (YEPTRIS_ERROR_PARSE well-formedness, YEPTRIS_ERROR_ENCODING UTF-8,
48
+ * YEPTRIS_ERROR_DEPTH nesting, YEPTRIS_ERROR_MEMORY) and
49
+ * yeptris_last_error() carries the message with the byte offset.
50
+ *
51
+ * Memory: the caller owns the document; yeptris_document_free releases
52
+ * everything in one call. */
53
+ YEPTRIS_API YeptrisDocument yeptris_cbor_decode(const void* buf, size_t len, uint32_t opts,
54
+ YeptrisStatus* status);
55
+
56
+ /* CBOR Sequences (RFC 8742): top-level data items, concatenated —
57
+ * no framing bytes. Iterates the buffer, one document per item; the
58
+ * callback OWNS each item (free it with yeptris_document_free) and
59
+ * its nonzero return aborts the iteration. Returns the item count
60
+ * delivered so far. An empty sequence is valid (0 items). A truncated
61
+ * or malformed trailing item fails YEPTRIS_ERROR_PARSE with the item
62
+ * index and byte offset on the error channel. opts: decode flags. */
63
+ typedef int (*yeptris_cbor_item_cb)(void* ctx, YeptrisDocument item, size_t index);
64
+ YEPTRIS_API size_t yeptris_cbor_decode_sequence(const void* buf, size_t len, uint32_t opts,
65
+ yeptris_cbor_item_cb cb, void* ctx,
66
+ YeptrisStatus* status);
67
+
68
+ /* Encodes n documents as a CBOR Sequence: the concatenation of the
69
+ * items (opts as yeptris_cbor_encode_into). buf == NULL: the exact
70
+ * byte count. Otherwise writes at most cap and returns the count; a
71
+ * too-small cap writes nothing and returns the need. Returns 0 on a
72
+ * NULL items entry or an unencodable document. */
73
+ YEPTRIS_API size_t yeptris_cbor_encode_sequence_into(YeptrisDocument* items, size_t n,
74
+ uint32_t opts, void* buf, size_t cap);
75
+
76
+ /* Convenience: the sequence in a malloc'd buffer — caller frees. */
77
+ YEPTRIS_API void* yeptris_cbor_encode_sequence(YeptrisDocument* items, size_t n, uint32_t opts,
78
+ size_t* len);
79
+
80
+ /* Encodes the document's first root as ONE data item (sequences are a
81
+ * separate surface). buf == NULL: returns the exact byte count needed.
82
+ * Otherwise writes at most cap bytes and returns the count written; a
83
+ * too-small cap writes nothing and returns the needed size. Returns 0
84
+ * on a NULL document or an unencodable one (aliases, non-decimal tag
85
+ * text, non-numeric INT/FLOAT text) — yeptris_last_error() says why.
86
+ *
87
+ * Canonical opts sort map keys (s4.2.1); without it, insertion order.
88
+ * encode(decode(x)) is byte-stable across repeated calls. */
89
+ YEPTRIS_API size_t yeptris_cbor_encode_into(YeptrisDocument doc, uint32_t opts, void* buf,
90
+ size_t cap);
91
+
92
+ /* Convenience: encodes into a malloc'd buffer — caller frees with
93
+ * free(). Returns NULL on failure; *len (may be NULL) receives the
94
+ * byte count. */
95
+ YEPTRIS_API void* yeptris_cbor_encode(YeptrisDocument doc, uint32_t opts, size_t* len);
96
+
97
+ #ifdef __cplusplus
98
+ }
99
+ #endif
100
+
101
+ #endif /* YEPTRIS_CBOR_H */