chore: introduce zba-util

In an effort to reuse code between zba and zba-gdbstub, move common util
code (like the SPSC Channel I implemented in this commit) in a new lib
This commit is contained in:
2023-03-10 00:05:31 -06:00
parent 72b702cb21
commit 11eae091db
19 changed files with 28 additions and 128 deletions

View File

@@ -70,9 +70,10 @@ pub fn main() void {
const paths = handleArguments(allocator, data_path, &result) catch |e| exitln("failed to handle cli arguments: {}", .{e});
defer if (paths.save) |path| allocator.free(path);
const log_file = if (config.config().debug.cpu_trace) blk: {
break :blk std.fs.cwd().createFile("zba.log", .{}) catch |e| exitln("failed to create trace log file: {}", .{e});
} else null;
const log_file = switch (config.config().debug.cpu_trace) {
true => std.fs.cwd().createFile("zba.log", .{}) catch |e| exitln("failed to create trace log file: {}", .{e}),
false => null,
};
defer if (log_file) |file| file.close();
// TODO: Take Emulator Init Code out of main.zig