eĿlipsis
a language independent preprocessor
 
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
ellipsis-blockstate.h File Reference

Maintain a set variables indexed by a level. More...

Go to the source code of this file.

Macros

#define __BLOCKSTATE_CLR(NAME, ...)
 Set the brace-level-specific variable with name NAME to zero.
 
#define __BLOCKSTATE_DEC(NAME, ...)
 Decrement brace-level-specific variable with name NAME.
 
#define __BLOCKSTATE_INC(NAME, ...)
 Increment brace-level-specific variable with name NAME.
 
#define __BLOCKSTATE_SET0(NAME, ...)
 Set the brace-level-specific variable with name NAME to 0.
 
#define __BLOCKSTATE_SET1(NAME, ...)
 Set the brace-level-specific variable with name NAME to 1.
 
#define __BLOCKSTATE_SET2(NAME, ...)
 Set the brace-level-specific variable with name NAME to 2.
 
#define __BLOCKSTATE_SET3(NAME, ...)
 Set the brace-level-specific variable with name NAME to 3.
 
#define __BLOCKSTATE_TST(NAME, ...)
 Test the brace-level-specific variable with name NAME.
 

Detailed Description

Maintain a set variables indexed by a level.

Using the macros with only one argument results in creating a block-local variable with the name that is passed as argument. For example

}
}
}
#define __BLOCKSTATE_INC(NAME,...)
Increment brace-level-specific variable with name NAME.
Definition ellipsis-blockstate.h:3
#define __BLOCKSTATE_CLR(NAME,...)
Set the brace-level-specific variable with name NAME to zero.
Definition ellipsis-blockstate.h:5
#define __BLOCKSTATE_TST(NAME,...)
Test the brace-level-specific variable with name NAME.
Definition ellipsis-blockstate.h:6
#define __BLOCKSTATE_DEC(NAME,...)
Decrement brace-level-specific variable with name NAME.
Definition ellipsis-blockstate.h:4

has three variables in the MINE series, one that is active outside the braces and another at each brace level. So the expansion of the above would be

1 {
0 {
-1
}
0 {
-2
}
}
1 0
Remarks
There is one variable for each level.
The macros all guarantee that the necessary support macros are always defined.

With a second argument, that argument is expected to represent another concept of "level" than nestedness of braces. In the example above if we'd use () parenthesis instead of {} braces by adding __PARENTHESIS_DEPTH__ as second argument to the macros, the result would be similar.

Macro Definition Documentation

◆ __BLOCKSTATE_CLR

#define __BLOCKSTATE_CLR (   NAME,
  ... 
)

Set the brace-level-specific variable with name NAME to zero.

If the variable is not yet defined, define it first.

Remarks
The default for the second argument is __BRACE_LEVEL__.
Returns
Expands to the empty token.

◆ __BLOCKSTATE_DEC

#define __BLOCKSTATE_DEC (   NAME,
  ... 
)

Decrement brace-level-specific variable with name NAME.

If the variable is not yet defined, sets its value to -1.

Remarks
The default for the second argument is __BRACE_LEVEL__.
Returns
Expands to the empty token.

◆ __BLOCKSTATE_INC

#define __BLOCKSTATE_INC (   NAME,
  ... 
)

Increment brace-level-specific variable with name NAME.

If the variable is not yet defined, sets its value to 1.

Remarks
The default for the second argument is __BRACE_LEVEL__.
Returns
Expands to the empty token.

◆ __BLOCKSTATE_SET0

#define __BLOCKSTATE_SET0 (   NAME,
  ... 
)

Set the brace-level-specific variable with name NAME to 0.

If the variable is not yet defined, define it first.

Remarks
The default for the second argument is __BRACE_LEVEL__.
Returns
Expands to the empty token.

◆ __BLOCKSTATE_SET1

#define __BLOCKSTATE_SET1 (   NAME,
  ... 
)

Set the brace-level-specific variable with name NAME to 1.

See also
__BLOCKSTATE_SET0

◆ __BLOCKSTATE_SET2

#define __BLOCKSTATE_SET2 (   NAME,
  ... 
)

Set the brace-level-specific variable with name NAME to 2.

See also
__BLOCKSTATE_SET0

◆ __BLOCKSTATE_SET3

#define __BLOCKSTATE_SET3 (   NAME,
  ... 
)

Set the brace-level-specific variable with name NAME to 3.

See also
__BLOCKSTATE_SET0

◆ __BLOCKSTATE_TST

#define __BLOCKSTATE_TST (   NAME,
  ... 
)

Test the brace-level-specific variable with name NAME.

If the variable is not yet defined, define it first and set it to zero.

Remarks
The default for the second argument is __BRACE_LEVEL__.
Returns
Expands to the current integer value of the variable.