summaryrefslogtreecommitdiff
path: root/build/core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 09:15:57 -0300
committerGabriel Schneider <[email protected]>2026-11-23 09:25:44 -0300
commitc8f0d65a69274dc8a072c35a6c13cb07a6770007 (patch)
treeb3e13754d99250ee596be3368d07539eb4437bfb /build/core.zig
parent0733d0a0d89bacb64f45d71b06ffbcf1abe6ffb3 (diff)
downloadpardes-c8f0d65a69274dc8a072c35a6c13cb07a6770007.tar.gz
pardes-c8f0d65a69274dc8a072c35a6c13cb07a6770007.zip
pdf, abi, core: the pointer and count a C struct or a C caller hands over read through one helper, `addon.cSlice` (abi/addon.zig), NULL being none whatever the count: the bridge says none with a NULL (pardes_pdf_search_page with no hit, pardes_pdf_select over no text, pardes_pdf_load_outline of no entries: each OK with a NULL and a count of 0), and Zig slices a NULL C pointer with a safety panic even at length 0; every site in pdf.zig (jobRun's page text and hits, pageText, hitsOf, selectHere, probeAt, follow, the outline's usable, resolve, sections and section, its bytes now bounded by bytes_len), abi/addon.zig's own (its private `span` was that helper for bytes alone; open's bytes), and the core's kind-ABI callbacks (Kind.zig look, say, text, exec, select, found; Addon.zig loadedOf's words), the core taking the addons' module (`addon`) for it; what holds the next site: pdf.zig's test (run by addon-test, which now runs the pdf module's tests) takes every typed pointer field of the bridge's structs from the translated header at comptime and fails on any `.field[` in pdf.zig, naming the line (shown by putting one site back: "pdf.zig:1014: pardes_pdf_text.data read bare"); the test of the change before passes, with every PDF behaviour test (8/8, Debug)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'build/core.zig')
-rw-r--r--build/core.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/build/core.zig b/build/core.zig
index 32228ab2..f9cb450f 100644
--- a/build/core.zig
+++ b/build/core.zig
@@ -310,8 +310,10 @@ pub const Parts = struct {
pdf: ?*std.Build.Module,
term: *std.Build.Module,
plain: *std.Build.Module,
- /// The kinds' C ABI (abi/pardes_addon.h), translated.
+ /// The kinds' C ABI (abi/pardes_addon.h), translated, and what an addon
+ /// in Zig imports over it (abi/addon.zig: the core's `cSlice` too).
kind: *std.Build.Module,
+ addon: *std.Build.Module,
themes: *std.Build.Module,
ts: TreeSitter,
mvzr: *std.Build.Module,
@@ -401,6 +403,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules {
if (c.terminal) x.addImport("term", p.term);
x.addImport("plain", p.plain);
x.addImport("pardes_addon", p.kind);
+ x.addImport("addon", p.addon);
x.addImport("generated_themes", p.themes);
x.addImport("tree-sitter", p.ts.mod);
x.addImport("ts_queries", ts_queries);
@@ -632,6 +635,7 @@ pub fn assemble(b: *std.Build, c: struct {
.term = term_mod,
.plain = plain_mod,
.kind = kind_mod,
+ .addon = addon_mod,
.themes = themes_mod,
.ts = ts,
.mvzr = mvzr_mod,