forked from AbleOS/ableos
28 lines
672 B
Plaintext
28 lines
672 B
Plaintext
stn := @use("../../../libraries/stn/src/lib.hb");
|
|
.{allocators, panic, log} := stn
|
|
|
|
AStruct := struct {
|
|
a_field: u8,
|
|
}
|
|
|
|
main := fn(): void {
|
|
// alloc := allocators.FakeAlloc.init()
|
|
// astruct := alloc.alloc(AStruct, 2)
|
|
// if astruct.ptr != null{
|
|
// panic.panic("FakeAlloc actually allocated.")
|
|
// }
|
|
// alloc.dealloc(&astruct.ptr, AStruct, 2)
|
|
// alloc.deinit()
|
|
|
|
balloc := allocators.BlockAlloc.init()
|
|
bstruct := balloc.alloc(AStruct, 2)
|
|
if bstruct.ptr == null {
|
|
log.info("Hi\0")
|
|
// panic.panic("BlockAlloc actually didn't allocate.")
|
|
} else {
|
|
log.info("Allocator functioned.\0")
|
|
}
|
|
// balloc.dealloc(bstruct_ptr, AStruct, 2)
|
|
// balloc.deinit()
|
|
return
|
|
} |