code wiki / _hdl_build / nx_g_puts_lib.nx

nx_g_puts_lib.nx source

↩ module page · 7 lines · 632 B

1// nx_g_puts_lib.nx -- single-responsibility shared helper: g_puts (gate stdout string writer). 2// Split from nx_gate_emit_lib so a consumer can delegate g_puts WITHOUT importing g_pn/g_check. 3// Rationale: NishiLang import OVERRIDES a same-name local def (PROVEN by nx_shadow_probe -> prints 4// the imported body, not the local) -- so a bundled import would clobber a RETAINED local variant of a 5// sibling helper. Single-helper libs make per-helper delegation safe-by-construction. license_tier: ORIGINAL 6import "nx_syscalls.nx" 7func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }