summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-01 18:29:55 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-01 18:29:55 +0200
commit9a78e6df17033223ebdf499f2b02b2538601c52d (patch)
tree9b9e1ed02b97f57c83880b371c2dd4939098032a /src
parente6b5324e3a3d354363f3c48e784c42ce3e77453f (diff)
patch 8.2.1111: inconsistent naming of get_list_tv() and eval_dict()v8.2.1111
Problem: Inconsistent naming of get_list_tv() and eval_dict(). Solution: Rename get_list_tv() to eval_list(). Similarly for eval_number(), eval_string(), eval_lit_string() and a few others.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c21
-rw-r--r--src/evalfunc.c2
-rw-r--r--src/evalvars.c10
-rw-r--r--src/list.c2
-rw-r--r--src/proto/evalvars.pro2
-rw-r--r--src/proto/list.pro2
-rw-r--r--src/proto/typval.pro26
-rw-r--r--src/typval.c12
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c18
-rw-r--r--src/vim9execute.c4
-rw-r--r--src/vim9script.c4
12 files changed, 55 insertions, 50 deletions
diff --git a/src/eval.c b/src/eval.c
index ce255e2b96..9a2fdf6540 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1224,7 +1224,7 @@ set_var_lval(
// handle +=, -=, *=, /=, %= and .=
di = NULL;
- if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name),
+ if (eval_variable(lp->ll_name, (int)STRLEN(lp->ll_name),
&tv, &di, TRUE, FALSE) == OK)
{
if ((di == NULL
@@ -2901,7 +2901,7 @@ eval7(
case '7':
case '8':
case '9':
- case '.': ret = get_number_tv(arg, rettv, evaluate, want_string);
+ case '.': ret = eval_number(arg, rettv, evaluate, want_string);
// Apply prefixed "-" and "+" now. Matters especially when
// "->" follows.
@@ -2912,19 +2912,19 @@ eval7(
/*
* String constant: "string".
*/
- case '"': ret = get_string_tv(arg, rettv, evaluate);
+ case '"': ret = eval_string(arg, rettv, evaluate);
break;
/*
* Literal string constant: 'str''ing'.
*/
- case '\'': ret = get_lit_string_tv(arg, rettv, evaluate);
+ case '\'': ret = eval_lit_string(arg, rettv, evaluate);
break;
/*
* List: [expr, expr]
*/
- case '[': ret = get_list_tv(arg, rettv, evalarg, TRUE);
+ case '[': ret = eval_list(arg, rettv, evalarg, TRUE);
break;
/*
@@ -2951,13 +2951,13 @@ eval7(
/*
* Option value: &name
*/
- case '&': ret = get_option_tv(arg, rettv, evaluate);
+ case '&': ret = eval_option(arg, rettv, evaluate);
break;
/*
* Environment variable: $VAR.
*/
- case '$': ret = get_env_tv(arg, rettv, evaluate);
+ case '$': ret = eval_env_var(arg, rettv, evaluate);
break;
/*
@@ -3012,14 +3012,17 @@ eval7(
ret = FAIL;
else
{
- if (**arg == '(') // recursive!
+ if (**arg == '(')
+ // "name(..." recursive!
ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
else if (flags & EVAL_CONSTANT)
ret = FAIL;
else if (evaluate)
- ret = get_var_tv(s, len, rettv, NULL, TRUE, FALSE);
+ // get value of variable
+ ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE);
else
{
+ // skip the name
check_vars(s, len);
ret = OK;
}
diff --git a/src/evalfunc.c b/src/evalfunc.c
index b8f1c2c38e..8d81f15123 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2324,7 +2324,7 @@ f_exists(typval_T *argvars, typval_T *rettv)
}
else if (*p == '&' || *p == '+') // option
{
- n = (get_option_tv(&p, NULL, TRUE) == OK);
+ n = (eval_option(&p, NULL, TRUE) == OK);
if (*skipwhite(p) != NUL)
n = FALSE; // trailing garbage
}
diff --git a/src/evalvars.c b/src/evalvars.c
index 901d406a00..131486750c 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1124,7 +1124,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
{
if (tofree != NULL)
name = tofree;
- if (get_var_tv(name, len, &tv, NULL, TRUE, FALSE) == FAIL)
+ if (eval_variable(name, len, &tv, NULL, TRUE, FALSE) == FAIL)
error = TRUE;
else
{
@@ -2365,7 +2365,7 @@ set_cmdarg(exarg_T *eap, char_u *oldarg)
* Return OK or FAIL. If OK is returned "rettv" must be cleared.
*/
int
-get_var_tv(
+eval_variable(
char_u *name,
int len, // length of "name"
typval_T *rettv, // NULL when only checking existence
@@ -3206,7 +3206,7 @@ getwinvar(
done = TRUE;
}
}
- else if (get_option_tv(&varname, rettv, 1) == OK)
+ else if (eval_option(&varname, rettv, 1) == OK)
// window-local-option
done = TRUE;
}
@@ -3342,7 +3342,7 @@ var_exists(char_u *var)
{
if (tofree != NULL)
name = tofree;
- n = (get_var_tv(name, len, &tv, NULL, FALSE, TRUE) == OK);
+ n = (eval_variable(name, len, &tv, NULL, FALSE, TRUE) == OK);
if (n)
{
// handle d.key, l[idx], f(expr)
@@ -3609,7 +3609,7 @@ f_getbufvar(typval_T *argvars, typval_T *rettv)
done = TRUE;
}
}
- else if (get_option_tv(&varname, rettv, TRUE) == OK)
+ else if (eval_option(&varname, rettv, TRUE) == OK)
// buffer-local-option
done = TRUE;
diff --git a/src/list.c b/src/list.c
index 2bea55e02f..9475ef99e2 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1160,7 +1160,7 @@ f_join(typval_T *argvars, typval_T *rettv)
* Return OK or FAIL.
*/
int
-get_list_tv(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
+eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
{
int evaluate = evalarg == NULL ? FALSE
: evalarg->eval_flags & EVAL_EVALUATE;
diff --git a/src/proto/evalvars.pro b/src/proto/evalvars.pro
index eab82c8cfa..a1083100dc 100644
--- a/src/proto/evalvars.pro
+++ b/src/proto/evalvars.pro
@@ -52,7 +52,7 @@ void set_reg_var(int c);
char_u *v_exception(char_u *oldval);
char_u *v_throwpoint(char_u *oldval);
char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
-int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
+int eval_variable(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
void check_vars(char_u *name, int len);
dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload);
dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);
diff --git a/src/proto/list.pro b/src/proto/list.pro
index ddf26a5dd6..53502ae723 100644
--- a/src/proto/list.pro
+++ b/src/proto/list.pro
@@ -39,7 +39,7 @@ void vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2);
char_u *list2string(typval_T *tv, int copyID, int restore_copyID);
int list_join(garray_T *gap, list_T *l, char_u *sep, int echo_style, int restore_copyID, int copyID);
void f_join(typval_T *argvars, typval_T *rettv);
-int get_list_tv(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error);
+int eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error);
int write_list(FILE *fd, list_T *list, int binary);
void init_static_list(staticList10_T *sl);
void f_list2str(typval_T *argvars, typval_T *rettv);
diff --git a/src/proto/typval.pro b/src/proto/typval.pro
index 6eebde26e0..3bc2f2c5e5 100644
--- a/src/proto/typval.pro
+++ b/src/proto/typval.pro
@@ -4,18 +4,6 @@ typval_T *alloc_string_tv(char_u *s);
void free_tv(typval_T *varp);
void clear_tv(typval_T *varp);
void init_tv(typval_T *varp);
-int tv_check_lock(typval_T *tv, char_u *name, int use_gettext);
-void copy_tv(typval_T *from, typval_T *to);
-int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int ic);
-char_u *typval_tostring(typval_T *arg);
-int tv_islocked(typval_T *tv);
-int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
-int get_option_tv(char_u **arg, typval_T *rettv, int evaluate);
-int get_number_tv(char_u **arg, typval_T *rettv, int evaluate, int want_string);
-int get_string_tv(char_u **arg, typval_T *rettv, int evaluate);
-int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate);
-char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID);
-int get_env_tv(char_u **arg, typval_T *rettv, int evaluate);
varnumber_T tv_get_number(typval_T *varp);
varnumber_T tv_get_number_chk(typval_T *varp, int *denote);
float_T tv_get_float(typval_T *varp);
@@ -23,8 +11,20 @@ char_u *tv_get_string(typval_T *varp);
char_u *tv_get_string_buf(typval_T *varp, char_u *buf);
char_u *tv_get_string_chk(typval_T *varp);
char_u *tv_get_string_buf_chk(typval_T *varp, char_u *buf);
+char_u *tv_stringify(typval_T *varp, char_u *buf);
+int tv_check_lock(typval_T *tv, char_u *name, int use_gettext);
+void copy_tv(typval_T *from, typval_T *to);
+int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int ic);
+char_u *typval_tostring(typval_T *arg);
+int tv_islocked(typval_T *tv);
+int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
+int eval_option(char_u **arg, typval_T *rettv, int evaluate);
+int eval_number(char_u **arg, typval_T *rettv, int evaluate, int want_string);
+int eval_string(char_u **arg, typval_T *rettv, int evaluate);
+int eval_lit_string(char_u **arg, typval_T *rettv, int evaluate);
+char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID);
+int eval_env_var(char_u **arg, typval_T *rettv, int evaluate);
linenr_T tv_get_lnum(typval_T *argvars);
linenr_T tv_get_lnum_buf(typval_T *argvars, buf_T *buf);
buf_T *tv_get_buf(typval_T *tv, int curtab_only);
-char_u *tv_stringify(typval_T *varp, char_u *buf);
/* vim: set ft=c : */
diff --git a/src/typval.c b/src/typval.c
index ebc51c6af3..9d0c6acd40 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -992,7 +992,7 @@ tv_equal(
* Return OK or FAIL.
*/
int
-get_option_tv(
+eval_option(
char_u **arg,
typval_T *rettv, // when NULL, only check if option exists
int evaluate)
@@ -1069,7 +1069,7 @@ get_option_tv(
* Return OK or FAIL.
*/
int
-get_number_tv(
+eval_number(
char_u **arg,
typval_T *rettv,
int evaluate,
@@ -1179,7 +1179,7 @@ get_number_tv(
* Return OK or FAIL.
*/
int
-get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
+eval_string(char_u **arg, typval_T *rettv, int evaluate)
{
char_u *p;
char_u *end;
@@ -1297,7 +1297,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
{
end += extra;
if (end >= rettv->vval.v_string + len)
- iemsg("get_string_tv() used more space than allocated");
+ iemsg("eval_string() used more space than allocated");
break;
}
}
@@ -1323,7 +1323,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
* Return OK or FAIL.
*/
int
-get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
+eval_lit_string(char_u **arg, typval_T *rettv, int evaluate)
{
char_u *p;
char_u *str;
@@ -1401,7 +1401,7 @@ tv2string(
* Return FAIL if the name is invalid.
*/
int
-get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
+eval_env_var(char_u **arg, typval_T *rettv, int evaluate)
{
char_u *string = NULL;
int len;
diff --git a/src/version.c b/src/version.c
index e7dc813ce2..7817a4442e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1111,
+/**/
1110,
/**/
1109,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index b3ed77d75d..bb3122f40d 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2868,9 +2868,9 @@ compile_call(
argvars[0].v_type = VAR_UNKNOWN;
if (*s == '"')
- (void)get_string_tv(&s, &argvars[0], TRUE);
+ (void)eval_string(&s, &argvars[0], TRUE);
else if (*s == '\'')
- (void)get_lit_string_tv(&s, &argvars[0], TRUE);
+ (void)eval_lit_string(&s, &argvars[0], TRUE);
s = skipwhite(s);
if (*s == ')' && argvars[0].v_type == VAR_STRING)
{
@@ -2992,7 +2992,7 @@ to_name_const_end(char_u *arg)
{
// Can be "[1, 2, 3]->Func()".
- if (get_list_tv(&p, &rettv, NULL, FALSE) == FAIL)
+ if (eval_list(&p, &rettv, NULL, FALSE) == FAIL)
p = arg;
}
else if (p == arg && *arg == '#' && arg[1] == '{')
@@ -3270,10 +3270,10 @@ compile_get_option(char_u **arg, cctx_T *cctx)
// parse the option and get the current value to get the type.
rettv.v_type = VAR_UNKNOWN;
- ret = get_option_tv(arg, &rettv, TRUE);
+ ret = eval_option(arg, &rettv, TRUE);
if (ret == OK)
{
- // include the '&' in the name, get_option_tv() expects it.
+ // include the '&' in the name, eval_option() expects it.
char_u *name = vim_strnsave(start, *arg - start);
type_T *type = rettv.v_type == VAR_NUMBER ? &t_number : &t_string;
@@ -3304,7 +3304,7 @@ compile_get_env(char_u **arg, cctx_T *cctx)
return FAIL;
}
- // include the '$' in the name, get_env_tv() expects it.
+ // include the '$' in the name, eval_env_var() expects it.
name = vim_strnsave(start, len + 1);
ret = generate_LOAD(cctx, ISN_LOADENV, 0, name, &t_string);
vim_free(name);
@@ -3761,21 +3761,21 @@ compile_expr7(
case '7':
case '8':
case '9':
- case '.': if (get_number_tv(arg, rettv, TRUE, FALSE) == FAIL)
+ case '.': if (eval_number(arg, rettv, TRUE, FALSE) == FAIL)
return FAIL;
break;
/*
* String constant: "string".
*/
- case '"': if (get_string_tv(arg, rettv, TRUE) == FAIL)
+ case '"': if (eval_string(arg, rettv, TRUE) == FAIL)
return FAIL;
break;
/*
* Literal string constant: 'str''ing'.
*/
- case '\'': if (get_lit_string_tv(arg, rettv, TRUE) == FAIL)
+ case '\'': if (eval_lit_string(arg, rettv, TRUE) == FAIL)
return FAIL;
break;
diff --git a/src/vim9execute.c b/src/vim9execute.c
index fda44ec08e..b4acb35c10 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1089,7 +1089,7 @@ call_def_function(
// compilation: don't set SOURCING_LNUM.
if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
goto failed;
- if (get_option_tv(&name, &optval, TRUE) == FAIL)
+ if (eval_option(&name, &optval, TRUE) == FAIL)
goto failed;
*STACK_TV_BOT(0) = optval;
++ectx.ec_stack.ga_len;
@@ -1105,7 +1105,7 @@ call_def_function(
if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
goto failed;
// name is always valid, checked when compiling
- (void)get_env_tv(&name, &optval, TRUE);
+ (void)eval_env_var(&name, &optval, TRUE);
*STACK_TV_BOT(0) = optval;
++ectx.ec_stack.ga_len;
}
diff --git a/src/vim9script.c b/src/vim9script.c
index 30c269af83..aa6b92cddc 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -302,9 +302,9 @@ handle_import(char_u *arg_start, garray_T *gap, int import_sid, void *cctx)
tv.v_type = VAR_UNKNOWN;
// TODO: should we accept any expression?
if (*arg == '\'')
- ret = get_lit_string_tv(&arg, &tv, TRUE);
+ ret = eval_lit_string(&arg, &tv, TRUE);
else if (*arg == '"')
- ret = get_string_tv(&arg, &tv, TRUE);
+ ret = eval_string(&arg, &tv, TRUE);
if (ret == FAIL || tv.vval.v_string == NULL || *tv.vval.v_string == NUL)
{
emsg(_("E1071: Invalid string after \"from\""));