|
ginnOS
The reference: libc, the libraries and the kernel
|
terminal state machine: ANSI escape parsing, cursor handling, output. More...
#include "tty.h"Functions | |
| void | tty_init (tty_t *tty, const tty_backend_t *backend) |
| initialize a tty on a backend. | |
| void | tty_begin_batch (tty_t *tty) |
| start a batch of output. | |
| void | tty_end_batch (tty_t *tty) |
| end a batch: redraw the caret where the cursor ended up and flush once. | |
| void | tty_putchar (tty_t *tty, char c) |
| feed one output byte through the terminal state machine. | |
| void | tty_write (tty_t *tty, const char *str) |
| feed a null-terminated string through tty_putchar(), as one batch. | |
| uint8_t | tty_set_mode (tty_t *tty, uint8_t mode) |
| set the line-discipline mode (TTY_MODE_COOKED or TTY_MODE_RAW). | |
terminal state machine: ANSI escape parsing, cursor handling, output.
this is the logic that used to live in console.c, lifted onto a tty_t so it no longer talks to the VGA driver directly. all cell access goes through the backend ops, so the same parser drives any character-cell device.
| void tty_init | ( | tty_t * | tty, |
| const tty_backend_t * | backend ) |
initialize a tty on a backend.
starts in cooked mode, normal parser state.
| tty | the terminal to initialize. |
| backend | the character-cell backend (must outlive the tty). |
| void tty_begin_batch | ( | tty_t * | tty | ) |
start a batch of output.
until the matching tty_end_batch(), bytes are drawn but the caret is hidden and nothing is flushed to the display, so the screen never shows a half-finished update (e.g. a shell redrawing its line, where the cursor briefly visits column 0). batches nest.
| tty | the terminal. |
| void tty_end_batch | ( | tty_t * | tty | ) |
end a batch: redraw the caret where the cursor ended up and flush once.
| tty | the terminal. |
| void tty_putchar | ( | tty_t * | tty, |
| char | c ) |
feed one output byte through the terminal state machine.
printable characters are drawn; control characters and ANSI escape sequences are interpreted (cursor movement, erase, etc.).
| tty | the terminal. |
| c | the byte to process. |
| void tty_write | ( | tty_t * | tty, |
| const char * | str ) |
feed a null-terminated string through tty_putchar(), as one batch.
| tty | the terminal. |
| str | the string to write. |