yeptris 0.6.12.1 → 0.6.12.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.
- checksums.yaml +4 -4
- data/lib/yeptris/ffi.rb +62 -25
- data/lib/yeptris.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5900164f14038b2ef4e6c7b3e7764c335faf037559f9743099787e2ffcadb2f7
|
|
4
|
+
data.tar.gz: b539d2090254785c57c6dfd5a08e46200b668b0061619691e779a5c186a3978a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d837519cc77193279158957e4757a0b2ee6f250467d293422676135b6aee89058eac9dbb48c6b7a5f3eb79ca77cc1e076399f93935ed75d652612244b845db74
|
|
7
|
+
data.tar.gz: 5eff7ba15bd3c4314508d226ebaa4d2e3aa0eb0a7cc2887645078acbbecd193cbaa443af6877891b226224719b8955700f8567ec8a0446cc42fa713349993864
|
data/lib/yeptris/ffi.rb
CHANGED
|
@@ -28,6 +28,32 @@ module Yeptris
|
|
|
28
28
|
MSG
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
class << self
|
|
32
|
+
# #138's class, hit again by the oiml-cs report: a stale
|
|
33
|
+
# libyeptris on the machine (the Windows base-name dedupe makes
|
|
34
|
+
# a system copy win) lacks newer symbols, and a raising attach
|
|
35
|
+
# aborts this file mid-evaluation — every constant after it
|
|
36
|
+
# never defines, so the next autoload dies with
|
|
37
|
+
# 'uninitialized constant Yeptris::FFI::NODE_SCALAR'. Attaches
|
|
38
|
+
# now record the miss and define a raising stub of the same
|
|
39
|
+
# name: the load completes, optional surfaces fail with a clear
|
|
40
|
+
# message at USE, and the ESSENTIAL self-check at the bottom of
|
|
41
|
+
# this file raises the friendly load error for truly old
|
|
42
|
+
# engines.
|
|
43
|
+
def attach_function(name, args, ret, opts = {})
|
|
44
|
+
super
|
|
45
|
+
rescue ::FFI::NotFoundError, ::FFI::TypeError
|
|
46
|
+
define_singleton_method(name) do |*_a, **_kw|
|
|
47
|
+
raise ::FFI::NotFoundError,
|
|
48
|
+
"yeptris: #{name} is unavailable — the loaded " \
|
|
49
|
+
"libyeptris is older than this gem. Update the engine " \
|
|
50
|
+
"library (or clear the stale copy shadowing it)."
|
|
51
|
+
end
|
|
52
|
+
(@missing ||= []) << name
|
|
53
|
+
nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
31
57
|
|
|
32
58
|
typedef :pointer, :yeptris_document
|
|
33
59
|
typedef :pointer, :yeptris_node
|
|
@@ -194,18 +220,14 @@ module Yeptris
|
|
|
194
220
|
# instead of walking per-value records in pure Ruby. Same feature-
|
|
195
221
|
# detect discipline as the columnar drain (older libraries fall
|
|
196
222
|
# back to the record walk).
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
true
|
|
206
|
-
rescue ::FFI::NotFoundError
|
|
207
|
-
false
|
|
208
|
-
end
|
|
223
|
+
MARSHAL_ALL_DOCS = 0
|
|
224
|
+
MARSHAL_FIRST_DOC = 1
|
|
225
|
+
attach_function :yeptris_marshal,
|
|
226
|
+
%i[pointer size_t int int pointer pointer], :int
|
|
227
|
+
attach_function :yeptris_marshal_node,
|
|
228
|
+
%i[yeptris_node pointer pointer], :int
|
|
229
|
+
attach_function :yeptris_marshal_free, [:pointer], :void
|
|
230
|
+
MARSHAL = !(@missing ||= []).include?(:yeptris_marshal_node)
|
|
209
231
|
|
|
210
232
|
# bulk build (TODO.impl/15 phase D): one call raises a document
|
|
211
233
|
BUILD_SCALAR = 1
|
|
@@ -238,19 +260,15 @@ module Yeptris
|
|
|
238
260
|
|
|
239
261
|
# CBOR (RFC 8949, TODO.cbor): absent on libraries before the
|
|
240
262
|
# codec's release — the CBOR module feature-detects
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
true
|
|
251
|
-
rescue ::FFI::NotFoundError
|
|
252
|
-
false
|
|
253
|
-
end
|
|
263
|
+
attach_function :yeptris_cbor_decode, %i[pointer size_t uint32 yeptris_status_out],
|
|
264
|
+
:yeptris_document
|
|
265
|
+
callback :cbor_item_cb, %i[pointer yeptris_document size_t], :int
|
|
266
|
+
attach_function :yeptris_cbor_decode_sequence,
|
|
267
|
+
%i[pointer size_t uint32 cbor_item_cb pointer yeptris_status_out], :size_t
|
|
268
|
+
attach_function :yeptris_cbor_encode, %i[yeptris_document uint32 pointer], :pointer
|
|
269
|
+
attach_function :yeptris_cbor_encode_sequence,
|
|
270
|
+
%i[pointer size_t uint32 pointer], :pointer
|
|
271
|
+
CBOR_EX = !(@missing ||= []).include?(:yeptris_cbor_decode)
|
|
254
272
|
|
|
255
273
|
# Owned char* results (serialize*): one reader, freed exactly once.
|
|
256
274
|
# The release goes through yeptris_free (libyeptris's own
|
|
@@ -368,5 +386,24 @@ module Yeptris
|
|
|
368
386
|
ERROR_ARG = 6
|
|
369
387
|
ERROR_UNSUPPORTED = 7
|
|
370
388
|
ERROR_INTERNAL = 8
|
|
389
|
+
# The load-time essentials (the read path + the ownership
|
|
390
|
+
# contract): absent on engines far older than the optional
|
|
391
|
+
# surfaces — raise the friendly error once every constant has
|
|
392
|
+
# fully defined, so no partial-module state leaks into autoloads
|
|
393
|
+
# (the #138 class, closed at the root).
|
|
394
|
+
ESSENTIAL = %i[
|
|
395
|
+
yeptris_version yeptris_last_error yeptris_parse yeptris_parse_ex
|
|
396
|
+
yeptris_parse_json yeptris_document_free yeptris_document_count
|
|
397
|
+
yeptris_document_root yeptris_node_kind yeptris_node_value
|
|
398
|
+
yeptris_node_tag_id yeptris_node_style yeptris_document_new
|
|
399
|
+
yeptris_document_set_root yeptris_serialize yeptris_serialize_ex
|
|
400
|
+
].freeze
|
|
401
|
+
missing_core = ESSENTIAL & (@missing ||= [])
|
|
402
|
+
raise ::FFI::NotFoundError,
|
|
403
|
+
"yeptris: the loaded libyeptris is older than this gem " \
|
|
404
|
+
"requires (missing: #{missing_core.join(', ')}). Update the " \
|
|
405
|
+
"engine library, or clear the stale copy shadowing it." \
|
|
406
|
+
unless missing_core.empty?
|
|
407
|
+
|
|
371
408
|
end
|
|
372
409
|
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.12.
|
|
6
|
+
VERSION = "0.6.12.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
|