leptris 1.9.379.0 → 1.9.379.2

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: 67c48c7a6e45049f3b82b51ab4df2ad9b7560769bcc74508c088c9a41b99ff66
4
- data.tar.gz: 6021d287da0756566a9aa4a411172e4bec507794e1003d5d940fe33f6e5497ca
3
+ metadata.gz: edeb66183ddb13396cc543e13dfb1cff9269e81320012d8381cd9a89444947b1
4
+ data.tar.gz: 48369d2290dc535b1c32696ec2d6b41f8d4bbe5cff60f7195074b957b6f9d198
5
5
  SHA512:
6
- metadata.gz: 3580c365274a0758a9eff72697240f319880d83a823e195c18af23d3fc2fd5fed392cafb1d5050dfb9682ac99fef2cf72db87c6cd20d0b0d3653f9c7d8363b64
7
- data.tar.gz: 2a9d437f8823b9d94e340f27540fa586dda60c4e8f6e779da3a59b1226eaf76c87bc87e9a2de7ec0d7d07646e5ef6690cf92dff93a23f1b118b1e18e99453938
6
+ metadata.gz: db7311d0ad04fd30862f5df61e4daac541b2eee6744cf2f635fc1224174b41d52a0932883c6bc4e3ba6bc6387dab17ed70201742dfd0d727df8da575cde6313d
7
+ data.tar.gz: bdf72ad7a7b8c5e11b1709450ce5f32d75639d6f7d96b3aaa45327a7e258e0d3572e5cb40e1f40538213182099f0d8c341746a38e6da47aef3a6605358f34f2d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [1.9.379.2] - 2026-10-21
2
+
3
+ ### Added — native layer
4
+
5
+ - **Unshadowed `set_text_native` alias (the add_child_native
6
+ pattern, leptris/leptris-ruby#525)**: `content=` on the TypedData
7
+ self, one C frame per text write; consumers gate by respond_to?
8
+ and fall back on older exts.
9
+
10
+ ## [1.9.379.1] - 2026-10-21
11
+
12
+ ### Added — native layer
13
+
14
+ - **The element mint pre-writes the consumer contract in C
15
+ (leptris/leptris-ruby#523)**: `NativeNode.create_element` takes
16
+ optional `(context, adapter)` and writes `@native` (the identity
17
+ contract: the node itself), `@context` and `@adapter` before
18
+ returning, so moxml's builder hot path skips its Ruby prime pass
19
+ per created element. The binding-agnostic consumer gates itself
20
+ by an arity probe; the two-argument call is unchanged for
21
+ existing callers.
22
+
1
23
  ## [1.9.379.0] - 2026-10-21
2
24
 
3
25
  ### Fixed — engine sync (libleptris 1.9.379)
@@ -205,6 +205,7 @@ static VALUE c_leptris_error;
205
205
  static VALUE c_b_document, c_b_freed, c_ffi_pointer;
206
206
  static ID id_ptr_new, id_freed_new, id_alive;
207
207
  static ID id_iv_c_address, id_iv_document, id_iv_parent;
208
+ static ID id_iv_mx_context, id_iv_mx_adapter, id_iv_mx_native;
208
209
  static ID id_iv_structure_memoizable, id_iv_native_fast;
209
210
  static ID id_iv_pub_document, id_iv_addr_reads_fast, id_iv_node_type;
210
211
  static void check_status_c(int st);
@@ -1411,11 +1412,18 @@ static VALUE nf_insert_binding_child(VALUE self, VALUE document,
1411
1412
 
1412
1413
  /* Builder factories (#149): create in C, wrap as NativeNode — no
1413
1414
  * FFI::Pointer, no Ruby wrap_fresh path. */
1414
- static VALUE nn_create_element(VALUE klass, VALUE document, VALUE name)
1415
+ static VALUE nn_create_element(int argc, VALUE *argv, VALUE klass)
1415
1416
  {
1417
+ VALUE document, name, mx_context, mx_adapter;
1416
1418
  void *ptr;
1417
- VALUE mk = doc_klass_for_kind(document, 0);
1419
+ VALUE mk, node;
1418
1420
  (void)klass;
1421
+ /* Optional (context, adapter): when the consumer passes its
1422
+ * contract state, the mint pre-writes the ivars in C and the
1423
+ * consumer's Ruby prime pass disappears from the build path. */
1424
+ rb_scan_args(argc, argv, "22", &document, &name,
1425
+ &mx_context, &mx_adapter);
1426
+ mk = doc_klass_for_kind(document, 0);
1419
1427
  ptr = f_elem_create(doc_ptr_of(document), StringValueCStr(name));
1420
1428
  if (!ptr)
1421
1429
  rb_raise(c_runtime_error, "leptris_element_create failed");
@@ -1423,8 +1431,18 @@ static VALUE nn_create_element(VALUE klass, VALUE document, VALUE name)
1423
1431
  * the unattached create factories are the build path (moxml's
1424
1432
  * create_element per record); plain NativeNode here forced the
1425
1433
  * consumer into wrapper-mode bridging for the whole document. */
1426
- if (!NIL_P(mk))
1427
- return mint_consumer_node(mk, document, ptr);
1434
+ if (!NIL_P(mk)) {
1435
+ node = mint_consumer_node(mk, document, ptr);
1436
+ if (!NIL_P(mx_context)) {
1437
+ /* The identity contract (#508): @native is the node
1438
+ * itself — exactly what the consumer's prime pass wrote.
1439
+ * Writing it here lets that pass disappear. */
1440
+ rb_ivar_set(node, id_iv_mx_native, node);
1441
+ rb_ivar_set(node, id_iv_mx_context, mx_context);
1442
+ rb_ivar_set(node, id_iv_mx_adapter, mx_adapter);
1443
+ }
1444
+ return node;
1445
+ }
1428
1446
  return wrap_new(document, ptr);
1429
1447
  }
1430
1448
 
@@ -3525,6 +3543,9 @@ LEPTRIS_INIT_EXPORT void Init_native(void)
3525
3543
  id_iv_binding_cache = rb_intern("@wrapper_cache");
3526
3544
  id_iv_c_address = rb_intern("@c_address");
3527
3545
  id_iv_document = rb_intern("@document");
3546
+ id_iv_mx_context = rb_intern("@context");
3547
+ id_iv_mx_native = rb_intern("@native");
3548
+ id_iv_mx_adapter = rb_intern("@adapter");
3528
3549
  id_iv_parent = rb_intern("@parent");
3529
3550
  id_iv_structure_memoizable = rb_intern("@structure_memoizable");
3530
3551
  id_iv_native_fast = rb_intern("@native_fast");
@@ -3552,7 +3573,7 @@ LEPTRIS_INIT_EXPORT void Init_native(void)
3552
3573
  rb_define_singleton_method(c_native_node, "from", nn_from, 2);
3553
3574
  rb_define_singleton_method(c_native_node, "install_child_klasses",
3554
3575
  nn_install_child_klasses, 1);
3555
- rb_define_singleton_method(c_native_node, "create_element", nn_create_element, 2);
3576
+ rb_define_singleton_method(c_native_node, "create_element", nn_create_element, -1);
3556
3577
  rb_define_singleton_method(c_native_node, "create_text", nn_create_text, 2);
3557
3578
  rb_define_singleton_method(c_native_node, "set_root", nn_set_root, 2);
3558
3579
  rb_define_method(c_native_node, "create_child", nn_create_child, 1);
@@ -3578,6 +3599,11 @@ LEPTRIS_INIT_EXPORT void Init_native(void)
3578
3599
  rb_define_alias(c_native_node, "name_read", "name");
3579
3600
  rb_define_method(c_native_node, "children", nn_children, 0);
3580
3601
  rb_define_alias(c_native_node, "children_read", "children");
3602
+ /* Unshadowed write face (the add_child_native pattern): the
3603
+ * registered Identity klasses shadow content= with the
3604
+ * facade; consumers plain-dispatch here for the one-frame
3605
+ * text write. */
3606
+ rb_define_alias(c_native_node, "set_text_native", "content=");
3581
3607
  rb_define_method(c_native_node, "element_children", nn_element_children, 0);
3582
3608
  rb_define_method(c_native_node, "next_sibling", nn_next_sibling, 0);
3583
3609
  rb_define_method(c_native_node, "parent", nn_parent, 0);
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.379.0"
4
+ VERSION = "1.9.379.2"
5
5
  end
@@ -111,8 +111,17 @@ class Leptris::XML::Document
111
111
 
112
112
  # Builder factories that return NativeNodes (#149): one C call
113
113
  # and a TypedData wrap — no FFI::Pointer, no wrap_fresh path.
114
- def native_create_element(name)
115
- Leptris::XML::NativeNode.create_element(self, name.to_s)
114
+ # (context, adapter) pre-writes the consumer's contract ivars in
115
+ # C — the mint returns a node that already answers them, and the
116
+ # consumer's Ruby prime pass disappears from the build path.
117
+ # Older compiled exts take two args; pass through only when given.
118
+ def native_create_element(name, mx_context = nil, mx_adapter = nil)
119
+ if mx_context.nil?
120
+ Leptris::XML::NativeNode.create_element(self, name.to_s)
121
+ else
122
+ Leptris::XML::NativeNode.create_element(self, name.to_s,
123
+ mx_context, mx_adapter)
124
+ end
116
125
  end
117
126
 
118
127
  def native_create_text(content)
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.379.0
4
+ version: 1.9.379.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.