diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 21:23:22 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-18 21:43:03 -0300 |
| commit | f9a3179542012ec1a700e2020ac9f616b819f972 (patch) | |
| tree | 73f4cb241876196331f7b28c9f773301bd341a7f /runtime | |
| parent | a75956bb3443aa8aac778d2ff12c42f5ef99e0e9 (diff) | |
| download | pardes-f9a3179542012ec1a700e2020ac9f616b819f972.tar.gz pardes-f9a3179542012ec1a700e2020ac9f616b819f972.zip | |
dev: the frontends (dev/tui, dev/gui, the macOS app's Swift and resources in dev/macos), host_io, file_watch, fonts, the lsp client and Scip, Art, jump_trail, glide and vaxis_input into dev/ (the reorganisation's tree, step 2b): module `dev` (dev/root.zig) beside the core and the runtime, each naming the others; the window wired into it, sketchbook's devices imported as `sketchbook` (its `dev` would be ours); pardes.zig keeps its re-exports (host_io, file_watch, glide, fonts) so every caller reads as before; core-test and shell-test run the devices' test program too, so the same tests run (the ledger, tui and gui); nothing else changes: 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 'runtime')
| -rw-r--r-- | runtime/9p_io.zig | 44 | ||||
| -rw-r--r-- | runtime/macos.zig | 6 | ||||
| -rw-r--r-- | runtime/main.zig | 21 | ||||
| -rw-r--r-- | runtime/root.zig | 2 |
4 files changed, 37 insertions, 36 deletions
diff --git a/runtime/9p_io.zig b/runtime/9p_io.zig index acc851c4..ef4ecfdd 100644 --- a/runtime/9p_io.zig +++ b/runtime/9p_io.zig @@ -1097,7 +1097,7 @@ const TempRuntime = struct { if (t.old) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); testing.allocator.free(v); - } else _ = @import("core").host_io.testUnsetenv("XDG_RUNTIME_DIR"); + } else _ = @import("dev").host_io.testUnsetenv("XDG_RUNTIME_DIR"); std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&t.directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); } }; @@ -1133,7 +1133,7 @@ pub fn start(io: std.Io, gpa: std.mem.Allocator, core: *pardes.Pardes) ?*Listene /// ChildEnv.exportVar for why). pub fn exportEnv(serial: u32, adopts: bool) void { const socket: ?[]const u8 = if (own_socket_len > 0) own_socket[0..own_socket_len] else null; - const ChildEnv = @import("core").host_io.ChildEnv; + const ChildEnv = @import("dev").host_io.ChildEnv; var pid_buf: [16]u8 = undefined; ChildEnv.exportVar("PARDES_PID", if (adopts) std.fmt.bufPrint(&pid_buf, "{d}", .{@as(u32, @intCast(libc.getpid()))}) catch unreachable else null); // a u32 fits 16 if (socket) |own| { @@ -1164,10 +1164,10 @@ fn exportMount(sock_path: []const u8) void { if (mntgen and root.len > 0 and std.mem.startsWith(u8, base, sock_prefix) and std.mem.endsWith(u8, base, suffix) and base.len > sock_prefix.len + suffix.len) { var buf: [4096]u8 = undefined; if (std.fmt.bufPrint(&buf, "{s}/pardes/{s}", .{ std.mem.trimEnd(u8, root, "/"), base[sock_prefix.len .. base.len - suffix.len] })) |mount| { - return @import("core").host_io.ChildEnv.exportVar("PARDES_MOUNT", mount); + return @import("dev").host_io.ChildEnv.exportVar("PARDES_MOUNT", mount); } else |_| {} } - @import("core").host_io.ChildEnv.exportVar("PARDES_MOUNT", null); + @import("dev").host_io.ChildEnv.exportVar("PARDES_MOUNT", null); } pub const Client = struct { @@ -2719,16 +2719,16 @@ test "a pane's PARDES_MOUNT is the session's directory under 9ns --mntgen, and u if (value) |old| { _ = setenv(name, old, 1); testing.allocator.free(old); - } else _ = @import("core").host_io.testUnsetenv(name); + } else _ = @import("dev").host_io.testUnsetenv(name); }; _ = setenv("NINE_MOUNT", "/mnt/9p", 1); _ = setenv("NINE_MNTGEN", "1", 1); exportMount("/run/user/1000/pardes-9p-work.sock"); - try testing.expectEqualStrings("/mnt/9p/pardes/work", @import("core").host_io.ChildEnv.exported("PARDES_MOUNT").?); + try testing.expectEqualStrings("/mnt/9p/pardes/work", @import("dev").host_io.ChildEnv.exported("PARDES_MOUNT").?); // A mount of another server (9ns --unix): not this session's. - _ = @import("core").host_io.testUnsetenv("NINE_MNTGEN"); + _ = @import("dev").host_io.testUnsetenv("NINE_MNTGEN"); exportMount("/run/user/1000/pardes-9p-work.sock"); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_MOUNT") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_MOUNT") == null); } test "9P shell environment states being inside pardes apart from how to reach it" { @@ -2741,16 +2741,16 @@ test "9P shell environment states being inside pardes apart from how to reach it if (value) |old| { _ = setenv(name, old, 1); testing.allocator.free(old); - } else _ = @import("core").host_io.testUnsetenv(name); + } else _ = @import("dev").host_io.testUnsetenv(name); }; var dir: [sun_path_len:0]u8 = undefined; _ = setenv("XDG_RUNTIME_DIR", "/run/user/1000", 1); try testing.expectEqualStrings("/run/user/1000", socketDir(&dir).?); - _ = @import("core").host_io.testUnsetenv("XDG_RUNTIME_DIR"); + _ = @import("dev").host_io.testUnsetenv("XDG_RUNTIME_DIR"); _ = setenv("HOME", "/home/example", 1); try testing.expectEqualStrings("/home/example/.local/state/pardes", socketDir(&dir).?); - _ = @import("core").host_io.testUnsetenv("HOME"); + _ = @import("dev").host_io.testUnsetenv("HOME"); try testing.expect(socketDir(&dir) == null); // The socket a listener keeps while it lives. @@ -2766,24 +2766,24 @@ test "9P shell environment states being inside pardes apart from how to reach it // parent, so a pardes started in one of its shells runs a session of // its own instead of handing its argument over. exportEnv(7, false); - try testing.expectEqualStrings(path, @import("core").host_io.ChildEnv.exported("PARDES_9P").?); - try testing.expectEqualStrings("7", @import("core").host_io.ChildEnv.exported("PARDES_PANE").?); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PID") == null); + try testing.expectEqualStrings(path, @import("dev").host_io.ChildEnv.exported("PARDES_9P").?); + try testing.expectEqualStrings("7", @import("dev").host_io.ChildEnv.exported("PARDES_PANE").?); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PID") == null); exportEnv(8, true); - try testing.expectEqualStrings("8", @import("core").host_io.ChildEnv.exported("PARDES_PANE").?); - try testing.expectEqualStrings(own_pid, @import("core").host_io.ChildEnv.exported("PARDES_PID").?); + try testing.expectEqualStrings("8", @import("dev").host_io.ChildEnv.exported("PARDES_PANE").?); + try testing.expectEqualStrings(own_pid, @import("dev").host_io.ChildEnv.exported("PARDES_PID").?); // A session whose listener never came up is still the session this shell // is inside: the pid stands on its own, and only the address is missing. own_socket_len = 0; exportEnv(0, true); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_9P") == null); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PANE") == null); - try testing.expectEqualStrings(own_pid, @import("core").host_io.ChildEnv.exported("PARDES_PID").?); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_9P") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PANE") == null); + try testing.expectEqualStrings(own_pid, @import("dev").host_io.ChildEnv.exported("PARDES_PID").?); exportEnv(0, false); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_9P") == null); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PANE") == null); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PID") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_9P") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PANE") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PID") == null); } diff --git a/runtime/macos.zig b/runtime/macos.zig index f968597b..9475eb78 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -12,9 +12,9 @@ const colors = @import("core").colors; const look = @import("core").look; const message = pardes.Messages.Message; const layout = @import("core").layout; -const file_watch = @import("core").file_watch; -const host_io = @import("core").host_io; -const fonts = @import("core").fonts; // the shared fallback preference order +const file_watch = @import("dev").file_watch; +const host_io = @import("dev").host_io; +const fonts = @import("dev").fonts; // the shared fallback preference order const tracy = @import("core").tracy; // no-op unless -Dtracy names a checkout const selection_pipe = @import("core").selection_pipe; // start, Response and Tasks const crash = @import("runtime").crash; diff --git a/runtime/main.zig b/runtime/main.zig index 85b3e249..5d67ad60 100644 --- a/runtime/main.zig +++ b/runtime/main.zig @@ -1537,7 +1537,7 @@ fn nativeMain(std_init: std.process.Init) !void { opts.rows = 50; } const kind: daemon.Kind = if (pardes.platform == .gui) .gui else .tty; - var term: @import("core").tui.Term = if (detach != null) .detached else .open; + var term: @import("dev").tui.Term = if (detach != null) .detached else .open; var detached = detach != null; upgrade.remember(args); if (upgrade.resumed) |*rec| { @@ -1583,7 +1583,7 @@ fn nativeMain(std_init: std.process.Init) !void { defer daemon.quit(); errdefer daemon.tellStubExit(1); switch (pardes.platform) { - .tui => @import("core").tui.run(init, opts, term) catch |err| switch (err) { + .tui => @import("dev").tui.run(init, opts, term) catch |err| switch (err) { // No controlling terminal (a detached pty, a daemon): said, not // an error trace. error.NoDevice => { @@ -1592,7 +1592,7 @@ fn nativeMain(std_init: std.process.Init) !void { }, else => return err, }, - .gui => try @import("core").gui.run(init, opts, detached), + .gui => try @import("dev").gui.run(init, opts, detached), .macos => unreachable, } daemon.tellStubExit(0); @@ -1692,8 +1692,8 @@ fn commOf(io: std.Io, pid: []const u8, buf: *[64]u8) []const u8 { /// window's (gui.zig). fn clientOf(init: std.process.Init, opts: pardes.Options, path: []const u8, name: []const u8, far: bool) !void { switch (pardes.platform) { - .tui => try @import("core").tui.runClient(init, opts, path, name, far), - .gui => try @import("core").gui.runClient(init, opts, path, name, far), + .tui => try @import("dev").tui.runClient(init, opts, path, name, far), + .gui => try @import("dev").gui.runClient(init, opts, path, name, far), else => unreachable, } } @@ -1916,11 +1916,12 @@ test "tcgetattr writes nothing past a Zig termios" { test { _ = pardes.config.User; // The rest this block collected is collected where it lives now: the - // runtime's files by runtime/root.zig's test block, the core's (the - // frontends among them) by pardes.zig's. The window stays named: its - // C's allocator (ui_malloc and the rest) is gui.zig's. + // runtime's files by runtime/root.zig's test block, the core's by + // pardes.zig's, the devices' (the frontends) by dev/root.zig's. The + // window stays named: its C's allocator (ui_malloc and the rest) is + // gui.zig's. if (comptime pardes.platform == .tui) { - _ = @import("core").tui; + _ = @import("dev").tui; } - if (comptime pardes.platform == .gui) _ = @import("core").gui; + if (comptime pardes.platform == .gui) _ = @import("dev").gui; } diff --git a/runtime/root.zig b/runtime/root.zig index 86fd9a75..3297db5e 100644 --- a/runtime/root.zig +++ b/runtime/root.zig @@ -22,5 +22,5 @@ test { // A window's build links the window's C (font.c over FreeType and // HarfBuzz) into each of its programs, and their allocator (ui_malloc // and the rest) is gui.zig's. - if (comptime @import("term_options").terminal and @import("pardes_config").platform == .gui) _ = @import("core").gui; + if (comptime @import("term_options").terminal and @import("pardes_config").platform == .gui) _ = @import("dev").gui; } |
