| ... | @@ -7,24 +7,16 @@ const usage = | ... | @@ -7,24 +7,16 @@ const usage = |
| 7 | \\ | 7 | \\ |
| 8 | ; | 8 | ; |
| 9 | | 9 | |
| 10 | const Transformation = enum { | | |
| 11 | none, | | |
| 12 | }; | | |
| 13 | | | |
| 14 | // Roadmap: | 10 | // Roadmap: |
| 15 | // - add the main loop that checks for interestingness | 11 | // - add the main loop that checks for interestingness |
| 16 | // - add transformations | 12 | // - add transformations |
| 17 | // - gut function | | |
| 18 | // - replace body with `@trap();` | | |
| 19 | // - discard the parameters | | |
| 20 | // - add thread pool | 13 | // - add thread pool |
| 21 | // - add support for `@import` detection and other files | 14 | // - add support for `@import` detection and other files |
| | 15 | // - reduce flags sent to the compiler |
| 22 | | 16 | |
| 23 | pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | 17 | pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 24 | const file_path = args[2]; | 18 | const file_path = args[2]; |
| 25 | const transformation = std.meta.stringToEnum(Transformation, args[3]); | 19 | const transformation_index = try std.fmt.parseInt(u32, args[3], 0); |
| 26 | | | |
| 27 | assert(transformation == .none); | | |
| 28 | | 20 | |
| 29 | const source_code = try std.fs.cwd().readFileAllocOptions( | 21 | const source_code = try std.fs.cwd().readFileAllocOptions( |
| 30 | arena, | 22 | arena, |
| ... | @@ -46,8 +38,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -46,8 +38,7 @@ pub fn main(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 46 | rendered.clearRetainingCapacity(); | 38 | rendered.clearRetainingCapacity(); |
| 47 | | 39 | |
| 48 | var gut_functions: std.AutoHashMapUnmanaged(u32, void) = .{}; | 40 | var gut_functions: std.AutoHashMapUnmanaged(u32, void) = .{}; |
| 49 | try gut_functions.put(arena, 1, {}); | 41 | try gut_functions.put(arena, transformation_index, {}); |
| 50 | try gut_functions.put(arena, 3, {}); | | |
| 51 | | 42 | |
| 52 | try tree.renderToArrayList(&rendered, .{ | 43 | try tree.renderToArrayList(&rendered, .{ |
| 53 | .gut_functions = gut_functions, | 44 | .gut_functions = gut_functions, |