Skip to content

Instantly share code, notes, and snippets.

@lmdexpr
Created January 15, 2015 13:31
Show Gist options
  • Save lmdexpr/e1a85a97c5865f21f331 to your computer and use it in GitHub Desktop.
Save lmdexpr/e1a85a97c5865f21f331 to your computer and use it in GitHub Desktop.
#define CMD(x) "\033[" x
#define F_COL(x) CMD("3" x "m")
#define B_COL(x) CMD("4" x "m")
#define R "1"
#define G "2"
#define Y "3"
#define B "4"
#define M "5"
#define C "6"
#define W "7"
#define D "9"
#define CLEAR printf(CMD("2J"));
#define MOVE_TOP printf(CMD("0;0H"));
#define pp(msg, ...) printf("\t\t" msg "\n", ##__VA_ARGS__)
#define error(msg, ...) {\
fprintf(stderr, F_COL(R) "ERROR" F_COL(D) ":" msg "\n", ##__VA_ARGS__);\
exit(EXIT_FAILURE);\
}
#if DEBUG == 1
# define debug_print_string(var) printf(F_COL(Y) "Trace" F_COL(D) ":(string)%s:%s", #var, var);
# define debug_print_char(var) printf(F_COL(Y) "Trace" F_COL(D) ":(char)%s:%c\n", #var, var);
# define debug_print_int(var) printf(F_COL(Y) "Trace" F_COL(D) ":(int)%s:%d\n" , #var, var);
# define debug_nl puts("");
#else
# define debug_print_string(var)
# define debug_print_char(var)
# define debug_print_int(var)
# define debug_nl
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment