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.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/README.adoc +150 -0
  3. data/ext/build_windows_native.rb +60 -0
  4. data/ext/libyeptris/extconf.rb +57 -0
  5. data/ext/yeptris_native/cbor_ruby.c +198 -0
  6. data/ext/yeptris_native/extconf.rb +99 -0
  7. data/ext/yeptris_native/json_ruby.c +414 -0
  8. data/ext/yeptris_native/version.h +29 -0
  9. data/ext/yeptris_native/yeptris_native.c +507 -0
  10. data/lib/yeptris/3.3/native.so +0 -0
  11. data/lib/yeptris/cbor.rb +169 -0
  12. data/lib/yeptris/document.rb +319 -0
  13. data/lib/yeptris/ffi.rb +572 -0
  14. data/lib/yeptris/json/descriptor.rb +266 -0
  15. data/lib/yeptris/json.rb +502 -0
  16. data/lib/yeptris/materializer.rb +389 -0
  17. data/lib/yeptris/node.rb +482 -0
  18. data/lib/yeptris/psych/class_loader.rb +24 -0
  19. data/lib/yeptris/psych/coder_shim.rb +55 -0
  20. data/lib/yeptris/psych/drop_in.rb +63 -0
  21. data/lib/yeptris/psych/encodable.rb +14 -0
  22. data/lib/yeptris/psych/handler.rb +95 -0
  23. data/lib/yeptris/psych/parser.rb +114 -0
  24. data/lib/yeptris/psych/scalar_scanner.rb +149 -0
  25. data/lib/yeptris/psych/tree_builder.rb +119 -0
  26. data/lib/yeptris/psych/visitors.rb +670 -0
  27. data/lib/yeptris/psych.rb +796 -0
  28. data/lib/yeptris/schema.rb +253 -0
  29. data/lib/yeptris/validation.rb +320 -0
  30. data/lib/yeptris/valueml.rb +477 -0
  31. data/lib/yeptris/yaml/descriptor.rb +56 -0
  32. data/lib/yeptris/yaml.rb +668 -0
  33. data/lib/yeptris.rb +130 -0
  34. data/libyeptris.so +0 -0
  35. data/vendor/libyeptris/CMakeLists.txt +280 -0
  36. data/vendor/libyeptris/cmake/yeptris-config.cmake.in +5 -0
  37. data/vendor/libyeptris/cmake/yeptris.pc.in +11 -0
  38. data/vendor/libyeptris/src/CMakeLists.txt +183 -0
  39. data/vendor/libyeptris/src/include/yeptris/api.h +32 -0
  40. data/vendor/libyeptris/src/include/yeptris/cbor.h +174 -0
  41. data/vendor/libyeptris/src/include/yeptris/dom.h +196 -0
  42. data/vendor/libyeptris/src/include/yeptris/emit.h +128 -0
  43. data/vendor/libyeptris/src/include/yeptris/error.h +42 -0
  44. data/vendor/libyeptris/src/include/yeptris/events.h +171 -0
  45. data/vendor/libyeptris/src/include/yeptris/json.h +57 -0
  46. data/vendor/libyeptris/src/include/yeptris/json.hpp +258 -0
  47. data/vendor/libyeptris/src/include/yeptris/jsonc_compat.h +115 -0
  48. data/vendor/libyeptris/src/include/yeptris/marshal.h +75 -0
  49. data/vendor/libyeptris/src/include/yeptris/parse.h +121 -0
  50. data/vendor/libyeptris/src/include/yeptris/plan.h +100 -0
  51. data/vendor/libyeptris/src/include/yeptris/resolve.h +81 -0
  52. data/vendor/libyeptris/src/include/yeptris/schema.h +121 -0
  53. data/vendor/libyeptris/src/include/yeptris/tape.h +128 -0
  54. data/vendor/libyeptris/src/include/yeptris/types.h +38 -0
  55. data/vendor/libyeptris/src/include/yeptris/validate.h +401 -0
  56. data/vendor/libyeptris/src/include/yeptris/values.h +108 -0
  57. data/vendor/libyeptris/src/include/yeptris/version.h.in +29 -0
  58. data/vendor/libyeptris/src/include/yeptris/visit.h +77 -0
  59. data/vendor/libyeptris/src/include/yeptris/yajl_compat.h +135 -0
  60. data/vendor/libyeptris/src/include/yeptris.h +24 -0
  61. data/vendor/libyeptris/src/yeptris/build.c +393 -0
  62. data/vendor/libyeptris/src/yeptris/cbor/cbor.h +35 -0
  63. data/vendor/libyeptris/src/yeptris/cbor/decode.c +1054 -0
  64. data/vendor/libyeptris/src/yeptris/cbor/encode.c +836 -0
  65. data/vendor/libyeptris/src/yeptris/cbor/encode_priv.h +32 -0
  66. data/vendor/libyeptris/src/yeptris/cbor/from_marshal.c +982 -0
  67. data/vendor/libyeptris/src/yeptris/cbor/sink.h +36 -0
  68. data/vendor/libyeptris/src/yeptris/common/chartype.c +41 -0
  69. data/vendor/libyeptris/src/yeptris/common/chartype.h +77 -0
  70. data/vendor/libyeptris/src/yeptris/common/cpu.c +81 -0
  71. data/vendor/libyeptris/src/yeptris/common/cpu.h +40 -0
  72. data/vendor/libyeptris/src/yeptris/common/error.c +65 -0
  73. data/vendor/libyeptris/src/yeptris/common/error.h +81 -0
  74. data/vendor/libyeptris/src/yeptris/common/mutex.h +45 -0
  75. data/vendor/libyeptris/src/yeptris/common/nametab.c +275 -0
  76. data/vendor/libyeptris/src/yeptris/common/nametab.h +68 -0
  77. data/vendor/libyeptris/src/yeptris/common/port.h +74 -0
  78. data/vendor/libyeptris/src/yeptris/common/simd_text.c +49 -0
  79. data/vendor/libyeptris/src/yeptris/common/simd_text.h +342 -0
  80. data/vendor/libyeptris/src/yeptris/common/simd_text_avx2.c +672 -0
  81. data/vendor/libyeptris/src/yeptris/common/simd_text_neon.c +793 -0
  82. data/vendor/libyeptris/src/yeptris/common/simd_text_scalar.c +324 -0
  83. data/vendor/libyeptris/src/yeptris/common/string_view.c +34 -0
  84. data/vendor/libyeptris/src/yeptris/common/string_view.h +93 -0
  85. data/vendor/libyeptris/src/yeptris/doc.h +86 -0
  86. data/vendor/libyeptris/src/yeptris/dom/dom.c +1312 -0
  87. data/vendor/libyeptris/src/yeptris/dom/dom.h +332 -0
  88. data/vendor/libyeptris/src/yeptris/dom/hpool.c +107 -0
  89. data/vendor/libyeptris/src/yeptris/dom/mapindex.c +173 -0
  90. data/vendor/libyeptris/src/yeptris/dom/mapindex.h +61 -0
  91. data/vendor/libyeptris/src/yeptris/dom/mutate.c +431 -0
  92. data/vendor/libyeptris/src/yeptris/dom/ytape.c +2323 -0
  93. data/vendor/libyeptris/src/yeptris/dom/ytape.h +96 -0
  94. data/vendor/libyeptris/src/yeptris/emit/emit.c +670 -0
  95. data/vendor/libyeptris/src/yeptris/emit/float/api.h +43 -0
  96. data/vendor/libyeptris/src/yeptris/emit/float/dragon.c +405 -0
  97. data/vendor/libyeptris/src/yeptris/emit/float/floatint.h +231 -0
  98. data/vendor/libyeptris/src/yeptris/emit/float/fpconv.c +428 -0
  99. data/vendor/libyeptris/src/yeptris/emit/float/print.c +396 -0
  100. data/vendor/libyeptris/src/yeptris/emit/style.c +21 -0
  101. data/vendor/libyeptris/src/yeptris/emit/style.h +32 -0
  102. data/vendor/libyeptris/src/yeptris/emit/writer.c +1951 -0
  103. data/vendor/libyeptris/src/yeptris/emit/writer.h +111 -0
  104. data/vendor/libyeptris/src/yeptris/encoding/bom.c +31 -0
  105. data/vendor/libyeptris/src/yeptris/encoding/encoding.h +63 -0
  106. data/vendor/libyeptris/src/yeptris/encoding/transcode.c +157 -0
  107. data/vendor/libyeptris/src/yeptris/encoding/utf8_validate.c +178 -0
  108. data/vendor/libyeptris/src/yeptris/events/capture.c +166 -0
  109. data/vendor/libyeptris/src/yeptris/events/capture.h +39 -0
  110. data/vendor/libyeptris/src/yeptris/events/iterparse.c +298 -0
  111. data/vendor/libyeptris/src/yeptris/events/pull.c +117 -0
  112. data/vendor/libyeptris/src/yeptris/events/push.c +151 -0
  113. data/vendor/libyeptris/src/yeptris/events/recorder.c +144 -0
  114. data/vendor/libyeptris/src/yeptris/events/values.c +630 -0
  115. data/vendor/libyeptris/src/yeptris/events/values_priv.h +53 -0
  116. data/vendor/libyeptris/src/yeptris/events/yaml_compat.c +86 -0
  117. data/vendor/libyeptris/src/yeptris/events/yaml_compat.h +90 -0
  118. data/vendor/libyeptris/src/yeptris/jsonapi/jsonc_compat.c +687 -0
  119. data/vendor/libyeptris/src/yeptris/jsonapi/yajl_compat.c +728 -0
  120. data/vendor/libyeptris/src/yeptris/marshal/to_json.c +650 -0
  121. data/vendor/libyeptris/src/yeptris/marshal.c +988 -0
  122. data/vendor/libyeptris/src/yeptris/memory/allocator.c +20 -0
  123. data/vendor/libyeptris/src/yeptris/memory/allocator.h +43 -0
  124. data/vendor/libyeptris/src/yeptris/memory/arena.c +150 -0
  125. data/vendor/libyeptris/src/yeptris/memory/arena.h +52 -0
  126. data/vendor/libyeptris/src/yeptris/memory/pool.c +133 -0
  127. data/vendor/libyeptris/src/yeptris/memory/pool.h +36 -0
  128. data/vendor/libyeptris/src/yeptris/parse/engine.c +6528 -0
  129. data/vendor/libyeptris/src/yeptris/parse/engine.h +96 -0
  130. data/vendor/libyeptris/src/yeptris/parse/events.h +137 -0
  131. data/vendor/libyeptris/src/yeptris/parse/numbers.c +374 -0
  132. data/vendor/libyeptris/src/yeptris/parse/numbers.h +33 -0
  133. data/vendor/libyeptris/src/yeptris/parse/scalars.c +435 -0
  134. data/vendor/libyeptris/src/yeptris/parse/scalars.h +87 -0
  135. data/vendor/libyeptris/src/yeptris/parse/stream_iter.c +358 -0
  136. data/vendor/libyeptris/src/yeptris/parse.c +1074 -0
  137. data/vendor/libyeptris/src/yeptris/plan.c +824 -0
  138. data/vendor/libyeptris/src/yeptris/resolve/compat11.c +339 -0
  139. data/vendor/libyeptris/src/yeptris/resolve/core12.c +153 -0
  140. data/vendor/libyeptris/src/yeptris/resolve/full12.c +201 -0
  141. data/vendor/libyeptris/src/yeptris/resolve/json12.c +109 -0
  142. data/vendor/libyeptris/src/yeptris/resolve/resolver.h +103 -0
  143. data/vendor/libyeptris/src/yeptris/resolve/tags.c +250 -0
  144. data/vendor/libyeptris/src/yeptris/scan/json.c +839 -0
  145. data/vendor/libyeptris/src/yeptris/scan/json.h +116 -0
  146. data/vendor/libyeptris/src/yeptris/scan/scan.c +862 -0
  147. data/vendor/libyeptris/src/yeptris/scan/scan.h +177 -0
  148. data/vendor/libyeptris/src/yeptris/schema.c +309 -0
  149. data/vendor/libyeptris/src/yeptris/tape.c +2375 -0
  150. data/vendor/libyeptris/src/yeptris/tape_in.h +39 -0
  151. data/vendor/libyeptris/src/yeptris/validate/compile.c +306 -0
  152. data/vendor/libyeptris/src/yeptris/validate/internal.h +347 -0
  153. data/vendor/libyeptris/src/yeptris/validate/jsonschema.c +1922 -0
  154. data/vendor/libyeptris/src/yeptris/validate/output.c +246 -0
  155. data/vendor/libyeptris/src/yeptris/validate/regexp.c +1600 -0
  156. data/vendor/libyeptris/src/yeptris/validate/registry.c +118 -0
  157. data/vendor/libyeptris/src/yeptris/validate/resources.c +601 -0
  158. data/vendor/libyeptris/src/yeptris/validate/stream.c +1155 -0
  159. data/vendor/libyeptris/src/yeptris/validate/validate.c +1043 -0
  160. data/vendor/libyeptris/src/yeptris/version.c +7 -0
  161. data/vendor/libyeptris/src/yeptris/visit/dom_visit.c +115 -0
  162. data/vendor/libyeptris/src/yeptris/visit/json_visit.c +293 -0
  163. data/vendor/libyeptris/src/yeptris/visit/yaml_visit.c +127 -0
  164. metadata +221 -0
@@ -0,0 +1,151 @@
1
+ /* push.c — callback push over the engine sink (TODO.impl/12).
2
+ *
3
+ * The C-user convenience shape: one call per event, strings valid only
4
+ * during the callback. Bindings prefer the recorder's bulk drain. */
5
+
6
+ #include <string.h>
7
+
8
+ #include "../../include/yeptris/events.h"
9
+ #include "../common/simd_text.h"
10
+ #include "../parse/engine.h"
11
+ #include "yeptris/error.h"
12
+ #include "yeptris/parse.h"
13
+
14
+ typedef struct {
15
+ yeptris_event_fn fn;
16
+ void* ctx;
17
+ uint32_t abort_line; /* the mark of the event the callback aborted
18
+ * on: the abort-text law sets the channel AT
19
+ * the abort point, not at 0/0 */
20
+ uint32_t abort_col;
21
+ } yep_push_ctx;
22
+
23
+ static int push_on_event(void* ctx, const yep_event* ev) {
24
+ yep_push_ctx* p = (yep_push_ctx*)ctx;
25
+ YeptrisEvent e;
26
+ memset(&e, 0, sizeof(e));
27
+ switch (ev->type) {
28
+ case YEP_EV_STREAM_START:
29
+ e.type = YEPTRIS_EV_STREAM_START;
30
+ break;
31
+ case YEP_EV_STREAM_END:
32
+ e.type = YEPTRIS_EV_STREAM_END;
33
+ break;
34
+ case YEP_EV_DOCUMENT_START:
35
+ e.type = YEPTRIS_EV_DOCUMENT_START;
36
+ e.explicit_marker = (ev->style == 1);
37
+ break;
38
+ case YEP_EV_DOCUMENT_END:
39
+ e.type = YEPTRIS_EV_DOCUMENT_END;
40
+ e.explicit_marker = (ev->style == 1);
41
+ break;
42
+ case YEP_EV_SEQ_START:
43
+ e.type = YEPTRIS_EV_SEQUENCE_START;
44
+ break;
45
+ case YEP_EV_SEQ_END:
46
+ e.type = YEPTRIS_EV_SEQUENCE_END;
47
+ break;
48
+ case YEP_EV_MAP_START:
49
+ e.type = YEPTRIS_EV_MAPPING_START;
50
+ break;
51
+ case YEP_EV_MAP_END:
52
+ e.type = YEPTRIS_EV_MAPPING_END;
53
+ break;
54
+ case YEP_EV_SCALAR:
55
+ e.type = YEPTRIS_EV_SCALAR;
56
+ e.style = ev->style;
57
+ e.implicit = ev->implicit;
58
+ break;
59
+ case YEP_EV_ALIAS:
60
+ e.type = YEPTRIS_EV_ALIAS;
61
+ break;
62
+ default:
63
+ return 0;
64
+ }
65
+ e.flow = ev->flow;
66
+ e.line = ev->line;
67
+ e.col = ev->col;
68
+ /* the cross-model identity law (#179, test_event_marks): push,
69
+ * pull and the recorder emit identical mark data — dropping the
70
+ * end marks here made the push route's events half-marked where
71
+ * pull/recorder carried all four fields */
72
+ e.end_line = ev->end_line;
73
+ e.end_col = ev->end_col;
74
+ e.value = ev->value.len > 0 ? (const char*)ev->value.p : NULL;
75
+ e.value_len = ev->value.len;
76
+ e.anchor = ev->anchor.len > 0 ? (const char*)ev->anchor.p : NULL;
77
+ e.anchor_len = ev->anchor.len;
78
+ e.tag = ev->tag.len > 0 ? (const char*)ev->tag.p : NULL;
79
+ e.tag_len = ev->tag.len;
80
+ int rc = p->fn(p->ctx, &e);
81
+ if (rc != 0) {
82
+ /* the abort point travels with the abort: the TLS slot's mark
83
+ * is where the walk stopped, not 0/0 (events.h's contract) */
84
+ p->abort_line = ev->line;
85
+ p->abort_col = ev->col;
86
+ }
87
+ return rc;
88
+ }
89
+
90
+ YEPTRIS_API YeptrisStatus yeptris_push_parse(const char* buf, size_t len, yeptris_event_fn on_event,
91
+ void* ctx) {
92
+ if (buf == NULL && len != 0) {
93
+ return YEPTRIS_ERROR_ARG;
94
+ }
95
+ if (on_event == NULL) {
96
+ return YEPTRIS_ERROR_ARG;
97
+ }
98
+ /* the push run owns the channel for its duration: clearing at
99
+ * entry makes the abort-text law verifiable (the message a caller
100
+ * reads after a push is THIS run's verdict, never a stale one
101
+ * from an earlier operation on the thread — error.h promises ""
102
+ * after a success) */
103
+ yep_error_clear(yep_error_tls());
104
+ yep_engine* eng = yep_engine_create(yep_system_allocator());
105
+ if (eng == NULL) {
106
+ return YEPTRIS_ERROR_MEMORY;
107
+ }
108
+ yep_push_ctx p = {on_event, ctx, 0, 0};
109
+ yep_sink sink = {.on_event = push_on_event,
110
+ .ctx = &p,
111
+ .on_flow_build = NULL,
112
+ .on_flow_commit = NULL,
113
+ .on_flow_rollback = NULL,
114
+ .on_block_pair = NULL,
115
+ .on_block_open = NULL,
116
+ .on_block_item = NULL};
117
+ yep_text_stats pst;
118
+ yep_text_active()->scan_stats(buf, len, &pst);
119
+ yep_engine_prepare(eng, &pst);
120
+ int rc = yep_engine_run(eng, buf, len, &sink);
121
+ /* the error slot lives inside the engine and destroy munmaps it
122
+ * (glibc serves the ~260KB engine with mmap): copy the verdict out
123
+ * BEFORE the free — reading err->code after destroy segfaulted the
124
+ * round-5 CI */
125
+ yep_err_code err_code = YEP_ERR_NONE;
126
+ {
127
+ const yep_error* err = yep_engine_error(eng);
128
+ if (err != NULL) {
129
+ err_code = err->code;
130
+ }
131
+ }
132
+ yep_engine_destroy(eng);
133
+ if (rc == 0) {
134
+ return YEPTRIS_OK;
135
+ }
136
+ /* the engine's own memory failures report MEMORY (the parse route's
137
+ * law); the callback abort keeps its documented contract — a parse
138
+ * stop with the last-error channel SET (#904 item 4, the
139
+ * abort-text law: the old code returned PARSE over a CLEAN slot,
140
+ * so yeptris_last_error served whatever stale message this thread's
141
+ * previous operation had left there). YEP_ERR_ABORTED carries the
142
+ * mark of the event the callback aborted on. */
143
+ if (err_code == YEP_ERR_MEMORY) {
144
+ return YEPTRIS_ERROR_MEMORY;
145
+ }
146
+ if (err_code == YEP_ERR_NONE) {
147
+ yep_error_set(yep_error_tls(), YEP_ERR_ABORTED, p.abort_line, p.abort_col, 0,
148
+ "parse aborted by the event callback at %u:%u", p.abort_line, p.abort_col);
149
+ }
150
+ return YEPTRIS_ERROR_PARSE;
151
+ }
@@ -0,0 +1,144 @@
1
+ /* recorder.c — chunked event recorder (TODO.impl/12).
2
+ *
3
+ * Feed chunks, drain bulk: fixed-size records plus one string arena,
4
+ * reset at every feed entry. The engine's resumable stepping (07)
5
+ * advances the parse as complete documents arrive — each feed's
6
+ * records are the events for documents closed by that chunk, so a
7
+ * stream watcher holds one document of memory, not the whole stream. */
8
+
9
+ #include <stdlib.h>
10
+ #include <string.h>
11
+
12
+ #include "../../include/yeptris/events.h"
13
+ #include "../parse/engine.h"
14
+ #include "../resolve/resolver.h"
15
+ #include "capture.h"
16
+
17
+ struct yeptris_recorder {
18
+ yep_rec_store store;
19
+ yep_engine* eng; /* created on first feed; steps per feed */
20
+ int final_fed;
21
+ int compat11;
22
+ YeptrisStatus status;
23
+ uint32_t err_line;
24
+ uint32_t err_col;
25
+ };
26
+
27
+ YEPTRIS_API YeptrisRecorder yeptris_recorder_new(void) {
28
+ return yeptris_recorder_new_ex(YEPTRIS_SCHEMA_12_CORE);
29
+ }
30
+
31
+ YEPTRIS_API YeptrisRecorder yeptris_recorder_new_ex(YeptrisSchema schema) {
32
+ struct yeptris_recorder* r = calloc(1, sizeof(*r));
33
+ if (r != NULL) {
34
+ yep_rec_init(&r->store);
35
+ r->compat11 = schema == YEPTRIS_SCHEMA_11_COMPAT;
36
+ }
37
+ return r;
38
+ }
39
+
40
+ /* The engine's error code decides the public status — the parse
41
+ * route's law (parse.c maps YEP_ERR_* to the pinned codes). A clean
42
+ * channel means the SINK failed: the capture ran out of memory, the
43
+ * bytes never were a parse error. The MEMORY arm: the engine's own
44
+ * allocation failures (e_fail(YEP_ERR_MEMORY)) used to read as a parse
45
+ * error here — yep_engine_error always returns the slot, so the old
46
+ * `err != NULL` discriminator could never fire (the audit's finding). */
47
+ static YeptrisStatus rec_status_from_err(const yep_error* err) {
48
+ if (err == NULL || err->code == YEP_ERR_NONE || err->code == YEP_ERR_MEMORY) {
49
+ return YEPTRIS_ERROR_MEMORY;
50
+ }
51
+ if (err->code == YEP_ERR_ENCODING) {
52
+ return YEPTRIS_ERROR_ENCODING;
53
+ }
54
+ return YEPTRIS_ERROR_PARSE;
55
+ }
56
+
57
+ YEPTRIS_API YeptrisStatus yeptris_recorder_feed(YeptrisRecorder rec, const char* chunk, size_t len,
58
+ int final) {
59
+ if (rec == NULL || (chunk == NULL && len != 0)) {
60
+ return YEPTRIS_ERROR_ARG;
61
+ }
62
+ if (rec->final_fed) {
63
+ return YEPTRIS_ERROR_ARG; /* one stream per recorder */
64
+ }
65
+ if (rec->eng == NULL) {
66
+ rec->eng = yep_engine_create(yep_system_allocator());
67
+ if (rec->eng == NULL) {
68
+ return YEPTRIS_ERROR_MEMORY;
69
+ }
70
+ yep_engine_set_resolver(rec->eng,
71
+ rec->compat11 ? yep_resolver_compat11() : yep_resolver_core12());
72
+ /* the compat schema is the psych/libyaml surface: its grammar
73
+ * must accept what libyaml accepts (the flow indent floor is
74
+ * suite-strict, not libyaml — see yep_engine_set_compat_grammar;
75
+ * the recorder is the py safe_load path, which rode the floor
76
+ * and rejected multi-line flows #431 fixed everywhere else) */
77
+ yep_engine_set_compat_grammar(rec->eng, rec->compat11);
78
+ }
79
+ if (final) {
80
+ rec->final_fed = 1;
81
+ }
82
+ yep_rec_reset(&rec->store);
83
+ yep_sink sink = {.on_event = yep_rec_on_event,
84
+ .ctx = &rec->store,
85
+ .on_flow_build = NULL,
86
+ .on_flow_commit = NULL,
87
+ .on_block_item = NULL};
88
+ int rc = yep_engine_step(rec->eng, chunk, len, final, &sink);
89
+ if (rc != 0) {
90
+ const yep_error* err = yep_engine_error(rec->eng);
91
+ if (err != NULL && err->code != YEP_ERR_NONE) {
92
+ rec->err_line = err->line;
93
+ rec->err_col = err->col;
94
+ }
95
+ rec->status = rec_status_from_err(err);
96
+ rec->final_fed = 1; /* a failed feed kills the stream */
97
+ return rec->status;
98
+ }
99
+ rec->status = YEPTRIS_OK;
100
+ return rec->status;
101
+ }
102
+
103
+ YEPTRIS_API const YeptrisEventRecord* yeptris_recorder_records(YeptrisRecorder rec, size_t* count) {
104
+ if (rec == NULL) {
105
+ return NULL;
106
+ }
107
+ if (count != NULL) {
108
+ *count = rec->store.n;
109
+ }
110
+ return rec->store.recs;
111
+ }
112
+
113
+ YEPTRIS_API const char* yeptris_recorder_arena(YeptrisRecorder rec, size_t* len) {
114
+ if (rec == NULL) {
115
+ return NULL;
116
+ }
117
+ if (len != NULL) {
118
+ *len = rec->store.arena_len;
119
+ }
120
+ return rec->store.arena;
121
+ }
122
+
123
+ YEPTRIS_API YeptrisStatus yeptris_recorder_status(const YeptrisRecorder rec, uint32_t* line,
124
+ uint32_t* col) {
125
+ if (rec == NULL) {
126
+ return YEPTRIS_ERROR_ARG;
127
+ }
128
+ if (line != NULL) {
129
+ *line = rec->err_line;
130
+ }
131
+ if (col != NULL) {
132
+ *col = rec->err_col;
133
+ }
134
+ return rec->status;
135
+ }
136
+
137
+ YEPTRIS_API void yeptris_recorder_free(YeptrisRecorder rec) {
138
+ if (rec == NULL) {
139
+ return;
140
+ }
141
+ yep_engine_destroy(rec->eng);
142
+ yep_rec_free(&rec->store);
143
+ free(rec);
144
+ }