4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2012 Develer S.r.l. (http://www.develer.com/)
30 * All Rights Reserved.
33 * \brief Preprocessor FOR macro.
35 * \author Francesco Sacchi <batt@develer.com>
43 #define FOR(body, ...) \
44 PP_CAT(FOR_, COUNT_PARMS(__VA_ARGS__)) (body, __VA_ARGS__)
46 #define FOR_1(body, x) IDENTITY(body x)
48 #define FOR_2(body, x, ...) \
50 FOR_1(body, __VA_ARGS__)
52 #define FOR_3(body, x, ...) \
54 FOR_2(body, __VA_ARGS__)
56 #define FOR_4(body, x, ...) \
58 FOR_3(body, __VA_ARGS__)
60 #define FOR_5(body, x, ...) \
62 FOR_4(body, __VA_ARGS__)
64 #define FOR_6(body, x, ...) \
66 FOR_5(body, __VA_ARGS__)
68 #define FOR_7(body, x, ...) \
70 FOR_6(body, __VA_ARGS__)
72 #define FOR_8(body, x, ...) \
74 FOR_7(body, __VA_ARGS__)
76 #define FOR_9(body, x, ...) \
78 FOR_8(body, __VA_ARGS__)
80 #define FOR_10(body, x, ...) \
82 FOR_9(body, __VA_ARGS__)
84 #define FOR_11(body, x, ...) \
86 FOR_10(body, __VA_ARGS__)
88 #define FOR_12(body, x, ...) \
90 FOR_11(body, __VA_ARGS__)
92 #define FOR_13(body, x, ...) \
94 FOR_12(body, __VA_ARGS__)
96 #define FOR_14(body, x, ...) \
98 FOR_13(body, __VA_ARGS__)
100 #define FOR_15(body, x, ...) \
102 FOR_14(body, __VA_ARGS__)
104 #define FOR_16(body, x, ...) \
106 FOR_15(body, __VA_ARGS__)
108 #define FOR_17(body, x, ...) \
110 FOR_16(body, __VA_ARGS__)
112 #define FOR_18(body, x, ...) \
114 FOR_17(body, __VA_ARGS__)
116 #define FOR_19(body, x, ...) \
118 FOR_18(body, __VA_ARGS__)
120 #define FOR_20(body, x, ...) \
122 FOR_19(body, __VA_ARGS__)
124 #define FOR_21(body, x, ...) \
126 FOR_20(body, __VA_ARGS__)
128 #define FOR_22(body, x, ...) \
130 FOR_21(body, __VA_ARGS__)
132 #define FOR_23(body, x, ...) \
134 FOR_22(body, __VA_ARGS__)
136 #define FOR_24(body, x, ...) \
138 FOR_23(body, __VA_ARGS__)
140 #define FOR_25(body, x, ...) \
142 FOR_24(body, __VA_ARGS__)
144 #define FOR_26(body, x, ...) \
146 FOR_25(body, __VA_ARGS__)
148 #define FOR_27(body, x, ...) \
150 FOR_26(body, __VA_ARGS__)
152 #define FOR_28(body, x, ...) \
154 FOR_27(body, __VA_ARGS__)
156 #define FOR_29(body, x, ...) \
158 FOR_28(body, __VA_ARGS__)
160 #define FOR_30(body, x, ...) \
162 FOR_29(body, __VA_ARGS__)
164 #define FOR_31(body, x, ...) \
166 FOR_30(body, __VA_ARGS__)
168 #define FOR_32(body, x, ...) \
170 FOR_31(body, __VA_ARGS__)
172 #endif /* CFG_FOR_H */