diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 21:43:03 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-18 22:03:06 -0300 |
| commit | 92d553123673376adf6126ab90d49a22c5b833d2 (patch) | |
| tree | 2a4e83a7e5a0d8766358ce87ccebba72b95f9a2a | |
| parent | f9a3179542012ec1a700e2020ac9f616b819f972 (diff) | |
| download | pardes-92d553123673376adf6126ab90d49a22c5b833d2.tar.gz pardes-92d553123673376adf6126ab90d49a22c5b833d2.zip | |
abi: plain.zig and term.zig, the addon header and its Zig module, pardes.h and the replica stream's wire into abi/ (the reorganisation's tree, step 2c; abi.zig, the seam, is step 12's): plain, the addon's and pardes.h's modules as before from their new place, the wire a module of its own (`wire`, named by the core, the runtime and main.zig); shell-test runs the wire's tests on the core's set, since a window's set links the window's C, whose allocator gui.zig holds; nothing else changes: the ledger, frames byte-identical, replicas and process-test the base's
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| -rw-r--r-- | abi/addon.zig (renamed from src/kinds/addon.zig) | 0 | ||||
| -rw-r--r-- | abi/pardes.h (renamed from src/macos/pardes.h) | 0 | ||||
| -rw-r--r-- | abi/pardes_addon.h (renamed from src/kinds/pardes_addon.h) | 0 | ||||
| -rw-r--r-- | abi/plain.zig (renamed from src/plain/plain.zig) | 0 | ||||
| -rw-r--r-- | abi/term.zig (renamed from src/plain/term.zig) | 0 | ||||
| -rw-r--r-- | abi/wire.zig (renamed from src/wire.zig) | 2 | ||||
| -rw-r--r-- | build.zig | 1 | ||||
| -rw-r--r-- | build/core.zig | 22 | ||||
| -rw-r--r-- | build/macos.zig | 8 | ||||
| -rw-r--r-- | build/tests.zig | 10 | ||||
| -rw-r--r-- | runtime/daemon.zig | 2 | ||||
| -rw-r--r-- | runtime/main.zig | 2 | ||||
| -rw-r--r-- | src/Output.zig | 2 | ||||
| -rw-r--r-- | src/pardes.zig | 2 | ||||
| -rw-r--r-- | src/replica.zig | 2 |
15 files changed, 31 insertions, 22 deletions
diff --git a/src/kinds/addon.zig b/abi/addon.zig index 1fa2279a..1fa2279a 100644 --- a/src/kinds/addon.zig +++ b/abi/addon.zig diff --git a/src/macos/pardes.h b/abi/pardes.h index c4470569..c4470569 100644 --- a/src/macos/pardes.h +++ b/abi/pardes.h diff --git a/src/kinds/pardes_addon.h b/abi/pardes_addon.h index 11dcec38..11dcec38 100644 --- a/src/kinds/pardes_addon.h +++ b/abi/pardes_addon.h diff --git a/src/plain/plain.zig b/abi/plain.zig index 6ca96fe9..6ca96fe9 100644 --- a/src/plain/plain.zig +++ b/abi/plain.zig diff --git a/src/plain/term.zig b/abi/term.zig index de969796..de969796 100644 --- a/src/plain/term.zig +++ b/abi/term.zig diff --git a/src/wire.zig b/abi/wire.zig index 864c2fd8..d6098325 100644 --- a/src/wire.zig +++ b/abi/wire.zig @@ -6,7 +6,7 @@ //! them, went with phase 3. const std = @import("std"); const builtin = @import("builtin"); -const pardes = @import("pardes.zig"); +const pardes = @import("core"); const config = @import("pardes_config"); /// 23: a pane of a kind's frame names its rasters by key, their pixels @@ -328,6 +328,7 @@ pub fn build(b: *std.Build) void { .addon_mod = a.addon_mod, .core_lean = core_lean, .root_set = root_set, + .core_wire = core_set.wire, .core_module = core_module, .core_cfg = core_cfg, .exe = exe, diff --git a/build/core.zig b/build/core.zig index 56a047c0..26de1669 100644 --- a/build/core.zig +++ b/build/core.zig @@ -250,7 +250,7 @@ pub fn editorModule(b: *std.Build, name: ?[]const u8, target: std.Build.Resolved var lib_cfg = cfg; lib_cfg.lib = true; m.addOptions("pardes_config", shellOptions(b, lib_cfg, .tui)); - m.addImport("plain", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("src/plain/plain.zig") })); + m.addImport("plain", b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("abi/plain.zig") })); m.addImport("generated_themes", d.themes); d.ts.wire(m); m.addImport("mvzr", d.mvzr); @@ -274,7 +274,7 @@ pub const Parts = struct { pdf: ?*std.Build.Module, term: *std.Build.Module, plain: *std.Build.Module, - /// The kinds' C ABI (src/kinds/pardes_addon.h), translated. + /// The kinds' C ABI (abi/pardes_addon.h), translated. kind: *std.Build.Module, themes: *std.Build.Module, ts: TreeSitter, @@ -318,8 +318,9 @@ pub const Core = struct { util: bool = false, }; -/// What `module` makes: the core, the devices and the runtime, each naming -/// the others (`core`, `dev`, `runtime`), and the module a compile roots at. +/// What `module` makes: the core, the devices, the runtime and the replica +/// stream's wire (abi/wire.zig), each naming the others (`core`, `dev`, +/// `runtime`, `wire`), and the module a compile roots at. pub const Modules = struct { /// A product's own file (runtime/main.zig, runtime/macos.zig) naming /// both, the runtime, or the core. @@ -327,6 +328,7 @@ pub const Modules = struct { core: *std.Build.Module, dev: *std.Build.Module, runtime: *std.Build.Module, + wire: *std.Build.Module, }; /// A core and the devices and runtime beside it, everything they import @@ -361,6 +363,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { m.addAnonymousImport(f, .{ .root_source_file = b.path(f) }); const runtime = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path("runtime/root.zig"), .link_libc = true }); const dev = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path("dev/root.zig"), .link_libc = true }); + const wire = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path("abi/wire.zig"), .link_libc = true }); const root = if (!in_runtime) m else if (std.mem.eql(u8, c.root, "runtime/root.zig")) runtime else b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path(c.root), .link_libc = true }); // Each options module once, so that the modules share it: a file is in // one module of a compilation. @@ -370,7 +373,7 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { const pardes_config = c.config.createModule(); const pardes_isolation = (if (c.isolated) p.iso_on else p.iso_off).createModule(); const builtin_addons = (if (c.builtin_addons) p.builtin_on else p.builtin_off).createModule(); - for ([_]*std.Build.Module{ m, dev, runtime, root }) |x| { + for ([_]*std.Build.Module{ m, dev, runtime, wire, root }) |x| { x.addImport("cloud9", p.cloud9); if (c.builtin_addons) if (p.pdf) |pdf| x.addImport("pdf_addon", pdf); if (c.builtin_addons) x.addImport("image_addon", p.image); @@ -394,8 +397,9 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { x.addImport("core", m); x.addImport("dev", dev); x.addImport("runtime", runtime); + x.addImport("wire", wire); } - return .{ .root = root, .core = m, .dev = dev, .runtime = runtime }; + return .{ .root = root, .core = m, .dev = dev, .runtime = runtime, .wire = wire }; } /// What `assemble` makes besides the parts: the shells' options, the @@ -497,9 +501,9 @@ pub fn assemble(b: *std.Build, c: struct { // The kinds' C ABI (src/kinds/pardes_addon.h), translated once: the core's // records are the header's, never a mirror of it. - const kind_mod = b.addTranslateC(.{ .root_source_file = b.path("src/kinds/pardes_addon.h"), .target = target, .optimize = optimize }).createModule(); + const kind_mod = b.addTranslateC(.{ .root_source_file = b.path("abi/pardes_addon.h"), .target = target, .optimize = optimize }).createModule(); // ...and what an addon in Zig imports over it (src/kinds/addon.zig). - const addon_mod = b.createModule(.{ .root_source_file = b.path("src/kinds/addon.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "pardes_addon", .module = kind_mod }} }); + const addon_mod = b.createModule(.{ .root_source_file = b.path("abi/addon.zig"), .target = target, .optimize = optimize, .imports = &.{.{ .name = "pardes_addon", .module = kind_mod }} }); const pdf_built = addons.pdf(b, .{ .addon_mod = addon_mod, .c_optimize = c_optimize, @@ -590,7 +594,7 @@ pub fn assemble(b: *std.Build, c: struct { const image_addon = addons.image(b, target, c_optimize, addon_mod, zstbi_dep); // The records the core and the terminal both name (src/plain/plain.zig). - const plain_mod = b.createModule(.{ .root_source_file = b.path("src/plain/plain.zig"), .target = target, .optimize = optimize }); + const plain_mod = b.createModule(.{ .root_source_file = b.path("abi/plain.zig"), .target = target, .optimize = optimize }); // The terminal, a module of its own (src/term/term.zig): the emulator and // what it brings are its, and every core but core-test's is given it. const term_mod = b.createModule(.{ .root_source_file = b.path("src/term/term.zig"), .target = target, .optimize = optimize, .link_libc = true }); diff --git a/build/macos.zig b/build/macos.zig index b865740e..c485d7c2 100644 --- a/build/macos.zig +++ b/build/macos.zig @@ -17,7 +17,7 @@ pub fn add(b: *std.Build, c: struct { unit_profile: *std.Build.Step.Compile, }) void { const header = b.addTranslateC(.{ - .root_source_file = b.path("src/macos/pardes.h"), + .root_source_file = b.path("abi/pardes.h"), .target = c.target, .optimize = c.optimize, }); @@ -39,7 +39,7 @@ pub fn add(b: *std.Build, c: struct { else &b.addInstallArtifact(lib, .{}).step; b.getInstallStep().dependOn(install_lib); - b.installFile("src/macos/pardes.h", "include/pardes.h"); + b.installFile("abi/pardes.h", "include/pardes.h"); const app_step = b.step("macos-app", "assemble zig-out/pardes.app (needs macOS + swiftc)"); const dmg_step = b.step("macos-dmg", "package zig-out/pardes.dmg for distribution (needs macOS + swiftc)"); @@ -58,7 +58,7 @@ pub fn add(b: *std.Build, c: struct { }; const link = b.addSystemCommand(&.{ "swiftc", swift_mode, "-target", triple, "-import-objc-header" }); - link.addFileArg(b.path("src/macos/pardes.h")); + link.addFileArg(b.path("abi/pardes.h")); link.addArg("-o"); const app_bin = link.addOutputFileArg("pardes"); for ([_][]const u8{ @@ -145,7 +145,7 @@ pub fn add(b: *std.Build, c: struct { const arch = if (c.target.result.cpu.arch == .aarch64) "arm64" else @tagName(c.target.result.cpu.arch); const triple = b.fmt("{s}-apple-macos{d}.{d}", .{ arch, macos_min_version.major, macos_min_version.minor }); const e2e = b.addSystemCommand(&.{ "swiftc", "-O", "-target", triple, "-import-objc-header" }); - e2e.addFileArg(b.path("src/macos/pardes.h")); + e2e.addFileArg(b.path("abi/pardes.h")); e2e.addArg("-o"); const e2e_bin = e2e.addOutputFileArg("pardes-macos-e2e"); for ([_][]const u8{ diff --git a/build/tests.zig b/build/tests.zig index d351684d..0eaf7c63 100644 --- a/build/tests.zig +++ b/build/tests.zig @@ -13,6 +13,8 @@ pub fn add(b: *std.Build, c: struct { core_lean: core.Modules, /// The shell's root, core, devices and runtime: shell-test. root_set: core.Modules, + /// The wire (abi/wire.zig) on the core's configuration: shell-test's. + core_wire: *std.Build.Module, core_module: *std.Build.Module, /// core_module's configuration, for the test roots that run on its imports. core_cfg: core.Core, @@ -65,7 +67,7 @@ pub fn add(b: *std.Build, c: struct { _ = units.add(b, units.root(b, "test/fs_bench.zig", null, &.{}), null); const core_test_step = b.step("core-test", "run core tests without native shell tests, on the core without a terminal (a test that needs one skips), and the devices' and the runtime's beside it"); const core_match = testMatch(b, c.unit_profile, c.test_filters, core_test_step); - for ([_]*std.Build.Module{ c.core_lean.core, c.core_lean.dev, c.core_lean.runtime }) |m| { + for ([_]*std.Build.Module{ c.core_lean.core, c.core_lean.dev, c.core_lean.runtime, c.core_lean.wire }) |m| { const core_test = b.addTest(.{ .root_module = m, .filters = c.test_filters }); const run_core_test = b.addRunArtifact(core_test); run_core_test.has_side_effects = true; @@ -112,7 +114,7 @@ pub fn add(b: *std.Build, c: struct { .{ "fake_addon_no_dump", "-DFAKE_NO_DUMP" }, }) |variant| { const lib = b.addLibrary(.{ .name = variant[0], .linkage = .dynamic, .root_module = b.createModule(.{ .target = c.target, .optimize = c.optimize, .link_libc = true }) }); - lib.root_module.addIncludePath(b.path("src/kinds")); + lib.root_module.addIncludePath(b.path("abi")); const name_flag = if (std.mem.eql(u8, variant[0], "fake_addon_abi")) "-DFAKE_NAME=\"fakeabi\"" else if (std.mem.eql(u8, variant[0], "fake_addon_core_word")) "-DFAKE_NAME=\"fakeword\"" else "-DFAKE_PLAIN"; // The header is the whole contract: it compiles clean under every warning. lib.root_module.addCSourceFile(.{ .file = b.path("addons/fake/fake.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror", "-Wno-override-init", variant[1], name_flag } }); @@ -222,7 +224,9 @@ pub fn add(b: *std.Build, c: struct { // The native shell's tests alone, without the perf gate's // ReleaseFast build: what a -Dtest-filter iteration wants. const shell_test_step = b.step("shell-test", "run the native shell's unit tests (runtime/main.zig's, and its core's, devices' and runtime's)"); - for ([_]*std.Build.Module{ c.root_set.root, c.root_set.core, c.root_set.dev, c.root_set.runtime }) |m| + // The wire's on the core's own set: a window's set links the window's C, + // whose allocator is gui.zig's, which nothing in the wire reaches. + for ([_]*std.Build.Module{ c.root_set.root, c.root_set.core, c.root_set.dev, c.root_set.runtime, c.core_wire }) |m| shell_test_step.dependOn(&units.add(b, b.addTest(.{ .root_module = m, .filters = c.test_filters }), null).step); const profile_test = b.addExecutable(.{ .name = "pardes-unit-profile-test", diff --git a/runtime/daemon.zig b/runtime/daemon.zig index 6d96708d..4f770a3a 100644 --- a/runtime/daemon.zig +++ b/runtime/daemon.zig @@ -27,7 +27,7 @@ const builtin = @import("builtin"); const libc = std.c; const posix = std.posix; const ninep_io = @import("9p_io.zig"); -const wire = @import("core").wire; +const wire = @import("wire"); const upgrade = @import("upgrade.zig"); const log = std.log.scoped(.replica); diff --git a/runtime/main.zig b/runtime/main.zig index 5d67ad60..61e9f3fd 100644 --- a/runtime/main.zig +++ b/runtime/main.zig @@ -226,7 +226,7 @@ fn die(io: std.Io, comptime fmt: []const u8, args: anytype) noreturn { /// The second line is what a replica's build must share with its session's /// (wire.zig `semantics`). -const version_text = upgrade.version_line ++ "\n" ++ std.fmt.comptimePrint("semantics {x:0>16}\n", .{@import("core").wire.semantics}); +const version_text = upgrade.version_line ++ "\n" ++ std.fmt.comptimePrint("semantics {x:0>16}\n", .{@import("wire").semantics}); const nested_text = \\pardes: this shell is already inside pardes, and a pardes inside a pardes diff --git a/src/Output.zig b/src/Output.zig index f748f949..c4252ab2 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -903,7 +903,7 @@ pub fn openBuild(p: *Pardes, id: usize) !void { try w.print("grammars {s}\naddons {s}\nsemantics {x:0>16}\n\ndependencies\n{s}", .{ if (build_options.syntax_full_grammars) "full" else if (build_options.syntax_minimal_grammars) "minimal" else "none", if (@import("builtin_addons").on) "compiled in" else "loaded from <prefix>/lib/pardes/addons", - @import("wire.zig").semantics, + @import("wire").semantics, build_options.deps, }); const content = try out.toOwnedSlice(); diff --git a/src/pardes.zig b/src/pardes.zig index c32ebb59..16933396 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -77,7 +77,7 @@ pub const config = @import("config.zig"); pub const memory = @import("memory.zig"); pub const tape = @import("tape.zig"); pub const walk = @import("walk.zig"); -pub const wire = @import("wire.zig"); +pub const wire = @import("wire"); pub const views = @import("views.zig"); pub const rollback = @import("rollback.zig"); pub const replica = @import("replica.zig"); diff --git a/src/replica.zig b/src/replica.zig index 8b7cdaf3..4336855e 100644 --- a/src/replica.zig +++ b/src/replica.zig @@ -27,7 +27,7 @@ const pardes = @import("pardes.zig"); const tape = @import("tape.zig"); const rollback = @import("rollback.zig"); const walk = @import("walk.zig"); -const wire = @import("wire.zig"); +const wire = @import("wire"); const daemon = @import("runtime").daemon; const writeAll = daemon.writeAll; const c_heap = @import("c_heap"); |
