implement helper functions to construct array val

This commit is contained in:
Kurtis Rader 2017-07-07 15:20:28 -07:00
parent 80df9053b3
commit 899b5ec6cf
3 changed files with 22 additions and 10 deletions

View File

@ -41,7 +41,6 @@
#include "env.h" #include "env.h"
#include "env_universal_common.h" #include "env_universal_common.h"
#include "event.h" #include "event.h"
#include "expand.h"
#include "fallback.h" // IWYU pragma: keep #include "fallback.h" // IWYU pragma: keep
#include "fish_version.h" #include "fish_version.h"
#include "history.h" #include "history.h"
@ -55,8 +54,6 @@
#include "screen.h" #include "screen.h"
#include "wutil.h" // IWYU pragma: keep #include "wutil.h" // IWYU pragma: keep
/// Value denoting a null string.
#define ENV_NULL L"\x1d"
#define DEFAULT_TERM1 "ansi" #define DEFAULT_TERM1 "ansi"
#define DEFAULT_TERM2 "dumb" #define DEFAULT_TERM2 "dumb"
@ -1524,3 +1521,11 @@ const wchar_t *const env_vars_snapshot_t::highlighting_keys[] = {L"PATH", L"CDPA
L"fish_function_path", NULL}; L"fish_function_path", NULL};
const wchar_t *const env_vars_snapshot_t::completing_keys[] = {L"PATH", L"CDPATH", NULL}; const wchar_t *const env_vars_snapshot_t::completing_keys[] = {L"PATH", L"CDPATH", NULL};
wcstring *list_to_array_val(const wcstring_list_t &list) {
return new wcstring();
}
wcstring *list_to_array_val(const wchar_t **list) {
return new wcstring();
}

View File

@ -14,6 +14,16 @@
extern size_t read_byte_limit; extern size_t read_byte_limit;
extern bool curses_initialized; extern bool curses_initialized;
/// Character for separating two array elements. We use 30, i.e. the ascii record separator since
/// that seems logical.
#define ARRAY_SEP ((wchar_t)(0x1e))
/// String containing the character for separating two array elements.
#define ARRAY_SEP_STR L"\x1e"
/// Value denoting a null string.
#define ENV_NULL L"\x1d"
// Flags that may be passed as the 'mode' in env_set / env_get_string. // Flags that may be passed as the 'mode' in env_set / env_get_string.
enum { enum {
/// Default mode. /// Default mode.
@ -200,4 +210,8 @@ extern bool term_has_xn; // does the terminal have the "eat_newline_glitch"
/// Returns true if we think the terminal supports setting its title. /// Returns true if we think the terminal supports setting its title.
bool term_supports_setting_title(); bool term_supports_setting_title();
/// Returns the fish internal representation for an array of strings.
wcstring *list_to_array_val(const wcstring_list_t &list);
wcstring *list_to_array_val(const wchar_t **list);
#endif #endif

View File

@ -89,13 +89,6 @@ enum expand_error_t {
EXPAND_WILDCARD_MATCH EXPAND_WILDCARD_MATCH
}; };
/// Character for separating two array elements. We use 30, i.e. the ascii record separator since
/// that seems logical.
#define ARRAY_SEP ((wchar_t)(0x1e))
/// String containing the character for separating two array elements.
#define ARRAY_SEP_STR L"\x1e"
/// Error issued on array out of bounds. /// Error issued on array out of bounds.
#define ARRAY_BOUNDS_ERR _(L"Array index out of bounds") #define ARRAY_BOUNDS_ERR _(L"Array index out of bounds")