summaryrefslogtreecommitdiff
path: root/blocks.ha
diff options
context:
space:
mode:
authorLassi Pulkkinen <lassi@pulk.fi>2024-10-31 03:11:21 +0200
committerLassi Pulkkinen <lassi@pulk.fi>2024-10-31 03:51:35 +0200
commitae44478b30d890fe0fb04022f44d474dcdcc3f9d (patch)
tree5f462459ae4b47d22114eed717d1382d08cf4dfe /blocks.ha
Initial commit (import old repo)HEADmain
Diffstat (limited to 'blocks.ha')
-rw-r--r--blocks.ha18
1 files changed, 18 insertions, 0 deletions
diff --git a/blocks.ha b/blocks.ha
new file mode 100644
index 0000000..d9a3048
--- /dev/null
+++ b/blocks.ha
@@ -0,0 +1,18 @@
+type BlockId = u32;
+
+let BLOCKS = IDREG_EMPTY;
+
+fn destroy_blocks() void = {
+ idreg_clear(&BLOCKS);
+};
+
+fn blocks_register(ident: str) BlockId = {
+ const blk = idreg_register(&BLOCKS, ident);
+ bstates_handle_blocks_onregister(blk);
+ return blk;
+};
+
+fn blocks_count() u32 = idreg_count(&BLOCKS);
+
+fn block_getident(blk: BlockId) str =
+ idreg_getname(&BLOCKS, blk);