diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 20:31:32 -0300 |
| commit | 0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (patch) | |
| tree | f2e288668decded9276ebc45907f16d651b06f9e /dev/Inbox.zig | |
| parent | 2ab05b536bc3b063666b5aaab497157adc2a9120 (diff) | |
| parent | bf351b62e8843a3d173cedeefa2dd0b8ef4b4392 (diff) | |
| download | pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.tar.gz pardes-0db34fbf28e70c8c6a3c6025c0888fc5ec75201c.zip | |
integration: a pane's and a view's slot as types, with the regular-expression fixes and the fixes the real loops asked for: pardes-ids (Pane.Id and View.Id through the entries, the events, the effects, the Host table and the device messages) and pardes-merge21, merged without a textual conflict; one call site written since on the old type follows (core/draw.zig: the twin test's file_changed event, .pane = .at(0)); tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/Inbox.zig')
| -rw-r--r-- | dev/Inbox.zig | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/dev/Inbox.zig b/dev/Inbox.zig index d8b14221..ed3a9835 100644 --- a/dev/Inbox.zig +++ b/dev/Inbox.zig @@ -8,8 +8,8 @@ const Lsp = host_io.Lsp; const Inbox = @This(); pub const Msg = union(enum) { - output: struct { pane: u8, gen: u32, bytes: []u8 }, - eof: struct { pane: u8, gen: u32, failure: ?anyerror = null }, + output: struct { pane: pardes.Pane.Id, gen: u32, bytes: []u8 }, + eof: struct { pane: pardes.Pane.Id, gen: u32, failure: ?anyerror = null }, lsp: struct { id: u32, rows: ?[]u8 }, lsp_status: []u8, pipe: selection_pipe.Response, @@ -96,18 +96,18 @@ pub fn wake(q: *Inbox) void { if (q.wake_fn) |f| f(q.wake_ctx); } -pub fn acceptReader(q: *Inbox, pane: u8, gen: u32) void { +pub fn acceptReader(q: *Inbox, pane: pardes.Pane.Id, gen: u32) void { q.lock(); defer q.unlock(); - std.debug.assert(q.readers[pane] == null); - q.readers[pane] = gen; + std.debug.assert(q.readers[pane.index()] == null); + q.readers[pane.index()] = gen; } -pub fn cancelReader(q: *Inbox, pane: u8, gen: u32) void { +pub fn cancelReader(q: *Inbox, pane: pardes.Pane.Id, gen: u32) void { q.lock(); defer q.unlock(); - if (q.readers[pane] != gen) return; - q.readers[pane] = null; + if (q.readers[pane.index()] != gen) return; + q.readers[pane.index()] = null; var i: usize = 0; while (i < q.len) { const msg = q.items[(q.head + i) % q.items.len]; @@ -121,14 +121,14 @@ pub fn cancelReader(q: *Inbox, pane: u8, gen: u32) void { q.space.broadcast(q.io); } -pub fn pushOutput(q: *Inbox, pane: u8, gen: u32, bytes: []u8) bool { +pub fn pushOutput(q: *Inbox, pane: pardes.Pane.Id, gen: u32, bytes: []u8) bool { q.lock(); - while (!q.closed and q.readers[pane] == gen and q.len >= output_capacity) { + while (!q.closed and q.readers[pane.index()] == gen and q.len >= output_capacity) { q.waiting += 1; q.space.waitUncancelable(q.io, &q.mutex); q.waiting -= 1; } - if (q.closed or q.readers[pane] != gen) { + if (q.closed or q.readers[pane.index()] != gen) { q.unlock(); q.gpa.free(bytes); return false; @@ -186,7 +186,7 @@ pub fn push(q: *Inbox, m: Msg) void { }, else => { if (m == .eof) { - if (q.readers[m.eof.pane] != m.eof.gen) { + if (q.readers[m.eof.pane.index()] != m.eof.gen) { q.unlock(); return; } @@ -270,13 +270,13 @@ pub fn deinit(q: *Inbox) void { /// A pane's reader: its pty's output pushed as it comes, then its end /// of file; canceled (closePty), it pushes nothing more. -pub fn startReader(q: *Inbox, pty: std.Io.File, pane: u8, gen: u32) !std.Io.Future(void) { +pub fn startReader(q: *Inbox, pty: std.Io.File, pane: pardes.Pane.Id, gen: u32) !std.Io.Future(void) { q.acceptReader(pane, gen); errdefer q.cancelReader(pane, gen); return q.io.concurrent(readPty, .{ q, pty, pane, gen }); } -fn readPty(q: *Inbox, pty: std.Io.File, pane: u8, gen: u32) void { +fn readPty(q: *Inbox, pty: std.Io.File, pane: pardes.Pane.Id, gen: u32) void { var buf: [0x10000]u8 = undefined; var failure: ?anyerror = null; while (true) { |
