From ae44478b30d890fe0fb04022f44d474dcdcc3f9d Mon Sep 17 00:00:00 2001 From: Lassi Pulkkinen Date: Thu, 31 Oct 2024 03:11:21 +0200 Subject: Initial commit (import old repo) --- blocks.ha | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 blocks.ha (limited to 'blocks.ha') 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); -- cgit v1.2.3