leptris 1.9.193.4 → 1.9.197.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 +4 -4
- data/CHANGELOG.md +146 -0
- data/Rakefile +38 -1
- data/ext/leptris/native/native.c +123 -0
- data/lib/leptris/vendor/aarch64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/aarch64-linux/libutf8proc.so.3 +0 -0
- data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libutf8proc.so.3 +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libutf8proc.so.3 +0 -0
- data/lib/leptris/vendor/arm64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libutf8proc.so.3 +0 -0
- data/lib/leptris/vendor/x86_64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux/libutf8proc.so.3 +0 -0
- data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/ffi.rb +7 -0
- data/scripts/gem_smoke.rb +36 -0
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8de0724486489f72c2c7e2443165f3800ecf9d6c2982eb3a246dd3cd6ab6e70f
|
|
4
|
+
data.tar.gz: cfad76439cb742b582a4afa79e1ab029db61073843e5443a5c1d8250ee43c65e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c545ac6185a58d3628c4abbf9312a1fa54cf58878b357f6cabc64e1d84bb2624e15711872dea4d939b822a040fcbf3f753fc5c30186a393a3ecabe44d0043194
|
|
7
|
+
data.tar.gz: cf7246e381117269bad72dbb6213533d849f05b2573e5c611535a2826251c4d8f1f25e1c72a9381b179b7a4bd7656a0e41ca7caee5467ed2fc14563ec97636b6
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,152 @@ All notable changes to Leptris will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.9.199.0] - 2026-09-19
|
|
9
|
+
|
|
10
|
+
### Changed — libleptris 1.9.197 → 1.9.199 (lockstep; 1.9.198/199
|
|
11
|
+
released before this gem, entries folded)
|
|
12
|
+
|
|
13
|
+
- **The 32-bit port shipped (upstream #1174 closed)** — per-wordsize
|
|
14
|
+
layout pins replace the 64-bit-only ABI asserts, xsl:number values
|
|
15
|
+
are 64-bit end to end (ILP32 truncation fixed), and SSE2 paths
|
|
16
|
+
gate on `__SSE2__` rather than x86-ness. **The `arm-linux` and
|
|
17
|
+
`arm-linux-musl` platform gems compile for the first time** —
|
|
18
|
+
their release legs (experimental, with in-container install +
|
|
19
|
+
round-trip smoke) validate the port directly.
|
|
20
|
+
- **The root_doc_map TLS memo no longer resolves
|
|
21
|
+
namebp-carrying elements** (1.9.198, leptris/leptris#1189,
|
|
22
|
+
closed) — upstream adopted exactly the one-line guard filed from
|
|
23
|
+
our ubuntu-3.4 CI investigation: a recycled root address no
|
|
24
|
+
longer makes `set_root` mis-reject a same-document attach as
|
|
25
|
+
"cross-document". The seam_and_reads spec that exposed it runs
|
|
26
|
+
green across the full grid, deterministically.
|
|
27
|
+
- HTML: memchr prefilter in the raw-text close-tag scan; 256-entry
|
|
28
|
+
LUT for the attribute-name scan (#1177).
|
|
29
|
+
- `leptris validate --dtd` + DTD content-model fixes (cli; the
|
|
30
|
+
binding's DTD surface unchanged).
|
|
31
|
+
- Still experimental pending upstream: ppc64le (LTO export
|
|
32
|
+
internalization, #1196 — the no-LTO release build ships working
|
|
33
|
+
gems) and s390x big-endian parser (#1197/#1194, engine work
|
|
34
|
+
in progress upstream).
|
|
35
|
+
- No public-symbol changes: audit 323/323. 727/0 both modes.
|
|
36
|
+
|
|
37
|
+
## [1.9.197.0] - 2026-09-18
|
|
38
|
+
|
|
39
|
+
### Changed — libleptris 1.9.194 → 1.9.197 (lockstep)
|
|
40
|
+
|
|
41
|
+
- **HTML: the html5lib corpus is at ZERO reds upstream** — #659's
|
|
42
|
+
closing state reached in v1.9.196 (tricky01:8 table scope +
|
|
43
|
+
marker prune was the last), with table-foreign-scope bursts,
|
|
44
|
+
after-body/after-after-body comment routing, plaintext
|
|
45
|
+
raw-to-EOF, nested-table-in-cell, and the document-epilog
|
|
46
|
+
comment rule. v1.9.197 adds a memchr text-run skip in the
|
|
47
|
+
tokenizer main loop. The binding's WHATWG battery grows two
|
|
48
|
+
pins from the zero-reds set: comments past `</html>` become
|
|
49
|
+
document-level epilog nodes, and a nested table inside a cell
|
|
50
|
+
nests instead of foster-parenting.
|
|
51
|
+
- **HTML: WHATWG mode is feature-complete upstream (#659 closed)** —
|
|
52
|
+
the binding now pins the shipped behavior classes in
|
|
53
|
+
`spec/xml/html_whatwg_full_spec.rb`: active-formatting
|
|
54
|
+
reconstruction across paragraphs, the adoption agency (misnested
|
|
55
|
+
formatting reopens inside `<p>`), the Noah's Ark three-element
|
|
56
|
+
cap, template content outside the live table machinery,
|
|
57
|
+
RCDATA/rawtext (title/textarea/iframe/noembed/xmp/style),
|
|
58
|
+
in-table stray-text foster parenting, frameset-mode content
|
|
59
|
+
drop, foreign integration points, after-body restore, and the
|
|
60
|
+
script-data escape states. The `:html4` default lane is
|
|
61
|
+
unchanged.
|
|
62
|
+
- **RNG: required attributes behind `<ref>` are enforced**
|
|
63
|
+
(#1164). Spec-pinned.
|
|
64
|
+
- **RNG: stray character data under element-only content is
|
|
65
|
+
rejected (#1153)** — the anyName-wildcard laxness we filed from
|
|
66
|
+
the v188 pins. Spec-pinned at the verdict level; follow-up filed
|
|
67
|
+
upstream: the rejection does not yet record an error row
|
|
68
|
+
(report/legacy channels empty for this case).
|
|
69
|
+
- Engine 1.9.195 also fixes public-API symbols kept through
|
|
70
|
+
ThinLTO (#1154) — the macOS dylib now exports all 323 declared
|
|
71
|
+
symbols.
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- **gem-smoke workflow** (the teptris-ruby template, 9 legs): after
|
|
76
|
+
every release, install the PUBLISHED gem from rubygems on
|
|
77
|
+
ubuntu/arm64-ubuntu/macos-intel/macos-arm and Windows ucrt
|
|
78
|
+
(x64 3.3/3.4/4.0, arm64 3.4/4.0), then round-trip
|
|
79
|
+
parse/xpath/mutate/serialize/RelaxNG against the installed copy —
|
|
80
|
+
with an explicit guard that the NODE_* constants ship in the
|
|
81
|
+
Ruby layer (the sibling project's #318 class: a packaging skew
|
|
82
|
+
surfaced as NameErrors in host apps). `scripts/gem_smoke.rb`.
|
|
83
|
+
- **Ruby-source parity gate in the publish job**: every platform
|
|
84
|
+
variant's `lib/**/*.rb` must be byte-identical before anything
|
|
85
|
+
is pushed — a skew (one cell packaging from a different source
|
|
86
|
+
state) aborts the release.
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- The armv7 platform legs (`arm-linux`, `arm-linux-musl`) are
|
|
91
|
+
**experimental** (continue-on-error) until upstream ports the
|
|
92
|
+
64-bit-pinned layouts: the engine's round-19 ABI asserts
|
|
93
|
+
correctly abort on 32-bit (`sizeof(leptris_element) == 72`
|
|
94
|
+
requires 8-byte pointers) — filed as leptris/leptris#1174 with
|
|
95
|
+
both logs. aarch64-linux (qemu bookworm, glibc floor 2.36)
|
|
96
|
+
stays strict. The 1.9.194.0 release run correctly refused to
|
|
97
|
+
publish on their failure; .1/.2 were the parallel hot-read
|
|
98
|
+
aliases.
|
|
99
|
+
|
|
100
|
+
## [1.9.194.0] - 2026-09-18
|
|
101
|
+
|
|
102
|
+
### Changed — libleptris 1.9.193 → 1.9.194 (lockstep)
|
|
103
|
+
|
|
104
|
+
- **RELAX NG: define bodies are sibling lists** — a `<ref>` to a
|
|
105
|
+
multi-member define matches the WHOLE body (an implicit group);
|
|
106
|
+
previously only the body's head pattern was matched, so the
|
|
107
|
+
metanorma `DocumentBody` shape (optional preface + required
|
|
108
|
+
sections) never matched its tail. Spec-pinned.
|
|
109
|
+
- **RELAX NG: choice starvation fix** — inside a CHOICE,
|
|
110
|
+
alternatives that consume a child win over the zero-width
|
|
111
|
+
`<text/>`/empty branch (inline TextElement models stopped
|
|
112
|
+
failing). Spec-pinned.
|
|
113
|
+
- **RELAX NG diagnostics: Jing `PatternMatcher` semantics** — refs
|
|
114
|
+
splice body members into the walk, the invalid-attribute-value
|
|
115
|
+
message enumerates every reachable VALUE leaf through refs,
|
|
116
|
+
`incomplete` reports the leftmost required position, and missing
|
|
117
|
+
required attributes collapse to one message. The metanorma
|
|
118
|
+
standoc corpus is now byte-identical to Jing. Spec-pinned (the
|
|
119
|
+
attribution survives ref splicing).
|
|
120
|
+
- Engine 1.9.193.x fixes ride along (no public-symbol changes:
|
|
121
|
+
audit 323/323). The 1.9.193.2/.3 binding patches shipped without
|
|
122
|
+
changelog entries.
|
|
123
|
+
|
|
124
|
+
### Added
|
|
125
|
+
|
|
126
|
+
- **32-bit ARM platform gems: `arm-linux` and `arm-linux-musl`** —
|
|
127
|
+
no GitHub-hosted armv7 runner exists, so the release builds them
|
|
128
|
+
under qemu binfmt emulation (ruby:3.3-bookworm / ruby:3.3-alpine,
|
|
129
|
+
`--platform linux/arm/v7`); `LEPTRIS_PGO=0` on the emulated legs
|
|
130
|
+
(the two-stage trainer under qemu costs 10-20x for the same
|
|
131
|
+
library). The ruby variant vendors both, and the ffi vendor map
|
|
132
|
+
resolves `armv7l-linux`-style platforms — zero-setup
|
|
133
|
+
TruffleRuby/JRuby on armv7. Completes platform parity with the
|
|
134
|
+
sibling project's table.
|
|
135
|
+
|
|
136
|
+
### Fixed
|
|
137
|
+
|
|
138
|
+
- **macOS floor of the vendored dylibs (was: macOS 26 only)**: the
|
|
139
|
+
published darwin gems' `libleptris.dylib` carried
|
|
140
|
+
`LC_BUILD_VERSION minos 26.0` — the CI runner's SDK default —
|
|
141
|
+
and refused to load on any older macOS. The compile task now
|
|
142
|
+
sets `MACOSX_DEPLOYMENT_TARGET=11.0` for cmake (a plain
|
|
143
|
+
`-DCMAKE_OSX_DEPLOYMENT_TARGET` lands UNINITIALIZED and is
|
|
144
|
+
ignored); verified `minos 11.0` locally. The extconf.rb pin had
|
|
145
|
+
only ever covered the native bundle.
|
|
146
|
+
- **glibc floor of the linux gems (was: glibc ≥ 2.38)**: the
|
|
147
|
+
x86_64 gem was built on a 24.04 runner and leaked GLIBC_2.38
|
|
148
|
+
symbol requirements — Debian 12 / Ubuntu 22.04 hosts could not
|
|
149
|
+
load it (the aarch64 gem likewise via the 24.04-arm runner).
|
|
150
|
+
The x86_64 leg now builds natively on ubuntu-22.04 (floor
|
|
151
|
+
2.35) and the aarch64 leg builds in a qemu linux/arm64
|
|
152
|
+
bookworm container (floor 2.36).
|
|
153
|
+
|
|
8
154
|
## [1.9.193.0] - 2026-09-17
|
|
9
155
|
|
|
10
156
|
### Changed — libleptris 1.9.192 -> 1.9.193 (lockstep)
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.199"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
|
@@ -77,6 +77,14 @@ task :compile do
|
|
|
77
77
|
fetch_tarball.call(
|
|
78
78
|
"https://api.github.com/repos/leptris/leptris/tarball/v#{version}", build)
|
|
79
79
|
|
|
80
|
+
# NOTE: 32-bit ARM (armv7) is an ENGINE port task — the round-19
|
|
81
|
+
# ABI asserts pin layouts to 8-byte-pointer sizes and correctly
|
|
82
|
+
# abort the build on 32-bit. Filed upstream as leptris/leptris
|
|
83
|
+
# #1174; the release legs stay experimental (continue-on-error)
|
|
84
|
+
# and flip green automatically when the port ships. We patch
|
|
85
|
+
# nothing here — the emulated-leg smoke validates whatever the
|
|
86
|
+
# engine provides.
|
|
87
|
+
|
|
80
88
|
# utf8proc: shared build only, @rpath install name, local prefix.
|
|
81
89
|
u8_dir = File.expand_path("tmp/utf8proc-#{UTF8PROC_VERSION}", __dir__)
|
|
82
90
|
u8_prefix = File.join(u8_dir, "prefix")
|
|
@@ -98,6 +106,16 @@ task :compile do
|
|
|
98
106
|
# literal on Windows shells (they broke the MSVC build).
|
|
99
107
|
# GCC-family only — MSVC's cl rejects the flag outright (D8021).
|
|
100
108
|
cflags = Gem.win_platform? ? "" : "-Wno-error=incompatible-pointer-types"
|
|
109
|
+
# macOS floor for the VENDORED dylibs: without this, cmake uses
|
|
110
|
+
# the building machine's SDK default (a macos-latest runner
|
|
111
|
+
# shipped minos 26.0) and the dylib refuses to load on user
|
|
112
|
+
# machines older than the runner — the extconf.rb 11.0 pin only
|
|
113
|
+
# ever covered the native bundle. CMake initializes
|
|
114
|
+
# CMAKE_OSX_DEPLOYMENT_TARGET from this env var at first
|
|
115
|
+
# configure (a plain -D lands UNINITIALIZED and is ignored).
|
|
116
|
+
# 11.0 = the oldest macOS GitHub still hosts runners for;
|
|
117
|
+
# matches extconf.rb.
|
|
118
|
+
ENV["MACOSX_DEPLOYMENT_TARGET"] ||= "11.0" if RUBY_PLATFORM =~ /darwin/
|
|
101
119
|
cmake_base =
|
|
102
120
|
"#{CMAKE_FLAGS.join(' ').sub('-DLEPTRIS_ENABLE_UTF8PROC=OFF', '-DLEPTRIS_ENABLE_UTF8PROC=ON')} " \
|
|
103
121
|
"-DCMAKE_PREFIX_PATH=#{u8_prefix} #{cflags.empty? ? '' : "-DCMAKE_C_FLAGS=#{cflags}"}"
|
|
@@ -110,6 +128,12 @@ task :compile do
|
|
|
110
128
|
# LEPTRIS_PGO=0 escapes to the single-stage build.
|
|
111
129
|
pgo = ENV["LEPTRIS_PGO"] != "0" && !Gem.win_platform?
|
|
112
130
|
if pgo
|
|
131
|
+
# The trainer is disposable infrastructure — an engine-side
|
|
132
|
+
# trainer break (e.g. leptris/leptris#1204: GCC LTO internalizes
|
|
133
|
+
# CLI-only API symbols and the CLI link dies) must degrade the
|
|
134
|
+
# gem to the plain build (loudly, with the issue pointer), not
|
|
135
|
+
# block every platform's release.
|
|
136
|
+
begin
|
|
113
137
|
# _GNU_SOURCE for the TRAIN build only: the CLI (the trainer, not
|
|
114
138
|
# built in normal gems) uses fileno, which musl hides without a
|
|
115
139
|
# POSIX feature macro (glibc is lenient). Upstream fix pending in
|
|
@@ -150,6 +174,15 @@ task :compile do
|
|
|
150
174
|
sh "cmake -B #{build}/build -S #{build} #{cmake_base} " \
|
|
151
175
|
"-DLEPTRIS_BUILD_CLI=OFF -DLEPTRIS_ENABLE_PGO=USE"
|
|
152
176
|
sh "cmake --build #{build}/build --config Release -j 4"
|
|
177
|
+
rescue => e
|
|
178
|
+
warn "leptris: PGO trainer failed (#{e.message.to_s[0, 160]}); " \
|
|
179
|
+
"shipping the single-stage build — the parse path loses the " \
|
|
180
|
+
"~20% PGO gain this release (leptris/leptris#1204 tracks the " \
|
|
181
|
+
"engine-side trainer break)"
|
|
182
|
+
rm_rf(File.join(build, "build"))
|
|
183
|
+
sh "cmake -B #{build}/build -S #{build} #{cmake_base}"
|
|
184
|
+
sh "cmake --build #{build}/build --config Release -j 4"
|
|
185
|
+
end
|
|
153
186
|
else
|
|
154
187
|
sh "cmake -B #{build}/build -S #{build} #{cmake_base}"
|
|
155
188
|
sh "cmake --build #{build}/build --config Release -j 4"
|
|
@@ -328,6 +361,10 @@ platforms = [
|
|
|
328
361
|
"aarch64-linux-musl",
|
|
329
362
|
"x86_64-darwin",
|
|
330
363
|
"arm64-darwin",
|
|
364
|
+
"arm-linux",
|
|
365
|
+
"arm-linux-musl",
|
|
366
|
+
"ppc64le-linux",
|
|
367
|
+
"s390x-linux-musl",
|
|
331
368
|
]
|
|
332
369
|
|
|
333
370
|
platforms.each do |platform|
|
data/ext/leptris/native/native.c
CHANGED
|
@@ -1941,6 +1941,122 @@ static VALUE nf_snapshot_rows(VALUE self, VALUE document, VALUE addr)
|
|
|
1941
1941
|
return out;
|
|
1942
1942
|
}
|
|
1943
1943
|
|
|
1944
|
+
/* ---- Struct plan executor (moxml "miles faster" round) ------------
|
|
1945
|
+
* The consumer's shape compiles to spec: name (interned String) ->
|
|
1946
|
+
* [Struct class, attrs Hash (name -> slot Symbol), text slot Symbol
|
|
1947
|
+
* or nil, children slot Symbol or nil]. C walks the subtree
|
|
1948
|
+
* pre-order, mints typed structs directly (rb_struct_new +
|
|
1949
|
+
* rb_struct_aset), and attaches each to the nearest OPEN frame —
|
|
1950
|
+
* exactly Moxml::Plan's semantics: an unmatched element is a
|
|
1951
|
+
* barrier (its matched descendants surface at top level). Zero
|
|
1952
|
+
* Ruby frames and zero intermediate rows per element. */
|
|
1953
|
+
static void plan_walk(void *node, int depth, VALUE spec, VALUE stack,
|
|
1954
|
+
VALUE roots)
|
|
1955
|
+
{
|
|
1956
|
+
if (f_node_type(node) == WS_NODE_ELEMENT) {
|
|
1957
|
+
const char *name_c = f_elem_name(node);
|
|
1958
|
+
VALUE entry = name_c ? rb_hash_aref(spec,
|
|
1959
|
+
rb_enc_interned_str(name_c, strlen(name_c),
|
|
1960
|
+
rb_utf8_encoding()))
|
|
1961
|
+
: Qnil;
|
|
1962
|
+
|
|
1963
|
+
/* Complete deeper frames: pre-order means any open frame at
|
|
1964
|
+
* depth >= this element's depth belongs to an earlier
|
|
1965
|
+
* subtree that ended before this row. */
|
|
1966
|
+
while (RARRAY_LEN(stack) >= 2 &&
|
|
1967
|
+
NUM2INT(rb_ary_entry(stack, RARRAY_LEN(stack) - 2)) >=
|
|
1968
|
+
depth) {
|
|
1969
|
+
rb_ary_pop(stack);
|
|
1970
|
+
rb_ary_pop(stack);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
if (!NIL_P(entry)) {
|
|
1974
|
+
/* volatile: keep live VALUEs on the C stack so the
|
|
1975
|
+
* conservative scanner sees them on every ABI (windows
|
|
1976
|
+
* x64 keeps some only in callee-saved registers). */
|
|
1977
|
+
volatile VALUE klass = rb_ary_entry(entry, 0);
|
|
1978
|
+
volatile VALUE attrs_spec = rb_ary_entry(entry, 1);
|
|
1979
|
+
volatile VALUE text_slot = rb_ary_entry(entry, 2);
|
|
1980
|
+
volatile VALUE children_slot = rb_ary_entry(entry, 3);
|
|
1981
|
+
VALUE value = rb_struct_new(klass);
|
|
1982
|
+
|
|
1983
|
+
for (void *a = f_attr_first(node); a; a = f_attr_next(a)) {
|
|
1984
|
+
const char *an = f_attr_name(a);
|
|
1985
|
+
VALUE slot = an ? rb_hash_aref(attrs_spec,
|
|
1986
|
+
rb_enc_interned_str(an, strlen(an),
|
|
1987
|
+
rb_utf8_encoding()))
|
|
1988
|
+
: Qnil;
|
|
1989
|
+
if (!NIL_P(slot)) {
|
|
1990
|
+
const char *av = f_attr_value(node, a);
|
|
1991
|
+
rb_struct_aset(value, slot,
|
|
1992
|
+
av ? rb_utf8_str_new_cstr(av) : Qnil);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
if (!NIL_P(text_slot)) {
|
|
1996
|
+
void *c;
|
|
1997
|
+
for (c = f_first_child(node); c; c = f_next_sibling(c)) {
|
|
1998
|
+
if (f_node_type(c) == WS_NODE_TEXT) {
|
|
1999
|
+
const char *t = f_text_content(c);
|
|
2000
|
+
rb_struct_aset(value, text_slot,
|
|
2001
|
+
t ? rb_utf8_str_new_cstr(t) : Qnil);
|
|
2002
|
+
break;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
/* attach: nearest open frame carrying a children array;
|
|
2008
|
+
* barriers (unmatched ancestors) and the root surface
|
|
2009
|
+
* the value at top level — Moxml::Plan's contract. */
|
|
2010
|
+
if (RARRAY_LEN(stack) >= 2 &&
|
|
2011
|
+
rb_ary_entry(stack, RARRAY_LEN(stack) - 1) != Qnil) {
|
|
2012
|
+
rb_ary_push(rb_ary_entry(stack, RARRAY_LEN(stack) - 1),
|
|
2013
|
+
value);
|
|
2014
|
+
} else {
|
|
2015
|
+
rb_ary_push(roots, value);
|
|
2016
|
+
}
|
|
2017
|
+
RB_GC_GUARD(value);
|
|
2018
|
+
RB_GC_GUARD(entry);
|
|
2019
|
+
|
|
2020
|
+
if (!NIL_P(children_slot)) {
|
|
2021
|
+
VALUE children = rb_ary_new();
|
|
2022
|
+
rb_struct_aset(value, children_slot, children);
|
|
2023
|
+
rb_ary_push(stack, INT2NUM(depth));
|
|
2024
|
+
rb_ary_push(stack, children);
|
|
2025
|
+
}
|
|
2026
|
+
} else {
|
|
2027
|
+
/* unmatched: barrier frame — descendants must not
|
|
2028
|
+
* attach through it (Moxml::Plan parity). */
|
|
2029
|
+
rb_ary_push(stack, INT2NUM(depth));
|
|
2030
|
+
rb_ary_push(stack, Qnil);
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
void *c;
|
|
2034
|
+
for (c = f_first_child(node); c; c = f_next_sibling(c)) {
|
|
2035
|
+
plan_walk(c, depth + 1, spec, stack, roots);
|
|
2036
|
+
}
|
|
2037
|
+
} else if (f_node_type(node) == WS_NODE_DOCTYPE ||
|
|
2038
|
+
f_node_type(node) == 9) {
|
|
2039
|
+
void *dc = f_first_child(node);
|
|
2040
|
+
while (dc) {
|
|
2041
|
+
plan_walk(dc, depth, spec, stack, roots);
|
|
2042
|
+
dc = f_next_sibling(dc);
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
static VALUE nf_plan_structs(VALUE self, VALUE document, VALUE addr,
|
|
2048
|
+
VALUE spec)
|
|
2049
|
+
{
|
|
2050
|
+
(void)self;
|
|
2051
|
+
(void)document;
|
|
2052
|
+
VALUE roots = rb_ary_new();
|
|
2053
|
+
VALUE stack = rb_ary_new();
|
|
2054
|
+
plan_walk((void *)(uintptr_t)NUM2ULL(addr), 0, spec, stack, roots);
|
|
2055
|
+
RB_GC_GUARD(spec);
|
|
2056
|
+
RB_GC_GUARD(stack);
|
|
2057
|
+
return roots;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
1944
2060
|
/* ---- inner_html in one C pass (TODO.perf/18) --------------------
|
|
1945
2061
|
* Serializes the receiver's children into one growable buffer:
|
|
1946
2062
|
* elements via leptris_element_serialize_into (the same opts the
|
|
@@ -2417,6 +2533,11 @@ void Init_native(void)
|
|
|
2417
2533
|
rb_define_method(c_native_node, "content", nn_content, 0);
|
|
2418
2534
|
rb_define_method(c_native_node, "attribute", nn_attribute, 1);
|
|
2419
2535
|
rb_define_alias(c_native_node, "[]", "attribute");
|
|
2536
|
+
/* Unshadowed aliases for consumers whose contract modules shadow
|
|
2537
|
+
* attribute/content: a plain call resolves to these at normal
|
|
2538
|
+
* method-cache cost instead of UnboundMethod#bind_call. */
|
|
2539
|
+
rb_define_alias(c_native_node, "attr_read", "attribute");
|
|
2540
|
+
rb_define_alias(c_native_node, "text_read", "content");
|
|
2420
2541
|
rb_define_method(c_native_node, "children", nn_children, 0);
|
|
2421
2542
|
rb_define_method(c_native_node, "element_children", nn_element_children, 0);
|
|
2422
2543
|
rb_define_method(c_native_node, "next_sibling", nn_next_sibling, 0);
|
|
@@ -2485,6 +2606,8 @@ void Init_native(void)
|
|
|
2485
2606
|
nf_snapshot_subtree, 2);
|
|
2486
2607
|
rb_define_module_function(m_native, "snapshot_rows",
|
|
2487
2608
|
nf_snapshot_rows, 2);
|
|
2609
|
+
rb_define_module_function(m_native, "plan_structs",
|
|
2610
|
+
nf_plan_structs, 3);
|
|
2488
2611
|
rb_define_module_function(m_native, "doc_handle_attach",
|
|
2489
2612
|
nf_doc_handle_attach, 1);
|
|
2490
2613
|
rb_define_module_function(m_native, "doc_handle_release",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/ffi.rb
CHANGED
|
@@ -21,6 +21,13 @@ module Leptris
|
|
|
21
21
|
when /x86_64.*darwin/ then %w[x86_64-darwin]
|
|
22
22
|
when /aarch64.*linux/ then %w[aarch64-linux aarch64-linux-musl]
|
|
23
23
|
when /x86_64.*linux/ then %w[x86_64-linux x86_64-linux-musl]
|
|
24
|
+
# 32-bit ARM (armv[567l]: "arm-linux", "armv7l-linux",
|
|
25
|
+
# "armeb-linux", ...). Never matches aarch64 ("aarch" has
|
|
26
|
+
# no "arm" substring).
|
|
27
|
+
when /arm.*linux/ then %w[arm-linux arm-linux-musl]
|
|
28
|
+
# POWER8+ little-endian and IBM Z (qemu-built platform gems)
|
|
29
|
+
when /ppc64le.*linux/ then %w[ppc64le-linux]
|
|
30
|
+
when /s390x.*linux/ then %w[s390x-linux s390x-linux-musl]
|
|
24
31
|
else []
|
|
25
32
|
end
|
|
26
33
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Post-publish smoke (the teptris-ruby gem-smoke template): the
|
|
4
|
+
# INSTALLED gem from rubygems — not the checkout — must parse,
|
|
5
|
+
# query, mutate, serialize, and validate, with the native layer
|
|
6
|
+
# when the platform ships it. Also guards the #318 class: the
|
|
7
|
+
# NODE_* constants must exist in the shipped layer (a packaging
|
|
8
|
+
# skew surfaces as a NameError on first use, not at require).
|
|
9
|
+
require "leptris"
|
|
10
|
+
|
|
11
|
+
abort "SMOKE FAIL: leptris did not define Leptris::VERSION" unless defined?(Leptris::VERSION)
|
|
12
|
+
puts "leptris #{Leptris::VERSION} on #{RUBY_PLATFORM} (ruby #{RUBY_VERSION})"
|
|
13
|
+
|
|
14
|
+
doc = Leptris::XML.parse("<r id='1'><a x='2'>t1</a><a>t2</a></r>")
|
|
15
|
+
raise "parse: root" unless doc.root.name == "r"
|
|
16
|
+
raise "xpath: children" unless doc.root.xpath("a").size == 2
|
|
17
|
+
raise "attr read" unless doc.at_xpath("a")["x"] == "2"
|
|
18
|
+
|
|
19
|
+
doc.at_xpath("a").content = "z"
|
|
20
|
+
raise "mutate" unless doc.at_xpath("a").content == "z"
|
|
21
|
+
raise "serialize" unless doc.to_xml.include?('<a x="2">z</a>')
|
|
22
|
+
|
|
23
|
+
rng = Leptris::XML::RelaxNG.parse(
|
|
24
|
+
'<element name="r" xmlns="http://relaxng.org/ns/structure/1.0">' \
|
|
25
|
+
"<attribute name=\"id\"/></element>")
|
|
26
|
+
rng_doc = Leptris::XML::Document.parse(%q{<r id='1'/>})
|
|
27
|
+
raise "rng verdict" unless rng.valid?(rng_doc)
|
|
28
|
+
raise "rng errors shape" unless rng.validate_errors(rng_doc).is_a?(Array)
|
|
29
|
+
raise "rng report shape" unless rng.validate_report(rng_doc).is_a?(Array)
|
|
30
|
+
|
|
31
|
+
# The #318 class: node-kind constants must live in the shipped
|
|
32
|
+
# Ruby layer (plain constants cannot go missing with the lib).
|
|
33
|
+
raise "NODE constants" unless Leptris::XML::FFI::NODE_ELEMENT
|
|
34
|
+
|
|
35
|
+
layer = defined?(Leptris::XML::NATIVE_FAST) ? "native" : "ffi"
|
|
36
|
+
puts "SMOKE OK (#{layer} layer)"
|
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.
|
|
4
|
+
version: 1.9.197.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -144,8 +144,14 @@ files:
|
|
|
144
144
|
- lib/leptris/vendor/aarch64-linux-musl/libutf8proc.so.3
|
|
145
145
|
- lib/leptris/vendor/aarch64-linux/libleptris.so
|
|
146
146
|
- lib/leptris/vendor/aarch64-linux/libutf8proc.so.3
|
|
147
|
+
- lib/leptris/vendor/arm-linux-musl/libleptris.so
|
|
148
|
+
- lib/leptris/vendor/arm-linux-musl/libutf8proc.so.3
|
|
149
|
+
- lib/leptris/vendor/arm-linux/libleptris.so
|
|
150
|
+
- lib/leptris/vendor/arm-linux/libutf8proc.so.3
|
|
147
151
|
- lib/leptris/vendor/arm64-darwin/libleptris.dylib
|
|
148
152
|
- lib/leptris/vendor/arm64-darwin/libutf8proc.3.dylib
|
|
153
|
+
- lib/leptris/vendor/ppc64le-linux/libleptris.so
|
|
154
|
+
- lib/leptris/vendor/ppc64le-linux/libutf8proc.so.3
|
|
149
155
|
- lib/leptris/vendor/x86_64-darwin/libleptris.dylib
|
|
150
156
|
- lib/leptris/vendor/x86_64-darwin/libutf8proc.3.dylib
|
|
151
157
|
- lib/leptris/vendor/x86_64-linux-musl/libleptris.so
|
|
@@ -193,6 +199,7 @@ files:
|
|
|
193
199
|
- lib/leptris/xml/xpath.rb
|
|
194
200
|
- lib/leptris/xml/xquery.rb
|
|
195
201
|
- lib/leptris/xml/xslt.rb
|
|
202
|
+
- scripts/gem_smoke.rb
|
|
196
203
|
homepage: https://github.com/leptris/leptris-ruby
|
|
197
204
|
licenses:
|
|
198
205
|
- MIT
|