summaryrefslogtreecommitdiff
path: root/dev/Host.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 22:34:26 -0300
committerGabriel Schneider <[email protected]>2026-11-18 22:57:27 -0300
commit250d34c1b942cd6e3726e96f6d80a9cf98d6e20e (patch)
tree30d0d8bb7cd769adf3174d215d4be7e21d754fc2 /dev/Host.zig
parent99f5b10eccd95aa0066ea6fe6bb75f367ab56a47 (diff)
downloadpardes-250d34c1b942cd6e3726e96f6d80a9cf98d6e20e.tar.gz
pardes-250d34c1b942cd6e3726e96f6d80a9cf98d6e20e.zip
dev: host_io.zig into its type files (the reorganisation's tree, step 2e): Host, KindJob, Inbox, Lsp and Shell each a file of its own beside it, their declarations moved as they were (a struct's body is the file's, one indent less), each file importing what it names and host_io.zig naming each (`pub const Shell = @import("Shell.zig")`), so every caller reads as before; Shell's `setenv` is pub, host_io.zig's own code calling it; the tests inside the structs move with them (host_io.Shell.test.* now Shell.test.*); nothing else changes: the ledger, frames byte-identical, replicas and process-test the base's
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/Host.zig')
-rw-r--r--dev/Host.zig66
1 files changed, 66 insertions, 0 deletions
diff --git a/dev/Host.zig b/dev/Host.zig
new file mode 100644
index 00000000..0dc2ae6c
--- /dev/null
+++ b/dev/Host.zig
@@ -0,0 +1,66 @@
+const pardes = @import("core");
+const host_io = @import("host_io.zig");
+const Lsp = host_io.Lsp;
+
+ctx: ?*anyopaque = null,
+vtable: *const VTable = &.{},
+
+pub const VTable = struct {
+ wait_input: ?*const fn (ctx: ?*anyopaque, timeout_ms: u32) void = null,
+ /// The shell's monotonic clock in ns: the only time the core sees.
+ /// Without one, core animation moves only by `.tick` events.
+ now: ?*const fn (ctx: ?*anyopaque) u64 = null,
+ present: ?*const fn (ctx: ?*anyopaque, surface: *const pardes.Surface) void = null,
+ post_present: ?*const fn (ctx: ?*anyopaque) void = null,
+ poll_frame: ?*const fn (ctx: ?*anyopaque) void = null,
+ /// Whether anyone sees a frame drawn now. A detached session with no
+ /// client attached draws none (a /screen read draws its own), and
+ /// the frame owed is drawn when one attaches. Absent: always.
+ watched: ?*const fn (ctx: ?*anyopaque) bool = null,
+ /// Detach: the terminal or window let go, the session left running
+ /// for the daemon to attach again (daemon.zig).
+ detach: ?*const fn (ctx: ?*anyopaque) void = null,
+ /// Adopt: the shells a dead session left, asked of the daemon.
+ adopt: ?*const fn (ctx: ?*anyopaque, pane: u8) void = null,
+ /// Upgrade: this process exec'd as the pardes installed since, at
+ /// the step's end (upgrade.zig); `pane` hears why if it cannot be.
+ upgrade: ?*const fn (ctx: ?*anyopaque, pane: u8) void = null,
+ /// Whether a newer pardes is installed at the path this process
+ /// started from, to be said once (upgrade.zig): asked at a focus-in.
+ newer_build: ?*const fn (ctx: ?*anyopaque) bool = null,
+ spawn: ?*const fn (ctx: ?*anyopaque, pane: u8, cwd: []const u8) void = null,
+ pty_write: ?*const fn (ctx: ?*anyopaque, pane: u8, bytes: []const u8) void = null,
+ pty_resize: ?*const fn (ctx: ?*anyopaque, pane: u8, cols: u16, rows: u16) void = null,
+ pty_signal: ?*const fn (ctx: ?*anyopaque, pane: u8, sig: pardes.PtySignal) void = null,
+ close_pty: ?*const fn (ctx: ?*anyopaque, pane: u8) void = null,
+ tty_taken: ?*const fn (ctx: ?*anyopaque, pane: u8) bool = null,
+ /// The name of the program holding the tty, when it is not the
+ /// shell (host_io.foregroundName), in `buf`.
+ fg_name: ?*const fn (ctx: ?*anyopaque, pane: u8, buf: []u8) ?[]const u8 = null,
+ /// Answered at once, not queued as an effect: Kill asks while the
+ /// job it saw running is still the one in the tty (host_io.killJob).
+ kill_job: ?*const fn (ctx: ?*anyopaque, pane: u8) bool = null,
+ write_file: ?*const fn (ctx: ?*anyopaque, pane: u8, path: []const u8, bytes: []const u8) void = null,
+ write_dump: ?*const fn (ctx: ?*anyopaque, bytes: []const u8) void = null,
+ watch_file: ?*const fn (ctx: ?*anyopaque, pane: u8, path: []const u8, on: bool, mode: pardes.WatchMode) void = null,
+ watch_theme: ?*const fn (ctx: ?*anyopaque, generation: u32, on: bool) void = null,
+ dump_themes: ?*const fn (ctx: ?*anyopaque, pane: u8) void = null,
+ set_clipboard: ?*const fn (ctx: ?*anyopaque, text: []const u8) void = null,
+ read_clipboard: ?*const fn (ctx: ?*anyopaque) void = null,
+ open_link: ?*const fn (ctx: ?*anyopaque, url: []const u8) void = null,
+ /// A plumbing rule's program (Effect.start): every host's is
+ /// startDetached. Null once it runs, else why not.
+ start: ?*const fn (ctx: ?*anyopaque, line: []const u8, why: []u8) ?[]const u8 = null,
+ lsp: ?*const fn (ctx: ?*anyopaque, req: Lsp.Request) void = null,
+ pipe: ?*const fn (ctx: ?*anyopaque, id: u32) void = null,
+ /// Start the streaming search of this generation on a worker
+ /// (pardes.Stream.start); absent, it runs on the loop.
+ search: ?*const fn (ctx: ?*anyopaque, gen: u32) void = null,
+ /// Carry the dump of handover `seq` to another window on a worker
+ /// (Handover.start), which answers through the inbox's `handed`.
+ hand_over: ?*const fn (ctx: ?*anyopaque, seq: u32, bytes: []const u8) void = null,
+ /// Run job `token` of the pane in slot `pane` (whose serial is
+ /// `serial`) on a worker (`KindJob`), answering with the `job` event;
+ /// absent, it runs on the loop.
+ job: ?*const fn (ctx: ?*anyopaque, pane: u8, serial: u32, token: u32) void = null,
+};