update because of arraylist api changes

This commit is contained in:
Luna 2020-05-12 17:26:33 -03:00
parent 043556e798
commit 0c2cd5638e
5 changed files with 10 additions and 11 deletions

View File

@ -312,7 +312,7 @@ pub const Image = struct {
// now, for each param for the plugin, we find its port, and set
// the value for the port there.
for (params.toSlice()) |param| {
for (params.items) |param| {
var sym_cstr = try std.cstr.addNullByte(self.allocator, param.sym);
defer self.allocator.free(sym_cstr);

View File

@ -113,7 +113,7 @@ pub const Command = struct {
try arr.append(value);
}
return arr.toSliceConst();
return arr.items;
}
pub fn appendParam(
@ -256,8 +256,7 @@ pub const Lang = struct {
}
while (i < count) : (i += 1) {
var arg = args.at(i);
var arg = args.items[i];
_ = std.fmt.parseFloat(f32, arg) catch |err| {
std.debug.warn("failed to parse f32: {}\n", .{err});
return error.FloatParseFail;

View File

@ -51,7 +51,7 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
defer existing_cmds.deinit();
// copy the existing command list into the repl's command list
for (existing_cmds.toSlice()) |existing_cmd| {
for (existing_cmds.items) |existing_cmd| {
try cmds.append(existing_cmd);
}
} else {

View File

@ -1,7 +1,7 @@
const langs = @import("lang.zig");
pub fn printList(list: langs.CommandList, stream: var) !void {
for (list.toSlice()) |cmd| {
for (list.items) |cmd| {
var command = switch (cmd.command) {
.Noop => "noop",
.Load => "load",
@ -47,7 +47,7 @@ pub fn printList(list: langs.CommandList, stream: var) !void {
try stream.print("{}", .{command});
for (cmd.args.toSlice()) |arg| {
for (cmd.args.items) |arg| {
try stream.print(" {}", .{arg});
}

View File

@ -384,14 +384,14 @@ pub const Runner = struct {
return switch (cmd.command) {
.Noop => {},
.Load => blk: {
var path = cmd.args.at(0);
var path = cmd.args.items[0];
try self.loadCmd(path);
// TODO is this needed?
break :blk;
},
.Quicksave => try self.quicksaveCmd(),
.RunQS => try self.runQSCmd(cmd.args.at(0)),
.RunQS => try self.runQSCmd(cmd.args.items[0]),
.Amp => blk: {
const pos = try cmd.consumePosition();
@ -547,7 +547,7 @@ pub const Runner = struct {
.Embed => blk: {
const pos = try cmd.consumePosition();
const path = cmd.args.at(2);
const path = cmd.args.items[2];
try self.embedCmd(pos, path);
},
@ -775,7 +775,7 @@ pub const Runner = struct {
cmds: lang.CommandList,
debug_flag: bool,
) !void {
for (cmds.toSlice()) |const_cmd| {
for (cmds.items) |const_cmd| {
if (debug_flag) const_cmd.print();
// copy the command so we own its memory