forked from mirror/vulkan-zig
Update to new opaque syntax
This commit is contained in:
@@ -152,7 +152,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 = .{.external = {}},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub const DeclarationType = union(enum) {
|
|||||||
alias: Alias,
|
alias: Alias,
|
||||||
foreign: Foreign,
|
foreign: Foreign,
|
||||||
typedef: TypeInfo,
|
typedef: TypeInfo,
|
||||||
opaque,
|
external,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const Alias = struct {
|
pub const Alias = struct {
|
||||||
|
|||||||
@@ -81,20 +81,20 @@ const builtin_types = std.ComptimeStringMap([]const u8, .{
|
|||||||
});
|
});
|
||||||
|
|
||||||
const foreign_types = std.ComptimeStringMap([]const u8, .{
|
const foreign_types = std.ComptimeStringMap([]const u8, .{
|
||||||
.{"Display", "@Type(.Opaque)"},
|
.{"Display", "opaque {}"},
|
||||||
.{"VisualID", @typeName(c_uint)},
|
.{"VisualID", @typeName(c_uint)},
|
||||||
.{"Window", @typeName(c_ulong)},
|
.{"Window", @typeName(c_ulong)},
|
||||||
.{"RROutput", @typeName(c_ulong)},
|
.{"RROutput", @typeName(c_ulong)},
|
||||||
.{"wl_display", "@Type(.Opaque)"},
|
.{"wl_display", "opaque {}"},
|
||||||
.{"wl_surface", "@Type(.Opaque)"},
|
.{"wl_surface", "opaque {}"},
|
||||||
.{"HINSTANCE", "std.os.HINSTANCE"},
|
.{"HINSTANCE", "std.os.HINSTANCE"},
|
||||||
.{"HWND", "*@Type(.Opaque)"},
|
.{"HWND", "*opaque {}"},
|
||||||
.{"HMONITOR", "*@Type(.Opaque)"},
|
.{"HMONITOR", "*opaque {}"},
|
||||||
.{"HANDLE", "std.os.HANDLE"},
|
.{"HANDLE", "std.os.HANDLE"},
|
||||||
.{"SECURITY_ATTRIBUTES", "std.os.SECURITY_ATTRIBUTES"},
|
.{"SECURITY_ATTRIBUTES", "std.os.SECURITY_ATTRIBUTES"},
|
||||||
.{"DWORD", "std.os.DWORD"},
|
.{"DWORD", "std.os.DWORD"},
|
||||||
.{"LPCWSTR", "std.os.LPCWSTR"},
|
.{"LPCWSTR", "std.os.LPCWSTR"},
|
||||||
.{"xcb_connection_t", "@Type(.Opaque)"},
|
.{"xcb_connection_t", "opaque {}"},
|
||||||
.{"xcb_visualid_t", @typeName(u32)},
|
.{"xcb_visualid_t", @typeName(u32)},
|
||||||
.{"xcb_window_t", @typeName(u32)},
|
.{"xcb_window_t", @typeName(u32)},
|
||||||
.{"zx_handle_t", @typeName(u32)},
|
.{"zx_handle_t", @typeName(u32)},
|
||||||
@@ -536,7 +536,7 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
.alias => |alias| try self.renderAlias(decl.name, alias),
|
.alias => |alias| try self.renderAlias(decl.name, alias),
|
||||||
.foreign => |foreign| try self.renderForeign(decl.name, foreign),
|
.foreign => |foreign| try self.renderForeign(decl.name, foreign),
|
||||||
.typedef => |type_info| try self.renderTypedef(decl.name, type_info),
|
.typedef => |type_info| try self.renderTypedef(decl.name, type_info),
|
||||||
.opaque => try self.renderOpaque(decl.name),
|
.external => try self.renderExternal(decl.name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,10 +711,10 @@ fn Renderer(comptime WriterType: type) type {
|
|||||||
try self.writer.writeAll(";\n");
|
try self.writer.writeAll(";\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn renderOpaque(self: *Self, name: []const u8) !void {
|
fn renderExternal(self: *Self, name: []const u8) !void {
|
||||||
try self.writer.writeAll("pub const ");
|
try self.writer.writeAll("pub const ");
|
||||||
try self.renderName(name);
|
try self.renderName(name);
|
||||||
try self.writer.writeAll(" = @Type(.Opaque);\n");
|
try self.writer.writeAll(" = opaque {};\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn renderForeign(self: *Self, name: []const u8, foreign: reg.Foreign) !void {
|
fn renderForeign(self: *Self, name: []const u8, foreign: reg.Foreign) !void {
|
||||||
|
|||||||
Reference in New Issue
Block a user