mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes #3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts.
This commit is contained in:
238
src/eval.c
238
src/eval.c
@@ -301,7 +301,7 @@ eval_init(void)
|
||||
p = &vimvars[i];
|
||||
if (STRLEN(p->vv_name) > 16)
|
||||
{
|
||||
IEMSG("INTERNAL: name too long, increase size of dictitem16_T");
|
||||
iemsg("INTERNAL: name too long, increase size of dictitem16_T");
|
||||
getout(1);
|
||||
}
|
||||
STRCPY(p->vv_di.di_key, p->vv_name);
|
||||
@@ -448,7 +448,7 @@ var_redir_start(char_u *name, int append)
|
||||
/* Catch a bad name early. */
|
||||
if (!eval_isnamec1(*name))
|
||||
{
|
||||
EMSG(_(e_invarg));
|
||||
emsg(_(e_invarg));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -475,9 +475,9 @@ var_redir_start(char_u *name, int append)
|
||||
clear_lval(redir_lval);
|
||||
if (redir_endp != NULL && *redir_endp != NUL)
|
||||
/* Trailing characters are present after the variable name */
|
||||
EMSG(_(e_trailing));
|
||||
emsg(_(e_trailing));
|
||||
else
|
||||
EMSG(_(e_invarg));
|
||||
emsg(_(e_invarg));
|
||||
redir_endp = NULL; /* don't store a value, only cleanup */
|
||||
var_redir_stop();
|
||||
return FAIL;
|
||||
@@ -734,7 +734,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
|
||||
if (*s != NUL) /* check for trailing chars after expr */
|
||||
{
|
||||
clear_tv(rettv);
|
||||
EMSG2(_(e_invexpr2), s);
|
||||
semsg(_(e_invexpr2), s);
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@@ -1202,7 +1202,7 @@ ex_let(exarg_T *eap)
|
||||
* ":let" without "=": list variables
|
||||
*/
|
||||
if (*arg == '[')
|
||||
EMSG(_(e_invarg));
|
||||
emsg(_(e_invarg));
|
||||
else if (!ends_excmd(*arg))
|
||||
/* ":let var1 var2" */
|
||||
arg = list_arg_vars(eap, arg, &first);
|
||||
@@ -1288,19 +1288,19 @@ ex_let_vars(
|
||||
*/
|
||||
if (tv->v_type != VAR_LIST || (l = tv->vval.v_list) == NULL)
|
||||
{
|
||||
EMSG(_(e_listreq));
|
||||
emsg(_(e_listreq));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
i = list_len(l);
|
||||
if (semicolon == 0 && var_count < i)
|
||||
{
|
||||
EMSG(_("E687: Less targets than List items"));
|
||||
emsg(_("E687: Less targets than List items"));
|
||||
return FAIL;
|
||||
}
|
||||
if (var_count - semicolon > i)
|
||||
{
|
||||
EMSG(_("E688: More targets than List items"));
|
||||
emsg(_("E688: More targets than List items"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -1374,7 +1374,7 @@ skip_var_list(
|
||||
s = skip_var_one(p);
|
||||
if (s == p)
|
||||
{
|
||||
EMSG2(_(e_invarg2), p);
|
||||
semsg(_(e_invarg2), p);
|
||||
return NULL;
|
||||
}
|
||||
++*var_count;
|
||||
@@ -1386,14 +1386,14 @@ skip_var_list(
|
||||
{
|
||||
if (*semicolon == 1)
|
||||
{
|
||||
EMSG(_("Double ; in list of variables"));
|
||||
emsg(_("Double ; in list of variables"));
|
||||
return NULL;
|
||||
}
|
||||
*semicolon = 1;
|
||||
}
|
||||
else if (*p != ',')
|
||||
{
|
||||
EMSG2(_(e_invarg2), p);
|
||||
semsg(_(e_invarg2), p);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1534,7 +1534,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
|
||||
if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg))
|
||||
{
|
||||
emsg_severe = TRUE;
|
||||
EMSG(_(e_trailing));
|
||||
emsg(_(e_trailing));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1550,7 +1550,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
|
||||
if (len < 0 && !aborting())
|
||||
{
|
||||
emsg_severe = TRUE;
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
semsg(_(e_invarg2), arg);
|
||||
break;
|
||||
}
|
||||
error = TRUE;
|
||||
@@ -1581,7 +1581,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
|
||||
case 's': list_script_vars(first); break;
|
||||
case 'l': list_func_vars(first); break;
|
||||
default:
|
||||
EMSG2(_("E738: Can't list variables for %s"), name);
|
||||
semsg(_("E738: Can't list variables for %s"), name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1647,14 +1647,14 @@ ex_let_one(
|
||||
name = arg;
|
||||
len = get_env_len(&arg);
|
||||
if (len == 0)
|
||||
EMSG2(_(e_invarg2), name - 1);
|
||||
semsg(_(e_invarg2), name - 1);
|
||||
else
|
||||
{
|
||||
if (op != NULL && (*op == '+' || *op == '-'))
|
||||
EMSG2(_(e_letwrong), op);
|
||||
semsg(_(e_letwrong), op);
|
||||
else if (endchars != NULL
|
||||
&& vim_strchr(endchars, *skipwhite(arg)) == NULL)
|
||||
EMSG(_(e_letunexp));
|
||||
emsg(_(e_letunexp));
|
||||
else if (!check_secure())
|
||||
{
|
||||
c1 = name[len];
|
||||
@@ -1701,7 +1701,7 @@ ex_let_one(
|
||||
p = find_option_end(&arg, &opt_flags);
|
||||
if (p == NULL || (endchars != NULL
|
||||
&& vim_strchr(endchars, *skipwhite(p)) == NULL))
|
||||
EMSG(_(e_letunexp));
|
||||
emsg(_(e_letunexp));
|
||||
else
|
||||
{
|
||||
long n;
|
||||
@@ -1722,7 +1722,7 @@ ex_let_one(
|
||||
if ((opt_type == 1 && *op == '.')
|
||||
|| (opt_type == 0 && *op != '.'))
|
||||
{
|
||||
EMSG2(_(e_letwrong), op);
|
||||
semsg(_(e_letwrong), op);
|
||||
s = NULL; /* don't set the value */
|
||||
}
|
||||
else
|
||||
@@ -1759,10 +1759,10 @@ ex_let_one(
|
||||
{
|
||||
++arg;
|
||||
if (op != NULL && (*op == '+' || *op == '-'))
|
||||
EMSG2(_(e_letwrong), op);
|
||||
semsg(_(e_letwrong), op);
|
||||
else if (endchars != NULL
|
||||
&& vim_strchr(endchars, *skipwhite(arg + 1)) == NULL)
|
||||
EMSG(_(e_letunexp));
|
||||
emsg(_(e_letunexp));
|
||||
else
|
||||
{
|
||||
char_u *ptofree = NULL;
|
||||
@@ -1799,7 +1799,7 @@ ex_let_one(
|
||||
if (p != NULL && lv.ll_name != NULL)
|
||||
{
|
||||
if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL)
|
||||
EMSG(_(e_letunexp));
|
||||
emsg(_(e_letunexp));
|
||||
else
|
||||
{
|
||||
set_var_lval(&lv, p, tv, copy, op);
|
||||
@@ -1810,7 +1810,7 @@ ex_let_one(
|
||||
}
|
||||
|
||||
else
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
semsg(_(e_invarg2), arg);
|
||||
|
||||
return arg_end;
|
||||
}
|
||||
@@ -1875,7 +1875,7 @@ get_lval(
|
||||
if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p)
|
||||
&& *p != '[' && *p != '.')
|
||||
{
|
||||
EMSG(_(e_trailing));
|
||||
emsg(_(e_trailing));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1888,7 +1888,7 @@ get_lval(
|
||||
if (!aborting() && !quiet)
|
||||
{
|
||||
emsg_severe = TRUE;
|
||||
EMSG2(_(e_invarg2), name);
|
||||
semsg(_(e_invarg2), name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1908,7 +1908,7 @@ get_lval(
|
||||
v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
|
||||
flags & GLV_NO_AUTOLOAD);
|
||||
if (v == NULL && !quiet)
|
||||
EMSG2(_(e_undefvar), lp->ll_name);
|
||||
semsg(_(e_undefvar), lp->ll_name);
|
||||
*p = cc;
|
||||
if (v == NULL)
|
||||
return NULL;
|
||||
@@ -1928,13 +1928,13 @@ get_lval(
|
||||
&& lp->ll_tv->vval.v_blob != NULL))
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_("E689: Can only index a List, Dictionary or Blob"));
|
||||
emsg(_("E689: Can only index a List, Dictionary or Blob"));
|
||||
return NULL;
|
||||
}
|
||||
if (lp->ll_range)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_("E708: [:] must come last"));
|
||||
emsg(_("E708: [:] must come last"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1947,7 +1947,7 @@ get_lval(
|
||||
if (len == 0)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_(e_emptykey));
|
||||
emsg(_(e_emptykey));
|
||||
return NULL;
|
||||
}
|
||||
p = key + len;
|
||||
@@ -1977,7 +1977,7 @@ get_lval(
|
||||
if (lp->ll_tv->v_type == VAR_DICT)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_(e_dictrange));
|
||||
emsg(_(e_dictrange));
|
||||
clear_tv(&var1);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1988,7 +1988,7 @@ get_lval(
|
||||
&& rettv->vval.v_blob != NULL))
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_("E709: [:] requires a List or Blob value"));
|
||||
emsg(_("E709: [:] requires a List or Blob value"));
|
||||
clear_tv(&var1);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2019,7 +2019,7 @@ get_lval(
|
||||
if (*p != ']')
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_(e_missbrac));
|
||||
emsg(_(e_missbrac));
|
||||
clear_tv(&var1);
|
||||
clear_tv(&var2);
|
||||
return NULL;
|
||||
@@ -2075,7 +2075,7 @@ get_lval(
|
||||
/* Can't add "v:" variable. */
|
||||
if (lp->ll_dict == &vimvardict)
|
||||
{
|
||||
EMSG2(_(e_illvar), name);
|
||||
semsg(_(e_illvar), name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2083,7 +2083,7 @@ get_lval(
|
||||
if (*p == '[' || *p == '.' || unlet)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG2(_(e_dictkey), key);
|
||||
semsg(_(e_dictkey), key);
|
||||
clear_tv(&var1);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2126,7 +2126,7 @@ get_lval(
|
||||
|| (lp->ll_range && lp->ll_n1 == bloblen))
|
||||
{
|
||||
if (!quiet)
|
||||
EMSGN(_(e_blobidx), lp->ll_n1);
|
||||
semsg(_(e_blobidx), lp->ll_n1);
|
||||
clear_tv(&var2);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2139,7 +2139,7 @@ get_lval(
|
||||
|| lp->ll_n2 < lp->ll_n1)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSGN(_(e_blobidx), lp->ll_n2);
|
||||
semsg(_(e_blobidx), lp->ll_n2);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -2173,7 +2173,7 @@ get_lval(
|
||||
{
|
||||
clear_tv(&var2);
|
||||
if (!quiet)
|
||||
EMSGN(_(e_listidx), lp->ll_n1);
|
||||
semsg(_(e_listidx), lp->ll_n1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2194,7 +2194,7 @@ get_lval(
|
||||
if (ni == NULL)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSGN(_(e_listidx), lp->ll_n2);
|
||||
semsg(_(e_listidx), lp->ll_n2);
|
||||
return NULL;
|
||||
}
|
||||
lp->ll_n2 = list_idx_of_item(lp->ll_list, ni);
|
||||
@@ -2206,7 +2206,7 @@ get_lval(
|
||||
if (lp->ll_n2 < lp->ll_n1)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSGN(_(e_listidx), lp->ll_n2);
|
||||
semsg(_(e_listidx), lp->ll_n2);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -2256,7 +2256,7 @@ set_var_lval(
|
||||
|
||||
if (op != NULL && *op != '=')
|
||||
{
|
||||
EMSG2(_(e_letwrong), op);
|
||||
semsg(_(e_letwrong), op);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2269,7 +2269,7 @@ set_var_lval(
|
||||
|
||||
if (lp->ll_n2 - lp->ll_n1 + 1 != blob_len(rettv->vval.v_blob))
|
||||
{
|
||||
EMSG(_("E972: Blob value does not have the right number of bytes"));
|
||||
emsg(_("E972: Blob value does not have the right number of bytes"));
|
||||
return;
|
||||
}
|
||||
if (lp->ll_empty2)
|
||||
@@ -2374,11 +2374,11 @@ set_var_lval(
|
||||
++lp->ll_n1;
|
||||
}
|
||||
if (ri != NULL)
|
||||
EMSG(_("E710: List value has more items than target"));
|
||||
emsg(_("E710: List value has more items than target"));
|
||||
else if (lp->ll_empty2
|
||||
? (lp->ll_li != NULL && lp->ll_li->li_next != NULL)
|
||||
: lp->ll_n1 != lp->ll_n2)
|
||||
EMSG(_("E711: List value has not enough items"));
|
||||
emsg(_("E711: List value has not enough items"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2389,7 +2389,7 @@ set_var_lval(
|
||||
{
|
||||
if (op != NULL && *op != '=')
|
||||
{
|
||||
EMSG2(_(e_letwrong), op);
|
||||
semsg(_(e_letwrong), op);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2544,7 +2544,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
|
||||
}
|
||||
}
|
||||
|
||||
EMSG2(_(e_letwrong), op);
|
||||
semsg(_(e_letwrong), op);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -2580,7 +2580,7 @@ eval_for_line(
|
||||
expr = skipwhite(expr);
|
||||
if (expr[0] != 'i' || expr[1] != 'n' || !VIM_ISWHITE(expr[2]))
|
||||
{
|
||||
EMSG(_("E690: Missing \"in\" after :for"));
|
||||
emsg(_("E690: Missing \"in\" after :for"));
|
||||
return fi;
|
||||
}
|
||||
|
||||
@@ -2623,7 +2623,7 @@ eval_for_line(
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG(_(e_listreq));
|
||||
emsg(_(e_listreq));
|
||||
clear_tv(&tv);
|
||||
}
|
||||
}
|
||||
@@ -2860,7 +2860,7 @@ ex_unletlock(
|
||||
|
||||
if (get_env_len(&arg) == 0)
|
||||
{
|
||||
EMSG2(_(e_invarg2), name - 1);
|
||||
semsg(_(e_invarg2), name - 1);
|
||||
return;
|
||||
}
|
||||
vim_unsetenv(name);
|
||||
@@ -2879,7 +2879,7 @@ ex_unletlock(
|
||||
if (name_end != NULL)
|
||||
{
|
||||
emsg_severe = TRUE;
|
||||
EMSG(_(e_trailing));
|
||||
emsg(_(e_trailing));
|
||||
}
|
||||
if (!(eap->skip || error))
|
||||
clear_lval(&lv);
|
||||
@@ -3022,7 +3022,7 @@ do_unlet(char_u *name, int forceit)
|
||||
}
|
||||
if (forceit)
|
||||
return OK;
|
||||
EMSG2(_("E108: No such variable: \"%s\""), name);
|
||||
semsg(_("E108: No such variable: \"%s\""), name);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -3059,7 +3059,7 @@ do_lock_var(
|
||||
&& di->di_tv.v_type != VAR_LIST)
|
||||
/* For historic reasons this error is not given for a list or dict.
|
||||
* E.g., the b: dict could be locked/unlocked. */
|
||||
EMSG2(_("E940: Cannot lock or unlock variable %s"), lp->ll_name);
|
||||
semsg(_("E940: Cannot lock or unlock variable %s"), lp->ll_name);
|
||||
else
|
||||
{
|
||||
if (lock)
|
||||
@@ -3108,7 +3108,7 @@ item_lock(typval_T *tv, int deep, int lock)
|
||||
|
||||
if (recurse >= DICT_MAXNEST)
|
||||
{
|
||||
EMSG(_("E743: variable nested too deep for (un)lock"));
|
||||
emsg(_("E743: variable nested too deep for (un)lock"));
|
||||
return;
|
||||
}
|
||||
if (deep == 0)
|
||||
@@ -3393,7 +3393,7 @@ eval0(
|
||||
*/
|
||||
if (!aborting() && did_emsg == did_emsg_before
|
||||
&& called_emsg == called_emsg_before)
|
||||
EMSG2(_(e_invexpr2), arg);
|
||||
semsg(_(e_invexpr2), arg);
|
||||
ret = FAIL;
|
||||
}
|
||||
if (nextcmd != NULL)
|
||||
@@ -3451,7 +3451,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate)
|
||||
*/
|
||||
if ((*arg)[0] != ':')
|
||||
{
|
||||
EMSG(_("E109: Missing ':' after '?'"));
|
||||
emsg(_("E109: Missing ':' after '?'"));
|
||||
if (evaluate && result)
|
||||
clear_tv(rettv);
|
||||
return FAIL;
|
||||
@@ -4058,7 +4058,7 @@ eval6(
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG(_("E804: Cannot use '%' with Float"));
|
||||
emsg(_("E804: Cannot use '%' with Float"));
|
||||
return FAIL;
|
||||
}
|
||||
rettv->v_type = VAR_FLOAT;
|
||||
@@ -4223,7 +4223,7 @@ eval7(
|
||||
{
|
||||
if (blob != NULL)
|
||||
{
|
||||
EMSG(_("E973: Blob literal should have an even number of hex characters"));
|
||||
emsg(_("E973: Blob literal should have an even number of hex characters"));
|
||||
ga_clear(&blob->bv_ga);
|
||||
VIM_CLEAR(blob);
|
||||
}
|
||||
@@ -4314,7 +4314,7 @@ eval7(
|
||||
++*arg;
|
||||
else if (ret == OK)
|
||||
{
|
||||
EMSG(_("E110: Missing ')'"));
|
||||
emsg(_("E110: Missing ')'"));
|
||||
clear_tv(rettv);
|
||||
ret = FAIL;
|
||||
}
|
||||
@@ -4488,19 +4488,19 @@ eval_index(
|
||||
case VAR_FUNC:
|
||||
case VAR_PARTIAL:
|
||||
if (verbose)
|
||||
EMSG(_("E695: Cannot index a Funcref"));
|
||||
emsg(_("E695: Cannot index a Funcref"));
|
||||
return FAIL;
|
||||
case VAR_FLOAT:
|
||||
#ifdef FEAT_FLOAT
|
||||
if (verbose)
|
||||
EMSG(_(e_float_as_string));
|
||||
emsg(_(e_float_as_string));
|
||||
return FAIL;
|
||||
#endif
|
||||
case VAR_SPECIAL:
|
||||
case VAR_JOB:
|
||||
case VAR_CHANNEL:
|
||||
if (verbose)
|
||||
EMSG(_("E909: Cannot index a special variable"));
|
||||
emsg(_("E909: Cannot index a special variable"));
|
||||
return FAIL;
|
||||
case VAR_UNKNOWN:
|
||||
if (evaluate)
|
||||
@@ -4577,7 +4577,7 @@ eval_index(
|
||||
if (**arg != ']')
|
||||
{
|
||||
if (verbose)
|
||||
EMSG(_(e_missbrac));
|
||||
emsg(_(e_missbrac));
|
||||
clear_tv(&var1);
|
||||
if (range)
|
||||
clear_tv(&var2);
|
||||
@@ -4711,7 +4711,7 @@ eval_index(
|
||||
rettv->vval.v_number = v;
|
||||
}
|
||||
else
|
||||
EMSGN(_(e_blobidx), n1);
|
||||
semsg(_(e_blobidx), n1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -4726,7 +4726,7 @@ eval_index(
|
||||
if (!range)
|
||||
{
|
||||
if (verbose)
|
||||
EMSGN(_(e_listidx), n1);
|
||||
semsg(_(e_listidx), n1);
|
||||
return FAIL;
|
||||
}
|
||||
n1 = len;
|
||||
@@ -4770,7 +4770,7 @@ eval_index(
|
||||
if (range)
|
||||
{
|
||||
if (verbose)
|
||||
EMSG(_(e_dictrange));
|
||||
emsg(_(e_dictrange));
|
||||
if (len == -1)
|
||||
clear_tv(&var1);
|
||||
return FAIL;
|
||||
@@ -4791,7 +4791,7 @@ eval_index(
|
||||
item = dict_find(rettv->vval.v_dict, key, (int)len);
|
||||
|
||||
if (item == NULL && verbose)
|
||||
EMSG2(_(e_dictkey), key);
|
||||
semsg(_(e_dictkey), key);
|
||||
if (len == -1)
|
||||
clear_tv(&var1);
|
||||
if (item == NULL)
|
||||
@@ -4836,7 +4836,7 @@ get_option_tv(
|
||||
if (option_end == NULL)
|
||||
{
|
||||
if (rettv != NULL)
|
||||
EMSG2(_("E112: Option name missing: %s"), *arg);
|
||||
semsg(_("E112: Option name missing: %s"), *arg);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -4854,7 +4854,7 @@ get_option_tv(
|
||||
if (opt_type == -3) /* invalid name */
|
||||
{
|
||||
if (rettv != NULL)
|
||||
EMSG2(_("E113: Unknown option: %s"), *arg);
|
||||
semsg(_("E113: Unknown option: %s"), *arg);
|
||||
ret = FAIL;
|
||||
}
|
||||
else if (rettv != NULL)
|
||||
@@ -4917,7 +4917,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
|
||||
if (*p != '"')
|
||||
{
|
||||
EMSG2(_("E114: Missing quote: %s"), *arg);
|
||||
semsg(_("E114: Missing quote: %s"), *arg);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -5054,7 +5054,7 @@ get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
|
||||
if (*p != '\'')
|
||||
{
|
||||
EMSG2(_("E115: Missing quote: %s"), *arg);
|
||||
semsg(_("E115: Missing quote: %s"), *arg);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -5798,7 +5798,7 @@ echo_string_core(
|
||||
* flooding the user with errors. And stop iterating over lists
|
||||
* and dicts. */
|
||||
did_echo_string_emsg = TRUE;
|
||||
EMSG(_("E724: variable nested too deep for displaying"));
|
||||
emsg(_("E724: variable nested too deep for displaying"));
|
||||
}
|
||||
*tofree = NULL;
|
||||
return (char_u *)"{E724}";
|
||||
@@ -6439,7 +6439,7 @@ get_name_len(
|
||||
// Only give an error when there is something, otherwise it will be
|
||||
// reported at a higher level.
|
||||
if (len == 0 && verbose && **arg != NUL)
|
||||
EMSG2(_(e_invexpr2), *arg);
|
||||
semsg(_(e_invexpr2), *arg);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -6937,7 +6937,7 @@ get_var_tv(
|
||||
if (tv == NULL)
|
||||
{
|
||||
if (rettv != NULL && verbose)
|
||||
EMSG2(_(e_undefvar), name);
|
||||
semsg(_(e_undefvar), name);
|
||||
ret = FAIL;
|
||||
}
|
||||
else if (rettv != NULL)
|
||||
@@ -7251,12 +7251,12 @@ tv_get_number_chk(typval_T *varp, int *denote)
|
||||
return varp->vval.v_number;
|
||||
case VAR_FLOAT:
|
||||
#ifdef FEAT_FLOAT
|
||||
EMSG(_("E805: Using a Float as a Number"));
|
||||
emsg(_("E805: Using a Float as a Number"));
|
||||
break;
|
||||
#endif
|
||||
case VAR_FUNC:
|
||||
case VAR_PARTIAL:
|
||||
EMSG(_("E703: Using a Funcref as a Number"));
|
||||
emsg(_("E703: Using a Funcref as a Number"));
|
||||
break;
|
||||
case VAR_STRING:
|
||||
if (varp->vval.v_string != NULL)
|
||||
@@ -7264,26 +7264,26 @@ tv_get_number_chk(typval_T *varp, int *denote)
|
||||
STR2NR_ALL, &n, NULL, 0);
|
||||
return n;
|
||||
case VAR_LIST:
|
||||
EMSG(_("E745: Using a List as a Number"));
|
||||
emsg(_("E745: Using a List as a Number"));
|
||||
break;
|
||||
case VAR_DICT:
|
||||
EMSG(_("E728: Using a Dictionary as a Number"));
|
||||
emsg(_("E728: Using a Dictionary as a Number"));
|
||||
break;
|
||||
case VAR_SPECIAL:
|
||||
return varp->vval.v_number == VVAL_TRUE ? 1 : 0;
|
||||
break;
|
||||
case VAR_JOB:
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
EMSG(_("E910: Using a Job as a Number"));
|
||||
emsg(_("E910: Using a Job as a Number"));
|
||||
break;
|
||||
#endif
|
||||
case VAR_CHANNEL:
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
EMSG(_("E913: Using a Channel as a Number"));
|
||||
emsg(_("E913: Using a Channel as a Number"));
|
||||
break;
|
||||
#endif
|
||||
case VAR_BLOB:
|
||||
EMSG(_("E974: Using a Blob as a Number"));
|
||||
emsg(_("E974: Using a Blob as a Number"));
|
||||
break;
|
||||
case VAR_UNKNOWN:
|
||||
internal_error("tv_get_number(UNKNOWN)");
|
||||
@@ -7308,32 +7308,32 @@ tv_get_float(typval_T *varp)
|
||||
return varp->vval.v_float;
|
||||
case VAR_FUNC:
|
||||
case VAR_PARTIAL:
|
||||
EMSG(_("E891: Using a Funcref as a Float"));
|
||||
emsg(_("E891: Using a Funcref as a Float"));
|
||||
break;
|
||||
case VAR_STRING:
|
||||
EMSG(_("E892: Using a String as a Float"));
|
||||
emsg(_("E892: Using a String as a Float"));
|
||||
break;
|
||||
case VAR_LIST:
|
||||
EMSG(_("E893: Using a List as a Float"));
|
||||
emsg(_("E893: Using a List as a Float"));
|
||||
break;
|
||||
case VAR_DICT:
|
||||
EMSG(_("E894: Using a Dictionary as a Float"));
|
||||
emsg(_("E894: Using a Dictionary as a Float"));
|
||||
break;
|
||||
case VAR_SPECIAL:
|
||||
EMSG(_("E907: Using a special value as a Float"));
|
||||
emsg(_("E907: Using a special value as a Float"));
|
||||
break;
|
||||
case VAR_JOB:
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
EMSG(_("E911: Using a Job as a Float"));
|
||||
emsg(_("E911: Using a Job as a Float"));
|
||||
break;
|
||||
# endif
|
||||
case VAR_CHANNEL:
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
EMSG(_("E914: Using a Channel as a Float"));
|
||||
emsg(_("E914: Using a Channel as a Float"));
|
||||
break;
|
||||
# endif
|
||||
case VAR_BLOB:
|
||||
EMSG(_("E975: Using a Blob as a Float"));
|
||||
emsg(_("E975: Using a Blob as a Float"));
|
||||
break;
|
||||
case VAR_UNKNOWN:
|
||||
internal_error("tv_get_float(UNKNOWN)");
|
||||
@@ -7391,17 +7391,17 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf)
|
||||
return buf;
|
||||
case VAR_FUNC:
|
||||
case VAR_PARTIAL:
|
||||
EMSG(_("E729: using Funcref as a String"));
|
||||
emsg(_("E729: using Funcref as a String"));
|
||||
break;
|
||||
case VAR_LIST:
|
||||
EMSG(_("E730: using List as a String"));
|
||||
emsg(_("E730: using List as a String"));
|
||||
break;
|
||||
case VAR_DICT:
|
||||
EMSG(_("E731: using Dictionary as a String"));
|
||||
emsg(_("E731: using Dictionary as a String"));
|
||||
break;
|
||||
case VAR_FLOAT:
|
||||
#ifdef FEAT_FLOAT
|
||||
EMSG(_(e_float_as_string));
|
||||
emsg(_(e_float_as_string));
|
||||
break;
|
||||
#endif
|
||||
case VAR_STRING:
|
||||
@@ -7412,7 +7412,7 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf)
|
||||
STRCPY(buf, get_var_special_name(varp->vval.v_number));
|
||||
return buf;
|
||||
case VAR_BLOB:
|
||||
EMSG(_("E976: using Blob as a String"));
|
||||
emsg(_("E976: using Blob as a String"));
|
||||
break;
|
||||
case VAR_JOB:
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
@@ -7457,7 +7457,7 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf)
|
||||
#endif
|
||||
break;
|
||||
case VAR_UNKNOWN:
|
||||
EMSG(_("E908: using an invalid value as a String"));
|
||||
emsg(_("E908: using an invalid value as a String"));
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
@@ -7839,7 +7839,7 @@ set_var(
|
||||
ht = find_var_ht(name, &varname);
|
||||
if (ht == NULL || *varname == NUL)
|
||||
{
|
||||
EMSG2(_(e_illvar), name);
|
||||
semsg(_(e_illvar), name);
|
||||
return;
|
||||
}
|
||||
v = find_var_in_ht(ht, 0, varname, TRUE);
|
||||
@@ -7894,7 +7894,7 @@ set_var(
|
||||
}
|
||||
else if (v->di_tv.v_type != tv->v_type)
|
||||
{
|
||||
EMSG2(_("E963: setting %s to value with wrong type"), name);
|
||||
semsg(_("E963: setting %s to value with wrong type"), name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -7906,7 +7906,7 @@ set_var(
|
||||
/* Can't add "v:" variable. */
|
||||
if (ht == &vimvarht)
|
||||
{
|
||||
EMSG2(_(e_illvar), name);
|
||||
semsg(_(e_illvar), name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7946,12 +7946,12 @@ var_check_ro(int flags, char_u *name, int use_gettext)
|
||||
{
|
||||
if (flags & DI_FLAGS_RO)
|
||||
{
|
||||
EMSG2(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name);
|
||||
semsg(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name);
|
||||
return TRUE;
|
||||
}
|
||||
if ((flags & DI_FLAGS_RO_SBX) && sandbox)
|
||||
{
|
||||
EMSG2(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name);
|
||||
semsg(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -7966,7 +7966,7 @@ var_check_fixed(int flags, char_u *name, int use_gettext)
|
||||
{
|
||||
if (flags & DI_FLAGS_FIX)
|
||||
{
|
||||
EMSG2(_("E795: Cannot delete variable %s"),
|
||||
semsg(_("E795: Cannot delete variable %s"),
|
||||
use_gettext ? (char_u *)_(name) : name);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -7987,7 +7987,7 @@ var_check_func_name(
|
||||
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
|
||||
? name[2] : name[0]))
|
||||
{
|
||||
EMSG2(_("E704: Funcref variable name must start with a capital: %s"),
|
||||
semsg(_("E704: Funcref variable name must start with a capital: %s"),
|
||||
name);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -7996,7 +7996,7 @@ var_check_func_name(
|
||||
* below. */
|
||||
if (new_var && function_exists(name, FALSE))
|
||||
{
|
||||
EMSG2(_("E705: Variable name conflicts with existing function: %s"),
|
||||
semsg(_("E705: Variable name conflicts with existing function: %s"),
|
||||
name);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -8016,7 +8016,7 @@ valid_varname(char_u *varname)
|
||||
if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p))
|
||||
&& *p != AUTOLOAD_CHAR)
|
||||
{
|
||||
EMSG2(_(e_illvar), varname);
|
||||
semsg(_(e_illvar), varname);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -8032,7 +8032,7 @@ tv_check_lock(int lock, char_u *name, int use_gettext)
|
||||
{
|
||||
if (lock & VAR_LOCKED)
|
||||
{
|
||||
EMSG2(_("E741: Value is locked: %s"),
|
||||
semsg(_("E741: Value is locked: %s"),
|
||||
name == NULL ? (char_u *)_("Unknown")
|
||||
: use_gettext ? (char_u *)_(name)
|
||||
: name);
|
||||
@@ -8040,7 +8040,7 @@ tv_check_lock(int lock, char_u *name, int use_gettext)
|
||||
}
|
||||
if (lock & VAR_FIXED)
|
||||
{
|
||||
EMSG2(_("E742: Cannot change value of %s"),
|
||||
semsg(_("E742: Cannot change value of %s"),
|
||||
name == NULL ? (char_u *)_("Unknown")
|
||||
: use_gettext ? (char_u *)_(name)
|
||||
: name);
|
||||
@@ -8158,7 +8158,7 @@ item_copy(
|
||||
|
||||
if (recurse >= DICT_MAXNEST)
|
||||
{
|
||||
EMSG(_("E698: variable nested too deep for making a copy"));
|
||||
emsg(_("E698: variable nested too deep for making a copy"));
|
||||
return FAIL;
|
||||
}
|
||||
++recurse;
|
||||
@@ -8358,7 +8358,7 @@ ex_echo(exarg_T *eap)
|
||||
*/
|
||||
if (!aborting() && did_emsg == did_emsg_before
|
||||
&& called_emsg == called_emsg_before)
|
||||
EMSG2(_(e_invexpr2), p);
|
||||
semsg(_(e_invexpr2), p);
|
||||
need_clr_eos = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -8472,7 +8472,7 @@ ex_execute(exarg_T *eap)
|
||||
* exception.
|
||||
*/
|
||||
if (!aborting() && did_emsg == save_did_emsg)
|
||||
EMSG2(_(e_invexpr2), p);
|
||||
semsg(_(e_invexpr2), p);
|
||||
ret = FAIL;
|
||||
break;
|
||||
}
|
||||
@@ -8521,7 +8521,7 @@ ex_execute(exarg_T *eap)
|
||||
{
|
||||
/* We don't want to abort following commands, restore did_emsg. */
|
||||
save_did_emsg = did_emsg;
|
||||
EMSG((char_u *)ga.ga_data);
|
||||
emsg(ga.ga_data);
|
||||
if (!force_abort)
|
||||
did_emsg = save_did_emsg;
|
||||
}
|
||||
@@ -9286,7 +9286,7 @@ assert_match_common(typval_T *argvars, assert_type_T atype)
|
||||
char_u *text = tv_get_string_buf_chk(&argvars[1], buf2);
|
||||
|
||||
if (pat == NULL || text == NULL)
|
||||
EMSG(_(e_invarg));
|
||||
emsg(_(e_invarg));
|
||||
else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH))
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
@@ -9602,9 +9602,9 @@ typval_compare(
|
||||
|| (type != TYPE_EQUAL && type != TYPE_NEQUAL))
|
||||
{
|
||||
if (typ1->v_type != typ2->v_type)
|
||||
EMSG(_("E977: Can only compare Blob with Blob"));
|
||||
emsg(_("E977: Can only compare Blob with Blob"));
|
||||
else
|
||||
EMSG(_(e_invalblob));
|
||||
emsg(_(e_invalblob));
|
||||
clear_tv(typ1);
|
||||
return FAIL;
|
||||
}
|
||||
@@ -9629,9 +9629,9 @@ typval_compare(
|
||||
|| (type != TYPE_EQUAL && type != TYPE_NEQUAL))
|
||||
{
|
||||
if (typ1->v_type != typ2->v_type)
|
||||
EMSG(_("E691: Can only compare List with List"));
|
||||
emsg(_("E691: Can only compare List with List"));
|
||||
else
|
||||
EMSG(_("E692: Invalid operation for List"));
|
||||
emsg(_("E692: Invalid operation for List"));
|
||||
clear_tv(typ1);
|
||||
return FAIL;
|
||||
}
|
||||
@@ -9658,9 +9658,9 @@ typval_compare(
|
||||
|| (type != TYPE_EQUAL && type != TYPE_NEQUAL))
|
||||
{
|
||||
if (typ1->v_type != typ2->v_type)
|
||||
EMSG(_("E735: Can only compare Dictionary with Dictionary"));
|
||||
emsg(_("E735: Can only compare Dictionary with Dictionary"));
|
||||
else
|
||||
EMSG(_("E736: Invalid operation for Dictionary"));
|
||||
emsg(_("E736: Invalid operation for Dictionary"));
|
||||
clear_tv(typ1);
|
||||
return FAIL;
|
||||
}
|
||||
@@ -9679,7 +9679,7 @@ typval_compare(
|
||||
{
|
||||
if (type != TYPE_EQUAL && type != TYPE_NEQUAL)
|
||||
{
|
||||
EMSG(_("E694: Invalid operation for Funcrefs"));
|
||||
emsg(_("E694: Invalid operation for Funcrefs"));
|
||||
clear_tv(typ1);
|
||||
return FAIL;
|
||||
}
|
||||
@@ -10672,7 +10672,7 @@ filter_map(typval_T *argvars, typval_T *rettv, int map)
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG2(_(e_listdictarg), ermsg);
|
||||
semsg(_(e_listdictarg), ermsg);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10740,7 +10740,7 @@ filter_map(typval_T *argvars, typval_T *rettv, int map)
|
||||
break;
|
||||
if (tv.v_type != VAR_NUMBER)
|
||||
{
|
||||
EMSG(_(e_invalblob));
|
||||
emsg(_(e_invalblob));
|
||||
return;
|
||||
}
|
||||
tv.v_type = VAR_NUMBER;
|
||||
|
Reference in New Issue
Block a user