2024-09-18 03:38:49 -05:00
|
|
|
acs := @use("acs.hb")
|
2024-11-24 10:18:09 -06:00
|
|
|
allocators := @use("alloc/lib.hb")
|
2024-12-19 11:19:57 -06:00
|
|
|
fmt := @use("fmt.hb")
|
2024-11-24 14:58:14 -06:00
|
|
|
hashers := @use("hash/lib.hb")
|
2024-09-18 03:38:49 -05:00
|
|
|
string := @use("string.hb")
|
|
|
|
log := @use("log.hb")
|
|
|
|
memory := @use("memory.hb")
|
|
|
|
buffer := @use("buffer.hb")
|
|
|
|
math := @use("math.hb")
|
|
|
|
random := @use("random.hb")
|
2024-10-14 12:54:53 -05:00
|
|
|
file := @use("file_io.hb")
|
2024-11-03 16:31:53 -06:00
|
|
|
dt := @use("dt.hb")
|
2024-11-17 14:29:32 -06:00
|
|
|
process := @use("process.hb")
|
2024-11-27 06:41:51 -06:00
|
|
|
sleep := @use("sleep.hb")
|
2024-11-03 16:31:53 -06:00
|
|
|
|
2024-12-16 07:22:03 -06:00
|
|
|
// todo: replace with comptime message (for zero cost)
|
2024-11-03 16:31:53 -06:00
|
|
|
panic := fn(message: ?^u8): never {
|
|
|
|
log.error("Error: Panic Called, Message:\0")
|
|
|
|
if message == null {
|
|
|
|
log.error("None\0")
|
|
|
|
} else {
|
|
|
|
log.error(message)
|
|
|
|
}
|
|
|
|
die
|
2024-12-16 07:22:03 -06:00
|
|
|
}
|
|
|
|
|
2024-12-17 16:30:22 -06:00
|
|
|
Kind := enum {
|
|
|
|
Builtin,
|
|
|
|
Struct,
|
2024-12-20 04:37:06 -06:00
|
|
|
Tuple,
|
2024-12-17 16:30:22 -06:00
|
|
|
Enum,
|
|
|
|
Union,
|
|
|
|
Pointer,
|
|
|
|
Slice,
|
|
|
|
Opt,
|
|
|
|
Function,
|
|
|
|
Template,
|
|
|
|
Global,
|
|
|
|
Const,
|
|
|
|
Module,
|
|
|
|
$of := fn($T: type): Self {
|
|
|
|
return @bitcast(@kindof(T))
|
|
|
|
}
|
|
|
|
}
|
2024-12-17 07:50:04 -06:00
|
|
|
|
2024-12-16 07:22:03 -06:00
|
|
|
$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
|
|
|
|
}
|
|
|
|
|
2024-12-19 11:19:57 -06:00
|
|
|
$usize := fn($T: type): type {
|
|
|
|
if @sizeof(T) == 1 return u8 else if @sizeof(T) == 2 return u16 else if @sizeof(T) == 4 return u32 else return uint
|
|
|
|
}
|
|
|
|
|
|
|
|
$bits := fn($T: type): usize(T) {
|
|
|
|
return @sizeof(T) << 3
|
|
|
|
}
|
|
|
|
|
|
|
|
$bitmask := fn($T: type): usize(T) {
|
|
|
|
return -1
|
2024-12-20 04:37:06 -06:00
|
|
|
}
|