P99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions
p99_generic.h File Reference
#include "p99_for.h"
#include "p99_enum.h"
#include "p99_typenames.h"
#include "p99_c99.h"
+ Include dependency graph for p99_generic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define P99_AVALUE(X, ...)
 For a pointer or array expression X return the underlying array. More...
 
#define P99_DECLARE_INLINE_EXPRESSION(EXT, BASE, EXP, ...)
 Declare an inline function of basename BASE for expression EXP, applied to the builtin type EXT. More...
 
#define P99_DECLARE_INLINE_EXPRESSIONS(NEPL, ...)
 Declare a whole bunch of inline functions of basename BASE for expression EXP, applied to the builtin types as given in the argument list. More...
 
#define P99_FORMAT(...)
 
#define P99_FORMATS(...)   P99_SEQ(P99_FORMAT, __VA_ARGS__)
 
#define P99_FPRINTF(F, FORMAT, ...)   fprintf(F, FORMAT, P99_FORMATS(__VA_ARGS__))
 
#define P99_GEN_ABS(A)   P99_GEN_EXPR(abs, ((A) >= 0) ? (A) : -(A), P99_STD_REAL_EXTS)(A)
 
#define P99_GEN_EXPR(BASE, EXPR, ...)
 Produce a type generic expression that can be used as if it were an inline function. More...
 
#define P99_GEN_MAX(A, B)
 
#define P99_GEN_MIN(A, B)
 
#define P99_GEN_SIN(A)   P99_GEN_EXPR(sin, (A), P99_STD_FLOATING_EXTS)(A)
 Type generic macro to compute the sine of A. More...
 
#define P99_GENERIC(...)
 Type generic expression in anticipation of C11 _Generic. More...
 
#define P99_GENERIC_INTEGRAL_CONSTANT(EXP, TRUE, FALSE)
 
#define P99_GENERIC_LIT(...)
 For each generic choice return a compound literal of the chosen type. More...
 
#define P99_GENERIC_NULLPTR(PEXP, TRUE, FALSE)
 
#define P99_GENERIC_NULLPTR_CONSTANT(PEXP, TRUE, FALSE)
 
#define P99_GENERIC_NULLPTR_CONSTANT_(PEXP, TRUE, FALSE)
 
#define P99_GENERIC_PCONST(PEXP, NCONST, CONST)
 Generic choice based on the qualification of the target of a pointer expression. More...
 
#define P99_GENERIC_PCONSTVOLATILE(PEXP, NON, FULL)
 Generic choice based on the qualification of the target of a pointer expression. More...
 
#define P99_GENERIC_PQUALIFIED(PEXP, ...)
 Generic choice based on the qualification of the target of a pointer expression. More...
 
#define P99_GENERIC_PVOLATILE(PEXP, NVOLATILE, VOLATILE)
 Generic choice based on the qualification of the target of a pointer expression. More...
 
#define P99_GENERIC_SIZE(UI, ...)
 Similar to P99_GENERIC but the choice is not according to the type of the expression UI but to its unsigned value. More...
 
#define P99_GENERIC_SIZE_LIT(UI, ...)
 Similar to P99_GENERIC_SIZE but returns a compound literal of the chosen type. More...
 
#define P99_GENERIC_TCONST(T, NCONST, CONST)   P99_GENERIC_PCONST((&(T)P99_INIT), NCONST, CONST)
 Generic choice based on the qualification of a type expression. More...
 
#define P99_GENERIC_TCONSTVOLATILE(T, NON, FULL)   P99_GENERIC_PCONSTVOLATILE((&(T)P99_INIT), NON, FULL)
 Generic choice based on the qualification of a type expression. More...
 
#define P99_GENERIC_TQUALIFIED(T, ...)   P99_GENERIC_PQUALIFIED((&(T)P99_INIT), ...)
 Generic choice based on the qualification of a type expression. More...
 
#define P99_GENERIC_TVOLATILE(T, NVOLATILE, VOLATILE)   P99_GENERIC_PVOLATILE((&(T)P99_INIT), NVOLATILE, VOLATILE)
 Generic choice based on the qualification of a type expression. More...
 
#define P99_IN_RANGE(R, S, L)   P00_IN_RANGE((R), (S), (L), P00_IN_RANGE_LIST())
 check if R is in the range [S, S + L) More...
 
#define P99_IS_INTEGRAL_CONSTANT(EXP)   P99_GENERIC_INTEGRAL_CONSTANT((EXP), true, false)
 Test if the expression EXP is an integral constant in the sense of the C standard. More...
 
#define P99_IS_NULLPTR(PEXP)   P99_GENERIC_NULLPTR((PEXP), true, false)
 Test if the expression EXP is a null pointer in the sense of the C standard. More...
 
#define P99_IS_NULLPTR_CONSTANT(PEXP)   P99_GENERIC_NULLPTR_CONSTANT((PEXP), true, false)
 Test if the expression PEXP is a null pointer constant in the sense of the C standard. More...
 
#define P99_OBJLEN(X, ...)
 For a pointer or array expression X return the length of the underlying array object. More...
 
#define P99_OBJSIZE(X, ...)
 For a pointer or array expression X return the size of the underlying object. More...
 
#define P99_OVALUE(X, ...)
 For a pointer or array expression X return the underlying object. More...
 
#define P99_PRINTF(FORMAT, ...)   printf(FORMAT, P99_FORMATS(__VA_ARGS__))
 
#define P99_SIZE_CHOICE(UI, YES, NO, ...)
 Classify expression UI according to its value and return YES if the value is in the list and NO, otherwise. More...
 
#define P99_SIZE_INDICATOR(UI, ...)
 Classify expression UI according to its value and return 1 if the value is in the list and 0, otherwise. More...
 
#define P99_SNPRINTF(S, N, FORMAT, ...)   snprintf(S, N, FORMAT, P99_FORMATS(__VA_ARGS__))
 
#define P99_SPRINTF(S, FORMAT, ...)   sprintf(S, FORMAT, P99_FORMATS(__VA_ARGS__))
 
#define P99_TYPE_ARITHMETIC(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_ARITHMETIC_TYPES)
 
#define P99_TYPE_BASIC(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_BASIC_TYPES)
 
#define P99_TYPE_CHARACTER(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_CHARACTER_TYPES)
 
#define P99_TYPE_CHOICE(EXP, YES, NO, ...)
 Classify expression EXP according to its type and return YES if the type is in the list and NO, otherwise. More...
 
#define P99_TYPE_COMPLEX(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_COMPLEX_TYPES)
 
#define P99_TYPE_FLOATING(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_FLOATING_TYPES)
 
#define P99_TYPE_INTEGER(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_INTEGER_TYPES)
 
#define P99_TYPE_REAL(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_REAL_TYPES)
 
#define P99_TYPE_REAL_FLOATING(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_REAL_FLOATING_TYPES)
 
#define P99_TYPE_SIGNED(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_SIGNED_TYPES)
 
#define P99_TYPE_UNSIGNED(EXP)   P99_TYPE_CHOICE((EXP), 1, 0, P99_STD_UNSIGNED_TYPES)
 
#define P99_TYPED_TERN(COND, YES, NO)
 A compile time ternary operator that is analogous to COND ? YES : NO that keeps the type of the chosen expression. More...
 

Functions

void P99_PASTEP00_ARG (p00_harmless_declaration_, P00_SPRINT_DEFINE, uchar, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,)(p00_harmless_declaration_
 
void P99_PASTEP00_ARG (p00_harmless_declaration_, P00_SPRINT_DEFINE, ullong, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,)(p00_harmless_declaration_
 
void P99_PASTEP00_ARG (p00_harmless_declaration_, P00_SPRINT_DEFINE, ulong, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,)(p00_harmless_declaration_
 
void P99_PASTEP00_ARG (p00_harmless_declaration_, P00_SPRINT_DEFINE, unsigned, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,)(p00_harmless_declaration_
 
void P99_PASTEP00_ARG (p00_harmless_declaration_, P00_SPRINT_DEFINE, ushort, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,)(p00_harmless_declaration_
 
void uchar (void)
 
void ullong (void)
 
void ulong (void)
 
void unsigned (void)
 
void ushort (void)
 
P99_GENERIC_PQUALIFIED
#define P99_GENERIC_PQUALIFIED(PEXP,...)
Generic choice based on the qualification of the target of a pointer expression.
Definition: p99_generic.h:1554
P99_GENERIC_LIT
#define P99_GENERIC_LIT(...)
For each generic choice return a compound literal of the chosen type.
Definition: p99_generic.h:728
P99_SIZE_INDICATOR
#define P99_SIZE_INDICATOR(UI,...)
Classify expression UI according to its value and return 1 if the value is in the list and 0,...
Definition: p99_generic.h:856
uintmax_t
uintmax_t
Definition: p99_str.h:117
P99_GENERIC
#define P99_GENERIC(...)
Type generic expression in anticipation of C11 _Generic.
Definition: p99_generic.h:707
f
f
Definition: p99_str.h:138
ptrdiff_t
ptrdiff_t
Definition: p99_str.h:101
ld
ld
Definition: p99_str.h:138
P99_GENERIC_NULLPTR_CONSTANT
#define P99_GENERIC_NULLPTR_CONSTANT(PEXP, TRUE, FALSE)
Definition: p99_generic.h:1707
P99_DECLARE_INLINE_EXPRESSION
#define P99_DECLARE_INLINE_EXPRESSION(EXT, BASE, EXP,...)
Declare an inline function of basename BASE for expression EXP, applied to the builtin type EXT.
Definition: p99_generic.h:890
P99_GEN_EXPR
#define P99_GEN_EXPR(BASE, EXPR,...)
Produce a type generic expression that can be used as if it were an inline function.
Definition: p99_generic.h:1000
P99_GEN_MAX
#define P99_GEN_MAX(A, B)
Definition: p99_generic.h:1002
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_GENERIC_NULLPTR_CONSTANT_
#define P99_GENERIC_NULLPTR_CONSTANT_(PEXP, TRUE, FALSE)
Definition: p99_generic.h:1702
P99_DECLARE_INLINE_EXPRESSIONS
#define P99_DECLARE_INLINE_EXPRESSIONS(NEPL,...)
Declare a whole bunch of inline functions of basename BASE for expression EXP, applied to the builtin...
Definition: p99_generic.h:926
d
d
Definition: p99_str.h:138
P99_GENERIC_SIZE
#define P99_GENERIC_SIZE(UI,...)
Similar to P99_GENERIC but the choice is not according to the type of the expression UI but to its un...
Definition: p99_generic.h:761
i
P00_CLAUSE2 i(_Pragma("weak p00_getopt_comp"))(_Pragma("weak p00_getopt_comp
P99_GENERIC_INTEGRAL_CONSTANT
#define P99_GENERIC_INTEGRAL_CONSTANT(EXP, TRUE, FALSE)
Definition: p99_generic.h:1744
P99_STD_REAL_EXTS
#define P99_STD_REAL_EXTS
Definition: p99_type.h:294
P99_FORMAT
#define P99_FORMAT(...)
Definition: p99_generic.h:1417