2019-04-05 19:20:33 -07:00
|
|
|
#ifndef _ANSI_H_
|
|
|
|
#define _ANSI_H_
|
|
|
|
|
|
|
|
#include <inc/types.h>
|
|
|
|
|
2019-04-19 11:24:59 -07:00
|
|
|
#define ACOL_WRAP(s) "\33[" s "m"
|
|
|
|
#define ACOL_BLACK ACOL_WRAP("30")
|
|
|
|
#define ACOL_RED ACOL_WRAP("31")
|
|
|
|
#define ACOL_GREEM ACOL_WRAP("32")
|
|
|
|
#define ACOL_YELLOW ACOL_WRAP("33")
|
|
|
|
#define ACOL_BLUE ACOL_WRAP("34")
|
|
|
|
#define ACOL_MAGENTA ACOL_WRAP("35")
|
|
|
|
#define ACOL_CYAN ACOL_WRAP("36")
|
|
|
|
#define ACOL_WHITE ACOL_WRAP("37")
|
|
|
|
#define ACOL_CLEAR ACOL_WRAP("0")
|
|
|
|
|
|
|
|
#define ACOL_TAG(c, s) "[" c s ACOL_CLEAR "] "
|
|
|
|
#define ACOL_NOTE(s) ACOL_TAG(ACOL_WHITE, "Note ") s
|
|
|
|
#define ACOL_WARN(s) ACOL_TAG(ACOL_YELLOW, "Warning") s
|
|
|
|
#define ACOL_ERR(s) ACOL_TAG(ACOL_RED, "Error ") s
|
|
|
|
|
2019-04-05 19:20:33 -07:00
|
|
|
struct AttrState {
|
|
|
|
uint8_t cattrs;
|
|
|
|
uint8_t attrs;
|
|
|
|
enum {
|
|
|
|
NORMAL,
|
|
|
|
ESC,
|
|
|
|
BRACKET,
|
|
|
|
COLOR_FG,
|
|
|
|
COLOR
|
|
|
|
} state;
|
|
|
|
};
|
|
|
|
|
|
|
|
void ansi_step(void (*putcf)(int), int c, struct AttrState* s);
|
|
|
|
|
|
|
|
#endif
|