Backlog/lib/sdl3/v2/assert.zig

38 lines
1.4 KiB
Zig

const std = @import("std");
pub const c = @import("c.zig").c;
pub const AssertData = extern struct {
always_ignore: bool, // true if app should always continue when assertion is triggered.
trigger_count: unsigned int, // Number of times this assertion has been triggered.
condition: [*c]const u8, // A string of this assert's test code.
filename: [*c]const u8, // The source file where this assert lives.
linenum: c_int, // The line in `filename` where this assert lives.
function: [*c]const u8, // The name of the function where this assert lives.
next: const struct SDL_AssertData *, // next item in the linked list.
};
pub inline fn reportAssertion(data: ?*AssertData, func: [*c]const u8, file: [*c]const u8, line: c_int) AssertState {
return c.SDL_ReportAssertion(data, func, file, line);
}
pub inline fn setAssertionHandler(handler: AssertionHandler, userdata: ?*anyopaque) void {
return c.SDL_SetAssertionHandler(handler, userdata);
}
pub inline fn getDefaultAssertionHandler() AssertionHandler {
return c.SDL_GetDefaultAssertionHandler();
}
pub inline fn getAssertionHandler(puserdata: [*c]?*anyopaque) AssertionHandler {
return c.SDL_GetAssertionHandler(puserdata);
}
pub inline fn getAssertionReport() *const AssertData {
return @ptrCast(c.SDL_GetAssertionReport());
}
pub inline fn resetAssertionReport() void {
return c.SDL_ResetAssertionReport();
}