authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-07 20:50:11 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-07 20:50:11 -07:00
log0b8ecc8d7a29012845ad62e13be3d0db294fb3b4
tree8454871d0da847e6519654026831c2f88f88fc7e
parentaec4e3409674faa31562989f0cbc98f3e74e3960
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

update to zig 0.16.0


3 files changed, 20 insertions(+), 25 deletions(-)

README.md+1-1
...@@ -3,7 +3,7 @@...@@ -3,7 +3,7 @@
3![loc](https://sloc.xyz/github/nektro/zig-unicode-ucd)3![loc](https://sloc.xyz/github/nektro/zig-unicode-ucd)
4[![license](https://img.shields.io/github/license/nektro/zig-unicode-ucd.svg)](https://github.com/nektro/zig-unicode-ucd/blob/master/LICENSE)4[![license](https://img.shields.io/github/license/nektro/zig-unicode-ucd.svg)](https://github.com/nektro/zig-unicode-ucd/blob/master/LICENSE)
5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)5[![nektro @ github sponsors](https://img.shields.io/badge/sponsors-nektro-purple?logo=github)](https://github.com/sponsors/nektro)
6[![Zig](https://img.shields.io/badge/Zig-0.14-f7a41d)](https://ziglang.org/)6[![Zig](https://img.shields.io/badge/Zig-0.16-f7a41d)](https://ziglang.org/)
7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)7[![Zigmod](https://img.shields.io/badge/Zigmod-latest-f7a41d)](https://github.com/nektro/zigmod)
88
9Zig bindings for the Unicode Character Database9Zig bindings for the Unicode Character Database
src/lib.zig+13-23
...@@ -50,39 +50,29 @@ pub const LineBreak = DerivedPropertyEnum("lb");...@@ -50,39 +50,29 @@ pub const LineBreak = DerivedPropertyEnum("lb");
50pub const IndicPositionalCategory = DerivedPropertyEnum("InPC");50pub const IndicPositionalCategory = DerivedPropertyEnum("InPC");
5151
52fn DerivedPropertyEnum(comptime prop: []const u8) type {52fn DerivedPropertyEnum(comptime prop: []const u8) type {
53 var fields: []const std.builtin.Type.EnumField = &.{};53 var len: usize = 0;
54 var names: []const []const u8 = &.{};
54 @setEvalBranchQuota(10_000);55 @setEvalBranchQuota(10_000);
55 for (property_value_aliases.data) |item| {56 for (property_value_aliases.data) |item| {
56 if (std.mem.eql(u8, item[0], prop)) {57 if (std.mem.eql(u8, item[0], prop)) {
57 fields = fields ++ &[_]std.builtin.Type.EnumField{.{58 len += 1;
58 .name = item[1],59 names = names ++ &[_][]const u8{item[1]};
59 .value = fields.len,
60 }};
61 }60 }
62 }61 }
63 return @Type(.{ .@"enum" = .{62 const Tag = std.math.IntFittingRange(0, names.len - 1);
64 .tag_type = std.math.IntFittingRange(0, fields.len - 1),63 return @Enum(Tag, .exhaustive, names, &std.simd.iota(Tag, names.len));
65 .fields = fields,
66 .decls = &.{},
67 .is_exhaustive = true,
68 } });
69}64}
7065
71fn DerivedPropertyLongEnum(comptime prop: []const u8) type {66fn DerivedPropertyLongEnum(comptime prop: []const u8) type {
72 var fields: []const std.builtin.Type.EnumField = &.{};67 var len: usize = 0;
68 var names: []const []const u8 = &.{};
73 @setEvalBranchQuota(10_000);69 @setEvalBranchQuota(10_000);
74 for (property_value_aliases.data) |item| {70 for (property_value_aliases.data) |item| {
75 if (!std.mem.eql(u8, item[0], prop)) continue;71 if (!std.mem.eql(u8, item[0], prop)) continue;
76 if (fields.len > 0 and std.mem.eql(u8, fields[fields.len - 1].name, item[2])) continue;72 if (len > 0 and std.mem.eql(u8, names[len - 1], item[2])) continue;
77 fields = fields ++ &[_]std.builtin.Type.EnumField{.{73 len += 1;
78 .name = item[2],74 names = names ++ &[_][]const u8{item[2]};
79 .value = fields.len,
80 }};
81 }75 }
82 return @Type(.{ .@"enum" = .{76 const Tag = std.math.IntFittingRange(0, names.len - 1);
83 .tag_type = std.math.IntFittingRange(0, fields.len - 1),77 return @Enum(Tag, .exhaustive, names, &std.simd.iota(Tag, names.len));
84 .fields = fields,
85 .decls = &.{},
86 .is_exhaustive = true,
87 } });
88}78}
test.zig+6-1
...@@ -11,7 +11,12 @@ test {...@@ -11,7 +11,12 @@ test {
11 _ = &ucd.composition_exclusions.data;11 _ = &ucd.composition_exclusions.data;
12 _ = &ucd.derived_age.data;12 _ = &ucd.derived_age.data;
13 _ = &ucd.derived_core_properties.data;13 _ = &ucd.derived_core_properties.data;
14 std.testing.refAllDeclsRecursive(ucd.derived_normalization_props);14 inline for (@typeInfo(ucd.derived_normalization_props).@"struct".decls) |d| {
15 const f = @field(ucd.derived_normalization_props, d.name);
16 if (@typeInfo(f).@"struct".decls.len == 0) _ = &f;
17 if (@typeInfo(f).@"struct".decls.len > 0) _ = &f.data;
18 if (@typeInfo(f).@"struct".decls.len > 0) _ = &f.data_range;
19 }
15 _ = &ucd.east_asian_width.data;20 _ = &ucd.east_asian_width.data;
16 _ = &ucd.emoji_sources.data;21 _ = &ucd.emoji_sources.data;
17 _ = &ucd.equivalent_unified_ideograph.data;22 _ = &ucd.equivalent_unified_ideograph.data;