Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
check:
uses: fizzyedit/plugin-build-action/.github/workflows/check.yml@v7
with:
zig-version: "0.16.0"
zig-version: "0.17.0"
# secrets:
# build_env: ${{ secrets.MY_BUILD_ENV }} # as in release.yml, if the build needs one
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
permissions:
contents: write
with:
zig-version: "0.16.0"
zig-version: "0.17.0"
2 changes: 1 addition & 1 deletion .github/workflows/sdk-repin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
with:
sdk-version: ${{ github.event.client_payload.version || inputs.sdk-version || '' }}
force: ${{ inputs.force == true }}
zig-version: "0.16.0"
zig-version: "0.17.0"
4 changes: 2 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub fn build(b: *std.Build) void {
});
bench.root_module.addImport("content_graph", cg_for_bench);
const run_bench = b.addRunArtifact(bench);
if (b.args) |a| run_bench.addArgs(a);
run_bench.addPassthruArgs();
b.step("bench", "Scan/resolve timings, --stats, --world, --shapes, --stability").dependOn(&run_bench.step);
}

Expand All @@ -286,7 +286,7 @@ pub fn build(b: *std.Build) void {
}),
});
const run_wiki = b.addRunArtifact(wiki);
if (b.args) |a| run_wiki.addArgs(a);
run_wiki.addPassthruArgs();
b.step("wiki-import", "MediaWiki XML dump -> markdown vault").dependOn(&run_wiki.step);
}

Expand Down
6 changes: 3 additions & 3 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.{
.name = .atlas,
.version = "0.0.1",
.minimum_zig_version = "0.16.0",
.minimum_zig_version = "0.17.0",
.paths = .{
"build.zig",
"build.zig.zon",
Expand All @@ -21,8 +21,8 @@
// The published SDK, not a path into a checkout: a release has to build from a
// clean clone, and the release asset (never the tag's git archive) is the SDK
// package alone — the monorepo root zon carries the app's own dependencies.
.url = "https://github.com/fizzyedit/fizzy/releases/download/sdk-v0.2.29/fizzy-sdk-v0.2.29.tar.gz",
.hash = "fizzy-0.2.29-SGBwY2sxJgCLLSPt4HLdlMSg7WtcP4K0fdtXI5WwJl2d",
.url = "https://github.com/fizzyedit/fizzy/releases/download/sdk-v0.2.30/fizzy-sdk-v0.2.30.tar.gz",
.hash = "fizzy-0.2.30-SGBwY1QnJwDznUMVnSLATxXgH2e8_Vz7eMwLj9UQ0sVU",
},
},
}
4 changes: 2 additions & 2 deletions plugin.zig.zon
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.{
.id = "atlas",
.name = "Atlas",
.version = "0.0.24",
.min_sdk_version = "0.2.29",
.version = "0.0.25",
.min_sdk_version = "0.2.30",
.description = "Wiki-style notes for fizzy: [[wikilinks]], backlinks, and a graph of how your markdown connects.",
.tags = .{ "notes", "markdown", "wiki" },
.author = "foxnne",
Expand Down
8 changes: 4 additions & 4 deletions src/batch2d/SoftAtlas.zig
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn deinit(self: *SoftAtlas, gpa: std.mem.Allocator) void {
/// neighbouring atlas cell (kinds sit in one horizontal strip).
pub fn uv(self: *const SoftAtlas, kind: Kind) UvRect {
_ = self;
const i: u32 = @intFromEnum(kind);
const i: u32 = @backingInt(kind);
const size: f32 = @floatFromInt(atlas_w);
const h: f32 = @floatFromInt(pad_px);
const x0: f32 = @floatFromInt(i * cell_px);
Expand Down Expand Up @@ -255,7 +255,7 @@ const testing = std.testing;
test "atlas cells are non-empty and non-overlapping in alpha mass" {
var a = try SoftAtlas.init(testing.allocator);
defer a.deinit(testing.allocator);
var mass: [cells]u32 = .{0} ** cells;
var mass: [cells]u32 = @splat(0);
for (0..cells) |c| {
const ox = c * cell_px;
for (0..cell_px) |y| {
Expand Down Expand Up @@ -287,8 +287,8 @@ test "dash ring has less alpha mass than solid ring" {
defer a.deinit(testing.allocator);
var solid: u32 = 0;
var dashed: u32 = 0;
const ox_r = @intFromEnum(Kind.ring) * cell_px;
const ox_d = @intFromEnum(Kind.dash_ring) * cell_px;
const ox_r = @backingInt(Kind.ring) * cell_px;
const ox_d = @backingInt(Kind.dash_ring) * cell_px;
for (0..cell_px) |y| {
for (0..cell_px) |x| {
solid += a.pixels[y * atlas_w + ox_r + x].a;
Expand Down
12 changes: 6 additions & 6 deletions src/bench_main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ pub fn main(init: std.process.Init) !void {
"{s:<22}{s:>7}{s:>8}{s:>9}{s:>8}{s:>10}{s:>8}{s:>9}{s:>8}{s:>8}{s:>9}{s:>11}\n",
.{ "vault", "notes", "edges", "read", "scan", "resolve", "hop2", "force", "pack", "relax", "snap+ref", "LAYOUT" },
);
std.debug.print("{s}\n", .{"-" ** 117});
std.debug.print("{s}\n", .{&@as([117]u8, @splat('-'))});
}

var i: usize = 1;
Expand Down Expand Up @@ -1100,9 +1100,9 @@ fn linkSpreadReport(

// The same sample, split by the busier endpoint's degree.
const cuts = [_]u32{ 8, 32, 128, 512, std.math.maxInt(u32) };
var b_sum: [cuts.len]f64 = .{0} ** cuts.len;
var b_far: [cuts.len]usize = .{0} ** cuts.len;
var b_n: [cuts.len]usize = .{0} ** cuts.len;
var b_sum: [cuts.len]f64 = @splat(0);
var b_far: [cuts.len]usize = @splat(0);
var b_n: [cuts.len]usize = @splat(0);
var ei: usize = 0;
while (ei < edges.len) : (ei += stride) {
const e = edges[ei];
Expand Down Expand Up @@ -1464,7 +1464,7 @@ fn layoutReport(
// blank annulus the reader sees around the giant component is a trailing zero.
{
const rings = 8;
var hist: [rings]usize = .{0} ** rings;
var hist: [rings]usize = @splat(0);
var total: usize = 0;
const n_notes = w.lad.leaf_cell.len;
const stride = @max(1, n_notes / sample_cap);
Expand Down Expand Up @@ -2271,7 +2271,7 @@ fn printStabilityHeader() void {
"fine p50/p90/max", "region p50/p90/max", "fine%", "region%",
},
);
std.debug.print("{s}\n", .{"-" ** 120});
std.debug.print("{s}\n", .{&@as([120]u8, @splat('-'))});
}

fn printStabilityRow(label: []const u8, n: usize, e: usize, s: louvain.Stability) void {
Expand Down
12 changes: 6 additions & 6 deletions src/index/query.zig
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub fn noteContentGraph(
});
try heading_rows.append(arena, .{ .line = h.line, .level = level });
}
for (n.blocks) |b| try block_rows.append(arena, .{ .kind = @intFromEnum(b.kind), .line_start = b.line_start, .line_end = b.line_end, .weight = b.weight });
for (n.blocks) |b| try block_rows.append(arena, .{ .kind = @backingInt(b.kind), .line_start = b.line_start, .line_end = b.line_end, .weight = b.weight });
for (n.tags) |t| try tag_rows.append(arena, .{ .tag = try arena.dupe(u8, t.tag), .line = t.line });
// Embeds are kept apart from the same-note cross-reference edges below rather than
// merged into them.
Expand Down Expand Up @@ -254,7 +254,7 @@ pub fn noteContentGraph(
},
.block => {
const b = block_rows.items[m.idx];
const kind: content_graph.ItemKind = switch (@as(schema.BlockKind, @enumFromInt(b.kind))) {
const kind: content_graph.ItemKind = switch (@as(schema.BlockKind, @fromBackingInt(@intCast(b.kind)))) {
.paragraph => .paragraph,
.list => .list,
.code => .code,
Expand Down Expand Up @@ -335,15 +335,15 @@ fn appendBodyItem(
}

fn ordinalKey(parent_id: i64, kind: content_graph.ItemKind) u64 {
return (@as(u64, @bitCast(parent_id)) *% 1099511628211) ^ @as(u64, @intFromEnum(kind));
return (@as(u64, @bitCast(parent_id)) *% 1099511628211) ^ @as(u64, @backingInt(kind));
}

/// Identity for a non-heading item: unstable across edits that reorder or insert siblings under
/// the same heading, stable otherwise — see `content_graph.Item.id`'s doc comment.
fn contentItemId(kind: content_graph.ItemKind, parent_id: i64, ordinal: u32) i64 {
var h = std.hash.Wyhash.init(ordinal);
h.update(std.mem.asBytes(&parent_id));
h.update(&[_]u8{@intFromEnum(kind)});
h.update(&[_]u8{@backingInt(kind)});
const v: i64 = @intCast(h.final() & 0x7fff_ffff_ffff_ffff);
return if (v == 0) 1 else v;
}
Expand Down Expand Up @@ -513,7 +513,7 @@ pub fn vaultRelative(vault: []const u8, abs: []const u8, buf: []u8) ?[]const u8
if (rest.len == 0 or rest.len > buf.len) return null;
const out = buf[0..rest.len];
@memcpy(out, rest);
if (builtin.os.tag == .windows) {
if (builtin.target.os.tag == .windows) {
std.mem.replaceScalar(u8, out, std.fs.path.sep_windows, std.fs.path.sep_posix);
}
return out;
Expand All @@ -528,7 +528,7 @@ const sep_any = &[_]u8{ std.fs.path.sep_posix, std.fs.path.sep_windows };
fn hasPathPrefix(abs: []const u8, vault: []const u8) bool {
if (abs.len < vault.len) return false;
if (std.mem.eql(u8, abs[0..vault.len], vault)) return true;
if (builtin.os.tag != .windows) return false;
if (builtin.target.os.tag != .windows) return false;
for (abs[0..vault.len], vault) |a, v| {
const an = if (a == std.fs.path.sep_windows) std.fs.path.sep_posix else std.ascii.toLower(a);
const vn = if (v == std.fs.path.sep_windows) std.fs.path.sep_posix else std.ascii.toLower(v);
Expand Down
26 changes: 13 additions & 13 deletions src/ui/containment.zig
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ pub const Field = struct {
// memoised in `expanded` — the relaxation is paid on the frame a cell first opens and never
// again, which is the same budget the permutation search lived in.
const n = kids.len;
var p: [8]Vec2 = .{Vec2{ .x = 0, .y = 0 }} ** 8;
var sep_r: [8]f32 = .{0} ** 8;
var mass: [8]f32 = .{1} ** 8;
var p: [8]Vec2 = @splat(Vec2{ .x = 0, .y = 0 });
var sep_r: [8]f32 = @splat(0);
var mass: [8]f32 = @splat(1);
var big: usize = 0;
for (kids, 0..) |k, i| {
sep_r[i] = self.separationRadius(lad, k);
Expand All @@ -351,8 +351,8 @@ pub const Field = struct {
}

// Where each child's out-of-cell neighbours lie, as one unit direction per child.
var ext_dir: [8]Vec2 = .{Vec2{ .x = 0, .y = 0 }} ** 8;
var ext_mag: [8]f32 = .{0} ** 8;
var ext_dir: [8]Vec2 = @splat(Vec2{ .x = 0, .y = 0 });
var ext_mag: [8]f32 = @splat(0);
if (self.opts.ext_k != 0) {
for (lad.extOf(cell)) |e| {
if (e.child >= n or e.toward >= self.pos.len) continue;
Expand Down Expand Up @@ -484,7 +484,7 @@ pub const Field = struct {
}

// Which bodies were touching someone on the previous step. Cohesion skips them.
var crowded: [8]bool = .{false} ** 8;
var crowded: [8]bool = @splat(false);

var step: usize = 0;
while (step < relax_steps) : (step += 1) {
Expand Down Expand Up @@ -518,7 +518,7 @@ pub const Field = struct {
}

// separation — last, and it wins
crowded = .{false} ** 8;
crowded = @splat(false);
for (0..n) |i| {
for (i + 1..n) |j| {
var dx = p[j].x - p[i].x;
Expand Down Expand Up @@ -635,10 +635,10 @@ pub const Field = struct {
) void {
const n = kids.len;
const r_parent = self.estimatedRadius(lad, cell);
var p: [8]Vec2 = .{Vec2{ .x = 0, .y = 0 }} ** 8;
var sep_r: [8]f32 = .{0} ** 8;
var mass: [8]f32 = .{1} ** 8;
var sib_deg: [8]f32 = .{1} ** 8;
var p: [8]Vec2 = @splat(Vec2{ .x = 0, .y = 0 });
var sep_r: [8]f32 = @splat(0);
var mass: [8]f32 = @splat(1);
var sib_deg: [8]f32 = @splat(1);
for (kids, 0..) |k, i| {
sep_r[i] = self.separationRadius(lad, k);
mass[i] = 1 + lad.cells[k].weight + self.bodyMass(lad.cells[k].body);
Expand All @@ -649,8 +649,8 @@ pub const Field = struct {
sib_deg[sp.j] += sp.w;
}

var ext_dir: [8]Vec2 = .{Vec2{ .x = 0, .y = 0 }} ** 8;
var ext_mag: [8]f32 = .{0} ** 8;
var ext_dir: [8]Vec2 = @splat(Vec2{ .x = 0, .y = 0 });
var ext_mag: [8]f32 = @splat(0);
if (self.opts.ext_k != 0) {
for (lad.extOf(cell)) |e| {
if (e.child >= n or e.toward >= self.pos.len) continue;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/fold.zig
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub const Arity = enum(u8) {
seven = 7,

pub fn n(self: Arity) usize {
return @intFromEnum(self);
return @backingInt(self);
}
};

Expand Down
10 changes: 5 additions & 5 deletions src/ui/graph.zig
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ fn freeReuse(gpa: std.mem.Allocator, r: layout.Reuse) void {

const LayoutJob = struct {
arena: std.heap.ArenaAllocator,
phase: std.atomic.Value(u8) = .init(@intFromEnum(JobPhase.solving)),
phase: std.atomic.Value(u8) = .init(@backingInt(JobPhase.solving)),
/// Set by `shutdownPanel` so the worker can abandon a long build instead of making teardown
/// wait for it. The join itself is not optional — the worker is executing code inside a dylib
/// that is about to be unloaded — so the only way to make closing the app prompt is to give
Expand Down Expand Up @@ -662,7 +662,7 @@ const LayoutJob = struct {
// remaining hitch on a prose save.
return;
}
job.phase.store(@intFromEnum(JobPhase.building_map), .release);
job.phase.store(@backingInt(JobPhase.building_map), .release);
const gpa = sdk.allocator();
const a = job.arena.allocator();

Expand Down Expand Up @@ -999,7 +999,7 @@ pub const Panel = struct {

interior: Interior,

touches: [10]Touch = [_]Touch{.{}} ** 10,
touches: [10]Touch = @as([10]Touch, @splat(.{})),
gesture_active: bool = false,
last_centroid: dvui.Point.Physical = .{},
last_pinch: f32 = 0,
Expand Down Expand Up @@ -1387,7 +1387,7 @@ pub fn drawPanel(p: *Panel, st: anytype) !void {
// wait it reports.
if ((p.job != null or p.rebuild_waiting) and p.nodes.len == 0) {
const building_map = if (p.job) |j|
j.phase.load(.acquire) == @intFromEnum(JobPhase.building_map)
j.phase.load(.acquire) == @backingInt(JobPhase.building_map)
else
false;
if (building_map) {
Expand Down Expand Up @@ -6470,7 +6470,7 @@ fn updateTouchGesture(p: *Panel, pane: *dvui.WidgetData) void {
if (e.evt != .mouse) continue;
const me = e.evt.mouse;
if (!me.button.touch()) continue;
const slot_signed = @intFromEnum(me.button) - @intFromEnum(dvui.enums.Button.touch0);
const slot_signed = @backingInt(me.button) - @backingInt(dvui.enums.Button.touch0);
if (slot_signed < 0 or slot_signed >= p.touches.len) continue;
const slot: usize = @intCast(slot_signed);
const inside = pane.rectScale().r.contains(me.p);
Expand Down
Loading
Loading