Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[e16e8f2] | 1 | /* |
---|
| 2 | * ansi.h |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #ifndef COM32_LIB_SYS_ANSI_H |
---|
| 6 | #define COM32_LIB_SYS_ANSI_H |
---|
| 7 | |
---|
| 8 | #include <inttypes.h> |
---|
| 9 | #include <stdbool.h> |
---|
| 10 | #include "vesa/video.h" |
---|
| 11 | |
---|
| 12 | #define ANSI_MAX_PARMS 16 |
---|
| 13 | |
---|
| 14 | enum ansi_state { |
---|
| 15 | st_init, |
---|
| 16 | st_esc, |
---|
| 17 | st_csi, |
---|
| 18 | st_tbl, |
---|
| 19 | st_tblc, |
---|
| 20 | }; |
---|
| 21 | |
---|
| 22 | struct curxy { |
---|
| 23 | uint8_t x, y; |
---|
| 24 | } __attribute__ ((packed)); |
---|
| 25 | |
---|
| 26 | struct term_state { |
---|
| 27 | enum ansi_state state; |
---|
| 28 | int nparms; /* Number of parameters seen */ |
---|
| 29 | int parms[ANSI_MAX_PARMS]; |
---|
| 30 | bool pvt; /* Private code? */ |
---|
| 31 | struct curxy xy; |
---|
| 32 | struct curxy saved_xy; |
---|
| 33 | attr_t cindex; /* SOH color index */ |
---|
| 34 | uint8_t fg; |
---|
| 35 | uint8_t bg; |
---|
| 36 | uint8_t intensity; |
---|
| 37 | bool vtgraphics; /* VT graphics on/off */ |
---|
| 38 | bool underline; |
---|
| 39 | bool blink; |
---|
| 40 | bool reverse; |
---|
| 41 | bool autocr; |
---|
| 42 | bool autowrap; |
---|
| 43 | bool cursor; |
---|
| 44 | }; |
---|
| 45 | |
---|
| 46 | struct ansi_ops { |
---|
| 47 | void (*erase) (const struct term_state * st, int x0, int y0, int x1, |
---|
| 48 | int y1); |
---|
| 49 | void (*write_char) (int x, int y, uint8_t ch, const struct term_state * st); |
---|
| 50 | void (*showcursor) (const struct term_state * st); |
---|
| 51 | void (*scroll_up) (const struct term_state * st); |
---|
| 52 | void (*set_cursor) (int x, int y, bool visible); |
---|
| 53 | void (*beep) (void); |
---|
| 54 | }; |
---|
| 55 | |
---|
| 56 | struct term_info { |
---|
| 57 | int rows, cols; /* Screen size */ |
---|
| 58 | int disabled; |
---|
| 59 | struct term_state *ts; |
---|
| 60 | const struct ansi_ops *op; |
---|
| 61 | }; |
---|
| 62 | |
---|
| 63 | void __ansi_init(const struct term_info *ti); |
---|
| 64 | void __ansi_putchar(const struct term_info *ti, uint8_t ch); |
---|
| 65 | void __ansicon_beep(void); |
---|
| 66 | |
---|
| 67 | #endif /* COM32_LIB_SYS_ANSI_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.