/*!@file \brief Macros for printing unicode to streams \details Standardized method of handling unicodes in warnings, and errors \author Jordan Lavatai \date Aug 2016 ----------------------------------------------------------------------------*/ /* u8 print macros */ #ifndef _PRINT_H_ #define _PRINT_H_ #include #ifndef DEBUG #define DEBUG 0 #endif /* wprintf callback, may be defined prior to include or undefined and redefined later */ #ifndef wprintf_callback #define wprintf_callback(...) do { \ } while (0) #endif /* eprintf callback, may be defined prior to include or undefined and redefined later */ #ifndef eprintf_callback #define eprintf_callback(...) do { \ } while (0) #endif /* Print a unicode string */ #define uprintf(...) do { \ ulc_fprintf(stdout, __VA_ARGS__); \ } while (0) /* Print a unicode string to a filestream */ #define ufprintf(_STREAM,...) do { \ ulc_fprintf(_STREAM, __VA_ARGS__); \ } while (0) /* Print a warning message to stderr, then do_warn */ #define wprintf(...) do { \ ufprintf(stderr, __VA_ARGS__); \ wprintf_callback(__VA_ARGS__); \ } while (0) /* Print an error message to stderr, then do_error */ #define eprintf(...) do { \ ufprintf(stderr, __VA_ARGS__); \ eprintf_callback(__VA_ARGS_); \ } while (0) /* Print only when the provided boolean is true */ #define bprintf(_BOOL,...) do { \ if (_BOOL) \ ufprintf(stdout, __VA_ARGS__); \ } while (0) /* Print only when DEBUG is set to a value */ #define dprintf(...) do { \ bprintf(DEBUG, __VA_ARGS__); \ } while (0) #endif