summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 02:31:55 -0300
committerGabriel Schneider <[email protected]>2026-11-06 04:04:25 -0300
commit9c66cdc9049b49f128336dcf5046e2bb1321e281 (patch)
tree7ff664677eb7291558f71a8f824d0ce6a922779a /src/gui
parenta6f294ef5b50aeb5b69e486838378654e318ed04 (diff)
downloadpardes-9c66cdc9049b49f128336dcf5046e2bb1321e281.tar.gz
pardes-9c66cdc9049b49f128336dcf5046e2bb1321e281.zip
kinds #5, ABI 2 and the seam: src/kinds/pardes_addon.h is ABI 2 as architecture §16.9 has it (pa_window 24 bytes and no art bytes, pa_placement 80 with at, from and dirty_y/dirty_h and no stride, pa_word 32 with no size and PA_WORD, tick(st, now_ns, flags) with PA_FOCUSED, PA_OK and the conventions, the dump and load rules, pa_put with attrs, pa_copy and PA_POD, whose fragment gcc -Werror refused as written and is ternaries here) and fake.c and image's table speak it; tick is called at its deadline and once after open, a taken key or click, a word, a job's answer, a load and a change of PA_FOCUSED (the pane has the keyboard in some view, its window focused), nextWake folds the deadlines, and a Debug build hashes the kind's allocations across paint and panics naming it; paint runs once a frame, the slot keeps its prefix and whether it placed a picture, the tag is that prefix, the core's art words when it did and the path, and a frame that changes it owes a step to lay the tag out again; Addon load and reload are an addon effect the host performs (memfd, BLAKE3, dlopen, the head checks and init, the bytes a process holds shared and counted) answered by an addon event carrying what the library brings as data, whose update does the collisions, the reload's validate-then-swap at a new generation and the waiting panes deterministically, while unload is the update's alone and lets the library go by effect; a kind's job is Effect.job run on the host's workers (host_io.KindJob: tui and gui on Io.concurrent, macOS and tests on the loop) answered by Event.job, stale generations dropped and a library closed after its last job; each core has its own Registry (16 kinds, their words, leaders and extensions, digested and dumped; their code a local side array a replica has none of), so a test session no longer unloads the world and Restore and -l keep the process's kinds; every call into a kind whose answer the core acts on is taped as an Outcome (its answer, refusal, message, Look, text pane) and the prefix a step reads is taped too, so a replica's core, which runs no kind's code, steps alike; a pane of a kind on a replica is a Shadow drawn from the authority's frames, painted for the peer's view and sent by Screens as row hashes with the rows that changed and each raster once a key (screen_state.Shadow), its keys going to the authority; the tail, reload and the Addon word and event are Addon.zig's, the slot's record dump.zig's, a tail word's run exec.zig's; --addon-test gains focus, blur, dump, body, ctl and the window line, its jobs done as a host does them; fake.out gains its window line, loses a body row once the tag carries the art words and lands FakeJob at once; tests rewritten: the image dump test (the replica-style load keeps the record), the Petscii/Palette/Ascii tag test in ctl.zig and test/panes.zig's image tag test (a picture decoded and shown first), fs_namespace's decode test (the job performed as a host would), Kind.zig's registry test and Addon.zig's crash-mark test, the addons suite's ABI numbers; new: a job under way across a reload (T1), a Shadow's frame codec, and a replica with no code for a kind showing its pane and passing its keys; gates: core-test 958/958 and behaviour-test 249/249 on both, unit-test 1490/1491 tui and 1533/1534 gui, pane-test 171/172, snap all 105 ok, process-test 0 of 37 failed on both, addon-test ok, hxdiff 19 and hxparity 6 mismatches by the base's names, hxgolf 0, replicas, gui-golden, monkey-gui, daemon.py main and window-clients, soak local pass, perf medium within 1% of the base
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 07624c20..eb8636be 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -1744,6 +1744,7 @@ fn localSession(
host_io.startWorkers(io, allocs);
defer host_io.stopWorkers();
var opts = opts_in;
+ opts.addons = pardes.Addon.scan();
opts.image_allocator = allocs.image;
opts.pdf_allocator = allocs.pdf;
opts.tree_sitter_allocator = allocs.tree_sitter;
@@ -1827,6 +1828,7 @@ fn localSession(
.test_clock = if (test_mode) host_io.testClock() else null,
.test_hz = if (std.c.getenv("PARDES_TEST_HZ")) |hz| @max(1, std.fmt.parseInt(u64, std.mem.span(hz), 10) catch 60) else 60,
};
+ defer shell.job_tasks.cancelAll(io);
defer shell.shutdownPtys();
// A virtual clock never blinks: goldens and feel series hold still.
g.no_blink = shell.test_clock != null;
@@ -3172,6 +3174,7 @@ const Shell = struct {
/// What drainQueue takes each wakeup, kept rather than rebuilt.
batch: Queue.Batch = .{},
pipe_tasks: *PipeTasks,
+ job_tasks: PipeTasks = .{},
inotify_fd: c_int,
watches: *file_watch.Table,
threads_ok: bool = false,
@@ -3545,6 +3548,7 @@ const Shell = struct {
.pipe = pipe,
.search = search,
.hand_over = handOver,
+ .job = kindJob,
};
/// The command panes' exits, told once their output is in (host_io).
@@ -3626,6 +3630,10 @@ const Shell = struct {
s.core.update(.{ .handed = .{ .seq = h.seq, .to = if (h.ok) h.words else "", .failure = if (h.ok) null else h.words } });
s.gpa.free(h.words);
},
+ .kind_job => |j| {
+ s.job_tasks.finish(s.io, j.id);
+ j.land(s.core);
+ },
.files_changed => check_files = true,
.fs_ready => {},
.window => if (s.gui != null) s.openAnotherWindow(null) else s.openTheWindow(),
@@ -4358,6 +4366,12 @@ fn pipe(ctx: ?*anyopaque, id: u32) void {
s.core.reportError(s.core.active, "pipe", error.WorkersUnavailable);
}
+fn kindJob(ctx: ?*anyopaque, pane: u8, serial: u32, token: u32) void {
+ const s = shellOf(ctx);
+ if (s.threads_ok) return host_io.KindJob.start(s.io, s.core, &s.job_tasks, pane, serial, token, s.queue, Queue.pushJob);
+ host_io.KindJob.runHere(s.core, pane, serial, token);
+}
+
fn search(ctx: ?*anyopaque, gen: u32) void {
const s = shellOf(ctx);
if (s.threads_ok) return pardes.Stream.start(s.io, s.gpa, s.core, gen, s.queue, Queue.pushSearch);