LF OS
Hobby operating system for amd64 with high ambitions
|
#include "vterm.h"
#include "../src/vterm_internal.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | streq(a, b) (!strcmp(a,b)) |
#define | strstartswith(a, b) (!strncmp(a,b,strlen(b))) |
#define | BOOLSTR(v) ((v) ? "on" : "off") |
Functions | |
static size_t | inplace_hex2bytes (char *s) |
static VTermModifier | strpe_modifiers (char **strp) |
static VTermKey | strp_key (char *str) |
static void | print_color (const VTermColor *col) |
static VTermColor | strpe_color (char **strp) |
static void | term_output (const char *s, size_t len, void *user) |
static void | printhex (const char *s, size_t len) |
static int | parser_text (const char bytes[], size_t len, void *user) |
static int | parser_control (unsigned char control, void *user) |
static int | parser_escape (const char bytes[], size_t len, void *user) |
static int | parser_csi (const char *leader, const long args[], int argcount, const char *intermed, char command, void *user) |
static int | parser_osc (int command, VTermStringFragment frag, void *user) |
static int | parser_dcs (const char *command, size_t commandlen, VTermStringFragment frag, void *user) |
static int | parser_apc (VTermStringFragment frag, void *user) |
static int | parser_pm (VTermStringFragment frag, void *user) |
static int | parser_sos (VTermStringFragment frag, void *user) |
static int | movecursor (VTermPos pos, VTermPos oldpos, int visible, void *user) |
static int | scrollrect (VTermRect rect, int downward, int rightward, void *user) |
static int | moverect (VTermRect dest, VTermRect src, void *user) |
static int | settermprop (VTermProp prop, VTermValue *val, void *user) |
static int | state_putglyph (VTermGlyphInfo *info, VTermPos pos, void *user) |
static int | state_erase (VTermRect rect, int selective, void *user) |
static int | state_setpenattr (VTermAttr attr, VTermValue *val, void *user) |
static int | state_setlineinfo (int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user) |
static int | state_sb_clear (void *user) |
static int | selection_set (VTermSelectionMask mask, VTermStringFragment frag, void *user) |
static int | selection_query (VTermSelectionMask mask, void *user) |
static int | screen_damage (VTermRect rect, void *user) |
static int | screen_sb_pushline (int cols, const VTermScreenCell *cells, void *user) |
static int | screen_sb_popline (int cols, VTermScreenCell *cells, void *user) |
static int | screen_sb_clear (void *user) |
int | main (int argc, char **argv) |
Variables | ||
static VTerm * | vt | |
static VTermState * | state | |
static VTermScreen * | screen | |
static VTermEncodingInstance | encoding | |
static VTermParserCallbacks | parser_cbs | |
static VTermStateFallbacks | fallbacks | |
static int | want_movecursor = 0 | |
static VTermPos | state_pos | |
static int | want_scrollrect = 0 | |
static int | want_moverect = 0 | |
static int | want_settermprop = 0 | |
static int | want_state_putglyph = 0 | |
static int | want_state_erase = 0 | |
struct { | ||
int | bold | |
int | underline | |
int | italic | |
int | blink | |
int | reverse | |
int | conceal | |
int | strike | |
int | font | |
int | small | |
int | baseline | |
VTermColor | foreground | |
VTermColor | background | |
} | state_pen | |
static int | want_state_scrollback = 0 | |
VTermStateCallbacks | state_cbs | |
VTermSelectionCallbacks | selection_cbs | |
static int | want_screen_damage = 0 | |
static int | want_screen_damage_cells = 0 | |
static int | want_screen_scrollback = 0 | |
VTermScreenCallbacks | screen_cbs | |
#define BOOLSTR | ( | v | ) | ((v) ? "on" : "off") |
|
static |
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 627 of file harness.c.
References VTermScreenCell::attrs, VTermScreenCellAttrs::baseline, VTermScreenCell::bg, VTermScreenCellAttrs::blink, VTermScreenCellAttrs::bold, VTermValue::boolean, BOOLSTR, VTermScreenCell::chars, VTermPos::col, cols, VTermEncodingInstance::data, VTermEncoding::decode, VTermScreenCellAttrs::dhl, VTermScreenCellAttrs::dwl, VTermEncodingInstance::enc, ENC_UTF8, encoding, VTermRect::end_col, VTermRect::end_row, fallbacks, VTermScreenCell::fg, VTermStringFragment::final, VTermScreenCellAttrs::font, free(), info, VTermEncoding::init, VTermStringFragment::initial, inplace_hex2bytes(), VTermScreenCellAttrs::italic, VTermStringFragment::len, malloc(), memset(), VTermValue::number, parser_cbs, print_color(), VTermScreenCellAttrs::reverse, VTermPos::row, rows, screen, screen_cbs, selection_cbs, VTermScreenCellAttrs::small, VTermRect::start_col, VTermRect::start_row, state, state_cbs, state_pen, state_pos, VTermStringFragment::str, streq, strp_key(), strpe_color(), strpe_modifiers(), strstartswith, term_output(), VTermScreenCellAttrs::underline, vt, VTERM_ATTR_BASELINE, VTERM_ATTR_BLINK, VTERM_ATTR_BOLD, VTERM_ATTR_FONT, VTERM_ATTR_ITALIC, VTERM_ATTR_REVERSE, VTERM_ATTR_SMALL, VTERM_ATTR_UNDERLINE, VTERM_BASELINE_LOWER, VTERM_BASELINE_RAISE, VTERM_DAMAGE_CELL, VTERM_DAMAGE_ROW, VTERM_DAMAGE_SCREEN, VTERM_DAMAGE_SCROLL, vterm_free(), vterm_get_size(), vterm_input_write(), vterm_keyboard_end_paste(), vterm_keyboard_key(), vterm_keyboard_start_paste(), vterm_keyboard_unichar(), vterm_lookup_encoding(), VTERM_MAX_CHARS_PER_CELL, vterm_mouse_button(), vterm_mouse_move(), vterm_new(), vterm_obtain_screen(), vterm_obtain_state(), vterm_output_get_buffer_current(), vterm_output_read(), vterm_output_set_callback(), vterm_parser_set_callbacks(), vterm_screen_convert_color_to_rgb(), vterm_screen_enable_altscreen(), vterm_screen_enable_reflow(), vterm_screen_flush_damage(), vterm_screen_get_attrs_extent(), vterm_screen_get_cell(), vterm_screen_get_chars(), vterm_screen_get_text(), vterm_screen_is_eol(), vterm_screen_reset(), vterm_screen_set_callbacks(), vterm_screen_set_damage_merge(), vterm_screen_set_default_colors(), vterm_set_size(), vterm_set_utf8(), vterm_state_focus_in(), vterm_state_focus_out(), vterm_state_get_cursorpos(), vterm_state_get_lineinfo(), vterm_state_get_penattr(), vterm_state_reset(), vterm_state_send_selection(), vterm_state_set_bold_highbright(), vterm_state_set_callbacks(), vterm_state_set_selection_callbacks(), vterm_state_set_unrecognised_fallbacks(), want_movecursor, want_moverect, want_screen_damage, want_screen_damage_cells, want_screen_scrollback, want_scrollrect, want_settermprop, want_state_erase, want_state_putglyph, want_state_scrollback, and VTermScreenCell::width.
Definition at line 311 of file harness.c.
References VTermPos::col, VTermPos::row, state_pos, and want_movecursor.
Definition at line 335 of file harness.c.
References VTermRect::end_col, VTermRect::end_row, VTermRect::start_col, VTermRect::start_row, and want_moverect.
|
static |
Definition at line 234 of file harness.c.
References VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, printhex(), and VTermStringFragment::str.
|
static |
|
static |
Definition at line 163 of file harness.c.
References CSI_ARG, CSI_ARG_HAS_MORE, and CSI_ARG_MISSING.
|
static |
Definition at line 214 of file harness.c.
References VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, printhex(), and VTermStringFragment::str.
|
static |
Definition at line 145 of file harness.c.
References printhex().
|
static |
Definition at line 193 of file harness.c.
References VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, printhex(), and VTermStringFragment::str.
|
static |
Definition at line 251 of file harness.c.
References VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, printhex(), and VTermStringFragment::str.
|
static |
Definition at line 268 of file harness.c.
References VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, printhex(), and VTermStringFragment::str.
|
static |
|
static |
Definition at line 64 of file harness.c.
References VTermColor::indexed, VTermColor::rgb, VTermColor::type, VTERM_COLOR_IS_DEFAULT_BG, VTERM_COLOR_IS_DEFAULT_FG, VTERM_COLOR_IS_INDEXED, and VTERM_COLOR_IS_RGB.
|
static |
|
static |
Definition at line 528 of file harness.c.
References VTermScreenCell::chars, VTermRect::end_col, VTermRect::end_row, screen, VTermRect::start_col, VTermRect::start_row, vterm_screen_get_cell(), want_screen_damage, and want_screen_damage_cells.
|
static |
Definition at line 608 of file harness.c.
References want_screen_scrollback.
|
static |
Definition at line 589 of file harness.c.
References VTermScreenCell::chars, cols, want_screen_scrollback, and VTermScreenCell::width.
|
static |
Definition at line 572 of file harness.c.
References cols, and want_screen_scrollback.
|
static |
Definition at line 322 of file harness.c.
References VTermRect::end_col, VTermRect::end_row, VTermRect::start_col, VTermRect::start_row, and want_scrollrect.
|
static |
|
static |
Definition at line 501 of file harness.c.
References VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, printhex(), and VTermStringFragment::str.
|
static |
Definition at line 348 of file harness.c.
References VTermValue::boolean, VTermValue::color, VTermStringFragment::final, VTermStringFragment::initial, VTermStringFragment::len, VTermValue::number, print_color(), VTermStringFragment::str, VTermValue::string, type, vterm_get_prop_type(), VTERM_N_VALUETYPES, VTERM_VALUETYPE_BOOL, VTERM_VALUETYPE_COLOR, VTERM_VALUETYPE_INT, VTERM_VALUETYPE_STRING, and want_settermprop.
|
static |
Definition at line 402 of file harness.c.
References VTermRect::end_col, VTermRect::end_row, VTermRect::start_col, VTermRect::start_row, and want_state_erase.
|
static |
Definition at line 381 of file harness.c.
References VTermPos::col, info, VTermPos::row, VTERM_MAX_CHARS_PER_CELL, and want_state_putglyph.
|
static |
Definition at line 481 of file harness.c.
References want_state_scrollback.
|
static |
|
static |
Definition at line 428 of file harness.c.
References VTermValue::boolean, VTermValue::color, VTermValue::number, state_pen, VTERM_ATTR_BACKGROUND, VTERM_ATTR_BASELINE, VTERM_ATTR_BLINK, VTERM_ATTR_BOLD, VTERM_ATTR_CONCEAL, VTERM_ATTR_FONT, VTERM_ATTR_FOREGROUND, VTERM_ATTR_ITALIC, VTERM_ATTR_REVERSE, VTERM_ATTR_SMALL, VTERM_ATTR_STRIKE, VTERM_ATTR_UNDERLINE, and VTERM_N_ATTRS.
|
static |
Definition at line 42 of file harness.c.
References name, streq, VTERM_KEY_ENTER, VTERM_KEY_FUNCTION, VTERM_KEY_KP_0, VTERM_KEY_NONE, VTERM_KEY_TAB, and VTERM_KEY_UP.
|
static |
Definition at line 84 of file harness.c.
References vterm_color_indexed(), and vterm_color_rgb().
|
static |
Definition at line 26 of file harness.c.
References state, VTERM_MOD_ALT, VTERM_MOD_CTRL, and VTERM_MOD_SHIFT.
|
static |
|
static |
|
static |
|
static |
|
static |
VTermScreenCallbacks screen_cbs |
VTermSelectionCallbacks selection_cbs |
|
static |
VTermStateCallbacks state_cbs |
struct { ... } state_pen |