wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run

ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 5ffe50ed02
commit 19fcf60599
459 changed files with 17862 additions and 17603 deletions

View file

@ -1,18 +1,17 @@
# tpl_lines.ludic - which line of its file an element is on
# the text being read, and where its lines start, so an element can say which line it is on
var tp_nl: []int = new []int
function tp_lines(src: string) -> void {
tp_nl = new []int
function tp_lines(ui_st: mut UiState, src: string) -> void {
ui_st.tp_nl = new []int
for i in 0 .. len(src) {
if src[i] == 10 { push(tp_nl, i) }
if src[i] == 10 { push(ui_st.tp_nl, i) }
}
}
function tp_line(at: int) -> int {
function tp_line(ui_st: UiState, at: int) -> int {
var lo = 0
var hi = len(tp_nl)
var hi = len(ui_st.tp_nl)
while lo < hi {
let mid = (lo + hi) / 2
if tp_nl[mid] < at { lo = mid + 1 } else { hi = mid }
if ui_st.tp_nl[mid] < at { lo = mid + 1 } else { hi = mid }
}
return lo + 1
}
@ -25,7 +24,7 @@ function tp_mixed(x: Xml) -> bool {
}
return false
}
function tp_read_mixed(t: UiTpl, x: Xml, file: string, err: []string) -> void {
function tp_read_mixed(ui_st: mut UiState, t: UiTpl, x: Xml, file: string, err: []string) -> void {
for i in 0 .. len(x.mixed) {
let m = x.mixed[i]
if m.tag == "#text" {
@ -39,6 +38,6 @@ function tp_read_mixed(t: UiTpl, x: Xml, file: string, err: []string) -> void {
r.kids = new []UiTpl
r.text = ex_text(tpl_words(m.text), err)
push(t.kids, r)
} else { push(t.kids, tpl_read(m, file)) }
} else { push(t.kids, tpl_read(ui_st, m, file)) }
}
}