jos/kern/ansi.h

37 lines
813 B
C
Raw Permalink Normal View History

#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")
2019-04-19 13:19:15 -07:00
#define ACOL_GREEN ACOL_WRAP("32")
2019-04-19 11:24:59 -07:00
#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 "] "
2019-04-19 13:19:15 -07:00
#define ACOL_NOTE(s) ACOL_TAG(ACOL_WHITE, " Note ") s
2019-04-19 11:24:59 -07:00
#define ACOL_WARN(s) ACOL_TAG(ACOL_YELLOW, "Warning") s
2019-04-19 13:19:15 -07:00
#define ACOL_ERR(s) ACOL_TAG(ACOL_RED, " Error ") s
2019-04-19 11:24:59 -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