leptris 1.9.420.1-arm-linux → 1.9.420.3-arm-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f91f6a7f81afdee0f085118510b273435750711b0721daf7ebc274834c5643a9
4
- data.tar.gz: 02ba02d1d36ccd5e56c524e6b40e8576229fb0ec49a48d58961ae831b9cc47b5
3
+ metadata.gz: 48400f5ba289ad24c0edb1e65d923266a236563b803cf3b2ad67d1ec06a8bda3
4
+ data.tar.gz: 6c30a9c90da8fc10d8982e1532f920e5dc0a898ec02841a9ca2683d3948c7ee5
5
5
  SHA512:
6
- metadata.gz: 9d21b5a325b5a3918acd3b9dff70f1fed778f161fc0ed39736e3140c6b768ce883863763256223ff2fbc72859d48d92a856b481eb8fe7f1c2376b3b04af588d4
7
- data.tar.gz: 0a87c95caf8970e391ae3a6b059112141f638c145b47299964318ca1d200af011cf5d34c7df023501cdb7bd20f94b43b9dfd08884107a8af02cacfc2c60eda07
6
+ metadata.gz: 710e550a23bbe7da191b24db66c2684723e57ef8a0105f684c2f479f8ca6fc4e98d8471cd2d90064ed0fa88e984b8e8d14325b8dd4d938e379a9acd0242055ff
7
+ data.tar.gz: 6e259ee7a0cc9cf1999e28ae3a09ca84459c0277c227894553df45f768aa401735e3ff485b430d53d573a59d978d7dfca2824fc96ba21902757bc5bd1106b3ef
@@ -83,6 +83,7 @@ static attr_first_fn f_attr_first;
83
83
  static attr_next_fn f_attr_next;
84
84
  static attr_name_fn f_attr_name;
85
85
  static attr_value_fn f_attr_value;
86
+ static const char *(*e_attr_ns_uri)(void *);
86
87
  static attr_pairs_fn f_attr_pairs;
87
88
  static node_line_fn f_node_line;
88
89
  static node_offset_fn f_node_offset;
@@ -211,6 +212,7 @@ static ID id_bulk_rows_mark;
211
212
  static ID id_ptr_new, id_freed_new, id_alive;
212
213
  static ID id_iv_c_address, id_iv_document, id_iv_parent;
213
214
  static ID id_iv_mx_context, id_iv_mx_adapter, id_iv_mx_native;
215
+ static ID id_cs_factory, id_af_factory;
214
216
  static ID id_iv_structure_memoizable, id_iv_native_fast;
215
217
  static ID id_iv_pub_document, id_iv_addr_reads_fast, id_iv_node_type;
216
218
  static void check_status_c(int st);
@@ -322,6 +324,7 @@ static void resolve_symbols(const char *lib_path)
322
324
  f_attr_next = (attr_next_fn)lib_sym(h, "leptris_attribute_next");
323
325
  f_attr_name = (attr_name_fn)lib_sym(h, "leptris_attribute_get_name");
324
326
  f_attr_value = (attr_value_fn)lib_sym(h, "leptris_attribute_get_value");
327
+ e_attr_ns_uri = (const char *(*)(void *))lib_sym(h, "leptris_attribute_namespace_uri");
325
328
  f_attr_pairs = (attr_pairs_fn)lib_sym(h, "leptris_element_attribute_pairs");
326
329
  f_node_line = (node_line_fn)lib_sym(h, "leptris_node_line");
327
330
  f_node_offset = (node_offset_fn)lib_sym(h, "leptris_node_byte_offset");
@@ -1710,6 +1713,68 @@ static VALUE nn_set_root(VALUE klass, VALUE document, VALUE element)
1710
1713
  * consumer's NativeNode subclass or NativeNode itself — a non-
1711
1714
  * TypedData class would crash on first read, so the type is checked
1712
1715
  * here against the registry. */
1716
+ /* ---- moxml-native consumer-contract binding (lutaml/moxml#548,
1717
+ * leptris-ruby#634) ----------------------------------------------
1718
+ * The factory-parameterized contract: the consumer registers its
1719
+ * shape factories ONCE per klass, and the binding defines the
1720
+ * contract's hot methods IN C — children serving the #530 memo'd
1721
+ * list wrapped by the consumer's set factory (the contract-required
1722
+ * object constructed without the Ruby dispatch chain), attribute
1723
+ * serving the engine's decode-authoritative getter wrapped by the
1724
+ * attribute factory. The context rides the primed @mx_context ivar
1725
+ * (the wrap path writes it); unprimed instances pass nil. */
1726
+ static VALUE cc_children(VALUE self)
1727
+ {
1728
+ VALUE list = nn_children(self);
1729
+ VALUE factory =
1730
+ rb_attr_get(rb_obj_class(self), id_cs_factory);
1731
+ VALUE context = rb_ivar_get(self, id_iv_mx_context);
1732
+ if (NIL_P(factory)) return list;
1733
+ return rb_funcall(factory, rb_intern("new"), 2, list, context);
1734
+ }
1735
+
1736
+ static VALUE cc_attribute(VALUE self, VALUE name)
1737
+ {
1738
+ struct native_node *n;
1739
+ TypedData_Get_Struct(self, struct native_node, &nn_type, n);
1740
+ VALUE factory = rb_attr_get(rb_obj_class(self), id_af_factory);
1741
+ if (NIL_P(factory)) return Qnil;
1742
+ const char *needle = StringValueCStr(name);
1743
+ /* Walk to the ATTRIBUTE pointer: the value comes from the
1744
+ * decode-authoritative getter and the namespace URI from the
1745
+ * attr-level face - both need the attr pointer, not the node. */
1746
+ for (void *a = f_attr_first(n->ptr); a; a = f_attr_next(a)) {
1747
+ const char *an = f_attr_name(a);
1748
+ if (!an || strcmp(an, needle) != 0) continue;
1749
+ const char *v = f_attr_value(n->ptr, a);
1750
+ if (!v) return Qnil;
1751
+ const char *uri = e_attr_ns_uri ? e_attr_ns_uri(a) : NULL;
1752
+ return rb_funcall(factory, rb_intern("new"), 4,
1753
+ rb_utf8_str_new_cstr(an),
1754
+ rb_utf8_str_new_cstr(v), self,
1755
+ uri ? rb_utf8_str_new_cstr(uri) : Qnil);
1756
+ }
1757
+ return Qnil;
1758
+ }
1759
+
1760
+ static VALUE nf_bind_consumer_contract(VALUE self, VALUE klass,
1761
+ VALUE set_factory,
1762
+ VALUE attr_factory)
1763
+ {
1764
+ (void)self;
1765
+ if (!RB_TYPE_P(klass, T_CLASS))
1766
+ rb_raise(rb_eTypeError, "expected a class");
1767
+ if (klass != c_native_node &&
1768
+ rb_class_inherited_p(klass, c_native_node) != Qtrue)
1769
+ rb_raise(rb_eTypeError,
1770
+ "the class must subclass Leptris::XML::NativeNode");
1771
+ rb_ivar_set(klass, id_cs_factory, set_factory);
1772
+ rb_ivar_set(klass, id_af_factory, attr_factory);
1773
+ rb_define_method(klass, "children", cc_children, 0);
1774
+ rb_define_method(klass, "attribute", cc_attribute, 1);
1775
+ return Qtrue;
1776
+ }
1777
+
1713
1778
  static VALUE nf_define_hot_readers(VALUE self, VALUE klass)
1714
1779
  {
1715
1780
  (void)self;
@@ -4362,6 +4427,8 @@ static void leptris_native_setup(void)
4362
4427
  id_iv_c_address = rb_intern("@c_address");
4363
4428
  id_iv_document = rb_intern("@document");
4364
4429
  id_iv_mx_context = rb_intern("@context");
4430
+ id_cs_factory = rb_intern("@cs_factory");
4431
+ id_af_factory = rb_intern("@af_factory");
4365
4432
  id_iv_mx_native = rb_intern("@native");
4366
4433
  id_iv_mx_adapter = rb_intern("@adapter");
4367
4434
  id_bulk_rows_mark = rb_intern("BulkIdentityRows");
@@ -4473,6 +4540,8 @@ static void leptris_native_setup(void)
4473
4540
  nf_set_binding_attribute, 4);
4474
4541
  rb_define_module_function(m_native, "define_hot_readers",
4475
4542
  nf_define_hot_readers, 1);
4543
+ rb_define_module_function(m_native, "bind_consumer_contract",
4544
+ nf_bind_consumer_contract, 3);
4476
4545
  rb_define_module_function(m_native, "insert_binding_child",
4477
4546
  nf_insert_binding_child, 4);
4478
4547
  rb_define_module_function(m_native, "at_xpath_first",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.420.1"
4
+ VERSION = "1.9.420.3"
5
5
  end
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.420.1
4
+ version: 1.9.420.3
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-14 00:00:00.000000000 Z
11
+ date: 2026-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi