Merge branch 'master' into zig-0.14

This commit is contained in:
CJ van den Berg 2025-01-30 18:15:07 +01:00
commit 0dee31636e
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
32 changed files with 1164 additions and 169 deletions

View file

@ -207,6 +207,10 @@ pub const message = struct {
pub fn match(self: Self, m: anytype) error{Exit}!bool {
return if (cbor.match(self.buf, m)) |ret| ret else |e| exit_error(e, @errorReturnTrace());
}
pub fn format(self: @This(), comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
return cbor.toJsonWriter(self.buf, writer, .{});
}
};
pub fn exit_message(e: anytype, stack_trace: ?*std.builtin.StackTrace) message {
@ -332,6 +336,7 @@ pub const channel = struct {
pub const event: c.thespian_trace_channel = 2048;
pub const widget: c.thespian_trace_channel = 4096;
pub const input: c.thespian_trace_channel = 8192;
pub const debug: c.thespian_trace_channel = 16384;
pub const all = c.thespian_trace_channel_all;
};
@ -423,7 +428,8 @@ pub fn trace(chan: trace_channel, value: anytype) void {
env.get().trace(value.to(message.c_buffer_type));
} else {
var trace_buffer: [512]u8 = undefined;
const m = message.fmtbuf(&trace_buffer, value);
const m = message.fmtbuf(&trace_buffer, value) catch |e|
std.debug.panic("TRACE ERROR: {}", .{e});
env.get().trace(m.to(message.c_buffer_type));
}
}