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:
12
CLAUDE.md
12
CLAUDE.md
@@ -16,7 +16,7 @@ Procedure:
|
|||||||
- **Symptom** — one-line summary + observed vs expected.
|
- **Symptom** — one-line summary + observed vs expected.
|
||||||
- **Reproduction** — minimal sx code (inline fenced block). Must
|
- **Reproduction** — minimal sx code (inline fenced block). Must
|
||||||
reproduce the bug standalone, no project dependencies beyond
|
reproduce the bug standalone, no project dependencies beyond
|
||||||
`modules/std.sx` / `modules/allocators.sx`.
|
`modules/std.sx` / `modules/std/mem.sx`.
|
||||||
- **Investigation prompt** — a ready-to-paste prompt the user can
|
- **Investigation prompt** — a ready-to-paste prompt the user can
|
||||||
drop into a fresh session to fix the bug. Should include: the
|
drop into a fresh session to fix the bug. Should include: the
|
||||||
suspected area of the compiler (file + function), what the
|
suspected area of the compiler (file + function), what the
|
||||||
@@ -541,9 +541,9 @@ foreign calls.
|
|||||||
| File | Role |
|
| File | Role |
|
||||||
|------|------|
|
|------|------|
|
||||||
| [library/modules/platform/bundle.sx](library/modules/platform/bundle.sx) | All four targets (macOS, iOS sim, iOS device, Android). Branches on `BuildOptions.is_macos / is_ios / is_ios_device / is_ios_simulator / is_android` accessors. |
|
| [library/modules/platform/bundle.sx](library/modules/platform/bundle.sx) | All four targets (macOS, iOS sim, iOS device, Android). Branches on `BuildOptions.is_macos / is_ios / is_ios_device / is_ios_simulator / is_android` accessors. |
|
||||||
| [library/modules/fs.sx](library/modules/fs.sx) | POSIX file stdlib (open / read / write / copy / mkdir / unlink / chmod / rename / exists / basename / dirname). |
|
| [library/modules/std/fs.sx](library/modules/std/fs.sx) | POSIX file stdlib (open / read / write / copy / mkdir / unlink / chmod / rename / exists / basename / dirname). |
|
||||||
| [library/modules/process.sx](library/modules/process.sx) | popen-based `run(cmd) -> ?ProcessResult` + `env(name)` + `find_executable(name)`. |
|
| [library/modules/std/process.sx](library/modules/std/process.sx) | popen-based `run(cmd) -> ?ProcessResult` + `env(name)` + `find_executable(name)`. |
|
||||||
| [library/modules/compiler.sx](library/modules/compiler.sx) | `BuildOptions` setters + accessors. Adding a new bundling parameter = add a setter here + a hook in compiler_hooks.zig. |
|
| [library/modules/build.sx](library/modules/build.sx) | `BuildOptions` setters + accessors. Adding a new bundling parameter = add a setter here + a hook in compiler_hooks.zig. |
|
||||||
| [library/modules/platform/android.sx](library/modules/platform/android.sx) | `AndroidPlatform` (state-on-struct, no module globals). `sx_android_*` helpers take `plat: *AndroidPlatform` as first arg. `logical_w` field drives `dpi_scale = pixel_w / logical_w` so consumer's design-width fits any physical resolution. |
|
| [library/modules/platform/android.sx](library/modules/platform/android.sx) | `AndroidPlatform` (state-on-struct, no module globals). `sx_android_*` helpers take `plat: *AndroidPlatform` as first arg. `logical_w` field drives `dpi_scale = pixel_w / logical_w` so consumer's design-width fits any physical resolution. |
|
||||||
| [src/ir/compiler_hooks.zig](src/ir/compiler_hooks.zig) | `BuildConfig` + every `BuildOptions.*` hook. Hook registry is in `Registry.registerDefaults`. |
|
| [src/ir/compiler_hooks.zig](src/ir/compiler_hooks.zig) | `BuildConfig` + every `BuildOptions.*` hook. Hook registry is in `Registry.registerDefaults`. |
|
||||||
| [src/ir/host_ffi.zig](src/ir/host_ffi.zig) | `dlsym(RTLD_DEFAULT)` + arity-switched cdecl trampolines. Lets `#foreign("c")` decls resolve at `#run` / post-link time against host libc. |
|
| [src/ir/host_ffi.zig](src/ir/host_ffi.zig) | `dlsym(RTLD_DEFAULT)` + arity-switched cdecl trampolines. Lets `#foreign("c")` decls resolve at `#run` / post-link time against host libc. |
|
||||||
@@ -554,7 +554,7 @@ spec — what runs per Apple target vs Android, what each accessor
|
|||||||
returns, the BuildConfig forwarded from main.zig — lives there.
|
returns, the BuildConfig forwarded from main.zig — lives there.
|
||||||
|
|
||||||
Wiring a new bundling step:
|
Wiring a new bundling step:
|
||||||
1. Add the parameter as a setter on `BuildOptions :: struct #compiler { ... }` in [library/modules/compiler.sx](library/modules/compiler.sx).
|
1. Add the parameter as a setter on `BuildOptions :: struct #compiler { ... }` in [library/modules/build.sx](library/modules/build.sx).
|
||||||
2. Add the `BuildConfig` field + setter hook + accessor hook in [src/ir/compiler_hooks.zig](src/ir/compiler_hooks.zig). Register both in `Registry.registerDefaults`.
|
2. Add the `BuildConfig` field + setter hook + accessor hook in [src/ir/compiler_hooks.zig](src/ir/compiler_hooks.zig). Register both in `Registry.registerDefaults`.
|
||||||
3. Optionally forward a CLI flag in [src/main.zig](src/main.zig) before the post-link invocation.
|
3. Optionally forward a CLI flag in [src/main.zig](src/main.zig) before the post-link invocation.
|
||||||
4. Read the accessor from [library/modules/platform/bundle.sx](library/modules/platform/bundle.sx).
|
4. Read the accessor from [library/modules/platform/bundle.sx](library/modules/platform/bundle.sx).
|
||||||
@@ -576,4 +576,4 @@ Wiring a new bundling step:
|
|||||||
| `readme.md` | User-facing language overview — **maintained**. Update it whenever a user-facing sx change lands (new/changed syntax, semantics, gating diagnostics, language behavior), per the docs-track-changes rule. |
|
| `readme.md` | User-facing language overview — **maintained**. Update it whenever a user-facing sx change lands (new/changed syntax, semantics, gating diagnostics, language behavior), per the docs-track-changes rule. |
|
||||||
| `CLAUDE.md` | This file. Session instructions. |
|
| `CLAUDE.md` | This file. Session instructions. |
|
||||||
| `library/modules/platform/bundle.sx` | sx-side `.app` / `.apk` bundler. See "Bundling lives in sx" above. |
|
| `library/modules/platform/bundle.sx` | sx-side `.app` / `.apk` bundler. See "Bundling lives in sx" above. |
|
||||||
| `library/modules/fs.sx`, `library/modules/process.sx` | POSIX stdlib for the bundler + general consumer use. |
|
| `library/modules/std/fs.sx`, `library/modules/std/process.sx` | POSIX stdlib for the bundler + general consumer use. |
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// block (only one terminator per block).
|
// block (only one terminator per block).
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
do_it :: () -> bool {
|
do_it :: () -> bool {
|
||||||
inline if OS != .ios { return false; }
|
inline if OS != .ios { return false; }
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Color :: enum { red; green; blue; }
|
Color :: enum { red; green; blue; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
add :: (a: s32, b: s32) -> s32 { a + b }
|
add :: (a: s32, b: s32) -> s32 { a + b }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
add :: (a: s32, b: s32) -> s32 { a + b }
|
add :: (a: s32, b: s32) -> s32 { a + b }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
add :: (a: s32, b: s32) -> s32 { a + b }
|
add :: (a: s32, b: s32) -> s32 { a + b }
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// step-5.2 impl.
|
// step-5.2 impl.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
preview_void :: (..$args) -> string {
|
preview_void :: (..$args) -> string {
|
||||||
return build_block_convert($args, void);
|
return build_block_convert($args, void);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
// and matches the caller's two-register pass on AArch64.
|
// and matches the caller's two-register pass on AArch64.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
g_s: string = "";
|
g_s: string = "";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Perms :: enum flags { read; write; execute; }
|
Perms :: enum flags { read; write; execute; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/mem.sx"; // `Allocator` is non-transitive: name it, import it.
|
#import "modules/std/mem.sx"; // `Allocator` is non-transitive: name it, import it.
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Struct constants test
|
// Struct constants test
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
// This test exercises a closure shape (`Closure(s64, s64) -> void`)
|
// This test exercises a closure shape (`Closure(s64, s64) -> void`)
|
||||||
// that has NO hand-rolled `Into(Block)` impl in
|
// that has NO hand-rolled `Into(Block)` impl in
|
||||||
// `library/modules/std/objc_block.sx`. Before step 5.2 lands,
|
// `library/modules/ffi/objc_block.sx`. Before step 5.2 lands,
|
||||||
// `xx cl : Block` errors out with the "no Into(Block) for
|
// `xx cl : Block` errors out with the "no Into(Block) for
|
||||||
// cl_s64_s64__void" focused diagnostic. After the generic impl
|
// cl_s64_s64__void" focused diagnostic. After the generic impl
|
||||||
// lands, the same call resolves through the pack-shaped impl and
|
// lands, the same call resolves through the pack-shaped impl and
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// to its registered invoke.
|
// to its registered invoke.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
g_a: s64 = 0;
|
g_a: s64 = 0;
|
||||||
g_b: s64 = 0;
|
g_b: s64 = 0;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
Point :: struct { x, y: s32; }
|
Point :: struct { x, y: s32; }
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
// only candidate.
|
// only candidate.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
impl Into(Block) for Closure(..$args) -> $R {
|
impl Into(Block) for Closure(..$args) -> $R {
|
||||||
convert :: (self: Closure(..$args) -> $R) -> Block {
|
convert :: (self: Closure(..$args) -> $R) -> Block {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
// runs `walk(42, "hi")` at `#run` time and prints the result.
|
// runs `walk(42, "hi")` at `#run` time and prints the result.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
walk :: (..$args) -> string {
|
walk :: (..$args) -> string {
|
||||||
list := $args;
|
list := $args;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
// builder-driven generic Into(Block) impl rests on.
|
// builder-driven generic Into(Block) impl rests on.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
// Generic "describe pack" builder. Receives the pack as
|
// Generic "describe pack" builder. Receives the pack as
|
||||||
// []Type, returns a joined string with each type's name.
|
// []Type, returns a joined string with each type's name.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// as undef so the comparison runs through unchanged.
|
// as undef so the comparison runs through unchanged.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
libc :: #library "c";
|
libc :: #library "c";
|
||||||
popen :: (cmd: [:0]u8, mode: [:0]u8) -> *void #foreign libc;
|
popen :: (cmd: [:0]u8, mode: [:0]u8) -> *void #foreign libc;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// the first two — and not just via JIT.
|
// the first two — and not just via JIT.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
puts :: (s: [:0]u8) -> s32 #foreign libc;
|
puts :: (s: [:0]u8) -> s32 #foreign libc;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
add :: (a: s32, b: s32) -> s32 { a + b }
|
add :: (a: s32, b: s32) -> s32 { a + b }
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
tc :: #import "modules/test_c.sx";
|
tc :: #import "tests/fixtures/test_c.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
a := tc.add_numbers(10, 20);
|
a := tc.add_numbers(10, 20);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
// Fail-before (pre-E6BR-4): the wrapped/pack source fell to the no-author
|
// Fail-before (pre-E6BR-4): the wrapped/pack source fell to the no-author
|
||||||
// `type_bridge.resolveTemplateSignatureType` wrapper (global last-wins, no
|
// `type_bridge.resolveTemplateSignatureType` wrapper (global last-wins, no
|
||||||
// diagnostic), so the `*Box` collision registered silently. Protects the pure-pack
|
// diagnostic), so the `*Box` collision registered silently. Protects the pure-pack
|
||||||
// `Closure(..$args) -> $R` bridge in `library/modules/std/objc_block.sx` (0504 /
|
// `Closure(..$args) -> $R` bridge in `library/modules/ffi/objc_block.sx` (0504 /
|
||||||
// 1302 / 1304 stay byte-identical), whose single author keeps the prefix-free path.
|
// 1302 / 1304 stay byte-identical), whose single author keeps the prefix-free path.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// Regression (issue 0076, attempt-5 span precision). Expected: one error per
|
// Regression (issue 0076, attempt-5 span precision). Expected: one error per
|
||||||
// offending parameter, each caret on the parameter name; exit 1.
|
// offending parameter, each caret on the parameter name; exit 1.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
Greeter :: protocol {
|
Greeter :: protocol {
|
||||||
greet :: (self: *Self, u8: s64) -> s64 {
|
greet :: (self: *Self, u8: s64) -> s64 {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
// capture through an FFI intrinsic call's arg list.
|
// capture through an FFI intrinsic call's arg list.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
passthrough_works :: (recv: *void) -> Closure(s32) -> *void {
|
passthrough_works :: (recv: *void) -> Closure(s32) -> *void {
|
||||||
closure((d: s32) -> *void => recv) // captures `recv` — fine
|
closure((d: s32) -> *void => recv) // captures `recv` — fine
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// 4. comptime-gated branch (inline if OS == ...)
|
// 4. comptime-gated branch (inline if OS == ...)
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
#import c {
|
#import c {
|
||||||
#include "1216-ffi-08-foreign-in-method.h";
|
#include "1216-ffi-08-foreign-in-method.h";
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/math/math.sx";
|
#import "modules/math";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/test.sx";
|
#import "modules/std/test.sx";
|
||||||
pkg :: #import "modules/testpkg";
|
pkg :: #import "tests/fixtures/testpkg";
|
||||||
|
|
||||||
// --- Foreign function binding ---
|
// --- Foreign function binding ---
|
||||||
libc :: #library "c";
|
libc :: #library "c";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// right registers.
|
// right registers.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
ns_class := objc_getClass("NSString".ptr);
|
ns_class := objc_getClass("NSString".ptr);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// If the IMP ran, the global `g_marker` is non-zero and we return it as exit.
|
// If the IMP ran, the global `g_marker` is non-zero and we return it as exit.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
g_marker : s32 = 0;
|
g_marker : s32 = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// pointer instead of going through the Obj-C runtime.
|
// pointer instead of going through the Obj-C runtime.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
cl := () => { print("noop block ran\n"); };
|
cl := () => { print("noop block ran\n"); };
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// before delegating.
|
// before delegating.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
x : s64 = 42;
|
x : s64 = 42;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// `xx closure : Block` for an arbitrary closure signature.
|
// `xx closure : Block` for an arbitrary closure signature.
|
||||||
//
|
//
|
||||||
// The stdlib (modules/std/objc_block.sx) declares hand-rolled
|
// The stdlib (modules/ffi/objc_block.sx) declares hand-rolled
|
||||||
// `Into(Block) for Closure() -> void` and `Closure(bool) -> void`
|
// `Into(Block) for Closure() -> void` and `Closure(bool) -> void`
|
||||||
// impls — the two most common Apple block shapes. Other signatures
|
// impls — the two most common Apple block shapes. Other signatures
|
||||||
// need a per-shape `__block_invoke_<sig>` trampoline + `Into(Block)`
|
// need a per-shape `__block_invoke_<sig>` trampoline + `Into(Block)`
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
// This test exercises the user-declared variant: signature
|
// This test exercises the user-declared variant: signature
|
||||||
// `Closure(s32, *void) -> void` (a two-arg block — not in stdlib).
|
// `Closure(s32, *void) -> void` (a two-arg block — not in stdlib).
|
||||||
// If the impl is missing, the compiler emits a focused diagnostic
|
// If the impl is missing, the compiler emits a focused diagnostic
|
||||||
// pointing at modules/std/objc_block.sx as the template.
|
// pointing at modules/ffi/objc_block.sx as the template.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
// Trampoline matching `void (^)(int, void*)` — the C ABI Apple's
|
// Trampoline matching `void (^)(int, void*)` — the C ABI Apple's
|
||||||
// runtime calls. Forwards through to the sx closure with the
|
// runtime calls. Forwards through to the sx closure with the
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
// Matches the ergonomics of ObjC's `^{...}` literal at the call site.
|
// Matches the ergonomics of ObjC's `^{...}` literal at the call site.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc_block.sx";
|
#import "modules/ffi/objc_block.sx";
|
||||||
|
|
||||||
invoke_once :: (b: *Block) {
|
invoke_once :: (b: *Block) {
|
||||||
invoke_fn : (*Block) -> void callconv(.c) = xx b.invoke;
|
invoke_fn : (*Block) -> void callconv(.c) = xx b.invoke;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
// next `.method(...)` finds the foreign-class declaration.
|
// next `.method(...)` finds the foreign-class declaration.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #foreign #objc_class("NSObject") {
|
||||||
alloc :: () -> *NSObject;
|
alloc :: () -> *NSObject;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// M1.1 — Obj-C primitive type aliases.
|
// M1.1 — Obj-C primitive type aliases.
|
||||||
//
|
//
|
||||||
// `id`, `Class`, `SEL`, `BOOL` from `modules/std/objc.sx` stand in
|
// `id`, `Class`, `SEL`, `BOOL` from `modules/ffi/objc.sx` stand in
|
||||||
// for the three opaque Obj-C runtime types and Apple's signed-char
|
// for the three opaque Obj-C runtime types and Apple's signed-char
|
||||||
// boolean. They resolve to `*void` / `s8` at the LLVM layer — no
|
// boolean. They resolve to `*void` / `s8` at the LLVM layer — no
|
||||||
// runtime cost — but make foreign-class and call-site declarations
|
// runtime cost — but make foreign-class and call-site declarations
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
// referent's class hierarchy.
|
// referent's class hierarchy.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
// Foreign-class declaration using the aliases at param/return positions.
|
// Foreign-class declaration using the aliases at param/return positions.
|
||||||
NSObjectAlias :: #foreign #objc_class("NSObject") {
|
NSObjectAlias :: #foreign #objc_class("NSObject") {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
// (M1.2 A.7) stays gated until then.
|
// (M1.2 A.7) stays gated until then.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxFoo :: #objc_class("SxFoo") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: s32;
|
counter: s32;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
// class EXIST in the runtime.
|
// class EXIST in the runtime.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxFoo :: #objc_class("SxFoo") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: s32;
|
counter: s32;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
// overrides (A.5 / A.6) come next.
|
// overrides (A.5 / A.6) come next.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
// returns a non-null IMP — proves the trampoline is wired.
|
// returns a non-null IMP — proves the trampoline is wired.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
|
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
// the full lifecycle.
|
// the full lifecycle.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
// f.bump();`) await A.7's dispatch-gate opening.
|
// f.bump();`) await A.7's dispatch-gate opening.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
class_getInstanceVariable :: (cls: *void, name: [*]u8) -> *void #foreign objc;
|
||||||
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
|
class_getMethodImplementation :: (cls: *void, sel: *void) -> *void #foreign objc;
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
// Class.
|
// Class.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
NSObjectFwd :: #foreign #objc_class("NSObject") {
|
NSObjectFwd :: #foreign #objc_class("NSObject") {
|
||||||
alloc :: () -> *NSObjectFwd;
|
alloc :: () -> *NSObjectFwd;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
// sx body's result.
|
// sx body's result.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getClassMethod :: (cls: *void, sel: *void) -> *void #foreign objc;
|
class_getClassMethod :: (cls: *void, sel: *void) -> *void #foreign objc;
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
// (canonical example: '+layerClass' on UIView subclasses).
|
// (canonical example: '+layerClass' on UIView subclasses).
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #foreign #objc_class("NSObject") {
|
||||||
alloc :: () -> *NSObject;
|
alloc :: () -> *NSObject;
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
// the state struct) live later in M2.2.
|
// the state struct) live later in M2.2.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
// Build a probe class on the fly: registers two IMPs (`tag` and
|
// Build a probe class on the fly: registers two IMPs (`tag` and
|
||||||
// `setTag:`) that read/write an instance-bound s32 stored in a
|
// `setTag:`) that read/write an instance-bound s32 stored in a
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
// `readonly` skips setter registration.
|
// `readonly` skips setter registration.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
class_getInstanceMethod :: (cls: *void, sel: *void) -> *void #foreign objc;
|
class_getInstanceMethod :: (cls: *void, sel: *void) -> *void #foreign objc;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
// resolution (selector mangling, return type, arity check).
|
// resolution (selector mangling, return type, arity check).
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
NSObjectBase :: #foreign #objc_class("NSObject") {
|
NSObjectBase :: #foreign #objc_class("NSObject") {
|
||||||
alloc :: () -> *NSObjectBase;
|
alloc :: () -> *NSObjectBase;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
// pointer would appear as e.g. 0xC0 / 0x20 instead of its real
|
// pointer would appear as e.g. 0xC0 / 0x20 instead of its real
|
||||||
// 64-bit value.
|
// 64-bit value.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
g_observer : *void = null;
|
g_observer : *void = null;
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/mem.sx";
|
#import "modules/std/mem.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxAllocProbe :: #objc_class("SxAllocProbe") {
|
SxAllocProbe :: #objc_class("SxAllocProbe") {
|
||||||
#extends NSObject;
|
#extends NSObject;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/mem.sx";
|
#import "modules/std/mem.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxMultiProbe :: #objc_class("SxMultiProbe") {
|
SxMultiProbe :: #objc_class("SxMultiProbe") {
|
||||||
#extends NSObject;
|
#extends NSObject;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
// macOS-only — libobjc + NSObject must be available at runtime.
|
// macOS-only — libobjc + NSObject must be available at runtime.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
inline if OS == .macos {
|
inline if OS == .macos {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/mem.sx";
|
#import "modules/std/mem.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxStrongChild :: #objc_class("SxStrongChild") {
|
SxStrongChild :: #objc_class("SxStrongChild") {
|
||||||
#extends NSObject;
|
#extends NSObject;
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/mem.sx";
|
#import "modules/std/mem.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxWeakTarget :: #objc_class("SxWeakTarget") {
|
SxWeakTarget :: #objc_class("SxWeakTarget") {
|
||||||
#extends NSObject;
|
#extends NSObject;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// per call site (no selector interning until step 1.5).
|
// per call site (no selector interning until step 1.5).
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
inline if OS == .macos {
|
inline if OS == .macos {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
// the call sites.
|
// the call sites.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
inline if OS == .macos {
|
inline if OS == .macos {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// "the runtime no-oped the call."
|
// "the runtime no-oped the call."
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
inline if OS == .macos {
|
inline if OS == .macos {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
// ABI without constructing a real object graph.
|
// ABI without constructing a real object graph.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
// 16 B HFA (Apple ARM64 — 2×f64 stays in v0/v1, SysV AMD64 — in xmm0/xmm1).
|
// 16 B HFA (Apple ARM64 — 2×f64 stays in v0/v1, SysV AMD64 — in xmm0/xmm1).
|
||||||
NSPoint :: struct { x: f64; y: f64; }
|
NSPoint :: struct { x: f64; y: f64; }
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
// round-trip to return the right bytes.
|
// round-trip to return the right bytes.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
Triple :: struct { a: s64; b: s64; c: s64; }
|
Triple :: struct { a: s64; b: s64; c: s64; }
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// field comes through the float-register file intact.
|
// field comes through the float-register file intact.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
UIEdgeInsets :: struct {
|
UIEdgeInsets :: struct {
|
||||||
top: f64;
|
top: f64;
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// + a real IMP that consumes both keyword args.
|
// + a real IMP that consumes both keyword args.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
combine_imp :: (self: *void, _cmd: *void, a: s32, b: s32) -> s32 callconv(.c) {
|
combine_imp :: (self: *void, _cmd: *void, a: s32, b: s32) -> s32 callconv(.c) {
|
||||||
a * 100 + b
|
a * 100 + b
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
// targets — verified by `tests/cross_compile.sh`.
|
// targets — verified by `tests/cross_compile.sh`.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
// ── 1. Struct method calling #objc_call ─────────────────────────────
|
// ── 1. Struct method calling #objc_call ─────────────────────────────
|
||||||
Probe :: struct {
|
Probe :: struct {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// sites the same way it does elsewhere.
|
// sites the same way it does elsewhere.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
// Empty stub class — Android cross-compile requires a `#jni_main`
|
// Empty stub class — Android cross-compile requires a `#jni_main`
|
||||||
// declaration to satisfy the entry-point check. This file is testing
|
// declaration to satisfy the entry-point check. This file is testing
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// results are checked.
|
// results are checked.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
yes_imp :: (self: *void, _cmd: *void) -> bool callconv(.c) { true }
|
yes_imp :: (self: *void, _cmd: *void) -> bool callconv(.c) { true }
|
||||||
no_imp :: (self: *void, _cmd: *void) -> bool callconv(.c) { false }
|
no_imp :: (self: *void, _cmd: *void) -> bool callconv(.c) { false }
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// path, so this test gives the two shapes their own runtime lockdown.
|
// path, so this test gives the two shapes their own runtime lockdown.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
CGRect :: struct {
|
CGRect :: struct {
|
||||||
x: f64;
|
x: f64;
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
// and chains to [super dealloc].
|
// and chains to [super dealloc].
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxFoo :: #objc_class("SxFoo") {
|
SxFoo :: #objc_class("SxFoo") {
|
||||||
counter: s32;
|
counter: s32;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
// going through cleanly.
|
// going through cleanly.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
Point :: struct {
|
Point :: struct {
|
||||||
x: f64;
|
x: f64;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
// 'objc_class' runtime not yet supported (Phase 3/4)". Snapshot captures
|
// 'objc_class' runtime not yet supported (Phase 3/4)". Snapshot captures
|
||||||
// that diagnostic.
|
// that diagnostic.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxProbeNiladic :: #foreign #objc_class("SxProbeNiladic") {
|
SxProbeNiladic :: #foreign #objc_class("SxProbeNiladic") {
|
||||||
length :: (self: *Self) -> s32;
|
length :: (self: *Self) -> s32;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
//
|
//
|
||||||
// Pre-3.0: bails at lower.zig with the Phase 3/4 diagnostic.
|
// Pre-3.0: bails at lower.zig with the Phase 3/4 diagnostic.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxProbeOneArg :: #foreign #objc_class("SxProbeOneArg") {
|
SxProbeOneArg :: #foreign #objc_class("SxProbeOneArg") {
|
||||||
addObject :: (self: *Self, val: s32) -> s32;
|
addObject :: (self: *Self, val: s32) -> s32;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
//
|
//
|
||||||
// Pre-3.0: bails at lower.zig with the Phase 3/4 diagnostic.
|
// Pre-3.0: bails at lower.zig with the Phase 3/4 diagnostic.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxProbeMultiKeyword :: #foreign #objc_class("SxProbeMultiKeyword") {
|
SxProbeMultiKeyword :: #foreign #objc_class("SxProbeMultiKeyword") {
|
||||||
combine_and :: (self: *Self, a: s32, b: s32) -> s32;
|
combine_and :: (self: *Self, a: s32, b: s32) -> s32;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// (which subsumes this case). Once 3.0 lands, the diagnostic becomes a
|
// (which subsumes this case). Once 3.0 lands, the diagnostic becomes a
|
||||||
// specific "keyword count mismatch" message.
|
// specific "keyword count mismatch" message.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
SxProbeMismatch :: #foreign #objc_class("SxProbeMismatch") {
|
SxProbeMismatch :: #foreign #objc_class("SxProbeMismatch") {
|
||||||
something_extra :: (self: *Self, x: s32) -> s32;
|
something_extra :: (self: *Self, x: s32) -> s32;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
// exist yet when `objc_getClass` runs. NSObject is always available
|
// exist yet when `objc_getClass` runs. NSObject is always available
|
||||||
// on macOS via libobjc.
|
// on macOS via libobjc.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #foreign #objc_class("NSObject") {
|
||||||
// `+(Class)class` — niladic, name verbatim, selector = "class".
|
// `+(Class)class` — niladic, name verbatim, selector = "class".
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// captures the parser error (exit=1). Next commit wires lexer + parser
|
// captures the parser error (exit=1). Next commit wires lexer + parser
|
||||||
// + AST + lowering and the snapshot flips to working output.
|
// + AST + lowering and the snapshot flips to working output.
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
NSObject :: #foreign #objc_class("NSObject") {
|
NSObject :: #foreign #objc_class("NSObject") {
|
||||||
// Default mangling would yield selector "gimme" — NSObject has no
|
// Default mangling would yield selector "gimme" — NSObject has no
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
// string is used as the selector. Arity is the user's contract.
|
// string is used as the selector. Arity is the user's contract.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
SxManglingProbe :: #foreign #objc_class("SxManglingProbe") {
|
SxManglingProbe :: #foreign #objc_class("SxManglingProbe") {
|
||||||
length :: (self: *Self) -> s32;
|
length :: (self: *Self) -> s32;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
// libjvm in the Android sysroot.
|
// libjvm in the Android sysroot.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
// Android target requires a `#jni_main` Activity declaration to
|
// Android target requires a `#jni_main` Activity declaration to
|
||||||
// satisfy the entry-point check. An empty stub class is enough — this
|
// satisfy the entry-point check. An empty stub class is enough — this
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// unzip -l /tmp/sxjnimain.apk | grep classes.dex
|
// unzip -l /tmp/sxjnimain.apk | grep classes.dex
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
// `*Bundle` resolves through the class registry to `android.os.Bundle`
|
// `*Bundle` resolves through the class registry to `android.os.Bundle`
|
||||||
// in the emitted Java — needed for `onCreate`'s @Override to match
|
// in the emitted Java — needed for `onCreate`'s @Override to match
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// + on-device launch, which is the chess deploy.
|
// + on-device launch, which is the chess deploy.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
Bundle :: #foreign #jni_class("android/os/Bundle") { }
|
Bundle :: #foreign #jni_class("android/os/Bundle") { }
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// `onCreate` body — chess's render surface starts the same way.
|
// `onCreate` body — chess's render surface starts the same way.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
Bundle :: #foreign #jni_class("android/os/Bundle") { }
|
Bundle :: #foreign #jni_class("android/os/Bundle") { }
|
||||||
JContext :: #foreign #jni_class("android/content/Context") { }
|
JContext :: #foreign #jni_class("android/content/Context") { }
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#import "modules/raylib.sx";
|
#import "modules/ffi/raylib.sx";
|
||||||
|
|
||||||
main :: () {
|
main :: () {
|
||||||
InitWindow(800, 600, "sx - Triangle");
|
InitWindow(800, 600, "sx - Triangle");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/sdl3.sx";
|
#import "modules/ffi/sdl3.sx";
|
||||||
#import "modules/opengl.sx";
|
#import "modules/ffi/opengl.sx";
|
||||||
#import "modules/math";
|
#import "modules/math";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
stb :: #import "modules/stb.sx";
|
stb :: #import "modules/ffi/stb.sx";
|
||||||
|
|
||||||
main :: () -> s32 {
|
main :: () -> s32 {
|
||||||
w: s32 = 0;
|
w: s32 = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
|
|
||||||
// --- #run build configuration ---
|
// --- #run build configuration ---
|
||||||
// build_options() returns a BuildOptions struct at compile time.
|
// build_options() returns a BuildOptions struct at compile time.
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
// tests/expected/63-metal-clear.txt). The test runner skips it on macOS.
|
// tests/expected/63-metal-clear.txt). The test runner skips it on macOS.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/objc.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
#import "modules/compiler.sx";
|
#import "modules/build.sx";
|
||||||
#import "modules/platform/api.sx";
|
#import "modules/platform/api.sx";
|
||||||
#import "modules/platform/uikit.sx";
|
#import "modules/platform/uikit.sx";
|
||||||
#import "modules/gpu/api.sx";
|
#import "modules/gpu/api.sx";
|
||||||
|
|||||||
@@ -12,13 +12,17 @@
|
|||||||
// drives the iOS run loop.
|
// drives the iOS run loop.
|
||||||
|
|
||||||
#import "modules/std.sx";
|
#import "modules/std.sx";
|
||||||
#import "modules/std/uikit.sx";
|
#import "modules/ffi/objc.sx";
|
||||||
|
|
||||||
|
#framework "UIKit";
|
||||||
|
|
||||||
|
UIApplicationMain :: (argc: s32, argv: *void, principal_class: *NSString, delegate_class: *NSString) -> s32 #foreign;
|
||||||
|
|
||||||
// IMP for application:didFinishLaunchingWithOptions:
|
// IMP for application:didFinishLaunchingWithOptions:
|
||||||
// Obj-C: -(BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts
|
// Obj-C: -(BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)opts
|
||||||
// Type encoding: "c@:@@" -- BOOL (signed char), self, _cmd, id, id
|
// Type encoding: "c@:@@" -- BOOL (signed char), self, _cmd, id, id
|
||||||
did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u8 callconv(.c) {
|
did_finish_launching :: (self: *void, _cmd: *void, app: *void, opts: *void) -> u8 callconv(.c) {
|
||||||
NSLog(ns_string("[sx] application:didFinishLaunchingWithOptions: called\n".ptr));
|
NSLog(xx "[sx] application:didFinishLaunchingWithOptions: called\n");
|
||||||
return 1; // YES
|
return 1; // YES
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,5 +41,5 @@ main :: () -> s32 {
|
|||||||
objc_registerClassPair(SxAppDelegate);
|
objc_registerClassPair(SxAppDelegate);
|
||||||
|
|
||||||
// Hand off to the iOS run loop. Never returns under normal operation.
|
// Hand off to the iOS run loop. Never returns under normal operation.
|
||||||
return UIApplicationMain(0, xx 0, xx 0, ns_string("SxAppDelegate".ptr));
|
return UIApplicationMain(0, xx 0, xx 0, xx "SxAppDelegate");
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user