Phase 8b: modern names for the raw-memory and OS/IO primitives
Groups B and C of the leftover-primitive cleanup — renames, not new machinery,
and deliberately NO unsafe_ prefix (a __-prefix is itself a C convention, and an
`unsafe` marker carries no signal in a fully-manual-memory language with no safe
subset to contrast against).
memory: mem_free -> free mem_realloc -> resize mem_set -> fill
ptr_add -> offset
process: os_argc -> arg_count os_arg -> arg os_exit -> exit
os_system -> run os_getenv -> getenv read_byte -> read_char
dead: mem_copy, os_time, write_byte (0 uses) — deleted
Two reseeds: accept both old and new names in the intrinsic dispatch, then
migrate every call site and drop the old names. file_open/read/write/seek/tell/
close are left as-is — they're the domain-prefixed syscall layer wrapped by
read_file, not the argc/argv-style C-ness the audit targeted; a `File` type is a
separate, larger design if wanted.
test.sh's CLI smoke updated (os_exit -> exit); check-vocabulary's grammar marker
moved off the deleted names. Reseeded (22243 lines); C-free fixpoint holds;
goldens identical; 18/18; vocab + doc-fences clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
6f1ba2c214
commit
d3301684f1
19 changed files with 2468 additions and 2614 deletions
|
|
@ -36,9 +36,9 @@ fn rt_font() -> str {
|
|||
fn rt_init() -> void {
|
||||
rt_fb = words(320 * 240)
|
||||
rt_regs = words(64)
|
||||
mem_set(rt_regs, 0, 64 * 4)
|
||||
fill(rt_regs, 0, 64 * 4)
|
||||
rt_map = bytes(96 * 64)
|
||||
mem_set(rt_map, 32, 96 * 64)
|
||||
fill(rt_map, 32, 96 * 64)
|
||||
rt_statusbuf = bytes(96)
|
||||
rt_statusbuf[0] = 0
|
||||
rt_image_init()
|
||||
|
|
@ -218,7 +218,7 @@ fn rt_poll() -> int {
|
|||
if is_windowed() {
|
||||
return win_poll()
|
||||
}
|
||||
let c = read_byte()
|
||||
let c = read_char()
|
||||
if c < 0 {
|
||||
rt_alive = 0
|
||||
return 0
|
||||
|
|
@ -297,8 +297,8 @@ fn rt_dump_ppm(path: str) -> void {
|
|||
}
|
||||
file_write(f, buf, px * 3)
|
||||
file_close(f)
|
||||
mem_free(buf)
|
||||
mem_free(hdr)
|
||||
free(buf)
|
||||
free(hdr)
|
||||
}
|
||||
|
||||
import "inflate.ludic"
|
||||
|
|
@ -317,7 +317,7 @@ var rt_maph: int = 0
|
|||
fn rt_map_size(w: int, h: int) -> void {
|
||||
rt_mapw = clamp(w, 0, 96)
|
||||
rt_maph = clamp(h, 0, 64)
|
||||
mem_set(rt_map, 32, 96 * 64)
|
||||
fill(rt_map, 32, 96 * 64)
|
||||
}
|
||||
|
||||
fn rt_map_row(y: int, s: str) -> void {
|
||||
|
|
@ -378,7 +378,7 @@ fn rt_save_state(f: ptr) -> void {
|
|||
file_write(f, rt_regs, 64 * 4)
|
||||
file_write(f, rt_map, 96 * 64)
|
||||
file_write(f, rt_statusbuf, 96)
|
||||
mem_free(w)
|
||||
free(w)
|
||||
}
|
||||
|
||||
fn rt_load_state(f: ptr) -> void {
|
||||
|
|
@ -390,5 +390,5 @@ fn rt_load_state(f: ptr) -> void {
|
|||
file_read(f, rt_regs, 64 * 4)
|
||||
file_read(f, rt_map, 96 * 64)
|
||||
file_read(f, rt_statusbuf, 96)
|
||||
mem_free(w)
|
||||
free(w)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue