summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 11:40:11 -0300
committerGabriel Schneider <[email protected]>2026-11-05 12:41:36 -0300
commit3f1533813b6692a736251e4d467a7f108229ddee (patch)
tree37a32c5ebbf9d3af08923856fd6fa516f3b33a39 /src/ninep
parentcfd2b993feda1b3f7474225bb32db8cac8edc5ae (diff)
downloadpardes-3f1533813b6692a736251e4d467a7f108229ddee.tar.gz
pardes-3f1533813b6692a736251e4d467a7f108229ddee.zip
targets: the DOM web shell goes (src/web.zig and src/web/, its harnesses web_harness, web_snapshot, web_driver_test and web-snapshots/, tools/web_fixture.py, -Dplatform=web, -Ddump, and the web, web-harness, web-snap, web-e2e and web-driver-test steps), and with it what only a freestanding build needed: `hosted` and every guard on it (every build has a host now), memory's stack-fallback arenas and reduced_target sizes, the emscripten main, the tree-sitter libc shim and the stb stub, lsp's has_client, the web arms of the platform switches (-Dplatform is tui, gui or macos); the macOS files pass zig ast-check; docs/web.md is a paragraph on what it was
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/cols.zig1
-rw-r--r--src/ninep/ctl.zig13
-rw-r--r--src/ninep/events.zig1
-rw-r--r--src/ninep/pane.zig2
-rw-r--r--src/ninep/pty.zig10
-rw-r--r--src/ninep/tree.zig2
6 files changed, 8 insertions, 21 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig
index d74c044d..d1ffc3c6 100644
--- a/src/ninep/cols.zig
+++ b/src/ninep/cols.zig
@@ -417,7 +417,6 @@ test "Help and Find at /tagexec act in the session's directory, not the keyboard
}
test "a shell command at /tagexec or a column's exec is a command pane in the session's directory, never typed into the keyboard's terminal" {
- if (comptime !pardes.hosted) return;
const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 30 });
defer p.deinit();
while (p.nextEffect()) |_| {}
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 3b8dae1e..96c44d14 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -382,7 +382,7 @@ pub fn statusText(p: *Pardes) []const u8 {
var w: std.Io.Writer.Allocating = .init(p.scratch.allocator());
var count: usize = 0;
for (p.panes) |slot| count += @intFromBool(slot != null);
- const pid: u32 = if (comptime pardes.hosted) @intCast(std.c.getpid()) else 0;
+ const pid: u32 = @intCast(std.c.getpid());
w.writer.print("pid {d}\nversion {s}\npanes {d}\n", .{ pid, pardes.version, count }) catch {};
// Whether the pointer is over this window: what a grip let go past
// another window's edge asks of every window, to find the one it was
@@ -665,7 +665,7 @@ pub fn writePager(p: *Pardes, req: Req) Reply {
var shown: [256]u8 = undefined;
return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "pager: invalid directory \"{s}\": must be absolute", .{blanked(dir[0..@min(dir.len, shown.len)], &shown)}) catch "pager: invalid directory: must be absolute");
}
- if (comptime pardes.hosted) if (dir.len > 0) if (pardes.filesystem.localPath(dir)) |local| {
+ if (dir.len > 0) if (pardes.filesystem.localPath(dir)) |local| {
// A file there is no directory, ENOTDIR; nothing there, ENOENT.
if (exec_line.kindOf(local) != .directory) {
if (exec_line.kindOf(local) != null)
@@ -1596,7 +1596,6 @@ test "exec Save writes the named file through the host" {
}
test "a refusal's +Unsaved goes in the session's directory when the active pane's directory is not there" {
- if (comptime !pardes.hosted) return;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const serial = serialOf(p);
@@ -1697,7 +1696,6 @@ test "DumpConfig's whole report writes back to the root ctl, line by line, with
}
test "a Restore asks again for the ThemeFile the dump names, as a /ctl write of it does" {
- if (comptime !pardes.hosted) return;
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
@@ -1726,7 +1724,6 @@ test "a Restore asks again for the ThemeFile the dump names, as a /ctl write of
}
test "a ThemeFile that fails to load changes nothing: the root ctl still names the one loaded, or none" {
- if (comptime !pardes.hosted) return;
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
@@ -1752,7 +1749,6 @@ test "a ThemeFile that fails to load changes nothing: the root ctl still names t
}
test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path, which writes back" {
- if (comptime !pardes.hosted) return;
const gpa = testing.allocator;
const p = try withFile(gpa, "x\n");
defer p.deinit();
@@ -1827,7 +1823,6 @@ test "a look whose pane is refused a place fails with that alone, not a missing
}
test "a Restore of a file that is no dump fails the write before any warning, and a failed Dump fails its write" {
- if (comptime !pardes.hosted) return error.SkipZigTest;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const f = pane_files.fileOf(p.panes[0].?).?;
@@ -2286,7 +2281,6 @@ test "with no pane at all, the root look opens its file and the root exec runs i
}
test "a restored pane whose file is gone from disk comes back dirty, and Del asks first" {
- if (comptime !pardes.hosted) return error.SkipZigTest;
const p = try withFile(testing.allocator, "kept text\n");
defer p.deinit();
// On disk when dumped, gone by the Restore.
@@ -2336,7 +2330,6 @@ test "a focus moved over 9P tells the programs that asked for focus reports, as
}
test "a Restore of a name in the DumpDir asks for, and logs, the whole path it reads" {
- if (comptime !pardes.hosted) return error.SkipZigTest;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
try pardes.dump.dumpState(p);
@@ -2853,7 +2846,6 @@ test "a Rename the server answered for this file alone, with other open files sa
}
test "Find says what it skipped under its names, and a script's Find that finds nothing is told so" {
- if (comptime !pardes.hosted) return;
const gpa = testing.allocator;
var tmp = testing.tmpDir(.{});
defer tmp.cleanup();
@@ -2896,7 +2888,6 @@ test "Lspinfo's answer is the +Lsp pane it fills, as a Rename preview's is its +
test "DumpDir refuses a relative directory and one that may not be written, up front; a Dump there says permission denied" {
- if (comptime !pardes.hosted) return;
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();
const root_ctl = @backingInt(tree.TopFile.ctl);
diff --git a/src/ninep/events.zig b/src/ninep/events.zig
index 088520e3..d77cc65a 100644
--- a/src/ninep/events.zig
+++ b/src/ninep/events.zig
@@ -21,7 +21,6 @@ pub const queue_cap = 64 * 1024;
/// Wall-clock seconds, or zero where the platform has no clock.
pub fn now() u32 {
- if (comptime !pardes.hosted) return 0;
var ts: std.c.timespec = undefined;
if (std.c.clock_gettime(.REALTIME, &ts) != 0) return 0;
return std.math.cast(u32, ts.sec) orelse 0;
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 2faa4466..289639e9 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -899,7 +899,7 @@ fn writeName(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
// A directory (`~`, `/`, `foo/`) is no file to name a pane after: a
// Save could only fail. Said now, EISDIR.
const is_dir = name[name.len - 1] == '/' or std.mem.eql(u8, full, "/") or
- (if (comptime pardes.hosted) (if (fs.localPath(full)) |local| exec.kindOf(local) == .directory else false) else false);
+ (if (fs.localPath(full)) |local| exec.kindOf(local) == .directory else false);
if (is_dir) return tree.failText(req.tag, E.ISDIR, std.fmt.bufPrint(&p.fs.ename, "name: {s} is a directory, not a file", .{full[0..@min(full.len, 256)]}) catch "name: is a directory, not a file");
nameBuffer(p, id, full, false) catch |err| return Reply.fail(req.tag, switch (err) {
error.OutOfMemory => E.NOMEM,
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig
index e212d67d..65e8589f 100644
--- a/src/ninep/pty.zig
+++ b/src/ninep/pty.zig
@@ -62,12 +62,10 @@ pub fn writeCtl(p: *Pardes, req: Req, id: usize) Reply {
return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}: no such directory", .{dir[0..@min(dir.len, 256)]}) catch "exec: no such directory");
// Nor is a shell that is not there, or a script whose
// interpreter is not: refused, and the running shell kept.
- if (comptime pardes.hosted) {
- const bin = pane.shell orelse p.shellBin();
- var why: [320]u8 = undefined;
- if (pardes.tape.value(.shell, @import("../host_io.zig").Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused|
- return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}", .{refused}) catch "exec: no such shell");
- }
+ const bin = pane.shell orelse p.shellBin();
+ var why: [320]u8 = undefined;
+ if (pardes.tape.value(.shell, @import("../host_io.zig").Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused|
+ return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}", .{refused}) catch "exec: no such shell");
};
if (verb(p, id, line, apply)) |why| return tree.failText(req.tag, E.INVAL, why);
}
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 53bec357..66a2c0bb 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -1081,7 +1081,7 @@ fn readFile(p: *Pardes, req: Req, target: Target) Reply {
.screen => screen.readSnapshot(p, req, null),
.listeners => window(p, req, screen.listenersText(p)),
.sessions => sessions: {
- if (comptime !(pardes.hosted and daemon.supported)) break :sessions stagedReply(p, req);
+ if (comptime !daemon.supported) break :sessions stagedReply(p, req);
// Out of the turn: the daemon answers within 2 s, or not at all.
const said = pardes.tape.site(.sessions, p.gpa, daemonList, .{p.gpa}) catch |err| break :sessions switch (err) {
error.OutOfMemory => Reply.fail(req.tag, E.NOMEM),