P99
Macros
Produce C99 statements or expression lists
+ Collaboration diagram for Produce C99 statements or expression lists:

Macros

#define P99_AASSIGN(TARGET, SOURCE, N)
 Assign the content of array SOURCE to TARGET. More...
 
#define P99_ACCESSORS(X, N)   P00_ACCESSORS(X, N)
 
#define P99_ACOPY(TYPE, N, VAR, M)
 Expand to an array literal of type TYPE[N] copying from another array. More...
 
#define P99_ADDS(...)   P00_ADDS(P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Return a token that is the sum of all arguments. More...
 
#define P99_ADESIGNATED(VAR, N)   P99_DESIGNATED(VAR, P99_ACCESSORS(, N))
 Expand to an array initializer copying array VAR for N positions. More...
 
#define P99_ANDS(...)   P99_BIGOP(P00_AND, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative logical and of all the arguments. More...
 
#define P99_ARE_EQ(FIRST, ...)   P99_FOR(== (FIRST), P99_NARG(__VA_ARGS__), P00_AND, P00_ISIT, __VA_ARGS__)
 Check if the arguments in the list are all equal. More...
 
#define P99_ARE_ORDERED(OP, ...)   P00_ARE_ORDERED(OP, P99_NARG(__VA_ARGS__), __VA_ARGS__)
 Check if the arguments in the list are ordered according to the operation OP. More...
 
#define P99_BANDS(...)   P99_BIGOP(P00_BAND, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative bitwise and of all the arguments. More...
 
#define P99_BORS(...)   P99_BIGOP(P00_BOR, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative bitwise or of all the arguments. More...
 
#define P99_DESIGNATED(VAR, ...)   { P00_DESIGNATED(VAR, P99_NARG(__VA_ARGS__), __VA_ARGS__) }
 Construct a designated initializer by copying fields of VAR. More...
 
#define P99_IPOW(N, X)   P99_IF_EQ(N,0)(P99_SIGN_PROMOTE(1, X))((P99_FOR(X, N, P00_POW, P00_POW0, P99_REP(N,))))
 Compute the Nth multiplicative integer power of X. More...
 
#define P99_IS_INF(FIRST, ...)   P99_FOR(> (FIRST), P99_NARG(__VA_ARGS__), P00_AND, P00_ISIT, __VA_ARGS__)
 Check if argument FIRST is less than or equal to the other elements in the list. More...
 
#define P99_IS_MAX(FIRST, ...)   P99_FOR(<= (FIRST), P99_NARG(__VA_ARGS__), P00_AND, P00_ISIT, __VA_ARGS__)
 Check if argument FIRST is strictly greater than the other elements in the list. More...
 
#define P99_IS_MIN(FIRST, ...)   P99_FOR(>= (FIRST), P99_NARG(__VA_ARGS__), P00_AND, P00_ISIT, __VA_ARGS__)
 Check if argument FIRST is less than the other elements in the list. More...
 
#define P99_IS_ONE(FIRST, ...)   P99_FOR(== (FIRST), P99_NARG(__VA_ARGS__), P00_OR, P00_ISIT, __VA_ARGS__)
 Check if argument FIRST is equal to one of the other elements in the list. More...
 
#define P99_IS_SUP(FIRST, ...)   P99_FOR(< (FIRST), P99_NARG(__VA_ARGS__), P00_AND, P00_ISIT, __VA_ARGS__)
 Check if argument FIRST is greater than or equal to the other elements in the list. More...
 
#define P99_JOIN(...)   P99_STRCATS((char[P99_SIZEOFS(__VA_ARGS__) + 1]){ 0 }, __VA_ARGS__)
 Concatenate all arguments. More...
 
#define P99_LCOPY(TYPE, VAR, ...)   ((TYPE)P99_DESIGNATED(VAR, __VA_ARGS__))
 Construct a compound literal of type TYPE by copying fields of VAR. More...
 
#define P99_ORS(...)   P99_BIGOP(P00_OR, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative logical or of all the arguments. More...
 
#define P99_POSS(N)   P99_FOR(,N, P00_SEQ, P00_POS,)
 Produce a list of length N that has the contents of 0, 1, , N-1. More...
 
#define P99_PRODS(...)   P99_BIGOP(P00_PROD, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative product of all the arguments. More...
 
#define P99_QUOTS(...)   P99_BIGOP(P00_QUOT, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative quotient of all the arguments. More...
 
#define P99_SIZEOFS(...)   P00_SIZEOFS(P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Return an expression that returns the sum of the size of all arguments. More...
 
#define P99_STRCATS(TARG, ...)
 Append all argument strings after TARG to TARG. More...
 
#define P99_STRDUP(...)   P99_STRCATS(calloc(P99_STRLENS(__VA_ARGS__) + 16, 1), __VA_ARGS__)
 Concatenate all arguments. More...
 
#define P99_STRLENS(...)   P00_STRLENS(P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Return an expression that returns the sum of the lengths of all strings that are given as arguments. More...
 
#define P99_SUMS(...)   P99_BIGOP(P00_SUM, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative sum of all the arguments. More...
 
#define P99_TYPEDEFS(NAME, ...)   P00_TYPEDEFS(NAME, P99_NARG(__VA_ARGS__), __VA_ARGS__)
 Take each argument on the list and transform it into a typedef of name NAME_0, NAME_1, etc. More...
 
#define P99_VASSIGNS(NAME, ...)
 Vector-assign to a list. More...
 
#define P99_XORS(...)   P99_BIGOP(P00_XOR, P99_NARG(__VA_ARGS__),__VA_ARGS__)
 Realize the right associative bitwise exclusive or of all the arguments. More...
 

Detailed Description

This provides tools to produce a list of declarations (e.g typedef), list of initializers or perform a sequence of additions or other operations. The input usually is just a list of names, e.g.