diff options
| -rw-r--r-- | build.zig | 4 | ||||
| -rw-r--r-- | build/core.zig | 17 | ||||
| -rw-r--r-- | build/gui.zig | 14 | ||||
| -rw-r--r-- | build/macos.zig | 18 | ||||
| -rw-r--r-- | build/tests.zig | 16 | ||||
| -rw-r--r-- | dev/Art.zig (renamed from src/Art.zig) | 4 | ||||
| -rw-r--r-- | dev/file_watch.zig (renamed from src/file_watch.zig) | 10 | ||||
| -rw-r--r-- | dev/fonts.zig (renamed from src/fonts.zig) | 0 | ||||
| -rw-r--r-- | dev/glide.zig (renamed from src/glide.zig) | 4 | ||||
| -rw-r--r-- | dev/gui/Trackpad.zig (renamed from src/gui/Trackpad.zig) | 0 | ||||
| -rw-r--r-- | dev/gui/deck.zig (renamed from src/gui/deck.zig) | 0 | ||||
| -rw-r--r-- | dev/gui/gui.zig (renamed from src/gui/gui.zig) | 20 | ||||
| -rw-r--r-- | dev/gui/macos_trackpad.h (renamed from src/gui/macos_trackpad.h) | 0 | ||||
| -rw-r--r-- | dev/gui/macos_trackpad.m (renamed from src/gui/macos_trackpad.m) | 0 | ||||
| -rw-r--r-- | dev/gui/pet.zig (renamed from src/gui/pet.zig) | 0 | ||||
| -rw-r--r-- | dev/host_io.zig (renamed from src/host_io.zig) | 16 | ||||
| -rw-r--r-- | dev/jump_trail.zig (renamed from src/jump_trail.zig) | 0 | ||||
| -rw-r--r-- | dev/lsp/Scip.zig (renamed from src/lsp/Scip.zig) | 2 | ||||
| -rw-r--r-- | dev/lsp/lsp_client.zig (renamed from src/lsp/lsp_client.zig) | 4 | ||||
| -rw-r--r-- | dev/macos/Info.plist (renamed from src/macos/Info.plist) | 0 | ||||
| -rw-r--r-- | dev/macos/Sources/AppDelegate.swift (renamed from src/macos/Sources/AppDelegate.swift) | 0 | ||||
| -rw-r--r-- | dev/macos/Sources/FileWatcher.swift (renamed from src/macos/Sources/FileWatcher.swift) | 0 | ||||
| -rw-r--r-- | dev/macos/Sources/PardesView.swift (renamed from src/macos/Sources/PardesView.swift) | 0 | ||||
| -rw-r--r-- | dev/macos/Sources/ScenePostprocessor.swift (renamed from src/macos/Sources/ScenePostprocessor.swift) | 0 | ||||
| -rw-r--r-- | dev/macos/Sources/main.swift (renamed from src/macos/Sources/main.swift) | 0 | ||||
| -rw-r--r-- | dev/macos/icon.png (renamed from src/macos/icon.png) | bin | 1788282 -> 1788282 bytes | |||
| -rw-r--r-- | dev/macos/icon.swift (renamed from src/macos/icon.swift) | 0 | ||||
| -rw-r--r-- | dev/root.zig | 34 | ||||
| -rw-r--r-- | dev/tui/tui.zig (renamed from src/tui/tui.zig) | 12 | ||||
| -rw-r--r-- | dev/vaxis_input.zig (renamed from src/vaxis_input.zig) | 2 | ||||
| -rw-r--r-- | runtime/9p_io.zig | 44 | ||||
| -rw-r--r-- | runtime/macos.zig | 6 | ||||
| -rw-r--r-- | runtime/main.zig | 21 | ||||
| -rw-r--r-- | runtime/root.zig | 2 | ||||
| -rw-r--r-- | src/Core.zig | 2 | ||||
| -rw-r--r-- | src/Effect.zig | 2 | ||||
| -rw-r--r-- | src/Handover.zig | 2 | ||||
| -rw-r--r-- | src/Kind.zig | 2 | ||||
| -rw-r--r-- | src/Output.zig | 2 | ||||
| -rw-r--r-- | src/Stream.zig | 2 | ||||
| -rw-r--r-- | src/builtins.zig | 2 | ||||
| -rw-r--r-- | src/edit_cmd.zig | 2 | ||||
| -rw-r--r-- | src/exec.zig | 2 | ||||
| -rw-r--r-- | src/fs.zig | 4 | ||||
| -rw-r--r-- | src/look.zig | 2 | ||||
| -rw-r--r-- | src/lsp/lsp.zig | 2 | ||||
| -rw-r--r-- | src/ninep/pty.zig | 2 | ||||
| -rw-r--r-- | src/pardes.zig | 24 | ||||
| -rw-r--r-- | src/tape.zig | 2 | ||||
| -rw-r--r-- | test/macos_trackpad.m | 2 |
50 files changed, 168 insertions, 138 deletions
@@ -209,8 +209,8 @@ pub fn build(b: *std.Build) void { var sketchbook: ?*std.Build.Dependency = null; if (also_gui or platform == .gui) { const window = gui.make(b, target, optimize, macos_sdk, prebuilt_shaders, a.freetype); - // ...into the core, whose gui/gui.zig names the window. - for ([_]?core.Modules{ gui_set, if (platform == .gui) root_set else null, if (platform == .gui) static_set else null }) |m| if (m) |s| window.wire(s.core); + // ...into the devices, whose gui/gui.zig names the window. + for ([_]?core.Modules{ gui_set, if (platform == .gui) root_set else null, if (platform == .gui) static_set else null }) |m| if (m) |s| window.wire(s.dev); sketchbook = window.sketchbook; } const snake_shader_lib = addons.gpu(b, target, optimize, a.addon_mod, sketchbook); diff --git a/build/core.zig b/build/core.zig index 8749d612..56a047c0 100644 --- a/build/core.zig +++ b/build/core.zig @@ -318,18 +318,19 @@ pub const Core = struct { util: bool = false, }; -/// What `module` makes: the core and the runtime, each naming the other -/// (`core`, `runtime`), and the module a compile roots at. +/// What `module` makes: the core, the devices and the runtime, each naming +/// the others (`core`, `dev`, `runtime`), 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. root: *std.Build.Module, core: *std.Build.Module, + dev: *std.Build.Module, runtime: *std.Build.Module, }; -/// A core and the runtime beside it, everything they import and link -/// named here and nowhere else. +/// A core and the devices and runtime beside it, everything they import +/// and link named here and nowhere else. pub fn module(b: *std.Build, p: Parts, c: Core) Modules { const in_runtime = std.mem.startsWith(u8, c.root, "runtime/"); const m = b.createModule(.{ .target = p.target, .optimize = p.optimize, .root_source_file = b.path(if (in_runtime) "src/pardes.zig" else c.root), .link_libc = true }); @@ -356,9 +357,10 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { for (p.ts.libs.items) |lib| m.linkLibrary(lib); // The /src tree's files that live outside the core's directory // (fs.zig embeds them under the names they had there). - if (p.embed_sources) for ([_][]const u8{ "runtime/9p.zig", "runtime/9p_io.zig", "runtime/main.zig" }) |f| + if (p.embed_sources) for ([_][]const u8{ "runtime/9p.zig", "runtime/9p_io.zig", "runtime/main.zig", "dev/host_io.zig" }) |f| 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 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. @@ -368,7 +370,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, runtime, root }) |x| { + for ([_]*std.Build.Module{ m, dev, runtime, 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); @@ -390,9 +392,10 @@ pub fn module(b: *std.Build, p: Parts, c: Core) Modules { x.addImport("pardes_isolation", pardes_isolation); x.addImport("builtin_addons", builtin_addons); x.addImport("core", m); + x.addImport("dev", dev); x.addImport("runtime", runtime); } - return .{ .root = root, .core = m, .runtime = runtime }; + return .{ .root = root, .core = m, .dev = dev, .runtime = runtime }; } /// What `assemble` makes besides the parts: the shells' options, the diff --git a/build/gui.zig b/build/gui.zig index cc90bd0a..bec26c0c 100644 --- a/build/gui.zig +++ b/build/gui.zig @@ -30,7 +30,7 @@ pub const Window = struct { gm.addIncludePath(sdl.include); if (w.sketchbook) |sb| { gm.addImport("gui_c", sb.module("c")); - gm.addImport("dev", sb.module("dev")); + gm.addImport("sketchbook", sb.module("dev")); } if (sdl.trackpad) |object| { gm.addObjectFile(object); @@ -47,7 +47,7 @@ pub const Window = struct { gm.addRPath(.{ .cwd_relative = "/usr/local/lib" }); if (w.sketchbook) |sb| gm.addCSourceFile(.{ .file = sb.namedLazyPath("font.c") }); // the embedded UI font: provided as a build import since assets/ lives - // outside the src/ module root (@embedFile can't escape it) + // outside the dev/ module root (@embedFile can't escape it) gm.addAnonymousImport("AdwaitaMono-Regular.ttf", .{ .root_source_file = b.path("assets/AdwaitaMono-Regular.ttf"), }); @@ -77,7 +77,7 @@ pub fn make(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang. \\#include "macos_trackpad.h" \\ ); - const include: []const std.Build.LazyPath = &.{ dep.path("include"), b.path("src/gui") }; + const include: []const std.Build.LazyPath = &.{ dep.path("include"), b.path("dev/gui") }; w.sketchbook = b.lazyDependency("sketchbook", .{ .target = target, .optimize = optimize, .@"c-header" = header, .@"c-include" = include, .@"prebuilt-shaders" = prebuilt_shaders }); var sdl: Window.Sdl = .{ .lib = sdl_lib, .include = dep.path("include") }; if (target.result.os.tag == .macos) { @@ -85,9 +85,9 @@ pub fn make(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang. const shim = b.addSystemCommand(&.{ "xcrun", "clang", "-fobjc-arc", "-O2", "-target", b.fmt("{s}-apple-macos13.0", .{arch}), "-I" }); shim.addDirectoryArg(dep.path("include")); shim.addArg("-c"); - shim.addFileArg(b.path("src/gui/macos_trackpad.m")); + shim.addFileArg(b.path("dev/gui/macos_trackpad.m")); // Header changes invalidate the independently compiled adapter. - shim.addFileInput(b.path("src/gui/macos_trackpad.h")); + shim.addFileInput(b.path("dev/gui/macos_trackpad.h")); shim.addArg("-o"); sdl.trackpad = shim.addOutputFileArg("macos_trackpad.o"); } @@ -136,8 +136,8 @@ pub fn make(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.lang. const adapter_test = b.addSystemCommand(&.{ "xcrun", "clang", "-fobjc-arc", "-O1", "-framework", "Cocoa", "-I" }); adapter_test.addDirectoryArg(sdl.include); adapter_test.addFileArg(b.path("test/macos_trackpad.m")); - adapter_test.addFileInput(b.path("src/gui/macos_trackpad.m")); - adapter_test.addFileInput(b.path("src/gui/macos_trackpad.h")); + adapter_test.addFileInput(b.path("dev/gui/macos_trackpad.m")); + adapter_test.addFileInput(b.path("dev/gui/macos_trackpad.h")); adapter_test.addArg("-o"); const adapter_bin = adapter_test.addOutputFileArg("macos-trackpad-test"); const run_adapter = std.Build.Step.Run.create(b, "run macos-trackpad-test"); diff --git a/build/macos.zig b/build/macos.zig index 7289e70a..b865740e 100644 --- a/build/macos.zig +++ b/build/macos.zig @@ -23,7 +23,7 @@ pub fn add(b: *std.Build, c: struct { }); c.root_mod.addImport("pardes.h", header.createModule()); // The app's watcher, which macos.zig's test reads beside its own. - c.root_mod.addAnonymousImport("macos/Sources/FileWatcher.swift", .{ .root_source_file = b.path("src/macos/Sources/FileWatcher.swift") }); + c.root_mod.addAnonymousImport("macos/Sources/FileWatcher.swift", .{ .root_source_file = b.path("dev/macos/Sources/FileWatcher.swift") }); const lib = b.addLibrary(.{ .name = "pardes", @@ -68,7 +68,7 @@ pub fn add(b: *std.Build, c: struct { "ScenePostprocessor.swift", "FileWatcher.swift", }) |src| - link.addFileArg(b.path(b.fmt("src/macos/Sources/{s}", .{src}))); + link.addFileArg(b.path(b.fmt("dev/macos/Sources/{s}", .{src}))); link.addFileArg(lib_archive); link.addArgs(&.{ "-lc++", @@ -86,17 +86,17 @@ pub fn add(b: *std.Build, c: struct { const icon_build = b.addSystemCommand(&.{ "swiftc", "-O", "-target", triple, "-o" }); const icon_bin = icon_build.addOutputFileArg("pardes-icon"); - icon_build.addFileArg(b.path("src/macos/icon.swift")); + icon_build.addFileArg(b.path("dev/macos/icon.swift")); const icon_run = std.Build.Step.Run.create(b, "pardes-icon"); icon_run.addFileArg(icon_bin); - icon_run.addFileArg(b.path("src/macos/icon.png")); + icon_run.addFileArg(b.path("dev/macos/icon.png")); const icon_dir = icon_run.addOutputDirectoryArg("Resources"); const plist = b.addSystemCommand(&.{ "plutil", "-replace", "LSMinimumSystemVersion", "-string", min_version, "-o", }); const plist_out = plist.addOutputFileArg("Info.plist"); - plist.addFileArg(b.path("src/macos/Info.plist")); + plist.addFileArg(b.path("dev/macos/Info.plist")); const version_plist = b.addSystemCommand(&.{ "plutil", "-replace", "CFBundleShortVersionString", "-string", display_version, "-o", @@ -149,10 +149,10 @@ pub fn add(b: *std.Build, c: struct { e2e.addArg("-o"); const e2e_bin = e2e.addOutputFileArg("pardes-macos-e2e"); for ([_][]const u8{ - "src/macos/Sources/PardesView.swift", - "src/macos/Sources/ScenePostprocessor.swift", - "src/macos/Sources/FileWatcher.swift", - "src/macos/Sources/AppDelegate.swift", + "dev/macos/Sources/PardesView.swift", + "dev/macos/Sources/ScenePostprocessor.swift", + "dev/macos/Sources/FileWatcher.swift", + "dev/macos/Sources/AppDelegate.swift", "test/macos_e2e.swift", }) |source| e2e.addFileArg(b.path(source)); e2e.addFileArg(lib_archive); diff --git a/build/tests.zig b/build/tests.zig index 2d43d743..d351684d 100644 --- a/build/tests.zig +++ b/build/tests.zig @@ -9,9 +9,9 @@ const program = tools.program; /// addon-test (and the addons it loads), kitty-test, the 9P roots. pub fn add(b: *std.Build, c: struct { addon_mod: *std.Build.Module, - /// The core without a terminal and the runtime beside it: core-test. + /// The core without a terminal and the devices and runtime beside it: core-test. core_lean: core.Modules, - /// The shell's root, core and runtime: shell-test. + /// The shell's root, core, devices and runtime: shell-test. root_set: core.Modules, core_module: *std.Build.Module, /// core_module's configuration, for the test roots that run on its imports. @@ -63,9 +63,9 @@ pub fn add(b: *std.Build, c: struct { // The perf and fs bench programs' own tests: they compile no editor. _ = units.add(b, units.root(b, "test/perf.zig", true, &.{.{ .name = "perf_options", .module = c.tools.perf_options.createModule() }}), null); _ = 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 runtime's beside it"); + 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.runtime }) |m| { + for ([_]*std.Build.Module{ c.core_lean.core, c.core_lean.dev, c.core_lean.runtime }) |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; @@ -211,18 +211,18 @@ pub fn add(b: *std.Build, c: struct { const protocol_step = b.step("9p-test", "run freestanding 9P protocol tests"); protocol_step.dependOn(&units.add(b, protocol_tests, null).step); if (testMatch(b, c.unit_profile, c.test_filters, protocol_step)) |check| check.addArtifactArg(protocol_tests); - _ = units.add(b, units.root(b, "src/fonts.zig", true, cloud9), null); + _ = units.add(b, units.root(b, "dev/fonts.zig", true, cloud9), null); _ = units.add(b, units.root(b, "src/c_heap.zig", false, cloud9), null); // Its lookup goes wrong only where the optimizer folds it. _ = units.add(b, b.addTest(.{ .root_module = b.createModule(.{ .target = c.target, .optimize = .safe, .root_source_file = b.path("src/c_heap.zig"), .link_libc = false, .imports = cloud9 }), .filters = c.test_filters }), null); - _ = units.add(b, units.root(b, "test/deck/replay.zig", null, &.{.{ .name = "deck", .module = b.createModule(.{ .target = c.target, .optimize = c.optimize, .root_source_file = b.path("src/gui/deck.zig") }) }}), null); + _ = units.add(b, units.root(b, "test/deck/replay.zig", null, &.{.{ .name = "deck", .module = b.createModule(.{ .target = c.target, .optimize = c.optimize, .root_source_file = b.path("dev/gui/deck.zig") }) }}), null); if (c.platform == .tui or c.platform == .gui) { // 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 and runtime's)"); - for ([_]*std.Build.Module{ c.root_set.root, c.root_set.core, c.root_set.runtime }) |m| + 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| 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/src/Art.zig b/dev/Art.zig index 2e2941c6..9ab0d0f1 100644 --- a/src/Art.zig +++ b/dev/Art.zig @@ -6,8 +6,8 @@ //! the same on every client. One of these a frontend keeps the art of the //! pictures it shows, while it shows them. const std = @import("std"); -const colors = @import("colors.zig"); -const pardes = @import("pardes.zig"); +const colors = @import("core").colors; +const pardes = @import("core"); const Art = @This(); const Surface = pardes.Surface; diff --git a/src/file_watch.zig b/dev/file_watch.zig index 9bb59683..b2205173 100644 --- a/src/file_watch.zig +++ b/dev/file_watch.zig @@ -14,9 +14,9 @@ const builtin = @import("builtin"); /// libc: inotify and kqueue, which std.Io does not have. const libc = std.c; const linux = std.os.linux; -const pardes = @import("pardes.zig"); -const colors = @import("colors.zig"); -const filesystem = @import("fs.zig"); +const pardes = @import("core"); +const colors = @import("core").colors; +const filesystem = @import("core").filesystem; const message = pardes.Messages.Message; pub const Identity = struct { @@ -414,7 +414,7 @@ pub fn watchPane( // stat and a lookup out there: the turn goes out with them. pardes.turn.yield(); defer pardes.turn.back(); - const stat = @import("fs.zig").statPath(std.Io.Threaded.global_single_threaded.io(), watched_path, .{}) catch null; + const stat = @import("core").filesystem.statPath(std.Io.Threaded.global_single_threaded.io(), watched_path, .{}) catch null; const dir = if (stat != null and stat.?.kind == .directory) watched_path else std.Io.Dir.path.dirname(watched_path) orelse "."; var dir_buf: [4096:0]u8 = undefined; if (dir.len >= dir_buf.len) return; @@ -668,7 +668,7 @@ pub fn identify(io: std.Io, path: []const u8) !Identity { const native = filesystem.localPath(path) orelse return error.NonLocalPath; pardes.turn.yield(); defer pardes.turn.back(); - const stat = try @import("fs.zig").statPath(io, native, .{}); + const stat = try @import("core").filesystem.statPath(io, native, .{}); if (stat.kind != .file) return error.NotFile; return .{ .inode = stat.inode, diff --git a/src/fonts.zig b/dev/fonts.zig index 540e3a60..540e3a60 100644 --- a/src/fonts.zig +++ b/dev/fonts.zig diff --git a/src/glide.zig b/dev/glide.zig index 1c49d8e8..711acb22 100644 --- a/src/glide.zig +++ b/dev/glide.zig @@ -9,8 +9,8 @@ //! into the core. const std = @import("std"); -const pardes = @import("pardes.zig"); -const config = @import("config.zig"); +const pardes = @import("core"); +const config = @import("core").config; /// How far the rows moved is measured on the frame against the last drawn, /// a line wrapped over several rows or a terminal's output included, and diff --git a/src/gui/Trackpad.zig b/dev/gui/Trackpad.zig index ef28d211..ef28d211 100644 --- a/src/gui/Trackpad.zig +++ b/dev/gui/Trackpad.zig diff --git a/src/gui/deck.zig b/dev/gui/deck.zig index 1859bae8..1859bae8 100644 --- a/src/gui/deck.zig +++ b/dev/gui/deck.zig diff --git a/src/gui/gui.zig b/dev/gui/gui.zig index c772ac1d..595e867d 100644 --- a/src/gui/gui.zig +++ b/dev/gui/gui.zig @@ -1,21 +1,21 @@ -const dev = @import("dev"); // sketchbook's devices +const dev = @import("sketchbook"); // sketchbook's devices const SketchGpu = dev.Executor; const Cells = dev.Cells; const Atlas = dev.Atlas; const Present = dev.Present; const GpuScene = dev.scene; -const filesystem = @import("../fs.zig"); +const filesystem = @import("core").filesystem; const std = @import("std"); const builtin = @import("builtin"); const posix = std.posix; /// libc: pipes and fcntl for the window's wakes, and a test harness's capture files written from the render thread. const libc = std.c; const vaxis = @import("vaxis"); // test modes only: the stdin escape-seq parser -const pardes = @import("../pardes.zig"); +const pardes = @import("core"); const vaxis_input = @import("../vaxis_input.zig"); -const dump = @import("../dump.zig"); -const config = @import("../config.zig"); -const look = @import("../look.zig"); +const dump = @import("core").dump; +const config = @import("core").config; +const look = @import("core").look; const message = pardes.Messages.Message; const file_watch = @import("../file_watch.zig"); const deck = @import("deck.zig"); @@ -24,15 +24,15 @@ const Trackpad = @import("Trackpad.zig"); const JumpTrail = @import("../jump_trail.zig"); const Art = @import("../Art.zig"); const fonts = @import("../fonts.zig"); // the fallback faces -const selection_pipe = @import("../selection_pipe.zig"); +const selection_pipe = @import("core").selection_pipe; const c_heap = @import("c_heap"); const ninep_io = @import("runtime").ninep_io; const daemon = @import("runtime").daemon; const upgrade = @import("runtime").upgrade; -const replica = @import("../replica.zig"); -const tracy = @import("../tracy.zig"); +const replica = @import("core").replica; +const tracy = @import("core").tracy; pub const c = @import("gui_c"); // SDL3 and font.h, translated by build.zig @@ -1040,7 +1040,7 @@ fn localSession( var core = if (upgrade.resumed) |*rec| try upgrade.load(gpa, allocs.pardes, opts, rec) else if (opts.load_path) |lp| blk: { - const bytes = try @import("../fs.zig").readFile(gpa, lp); + const bytes = try @import("core").filesystem.readFile(gpa, lp); defer gpa.free(bytes); break :blk try pardes.dump.initFromDump(allocs.pardes, opts, bytes); } else try pardes.Pardes.init(allocs.pardes, opts); diff --git a/src/gui/macos_trackpad.h b/dev/gui/macos_trackpad.h index f5266084..f5266084 100644 --- a/src/gui/macos_trackpad.h +++ b/dev/gui/macos_trackpad.h diff --git a/src/gui/macos_trackpad.m b/dev/gui/macos_trackpad.m index 64806b9e..64806b9e 100644 --- a/src/gui/macos_trackpad.m +++ b/dev/gui/macos_trackpad.m diff --git a/src/gui/pet.zig b/dev/gui/pet.zig index 7a13ca91..7a13ca91 100644 --- a/src/gui/pet.zig +++ b/dev/gui/pet.zig diff --git a/src/host_io.zig b/dev/host_io.zig index cadcc1d2..d8b8bbb3 100644 --- a/src/host_io.zig +++ b/dev/host_io.zig @@ -3,14 +3,14 @@ const std = @import("std"); const posix = std.posix; /// libc: ptys, fork and exec, signals; and the leaf file calls (/proc, PATH, the prompt rc files), which run with no io: in a forked child, a signal handler, or for callers holding none. const libc = std.c; -const pardes = @import("pardes.zig"); -const selection_pipe = @import("selection_pipe.zig"); +const pardes = @import("core"); +const selection_pipe = @import("core").selection_pipe; const ninep_io = @import("runtime").ninep_io; -const filesystem = @import("fs.zig"); +const filesystem = @import("core").filesystem; const file_watch = @import("file_watch.zig"); -const replica = @import("replica.zig"); +const replica = @import("core").replica; const daemon = @import("runtime").daemon; -const panes = @import("panes.zig"); +const panes = @import("core").panes; pub const Host = struct { ctx: ?*anyopaque = null, @@ -1813,7 +1813,7 @@ pub const Shell = struct { var buf: [2048]u8 = undefined; try std.testing.expectEqualStrings(bash_rc, readSmall(a_bash, &buf) orelse return error.ReadFailed); try std.testing.expectEqualStrings(fish_rc, readSmall(a.fishPath().?, &buf) orelse return error.ReadFailed); - const stat = try @import("fs.zig").statPath(std.testing.io, a_bash, .{}); + const stat = try @import("core").filesystem.statPath(std.testing.io, a_bash, .{}); try std.testing.expectEqual(0, stat.permissions.toMode() & 0o077); var kept: [rc_path_capacity:0]u8 = @splat(0); @memcpy(kept[0..a_bash.len], a_bash); @@ -2085,7 +2085,7 @@ pub fn forkShell( // A shell's directory may be inside a mount this editor serves. pardes.turn.yield(); defer pardes.turn.back(); - const stat = try @import("fs.zig").statPath(std.Io.Threaded.global_single_threaded.io(), path, .{}); + const stat = try @import("core").filesystem.statPath(std.Io.Threaded.global_single_threaded.io(), path, .{}); if (stat.kind != .directory) return error.NotDir; break :dir path; }; @@ -2254,7 +2254,7 @@ pub fn shellCwd(pid: libc.pid_t, buf: []u8) ?[]const u8 { // no directory to be named by, so the name it had stays, and a // restart works there once it is back. if (std.mem.endsWith(u8, link, " (deleted)")) { - _ = @import("fs.zig").statPath(std.Io.Threaded.global_single_threaded.io(), link, .{}) catch return null; + _ = @import("core").filesystem.statPath(std.Io.Threaded.global_single_threaded.io(), link, .{}) catch return null; } return link; }, diff --git a/src/jump_trail.zig b/dev/jump_trail.zig index 25eba636..25eba636 100644 --- a/src/jump_trail.zig +++ b/dev/jump_trail.zig diff --git a/src/lsp/Scip.zig b/dev/lsp/Scip.zig index 540ba5cd..839f9117 100644 --- a/src/lsp/Scip.zig +++ b/dev/lsp/Scip.zig @@ -14,7 +14,7 @@ //! the index's own directory), external symbols, syntax kinds, an //! occurrence's diagnostics and a document's text. const std = @import("std"); -const statPath = @import("../fs.zig").statPath; +const statPath = @import("core").filesystem.statPath; /// Agave's workspace index is 104 MiB; leave room for it and its lookup tables. /// A bigger index is refused, in words. diff --git a/src/lsp/lsp_client.zig b/dev/lsp/lsp_client.zig index 097bddf2..83aea44f 100644 --- a/src/lsp/lsp_client.zig +++ b/dev/lsp/lsp_client.zig @@ -49,7 +49,7 @@ const std = @import("std"); const builtin = @import("builtin"); const libc = std.c; -const lsp = @import("lsp.zig"); +const lsp = @import("core").lsp; const Scip = @import("Scip.zig"); extern "c" fn execv(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) c_int; @@ -412,7 +412,7 @@ fn record(si: usize, req: lsp.Req, us: u64, rows: usize, err: []const u8) void { } fn hideTime() bool { - return @import("../Messages.zig").Message.noTime(); + return @import("core").Messages.Message.noTime(); } /// `SPC l w` narration, threaded through the real path, so it cannot diff --git a/src/macos/Info.plist b/dev/macos/Info.plist index 3cb2e488..3cb2e488 100644 --- a/src/macos/Info.plist +++ b/dev/macos/Info.plist diff --git a/src/macos/Sources/AppDelegate.swift b/dev/macos/Sources/AppDelegate.swift index dbc0fbc9..dbc0fbc9 100644 --- a/src/macos/Sources/AppDelegate.swift +++ b/dev/macos/Sources/AppDelegate.swift diff --git a/src/macos/Sources/FileWatcher.swift b/dev/macos/Sources/FileWatcher.swift index 1fee2fd8..1fee2fd8 100644 --- a/src/macos/Sources/FileWatcher.swift +++ b/dev/macos/Sources/FileWatcher.swift diff --git a/src/macos/Sources/PardesView.swift b/dev/macos/Sources/PardesView.swift index 23cd0f78..23cd0f78 100644 --- a/src/macos/Sources/PardesView.swift +++ b/dev/macos/Sources/PardesView.swift diff --git a/src/macos/Sources/ScenePostprocessor.swift b/dev/macos/Sources/ScenePostprocessor.swift index 41d54e34..41d54e34 100644 --- a/src/macos/Sources/ScenePostprocessor.swift +++ b/dev/macos/Sources/ScenePostprocessor.swift diff --git a/src/macos/Sources/main.swift b/dev/macos/Sources/main.swift index 6cb2646e..6cb2646e 100644 --- a/src/macos/Sources/main.swift +++ b/dev/macos/Sources/main.swift diff --git a/src/macos/icon.png b/dev/macos/icon.png Binary files differindex 9889c348..9889c348 100644 --- a/src/macos/icon.png +++ b/dev/macos/icon.png diff --git a/src/macos/icon.swift b/dev/macos/icon.swift index 2f45220f..2f45220f 100644 --- a/src/macos/icon.swift +++ b/dev/macos/icon.swift diff --git a/dev/root.zig b/dev/root.zig new file mode 100644 index 00000000..2c70783f --- /dev/null +++ b/dev/root.zig @@ -0,0 +1,34 @@ +//! The devices: the frontends (tui, gui; the macOS app's Swift and +//! resources in macos/), the host's services (host_io), the file watcher, +//! the fonts installed, the language servers' client and the SCIP index, +//! and what the frontends share (Art, jump_trail, glide, vaxis_input). +//! Module `dev`, naming `core` and `runtime`. +pub const tui = @import("tui/tui.zig"); +pub const gui = @import("gui/gui.zig"); +pub const host_io = @import("host_io.zig"); +pub const file_watch = @import("file_watch.zig"); +pub const fonts = @import("fonts.zig"); +pub const lsp_client = @import("lsp/lsp_client.zig"); +pub const Scip = @import("lsp/Scip.zig"); +pub const Art = @import("Art.zig"); +pub const jump_trail = @import("jump_trail.zig"); +pub const glide = @import("glide.zig"); +pub const vaxis_input = @import("vaxis_input.zig"); + +test { + _ = host_io; + _ = host_io.Shell; + _ = host_io.Lsp; + _ = file_watch; + _ = fonts; + _ = lsp_client; + _ = Scip; + _ = glide; + // The frontends', which main.zig's test block collected: a shell's + // build (shell-test); the core without a terminal never compiled them. + if (comptime @import("term_options").terminal) { + if (comptime @import("pardes_config").platform == .tui) _ = tui; + if (comptime @import("pardes_config").platform == .gui) _ = gui; + _ = vaxis_input; + } +} diff --git a/src/tui/tui.zig b/dev/tui/tui.zig index cb709ff1..df2d0016 100644 --- a/src/tui/tui.zig +++ b/dev/tui/tui.zig @@ -1,24 +1,24 @@ -const filesystem = @import("../fs.zig"); +const filesystem = @import("core").filesystem; const std = @import("std"); const builtin = @import("builtin"); const posix = std.posix; /// libc: termios, signals, kitty shm segments and the fds a terminal hands over. const libc = std.c; const vaxis = @import("vaxis"); -const pardes = @import("../pardes.zig"); +const pardes = @import("core"); const JumpTrail = @import("../jump_trail.zig"); const Art = @import("../Art.zig"); const vaxis_input = @import("../vaxis_input.zig"); -const tracy = @import("../tracy.zig"); -const look = @import("../look.zig"); +const tracy = @import("core").tracy; +const look = @import("core").look; const message = pardes.Messages.Message; const file_watch = @import("../file_watch.zig"); -const selection_pipe = @import("../selection_pipe.zig"); +const selection_pipe = @import("core").selection_pipe; const ninep_io = @import("runtime").ninep_io; const daemon = @import("runtime").daemon; const host_io = @import("../host_io.zig"); const upgrade = @import("runtime").upgrade; -const replica = @import("../replica.zig"); +const replica = @import("core").replica; extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; diff --git a/src/vaxis_input.zig b/dev/vaxis_input.zig index dcad9ef1..6cea6553 100644 --- a/src/vaxis_input.zig +++ b/dev/vaxis_input.zig @@ -5,7 +5,7 @@ //! it. const std = @import("std"); const vaxis = @import("vaxis"); -const pardes = @import("pardes.zig"); +const pardes = @import("core"); /// The effective codepoint the way vaxis's own `Key.matches` sees it: a /// single-character `text` wins, the terminal having resolved shift; diff --git a/runtime/9p_io.zig b/runtime/9p_io.zig index acc851c4..ef4ecfdd 100644 --- a/runtime/9p_io.zig +++ b/runtime/9p_io.zig @@ -1097,7 +1097,7 @@ const TempRuntime = struct { if (t.old) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); testing.allocator.free(v); - } else _ = @import("core").host_io.testUnsetenv("XDG_RUNTIME_DIR"); + } else _ = @import("dev").host_io.testUnsetenv("XDG_RUNTIME_DIR"); std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&t.directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); } }; @@ -1133,7 +1133,7 @@ pub fn start(io: std.Io, gpa: std.mem.Allocator, core: *pardes.Pardes) ?*Listene /// ChildEnv.exportVar for why). pub fn exportEnv(serial: u32, adopts: bool) void { const socket: ?[]const u8 = if (own_socket_len > 0) own_socket[0..own_socket_len] else null; - const ChildEnv = @import("core").host_io.ChildEnv; + const ChildEnv = @import("dev").host_io.ChildEnv; var pid_buf: [16]u8 = undefined; ChildEnv.exportVar("PARDES_PID", if (adopts) std.fmt.bufPrint(&pid_buf, "{d}", .{@as(u32, @intCast(libc.getpid()))}) catch unreachable else null); // a u32 fits 16 if (socket) |own| { @@ -1164,10 +1164,10 @@ fn exportMount(sock_path: []const u8) void { if (mntgen and root.len > 0 and std.mem.startsWith(u8, base, sock_prefix) and std.mem.endsWith(u8, base, suffix) and base.len > sock_prefix.len + suffix.len) { var buf: [4096]u8 = undefined; if (std.fmt.bufPrint(&buf, "{s}/pardes/{s}", .{ std.mem.trimEnd(u8, root, "/"), base[sock_prefix.len .. base.len - suffix.len] })) |mount| { - return @import("core").host_io.ChildEnv.exportVar("PARDES_MOUNT", mount); + return @import("dev").host_io.ChildEnv.exportVar("PARDES_MOUNT", mount); } else |_| {} } - @import("core").host_io.ChildEnv.exportVar("PARDES_MOUNT", null); + @import("dev").host_io.ChildEnv.exportVar("PARDES_MOUNT", null); } pub const Client = struct { @@ -2719,16 +2719,16 @@ test "a pane's PARDES_MOUNT is the session's directory under 9ns --mntgen, and u if (value) |old| { _ = setenv(name, old, 1); testing.allocator.free(old); - } else _ = @import("core").host_io.testUnsetenv(name); + } else _ = @import("dev").host_io.testUnsetenv(name); }; _ = setenv("NINE_MOUNT", "/mnt/9p", 1); _ = setenv("NINE_MNTGEN", "1", 1); exportMount("/run/user/1000/pardes-9p-work.sock"); - try testing.expectEqualStrings("/mnt/9p/pardes/work", @import("core").host_io.ChildEnv.exported("PARDES_MOUNT").?); + try testing.expectEqualStrings("/mnt/9p/pardes/work", @import("dev").host_io.ChildEnv.exported("PARDES_MOUNT").?); // A mount of another server (9ns --unix): not this session's. - _ = @import("core").host_io.testUnsetenv("NINE_MNTGEN"); + _ = @import("dev").host_io.testUnsetenv("NINE_MNTGEN"); exportMount("/run/user/1000/pardes-9p-work.sock"); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_MOUNT") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_MOUNT") == null); } test "9P shell environment states being inside pardes apart from how to reach it" { @@ -2741,16 +2741,16 @@ test "9P shell environment states being inside pardes apart from how to reach it if (value) |old| { _ = setenv(name, old, 1); testing.allocator.free(old); - } else _ = @import("core").host_io.testUnsetenv(name); + } else _ = @import("dev").host_io.testUnsetenv(name); }; var dir: [sun_path_len:0]u8 = undefined; _ = setenv("XDG_RUNTIME_DIR", "/run/user/1000", 1); try testing.expectEqualStrings("/run/user/1000", socketDir(&dir).?); - _ = @import("core").host_io.testUnsetenv("XDG_RUNTIME_DIR"); + _ = @import("dev").host_io.testUnsetenv("XDG_RUNTIME_DIR"); _ = setenv("HOME", "/home/example", 1); try testing.expectEqualStrings("/home/example/.local/state/pardes", socketDir(&dir).?); - _ = @import("core").host_io.testUnsetenv("HOME"); + _ = @import("dev").host_io.testUnsetenv("HOME"); try testing.expect(socketDir(&dir) == null); // The socket a listener keeps while it lives. @@ -2766,24 +2766,24 @@ test "9P shell environment states being inside pardes apart from how to reach it // parent, so a pardes started in one of its shells runs a session of // its own instead of handing its argument over. exportEnv(7, false); - try testing.expectEqualStrings(path, @import("core").host_io.ChildEnv.exported("PARDES_9P").?); - try testing.expectEqualStrings("7", @import("core").host_io.ChildEnv.exported("PARDES_PANE").?); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PID") == null); + try testing.expectEqualStrings(path, @import("dev").host_io.ChildEnv.exported("PARDES_9P").?); + try testing.expectEqualStrings("7", @import("dev").host_io.ChildEnv.exported("PARDES_PANE").?); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PID") == null); exportEnv(8, true); - try testing.expectEqualStrings("8", @import("core").host_io.ChildEnv.exported("PARDES_PANE").?); - try testing.expectEqualStrings(own_pid, @import("core").host_io.ChildEnv.exported("PARDES_PID").?); + try testing.expectEqualStrings("8", @import("dev").host_io.ChildEnv.exported("PARDES_PANE").?); + try testing.expectEqualStrings(own_pid, @import("dev").host_io.ChildEnv.exported("PARDES_PID").?); // A session whose listener never came up is still the session this shell // is inside: the pid stands on its own, and only the address is missing. own_socket_len = 0; exportEnv(0, true); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_9P") == null); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PANE") == null); - try testing.expectEqualStrings(own_pid, @import("core").host_io.ChildEnv.exported("PARDES_PID").?); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_9P") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PANE") == null); + try testing.expectEqualStrings(own_pid, @import("dev").host_io.ChildEnv.exported("PARDES_PID").?); exportEnv(0, false); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_9P") == null); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PANE") == null); - try testing.expect(@import("core").host_io.ChildEnv.exported("PARDES_PID") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_9P") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PANE") == null); + try testing.expect(@import("dev").host_io.ChildEnv.exported("PARDES_PID") == null); } diff --git a/runtime/macos.zig b/runtime/macos.zig index f968597b..9475eb78 100644 --- a/runtime/macos.zig +++ b/runtime/macos.zig @@ -12,9 +12,9 @@ const colors = @import("core").colors; const look = @import("core").look; const message = pardes.Messages.Message; const layout = @import("core").layout; -const file_watch = @import("core").file_watch; -const host_io = @import("core").host_io; -const fonts = @import("core").fonts; // the shared fallback preference order +const file_watch = @import("dev").file_watch; +const host_io = @import("dev").host_io; +const fonts = @import("dev").fonts; // the shared fallback preference order const tracy = @import("core").tracy; // no-op unless -Dtracy names a checkout const selection_pipe = @import("core").selection_pipe; // start, Response and Tasks const crash = @import("runtime").crash; diff --git a/runtime/main.zig b/runtime/main.zig index 85b3e249..5d67ad60 100644 --- a/runtime/main.zig +++ b/runtime/main.zig @@ -1537,7 +1537,7 @@ fn nativeMain(std_init: std.process.Init) !void { opts.rows = 50; } const kind: daemon.Kind = if (pardes.platform == .gui) .gui else .tty; - var term: @import("core").tui.Term = if (detach != null) .detached else .open; + var term: @import("dev").tui.Term = if (detach != null) .detached else .open; var detached = detach != null; upgrade.remember(args); if (upgrade.resumed) |*rec| { @@ -1583,7 +1583,7 @@ fn nativeMain(std_init: std.process.Init) !void { defer daemon.quit(); errdefer daemon.tellStubExit(1); switch (pardes.platform) { - .tui => @import("core").tui.run(init, opts, term) catch |err| switch (err) { + .tui => @import("dev").tui.run(init, opts, term) catch |err| switch (err) { // No controlling terminal (a detached pty, a daemon): said, not // an error trace. error.NoDevice => { @@ -1592,7 +1592,7 @@ fn nativeMain(std_init: std.process.Init) !void { }, else => return err, }, - .gui => try @import("core").gui.run(init, opts, detached), + .gui => try @import("dev").gui.run(init, opts, detached), .macos => unreachable, } daemon.tellStubExit(0); @@ -1692,8 +1692,8 @@ fn commOf(io: std.Io, pid: []const u8, buf: *[64]u8) []const u8 { /// window's (gui.zig). fn clientOf(init: std.process.Init, opts: pardes.Options, path: []const u8, name: []const u8, far: bool) !void { switch (pardes.platform) { - .tui => try @import("core").tui.runClient(init, opts, path, name, far), - .gui => try @import("core").gui.runClient(init, opts, path, name, far), + .tui => try @import("dev").tui.runClient(init, opts, path, name, far), + .gui => try @import("dev").gui.runClient(init, opts, path, name, far), else => unreachable, } } @@ -1916,11 +1916,12 @@ test "tcgetattr writes nothing past a Zig termios" { test { _ = pardes.config.User; // The rest this block collected is collected where it lives now: the - // runtime's files by runtime/root.zig's test block, the core's (the - // frontends among them) by pardes.zig's. The window stays named: its - // C's allocator (ui_malloc and the rest) is gui.zig's. + // runtime's files by runtime/root.zig's test block, the core's by + // pardes.zig's, the devices' (the frontends) by dev/root.zig's. The + // window stays named: its C's allocator (ui_malloc and the rest) is + // gui.zig's. if (comptime pardes.platform == .tui) { - _ = @import("core").tui; + _ = @import("dev").tui; } - if (comptime pardes.platform == .gui) _ = @import("core").gui; + if (comptime pardes.platform == .gui) _ = @import("dev").gui; } diff --git a/runtime/root.zig b/runtime/root.zig index 86fd9a75..3297db5e 100644 --- a/runtime/root.zig +++ b/runtime/root.zig @@ -22,5 +22,5 @@ test { // A window's build links the window's C (font.c over FreeType and // HarfBuzz) into each of its programs, and their allocator (ui_malloc // and the rest) is gui.zig's. - if (comptime @import("term_options").terminal and @import("pardes_config").platform == .gui) _ = @import("core").gui; + if (comptime @import("term_options").terminal and @import("pardes_config").platform == .gui) _ = @import("dev").gui; } diff --git a/src/Core.zig b/src/Core.zig index 9ba448be..ffc60360 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -1344,7 +1344,7 @@ fn sayShellFailure(p: *Pardes, id: u8, err: anyerror) void { /// The program the shell's `#!` names that is not there, in `out`. fn missingInterpreter(bin: []const u8, out: []u8) ?[]const u8 { - const Shell = @import("host_io.zig").Shell; + const Shell = @import("dev").host_io.Shell; var buf: [std.Io.Dir.max_path_bytes]u8 = undefined; return Shell.missingInterpreter(Shell.find(bin, &buf) orelse return null, out); } diff --git a/src/Effect.zig b/src/Effect.zig index 344034e2..420bb8e3 100644 --- a/src/Effect.zig +++ b/src/Effect.zig @@ -8,7 +8,7 @@ const tape = @import("tape.zig"); const panes = @import("panes.zig"); const ctlfs = @import("ninep/tree.zig"); const filesystem = @import("fs.zig"); -const host_io = @import("host_io.zig"); +const host_io = @import("dev").host_io; const exec = @import("exec.zig"); const lsp = @import("lsp/lsp.zig"); const Stream = @import("Stream.zig"); diff --git a/src/Handover.zig b/src/Handover.zig index b8491978..7e71fff6 100644 --- a/src/Handover.zig +++ b/src/Handover.zig @@ -679,7 +679,7 @@ test "a handover under a runtime directory too long for a window's socket is ref _ = setenv("XDG_RUNTIME_DIR", v, 1); gpa.free(v); } else { - _ = @import("host_io.zig").testUnsetenv("XDG_RUNTIME_DIR"); + _ = @import("dev").host_io.testUnsetenv("XDG_RUNTIME_DIR"); }; // The ledger's case, past 490 bytes, and one past sun_path alone. for ([_]usize{ 600, 100 }) |n| { diff --git a/src/Kind.zig b/src/Kind.zig index b4e04d6d..021d0247 100644 --- a/src/Kind.zig +++ b/src/Kind.zig @@ -23,7 +23,7 @@ const tape = @import("tape.zig"); const surface = @import("surface.zig"); const views = @import("views.zig"); const Addon = @import("Addon.zig"); -const host_io = @import("host_io.zig"); +const host_io = @import("dev").host_io; pub const Loaded = Addon.Loaded; pub const LoadedWord = Addon.LoadedWord; pub const loadedOf = Addon.loadedOf; diff --git a/src/Output.zig b/src/Output.zig index 8f49fa4e..f748f949 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -19,7 +19,7 @@ const File = panes.File; const Builtin = builtins.registry.Builtin(); -const fonts = if (builtins.capabilities.font_picker) @import("fonts.zig") else struct {}; +const fonts = if (builtins.capabilities.font_picker) @import("dev").fonts else struct {}; pub const Origin = union(enum) { cmd: Builtin, diff --git a/src/Stream.zig b/src/Stream.zig index abdf9afa..e94ac58d 100644 --- a/src/Stream.zig +++ b/src/Stream.zig @@ -1088,7 +1088,7 @@ fn work(io: std.Io, job: *Job, ctx: ?*anyopaque, sink: Sink) void { // ---- tests ---- -const host_io = @import("host_io.zig"); +const host_io = @import("dev").host_io; const testing = std.testing; /// The shell's half, in a test: perform the `search` effect on a real diff --git a/src/builtins.zig b/src/builtins.zig index 02718ff0..a44afb98 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1182,7 +1182,7 @@ pub const Term = struct { if (arg.len > 0) { var why: [320]u8 = undefined; // The authority's lookup, taped, as Shell's (exec.zig). - if (pardes.tape.value(.shell, @import("host_io.zig").Shell.refusal, .{ arg[0..@min(arg.len, 200)], &why })) |refused| { + if (pardes.tape.value(.shell, @import("dev").host_io.Shell.refusal, .{ arg[0..@min(arg.len, 200)], &why })) |refused| { var said: pardes.Kind.Buf(340) = .{}; return c.p.reportFailure(c.id, said.print("Term: {s}", .{refused})); } diff --git a/src/edit_cmd.zig b/src/edit_cmd.zig index f299a39d..54ce5c1f 100644 --- a/src/edit_cmd.zig +++ b/src/edit_cmd.zig @@ -238,7 +238,7 @@ pub fn run(p: *Pardes, id: usize, command: []const u8) void { .token = selection_pipe.newToken(), // What a pane's command is given: $PARDES_MOUNT, $PARDES_9P, // $PARDES_PID, $winid as the Edit's pane. - .env = @import("host_io.zig").commandEnv(arena, pane.serial, !p.opts.nested) catch &.{}, + .env = @import("dev").host_io.commandEnv(arena, pane.serial, !p.opts.nested) catch &.{}, }; keep = true; p.pipe.edit_run = pd; diff --git a/src/exec.zig b/src/exec.zig index f2fb30d4..0a831a85 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -1025,7 +1025,7 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] return p.setMessage(v.active, said.print("Shell: the default again, {s} ($SHELL, else /bin/sh)", .{config.defaultShell()[0..@min(config.defaultShell().len, 256)]})); } var why: [320]u8 = undefined; - if (pardes.tape.value(.shell, @import("host_io.zig").Shell.refusal, .{ want[0..@min(want.len, 200)], &why })) |refused| { + if (pardes.tape.value(.shell, @import("dev").host_io.Shell.refusal, .{ want[0..@min(want.len, 200)], &why })) |refused| { var text: pardes.Kind.Buf(340) = .{}; return p.reportFailure(v.active, text.print("Shell: {s}", .{refused})); } @@ -60,7 +60,7 @@ const source_files = [_]Source{ .{ .path = "src/look.zig", .contents = @embedFile("look.zig") }, .{ .path = "src/9p.zig", .contents = @embedFile("runtime/9p.zig") }, .{ .path = "src/9p_io.zig", .contents = @embedFile("runtime/9p_io.zig") }, - .{ .path = "src/host_io.zig", .contents = @embedFile("host_io.zig") }, + .{ .path = "src/host_io.zig", .contents = @embedFile("dev/host_io.zig") }, .{ .path = "src/config.zig", .contents = @embedFile("config.zig") }, .{ .path = "src/main.zig", .contents = @embedFile("runtime/main.zig") }, .{ .path = "src/builtins.zig", .contents = @embedFile("builtins.zig") }, @@ -804,7 +804,7 @@ pub fn readHost(gpa: std.mem.Allocator, path_z: [:0]const u8, limit: usize) ![]u /// it returned and what the file was before the read: a watch armed over a /// text whose content is that very buffer (file_watch.applyEffect) finds the /// disk the same without reading it again. -pub var last_reads: [8]struct { path: u64 = 0, bytes: [*]const u8 = undefined, len: usize = 0, file: @import("file_watch.zig").Identity = undefined } = @splat(.{}); +pub var last_reads: [8]struct { path: u64 = 0, bytes: [*]const u8 = undefined, len: usize = 0, file: @import("dev").file_watch.Identity = undefined } = @splat(.{}); var last_read: usize = 0; /// A 9P write of an Edit held while its commands run (Namespace.edit_hold). diff --git a/src/look.zig b/src/look.zig index 2ca4afc3..c6e2ea8b 100644 --- a/src/look.zig +++ b/src/look.zig @@ -45,7 +45,7 @@ pub fn openLink(url: []const u8) void { if (pid < 0) return; if (pid == 0) { if (libc.fork() == 0) { - @import("host_io.zig").resetChildSignals(); + @import("dev").host_io.resetChildSignals(); const argv: [3:null]?[*:0]const u8 = .{ opener, url_z.ptr, null }; _ = execv(opener, &argv); } diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 3f8fcde3..7a636f72 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -82,7 +82,7 @@ pub fn explaining(req: Req) Req { /// Every language, Zig's (zls) included, through the protocol client, which /// runs its server as a child process. -const client = @import("lsp_client.zig"); +const client = @import("dev").lsp_client; pub const supports: std.EnumSet(Kind) = client.supports; diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index be85a497..0a1cfc23 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -66,7 +66,7 @@ pub fn writeCtl(p: *Pardes, req: Req, id: usize) Reply { // interpreter is not: refused, and the running shell kept. const bin = pane.shell orelse p.shellBin(); var why: [320]u8 = undefined; - if (pardes.tape.value(.shell, @import("../host_io.zig").Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused| + if (pardes.tape.value(.shell, @import("dev").host_io.Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused| return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}", .{refused[0..@min(refused.len, 300)]}) catch &p.fs.ename); // cut to ename's 320 }; if (verb(p, id, line, apply)) |why| return tree.failText(req.tag, E.INVAL, why); diff --git a/src/pardes.zig b/src/pardes.zig index 061c0efc..c32ebb59 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -4,7 +4,7 @@ pub const layout = @import("layout.zig"); /// `nextWake` answers in whole frames of it. pub const frame_ms: u32 = 16; pub const frame_ns: u64 = frame_ms * std.time.ns_per_ms; -pub const glide = @import("glide.zig"); +pub const glide = @import("dev").glide; pub const FrameStats = @import("FrameStats.zig"); pub const modal = @import("modal.zig"); pub const look = @import("look.zig"); @@ -91,11 +91,8 @@ pub const lsp = @import("lsp/lsp.zig"); /// What the runtime's files name of the core beside the above (9p_io). pub const ctl = @import("ninep/ctl.zig"); pub const edit_cmd = @import("edit_cmd.zig"); -/// The frontends, named by the product's root (runtime/main.zig). -pub const tui = @import("tui/tui.zig"); -pub const gui = @import("gui/gui.zig"); -pub const host_io = @import("host_io.zig"); -pub const file_watch = @import("file_watch.zig"); +pub const host_io = @import("dev").host_io; +pub const file_watch = @import("dev").file_watch; pub const Host = host_io.Host; pub const frameMark = tracy.frameMark; @@ -119,7 +116,7 @@ const Loc = Jump.Loc; pub const can_attach = platform == .tui or platform == .gui; -pub const fonts = if (font_picker) @import("fonts.zig") else struct {}; +pub const fonts = if (font_picker) @import("dev").fonts else struct {}; pub const Pane = panes.Pane; const Text = panes.Text; @@ -399,7 +396,6 @@ test { _ = @import("Core.zig"); _ = @import("Plumb.zig"); _ = @import("lsp/Ask.zig"); - _ = @import("lsp/lsp_client.zig"); _ = @import("Jump.zig"); _ = @import("keys.zig"); _ = @import("Effect.zig"); @@ -427,7 +423,6 @@ test { _ = @import("Pipe.zig"); _ = @import("colors.zig"); _ = @import("surface.zig"); - _ = @import("glide.zig"); _ = @import("body_layer.zig"); _ = @import("draw.zig"); _ = @import("dump.zig"); // its tests ran nowhere before @@ -443,11 +438,8 @@ test { _ = @import("Handover.zig"); _ = @import("walk.zig"); _ = @import("views.zig"); - // The frontends', which main.zig's test block collected: a shell's - // build (shell-test); the core without a terminal never compiled them. - if (comptime @import("term_options").terminal) { - if (comptime platform == .tui) _ = @import("tui/tui.zig"); - if (comptime platform == .gui) _ = @import("gui/gui.zig"); - _ = @import("vaxis_input.zig"); - } + // A window's build links the window's C (font.c over FreeType and + // HarfBuzz) into each of its programs, and their allocator (ui_malloc + // and the rest) is gui.zig's. + if (comptime @import("term_options").terminal and platform == .gui) _ = @import("dev").gui; } diff --git a/src/tape.zig b/src/tape.zig index 9337ff9f..da9de05b 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -20,7 +20,7 @@ const std = @import("std"); const pardes = @import("pardes.zig"); const walk = @import("walk.zig"); -const host_io = @import("host_io.zig"); +const host_io = @import("dev").host_io; const Pardes = pardes.Pardes; const VTable = pardes.Host.VTable; const libc = std.c; diff --git a/test/macos_trackpad.m b/test/macos_trackpad.m index 03c9d311..8f7d9775 100644 --- a/test/macos_trackpad.m +++ b/test/macos_trackpad.m @@ -1,7 +1,7 @@ /* Exercise the real AppKit adapter without a window or a physical trackpad. * Only SDL's event queue and window lookup are replaced with test doubles. */ #import <Cocoa/Cocoa.h> -#include "../src/gui/macos_trackpad.m" +#include "../dev/gui/macos_trackpad.m" #include <assert.h> static id native_window; |
