summaryrefslogtreecommitdiff
path: root/docs/application/type.md
blob: 3a831b23c241a8c61192f013082bf0dd623d823c (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Type

---

## Object Definitions

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

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

typedef union {
    // 64 Bytes Max
} kpl_type_body;

typedef struct {
    uint16_t length, line;
    int32_t position, module_id;
} kpl_token;

typedef enum {
    NONE,
    GENERAL_REGISTER,
    XMM_REGISTER,
    STACK
} kpl_native_storage;

typedef struct {
    uint8_t storage : 2, id : 6;
} kpl_native_id;

typedef struct _kpl_type {
    kpl_type_template template;
    uint8_t qualifiers;
    uint16_t modifiers;
    union {
        kpl_token token;
        struct {
            kpl_native_id native_id;
            int8_t process_state_id; // -1 not used
            uint16_t tree_weight;
            struct _kpl_type *function;
        } var;
    } meta;
    _Atomic ssize_t ref_count;
    struct _kpl_type *prev, *next, *parent;
    kpl_type_body body;
} kpl_type;
```