play 2's frame keeps and a dropped file: a var() join made at once, the hint rail emptied in place, save_read gives its text back
- ludic.ui cv_join (units_pieces.ludic:93): a var() value's pieces were joined by +, a text left behind per piece on every memo miss; it is written at its length at once (units_join.ludic), and the miss is its own declared function (cs_vars_miss), bounded by the memo. - ludic.hints hn_slots (rail.ludic:41): hints_reset made a new rail every time; the rail is emptied in place, made again only for another count (rail_slots.ludic). - value_spare_put (value.ludic:138): a list's spares grow only past the most it has ever cut off; declared as such. - ludic.save: save_read reads, parses and frees the file's text - the tree's strings are the parser's own - and says whether the text was whole (SaveRead.intact) for the words of a refusal. Maroon Lake's trip and home reads kept the whole file on every load and every menu card read. Tests: ludic.save (10), ludic.hints (8); the 36 ui examples; value_list_regrow, json_saves and alloc_fence_declared unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9b3d3e3298
commit
338202c41b
10 changed files with 53 additions and 13 deletions
|
|
@ -16,6 +16,7 @@ import "memo_more.ludic"
|
|||
import "memo_join.ludic"
|
||||
import "eval_text.ludic"
|
||||
import "units_pieces.ludic"
|
||||
import "units_join.ludic"
|
||||
import "expr.ludic"
|
||||
import "expr_parse.ludic"
|
||||
import "expr_prim.ludic"
|
||||
|
|
|
|||
|
|
@ -68,6 +68,11 @@ function cs_vars_in(ui_st: mut UiState, n: UiNode, v: Val) -> Val {
|
|||
if m.tags[i] == MM_VARS and cv_same(ui_st, m.keys[i]) { return m.vals[i] }
|
||||
at = (at + 1) & (MM_CAP - 1)
|
||||
}
|
||||
return cs_vars_miss(ui_st, m)
|
||||
}
|
||||
# a value's var()s resolved to something not seen before: built once and kept in the memo
|
||||
@alloc_ok("a memo miss: a var() value first seen, then kept, up to MM_CAP")
|
||||
function cs_vars_miss(ui_st: mut UiState, m: UiMemo) -> Val {
|
||||
let raw = cv_join(ui_st)
|
||||
let r = Value.str(tpl_words(raw))
|
||||
let j = mm_add(m, MM_VARS, raw)
|
||||
|
|
|
|||
17
packages/ludic.ui/units_join.ludic
Normal file
17
packages/ludic.ui/units_join.ludic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# units_join.ludic - a var() value's pieces joined, for a memo miss (units.ludic)
|
||||
# the pieces as one text, made at its length at once (joined by + it left a text per piece behind)
|
||||
function cv_join(ui_st: UiState) -> string {
|
||||
var n = 0
|
||||
for p in 0 .. len(ui_st.cv_texts) { n += len(ui_st.cv_texts[p]) }
|
||||
var out: pointer = null
|
||||
unsafe { out = bytes(n + 1) }
|
||||
var at = 0
|
||||
for p in 0 .. len(ui_st.cv_texts) {
|
||||
let t = ui_st.cv_texts[p]
|
||||
unsafe { for i in 0 .. len(t) { out[at + i] = t[i] } }
|
||||
at += len(t)
|
||||
}
|
||||
unsafe { out[n] = 0 }
|
||||
let s: string = out
|
||||
return s
|
||||
}
|
||||
|
|
@ -88,8 +88,3 @@ function cv_same(ui_st: UiState, k: string) -> bool {
|
|||
}
|
||||
return at == len(k)
|
||||
}
|
||||
function cv_join(ui_st: UiState) -> string {
|
||||
var out = ""
|
||||
for p in 0 .. len(ui_st.cv_texts) { out = out + ui_st.cv_texts[p] }
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue