|
pputl
0.2.1
pputl Preprocessor Utilities
|
Modules | |
| gen | |
| join | |
| tuple | |
Macros | |
| #define | PPUTL_ADD(a, b) PPUTL_DETAIL_ADD_REDUCE(PPUTL_DETAIL_ADD_REDUCER, a, PPUTL_GEN_REPEAT(b, 0)) |
| #define | PPUTL_CAT(...) PPUTL_DETAIL_CAT_X(__VA_ARGS__) |
| #define | PPUTL_CHOOSE(idx) PPUTL_CAT(PPUTL_DETAIL_CHOOSE_, idx) |
| #define | PPUTL_DEC(n) PPUTL_CAT(PPUTL_DETAIL_DEC_, n) |
| #define | PPUTL_EAT(...) |
| #define | PPUTL_EMPTY() |
| #define | PPUTL_EQ(a, b) PPUTL_DETAIL_EQ_X(a, b) |
| #define | PPUTL_EXPAND(...) PPUTL_DETAIL_EXPAND_X(__VA_ARGS__) |
| #define | PPUTL_FIRST(...) PPUTL_DETAIL_FIRST_X(__VA_ARGS__) |
| #define | PPUTL_IIF(bit) PPUTL_CAT(PPUTL_DETAIL_IIF_, bit) |
| #define | PPUTL_INC(n) PPUTL_CAT(PPUTL_DETAIL_INC_, n) |
| #define | PPUTL_INCLUDES(n, ...) |
| #define | PPUTL_NARGS(...) PPUTL_DETAIL_NARGS_X(__VA_ARGS__) |
| #define | PPUTL_NEQ(a, b) PPUTL_NOT(PPUTL_EQ(a, b)) |
| #define | PPUTL_NOT(b) PPUTL_IIF(b)(0, 1) |
| #define | PPUTL_NOTHING |
| #define | PPUTL_REDUCE(reducer, initial, ...) |
| #define | PPUTL_REST(...) PPUTL_DETAIL_REST_X(__VA_ARGS__) |
| #define | PPUTL_STRINGIZE(...) PPUTL_DETAIL_STRINGIZE_X(__VA_ARGS__) |
| #define | PPUTL_SUM(...) PPUTL_DETAIL_SUM_REDUCE(PPUTL_DETAIL_SUM_REDUCER, 0, __VA_ARGS__) |
| #define PPUTL_ADD | ( | a, | |
| b | |||
| ) | PPUTL_DETAIL_ADD_REDUCE(PPUTL_DETAIL_ADD_REDUCER, a, PPUTL_GEN_REPEAT(b, 0)) |
| #define PPUTL_CHOOSE | ( | idx | ) | PPUTL_CAT(PPUTL_DETAIL_CHOOSE_, idx) |
expands to arg at index idx [0, 256)
| #define PPUTL_DEC | ( | n | ) | PPUTL_CAT(PPUTL_DETAIL_DEC_, n) |
| #define PPUTL_EQ | ( | a, | |
| b | |||
| ) | PPUTL_DETAIL_EQ_X(a, b) |
| #define PPUTL_EXPAND | ( | ... | ) | PPUTL_DETAIL_EXPAND_X(__VA_ARGS__) |
| #define PPUTL_FIRST | ( | ... | ) | PPUTL_DETAIL_FIRST_X(__VA_ARGS__) |
return the first passed argument
| ... | args |
| #define PPUTL_IIF | ( | bit | ) | PPUTL_CAT(PPUTL_DETAIL_IIF_, bit) |
| #define PPUTL_INC | ( | n | ) | PPUTL_CAT(PPUTL_DETAIL_INC_, n) |
| #define PPUTL_INCLUDES | ( | n, | |
| ... | |||
| ) |
expands to 1 if numeric args [0, 256) have at least one n value; else 0
| n | number to check for |
| ... | numeric args; all values and total size ranged [0, 256) |
| #define PPUTL_NARGS | ( | ... | ) | PPUTL_DETAIL_NARGS_X(__VA_ARGS__) |
| #define PPUTL_NOT | ( | b | ) | PPUTL_IIF(b)(0, 1) |
| #define PPUTL_REDUCE | ( | reducer, | |
| initial, | |||
| ... | |||
| ) |
reduces [0, 256) args to one expansion using a reducer macro
warn: REDUCE calls cannot be chained together. Macros utilizing REDUCE cannot be used by other macros using REDUCE. See tools/genReduceMacro to generate this functionality for each use. To create this file: node genReduceMacro PPUTL REDUCE 256 false.
| reducer | - macro function of the form: f(accumulator, current, index) -> accumulator |
| initial | - intial value of the accumulator |
| ... | - args to reduce #include <pputl/add.h>
#include <pputl/reduce.h>
#define SUM_REDUCER(a, v, i) PPUTL_ADD(a, v)
// SUM(): 0; SUM(0): 0; SUM(1): 1; SUM(1, 2, 3): 6
#define SUM(...) PPUTL_REDUCE(SUM_REDUCER, 0, __VA_ARGS__)
|
| #define PPUTL_REST | ( | ... | ) | PPUTL_DETAIL_REST_X(__VA_ARGS__) |
return all passed arguments except for the first
| ... | args |
1.8.18