fixes for some version of zig
This commit is contained in:
parent
0f6ac055a4
commit
ed67a52b15
3 changed files with 5 additions and 6 deletions
|
@ -45,7 +45,6 @@ pub fn build(b: *Builder) void {
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
const exe = b.addExecutable("scritcher", "src/main.zig");
|
const exe = b.addExecutable("scritcher", "src/main.zig");
|
||||||
exe.setBuildMode(mode);
|
exe.setBuildMode(mode);
|
||||||
exe.use_stage1 = true;
|
|
||||||
exe.install();
|
exe.install();
|
||||||
|
|
||||||
setupLinks(exe);
|
setupLinks(exe);
|
||||||
|
|
|
@ -488,7 +488,7 @@ pub const CommandList = struct {
|
||||||
|
|
||||||
const inner_command = cmd_ptr.cast(typ).?;
|
const inner_command = cmd_ptr.cast(typ).?;
|
||||||
inline for (@typeInfo(typ).Struct.fields) |cmd_field| {
|
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)),
|
[]u8, []const u8 => self.list.allocator.free(@field(inner_command, cmd_field.name)),
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ pub const Lang = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const arg = maybe_arg.?;
|
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),
|
f32 => try std.fmt.parseFloat(f32, arg),
|
||||||
u64 => try std.fmt.parseInt(u64, arg, 10),
|
u64 => try std.fmt.parseInt(u64, arg, 10),
|
||||||
usize => try std.fmt.parseInt(usize, arg, 10),
|
usize => try std.fmt.parseInt(usize, arg, 10),
|
||||||
|
@ -601,7 +601,7 @@ pub const Lang = struct {
|
||||||
}
|
}
|
||||||
const arg = arg_opt.?;
|
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),
|
usize => try std.fmt.parseInt(usize, arg, 10),
|
||||||
i32 => try std.fmt.parseInt(i32, arg, 10),
|
i32 => try std.fmt.parseInt(i32, arg, 10),
|
||||||
f32 => try std.fmt.parseFloat(f32, arg),
|
f32 => try std.fmt.parseFloat(f32, arg),
|
||||||
|
|
|
@ -7,9 +7,9 @@ fn printCommandWithParams(stream: anytype, command: anytype) !void {
|
||||||
const Parameters = @TypeOf(command.parameters);
|
const Parameters = @TypeOf(command.parameters);
|
||||||
try stream.print(" {d} {d}", .{ command.split, command.index });
|
try stream.print(" {d} {d}", .{ command.split, command.index });
|
||||||
inline for (@typeInfo(Parameters).Struct.fields) |field| {
|
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)});
|
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)});
|
try stream.print(" {d}", .{@field(command.parameters, field.name)});
|
||||||
} else {
|
} else {
|
||||||
try stream.print(" {s}", .{@field(command.parameters, field.name)});
|
try stream.print(" {s}", .{@field(command.parameters, field.name)});
|
||||||
|
|
Loading…
Reference in a new issue