fixes for some version of zig

This commit is contained in:
Luna 2023-08-04 21:34:17 -03:00
parent 0f6ac055a4
commit ed67a52b15
3 changed files with 5 additions and 6 deletions

View File

@ -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);

View File

@ -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),

View File

@ -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)});