3 #ifdef QCC_SUPPORT_ACCUMULATE
4 #define ACCUMULATE_FUNCTION(func, otherfunc) \
5 [[accumulate]] void func() \
9 #define CALL_ACCUMULATED_FUNCTION(func) \
12 #ifdef HAVE_YO_DAWG_CPP
13 // TODO make ascii art pic of xzibit
15 // I HERD YO LIEK MACROS
16 // SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
17 // SO YO CAN EXPAND MACROS WHILE YO EXPAND MACROS
18 #define ACCUMULATE_FUNCTION(func, otherfunc) \
20 void __merge__##otherfunc() \
22 func(); otherfunc(); \
25 #define func __merge__##otherfunc \
27 #define func otherfunc \
29 #define CALL_ACCUMULATED_FUNCTION(func) \
32 #define ACCUMULATE_FUNCTION(func, otherfunc) \
33 .float _ACCUMULATE_##func##__##otherfunc;
34 void ACCUMULATE_call(string func)
37 float n = numentityfields();
38 string funcprefix = strcat("_ACCUMULATE_", func, "__");
39 float funcprefixlen = strlen(funcprefix);
40 for (i = 0; i < n; ++i)
42 string name = entityfieldname(i);
43 if (substring(name, 0, funcprefixlen) == funcprefix) callfunction(substring(name, funcprefixlen, -1));
46 #define CALL_ACCUMULATED_FUNCTION(func) \
47 ACCUMULATE_call( #func)
51 // used for simplifying ACCUMULATE_FUNCTIONs
52 #define SET_FIRST_OR_LAST(input, first, count) \
53 if (!input) { input = (first + count); }
54 #define SET_FIELD_COUNT(field, first, count) \
55 if (!field) { field = (first + count); ++count; }
56 #define CHECK_MAX_COUNT(name, max, count, type) \
57 if (count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }