From 99f5b10eccd95aa0066ea6fe6bb75f367ab56a47 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 18 Nov 2026 22:03:14 -0300 Subject: core: src/ becomes core/, pardes.zig its root.zig (the reorganisation's tree, step 2d), and every mention of a src/ path follows: the build's paths, the core's imports of its root, the tests that read the repository's files by path (lspbench's, look.zig's spans over core/look.zig), the comments that cite files, the documents and the manual (the typst corpus reads core/tutor.txt and core/plumbing); left as they were: the /src tree's served names (src/pardes.zig and the rest are the 9P tree's, not the repository's), the CHANGELOG's history, fixtures that are only strings; fs-unit-test runs from the core's root (a module of the core rooted at fs.zig had the runtime's and the devices' `core` be fs.zig); nothing else changes: the ledger (pardes.test.* now root.test.*), frames byte-identical, replicas and process-test the base's Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- docs/macos.md | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'docs/macos.md') diff --git a/docs/macos.md b/docs/macos.md index 17294520..44b77d67 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -2,7 +2,7 @@ Zig owns the core, the ptys, every effect and the worker threads. Swift owns `NSApplication`, the window, input translation, and drawing. They meet at a -hand-written C ABI, `src/macos/pardes.h`, built as a static library that the app +hand-written C ABI, `abi/pardes.h`, built as a static library that the app links; the Swift half is ordinary AppKit that pumps events in and reads one packed cell buffer out. There is exactly one core per process, so the ABI has no handles — the state is a file-scoped singleton and every function names it @@ -32,8 +32,8 @@ Pardes goes the other way because its frame is *already* a cell grid. draw one: attributed runs, the system font stack, and Apple's own subpixel and color-emoji handling, for free. The alternative is a hand-rolled glyph atlas, and the SDL backend is the measurement of what that costs — a large part of -`src/gui/gui.zig`'s 6,348 lines is a 2048² FreeType-hinted R8 atlas (`atlas_w` -and `atlas_h`, `src/gui/gui.zig:140`), GPU pipelines, transfer buffers and +`dev/gui/gui.zig`'s 6,348 lines is a 2048² FreeType-hinted R8 atlas (`atlas_w` +and `atlas_h`, `dev/gui/gui.zig:140`), GPU pipelines, transfer buffers and shaders. Writing a second one, blind, buys nothing the grid needs. Blind is the operative word: this backend was scaffolded on a Linux machine. A @@ -68,18 +68,18 @@ the glyph. IO stays on the Zig side: macOS has `forkpty`, `read` and `write` right there, so almost no effect crosses the boundary at all: `pardes_tick` runs -`while (core.nextEffect()) |e| core.perform(e)` (`src/macos.zig:1154`) and each +`while (core.nextEffect()) |e| core.perform(e)` (`runtime/macos.zig:1154`) and each effect lands on this host's own `Host.VTable`, of whose twenty-one methods -fourteen are filled in (`src/macos.zig:1761`). +fourteen are filled in (`runtime/macos.zig:1761`). The machine-local half of those methods is no longer this file's. `forkShell`, -`writeFileBytes` and `writeFd` live in `src/host_io.zig` and are shared with -the tui shell and the SDL shell; `src/macos.zig` calls +`writeFileBytes` and `writeFd` live in `dev/host_io.zig` and are shared with +the tui shell and the SDL shell; `runtime/macos.zig` calls them (`:1807`, `:1823`, `:1848`, `:1863`) and its own copies, together with the four `extern "c"` declarations they needed (`forkpty`, `execv`, `chdir`, `_exit`), are gone. Two `extern "c"` declarations remain here: `setenv`, and `pardes_host_watch_file`, which FileWatcher.swift satisfies -(`src/macos.zig:40`, `:45`). The bug all four hosts' private `forkShell` +(`runtime/macos.zig:40`, `:45`). The bug all four hosts' private `forkShell` copies had in common is the argument for the shared file existing: none set `FD_CLOEXEC` on the pty master, so a program in one pane could read and write another pane's @@ -117,7 +117,7 @@ full mask is passed anyway to keep the signature whole. `pardes_scroll` carries fractional row and column deltas from a trackpad; the Zig side accumulates each axis separately and synthesizes whole `wheel_up`/`wheel_down`/`wheel_left`/`wheel_right` presses, because the core -scrolls on button events. `src/gui/gui.zig` (`takeScrollTicks`) does +scrolls on button events. `dev/gui/gui.zig` (`takeScrollTicks`) does exactly this already. A real mouse notch skips the smoothing and goes through `pardes_mouse`. `pardes_rotate` is the same shape for a two-finger twist, spent as `n`/`N` — see the trackpad section. @@ -142,7 +142,7 @@ pasteboard", with no payload either way, because the host answers by calling `pardes_paste` — and NSPasteboard being synchronous, that usually happens inside the callback itself, before it returns. Both are main thread, inside `pardes_tick`. There is no `open_url` callback because the core already opens -links itself through `/usr/bin/open` (`src/look.zig`), and no file callbacks +links itself through `/usr/bin/open` (`core/look.zig`), and no file callbacks because it owns the filesystem side too. **Lifecycle.** `pardes_init` returns 0 or an opaque nonzero code, @@ -156,7 +156,7 @@ Ordinary input and pty pumps never count as elapsed animation frames. The ordering contract is the part a header cannot enforce. **Init with the real grid size.** The core defers each integrated shell's greeting until it has seen -a resize: `sync()` in `src/pardes.zig` only emits the opening `ls` once +a resize: `sync()` in `core/root.zig` only emits the opening `ls` once `resize_count > 0` and parsed OSC 133 B says the prompt has handed the cursor to input. An unintegrated shell has no reliable readiness signal, so it skips the cosmetic greeting; an explicit command still releases after its successful @@ -484,7 +484,7 @@ has none: compares each member's `proc_pidpath` against the shell's own. A nested interactive shell is therefore still a prompt, and `bash -c 'sleep 30'` is still taken — the wrapper wears the shell's binary, but `sleep` shares its - group. The occupancy suite in `src/host_io.zig` runs on both platforms. + group. The occupancy suite in `dev/host_io.zig` runs on both platforms. ## Fonts and zoom @@ -493,7 +493,7 @@ reached differently on purpose. `Font ` and the `Fonts` picker are ordinary core builtins, enabled by `pardes.font_picker` — the frontends that draw their own text, which is now the -SDL shell and this one. `src/fonts.zig` moved out of `gui/` for that reason. It +SDL shell and this one. `dev/fonts.zig` moved out of `gui/` for that reason. It walks the platform's font directories and reads four small sfnt tables per file to decide whether every glyph has the same advance; no fontconfig and no CoreText, so both shells agree about which faces exist and disagree only about @@ -853,10 +853,10 @@ already do (`install_app_bin`, `install_plist`, `install_scene_kernel`, `install_icon`). - **The plist.** `plutil -replace LSMinimumSystemVersion` reads the committed - `src/macos/Info.plist` and writes a stamped copy into the cache. The source + `dev/macos/Info.plist` and writes a stamped copy into the cache. The source file is never mutated, which is what the old in-place `PlistBuddy` call did. - **The icon.** The mark is **Glenda**, the Plan 9 rabbit — pardes is an acme, - and acme is Plan 9's. `src/macos/icon.swift` is compiled alone (it is + and acme is Plan 9's. `dev/macos/icon.swift` is compiled alone (it is top-level code: one file, one module) and run with the bundle's `Resources` as its output directory. She is *drawn*, not traced: four overlapping ellipses filled as one path under nonzero winding for the silhouette, three @@ -886,9 +886,9 @@ already do (`install_app_bin`, `install_plist`, `install_scene_kernel`, ```sh swiftc <-O|-Osize|-Onone> -target -apple-macos13.0 \ - -import-objc-header src/macos/pardes.h \ + -import-objc-header abi/pardes.h \ -o /pardes \ - src/macos/Sources/{main,AppDelegate,PardesView,ScenePostprocessor,FileWatcher}.swift \ + dev/macos/Sources/{main,AppDelegate,PardesView,ScenePostprocessor,FileWatcher}.swift \ /libpardes.a -lc++ \ -framework AppKit -framework CoreText -framework CoreGraphics \ -framework CoreImage -framework Metal @@ -946,9 +946,9 @@ it goes. **The Linux dev loop.** The Zig half of this backend is plain POSIX, and most of it is no longer even this backend's: `forkShell`, `writeFileBytes` and -`writeFd` are `src/host_io.zig`'s, byte-identical on both systems, and what is +`writeFd` are `dev/host_io.zig`'s, byte-identical on both systems, and what is left that differs is `ioctl(TIOCSWINSZ)` (absent from `std.c.T` on darwin), -`/usr/bin/open` against `/usr/bin/xdg-open` (`src/look.zig:33-37`), and libproc +`/usr/bin/open` against `/usr/bin/xdg-open` (`core/look.zig:33-37`), and libproc against `/proc`. So `-Dplatform=macos` compiles on a Linux host, and its tests run there: @@ -962,7 +962,7 @@ functions precisely so that "how many notches is a 180° twist" is answerable on a machine with no trackpad in it. The header is kept honest with ghostty's trick. `build.zig` runs `translate-C` -over `src/macos/pardes.h` into the unit-test build, and `src/macos.zig` +over `abi/pardes.h` into the unit-test build, and `runtime/macos.zig` asserts every constant and every struct layout against the Zig side — the color tags, the attribute bits, the key codepoints, the mouse, modifier and haptic ordinals, `@sizeOf(pardes_cell_s)` and each field offset. A hand-written header @@ -1099,7 +1099,7 @@ used for the table and is not folded into the direct-path claim. `lsp`, one more response type. - **Detached sessions.** `Detach` (`SPC s D`), `Adopt` and `Upgrade` are compiled into the tui's and the window's builds alone (`enabled` is - `pardes.can_attach`, `src/builtins.zig`), and there is no daemon on macOS + `pardes.can_attach`, `core/builtins.zig`), and there is no daemon on macOS (`daemon.supported` is Linux and FreeBSD): this build's session is the one process it started, and closing it ends it. The `Attach` word and `src/detached/` it went through are gone (`docs/next-daemon.md`, "Phase 3 @@ -1125,7 +1125,7 @@ used for the table and is not folded into the direct-path claim. which is not where the time is, so the escalation is still not warranted. When it is, it is ghostty's: a `CAMetalLayer` installed into the view and driven from Zig, with the ABI growing one `platform` pointer field. -- **A Tahoe icon asset.** `src/macos/icon.swift` emits a full-colour `.icns`, +- **A Tahoe icon asset.** `dev/macos/icon.swift` emits a full-colour `.icns`, every one of the ten sizes, and that is the correct and only format at a 13.0 deployment target. macOS 26's Dock defaults to the `ClearAutomatic` icon style, which desaturates any icon that does not ship the new appearance -- cgit v1.3