From ed67a52b151d8531bbe81e783d383864ffc914c5 Mon Sep 17 00:00:00 2001 From: Luna Date: Fri, 4 Aug 2023 21:34:17 -0300 Subject: [PATCH] fixes for some version of zig --- build.zig | 1 - src/lang.zig | 6 +++--- src/printer.zig | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index 520aeb9..ad6f87d 100644 --- a/build.zig +++ b/build.zig @@ -45,7 +45,6 @@ pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const exe = b.addExecutable("scritcher", "src/main.zig"); exe.setBuildMode(mode); - exe.use_stage1 = true; exe.install(); setupLinks(exe); diff --git a/src/lang.zig b/src/lang.zig index 08346ff..ca5fbec 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -488,7 +488,7 @@ pub const CommandList = struct { const inner_command = cmd_ptr.cast(typ).?; inline for (@typeInfo(typ).Struct.fields) |cmd_field| { - switch (cmd_field.field_type) { + switch (cmd_field.type) { []u8, []const u8 => self.list.allocator.free(@field(inner_command, cmd_field.name)), else => {}, } @@ -576,7 +576,7 @@ pub const Lang = struct { } const arg = maybe_arg.?; - const arg_value = switch (cmd_field.field_type) { + const arg_value = switch (cmd_field.type) { f32 => try std.fmt.parseFloat(f32, arg), u64 => try std.fmt.parseInt(u64, arg, 10), usize => try std.fmt.parseInt(usize, arg, 10), @@ -601,7 +601,7 @@ pub const Lang = struct { } const arg = arg_opt.?; - const argument_value = switch (cmd_field.field_type) { + const argument_value = switch (cmd_field.type) { usize => try std.fmt.parseInt(usize, arg, 10), i32 => try std.fmt.parseInt(i32, arg, 10), f32 => try std.fmt.parseFloat(f32, arg), diff --git a/src/printer.zig b/src/printer.zig index a851602..b3da89b 100644 --- a/src/printer.zig +++ b/src/printer.zig @@ -7,9 +7,9 @@ fn printCommandWithParams(stream: anytype, command: anytype) !void { const Parameters = @TypeOf(command.parameters); try stream.print(" {d} {d}", .{ command.split, command.index }); inline for (@typeInfo(Parameters).Struct.fields) |field| { - if (field.field_type == f32 or field.field_type == f64) { + if (field.type == f32 or field.type == f64) { try stream.print(" {}", .{@field(command.parameters, field.name)}); - } else if (field.field_type == usize or field.field_type == u64) { + } else if (field.type == usize or field.type == u64) { try stream.print(" {d}", .{@field(command.parameters, field.name)}); } else { try stream.print(" {s}", .{@field(command.parameters, field.name)});