P99
Macros
Preprocessor text and token manipulation

These macros allow the handling of small texts and tokens. More...

+ Collaboration diagram for Preprocessor text and token manipulation:

Macros

#define P99_BOOL_LEN(SEQ)   P99_IF_ELSE(P99_IS_BOOL_TOK(SEQ))(P00_BOOL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind BOOL. More...
 
#define P99_BOOL_QUAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_BOOL_QUAL_TOK(SEQ))(P00_BOOL_QUAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind BOOL_QUAL. More...
 
#define P99_BUILTIN_MAX(...)   P99_PASTE2(P00_, P99_PASTE(BUILTIN_MAX_, __VA_ARGS__))
 
#define P99_BUILTIN_MIN(...)   P99_PASTE2(P00_, P99_PASTE(BUILTIN_MIN_, __VA_ARGS__))
 
#define P99_BUILTIN_TYPE(...)   P99_PASTE2(P00_, P99_PASTE(BUILTIN_TYPE_, __VA_ARGS__))
 Find a builtin type according to a code such as ‘ull’ or ‘ld’. More...
 
#define P99_CAT2(_1, _2)   _1 ## _2
 Paste two token sequences at their junction. More...
 
#define P99_CONST_LEN(SEQ)   P99_IF_ELSE(P99_IS_CONST_TOK(SEQ))(P00_CONST1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind CONST. More...
 
#define P99_FLOAT_LEN(SEQ)   P99_IF_ELSE(P99_IS_FLOAT_TOK(SEQ))(P00_FLOAT1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind FLOAT. More...
 
#define P99_FLOAT_QUAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_FLOAT_QUAL_TOK(SEQ))(P00_FLOAT_QUAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind FLOAT_QUAL. More...
 
#define P99_INTEGER_LEN(SEQ)   P99_IF_ELSE(P99_IS_INTEGER_TOK(SEQ))(P00_INTEGER1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind INTEGER. More...
 
#define P99_INTEGER_QUAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_INTEGER_QUAL_TOK(SEQ))(P00_INTEGER_QUAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind INTEGER_QUAL. More...
 
#define P99_INTEGER_RANK(...)   P99_PASTE2(P00_, P99_PASTE(INTEGER_RANK_, __VA_ARGS__))
 
#define P99_INTEGER_SIGN(...)   P99_PASTE2(P00_, P99_PASTE(INTEGER_SIGN_, __VA_ARGS__))
 
#define P99_INTEGER_SIGNED(...)   P99_PASTE2(P00_, P99_PASTE(INTEGER_SIGNED_, __VA_ARGS__))
 
#define P99_INTEGER_UNSIGNED(...)   P99_PASTE2(P00_, P99_PASTE(INTEGER_UNSIGNED_, __VA_ARGS__))
 
#define P99_IS_BOOL_QUAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_BOOL_QUAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind BOOL_QUAL. More...
 
#define P99_IS_BOOL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_BOOL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind BOOL. More...
 
#define P99_IS_CONST_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_CONST_, SEQ))
 Test if the token sequence SEQ starts with a token of kind CONST. More...
 
#define P99_IS_FLOAT_QUAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_FLOAT_QUAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind FLOAT_QUAL. More...
 
#define P99_IS_FLOAT_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_FLOAT_, SEQ))
 Test if the token sequence SEQ starts with a token of kind FLOAT. More...
 
#define P99_IS_INTEGER_QUAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_INTEGER_QUAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind INTEGER_QUAL. More...
 
#define P99_IS_INTEGER_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_INTEGER_, SEQ))
 Test if the token sequence SEQ starts with a token of kind INTEGER. More...
 
#define P99_IS_KEYWORD_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_KEYWORD_, SEQ))
 Test if the token sequence SEQ starts with a token of kind KEYWORD. More...
 
#define P99_IS_REAL_QUAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_REAL_QUAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind REAL_QUAL. More...
 
#define P99_IS_REAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_REAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind REAL. More...
 
#define P99_IS_RESERVED_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_RESERVED_, SEQ))
 Test if the token sequence SEQ starts with a token of kind RESERVED. More...
 
#define P99_IS_RESTRICT_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_RESTRICT_, SEQ))
 Test if the token sequence SEQ starts with a token of kind RESTRICT. More...
 
#define P99_IS_TYPE_QUAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_TYPE_QUAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind TYPE_QUAL. More...
 
#define P99_IS_TYPE_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_TYPE_, SEQ))
 Test if the token sequence SEQ starts with a token of kind TYPE. More...
 
#define P99_IS_VOID_QUAL_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_VOID_QUAL_, SEQ))
 Test if the token sequence SEQ starts with a token of kind VOID_QUAL. More...
 
#define P99_IS_VOID_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_VOID_, SEQ))
 Test if the token sequence SEQ starts with a token of kind VOID. More...
 
#define P99_IS_VOLATILE_TOK(SEQ)   P99_HAS_COMMA(P99_PASTE2(P00_VOLATILE_, SEQ))
 Test if the token sequence SEQ starts with a token of kind VOLATILE. More...
 
#define P99_KEYWORD_LEN(SEQ)   P99_IF_ELSE(P99_IS_KEYWORD_TOK(SEQ))(P00_KEYWORD1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind KEYWORD. More...
 
#define P99_PASTE(...)   P00_PASTE(P00_NARG(__VA_ARGS__), __VA_ARGS__)
 A left-to-right associative paste operator. More...
 
#define P99_PASTE0()
 
#define P99_PASTE1(_1)   _1
 
#define P99_PASTE2(_1, _2)   P99_CAT2(_1, _2)
 Paste two token sequences at their junction. More...
 
#define P99_PASTE3(_1, _2, _3)   P99_PASTE2(P99_PASTE2(_1, _2), _3)
 
#define P99_PASTE4(_1, _2, _3, _4)   P99_PASTE2(P99_PASTE3(_1, _2, _3), _4)
 
#define P99_PASTE5(_1, _2, _3, _4, _5)   P99_PASTE2(P99_PASTE4(_1, _2, _3, _4), _5)
 
#define P99_PASTE6(_1, _2, _3, _4, _5, _6)   P99_PASTE2(P99_PASTE5(_1, _2, _3, _4, _5), _6)
 
#define P99_PASTID(...)   P99_PASTE2(P99_PASTID, P99_NARG(__VA_ARGS__))(__VA_ARGS__)
 
#define P99_PASTID0()
 
#define P99_PASTID1(ID)   ID
 
#define P99_PASTID2(ID0, ID1)   P99_IF_EMPTY(ID1)(P00_PASTID2(ID0, p007))(P00_PASTID2(ID0, ID1))
 
#define P99_REAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_REAL_TOK(SEQ))(P00_REAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind REAL. More...
 
#define P99_REAL_QUAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_REAL_QUAL_TOK(SEQ))(P00_REAL_QUAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind REAL_QUAL. More...
 
#define P99_RESERVED_LEN(SEQ)   P99_IF_ELSE(P99_IS_RESERVED_TOK(SEQ))(P00_RESERVED1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind RESERVED. More...
 
#define P99_RESTRICT_LEN(SEQ)   P99_IF_ELSE(P99_IS_RESTRICT_TOK(SEQ))(P00_RESTRICT1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind RESTRICT. More...
 
#define P99_TOK_EQ(TOK, ...)   P00_TOK_EQ_(P99_PASTE3(P00_IS_, TOK, _EQ_), __VA_ARGS__)
 Detect if two tokens are equal. More...
 
#define P99_TYPE_LEN(SEQ)   P99_IF_ELSE(P99_IS_TYPE_TOK(SEQ))(P00_TYPE1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind TYPE. More...
 
#define P99_TYPE_QUAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_TYPE_QUAL_TOK(SEQ))(P00_TYPE_QUAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind TYPE_QUAL. More...
 
#define P99_VOID_LEN(SEQ)   P99_IF_ELSE(P99_IS_VOID_TOK(SEQ))(P00_VOID1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind VOID. More...
 
#define P99_VOID_QUAL_LEN(SEQ)   P99_IF_ELSE(P99_IS_VOID_QUAL_TOK(SEQ))(P00_VOID_QUAL1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind VOID_QUAL. More...
 
#define P99_VOLATILE_LEN(SEQ)   P99_IF_ELSE(P99_IS_VOLATILE_TOK(SEQ))(P00_VOLATILE1(P00_EAT_FIRST(SEQ)))(0)
 Count the number of tokens in sequence SEQ that all are of kind VOLATILE. More...
 

Detailed Description

These macros allow the handling of small texts and tokens.

For the following tokens, the macro P99_TOK_EQ will work.

Warning
Non-functional macros cannot be captured by this mechanism since they will be expanded before we may actually handle them. This concerns in particular the following tokens that are defined to be macros: NULL and and_eq bitand bitor bool compl false not not_eq offsetof or or_eq true xor xor_eq
P99_PASTE
#define P99_PASTE(...)
A left-to-right associative paste operator.
Definition: p99_logical.h:357