summaryrefslogtreecommitdiff
path: root/src/kinds/addon.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-18 08:29:46 -0300
committerGabriel Schneider <[email protected]>2026-11-18 08:29:46 -0300
commit5c5e0102f92938f433a3465c92818be810c1ef78 (patch)
tree379cf5e47f2e281934236482d7a5f78db732b18b /src/kinds/addon.zig
parent8640d280ebc48b0d2658aa13bee2f9ad933c39f3 (diff)
parent3350156db428656fa8e583d1971663e1c4a215b0 (diff)
downloadpardes-5c5e0102f92938f433a3465c92818be810c1ef78.tar.gz
pardes-5c5e0102f92938f433a3465c92818be810c1ef78.zip
integration: the client path's round 1 (the tty client drawing as the own terminal does, a detached session's deltas a unit a frame, the window client's wait, pardes-gui --detach as pardes) with addons in a client part 2 (a draw, ABI 3.2; the image kind where it is shown): no conflict; tui core-test 819/958 (139 skipped), shell-test 993/996, behaviour-test 273/273, replicas pass, pane-test 180/181; the window's suites and its frame corpus NOT run on this merge yet (disk)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/kinds/addon.zig')
-rw-r--r--src/kinds/addon.zig14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/kinds/addon.zig b/src/kinds/addon.zig
index 557547f6..1fa2279a 100644
--- a/src/kinds/addon.zig
+++ b/src/kinds/addon.zig
@@ -19,7 +19,7 @@
//! dump(s, buf) usize load(s, bytes, version) bool search(s, pat) void
//!
//! and pardes's side (pa_api) as the functions below: `arena` and `heap`
-//! as Allocators, `seed`, `say`, `job`, `cancel`, `look`, `text`, `exec`,
+//! as Allocators, `seed`, `say`, `job`, `draw`, `cancel`, `look`, `text`, `exec`,
//! `select` and `found`. A body written is at most `body_max` bytes.
//!
//! pub const pardes_addon = addon.ops(Snake);
@@ -36,9 +36,9 @@ pub const c = @import("pardes_addon");
const Allocator = std.mem.Allocator;
/// The ABI this file speaks: a header of another needs it brought along.
-pub const abi = 0x30001;
+pub const abi = 0x30002;
comptime {
- if (c.PA_ABI != abi) @compileError("addon.zig speaks ABI 3.1 and the header another");
+ if (c.PA_ABI != abi) @compileError("addon.zig speaks ABI 3.2 and the header another");
}
/// A word the kind brings: `opens` a pane of it, else goes to the pane's
@@ -87,6 +87,14 @@ pub fn say(text_: []const u8, how: enum { note, err }) void {
pub fn job(in: []const u8) u32 {
return api.job.?(in.ptr, @intCast(in.len));
}
+/// A picture's job (pa_api.draw): `jobRun` over a copy of `in` on a worker
+/// of the process that shows the pane, its answer to `jobDone` there alone
+/// (`token & drawn`), which keeps it for `paint` only. 0 when refused.
+pub fn draw(in: []const u8) u32 {
+ if (api.size < @sizeOf(c.pa_api)) return 0;
+ return api.draw.?(in.ptr, @intCast(in.len));
+}
+pub const drawn = c.PA_DRAWN;
/// A job's answer not yet come dropped.
pub fn cancel(token: u32) void {
api.cancel.?(token);