Updates Zig
This commit is contained in:
parent
a43288f0f1
commit
241b2ee6a4
2 changed files with 22 additions and 11 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
.name = .dear_imgui,
|
.name = .dear_imgui,
|
||||||
.fingerprint = 0xc1cc609af54040bd,
|
.fingerprint = 0xc1cc609af54040bd,
|
||||||
.version = "1.0.0",
|
.version = "1.0.0",
|
||||||
.minimum_zig_version = "0.15.1",
|
.minimum_zig_version = "0.16.0-dev.1484+d0ba6642b",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.@"dear-imgui" = .{
|
.@"dear-imgui" = .{
|
||||||
.url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.92.2b-docking.tar.gz",
|
.url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.92.2b-docking.tar.gz",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
|
const Io = std.Io;
|
||||||
|
const Dir = Io.Dir;
|
||||||
|
|
||||||
const DeclarationKind = enum {
|
const DeclarationKind = enum {
|
||||||
normal,
|
normal,
|
||||||
|
|
@ -180,6 +182,9 @@ pub fn main() !void {
|
||||||
defer std.debug.assert(gpa.deinit() == .ok);
|
defer std.debug.assert(gpa.deinit() == .ok);
|
||||||
const allocator = gpa.allocator();
|
const allocator = gpa.allocator();
|
||||||
|
|
||||||
|
var threaded_io: Io.Threaded = .init_single_threaded;
|
||||||
|
const io = threaded_io.io();
|
||||||
|
|
||||||
var args = try std.process.argsWithAllocator(allocator);
|
var args = try std.process.argsWithAllocator(allocator);
|
||||||
defer args.deinit();
|
defer args.deinit();
|
||||||
std.debug.assert(args.skip());
|
std.debug.assert(args.skip());
|
||||||
|
|
@ -198,9 +203,12 @@ pub fn main() !void {
|
||||||
|
|
||||||
// Write the prefix
|
// Write the prefix
|
||||||
if (prefix_path) |p| {
|
if (prefix_path) |p| {
|
||||||
const prefix_source = try std.fs.cwd().readFileAlloc(allocator, p, max_size);
|
const file = try Dir.cwd().openFile(io, p, .{});
|
||||||
defer allocator.free(prefix_source);
|
defer file.close(io);
|
||||||
try writer.writeAll(prefix_source);
|
var buf: [4096]u8 = undefined;
|
||||||
|
var file_reader = file.readerStreaming(io, &buf);
|
||||||
|
var reader = &file_reader.interface;
|
||||||
|
_ = try reader.streamRemaining(writer);
|
||||||
try writer.writeAll("\n// End of prefix\n\n");
|
try writer.writeAll("\n// End of prefix\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +217,7 @@ pub fn main() !void {
|
||||||
defer symbols.deinit();
|
defer symbols.deinit();
|
||||||
|
|
||||||
// Write the source
|
// Write the source
|
||||||
const main_source = try std.fs.cwd().readFileAlloc(allocator, in_path, max_size);
|
const main_source = try std.fs.cwd().readFileAlloc(in_path, allocator, .limited(max_size));
|
||||||
defer allocator.free(main_source);
|
defer allocator.free(main_source);
|
||||||
try writeSource(
|
try writeSource(
|
||||||
allocator,
|
allocator,
|
||||||
|
|
@ -222,7 +230,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
// Write the internal source, if supplied
|
// Write the internal source, if supplied
|
||||||
if (internal_path) |p| {
|
if (internal_path) |p| {
|
||||||
const internal_source = try std.fs.cwd().readFileAlloc(allocator, p, max_size);
|
const internal_source = try std.fs.cwd().readFileAlloc(p, allocator, .limited(max_size));
|
||||||
defer allocator.free(internal_source);
|
defer allocator.free(internal_source);
|
||||||
|
|
||||||
try writer.writeAll("pub const internal = struct {\n");
|
try writer.writeAll("pub const internal = struct {\n");
|
||||||
|
|
@ -238,10 +246,13 @@ pub fn main() !void {
|
||||||
|
|
||||||
// Write the postfix
|
// Write the postfix
|
||||||
if (postfix_path) |p| {
|
if (postfix_path) |p| {
|
||||||
const postfix_source = try std.fs.cwd().readFileAlloc(allocator, p, max_size);
|
const file = try Dir.cwd().openFile(io, p, .{});
|
||||||
defer allocator.free(postfix_source);
|
defer file.close(io);
|
||||||
|
var buf: [4096]u8 = undefined;
|
||||||
|
var file_reader = file.readerStreaming(io, &buf);
|
||||||
|
var reader = &file_reader.interface;
|
||||||
|
_ = try reader.streamRemaining(writer);
|
||||||
try writer.writeAll("\n// Start of postfix\n\n");
|
try writer.writeAll("\n// Start of postfix\n\n");
|
||||||
try writer.writeAll(postfix_source);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush and exit
|
// Flush and exit
|
||||||
|
|
@ -251,7 +262,7 @@ pub fn main() !void {
|
||||||
fn writeSource(
|
fn writeSource(
|
||||||
allocator: Allocator,
|
allocator: Allocator,
|
||||||
source: []const u8,
|
source: []const u8,
|
||||||
writer: *std.Io.Writer,
|
writer: *Io.Writer,
|
||||||
symbols: *Symbols,
|
symbols: *Symbols,
|
||||||
internal: bool,
|
internal: bool,
|
||||||
) !void {
|
) !void {
|
||||||
|
|
@ -740,7 +751,7 @@ fn writeType(
|
||||||
ty: Header.Type,
|
ty: Header.Type,
|
||||||
declarations: *const Declarations,
|
declarations: *const Declarations,
|
||||||
hints: WriteTypeHints,
|
hints: WriteTypeHints,
|
||||||
) std.Io.Writer.Error!void {
|
) Io.Writer.Error!void {
|
||||||
// Handle function pointers which are stored separately.
|
// Handle function pointers which are stored separately.
|
||||||
if (ty.type_details) |details| switch (details.flavour) {
|
if (ty.type_details) |details| switch (details.flavour) {
|
||||||
.function_pointer => return writeFunctionPointer(writer, details, declarations),
|
.function_pointer => return writeFunctionPointer(writer, details, declarations),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue