Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
30 lines
1.3 KiB
Plaintext
30 lines
1.3 KiB
Plaintext
// Windows x86_64 — print "42" and exit(0) through the Win32 system-call
|
|
// boundary. The Windows analog of the Linux raw-`syscall` write (see
|
|
// 1651): Windows has no stable raw syscall ABI (NtWriteFile's ordinal
|
|
// shifts between OS builds), so the documented boundary IS kernel32 —
|
|
// `GetStdHandle` + `WriteFile` to print, `ExitProcess` to terminate.
|
|
//
|
|
// Exercises the bundled-`zig` link backend end to end: built with
|
|
// `--target windows-gnu --self-contained`, zig cc (mingw) auto-resolves
|
|
// kernel32, producing a PE32+ that prints "42\n" and exits 0.
|
|
//
|
|
// Pinned `x86_64-windows-gnu` via `.build`: ir-only on this non-Windows
|
|
// host (the `.ir` snapshot locks the Win64-ABI lowering of the three
|
|
// extern calls); runs end-to-end on a Windows x86_64 runner.
|
|
|
|
kernel32 :: #library "kernel32";
|
|
|
|
// DWORD = u32, HANDLE/LPVOID = *void, BOOL = i32.
|
|
GetStdHandle :: (n_std_handle: u32) -> *void extern;
|
|
WriteFile :: (file: *void, buf: *u8, n: u32, written: *u32, overlapped: *void) -> i32 extern;
|
|
ExitProcess :: (code: u32) -> void extern;
|
|
|
|
main :: () {
|
|
// STD_OUTPUT_HANDLE = (DWORD)-11 = 0xFFFFFFF5.
|
|
out := GetStdHandle(0xFFFFFFF5);
|
|
msg : [3]u8 = .[52, 50, 10]; // "42\n"
|
|
written : u32 = 0;
|
|
WriteFile(out, @msg[0], 3, @written, null);
|
|
ExitProcess(0);
|
|
}
|