leptris 1.9.420.1-arm-linux → 1.9.420.2-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: a630971cb93e51ae80e31f78afbe7660ad38575bc5e52c7cfbd958cf8168d3af
4
+ data.tar.gz: a66e3a535c36e9e1de8bd3200d244f3893ee6472ff921819ead23d2171e1d522
5
5
  SHA512:
6
- metadata.gz: 9d21b5a325b5a3918acd3b9dff70f1fed778f161fc0ed39736e3140c6b768ce883863763256223ff2fbc72859d48d92a856b481eb8fe7f1c2376b3b04af588d4
7
- data.tar.gz: 0a87c95caf8970e391ae3a6b059112141f638c145b47299964318ca1d200af011cf5d34c7df023501cdb7bd20f94b43b9dfd08884107a8af02cacfc2c60eda07
6
+ metadata.gz: f0722926cc11a8a02258c094e6fa548a6e356a287acc60e639ad2429c27a354d1c5ca391843d36be152ccd5a4685418fcba037e70024c1a0bcf125672aa22676
7
+ data.tar.gz: 3a5b391d0e98e25d28efac9dc5398b5cd08598e02848ce1131901db2e77dc59980438a928f553752ae745dd9153930c8360bb612bc86c89921e0e14aea2acef8
@@ -211,6 +211,7 @@ static ID id_bulk_rows_mark;
211
211
  static ID id_ptr_new, id_freed_new, id_alive;
212
212
  static ID id_iv_c_address, id_iv_document, id_iv_parent;
213
213
  static ID id_iv_mx_context, id_iv_mx_adapter, id_iv_mx_native;
214
+ static ID id_cs_factory, id_af_factory;
214
215
  static ID id_iv_structure_memoizable, id_iv_native_fast;
215
216
  static ID id_iv_pub_document, id_iv_addr_reads_fast, id_iv_node_type;
216
217
  static void check_status_c(int st);
@@ -1710,6 +1711,57 @@ static VALUE nn_set_root(VALUE klass, VALUE document, VALUE element)
1710
1711
  * consumer's NativeNode subclass or NativeNode itself — a non-
1711
1712
  * TypedData class would crash on first read, so the type is checked
1712
1713
  * here against the registry. */
1714
+ /* ---- moxml-native consumer-contract binding (lutaml/moxml#548,
1715
+ * leptris-ruby#634) ----------------------------------------------
1716
+ * The factory-parameterized contract: the consumer registers its
1717
+ * shape factories ONCE per klass, and the binding defines the
1718
+ * contract's hot methods IN C — children serving the #530 memo'd
1719
+ * list wrapped by the consumer's set factory (the contract-required
1720
+ * object constructed without the Ruby dispatch chain), attribute
1721
+ * serving the engine's decode-authoritative getter wrapped by the
1722
+ * attribute factory. The context rides the primed @mx_context ivar
1723
+ * (the wrap path writes it); unprimed instances pass nil. */
1724
+ static VALUE cc_children(VALUE self)
1725
+ {
1726
+ VALUE list = nn_children(self);
1727
+ VALUE factory =
1728
+ rb_attr_get(rb_obj_class(self), id_cs_factory);
1729
+ VALUE context = rb_ivar_get(self, id_iv_mx_context);
1730
+ if (NIL_P(factory)) return list;
1731
+ return rb_funcall(factory, rb_intern("new"), 2, list, context);
1732
+ }
1733
+
1734
+ static VALUE cc_attribute(VALUE self, VALUE name)
1735
+ {
1736
+ struct native_node *n;
1737
+ TypedData_Get_Struct(self, struct native_node, &nn_type, n);
1738
+ VALUE factory = rb_attr_get(rb_obj_class(self), id_af_factory);
1739
+ if (NIL_P(factory)) return Qnil;
1740
+ const char *v = f_attr(n->ptr, StringValueCStr(name));
1741
+ if (!v) return Qnil;
1742
+ return rb_funcall(factory, rb_intern("new"), 3,
1743
+ rb_utf8_str_new_cstr(StringValueCStr(name)),
1744
+ rb_utf8_str_new_cstr(v), self);
1745
+ }
1746
+
1747
+ static VALUE nf_bind_consumer_contract(VALUE self, VALUE klass,
1748
+ VALUE set_factory,
1749
+ VALUE attr_factory)
1750
+ {
1751
+ (void)self;
1752
+ if (!RB_TYPE_P(klass, T_CLASS))
1753
+ rb_raise(rb_eTypeError, "expected a class");
1754
+ if (klass != c_native_node &&
1755
+ rb_class_inherited_p(klass, c_native_node) != Qtrue)
1756
+ rb_raise(rb_eTypeError,
1757
+ "the class must subclass Leptris::XML::NativeNode");
1758
+ rb_ivar_set(klass, id_cs_factory, set_factory);
1759
+ rb_ivar_set(klass, id_af_factory, attr_factory);
1760
+ rb_define_method(klass, "children", cc_children, 0);
1761
+ rb_define_method(klass, "attribute", cc_attribute, 1);
1762
+ return Qtrue;
1763
+ }
1764
+
1713
1765
  static VALUE nf_define_hot_readers(VALUE self, VALUE klass)
1714
1766
  {
1715
1767
  (void)self;
@@ -4362,6 +4414,8 @@ static void leptris_native_setup(void)
4362
4414
  id_iv_c_address = rb_intern("@c_address");
4363
4415
  id_iv_document = rb_intern("@document");
4364
4416
  id_iv_mx_context = rb_intern("@context");
4417
+ id_cs_factory = rb_intern("@cs_factory");
4418
+ id_af_factory = rb_intern("@af_factory");
4365
4419
  id_iv_mx_native = rb_intern("@native");
4366
4420
  id_iv_mx_adapter = rb_intern("@adapter");
4367
4421
  id_bulk_rows_mark = rb_intern("BulkIdentityRows");
@@ -4473,6 +4527,8 @@ static void leptris_native_setup(void)
4473
4527
  nf_set_binding_attribute, 4);
4474
4528
  rb_define_module_function(m_native, "define_hot_readers",
4475
4529
  nf_define_hot_readers, 1);
4530
+ rb_define_module_function(m_native, "bind_consumer_contract",
4531
+ nf_bind_consumer_contract, 3);
4476
4532
  rb_define_module_function(m_native, "insert_binding_child",
4477
4533
  nf_insert_binding_child, 4);
4478
4534
  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.2"
5
5
  end
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
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.2
5
5
  platform: arm-linux
6
6
  authors:
7
7
  - Ribose Inc.