mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lint (#16526)
This commit is contained in:
parent
4306b395de
commit
523f03b506
@ -14,8 +14,8 @@
|
|||||||
/// @return Folded variant.
|
/// @return Folded variant.
|
||||||
#define CH_FOLD(c) \
|
#define CH_FOLD(c) \
|
||||||
utf_fold((sizeof(c) == sizeof(char)) \
|
utf_fold((sizeof(c) == sizeof(char)) \
|
||||||
?((int)(uint8_t)(c)) \
|
? ((int)(uint8_t)(c)) \
|
||||||
:((int)(c)))
|
: ((int)(c)))
|
||||||
|
|
||||||
/// Flags for vim_str2nr()
|
/// Flags for vim_str2nr()
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -5241,7 +5241,7 @@ static int ins_complete(int c, bool enable_pum)
|
|||||||
funcname = get_complete_funcname(ctrl_x_mode);
|
funcname = get_complete_funcname(ctrl_x_mode);
|
||||||
if (*funcname == NUL) {
|
if (*funcname == NUL) {
|
||||||
semsg(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION
|
semsg(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION
|
||||||
? "completefunc" : "omnifunc");
|
? "completefunc" : "omnifunc");
|
||||||
// restore did_ai, so that adding comment leader works
|
// restore did_ai, so that adding comment leader works
|
||||||
did_ai = save_did_ai;
|
did_ai = save_did_ai;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
@ -4523,7 +4523,7 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
|
|||||||
* dict.name
|
* dict.name
|
||||||
*/
|
*/
|
||||||
key = *arg + 1;
|
key = *arg + 1;
|
||||||
for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; ++len) {
|
for (len = 0; ASCII_ISALNUM(key[len]) || key[len] == '_'; len++) {
|
||||||
}
|
}
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -6603,8 +6603,9 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref, FunPtr
|
|||||||
: (const char *)s));
|
: (const char *)s));
|
||||||
// Don't check an autoload name for existence here.
|
// Don't check an autoload name for existence here.
|
||||||
} else if (trans_name != NULL
|
} else if (trans_name != NULL
|
||||||
&& (is_funcref ? find_func(trans_name) == NULL
|
&& (is_funcref
|
||||||
: !translated_function_exists((const char *)trans_name))) {
|
? find_func(trans_name) == NULL
|
||||||
|
: !translated_function_exists((const char *)trans_name))) {
|
||||||
semsg(_("E700: Unknown function: %s"), s);
|
semsg(_("E700: Unknown function: %s"), s);
|
||||||
} else {
|
} else {
|
||||||
int dict_idx = 0;
|
int dict_idx = 0;
|
||||||
@ -9649,8 +9650,8 @@ bool var_check_func_name(const char *const name, const bool new_var)
|
|||||||
{
|
{
|
||||||
// Allow for w: b: s: and t:.
|
// Allow for w: b: s: and t:.
|
||||||
if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':')
|
if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':')
|
||||||
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2]
|
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
|
||||||
: name[0])) {
|
? name[2] : name[0])) {
|
||||||
semsg(_("E704: Funcref variable name must start with a capital: %s"), name);
|
semsg(_("E704: Funcref variable name must start with a capital: %s"), name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -209,8 +209,8 @@ typedef enum {
|
|||||||
|
|
||||||
/// flags for find_name_end()
|
/// flags for find_name_end()
|
||||||
#define FNE_INCL_BR 1 // find_name_end(): include [] in name
|
#define FNE_INCL_BR 1 // find_name_end(): include [] in name
|
||||||
#define FNE_CHECK_START 2 /* find_name_end(): check name starts with
|
#define FNE_CHECK_START 2 // find_name_end(): check name starts with
|
||||||
valid character */
|
// valid character
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TimeWatcher tw;
|
TimeWatcher tw;
|
||||||
|
@ -730,7 +730,7 @@ json_decode_string_cycle_start:
|
|||||||
? (DICT_LEN(last_container.container.vval.v_dict) == 0)
|
? (DICT_LEN(last_container.container.vval.v_dict) == 0)
|
||||||
: (tv_list_len(last_container.container.vval.v_list)
|
: (tv_list_len(last_container.container.vval.v_list)
|
||||||
== 0))
|
== 0))
|
||||||
: (tv_list_len(last_container.special_val) == 0)) {
|
: (tv_list_len(last_container.special_val) == 0)) {
|
||||||
semsg(_("E474: Leading comma: %.*s"), LENP(p, e));
|
semsg(_("E474: Leading comma: %.*s"), LENP(p, e));
|
||||||
goto json_decode_string_fail;
|
goto json_decode_string_fail;
|
||||||
}
|
}
|
||||||
|
@ -305,9 +305,8 @@ void ex_align(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
(void)set_indent(++new_indent, 0);
|
(void)set_indent(++new_indent, 0);
|
||||||
}
|
} while (linelen(NULL) <= width);
|
||||||
while (linelen(NULL) <= width);
|
new_indent--;
|
||||||
--new_indent;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
--new_indent;
|
--new_indent;
|
||||||
@ -1457,7 +1456,7 @@ error:
|
|||||||
filterend:
|
filterend:
|
||||||
|
|
||||||
if (curbuf != old_curbuf) {
|
if (curbuf != old_curbuf) {
|
||||||
--no_wait_return;
|
no_wait_return--;
|
||||||
emsg(_("E135: *Filter* Autocommands must not change current buffer"));
|
emsg(_("E135: *Filter* Autocommands must not change current buffer"));
|
||||||
}
|
}
|
||||||
if (itmp != NULL) {
|
if (itmp != NULL) {
|
||||||
@ -2094,7 +2093,7 @@ void do_wqall(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
if (buf->b_ffname == NULL) {
|
if (buf->b_ffname == NULL) {
|
||||||
semsg(_("E141: No file name for buffer %" PRId64), (int64_t)buf->b_fnum);
|
semsg(_("E141: No file name for buffer %" PRId64), (int64_t)buf->b_fnum);
|
||||||
++error;
|
error++;
|
||||||
} else if (check_readonly(&eap->forceit, buf)
|
} else if (check_readonly(&eap->forceit, buf)
|
||||||
|| check_overwrite(eap, buf, buf->b_fname, buf->b_ffname,
|
|| check_overwrite(eap, buf, buf->b_fname, buf->b_ffname,
|
||||||
FALSE) == FAIL) {
|
FALSE) == FAIL) {
|
||||||
@ -2120,17 +2119,15 @@ void do_wqall(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Check the 'write' option.
|
||||||
* Check the 'write' option.
|
// Return true and give a message when it's not st.
|
||||||
* Return TRUE and give a message when it's not st.
|
bool not_writing(void)
|
||||||
*/
|
|
||||||
int not_writing(void)
|
|
||||||
{
|
{
|
||||||
if (p_write) {
|
if (p_write) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
emsg(_("E142: File not written: Writing is disabled by 'write' option"));
|
emsg(_("E142: File not written: Writing is disabled by 'write' option"));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2945,7 +2942,7 @@ void ex_append(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
msg_scroll = TRUE;
|
msg_scroll = true;
|
||||||
need_wait_return = false;
|
need_wait_return = false;
|
||||||
if (curbuf->b_p_ai) {
|
if (curbuf->b_p_ai) {
|
||||||
if (append_indent >= 0) {
|
if (append_indent >= 0) {
|
||||||
@ -3131,7 +3128,7 @@ void ex_z(exarg_T *eap)
|
|||||||
|
|
||||||
// the number of '-' and '+' multiplies the distance
|
// the number of '-' and '+' multiplies the distance
|
||||||
if (*kind == '-' || *kind == '+') {
|
if (*kind == '-' || *kind == '+') {
|
||||||
for (x = kind + 1; *x == *kind; ++x) {
|
for (x = kind + 1; *x == *kind; x++) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3214,26 +3211,24 @@ void ex_z(exarg_T *eap)
|
|||||||
ex_no_reprint = true;
|
ex_no_reprint = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Check if the secure flag is set (.exrc or .vimrc in current directory).
|
||||||
* Check if the secure flag is set (.exrc or .vimrc in current directory).
|
// If so, give an error message and return true.
|
||||||
* If so, give an error message and return TRUE.
|
// Otherwise, return false.
|
||||||
* Otherwise, return FALSE.
|
bool check_secure(void)
|
||||||
*/
|
|
||||||
int check_secure(void)
|
|
||||||
{
|
{
|
||||||
if (secure) {
|
if (secure) {
|
||||||
secure = 2;
|
secure = 2;
|
||||||
emsg(_(e_curdir));
|
emsg(_(e_curdir));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the sandbox more things are not allowed, including the things
|
// In the sandbox more things are not allowed, including the things
|
||||||
// disallowed in secure mode.
|
// disallowed in secure mode.
|
||||||
if (sandbox != 0) {
|
if (sandbox != 0) {
|
||||||
emsg(_(e_sandbox));
|
emsg(_(e_sandbox));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Previous substitute replacement string
|
/// Previous substitute replacement string
|
||||||
|
@ -435,7 +435,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
|
|||||||
&& cstack.cs_idx < 0
|
&& cstack.cs_idx < 0
|
||||||
&& !(getline_is_func
|
&& !(getline_is_func
|
||||||
&& func_has_abort(real_cookie))) {
|
&& func_has_abort(real_cookie))) {
|
||||||
did_emsg = FALSE;
|
did_emsg = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2717,7 +2717,7 @@ static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *
|
|||||||
*/
|
*/
|
||||||
gap = &curbuf->b_ucmds;
|
gap = &curbuf->b_ucmds;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (j = 0; j < gap->ga_len; ++j) {
|
for (j = 0; j < gap->ga_len; j++) {
|
||||||
uc = USER_CMD_GA(gap, j);
|
uc = USER_CMD_GA(gap, j);
|
||||||
cp = eap->cmd;
|
cp = eap->cmd;
|
||||||
np = uc->uc_name;
|
np = uc->uc_name;
|
||||||
@ -5328,7 +5328,7 @@ static void uc_list(char_u *name, size_t name_len)
|
|||||||
? &prevwin->w_buffer->b_ucmds
|
? &prevwin->w_buffer->b_ucmds
|
||||||
: &curbuf->b_ucmds;
|
: &curbuf->b_ucmds;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (i = 0; i < gap->ga_len; ++i) {
|
for (i = 0; i < gap->ga_len; i++) {
|
||||||
cmd = USER_CMD_GA(gap, i);
|
cmd = USER_CMD_GA(gap, i);
|
||||||
a = cmd->uc_argt;
|
a = cmd->uc_argt;
|
||||||
|
|
||||||
@ -5715,7 +5715,7 @@ static void ex_delcommand(exarg_T *eap)
|
|||||||
|
|
||||||
gap = &curbuf->b_ucmds;
|
gap = &curbuf->b_ucmds;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (i = 0; i < gap->ga_len; ++i) {
|
for (i = 0; i < gap->ga_len; i++) {
|
||||||
cmd = USER_CMD_GA(gap, i);
|
cmd = USER_CMD_GA(gap, i);
|
||||||
cmp = STRCMP(eap->arg, cmd->uc_name);
|
cmp = STRCMP(eap->arg, cmd->uc_name);
|
||||||
if (cmp <= 0) {
|
if (cmp <= 0) {
|
||||||
@ -8338,9 +8338,7 @@ static void ex_redir(exarg_T *eap)
|
|||||||
if (var_redir_start(skipwhite(arg), append) == OK) {
|
if (var_redir_start(skipwhite(arg), append) == OK) {
|
||||||
redir_vname = 1;
|
redir_vname = 1;
|
||||||
}
|
}
|
||||||
}
|
} else { // TODO(vim): redirect to a buffer
|
||||||
// TODO: redirect to a buffer
|
|
||||||
else {
|
|
||||||
semsg(_(e_invarg2), eap->arg);
|
semsg(_(e_invarg2), eap->arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,7 +437,7 @@ char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*should_free = FALSE;
|
*should_free = false;
|
||||||
ret = value;
|
ret = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,11 +888,10 @@ void ex_endif(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
void ex_else(exarg_T *eap)
|
void ex_else(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int skip;
|
|
||||||
int result;
|
int result;
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
|
|
||||||
skip = CHECK_SKIP;
|
bool skip = CHECK_SKIP;
|
||||||
|
|
||||||
if (cstack->cs_idx < 0
|
if (cstack->cs_idx < 0
|
||||||
|| (cstack->cs_flags[cstack->cs_idx]
|
|| (cstack->cs_flags[cstack->cs_idx]
|
||||||
@ -902,14 +901,14 @@ void ex_else(exarg_T *eap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
eap->errmsg = N_("E582: :elseif without :if");
|
eap->errmsg = N_("E582: :elseif without :if");
|
||||||
skip = TRUE;
|
skip = true;
|
||||||
} else if (cstack->cs_flags[cstack->cs_idx] & CSF_ELSE) {
|
} else if (cstack->cs_flags[cstack->cs_idx] & CSF_ELSE) {
|
||||||
if (eap->cmdidx == CMD_else) {
|
if (eap->cmdidx == CMD_else) {
|
||||||
eap->errmsg = N_("E583: multiple :else");
|
eap->errmsg = N_("E583: multiple :else");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
eap->errmsg = N_("E584: :elseif after :else");
|
eap->errmsg = N_("E584: :elseif after :else");
|
||||||
skip = TRUE;
|
skip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if skipping or the ":if" was TRUE, reset ACTIVE, otherwise set it
|
// if skipping or the ":if" was TRUE, reset ACTIVE, otherwise set it
|
||||||
@ -917,7 +916,7 @@ void ex_else(exarg_T *eap)
|
|||||||
if (eap->errmsg == NULL) {
|
if (eap->errmsg == NULL) {
|
||||||
cstack->cs_flags[cstack->cs_idx] = CSF_TRUE;
|
cstack->cs_flags[cstack->cs_idx] = CSF_TRUE;
|
||||||
}
|
}
|
||||||
skip = TRUE; // don't evaluate an ":elseif"
|
skip = true; // don't evaluate an ":elseif"
|
||||||
} else {
|
} else {
|
||||||
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE;
|
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE;
|
||||||
}
|
}
|
||||||
@ -932,7 +931,7 @@ void ex_else(exarg_T *eap)
|
|||||||
// later on.
|
// later on.
|
||||||
if (!skip && dbg_check_skipped(eap) && got_int) {
|
if (!skip && dbg_check_skipped(eap) && got_int) {
|
||||||
(void)do_intthrow(cstack);
|
(void)do_intthrow(cstack);
|
||||||
skip = TRUE;
|
skip = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_elseif) {
|
if (eap->cmdidx == CMD_elseif) {
|
||||||
@ -1322,9 +1321,9 @@ void ex_try(exarg_T *eap)
|
|||||||
void ex_catch(exarg_T *eap)
|
void ex_catch(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
int give_up = FALSE;
|
bool give_up = false;
|
||||||
int skip = FALSE;
|
bool skip = false;
|
||||||
int caught = FALSE;
|
bool caught = false;
|
||||||
char_u *end;
|
char_u *end;
|
||||||
char_u save_char = 0;
|
char_u save_char = 0;
|
||||||
char_u *save_cpo;
|
char_u *save_cpo;
|
||||||
@ -1335,13 +1334,13 @@ void ex_catch(exarg_T *eap)
|
|||||||
|
|
||||||
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
|
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
|
||||||
eap->errmsg = N_("E603: :catch without :try");
|
eap->errmsg = N_("E603: :catch without :try");
|
||||||
give_up = TRUE;
|
give_up = true;
|
||||||
} else {
|
} else {
|
||||||
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
|
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
|
||||||
// Report what's missing if the matching ":try" is not in its
|
// Report what's missing if the matching ":try" is not in its
|
||||||
// finally clause.
|
// finally clause.
|
||||||
eap->errmsg = get_end_emsg(cstack);
|
eap->errmsg = get_end_emsg(cstack);
|
||||||
skip = TRUE;
|
skip = true;
|
||||||
}
|
}
|
||||||
for (idx = cstack->cs_idx; idx > 0; --idx) {
|
for (idx = cstack->cs_idx; idx > 0; --idx) {
|
||||||
if (cstack->cs_flags[idx] & CSF_TRY) {
|
if (cstack->cs_flags[idx] & CSF_TRY) {
|
||||||
@ -1352,7 +1351,7 @@ void ex_catch(exarg_T *eap)
|
|||||||
// Give up for a ":catch" after ":finally" and ignore it.
|
// Give up for a ":catch" after ":finally" and ignore it.
|
||||||
// Just parse.
|
// Just parse.
|
||||||
eap->errmsg = N_("E604: :catch after :finally");
|
eap->errmsg = N_("E604: :catch after :finally");
|
||||||
give_up = TRUE;
|
give_up = true;
|
||||||
} else {
|
} else {
|
||||||
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
|
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
|
||||||
&cstack->cs_looplevel);
|
&cstack->cs_looplevel);
|
||||||
@ -1425,7 +1424,7 @@ void ex_catch(exarg_T *eap)
|
|||||||
// CTRL-C while matching should abort it.
|
// CTRL-C while matching should abort it.
|
||||||
//
|
//
|
||||||
prev_got_int = got_int;
|
prev_got_int = got_int;
|
||||||
got_int = FALSE;
|
got_int = false;
|
||||||
caught = vim_regexec_nl(®match, (char_u *)current_exception->value,
|
caught = vim_regexec_nl(®match, (char_u *)current_exception->value,
|
||||||
(colnr_T)0);
|
(colnr_T)0);
|
||||||
got_int |= prev_got_int;
|
got_int |= prev_got_int;
|
||||||
@ -1602,8 +1601,7 @@ void ex_finally(exarg_T *eap)
|
|||||||
void ex_endtry(exarg_T *eap)
|
void ex_endtry(exarg_T *eap)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
int skip;
|
bool rethrow = false;
|
||||||
int rethrow = FALSE;
|
|
||||||
int pending = CSTP_NONE;
|
int pending = CSTP_NONE;
|
||||||
void *rettv = NULL;
|
void *rettv = NULL;
|
||||||
cstack_T *const cstack = eap->cstack;
|
cstack_T *const cstack = eap->cstack;
|
||||||
@ -1621,20 +1619,19 @@ void ex_endtry(exarg_T *eap)
|
|||||||
// made inactive by a ":continue", ":break", ":return", or ":finish" in
|
// made inactive by a ":continue", ":break", ":return", or ":finish" in
|
||||||
// the finally clause. The latter case need not be tested since then
|
// the finally clause. The latter case need not be tested since then
|
||||||
// anything pending has already been discarded.
|
// anything pending has already been discarded.
|
||||||
skip = (did_emsg || got_int || current_exception
|
bool skip = did_emsg || got_int || current_exception
|
||||||
|| !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE));
|
|| !(cstack->cs_flags[cstack->cs_idx] & CSF_TRUE);
|
||||||
|
|
||||||
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
|
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
|
||||||
eap->errmsg = get_end_emsg(cstack);
|
eap->errmsg = get_end_emsg(cstack);
|
||||||
// Find the matching ":try" and report what's missing.
|
// Find the matching ":try" and report what's missing.
|
||||||
idx = cstack->cs_idx;
|
idx = cstack->cs_idx;
|
||||||
do {
|
do {
|
||||||
--idx;
|
idx--;
|
||||||
}
|
} while (idx > 0 && !(cstack->cs_flags[idx] & CSF_TRY));
|
||||||
while (idx > 0 && !(cstack->cs_flags[idx] & CSF_TRY));
|
|
||||||
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
|
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
|
||||||
&cstack->cs_looplevel);
|
&cstack->cs_looplevel);
|
||||||
skip = TRUE;
|
skip = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If an exception is being thrown, discard it to prevent it from
|
* If an exception is being thrown, discard it to prevent it from
|
||||||
@ -1677,7 +1674,7 @@ void ex_endtry(exarg_T *eap)
|
|||||||
// before the ":endtry". That is, throw an interrupt exception and
|
// before the ":endtry". That is, throw an interrupt exception and
|
||||||
// set "skip" and "rethrow".
|
// set "skip" and "rethrow".
|
||||||
if (got_int) {
|
if (got_int) {
|
||||||
skip = TRUE;
|
skip = true;
|
||||||
(void)do_intthrow(cstack);
|
(void)do_intthrow(cstack);
|
||||||
// The do_intthrow() call may have reset current_exception or
|
// The do_intthrow() call may have reset current_exception or
|
||||||
// cstack->cs_pending[idx].
|
// cstack->cs_pending[idx].
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
#define CSF_THROWN 0x0400 // exception thrown to this try conditional
|
#define CSF_THROWN 0x0400 // exception thrown to this try conditional
|
||||||
#define CSF_CAUGHT 0x0800 // exception caught by this try conditional
|
#define CSF_CAUGHT 0x0800 // exception caught by this try conditional
|
||||||
#define CSF_SILENT 0x1000 // "emsg_silent" reset by ":try"
|
#define CSF_SILENT 0x1000 // "emsg_silent" reset by ":try"
|
||||||
/* Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset
|
// Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset
|
||||||
* (an ":if"), and CSF_SILENT is only used when CSF_TRY is set. */
|
// (an ":if"), and CSF_SILENT is only used when CSF_TRY is set.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* What's pending for being reactivated at the ":endtry" of this try
|
* What's pending for being reactivated at the ":endtry" of this try
|
||||||
|
@ -2491,27 +2491,25 @@ char *get_text_locked_msg(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if "curbuf->b_ro_locked" or "allbuf_lock" is set and
|
/// Check if "curbuf->b_ro_locked" or "allbuf_lock" is set and
|
||||||
/// return TRUE when it is and give an error message.
|
/// return true when it is and give an error message.
|
||||||
int curbuf_locked(void)
|
bool curbuf_locked(void)
|
||||||
{
|
{
|
||||||
if (curbuf->b_ro_locked > 0) {
|
if (curbuf->b_ro_locked > 0) {
|
||||||
emsg(_("E788: Not allowed to edit another buffer now"));
|
emsg(_("E788: Not allowed to edit another buffer now"));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return allbuf_locked();
|
return allbuf_locked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Check if "allbuf_lock" is set and return true when it is and give an error
|
||||||
* Check if "allbuf_lock" is set and return TRUE when it is and give an error
|
// message.
|
||||||
* message.
|
bool allbuf_locked(void)
|
||||||
*/
|
|
||||||
int allbuf_locked(void)
|
|
||||||
{
|
{
|
||||||
if (allbuf_lock > 0) {
|
if (allbuf_lock > 0) {
|
||||||
emsg(_("E811: Not allowed to change buffer information now"));
|
emsg(_("E811: Not allowed to change buffer information now"));
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmdline_charsize(int idx)
|
static int cmdline_charsize(int idx)
|
||||||
|
@ -1851,7 +1851,7 @@ failed:
|
|||||||
msg_scrolled_ign = true;
|
msg_scrolled_ign = true;
|
||||||
|
|
||||||
if (!read_stdin && !read_buffer) {
|
if (!read_stdin && !read_buffer) {
|
||||||
p = (char_u *)msg_trunc_attr((char *)IObuff, FALSE, 0);
|
p = (char_u *)msg_trunc_attr((char *)IObuff, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read_stdin || read_buffer || restart_edit != 0
|
if (read_stdin || read_buffer || restart_edit != 0
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct foldinfo {
|
typedef struct foldinfo {
|
||||||
linenr_T fi_lnum; // line number where fold starts
|
linenr_T fi_lnum; // line number where fold starts
|
||||||
int fi_level; /* level of the fold; when this is zero the
|
int fi_level; // level of the fold; when this is zero the
|
||||||
other fields are invalid */
|
// other fields are invalid
|
||||||
int fi_low_level; /* lowest fold level that starts in the same
|
int fi_low_level; // lowest fold level that starts in the same
|
||||||
line */
|
// line
|
||||||
long fi_lines;
|
long fi_lines;
|
||||||
} foldinfo_T;
|
} foldinfo_T;
|
||||||
|
|
||||||
|
@ -1794,11 +1794,9 @@ static int vgetorpeek(bool advance)
|
|||||||
* try re-mapping.
|
* try re-mapping.
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/*
|
// os_breakcheck() is slow, don't use it too often when
|
||||||
* os_breakcheck() is slow, don't use it too often when
|
// inside a mapping. But call it each time for typed
|
||||||
* inside a mapping. But call it each time for typed
|
// characters.
|
||||||
* characters.
|
|
||||||
*/
|
|
||||||
if (typebuf.tb_maplen) {
|
if (typebuf.tb_maplen) {
|
||||||
line_breakcheck();
|
line_breakcheck();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1253,7 +1253,7 @@ static struct prt_dsc_comment_S prt_dsc_table[] =
|
|||||||
* Variables for the output PostScript file.
|
* Variables for the output PostScript file.
|
||||||
*/
|
*/
|
||||||
static FILE *prt_ps_fd;
|
static FILE *prt_ps_fd;
|
||||||
static int prt_file_error;
|
static bool prt_file_error;
|
||||||
static char_u *prt_ps_file_name = NULL;
|
static char_u *prt_ps_file_name = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1329,7 +1329,7 @@ static void prt_write_file_raw_len(char_u *buffer, size_t bytes)
|
|||||||
if (!prt_file_error
|
if (!prt_file_error
|
||||||
&& fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd) != bytes) {
|
&& fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd) != bytes) {
|
||||||
emsg(_("E455: Error writing to PostScript output file"));
|
emsg(_("E455: Error writing to PostScript output file"));
|
||||||
prt_file_error = TRUE;
|
prt_file_error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1981,7 +1981,7 @@ void mch_print_cleanup(void)
|
|||||||
if (prt_ps_fd != NULL) {
|
if (prt_ps_fd != NULL) {
|
||||||
fclose(prt_ps_fd);
|
fclose(prt_ps_fd);
|
||||||
prt_ps_fd = NULL;
|
prt_ps_fd = NULL;
|
||||||
prt_file_error = FALSE;
|
prt_file_error = false;
|
||||||
}
|
}
|
||||||
if (prt_ps_file_name != NULL) {
|
if (prt_ps_file_name != NULL) {
|
||||||
XFREE_CLEAR(prt_ps_file_name);
|
XFREE_CLEAR(prt_ps_file_name);
|
||||||
@ -2203,7 +2203,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
// Check encoding and character set are compatible
|
// Check encoding and character set are compatible
|
||||||
if ((p_mbenc->needs_charset & p_mbchar->has_charset) == 0) {
|
if ((p_mbenc->needs_charset & p_mbchar->has_charset) == 0) {
|
||||||
emsg(_("E673: Incompatible multi-byte encoding and character set."));
|
emsg(_("E673: Incompatible multi-byte encoding and character set."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add charset name if not empty
|
// Add charset name if not empty
|
||||||
@ -2215,7 +2215,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
// Add custom CMap character set name
|
// Add custom CMap character set name
|
||||||
if (*p_pmcs == NUL) {
|
if (*p_pmcs == NUL) {
|
||||||
emsg(_("E674: printmbcharset cannot be empty with multi-byte encoding."));
|
emsg(_("E674: printmbcharset cannot be empty with multi-byte encoding."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
STRLCPY(prt_cmap, p_pmcs, sizeof(prt_cmap) - 2);
|
STRLCPY(prt_cmap, p_pmcs, sizeof(prt_cmap) - 2);
|
||||||
STRCAT(prt_cmap, "-");
|
STRCAT(prt_cmap, "-");
|
||||||
@ -2231,7 +2231,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
|
|
||||||
if (!mbfont_opts[OPT_MBFONT_REGULAR].present) {
|
if (!mbfont_opts[OPT_MBFONT_REGULAR].present) {
|
||||||
emsg(_("E675: No default font specified for multi-byte printing."));
|
emsg(_("E675: No default font specified for multi-byte printing."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derive CID font names with fallbacks if not defined
|
// Derive CID font names with fallbacks if not defined
|
||||||
@ -2425,12 +2425,12 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
prt_need_bgcol = false;
|
prt_need_bgcol = false;
|
||||||
prt_need_underline = false;
|
prt_need_underline = false;
|
||||||
|
|
||||||
prt_file_error = FALSE;
|
prt_file_error = false;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prt_add_resource(struct prt_ps_resource_S *resource)
|
static bool prt_add_resource(struct prt_ps_resource_S *resource)
|
||||||
{
|
{
|
||||||
FILE *fd_resource;
|
FILE *fd_resource;
|
||||||
char_u resource_buffer[512];
|
char_u resource_buffer[512];
|
||||||
@ -2439,7 +2439,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
|
|||||||
fd_resource = os_fopen((char *)resource->filename, READBIN);
|
fd_resource = os_fopen((char *)resource->filename, READBIN);
|
||||||
if (fd_resource == NULL) {
|
if (fd_resource == NULL) {
|
||||||
semsg(_("E456: Can't open file \"%s\""), resource->filename);
|
semsg(_("E456: Can't open file \"%s\""), resource->filename);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
switch (resource->type) {
|
switch (resource->type) {
|
||||||
case PRT_RESOURCE_TYPE_PROCSET:
|
case PRT_RESOURCE_TYPE_PROCSET:
|
||||||
@ -2449,7 +2449,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
|
|||||||
(char *)resource->title);
|
(char *)resource->title);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
prt_dsc_textline("BeginDocument", (char *)resource->filename);
|
prt_dsc_textline("BeginDocument", (char *)resource->filename);
|
||||||
@ -2461,7 +2461,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
|
|||||||
semsg(_("E457: Can't read PostScript resource file \"%s\""),
|
semsg(_("E457: Can't read PostScript resource file \"%s\""),
|
||||||
resource->filename);
|
resource->filename);
|
||||||
fclose(fd_resource);
|
fclose(fd_resource);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (bytes_read == 0) {
|
if (bytes_read == 0) {
|
||||||
break;
|
break;
|
||||||
@ -2469,7 +2469,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
|
|||||||
prt_write_file_raw_len(resource_buffer, bytes_read);
|
prt_write_file_raw_len(resource_buffer, bytes_read);
|
||||||
if (prt_file_error) {
|
if (prt_file_error) {
|
||||||
fclose(fd_resource);
|
fclose(fd_resource);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fd_resource);
|
fclose(fd_resource);
|
||||||
@ -2478,10 +2478,10 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
|
|||||||
|
|
||||||
prt_dsc_noarg("EndResource");
|
prt_dsc_noarg("EndResource");
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mch_print_begin(prt_settings_T *psettings)
|
bool mch_print_begin(prt_settings_T *psettings)
|
||||||
{
|
{
|
||||||
int bbox[4];
|
int bbox[4];
|
||||||
double left;
|
double left;
|
||||||
@ -2495,7 +2495,6 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
struct prt_ps_resource_S res_cidfont;
|
struct prt_ps_resource_S res_cidfont;
|
||||||
struct prt_ps_resource_S res_cmap;
|
struct prt_ps_resource_S res_cmap;
|
||||||
int retval = FALSE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PS DSC Header comments - no PS code!
|
* PS DSC Header comments - no PS code!
|
||||||
@ -2567,25 +2566,25 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
// Search for external resources VIM supplies
|
// Search for external resources VIM supplies
|
||||||
if (!prt_find_resource("prolog", &res_prolog)) {
|
if (!prt_find_resource("prolog", &res_prolog)) {
|
||||||
emsg(_("E456: Can't find PostScript resource file \"prolog.ps\""));
|
emsg(_("E456: Can't find PostScript resource file \"prolog.ps\""));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prt_open_resource(&res_prolog)) {
|
if (!prt_open_resource(&res_prolog)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prt_check_resource(&res_prolog, PRT_PROLOG_VERSION)) {
|
if (!prt_check_resource(&res_prolog, PRT_PROLOG_VERSION)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (prt_out_mbyte) {
|
if (prt_out_mbyte) {
|
||||||
// Look for required version of multi-byte printing procset
|
// Look for required version of multi-byte printing procset
|
||||||
if (!prt_find_resource("cidfont", &res_cidfont)) {
|
if (!prt_find_resource("cidfont", &res_cidfont)) {
|
||||||
emsg(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
|
emsg(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prt_open_resource(&res_cidfont)) {
|
if (!prt_open_resource(&res_cidfont)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prt_check_resource(&res_cidfont, PRT_CID_PROLOG_VERSION)) {
|
if (!prt_check_resource(&res_cidfont, PRT_CID_PROLOG_VERSION)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2610,12 +2609,12 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
if (!prt_find_resource(p_encoding, &res_encoding)) {
|
if (!prt_find_resource(p_encoding, &res_encoding)) {
|
||||||
semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
|
semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
|
||||||
p_encoding);
|
p_encoding);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!prt_open_resource(&res_encoding)) {
|
if (!prt_open_resource(&res_encoding)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
// For the moment there are no checks on encoding resource files to
|
// For the moment there are no checks on encoding resource files to
|
||||||
// perform
|
// perform
|
||||||
@ -2629,10 +2628,10 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
if (!prt_find_resource(prt_ascii_encoding, &res_encoding)) {
|
if (!prt_find_resource(prt_ascii_encoding, &res_encoding)) {
|
||||||
semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
|
semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
|
||||||
prt_ascii_encoding);
|
prt_ascii_encoding);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prt_open_resource(&res_encoding)) {
|
if (!prt_open_resource(&res_encoding)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
// For the moment there are no checks on encoding resource files to
|
// For the moment there are no checks on encoding resource files to
|
||||||
// perform
|
// perform
|
||||||
@ -2655,10 +2654,10 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
if (!prt_find_resource(prt_cmap, &res_cmap)) {
|
if (!prt_find_resource(prt_cmap, &res_cmap)) {
|
||||||
semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
|
semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
|
||||||
prt_cmap);
|
prt_cmap);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (!prt_open_resource(&res_cmap)) {
|
if (!prt_open_resource(&res_cmap)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2736,7 +2735,7 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
// There will be only one Roman font encoding to be included in the PS
|
// There will be only one Roman font encoding to be included in the PS
|
||||||
// file.
|
// file.
|
||||||
if (!prt_add_resource(&res_encoding)) {
|
if (!prt_add_resource(&res_encoding)) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2846,9 +2845,7 @@ int mch_print_begin(prt_settings_T *psettings)
|
|||||||
prt_dsc_noarg("EndSetup");
|
prt_dsc_noarg("EndSetup");
|
||||||
|
|
||||||
// Fail if any problems writing out to the PS file
|
// Fail if any problems writing out to the PS file
|
||||||
retval = !prt_file_error;
|
return !prt_file_error;
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mch_print_end(prt_settings_T *psettings)
|
void mch_print_end(prt_settings_T *psettings)
|
||||||
|
@ -223,9 +223,9 @@ void ex_cstag(exarg_T *eap)
|
|||||||
switch (p_csto) {
|
switch (p_csto) {
|
||||||
case 0:
|
case 0:
|
||||||
if (cs_check_for_connections()) {
|
if (cs_check_for_connections()) {
|
||||||
ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE,
|
ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, false,
|
||||||
FALSE, *eap->cmdlinep);
|
false, *eap->cmdlinep);
|
||||||
if (ret == FALSE) {
|
if (ret == false) {
|
||||||
cs_free_tags();
|
cs_free_tags();
|
||||||
if (msg_col) {
|
if (msg_col) {
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
@ -249,16 +249,16 @@ void ex_cstag(exarg_T *eap)
|
|||||||
|
|
||||||
if (cs_check_for_connections()) {
|
if (cs_check_for_connections()) {
|
||||||
ret = cs_find_common("g", (char *)(eap->arg), eap->forceit,
|
ret = cs_find_common("g", (char *)(eap->arg), eap->forceit,
|
||||||
FALSE, FALSE, *eap->cmdlinep);
|
false, false, *eap->cmdlinep);
|
||||||
if (ret == FALSE) {
|
if (ret == false) {
|
||||||
cs_free_tags();
|
cs_free_tags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cs_check_for_connections()) {
|
} else if (cs_check_for_connections()) {
|
||||||
ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE,
|
ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, false,
|
||||||
FALSE, *eap->cmdlinep);
|
false, *eap->cmdlinep);
|
||||||
if (ret == FALSE) {
|
if (ret == false) {
|
||||||
cs_free_tags();
|
cs_free_tags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ add_err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int cs_check_for_connections(void)
|
static bool cs_check_for_connections(void)
|
||||||
{
|
{
|
||||||
return cs_cnt_connections() > 0;
|
return cs_cnt_connections() > 0;
|
||||||
}
|
}
|
||||||
@ -887,20 +887,20 @@ static int cs_find(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
char *opt, *pat;
|
char *opt, *pat;
|
||||||
|
|
||||||
if (cs_check_for_connections() == FALSE) {
|
if (cs_check_for_connections() == false) {
|
||||||
(void)emsg(_("E567: no cscope connections"));
|
(void)emsg(_("E567: no cscope connections"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((opt = strtok((char *)NULL, (const char *)" ")) == NULL) {
|
if ((opt = strtok((char *)NULL, (const char *)" ")) == NULL) {
|
||||||
cs_usage_msg(Find);
|
cs_usage_msg(Find);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pat = opt + strlen(opt) + 1;
|
pat = opt + strlen(opt) + 1;
|
||||||
if (pat >= (char *)eap->arg + eap_arg_len) {
|
if (pat >= (char *)eap->arg + eap_arg_len) {
|
||||||
cs_usage_msg(Find);
|
cs_usage_msg(Find);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -919,8 +919,8 @@ static int cs_find(exarg_T *eap)
|
|||||||
|
|
||||||
|
|
||||||
/// Common code for cscope find, shared by cs_find() and ex_cstag().
|
/// Common code for cscope find, shared by cs_find() and ex_cstag().
|
||||||
static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int use_ll,
|
static bool cs_find_common(char *opt, char *pat, int forceit, int verbose,
|
||||||
char_u *cmdline)
|
bool use_ll, char_u *cmdline)
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int *nummatches;
|
int *nummatches;
|
||||||
@ -967,7 +967,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
|
|||||||
// next symbol must be + or -
|
// next symbol must be + or -
|
||||||
if (strchr(CSQF_FLAGS, *qfpos) == NULL) {
|
if (strchr(CSQF_FLAGS, *qfpos) == NULL) {
|
||||||
(void)semsg(_("E469: invalid cscopequickfix flag %c for %c"), *qfpos, *(qfpos - 1));
|
(void)semsg(_("E469: invalid cscopequickfix flag %c for %c"), *qfpos, *(qfpos - 1));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*qfpos != '0'
|
if (*qfpos != '0'
|
||||||
@ -982,7 +982,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
|
|||||||
// create the actual command to send to cscope
|
// create the actual command to send to cscope
|
||||||
cmd = cs_create_cmd(opt, pat);
|
cmd = cs_create_cmd(opt, pat);
|
||||||
if (cmd == NULL) {
|
if (cmd == NULL) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nummatches = xmalloc(sizeof(int) * csinfo_size);
|
nummatches = xmalloc(sizeof(int) * csinfo_size);
|
||||||
@ -1019,7 +1019,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
|
|||||||
(void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat);
|
(void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat);
|
||||||
}
|
}
|
||||||
xfree(nummatches);
|
xfree(nummatches);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qfpos != NULL && *qfpos != '0') {
|
if (qfpos != NULL && *qfpos != '0') {
|
||||||
@ -1064,7 +1064,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
|
|||||||
os_remove((char *)tmp);
|
os_remove((char *)tmp);
|
||||||
xfree(tmp);
|
xfree(tmp);
|
||||||
xfree(nummatches);
|
xfree(nummatches);
|
||||||
return TRUE;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
char **matches = NULL, **contexts = NULL;
|
char **matches = NULL, **contexts = NULL;
|
||||||
size_t matched = 0;
|
size_t matched = 0;
|
||||||
@ -1073,7 +1073,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
|
|||||||
cs_fill_results(pat, totmatches, nummatches, &matches, &contexts, &matched);
|
cs_fill_results(pat, totmatches, nummatches, &matches, &contexts, &matched);
|
||||||
xfree(nummatches);
|
xfree(nummatches);
|
||||||
if (matches == NULL) {
|
if (matches == NULL) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)cs_manage_matches(matches, contexts, matched, Store);
|
(void)cs_manage_matches(matches, contexts, matched, Store);
|
||||||
@ -1499,12 +1499,13 @@ static void cs_file_results(FILE *f, int *nummatches_a)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = xmalloc(strlen(cntx) + 5);
|
size_t context_len = strlen(cntx) + 5;
|
||||||
|
context = xmalloc(context_len);
|
||||||
|
|
||||||
if (strcmp(cntx, "<global>") == 0) {
|
if (strcmp(cntx, "<global>") == 0) {
|
||||||
strcpy(context, "<<global>>");
|
xstrlcpy(context, "<<global>>", context_len);
|
||||||
} else {
|
} else {
|
||||||
sprintf(context, "<<%s>>", cntx);
|
snprintf(context, context_len, "<<%s>>", cntx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search == NULL) {
|
if (search == NULL) {
|
||||||
|
@ -839,13 +839,11 @@ void msg_schedule_semsg(const char *const fmt, ...)
|
|||||||
multiqueue_put(main_loop.events, msg_semsg_event, 1, s);
|
multiqueue_put(main_loop.events, msg_semsg_event, 1, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Like msg(), but truncate to a single line if p_shm contains 't', or when
|
||||||
* Like msg(), but truncate to a single line if p_shm contains 't', or when
|
// "force" is true. This truncates in another way as for normal messages.
|
||||||
* "force" is TRUE. This truncates in another way as for normal messages.
|
// Careful: The string may be changed by msg_may_trunc()!
|
||||||
* Careful: The string may be changed by msg_may_trunc()!
|
// Returns a pointer to the printed message, if wait_return() not called.
|
||||||
* Returns a pointer to the printed message, if wait_return() not called.
|
char *msg_trunc_attr(char *s, bool force, int attr)
|
||||||
*/
|
|
||||||
char *msg_trunc_attr(char *s, int force, int attr)
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -869,7 +867,7 @@ char *msg_trunc_attr(char *s, int force, int attr)
|
|||||||
* Return a pointer to where the truncated message starts.
|
* Return a pointer to where the truncated message starts.
|
||||||
* Note: May change the message by replacing a character with '<'.
|
* Note: May change the message by replacing a character with '<'.
|
||||||
*/
|
*/
|
||||||
char_u *msg_may_trunc(int force, char_u *s)
|
char_u *msg_may_trunc(bool force, char_u *s)
|
||||||
{
|
{
|
||||||
int room;
|
int room;
|
||||||
|
|
||||||
|
@ -1760,13 +1760,14 @@ static char_u *regpiece(int *flagp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (re_multi_type(peekchr()) != NOT_MULTI) {
|
if (re_multi_type(peekchr()) != NOT_MULTI) {
|
||||||
/* Can't have a multi follow a multi. */
|
// Can't have a multi follow a multi.
|
||||||
if (peekchr() == Magic('*'))
|
if (peekchr() == Magic('*')) {
|
||||||
sprintf((char *)IObuff, _("E61: Nested %s*"),
|
snprintf((char *)IObuff, IOSIZE, _("E61: Nested %s*"),
|
||||||
reg_magic >= MAGIC_ON ? "" : "\\");
|
reg_magic >= MAGIC_ON ? "" : "\\");
|
||||||
else
|
} else {
|
||||||
sprintf((char *)IObuff, _("E62: Nested %s%c"),
|
snprintf((char *)IObuff, IOSIZE, _("E62: Nested %s%c"),
|
||||||
reg_magic == MAGIC_ALL ? "" : "\\", no_Magic(peekchr()));
|
reg_magic == MAGIC_ALL ? "" : "\\", no_Magic(peekchr()));
|
||||||
|
}
|
||||||
EMSG_RET_NULL((char *)IObuff);
|
EMSG_RET_NULL((char *)IObuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1926,11 +1927,11 @@ static char_u *regatom(int *flagp)
|
|||||||
case Magic('{'):
|
case Magic('{'):
|
||||||
case Magic('*'):
|
case Magic('*'):
|
||||||
c = no_Magic(c);
|
c = no_Magic(c);
|
||||||
sprintf((char *)IObuff, _("E64: %s%c follows nothing"),
|
snprintf((char *)IObuff, IOSIZE, _("E64: %s%c follows nothing"),
|
||||||
(c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL)
|
(c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL)
|
||||||
? "" : "\\", c);
|
? "" : "\\", c);
|
||||||
EMSG_RET_NULL((char *)IObuff);
|
EMSG_RET_NULL((char *)IObuff);
|
||||||
/* NOTREACHED */
|
// NOTREACHED
|
||||||
|
|
||||||
case Magic('~'): /* previous substitute pattern */
|
case Magic('~'): /* previous substitute pattern */
|
||||||
if (reg_prev_sub != NULL) {
|
if (reg_prev_sub != NULL) {
|
||||||
@ -3152,8 +3153,8 @@ static int read_limits(long *minval, long *maxval)
|
|||||||
regparse++; // Allow either \{...} or \{...\}
|
regparse++; // Allow either \{...} or \{...\}
|
||||||
}
|
}
|
||||||
if (*regparse != '}') {
|
if (*regparse != '}') {
|
||||||
sprintf((char *)IObuff, _("E554: Syntax error in %s{...}"),
|
snprintf((char *)IObuff, IOSIZE, _("E554: Syntax error in %s{...}"),
|
||||||
reg_magic == MAGIC_ALL ? "" : "\\");
|
reg_magic == MAGIC_ALL ? "" : "\\");
|
||||||
EMSG_RET_FAIL((char *)IObuff);
|
EMSG_RET_FAIL((char *)IObuff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7263,9 +7264,10 @@ regprog_T *vim_regcomp(char_u *expr_arg, int re_flags)
|
|||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "Syntax error in \"%s\"\n", expr);
|
fprintf(f, "Syntax error in \"%s\"\n", expr);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
} else
|
} else {
|
||||||
semsg("(NFA) Could not open \"%s\" to write !!!",
|
semsg("(NFA) Could not open \"%s\" to write !!!",
|
||||||
BT_REGEXP_DEBUG_LOG_NAME);
|
BT_REGEXP_DEBUG_LOG_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// If the NFA engine failed, try the backtracking engine. The NFA engine
|
// If the NFA engine failed, try the backtracking engine. The NFA engine
|
||||||
|
@ -141,12 +141,12 @@ static int tfu_in_use = false; // disallow recursive call of tagfunc
|
|||||||
/// type == DT_LTAG: use location list for displaying tag matches
|
/// type == DT_LTAG: use location list for displaying tag matches
|
||||||
/// type == DT_FREE: free cached matches
|
/// type == DT_FREE: free cached matches
|
||||||
///
|
///
|
||||||
/// for cscope, returns TRUE if we jumped to tag or aborted, FALSE otherwise
|
/// for cscope, returns true if we jumped to tag or aborted, false otherwise
|
||||||
///
|
///
|
||||||
/// @param tag tag (pattern) to jump to
|
/// @param tag tag (pattern) to jump to
|
||||||
/// @param forceit :ta with !
|
/// @param forceit :ta with !
|
||||||
/// @param verbose print "tag not found" message
|
/// @param verbose print "tag not found" message
|
||||||
int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
|
bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
|
||||||
{
|
{
|
||||||
taggy_T *tagstack = curwin->w_tagstack;
|
taggy_T *tagstack = curwin->w_tagstack;
|
||||||
int tagstackidx = curwin->w_tagstackidx;
|
int tagstackidx = curwin->w_tagstackidx;
|
||||||
@ -163,7 +163,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
|
|||||||
int error_cur_match = 0;
|
int error_cur_match = 0;
|
||||||
int save_pos = false;
|
int save_pos = false;
|
||||||
fmark_T saved_fmark;
|
fmark_T saved_fmark;
|
||||||
int jumped_to_tag = false;
|
bool jumped_to_tag = false;
|
||||||
int new_num_matches;
|
int new_num_matches;
|
||||||
char_u **new_matches;
|
char_u **new_matches;
|
||||||
int use_tagstack;
|
int use_tagstack;
|
||||||
|
Loading…
Reference in New Issue
Block a user