|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
Exception class, hex formatting utilities, and terminal color definitions. More...
#include <cstdint>#include <cstring>#include <errno.h>#include <sstream>#include <stdexcept>#include <string>#include <unistd.h>

Go to the source code of this file.
Classes | |
| class | mx::Exception |
| General-purpose exception with errno-aware factory method. More... | |
Namespaces | |
| namespace | mx |
| namespace | mx::Color |
| ANSI escape code constants for terminal coloring. | |
Functions | |
| std::string | mx::format_hex64 (uint64_t value) |
| Format a 64-bit value as a hex string with 0x prefix. | |
| std::string | mx::format_hex32 (uint32_t value) |
| Format a 32-bit value as a hex string with 0x prefix. | |
| std::string | mx::format_hex16 (uint16_t value) |
| Format a 16-bit value as a hex string with 0x prefix. | |
| std::string | mx::format_hex8 (uint8_t value) |
| Format an 8-bit value as a hex string with 0x prefix. | |
| std::string | mx::format_signal (uint32_t sig) |
| Format a signal number as a descriptive string. | |
| std::string | mx::format_hex_no_prefix (uint64_t value) |
| Format a 64-bit value as a hex string without 0x prefix. | |
| bool | mx::terminal_supports_color () |
| Check whether stdout is a TTY that supports ANSI color. | |
| std::string | Col (const std::string &col, std::string color) |
| Wrap a string with ANSI color codes if terminal supports color. | |
Variables | |
| const std::string | mx::Color::RESET = "\033[0m" |
| const std::string | mx::Color::BOLD = "\033[1m" |
| const std::string | mx::Color::DIM = "\033[2m" |
| const std::string | mx::Color::BLACK = "\033[30m" |
| const std::string | mx::Color::RED = "\033[31m" |
| const std::string | mx::Color::GREEN = "\033[32m" |
| const std::string | mx::Color::YELLOW = "\033[33m" |
| const std::string | mx::Color::BLUE = "\033[34m" |
| const std::string | mx::Color::MAGENTA = "\033[35m" |
| const std::string | mx::Color::CYAN = "\033[36m" |
| const std::string | mx::Color::WHITE = "\033[37m" |
| const std::string | mx::Color::BRIGHT_RED = "\033[91m" |
| const std::string | mx::Color::BRIGHT_GREEN = "\033[92m" |
| const std::string | mx::Color::BRIGHT_YELLOW = "\033[93m" |
| const std::string | mx::Color::BRIGHT_BLUE = "\033[94m" |
| const std::string | mx::Color::BRIGHT_MAGENTA = "\033[95m" |
| const std::string | mx::Color::BRIGHT_CYAN = "\033[96m" |
| const std::string | mx::Color::BG_RED = "\033[41m" |
| const std::string | mx::Color::BG_GREEN = "\033[42m" |
| const std::string | mx::Color::BG_YELLOW = "\033[43m" |
| bool | mx::color_ = terminal_supports_color() |
| cached color support flag | |
Exception class, hex formatting utilities, and terminal color definitions.
Definition in file exception.hpp.
|
inline |
Wrap a string with ANSI color codes if terminal supports color.
| col | The text to colorize |
| color | The ANSI escape sequence to apply |
Definition at line 100 of file exception.hpp.
References mx::color_, and mx::Color::RESET.
Referenced by mxvm::Program::~Program(), action_interpret(), createMakefile(), mxvm::Program::generateCode(), mxvm::Parser::generateProgramCode(), print_help(), proc_args(), process_arguments(), translate_x64(), and mxvm::Program::x64_generateCode().