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.
15 lines
547 B
Plaintext
15 lines
547 B
Plaintext
// extern function binding (FFI-linkage stream, Phase 1): bind libc's `abs`
|
|
// directly via the bare `extern` linkage modifier — no `extern`, no
|
|
// `#library`. `extern` ⇒ external linkage + C ABI + no sx ctx; the symbol
|
|
// resolves against the default-linked libc at link time. The sx name `abs`
|
|
// IS the C symbol (no rename — the `extern LIB "csym"` forms land in 1.2).
|
|
#import "modules/std.sx";
|
|
|
|
abs :: (n: i32) -> i32 extern;
|
|
|
|
main :: () -> i32 {
|
|
print("abs(-7) = {}\n", abs(xx -7));
|
|
print("abs(42) = {}\n", abs(xx 42));
|
|
0
|
|
}
|