|
| int | map_expanded_line_to_include_path (const char *path, int line, char *out_path, size_t out_path_cap, int *out_line) |
| | Map a line number in expanded source back to original include path/line.
|
| static const char * | rl_hist_last (void) |
| | Return the last history line or NULL if history is empty.
|
| static void | rl_hist_add (const char *s) |
| | Append a non-empty line to in-memory history, de-duplicating consecutive duplicates. Trailing newlines are stripped.
|
| static void | rl_hist_load_file (const char *path) |
| | Load history entries from a file (one line per entry).
|
| static void | repl_disable_raw (void) |
| | Disable terminal raw mode if previously enabled.
|
| static int | repl_enable_raw (void) |
| | Enable minimal terminal raw mode for interactive input.
|
| static int | is_dir_path (const char *path) |
| | Return 1 if path refers to a directory, 0 otherwise.
|
| static size_t | lcp_suffix (const char **names, int count, size_t base_len) |
| | Longest common suffix length among names[i] starting at base_len.
|
| static void | rl_word_left (const char *out, size_t len, size_t *pos) |
| | Move cursor left by one word.
|
| static void | rl_word_right (const char *out, size_t len, size_t *pos) |
| | Move cursor right by one word.
|
| static int | complete_load_path (char *buf, size_t *len_io) |
| | Complete a :load file path in-place within the buffer.
|
| static int | is_ident_start (int c) |
| | Return 1 if c can start an identifier.
|
| static int | is_ident_char (int c) |
| | Return 1 if c is a valid identifier continuation character.
|
| static void | std_syms_add (const char *name) |
| | Add a stdlib symbol name to the completion table.
|
| static void | scan_symbols_from_file (const char *path) |
| | Scan a .fun file and collect top-level definitions for completion.
|
| static void | scan_dir_recursive (const char *dir) |
| | Recursively scan a directory tree for .fun files.
|
| static void | load_stdlib_symbols (const char *libdir) |
| | Populate stdlib completion symbols from a base directory.
|
| static void | free_stdlib_symbols (void) |
| | Free all memory held by stdlib completion symbols.
|
| static int | complete_stdlib_ident (char *buf, size_t *len_io, size_t *pos_io, size_t cap) |
| | Complete the trailing identifier in buf from stdlib symbols.
|
| static int | read_line_edit (char *out, size_t out_cap, const char *prompt) |
| | Read a line with basic line-editing and history support.
|
| static int | is_blank_line (const char *s) |
| static const char * | lstrip (const char *s) |
| | Advance pointer past leading spaces and tabs.
|
| static int | ends_with_opener (const char *line) |
| | Heuristic: check if a line ends with an operator that suggests continuation.
|
| static int | compute_open_indent_blocks (const char *buf) |
| | Compute number of open indentation blocks (2 spaces per level).
|
| static int | buffer_looks_incomplete (const char *buf) |
| | Heuristic to determine if the current buffer likely needs another line. Looks for open quotes/escapes or unmatched indentation.
|
| static void | show_repl_help (void) |
| | Print REPL help with available commands.
|
| static char * | read_entire_file (const char *path, size_t *out_len) |
| | Read a file fully into a newly allocated buffer.
|
| static int | write_entire_file (const char *path, const char *data, size_t len) |
| | Write a buffer to a file path, replacing existing contents.
|
| static int | cmd_is_one_of (const char *cmd, const char *const names[]) |
| | Return 1 if cmd equals any non-NULL entry in names[] (terminated by NULL).
|
| static void | hexdump_to (FILE *out, const unsigned char *data, size_t len, size_t base_off) |
| | Dump a byte buffer in hex to a FILE*, with offsets.
|
| static void | print_last_n_lines (const char *path, int n) |
| | Print the last n lines of a file to stdout (tail-like).
|
| static void | append_history (FILE *hist, const char *buffer) |
| | Append multi-line buffer to history file, one line per entry.
|
| static void | env_show_usage (void) |
| | Print usage for :env commands.
|
| static void | env_get (const char *name) |
| | Show the value of an environment variable.
|
| static void | env_set (const char *name, const char *value) |
| | Set or unset (when value is NULL) an environment variable.
|
| int | fun_run_repl (VM *vm) |
| | Run the interactive Fun REPL session.
|
Interactive Read–Eval–Print Loop (REPL) for the Fun language.
Provides line editing, history, simple completion for :load paths and stdlib identifiers, multi-line input heuristics, and a command interface (e.g. :help, :env, :load). Built only when FUN_WITH_REPL is defined.
Definition in file repl.c.