Add predefined resources.

This commit is contained in:
bʰedoh₂ swé 2025-02-09 17:53:55 +05:00
parent 935fd58e8c
commit 2c1d945e5f

24
include/with99/defres.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef WITH99_DEFRES_H
#define WITH99_DEFRES_H
#define WITH99_resource_type_Void_IMPL(var, _) v(void*)
#define WITH99_resource_init_Void_IMPL(var, init) v((var = init))
#define WITH99_resource_free_Void_IMPL(var, ...) v((free(var)))
#define WITH99_resource_throws_Void_IMPL(...) ML99_false()
#define WITH99_resource_type_Memory_IMPL(var, type, _) v(type*)
#define WITH99_resource_init_Memory_IMPL(var, _, init) v((var = init))
#define WITH99_resource_free_Memory_IMPL(var, ...) v((free(var)))
#define WITH99_resource_throws_Memory_IMPL(...) ML99_false()
#define WITH99_resource_type_Adhoc_IMPL(var, type, _1, _2) v(type)
#define WITH99_resource_init_Adhoc_IMPL(var, _1, init, _2) v((var = init))
#define WITH99_resource_free_Adhoc_IMPL(var, _1, _2, deinit) v((deinit))
#define WITH99_resource_throws_Adhoc_IMPL(...) ML99_false()
#define WITH99_resource_type_AdhocThrows_IMPL(var, type, _1, _2) v(type)
#define WITH99_resource_init_AdhocThrows_IMPL(var, _1, init, _2) v((var = init))
#define WITH99_resource_free_AdhocThrows_IMPL(var, _1, _2, deinit) v((deinit))
#define WITH99_resource_throws_AdhocThrows_IMPL(...) ML99_true()
#endif