0
0
mirror of https://github.com/vim/vim.git synced 2025-08-27 20:13:38 -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)
return NULL;
if (++last_timer_id <= prev_id)
/* Overflow! Might cause duplicates... */
// Overflow! Might cause duplicates...
last_timer_id = 0;
timer->tr_id = last_timer_id;
insert_timer(timer);
@ -135,7 +135,7 @@ check_due_timer(void)
int need_update_screen = FALSE;
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())
return next_due;
@ -149,8 +149,8 @@ check_due_timer(void)
this_due = proftime_time_left(&timer->tr_due, &now);
if (this_due <= 1)
{
/* Save and restore a lot of flags, because the timer fires while
* waiting for a character, which might be halfway a command. */
// Save and restore a lot of flags, because the timer fires while
// waiting for a character, which might be halfway a command.
int save_timer_busy = timer_busy;
int save_vgetc_busy = vgetc_busy;
int save_did_emsg = did_emsg;
@ -163,8 +163,8 @@ check_due_timer(void)
except_T *save_current_exception = current_exception;
vimvars_save_T vvsave;
/* Create a scope for running the timer callback, ignoring most of
* the current scope, such as being inside a try/catch. */
// Create a scope for running the timer callback, ignoring most of
// the current scope, such as being inside a try/catch.
timer_busy = timer_busy > 0 || vgetc_busy > 0;
vgetc_busy = 0;
called_emsg = FALSE;
@ -200,8 +200,8 @@ check_due_timer(void)
set_pressedreturn(save_ex_pressedreturn);
may_garbage_collect = save_may_garbage_collect;
/* Only fire the timer again if it repeats and stop_timer() wasn't
* called while inside the callback (tr_id == -1). */
// Only fire the timer again if it repeats and stop_timer() wasn't
// called while inside the callback (tr_id == -1).
if (timer->tr_repeat != 0 && timer->tr_id != -1
&& timer->tr_emsg_count < 3)
{
@ -250,7 +250,7 @@ check_due_timer(void)
}
#endif
#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);
#endif
@ -282,7 +282,7 @@ find_timer(long id)
stop_timer(timer_T *timer)
{
if (timer->tr_firing)
/* Free the timer after the callback returns. */
// Free the timer after the callback returns.
timer->tr_id = -1;
else
{
@ -520,7 +520,7 @@ autowrite(buf_T *buf, int forceit)
if (!(p_aw || p_awa) || !p_write
#ifdef FEAT_QUICKFIX
/* never autowrite a "nofile" or "nowrite" buffer */
// never autowrite a "nofile" or "nowrite" buffer
|| bt_dontwrite(buf)
#endif
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
@ -528,8 +528,8 @@ autowrite(buf_T *buf, int forceit)
set_bufref(&bufref, buf);
r = buf_write_all(buf, forceit);
/* Writing may succeed but the buffer still changed, e.g., when there is a
* conversion error. We do want to return FAIL then. */
// Writing may succeed but the buffer still changed, e.g., when there is a
// conversion error. We do want to return FAIL then.
if (bufref_valid(&bufref) && bufIsChanged(buf))
r = FAIL;
return r;
@ -554,7 +554,7 @@ autowrite_all(void)
(void)buf_write_all(buf, FALSE);
/* an autocommand may have deleted the buffer */
// an autocommand may have deleted the buffer
if (!bufref_valid(&bufref))
buf = firstbuf;
}
@ -593,13 +593,13 @@ check_changed(buf_T *buf, int flags)
))
++count;
if (!bufref_valid(&bufref))
/* Autocommand deleted buffer, oops! It's not changed now. */
// Autocommand deleted buffer, oops! It's not changed now.
return FALSE;
dialog_changed(buf, count > 1);
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 bufIsChanged(buf);
}
@ -645,7 +645,7 @@ browse_save_fname(buf_T *buf)
void
dialog_changed(
buf_T *buf,
int checkall) /* may abandon all changed buffers */
int checkall) // may abandon all changed buffers
{
char_u buff[DIALOG_MSG_SIZE];
int ret;
@ -665,12 +665,12 @@ dialog_changed(
if (ret == VIM_YES)
{
#ifdef FEAT_BROWSE
/* May get file name, when there is none */
// May get file name, when there is none
browse_save_fname(buf);
#endif
if (buf->b_fname != NULL && check_overwrite(&ea, buf,
buf->b_fname, buf->b_ffname, FALSE) == OK)
/* didn't hit Cancel */
// didn't hit Cancel
(void)buf_write_all(buf, FALSE);
}
else if (ret == VIM_NO)
@ -698,15 +698,15 @@ dialog_changed(
set_bufref(&bufref, buf2);
#ifdef FEAT_BROWSE
/* May get file name, when there is none */
// May get file name, when there is none
browse_save_fname(buf2);
#endif
if (buf2->b_fname != NULL && check_overwrite(&ea, buf2,
buf2->b_fname, buf2->b_ffname, FALSE) == OK)
/* didn't hit Cancel */
// didn't hit Cancel
(void)buf_write_all(buf2, FALSE);
/* an autocommand may have deleted the buffer */
// an autocommand may have deleted the buffer
if (!bufref_valid(&bufref))
buf2 = firstbuf;
}
@ -760,7 +760,7 @@ add_bufnum(int *bufnrs, int *bufnump, int nr)
*/
int
check_changed_any(
int hidden, /* Only check hidden buffers */
int hidden, // Only check hidden buffers
int unload)
{
int ret = FALSE;
@ -773,7 +773,7 @@ check_changed_any(
tabpage_T *tp;
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)
++bufcount;
@ -784,21 +784,21 @@ check_changed_any(
if (bufnrs == NULL)
return FALSE;
/* curbuf */
// curbuf
bufnrs[bufnum++] = curbuf->b_fnum;
/* buffers in current tab */
// buffers in current tab
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer != curbuf)
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
/* buffers in other tabs */
// buffers in other tabs
FOR_ALL_TABPAGES(tp)
if (tp != curtab)
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum);
/* any other buffer */
// any other buffer
FOR_ALL_BUFFERS(buf)
add_bufnum(bufnrs, &bufnum, buf->b_fnum);
@ -820,19 +820,19 @@ check_changed_any(
}
else
#endif
/* Try auto-writing the buffer. If this fails but the buffer no
* longer exists it's not changed, that's OK. */
// Try auto-writing the buffer. If this fails but the buffer no
// longer exists it's not changed, that's OK.
if (check_changed(buf, (p_awa ? CCGD_AW : 0)
| CCGD_MULTWIN
| CCGD_ALLBUF) && bufref_valid(&bufref))
break; /* didn't save - still changes */
break; // didn't save - still changes
}
}
if (i >= bufnum)
goto theend;
/* Get here if "buf" cannot be abandoned. */
// Get here if "buf" cannot be abandoned.
ret = TRUE;
exiting = FALSE;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
@ -842,10 +842,10 @@ check_changed_any(
if (!(p_confirm || cmdmod.confirm))
#endif
{
/* There must be a wait_return for this message, do_buffer()
* 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
* cause a scroll up. */
// There must be a wait_return for this message, do_buffer()
// 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
// cause a scroll up.
if (vgetc_busy > 0)
{
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)
FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_buffer == buf)
@ -887,7 +887,7 @@ check_changed_any(
}
buf_found:
/* Open the changed buffer in the current window. */
// Open the changed buffer in the current window.
if (buf != curbuf)
set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO);
@ -965,8 +965,8 @@ ex_listdo(exarg_T *eap)
#if defined(FEAT_SYN_HL)
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
{
/* Don't do syntax HL autocommands. Skipping the syntax file is a
* great speed improvement. */
// Don't do syntax HL autocommands. Skipping the syntax file is a
// great speed improvement.
save_ei = au_event_disable(",Syntax");
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
@ -986,7 +986,7 @@ ex_listdo(exarg_T *eap)
| CCGD_EXCMD))
{
i = 0;
/* start at the eap->line1 argument/window/buffer */
// start at the eap->line1 argument/window/buffer
wp = firstwin;
tp = first_tabpage;
switch (eap->cmdidx)
@ -1005,10 +1005,10 @@ ex_listdo(exarg_T *eap)
default:
break;
}
/* set pcmark now */
// set pcmark now
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
|| !buf->b_p_bl); buf = buf->b_next)
if (buf->b_fnum > eap->line2)
@ -1033,28 +1033,28 @@ ex_listdo(exarg_T *eap)
buf = curbuf;
i = eap->line1 - 1;
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;
}
}
#endif
else
setpcmark();
listcmd_busy = TRUE; /* avoids setting pcmark below */
listcmd_busy = TRUE; // avoids setting pcmark below
while (!got_int && buf != NULL)
{
if (eap->cmdidx == CMD_argdo)
{
/* go to argument "i" */
// go to argument "i"
if (i == ARGCOUNT)
break;
/* Don't call do_argfile() when already there, it will try
* reloading the file. */
// Don't call do_argfile() when already there, it will try
// reloading the file.
if (curwin->w_arg_idx != i || !editing_arg_idx(curwin))
{
/* Clear 'shm' to avoid that the file message overwrites
* any output from the command. */
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
p_shm_save = vim_strsave(p_shm);
set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
do_argfile(eap, i);
@ -1066,17 +1066,17 @@ ex_listdo(exarg_T *eap)
}
else if (eap->cmdidx == CMD_windo)
{
/* go to window "wp" */
// go to window "wp"
if (!win_valid(wp))
break;
win_goto(wp);
if (curwin != wp)
break; /* something must be wrong */
break; // something must be wrong
wp = curwin->w_next;
}
else if (eap->cmdidx == CMD_tabdo)
{
/* go to window "tp" */
// go to window "tp"
if (!valid_tabpage(tp))
break;
goto_tabpage_tp(tp, TRUE, TRUE);
@ -1084,8 +1084,8 @@ ex_listdo(exarg_T *eap)
}
else if (eap->cmdidx == CMD_bufdo)
{
/* Remember the number of the next listed buffer, in case
* ":bwipe" is used or autocommands do something strange. */
// Remember the number of the next listed buffer, in case
// ":bwipe" is used or autocommands do something strange.
next_fnum = -1;
for (buf = curbuf->b_next; buf != NULL; buf = buf->b_next)
if (buf->b_p_bl)
@ -1097,31 +1097,31 @@ ex_listdo(exarg_T *eap)
++i;
/* execute the command */
// execute the command
do_cmdline(eap->arg, eap->getline, eap->cookie,
DOCMD_VERBOSE + DOCMD_NOWAIT);
if (eap->cmdidx == CMD_bufdo)
{
/* Done? */
// Done?
if (next_fnum < 0 || next_fnum > eap->line2)
break;
/* Check if the buffer still exists. */
// Check if the buffer still exists.
FOR_ALL_BUFFERS(buf)
if (buf->b_fnum == next_fnum)
break;
if (buf == NULL)
break;
/* Go to the next buffer. Clear 'shm' to avoid that the file
* message overwrites any output from the command. */
// Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command.
p_shm_save = vim_strsave(p_shm);
set_option_value((char_u *)"shm", 0L, (char_u *)"", 0);
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
set_option_value((char_u *)"shm", 0L, p_shm_save, 0);
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)
break;
}
@ -1137,7 +1137,7 @@ ex_listdo(exarg_T *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)
break;
}
@ -1145,9 +1145,9 @@ ex_listdo(exarg_T *eap)
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)
do_check_scrollbind(TRUE);
}
@ -1213,9 +1213,9 @@ ex_compiler(exarg_T *eap)
if (*eap->arg == NUL)
{
/* List all compiler scripts. */
// List all compiler scripts.
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
/* ) keep the indenter happy... */
// ) keep the indenter happy...
}
else
{
@ -1224,18 +1224,18 @@ ex_compiler(exarg_T *eap)
{
if (eap->forceit)
{
/* ":compiler! {name}" sets global options */
// ":compiler! {name}" sets global options
do_cmdline_cmd((char_u *)
"command -nargs=* CompilerSet set <args>");
}
else
{
/* ":compiler! {name}" sets local options.
* To remain backwards compatible "current_compiler" is always
* used. A user's compiler plugin may set it, the distributed
* plugin will then skip the settings. Afterwards set
* "b:current_compiler" and restore "current_compiler".
* Explicitly prepend "g:" to make it work in a function. */
// ":compiler! {name}" sets local options.
// To remain backwards compatible "current_compiler" is always
// used. A user's compiler plugin may set it, the distributed
// plugin will then skip the settings. Afterwards set
// "b:current_compiler" and restore "current_compiler".
// Explicitly prepend "g:" to make it work in a function.
old_cur_comp = get_var_value((char_u *)"g:current_compiler");
if (old_cur_comp != NULL)
old_cur_comp = vim_strsave(old_cur_comp);
@ -1252,12 +1252,12 @@ ex_compiler(exarg_T *eap)
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");
if (p != NULL)
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 (old_cur_comp != NULL)
@ -1322,7 +1322,7 @@ requires_py_version(char_u *filename)
break;
if (i == 0 && IObuff[0] == '#' && IObuff[1] == '!')
{
/* Check shebang. */
// Check shebang.
if (strstr((char *)IObuff + 2, "python2") != NULL)
{
requires_py_version = 2;
@ -1367,7 +1367,7 @@ source_pyx_file(exarg_T *eap, char_u *fname)
if (v == 0)
{
# 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;
# elif defined(FEAT_PYTHON)
v = 2;
@ -1472,12 +1472,12 @@ ex_checktime(exarg_T *eap)
int save_no_check_timestamps = no_check_timestamps;
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);
else
{
buf = buflist_findnr((int)eap->line2);
if (buf != NULL) /* cannot happen? */
if (buf != NULL) // cannot happen?
(void)buf_check_timestamp(buf, FALSE);
}
no_check_timestamps = save_no_check_timestamps;
@ -1491,7 +1491,7 @@ get_locale_val(int what)
{
char_u *loc;
/* Obtain the locale value from the libraries. */
// Obtain the locale value from the libraries.
loc = (char_u *)setlocale(what, NULL);
# ifdef MSWIN
@ -1499,13 +1499,13 @@ get_locale_val(int what)
{
char_u *p;
/* setocale() returns something like "LC_COLLATE=<name>;LC_..." when
* one of the values (e.g., LC_CTYPE) differs. */
// setocale() returns something like "LC_COLLATE=<name>;LC_..." when
// one of the values (e.g., LC_CTYPE) differs.
p = vim_strchr(loc, '=');
if (p != NULL)
{
loc = ++p;
while (*p != NUL) /* remove trailing newline */
while (*p != NUL) // remove trailing newline
{
if (*p < ' ' || *p == ';')
{
@ -1585,10 +1585,10 @@ get_mess_lang(void)
# if defined(LC_MESSAGES)
p = get_locale_val(LC_MESSAGES);
# else
/* 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
* and LC_MONETARY may be set differently for a Japanese working in the
* US. */
// 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
// and LC_MONETARY may be set differently for a Japanese working in the
// US.
p = get_locale_val(LC_COLLATE);
# endif
# else
@ -1607,7 +1607,7 @@ get_mess_lang(void)
}
#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)) \
&& defined(LC_MESSAGES))) \
|| ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
@ -1628,7 +1628,7 @@ get_mess_env(void)
{
p = mch_getenv((char_u *)"LANG");
if (p != NULL && VIM_ISDIGIT(*p))
p = NULL; /* ignore something like "1043" */
p = NULL; // ignore something like "1043"
# ifdef HAVE_GET_LOCALE_VAL
if (p == NULL || *p == NUL)
p = get_locale_val(LC_CTYPE);
@ -1653,13 +1653,13 @@ set_lang_var(void)
# ifdef HAVE_GET_LOCALE_VAL
loc = get_locale_val(LC_CTYPE);
# else
/* setlocale() not supported: use the default value */
// setlocale() not supported: use the default value
loc = (char_u *)"C";
# endif
set_vim_var_string(VV_CTYPE, loc, -1);
/* When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall
* back to LC_CTYPE if it's empty. */
// When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall
// back to LC_CTYPE if it's empty.
# if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES)
loc = get_locale_val(LC_MESSAGES);
# else
@ -1694,9 +1694,9 @@ ex_language(exarg_T *eap)
name = eap->arg;
/* Check for "messages {name}", "ctype {name}" or "time {name}" argument.
* Allow abbreviation, but require at least 3 characters to avoid
* confusion with a two letter language name "me" or "ct". */
// Check for "messages {name}", "ctype {name}" or "time {name}" argument.
// Allow abbreviation, but require at least 3 characters to avoid
// confusion with a two letter language name "me" or "ct".
p = skiptowhite(eap->arg);
if ((*p == NUL || VIM_ISWHITE(*p)) && p - eap->arg >= 3)
{
@ -1742,7 +1742,7 @@ ex_language(exarg_T *eap)
{
loc = setlocale(what, (char *)name);
#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");
#endif
}
@ -1751,31 +1751,31 @@ ex_language(exarg_T *eap)
else
{
#ifdef HAVE_NL_MSG_CAT_CNTR
/* Need to do this for GNU gettext, otherwise cached translations
* will be used again. */
// Need to do this for GNU gettext, otherwise cached translations
// will be used again.
extern int _nl_msg_cat_cntr;
++_nl_msg_cat_cntr;
#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 *)"");
if (what != LC_TIME)
{
/* Tell gettext() what to translate to. It apparently doesn't
* use the currently effective locale. Also do this when
* FEAT_GETTEXT isn't defined, so that shell commands use this
* value. */
// Tell gettext() what to translate to. It apparently doesn't
// use the currently effective locale. Also do this when
// FEAT_GETTEXT isn't defined, so that shell commands use this
// value.
if (what == LC_ALL)
{
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 *)"");
# ifdef MSWIN
/* Apparently MS-Windows printf() may cause a crash when
* we give it 8-bit text while it's expecting text in the
* current locale. This call avoids that. */
// Apparently MS-Windows printf() may cause a crash when
// we give it 8-bit text while it's expecting text in the
// current locale. This call avoids that.
setlocale(LC_CTYPE, "C");
# endif
}
@ -1795,7 +1795,7 @@ ex_language(exarg_T *eap)
}
# 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();
# endif
# 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
static int did_init_locales = FALSE;
@ -1820,16 +1820,16 @@ find_locales(void)
garray_T locales_ga;
char_u *loc;
/* Find all available locales by running command "locale -a". If this
* doesn't work we won't have completion. */
// Find all available locales by running command "locale -a". If this
// doesn't work we won't have completion.
char_u *locale_a = get_cmd_output((char_u *)"locale -a",
NULL, SHELL_SILENT, NULL);
if (locale_a == NULL)
return NULL;
ga_init2(&locales_ga, sizeof(char_u *), 20);
/* Transform locale_a string where each locale is separated by "\n"
* into an array of locale strings. */
// Transform locale_a string where each locale is separated by "\n"
// into an array of locale strings.
loc = (char_u *)strtok((char *)locale_a, "\n");
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.
*/
#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_INTERRUPT (!eval_to_number("$VIMNOINTTHROW"))
# define THROW_TEST
#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_INTERRUPT TRUE
@ -127,8 +127,8 @@ should_abort(int retcode)
int
aborted_in_try(void)
{
/* This function is only called after an error. In this case, "force_abort"
* determines whether searching for finally clauses is necessary. */
// This function is only called after an error. In this case, "force_abort"
// determines whether searching for finally clauses is necessary.
return force_abort;
}
@ -215,9 +215,9 @@ cause_errthrow(
*/
if (did_throw)
{
/* When discarding an interrupt exception, reset got_int to prevent the
* same interrupt being converted to an exception again and discarding
* the error exception we are about to throw here. */
// When discarding an interrupt exception, reset got_int to prevent the
// same interrupt being converted to an exception again and discarding
// the error exception we are about to throw here.
if (current_exception->type == ET_INTERRUPT)
got_int = FALSE;
discard_current_exception();
@ -276,7 +276,7 @@ cause_errthrow(
{
char *tmsg;
/* Skip the extra "Vim " prefix for message "E458". */
// Skip the extra "Vim " prefix for message "E458".
tmsg = elem->msg;
if (STRNCMP(tmsg, "Vim E", 5) == 0
&& VIM_ISDIGIT(tmsg[5])
@ -342,8 +342,8 @@ do_errthrow(struct condstack *cstack, char_u *cmdname)
force_abort = TRUE;
}
/* 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. */
// 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.
if (msg_list == NULL || *msg_list == NULL)
return;
@ -374,7 +374,7 @@ do_intthrow(struct condstack *cstack)
if (!got_int || (trylevel == 0 && !did_throw))
return FALSE;
#ifdef THROW_TEST /* avoid warning for condition always true */
#ifdef THROW_TEST // avoid warning for condition always true
if (!THROW_ON_INTERRUPT)
{
/*
@ -401,7 +401,7 @@ do_intthrow(struct condstack *cstack)
if (current_exception->type == ET_INTERRUPT)
return FALSE;
/* An interrupt exception replaces any user or error exception. */
// An interrupt exception replaces any user or error exception.
discard_current_exception();
}
if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) != FAIL)
@ -449,9 +449,9 @@ get_exception_string(
val = ret + 4;
}
/* 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
* parentheses and move it to the end. */
// 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
// parentheses and move it to the end.
for (p = mesg; ; p++)
{
if (*p == NUL
@ -464,13 +464,13 @@ get_exception_string(
&& p[4] == ':'))))))
{
if (*p == NUL || p == mesg)
STRCAT(val, mesg); /* 'E123' missing or at beginning */
STRCAT(val, mesg); // 'E123' missing or at beginning
else
{
/* '"filename" E123: message text' */
// '"filename" E123: message text'
if (mesg[0] != '"' || p-2 < &mesg[1] ||
p[-2] != '"' || p[-1] != ' ')
/* "E123:" is part of the file name. */
// "E123:" is part of the file name.
continue;
STRCAT(val, p);
@ -525,8 +525,8 @@ throw_exception(void *value, except_type_T type, char_u *cmdname)
goto nomem;
if (type == ET_ERROR)
/* Store the original message and prefix the exception value with
* "Vim:" or, if a command name is given, "Vim(cmdname):". */
// Store the original message and prefix the exception value with
// "Vim:" or, if a command name is given, "Vim(cmdname):".
excp->messages = (struct msglist *)value;
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;
if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */
msg_silent = FALSE; // display messages
else
verbose_enter();
++no_wait_return;
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);
msg_puts("\n"); /* don't overwrite this either */
msg_puts("\n"); // don't overwrite this either
if (debug_break_level > 0 || *p_vfile == NUL)
cmdline_row = msg_row;
@ -601,17 +601,17 @@ discard_exception(except_T *excp, int was_finished)
saved_IObuff = vim_strsave(IObuff);
if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */
msg_silent = FALSE; // display messages
else
verbose_enter();
++no_wait_return;
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
? _("Exception finished: %s")
: _("Exception discarded: %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)
cmdline_row = msg_row;
--no_wait_return;
@ -664,7 +664,7 @@ catch_exception(except_T *excp)
set_vim_var_string(VV_THROWPOINT, IObuff, -1);
}
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);
if (p_verbose >= 13 || debug_break_level > 0)
@ -672,15 +672,15 @@ catch_exception(except_T *excp)
int save_msg_silent = msg_silent;
if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */
msg_silent = FALSE; // display messages
else
verbose_enter();
++no_wait_return;
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);
msg_puts("\n"); /* don't overwrite this either */
msg_puts("\n"); // don't overwrite this either
if (debug_break_level > 0 || *p_vfile == NUL)
cmdline_row = msg_row;
@ -716,8 +716,8 @@ finish_exception(except_T *excp)
set_vim_var_string(VV_THROWPOINT, IObuff, -1);
}
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);
}
else
@ -726,7 +726,7 @@ finish_exception(except_T *excp)
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);
}
@ -760,7 +760,7 @@ report_pending(int action, int pending, void *value)
case RP_RESUME:
mesg = _("%s resumed");
break;
/* case RP_DISCARD: */
// case RP_DISCARD:
default:
mesg = _("%s discarded");
break;
@ -781,7 +781,7 @@ report_pending(int action, int pending, void *value)
s = ":finish";
break;
case CSTP_RETURN:
/* ":return" command producing value, allocated */
// ":return" command producing value, allocated
s = (char *)get_return_cmd(value);
break;
@ -797,17 +797,17 @@ report_pending(int action, int pending, void *value)
s = _("Error and interrupt");
else if (pending & CSTP_ERROR)
s = _("Error");
else /* if (pending & CSTP_INTERRUPT) */
else // if (pending & CSTP_INTERRUPT)
s = _("Interrupt");
}
save_msg_silent = msg_silent;
if (debug_break_level > 0)
msg_silent = FALSE; /* display messages */
msg_silent = FALSE; // display messages
++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */
msg_scroll = TRUE; // always scroll up, don't overwrite
smsg(mesg, s);
msg_puts("\n"); /* don't overwrite this either */
msg_puts("\n"); // don't overwrite this either
cmdline_row = msg_row;
--no_wait_return;
if (debug_break_level > 0)
@ -916,7 +916,7 @@ ex_if(exarg_T *eap)
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE;
}
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;
}
}
@ -992,12 +992,12 @@ ex_else(exarg_T *eap)
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 (eap->errmsg == NULL)
cstack->cs_flags[cstack->cs_idx] = CSF_TRUE;
skip = TRUE; /* don't evaluate an ":elseif" */
skip = TRUE; // don't evaluate an ":elseif"
}
else
cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE;
@ -1021,11 +1021,11 @@ ex_else(exarg_T *eap)
if (eap->cmdidx == CMD_elseif)
{
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
/* When throwing error exceptions, we want to throw always the first
* of several errors in a row. This is what actually happens when
* a conditional error was detected above and there is another failure
* when parsing the expression. Since the skip flag is set in this
* case, the parsing error will be ignored by emsg(). */
// When throwing error exceptions, we want to throw always the first
// of several errors in a row. This is what actually happens when
// a conditional error was detected above and there is another failure
// when parsing the expression. Since the skip flag is set in this
// case, the parsing error will be ignored by emsg().
if (!skip && !error)
{
@ -1035,7 +1035,7 @@ ex_else(exarg_T *eap)
cstack->cs_flags[cstack->cs_idx] = 0;
}
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;
}
else
@ -1093,19 +1093,19 @@ ex_while(exarg_T *eap)
*/
if ((cstack->cs_lflags & CSL_HAD_LOOP) != 0)
{
/* Jumping here from a ":continue" or ":endfor": use the
* previously evaluated list. */
// Jumping here from a ":continue" or ":endfor": use the
// previously evaluated list.
fi = cstack->cs_forinfo[cstack->cs_idx];
error = FALSE;
}
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);
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)
result = next_for_item(fi, eap->arg);
else
@ -1131,10 +1131,10 @@ ex_while(exarg_T *eap)
else
{
cstack->cs_lflags &= ~CSL_HAD_LOOP;
/* If the ":while" evaluates to FALSE or ":for" is past the end of
* the list, show the debug prompt at the ":endwhile"/":endfor" as
* if there was a ":break" in a ":while"/":for" evaluating to
* TRUE. */
// If the ":while" evaluates to FALSE or ":for" is past the end of
// the list, show the debug prompt at the ":endwhile"/":endfor" as
// if there was a ":break" in a ":while"/":for" evaluating to
// TRUE.
if (!skip && !error)
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");
else
{
/* Try to find the matching ":while". This might stop at a try
* conditional not in its finally clause (which is then to be executed
* next). Therefor, inactivate all conditionals except the ":while"
* itself (if reached). */
// Try to find the matching ":while". This might stop at a try
// conditional not in its finally clause (which is then to be executed
// next). Therefor, inactivate all conditionals except the ":while"
// itself (if reached).
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE);
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
* 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
{
/* If a try conditional not in its finally clause is reached first,
* make the ":continue" pending for execution at the ":endtry". */
// If a try conditional not in its finally clause is reached first,
// make the ":continue" pending for execution at the ":endtry".
cstack->cs_pending[idx] = CSTP_CONTINUE;
report_make_pending(CSTP_CONTINUE, NULL);
}
@ -1192,10 +1192,10 @@ ex_break(exarg_T *eap)
eap->errmsg = N_("E587: :break without :while or :for");
else
{
/* Inactivate conditionals until the matching ":while" or a try
* conditional not in its finally clause (which is then to be
* executed next) is found. In the latter case, make the ":break"
* pending for execution at the ":endtry". */
// Inactivate conditionals until the matching ":while" or a try
// conditional not in its finally clause (which is then to be
// executed next) is found. In the latter case, make the ":break"
// pending for execution at the ":endtry".
idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE);
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];
if (!(fl & csf))
{
/* If we are in a ":while" or ":for" but used the wrong endloop
* command, do not rewind to the next enclosing ":for"/":while". */
// If we are in a ":while" or ":for" but used the wrong endloop
// command, do not rewind to the next enclosing ":for"/":while".
if (fl & CSF_WHILE)
eap->errmsg = _("E732: Using :endfor with :while");
else if (fl & CSF_FOR)
@ -1248,21 +1248,21 @@ ex_endwhile(exarg_T *eap)
eap->errmsg = e_endif;
else if (fl & CSF_FINALLY)
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)
{
fl = cstack->cs_flags[idx];
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY))
{
/* Give up at a try conditional not in its finally clause.
* Ignore the ":endwhile"/":endfor". */
// Give up at a try conditional not in its finally clause.
// Ignore the ":endwhile"/":endfor".
eap->errmsg = err;
return;
}
if (fl & csf)
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);
rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel);
}
@ -1308,8 +1308,8 @@ ex_throw(exarg_T *eap)
value = NULL;
}
/* On error or when an exception is thrown during argument evaluation, do
* not throw. */
// On error or when an exception is thrown during argument evaluation, do
// not throw.
if (!eap->skip && value != NULL)
{
if (throw_exception(value, ET_USER, NULL) == FAIL)
@ -1374,17 +1374,17 @@ do_throw(struct condstack *cstack)
if (cstack->cs_flags[idx] & CSF_ACTIVE)
cstack->cs_flags[idx] |= CSF_THROWN;
else
/* THROWN may have already been set for a catchable exception
* that has been discarded. Ensure it is reset for the new
* exception. */
// THROWN may have already been set for a catchable exception
// that has been discarded. Ensure it is reset for the new
// exception.
cstack->cs_flags[idx] &= ~CSF_THROWN;
}
cstack->cs_flags[idx] &= ~CSF_ACTIVE;
cstack->cs_exception[idx] = current_exception;
}
#if 0
/* TODO: Add optimization below. Not yet done because of interface
* problems to eval.c and ex_cmds2.c. (Servatius) */
// TODO: Add optimization below. Not yet done because of interface
// problems to eval.c and ex_cmds2.c. (Servatius)
else
{
/*
@ -1429,9 +1429,9 @@ ex_try(exarg_T *eap)
if (!skip)
{
/* Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
* commands should check for a match if an exception is thrown and
* that the finally clause needs to be executed. */
// Set ACTIVE and TRUE. TRUE means that the corresponding ":catch"
// commands should check for a match if an exception is thrown and
// that the finally clause needs to be executed.
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))
{
/* Report what's missing if the matching ":try" is not in its
* finally clause. */
// Report what's missing if the matching ":try" is not in its
// finally clause.
eap->errmsg = get_end_emsg(cstack);
skip = TRUE;
}
@ -1508,8 +1508,8 @@ ex_catch(exarg_T *eap)
break;
if (cstack->cs_flags[idx] & CSF_FINALLY)
{
/* Give up for a ":catch" after ":finally" and ignore it.
* Just parse. */
// Give up for a ":catch" after ":finally" and ignore it.
// Just parse.
eap->errmsg = N_("E604: :catch after :finally");
give_up = TRUE;
}
@ -1518,7 +1518,7 @@ ex_catch(exarg_T *eap)
&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 *)".*";
end = NULL;
@ -1554,17 +1554,17 @@ ex_catch(exarg_T *eap)
return;
}
/* When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done) before checking for a match.
* This is a helpful hint for the user when the regular expression
* matching fails. Handle a ">quit" debug command as if an
* interrupt had occurred before the ":catch". That is, discard
* the original exception, replace it by an interrupt exception,
* and don't catch it in this try block. */
// When debugging or a breakpoint was encountered, display the
// debug prompt (if not already done) before checking for a match.
// This is a helpful hint for the user when the regular expression
// matching fails. Handle a ">quit" debug command as if an
// interrupt had occurred before the ":catch". That is, discard
// the original exception, replace it by an interrupt exception,
// and don't catch it in this try block.
if (!dbg_check_skipped(eap) || !do_intthrow(cstack))
{
/* Terminate the pattern and avoid the 'l' flag in 'cpoptions'
* while compiling it. */
// Terminate the pattern and avoid the 'l' flag in 'cpoptions'
// while compiling it.
if (end != NULL)
{
save_char = *end;
@ -1572,8 +1572,8 @@ ex_catch(exarg_T *eap)
}
save_cpo = p_cpo;
p_cpo = (char_u *)"";
/* Disable error messages, it will make current_exception
* invalid. */
// Disable error messages, it will make current_exception
// invalid.
++emsg_off;
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
--emsg_off;
@ -1602,16 +1602,16 @@ ex_catch(exarg_T *eap)
if (caught)
{
/* Make this ":catch" clause active and reset did_emsg, got_int,
* and did_throw. Put the exception on the caught stack. */
// Make this ":catch" clause active and reset did_emsg, got_int,
// and did_throw. Put the exception on the caught stack.
cstack->cs_flags[idx] |= CSF_ACTIVE | CSF_CAUGHT;
did_emsg = got_int = did_throw = FALSE;
catch_exception((except_T *)cstack->cs_exception[idx]);
/* It's mandatory that the current exception is stored in the cstack
* so that it can be discarded at the next ":catch", ":finally", or
* ":endtry" or when the catch clause is left by a ":continue",
* ":break", ":return", ":finish", error, interrupt, or another
* exception. */
// It's mandatory that the current exception is stored in the cstack
// so that it can be discarded at the next ":catch", ":finally", or
// ":endtry" or when the catch clause is left by a ":continue",
// ":break", ":return", ":finish", error, interrupt, or another
// exception.
if (cstack->cs_exception[cstack->cs_idx] != current_exception)
internal_error("ex_catch()");
}
@ -1656,9 +1656,9 @@ ex_finally(exarg_T *eap)
for (idx = cstack->cs_idx - 1; idx > 0; --idx)
if (cstack->cs_flags[idx] & CSF_TRY)
break;
/* Make this error pending, so that the commands in the following
* finally clause can be executed. This overrules also a pending
* ":continue", ":break", ":return", or ":finish". */
// Make this error pending, so that the commands in the following
// finally clause can be executed. This overrules also a pending
// ":continue", ":break", ":return", or ":finish".
pending = CSTP_ERROR;
}
else
@ -1666,7 +1666,7 @@ ex_finally(exarg_T *eap)
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");
return;
}
@ -1685,15 +1685,15 @@ ex_finally(exarg_T *eap)
if (!skip)
{
/* When debugging or a breakpoint was encountered, display the
* debug prompt (if not already done). The user then knows that the
* finally clause is executed. */
// When debugging or a breakpoint was encountered, display the
// debug prompt (if not already done). The user then knows that the
// finally clause is executed.
if (dbg_check_skipped(eap))
{
/* Handle a ">quit" debug command as if an interrupt had
* occurred before the ":finally". That is, discard the
* original exception and replace it by an interrupt
* exception. */
// Handle a ">quit" debug command as if an interrupt had
// occurred before the ":finally". That is, discard the
// original exception and replace it by an interrupt
// exception.
(void)do_intthrow(cstack);
}
@ -1738,13 +1738,13 @@ ex_finally(exarg_T *eap)
pending |= got_int ? CSTP_INTERRUPT : 0;
cstack->cs_pending[cstack->cs_idx] = pending;
/* It's mandatory that the current exception is stored in the
* cstack so that it can be rethrown at the ":endtry" or be
* discarded if the finally clause is left by a ":continue",
* ":break", ":return", ":finish", error, interrupt, or another
* exception. When emsg() is called for a missing ":endif" or
* a missing ":endwhile"/":endfor" detected here, the
* exception will be discarded. */
// It's mandatory that the current exception is stored in the
// cstack so that it can be rethrown at the ":endtry" or be
// discarded if the finally clause is left by a ":continue",
// ":break", ":return", ":finish", error, interrupt, or another
// exception. When emsg() is called for a missing ":endif" or
// a missing ":endwhile"/":endfor" detected here, the
// exception will be discarded.
if (did_throw && cstack->cs_exception[cstack->cs_idx]
!= current_exception)
internal_error("ex_finally()");
@ -1796,7 +1796,7 @@ ex_endtry(exarg_T *eap)
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY))
{
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;
do
--idx;
@ -1830,28 +1830,27 @@ ex_endtry(exarg_T *eap)
rethrow = TRUE;
}
/* If there was no finally clause, show the user when debugging or
* a breakpoint was encountered that the end of the try conditional has
* been reached: display the debug prompt (if not already done). Do
* 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
* a ":break", ":continue", ":return", or ":finish" is pending. These
* actions are carried out immediately.
*/
// If there was no finally clause, show the user when debugging or
// a breakpoint was encountered that the end of the try conditional has
// been reached: display the debug prompt (if not already done). Do
// 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
// a ":break", ":continue", ":return", or ":finish" is pending. These
// actions are carried out immediately.
if ((rethrow || (!skip
&& !(cstack->cs_flags[idx] & CSF_FINALLY)
&& !cstack->cs_pending[idx]))
&& dbg_check_skipped(eap))
{
/* Handle a ">quit" debug command as if an interrupt had occurred
* before the ":endtry". That is, throw an interrupt exception and
* set "skip" and "rethrow". */
// Handle a ">quit" debug command as if an interrupt had occurred
// before the ":endtry". That is, throw an interrupt exception and
// set "skip" and "rethrow".
if (got_int)
{
skip = TRUE;
(void)do_intthrow(cstack);
/* The do_intthrow() call may have reset did_throw or
* cstack->cs_pending[idx].*/
// The do_intthrow() call may have reset did_throw or
// cstack->cs_pending[idx].
rethrow = FALSE;
if (did_throw && !(cstack->cs_flags[idx] & CSF_FINALLY))
rethrow = TRUE;
@ -1899,13 +1898,13 @@ ex_endtry(exarg_T *eap)
case CSTP_NONE:
break;
/* Reactivate a pending ":continue", ":break", ":return",
* ":finish" from the try block or a catch clause of this try
* conditional. This is skipped, if there was an error in an
* (unskipped) conditional command or an interrupt afterwards
* or if the finally clause is present and executed a new error,
* interrupt, throw, ":continue", ":break", ":return", or
* ":finish". */
// Reactivate a pending ":continue", ":break", ":return",
// ":finish" from the try block or a catch clause of this try
// conditional. This is skipped, if there was an error in an
// (unskipped) conditional command or an interrupt afterwards
// or if the finally clause is present and executed a new error,
// interrupt, throw, ":continue", ":break", ":return", or
// ":finish".
case CSTP_CONTINUE:
ex_continue(eap);
break;
@ -1919,12 +1918,12 @@ ex_endtry(exarg_T *eap)
do_finish(eap, FALSE);
break;
/* When the finally clause was entered due to an error,
* interrupt or throw (as opposed to a ":continue", ":break",
* ":return", or ":finish"), restore the pending values of
* did_emsg, got_int, and did_throw. This is skipped, if there
* was a new error, interrupt, throw, ":continue", ":break",
* ":return", or ":finish". in the finally clause. */
// When the finally clause was entered due to an error,
// interrupt or throw (as opposed to a ":continue", ":break",
// ":return", or ":finish"), restore the pending values of
// did_emsg, got_int, and did_throw. This is skipped, if there
// was a new error, interrupt, throw, ":continue", ":break",
// ":return", or ":finish". in the finally clause.
default:
if (pending & CSTP_ERROR)
did_emsg = TRUE;
@ -1937,7 +1936,7 @@ ex_endtry(exarg_T *eap)
}
if (rethrow)
/* Rethrow the current exception (within this cstack). */
// Rethrow the current exception (within this cstack).
do_throw(cstack);
}
}
@ -1980,13 +1979,12 @@ enter_cleanup(cleanup_T *csp)
| (did_throw ? CSTP_THROW : 0)
| (need_rethrow ? CSTP_THROW : 0);
/* If we are currently throwing an exception (did_throw), save it as
* well. On an error not yet converted to an exception, update
* "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
* for autocommand execution. We need not save *msg_list because
* there is an extra instance for every call of do_cmdline(), anyway.
*/
// If we are currently throwing an exception (did_throw), save it as
// well. On an error not yet converted to an exception, update
// "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
// for autocommand execution. We need not save *msg_list because
// there is an extra instance for every call of do_cmdline(), anyway.
if (did_throw || need_rethrow)
{
csp->exception = current_exception;
@ -2003,7 +2001,7 @@ enter_cleanup(cleanup_T *csp)
}
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);
}
else
@ -2033,23 +2031,23 @@ leave_cleanup(cleanup_T *csp)
{
int pending = csp->pending;
if (pending == CSTP_NONE) /* nothing to do */
if (pending == CSTP_NONE) // nothing to do
return;
/* If there was an aborting error, an interrupt, or an uncaught exception
* after the corresponding call to enter_cleanup(), discard what has been
* made pending by it. Report this to the user if required by the
* 'verbose' option or when debugging. */
// If there was an aborting error, an interrupt, or an uncaught exception
// after the corresponding call to enter_cleanup(), discard what has been
// made pending by it. Report this to the user if required by the
// 'verbose' option or when debugging.
if (aborting() || need_rethrow)
{
if (pending & CSTP_THROW)
/* Cancel the pending exception (includes report). */
// Cancel the pending exception (includes report).
discard_exception((except_T *)csp->exception, FALSE);
else
report_discard_pending(pending, NULL);
/* If an error was about to be converted to an exception when
* enter_cleanup() was called, free the message list. */
// If an error was about to be converted to an exception when
// enter_cleanup() was called, free the message list.
if (msg_list != NULL)
free_global_msglist();
}
@ -2088,9 +2086,9 @@ leave_cleanup(cleanup_T *csp)
if (pending & CSTP_INTERRUPT)
got_int = TRUE;
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,
(pending & CSTP_THROW) ? (void *)current_exception : NULL);
}
@ -2158,9 +2156,9 @@ cleanup_conditionals(
{
if (cstack->cs_pending[idx] & CSTP_THROW)
{
/* Cancel the pending exception. This is in the
* finally clause, so that the stack of the
* caught exceptions is not involved. */
// Cancel the pending exception. This is in the
// finally clause, so that the stack of the
// caught exceptions is not involved.
discard_exception((except_T *)
cstack->cs_exception[idx],
FALSE);
@ -2184,10 +2182,10 @@ cleanup_conditionals(
if ((cstack->cs_flags[idx] & CSF_ACTIVE)
&& (cstack->cs_flags[idx] & CSF_CAUGHT))
finish_exception((except_T *)cstack->cs_exception[idx]);
/* Stop at this try conditional - except the try block never
* got active (because of an inactive surrounding conditional
* or when the ":try" appeared after an error or interrupt or
* throw). */
// Stop at this try conditional - except the try block never
// got active (because of an inactive surrounding conditional
// or when the ":try" appeared after an error or interrupt or
// throw).
if (cstack->cs_flags[idx] & CSF_TRUE)
{
if (searched_cond == 0 && !inclusive)
@ -2197,10 +2195,10 @@ cleanup_conditionals(
}
}
/* Stop on the searched conditional type (even when the surrounding
* conditional is not active or something has been made pending).
* If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT,
* check first whether "emsg_silent" needs to be restored. */
// Stop on the searched conditional type (even when the surrounding
// conditional is not active or something has been made pending).
// If "inclusive" is TRUE and "searched_cond" is CSF_TRY|CSF_SILENT,
// check first whether "emsg_silent" needs to be restored.
if (cstack->cs_flags[idx] & searched_cond)
{
if (!inclusive)
@ -2288,7 +2286,7 @@ has_loop_cmd(char_u *p)
{
int len;
/* skip modifiers, white space and ':' */
// skip modifiers, white space and ':'
for (;;)
{
while (*p == ' ' || *p == '\t' || *p == ':')
@ -2304,4 +2302,4 @@ has_loop_cmd(char_u *p)
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.
*/
/* Compute the length of the new path. */
// Compute the length of the new path.
sfx_len = (int)(save_endp - endp) + 1;
new_len = len + sfx_len;
@ -2367,7 +2367,7 @@ fullpathcmp(
r2 = mch_stat((char *)s2, &st2);
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 (fnamecmp(exp1, s2) == 0)
@ -3689,7 +3689,7 @@ gen_expand_wildcards(
void
addfile(
garray_T *gap,
char_u *f, /* filename */
char_u *f, // filename
int flags)
{
char_u *p;

View File

@ -968,7 +968,7 @@ vim_findfile(void *search_ctx_arg)
{
if (!path_with_url(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
// below
@ -2690,7 +2690,7 @@ simplify_filename(char_u *filename)
char_u saved_char;
stat_T st;
/* Don't strip for an erroneous file name. */
// Don't strip for an erroneous file name.
if (!stripping_disabled)
{
// 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]);
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;
}
#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[] =
{ /* Add new patch number below this line */
/**/
2379,
/**/
2378,
/**/