axle OS
x86_32 UNIX-like hobby OS
terminal.h
1 #ifndef STD_TERMINAL_H
2 #define STD_TERMINAL_H
3 
4 #include <std/std_base.h>
5 #include <stdint.h>
6 
7 __BEGIN_DECLS
8 
10 typedef enum term_color {
11  COLOR_BLACK = 0,
12  COLOR_BLUE = 1,
13  COLOR_GREEN = 2,
14  COLOR_CYAN = 3,
15  COLOR_RED = 4,
16  COLOR_MAGENTA = 5,
17  COLOR_BROWN = 6,
18  COLOR_LIGHT_GREY = 7,
19  COLOR_DARK_GREY = 8,
20  COLOR_LIGHT_BLUE = 9,
21  COLOR_LIGHT_GREEN = 10,
22  COLOR_LIGHT_CYAN = 11,
23  COLOR_LIGHT_RED = 12,
24  COLOR_LIGHT_MAGENTA = 13,
25  COLOR_LIGHT_BROWN = 14,
26  COLOR_WHITE = 15,
27 } term_color;
28 
30 typedef struct term_cursor {
31  uint16_t x;
32  uint16_t y;
33 } term_cursor;
34 
36 typedef enum term_scroll_direction {
37  TERM_SCROLL_UP = 0,
38  TERM_SCROLL_DOWN,
39 } term_scroll_direction;
40 
42 #define TERM_WIDTH 80
43 
45 #define TERM_HEIGHT 25
46 
48 #define TERM_AREA (TERM_WIDTH * TERM_HEIGHT)
49 
51 #define TERM_TABWIDTH 4
52 
54 #define TERM_DEFAULT_FG COLOR_LIGHT_BLUE
55 
57 #define TERM_DEFAULT_BG COLOR_BLACK
58 
59 
61 STDAPI void terminal_initialize(void);
62 
64 STDAPI void terminal_clear(void);
65 
69 STDAPI void terminal_putchar(char ch);
70 
73 STDAPI void terminal_writestring(const char* str);
74 
78 STDAPI void terminal_setcolor(term_color fg, term_color bg);
79 
82 STDAPI void terminal_settextcolor(term_color color);
83 
86 STDAPI void terminal_setbgcolor(term_color color);
87 
90 STDAPI term_cursor terminal_getcursor(void);
91 
95 STDAPI void terminal_setcursor(term_cursor loc);
96 
98 STDAPI void terminal_updatecursor(void);
99 
102 STDAPI void terminal_movecursor(term_cursor loc);
103 
106 void term_scroll(term_scroll_direction dir);
107 
108 __END_DECLS
109 
110 #endif // STD_TERMINAL_H
Definition: color.h:7
Holds the screen position of a terminal cursor.
Definition: terminal.h:30