teptris 0.2.29-x86_64-linux → 0.2.30-x86_64-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 +4 -4
- data/lib/teptris/descriptor.rb +29 -29
- data/lib/teptris/version.rb +1 -1
- data/lib/teptris_ext.so +0 -0
- 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: 8481b0ddbaecff804ac851e3b54e3b16a76d005064b3e1ac535d82993d20faf4
|
|
4
|
+
data.tar.gz: a46a7f679ac29526967f004df07aad98d268935b6ad25db1b4b74a7035a20310
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73eeb15033381b2d8da0a657b2c6e9d3d59597a4d94c8c5f586cbb49341ce4e5d154f3923c4246f2e52c9d2ff33ac31e1e9e67093d2a7caaadb521490453c140
|
|
7
|
+
data.tar.gz: 054db779514589be18599d58c29873ac673905d640232ef797b49aef489fc3a812f6693026d63717532f9ef787993432611bbc54feda547d5146bb3e8474a0a2
|
data/lib/teptris/descriptor.rb
CHANGED
|
@@ -27,11 +27,35 @@ class Teptris::Descriptor
|
|
|
27
27
|
attr_reader :rows, :first_row
|
|
28
28
|
|
|
29
29
|
def self.build(tree)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
# Pre-order plan numbering (root = plan 0) with each plan's rows
|
|
31
|
+
# assigned a DISJOINT reserved range. Interleaved appending leaks
|
|
32
|
+
# siblings that follow a :nested child into the sub-plan's range —
|
|
33
|
+
# the 0.2.29 bug (every array-of-tables element grew stray nil
|
|
34
|
+
# rows).
|
|
35
|
+
plans = []
|
|
36
|
+
index_of = {}
|
|
37
|
+
collect = lambda do |t|
|
|
38
|
+
unless index_of.key?(t.object_id)
|
|
39
|
+
index_of[t.object_id] = plans.length
|
|
40
|
+
plans << t
|
|
41
|
+
end
|
|
42
|
+
(t[:children] || []).each do |ch|
|
|
43
|
+
collect.call(ch[:plan]) if KINDS.fetch(ch[:kind]) == 3
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
collect.call(tree)
|
|
47
|
+
|
|
48
|
+
first_row = [0]
|
|
49
|
+
plans.each { |t| first_row << first_row[-1] + (t[:children] || []).length }
|
|
50
|
+
rows = Array.new(first_row[-1])
|
|
51
|
+
plans.each_with_index do |t, i|
|
|
52
|
+
(t[:children] || []).each_with_index do |ch, j|
|
|
53
|
+
kind = KINDS.fetch(ch[:kind])
|
|
54
|
+
sub = kind == 3 ? index_of[ch[:plan].object_id] : 0
|
|
55
|
+
rows[first_row[i] + j] = [ch[:name].to_s, kind, sub]
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
35
59
|
d = allocate
|
|
36
60
|
d.instance_variable_set(:@rows, rows.freeze)
|
|
37
61
|
d.instance_variable_set(:@first_row, first_row.freeze)
|
|
@@ -40,30 +64,6 @@ class Teptris::Descriptor
|
|
|
40
64
|
d.freeze
|
|
41
65
|
end
|
|
42
66
|
|
|
43
|
-
# Pre-order: each plan's rows are one CONTIGUOUS block; nested
|
|
44
|
-
# sub-plans are compiled after the parent's block starts and their
|
|
45
|
-
# indices patch the parent's NESTED rows. first_row must eventually
|
|
46
|
-
# carry plan_count + 1 entries (the sentinel is rows.length).
|
|
47
|
-
def self.compile(tree, rows, first_row, counter)
|
|
48
|
-
idx = counter[0]
|
|
49
|
-
counter[0] += 1
|
|
50
|
-
first_row[idx] = rows.length
|
|
51
|
-
(tree[:children] || []).each do |ch|
|
|
52
|
-
kind = KINDS.fetch(ch[:kind])
|
|
53
|
-
if kind == 3
|
|
54
|
-
sub = counter[0]
|
|
55
|
-
pos = rows.length
|
|
56
|
-
rows << nil # patched with the real sub index below
|
|
57
|
-
sub = compile(ch[:plan], rows, first_row, counter)
|
|
58
|
-
rows[pos] = [ch[:name].to_s, kind, sub]
|
|
59
|
-
else
|
|
60
|
-
rows << [ch[:name].to_s, kind, 0]
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
idx
|
|
64
|
-
end
|
|
65
|
-
private_class_method :compile
|
|
66
|
-
|
|
67
67
|
def walk(toml)
|
|
68
68
|
TeptrisExt.plan_emit(@handle, toml)
|
|
69
69
|
end
|
data/lib/teptris/version.rb
CHANGED
data/lib/teptris_ext.so
CHANGED
|
Binary file
|