Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef P99_ARGS_H_
00014 # define P99_ARGS_H_
00015
00021 #include "p99_paste.h"
00022
00041 #define P00_NARG(...) P00_NARG_1(__VA_ARGS__)
00042
00043 #define P00_IS__EQ__(...) ,
00044
00065 #define P99_IS_EMPTY(...) \
00066 P00_ISEMPTY( \
00067
00068 \
00069 P99_HAS_COMMA(__VA_ARGS__), \
00070
00071 \
00072 P99_HAS_COMMA(P00_IS__EQ__ __VA_ARGS__), \
00073
00074 \
00075 P99_HAS_COMMA(__VA_ARGS__ ()), \
00076
00077 \
00078 P99_HAS_COMMA(P00_IS__EQ__ __VA_ARGS__ ()) \
00079 )
00080
00081 #define P00_ISEMPTY(_0, _1, _2, _3) P99_HAS_COMMA(P99_PASTE5(P00_IS_EMPTY_CASE_, _0, _1, _2, _3))
00082 #define P00_IS_EMPTY_CASE_0000 P00_IS_EMPTY_CASE_0000
00083 #define P00_IS_EMPTY_CASE_0001 ,
00084 #define P00_IS_EMPTY_CASE_0010 P00_IS_EMPTY_CASE_0010
00085 #define P00_IS_EMPTY_CASE_0011 P00_IS_EMPTY_CASE_0011
00086 #define P00_IS_EMPTY_CASE_0100 P00_IS_EMPTY_CASE_0100
00087 #define P00_IS_EMPTY_CASE_0101 P00_IS_EMPTY_CASE_0101
00088 #define P00_IS_EMPTY_CASE_0110 P00_IS_EMPTY_CASE_0110
00089 #define P00_IS_EMPTY_CASE_0111 P00_IS_EMPTY_CASE_0111
00090 #define P00_IS_EMPTY_CASE_1000 P00_IS_EMPTY_CASE_1000
00091 #define P00_IS_EMPTY_CASE_1001 P00_IS_EMPTY_CASE_1001
00092 #define P00_IS_EMPTY_CASE_1010 P00_IS_EMPTY_CASE_1010
00093 #define P00_IS_EMPTY_CASE_1011 P00_IS_EMPTY_CASE_1011
00094 #define P00_IS_EMPTY_CASE_1100 P00_IS_EMPTY_CASE_1100
00095 #define P00_IS_EMPTY_CASE_1101 P00_IS_EMPTY_CASE_1101
00096 #define P00_IS_EMPTY_CASE_1110 P00_IS_EMPTY_CASE_1110
00097 #define P00_IS_EMPTY_CASE_1111 P00_IS_EMPTY_CASE_1111
00098
00099
00100 #define P00_NARG_EMPTY_1(VAL) 0
00101 #define P00_NARG_EMPTY_0(VAL) VAL
00102
00111 #define P99_NARG(...) P00_NARG__1(P99_IS_EMPTY(__VA_ARGS__), P00_NARG(__VA_ARGS__))
00112 #define P00_NARG__1(B, VAL) P00_NARG__2(P99_PASTE2(P00_NARG_EMPTY_, B), VAL)
00113 #define P00_NARG__2(B, VAL) B(VAL)
00114
00115
00136 #define P99_TOK_EQ(TOK, ...) P00_TOK_EQ_(P99_PASTE3(P00_IS_, TOK, _EQ_), __VA_ARGS__)
00137 #define P00_TOK_EQ_(MAC, ...) P00_TOK_EQ__(MAC, __VA_ARGS__)
00138 #define P00_TOK_EQ__(MAC, ...) P99_HAS_COMMA(P99_PASTE2(P00_TOK_EQ_, P00_NARG(MAC ## __VA_ARGS__ (~) MAC ## __VA_ARGS__))(~))
00139
00140 #define P00_TOK_EQ_0(...) ~
00141 #define P00_TOK_EQ_1(...) ~
00142 #define P00_TOK_EQ_2(...) ,
00143 #define P00_TOK_EQ_3(...) ~
00144 #define P00_TOK_EQ_4(...) ~
00145
00146
00207 #define P99_VA_ARGS(X) size_t X , ...
00208
00209 #define P00_FSYMB(NAME) P99_PASTE5(NAME, _f, sy, mb, _)
00210
00217 #define P99_FSYMB(NAME) P00_FSYMB(NAME)
00218
00228 #define P99_LENGTH_VA_ARG(...) ((size_t)P99_NARG(__VA_ARGS__)), __VA_ARGS__
00229
00230
00276 #define P99_LENGTH_ARR_ARG(T, ...) ((size_t)P99_NARG(__VA_ARGS__)), (T[]){ __VA_ARGS__ }
00277
00278
00285 #endif