Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
// Error return-trace formatting (ERR step E3.3). `library/modules/std/trace.sx`
|
|
// reads the trace buffer (E3.1, populated by E3.2's raise/try push wiring) and
|
|
// renders it. `trace.print_current()` writes the trace to stderr; the catch
|
|
// handler sees the full chain because the absorption clear fires at handler
|
|
// EXIT, not entry. Frame locations are placeholders until DWARF (ERR E3.0)
|
|
// resolves PCs to file:line; the count + ordering are already meaningful.
|
|
//
|
|
// Note: the trace goes to stderr. The test runner merges stderr+stdout, so the
|
|
// snapshot shows the trace lines interleaved with the `print` (stdout) lines.
|
|
|
|
#import "modules/std.sx";
|
|
trace :: #import "modules/std/trace.sx";
|
|
|
|
// Buffer length probe (the runtime symbol; public read API is the trace module).
|
|
sx_trace_len :: () -> u32 #foreign;
|
|
|
|
E :: error { BadInput, Overflow }
|
|
|
|
leaf :: (n: i32) -> !E {
|
|
if n < 0 { raise error.BadInput; } // pushes frame 0
|
|
return;
|
|
}
|
|
|
|
mid :: (n: i32) -> !E {
|
|
try leaf(n); // propagation pushes frame 1
|
|
return;
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
mid(-1) catch (e) {
|
|
print("[stdout] caught {}\n", e); // tag name via the always-linked table
|
|
trace.print_current(); // [stderr] the 2-frame trace
|
|
};
|
|
print("[stdout] recovered; trace buffer now empty (len {})\n", sx_trace_len());
|
|
return 0;
|
|
}
|