summaryrefslogtreecommitdiff
path: root/addons
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 /addons
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 'addons')
-rw-r--r--addons/fake/fake.c28
-rw-r--r--addons/fake/fake.out11
2 files changed, 16 insertions, 23 deletions
diff --git a/addons/fake/fake.c b/addons/fake/fake.c
index ad0f83ee..818c8ea3 100644
--- a/addons/fake/fake.c
+++ b/addons/fake/fake.c
@@ -30,7 +30,7 @@ typedef struct {
static int init(const pa_api *a) {
api = a;
- return 0;
+ return PA_OK;
}
static void *open(const char *path, const uint8_t *bytes, uint64_t len) {
@@ -45,8 +45,9 @@ static void *open(const char *path, const uint8_t *bytes, uint64_t len) {
static void close(void *st) { (void)st; }
-static uint64_t tick(void *st, uint64_t now) {
+static uint64_t tick(void *st, uint64_t now, uint32_t flags) {
fake *f = st;
+ (void)flags;
f->ticks++;
return f->ticks < 3 ? now + 100000000u : 0; /* ten a second, three times */
}
@@ -63,13 +64,13 @@ static void paint(void *st, const pa_window *w, pa_paint *out) {
fake *f = st;
char line[48] = "count ";
num(line + 6, f ? f->count : 0);
- pa_put(w, 0, 0, line, PA_INDEX(2), PA_DEFAULT);
- if (f && f->last[0]) pa_put(w, 1, 0, f->last, PA_DEFAULT, PA_DEFAULT);
+ pa_put(w, 0, 0, line, PA_INDEX(2), PA_DEFAULT, 0);
+ if (f && f->last[0]) pa_put(w, 1, 0, f->last, PA_DEFAULT, PA_DEFAULT, 0);
const char *p = "fake";
for (out->prefix_len = 0; p[out->prefix_len]; out->prefix_len++) out->prefix[out->prefix_len] = p[out->prefix_len];
if (f && out->cap > 0 && w->rows > 2) {
pa_placement *pl = &out->placements[out->n++];
- *pl = (pa_placement){.rgba = f->pixels, .w = 2, .h = 2, .stride = 8, .src = {0, 0, 2, 2}, .dst = {0, 2, 2, 1}, .key = f->count};
+ *pl = (pa_placement){.rgba = f->pixels, .w = 2, .h = 2, .src = {0, 0, 2, 2}, .dst = {0, 2, 2, 1}, .key = f->count};
}
}
@@ -96,10 +97,7 @@ static uint64_t body_len(void *st) { (void)st; return 6; }
static uint32_t body(void *st, uint64_t off, char *buf, uint32_t n) {
(void)st;
- const char *text = "fake\n\n";
- uint32_t k = 0;
- while (off + k < 6 && k < n) { buf[k] = text[off + k]; k++; }
- return k;
+ return pa_copy("fake\n\n", 6, off, buf, n);
}
static int address(void *st, const char *text, uint32_t n) {
@@ -131,9 +129,9 @@ static int ctl(void *st, const char *line, uint32_t n, char *reply, uint32_t cap
unsigned by = 0;
for (uint32_t i = 9; i < n && line[i] >= '0' && line[i] <= '9'; i++) by = by * 10 + (unsigned)(line[i] - '0');
f->count += by ? by : 1;
- return 0;
+ return PA_OK;
}
- if (n >= 7 && line[4] == 'J') return api->job("abc", 3) ? 0 : 1;
+ if (n >= 7 && line[4] == 'J') return api->job("abc", 3) ? PA_OK : 1;
const char *no = "no such fake word";
uint32_t k = 0;
while (no[k] && k + 1 < cap) { reply[k] = no[k]; k++; }
@@ -174,14 +172,14 @@ static int load(void *st, const uint8_t *buf, uint32_t n, uint32_t version) {
fake *f = st;
if (n != 4 || version > 1) return 1;
f->count = (unsigned)buf[0] | (unsigned)buf[1] << 8 | (unsigned)buf[2] << 16 | (unsigned)buf[3] << 24;
- return 0;
+ return PA_OK;
}
#endif
static const pa_word words[] = {
- {.size = sizeof(pa_word), .name = FAKE_WORD, .leader = "zf", .opens = 1, .doc = "a fake pane, counting"},
- {.size = sizeof(pa_word), .name = "FakeBump", .arg = PA_ARG_OPTIONAL, .doc = "add to the count"},
- {.size = sizeof(pa_word), .name = "FakeJob", .doc = "count a job's answer"},
+ PA_WORD(FAKE_WORD, "zf", PA_ARG_NONE, 1, "a fake pane, counting"),
+ PA_WORD("FakeBump", 0, PA_ARG_OPTIONAL, 0, "add to the count"),
+ PA_WORD("FakeJob", 0, PA_ARG_NONE, 0, "count a job's answer"),
};
const pa_ops pardes_addon = {
diff --git a/addons/fake/fake.out b/addons/fake/fake.out
index 40b958f8..7a09e97a 100644
--- a/addons/fake/fake.out
+++ b/addons/fake/fake.out
@@ -1,5 +1,6 @@
> seed 7
> size 60 20
+window 58x8
tag fake
|count 0
|
@@ -19,7 +20,6 @@ tag fake
|
|
|
-|
placement 2x2 src 0,0 2x2 over 0,2 2x1 key fdcaab9076ad067e
> click 3 1
tag fake
@@ -30,7 +30,6 @@ tag fake
|
|
|
-|
placement 2x2 src 0,0 2x2 over 0,2 2x1 key 71e39225f0cec2a5
> FakeBump 10
tag fake
@@ -41,19 +40,17 @@ tag fake
|
|
|
-|
placement 2x2 src 0,0 2x2 over 0,2 2x1 key 54740e23065232cf
> FakeJob
tag fake
-|count 13
+|count 19
|m3
|
|
|
|
|
-|
-placement 2x2 src 0,0 2x2 over 0,2 2x1 key 54740e23065232cf
+placement 2x2 src 0,0 2x2 over 0,2 2x1 key 540d6c1b4eee5716
> tick 100
tag fake
|count 19
@@ -63,7 +60,6 @@ tag fake
|
|
|
-|
placement 2x2 src 0,0 2x2 over 0,2 2x1 key 540d6c1b4eee5716
> settle
tag fake
@@ -74,5 +70,4 @@ tag fake
|
|
|
-|
placement 2x2 src 0,0 2x2 over 0,2 2x1 key 540d6c1b4eee5716