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:
parent
ae65acde33
commit
5a9e8cb2da
13 changed files with 2992 additions and 3206 deletions
|
|
@ -13,7 +13,7 @@ const IMG_MAX: int = 32
|
|||
const SPR_MAX: int = 160
|
||||
const SPR_SZ: int = 16
|
||||
|
||||
var img_px: ptr = null # IMG_MAX pointers to RGBA buffers
|
||||
var img_px: ptrs = null # IMG_MAX pointers to RGBA buffers
|
||||
var img_w: words = null
|
||||
var img_h: words = null
|
||||
var img_n: int = 0
|
||||
|
|
@ -232,7 +232,7 @@ fn rt_image_load(path: str) -> int {
|
|||
if rt_decode_png(path) == false { return 0 - 1 }
|
||||
let id = img_n
|
||||
img_n = img_n + 1
|
||||
pokep(img_px, id, png_px)
|
||||
img_px[id] = png_px
|
||||
img_w[id] = png_w
|
||||
img_h[id] = png_h
|
||||
return id
|
||||
|
|
@ -265,7 +265,7 @@ fn rt_draw_image(id: int, dx: int, dy: int) -> void {
|
|||
if id >= img_n { return }
|
||||
let w = img_w[id]
|
||||
let h = img_h[id]
|
||||
let s: words = peekp(img_px, id)
|
||||
let s: words = img_px[id]
|
||||
for y in 0 .. h {
|
||||
for x in 0 .. w {
|
||||
rt_blend_px(dx + x, dy + y, s[y * w + x])
|
||||
|
|
@ -280,7 +280,7 @@ fn rt_draw_image_scaled(id: int, dx: int, dy: int, dw: int, dh: int) -> void {
|
|||
if dh <= 0 { return }
|
||||
let w = img_w[id]
|
||||
let h = img_h[id]
|
||||
let s: words = peekp(img_px, id)
|
||||
let s: words = img_px[id]
|
||||
for y in 0 .. dh {
|
||||
for x in 0 .. dw {
|
||||
rt_blend_px(dx + x, dy + y, s[(y * h / dh) * w + x * w / dw])
|
||||
|
|
@ -305,7 +305,7 @@ fn rt_draw_9slice(id: int, dx: int, dy: int, dw: int, dh: int, inset: int) -> vo
|
|||
if dh <= 0 { return }
|
||||
let w = img_w[id]
|
||||
let h = img_h[id]
|
||||
let s: words = peekp(img_px, id)
|
||||
let s: words = img_px[id]
|
||||
for y in 0 .. dh {
|
||||
let sy = rt_9map(y, dh, h, inset)
|
||||
for x in 0 .. dw {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue