Line editing support with history. More...
Go to the source code of this file.
Defines | |
| #define | DEBUG_DUMP_HISTORY 0 |
| Enable dump of the history after each line. | |
| #define | IS_WORD_SEPARATOR(c) ((c) == ' ' || (c) == '\0') |
| Check if c is a separator between words. | |
Enumerations | |
| enum | RL_KEYS |
| Special keys (escape sequences converted to a single code) | |
Functions | |
| void | rl_puts (const struct RLContext *ctx, const char *txt) |
| Write the string txt to the IO output (without any kind of termination) | |
| void | rl_putc (const struct RLContext *ctx, char ch) |
| Write character ch to the IO output. | |
| static bool | rl_getc (const struct RLContext *ctx, int *ch) |
| Read a character from the IO into ch. | |
| bool | is_history_begin (struct RLContext *ctx, int i) |
| Check if index i points to the begin of the history. | |
| bool | is_history_end (struct RLContext *ctx, int i) |
| Check if index i points to the (exclusive) end of history. | |
| bool | is_history_past_end (struct RLContext *ctx, int i) |
| Check if index i points to the (exclusive) end of history, or somewhere past the end. | |
| static bool | insert_chars (struct RLContext *ctx, size_t *curpos, const char *ch, int num_chars) |
| Insert num_chars characters from ch into the history buffer at the position indicated by curpos. | |
| static bool | insert_char (struct RLContext *ctx, size_t *curpos, char ch) |
Insert a single character ch into the buffer (with the same semantic of insert_chars()) | |
| static bool | complete_word (struct RLContext *ctx, size_t *curpos) |
| Complete the current word. Return false if no unambiguous completion was found. | |
Detailed Description
Line editing support with history.
Definition in file readline.c.
Define Documentation
| #define IS_WORD_SEPARATOR | ( | c | ) | ((c) == ' ' || (c) == '\0') |
Check if c is a separator between words.
- Note:
- Parameter c is evaluated multiple times
Definition at line 104 of file readline.c.
Function Documentation
| static bool insert_chars | ( | struct RLContext * | ctx, |
| size_t * | curpos, | ||
| const char * | ch, | ||
| int | num_chars | ||
| ) | [static] |
Insert num_chars characters from ch into the history buffer at the position indicated by curpos.
If needed, remove old history to make room. Returns true if everything was successful, false if there was no room to add the characters.
- Note:
- num_chars can be 0, in which case we just make sure the line is correctly zero-terminated (ASCIIZ format).
Definition at line 239 of file readline.c.
| static bool rl_getc | ( | const struct RLContext * | ctx, |
| int * | ch | ||
| ) | [static] |
Read a character from the IO into ch.
This function also takes care of converting the ANSI escape sequences into one of the codes defined in RL_KEYS.
Definition at line 128 of file readline.c.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/bertos_logo.png)