4 #define FOREACH_ARRAY(arr, start, end, cond, body) \
7 for (int i = start; i < end; ++i) \
9 const noref entity it = arr[i]; \
15 #define FOREACH_LIST(list, next, cond, body) \
19 for (entity it = list##_first; it; (it = it.next, ++i)) \
26 #define FOREACH_WORD(words, cond, body) \
29 string _words = words; \
31 for (string _it; (_it = car(_words)); (_words = cdr(_words), ++i)) \
33 const noref string it = _it; \
40 entity(.entity fld, entity match, .entity tofield) findchainentity_tofield = #403;
42 entity(.entity fld, entity match, .entity tofield) findchainentity_tofield = #403;
44 entity(.entity fld, entity match, .entity tofield) findchainentity_tofield = #27;
47 .entity _FOREACH_ENTITY_fld;
48 .entity _FOREACH_ENTITY_next;
50 #define FOREACH_ENTITY_UNORDERED(cond, body) \
53 for (entity it = findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
60 #define FOREACH_ENTITY_ORDERED(cond, body) \
63 for (entity it = NULL; (it = nextent(it)); ++i) \
70 #define FOREACH_ENTITY(cond, body) FOREACH_ENTITY_UNORDERED(cond, body)
72 #define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body)