Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include"base/dependencies/index.hpp"
- #include"attributes.hpp"
- #include"characters.hpp"
- #include"output.hpp"
- // Control sequence introducer for the terminal.
- #define CSI "\033["
- // RGB foreground color prefix sequence.
- #define RGB CSI"38;2;"
- // Color sequences.
- #define BLUE RGB"30;144;255m"
- #define CYAN RGB"0;206;209m"
- #define GRAY RGB"119;136;153m"
- #define GREEN RGB"50;205;50m"
- #define RED RGB"255;0;0m"
- #define VIOLET RGB"148;0;211m"
- #define YELLOW RGB"255;215;0m"
- // Font style sequences.
- #define BOLD CSI"1m"
- #define ITALIC CSI"3m"
- #define NOBOLD CSI"22m"
- #define NOITALIC CSI"23m"
- #define NOUNDERLINE CSI"24m"
- #define UNDERLINE CSI"4m"
- // Reset sequence.
- #define RESET CSI"m"
- // Constant expression that evaluates to nothing.
- #define NOOP ((void)0)
- // Assert that an expression is true locally.
- #ifdef LOCAL
- #define ASSERT(x)({if(!(x))UNLIKELY{write(cerr,RED,BOLD,"Error",NOBOLD,": fail\
- ed assertion in line ",UNDERLINE,__FILE__,':',__LINE__,NOUNDERLINE,": ",ITALIC\
- ,#x,RESET,lf);abort();}})
- #else
- #define ASSERT(x)NOOP
- #endif
- // Print an expression and its value to standard error locally.
- #ifdef LOCAL
- #define DEBUG(x)(write(cerr,BLUE,ITALIC,#x,NOITALIC," = ",(x),RESET,lf))
- #else
- #define DEBUG(x)NOOP
- #endif
- // Print multiple values to standard error locally.
- #ifdef LOCAL
- #define LOG(...)(write(cerr,GRAY,__VA_ARGS__,RESET,lf))
- #else
- #define LOG(...)NOOP
- #endif
- // Print a new line to standard error locally.
- #ifdef LOCAL
- #define LINE (cerr<<lf)
- #else
- #define LINE NOOP
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement