ableos/sysdata/libraries/stn/src/lib.hb
2024-12-17 13:50:04 +00:00

53 lines
1.2 KiB
Plaintext

acs := @use("acs.hb")
allocators := @use("alloc/lib.hb")
formatters := @use("formatters.hb")
hashers := @use("hash/lib.hb")
string := @use("string.hb")
log := @use("log.hb")
memory := @use("memory.hb")
buffer := @use("buffer.hb")
math := @use("math.hb")
random := @use("random.hb")
file := @use("file_io.hb")
dt := @use("dt.hb")
process := @use("process.hb")
sleep := @use("sleep.hb")
// todo: replace with comptime message (for zero cost)
panic := fn(message: ?^u8): never {
log.error("Error: Panic Called, Message:\0")
if message == null {
log.error("None\0")
} else {
log.error(message)
}
die
}
$pointer := fn($T: type): bool {
return T != f64 & T != uint & T != int & @sizeof(T) == @sizeof(uint) & @alignof(T) == @alignof(uint)
}
$unsigned_int := fn($T: type): bool {
return T == uint | T == u8 | T == u16 | T == u32
}
$signed_int := fn($T: type): bool {
return T == int | T == i8 | T == i16 | T == i32
}
$integer := fn($T: type): bool {
return unsigned_int(T) | signed_int(T)
}
$float := fn($T: type): bool {
return T == f32 | T == f64
}
$primitive := fn($T: type): bool {
return integer(T) | float(T) | pointer(T) | T == bool
}
$float_bytes := fn($T: type): type {
if T == f64 return uint else if T == f32 return u32
}