Merge pull request #3881 from sethjackson/msvc-ui-call

MSVC: Fix UI_CALL for MSVC
This commit is contained in:
Justin M. Keyes 2015-12-31 00:16:07 -05:00
commit 68fb815bf1

View File

@ -55,14 +55,25 @@ static int height, width;
//
// See http://stackoverflow.com/a/11172679 for a better explanation of how it
// works.
#define UI_CALL(...) \
do { \
flush_cursor_update(); \
for (size_t i = 0; i < ui_count; i++) { \
UI *ui = uis[i]; \
UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \
} \
} while (0)
#ifdef _MSC_VER
#define UI_CALL(funname, ...) \
do { \
flush_cursor_update(); \
for (size_t i = 0; i < ui_count; i++) { \
UI *ui = uis[i]; \
UI_CALL_MORE(funname, __VA_ARGS__); \
} \
} while (0)
#else
#define UI_CALL(...) \
do { \
flush_cursor_update(); \
for (size_t i = 0; i < ui_count; i++) { \
UI *ui = uis[i]; \
UI_CALL_HELPER(CNT(__VA_ARGS__), __VA_ARGS__); \
} \
} while (0)
#endif
#define CNT(...) SELECT_NTH(__VA_ARGS__, MORE, MORE, MORE, MORE, ZERO, ignore)
#define SELECT_NTH(a1, a2, a3, a4, a5, a6, ...) a6
#define UI_CALL_HELPER(c, ...) UI_CALL_HELPER2(c, __VA_ARGS__)