#include "source/print.h"
#if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \
defined(SPIRV_IOS) || defined(SPIRV_TVOS) || defined(SPIRV_FREEBSD) || \
defined(SPIRV_OPENBSD) || defined(SPIRV_EMSCRIPTEN) || \
defined(SPIRV_FUCHSIA) || defined(SPIRV_GNU) || defined(SPIRV_QNX)
namespace spvtools {
clr::reset::operator const char*() { return "\x1b[0m"; }
clr::grey::operator const char*() { return "\x1b[1;30m"; }
clr::red::operator const char*() { return "\x1b[31m"; }
clr::green::operator const char*() { return "\x1b[32m"; }
clr::yellow::operator const char*() { return "\x1b[33m"; }
clr::blue::operator const char*() { return "\x1b[34m"; }
}
#elif defined(SPIRV_WINDOWS)
#include <windows.h>
namespace spvtools {
static void SetConsoleForegroundColorPrimary(HANDLE hConsole, WORD color) {
CONSOLE_SCREEN_BUFFER_INFO bufInfo;
GetConsoleScreenBufferInfo(hConsole, &bufInfo);
color = WORD(color | (bufInfo.wAttributes & 0xfff0));
SetConsoleTextAttribute(hConsole, color);
}
static void SetConsoleForegroundColor(WORD color) {
SetConsoleForegroundColorPrimary(GetStdHandle(STD_OUTPUT_HANDLE), color);
SetConsoleForegroundColorPrimary(GetStdHandle(STD_ERROR_HANDLE), color);
}
clr::reset::operator const char*() {
if (isPrint) {
SetConsoleForegroundColor(0xf);
return "";
}
return "\x1b[0m";
}
clr::grey::operator const char*() {
if (isPrint) {
SetConsoleForegroundColor(FOREGROUND_INTENSITY);
return "";
}
return "\x1b[1;30m";
}
clr::red::operator const char*() {
if (isPrint) {
SetConsoleForegroundColor(FOREGROUND_RED);
return "";
}
return "\x1b[31m";
}
clr::green::operator const char*() {
if (isPrint) {
SetConsoleForegroundColor(FOREGROUND_GREEN);
return "";
}
return "\x1b[32m";
}
clr::yellow::operator const char*() {
if (isPrint) {
SetConsoleForegroundColor(FOREGROUND_RED | FOREGROUND_GREEN);
return "";
}
return "\x1b[33m";
}
clr::blue::operator const char*() {
if (isPrint) {
SetConsoleForegroundColor(FOREGROUND_BLUE | FOREGROUND_INTENSITY);
return "";
}
return "\x1b[94m";
}
}
#else
namespace spvtools {
operator const char *()
operator const char *()
operator const char *()
operator const char *()
operator const char *()
operator const char *()
}
#endif