[sys] Move terminal color escapes to sys.h

This puts them all in the one place, thus easier to use (and the reason
for the console charset change).
This commit is contained in:
Bill Currie 2024-01-28 12:57:16 +09:00
parent 9552f3c133
commit db46dc8a55
5 changed files with 13 additions and 40 deletions

View file

@ -73,6 +73,16 @@ sys_printf_t Sys_SetErrPrintf (sys_printf_t func);
void Sys_PushErrorHandler (sys_error_t func, void *data);
void Sys_PopErrorHandler (void);
#define DFL "\e[39;49m"
#define BLK "\e[30;40m"
#define RED "\e[31;40m"
#define GRN "\e[32;40m"
#define ONG "\e[33;40m"
#define BLU "\e[34;40m"
#define MAG "\e[35;40m"
#define CYN "\e[36;40m"
#define WHT "\e[37;40m"
void Sys_Print (FILE *stream, const char *fmt, va_list args) __attribute__((format(PRINTF, 2, 0)));
void Sys_Printf (const char *fmt, ...) __attribute__((format(PRINTF,1,2)));
void Sys_Error (const char *error, ...) __attribute__((format(PRINTF,1,2), noreturn));

View file

@ -7,6 +7,7 @@
#include <unistd.h>
#include "QF/ecs.h"
#include "QF/sys.h"
enum {
test_href,
@ -40,16 +41,6 @@ static const component_t test_components[] = {
ecs_registry_t *test_reg;
#define DFL "\e[39;49m"
#define BLK "\e[30;40m"
#define RED "\e[31;40m"
#define GRN "\e[32;40m"
#define ONG "\e[33;40m"
#define BLU "\e[34;40m"
#define MAG "\e[35;40m"
#define CYN "\e[36;40m"
#define WHT "\e[37;40m"
static int
check_hierarchy_size (hierref_t href, uint32_t size)
{

View file

@ -10,16 +10,6 @@
#include "QF/mathlib.h"
#include "QF/ecs.h"
#define DFL "\e[39;49m"
#define BLK "\e[30;40m"
#define RED "\e[31;40m"
#define GRN "\e[32;40m"
#define ONG "\e[33;40m"
#define BLU "\e[34;40m"
#define MAG "\e[35;40m"
#define CYN "\e[36;40m"
#define WHT "\e[37;40m"
enum test_components {
test_subpool,
test_obj,

View file

@ -7,6 +7,7 @@
#include <unistd.h>
#include "QF/ecs.h"
#include "QF/sys.h"
enum {
test_href,
@ -40,16 +41,6 @@ static const component_t test_components[] = {
ecs_registry_t *test_reg;
#define DFL "\e[39;49m"
#define BLK "\e[30;40m"
#define RED "\e[31;40m"
#define GRN "\e[32;40m"
#define ONG "\e[33;40m"
#define BLU "\e[34;40m"
#define MAG "\e[35;40m"
#define CYN "\e[36;40m"
#define WHT "\e[37;40m"
static int
check_hierarchy_size (hierref_t href, uint32_t size)
{

View file

@ -41,6 +41,7 @@
#include "QF/mathlib.h"
#include "QF/progs.h"
#include "QF/quakeio.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/input/event.h"
@ -477,16 +478,6 @@ prune_objects (imui_ctx_t *ctx)
}
}
#define DFL "\e[39;49m"
#define BLK "\e[30;40m"
#define RED "\e[31;40m"
#define GRN "\e[32;40m"
#define ONG "\e[33;40m"
#define BLU "\e[34;40m"
#define MAG "\e[35;40m"
#define CYN "\e[36;40m"
#define WHT "\e[37;40m"
static const char *
view_color (hierarchy_t *h, uint32_t ind, imui_ctx_t *ctx, bool for_y)
{