aboutsummaryrefslogtreecommitdiff
path: root/hobgoblin/src/patio/types.hob
blob: 2bd2e47a973ad058d082809f151bc31bc2bbdbf3 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import {PatioDataPtrValue, PatioIntValue} from ./values;

// == Types ==

sum PatioType {
    variant PatioBoolType;
    variant PatioByteType;
    variant PatioDataPtrType;
    variant PatioFunctionPtrType;
    variant PatioInt32Type;
    variant PatioIntType;
}

struct PatioBoolType {
    singleton;
}

struct PatioByteType {
    singleton;
}

struct PatioDataPtrType {
    singleton;
}

struct PatioFunctionPtrType {
    singleton;
}

struct PatioInt32Type {
    singleton;
}

struct PatioIntType {
    singleton;
}

// == Data layouts ==

sum PatioDataLayout {
    variant PatioDataLayoutArray box;
    variant PatioDataLayoutBool;
    variant PatioDataLayoutByte;
    variant PatioDataLayoutDataPtr;
    variant PatioDataLayoutFunctionPtr;
    variant PatioDataLayoutInt;
    variant PatioDataLayoutInt32;
    variant PatioDataLayoutStruct;
}

struct PatioDataLayoutArray {
    field element: PatioDataLayout;
    // TODO: should be UInt32
    field size: Int32;
}

struct PatioDataLayoutBool {
    singleton;
}

struct PatioDataLayoutByte {
    singleton;
}

struct PatioDataLayoutDataPtr {
    singleton;
}

struct PatioDataLayoutFunctionPtr {
    singleton;
}

struct PatioDataLayoutInt {
    singleton;
}

struct PatioDataLayoutInt32 {
    singleton;
}

struct PatioDataLayoutStruct {
    field elements: List[PatioDataLayout];
}

// == Data values ==

sum PatioDataValue {
    variant PatioDataValueArray;
    variant PatioDataValueBool;
    variant PatioDataValueByte;
    variant PatioDataValueDataPtr;
    variant PatioDataValueInt;
    variant PatioDataValueInt32;
    variant PatioDataValueStruct;
}

struct PatioDataValueArray {
    field elementLayout: PatioDataLayout;
    field elements: List[PatioDataValue];
}

struct PatioDataValueBool {
    field value: Bool;
}

struct PatioDataValueByte {
    field value: Int8;
}

struct PatioDataValueDataPtr {
    field value: PatioDataPtrValue;
}

struct PatioDataValueInt {
    field value: PatioIntValue;
}

struct PatioDataValueInt32 {
    field value: PatioIntValue;
}

struct PatioDataValueStruct {
    field elements: List[PatioDataValue];
}