Updates Zig
This commit is contained in:
parent
e114e2fbf1
commit
9e1c11e373
2 changed files with 6 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
.{
|
.{
|
||||||
.name = "dear_imgui_zig",
|
.name = "dear_imgui_zig",
|
||||||
.version = "0.0.0",
|
.version = "0.0.0",
|
||||||
|
.minimum_zig_version = "0.14.0-dev.1820+ea527f7a8",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.@"dear-imgui" = .{
|
.@"dear-imgui" = .{
|
||||||
.url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.91.0-docking.tar.gz",
|
.url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.91.0-docking.tar.gz",
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ fn getDeclarations(allocator: Allocator, header: *const Header) !Declarations {
|
||||||
} else if (ty.kind == .@"struct") {
|
} else if (ty.kind == .@"struct") {
|
||||||
for (ty.fields) |field| if (field.width != null) {
|
for (ty.fields) |field| if (field.width != null) {
|
||||||
// Treat packed structs as opaque.
|
// Treat packed structs as opaque.
|
||||||
//
|
//
|
||||||
// We *could* write out the Zig code to pack them by passing the widths in when
|
// We *could* write out the Zig code to pack them by passing the widths in when
|
||||||
// writing the type (and overwriting number types with the actual width, asserting
|
// writing the type (and overwriting number types with the actual width, asserting
|
||||||
// otherwise.)
|
// otherwise.)
|
||||||
|
|
@ -432,8 +432,8 @@ fn writeEnums(allocator: Allocator, writer: anytype, header: *const Header) !voi
|
||||||
|
|
||||||
fn writeFlagsEnum(writer: anytype, e: Header.Enum) !void {
|
fn writeFlagsEnum(writer: anytype, e: Header.Enum) !void {
|
||||||
const backing, const backing_bits = switch (e.storage_type.declaration) {
|
const backing, const backing_bits = switch (e.storage_type.declaration) {
|
||||||
.int => .{"c_int", @typeInfo(c_int).Int.bits},
|
.int => .{ "c_int", @typeInfo(c_int).int.bits },
|
||||||
.ImU8 => .{"u8", 8},
|
.ImU8 => .{ "u8", 8 },
|
||||||
};
|
};
|
||||||
try writer.print("packed struct({s}) {{\n", .{backing});
|
try writer.print("packed struct({s}) {{\n", .{backing});
|
||||||
var current_offset: usize = 0;
|
var current_offset: usize = 0;
|
||||||
|
|
@ -577,7 +577,7 @@ fn writeStructs(
|
||||||
const method_names = methods.types.getPtr(ty.name).?;
|
const method_names = methods.types.getPtr(ty.name).?;
|
||||||
for (method_names.items) |name| {
|
for (method_names.items) |name| {
|
||||||
try writer.writeAll(" pub const ");
|
try writer.writeAll(" pub const ");
|
||||||
try writeFunctionName(writer, name[ty.name.len + 1..]);
|
try writeFunctionName(writer, name[ty.name.len + 1 ..]);
|
||||||
try writer.print(" = {s};\n", .{name});
|
try writer.print(" = {s};\n", .{name});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -588,7 +588,7 @@ fn writeStructs(
|
||||||
fn writeHelpers(writer: anytype) !void {
|
fn writeHelpers(writer: anytype) !void {
|
||||||
try writer.writeAll(
|
try writer.writeAll(
|
||||||
\\fn toUsize(v: anytype) usize {
|
\\fn toUsize(v: anytype) usize {
|
||||||
\\ if (@typeInfo(@TypeOf(v)) == .Enum) return @intFromEnum(v);
|
\\ if (@typeInfo(@TypeOf(v)) == .@"enum") return @intFromEnum(v);
|
||||||
\\ return @intCast(v);
|
\\ return @intCast(v);
|
||||||
\\}
|
\\}
|
||||||
\\
|
\\
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue