File indexing completed on 2025-12-13 10:32:09
0001
0002
0003
0004
0005
0006 #ifndef YODA_FORMATTING_H
0007 #define YODA_FORMATTING_H
0008
0009 #include <iostream>
0010 #include <iomanip>
0011 #include <unistd.h>
0012
0013 #define MSG_(msg) do { std::cout << msg; } while (0)
0014
0015 #define MSG(msg) MSG_(msg << std::endl)
0016
0017 #define PAD(n) std::setw(n) << std::left
0018
0019 #define COLOR_(msg, code) \
0020 (isatty(1) ? code : "") << msg << (isatty(1) ? "\033[0m" : "")
0021
0022
0023 #define RED(msg) COLOR_(msg, "\033[0;31m")
0024 #define MSG_RED_(x) MSG_(RED(x))
0025 #define MSG_RED(x) MSG(RED(x))
0026
0027 #define GREEN(msg) COLOR_(msg, "\033[0;32m")
0028 #define MSG_GREEN_(x) MSG_(GREEN(x))
0029 #define MSG_GREEN(x) MSG(GREEN(x))
0030
0031 #define YELLOW(msg) COLOR_(msg, "\033[0;33m")
0032 #define MSG_YELLOW_(x) MSG_(YELLOW(x))
0033 #define MSG_YELLOW(x) MSG(YELLOW(x))
0034
0035 #define BLUE(msg) COLOR_(msg, "\033[0;34m")
0036 #define MSG_BLUE_(x) MSG_(BLUE(x))
0037 #define MSG_BLUE(x) MSG(BLUE(x))
0038
0039
0040 #endif