]>
Commit | Line | Data |
---|---|---|
ea2d184c JF |
1 | #ifndef SIG_TYPES_H |
2 | #define SIG_TYPES_H | |
3 | ||
4 | #include "minimal/stdlib.h" | |
5 | ||
6 | namespace sig { | |
7 | ||
8 | enum Primitive { | |
9 | typename_P = '#', | |
10 | union_P = '(', | |
11 | string_P = '*', | |
12 | selector_P = ':', | |
13 | object_P = '@', | |
14 | boolean_P = 'B', | |
15 | uchar_P = 'C', | |
16 | uint_P = 'I', | |
17 | ulong_P = 'L', | |
18 | ulonglong_P = 'Q', | |
19 | ushort_P = 'S', | |
20 | array_P = '[', | |
21 | pointer_P = '^', | |
22 | bit_P = 'b', | |
23 | char_P = 'c', | |
24 | double_P = 'd', | |
25 | float_P = 'f', | |
26 | int_P = 'i', | |
27 | long_P = 'l', | |
28 | longlong_P = 'q', | |
29 | short_P = 's', | |
30 | void_P = 'v', | |
31 | struct_P = '{' | |
32 | }; | |
33 | ||
34 | struct Element { | |
35 | char *name; | |
36 | struct Type *type; | |
37 | size_t offset; | |
38 | }; | |
39 | ||
40 | struct Signature { | |
41 | struct Element *elements; | |
42 | size_t count; | |
43 | }; | |
44 | ||
45 | #define JOC_TYPE_INOUT (1 << 0) | |
46 | #define JOC_TYPE_IN (1 << 1) | |
47 | #define JOC_TYPE_BYCOPY (1 << 2) | |
48 | #define JOC_TYPE_OUT (1 << 3) | |
49 | #define JOC_TYPE_BYREF (1 << 4) | |
50 | #define JOC_TYPE_CONST (1 << 5) | |
51 | #define JOC_TYPE_ONEWAY (1 << 6) | |
52 | ||
53 | struct Type { | |
54 | enum Primitive primitive; | |
55 | char *name; | |
56 | uint8_t flags; | |
57 | ||
58 | union { | |
59 | struct { | |
60 | struct Type *type; | |
61 | size_t size; | |
62 | } data; | |
63 | ||
64 | struct Signature signature; | |
65 | char *extra; | |
66 | } data; | |
67 | }; | |
68 | ||
69 | struct Type *joc_parse_type(char **name, char eos, bool variable, bool signature); | |
70 | void joc_parse_signature(struct Signature *signature, char **name, char eos, bool variable); | |
71 | ||
72 | } | |
73 | ||
74 | #endif/*SIG_TYPES_H*/ |