summaryrefslogtreecommitdiff
path: root/docs/application/type.md
blob: c985b355f38d87e9dc83c9ec7e74c49e5fec2c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Type

---

## Object Definitions

```c
#define KPL_TYPE_BLOCK_ARRAY_SIZE UINT16_MAX

#define KPL_TYPE_BLOCKS_SIZE UINT16_MAX

typedef struct {
    uint16_t slab_index, slab_array_index;
} kpl_type_ptr;

static const kpl_type_ptr kpl_type_ptr_null = { UINT16_MAX, UINT16_MAX };

typedef enum : uint8_t {
    // ...
} kpl_type_template;

typedef enum {
    CONST   = 1 << 0,
    EMPTY   = 1 << 1,
    REF     = 1 << 2,
    SHARED  = 1 << 3
} kpl_type_qualifiers;

typedef union {
    // ...
} kpl_type_body;

typedef struct {
    kpl_type_template template;
    uint8_t qualifiers;
    uint16_t modifiers;
    _Atomic int32_t ref_count;
    kpl_ptr self;
    kpl_type_body body;
} kpl_type;

// TODO slab store for kpl_type_ptr
```