infinite terrain experiments
[shady.git] / output.hpp
blobb0bc054a756056f725ae4b2fc188f08ff6efe962
2 #ifndef SHADY_OUTPUT_HPP
3 #define SHADY_OUTPUT_HPP
5 extern int debug_depth;
7 #include <cstdio>
8 #define _OUT_PRINT std::fprintf
10 #define _OUT_BRACKET(str) OUT_COLORED(OUT_CYAN, str)
12 #define OUT_OPEN(F,...) _OUT_PRINT(stdout,"%*c" F " " _OUT_BRACKET("{") "\n",(debug_depth++)*2,' ',##__VA_ARGS__)
13 #define OUT(F,...) _OUT_PRINT(stdout,"%*c" F "\n",(debug_depth)*2,' ',##__VA_ARGS__)
14 #define OUT_CLOSE() _OUT_PRINT(stdout,"%*c" _OUT_BRACKET("}") "\n",(--debug_depth)*2,' ')
15 #define OUT_START() _OUT_PRINT(stdout,"%*c",(debug_depth)*2,' ')
16 #define OUT_END() _OUT_PRINT(stdout,"\n")
17 #define OUT_PART(...) _OUT_PRINT(stdout,__VA_ARGS__)
19 #define OUT_RESET "0"
20 #define OUT_BRIGHT "1"
21 #define OUT_DIM "2"
22 #define OUT_UNDERLINE "3"
23 #define OUT_BLINK "5"
24 #define OUT_REVERSE "7"
25 #define OUT_HIDDEN "8"
27 #define OUT_BLACK "0"
28 #define OUT_RED "1"
29 #define OUT_GREEN "2"
30 #define OUT_YELLOW "3"
31 #define OUT_BLUE "4"
32 #define OUT_MAGENTA "5"
33 #define OUT_CYAN "6"
34 #define OUT_WHITE "7"
36 #define OUT_FG "3"
37 #define OUT_BG "4"
39 #define OUT_SHELLCOMMAND(command) "\x1B[" command "m"
41 #define OUT_FGCOLOR(color) OUT_SHELLCOMMAND(OUT_FG color)
42 #define OUT_COLOR_RESET OUT_SHELLCOMMAND(OUT_RESET)
44 #define OUT_COLORED(color, str) OUT_FGCOLOR(color) str OUT_COLOR_RESET
45 #define OUT_SEP ";"
47 #define ERROR_COLOR OUT_RED OUT_SEP OUT_BRIGHT
48 #define ERROR(F,...) _OUT_PRINT(stderr,"%*c" OUT_COLORED(ERROR_COLOR, "ERROR: " F) "\n",(debug_depth)*2,' ',##__VA_ARGS__)
49 #define WARNING_COLOR OUT_YELLOW OUT_SEP OUT_BRIGHT
50 #define WARNING(F,...) _OUT_PRINT(stderr,"%*c" OUT_COLORED(WARNING_COLOR, "WARNING: " F) "\n",(debug_depth)*2,' ',##__VA_ARGS__)
52 #endif // SHADY_OUTPUT_HPP