-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclass.h
104 lines (89 loc) · 2.07 KB
/
class.h
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
#ifndef class_header
#define class_header
#include <stdint.h>
#include <stdio.h>
struct enum_value{
const char *name;
uint16_t value;
};
struct enumeration{
unsigned value_count;
struct enum_value values[0];
};
struct variable_definition{
const char *read_access;
const char *write_access;
const char *type;
const char *name;
const char *dimensions;
unsigned value_count;
const char **initial_values;
// descriptors
uint8_t indirect:1;
uint8_t constant:1;
uint8_t user_defined:1;
};
struct argument_definition{
const char *access;
const char *type;
const char *name;
const char *dimensions;
};
struct script_definition{
const char *name;
const char *access;
const char *signature;
const char *external_name;
const char *library;
const char *return_type;
const char *event_type;
unsigned local_variable_count;
struct variable_definition **local_variables;
unsigned argument_count;
struct argument_definition **arguments;
unsigned throws_count;
const char **throws;
uint8_t event:1;
uint8_t hidden:1;
uint8_t system:1;
uint8_t rpc:1;
uint8_t implemented:1;
uint8_t in_ancestor:1;
};
struct class_definition{
const char *ancestor;
const char *parent;
unsigned script_count;
struct script_definition **scripts;
unsigned instance_variable_count;
struct variable_definition **instance_variables;
uint8_t autoinstantiate:1;
// TODO initial values
};
enum type_enum{
enum_type,
class_type,
initsrc,
sharedsrc,
globalsrc
};
struct type_definition{
enum type_enum type;
const char *name;
union{
struct class_definition *class_definition;
struct enumeration *enum_definition;
};
uint8_t system:1;
};
struct class_group{
unsigned global_variable_count;
struct variable_definition **global_variables;
unsigned type_count;
struct type_definition *types;
};
struct lib_entry;
struct class_group *class_parse(struct lib_entry *entry);
void class_free(struct class_group *class_group);
void dump_script_resources(FILE *fd, struct class_group *group, struct script_definition *script);
#endif