Metalang99
1.13.3
Full-blown preprocessor metaprogramming
choice.h
Go to the documentation of this file.
1
15
#ifndef ML99_CHOICE_H
16
#define ML99_CHOICE_H
17
18
#include <metalang99/priv/util.h>
19
20
#include <
metalang99/lang.h
>
21
33
#define ML99_choice(tag, ...) ML99_call(ML99_choice, tag, __VA_ARGS__)
34
49
#define ML99_choiceTag(choice) ML99_call(ML99_choiceTag, choice)
50
65
#define ML99_choiceData(choice) ML99_call(ML99_choiceData, choice)
66
77
#define ML99_match(choice, matcher) ML99_call(ML99_match, choice, matcher)
78
96
#define ML99_matchWithArgs(choice, matcher, ...) \
97
ML99_call(ML99_matchWithArgs, choice, matcher, __VA_ARGS__)
98
99
#define ML99_CHOICE(tag, ...) (tag, __VA_ARGS__)
100
#define ML99_CHOICE_TAG(choice) ML99_PRIV_HEAD_AUX choice
101
#define ML99_CHOICE_DATA(choice) ML99_PRIV_TAIL_AUX choice
102
103
#ifndef DOXYGEN_IGNORE
104
105
#define ML99_choice_IMPL(tag, ...) v(ML99_CHOICE(tag, __VA_ARGS__))
106
#define ML99_choiceTag_IMPL(choice) v(ML99_CHOICE_TAG(choice))
107
#define ML99_choiceData_IMPL(choice) v(ML99_CHOICE_DATA(choice))
108
109
#define ML99_match_IMPL(choice, matcher) \
110
ML99_callUneval(ML99_PRIV_CAT(matcher, ML99_PRIV_HEAD_AUX choice), ML99_PRIV_TAIL_AUX choice)
111
112
#define ML99_matchWithArgs_IMPL(choice, matcher, ...) \
113
ML99_callUneval( \
114
ML99_PRIV_CAT(matcher, ML99_PRIV_HEAD_AUX choice), \
115
ML99_PRIV_TAIL_AUX choice, \
116
__VA_ARGS__)
117
118
// Arity specifiers {
119
120
#define ML99_choice_ARITY 2
121
#define ML99_choiceTag_ARITY 1
122
#define ML99_choiceData_ARITY 1
123
#define ML99_match_ARITY 2
124
#define ML99_matchWithArgs_ARITY 3
125
// } (Arity specifiers)
126
127
#endif
// DOXYGEN_IGNORE
128
129
#endif
// ML99_CHOICE_H
lang.h
The core metalanguage.
include
metalang99
choice.h
Generated by
1.9.4