Adding upstream version 4.00~pre54+dfsg.
[syslinux-debian/hramrach.git] / com32 / lib / sys / ansi.h
blob7ccafc8b5b6eb547607dbd2440a6141790e708e9
1 /*
2 * ansi.h
3 */
5 #ifndef COM32_LIB_SYS_ANSI_H
6 #define COM32_LIB_SYS_ANSI_H
8 #include <inttypes.h>
9 #include <stdbool.h>
11 #define ANSI_MAX_PARMS 16
13 enum ansi_state {
14 st_init,
15 st_esc,
16 st_csi,
17 st_tbl,
18 st_tblc,
21 struct curxy {
22 uint8_t x, y;
23 } __attribute__ ((packed));
25 struct term_state {
26 enum ansi_state state;
27 int nparms; /* Number of parameters seen */
28 int parms[ANSI_MAX_PARMS];
29 bool pvt; /* Private code? */
30 struct curxy xy;
31 struct curxy saved_xy;
32 uint8_t cindex; /* SOH color index */
33 uint8_t fg;
34 uint8_t bg;
35 uint8_t intensity;
36 bool vtgraphics; /* VT graphics on/off */
37 bool underline;
38 bool blink;
39 bool reverse;
40 bool autocr;
41 bool autowrap;
42 bool cursor;
45 struct ansi_ops {
46 void (*erase) (const struct term_state * st, int x0, int y0, int x1,
47 int y1);
48 void (*write_char) (int x, int y, uint8_t ch, const struct term_state * st);
49 void (*showcursor) (const struct term_state * st);
50 void (*scroll_up) (const struct term_state * st);
51 void (*set_cursor) (int x, int y, bool visible);
52 void (*beep) (void);
55 struct term_info {
56 int rows, cols; /* Screen size */
57 int disabled;
58 struct term_state *ts;
59 const struct ansi_ops *op;
62 void __ansi_init(const struct term_info *ti);
63 void __ansi_putchar(const struct term_info *ti, uint8_t ch);
64 void __ansicon_beep(void);
66 #endif /* COM32_LIB_SYS_ANSI_H */