Registry: Base types

This commit is contained in:
Robin Voetter
2020-01-24 13:27:56 +01:00
parent d9976a4271
commit 51cb124feb

View File

@@ -121,7 +121,8 @@ const Definition = union(enum) {
Handle: HandleInfo, Handle: HandleInfo,
FnPtr: CommandInfo, FnPtr: CommandInfo,
Command: CommandInfo, Command: CommandInfo,
Alias: []const u8 Alias: []const u8,
BaseType: TypeInfo
}; };
const HandleInfo = struct { const HandleInfo = struct {
@@ -537,6 +538,8 @@ fn processTypes(registry: *Registry, root: *xml.Element) void {
processStructType(registry, ty); processStructType(registry, ty);
} else if (mem.eql(u8, category, "funcpointer")) { } else if (mem.eql(u8, category, "funcpointer")) {
processFuncPointerType(registry, ty); processFuncPointerType(registry, ty);
} else if (mem.eql(u8, category, "basetype")) {
processBaseType(registry, ty);
} }
} }
} }
@@ -596,6 +599,12 @@ fn processFuncPointerType(registry: *Registry, ty: *xml.Element) void {
registry.addDefinition(name, .{.FnPtr = cmd}); registry.addDefinition(name, .{.FnPtr = cmd});
} }
fn processBaseType(registry: *Registry, ty: *xml.Element) void {
const name = ty.getCharData("name").?;
const type_info = TypeInfo.fromXml(&registry.arena.allocator, ty);
registry.addDefinition(name, .{.BaseType = type_info});
}
fn processEnums(registry: *Registry, root: *xml.Element) void { fn processEnums(registry: *Registry, root: *xml.Element) void {
var it = root.findChildrenByTag("enums"); var it = root.findChildrenByTag("enums");
while (it.next()) |enums| { while (it.next()) |enums| {