Fix merge

This commit is contained in:
Jacob Sandlund
2025-09-23 09:54:09 -04:00
parent c2a9c5ee5b
commit b5c6c044a7
6 changed files with 48 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ pub fn init(b: *std.Build, uucode_tables: std.Build.LazyPath) !UnicodeTables {
const props_exe = b.addExecutable(.{ const props_exe = b.addExecutable(.{
.name = "props-unigen", .name = "props-unigen",
.root_module = b.createModule(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/unicode/props_ziglyph.zig"), .root_source_file = b.path("src/unicode/props_uucode.zig"),
.target = b.graph.host, .target = b.graph.host,
.strip = false, .strip = false,
.omit_frame_pointer = false, .omit_frame_pointer = false,
@@ -26,7 +26,7 @@ pub fn init(b: *std.Build, uucode_tables: std.Build.LazyPath) !UnicodeTables {
const symbols_exe = b.addExecutable(.{ const symbols_exe = b.addExecutable(.{
.name = "symbols-unigen", .name = "symbols-unigen",
.root_module = b.createModule(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/unicode/symbols_ziglyph.zig"), .root_source_file = b.path("src/unicode/symbols_uucode.zig"),
.target = b.graph.host, .target = b.graph.host,
.strip = false, .strip = false,
.omit_frame_pointer = false, .omit_frame_pointer = false,

View File

@@ -191,8 +191,8 @@ test {
_ = @import("simd/main.zig"); _ = @import("simd/main.zig");
_ = @import("synthetic/main.zig"); _ = @import("synthetic/main.zig");
_ = @import("unicode/main.zig"); _ = @import("unicode/main.zig");
_ = @import("unicode/props_ziglyph.zig"); _ = @import("unicode/props_uucode.zig");
_ = @import("unicode/symbols_ziglyph.zig"); _ = @import("unicode/symbols_uucode.zig");
// Extra // Extra
_ = @import("extra/bash.zig"); _ = @import("extra/bash.zig");

View File

@@ -8,7 +8,7 @@ pub const table = table: {
// build.zig process, but due to Zig's lazy analysis we can still reference // build.zig process, but due to Zig's lazy analysis we can still reference
// it here. // it here.
// //
// An example process is the `main` in `props_ziglyph.zig` // An example process is the `main` in `props_uucode.zig`
const generated = @import("unicode_tables").Tables(Properties); const generated = @import("unicode_tables").Tables(Properties);
const Tables = lut.Tables(Properties); const Tables = lut.Tables(Properties);
break :table Tables{ break :table Tables{

View File

@@ -55,7 +55,7 @@ pub fn get(cp: u21) Properties {
return .{ return .{
.width = width, .width = width,
.grapheme_boundary_class = .init(cp), .grapheme_boundary_class = graphemeBoundaryClass(cp),
}; };
} }

View File

@@ -7,7 +7,7 @@ pub const table = table: {
// build.zig process, but due to Zig's lazy analysis we can still reference // build.zig process, but due to Zig's lazy analysis we can still reference
// it here. // it here.
// //
// An example process is the `main` in `symbols_ziglyph.zig` // An example process is the `main` in `symbols_uucode.zig`
const generated = @import("symbols_tables").Tables(bool); const generated = @import("symbols_tables").Tables(bool);
const Tables = lut.Tables(bool); const Tables = lut.Tables(bool);
break :table Tables{ break :table Tables{

View File

@@ -0,0 +1,41 @@
const std = @import("std");
const uucode = @import("uucode");
const lut = @import("lut.zig");
/// Runnable binary to generate the lookup tables and output to stdout.
pub fn main() !void {
var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena_state.deinit();
const alloc = arena_state.allocator();
const gen: lut.Generator(
bool,
struct {
pub fn get(ctx: @This(), cp: u21) !bool {
_ = ctx;
return if (cp > uucode.config.max_code_point)
false
else
uucode.get(.is_symbol, @intCast(cp));
}
pub fn eql(ctx: @This(), a: bool, b: bool) bool {
_ = ctx;
return a == b;
}
},
) = .{};
const t = try gen.generate(alloc);
defer alloc.free(t.stage1);
defer alloc.free(t.stage2);
defer alloc.free(t.stage3);
try t.writeZig(std.io.getStdOut().writer());
// Uncomment when manually debugging to see our table sizes.
// std.log.warn("stage1={} stage2={} stage3={}", .{
// t.stage1.len,
// t.stage2.len,
// t.stage3.len,
// });
}