#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <wctype.h>
#include <wchar.h>
#include <time.h>
#include <assert.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "common.h"
#include "tokenizer.h"
#include "parse_util.h"
#include "expand.h"
#include "intern.h"
#include "exec.h"
#include "env.h"
#include "signal.h"
#include "wildcard.h"
#include "halloc_util.h"
Data Structures | |
| struct | autoload_t |
| A structure representing the autoload state for a specific variable, e.g. More... | |
Defines | |
| #define | AUTOLOAD_MAX 10 |
| Maximum number of autoloaded items opf a specific type to keep in memory at a time. | |
| #define | AUTOLOAD_MIN_AGE 60 |
| Minimum time, in seconds, before an autoloaded item will be unloaded. | |
Functions | |
| int | parse_util_lineno (const wchar_t *str, int len) |
| Get the linenumber at the specified character offset. | |
| int | parse_util_get_line_from_offset (wchar_t *buff, int pos) |
| Calculate the line number of the specified cursor position. | |
| int | parse_util_get_offset_from_line (wchar_t *buff, int line) |
| Get the offset of the first character on the specified line. | |
| int | parse_util_get_offset (wchar_t *buff, int line, int line_offset) |
| Return the total offset of the buffer for the cursor position nearest to the specified poition. | |
| int | parse_util_locate_cmdsubst (const wchar_t *in, wchar_t **begin, wchar_t **end, int allow_incomplete) |
| Find the beginning and end of the first subshell in the specified string. | |
| void | parse_util_cmdsubst_extent (const wchar_t *buff, int cursor_pos, wchar_t **a, wchar_t **b) |
| Find the beginning and end of the command substitution under the cursor. | |
| static void | job_or_process_extent (const wchar_t *buff, int cursor_pos, wchar_t **a, wchar_t **b, int process) |
| Get the beginning and end of the job or process definition under the cursor. | |
| void | parse_util_process_extent (const wchar_t *buff, int pos, wchar_t **a, wchar_t **b) |
| Find the beginning and end of the process definition under the cursor. | |
| void | parse_util_job_extent (const wchar_t *buff, int pos, wchar_t **a, wchar_t **b) |
| Find the beginning and end of the job definition under the cursor. | |
| void | parse_util_token_extent (const wchar_t *buff, int cursor_pos, wchar_t **tok_begin, wchar_t **tok_end, wchar_t **prev_begin, wchar_t **prev_end) |
| Find the beginning and end of the token under the cursor and the toekn before the current token. | |
| static void | clear_hash_value (void *key, void *data, void *aux) |
| Free hash value, but not hash key. | |
| static void | clear_loaded_entry (void *key, void *data, void *handler) |
| Part of the autoloader cleanup. | |
| static void | parse_util_destroy () |
| The autoloader cleanup function. | |
| void | parse_util_load_reset (const wchar_t *path_var_name, void(*on_load)(const wchar_t *cmd)) |
| Reset the loader for the specified path variable. | |
| int | parse_util_unload (const wchar_t *cmd, const wchar_t *path_var_name, void(*on_load)(const wchar_t *cmd)) |
| Tell the autoloader that the specified file, in the specified path, is no longer loaded. | |
| static void | parse_util_autounload (const wchar_t *path_var_name, const wchar_t *skip, void(*on_load)(const wchar_t *cmd)) |
| Unload all autoloaded items that have expired, that where loaded in the specified path. | |
| static int | parse_util_load_internal (const wchar_t *cmd, void(*on_load)(const wchar_t *cmd), int reload, autoload_t *loaded, array_list_t *path_list) |
| This internal helper function does all the real work. | |
| int | parse_util_load (const wchar_t *cmd, const wchar_t *path_var_name, void(*on_load)(const wchar_t *cmd), int reload) |
| Autoload the specified file, if it exists in the specified path. | |
| void | parse_util_set_argv (wchar_t **argv, array_list_t *named_arguments) |
| Set the argv environment variable to the specified null-terminated array of strings. | |
| wchar_t * | parse_util_unescape_wildcards (const wchar_t *str) |
| Make a duplicate of the specified string, unescape wildcard characters but not performing any other character transformation. | |
Variables | |
| static hash_table_t * | all_loaded = 0 |
| Set of files which have been autoloaded. | |
This library can be seen as a 'toolbox' for functions that are used in many places in fish and that are somehow related to parsing the code.
|
||||||||||||||||
|
Unload all autoloaded items that have expired, that where loaded in the specified path.
|
|
||||||||||||||||||||
|
Find the beginning and end of the command substitution under the cursor. If no subshell is found, the entire string is returned. If the current command substitution is not ended, i.e. the closing parenthesis is missing, then the string from the beginning of the substitution to the end of the string is returned.
|
|
|
The autoloader cleanup function. It is run on shutdown and frees any memory used by the autoloader code to keep track of loaded files. |
|
||||||||||||||||||||
|
Find the beginning and end of the job definition under the cursor.
|
|
||||||||||||
|
Get the linenumber at the specified character offset. First cached state Second cached state |
|
||||||||||||||||||||
|
Autoload the specified file, if it exists in the specified path. Init if this is the first time we try to autoload anything Warn and fail on infinite recursion Cleanup Make sure we didn't 'drop' something |
|
||||||||||||||||||||||||
|
This internal helper function does all the real work. By using two functions, the internal function can return on various places in the code, and the caller can take care of various cleanup work. |
|
||||||||||||
|
Reset the loader for the specified path variable. This will cause all information on loaded files in the specified directory to be reset.
|
|
||||||||||||||||||||
|
Find the beginning and end of the first subshell in the specified string.
|
|
||||||||||||||||||||
|
Find the beginning and end of the process definition under the cursor.
|
|
||||||||||||||||||||||||||||
|
Find the beginning and end of the token under the cursor and the toekn before the current token. Any combination of tok_begin, tok_end, prev_begin and prev_end may be null.
|
|
||||||||||||||||
|
Tell the autoloader that the specified file, in the specified path, is no longer loaded.
|
1.4.4