summaryrefslogtreecommitdiff
path: root/codegen/props.zig
diff options
context:
space:
mode:
authorGravatar Sam Atman2026-02-04 18:36:18 -0500
committerGravatar Sam Atman2026-02-04 18:36:18 -0500
commite476250ea9326b2550847b301c265115ff375a31 (patch)
treecf627ced47cecce80020b7a1f30aa51852c0c59b /codegen/props.zig
parentNormalization and case folding (diff)
downloadzg-e476250ea9326b2550847b301c265115ff375a31.tar.gz
zg-e476250ea9326b2550847b301c265115ff375a31.tar.xz
zg-e476250ea9326b2550847b301c265115ff375a31.zip
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.
Diffstat (limited to 'codegen/props.zig')
-rw-r--r--codegen/props.zig23
1 files changed, 18 insertions, 5 deletions
diff --git a/codegen/props.zig b/codegen/props.zig
index 35c7dfb..ebd5116 100644
--- a/codegen/props.zig
+++ b/codegen/props.zig
@@ -123,11 +123,24 @@ pub fn main() anyerror!void {
123 defer out_file.close(); 123 defer out_file.close();
124 var writer = out_file.writer(&write_buf); 124 var writer = out_file.writer(&write_buf);
125 125
126 const endian = builtin.cpu.arch.endian(); 126 try writer.interface.print(
127 try writer.interface.writeInt(u16, @intCast(stage1.items.len), endian); 127 \\//! This file is auto-generated. Do not edit.
128 for (stage1.items) |i| try writer.interface.writeInt(u16, i, endian); 128 \\
129 \\pub const s1: [{}]u16 = .{{
130 , .{stage1.items.len});
131 for (stage1.items) |entry| try writer.interface.print("{}, ", .{entry});
132
133 try writer.interface.print(
134 \\
135 \\}};
136 \\
137 \\pub const s2: [{}]u8 = .{{
138 , .{stage2.items.len});
139 for (stage2.items) |entry| try writer.interface.print("{}, ", .{entry});
140
141 try writer.interface.writeAll(
142 \\};
143 );
129 144
130 try writer.interface.writeInt(u16, @intCast(stage2.items.len), endian);
131 try writer.interface.writeAll(stage2.items);
132 try writer.interface.flush(); 145 try writer.interface.flush();
133} 146}