aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-11-01 11:27:42 -0400
committerGitHub <noreply@github.com>2021-11-01 11:27:42 -0400
commitb8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e (patch)
treed8fc27ffbbb9ece2b15008b09d4b4a6b89d0d20b /src/nvim/eval
parent961cd83b3b39855b232841f37ded856c8621bd90 (diff)
parent9e479ea05e00e63ccc985fc8ce4912c709f30111 (diff)
downloadrneovim-b8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e.tar.gz
rneovim-b8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e.tar.bz2
rneovim-b8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e.zip
Merge pull request #16131 from jamessan/vim-8.1.0306
Diffstat (limited to 'src/nvim/eval')
-rw-r--r--src/nvim/eval/decode.c82
-rw-r--r--src/nvim/eval/encode.c18
-rw-r--r--src/nvim/eval/executor.c2
-rw-r--r--src/nvim/eval/funcs.c422
-rw-r--r--src/nvim/eval/typval.c66
-rw-r--r--src/nvim/eval/typval.h4
-rw-r--r--src/nvim/eval/userfunc.c74
7 files changed, 334 insertions, 334 deletions
diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c
index c8734c9b9c..5008945f09 100644
--- a/src/nvim/eval/decode.c
+++ b/src/nvim/eval/decode.c
@@ -118,7 +118,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
if (last_container.container.v_type == VAR_LIST) {
if (tv_list_len(last_container.container.vval.v_list) != 0
&& !obj.didcomma) {
- EMSG2(_("E474: Expected comma before list item: %s"), val_location);
+ semsg(_("E474: Expected comma before list item: %s"), val_location);
tv_clear(&obj.val);
return FAIL;
}
@@ -126,7 +126,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
tv_list_append_owned_tv(last_container.container.vval.v_list, obj.val);
} else if (last_container.stack_index == kv_size(*stack) - 2) {
if (!obj.didcolon) {
- EMSG2(_("E474: Expected colon before dictionary value: %s"),
+ semsg(_("E474: Expected colon before dictionary value: %s"),
val_location);
tv_clear(&obj.val);
return FAIL;
@@ -153,13 +153,13 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
} else {
// Object with key only
if (!obj.is_special_string && obj.val.v_type != VAR_STRING) {
- EMSG2(_("E474: Expected string key: %s"), *pp);
+ semsg(_("E474: Expected string key: %s"), *pp);
tv_clear(&obj.val);
return FAIL;
} else if (!obj.didcomma
&& (last_container.special_val == NULL
&& (DICT_LEN(last_container.container.vval.v_dict) != 0))) {
- EMSG2(_("E474: Expected comma before dictionary key: %s"), val_location);
+ semsg(_("E474: Expected comma before dictionary key: %s"), val_location);
tv_clear(&obj.val);
return FAIL;
}
@@ -330,21 +330,21 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
if (*p == '\\') {
p++;
if (p == e) {
- emsgf(_("E474: Unfinished escape sequence: %.*s"),
+ semsg(_("E474: Unfinished escape sequence: %.*s"),
(int)buf_len, buf);
goto parse_json_string_fail;
}
switch (*p) {
case 'u':
if (p + 4 >= e) {
- emsgf(_("E474: Unfinished unicode escape sequence: %.*s"),
+ semsg(_("E474: Unfinished unicode escape sequence: %.*s"),
(int)buf_len, buf);
goto parse_json_string_fail;
} else if (!ascii_isxdigit(p[1])
|| !ascii_isxdigit(p[2])
|| !ascii_isxdigit(p[3])
|| !ascii_isxdigit(p[4])) {
- emsgf(_("E474: Expected four hex digits after \\u: %.*s"),
+ semsg(_("E474: Expected four hex digits after \\u: %.*s"),
LENP(p - 1, e));
goto parse_json_string_fail;
}
@@ -365,14 +365,14 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
p++;
break;
default:
- emsgf(_("E474: Unknown escape sequence: %.*s"), LENP(p - 1, e));
+ semsg(_("E474: Unknown escape sequence: %.*s"), LENP(p - 1, e));
goto parse_json_string_fail;
}
} else {
uint8_t p_byte = (uint8_t)*p;
// unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
if (p_byte < 0x20) {
- emsgf(_("E474: ASCII control characters cannot be present "
+ semsg(_("E474: ASCII control characters cannot be present "
"inside string: %.*s"), LENP(p, e));
goto parse_json_string_fail;
}
@@ -385,10 +385,10 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
// The only exception is U+00C3 which is represented as 0xC3 0x83.
if (ch >= 0x80 && p_byte == ch
&& !(ch == 0xC3 && p + 1 < e && (uint8_t)p[1] == 0x83)) {
- emsgf(_("E474: Only UTF-8 strings allowed: %.*s"), LENP(p, e));
+ semsg(_("E474: Only UTF-8 strings allowed: %.*s"), LENP(p, e));
goto parse_json_string_fail;
} else if (ch > 0x10FFFF) {
- emsgf(_("E474: Only UTF-8 code points up to U+10FFFF "
+ semsg(_("E474: Only UTF-8 code points up to U+10FFFF "
"are allowed to appear unescaped: %.*s"), LENP(p, e));
goto parse_json_string_fail;
}
@@ -399,7 +399,7 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
}
}
if (p == e || *p != '"') {
- emsgf(_("E474: Expected string end: %.*s"), (int)buf_len, buf);
+ semsg(_("E474: Expected string end: %.*s"), (int)buf_len, buf);
goto parse_json_string_fail;
}
if (len == 0) {
@@ -546,7 +546,7 @@ static inline int parse_json_number(const char *const buf, const size_t buf_len,
p++;
}
if (p != ints + 1 && *ints == '0') {
- emsgf(_("E474: Leading zeroes are not allowed: %.*s"), LENP(s, e));
+ semsg(_("E474: Leading zeroes are not allowed: %.*s"), LENP(s, e));
goto parse_json_number_fail;
}
if (p >= e || p == ints) {
@@ -575,13 +575,13 @@ static inline int parse_json_number(const char *const buf, const size_t buf_len,
}
parse_json_number_check:
if (p == ints) {
- emsgf(_("E474: Missing number after minus sign: %.*s"), LENP(s, e));
+ semsg(_("E474: Missing number after minus sign: %.*s"), LENP(s, e));
goto parse_json_number_fail;
} else if (p == fracs || (fracs != NULL && exps_s == fracs + 1)) {
- emsgf(_("E474: Missing number after decimal dot: %.*s"), LENP(s, e));
+ semsg(_("E474: Missing number after decimal dot: %.*s"), LENP(s, e));
goto parse_json_number_fail;
} else if (p == exps) {
- emsgf(_("E474: Missing exponent: %.*s"), LENP(s, e));
+ semsg(_("E474: Missing exponent: %.*s"), LENP(s, e));
goto parse_json_number_fail;
}
typval_T tv = {
@@ -593,7 +593,7 @@ parse_json_number_check:
// Convert floating-point number
const size_t num_len = string2float(s, &tv.vval.v_float);
if (exp_num_len != num_len) {
- emsgf(_("E685: internal error: while converting number \"%.*s\" "
+ semsg(_("E685: internal error: while converting number \"%.*s\" "
"to float string2float consumed %zu bytes in place of %zu"),
(int)exp_num_len, s, num_len, exp_num_len);
}
@@ -604,7 +604,7 @@ parse_json_number_check:
int num_len;
vim_str2nr((char_u *)s, NULL, &num_len, 0, &nr, NULL, (int)(p - s), true);
if ((int)exp_num_len != num_len) {
- emsgf(_("E685: internal error: while converting number \"%.*s\" "
+ semsg(_("E685: internal error: while converting number \"%.*s\" "
"to integer vim_str2nr consumed %i bytes in place of %zu"),
(int)exp_num_len, s, num_len, exp_num_len);
}
@@ -656,7 +656,7 @@ int json_decode_string(const char *const buf, const size_t buf_len, typval_T *co
p++;
}
if (p == e) {
- EMSG(_("E474: Attempt to decode a blank string"));
+ emsg(_("E474: Attempt to decode a blank string"));
return FAIL;
}
int ret = OK;
@@ -673,26 +673,26 @@ json_decode_string_cycle_start:
case '}':
case ']': {
if (kv_size(container_stack) == 0) {
- emsgf(_("E474: No container to close: %.*s"), LENP(p, e));
+ semsg(_("E474: No container to close: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
ContainerStackItem last_container = kv_last(container_stack);
if (*p == '}' && last_container.container.v_type != VAR_DICT) {
- emsgf(_("E474: Closing list with curly bracket: %.*s"), LENP(p, e));
+ semsg(_("E474: Closing list with curly bracket: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (*p == ']' && last_container.container.v_type != VAR_LIST) {
- emsgf(_("E474: Closing dictionary with square bracket: %.*s"),
+ semsg(_("E474: Closing dictionary with square bracket: %.*s"),
LENP(p, e));
goto json_decode_string_fail;
} else if (didcomma) {
- emsgf(_("E474: Trailing comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Trailing comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcolon) {
- emsgf(_("E474: Expected value after colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected value after colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.stack_index != kv_size(stack) - 1) {
assert(last_container.stack_index < kv_size(stack) - 1);
- emsgf(_("E474: Expected value: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected value: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
if (kv_size(stack) == 1) {
@@ -711,19 +711,19 @@ json_decode_string_cycle_start:
}
case ',': {
if (kv_size(container_stack) == 0) {
- emsgf(_("E474: Comma not inside container: %.*s"), LENP(p, e));
+ semsg(_("E474: Comma not inside container: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
ContainerStackItem last_container = kv_last(container_stack);
if (didcomma) {
- emsgf(_("E474: Duplicate comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Duplicate comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcolon) {
- emsgf(_("E474: Comma after colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Comma after colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.container.v_type == VAR_DICT
&& last_container.stack_index != kv_size(stack) - 1) {
- emsgf(_("E474: Using comma in place of colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Using comma in place of colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.special_val == NULL
? (last_container.container.v_type == VAR_DICT
@@ -731,7 +731,7 @@ json_decode_string_cycle_start:
: (tv_list_len(last_container.container.vval.v_list)
== 0))
: (tv_list_len(last_container.special_val) == 0)) {
- emsgf(_("E474: Leading comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Leading comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
didcomma = true;
@@ -739,21 +739,21 @@ json_decode_string_cycle_start:
}
case ':': {
if (kv_size(container_stack) == 0) {
- emsgf(_("E474: Colon not inside container: %.*s"), LENP(p, e));
+ semsg(_("E474: Colon not inside container: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
ContainerStackItem last_container = kv_last(container_stack);
if (last_container.container.v_type != VAR_DICT) {
- emsgf(_("E474: Using colon not in dictionary: %.*s"), LENP(p, e));
+ semsg(_("E474: Using colon not in dictionary: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.stack_index != kv_size(stack) - 2) {
- emsgf(_("E474: Unexpected colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Unexpected colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcomma) {
- emsgf(_("E474: Colon after comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Colon after comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcolon) {
- emsgf(_("E474: Duplicate colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Duplicate colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
didcolon = true;
@@ -766,7 +766,7 @@ json_decode_string_cycle_start:
continue;
case 'n':
if ((p + 3) >= e || strncmp(p + 1, "ull", 3) != 0) {
- emsgf(_("E474: Expected null: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected null: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
p += 3;
@@ -778,7 +778,7 @@ json_decode_string_cycle_start:
break;
case 't':
if ((p + 3) >= e || strncmp(p + 1, "rue", 3) != 0) {
- emsgf(_("E474: Expected true: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected true: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
p += 3;
@@ -790,7 +790,7 @@ json_decode_string_cycle_start:
break;
case 'f':
if ((p + 4) >= e || strncmp(p + 1, "alse", 4) != 0) {
- emsgf(_("E474: Expected false: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected false: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
p += 4;
@@ -874,7 +874,7 @@ json_decode_string_cycle_start:
break;
}
default:
- emsgf(_("E474: Unidentified byte: %.*s"), LENP(p, e));
+ semsg(_("E474: Unidentified byte: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
didcomma = false;
@@ -893,7 +893,7 @@ json_decode_string_after_cycle:
case CAR:
break;
default:
- emsgf(_("E474: Trailing characters: %.*s"), LENP(p, e));
+ semsg(_("E474: Trailing characters: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
}
@@ -901,7 +901,7 @@ json_decode_string_after_cycle:
*rettv = kv_pop(stack).val;
goto json_decode_string_ret;
}
- emsgf(_("E474: Unexpected end of input: %.*s"), (int)buf_len, buf);
+ semsg(_("E474: Unexpected end of input: %.*s"), (int)buf_len, buf);
json_decode_string_fail:
ret = FAIL;
while (kv_size(stack)) {
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 627b4465db..b457353838 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -197,7 +197,7 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
}
}
}
- emsgf(msg, _(objname), (kv_size(*mpstack) == 0
+ semsg(msg, _(objname), (kv_size(*mpstack) == 0
? _("itself")
: (char *)msg_ga.ga_data));
ga_clear(&msg_ga);
@@ -448,7 +448,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
/* Only give this message once for a recursive call to avoid */ \
/* flooding the user with errors. */ \
did_echo_string_emsg = true; \
- EMSG(_("E724: unable to correctly dump variable " \
+ emsg(_("E724: unable to correctly dump variable " \
"with self-referencing container")); \
} \
char ebuf[NUMBUFLEN + 7]; \
@@ -528,7 +528,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
/* Only give this message once for a recursive call to avoid */ \
/* flooding the user with errors. */ \
did_echo_string_emsg = true; \
- EMSG(_("E724: unable to correctly dump variable " \
+ emsg(_("E724: unable to correctly dump variable " \
"with self-referencing container")); \
} \
} while (0)
@@ -558,11 +558,11 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
const float_T flt_ = (flt); \
switch (xfpclassify(flt_)) { \
case FP_NAN: { \
- EMSG(_("E474: Unable to represent NaN value in JSON")); \
+ emsg(_("E474: Unable to represent NaN value in JSON")); \
return FAIL; \
} \
case FP_INFINITE: { \
- EMSG(_("E474: Unable to represent infinity in JSON")); \
+ emsg(_("E474: Unable to represent infinity in JSON")); \
return FAIL; \
} \
default: { \
@@ -630,14 +630,14 @@ static inline int convert_to_json_string(garray_T *const gap, const char *const
break;
default:
if (ch > 0x7F && shift == 1) {
- emsgf(_("E474: String \"%.*s\" contains byte that does not start "
+ semsg(_("E474: String \"%.*s\" contains byte that does not start "
"any UTF-8 character"),
(int)(utf_len - (i - shift)), utf_buf + i - shift);
xfree(tofree);
return FAIL;
} else if ((SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END)
|| (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END)) {
- emsgf(_("E474: UTF-8 string contains code point which belongs "
+ semsg(_("E474: UTF-8 string contains code point which belongs "
"to a surrogate pair: %.*s"),
(int)(utf_len - (i - shift)), utf_buf + i - shift);
xfree(tofree);
@@ -719,7 +719,7 @@ static inline int convert_to_json_string(garray_T *const gap, const char *const
#define TYPVAL_ENCODE_CONV_EXT_STRING(tv, buf, len, type) \
do { \
xfree(buf); \
- EMSG(_("E474: Unable to convert EXT string to JSON")); \
+ emsg(_("E474: Unable to convert EXT string to JSON")); \
return FAIL; \
} while (0)
@@ -792,7 +792,7 @@ bool encode_check_json_key(const typval_T *const tv)
#define TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(label, key) \
do { \
if (!encode_check_json_key(&key)) { \
- EMSG(_("E474: Invalid key in special dictionary")); \
+ emsg(_("E474: Invalid key in special dictionary")); \
goto label; \
} \
} while (0)
diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c
index 8eceda84cf..ed4f36f4c7 100644
--- a/src/nvim/eval/executor.c
+++ b/src/nvim/eval/executor.c
@@ -144,6 +144,6 @@ int eexe_mod_op(typval_T *const tv1, const typval_T *const tv2, const char *cons
}
}
- EMSG2(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
return FAIL;
}
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index eb7d62d7a2..44af53b7c0 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -278,12 +278,12 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
Object result = fn(VIML_INTERNAL_CALL, args, &err);
if (ERROR_SET(&err)) {
- emsgf_multiline((const char *)e_api_error, err.msg);
+ semsg_multiline((const char *)e_api_error, err.msg);
goto end;
}
if (!object_to_vim(result, rettv, &err)) {
- EMSG2(_("Error converting the call result: %s"), err.msg);
+ semsg(_("Error converting the call result: %s"), err.msg);
}
end:
@@ -340,7 +340,7 @@ static void f_add(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else {
- EMSG(_(e_listblobreq));
+ emsg(_(e_listblobreq));
}
}
@@ -814,7 +814,7 @@ buf_T *get_buf_arg(typval_T *arg)
buf = tv_get_buf(arg, false);
emsg_off--;
if (buf == NULL) {
- EMSG2(_("E158: Invalid buffer name: %s"), tv_get_string(arg));
+ semsg(_("E158: Invalid buffer name: %s"), tv_get_string(arg));
}
return buf;
}
@@ -876,7 +876,7 @@ static void f_byteidxcomp(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_call(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[1].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
if (argvars[1].vval.v_list == NULL) {
@@ -905,7 +905,7 @@ static void f_call(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[2].v_type != VAR_UNKNOWN) {
if (argvars[2].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
selfdict = argvars[2].vval.v_dict;
@@ -937,7 +937,7 @@ static void f_chanclose(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER || (argvars[1].v_type != VAR_STRING
&& argvars[1].v_type != VAR_UNKNOWN)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -953,14 +953,14 @@ static void f_chanclose(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if (!strcmp(stream, "rpc")) {
part = kChannelPartRpc;
} else {
- EMSG2(_("Invalid channel stream \"%s\""), stream);
+ semsg(_("Invalid channel stream \"%s\""), stream);
return;
}
}
const char *error;
rettv->vval.v_number = channel_close(argvars[0].vval.v_number, part, &error);
if (!rettv->vval.v_number) {
- EMSG(error);
+ emsg(error);
}
}
@@ -976,7 +976,7 @@ static void f_chansend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER || argvars[1].v_type == VAR_UNKNOWN) {
// First argument is the channel id and second is the data to write
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1001,7 +1001,7 @@ static void f_chansend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *error = NULL;
rettv->vval.v_number = channel_send(id, input, input_len, true, &error);
if (error) {
- EMSG(error);
+ emsg(error);
}
}
@@ -1028,7 +1028,7 @@ static void f_charidx(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|| argvars[1].v_type != VAR_NUMBER
|| (argvars[2].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_NUMBER)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1042,7 +1042,7 @@ static void f_charidx(typval_T *argvars, typval_T *rettv, FunPtr fptr)
countcc = (int)tv_get_number(&argvars[2]);
}
if (countcc < 0 || countcc > 1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1130,7 +1130,7 @@ static win_T *get_optional_window(typval_T *argvars, int idx)
if (argvars[idx].v_type != VAR_UNKNOWN) {
win = find_win_by_nr_or_id(&argvars[idx]);
if (win == NULL) {
- EMSG(_(e_invalwindow));
+ emsg(_(e_invalwindow));
return NULL;
}
}
@@ -1196,7 +1196,7 @@ static void f_col(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_complete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if ((State & INSERT) == 0) {
- EMSG(_("E785: complete() can only be used in Insert mode"));
+ emsg(_("E785: complete() can only be used in Insert mode"));
return;
}
@@ -1207,7 +1207,7 @@ static void f_complete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[1].v_type != VAR_LIST) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1249,7 +1249,7 @@ static void f_complete_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_UNKNOWN) {
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
what_list = argvars[0].vval.v_list;
@@ -1372,7 +1372,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (!error) {
li = tv_list_find(l, idx);
if (li == NULL) {
- EMSGN(_(e_listidx), idx);
+ semsg(_(e_listidx), (int64_t)idx);
}
}
}
@@ -1395,7 +1395,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if ((d = argvars[0].vval.v_dict) != NULL) {
if (argvars[2].v_type != VAR_UNKNOWN) {
if (argvars[3].v_type != VAR_UNKNOWN) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
}
}
@@ -1410,7 +1410,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else {
- EMSG2(_(e_listdictarg), "count()");
+ semsg(_(e_listdictarg), "count()");
}
rettv->vval.v_number = n;
}
@@ -1447,13 +1447,13 @@ static void f_ctxget(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type == VAR_NUMBER) {
index = argvars[0].vval.v_number;
} else if (argvars[0].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_invarg2), "expected nothing or a Number as an argument");
+ semsg(_(e_invarg2), "expected nothing or a Number as an argument");
return;
}
Context *ctx = ctx_get(index);
if (ctx == NULL) {
- EMSG3(_(e_invargNval), "index", "out of bounds");
+ semsg(_(e_invargNval), "index", "out of bounds");
return;
}
@@ -1468,7 +1468,7 @@ static void f_ctxget(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_ctxpop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (!ctx_restore(NULL, kCtxAll)) {
- EMSG(_("Context stack is empty"));
+ emsg(_("Context stack is empty"));
}
}
@@ -1497,7 +1497,7 @@ static void f_ctxpush(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
});
} else if (argvars[0].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_invarg2), "expected nothing or a List as an argument");
+ semsg(_(e_invarg2), "expected nothing or a List as an argument");
return;
}
ctx_save(NULL, types);
@@ -1507,7 +1507,7 @@ static void f_ctxpush(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_ctxset(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_DICT) {
- EMSG2(_(e_invarg2), "expected dictionary as first argument");
+ semsg(_(e_invarg2), "expected dictionary as first argument");
return;
}
@@ -1515,13 +1515,13 @@ static void f_ctxset(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[1].v_type == VAR_NUMBER) {
index = argvars[1].vval.v_number;
} else if (argvars[1].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_invarg2), "expected nothing or a Number as second argument");
+ semsg(_(e_invarg2), "expected nothing or a Number as second argument");
return;
}
Context *ctx = ctx_get(index);
if (ctx == NULL) {
- EMSG3(_(e_invargNval), "index", "out of bounds");
+ semsg(_(e_invargNval), "index", "out of bounds");
return;
}
@@ -1568,7 +1568,7 @@ static void f_cursor(typval_T *argvars, typval_T *rettv, FunPtr fptr)
colnr_T curswant = -1;
if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1615,7 +1615,7 @@ static void f_debugbreak(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = FAIL;
pid = (int)tv_get_number(&argvars[0]);
if (pid == 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
#ifdef WIN32
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
@@ -1640,7 +1640,7 @@ static void f_deepcopy(typval_T *argvars, typval_T *rettv, FunPtr fptr)
noref = tv_get_number_chk(&argvars[1], NULL);
}
if (noref < 0 || noref > 1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
var_item_copy(NULL, &argvars[0], rettv, true, (noref == 0
? get_copyID()
@@ -1658,7 +1658,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *const name = tv_get_string(&argvars[0]);
if (*name == NUL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1680,7 +1680,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// delete a directory recursively
rettv->vval.v_number = delete_recursive(name);
} else {
- emsgf(_(e_invexpr2), flags);
+ semsg(_(e_invexpr2), flags);
}
}
@@ -1692,17 +1692,17 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_DICT) {
- emsgf(_(e_invarg2), "dict");
+ semsg(_(e_invarg2), "dict");
return;
} else if (argvars[0].vval.v_dict == NULL) {
const char *const arg_errmsg = _("dictwatcheradd() argument");
const size_t arg_errmsg_len = strlen(arg_errmsg);
- emsgf(_(e_readonlyvar), (int)arg_errmsg_len, arg_errmsg);
+ semsg(_(e_readonlyvar), (int)arg_errmsg_len, arg_errmsg);
return;
}
if (argvars[1].v_type != VAR_STRING && argvars[1].v_type != VAR_NUMBER) {
- emsgf(_(e_invarg2), "key");
+ semsg(_(e_invarg2), "key");
return;
}
@@ -1714,7 +1714,7 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
Callback callback;
if (!callback_from_typval(&callback, &argvars[2])) {
- emsgf(_(e_invarg2), "funcref");
+ semsg(_(e_invarg2), "funcref");
return;
}
@@ -1730,12 +1730,12 @@ static void f_dictwatcherdel(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_DICT) {
- emsgf(_(e_invarg2), "dict");
+ semsg(_(e_invarg2), "dict");
return;
}
if (argvars[2].v_type != VAR_FUNC && argvars[2].v_type != VAR_STRING) {
- emsgf(_(e_invarg2), "funcref");
+ semsg(_(e_invarg2), "funcref");
return;
}
@@ -1751,7 +1751,7 @@ static void f_dictwatcherdel(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (!tv_dict_watcher_remove(argvars[0].vval.v_dict, key_pattern,
strlen(key_pattern), callback)) {
- EMSG("Couldn't find a watcher matching key and callback");
+ emsg("Couldn't find a watcher matching key and callback");
}
callback_free(&callback);
@@ -2039,13 +2039,13 @@ static void f_eval(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *const expr_start = s;
if (s == NULL || eval1((char_u **)&s, rettv, true) == FAIL) {
if (expr_start != NULL && !aborting()) {
- EMSG2(_(e_invexpr2), expr_start);
+ semsg(_(e_invexpr2), expr_start);
}
need_clr_eos = false;
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
} else if (*s != NUL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
}
}
@@ -2263,7 +2263,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
size_t len;
- char_u *errormsg;
+ char *errormsg;
int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
expand_T xpc;
bool error = false;
@@ -2348,7 +2348,7 @@ static void f_menu_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Expand all the special characters in a command string.
static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- char_u *errormsg = NULL;
+ char *errormsg = NULL;
rettv->v_type = VAR_STRING;
char_u *cmdstr = (char_u *)xstrdup(tv_get_string(&argvars[0]));
@@ -2364,7 +2364,7 @@ static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
expand_filename(&eap, &cmdstr, &errormsg);
if (errormsg != NULL && *errormsg != NUL) {
- EMSG(errormsg);
+ emsg(errormsg);
}
rettv->vval.v_string = cmdstr;
}
@@ -2378,7 +2378,7 @@ static void f_flatten(typval_T *argvars, typval_T *rettv, FunPtr fptr)
bool error = false;
if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listarg), "flatten()");
+ semsg(_(e_listarg), "flatten()");
return;
}
@@ -2390,7 +2390,7 @@ static void f_flatten(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (maxdepth < 0) {
- EMSG(_("E900: maxdepth must be non-negative number"));
+ emsg(_("E900: maxdepth must be non-negative number"));
return;
}
}
@@ -2432,7 +2432,7 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else {
item = tv_list_find(l1, before);
if (item == NULL) {
- EMSGN(_(e_listidx), before);
+ semsg(_(e_listidx), (int64_t)before);
return;
}
}
@@ -2471,7 +2471,7 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
if (i == 3) {
- EMSG2(_(e_invarg2), action);
+ semsg(_(e_invarg2), action);
return;
}
}
@@ -2481,7 +2481,7 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_copy(&argvars[0], rettv);
}
} else {
- EMSG2(_(e_listdictarg), "extend()");
+ semsg(_(e_listdictarg), "extend()");
}
}
@@ -2928,7 +2928,7 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_list_append_tv(rettv->vval.v_list, &pt->pt_argv[i]);
}
} else {
- EMSG2(_(e_invarg2), what);
+ semsg(_(e_invarg2), what);
}
// When {what} == "dict" and pt->pt_dict == NULL, evaluate the
@@ -2938,7 +2938,7 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else {
- EMSG2(_(e_listdictblobarg), "get()");
+ semsg(_(e_listdictblobarg), "get()");
}
if (tv == NULL) {
@@ -3364,7 +3364,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
| WILD_NO_BEEP | WILD_HOME_REPLACE;
if (argvars[1].v_type != VAR_STRING) {
- EMSG2(_(e_invarg2), "type must be a string");
+ semsg(_(e_invarg2), "type must be a string");
return;
}
const char *const type = tv_get_string(&argvars[1]);
@@ -3383,7 +3383,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -3398,7 +3398,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
xpc.xp_context = cmdcomplete_str_to_type(type);
if (xpc.xp_context == EXPAND_NOTHING) {
- EMSG2(_(e_invarg2), type);
+ semsg(_(e_invarg2), type);
return;
}
@@ -3467,13 +3467,13 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break;
}
if (argvars[i].v_type != VAR_NUMBER) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
scope_number[i] = argvars[i].vval.v_number;
// It is an error for the scope number to be less than `-1`.
if (scope_number[i] < -1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
// Use the narrowest scope the user requested
@@ -3494,7 +3494,7 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (scope_number[kCdScopeTabpage] > 0) {
tp = find_tabpage(scope_number[kCdScopeTabpage]);
if (!tp) {
- EMSG(_("E5000: Cannot find tab number."));
+ emsg(_("E5000: Cannot find tab number."));
return;
}
}
@@ -3502,14 +3502,14 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Find the window in `tp` by number, `NULL` if none.
if (scope_number[kCdScopeWindow] >= 0) {
if (scope_number[kCdScopeTabpage] < 0) {
- EMSG(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));