0
0
mirror of https://github.com/vim/vim.git synced 2025-08-29 20:33:37 -04:00

patch 8.1.2379: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
This commit is contained in:
Bram Moolenaar 2019-12-01 21:41:28 +01:00
parent 5d18efecfd
commit 217e1b8359
10 changed files with 2687 additions and 2705 deletions

File diff suppressed because it is too large Load Diff

View File

@ -89,7 +89,7 @@ create_timer(long msec, int repeat)
if (timer == NULL) if (timer == NULL)
return NULL; return NULL;
if (++last_timer_id <= prev_id) if (++last_timer_id <= prev_id)
/* Overflow! Might cause duplicates... */ // Overflow! Might cause duplicates...
last_timer_id = 0; last_timer_id = 0;
timer->tr_id = last_timer_id; timer->tr_id = last_timer_id;
insert_timer(timer); insert_timer(timer);
@ -135,7 +135,7 @@ check_due_timer(void)
int need_update_screen = FALSE; int need_update_screen = FALSE;
long current_id = last_timer_id; long current_id = last_timer_id;
/* Don't run any timers while exiting or dealing with an error. */ // Don't run any timers while exiting or dealing with an error.
if (exiting || aborting()) if (exiting || aborting())
return next_due; return next_due;
@ -149,8 +149,8 @@ check_due_timer(void)
this_due = proftime_time_left(&timer->tr_due, &now); this_due = proftime_time_left(&timer->tr_due, &now);
if (this_due <= 1) if (this_due <= 1)
{ {
/* Save and restore a lot of flags, because the timer fires while // Save and restore a lot of flags, because the timer fires while
* waiting for a character, which might be halfway a command. */ // waiting for a character, which might be halfway a command.
int save_timer_busy = timer_busy; int save_timer_busy = timer_busy;
int save_vgetc_busy = vgetc_busy; int save_vgetc_busy = vgetc_busy;
int save_did_emsg = did_emsg; int save_did_emsg = did_emsg;
@ -163,8 +163,8 @@ check_due_timer(void)
except_T *save_current_exception = current_exception; except_T *save_current_exception = current_exception;
vimvars_save_T vvsave; vimvars_save_T vvsave;
/* Create a scope for running the timer callback, ignoring most of // Create a scope for running the timer callback, ignoring most of
* the current scope, such as being inside a try/catch. */ // the current scope, such as being inside a try/catch.
timer_busy = timer_busy > 0 || vgetc_busy > 0; timer_busy = timer_busy > 0 || vgetc_busy > 0;
vgetc_busy = 0; vgetc_busy = 0;
called_emsg = FALSE; called_emsg = FALSE;
@ -200,8 +200,8 @@ check_due_timer(void)
set_pressedreturn(save_ex_pressedreturn); set_pressedreturn(save_ex_pressedreturn);
may_garbage_collect = save_may_garbage_collect; may_garbage_collect = save_may_garbage_collect;
/* Only fire the timer again if it repeats and stop_timer() wasn't // Only fire the timer again if it repeats and stop_timer() wasn't
* called while inside the callback (tr_id == -1). */ // called while inside the callback (tr_id == -1).
if (timer->tr_repeat != 0 && timer->tr_id != -1 if (timer->tr_repeat != 0 && timer->tr_id != -1
&& timer->tr_emsg_count < 3) && timer->tr_emsg_count < 3)
{ {
@ -250,7 +250,7 @@ check_due_timer(void)
} }
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
/* Some terminal windows may need their buffer updated. */ // Some terminal windows may need their buffer updated.
next_due = term_check_timers(next_due, &now); next_due = term_check_timers(next_due, &now);
#endif #endif
@ -282,7 +282,7 @@ find_timer(long id)
stop_timer(timer_T *timer) stop_timer(timer_T *timer)
{ {
if (timer->tr_firing) if (timer->tr_firing)
/* Free the timer after the callback returns. */ // Free the timer after the callback returns.
timer->tr_id = -1; timer->tr_id = -1;
else else
{ {
@ -520,7 +520,7 @@ autowrite(buf_T *buf, int forceit)
if (!(p_aw || p_awa) || !p_write if (!(p_aw || p_awa) || !p_write
#ifdef FEAT_QUICKFIX #ifdef FEAT_QUICKFIX
/* never autowrite a "nofile" or "nowrite" buffer */ // never autowrite a "nofile" or "nowrite" buffer
|| bt_dontwrite(buf) || bt_dontwrite(buf)
#endif #endif
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL) || (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
@ -528,8 +528,8 @@ autowrite(buf_T *buf, int forceit)
set_bufref(&bufref, buf); set_bufref(&bufref, buf);
r = buf_write_all(buf, forceit); r = buf_write_all(buf, forceit);
/* Writing may succeed but the buffer still changed, e.g., when there is a // Writing may succeed but the buffer still changed, e.g., when there is a
* conversion error. We do want to return FAIL then. */ // conversion error. We do want to return FAIL then.
if (bufref_valid(&bufref) && bufIsChanged(buf)) if (bufref_valid(&bufref) && bufIsChanged(buf))
r = FAIL; r = FAIL;
return r; return r;
@ -554,7 +554,7 @@ autowrite_all(void)
(void)buf_write_all(buf, FALSE); (void)buf_write_all(buf, FALSE);
/* an autocommand may have deleted the buffer */ // an autocommand may have deleted the buffer
if (!bufref_valid(&bufref)) if (!bufref_valid(&bufref))
buf = firstbuf; buf = firstbuf;
} }
@ -593,13 +593,13 @@ check_changed(buf_T *buf, int flags)
)) ))
++count; ++count;
if (!bufref_valid(&bufref)) if (!bufref_valid(&bufref))
/* Autocommand deleted buffer, oops! It's not changed now. */ // Autocommand deleted buffer, oops! It's not changed now.
return FALSE; return FALSE;
dialog_changed(buf, count > 1); dialog_changed(buf, count > 1);
if (!bufref_valid(&bufref)) if (!bufref_valid(&bufref))
/* Autocommand deleted buffer, oops! It's not changed now. */ // Autocommand deleted buffer, oops! It's not changed now.
return FALSE; return FALSE;
return bufIsChanged(buf); return bufIsChanged(buf);
} }
@ -645,7 +645,7 @@ browse_save_fname(buf_T *buf)
void void
dialog_changed( dialog_changed(
buf_T *buf, buf_T *buf,
int checkall) /* may abandon all changed buffers */ int checkall) // may abandon all changed buffers
{ {
char_u buff[DIALOG_MSG_SIZE]; char_u buff[DIALOG_MSG_SIZE];
int ret; int ret;
@ -665,12 +665,12 @@ dialog_changed(
if (ret == VIM_YES) if (ret == VIM_YES)
{ {
#ifdef FEAT_BROWSE #ifdef FEAT_BROWSE
/* May get file name, when there is none */ // May get file name, when there is none
browse_save_fname(buf); browse_save_fname(buf);
#endif #endif
if (buf->b_fname != NULL && check_overwrite(&ea, buf, if (buf->b_fname != NULL && check_overwrite(&ea, buf,
buf->b_fname, buf->b_ffname, FALSE) == OK) buf->b_fname, buf->b_ffname, FALSE) == OK)
/* didn't hit Cancel */ // didn't hit Cancel
(void)buf_write_all(buf, FALSE); (void)buf_write_all(buf, FALSE);
} }
else if (ret == VIM_NO) else if (ret == VIM_NO)
@ -698,15 +698,15 @@ dialog_changed(
set_bufref(&bufref, buf2); set_bufref(&bufref, buf2);
#ifdef FEAT_BROWSE #ifdef FEAT_BROWSE
/* May get file name, when there is none */ // May get file name, when there is none
browse_save_fname(buf2); browse_save_fname(buf2);
#endif #endif
if (buf2->b_fname != NULL && check_overwrite(&ea, buf2, if (buf2->b_fname != NULL && check_overwrite(&ea, buf2,
buf2->b_fname, buf2->b_ffname, FALSE) == OK) buf2->b_fname, buf2->b_ffname, FALSE) == OK)
/* didn't hit Cancel */ // didn't hit Cancel
(void)buf_write_all(buf2, FALSE); (void)buf_write_all(buf2, FALSE);
/* an autocommand may have deleted the buffer */ // an autocommand may have deleted the buffer
if (!bufref_valid(&bufref)) if (!bufref_valid(&bufref))
buf2 = firstbuf; buf2 = firstbuf;
} }
@ -760,7 +760,7 @@ add_bufnum(int *bufnrs, int *bufnump, int nr)
*/ */
int int
check_changed_any( check_changed_any(
int hidden, /* Only check hidden buffers */ int hidden, // Only check hidden buffers
int unload) int unload)
{ {
int ret = FALSE; int ret = FALSE;
@ -773,7 +773,7 @@ check_changed_any(
tabpage_T *tp; tabpage_T *tp;
win_T *wp; win_T *wp;
/* Make a list of all buffers, with the most important ones first. */ // Make a list of all buffers, with the most important ones first.
FOR_ALL_BUFFERS(buf) FOR_ALL_BUFFERS(buf)
++bufcount; ++bufcount;
@ -784,21 +784,21 @@ check_changed_any(
if (bufnrs == NULL) if (bufnrs == NULL)
return FALSE; return FALSE;
/* curbuf */ // curbuf
bufnrs[bufnum++] = curbuf->b_fnum; bufnrs[bufnum++] = curbuf->b_fnum;
/* buffers in current tab */ // buffers in current tab
FOR_ALL_WINDOWS(wp) FOR_ALL_WINDOWS(wp)
if (wp->w_buffer != curbuf) if (wp->w_buffer != curbuf)
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
/* buffers in other tabs */ // buffers in other tabs
FOR_ALL_TABPAGES(tp) FOR_ALL_TABPAGES(tp)
if (tp != curtab) if (tp != curtab)
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
/* any other buffer */ // any other buffer
FOR_ALL_BUFFERS(buf) FOR_ALL_BUFFERS(buf)
add_bufnum(bufnrs, &bufnum, buf->b_fnum); add_bufnum(bufnrs, &bufnum, buf->b_fnum);
@ -820,19 +820,19 @@ check_changed_any(
} }
else else
#endif #endif
/* Try auto-writing the buffer. If this fails but the buffer no // Try auto-writing the buffer. If this fails but the buffer no
* longer exists it's not changed, that's OK. */ // longer exists it's not changed, that's OK.
if (check_changed(buf, (p_awa ? CCGD_AW : 0) if (check_changed(buf, (p_awa ? CCGD_AW : 0)
| CCGD_MULTWIN | CCGD_MULTWIN
| CCGD_ALLBUF) && bufref_valid(&bufref)) | CCGD_ALLBUF) && bufref_valid(&bufref))
break; /* didn't save - still changes */ break; // didn't save - still changes
} }
} }
if (i >= bufnum) if (i >= bufnum)
goto theend; goto theend;
/* Get here if "buf" cannot be abandoned. */ // Get here if "buf" cannot be abandoned.
ret = TRUE; ret = TRUE;
exiting = FALSE; exiting = FALSE;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
@ -842,10 +842,10 @@ check_changed_any(
if (!(p_confirm || cmdmod.confirm)) if (!(p_confirm || cmdmod.confirm))
#endif #endif
{ {
/* There must be a wait_return for this message, do_buffer() // There must be a wait_return for this message, do_buffer()
* may cause a redraw. But wait_return() is a no-op when vgetc() // may cause a redraw. But wait_return() is a no-op when vgetc()
* is busy (Quit used from window menu), then make sure we don't // is busy (Quit used from window menu), then make sure we don't
* cause a scroll up. */ // cause a scroll up.
if (vgetc_busy > 0) if (vgetc_busy > 0)
{ {
msg_row = cmdline_row; msg_row = cmdline_row;
@ -869,7 +869,7 @@ check_changed_any(
} }
} }
/* Try to find a window that contains the buffer. */ // Try to find a window that contains the buffer.
if (buf != curbuf) if (buf != curbuf)
FOR_ALL_TAB_WINDOWS(tp, wp) FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_buffer == buf) if (wp->w_buffer == buf)
@ -887,7 +887,7 @@ check_changed_any(
} }
buf_found: buf_found:
/* Open the changed buffer in the current window. */ // Open the changed buffer in the current window.
if (buf != curbuf) if (buf != curbuf)
set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO); set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO);
@ -965,8 +965,8 @@ ex_listdo(exarg_T *eap)
#if defined(FEAT_SYN_HL) #if defined(FEAT_SYN_HL)
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo) if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
{ {
/* Don't do syntax HL autocommands. Skipping the syntax file is a // Don't do syntax HL autocommands. Skipping the syntax file is a
* great speed improvement. */ // great speed improvement.
save_ei = au_event_disable(",Syntax"); save_ei = au_event_disable(",Syntax");
for (buf = firstbuf; buf != NULL; buf = buf->b_next) for (buf = firstbuf; buf != NULL; buf = buf->b_next)
@ -986,7 +986,7 @@ ex_listdo(exarg_T *eap)
| CCGD_EXCMD)) | CCGD_EXCMD))
{ {
i = 0; i = 0;
/* start at the eap->line1 argument/window/buffer */ // start at the eap->line1 argument/window/buffer
wp = firstwin; wp = firstwin;
tp = first_tabpage; tp = first_tabpage;
switch (eap->cmdidx) switch (eap->cmdidx)
@ -1005,10 +1005,10 @@ ex_listdo(exarg_T *eap)
default: default:
break; break;
} }
/* set pcmark now */ // set pcmark now
if (eap->cmdidx == CMD_bufdo) if (eap->cmdidx == CMD_bufdo)
{ {
/* Advance to the first listed buffer after "eap->line1". */ // Advance to the first listed buffer after "eap->line1".
for (buf = firstbuf; buf != NULL && (buf->b_fnum < eap->line1 for (buf = firstbuf; buf != NULL && (buf->b_fnum < eap->line1
|| !buf->b_p_bl); buf = buf->b_next) || !buf->b_p_bl); buf = buf->b_next)
if (buf->b_fnum > eap->line2) if (buf->b_fnum > eap->line2)
@ -1033,28 +1033,28 @@ ex_listdo(exarg_T *eap)
buf = curbuf; buf = curbuf;
i = eap->line1 - 1; i = eap->line1 - 1;
if (eap->addr_count <= 0) if (eap->addr_count <= 0)
/* default is all the quickfix/location list entries */ // default is all the quickfix/location list entries
eap->line2 = qf_size; eap->line2 = qf_size;
} }
} }
#endif #endif
else else
setpcmark(); setpcmark();
listcmd_busy = TRUE; /* avoids setting pcmark below */ listcmd_busy = TRUE; // avoids setting pcmark below
while (!got_int && buf != NULL) while (!got_int && buf != NULL)
{ {
if (eap->cmdidx == CMD_argdo) if (eap->cmdidx == CMD_argdo)
{ {
/* go to argument "i" */ // go to argument "i"
if (i == ARGCOUNT) if (i == ARGCOUNT)
break; break;
/* Don't call do_argfile() when already there, it will try // Don't call do_argfile() when already there, it will try
* reloading the file. */ // reloading the file.
if (curwin->w_arg_idx != i || !editing_arg_idx(curwin)) if (curwin->w_arg_idx != i || !editing_arg_idx(curwin))
{ {
/* Clear 'shm' to avoid that the file message overwrites // Clear 'shm' to avoid that the file message overwrites
* any output from the command. */ // any output from the command.
p_shm_save = vim_strsave(p_shm); p_shm_save = vim_strsave(p_shm);
set_option_value((char_u *)"shm", 0L, (char_u *)"", 0); set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
do_argfile(eap, i); do_argfile(eap, i);
@ -1066,17 +1066,17 @@ ex_listdo(exarg_T *eap)
} }
else if (eap->cmdidx == CMD_windo) else if (eap->cmdidx == CMD_windo)
{ {
/* go to window "wp" */ // go to window "wp"
if (!win_valid(wp)) if (!win_valid(wp))
break; break;
win_goto(wp); win_goto(wp);
if (curwin != wp) if (curwin != wp)
break; /* something must be wrong */ break; // something must be wrong
wp = curwin->w_next; wp = curwin->w_next;
} }
else if (eap->cmdidx == CMD_tabdo) else if (eap->cmdidx == CMD_tabdo)
{ {
/* go to window "tp" */ // go to window "tp"
if (!valid_tabpage(tp)) if (!valid_tabpage(tp))
break; break;
goto_tabpage_tp(tp, TRUE, TRUE); goto_tabpage_tp(tp, TRUE, TRUE);
@ -1084,8 +1084,8 @@ ex_listdo(exarg_T *eap)
} }
else if (eap->cmdidx == CMD_bufdo) else if (eap->cmdidx == CMD_bufdo)
{ {
/* Remember the number of the next listed buffer, in case // Remember the number of the next listed buffer, in case
* ":bwipe" is used or autocommands do something strange. */ // ":bwipe" is used or autocommands do something strange.
next_fnum = -1; next_fnum = -1;
for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next) for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next)
if (buf->b_p_bl) if (buf->b_p_bl)
@ -1097,31 +1097,31 @@ ex_listdo(exarg_T *eap)
++i; ++i;
/* execute the command */ // execute the command
do_cmdline(eap->arg, eap->getline, eap->cookie, do_cmdline(eap->arg, eap->getline, eap->cookie,
DOCMD_VERBOSE + DOCMD_NOWAIT); DOCMD_VERBOSE + DOCMD_NOWAIT);
if (eap->cmdidx == CMD_bufdo) if (eap->cmdidx == CMD_bufdo)
{ {
/* Done? */ // Done?
if (next_fnum < 0 || next_fnum > eap->line2) if (next_fnum < 0 || next_fnum > eap->line2)
break; break;
/* Check if the buffer still exists. */ // Check if the buffer still exists.
FOR_ALL_BUFFERS(buf) FOR_ALL_BUFFERS(buf)
if (buf->b_fnum == next_fnum) if (buf->b_fnum == next_fnum)
break; break;
if (buf == NULL) if (buf == NULL)
break; break;
/* Go to the next buffer. Clear 'shm' to avoid that the file // Go to the next buffer. Clear 'shm' to avoid that the file
* message overwrites any output from the command. */ // message overwrites any output from the command.
p_shm_save = vim_strsave(p_shm); p_shm_save = vim_strsave(p_shm);
set_option_value((char_u *)"shm", 0L, (char_u *)"", 0); set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum); goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
set_option_value((char_u *)"shm", 0L, p_shm_save, 0); set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
vim_free(p_shm_save); vim_free(p_shm_save);
/* If autocommands took us elsewhere, quit here. */ // If autocommands took us elsewhere, quit here.
if (curbuf->b_fnum != next_fnum) if (curbuf->b_fnum != next_fnum)
break; break;
} }
@ -1137,7 +1137,7 @@ ex_listdo(exarg_T *eap)
ex_cnext(eap); ex_cnext(eap);
/* If jumping to the next quickfix entry fails, quit here */ // If jumping to the next quickfix entry fails, quit here
if (qf_get_cur_idx(eap) == qf_idx) if (qf_get_cur_idx(eap) == qf_idx)
break; break;
} }
@ -1145,9 +1145,9 @@ ex_listdo(exarg_T *eap)
if (eap->cmdidx == CMD_windo) if (eap->cmdidx == CMD_windo)
{ {
validate_cursor(); /* cursor may have moved */ validate_cursor(); // cursor may have moved
/* required when 'scrollbind' has been set */ // required when 'scrollbind' has been set
if (curwin->w_p_scb) if (curwin->w_p_scb)
do_check_scrollbind(TRUE); do_check_scrollbind(TRUE);
} }
@ -1213,9 +1213,9 @@ ex_compiler(exarg_T *eap)
if (*eap->arg == NUL) if (*eap->arg == NUL)
{ {
/* List all compiler scripts. */ // List all compiler scripts.
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
/* ) keep the indenter happy... */ // ) keep the indenter happy...
} }
else else
{ {
@ -1224,18 +1224,18 @@ ex_compiler(exarg_T *eap)
{ {
if (eap->forceit) if (eap->forceit)
{ {
/* ":compiler! {name}" sets global options */ // ":compiler! {name}" sets global options
do_cmdline_cmd((char_u *) do_cmdline_cmd((char_u *)
"command -nargs=* CompilerSet set <args>"); "command -nargs=* CompilerSet set <args>");
} }
else else
{ {
/* ":compiler! {name}" sets local options. // ":compiler! {name}" sets local options.
* To remain backwards compatible "current_compiler" is always // To remain backwards compatible "current_compiler" is always
* used. A user's compiler plugin may set it, the distributed // used. A user's compiler plugin may set it, the distributed
* plugin will then skip the settings. Afterwards set // plugin will then skip the settings. Afterwards set
* "b:current_compiler" and restore "current_compiler". // "b:current_compiler" and restore "current_compiler".
* Explicitly prepend "g:" to make it work in a function. */ // Explicitly prepend "g:" to make it work in a function.
old_cur_comp = get_var_value((char_u *)"g:current_compiler"); old_cur_comp = get_var_value((char_u *)"g:current_compiler");
if (old_cur_comp != NULL) if (old_cur_comp != NULL)
old_cur_comp = vim_strsave(old_cur_comp); old_cur_comp = vim_strsave(old_cur_comp);
@ -1252,12 +1252,12 @@ ex_compiler(exarg_T *eap)
do_cmdline_cmd((char_u *)":delcommand CompilerSet"); do_cmdline_cmd((char_u *)":delcommand CompilerSet");
/* Set "b:current_compiler" from "current_compiler". */ // Set "b:current_compiler" from "current_compiler".
p = get_var_value((char_u *)"g:current_compiler"); p = get_var_value((char_u *)"g:current_compiler");
if (p != NULL) if (p != NULL)
set_internal_string_var((char_u *)"b:current_compiler", p); set_internal_string_var((char_u *)"b:current_compiler", p);
/* Restore "current_compiler" for ":compiler {name}". */ // Restore "current_compiler" for ":compiler {name}".
if (!eap->forceit) if (!eap->forceit)
{ {
if (old_cur_comp != NULL) if (old_cur_comp != NULL)
@ -1322,7 +1322,7 @@ requires_py_version(char_u *filename)
break; break;
if (i == 0 && IObuff[0] == '#' && IObuff[1] == '!') if (i == 0 && IObuff[0] == '#' && IObuff[1] == '!')
{ {
/* Check shebang. */ // Check shebang.
if (strstr((char *)IObuff + 2, "python2") != NULL) if (strstr((char *)IObuff + 2, "python2") != NULL)
{ {
requires_py_version = 2; requires_py_version = 2;
@ -1367,7 +1367,7 @@ source_pyx_file(exarg_T *eap, char_u *fname)
if (v == 0) if (v == 0)
{ {
# if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) # if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3)
/* user didn't choose a preference, 'pyx' is used */ // user didn't choose a preference, 'pyx' is used
v = p_pyx; v = p_pyx;
# elif defined(FEAT_PYTHON) # elif defined(FEAT_PYTHON)
v = 2; v = 2;
@ -1472,12 +1472,12 @@ ex_checktime(exarg_T *eap)
int save_no_check_timestamps = no_check_timestamps; int save_no_check_timestamps = no_check_timestamps;
no_check_timestamps = 0; no_check_timestamps = 0;
if (eap->addr_count == 0) /* default is all buffers */ if (eap->addr_count == 0) // default is all buffers
check_timestamps(FALSE); check_timestamps(FALSE);
else else
{ {
buf = buflist_findnr((int)eap->line2); buf = buflist_findnr((int)eap->line2);
if (buf != NULL) /* cannot happen? */ if (buf != NULL) // cannot happen?
(void)buf_check_timestamp(buf, FALSE); (void)buf_check_timestamp(buf, FALSE);
} }
no_check_timestamps = save_no_check_timestamps; no_check_timestamps = save_no_check_timestamps;
@ -1491,7 +1491,7 @@ get_locale_val(int what)
{ {
char_u *loc; char_u *loc;
/* Obtain the locale value from the libraries. */ // Obtain the locale value from the libraries.
loc = (char_u *)setlocale(what, NULL); loc = (char_u *)setlocale(what, NULL);
# ifdef MSWIN # ifdef MSWIN
@ -1499,13 +1499,13 @@ get_locale_val(int what)
{ {
char_u *p; char_u *p;
/* setocale() returns something like "LC_COLLATE=<name>;LC_..." when // setocale() returns something like "LC_COLLATE=<name>;LC_..." when
* one of the values (e.g., LC_CTYPE) differs. */ // one of the values (e.g., LC_CTYPE) differs.
p = vim_strchr(loc, '='); p = vim_strchr(loc, '=');
if (p != NULL) if (p != NULL)
{ {
loc = ++p; loc = ++p;
while (*p != NUL) /* remove trailing newline */ while (*p != NUL) // remove trailing newline
{ {
if (*p < ' ' || *p == ';') if (*p < ' ' || *p == ';')
{ {
@ -1585,10 +1585,10 @@ get_mess_lang(void)
# if defined(LC_MESSAGES) # if defined(LC_MESSAGES)
p = get_locale_val(LC_MESSAGES); p = get_locale_val(LC_MESSAGES);
# else # else
/* This is necessary for Win32, where LC_MESSAGES is not defined and $LANG // This is necessary for Win32, where LC_MESSAGES is not defined and $LANG
* may be set to the LCID number. LC_COLLATE is the best guess, LC_TIME // may be set to the LCID number. LC_COLLATE is the best guess, LC_TIME
* and LC_MONETARY may be set differently for a Japanese working in the // and LC_MONETARY may be set differently for a Japanese working in the
* US. */ // US.
p = get_locale_val(LC_COLLATE); p = get_locale_val(LC_COLLATE);
# endif # endif
# else # else
@ -1607,7 +1607,7 @@ get_mess_lang(void)
} }
#endif #endif
/* Complicated #if; matches with where get_mess_env() is used below. */ // Complicated #if; matches with where get_mess_env() is used below.
#if (defined(FEAT_EVAL) && !((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ #if (defined(FEAT_EVAL) && !((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& defined(LC_MESSAGES))) \ && defined(LC_MESSAGES))) \
|| ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ || ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
@ -1628,7 +1628,7 @@ get_mess_env(void)
{ {
p = mch_getenv((char_u *)"LANG"); p = mch_getenv((char_u *)"LANG");
if (p != NULL && VIM_ISDIGIT(*p)) if (p != NULL && VIM_ISDIGIT(*p))
p = NULL; /* ignore something like "1043" */ p = NULL; // ignore something like "1043"
# ifdef HAVE_GET_LOCALE_VAL # ifdef HAVE_GET_LOCALE_VAL
if (p == NULL || *p == NUL) if (p == NULL || *p == NUL)
p = get_locale_val(LC_CTYPE); p = get_locale_val(LC_CTYPE);
@ -1653,13 +1653,13 @@ set_lang_var(void)
# ifdef HAVE_GET_LOCALE_VAL # ifdef HAVE_GET_LOCALE_VAL
loc = get_locale_val(LC_CTYPE); loc = get_locale_val(LC_CTYPE);
# else # else
/* setlocale() not supported: use the default value */ // setlocale() not supported: use the default value
loc = (char_u *)"C"; loc = (char_u *)"C";
# endif # endif
set_vim_var_string(VV_CTYPE, loc, -1); set_vim_var_string(VV_CTYPE, loc, -1);
/* When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall // When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall
* back to LC_CTYPE if it's empty. */ // back to LC_CTYPE if it's empty.
# if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES) # if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES)
loc = get_locale_val(LC_MESSAGES); loc = get_locale_val(LC_MESSAGES);
# else # else
@ -1694,9 +1694,9 @@ ex_language(exarg_T *eap)
name = eap->arg; name = eap->arg;
/* Check for "messages {name}", "ctype {name}" or "time {name}" argument. // Check for "messages {name}", "ctype {name}" or "time {name}" argument.
* Allow abbreviation, but require at least 3 characters to avoid // Allow abbreviation, but require at least 3 characters to avoid
* confusion with a two letter language name "me" or "ct". */ // confusion with a two letter language name "me" or "ct".
p = skiptowhite(eap->arg); p = skiptowhite(eap->arg);
if ((*p == NUL || VIM_ISWHITE(*p)) && p - eap->arg >= 3) if ((*p == NUL || VIM_ISWHITE(*p)) && p - eap->arg >= 3)
{ {
@ -1742,7 +1742,7 @@ ex_language(exarg_T *eap)
{ {
loc = setlocale(what, (char *)name); loc = setlocale(what, (char *)name);
#if defined(FEAT_FLOAT) && defined(LC_NUMERIC) #if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
/* Make sure strtod() uses a decimal point, not a comma. */ // Make sure strtod() uses a decimal point, not a comma.
setlocale(LC_NUMERIC, "C"); setlocale(LC_NUMERIC, "C");
#endif #endif
} }
@ -1751,31 +1751,31 @@ ex_language(exarg_T *eap)
else else
{ {
#ifdef HAVE_NL_MSG_CAT_CNTR #ifdef HAVE_NL_MSG_CAT_CNTR
/* Need to do this for GNU gettext, otherwise cached translations // Need to do this for GNU gettext, otherwise cached translations
* will be used again. */ // will be used again.
extern int _nl_msg_cat_cntr; extern int _nl_msg_cat_cntr;
++_nl_msg_cat_cntr; ++_nl_msg_cat_cntr;
#endif #endif
/* Reset $LC_ALL, otherwise it would overrule everything. */ // Reset $LC_ALL, otherwise it would overrule everything.
vim_setenv((char_u *)"LC_ALL", (char_u *)""); vim_setenv((char_u *)"LC_ALL", (char_u *)"");
if (what != LC_TIME) if (what != LC_TIME)
{ {
/* Tell gettext() what to translate to. It apparently doesn't // Tell gettext() what to translate to. It apparently doesn't
* use the currently effective locale. Also do this when // use the currently effective locale. Also do this when
* FEAT_GETTEXT isn't defined, so that shell commands use this // FEAT_GETTEXT isn't defined, so that shell commands use this
* value. */ // value.
if (what == LC_ALL) if (what == LC_ALL)
{ {
vim_setenv((char_u *)"LANG", name); vim_setenv((char_u *)"LANG", name);
/* Clear $LANGUAGE because GNU gettext uses it. */ // Clear $LANGUAGE because GNU gettext uses it.
vim_setenv((char_u *)"LANGUAGE", (char_u *)""); vim_setenv((char_u *)"LANGUAGE", (char_u *)"");
# ifdef MSWIN # ifdef MSWIN
/* Apparently MS-Windows printf() may cause a crash when // Apparently MS-Windows printf() may cause a crash when
* we give it 8-bit text while it's expecting text in the // we give it 8-bit text while it's expecting text in the
* current locale. This call avoids that. */ // current locale. This call avoids that.
setlocale(LC_CTYPE, "C"); setlocale(LC_CTYPE, "C");
# endif # endif
} }
@ -1795,7 +1795,7 @@ ex_language(exarg_T *eap)
} }
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
/* Set v:lang, v:lc_time and v:ctype to the final result. */ // Set v:lang, v:lc_time and v:ctype to the final result.
set_lang_var(); set_lang_var();
# endif # endif
# ifdef FEAT_TITLE # ifdef FEAT_TITLE
@ -1805,7 +1805,7 @@ ex_language(exarg_T *eap)
} }
} }
static char_u **locales = NULL; /* Array of all available locales */ static char_u **locales = NULL; // Array of all available locales
# ifndef MSWIN # ifndef MSWIN
static int did_init_locales = FALSE; static int did_init_locales = FALSE;
@ -1820,16 +1820,16 @@ find_locales(void)
garray_T locales_ga; garray_T locales_ga;
char_u *loc; char_u *loc;
/* Find all available locales by running command "locale -a". If this // Find all available locales by running command "locale -a". If this
* doesn't work we won't have completion. */ // doesn't work we won't have completion.
char_u *locale_a = get_cmd_output((char_u *)"locale -a", char_u *locale_a = get_cmd_output((char_u *)"locale -a",
NULL, SHELL_SILENT, NULL); NULL, SHELL_SILENT, NULL);
if (locale_a == NULL) if (locale_a == NULL)
return NULL; return NULL;
ga_init2(&locales_ga, sizeof(char_u *), 20); ga_init2(&locales_ga, sizeof(char_u *), 20);
/* Transform locale_a string where each locale is separated by "\n" // Transform locale_a string where each locale is separated by "\n"
* into an array of locale strings. */ // into an array of locale strings.
loc = (char_u *)strtok((char *)locale_a, "\n"); loc = (char_u *)strtok((char *)locale_a, "\n");
while (loc != NULL) while (loc != NULL)

File diff suppressed because it is too large Load Diff

View File

@ -52,12 +52,12 @@ static char *get_end_emsg(struct condstack *cstack);
* for a variable that is allowed to be changed during execution of a script. * for a variable that is allowed to be changed during execution of a script.
*/ */
#if 0 #if 0
/* Expressions used for testing during the development phase. */ // Expressions used for testing during the development phase.
# define THROW_ON_ERROR (!eval_to_number("$VIMNOERRTHROW")) # define THROW_ON_ERROR (!eval_to_number("$VIMNOERRTHROW"))
# define THROW_ON_INTERRUPT (!eval_to_number("$VIMNOINTTHROW")) # define THROW_ON_INTERRUPT (!eval_to_number("$VIMNOINTTHROW"))
# define THROW_TEST # define THROW_TEST
#else #else
/* Values used for the Vim release. */ // Values used for the Vim release.
# define THROW_ON_ERROR TRUE # define THROW_ON_ERROR TRUE
# define THROW_ON_ERROR_TRUE # define THROW_ON_ERROR_TRUE
# define THROW_ON_INTERRUPT TRUE # define THROW_ON_INTERRUPT TRUE
@ -127,8 +127,8 @@ should_abort(int retcode)
int int
aborted_in_try(void) aborted_in_try(void)
{ {
/* This function is only called after an error. In this case, "force_abort" // This function is only called after an error. In this case, "force_abort"
* determines whether searching for finally clauses is necessary. */ // determines whether searching for finally clauses is necessary.
return force_abort; return force_abort;
} }
@ -215,9 +215,9 @@ cause_errthrow(
*/ */
if (did_throw) if (did_throw)
{ {
/* When discarding an interrupt exception, reset got_int to prevent the // When discarding an interrupt exception, reset got_int to prevent the
* same interrupt being converted to an exception again and discarding // same interrupt being converted to an exception again and discarding
* the error exception we are about to throw here. */ // the error exception we are about to throw here.
if (current_exception->type == ET_INTERRUPT) if (current_exception->type == ET_INTERRUPT)
got_int = FALSE; got_int = FALSE;
discard_current_exception(); discard_current_exception();
@ -276,7 +276,7 @@ cause_errthrow(
{ {
char *tmsg; char *tmsg;
/* Skip the extra "Vim " prefix for message "E458". */ // Skip the extra "Vim " prefix for message "E458".
tmsg = elem->msg; tmsg = elem->msg;
if (STRNCMP(tmsg, "Vim E", 5) == 0 if (STRNCMP(tmsg, "Vim E", 5) == 0
&& VIM_ISDIGIT(tmsg[5]) && VIM_ISDIGIT(tmsg[5])
@ -342,8 +342,8 @@ do_errthrow(struct condstack *cstack, char_u *cmdname)
force_abort = TRUE; force_abort = TRUE;
} }
/* If no exception is to be thrown or the conversion should be done after // If no exception is to be thrown or the conversion should be done after
* returning to a previous invocation of do_one_cmd(), do nothing. */ // returning to a previous invocation of do_one_cmd(), do nothing.
if (msg_list == NULL || *msg_list == NULL) if (msg_list == NULL || *msg_list == NULL)
return; return;
@ -374,7 +374,7 @@ do_intthrow(struct condstack *cstack)
if (!got_int || (trylevel == 0 && !did_throw)) if (!got_int || (trylevel == 0 && !did_throw))
return FALSE; return FALSE;
#ifdef THROW_TEST /* avoid warning for condition always true */ #ifdef THROW_TEST // avoid warning for condition always true
if (!THROW_ON_INTERRUPT) if (!THROW_ON_INTERRUPT)
{ {
/* /*
@ -401,7 +401,7 @@ do_intthrow(struct condstack *cstack)
if (current_exception->type == ET_INTERRUPT) if (current_exception->type == ET_INTERRUPT)
return FALSE; return FALSE;
/* An interrupt exception replaces any user or error exception. */ // An interrupt exception replaces any user or error exception.
discard_current_exception(); discard_current_exception();
} }
if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) != FAIL) if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) != FAIL)
@ -449,9 +449,9 @@ get_exception_string(
val = ret + 4; val = ret + 4;
} }
/* msg_add_fname may have been used to prefix the message with a file // msg_add_fname may have been used to prefix the message with a file
* name in quotes. In the exception value, put the file name in // name in quotes. In the exception value, put the file name in
* parentheses and move it to the end. */ // parentheses and move it to the end.
for (p = mesg; ; p++) for (p = mesg; ; p++)
{ {
if (*p == NUL if (*p == NUL
@ -464,13 +464,13 @@ get_exception_string(
&& p[4] == ':')))))) && p[4] == ':'))))))
{ {
if (*p == NUL || p == mesg) if (*p == NUL || p == mesg)
STRCAT(val, mesg); /* 'E123' missing or at beginning */ STRCAT(val, mesg); // 'E123' missing or at beginning
else else
{ {
/* '"filename" E123: message text' */ // '"filename" E123: message text'
if (mesg[0] != '"' || p-2 < &mesg[1] || if (mesg[0] != '"' || p-2 < &mesg[1] ||
p[-2] != '"' || p[-1] != ' ') p[-2] != '"' || p[-1] != ' ')
/* "E123:" is part of the file name. */ // "E123:" is part of the file name.
continue; continue;
STRCAT(val, p); STRCAT(val, p);
@ -525,8 +525,8 @@ throw_exception(void *value, except_type_T type, char_u *cmdname)
goto nomem; goto nomem;
if (type == ET_ERROR) if (type == ET_ERROR)
/* Store the original message and prefix the exception value with // Store the original message and prefix the exception value with
* "Vim:" or, if a command name is given, "Vim(cmdname):". */ // "Vim:" or, if a command name is given, "Vim(cmdname):".
excp->messages = (struct msglist *)value; excp->messages = (struct msglist *)value;
excp->value = get_exception_string(value, type, cmdname, &should_free); excp->value = get_exception_string(value, type, cmdname, &should_free);
@ -549,15 +549,15 @@ throw_exception(void *value, except_type_T type, char_u *cmdname)
int save_msg_silent = msg_silent; int save_msg_silent = msg_silent;
if (debug_break_level > 0) if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */ msg_silent = FALSE; // display messages
else else
verbose_enter(); verbose_enter();
++no_wait_return; ++no_wait_return;
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; // always scroll up, don't overwrite
smsg(_("Exception thrown: %s"), excp->value); smsg(_("Exception thrown: %s"), excp->value);
msg_puts("\n"); /* don't overwrite this either */ msg_puts("\n"); // don't overwrite this either
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
cmdline_row = msg_row; cmdline_row = msg_row;
@ -601,17 +601,17 @@ discard_exception(except_T *excp, int was_finished)
saved_IObuff = vim_strsave(IObuff); saved_IObuff = vim_strsave(IObuff);
if (debug_break_level > 0) if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */ msg_silent = FALSE; // display messages
else else
verbose_enter(); verbose_enter();
++no_wait_return; ++no_wait_return;
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; // always scroll up, don't overwrite
smsg(was_finished smsg(was_finished
? _("Exception finished: %s") ? _("Exception finished: %s")
: _("Exception discarded: %s"), : _("Exception discarded: %s"),
excp->value); excp->value);
msg_puts("\n"); /* don't overwrite this either */ msg_puts("\n"); // don't overwrite this either
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
cmdline_row = msg_row; cmdline_row = msg_row;
--no_wait_return; --no_wait_return;
@ -664,7 +664,7 @@ catch_exception(except_T *excp)
set_vim_var_string(VV_THROWPOINT, IObuff, -1); set_vim_var_string(VV_THROWPOINT, IObuff, -1);
} }
else else
/* throw_name not set on an exception from a command that was typed. */ // throw_name not set on an exception from a command that was typed.
set_vim_var_string(VV_THROWPOINT, NULL, -1); set_vim_var_string(VV_THROWPOINT, NULL, -1);
if (p_verbose >= 13 || debug_break_level > 0) if (p_verbose >= 13 || debug_break_level > 0)
@ -672,15 +672,15 @@ catch_exception(except_T *excp)
int save_msg_silent = msg_silent; int save_msg_silent = msg_silent;
if (debug_break_level > 0) if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */ msg_silent = FALSE; // display messages
else else
verbose_enter(); verbose_enter();
++no_wait_return; ++no_wait_return;
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; // always scroll up, don't overwrite
smsg(_("Exception caught: %s"), excp->value); smsg(_("Exception caught: %s"), excp->value);
msg_puts("\n"); /* don't overwrite this either */ msg_puts("\n"); // don't overwrite this either
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
cmdline_row = msg_row; cmdline_row = msg_row;
@ -716,8 +716,8 @@ finish_exception(except_T *excp)
set_vim_var_string(VV_THROWPOINT, IObuff, -1); set_vim_var_string(VV_THROWPOINT, IObuff, -1);
} }
else else
/* throw_name not set on an exception from a command that was // throw_name not set on an exception from a command that was
* typed. */ // typed.
set_vim_var_string(VV_THROWPOINT, NULL, -1); set_vim_var_string(VV_THROWPOINT, NULL, -1);
} }
else else
@ -726,7 +726,7 @@ finish_exception(except_T *excp)
set_vim_var_string(VV_THROWPOINT, NULL, -1); set_vim_var_string(VV_THROWPOINT, NULL, -1);
} }
/* Discard the exception, but use the finish message for 'verbose'. */ // Discard the exception, but use the finish message for 'verbose'.
discard_exception(excp, TRUE); discard_exception(excp, TRUE);
} }
@ -760,7 +760,7 @@ report_pending(int action, int pending, void *value)
case RP_RESUME: case RP_RESUME:
mesg = _("%s resumed"); mesg = _("%s resumed");
break; break;
/* case RP_DISCARD: */ // case RP_DISCARD:
default: default:
mesg = _("%s discarded"); mesg = _("%s discarded");
break; break;
@ -781,7 +781,7 @@ report_pending(int action, int pending, void *value)
s = ":finish"; s = ":finish";
break; break;
case CSTP_RETURN: case CSTP_RETURN:
/* ":return" command producing value, allocated */ // ":return" command producing value, allocated
s = (char *)get_return_cmd(value); s = (char *)get_return_cmd(value);
break; break;
@ -797,17 +797,17 @@ report_pending(int action, int pending, void *value)
s = _("Error and interrupt"); s = _("Error and interrupt");
else if (pending & CSTP_ERROR) else if (pending & CSTP_ERROR)
s = _("Error"); s = _("Error");
else /* if (pending & CSTP_INTERRUPT) */ else // if (pending & CSTP_INTERRUPT)
s = _("Interrupt"); s = _("Interrupt");
} }
save_msg_silent = msg_silent; save_msg_silent = msg_silent;
if (debug_break_level > 0) if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */ msg_silent = FALSE; // display messages
++no_wait_return; ++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; // always scroll up, don't overwrite
smsg(mesg, s); smsg(mesg, s);
msg_puts("\n"); /* don't overwrite this either */ msg_puts("\n"); // don't overwrite this either
cmdline_row = msg_row; cmdline_row = msg_row;
--no_wait_return; --no_wait_return;
if (debug_break_level > 0) if (debug_break_level > 0)
@ -916,7 +916,7 @@ ex_if(exarg_T *eap)
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE; cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE;
} }
else else
/* set TRUE, so this conditional will never get active */ // set TRUE, so this conditional will never get active
cstack->cs_flags[cstack->cs_idx] = CSF_TRUE; cstack->cs_flags[cstack->cs_idx] = CSF_TRUE;
} }
} }
@ -992,12 +992,12 @@ ex_else(exarg_T *eap)
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
if (skip || cstack->cs_flags[cstack->cs_idx] & CSF_TRUE) if (skip || cstack->cs_flags[cstack->cs_idx] & CSF_TRUE)
{ {
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;
@ -1021,11 +1021,11 @@ ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif) if (eap->cmdidx == CMD_elseif)
{ {
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
/* When throwing error exceptions, we want to throw always the first // When throwing error exceptions, we want to throw always the first
* of several errors in a row. This is what actually happens when // of several errors in a row. This is what actually happens when
* a conditional error was detected above and there is another failure // a conditional error was detected above and there is another failure
* when parsing the expression. Since the skip flag is set in this // when parsing the expression. Since the skip flag is set in this
* case, the parsing error will be ignored by emsg(). */ // case, the parsing error will be ignored by emsg().
if (!skip && !error) if (!skip && !error)
{ {
@ -1035,7 +1035,7 @@ ex_else(exarg_T *eap)
cstack->cs_flags[cstack->cs_idx] = 0; cstack->cs_flags[cstack->cs_idx] = 0;
} }
else if (eap->errmsg == NULL) else if (eap->errmsg == NULL)
/* set TRUE, so this conditional will never get active */ // set TRUE, so this conditional will never get active
cstack->cs_flags[cstack->cs_idx] = CSF_TRUE; cstack->cs_flags[cstack->cs_idx] = CSF_TRUE;
} }
else else
@ -1093,19 +1093,19 @@ ex_while(exarg_T *eap)
*/ */
if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0) if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0)
{ {
/* Jumping here from a ":continue" or ":endfor": use the // Jumping here from a ":continue" or ":endfor": use the
* previously evaluated list. */ // previously evaluated list.
fi = cstack->cs_forinfo[cstack->cs_idx]; fi = cstack->cs_forinfo[cstack->cs_idx];
error = FALSE; error = FALSE;
} }
else else
{ {
/* Evaluate the argument and get the info in a structure. */ // Evaluate the argument and get the info in a structure.
fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip); fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip);
cstack->cs_forinfo[cstack->cs_idx] = fi; cstack->cs_forinfo[cstack->cs_idx] = fi;
} }
/* use the element at the start of the list and advance */ // use the element at the start of the list and advance
if (!error && fi != NULL && !skip) if (!error && fi != NULL && !skip)
result = next_for_item(fi, eap->arg); result = next_for_item(fi, eap->arg);
else else
@ -1131,10 +1131,10 @@ ex_while(exarg_T *eap)
else else
{ {
cstack->cs_lflags &= ~CSL_HAD_LOOP; cstack->cs_lflags &= ~CSL_HAD_LOOP;
/* If the ":while" evaluates to FALSE or ":for" is past the end of // If the ":while" evaluates to FALSE or ":for" is past the end of
* the list, show the debug prompt at the ":endwhile"/":endfor" as // the list, show the debug prompt at the ":endwhile"/":endfor" as
* if there was a ":break" in a ":while"/":for" evaluating to // if there was a ":break" in a ":while"/":for" evaluating to
* TRUE. */ // TRUE.
if (!skip && !error) if (!skip && !error)
cstack->cs_flags[cstack->cs_idx] |= CSF_TRUE; cstack->cs_flags[cstack->cs_idx] |= CSF_TRUE;
} }
@ -1154,10 +1154,10 @@ ex_continue(exarg_T *eap)
eap->errmsg = N_("E586: :continue without :while or :for"); eap->errmsg = N_("E586: :continue without :while or :for");
else else
{ {
/* Try to find the matching ":while". This might stop at a try // Try to find the matching ":while". This might stop at a try
* conditional not in its finally clause (which is then to be executed // conditional not in its finally clause (which is then to be executed
* next). Therefor, inactivate all conditionals except the ":while" // next). Therefor, inactivate all conditionals except the ":while"
* itself (if reached). */ // itself (if reached).
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
if (idx >= 0 && (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) if (idx >= 0 && (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)))
{ {
@ -1167,12 +1167,12 @@ ex_continue(exarg_T *eap)
* Set CSL_HAD_CONT, so do_cmdline() will jump back to the * Set CSL_HAD_CONT, so do_cmdline() will jump back to the
* matching ":while". * matching ":while".
*/ */
cstack->cs_lflags |= CSL_HAD_CONT; /* let do_cmdline() handle it */ cstack->cs_lflags |= CSL_HAD_CONT; // let do_cmdline() handle it
} }
else else
{ {
/* If a try conditional not in its finally clause is reached first, // If a try conditional not in its finally clause is reached first,
* make the ":continue" pending for execution at the ":endtry". */ // make the ":continue" pending for execution at the ":endtry".
cstack->cs_pending[idx] = CSTP_CONTINUE; cstack->cs_pending[idx] = CSTP_CONTINUE;
report_make_pending(CSTP_CONTINUE, NULL); report_make_pending(CSTP_CONTINUE, NULL);
} }
@ -1192,10 +1192,10 @@ ex_break(exarg_T *eap)
eap->errmsg = N_("E587: :break without :while or :for"); eap->errmsg = N_("E587: :break without :while or :for");
else else
{ {
/* Inactivate conditionals until the matching ":while" or a try // Inactivate conditionals until the matching ":while" or a try
* conditional not in its finally clause (which is then to be // conditional not in its finally clause (which is then to be
* executed next) is found. In the latter case, make the ":break" // executed next) is found. In the latter case, make the ":break"
* pending for execution at the ":endtry". */ // pending for execution at the ":endtry".
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE); idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE);
if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR)))
{ {
@ -1235,8 +1235,8 @@ ex_endwhile(exarg_T *eap)
fl = cstack->cs_flags[cstack->cs_idx]; fl = cstack->cs_flags[cstack->cs_idx];
if (!(fl & csf)) if (!(fl & csf))
{ {
/* If we are in a ":while" or ":for" but used the wrong endloop // If we are in a ":while" or ":for" but used the wrong endloop
* command, do not rewind to the next enclosing ":for"/":while". */ // command, do not rewind to the next enclosing ":for"/":while".
if (fl & CSF_WHILE) if (fl & CSF_WHILE)
eap->errmsg = _("E732: Using :endfor with :while"); eap->errmsg = _("E732: Using :endfor with :while");
else if (fl & CSF_FOR) else if (fl & CSF_FOR)
@ -1248,21 +1248,21 @@ ex_endwhile(exarg_T *eap)
eap->errmsg = e_endif; eap->errmsg = e_endif;
else if (fl & CSF_FINALLY) else if (fl & CSF_FINALLY)
eap->errmsg = e_endtry; eap->errmsg = e_endtry;
/* Try to find the matching ":while" and report what's missing. */ // Try to find the matching ":while" and report what's missing.
for (idx = cstack->cs_idx; idx > 0; --idx) for (idx = cstack->cs_idx; idx > 0; --idx)
{ {
fl = cstack->cs_flags[idx]; fl = cstack->cs_flags[idx];
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) if ((fl & CSF_TRY) && !(fl & CSF_FINALLY))
{ {
/* Give up at a try conditional not in its finally clause. // Give up at a try conditional not in its finally clause.
* Ignore the ":endwhile"/":endfor". */ // Ignore the ":endwhile"/":endfor".
eap->errmsg = err; eap->errmsg = err;
return; return;
} }
if (fl & csf) if (fl & csf)
break; break;
} }
/* Cleanup and rewind all contained (and unclosed) conditionals. */ // Cleanup and rewind all contained (and unclosed) conditionals.
(void)cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); (void)cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel); rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
} }
@ -1308,8 +1308,8 @@ ex_throw(exarg_T *eap)
value = NULL; value = NULL;
} }
/* On error or when an exception is thrown during argument evaluation, do // On error or when an exception is thrown during argument evaluation, do
* not throw. */ // not throw.
if (!eap->skip && value != NULL) if (!eap->skip && value != NULL)
{ {
if (throw_exception(value, ET_USER, NULL) == FAIL) if (throw_exception(value, ET_USER, NULL) == FAIL)
@ -1374,17 +1374,17 @@ do_throw(struct condstack *cstack)
if (cstack->cs_flags[idx] & CSF_ACTIVE) if (cstack->cs_flags[idx] & CSF_ACTIVE)
cstack->cs_flags[idx] |= CSF_THROWN; cstack->cs_flags[idx] |= CSF_THROWN;
else else
/* THROWN may have already been set for a catchable exception // THROWN may have already been set for a catchable exception
* that has been discarded. Ensure it is reset for the new // that has been discarded. Ensure it is reset for the new
* exception. */ // exception.
cstack->cs_flags[idx] &= ~CSF_THROWN; cstack->cs_flags[idx] &= ~CSF_THROWN;
} }
cstack->cs_flags[idx] &= ~CSF_ACTIVE; cstack->cs_flags[idx] &= ~CSF_ACTIVE;
cstack->cs_exception[idx] = current_exception; cstack->cs_exception[idx] = current_exception;
} }
#if 0 #if 0
/* TODO: Add optimization below. Not yet done because of interface // TODO: Add optimization below. Not yet done because of interface
* problems to eval.c and ex_cmds2.c. (Servatius) */ // problems to eval.c and ex_cmds2.c. (Servatius)
else else
{ {
/* /*
@ -1429,9 +1429,9 @@ ex_try(exarg_T *eap)
if (!skip) if (!skip)
{ {
/* Set ACTIVE and TRUE. TRUE means that the corresponding ":catch" // Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
* commands should check for a match if an exception is thrown and // commands should check for a match if an exception is thrown and
* that the finally clause needs to be executed. */ // that the finally clause needs to be executed.
cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE; cstack->cs_flags[cstack->cs_idx] |= CSF_ACTIVE | CSF_TRUE;
/* /*
@ -1498,8 +1498,8 @@ ex_catch(exarg_T *eap)
{ {
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;
} }
@ -1508,8 +1508,8 @@ ex_catch(exarg_T *eap)
break; break;
if (cstack->cs_flags[idx] & CSF_FINALLY) if (cstack->cs_flags[idx] & CSF_FINALLY)
{ {
/* 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;
} }
@ -1518,7 +1518,7 @@ ex_catch(exarg_T *eap)
&cstack->cs_looplevel); &cstack->cs_looplevel);
} }
if (ends_excmd(*eap->arg)) /* no argument, catch all errors */ if (ends_excmd(*eap->arg)) // no argument, catch all errors
{ {
pat = (char_u *)".*"; pat = (char_u *)".*";
end = NULL; end = NULL;
@ -1554,17 +1554,17 @@ ex_catch(exarg_T *eap)
return; return;
} }
/* When debugging or a breakpoint was encountered, display the // When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done) before checking for a match. // debug prompt (if not already done) before checking for a match.
* This is a helpful hint for the user when the regular expression // This is a helpful hint for the user when the regular expression
* matching fails. Handle a ">quit" debug command as if an // matching fails. Handle a ">quit" debug command as if an
* interrupt had occurred before the ":catch". That is, discard // interrupt had occurred before the ":catch". That is, discard
* the original exception, replace it by an interrupt exception, // the original exception, replace it by an interrupt exception,
* and don't catch it in this try block. */ // and don't catch it in this try block.
if (!dbg_check_skipped(eap) || !do_intthrow(cstack)) if (!dbg_check_skipped(eap) || !do_intthrow(cstack))
{ {
/* Terminate the pattern and avoid the 'l' flag in 'cpoptions' // Terminate the pattern and avoid the 'l' flag in 'cpoptions'
* while compiling it. */ // while compiling it.
if (end != NULL) if (end != NULL)
{ {
save_char = *end; save_char = *end;
@ -1572,8 +1572,8 @@ ex_catch(exarg_T *eap)
} }
save_cpo = p_cpo; save_cpo = p_cpo;
p_cpo = (char_u *)""; p_cpo = (char_u *)"";
/* Disable error messages, it will make current_exception // Disable error messages, it will make current_exception
* invalid. */ // invalid.
++emsg_off; ++emsg_off;
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
--emsg_off; --emsg_off;
@ -1602,16 +1602,16 @@ ex_catch(exarg_T *eap)
if (caught) if (caught)
{ {
/* Make this ":catch" clause active and reset did_emsg, got_int, // Make this ":catch" clause active and reset did_emsg, got_int,
* and did_throw. Put the exception on the caught stack. */ // and did_throw. Put the exception on the caught stack.
cstack->cs_flags[idx] |= CSF_ACTIVE | CSF_CAUGHT; cstack->cs_flags[idx] |= CSF_ACTIVE | CSF_CAUGHT;
did_emsg = got_int = did_throw = FALSE; did_emsg = got_int = did_throw = FALSE;
catch_exception((except_T *)cstack->cs_exception[idx]); catch_exception((except_T *)cstack->cs_exception[idx]);
/* It's mandatory that the current exception is stored in the cstack // It's mandatory that the current exception is stored in the cstack
* so that it can be discarded at the next ":catch", ":finally", or // so that it can be discarded at the next ":catch", ":finally", or
* ":endtry" or when the catch clause is left by a ":continue", // ":endtry" or when the catch clause is left by a ":continue",
* ":break", ":return", ":finish", error, interrupt, or another // ":break", ":return", ":finish", error, interrupt, or another
* exception. */ // exception.
if (cstack->cs_exception[cstack->cs_idx] != current_exception) if (cstack->cs_exception[cstack->cs_idx] != current_exception)
internal_error("ex_catch()"); internal_error("ex_catch()");
} }
@ -1656,9 +1656,9 @@ ex_finally(exarg_T *eap)
for (idx = cstack->cs_idx - 1; idx > 0; --idx) for (idx = cstack->cs_idx - 1; idx > 0; --idx)
if (cstack->cs_flags[idx] & CSF_TRY) if (cstack->cs_flags[idx] & CSF_TRY)
break; break;
/* Make this error pending, so that the commands in the following // Make this error pending, so that the commands in the following
* finally clause can be executed. This overrules also a pending // finally clause can be executed. This overrules also a pending
* ":continue", ":break", ":return", or ":finish". */ // ":continue", ":break", ":return", or ":finish".
pending = CSTP_ERROR; pending = CSTP_ERROR;
} }
else else
@ -1666,7 +1666,7 @@ ex_finally(exarg_T *eap)
if (cstack->cs_flags[idx] & CSF_FINALLY) if (cstack->cs_flags[idx] & CSF_FINALLY)
{ {
/* Give up for a multiple ":finally" and ignore it. */ // Give up for a multiple ":finally" and ignore it.
eap->errmsg = N_("E607: multiple :finally"); eap->errmsg = N_("E607: multiple :finally");
return; return;
} }
@ -1685,15 +1685,15 @@ ex_finally(exarg_T *eap)
if (!skip) if (!skip)
{ {
/* When debugging or a breakpoint was encountered, display the // When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done). The user then knows that the // debug prompt (if not already done). The user then knows that the
* finally clause is executed. */ // finally clause is executed.
if (dbg_check_skipped(eap)) if (dbg_check_skipped(eap))
{ {
/* Handle a ">quit" debug command as if an interrupt had // Handle a ">quit" debug command as if an interrupt had
* occurred before the ":finally". That is, discard the // occurred before the ":finally". That is, discard the
* original exception and replace it by an interrupt // original exception and replace it by an interrupt
* exception. */ // exception.
(void)do_intthrow(cstack); (void)do_intthrow(cstack);
} }
@ -1738,13 +1738,13 @@ ex_finally(exarg_T *eap)
pending |= got_int ? CSTP_INTERRUPT : 0; pending |= got_int ? CSTP_INTERRUPT : 0;
cstack->cs_pending[cstack->cs_idx] = pending; cstack->cs_pending[cstack->cs_idx] = pending;
/* It's mandatory that the current exception is stored in the // It's mandatory that the current exception is stored in the
* cstack so that it can be rethrown at the ":endtry" or be // cstack so that it can be rethrown at the ":endtry" or be
* discarded if the finally clause is left by a ":continue", // discarded if the finally clause is left by a ":continue",
* ":break", ":return", ":finish", error, interrupt, or another // ":break", ":return", ":finish", error, interrupt, or another
* exception. When emsg() is called for a missing ":endif" or // exception. When emsg() is called for a missing ":endif" or
* a missing ":endwhile"/":endfor" detected here, the // a missing ":endwhile"/":endfor" detected here, the
* exception will be discarded. */ // exception will be discarded.
if (did_throw && cstack->cs_exception[cstack->cs_idx] if (did_throw && cstack->cs_exception[cstack->cs_idx]
!= current_exception) != current_exception)
internal_error("ex_finally()"); internal_error("ex_finally()");
@ -1796,7 +1796,7 @@ ex_endtry(exarg_T *eap)
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;
@ -1830,28 +1830,27 @@ ex_endtry(exarg_T *eap)
rethrow = TRUE; rethrow = TRUE;
} }
/* If there was no finally clause, show the user when debugging or // If there was no finally clause, show the user when debugging or
* a breakpoint was encountered that the end of the try conditional has // a breakpoint was encountered that the end of the try conditional has
* been reached: display the debug prompt (if not already done). Do // been reached: display the debug prompt (if not already done). Do
* this on normal control flow or when an exception was thrown, but not // this on normal control flow or when an exception was thrown, but not
* on an interrupt or error not converted to an exception or when // on an interrupt or error not converted to an exception or when
* a ":break", ":continue", ":return", or ":finish" is pending. These // a ":break", ":continue", ":return", or ":finish" is pending. These
* actions are carried out immediately. // actions are carried out immediately.
*/
if ((rethrow || (!skip if ((rethrow || (!skip
&& !(cstack->cs_flags[idx] & CSF_FINALLY) && !(cstack->cs_flags[idx] & CSF_FINALLY)
&& !cstack->cs_pending[idx])) && !cstack->cs_pending[idx]))
&& dbg_check_skipped(eap)) && dbg_check_skipped(eap))
{ {
/* Handle a ">quit" debug command as if an interrupt had occurred // Handle a ">quit" debug command as if an interrupt had occurred
* 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 did_throw or // The do_intthrow() call may have reset did_throw or
* cstack->cs_pending[idx].*/ // cstack->cs_pending[idx].
rethrow = FALSE; rethrow = FALSE;
if (did_throw && !(cstack->cs_flags[idx] & CSF_FINALLY)) if (did_throw && !(cstack->cs_flags[idx] & CSF_FINALLY))
rethrow = TRUE; rethrow = TRUE;
@ -1899,13 +1898,13 @@ ex_endtry(exarg_T *eap)
case CSTP_NONE: case CSTP_NONE:
break; break;
/* Reactivate a pending ":continue", ":break", ":return", // Reactivate a pending ":continue", ":break", ":return",
* ":finish" from the try block or a catch clause of this try // ":finish" from the try block or a catch clause of this try
* conditional. This is skipped, if there was an error in an // conditional. This is skipped, if there was an error in an
* (unskipped) conditional command or an interrupt afterwards // (unskipped) conditional command or an interrupt afterwards
* or if the finally clause is present and executed a new error, // or if the finally clause is present and executed a new error,
* interrupt, throw, ":continue", ":break", ":return", or // interrupt, throw, ":continue", ":break", ":return", or
* ":finish". */ // ":finish".
case CSTP_CONTINUE: case CSTP_CONTINUE:
ex_continue(eap); ex_continue(eap);
break; break;
@ -1919,12 +1918,12 @@ ex_endtry(exarg_T *eap)
do_finish(eap, FALSE); do_finish(eap, FALSE);
break; break;
/* When the finally clause was entered due to an error, // When the finally clause was entered due to an error,
* interrupt or throw (as opposed to a ":continue", ":break", // interrupt or throw (as opposed to a ":continue", ":break",
* ":return", or ":finish"), restore the pending values of // ":return", or ":finish"), restore the pending values of
* did_emsg, got_int, and did_throw. This is skipped, if there // did_emsg, got_int, and did_throw. This is skipped, if there
* was a new error, interrupt, throw, ":continue", ":break", // was a new error, interrupt, throw, ":continue", ":break",
* ":return", or ":finish". in the finally clause. */ // ":return", or ":finish". in the finally clause.
default: default:
if (pending & CSTP_ERROR) if (pending & CSTP_ERROR)
did_emsg = TRUE; did_emsg = TRUE;
@ -1937,7 +1936,7 @@ ex_endtry(exarg_T *eap)
} }
if (rethrow) if (rethrow)
/* Rethrow the current exception (within this cstack). */ // Rethrow the current exception (within this cstack).
do_throw(cstack); do_throw(cstack);
} }
} }
@ -1980,13 +1979,12 @@ enter_cleanup(cleanup_T *csp)
| (did_throw ? CSTP_THROW : 0) | (did_throw ? CSTP_THROW : 0)
| (need_rethrow ? CSTP_THROW : 0); | (need_rethrow ? CSTP_THROW : 0);
/* If we are currently throwing an exception (did_throw), save it as // If we are currently throwing an exception (did_throw), save it as
* well. On an error not yet converted to an exception, update // well. On an error not yet converted to an exception, update
* "force_abort" and reset "cause_abort" (as do_errthrow() would do). // "force_abort" and reset "cause_abort" (as do_errthrow() would do).
* This is needed for the do_cmdline() call that is going to be made // This is needed for the do_cmdline() call that is going to be made
* for autocommand execution. We need not save *msg_list because // for autocommand execution. We need not save *msg_list because
* there is an extra instance for every call of do_cmdline(), anyway. // there is an extra instance for every call of do_cmdline(), anyway.
*/
if (did_throw || need_rethrow) if (did_throw || need_rethrow)
{ {
csp->exception = current_exception; csp->exception = current_exception;
@ -2003,7 +2001,7 @@ enter_cleanup(cleanup_T *csp)
} }
did_emsg = got_int = did_throw = need_rethrow = FALSE; did_emsg = got_int = did_throw = need_rethrow = FALSE;
/* Report if required by the 'verbose' option or when debugging. */ // Report if required by the 'verbose' option or when debugging.
report_make_pending(pending, csp->exception); report_make_pending(pending, csp->exception);
} }
else else
@ -2033,23 +2031,23 @@ leave_cleanup(cleanup_T *csp)
{ {
int pending = csp->pending; int pending = csp->pending;
if (pending == CSTP_NONE) /* nothing to do */ if (pending == CSTP_NONE) // nothing to do
return; return;
/* If there was an aborting error, an interrupt, or an uncaught exception // If there was an aborting error, an interrupt, or an uncaught exception
* after the corresponding call to enter_cleanup(), discard what has been // after the corresponding call to enter_cleanup(), discard what has been
* made pending by it. Report this to the user if required by the // made pending by it. Report this to the user if required by the
* 'verbose' option or when debugging. */ // 'verbose' option or when debugging.
if (aborting() || need_rethrow) if (aborting() || need_rethrow)
{ {
if (pending & CSTP_THROW) if (pending & CSTP_THROW)
/* Cancel the pending exception (includes report). */ // Cancel the pending exception (includes report).
discard_exception((except_T *)csp->exception, FALSE); discard_exception((except_T *)csp->exception, FALSE);
else else
report_discard_pending(pending, NULL); report_discard_pending(pending, NULL);
/* If an error was about to be converted to an exception when // If an error was about to be converted to an exception when
* enter_cleanup() was called, free the message list. */ // enter_cleanup() was called, free the message list.
if (msg_list != NULL) if (msg_list != NULL)
free_global_msglist(); free_global_msglist();
} }
@ -2088,9 +2086,9 @@ leave_cleanup(cleanup_T *csp)
if (pending & CSTP_INTERRUPT) if (pending & CSTP_INTERRUPT)
got_int = TRUE; got_int = TRUE;
if (pending & CSTP_THROW) if (pending & CSTP_THROW)
need_rethrow = TRUE; /* did_throw will be set by do_one_cmd() */ need_rethrow = TRUE; // did_throw will be set by do_one_cmd()
/* Report if required by the 'verbose' option or when debugging. */ // Report if required by the 'verbose' option or when debugging.
report_resume_pending(pending, report_resume_pending(pending,
(pending & CSTP_THROW) ? (void *)current_exception : NULL); (pending & CSTP_THROW) ? (void *)current_exception : NULL);
} }
@ -2158,9 +2156,9 @@ cleanup_conditionals(
{ {
if (cstack->cs_pending[idx] & CSTP_THROW) if (cstack->cs_pending[idx] & CSTP_THROW)
{ {
/* Cancel the pending exception. This is in the // Cancel the pending exception. This is in the
* finally clause, so that the stack of the // finally clause, so that the stack of the
* caught exceptions is not involved. */ // caught exceptions is not involved.
discard_exception((except_T *) discard_exception((except_T *)
cstack->cs_exception[idx], cstack->cs_exception[idx],
FALSE); FALSE);
@ -2184,10 +2182,10 @@ cleanup_conditionals(
if ((cstack->cs_flags[idx] & CSF_ACTIVE) if ((cstack->cs_flags[idx] & CSF_ACTIVE)
&& (cstack->cs_flags[idx] & CSF_CAUGHT)) && (cstack->cs_flags[idx] & CSF_CAUGHT))
finish_exception((except_T *)cstack->cs_exception[idx]); finish_exception((except_T *)cstack->cs_exception[idx]);
/* Stop at this try conditional - except the try block never // Stop at this try conditional - except the try block never
* got active (because of an inactive surrounding conditional // got active (because of an inactive surrounding conditional
* or when the ":try" appeared after an error or interrupt or // or when the ":try" appeared after an error or interrupt or
* throw). */ // throw).
if (cstack->cs_flags[idx] & CSF_TRUE) if (cstack->cs_flags[idx] & CSF_TRUE)
{ {
if (searched_cond == 0 && !inclusive) if (searched_cond == 0 && !inclusive)
@ -2197,10 +2195,10 @@ cleanup_conditionals(
} }
} }
/* Stop on the searched conditional type (even when the surrounding // Stop on the searched conditional type (even when the surrounding
* conditional is not active or something has been made pending). // conditional is not active or something has been made pending).
* If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT, // If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT,
* check first whether "emsg_silent" needs to be restored. */ // check first whether "emsg_silent" needs to be restored.
if (cstack->cs_flags[idx] & searched_cond) if (cstack->cs_flags[idx] & searched_cond)
{ {
if (!inclusive) if (!inclusive)
@ -2288,7 +2286,7 @@ has_loop_cmd(char_u *p)
{ {
int len; int len;
/* skip modifiers, white space and ':' */ // skip modifiers, white space and ':'
for (;;) for (;;)
{ {
while (*p == ' ' || *p == '\t' || *p == ':') while (*p == ' ' || *p == '\t' || *p == ':')
@ -2304,4 +2302,4 @@ has_loop_cmd(char_u *p)
return FALSE; return FALSE;
} }
#endif /* FEAT_EVAL */ #endif // FEAT_EVAL

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -162,7 +162,7 @@ shortpath_for_invalid_fname(
* path with the remaining path at the tail. * path with the remaining path at the tail.
*/ */
/* Compute the length of the new path. */ // Compute the length of the new path.
sfx_len = (int)(save_endp - endp) + 1; sfx_len = (int)(save_endp - endp) + 1;
new_len = len + sfx_len; new_len = len + sfx_len;
@ -2367,7 +2367,7 @@ fullpathcmp(
r2 = mch_stat((char *)s2, &st2); r2 = mch_stat((char *)s2, &st2);
if (r1 != 0 && r2 != 0) if (r1 != 0 && r2 != 0)
{ {
/* if mch_stat() doesn't work, may compare the names */ // if mch_stat() doesn't work, may compare the names
if (checkname) if (checkname)
{ {
if (fnamecmp(exp1, s2) == 0) if (fnamecmp(exp1, s2) == 0)
@ -3689,7 +3689,7 @@ gen_expand_wildcards(
void void
addfile( addfile(
garray_T *gap, garray_T *gap,
char_u *f, /* filename */ char_u *f, // filename
int flags) int flags)
{ {
char_u *p; char_u *p;

View File

@ -968,7 +968,7 @@ vim_findfile(void *search_ctx_arg)
{ {
if (!path_with_url(stackp->ffs_filearray[i]) if (!path_with_url(stackp->ffs_filearray[i])
&& !mch_isdir(stackp->ffs_filearray[i])) && !mch_isdir(stackp->ffs_filearray[i]))
continue; /* not a directory */ continue; // not a directory
// prepare the filename to be checked for existence // prepare the filename to be checked for existence
// below // below
@ -2690,7 +2690,7 @@ simplify_filename(char_u *filename)
char_u saved_char; char_u saved_char;
stat_T st; stat_T st;
/* Don't strip for an erroneous file name. */ // Don't strip for an erroneous file name.
if (!stripping_disabled) if (!stripping_disabled)
{ {
// If the preceding component does not exist in the file // If the preceding component does not exist in the file
@ -2827,7 +2827,7 @@ f_simplify(typval_T *argvars, typval_T *rettv)
p = tv_get_string(&argvars[0]); p = tv_get_string(&argvars[0]);
rettv->vval.v_string = vim_strsave(p); rettv->vval.v_string = vim_strsave(p);
simplify_filename(rettv->vval.v_string); /* simplify in place */ simplify_filename(rettv->vval.v_string); // simplify in place
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;
} }
#endif // FEAT_EVAL #endif // FEAT_EVAL

File diff suppressed because it is too large Load Diff

View File

@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2379,
/**/ /**/
2378, 2378,
/**/ /**/