Phase 8a: finish typed indexing — fixeds/ptrs buffers (retire peekf/pokef/peekp/pokep/str_len)

The last peek/poke pairs were the same "typed buffer access wearing a C name" as
peek8/peek32, so they become indexing too:

  peekf(sc_x, i)     -> sc_x[i]        (a `fixeds` buffer -> a fixed)
  pokep(gc_bmp, s,b) -> gc_bmp[s] = b  (a `ptrs` buffer -> a pointer)
  str_len(s)         -> len(s)         (len is polymorphic since 7f; str_len was dead)

Two new element-typed buffers join words: `fixeds` (32-bit fixed) and `ptrs`
(pointer, 8-byte stride). emit_index_addr dispatches on the base type; IR is
byte-identical to the old intrinsics.

The peekf/peekp buffers (ed_x0/ed_x1/ol_x/sc_x fixed coords; gc_bmp/img_px/
tt_data/ui_text pointer arrays) were retyped scope-aware, then the 33 sites
migrated to indexing. Two bugs found via a menu golden diff / a link-time type
error and fixed: the buffer-name regex truncated digit suffixes (ed_x0 -> ed_x),
and the char-literal brace-miscount skipped a few module declarations (same class
as 7j).

Reseeded (22371 lines); C-free fixpoint holds; goldens byte-identical; 18/18;
vocab (fixeds/ptrs types in, 5 intrinsics out) + doc-fences clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-08-28 02:49:40 +03:00
parent ae65acde33
commit 5a9e8cb2da
13 changed files with 2992 additions and 3206 deletions

View file

@ -73,7 +73,7 @@ var ui_visible: words = null
var ui_fired: words = null
var ui_hasdyn: words = null
var ui_dyn: ptr = null # UI_MAX * 96 bytes
var ui_text: ptr = null # UI_MAX static string pointers
var ui_text: ptrs = null # UI_MAX static string pointers
var ui_n: int = 0
var ui_active: int = -1
@ -138,7 +138,7 @@ fn rt_ui_reset(n: int) -> void {
ui_visible[i] = 1
ui_fired[i] = 0
ui_hasdyn[i] = 0
pokep(ui_text, i, null)
ui_text[i] = null
}
}
@ -171,13 +171,13 @@ fn rt_ui_set(i: int, k: int, v: int) -> void {
fn rt_ui_static_text(i: int, s: str) -> void {
if i < 0 { return }
if i >= UI_MAX { return }
pokep(ui_text, i, s)
ui_text[i] = s
}
# ---- text helpers: TrueType when a font is loaded, bitmap otherwise -------
fn ui_str(i: int) -> ptr {
if ui_hasdyn[i] == 1 { return ptr_add(ui_dyn, i * 96) }
let t = peekp(ui_text, i)
let t = ui_text[i]
if (t == null) { return ptr_add(ui_dyn, i * 96) }
return t
}