yeptris 0.6.64.0-riscv64-linux-gnu
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.
- checksums.yaml +7 -0
- data/README.adoc +150 -0
- data/ext/build_windows_native.rb +60 -0
- data/ext/libyeptris/extconf.rb +57 -0
- data/ext/yeptris_native/cbor_ruby.c +198 -0
- data/ext/yeptris_native/extconf.rb +99 -0
- data/ext/yeptris_native/json_ruby.c +414 -0
- data/ext/yeptris_native/version.h +29 -0
- data/ext/yeptris_native/yeptris_native.c +507 -0
- data/lib/yeptris/3.3/native.so +0 -0
- data/lib/yeptris/cbor.rb +169 -0
- data/lib/yeptris/document.rb +319 -0
- data/lib/yeptris/ffi.rb +572 -0
- data/lib/yeptris/json/descriptor.rb +266 -0
- data/lib/yeptris/json.rb +502 -0
- data/lib/yeptris/materializer.rb +389 -0
- data/lib/yeptris/node.rb +482 -0
- data/lib/yeptris/psych/class_loader.rb +24 -0
- data/lib/yeptris/psych/coder_shim.rb +55 -0
- data/lib/yeptris/psych/drop_in.rb +63 -0
- data/lib/yeptris/psych/encodable.rb +14 -0
- data/lib/yeptris/psych/handler.rb +95 -0
- data/lib/yeptris/psych/parser.rb +114 -0
- data/lib/yeptris/psych/scalar_scanner.rb +149 -0
- data/lib/yeptris/psych/tree_builder.rb +119 -0
- data/lib/yeptris/psych/visitors.rb +670 -0
- data/lib/yeptris/psych.rb +796 -0
- data/lib/yeptris/schema.rb +253 -0
- data/lib/yeptris/validation.rb +320 -0
- data/lib/yeptris/valueml.rb +477 -0
- data/lib/yeptris/yaml/descriptor.rb +56 -0
- data/lib/yeptris/yaml.rb +668 -0
- data/lib/yeptris.rb +130 -0
- data/libyeptris.so +0 -0
- data/vendor/libyeptris/CMakeLists.txt +280 -0
- data/vendor/libyeptris/cmake/yeptris-config.cmake.in +5 -0
- data/vendor/libyeptris/cmake/yeptris.pc.in +11 -0
- data/vendor/libyeptris/src/CMakeLists.txt +183 -0
- data/vendor/libyeptris/src/include/yeptris/api.h +32 -0
- data/vendor/libyeptris/src/include/yeptris/cbor.h +174 -0
- data/vendor/libyeptris/src/include/yeptris/dom.h +196 -0
- data/vendor/libyeptris/src/include/yeptris/emit.h +128 -0
- data/vendor/libyeptris/src/include/yeptris/error.h +42 -0
- data/vendor/libyeptris/src/include/yeptris/events.h +171 -0
- data/vendor/libyeptris/src/include/yeptris/json.h +57 -0
- data/vendor/libyeptris/src/include/yeptris/json.hpp +258 -0
- data/vendor/libyeptris/src/include/yeptris/jsonc_compat.h +115 -0
- data/vendor/libyeptris/src/include/yeptris/marshal.h +75 -0
- data/vendor/libyeptris/src/include/yeptris/parse.h +121 -0
- data/vendor/libyeptris/src/include/yeptris/plan.h +100 -0
- data/vendor/libyeptris/src/include/yeptris/resolve.h +81 -0
- data/vendor/libyeptris/src/include/yeptris/schema.h +121 -0
- data/vendor/libyeptris/src/include/yeptris/tape.h +128 -0
- data/vendor/libyeptris/src/include/yeptris/types.h +38 -0
- data/vendor/libyeptris/src/include/yeptris/validate.h +401 -0
- data/vendor/libyeptris/src/include/yeptris/values.h +108 -0
- data/vendor/libyeptris/src/include/yeptris/version.h.in +29 -0
- data/vendor/libyeptris/src/include/yeptris/visit.h +77 -0
- data/vendor/libyeptris/src/include/yeptris/yajl_compat.h +135 -0
- data/vendor/libyeptris/src/include/yeptris.h +24 -0
- data/vendor/libyeptris/src/yeptris/build.c +393 -0
- data/vendor/libyeptris/src/yeptris/cbor/cbor.h +35 -0
- data/vendor/libyeptris/src/yeptris/cbor/decode.c +1054 -0
- data/vendor/libyeptris/src/yeptris/cbor/encode.c +836 -0
- data/vendor/libyeptris/src/yeptris/cbor/encode_priv.h +32 -0
- data/vendor/libyeptris/src/yeptris/cbor/from_marshal.c +982 -0
- data/vendor/libyeptris/src/yeptris/cbor/sink.h +36 -0
- data/vendor/libyeptris/src/yeptris/common/chartype.c +41 -0
- data/vendor/libyeptris/src/yeptris/common/chartype.h +77 -0
- data/vendor/libyeptris/src/yeptris/common/cpu.c +81 -0
- data/vendor/libyeptris/src/yeptris/common/cpu.h +40 -0
- data/vendor/libyeptris/src/yeptris/common/error.c +65 -0
- data/vendor/libyeptris/src/yeptris/common/error.h +81 -0
- data/vendor/libyeptris/src/yeptris/common/mutex.h +45 -0
- data/vendor/libyeptris/src/yeptris/common/nametab.c +275 -0
- data/vendor/libyeptris/src/yeptris/common/nametab.h +68 -0
- data/vendor/libyeptris/src/yeptris/common/port.h +74 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text.c +49 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text.h +342 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text_avx2.c +672 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text_neon.c +793 -0
- data/vendor/libyeptris/src/yeptris/common/simd_text_scalar.c +324 -0
- data/vendor/libyeptris/src/yeptris/common/string_view.c +34 -0
- data/vendor/libyeptris/src/yeptris/common/string_view.h +93 -0
- data/vendor/libyeptris/src/yeptris/doc.h +86 -0
- data/vendor/libyeptris/src/yeptris/dom/dom.c +1312 -0
- data/vendor/libyeptris/src/yeptris/dom/dom.h +332 -0
- data/vendor/libyeptris/src/yeptris/dom/hpool.c +107 -0
- data/vendor/libyeptris/src/yeptris/dom/mapindex.c +173 -0
- data/vendor/libyeptris/src/yeptris/dom/mapindex.h +61 -0
- data/vendor/libyeptris/src/yeptris/dom/mutate.c +431 -0
- data/vendor/libyeptris/src/yeptris/dom/ytape.c +2323 -0
- data/vendor/libyeptris/src/yeptris/dom/ytape.h +96 -0
- data/vendor/libyeptris/src/yeptris/emit/emit.c +670 -0
- data/vendor/libyeptris/src/yeptris/emit/float/api.h +43 -0
- data/vendor/libyeptris/src/yeptris/emit/float/dragon.c +405 -0
- data/vendor/libyeptris/src/yeptris/emit/float/floatint.h +231 -0
- data/vendor/libyeptris/src/yeptris/emit/float/fpconv.c +428 -0
- data/vendor/libyeptris/src/yeptris/emit/float/print.c +396 -0
- data/vendor/libyeptris/src/yeptris/emit/style.c +21 -0
- data/vendor/libyeptris/src/yeptris/emit/style.h +32 -0
- data/vendor/libyeptris/src/yeptris/emit/writer.c +1951 -0
- data/vendor/libyeptris/src/yeptris/emit/writer.h +111 -0
- data/vendor/libyeptris/src/yeptris/encoding/bom.c +31 -0
- data/vendor/libyeptris/src/yeptris/encoding/encoding.h +63 -0
- data/vendor/libyeptris/src/yeptris/encoding/transcode.c +157 -0
- data/vendor/libyeptris/src/yeptris/encoding/utf8_validate.c +178 -0
- data/vendor/libyeptris/src/yeptris/events/capture.c +166 -0
- data/vendor/libyeptris/src/yeptris/events/capture.h +39 -0
- data/vendor/libyeptris/src/yeptris/events/iterparse.c +298 -0
- data/vendor/libyeptris/src/yeptris/events/pull.c +117 -0
- data/vendor/libyeptris/src/yeptris/events/push.c +151 -0
- data/vendor/libyeptris/src/yeptris/events/recorder.c +144 -0
- data/vendor/libyeptris/src/yeptris/events/values.c +630 -0
- data/vendor/libyeptris/src/yeptris/events/values_priv.h +53 -0
- data/vendor/libyeptris/src/yeptris/events/yaml_compat.c +86 -0
- data/vendor/libyeptris/src/yeptris/events/yaml_compat.h +90 -0
- data/vendor/libyeptris/src/yeptris/jsonapi/jsonc_compat.c +687 -0
- data/vendor/libyeptris/src/yeptris/jsonapi/yajl_compat.c +728 -0
- data/vendor/libyeptris/src/yeptris/marshal/to_json.c +650 -0
- data/vendor/libyeptris/src/yeptris/marshal.c +988 -0
- data/vendor/libyeptris/src/yeptris/memory/allocator.c +20 -0
- data/vendor/libyeptris/src/yeptris/memory/allocator.h +43 -0
- data/vendor/libyeptris/src/yeptris/memory/arena.c +150 -0
- data/vendor/libyeptris/src/yeptris/memory/arena.h +52 -0
- data/vendor/libyeptris/src/yeptris/memory/pool.c +133 -0
- data/vendor/libyeptris/src/yeptris/memory/pool.h +36 -0
- data/vendor/libyeptris/src/yeptris/parse/engine.c +6528 -0
- data/vendor/libyeptris/src/yeptris/parse/engine.h +96 -0
- data/vendor/libyeptris/src/yeptris/parse/events.h +137 -0
- data/vendor/libyeptris/src/yeptris/parse/numbers.c +374 -0
- data/vendor/libyeptris/src/yeptris/parse/numbers.h +33 -0
- data/vendor/libyeptris/src/yeptris/parse/scalars.c +435 -0
- data/vendor/libyeptris/src/yeptris/parse/scalars.h +87 -0
- data/vendor/libyeptris/src/yeptris/parse/stream_iter.c +358 -0
- data/vendor/libyeptris/src/yeptris/parse.c +1074 -0
- data/vendor/libyeptris/src/yeptris/plan.c +824 -0
- data/vendor/libyeptris/src/yeptris/resolve/compat11.c +339 -0
- data/vendor/libyeptris/src/yeptris/resolve/core12.c +153 -0
- data/vendor/libyeptris/src/yeptris/resolve/full12.c +201 -0
- data/vendor/libyeptris/src/yeptris/resolve/json12.c +109 -0
- data/vendor/libyeptris/src/yeptris/resolve/resolver.h +103 -0
- data/vendor/libyeptris/src/yeptris/resolve/tags.c +250 -0
- data/vendor/libyeptris/src/yeptris/scan/json.c +839 -0
- data/vendor/libyeptris/src/yeptris/scan/json.h +116 -0
- data/vendor/libyeptris/src/yeptris/scan/scan.c +862 -0
- data/vendor/libyeptris/src/yeptris/scan/scan.h +177 -0
- data/vendor/libyeptris/src/yeptris/schema.c +309 -0
- data/vendor/libyeptris/src/yeptris/tape.c +2375 -0
- data/vendor/libyeptris/src/yeptris/tape_in.h +39 -0
- data/vendor/libyeptris/src/yeptris/validate/compile.c +306 -0
- data/vendor/libyeptris/src/yeptris/validate/internal.h +347 -0
- data/vendor/libyeptris/src/yeptris/validate/jsonschema.c +1922 -0
- data/vendor/libyeptris/src/yeptris/validate/output.c +246 -0
- data/vendor/libyeptris/src/yeptris/validate/regexp.c +1600 -0
- data/vendor/libyeptris/src/yeptris/validate/registry.c +118 -0
- data/vendor/libyeptris/src/yeptris/validate/resources.c +601 -0
- data/vendor/libyeptris/src/yeptris/validate/stream.c +1155 -0
- data/vendor/libyeptris/src/yeptris/validate/validate.c +1043 -0
- data/vendor/libyeptris/src/yeptris/version.c +7 -0
- data/vendor/libyeptris/src/yeptris/visit/dom_visit.c +115 -0
- data/vendor/libyeptris/src/yeptris/visit/json_visit.c +293 -0
- data/vendor/libyeptris/src/yeptris/visit/yaml_visit.c +127 -0
- metadata +221 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* parse.h — the parse entry points (TODO.impl/07/11 public surface). */
|
|
2
|
+
|
|
3
|
+
#ifndef YEPTRIS_PARSE_H
|
|
4
|
+
#define YEPTRIS_PARSE_H
|
|
5
|
+
|
|
6
|
+
#include <stddef.h>
|
|
7
|
+
|
|
8
|
+
#include <yeptris/api.h>
|
|
9
|
+
#include <yeptris/error.h>
|
|
10
|
+
#include <yeptris/resolve.h>
|
|
11
|
+
#include <yeptris/types.h>
|
|
12
|
+
|
|
13
|
+
#ifdef __cplusplus
|
|
14
|
+
extern "C" {
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
/* Parses a YAML document set. buf must remain valid for the lifetime of
|
|
18
|
+
* the returned document (scalar values are borrowed zero-copy views).
|
|
19
|
+
* On failure returns NULL; *status (may be NULL) receives the code and
|
|
20
|
+
* yeptris_last_error() carries the message with line/column.
|
|
21
|
+
*
|
|
22
|
+
* Memory: the caller owns the document; free it with
|
|
23
|
+
* yeptris_document_free — one call releases everything. */
|
|
24
|
+
YEPTRIS_API YeptrisDocument yeptris_parse(const char* buf, size_t len, YeptrisStatus* status);
|
|
25
|
+
|
|
26
|
+
/* Per-parse options (TODO.impl/10): schema selects the implicit-typing
|
|
27
|
+
* resolver (default YEPTRIS_SCHEMA_12_CORE), max_depth caps nesting
|
|
28
|
+
* (0: the library default), strict/tab_policy/recover are reserved
|
|
29
|
+
* pins of the option shape (the strict grammar is the default today;
|
|
30
|
+
* lenient modes land with the recover work). Zero-initialized = the
|
|
31
|
+
* yeptris_parse defaults. */
|
|
32
|
+
typedef struct YeptrisParseOptions {
|
|
33
|
+
YeptrisSchema schema;
|
|
34
|
+
int max_depth;
|
|
35
|
+
int strict;
|
|
36
|
+
int tab_policy;
|
|
37
|
+
int recover;
|
|
38
|
+
} YeptrisParseOptions;
|
|
39
|
+
|
|
40
|
+
YEPTRIS_API YeptrisDocument yeptris_parse_ex(const char* buf, size_t len,
|
|
41
|
+
const YeptrisParseOptions* opts,
|
|
42
|
+
YeptrisStatus* status);
|
|
43
|
+
|
|
44
|
+
/* ---- tolerant per-document stream iteration (#921) ----------------------
|
|
45
|
+
*
|
|
46
|
+
* load_stream parses the whole stream and aborts on the first bad
|
|
47
|
+
* document; this iterator frames documents engine-side (the abort-at-
|
|
48
|
+
* DOCUMENT_END run — scanner-accurate: a quoted scalar spanning a
|
|
49
|
+
* marker-looking line never splits) and reports failures PER DOCUMENT:
|
|
50
|
+
* a parse-class error surfaces as the step's status with NULL *out, the
|
|
51
|
+
* error channel carrying the failed document's own line/col (each run
|
|
52
|
+
* starts at the frame), and the iterator resynced to the next line-
|
|
53
|
+
* start marker — the host keeps calling and keeps the valid documents.
|
|
54
|
+
*
|
|
55
|
+
* yeptris_stream_iter* it = yeptris_stream_iter_new(buf, len, &opts);
|
|
56
|
+
* YeptrisDocument doc;
|
|
57
|
+
* size_t index;
|
|
58
|
+
* YeptrisStatus st;
|
|
59
|
+
* while ((st = yeptris_stream_iter_next(it, &doc, &index)) == YEPTRIS_OK && doc != NULL) {
|
|
60
|
+
* // doc is document `index` of the stream; free it with
|
|
61
|
+
* // yeptris_document_free
|
|
62
|
+
* }
|
|
63
|
+
* // st == OK && doc == NULL: the stream is over; st != OK: document
|
|
64
|
+
* // `index` failed (per-document line/col via
|
|
65
|
+
* // yeptris_stream_iter_status), keep iterating.
|
|
66
|
+
*
|
|
67
|
+
* Memory: the caller owns each *out (yeptris_document_free). The
|
|
68
|
+
* iterator borrows `buf` until free. Each document parses twice (the
|
|
69
|
+
* boundary run + the slice parse) — the tolerance contract is the
|
|
70
|
+
* point; a single-pass upgrade rides the same seam when needed.
|
|
71
|
+
*/
|
|
72
|
+
typedef struct yeptris_stream_iter yeptris_stream_iter;
|
|
73
|
+
|
|
74
|
+
/* The iterator borrows `buf` until free; `opts` is borrowed (may be
|
|
75
|
+
* NULL: the 12_CORE defaults). NULL on arg/alloc failure. */
|
|
76
|
+
YEPTRIS_API yeptris_stream_iter* yeptris_stream_iter_new(const char* buf, size_t len,
|
|
77
|
+
const YeptrisParseOptions* opts);
|
|
78
|
+
|
|
79
|
+
/* The next document: OK + *out = the document (the caller frees it);
|
|
80
|
+
* a parse/DEPTH-class DOCUMENT failure: that status + *out = NULL +
|
|
81
|
+
* the error channel set for THAT document — the iterator has already
|
|
82
|
+
* resynced, keep calling; OK + *out = NULL: the stream is over;
|
|
83
|
+
* MEMORY/ENCODING: stream-fatal, the iterator is done. *index (may be
|
|
84
|
+
* NULL) is the 0-based stream document index this step consumed
|
|
85
|
+
* (failures consume an index too — the yield order is the stream's). */
|
|
86
|
+
YEPTRIS_API YeptrisStatus yeptris_stream_iter_next(yeptris_stream_iter* it, YeptrisDocument* out,
|
|
87
|
+
size_t* index);
|
|
88
|
+
|
|
89
|
+
/* The LAST step's per-document verdict and its 1-based line/col
|
|
90
|
+
* (0/0 when the last step was a success or the stream end). */
|
|
91
|
+
YEPTRIS_API YeptrisStatus yeptris_stream_iter_status(const yeptris_stream_iter* it, uint32_t* line,
|
|
92
|
+
uint32_t* col);
|
|
93
|
+
|
|
94
|
+
/* The last successful step's document SLICE inside the iterator's
|
|
95
|
+
* buffer space (post-gate: BOM/transcode/normalization may have moved
|
|
96
|
+
* the buffer — the offsets are relative to the CURRENT buf the
|
|
97
|
+
* iterator holds, which is the space `yeptris_stream_iter_next`'s
|
|
98
|
+
* documents live in). Hosts that materialize through their own value
|
|
99
|
+
* route (the Python/Rust/TS drains) re-parse exactly these bytes and
|
|
100
|
+
* inherit the engine's framing without a DOM walk: one typing SSOT —
|
|
101
|
+
* the drain — and scanner-accurate frames. ARG on NULL; ARG when the
|
|
102
|
+
* last step was not a successful document. */
|
|
103
|
+
YEPTRIS_API YeptrisStatus yeptris_stream_iter_slice(const yeptris_stream_iter* it, size_t* off,
|
|
104
|
+
size_t* len);
|
|
105
|
+
|
|
106
|
+
/* The iterator's ACTIVE buffer (the caller's bytes, or the post-gate
|
|
107
|
+
* owned copy after a BOM strip / UTF-16-32 transcode / NEL-LS-PS
|
|
108
|
+
* normalization) and its length. `yeptris_stream_iter_slice`'s offsets
|
|
109
|
+
* index THIS buffer — hosts copy their frame bytes out of here
|
|
110
|
+
* (ctypes.string_at / Rust slice / TS Buffer) and re-parse them through
|
|
111
|
+
* their own drain. Borrowed: valid until yeptris_stream_iter_free. */
|
|
112
|
+
YEPTRIS_API YeptrisStatus yeptris_stream_iter_buffer(const yeptris_stream_iter* it,
|
|
113
|
+
const char** buf, size_t* len);
|
|
114
|
+
|
|
115
|
+
YEPTRIS_API void yeptris_stream_iter_free(yeptris_stream_iter* it);
|
|
116
|
+
|
|
117
|
+
#ifdef __cplusplus
|
|
118
|
+
}
|
|
119
|
+
#endif
|
|
120
|
+
|
|
121
|
+
#endif /* YEPTRIS_PARSE_H */
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* plan.h — the compiled plan walk (TODO.restructure/87 slice one,
|
|
2
|
+
* yeptris#293): a Descriptor-shaped plan compiled from a JSON spec,
|
|
3
|
+
* applied to a parsed JSON tape in ONE C pass producing typed
|
|
4
|
+
* COLUMNAR output — no Ruby/Python tree, no per-node host dispatch.
|
|
5
|
+
*
|
|
6
|
+
* Slice one covers the lutaml-model shape: a root collection (seq or
|
|
7
|
+
* map-of-rows) whose rows are mappings of scalar leaves (int, float,
|
|
8
|
+
* str, bool). Nested paths, the YAML leg, and partial descriptors
|
|
9
|
+
* compose later per the board item.
|
|
10
|
+
*
|
|
11
|
+
* The plan borrows nothing; the result borrows the tape's source
|
|
12
|
+
* buffer for string spans (free the result before the tape/source).
|
|
13
|
+
*/
|
|
14
|
+
#ifndef YEPTRIS_PLAN_H
|
|
15
|
+
#define YEPTRIS_PLAN_H
|
|
16
|
+
|
|
17
|
+
#include <stddef.h>
|
|
18
|
+
#include <stdint.h>
|
|
19
|
+
|
|
20
|
+
#include <yeptris/api.h>
|
|
21
|
+
#include <yeptris/error.h>
|
|
22
|
+
#include <yeptris/tape.h>
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
/* Column kinds (mirrors the spec's leaf "kind"). */
|
|
29
|
+
enum {
|
|
30
|
+
YEP_PLAN_INT = 0,
|
|
31
|
+
YEP_PLAN_FLOAT,
|
|
32
|
+
YEP_PLAN_STR,
|
|
33
|
+
YEP_PLAN_BOOL,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
typedef struct yeptris_plan yeptris_plan;
|
|
37
|
+
typedef struct yeptris_plan_result yeptris_plan_result;
|
|
38
|
+
|
|
39
|
+
/* Compiles a plan from a strict-JSON spec document:
|
|
40
|
+
*
|
|
41
|
+
* {"kind":"seq","path":"items","children":[
|
|
42
|
+
* {"name":"id","kind":"int"}, {"name":"ok","kind":"bool"}, ...]}
|
|
43
|
+
*
|
|
44
|
+
* kind: "seq" or "map" — the ROWS container's shape at the root.
|
|
45
|
+
* path: the root mapping's key holding the rows — a string, or an
|
|
46
|
+
* ARRAY of strings for a segmented (nested) path walked
|
|
47
|
+
* mapping by mapping. Empty/absent: the seq root itself.
|
|
48
|
+
* Leaf kinds: int, float, str, bool. Returns NULL with *st on
|
|
49
|
+
* a malformed spec (ARG/PARSE) or allocation failure. */
|
|
50
|
+
YEPTRIS_API yeptris_plan* yeptris_plan_compile(const char* spec, size_t len, YeptrisStatus* st);
|
|
51
|
+
|
|
52
|
+
YEPTRIS_API void yeptris_plan_free(yeptris_plan* plan);
|
|
53
|
+
|
|
54
|
+
YEPTRIS_API size_t yeptris_plan_column_count(const yeptris_plan* plan);
|
|
55
|
+
|
|
56
|
+
/* Applies the plan to a tape (from yeptris_parse_json_tape; the
|
|
57
|
+
* LENIENT tape also works — NUM records convert at extraction).
|
|
58
|
+
* Every row of the collection fills one slot per column; missing or
|
|
59
|
+
* null leaves mark the slot null. Returns NULL with *st on
|
|
60
|
+
* PARSE (document shape disagreement) or MEMORY. */
|
|
61
|
+
YEPTRIS_API yeptris_plan_result*
|
|
62
|
+
yeptris_tape_plan_walk(const yeptris_json_tape* tape, const yeptris_plan* plan, YeptrisStatus* st);
|
|
63
|
+
|
|
64
|
+
/* The YAML/DOM leg: the same compiled plan applied to a parsed
|
|
65
|
+
* yeptris document (yeptris_parse — any schema). Typed extraction
|
|
66
|
+
* rides the parse-time tag ids; string columns expose (ptr,len)
|
|
67
|
+
* views into the document's regions (input or string arena), so the
|
|
68
|
+
* RESULT BORROWS the document — free the result first. Same status
|
|
69
|
+
* contract as the tape walk. */
|
|
70
|
+
YEPTRIS_API yeptris_plan_result*
|
|
71
|
+
yeptris_document_plan_walk(YeptrisDocument doc, const yeptris_plan* plan, YeptrisStatus* st);
|
|
72
|
+
|
|
73
|
+
YEPTRIS_API void yeptris_plan_result_free(yeptris_plan_result* r);
|
|
74
|
+
|
|
75
|
+
/* Result accessors: rows, and per-column kind + typed arrays. The
|
|
76
|
+
* arrays hold `rows` entries; NULL markers are the per-column u8
|
|
77
|
+
* bitmap (1 = null/missing). String columns expose spans into the
|
|
78
|
+
* tape's source. */
|
|
79
|
+
YEPTRIS_API size_t yeptris_plan_result_rows(const yeptris_plan_result* r);
|
|
80
|
+
YEPTRIS_API int yeptris_plan_result_kind(const yeptris_plan_result* r, size_t col);
|
|
81
|
+
YEPTRIS_API const int64_t* yeptris_plan_result_ints(const yeptris_plan_result* r, size_t col);
|
|
82
|
+
YEPTRIS_API const double* yeptris_plan_result_floats(const yeptris_plan_result* r, size_t col);
|
|
83
|
+
YEPTRIS_API const uint32_t* yeptris_plan_result_str_offs(const yeptris_plan_result* r, size_t col);
|
|
84
|
+
YEPTRIS_API const uint32_t* yeptris_plan_result_str_lens(const yeptris_plan_result* r, size_t col);
|
|
85
|
+
/* The DOM leg's string column: rows (ptr,len) views into the
|
|
86
|
+
* document (NULL on the tape leg — use the offs/lens pair there). */
|
|
87
|
+
typedef struct yeptris_plan_str {
|
|
88
|
+
const char* p;
|
|
89
|
+
size_t len;
|
|
90
|
+
} yeptris_plan_str;
|
|
91
|
+
|
|
92
|
+
YEPTRIS_API const yeptris_plan_str* yeptris_plan_result_strs(const yeptris_plan_result* r,
|
|
93
|
+
size_t col);
|
|
94
|
+
YEPTRIS_API const uint8_t* yeptris_plan_result_nulls(const yeptris_plan_result* r, size_t col);
|
|
95
|
+
|
|
96
|
+
#ifdef __cplusplus
|
|
97
|
+
}
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
#endif /* YEPTRIS_PLAN_H */
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* resolve.h — schema resolvers and typed scalar access (TODO.impl/10).
|
|
2
|
+
*
|
|
3
|
+
* Typing is pluggable and outside the grammar: a resolver decides,
|
|
4
|
+
* per plain scalar, which implicit tag it carries. YAML 1.2 core
|
|
5
|
+
* correctness and Psych/libyaml 1.1 parity are two resolvers over one
|
|
6
|
+
* interface; the parse options select one per document.
|
|
7
|
+
*
|
|
8
|
+
* Resolution assigns a dense tag id at parse time (stored on DOM
|
|
9
|
+
* nodes); typed VALUE conversion happens on accessor demand — parse
|
|
10
|
+
* speed never pays for typing the caller never reads.
|
|
11
|
+
*/
|
|
12
|
+
#ifndef YEPTRIS_RESOLVE_H
|
|
13
|
+
#define YEPTRIS_RESOLVE_H
|
|
14
|
+
|
|
15
|
+
#include <stddef.h>
|
|
16
|
+
#include <stdint.h>
|
|
17
|
+
|
|
18
|
+
#include <yeptris/api.h>
|
|
19
|
+
#include <yeptris/error.h>
|
|
20
|
+
#include <yeptris/types.h>
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
/* Tag ids. The core set is preallocated and stable (ABI-pinned);
|
|
27
|
+
* custom tags resolve to YEPTRIS_TAG_CUSTOM and keep their string. */
|
|
28
|
+
typedef enum {
|
|
29
|
+
YEPTRIS_TAG_STR = 0,
|
|
30
|
+
YEPTRIS_TAG_INT = 1,
|
|
31
|
+
YEPTRIS_TAG_FLOAT = 2,
|
|
32
|
+
YEPTRIS_TAG_BOOL = 3,
|
|
33
|
+
YEPTRIS_TAG_NULL = 4,
|
|
34
|
+
YEPTRIS_TAG_TIMESTAMP = 5,
|
|
35
|
+
YEPTRIS_TAG_SEQ = 6,
|
|
36
|
+
YEPTRIS_TAG_MAP = 7,
|
|
37
|
+
YEPTRIS_TAG_BINARY = 8,
|
|
38
|
+
YEPTRIS_TAG_MERGE = 9,
|
|
39
|
+
YEPTRIS_TAG_VALUE = 10,
|
|
40
|
+
YEPTRIS_TAG_CUSTOM = 11,
|
|
41
|
+
} YeptrisTagId;
|
|
42
|
+
|
|
43
|
+
/* Schemas. Appending only — bindings hard-code the values (test_abi). */
|
|
44
|
+
typedef enum {
|
|
45
|
+
YEPTRIS_SCHEMA_12_CORE = 0, /* default: the yaml-test-suite target */
|
|
46
|
+
YEPTRIS_SCHEMA_11_COMPAT, /* libyaml/Psych implicit typing */
|
|
47
|
+
YEPTRIS_SCHEMA_12_JSON, /* spec 10.2: JSON productions; plain
|
|
48
|
+
* scalars matching none are errors (#882) */
|
|
49
|
+
YEPTRIS_SCHEMA_12_FULL, /* the full 1.2 family (#906 slice 3):
|
|
50
|
+
* core typing + RFC3339-era timestamps
|
|
51
|
+
* (spec 2.22's four forms; the yaml.org
|
|
52
|
+
* type repository carried forward) and
|
|
53
|
+
* the merge/value words; !!binary rides
|
|
54
|
+
* as passthrough. A validation family:
|
|
55
|
+
* explicit !!timestamp content must
|
|
56
|
+
* re-resolve through the classifier. */
|
|
57
|
+
} YeptrisSchema;
|
|
58
|
+
|
|
59
|
+
/* Canonical tag URI for a core id ("tag:yaml.org,2002:str"); NULL for
|
|
60
|
+
* YEPTRIS_TAG_CUSTOM. */
|
|
61
|
+
YEPTRIS_API const char* yeptris_tag_uri(YeptrisTagId id);
|
|
62
|
+
|
|
63
|
+
/* The tag a scalar resolved to (PLAIN scalars carry their implicit
|
|
64
|
+
* tag; quoted/other styles are always STR; explicit tags map to their
|
|
65
|
+
* core id when they match one, else CUSTOM). Non-scalars: SEQ/MAP.
|
|
66
|
+
* YEPTRIS_ERROR_ARG on a bad handle. */
|
|
67
|
+
YEPTRIS_API YeptrisTagId yeptris_node_tag_id(YeptrisNode node);
|
|
68
|
+
|
|
69
|
+
/* Typed access (lazy conversion from the raw view; resolution's tag
|
|
70
|
+
* id decides eligibility, the conversion revalidates the bytes):
|
|
71
|
+
* YEPTRIS_ERROR_PARSE when the scalar's tag does not match the
|
|
72
|
+
* accessor (e.g. an INT accessor on a STR). */
|
|
73
|
+
YEPTRIS_API YeptrisStatus yeptris_node_int(YeptrisNode node, int64_t* out);
|
|
74
|
+
YEPTRIS_API YeptrisStatus yeptris_node_float(YeptrisNode node, double* out);
|
|
75
|
+
YEPTRIS_API YeptrisStatus yeptris_node_bool(YeptrisNode node, int* out);
|
|
76
|
+
|
|
77
|
+
#ifdef __cplusplus
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
#endif /* YEPTRIS_RESOLVE_H */
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* schema.h — the fused schema-descriptor materialization API
|
|
2
|
+
* (issue #238, TODO.restructure/83).
|
|
3
|
+
*
|
|
4
|
+
* The descriptor is the ABI, NOT a schema language: XSD/JSON-Schema
|
|
5
|
+
* cannot express consumer semantics (two-names-one-slot merges, value
|
|
6
|
+
* maps, key renames, raw capture) — the CONSUMER compiles those into
|
|
7
|
+
* this flat positional plan, the same way lutaml-model compiles its
|
|
8
|
+
* rule plans. The engine materializes against it in ONE native pass;
|
|
9
|
+
* the intermediate generic document (the Hash/Array the bindings used
|
|
10
|
+
* to build) never exists.
|
|
11
|
+
*
|
|
12
|
+
* Design contract (from the committed consumer, co-designed):
|
|
13
|
+
* - kind CALLBACK is the escape hatch: the raw value span plus the
|
|
14
|
+
* node's byte position come back as records; the host finishes
|
|
15
|
+
* just those fields (custom procs, polymorphism, delegates).
|
|
16
|
+
* - Results are WHOLE DOCUMENTS: this call never crosses the FFI
|
|
17
|
+
* boundary per value — the caller passes output buffers sized by
|
|
18
|
+
* expectation and receives per-node counts.
|
|
19
|
+
* - The descriptor ABI is versioned in lockstep with the bindings
|
|
20
|
+
* ({c-semver}.{binding-patch}); desc_abi changes only with a C
|
|
21
|
+
* minor bump.
|
|
22
|
+
* - Sequences of a plan run the SAME node plan for every element
|
|
23
|
+
* (flags ELEMENT); nested mappings run their child plan slice.
|
|
24
|
+
*/
|
|
25
|
+
#ifndef YEPTRIS_SCHEMA_H
|
|
26
|
+
#define YEPTRIS_SCHEMA_H
|
|
27
|
+
|
|
28
|
+
#include <stddef.h>
|
|
29
|
+
#include <stdint.h>
|
|
30
|
+
|
|
31
|
+
#include <yeptris/api.h>
|
|
32
|
+
#include <yeptris/error.h>
|
|
33
|
+
#include <yeptris/parse.h>
|
|
34
|
+
|
|
35
|
+
#ifdef __cplusplus
|
|
36
|
+
extern "C" {
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
/* The descriptor ABI version of this header. */
|
|
40
|
+
#define YEPTRIS_DESC_ABI 1u
|
|
41
|
+
|
|
42
|
+
/* node kinds */
|
|
43
|
+
enum {
|
|
44
|
+
YEP_SK_SCALAR = 0, /* typed leaf: type_tag decides the column */
|
|
45
|
+
YEP_SK_SEQUENCE, /* sequence: children[0] is the ELEMENT plan */
|
|
46
|
+
YEP_SK_MAPPING, /* mapping: children are the key plans */
|
|
47
|
+
YEP_SK_CALLBACK, /* escape hatch: raw span + position records */
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/* scalar type tags (the columns' element types) */
|
|
51
|
+
enum {
|
|
52
|
+
YEP_ST_STR = 0, /* off/len into the input */
|
|
53
|
+
YEP_ST_INT, /* int64_t */
|
|
54
|
+
YEP_ST_FLOAT, /* double */
|
|
55
|
+
YEP_ST_BOOL, /* uint8_t */
|
|
56
|
+
YEP_ST_NULL, /* no payload (count only) */
|
|
57
|
+
YEP_ST_ANY, /* SCALAR: keep the resolver's verdict — the
|
|
58
|
+
column is a YeptrisValue-like record */
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/* node flags */
|
|
62
|
+
enum {
|
|
63
|
+
YEP_SF_REQUIRED = 1u << 0, /* missing at its mapping -> error */
|
|
64
|
+
YEP_SF_FIRST_WINS = 1u << 1, /* duplicates: first match kept
|
|
65
|
+
(default: last, as at parse) */
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/* One plan node. ABI-pinned: a pointer plus 16 fixed-width bytes —
|
|
69
|
+
* 24 on LP64, 20 on 32-bit (the hosts' FFI mirrors size :pointer
|
|
70
|
+
* per-process, so the layout contract is the POINTER plus the tail). */
|
|
71
|
+
typedef struct yeptris_desc_node {
|
|
72
|
+
const char* wire_name; /* mapping key to match (NULL: the root) */
|
|
73
|
+
uint8_t kind; /* YEP_SK_* */
|
|
74
|
+
uint8_t type_tag; /* YEP_ST_* (SCALAR) */
|
|
75
|
+
uint16_t flags; /* YEP_SF_* */
|
|
76
|
+
uint32_t child_index; /* SEQUENCE: the element plan; MAPPING: the
|
|
77
|
+
first child. Unused otherwise (0). */
|
|
78
|
+
uint32_t child_count; /* MAPPING: children from child_index. */
|
|
79
|
+
uint32_t reserved; /* must be 0 (ABI headroom) */
|
|
80
|
+
} yeptris_desc_node;
|
|
81
|
+
|
|
82
|
+
YEPTRIS_CT_ASSERT(sizeof(yeptris_desc_node) == sizeof(const char*) + 16);
|
|
83
|
+
|
|
84
|
+
/* One column's output. Caller allocates the payload array (sized by
|
|
85
|
+
* expectation); the call fills it and sets count. No per-value FFI:
|
|
86
|
+
* hosts drain whole columns after the call. */
|
|
87
|
+
typedef struct yeptris_schema_column {
|
|
88
|
+
void* data; /* element type from the plan's type_tag */
|
|
89
|
+
uint32_t capacity; /* elements the buffer holds */
|
|
90
|
+
uint32_t count; /* elements materialized (out) */
|
|
91
|
+
} yeptris_schema_column;
|
|
92
|
+
|
|
93
|
+
/* STR/CALLBACK payload: off/len into the INPUT buffer (zero-copy to
|
|
94
|
+
* the host). CALLBACK also carries the node's byte position. */
|
|
95
|
+
typedef struct yeptris_span2 {
|
|
96
|
+
uint32_t off;
|
|
97
|
+
uint32_t len;
|
|
98
|
+
uint32_t node_off; /* the node's first byte (callbacks) */
|
|
99
|
+
uint32_t pad;
|
|
100
|
+
} yeptris_span2;
|
|
101
|
+
|
|
102
|
+
YEPTRIS_CT_ASSERT(sizeof(yeptris_span2) == 16);
|
|
103
|
+
|
|
104
|
+
/* Parses `source` (YAML or strict JSON — the same front door as
|
|
105
|
+
* yeptris_parse_ex) and materializes against the descriptor in one
|
|
106
|
+
* pass: node i's matches land in cols[i]. The input buffer must
|
|
107
|
+
* outlive the string/callback spans (they borrow it).
|
|
108
|
+
*
|
|
109
|
+
* Status: YEPTRIS_OK; YEPTRIS_ERROR_PARSE (yeptris_last_error);
|
|
110
|
+
* YEPTRIS_ERROR_SCHEMA (a REQUIRED node missing — the error carries
|
|
111
|
+
* the node index; detail via yeptris_last_error); YEPTRIS_ERROR_MEMORY
|
|
112
|
+
* / ARG (NULL descriptor, desc_len 0, desc_abi mismatch). */
|
|
113
|
+
YEPTRIS_API YeptrisStatus yeptris_schema_load(const char* source, size_t len, YeptrisSchema schema,
|
|
114
|
+
const yeptris_desc_node* desc, uint32_t desc_len,
|
|
115
|
+
uint32_t desc_abi, yeptris_schema_column* cols);
|
|
116
|
+
|
|
117
|
+
#ifdef __cplusplus
|
|
118
|
+
}
|
|
119
|
+
#endif
|
|
120
|
+
|
|
121
|
+
#endif /* YEPTRIS_SCHEMA_H */
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* tape.h — the compact JSON tape (issue #238's consumer shape,
|
|
2
|
+
* TODO.restructure/85: the simdjson-class materialization).
|
|
3
|
+
*
|
|
4
|
+
* One fused strict walk appends ONE record per token — no DOM nodes,
|
|
5
|
+
* no links, no views. Records are THREE parallel columns (kind byte,
|
|
6
|
+
* off, len) carved from one block: bools encode in the kind, container
|
|
7
|
+
* links ride the off column, and NUMBERS RECORD SPANS ONLY — parse
|
|
8
|
+
* validates the grammar (the lean shape scan) and materialize converts
|
|
9
|
+
* (yeptris_tape_convert; the C-API materializer converts inline).
|
|
10
|
+
* Strings stay zero-copy spans into the caller's buffer.
|
|
11
|
+
*
|
|
12
|
+
* The tape is a document-level result (never per value across FFI);
|
|
13
|
+
* the buffer the spans borrow must outlive it.
|
|
14
|
+
*/
|
|
15
|
+
#ifndef YEPTRIS_TAPE_H
|
|
16
|
+
#define YEPTRIS_TAPE_H
|
|
17
|
+
|
|
18
|
+
#include <stddef.h>
|
|
19
|
+
#include <stdint.h>
|
|
20
|
+
|
|
21
|
+
#include <yeptris/api.h>
|
|
22
|
+
#include <yeptris/error.h>
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
/* Record kinds (the kinds column). */
|
|
29
|
+
enum {
|
|
30
|
+
YEP_T_DOC = 0, /* document boundary (records start after it) */
|
|
31
|
+
YEP_T_NULL,
|
|
32
|
+
YEP_T_TRUE, /* the kind IS the value */
|
|
33
|
+
YEP_T_FALSE, /* the kind IS the value */
|
|
34
|
+
YEP_T_INT, /* off/len: signed digit span; convert at materialize */
|
|
35
|
+
YEP_T_FLOAT, /* off/len: float text span; convert at materialize */
|
|
36
|
+
YEP_T_STR, /* off/len: raw span (escapes untouched; the
|
|
37
|
+
qbc kernel found them) */
|
|
38
|
+
YEP_T_SEQ_OPEN, /* off: index of the matching CLOSE */
|
|
39
|
+
YEP_T_MAP_OPEN, /* off: index of the matching CLOSE; keys are
|
|
40
|
+
the STR records at even positions inside */
|
|
41
|
+
YEP_T_CLOSE, /* off: index of the matching OPEN */
|
|
42
|
+
YEP_T_NUM, /* lenient route only: off/len number span with
|
|
43
|
+
the grammar UNVALIDATED at parse —
|
|
44
|
+
yeptris_tape_convert is the authority (it
|
|
45
|
+
classifies int/float and rejects malformed
|
|
46
|
+
spans; simdjson's deferred contract) */
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/* The interleaved record (TODO.max-perf/07): one 8-byte store per
|
|
50
|
+
* token instead of three column stores. Layout: off:u32 | len:u23 |
|
|
51
|
+
* kind:u8 — a span longer than 0xFEFFFF bytes carries len == 0xFFFFFF
|
|
52
|
+
* with the true length stored as a CONT-terminated extension record
|
|
53
|
+
* (kind YEP_T_CONT; unreachable for <16 MiB tokens). The columns
|
|
54
|
+
* stay the compatibility ABI: yeptris_tape_columns materializes them
|
|
55
|
+
* lazily from the records on first touch. */
|
|
56
|
+
#define YEP_T_CONT 8 /* record-length extension (not a token kind) */
|
|
57
|
+
typedef uint64_t yeptris_tape_rec;
|
|
58
|
+
|
|
59
|
+
typedef struct yeptris_json_tape {
|
|
60
|
+
size_t count;
|
|
61
|
+
uint8_t* kinds; /* compat columns — materialized lazily (see
|
|
62
|
+
yeptris_tape_columns) when the interleaved
|
|
63
|
+
records are the primary storage */
|
|
64
|
+
uint32_t* offs; /* span starts (STR/INT/FLOAT); container links */
|
|
65
|
+
uint32_t* lens; /* span lengths (STR/INT/FLOAT) */
|
|
66
|
+
yeptris_tape_rec* recs; /* primary storage (may be NULL on legacy
|
|
67
|
+
column-built tapes: the strict route) */
|
|
68
|
+
int _cols_ready; /* columns materialized from recs already */
|
|
69
|
+
int _rec_primary; /* the lenient route: recs carry the data and
|
|
70
|
+
the columns are lazy */
|
|
71
|
+
int64_t int_min; /* set by yeptris_tape_convert when an INT span
|
|
72
|
+
exceeds int64 (materialize-time discovery) */
|
|
73
|
+
const void* _src; /* the parsed buffer (spans borrow it; it must
|
|
74
|
+
outlive the tape — same contract as the spans) */
|
|
75
|
+
size_t _srclen;
|
|
76
|
+
void* _block; /* the carved allocation base */
|
|
77
|
+
/* the >1024 simple-key verdict, settled DURING the lenient walk
|
|
78
|
+
* (one compare per map key) — the post-scan re-walk of the whole
|
|
79
|
+
* tape cost 16% of json-users parse (#739 profile, 2026-10-28) */
|
|
80
|
+
unsigned char _long_key_known;
|
|
81
|
+
unsigned char _long_key;
|
|
82
|
+
} yeptris_json_tape;
|
|
83
|
+
|
|
84
|
+
/* Parses strict JSON into the tape. Accepts scalar roots (a single
|
|
85
|
+
* record). Returns YEPTRIS_OK, YEPTRIS_ERROR_PARSE (details via
|
|
86
|
+
* yeptris_last_error), YEPTRIS_ERROR_MEMORY, YEPTRIS_ERROR_ARG. */
|
|
87
|
+
YEPTRIS_API YeptrisStatus yeptris_parse_json_tape(const char* source, size_t len,
|
|
88
|
+
yeptris_json_tape* tape);
|
|
89
|
+
|
|
90
|
+
/* The lenient route (simdjson's deferred contract, opt-in): every
|
|
91
|
+
* STRUCTURAL check stays at parse (bracket matching, alternation,
|
|
92
|
+
* comma/colon placement, literals, string closes/escapes) while
|
|
93
|
+
* NUMBER grammar defers to yeptris_tape_convert — a number records
|
|
94
|
+
* as a YEP_T_NUM charset run (so "1.2.3" is accepted here and
|
|
95
|
+
* rejected at convert, exactly where simdjson's number parse would
|
|
96
|
+
* fail; a run with non-number bytes like "12ab" still rejects
|
|
97
|
+
* structurally at parse). Accepts a superset of the strict route's
|
|
98
|
+
* inputs (tab whitespace becomes legal, RFC 8259); on everything
|
|
99
|
+
* the strict route accepts, the tapes are structurally identical
|
|
100
|
+
* (spans and containers equal; NUM records carry the same bytes the
|
|
101
|
+
* strict INT/FLOAT records carry). Non-ASCII inputs take the strict
|
|
102
|
+
* route unchanged. */
|
|
103
|
+
YEPTRIS_API YeptrisStatus yeptris_parse_json_tape_lenient(const char* source, size_t len,
|
|
104
|
+
yeptris_json_tape* tape);
|
|
105
|
+
|
|
106
|
+
YEPTRIS_API void yeptris_tape_free(yeptris_json_tape* tape);
|
|
107
|
+
|
|
108
|
+
/* Converts the INT/FLOAT records in [from, to): ivals/dvals are
|
|
109
|
+
* parallel to the RECORD indices (slots for other kinds are left
|
|
110
|
+
* untouched; either pointer may be NULL). Returns the number of
|
|
111
|
+
* number records converted, or SIZE_MAX if a span does not re-scan
|
|
112
|
+
* as a number (impossible for a tape this library produced).
|
|
113
|
+
* Sets t->int_min when an INT span exceeds int64. */
|
|
114
|
+
/* Materializes the kinds/offs/lens columns from the interleaved
|
|
115
|
+
* records (no-op when the tape was built column-primary or the
|
|
116
|
+
* columns are already materialized). Consumers reading the column
|
|
117
|
+
* pointers directly (the FFI binding) must call this once first.
|
|
118
|
+
* Returns 0 on success, nonzero on allocation failure. */
|
|
119
|
+
YEPTRIS_API int yeptris_tape_columns(yeptris_json_tape* t);
|
|
120
|
+
|
|
121
|
+
YEPTRIS_API size_t yeptris_tape_convert(yeptris_json_tape* t, size_t from, size_t to,
|
|
122
|
+
int64_t* ivals, double* dvals);
|
|
123
|
+
|
|
124
|
+
#ifdef __cplusplus
|
|
125
|
+
}
|
|
126
|
+
#endif
|
|
127
|
+
|
|
128
|
+
#endif /* YEPTRIS_TAPE_H */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* types.h — opaque public handles.
|
|
2
|
+
*
|
|
3
|
+
* The single canonical source of public types (TODO.impl/02 extends this
|
|
4
|
+
* file; internal types never appear here). Callers never see struct
|
|
5
|
+
* definitions: every handle is opaque and pointer-sized, asserted by the
|
|
6
|
+
* ABI pinning test (test/unit/test_abi.cpp).
|
|
7
|
+
*/
|
|
8
|
+
#ifndef YEPTRIS_TYPES_H
|
|
9
|
+
#define YEPTRIS_TYPES_H
|
|
10
|
+
|
|
11
|
+
#include <stddef.h>
|
|
12
|
+
|
|
13
|
+
#ifdef __cplusplus
|
|
14
|
+
extern "C" {
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
/* A parsed document; the sole owner of all memory reachable from it.
|
|
18
|
+
* Memory: freed exactly once with yeptris_document_free (TODO.impl/11). */
|
|
19
|
+
typedef struct yeptris_document* YeptrisDocument;
|
|
20
|
+
|
|
21
|
+
/* A node (document, mapping, sequence, scalar, alias) inside a document.
|
|
22
|
+
* Memory: borrowed from its document — valid until the document is freed. */
|
|
23
|
+
typedef struct yeptris_node* YeptrisNode;
|
|
24
|
+
|
|
25
|
+
/* Streaming/streaming-adjacent handles, introduced with their items:
|
|
26
|
+
* parser engine (TODO.impl/07), pull/recorder/iterparse (TODO.impl/12),
|
|
27
|
+
* emitter (TODO.impl/13). Declared now so the handle vocabulary is stable. */
|
|
28
|
+
typedef struct yeptris_parser* YeptrisParser;
|
|
29
|
+
typedef struct yeptris_pull* YeptrisPullParser;
|
|
30
|
+
typedef struct yeptris_recorder* YeptrisRecorder;
|
|
31
|
+
typedef struct yeptris_iterparse* YeptrisIterparse;
|
|
32
|
+
typedef struct yeptris_emitter* YeptrisEmitter;
|
|
33
|
+
|
|
34
|
+
#ifdef __cplusplus
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#endif /* YEPTRIS_TYPES_H */
|