From e476250ea9326b2550847b301c265115ff375a31 Mon Sep 17 00:00:00 2001 From: Sam Atman Date: Wed, 4 Feb 2026 18:36:18 -0500 Subject: Rest of the 'easy' stuff This gets us up to feature parity with Jacob's work. I want to eliminate that last allocation using the comptime hash map, and then see about eliminating allocations from case comparisons as well. That should just about do it. --- build.zig | 57 +++++++++++++++------------------------------------------ 1 file changed, 15 insertions(+), 42 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index fa8c490..be91f50 100644 --- a/build.zig +++ b/build.zig @@ -151,7 +151,7 @@ pub fn build(b: *std.Build) void { }); gencat_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") }); const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); - const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z"); + const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.zig"); const fold_gen_exe = b.addExecutable(.{ .name = "fold", @@ -177,47 +177,21 @@ pub fn build(b: *std.Build) void { }); num_gen_exe.root_module.addAnonymousImport("DerivedNumericType.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedNumericType.txt") }); const run_num_gen_exe = b.addRunArtifact(num_gen_exe); - const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); + const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.zig"); - // Letter case properties - const case_prop_gen_exe = b.addExecutable(.{ - .name = "case_prop", + // Case mappings + const case_gen_exe = b.addExecutable(.{ + .name = "case", .root_module = b.createModule(.{ - .root_source_file = b.path("codegen/case_prop.zig"), + .root_source_file = b.path("codegen/case.zig"), .target = b.graph.host, .optimize = .Debug, }), }); - case_prop_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); - const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); - const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); - - // Uppercase mappings - const upper_gen_exe = b.addExecutable(.{ - .name = "upper", - .root_module = b.createModule(.{ - .root_source_file = b.path("codegen/upper.zig"), - .target = b.graph.host, - .optimize = .Debug, - }), - }); - upper_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); - const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); - const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); - - // Lowercase mappings - const lower_gen_exe = b.addExecutable(.{ - .name = "lower", - .root_module = b.createModule(.{ - .root_source_file = b.path("codegen/lower.zig"), - .target = b.graph.host, - .optimize = .Debug, - }), - }); - lower_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); - const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); - const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); + case_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); + const run_case_gen_exe = b.addRunArtifact(case_gen_exe); + const case_gen_out = run_case_gen_exe.addOutputFileArg("case.zig"); const scripts_gen_exe = b.addExecutable(.{ .name = "scripts", .root_module = b.createModule(.{ @@ -226,9 +200,10 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + scripts_gen_exe.root_module.addAnonymousImport("Scripts.txt", .{ .root_source_file = b.path("data/unicode/Scripts.txt") }); const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); - const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z"); + const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.zig"); const core_gen_exe = b.addExecutable(.{ .name = "core", @@ -240,7 +215,7 @@ pub fn build(b: *std.Build) void { }); core_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); const run_core_gen_exe = b.addRunArtifact(core_gen_exe); - const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z"); + const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.zig"); const props_gen_exe = b.addExecutable(.{ .name = "props", @@ -253,7 +228,7 @@ pub fn build(b: *std.Build) void { props_gen_exe.root_module.addAnonymousImport("PropList.txt", .{ .root_source_file = b.path("data/unicode/PropList.txt") }); const run_props_gen_exe = b.addRunArtifact(props_gen_exe); - const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z"); + const props_gen_out = run_props_gen_exe.addOutputFileArg("props.zig"); // Modules we provide @@ -457,9 +432,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); letter_case.addImport("code_point", code_point); - letter_case.addAnonymousImport("case_prop", .{ .root_source_file = case_prop_gen_out }); - letter_case.addAnonymousImport("upper", .{ .root_source_file = upper_gen_out }); - letter_case.addAnonymousImport("lower", .{ .root_source_file = lower_gen_out }); + letter_case.addAnonymousImport("case", .{ .root_source_file = case_gen_out }); const letter_case_t = b.addTest(.{ .name = "lettercase", @@ -473,7 +446,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); - scripts.addAnonymousImport("scripts", .{ .root_source_file = scripts_gen_out }); + scripts.addAnonymousImport("script", .{ .root_source_file = scripts_gen_out }); const scripts_t = b.addTest(.{ .name = "scripts", -- cgit v1.2.3