diff options
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h new file mode 100644 index 0000000..a1daa03 --- /dev/null +++ b/src/common.h @@ -0,0 +1,20 @@ +#ifndef COMMON_H +#define COMMON_H + +#include <stdio.h> + +#define __RED__ "\033[0;31m" +#define __GREEN__ "\033[0;32m" +#define __YELLOW__ "\033[0;33m" +#define __RESET__ "\033[0m" + +#define STR(x) #x +#define XSTR(x) STR(x) + +#define info(...) do { fprintf(stdout, __GREEN__"[INFO]"__RESET__" "__VA_ARGS__); fprintf(stdout, "\n"); } while(0) +#define err(...) do { fprintf(stderr, __RED__"[ERROR]"__RESET__" "__FILE__":"XSTR(__LINE__)": "__VA_ARGS__); fprintf(stderr, "\n"); }while(0) +#define warn(...) do { fprintf(stderr, __YELLOW__"[WARN]"__RESET__" "__FILE__":"XSTR(__LINE__)": "__VA_ARGS__); fprintf(stderr, "\n"); }while(0) +// #define info(...) printf(__VA_ARGS__); +// #define err(...) printf(__VA_ARGS__); + +#endif |