Updates Zig

This commit is contained in:
Mason Remaley 2026-01-15 01:12:15 -08:00
parent 8ca5c953f1
commit 67e1f44f0f
3 changed files with 30 additions and 30 deletions

View file

@ -29,7 +29,7 @@ const Symbols = struct {
/// Returns true if there's already a public symbol with this name.
pub fn put(self: *@This(), name: []const u8) !bool {
const trimmed = std.mem.trimRight(u8, name, "_");
const trimmed = std.mem.trimEnd(u8, name, "_");
if (self.public.contains(trimmed)) return false;
try self.front_buf.put(trimmed, {});
return true;
@ -174,7 +174,7 @@ const Header = struct {
};
};
pub fn main() !void {
pub fn main(init: std.process.Init.Minimal) !void {
// Allocator and command line args
var gpa = std.heap.GeneralPurposeAllocator(.{
.thread_safe = false,
@ -185,7 +185,7 @@ pub fn main() !void {
var threaded_io: Io.Threaded = .init_single_threaded;
const io = threaded_io.io();
var args = try std.process.argsWithAllocator(allocator);
var args = try init.args.iterateAllocator(allocator);
defer args.deinit();
std.debug.assert(args.skip());
const in_path = args.next().?;
@ -195,10 +195,10 @@ pub fn main() !void {
const internal_path = args.next();
std.debug.assert(args.next() == null);
const out = try std.fs.cwd().createFile(out_path, .{});
defer out.close();
const out = try Dir.cwd().createFile(io, out_path, .{});
defer out.close(io);
var writer_buf: [4096]u8 = undefined;
var file_writer = out.writerStreaming(&writer_buf);
var file_writer = out.writerStreaming(io, &writer_buf);
const writer = &file_writer.interface;
// Write the prefix
@ -217,7 +217,7 @@ pub fn main() !void {
defer symbols.deinit();
// Write the source
const main_source = try std.fs.cwd().readFileAlloc(in_path, allocator, .limited(max_size));
const main_source = try Dir.cwd().readFileAlloc(io, in_path, allocator, .limited(max_size));
defer allocator.free(main_source);
try writeSource(
allocator,
@ -230,7 +230,7 @@ pub fn main() !void {
// Write the internal source, if supplied
if (internal_path) |p| {
const internal_source = try std.fs.cwd().readFileAlloc(p, allocator, .limited(max_size));
const internal_source = try Dir.cwd().readFileAlloc(io, p, allocator, .limited(max_size));
defer allocator.free(internal_source);
try writer.writeAll("pub const internal = struct {\n");
@ -312,7 +312,7 @@ fn getDeclarations(allocator: Allocator, header: *const Header) !Declarations {
for (header.structs) |ty| {
if (skip(ty.conditionals)) continue;
const trimmed = std.mem.trimRight(u8, ty.name, "_");
const trimmed = std.mem.trimEnd(u8, ty.name, "_");
var kind: DeclarationKind = .normal;
if (ty.forward_declaration) {
@ -349,7 +349,7 @@ fn getDeclarations(allocator: Allocator, header: *const Header) !Declarations {
for (header.enums) |e| {
if (skip(e.conditionals)) continue;
const trimmed = std.mem.trimRight(u8, e.name, "_");
const trimmed = std.mem.trimEnd(u8, e.name, "_");
try declarations.put(trimmed, .normal);
}