ANSI terminal special escape code macros.
More...
Module Source Dependencies
The following files must be built with any user project that uses this module:
Module Description
Escape code macros for ANSI compliant text terminals.
- Note
- If desired, the macro
DISABLE_TERMINAL_CODES
can be defined in the project makefile and passed to the GCC compiler via the -D switch to disable the terminal codes without modifying the source, for use with non compatible terminals (any terminal codes then equate to empty strings).
Example Usage
The following snippet is an example of how this module may be used within a typical application.
◆ ANSI_ESCAPE_SEQUENCE
#define ANSI_ESCAPE_SEQUENCE |
( |
|
EscapeSeq | ) |
"\33[" EscapeSeq |
Creates an ANSI escape sequence with the specified payload.
- Parameters
-
[in] | EscapeSeq | Payload to encode as an ANSI escape sequence, a ESC_* mask. |
◆ ESC_BG_BLACK
Sets the text background colour to black.
◆ ESC_BG_BLUE
Sets the text background colour to blue.
◆ ESC_BG_CYAN
Sets the text background colour to cyan.
◆ ESC_BG_DEFAULT
Sets the text background colour to the terminal's default.
◆ ESC_BG_GREEN
Sets the text background colour to green.
◆ ESC_BG_MAGENTA
Sets the text background colour to magenta.
◆ ESC_BG_RED
Sets the text background colour to red.
◆ ESC_BG_WHITE
Sets the text background colour to white.
◆ ESC_BG_YELLOW
Sets the text background colour to yellow.
◆ ESC_BOLD_OFF
Turns off bold so that any following text is printed to the terminal in non bold.
◆ ESC_BOLD_ON
Turns on bold so that any following text is printed to the terminal in bold.
◆ ESC_CURSOR_BACKWARD
Moves the cursor to the left the given number of columns.
- Parameters
-
[in] | Columns | Number of columns to move the cursor position |
◆ ESC_CURSOR_DOWN
Moves the cursor down the given number of lines.
- Parameters
-
[in] | Lines | Number of lines to move the cursor position |
◆ ESC_CURSOR_FORWARD
Moves the cursor to the right the given number of columns.
- Parameters
-
[in] | Columns | Number of columns to move the cursor position |
◆ ESC_CURSOR_POS
Sets the cursor position to the given line and column.
- Parameters
-
[in] | Line | Line number to position the cursor at. |
[in] | Column | Column number to position the cursor at. |
◆ ESC_CURSOR_POS_RESTORE
◆ ESC_CURSOR_POS_SAVE
◆ ESC_CURSOR_UP
Moves the cursor up the given number of lines.
- Parameters
-
[in] | Lines | Number of lines to move the cursor position |
◆ ESC_ERASE_DISPLAY
Erases the entire display, returning the cursor to the top left.
◆ ESC_ERASE_LINE
Erases the current line, returning the cursor to the far left.
◆ ESC_FG_BLACK
Sets the foreground (text) colour to black.
◆ ESC_FG_BLUE
Sets the foreground (text) colour to blue.
◆ ESC_FG_CYAN
Sets the foreground (text) colour to cyan.
◆ ESC_FG_DEFAULT
Sets the foreground (text) colour to the terminal's default.
◆ ESC_FG_GREEN
Sets the foreground (text) colour to green.
◆ ESC_FG_MAGENTA
Sets the foreground (text) colour to magenta.
◆ ESC_FG_RED
Sets the foreground (text) colour to red.
◆ ESC_FG_WHITE
Sets the foreground (text) colour to white.
◆ ESC_FG_YELLOW
Sets the foreground (text) colour to yellow.
◆ ESC_INVERSE_OFF
Turns off inverse so that any following text is printed to the terminal in non inverted colours.
◆ ESC_INVERSE_ON
Turns on inverse so that any following text is printed to the terminal in inverted colours.
◆ ESC_ITALICS_OFF
Turns off italics so that any following text is printed to the terminal in non italics.
◆ ESC_ITALICS_ON
Turns on italics so that any following text is printed to the terminal in italics.
◆ ESC_RESET
Resets any escape sequence modifiers back to their defaults.
◆ ESC_STRIKETHROUGH_OFF
Turns off strike-through so that any following text is printed to the terminal without a line through the center.
◆ ESC_STRIKETHROUGH_ON
Turns on strike-through so that any following text is printed to the terminal with a line through the center.
◆ ESC_UNDERLINE_OFF
Turns off underline so that any following text is printed to the terminal non underlined.
◆ ESC_UNDERLINE_ON
Turns on underline so that any following text is printed to the terminal underlined.