summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 21:02:38 -0300
committerGabriel Schneider <[email protected]>2026-11-19 21:38:14 -0300
commita18b99e1e0862de4b3c8fd55e0fd816fe2dca621 (patch)
tree6a0cc6abf549df91af5adcbffb26c2bab2c094a5 /runtime
parent0d5c7d937c7d592ac7f3a9a8253993bffa283288 (diff)
downloadpardes-a18b99e1e0862de4b3c8fd55e0fd816fe2dca621.tar.gz
pardes-a18b99e1e0862de4b3c8fd55e0fd816fe2dca621.zip
abi, runtime, dev/macos, test, docs: what the macOS host lends the core is `Callbacks` in runtime/macos.zig and `pardes_callbacks_s` in abi/pardes.h and the Swift, no longer `Runtime` and `pardes_runtime_s` (P18, the user's ruling on the tree step's name collisions: the type's name collided with the directory `runtime/`; the C name follows so the three sides keep one name): the header's typedef, its use in `pardes_init`'s declaration and its section banner; the Zig type, its four uses (the State field's type, `pardes_init`, `initCore`) and the ABI guard's line; the Swift's two constructors (dev/macos/Sources/AppDelegate.swift 135, test/macos_e2e.swift 171) and that file's comment naming "the runtime struct"; docs/macos.md (two lines) and docs/ghostty-macos-notes.md (two lines) naming the struct; the field and parameter named `runtime` stay (not ruled); a rename only, nothing else on any line; the macOS library is not in the tape, so the semantics hash does not move; the Swift app cannot be built here: the header and the Zig agree by the ABI guard (`unit-test -Dplatform=macos -Dtest-filter="pardes.h matches the Zig boundary"` on Linux, 1/1, which reads the header through translate-c (build/macos.zig) and compares `@sizeOf(c.pardes_callbacks_s)` with `Callbacks`), the Swift by reading (the two constructors name the typedef the header declares, with its unchanged field labels); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds (`install -Dplatform=gui`), the macOS library for Linux and aarch64-macos and the FreeBSD cross-build rc 0, under a load of 34 to 57
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime')
-rw-r--r--runtime/macos.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/macos.zig b/runtime/macos.zig
index 408915da..a5869753 100644
--- a/runtime/macos.zig
+++ b/runtime/macos.zig
@@ -103,7 +103,7 @@ pub const Image = extern struct {
paper_bg: u32,
};
-pub const Runtime = extern struct {
+pub const Callbacks = extern struct {
userdata: ?*anyopaque = null,
wakeup: ?*const fn (?*anyopaque) callconv(.c) void = null,
set_clipboard: ?*const fn (?*anyopaque, [*]const u8, usize) callconv(.c) void = null,
@@ -250,7 +250,7 @@ const State = struct {
io: std.Io,
core: *pardes.Pardes,
started: bool = false,
- runtime: Runtime,
+ runtime: Callbacks,
tag_cells: [pardes.MAX_TAG_LAYERS][]Cell = @splat(&.{}),
layer_cells: [pardes.MAX_PANES][]Cell = @splat(&.{}),
cells: []Cell = &.{},
@@ -290,7 +290,7 @@ const State = struct {
var state: ?State = null;
-export fn pardes_init(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) c_int {
+export fn pardes_init(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) c_int {
if (state != null) return 1; // already up; deinit first
initCore(runtime, cols_arg, rows_arg) catch |err| {
log.err("init failed: {t}", .{err});
@@ -302,7 +302,7 @@ export fn pardes_init(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) c_
/// The shell's gpa in a Debug build, as std.start's is for the others.
var debug_gpa: std.heap.DebugAllocator(.{}) = .init;
-fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void {
+fn initCore(runtime: ?*const Callbacks, cols_arg: u16, rows_arg: u16) !void {
// The allocator every other shell gets from std.start: a DebugAllocator
// in Debug, libc's malloc otherwise. libc's measured at least as fast as
// std.heap.smp_allocator everywhere and faster on MuPDF's page-sized
@@ -2461,7 +2461,7 @@ test "pardes.h matches the Zig boundary" {
try expectEqual(@sizeOf(c.pardes_image_s), @sizeOf(Image));
inline for (@typeInfo(Image).@"struct".field_names) |name|
try expectEqual(@offsetOf(c.pardes_image_s, name), @offsetOf(Image, name));
- try expectEqual(@sizeOf(c.pardes_runtime_s), @sizeOf(Runtime));
+ try expectEqual(@sizeOf(c.pardes_callbacks_s), @sizeOf(Callbacks));
try expectEqual(@as(u32, c.PARDES_COLOR_DEFAULT), color_default);
try expectEqual(@as(u32, c.PARDES_COLOR_INDEXED), color_indexed);