forked from mirror/vulkan-zig
Rename TypeInfo members in snake case
This commit is contained in:
@@ -25,22 +25,22 @@ pub const Tag = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const TypeInfo = union(enum) {
|
pub const TypeInfo = union(enum) {
|
||||||
Struct: Container,
|
container: Container,
|
||||||
Union: Container,
|
enumeration: Enum,
|
||||||
Enum: Enum,
|
bitmask: Bitmask,
|
||||||
Bitmask: Bitmask,
|
handle: Handle,
|
||||||
Handle: Handle,
|
fn_ptr: Command,
|
||||||
FnPtr: Command,
|
command: Command,
|
||||||
Command: Command,
|
alias: []const u8, // Alias of another declaration
|
||||||
Alias: []const u8, // Alias of another declaration
|
pointer: Pointer,
|
||||||
Pointer: Pointer,
|
array: Array,
|
||||||
Array: Array,
|
opaque: void,
|
||||||
Opaque: void,
|
foreign: Foreign
|
||||||
Foreign: Foreign
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Container = struct {
|
pub const Container = struct {
|
||||||
fields: []Declaration,
|
fields: []Declaration,
|
||||||
|
is_union: bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Enum = struct {
|
pub const Enum = struct {
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ pub fn parseDeclaration(allocator: *Allocator, xctok: *XmlCTokenizer) !registry.
|
|||||||
if (tok.id != .type_name) return error.InvalidSyntax;
|
if (tok.id != .type_name) return error.InvalidSyntax;
|
||||||
const type_name = tok.text;
|
const type_name = tok.text;
|
||||||
|
|
||||||
var type_info = registry.TypeInfo{.Alias = type_name};
|
var type_info = registry.TypeInfo{.alias = type_name};
|
||||||
|
|
||||||
// Parse pointers
|
// Parse pointers
|
||||||
type_info = try parsePointers(allocator, xctok, inner_is_const, type_info);
|
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);
|
const child = try allocator.create(registry.TypeInfo);
|
||||||
child.* = type_info;
|
child.* = type_info;
|
||||||
type_info = .{
|
type_info = .{
|
||||||
.Array = .{
|
.array = .{
|
||||||
.size = array_size,
|
.size = array_size,
|
||||||
.child = child,
|
.child = child,
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ fn parsePointers(
|
|||||||
child.* = type_info;
|
child.* = type_info;
|
||||||
|
|
||||||
type_info = .{
|
type_info = .{
|
||||||
.Pointer = .{
|
.pointer = .{
|
||||||
.size = .one, // set elsewhere
|
.size = .one, // set elsewhere
|
||||||
.is_const = is_const or (first_const),
|
.is_const = is_const or (first_const),
|
||||||
.child = child,
|
.child = child,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ fn parseForeigntype(ty: *xml.Element) !registry.Declaration {
|
|||||||
|
|
||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = name,
|
.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;
|
const alias = ty.getAttribute("alias") orelse return error.InvalidRegistry;
|
||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = name,
|
.name = name,
|
||||||
.decl_type = .{.Alias = alias},
|
.decl_type = .{.alias = alias},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = ty.getCharData("name") orelse return error.InvalidRegistry,
|
.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;
|
const alias = ty.getAttribute("alias") orelse return error.InvalidRegistry;
|
||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = name,
|
.name = name,
|
||||||
.decl_type = .{.Alias = alias},
|
.decl_type = .{.alias = alias},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const name = ty.getCharData("name") orelse return error.InvalidRegistry;
|
const name = ty.getCharData("name") orelse return error.InvalidRegistry;
|
||||||
@@ -125,7 +125,7 @@ fn parseHandleType(ty: *xml.Element) !registry.Declaration {
|
|||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = name,
|
.name = name,
|
||||||
.decl_type = .{
|
.decl_type = .{
|
||||||
.Handle = .{
|
.handle = .{
|
||||||
.parent = ty.getAttribute("parent"),
|
.parent = ty.getAttribute("parent"),
|
||||||
.is_dispatchable = dispatchable,
|
.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.
|
// macros, which is why this part is not built into the xml/c parser.
|
||||||
return registry.Declaration{
|
return registry.Declaration{
|
||||||
.name = name,
|
.name = name,
|
||||||
.decl_type = .{.Opaque = {}},
|
.decl_type = .{.opaque = {}},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ fn parseEnums(allocator: *Allocator, out: []registry.Declaration, root: *xml.Ele
|
|||||||
|
|
||||||
out[i] = .{
|
out[i] = .{
|
||||||
.name = name,
|
.name = name,
|
||||||
.decl_type = .{.Enum = try parseEnumFields(allocator, enums)},
|
.decl_type = .{.enumeration = try parseEnumFields(allocator, enums)},
|
||||||
};
|
};
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user