diff --git a/generator/registry-new.zig b/generator/registry-new.zig index 200b841..32363ac 100644 --- a/generator/registry-new.zig +++ b/generator/registry-new.zig @@ -25,22 +25,22 @@ pub const Tag = struct { }; pub const TypeInfo = union(enum) { - Struct: Container, - Union: Container, - Enum: Enum, - Bitmask: Bitmask, - Handle: Handle, - FnPtr: Command, - Command: Command, - Alias: []const u8, // Alias of another declaration - Pointer: Pointer, - Array: Array, - Opaque: void, - Foreign: Foreign + container: Container, + enumeration: Enum, + bitmask: Bitmask, + handle: Handle, + fn_ptr: Command, + command: Command, + alias: []const u8, // Alias of another declaration + pointer: Pointer, + array: Array, + opaque: void, + foreign: Foreign }; pub const Container = struct { fields: []Declaration, + is_union: bool, }; pub const Enum = struct { diff --git a/generator/spec-c-parse.zig b/generator/spec-c-parse.zig index 551c47d..7b1b98c 100644 --- a/generator/spec-c-parse.zig +++ b/generator/spec-c-parse.zig @@ -241,7 +241,7 @@ pub fn parseDeclaration(allocator: *Allocator, xctok: *XmlCTokenizer) !registry. if (tok.id != .type_name) return error.InvalidSyntax; const type_name = tok.text; - var type_info = registry.TypeInfo{.Alias = type_name}; + var type_info = registry.TypeInfo{.alias = type_name}; // Parse pointers type_info = try parsePointers(allocator, xctok, inner_is_const, type_info); @@ -260,7 +260,7 @@ pub fn parseDeclaration(allocator: *Allocator, xctok: *XmlCTokenizer) !registry. const child = try allocator.create(registry.TypeInfo); child.* = type_info; type_info = .{ - .Array = .{ + .array = .{ .size = array_size, .child = child, } @@ -305,7 +305,7 @@ fn parsePointers( child.* = type_info; type_info = .{ - .Pointer = .{ + .pointer = .{ .size = .one, // set elsewhere .is_const = is_const or (first_const), .child = child, diff --git a/generator/spec-parse.zig b/generator/spec-parse.zig index 6837e25..0b324ab 100644 --- a/generator/spec-parse.zig +++ b/generator/spec-parse.zig @@ -87,7 +87,7 @@ fn parseForeigntype(ty: *xml.Element) !registry.Declaration { return registry.Declaration{ .name = name, - .decl_type = .{.Foreign = .{.dependency = dependency}}, + .decl_type = .{.foreign = .{.dependency = dependency}}, }; } @@ -96,12 +96,12 @@ fn parseBitmaskType(ty: *xml.Element) !registry.Declaration { const alias = ty.getAttribute("alias") orelse return error.InvalidRegistry; return registry.Declaration{ .name = name, - .decl_type = .{.Alias = alias}, + .decl_type = .{.alias = alias}, }; } else { return registry.Declaration{ .name = ty.getCharData("name") orelse return error.InvalidRegistry, - .decl_type = .{.Bitmask = .{.bits_enum = ty.getAttribute("requires")}}, + .decl_type = .{.bitmask = .{.bits_enum = ty.getAttribute("requires")}}, }; } } @@ -112,7 +112,7 @@ fn parseHandleType(ty: *xml.Element) !registry.Declaration { const alias = ty.getAttribute("alias") orelse return error.InvalidRegistry; return registry.Declaration{ .name = name, - .decl_type = .{.Alias = alias}, + .decl_type = .{.alias = alias}, }; } else { const name = ty.getCharData("name") orelse return error.InvalidRegistry; @@ -125,7 +125,7 @@ fn parseHandleType(ty: *xml.Element) !registry.Declaration { return registry.Declaration{ .name = name, .decl_type = .{ - .Handle = .{ + .handle = .{ .parent = ty.getAttribute("parent"), .is_dispatchable = dispatchable, } @@ -144,7 +144,7 @@ fn parseBaseType(allocator: *Allocator, ty: *xml.Element) !registry.Declaration // macros, which is why this part is not built into the xml/c parser. return registry.Declaration{ .name = name, - .decl_type = .{.Opaque = {}}, + .decl_type = .{.opaque = {}}, }; } } @@ -160,7 +160,7 @@ fn parseEnums(allocator: *Allocator, out: []registry.Declaration, root: *xml.Ele out[i] = .{ .name = name, - .decl_type = .{.Enum = try parseEnumFields(allocator, enums)}, + .decl_type = .{.enumeration = try parseEnumFields(allocator, enums)}, }; i += 1; }