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

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

#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <sys/syscalls.h>
#include "main.h"
#include "keyboard.h"
#include "font.h"
+ Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define FONT_WIDTH   (terminal_font.bbox.width)
 
#define FONT_HEIGHT   (terminal_font.bbox.height)
 

Functions

static void lfos_framebuffer_init (lfos_framebuffer *this)
 
static uint32_t get_color (lfos_term_state *state, VTermColor *color)
 
static struct glyphfind_glyph (uint32_t codepoint)
 
static void render_cell (lfos_term_state *state, int row, int col, VTermScreenCell *cell)
 
static void vterm_render_cell (lfos_term_state *state, int row, int col)
 
static int vterm_damage (VTermRect rect, void *user)
 
static int vterm_movecursor (VTermPos pos, VTermPos oldpos, int visible, void *user)
 
static void vterm_output_callback (const char *s, size_t len, void *user)
 
int read_lfos (int file, char *ptr, int len)
 
int write_lfos (int file, char *ptr, int len)
 
int klsh_main ()
 
int main (int argc, char *argv[])
 

Variables

struct font terminal_font
 
lfos_term_state state
 

Macro Definition Documentation

◆ FONT_HEIGHT

#define FONT_HEIGHT   (terminal_font.bbox.height)

Definition at line 18 of file main.c.

◆ FONT_WIDTH

#define FONT_WIDTH   (terminal_font.bbox.width)

Definition at line 17 of file main.c.

Function Documentation

◆ find_glyph()

static struct glyph * find_glyph ( uint32_t  codepoint)
static

Definition at line 34 of file main.c.

References glyph::encoding, find_glyph(), font::glyphs, font::num_glyphs, and terminal_font.

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

◆ get_color()

static uint32_t get_color ( lfos_term_state state,
VTermColor color 
)
static

Definition at line 24 of file main.c.

References VTermColor::rgb, state, VTERM_COLOR_IS_RGB, vterm_screen_convert_color_to_rgb(), and lfos_term_state::vtermScreen.

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

◆ klsh_main()

int klsh_main ( )

Definition at line 237 of file shell.c.

References add_hist_entry(), assign_variable(), built_in_exec(), free(), get_raw_buffer(), hist_push(), memset(), shell_variable::name, parse_argv(), prog_in_path(), shell_variable_add(), shell_variable_get(), strlen(), and shell_variable::value.

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

◆ lfos_framebuffer_init()

static void lfos_framebuffer_init ( lfos_framebuffer this)
static

Definition at line 20 of file main.c.

References height, stride, and width.

+ Here is the caller graph for this function:

◆ main()

◆ read_lfos()

int read_lfos ( int  file,
char *  ptr,
int  len 
)

Definition at line 135 of file main.c.

References lfos_term_state::input_buffer_current, lfos_term_state::input_buffer_len, kbd_read(), memcpy(), and state.

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

◆ render_cell()

static void render_cell ( lfos_term_state state,
int  row,
int  col,
VTermScreenCell cell 
)
static

Definition at line 50 of file main.c.

References VTermScreenCell::attrs, VTermScreenCell::bg, glyph::bitmap, VTermScreenCell::chars, VTermPos::col, lfos_term_state::cursor_pos, lfos_framebuffer::fb, lfos_term_state::fb, VTermScreenCell::fg, find_glyph(), FONT_HEIGHT, FONT_WIDTH, get_color(), lfos_framebuffer::height, VTermScreenCellAttrs::reverse, VTermPos::row, state, lfos_framebuffer::stride, VTermScreenCellAttrs::underline, and lfos_framebuffer::width.

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

◆ vterm_damage()

static int vterm_damage ( VTermRect  rect,
void *  user 
)
static

Definition at line 98 of file main.c.

References VTermRect::end_col, VTermRect::end_row, VTermRect::start_col, VTermRect::start_row, state, and vterm_render_cell().

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

◆ vterm_movecursor()

static int vterm_movecursor ( VTermPos  pos,
VTermPos  oldpos,
int  visible,
void *  user 
)
static

Definition at line 110 of file main.c.

References VTermPos::col, lfos_term_state::cursor_pos, VTermPos::row, state, and vterm_render_cell().

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

◆ vterm_output_callback()

static void vterm_output_callback ( const char *  s,
size_t  len,
void *  user 
)
static

Definition at line 119 of file main.c.

References free(), lfos_term_state::input_buffer, lfos_term_state::input_buffer_current, lfos_term_state::input_buffer_len, malloc(), memcpy(), and state.

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

◆ vterm_render_cell()

static void vterm_render_cell ( lfos_term_state state,
int  row,
int  col 
)
static

Definition at line 92 of file main.c.

References render_cell(), state, vterm_screen_get_cell(), and lfos_term_state::vtermScreen.

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

◆ write_lfos()

int write_lfos ( int  file,
char *  ptr,
int  len 
)

Definition at line 154 of file main.c.

References state, lfos_term_state::vterm, and vterm_input_write().

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

Variable Documentation

◆ state

Definition at line 134 of file main.c.

◆ terminal_font

struct font terminal_font
extern