eĿlipsis
a language independent preprocessor
 
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
ellipsis-trigger.h
Go to the documentation of this file.
1#ifndef DOXYGEN_SPECIAL
2
3#include_directives<ellipsis-blockstate.h>
4
5/* Fix macro names depending on the TRIGGER_NAME argument. */
6#xbind _TRIGGER_NAME_(SUFFIX) ⸤__MULTI__⸥(, TRIGGER_NAME, SUFFIX)
7#xbind _TRIGGER_NAME( SUFFIX) ⸤__MULTI__⸥(TRIGGER_NAME, SUFFIX)
8#xbind _STATE_ _TRIGGER_NAME_(⸤STATE_⸥)
9
10/* This will be appended to the closing brace. */
11#xbind _TRIGGER_CLOSE _TRIGGER_NAME_(⸤CLOSE_⸥)()
12
13/* A cascade of evaluations to trigger the user macro, or do nothing
14 depending on the state on this brace level. */
15#xdefine _TRIGGER_NAME_(⸤CLOSE_⸥)() _TRIGGER_NAME_(⸤CLOSE⸥)(⸤__BLOCKSTATE_TST⸥(_STATE_))
16
17#xdefine _TRIGGER_NAME_(⸤CLOSE⸥)(STATE) ⸤__MULTI__⸥(_TRIGGER_NAME_(⸤CLOSE⸥), STATE)()
18
19/* If the state was 1, invoke the user's close macro. */
20#xdefine _TRIGGER_NAME_(⸤CLOSE_1⸥)() _TRIGGER_NAME(⸤CLOSE⸥)()⸤__BLOCKSTATE_DEC⸥(_STATE_)
21
22/* If the state was 0, do nothing. */
23#xdefine _TRIGGER_NAME_(⸤CLOSE_0⸥)()
24
25/* Ensure to clear the state at the end of each block */
26#xbind _TRIGGER_TMP ⸤__BLOCKSTATE_CLR⸥(_STATE_)
27#gather _TRIGGER_TMP } _TRIGGER_CLOSE
28#gather } _TRIGGER_TMP
29
30#xdefine _TRIGGER_NAME_(⸤CHECK_⸥)() _TRIGGER_NAME_(⸤CHECK⸥)(⸤__BLOCKSTATE_TST⸥(_STATE_))
31#xdefine _TRIGGER_NAME_(⸤CHECK⸥)(STATE) ⸤__MULTI__⸥(_TRIGGER_NAME_(⸤CHECK⸥), STATE)()
32
33/* If the state was 1 issue a warning */
34#xdefine _TRIGGER_NAME_(⸤CHECK_1⸥)() ⸤__WARNING__⸥(__EXPAND_STRINGIFY__(TRIGGER_NAME repeated before properly opening braces))
35
36/* If the state was 0, do nothing. */
37#xdefine _TRIGGER_NAME_(⸤CHECK_0⸥)()
38
39/* Set the state to 1 and invoke the user's start macro. */
40#xdefine TRIGGER_NAME _TRIGGER_NAME_(⸤CHECK_⸥)⸤()__BLOCKSTATE_SET1⸥(_STATE_)_TRIGGER_NAME(⸤START⸥)
41
42#endif