PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
Terminal

Terminal Program. More...

Collaboration diagram for Terminal:

Detailed Description

Terminal Program.

A simple terminal emulator program.

The terminal always acts in raw mode, meaning that it does not process any input itself, instead it just sends all input directly to the shell program running inside it.

See also
Terminals OSDev Wiki
ANSI Escape Codes

Modules

 ANSI
 ANSI.
 

Data Structures

struct  terminal_char_t
 Terminal character. More...
 
struct  terminal_t
 Terminal structure. More...
 
struct  terminal_init_ctx_t
 Terminal initialization context. More...
 

Macros

#define TERMINAL_BLINK_INTERVAL   (CLOCKS_PER_SEC / 2)
 Terminal blink rate.
 
#define TERMINAL_COLUMNS   80
 Terminal columns.
 
#define TERMINAL_ROWS   30
 Terminal rows.
 
#define TERMINAL_MAX_DATA   (TERMINAL_COLUMNS * TERMINAL_ROWS)
 Maximum size of the buffer used to batch data.
 
#define TERMINAL_MAX_FPS   30
 Maximum terminal frames per second.
 

Enumerations

enum  terminal_flags_t {
  TERMINAL_NONE = 0 , TERMINAL_BOLD = (1 << 0) , TERMINAL_DIM = (1 << 1) , TERMINAL_ITALIC = (1 << 2) ,
  TERMINAL_UNDERLINE = (1 << 3) , TERMINAL_BLINK = (1 << 4) , TERMINAL_INVERSE = (1 << 5) , TERMINAL_HIDDEN = (1 << 6) ,
  TERMINAL_STRIKETHROUGH = (1 << 7)
}
 Terminal flags. More...
 

Functions

window_tterminal_new (display_t *disp)
 Create a new terminal window.
 
void terminal_loop (window_t *win)
 Terminal main loop.
 

Macro Definition Documentation

◆ TERMINAL_BLINK_INTERVAL

#define TERMINAL_BLINK_INTERVAL   (CLOCKS_PER_SEC / 2)

Terminal blink rate.

Definition at line 30 of file terminal.h.

◆ TERMINAL_COLUMNS

#define TERMINAL_COLUMNS   80

Terminal columns.

Definition at line 35 of file terminal.h.

◆ TERMINAL_ROWS

#define TERMINAL_ROWS   30

Terminal rows.

Definition at line 40 of file terminal.h.

◆ TERMINAL_MAX_DATA

#define TERMINAL_MAX_DATA   (TERMINAL_COLUMNS * TERMINAL_ROWS)

Maximum size of the buffer used to batch data.

Definition at line 45 of file terminal.h.

◆ TERMINAL_MAX_FPS

#define TERMINAL_MAX_FPS   30

Maximum terminal frames per second.

The terminal will batch any data received within a "frame" and only actually flush the data at the end of the frame.

Definition at line 52 of file terminal.h.

Enumeration Type Documentation

◆ terminal_flags_t

Terminal flags.

Used for the ANSI state machine and character attributes.

Enumerator
TERMINAL_NONE 
TERMINAL_BOLD 
TERMINAL_DIM 
TERMINAL_ITALIC 
TERMINAL_UNDERLINE 
TERMINAL_BLINK 
TERMINAL_INVERSE 
TERMINAL_HIDDEN 
TERMINAL_STRIKETHROUGH 

Definition at line 60 of file terminal.h.

Function Documentation

◆ terminal_new()

window_t * terminal_new ( display_t disp)

Create a new terminal window.

Parameters
dispThe display to create the window on.
Returns
On success, the terminal window. On failure, NULL and errno is set.

Definition at line 699 of file terminal.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ terminal_loop()

void terminal_loop ( window_t win)

Terminal main loop.

Parameters
winThe terminal window.

Definition at line 727 of file terminal.c.

Here is the call graph for this function:
Here is the caller graph for this function: