add runner support on command cast
This commit is contained in:
		
							parent
							
								
									6497fc1dd8
								
							
						
					
					
						commit
						7d519b73b6
					
				
					 2 changed files with 18 additions and 2 deletions
				
			
		|  | @ -116,7 +116,7 @@ pub const NewCommand = struct { | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub fn cast(base: *@This(), comptime T: type) ?*T { |     pub fn cast(base: *const @This(), comptime T: type) ?*const T { | ||||||
|         if (base.tag != T.base_tag) |         if (base.tag != T.base_tag) | ||||||
|             return null; |             return null; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -374,7 +374,23 @@ pub const Runner = struct { | ||||||
|         try image.runPlugin("http://calf.sourceforge.net/plugins/VintageDelay", pos, params); |         try image.runPlugin("http://calf.sourceforge.net/plugins/VintageDelay", pos, params); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn newRunCommand(self: *@This(), cmd: lang.NewCommand) !void {} |     fn newRunCommandSingle( | ||||||
|  |         self: *@This(), | ||||||
|  |         cmd: lang.NewCommand, | ||||||
|  |         comptime tag: lang.NewCommand.Tag, | ||||||
|  |     ) !void { | ||||||
|  |         comptime const typ = lang.NewCommand.tagToType(tag); | ||||||
|  |         const command = cmd.cast(typ).?; | ||||||
|  | 
 | ||||||
|  |         std.debug.warn("{}\n", .{command}); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     fn newRunCommand(self: *@This(), cmd: lang.NewCommand) !void { | ||||||
|  |         switch (cmd.tag) { | ||||||
|  |             .load => try self.newRunCommandSingle(cmd, .load), | ||||||
|  |             else => @panic("TODO"), | ||||||
|  |         } | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     fn runCommand(self: *Runner, cmd: *lang.Command) !void { |     fn runCommand(self: *Runner, cmd: *lang.Command) !void { | ||||||
|         var params = ParamList.init(self.allocator); |         var params = ParamList.init(self.allocator); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue