]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/struct.qh
Merge branch 'terencehill/menu_languages' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / struct.qh
1 #ifndef STRUCT_H
2 #define STRUCT_H
3
4 #ifndef QCC_SUPPORT_STRUCT
5         #define _STRUCT_DECLARE(x, id, type, END) noref type x##_##id;
6         #define STRUCT_DECLARE(id, s) s(_STRUCT_DECLARE, id)
7
8         #define _STRUCT_PARAM_(x, id, type) type x##_##id,
9         #define _STRUCT_PARAM_END(x, id, type) type x##_##id
10         #define _STRUCT_PARAM(x, id, type, isend) _STRUCT_PARAM_##isend(x, id, type)
11         #define STRUCT_PARAM(id, s) s(_STRUCT_PARAM, id)
12
13         #define _STRUCT_PASS_(x, id, type) x##_##id,
14         #define _STRUCT_PASS_END(x, id, type) x##_##id
15         #define _STRUCT_PASS(x, id, type, END) _STRUCT_PASS_##END(x, id, type)
16         #define STRUCT_PASS(id, s) s(_STRUCT_PASS, id)
17
18         #define _STRUCT_STORE_DST(_, it) it
19         #define _STRUCT_STORE_SRC(it, _) it
20         #define _CONCAT3_(a, b, c) a##b##c
21         #define _CONCAT3(a, b, c) _CONCAT3_(a, b, c)
22         #define _STRUCT_STORE(x, id, type, END) _CONCAT3(_STRUCT_STORE_DST x, _, id) = _CONCAT3(_STRUCT_STORE_SRC x, _, id);
23         #define STRUCT_STORE(from, to, s) s(_STRUCT_STORE, (from, to))
24
25         #define STRUCT(id, ...)
26 #else
27         #define STRUCT_DECLARE(id, type) type id;
28         #define STRUCT_PARAM(id, type) type id
29         #define STRUCT_PASS(id, type) id
30         #define STRUCT_STORE(from, to, s) to = from
31         #define _STRUCT_MEMBER(my, id, type, END) type id;
32         #define STRUCT(id, s) struct STRUCT_##id { s(_STRUCT_MEMBER, ) };
33 #endif
34
35 #endif