diff options
| author | 2025-09-14 04:11:09 -0700 | |
|---|---|---|
| committer | 2025-09-14 04:11:09 -0700 | |
| commit | 749197a3f9d25e211615960c02380a3d659b20f9 (patch) | |
| tree | 9c892349f0a7136edb150f27f549dc182f7699bb /codegen/props.zig | |
| parent | Update codebase to Zig 0.15.1. (diff) | |
| download | zg-749197a3f9d25e211615960c02380a3d659b20f9.tar.gz zg-749197a3f9d25e211615960c02380a3d659b20f9.tar.xz zg-749197a3f9d25e211615960c02380a3d659b20f9.zip | |
Embed data files in scripts rather than relying on filesystem access for easier packaging
Diffstat (limited to 'codegen/props.zig')
| -rw-r--r-- | codegen/props.zig | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/codegen/props.zig b/codegen/props.zig index 6ff0a33..ca42987 100644 --- a/codegen/props.zig +++ b/codegen/props.zig | |||
| @@ -30,14 +30,9 @@ pub fn main() anyerror!void { | |||
| 30 | var flat_map = std.AutoHashMap(u21, u8).init(allocator); | 30 | var flat_map = std.AutoHashMap(u21, u8).init(allocator); |
| 31 | defer flat_map.deinit(); | 31 | defer flat_map.deinit(); |
| 32 | 32 | ||
| 33 | var line_buf: [4096]u8 = undefined; | ||
| 34 | |||
| 35 | // Process PropList.txt | 33 | // Process PropList.txt |
| 36 | var in_file = try std.fs.cwd().openFile("data/unicode/PropList.txt", .{}); | 34 | var in_reader = std.io.Reader.fixed(@embedFile("PropList.txt")); |
| 37 | defer in_file.close(); | 35 | while (in_reader.takeDelimiterExclusive('\n')) |line| { |
| 38 | var in_reader = in_file.reader(&line_buf); | ||
| 39 | |||
| 40 | while (in_reader.interface.takeDelimiterExclusive('\n')) |line| { | ||
| 41 | if (line.len == 0 or line[0] == '#') continue; | 36 | if (line.len == 0 or line[0] == '#') continue; |
| 42 | const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; | 37 | const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; |
| 43 | 38 | ||