assert_handler : (msg: str, site: CallSite) -> void;
thread_id : i32;
+
+ user_data: rawptr;
+ user_data_type: type_expr;
}
+
#if runtime.runtime != .Custom {
#local default_logger :: (data: rawptr, msg: str) {
use package core
}
}
+#inject OnyxContext {
+ set_user_data :: macro (c: ^OnyxContext, data: ^$T) {
+ c.user_data = data;
+ c.user_data_type = T;
+ }
+
+ get_user_data :: macro (c: ^OnyxContext, $T: type_expr) -> ^T {
+ if c.user_data_type != T do return null;
+ return ~~ c.user_data;
+ }
+}
//
// Basic logging
macro (arr: [] $T, predicate_body: Code) -> bool {
for arr {
- if #unquote predicate_body do return false;
+ if #unquote predicate_body do return true;
}
- return true;
+ return false;
}
}