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 // now, for each param for the plugin, we find its port, and set
// the value for the port there. // 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); var sym_cstr = try std.cstr.addNullByte(self.allocator, param.sym);
defer self.allocator.free(sym_cstr); defer self.allocator.free(sym_cstr);

View File

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

View File

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

View File

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

View File

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