std: restructure step 3 — ffi/ moves, build.sx, math dir spelling, fixtures

- objc.sx, objc_block.sx (from std/) + sdl3/opengl/raylib/stb/stb_truetype/
  wasm vendor bindings (from modules/ root) -> modules/ffi/
- std/uikit.sx deleted: platform/uikit.sx already declares UIApplicationMain
  and imports objc; '#framework "UIKit"' cannot live in a file imported on
  macOS targets (unconditional link directive, UIKit is iOS-only), so the
  three iOS-only examples carry the 3-line glue inline. 1607/1608/1616 also
  un-rotted (dead ns_string -> 'xx "..."' Into conversions, callconv(.c)
  msgSend fn-ptrs) — all three build for ios-sim/ios again.
- math/math.sx -> math/scalar.sx; one spelling '#import "modules/math"'
  everywhere (4 pinned IR snapshots regenerated: dir import adds Vec2/Mat4
  to the type tables).
- compiler.sx -> build.sx (imports, CLAUDE.md bundling table, specs.md).
- testpkg/ + test_c.sx -> tests/fixtures/ (resolve CWD-relative from repo
  root, same as vendors/).
- library-internal imports use full modules/... paths (std.sx tail,
  platform/bundle.sx, fixtures).
This commit is contained in:
agra
2026-06-11 08:37:22 +03:00
parent 59f0aa7716
commit 12bf61a9fc
142 changed files with 5026 additions and 4161 deletions

View File

@@ -2419,10 +2419,10 @@ This works for any function, not just `format`. The mechanism is general: the VM
### Build Configuration
The `BuildOptions` struct (from `modules/compiler.sx`) provides compile-time build configuration via `#run`. Methods on `BuildOptions` are compiler builtins intercepted during compilation — they have no runtime cost.
The `BuildOptions` struct (from `modules/build.sx`) provides compile-time build configuration via `#run`. Methods on `BuildOptions` are compiler builtins intercepted during compilation — they have no runtime cost.
```sx
#import "modules/compiler.sx";
#import "modules/build.sx";
configure_build :: () {
opts := build_options();
@@ -2450,7 +2450,7 @@ Build flags from `add_link_flag` are merged with any flags passed on the command
### Compiler Constants
The `modules/compiler.sx` module provides compile-time constants set by the compiler based on the target:
The `modules/build.sx` module provides compile-time constants set by the compiler based on the target:
| Constant | Type | Description |
|----------|------|-------------|
@@ -2489,8 +2489,8 @@ std :: #import "modules/std.sx";
**Directory import** — when the path refers to a directory, all `.sx` files in that directory are aggregated into a single module:
```sx
pkg :: #import "modules/testpkg"; // namespaced — all .sx files merged under pkg
#import "modules/testpkg"; // flat — all declarations spliced into scope
pkg :: #import "modules/math"; // namespaced — all .sx files merged under pkg
#import "modules/math"; // flat — all declarations spliced into scope
```
Directory imports scan only the top level of the specified directory (non-recursive). Files are processed in alphabetical order for deterministic builds. Files within the directory may `#import` each other or external files.
@@ -2595,7 +2595,7 @@ interpreter post-link.
Users opt in **explicitly** from their own `#run` block:
```sx
#import "modules/compiler.sx";
#import "modules/build.sx";
#import "modules/platform/bundle.sx";
#run {
@@ -2626,7 +2626,7 @@ The callback returns `false` to fail the build.
### BuildOptions surface
`BuildOptions` is a `#compiler` struct in
[library/modules/compiler.sx](library/modules/compiler.sx). Setters
[library/modules/build.sx](library/modules/build.sx). Setters
accumulate config in the compiler's `BuildConfig`; accessors read it
back inside the post-link callback.
@@ -2668,7 +2668,7 @@ through the host-FFI dispatch in
[src/ir/host_ffi.zig](src/ir/host_ffi.zig) (a `dlsym(RTLD_DEFAULT)` +
arity-switched cdecl trampoline).
[library/modules/fs.sx](library/modules/fs.sx) (POSIX backend):
[library/modules/std/fs.sx](library/modules/std/fs.sx) (POSIX backend):
| Function | Purpose |
|----------|---------|
@@ -2692,7 +2692,7 @@ call libc directly so they remain callable from the post-link IR
interpreter (which doesn't yet handle `*Self` method dispatch on
locally-unwrapped optionals).
[library/modules/process.sx](library/modules/process.sx) (POSIX backend):
[library/modules/std/process.sx](library/modules/std/process.sx) (POSIX backend):
| Function | Purpose |
|----------|---------|