diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-07 17:45:48 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-07 17:45:48 -0400 |
| commit | ceb874e83d44a2c3d7c7d167fc8853694538ae53 (patch) | |
| tree | 53bb07d0c52ad667e0a23cef0757817ca154aaa1 /docs/application/type.md | |
| parent | 7df3d08d8dd0d81f24f0788b44efd37883d3c1c8 (diff) | |
type definitions with type_ptr
Diffstat (limited to 'docs/application/type.md')
| -rw-r--r-- | docs/application/type.md | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/docs/application/type.md b/docs/application/type.md index eae1425..52b28de 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -2,6 +2,42 @@ --- -## Allocation - ## Object Definitions + +```c +#define KPL_TYPE_BLOCK_ARRAY_SIZE UINT16_MAX + +#define KPL_TYPE_BLOCKS_SIZE UINT16_MAX + +typedef struct { + uint16_t block_index, array_index; +} kpl_type_ptr; + +static const kpl_type_ptr kpl_type_ptr_null = { UINT16_MAX, UINT16_MAX }; + +typedef enum __attribute__((packed)) { + // ... +} kpl_type_template; + +typedef enum __attribute__((packed)) { + // .. +} kpl_type_flags; + +typedef union { + // ... +} kpl_type_body; + +typedef struct { + kpl_type_template template; + uint16_t flags; + kpl_type_ptr self, prev, next, parent; + _Atomic int32_t ref_count; + kpl_type_body body; +} kpl_type; + +static size_t type_array_block_index; + +static kpl_type *type_array_blocks[KPL_TYPE_BLOCKS_SIZE]; + +static kpl_type_ptr type_pool_head; +``` |
