From a18b99e1e0862de4b3c8fd55e0fd816fe2dca621 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 19 Nov 2026 21:02:38 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/ghostty-macos-notes.md | 4 ++-- docs/macos.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/ghostty-macos-notes.md b/docs/ghostty-macos-notes.md index 830d4b1f..3dc03265 100644 --- a/docs/ghostty-macos-notes.md +++ b/docs/ghostty-macos-notes.md @@ -56,10 +56,10 @@ comptime { The payoff is that adding a feature adds an enum case, not a struct field: hosts that do not implement it return `false` and the ABI never changed. Worth copying the day a fixed callback list starts growing. pardes has three callbacks today -— `wakeup`, `set_clipboard`, `read_clipboard` (`Runtime` in `runtime/macos.zig:153`) +— `wakeup`, `set_clipboard`, `read_clipboard` (`Callbacks` in `runtime/macos.zig:153`) — and does not need it yet. -Two userdata scopes, worth noting: the runtime struct's `userdata` is +Two userdata scopes, worth noting: the callbacks struct's `userdata` is app-scoped, and each surface carries its own. Swift round-trips both with `Unmanaged.passUnretained(self).toOpaque()` — libghostty never retains, so lifetime stays entirely on the Swift side. diff --git a/docs/macos.md b/docs/macos.md index 44b77d67..98cd5312 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -85,7 +85,7 @@ copies had in common is the argument for the shared file existing: none set the pty master, so a program in one pane could read and write another pane's terminal and closing a master did not reliably hang its shell up. -That is why the runtime struct is three callbacks rather than a second vtable — +That is why the callbacks struct is three callbacks rather than a second vtable — and why two of the three are the clipboard: the pasteboard is AppKit's, in both directions, and is the one piece of IO the Zig side cannot reach for itself. @@ -128,7 +128,7 @@ is made of and what opens a path from argv or the Dock (`Look `). it. `pardes_resize` also carries one cell in *physical* pixels, which only the native PDF placement path reads — pass the backing-store size, not points. -**Runtime callbacks.** `pardes_runtime_s` is a `userdata` and three functions, +**Callbacks.** `pardes_callbacks_s` is a `userdata` and three functions, copied by value during init so the struct need not outlive the call. `wakeup` means "your state moved, please pump me". `set_clipboard` hands over text to put on the pasteboard, borrowed for the duration of the call; it fires inside a tick -- cgit v1.3