Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
microrl.c File Reference
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "microrl.h"
Include dependency graph for microrl.c:

Go to the source code of this file.

Functions

static void hist_erase_older (ring_history_t *pThis)
static int hist_is_space_for_new (ring_history_t *pThis, int len)
static void hist_save_line (ring_history_t *pThis, char *line, int len)
static int hist_restore_line (ring_history_t *pThis, char *line, int dir)
static int split (microrl_t *pThis, int limit)
static void print_prompt (microrl_t *pThis)
static void terminal_backspace (microrl_t *pThis)
static void terminal_newline (microrl_t *pThis)
static void u16bit_to_str (unsigned int nmb, char *buf)
static void terminal_move_cursor (microrl_t *pThis, int offset)
static void terminal_reset_cursor (microrl_t *pThis)
static void terminal_print_line (microrl_t *pThis, int pos, int cursor)
void microrl_init (microrl_t *pThis, void(*print)(const char *))
void microrl_set_complete_callback (microrl_t *pThis, const char **(*get_completion)(int, const char *const *))
void microrl_set_execute_callback (microrl_t *pThis, void(*execute)(int, const char *const *))
void microrl_set_sigint_callback (microrl_t *pThis, void(*sigintf)(void))
static void hist_search (microrl_t *pThis, int dir)
static int escape_process (microrl_t *pThis, char ch)
static int microrl_insert_text (microrl_t *pThis, const char *text, int len)
static void microrl_backspace (microrl_t *pThis)
static int common_len (const char **arr)
static void microrl_get_complite (microrl_t *pThis)
void new_line_handler (microrl_t *pThis)
void microrl_insert_char (microrl_t *pThis, int ch)

Variables

char * prompt_default = _PROMPT_DEFAUTL

Function Documentation

◆ common_len()

int common_len ( const char ** arr)
static

Definition at line 486 of file microrl.c.

Referenced by microrl_get_complite().

Here is the caller graph for this function:

◆ escape_process()

int escape_process ( microrl_t * pThis,
char ch )
static

Definition at line 385 of file microrl.c.

References _ESC_BRACKET, _ESC_END, _ESC_HOME, _HIST_DOWN, _HIST_UP, microrl_t::cmdlen, microrl_t::cursor, hist_search(), seq, terminal_move_cursor(), and terminal_reset_cursor().

Referenced by microrl_insert_char().

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

◆ hist_erase_older()

void hist_erase_older ( ring_history_t * pThis)
static

Definition at line 70 of file microrl.c.

References _RING_HISTORY_LEN, ring_history_t::begin, and ring_history_t::ring_buf.

Referenced by hist_save_line().

Here is the caller graph for this function:

◆ hist_is_space_for_new()

int hist_is_space_for_new ( ring_history_t * pThis,
int len )
static

Definition at line 81 of file microrl.c.

References _RING_HISTORY_LEN, ring_history_t::begin, ring_history_t::end, and ring_history_t::ring_buf.

Referenced by hist_save_line().

Here is the caller graph for this function:

◆ hist_restore_line()

int hist_restore_line ( ring_history_t * pThis,
char * line,
int dir )
static

Definition at line 131 of file microrl.c.

References _HIST_UP, _RING_HISTORY_LEN, ring_history_t::begin, ring_history_t::cur, dir, and ring_history_t::ring_buf.

Referenced by hist_search().

Here is the caller graph for this function:

◆ hist_save_line()

void hist_save_line ( ring_history_t * pThis,
char * line,
int len )
static

Definition at line 97 of file microrl.c.

References _RING_HISTORY_LEN, ring_history_t::begin, ring_history_t::cur, ring_history_t::end, hist_erase_older(), hist_is_space_for_new(), and ring_history_t::ring_buf.

Referenced by new_line_handler().

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

◆ hist_search()

void hist_search ( microrl_t * pThis,
int dir )
static

Definition at line 373 of file microrl.c.

References microrl_t::cmdlen, microrl_t::cmdline, microrl_t::cursor, dir, hist_restore_line(), microrl_t::ring_hist, terminal_print_line(), and terminal_reset_cursor().

Referenced by escape_process(), and microrl_insert_char().

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

◆ microrl_backspace()

void microrl_backspace ( microrl_t * pThis)
static

Definition at line 467 of file microrl.c.

References microrl_t::cmdlen, microrl_t::cmdline, microrl_t::cursor, and terminal_backspace().

Referenced by microrl_insert_char().

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

◆ microrl_get_complite()

void microrl_get_complite ( microrl_t * pThis)
static

Definition at line 504 of file microrl.c.

References microrl_t::cmdline, common_len(), microrl_t::cursor, microrl_t::get_completion, microrl_insert_text(), microrl_t::print, print_prompt(), split(), status, terminal_newline(), terminal_print_line(), terminal_reset_cursor(), and microrl_t::tkn_arr.

Referenced by microrl_insert_char().

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

◆ microrl_init()

void microrl_init ( microrl_t * pThis,
void(* print )(const char *) )

◆ microrl_insert_char()

◆ microrl_insert_text()

int microrl_insert_text ( microrl_t * pThis,
const char * text,
int len )
static

Definition at line 439 of file microrl.c.

References _COMMAND_LINE_LEN, microrl_t::cmdlen, microrl_t::cmdline, and microrl_t::cursor.

Referenced by microrl_get_complite(), and microrl_insert_char().

Here is the caller graph for this function:

◆ microrl_set_complete_callback()

void microrl_set_complete_callback ( microrl_t * pThis,
const char **(* get_completion )(int, const char *const *) )

Definition at line 353 of file microrl.c.

References microrl_t::get_completion.

Referenced by shellInit().

Here is the caller graph for this function:

◆ microrl_set_execute_callback()

void microrl_set_execute_callback ( microrl_t * pThis,
void(* execute )(int, const char *const *) )

Definition at line 360 of file microrl.c.

References microrl_t::execute.

Referenced by shellInit().

Here is the caller graph for this function:

◆ microrl_set_sigint_callback()

void microrl_set_sigint_callback ( microrl_t * pThis,
void(* sigintf )(void) )

Definition at line 366 of file microrl.c.

References microrl_t::sigint.

Referenced by shellInit().

Here is the caller graph for this function:

◆ new_line_handler()

void new_line_handler ( microrl_t * pThis)

Definition at line 546 of file microrl.c.

References _COMMAND_LINE_LEN, microrl_t::cmdlen, microrl_t::cmdline, ring_history_t::cur, microrl_t::cursor, ENDL, microrl_t::execute, hist_save_line(), microrl_t::print, print_prompt(), microrl_t::ring_hist, split(), status, terminal_newline(), and microrl_t::tkn_arr.

Referenced by microrl_insert_char().

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

◆ print_prompt()

void print_prompt ( microrl_t * pThis)
inlinestatic

Definition at line 229 of file microrl.c.

References microrl_t::print, and microrl_t::prompt_str.

Referenced by microrl_get_complite(), microrl_init(), and new_line_handler().

Here is the caller graph for this function:

◆ split()

int split ( microrl_t * pThis,
int limit )
static

Definition at line 204 of file microrl.c.

References _COMMAND_TOKEN_NMB, microrl_t::cmdline, and microrl_t::tkn_arr.

Referenced by handle_raw(), microrl_get_complite(), and new_line_handler().

Here is the caller graph for this function:

◆ terminal_backspace()

void terminal_backspace ( microrl_t * pThis)
inlinestatic

Definition at line 235 of file microrl.c.

References microrl_t::print.

Referenced by microrl_backspace().

Here is the caller graph for this function:

◆ terminal_move_cursor()

void terminal_move_cursor ( microrl_t * pThis,
int offset )
static

Definition at line 269 of file microrl.c.

References offset, microrl_t::print, and u16bit_to_str().

Referenced by escape_process(), microrl_insert_char(), and terminal_print_line().

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

◆ terminal_newline()

void terminal_newline ( microrl_t * pThis)
inlinestatic

Definition at line 241 of file microrl.c.

References ENDL, and microrl_t::print.

Referenced by microrl_get_complite(), and new_line_handler().

Here is the caller graph for this function:

◆ terminal_print_line()

void terminal_print_line ( microrl_t * pThis,
int pos,
int cursor )
static

Definition at line 312 of file microrl.c.

References microrl_t::cmdlen, microrl_t::cmdline, microrl_t::print, terminal_move_cursor(), and terminal_reset_cursor().

Referenced by hist_search(), microrl_get_complite(), and microrl_insert_char().

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

◆ terminal_reset_cursor()

void terminal_reset_cursor ( microrl_t * pThis)
static

Definition at line 293 of file microrl.c.

References _COMMAND_LINE_LEN, _PROMPT_LEN, microrl_t::print, and u16bit_to_str().

Referenced by escape_process(), hist_search(), microrl_get_complite(), microrl_insert_char(), and terminal_print_line().

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

◆ u16bit_to_str()

void u16bit_to_str ( unsigned int nmb,
char * buf )
static

Definition at line 250 of file microrl.c.

Referenced by terminal_move_cursor(), and terminal_reset_cursor().

Here is the caller graph for this function:

Variable Documentation

◆ prompt_default

char* prompt_default = _PROMPT_DEFAUTL

Definition at line 28 of file microrl.c.

Referenced by microrl_init().