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_universal_common.h"
#include "event.h"
#include "expand.h"
#include "fallback.h" // IWYU pragma: keep
#include "fish_version.h"
#include "history.h"
@ -55,8 +54,6 @@
#include "screen.h"
#include "wutil.h" // IWYU pragma: keep
/// Value denoting a null string.
#define ENV_NULL L"\x1d"
#define DEFAULT_TERM1 "ansi"
#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};
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 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.
enum {
/// 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.
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

View File

@ -89,13 +89,6 @@ enum expand_error_t {
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.
#define ARRAY_BOUNDS_ERR _(L"Array index out of bounds")