Skip to content

Commit

Permalink
created first and rest macroses to operate va_args
Browse files Browse the repository at this point in the history
  • Loading branch information
aodinokov committed Sep 14, 2024
1 parent 2c08a55 commit 326ea67
Show file tree
Hide file tree
Showing 4 changed files with 1,098 additions and 1,055 deletions.
6 changes: 5 additions & 1 deletion examples/c_print_args_alt/mr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

/* Interface macros for unrolled loops from mr_pp.h */
#define MR_FOREACH(X, ...) MR_PASTE2 (MR_FOREACH, MR_NARG (__VA_ARGS__)) (X, __VA_ARGS__)
#define MR_FOREACH_EX(X, ...) MR_PASTE2 (MR_FOREACH_EX_, MR_NARG (__VA_ARGS__)) (X, __VA_ARGS__)
#define MR_FOR(NAME, N, OP, FUNC, ...) MR_PASTE2 (MR_FOR, N) (NAME, OP, FUNC, __VA_ARGS__)

// like car/cdr in lisp
#define MR_FIRST(_FIRST_, ...) _FIRST_
#define MR_REST(_FIRST_, ...) __VA_ARGS__
#define MR_FOREACH_EX(X, ...) MR_PASTE2 (MR_FOREACH_EX_, MR_NARG (__VA_ARGS__)) (X, __VA_ARGS__)

#endif
Loading

0 comments on commit 326ea67

Please sign in to comment.