LF OS
Hobby operating system for amd64 with high ambitions
Loading...
Searching...
No Matches
unterm.c File Reference

(7c4d7d1 userspace/term: change eyecandy inclusion to use objcopy instead of xxd)

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <unistd.h>
#include "vterm.h"
#include "../src/utf8.h"
+ Include dependency graph for unterm.c:

Go to the source code of this file.

Macros

#define streq(a, b)   (!strcmp(a,b))
 

Enumerations

enum  { FORMAT_PLAIN , FORMAT_SGR }
 

Functions

static int dump_cell_color (const VTermColor *col, int sgri, int sgr[], int fg)
 
static void dump_cell (const VTermScreenCell *cell, const VTermScreenCell *prevcell)
 
static void dump_eol (const VTermScreenCell *prevcell)
 
void dump_row (int row)
 
static int screen_sb_pushline (int cols, const VTermScreenCell *cells, void *user)
 
static int screen_resize (int new_rows, int new_cols, void *user)
 
int main (int argc, char *argv[])
 

Variables

static VTermvt
 
static VTermScreenvts
 
static int cols
 
static int rows
 
static enum { ... }  format = FORMAT_PLAIN
 
static VTermScreenCallbacks cb_screen
 

Macro Definition Documentation

◆ streq

#define streq (   a,
 
)    (!strcmp(a,b))

Definition at line 25 of file unterm.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FORMAT_PLAIN 
FORMAT_SGR 

Definition at line 33 of file unterm.c.

Function Documentation

◆ dump_cell()

static void dump_cell ( const VTermScreenCell cell,
const VTermScreenCell prevcell 
)
static

Definition at line 75 of file unterm.c.

References VTermScreenCell::attrs, VTermScreenCell::bg, VTermScreenCellAttrs::blink, VTermScreenCellAttrs::bold, VTermScreenCell::chars, VTermScreenCellAttrs::conceal, CSI_ARG, CSI_ARG_HAS_MORE, dump_cell_color(), VTermScreenCell::fg, fill_utf8(), VTermScreenCellAttrs::font, format, FORMAT_PLAIN, FORMAT_SGR, VTermScreenCellAttrs::italic, VTermScreenCellAttrs::reverse, VTermScreenCellAttrs::strike, VTermScreenCellAttrs::underline, vterm_color_is_equal(), and VTERM_MAX_CHARS_PER_CELL.

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

◆ dump_cell_color()

static int dump_cell_color ( const VTermColor col,
int  sgri,
int  sgr[],
int  fg 
)
static

Definition at line 38 of file unterm.c.

References VTermColor::indexed, VTermColor::rgb, VTERM_COLOR_IS_DEFAULT_BG, VTERM_COLOR_IS_DEFAULT_FG, VTERM_COLOR_IS_INDEXED, and VTERM_COLOR_IS_RGB.

+ Here is the caller graph for this function:

◆ dump_eol()

static void dump_eol ( const VTermScreenCell prevcell)
static

Definition at line 155 of file unterm.c.

References VTermScreenCell::attrs, VTermScreenCellAttrs::blink, VTermScreenCellAttrs::bold, VTermScreenCellAttrs::conceal, VTermScreenCellAttrs::font, format, FORMAT_PLAIN, FORMAT_SGR, VTermScreenCellAttrs::italic, VTermScreenCellAttrs::reverse, VTermScreenCellAttrs::strike, and VTermScreenCellAttrs::underline.

+ Here is the caller graph for this function:

◆ dump_row()

void dump_row ( int  row)

Definition at line 171 of file unterm.c.

References VTermScreenCell::bg, VTermPos::col, cols, dump_cell(), dump_eol(), VTermScreenCell::fg, VTermPos::row, vt, vterm_obtain_state(), vterm_screen_get_cell(), vterm_state_get_default_colors(), vts, and VTermScreenCell::width.

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

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 217 of file unterm.c.

References cb_screen, cols, dump_row(), format, FORMAT_PLAIN, FORMAT_SGR, read(), rows, streq, vt, vterm_free(), vterm_input_write(), vterm_new(), vterm_obtain_screen(), vterm_screen_reset(), vterm_screen_set_callbacks(), vterm_set_utf8(), and vts.

+ Here is the call graph for this function:

◆ screen_resize()

static int screen_resize ( int  new_rows,
int  new_cols,
void *  user 
)
static

Definition at line 205 of file unterm.c.

References cols, and rows.

◆ screen_sb_pushline()

static int screen_sb_pushline ( int  cols,
const VTermScreenCell cells,
void *  user 
)
static

Definition at line 190 of file unterm.c.

References VTermScreenCell::bg, cols, dump_cell(), dump_eol(), VTermScreenCell::fg, vt, vterm_obtain_state(), and vterm_state_get_default_colors().

+ Here is the call graph for this function:

Variable Documentation

◆ cb_screen

VTermScreenCallbacks cb_screen
static
Initial value:
= {
.sb_pushline = &screen_sb_pushline,
.resize = &screen_resize,
}
static int screen_sb_pushline(int cols, const VTermScreenCell *cells, void *user)
Definition unterm.c:190
static int screen_resize(int new_rows, int new_cols, void *user)
Definition unterm.c:205

Definition at line 212 of file unterm.c.

◆ cols

int cols
static

Definition at line 30 of file unterm.c.

◆ []

enum { ... } format

◆ rows

int rows
static

Definition at line 31 of file unterm.c.

◆ vt

VTerm* vt
static

Definition at line 27 of file unterm.c.

◆ vts

VTermScreen* vts
static

Definition at line 28 of file unterm.c.