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.

P99_ARE_EQ
#define P99_ARE_EQ(FIRST,...)
Check if the arguments in the list are all equal.
Definition: p99_for.h:401
void
void void
Definition: p99_bitset.h:84
P99_ADESIGNATED
#define P99_ADESIGNATED(VAR, N)
Expand to an array initializer copying array VAR for N positions.
Definition: p99_map.h:267
f
f
Definition: p99_str.h:138
P99_IS_MIN
#define P99_IS_MIN(FIRST,...)
Check if argument FIRST is less than the other elements in the list.
Definition: p99_for.h:416
P99_IS_MAX
#define P99_IS_MAX(FIRST,...)
Check if argument FIRST is strictly greater than the other elements in the list.
Definition: p99_for.h:447
P99_IS_SUP
#define P99_IS_SUP(FIRST,...)
Check if argument FIRST is greater than or equal to the other elements in the list.
Definition: p99_for.h:463
P99_DESIGNATED
#define P99_DESIGNATED(VAR,...)
Construct a designated initializer by copying fields of VAR.
Definition: p99_map.h:253
P99_IS_ONE
#define P99_IS_ONE(FIRST,...)
Check if argument FIRST is equal to one of the other elements in the list.
Definition: p99_for.h:386
P99_AASSIGN
#define P99_AASSIGN(TARGET, SOURCE, N)
Assign the content of array SOURCE to TARGET.
Definition: p99_map.h:355
P99_IS_INF
#define P99_IS_INF(FIRST,...)
Check if argument FIRST is less than or equal to the other elements in the list.
Definition: p99_for.h:432
P99_NARG
#define P99_NARG(...)
Return the length of the variable length argument list, where an empty argument list is considered to...
Definition: p99_args.h:117
P99_IF_LT
#define P99_IF_LT(A, B)
Test two decimal numbers A and B for whether A is strictly less than B.
Definition: p99_if.h:120
P99_ARE_ORDERED
#define P99_ARE_ORDERED(OP,...)
Check if the arguments in the list are ordered according to the operation OP.
Definition: p99_for.h:481
d
d
Definition: p99_str.h:138
P99_BIGFUNC
#define P99_BIGFUNC(FUNC, M,...)
Realize the right associative call of binary function FUNC of all the arguments.
Definition: p99_for.h:154
P99_LCOPY
#define P99_LCOPY(TYPE, VAR,...)
Construct a compound literal of type TYPE by copying fields of VAR.
Definition: p99_map.h:299
P99_IF_VOID
#define P99_IF_VOID(...)
Definition: p99_if.h:171
P99_FOR
#define P99_FOR(NAME, N, OP, FUNC,...)
A preprocessor pseudo iterator.
Definition: p99_for.h:92