4 #ifdef QCC_SUPPORT_ACCUMULATE
5 #define ACCUMULATE_FUNCTION(func, otherfunc) \
6 [[accumulate]] void func() \
10 #define CALL_ACCUMULATED_FUNCTION(func) \
13 #ifdef HAVE_YO_DAWG_CPP
14 // TODO make ascii art pic of xzibit
16 // I HERD YO LIEK MACROS
17 // SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
18 // SO YO CAN EXPAND MACROS WHILE YO EXPAND MACROS
19 #define ACCUMULATE_FUNCTION(func, otherfunc) \
21 void __merge__##otherfunc() \
23 func(); otherfunc(); \
26 #define func __merge__##otherfunc \
28 #define func otherfunc \
30 #define CALL_ACCUMULATED_FUNCTION(func) \
33 #define ACCUMULATE_FUNCTION(func, otherfunc) \
34 .float _ACCUMULATE_##func##__##otherfunc;
35 void ACCUMULATE_call(string func)
38 float n = numentityfields();
39 string funcprefix = strcat("_ACCUMULATE_", func, "__");
40 float funcprefixlen = strlen(funcprefix);
41 for (i = 0; i < n; ++i)
43 string name = entityfieldname(i);
44 if (substring(name, 0, funcprefixlen) == funcprefix) callfunction(substring(name, funcprefixlen, -1));
47 #define CALL_ACCUMULATED_FUNCTION(func) \
48 ACCUMULATE_call( #func)
52 // used for simplifying ACCUMULATE_FUNCTIONs
53 #define SET_FIRST_OR_LAST(input, first, count) \
54 if (!input) { input = (first + count); }
55 #define SET_FIELD_COUNT(field, first, count) \
56 if (!field) { field = (first + count); ++count; }
57 #define CHECK_MAX_COUNT(name, max, count, type) \
58 if (count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }