summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar Sam Atman2024-12-13 15:14:15 -0500
committerGravatar Sam Atman2025-03-20 20:17:07 -0400
commitf37875c6c4e42055735f1cda9fdbcb7ab11b80bc (patch)
treec889b4287d9d6d7db4fca9fda475c9fd90b33adc /build.zig
parentUpdate LICENSE, add CONTRIBUTORS.md (diff)
downloadzg-f37875c6c4e42055735f1cda9fdbcb7ab11b80bc.tar.gz
zg-f37875c6c4e42055735f1cda9fdbcb7ab11b80bc.tar.xz
zg-f37875c6c4e42055735f1cda9fdbcb7ab11b80bc.zip
Add c0 and c1 control width options
This allows a build of DisplayWidth to give characters in those classes a width, for cases where they'll be printed with a substitute in the final display. It also raises the size of possible characters from an i3 to an i4, to accommodate printing C1s as e.g. <80> or \u{80}.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig17
1 files changed, 16 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index 4c4a35a..ce362ea 100644
--- a/build.zig
+++ b/build.zig
@@ -16,10 +16,24 @@ pub fn build(b: *std.Build) void {
16 const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z"); 16 const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z");
17 17
18 // Display width 18 // Display width
19 const cjk = b.option(bool, "cjk", "Ambiguouse code points are wide (display width: 2).") orelse false; 19 const cjk = b.option(bool, "cjk", "Ambiguous code points are wide (display width: 2).") orelse false;
20 const options = b.addOptions(); 20 const options = b.addOptions();
21 options.addOption(bool, "cjk", cjk); 21 options.addOption(bool, "cjk", cjk);
22 22
23 // Visible Controls
24 const c0_width = b.option(
25 i4,
26 "c0_width",
27 "C0 controls have this width (default: 0, <BS> <Del> default -1)",
28 );
29 options.addOption(?i4, "c0_width", c0_width);
30 const c1_width = b.option(
31 i4,
32 "c1_width",
33 "C1 controls have this width (default: 0)",
34 );
35 options.addOption(?i4, "c1_width", c1_width);
36
23 const dwp_gen_exe = b.addExecutable(.{ 37 const dwp_gen_exe = b.addExecutable(.{
24 .name = "dwp", 38 .name = "dwp",
25 .root_source_file = b.path("codegen/dwp.zig"), 39 .root_source_file = b.path("codegen/dwp.zig"),
@@ -210,6 +224,7 @@ pub fn build(b: *std.Build) void {
210 display_width.addImport("code_point", code_point); 224 display_width.addImport("code_point", code_point);
211 display_width.addImport("grapheme", grapheme); 225 display_width.addImport("grapheme", grapheme);
212 display_width.addImport("DisplayWidthData", width_data); 226 display_width.addImport("DisplayWidthData", width_data);
227 display_width.addOptions("options", options); // For testing
213 228
214 // Normalization 229 // Normalization
215 const ccc_data = b.createModule(.{ 230 const ccc_data = b.createModule(.{