lang migration: rename signed integer types sN -> iN

Mechanical sweep of all .sx sources, plan docs, and tests/expected
snapshots for the sx language rename (s8/s16/s32/s64 -> i8/i16/i32/i64).
Verified: tools/run_tests.sh 23/23.

Note: the ios-sim build has 2 pre-existing 'restart' dot-call errors
from the sx opt-in UFCS change (sx a47ea14) — independent of this
rename (present pre-sweep); migrated in the follow-up commit.
This commit is contained in:
swipelab
2026-06-12 09:36:51 +03:00
parent 1ab74c7d08
commit 6f7d2f4db2
36 changed files with 344 additions and 265 deletions

44
main.sx
View File

@@ -117,40 +117,40 @@ build_ui :: () -> View {
// be captured without injecting a tap. Absent → normal live behaviour.
read_env :: (name: [:0]u8) -> ?string {
p := getenv(name);
addr : s64 = xx p;
addr : i64 = xx p;
if addr == 0 { return null; }
n := cast(s64) strlen(p);
n := cast(i64) strlen(p);
if n == 0 { return ""; }
buf := cstring(n);
memcpy(buf.ptr, xx p, n);
buf
}
// Digit arithmetic runs entirely in s64; the result converts to f32 only once at
// Digit arithmetic runs entirely in i64; the result converts to f32 only once at
// the end. Doing the digit math in f32 would unify the ASCII literals (45/46/48/
// 57) to f32 across the comparisons, which mis-types the byte compares.
parse_f32 :: (s: string) -> f32 {
i : s64 = 0;
i : i64 = 0;
neg : bool = false;
if s.len > 0 {
c0 : s64 = xx s[0];
c0 : i64 = xx s[0];
if c0 == 45 { neg = true; i = 1; } // '-'
}
intval : s64 = 0;
intval : i64 = 0;
while i < s.len {
c : s64 = xx s[i];
c : i64 = xx s[i];
if c < 48 or c > 57 { break; }
intval = intval * 10 + (c - 48);
i += 1;
}
fracval : s64 = 0;
fracdiv : s64 = 1;
fracval : i64 = 0;
fracdiv : i64 = 1;
if i < s.len {
d : s64 = xx s[i];
d : i64 = xx s[i];
if d == 46 { // '.'
i += 1;
while i < s.len {
c : s64 = xx s[i];
c : i64 = xx s[i];
if c < 48 or c > 57 { break; }
fracval = fracval * 10 + (c - 48);
fracdiv = fracdiv * 10;
@@ -163,11 +163,11 @@ parse_f32 :: (s: string) -> f32 {
v
}
parse_s64 :: (s: string) -> s64 {
i : s64 = 0;
v : s64 = 0;
parse_i64 :: (s: string) -> i64 {
i : i64 = 0;
v : i64 = 0;
while i < s.len {
c : s64 = xx s[i];
c : i64 = xx s[i];
if c < 48 or c > 57 { break; }
v = v * 10 + (c - 48);
i += 1;
@@ -405,7 +405,7 @@ main :: () -> void {
g_motion.clock = parse_f32(t);
}
if sc := read_env("M3TE_SELECT") {
idx := parse_s64(sc);
idx := parse_i64(sc);
if idx >= 0 and idx < BOARD_CELLS {
g_sel.active = true;
g_sel.cell = Cell.{ col = idx % BOARD_COLS, row = idx / BOARD_COLS };
@@ -418,7 +418,7 @@ main :: () -> void {
// committed golden stay byte-identical. Purely a render overlay — no board /
// score / move / animation state changes and it never gates input.
if fp := read_env("M3TE_FPS") {
if parse_s64(fp) != 0 { g_fps_on = true; }
if parse_i64(fp) != 0 { g_fps_on = true; }
}
// Match-FX capture hook (P11.1). The bursts/popups spawn off a committed move,
@@ -433,7 +433,7 @@ main :: () -> void {
if fx := read_env("M3TE_FX") {
swaps := legal_swaps(g_board);
if swaps.len > 0 {
n := parse_s64(fx);
n := parse_i64(fx);
if n < 1 { n = 1; }
if n > swaps.len { n = swaps.len; }
sw := swaps.items[n - 1];
@@ -457,7 +457,7 @@ main :: () -> void {
if bs := read_env("M3TE_BADSWAP") {
bad := illegal_swaps(g_board);
if bad.len > 0 {
n := parse_s64(bs);
n := parse_i64(bs);
if n < 1 { n = 1; }
if n > bad.len { n = bad.len; }
sw := bad.items[n - 1];
@@ -473,10 +473,10 @@ main :: () -> void {
// M3TE_MOVE_LIMIT=0 makes it read LOST (budget spent below the goal). With
// M3TE_RESTART set non-zero the board is then restart()-ed, capturing the
// fresh in_progress board the restart button produces.
if tg := read_env("M3TE_TARGET") { g_board.target_score = parse_s64(tg); }
if ml := read_env("M3TE_MOVE_LIMIT") { g_board.move_limit = parse_s64(ml); }
if tg := read_env("M3TE_TARGET") { g_board.target_score = parse_i64(tg); }
if ml := read_env("M3TE_MOVE_LIMIT") { g_board.move_limit = parse_i64(ml); }
if rs := read_env("M3TE_RESTART") {
if parse_s64(rs) != 0 { g_board.restart(BOARD_SEED); }
if parse_i64(rs) != 0 { g_board.restart(BOARD_SEED); }
}
g_pipeline.set_body(closure(build_ui));