1
0
forked from mirror/vulkan-zig

Make registry generation a member function

This commit is contained in:
Robin Voetter
2020-01-24 15:14:52 +01:00
parent b093f6b61e
commit b5d71079e8
2 changed files with 16 additions and 17 deletions

View File

@@ -38,6 +38,20 @@ pub const Registry = struct {
return registry;
}
pub fn fromXml(allocator: *Allocator, root: *xml.Element) *Registry {
std.debug.assert(mem.eql(u8, root.tag, "registry"));
var registry = Registry.init(allocator) catch unreachable;
processTypes(registry, root);
processEnums(registry, root);
processCommands(registry, root);
processFeatures(registry, root);
processExtensions(registry, root);
return registry;
}
fn deinit(self: Registry) void {
self.declarations_by_name.deinit();
@@ -517,20 +531,6 @@ const EnumInfo = struct {
}
};
pub fn generate(backing_allocator: *Allocator, root: *xml.Element) *Registry {
std.debug.assert(mem.eql(u8, root.tag, "registry"));
var registry = Registry.init(backing_allocator) catch unreachable;
processTypes(registry, root);
processEnums(registry, root);
processCommands(registry, root);
processFeatures(registry, root);
processExtensions(registry, root);
return registry;
}
fn processTypes(registry: *Registry, root: *xml.Element) void {
var types = root.findChildByTag("types").?;
var it = types.findChildrenByTag("type");