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

(475a4fe LLVM update: finally on 18.x!)

#include "vterm.h"
#include <stdarg.h>
+ Include dependency graph for vterm_internal.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  VTermEncodingInstance
 
struct  VTermPen
 
struct  VTermState
 
struct  VTerm
 
struct  VTermEncoding
 
struct  VTermState.mode
 
struct  VTermState.saved
 
struct  VTermState.saved.mode
 
union  VTermState.tmp
 
struct  VTermState.tmp.selection
 
struct  VTermState.selection
 
struct  VTerm.mode
 
struct  VTerm.parser
 
union  VTerm.parser.v
 
struct  VTerm.parser.v.csi
 
struct  VTerm.parser.v.osc
 
struct  VTerm.parser.v.dcs
 

Macros

#define INTERNAL
 
#define DEBUG_LOG(...)
 
#define ESC_S   "\x1b"
 
#define INTERMED_MAX   16
 
#define CSI_ARGS_MAX   16
 
#define CSI_LEADER_MAX   16
 
#define BUFIDX_PRIMARY   0
 
#define BUFIDX_ALTSCREEN   1
 
#define SCROLLREGION_BOTTOM(state)   ((state)->scrollregion_bottom > -1 ? (state)->scrollregion_bottom : (state)->rows)
 
#define SCROLLREGION_LEFT(state)   ((state)->mode.leftrightmargin ? (state)->scrollregion_left : 0)
 
#define SCROLLREGION_RIGHT(state)   ((state)->mode.leftrightmargin && (state)->scrollregion_right > -1 ? (state)->scrollregion_right : (state)->cols)
 
#define ROWWIDTH(state, row)   ((state)->lineinfo[(row)].doublewidth ? ((state)->cols / 2) : (state)->cols)
 
#define THISROWWIDTH(state)   ROWWIDTH(state, (state)->pos.row)
 
#define MOUSE_WANT_CLICK   0x01
 
#define MOUSE_WANT_DRAG   0x02
 
#define MOUSE_WANT_MOVE   0x04
 

Typedefs

typedef struct VTermEncoding VTermEncoding
 

Enumerations

enum  VTermEncodingType { ENC_UTF8 , ENC_SINGLE_94 }
 
enum  {
  C1_SS3 = 0x8f , C1_DCS = 0x90 , C1_CSI = 0x9b , C1_ST = 0x9c ,
  C1_OSC = 0x9d
}
 

Functions

void * vterm_allocator_malloc (VTerm *vt, size_t size)
 
void vterm_allocator_free (VTerm *vt, void *ptr)
 
void vterm_push_output_bytes (VTerm *vt, const char *bytes, size_t len)
 
void vterm_push_output_vsprintf (VTerm *vt, const char *format, va_list args)
 
void vterm_push_output_sprintf (VTerm *vt, const char *format,...)
 
void vterm_push_output_sprintf_ctrl (VTerm *vt, unsigned char ctrl, const char *fmt,...)
 
void vterm_push_output_sprintf_str (VTerm *vt, unsigned char ctrl, bool term, const char *fmt,...)
 
void vterm_state_free (VTermState *state)
 
void vterm_state_newpen (VTermState *state)
 
void vterm_state_resetpen (VTermState *state)
 
void vterm_state_setpen (VTermState *state, const long args[], int argcount)
 
int vterm_state_getpen (VTermState *state, long args[], int argcount)
 
void vterm_state_savepen (VTermState *state, int save)
 
void vterm_state_push_output_sprintf_CSI (VTermState *vts, const char *format,...)
 
void vterm_screen_free (VTermScreen *screen)
 
VTermEncodingvterm_lookup_encoding (VTermEncodingType type, char designation)
 
int vterm_unicode_width (uint32_t codepoint)
 
int vterm_unicode_is_combining (uint32_t codepoint)
 

Data Structure Documentation

◆ VTermEncodingInstance

struct VTermEncodingInstance

Definition at line 32 of file vterm_internal.h.

+ Collaboration diagram for VTermEncodingInstance:
Data Fields
char data[4 *sizeof(uint32_t)]
VTermEncoding * enc

◆ VTermPen

struct VTermPen

Definition at line 39 of file vterm_internal.h.

+ Collaboration diagram for VTermPen:
Data Fields
unsigned int baseline:2
VTermColor bg
unsigned int blink:1
unsigned int bold:1
unsigned int conceal:1
VTermColor fg
unsigned int font:4
unsigned int italic:1
unsigned int reverse:1
unsigned int small:1
unsigned int strike:1
unsigned int underline:2

◆ VTerm

struct VTerm

Definition at line 176 of file vterm_internal.h.

+ Collaboration diagram for VTerm:
Data Fields
const VTermAllocatorFunctions * allocator
void * allocdata
int cols
struct VTerm.mode mode
char * outbuffer
size_t outbuffer_cur
size_t outbuffer_len
void * outdata
VTermOutputCallback * outfunc
struct VTerm.parser parser
int rows
VTermScreen * screen
VTermState * state
char * tmpbuffer
size_t tmpbuffer_len

◆ VTermState.mode

struct VTermState.mode

Definition at line 108 of file vterm_internal.h.

+ Collaboration diagram for VTermState.mode:
Data Fields
unsigned int alt_screen:1
unsigned int autowrap:1
unsigned int bracketpaste:1
unsigned int cursor:1
unsigned int cursor_blink:1
unsigned int cursor_shape:2
unsigned int cursor_visible:1
unsigned int insert:1
unsigned int keypad:1
unsigned int leftrightmargin:1
unsigned int newline:1
unsigned int origin:1
unsigned int report_focus:1
unsigned int screen:1

◆ VTermState.saved

struct VTermState.saved

Definition at line 139 of file vterm_internal.h.

+ Collaboration diagram for VTermState.saved:
Data Fields
struct VTermState.saved.mode mode
struct VTermPen pen
VTermPos pos

◆ VTermState.saved.mode

struct VTermState.saved.mode

Definition at line 143 of file vterm_internal.h.

+ Collaboration diagram for VTermState.saved.mode:
Data Fields
unsigned int cursor_blink:1
unsigned int cursor_shape:2
unsigned int cursor_visible:1

◆ VTermState.tmp

union VTermState.tmp

Definition at line 151 of file vterm_internal.h.

+ Collaboration diagram for VTermState.tmp:
Data Fields
char decrqss[4]
struct VTermState.tmp.selection selection

◆ VTermState.tmp.selection

struct VTermState.tmp.selection

Definition at line 153 of file vterm_internal.h.

+ Collaboration diagram for VTermState.tmp.selection:
Data Fields
uint16_t mask
uint32_t recvpartial
uint32_t sendpartial
enum VTermState state

◆ VTermState.selection

struct VTermState.selection

Definition at line 168 of file vterm_internal.h.

+ Collaboration diagram for VTermState.selection:
Data Fields
char * buffer
size_t buflen
const VTermSelectionCallbacks * callbacks
void * user

◆ VTerm.mode

struct VTerm.mode

Definition at line 184 of file vterm_internal.h.

+ Collaboration diagram for VTerm.mode:
Data Fields
unsigned int ctrl8bit:1
unsigned int utf8:1

◆ VTerm.parser

struct VTerm.parser

Definition at line 189 of file vterm_internal.h.

+ Collaboration diagram for VTerm.parser:
Data Fields
const VTermParserCallbacks * callbacks
void * cbdata
bool emit_nul
bool in_esc: 1
char intermed[INTERMED_MAX]
int intermedlen
enum VTermParserState state
bool string_initial
union VTerm.parser.v v

◆ VTerm.parser.v

union VTerm.parser.v

Definition at line 210 of file vterm_internal.h.

+ Collaboration diagram for VTerm.parser.v:
Data Fields
struct VTerm.parser.v.csi csi
struct VTerm.parser.v.dcs dcs
struct VTerm.parser.v.osc osc

◆ VTerm.parser.v.csi

struct VTerm.parser.v.csi

Definition at line 211 of file vterm_internal.h.

+ Collaboration diagram for VTerm.parser.v.csi:
Data Fields
int argi
long args[CSI_ARGS_MAX]
char leader[CSI_LEADER_MAX]
int leaderlen

◆ VTerm.parser.v.osc

struct VTerm.parser.v.osc

Definition at line 218 of file vterm_internal.h.

+ Collaboration diagram for VTerm.parser.v.osc:
Data Fields
int command

◆ VTerm.parser.v.dcs

struct VTerm.parser.v.dcs

Definition at line 221 of file vterm_internal.h.

+ Collaboration diagram for VTerm.parser.v.dcs:
Data Fields
char command[CSI_LEADER_MAX]
int commandlen

Macro Definition Documentation

◆ BUFIDX_ALTSCREEN

#define BUFIDX_ALTSCREEN   1

Definition at line 28 of file vterm_internal.h.

◆ BUFIDX_PRIMARY

#define BUFIDX_PRIMARY   0

Definition at line 27 of file vterm_internal.h.

◆ CSI_ARGS_MAX

#define CSI_ARGS_MAX   16

Definition at line 24 of file vterm_internal.h.

◆ CSI_LEADER_MAX

#define CSI_LEADER_MAX   16

Definition at line 25 of file vterm_internal.h.

◆ DEBUG_LOG

#define DEBUG_LOG (   ...)

Definition at line 17 of file vterm_internal.h.

◆ ESC_S

#define ESC_S   "\x1b"

Definition at line 20 of file vterm_internal.h.

◆ INTERMED_MAX

#define INTERMED_MAX   16

Definition at line 22 of file vterm_internal.h.

◆ INTERNAL

#define INTERNAL

Definition at line 11 of file vterm_internal.h.

◆ MOUSE_WANT_CLICK

#define MOUSE_WANT_CLICK   0x01

Definition at line 96 of file vterm_internal.h.

◆ MOUSE_WANT_DRAG

#define MOUSE_WANT_DRAG   0x02

Definition at line 97 of file vterm_internal.h.

◆ MOUSE_WANT_MOVE

#define MOUSE_WANT_MOVE   0x04

Definition at line 98 of file vterm_internal.h.

◆ ROWWIDTH

#define ROWWIDTH (   state,
  row 
)    ((state)->lineinfo[(row)].doublewidth ? ((state)->cols / 2) : (state)->cols)

Definition at line 89 of file vterm_internal.h.

◆ SCROLLREGION_BOTTOM

#define SCROLLREGION_BOTTOM (   state)    ((state)->scrollregion_bottom > -1 ? (state)->scrollregion_bottom : (state)->rows)

Definition at line 75 of file vterm_internal.h.

◆ SCROLLREGION_LEFT

#define SCROLLREGION_LEFT (   state)    ((state)->mode.leftrightmargin ? (state)->scrollregion_left : 0)

Definition at line 77 of file vterm_internal.h.

◆ SCROLLREGION_RIGHT

#define SCROLLREGION_RIGHT (   state)    ((state)->mode.leftrightmargin && (state)->scrollregion_right > -1 ? (state)->scrollregion_right : (state)->cols)

Definition at line 79 of file vterm_internal.h.

◆ THISROWWIDTH

#define THISROWWIDTH (   state)    ROWWIDTH(state, (state)->pos.row)

Definition at line 90 of file vterm_internal.h.

Typedef Documentation

◆ VTermEncoding

typedef struct VTermEncoding VTermEncoding

Definition at line 30 of file vterm_internal.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
C1_SS3 
C1_DCS 
C1_CSI 
C1_ST 
C1_OSC 

Definition at line 280 of file vterm_internal.h.

◆ VTermEncodingType

Enumerator
ENC_UTF8 
ENC_SINGLE_94 

Definition at line 258 of file vterm_internal.h.

Function Documentation

◆ vterm_allocator_free()

void vterm_allocator_free ( VTerm vt,
void *  ptr 
)

Definition at line 103 of file vterm.c.

References VTerm::allocator, VTerm::allocdata, VTermAllocatorFunctions::free, and vt.

+ Here is the caller graph for this function:

◆ vterm_allocator_malloc()

void * vterm_allocator_malloc ( VTerm vt,
size_t  size 
)

Definition at line 98 of file vterm.c.

References VTerm::allocator, VTerm::allocdata, VTermAllocatorFunctions::malloc, size, and vt.

+ Here is the caller graph for this function:

◆ vterm_lookup_encoding()

VTermEncoding * vterm_lookup_encoding ( VTermEncodingType  type,
char  designation 
)

Definition at line 224 of file encoding.c.

References encodings, and type.

+ Here is the caller graph for this function:

◆ vterm_push_output_bytes()

void vterm_push_output_bytes ( VTerm vt,
const char *  bytes,
size_t  len 
)

Definition at line 144 of file vterm.c.

References memcpy(), VTerm::outbuffer, VTerm::outbuffer_cur, VTerm::outbuffer_len, VTerm::outdata, VTerm::outfunc, and vt.

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

◆ vterm_push_output_sprintf()

void vterm_push_output_sprintf ( VTerm vt,
const char *  format,
  ... 
)

Definition at line 166 of file vterm.c.

References format, va_end, va_start, vt, and vterm_push_output_vsprintf().

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

◆ vterm_push_output_sprintf_ctrl()

void vterm_push_output_sprintf_ctrl ( VTerm vt,
unsigned char  ctrl,
const char *  fmt,
  ... 
)

Definition at line 174 of file vterm.c.

References ESC_S, VTerm::mode, VTerm::tmpbuffer, VTerm::tmpbuffer_len, va_end, va_start, vt, and vterm_push_output_bytes().

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

◆ vterm_push_output_sprintf_str()

void vterm_push_output_sprintf_str ( VTerm vt,
unsigned char  ctrl,
bool  term,
const char *  fmt,
  ... 
)

Definition at line 200 of file vterm.c.

References ESC_S, VTerm::mode, VTerm::tmpbuffer, VTerm::tmpbuffer_len, va_end, va_start, vt, and vterm_push_output_bytes().

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

◆ vterm_push_output_vsprintf()

void vterm_push_output_vsprintf ( VTerm vt,
const char *  format,
va_list  args 
)

Definition at line 158 of file vterm.c.

References format, VTerm::tmpbuffer, VTerm::tmpbuffer_len, vt, and vterm_push_output_bytes().

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

◆ vterm_screen_free()

void vterm_screen_free ( VTermScreen screen)

Definition at line 891 of file screen.c.

References VTermScreen::buffers, BUFIDX_ALTSCREEN, BUFIDX_PRIMARY, VTermScreen::sb_buffer, screen, VTermScreen::vt, and vterm_allocator_free().

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

◆ vterm_state_free()

void vterm_state_free ( VTermState state)

Definition at line 102 of file state.c.

References BUFIDX_ALTSCREEN, BUFIDX_PRIMARY, VTermState::combine_chars, VTermState::lineinfos, state, VTermState::tabstops, VTermState::vt, and vterm_allocator_free().

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

◆ vterm_state_getpen()

int vterm_state_getpen ( VTermState state,
long  args[],
int  argcount 
)

Definition at line 504 of file pen.c.

References VTermPen::baseline, VTermPen::bg, VTermPen::blink, VTermPen::bold, VTermPen::conceal, CSI_ARG_FLAG_MORE, VTermPen::fg, VTermPen::font, VTermPen::italic, VTermState::pen, VTermPen::reverse, VTermPen::small, state, VTermPen::strike, VTermPen::underline, VTERM_BASELINE_LOWER, VTERM_BASELINE_RAISE, vterm_state_getpen_color(), VTERM_UNDERLINE_CURLY, VTERM_UNDERLINE_DOUBLE, and VTERM_UNDERLINE_SINGLE.

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

◆ vterm_state_newpen()

void vterm_state_newpen ( VTermState state)

Definition at line 159 of file pen.c.

References VTermState::colors, VTermState::default_bg, VTermState::default_fg, lookup_default_colour_ansi(), state, vterm_color_rgb(), and vterm_state_set_default_colors().

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

◆ vterm_state_push_output_sprintf_CSI()

void vterm_state_push_output_sprintf_CSI ( VTermState vts,
const char *  format,
  ... 
)

◆ vterm_state_resetpen()

void vterm_state_resetpen ( VTermState state)

Definition at line 170 of file pen.c.

References VTermPen::baseline, VTermPen::bg, VTermPen::blink, VTermPen::bold, VTermPen::conceal, VTermState::default_bg, VTermState::default_fg, VTermPen::fg, VTermPen::font, VTermPen::italic, VTermState::pen, VTermPen::reverse, setpenattr_bool(), setpenattr_col(), setpenattr_int(), VTermPen::small, state, VTermPen::strike, VTermPen::underline, 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, and VTERM_ATTR_UNDERLINE.

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

◆ vterm_state_savepen()

void vterm_state_savepen ( VTermState state,
int  save 
)

Definition at line 187 of file pen.c.

References VTermPen::baseline, VTermPen::bg, VTermPen::blink, VTermPen::bold, VTermPen::conceal, VTermPen::fg, VTermPen::font, VTermPen::italic, VTermState::pen, VTermPen::reverse, VTermState::saved, setpenattr_bool(), setpenattr_col(), setpenattr_int(), VTermPen::small, state, VTermPen::strike, VTermPen::underline, 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, and VTERM_ATTR_UNDERLINE.

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

◆ vterm_state_setpen()

◆ vterm_unicode_is_combining()

int vterm_unicode_is_combining ( uint32_t  codepoint)

Definition at line 310 of file unicode.c.

References bisearch(), and combining.

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

◆ vterm_unicode_width()

int vterm_unicode_width ( uint32_t  codepoint)

Definition at line 302 of file unicode.c.

References bisearch(), fullwidth, and mk_wcwidth().

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