-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
186 additions
and
135 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#ifndef LIP_PP_H | ||
#define LIP_PP_H | ||
|
||
#define lip_pp_map(f, ...) \ | ||
lip_pp_msvc_vararg_expand( \ | ||
lip_pp_map1(f, lip_pp_concat(lip_pp_apply, lip_pp_len(__VA_ARGS__)), __VA_ARGS__) \ | ||
) | ||
#define lip_pp_map1(f, apply_n, ...) \ | ||
lip_pp_msvc_vararg_expand( \ | ||
apply_n(lip_pp_tail((lip_pp_seq())), f, __VA_ARGS__) \ | ||
) | ||
#define lip_pp_apply1(seq, f, a) f(lip_pp_head(seq), a) | ||
#define lip_pp_apply2(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply1(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply3(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply2(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply4(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply3(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply5(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply4(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply6(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply5(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply7(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply6(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply8(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply7(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply9(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply8(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
#define lip_pp_apply10(seq, f, a, ...) f(lip_pp_head(seq), a) lip_pp_msvc_vararg_expand(lip_pp_apply9(lip_pp_tail(seq), f, __VA_ARGS__)) | ||
|
||
#define lip_pp_len(...) lip_pp_msvc_vararg_expand(lip_pp_len1(__VA_ARGS__, lip_pp_inv_seq())) | ||
#define lip_pp_len1(...) lip_pp_msvc_vararg_expand(lip_pp_len2(__VA_ARGS__)) | ||
#define lip_pp_len2( \ | ||
x15, x14, x13, x12, \ | ||
x11, x10, x9, x8, \ | ||
x7, x6, x5, x4, \ | ||
x3, x2, x1, N, \ | ||
...) N | ||
#define lip_pp_inv_seq() \ | ||
15, 14, 13, 12, 11, 10, 9, 8, \ | ||
7, 6, 5, 4, 3, 2, 1, 0 | ||
#define lip_pp_seq() \ | ||
0, 1, 2, 3, 4, 5, 6, 7, \ | ||
8, 9, 10, 11, 12, 13, 14, 15 | ||
|
||
#define lip_pp_concat(a, b) lip_pp_concat1(a, b) | ||
#define lip_pp_concat1(a, b) lip_pp_concat2(a, b) | ||
#define lip_pp_concat2(a, b) a ## b | ||
|
||
#define lip_pp_nth(n, tuple, default_) \ | ||
lip_pp_nth_(n, lip_pp_pad(tuple, default_)) | ||
#define lip_pp_nth_(n, tuple) lip_pp_concat(lip_pp_nth, n) tuple | ||
#define lip_pp_nth1(x, ...) x | ||
#define lip_pp_nth2(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth1(__VA_ARGS__)) | ||
#define lip_pp_nth3(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth2(__VA_ARGS__)) | ||
#define lip_pp_nth4(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth3(__VA_ARGS__)) | ||
#define lip_pp_nth5(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth4(__VA_ARGS__)) | ||
#define lip_pp_nth6(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth5(__VA_ARGS__)) | ||
#define lip_pp_nth7(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth6(__VA_ARGS__)) | ||
#define lip_pp_nth8(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth7(__VA_ARGS__)) | ||
#define lip_pp_nth9(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth8(__VA_ARGS__)) | ||
#define lip_pp_nth10(x, ...) lip_pp_msvc_vararg_expand(lip_pp_nth9(__VA_ARGS__)) | ||
|
||
#define lip_pp_pad(tuple, val) (lip_pp_expand(tuple), val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val) | ||
|
||
#define lip_pp_expand(...) lip_pp_msvc_vararg_expand(lip_pp_expand1 __VA_ARGS__) | ||
#define lip_pp_expand1(...) __VA_ARGS__ | ||
|
||
#define lip_pp_head(x) lip_pp_head_ x | ||
#define lip_pp_head_(x, ...) x | ||
|
||
#define lip_pp_tail(x) lip_pp_tail_ x | ||
#define lip_pp_tail_(x, ...) (__VA_ARGS__) | ||
|
||
#define lip_pp_sep(x) lip_pp_concat(lip_pp_sep_, x) | ||
#define lip_pp_sep_1 | ||
#define lip_pp_sep_2 , | ||
#define lip_pp_sep_3 , | ||
#define lip_pp_sep_4 , | ||
#define lip_pp_sep_5 , | ||
#define lip_pp_sep_6 , | ||
#define lip_pp_sep_7 , | ||
#define lip_pp_sep_8 , | ||
#define lip_pp_sep_9 , | ||
#define lip_pp_sep_10 , | ||
|
||
#define lip_pp_msvc_vararg_expand(x) x | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.