summaryrefslogtreecommitdiffstats
path: root/src/ex_docmd.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-01 21:41:28 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-01 21:41:28 +0100
commit217e1b8359447f5550dcb0d1ee43380a90c253c5 (patch)
tree137e8b7d6f27848c95caa47e2fc13a4dc4c50d29 /src/ex_docmd.c
parent5d18efecfd6c45d69f55268948a22cd0465bb955 (diff)
patch 8.1.2379: using old C style commentsv8.1.2379
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r--src/ex_docmd.c985
1 files changed, 491 insertions, 494 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 677387f93b..b5ce9df4bd 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -23,7 +23,7 @@ static int ex_pressedreturn = FALSE;
static char_u *do_one_cmd(char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int, int), void *cookie);
#else
static char_u *do_one_cmd(char_u **, int, char_u *(*fgetline)(int, void *, int, int), void *cookie);
-static int if_level = 0; /* depth in :if */
+static int if_level = 0; // depth in :if
#endif
static void free_cmdmod(void);
static void append_command(char_u *cmd);
@@ -383,11 +383,11 @@ static char_u dollar_command[2] = {'$', 0};
#ifdef FEAT_EVAL
-/* Struct for storing a line inside a while/for loop */
+// Struct for storing a line inside a while/for loop
typedef struct
{
- char_u *line; /* command line */
- linenr_T lnum; /* sourcing_lnum of the line */
+ char_u *line; // command line
+ linenr_T lnum; // sourcing_lnum of the line
} wcmd_T;
/*
@@ -397,10 +397,10 @@ typedef struct
*/
struct loop_cookie
{
- garray_T *lines_gap; /* growarray with line info */
- int current_line; /* last read line from growarray */
- int repeating; /* TRUE when looping a second time */
- /* When "repeating" is FALSE use "getline" and "cookie" to get lines */
+ garray_T *lines_gap; // growarray with line info
+ int current_line; // last read line from growarray
+ int repeating; // TRUE when looping a second time
+ // When "repeating" is FALSE use "getline" and "cookie" to get lines
char_u *(*getline)(int, void *, int, int);
void *cookie;
};
@@ -409,7 +409,7 @@ static char_u *get_loop_line(int c, void *cookie, int indent, int do_concat);
static int store_loop_line(garray_T *gap, char_u *line);
static void free_cmdlines(garray_T *gap);
-/* Struct to save a few things while debugging. Used in do_cmdline() only. */
+// Struct to save a few things while debugging. Used in do_cmdline() only.
struct dbg_stuff
{
int trylevel;
@@ -434,7 +434,7 @@ save_dbg_stuff(struct dbg_stuff *dsp)
dsp->vv_exception = v_exception(NULL);
dsp->vv_throwpoint = v_throwpoint(NULL);
- /* Necessary for debugging an inactive ":catch", ":finally", ":endtry" */
+ // Necessary for debugging an inactive ":catch", ":finally", ":endtry"
dsp->did_emsg = did_emsg; did_emsg = FALSE;
dsp->got_int = got_int; got_int = FALSE;
dsp->did_throw = did_throw; did_throw = FALSE;
@@ -467,7 +467,7 @@ restore_dbg_stuff(struct dbg_stuff *dsp)
*/
void
do_exmode(
- int improved) /* TRUE for "improved Ex" mode */
+ int improved) // TRUE for "improved Ex" mode
{
int save_msg_scroll;
int prev_msg_row;
@@ -480,23 +480,23 @@ do_exmode(
exmode_active = EXMODE_NORMAL;
State = NORMAL;
- /* When using ":global /pat/ visual" and then "Q" we return to continue
- * the :global command. */
+ // When using ":global /pat/ visual" and then "Q" we return to continue
+ // the :global command.
if (global_busy)
return;
save_msg_scroll = msg_scroll;
- ++RedrawingDisabled; /* don't redisplay the window */
- ++no_wait_return; /* don't wait for return */
+ ++RedrawingDisabled; // don't redisplay the window
+ ++no_wait_return; // don't wait for return
#ifdef FEAT_GUI
- /* Ignore scrollbar and mouse events in Ex mode */
+ // Ignore scrollbar and mouse events in Ex mode
++hold_gui_events;
#endif
msg(_("Entering Ex mode. Type \"visual\" to go to Normal mode."));
while (exmode_active)
{
- /* Check for a ":normal" command and no more characters left. */
+ // Check for a ":normal" command and no more characters left.
if (ex_normal_busy > 0 && typebuf.tb_len == 0)
{
exmode_active = FALSE;
@@ -527,8 +527,8 @@ do_exmode(
{
if (ex_pressedreturn)
{
- /* go up one line, to overwrite the ":<CR>" line, so the
- * output doesn't contain empty lines. */
+ // go up one line, to overwrite the ":<CR>" line, so the
+ // output doesn't contain empty lines.
msg_row = prev_msg_row;
if (prev_msg_row == Rows - 1)
msg_row--;
@@ -538,7 +538,7 @@ do_exmode(
msg_clr_eos();
}
}
- else if (ex_pressedreturn && !ex_no_reprint) /* must be at EOF */
+ else if (ex_pressedreturn && !ex_no_reprint) // must be at EOF
{
if (curbuf->b_ml.ml_flags & ML_EMPTY)
emsg(_(e_emptybuf));
@@ -611,30 +611,30 @@ do_cmdline_cmd(char_u *cmd)
do_cmdline(
char_u *cmdline,
char_u *(*fgetline)(int, void *, int, int),
- void *cookie, /* argument for fgetline() */
+ void *cookie, // argument for fgetline()
int flags)
{
- char_u *next_cmdline; /* next cmd to execute */
- char_u *cmdline_copy = NULL; /* copy of cmd line */
- int used_getline = FALSE; /* used "fgetline" to obtain command */
- static int recursive = 0; /* recursive depth */
+ char_u *next_cmdline; // next cmd to execute
+ char_u *cmdline_copy = NULL; // copy of cmd line
+ int used_getline = FALSE; // used "fgetline" to obtain command
+ static int recursive = 0; // recursive depth
int msg_didout_before_start = 0;
- int count = 0; /* line number count */
- int did_inc = FALSE; /* incremented RedrawingDisabled */
+ int count = 0; // line number count
+ int did_inc = FALSE; // incremented RedrawingDisabled
int retval = OK;
#ifdef FEAT_EVAL
- struct condstack cstack; /* conditional stack */
- garray_T lines_ga; /* keep lines for ":while"/":for" */
- int current_line = 0; /* active line in lines_ga */
- char_u *fname = NULL; /* function or script name */
- linenr_T *breakpoint = NULL; /* ptr to breakpoint field in cookie */
- int *dbg_tick = NULL; /* ptr to dbg_tick field in cookie */
- struct dbg_stuff debug_saved; /* saved things for debug mode */
+ struct condstack cstack; // conditional stack
+ garray_T lines_ga; // keep lines for ":while"/":for"
+ int current_line = 0; // active line in lines_ga
+ char_u *fname = NULL; // function or script name
+ linenr_T *breakpoint = NULL; // ptr to breakpoint field in cookie
+ int *dbg_tick = NULL; // ptr to dbg_tick field in cookie
+ struct dbg_stuff debug_saved; // saved things for debug mode
int initial_trylevel;
struct msglist **saved_msg_list = NULL;
struct msglist *private_msg_list;
- /* "fgetline" and "cookie" passed to do_one_cmd() */
+ // "fgetline" and "cookie" passed to do_one_cmd()
char_u *(*cmd_getline)(int, void *, int, int);
void *cmd_cookie;
struct loop_cookie cmd_loop_cookie;
@@ -644,23 +644,23 @@ do_cmdline(
# define cmd_getline fgetline
# define cmd_cookie cookie
#endif
- static int call_depth = 0; /* recursiveness */
+ static int call_depth = 0; // recursiveness
#ifdef FEAT_EVAL
- /* For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
- * location for storing error messages to be converted to an exception.
- * This ensures that the do_errthrow() call in do_one_cmd() does not
- * combine the messages stored by an earlier invocation of do_one_cmd()
- * with the command name of the later one. This would happen when
- * BufWritePost autocommands are executed after a write error. */
+ // For every pair of do_cmdline()/do_one_cmd() calls, use an extra memory
+ // location for storing error messages to be converted to an exception.
+ // This ensures that the do_errthrow() call in do_one_cmd() does not
+ // combine the messages stored by an earlier invocation of do_one_cmd()
+ // with the command name of the later one. This would happen when
+ // BufWritePost autocommands are executed after a write error.
saved_msg_list = msg_list;
msg_list = &private_msg_list;
private_msg_list = NULL;
#endif
- /* It's possible to create an endless loop with ":execute", catch that
- * here. The value of 200 allows nested function calls, ":source", etc.
- * Allow 200 or 'maxfuncdepth', whatever is larger. */
+ // It's possible to create an endless loop with ":execute", catch that
+ // here. The value of 200 allows nested function calls, ":source", etc.
+ // Allow 200 or 'maxfuncdepth', whatever is larger.
if (call_depth >= 200
#ifdef FEAT_EVAL
&& call_depth >= p_mfd
@@ -669,8 +669,8 @@ do_cmdline(
{
emsg(_("E169: Command too recursive"));
#ifdef FEAT_EVAL
- /* When converting to an exception, we do not include the command name
- * since this is not an error of the specific command. */
+ // When converting to an exception, we do not include the command name
+ // since this is not an error of the specific command.
do_errthrow((struct condstack *)NULL, (char_u *)NULL);
msg_list = saved_msg_list;
#endif
@@ -688,13 +688,13 @@ do_cmdline(
real_cookie = getline_cookie(fgetline, cookie);
- /* Inside a function use a higher nesting level. */
+ // Inside a function use a higher nesting level.
getline_is_func = getline_equal(fgetline, cookie, get_func_line);
if (getline_is_func && ex_nesting_level == func_level(real_cookie))
++ex_nesting_level;
- /* Get the function or script name and the address where the next breakpoint
- * line and the debug tick for a function or script are stored. */
+ // Get the function or script name and the address where the next breakpoint
+ // line and the debug tick for a function or script are stored.
if (getline_is_func)
{
fname = func_name(real_cookie);
@@ -762,7 +762,7 @@ do_cmdline(
getline_is_func = getline_equal(fgetline, cookie, get_func_line);
#endif
- /* stop skipping cmds for an error msg after all endif/while/for */
+ // stop skipping cmds for an error msg after all endif/while/for
if (next_cmdline == NULL
#ifdef FEAT_EVAL
&& !force_abort
@@ -779,15 +779,15 @@ do_cmdline(
*/
#ifdef FEAT_EVAL
- /* 1. If repeating, get a previous line from lines_ga. */
+ // 1. If repeating, get a previous line from lines_ga.
if (cstack.cs_looplevel > 0 && current_line < lines_ga.ga_len)
{
- /* Each '|' separated command is stored separately in lines_ga, to
- * be able to jump to it. Don't use next_cmdline now. */
+ // Each '|' separated command is stored separately in lines_ga, to
+ // be able to jump to it. Don't use next_cmdline now.
VIM_CLEAR(cmdline_copy);
- /* Check if a function has returned or, unless it has an unclosed
- * try conditional, aborted. */
+ // Check if a function has returned or, unless it has an unclosed
+ // try conditional, aborted.
if (getline_is_func)
{
# ifdef FEAT_PROFILE
@@ -806,14 +806,14 @@ do_cmdline(
script_line_end();
#endif
- /* Check if a sourced file hit a ":finish" command. */
+ // Check if a sourced file hit a ":finish" command.
if (source_finished(fgetline, cookie))
{
retval = FAIL;
break;
}
- /* If breakpoints have been added/deleted need to check for it. */
+ // If breakpoints have been added/deleted need to check for it.
if (breakpoint != NULL && dbg_tick != NULL
&& *dbg_tick != debug_tick)
{
@@ -826,12 +826,12 @@ do_cmdline(
next_cmdline = ((wcmd_T *)(lines_ga.ga_data))[current_line].line;
sourcing_lnum = ((wcmd_T *)(lines_ga.ga_data))[current_line].lnum;
- /* Did we encounter a breakpoint? */
+ // Did we encounter a breakpoint?
if (breakpoint != NULL && *breakpoint != 0
&& *breakpoint <= sourcing_lnum)
{
dbg_breakpoint(fname, sourcing_lnum);
- /* Find next breakpoint. */
+ // Find next breakpoint.
*breakpoint = dbg_find_breakpoint(
getline_equal(fgetline, cookie, getsourceline),
fname, sourcing_lnum);
@@ -850,11 +850,11 @@ do_cmdline(
if (cstack.cs_looplevel > 0)
{
- /* Inside a while/for loop we need to store the lines and use them
- * again. Pass a different "fgetline" function to do_one_cmd()
- * below, so that it stores lines in or reads them from
- * "lines_ga". Makes it possible to define a function inside a
- * while/for loop. */
+ // Inside a while/for loop we need to store the lines and use them
+ // again. Pass a different "fgetline" function to do_one_cmd()
+ // below, so that it stores lines in or reads them from
+ // "lines_ga". Makes it possible to define a function inside a
+ // while/for loop.
cmd_getline = get_loop_line;
cmd_cookie = (void *)&cmd_loop_cookie;
cmd_loop_cookie.lines_gap = &lines_ga;
@@ -870,7 +870,7 @@ do_cmdline(
}
#endif
- /* 2. If no line given, get an allocated line with fgetline(). */
+ // 2. If no line given, get an allocated line with fgetline().
if (next_cmdline == NULL)
{
/*
@@ -887,9 +887,9 @@ do_cmdline(
#endif
, TRUE)) == NULL)
{
- /* Don't call wait_return for aborted command line. The NULL
- * returned for the end of a sourced file or executed function
- * doesn't do this. */
+ // Don't call wait_return for aborted command line. The NULL
+ // returned for the end of a sourced file or executed function
+ // doesn't do this.
if (KeyTyped && !(flags & DOCMD_REPEAT))
need_wait_return = FALSE;
retval = FAIL;
@@ -910,7 +910,7 @@ do_cmdline(
}
}
- /* 3. Make a copy of the command so we can mess with it. */
+ // 3. Make a copy of the command so we can mess with it.
else if (cmdline_copy == NULL)
{
next_cmdline = vim_strsave(next_cmdline);
@@ -954,10 +954,10 @@ do_cmdline(
if (!(flags & DOCMD_NOWAIT) && !recursive)
{
msg_didout_before_start = msg_didout;
- msg_didany = FALSE; /* no output yet */
+ msg_didany = FALSE; // no output yet
msg_start();
- msg_scroll = TRUE; /* put messages below each other */
- ++no_wait_return; /* don't wait for return until finished */
+ msg_scroll = TRUE; // put messages below each other
+ ++no_wait_return; // don't wait for return until finished
++RedrawingDisabled;
did_inc = TRUE;
}
@@ -981,8 +981,8 @@ do_cmdline(
#ifdef FEAT_EVAL
if (cmd_cookie == (void *)&cmd_loop_cookie)
- /* Use "current_line" from "cmd_loop_cookie", it may have been
- * incremented when defining a function. */
+ // Use "current_line" from "cmd_loop_cookie", it may have been
+ // incremented when defining a function.
current_line = cmd_loop_cookie.current_line;
#endif
@@ -1004,15 +1004,15 @@ do_cmdline(
}
else
{
- /* need to copy the command after the '|' to cmdline_copy, for the
- * next do_one_cmd() */
+ // need to copy the command after the '|' to cmdline_copy, for the
+ // next do_one_cmd()
STRMOVE(cmdline_copy, next_cmdline);
next_cmdline = cmdline_copy;
}
#ifdef FEAT_EVAL
- /* reset did_emsg for a function that is not aborted by an error */
+ // reset did_emsg for a function that is not aborted by an error
if (did_emsg && !force_abort
&& getline_equal(fgetline, cookie, get_func_line)
&& !func_has_abort(real_cookie))
@@ -1032,10 +1032,10 @@ do_cmdline(
{
cstack.cs_lflags &= ~(CSL_HAD_CONT | CSL_HAD_ENDLOOP);
- /* Jump back to the matching ":while" or ":for". Be careful
- * not to use a cs_line[] from an entry that isn't a ":while"
- * or ":for": It would make "current_line" invalid and can
- * cause a crash. */
+ // Jump back to the matching ":while" or ":for". Be careful
+ // not to use a cs_line[] from an entry that isn't a ":while"
+ // or ":for": It would make "current_line" invalid and can
+ // cause a crash.
if (!did_emsg && !got_int && !did_throw
&& cstack.cs_idx >= 0
&& (cstack.cs_flags[cstack.cs_idx]
@@ -1044,12 +1044,12 @@ do_cmdline(
&& (cstack.cs_flags[cstack.cs_idx] & CSF_ACTIVE))
{
current_line = cstack.cs_line[cstack.cs_idx];
- /* remember we jumped there */
+ // remember we jumped there
cstack.cs_lflags |= CSL_HAD_LOOP;
- line_breakcheck(); /* check if CTRL-C typed */
+ line_breakcheck(); // check if CTRL-C typed
- /* Check for the next breakpoint at or after the ":while"
- * or ":for". */
+ // Check for the next breakpoint at or after the ":while"
+ // or ":for".
if (breakpoint != NULL)
{
*breakpoint = dbg_find_breakpoint(
@@ -1061,7 +1061,7 @@ do_cmdline(
}
else
{
- /* can only get here with ":endwhile" or ":endfor" */
+ // can only get here with ":endwhile" or ":endfor"
if (cstack.cs_idx >= 0)
rewind_conditionals(&cstack, cstack.cs_idx - 1,
CSF_WHILE | CSF_FOR, &cstack.cs_looplevel);
@@ -1078,7 +1078,7 @@ do_cmdline(
}
}
- /* Check for the next breakpoint after a watchexpression */
+ // Check for the next breakpoint after a watchexpression
if (breakpoint != NULL && has_watchexpr())
{
*breakpoint = dbg_find_breakpoint(FALSE, fname, sourcing_lnum);
@@ -1116,8 +1116,8 @@ do_cmdline(
cstack.cs_flags[cstack.cs_idx] |= CSF_ACTIVE | CSF_FINALLY;
}
- /* Update global "trylevel" for recursive calls to do_cmdline() from
- * within this loop. */
+ // Update global "trylevel" for recursive calls to do_cmdline() from
+ // within this loop.
trylevel = initial_trylevel + cstack.cs_trylevel;
/*
@@ -1130,9 +1130,9 @@ do_cmdline(
if (trylevel == 0 && !did_emsg && !got_int && !did_throw)
force_abort = FALSE;
- /* Convert an interrupt to an exception if appropriate. */
+ // Convert an interrupt to an exception if appropriate.
(void)do_intthrow(&cstack);
-#endif /* FEAT_EVAL */
+#endif // FEAT_EVAL
}
/*
@@ -1155,9 +1155,9 @@ do_cmdline(
)
&& !(did_emsg
#ifdef FEAT_EVAL
- /* Keep going when inside try/catch, so that the error can be
- * deal with, except when it is a syntax error, it may cause
- * the :endtry to be missed. */
+ // Keep going when inside try/catch, so that the error can be
+ // deal with, except when it is a syntax error, it may cause
+ // the :endtry to be missed.
&& (cstack.cs_trylevel == 0 || did_emsg_syntax)
#endif
&& used_getline
@@ -1209,7 +1209,7 @@ do_cmdline(
int idx = cleanup_conditionals(&cstack, 0, TRUE);
if (idx >= 0)
- --idx; /* remove try block not in its finally clause */
+ --idx; // remove try block not in its finally clause
rewind_conditionals(&cstack, idx, CSF_WHILE | CSF_FOR,
&cstack.cs_looplevel);
}
@@ -1217,9 +1217,9 @@ do_cmdline(
trylevel = initial_trylevel;
}
- /* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
- * lack was reported above and the error message is to be converted to an
- * exception, do this now after rewinding the cstack. */
+ // If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
+ // lack was reported above and the error message is to be converted to an
+ // exception, do this now after rewinding the cstack.
do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
? (char_u *)"endfunction" : (char_u *)NULL);
@@ -1266,7 +1266,7 @@ do_cmdline(
sourcing_lnum = current_exception->throw_lnum;
current_exception->throw_name = NULL;
- discard_current_exception(); /* uses IObuff if 'verbose' */
+ discard_current_exception(); // uses IObuff if 'verbose'
suppress_errthrow = TRUE;
force_abort = TRUE;
@@ -1323,7 +1323,7 @@ do_cmdline(
}
else
{
- /* When leaving a function, reduce nesting level. */
+ // When leaving a function, reduce nesting level.
if (getline_equal(fgetline, cookie, get_func_line))
--ex_nesting_level;
/*
@@ -1346,7 +1346,7 @@ do_cmdline(
restore_dbg_stuff(&debug_saved);
msg_list = saved_msg_list;
-#endif /* FEAT_EVAL */
+#endif // FEAT_EVAL
/*
* If there was too much output to fit on the command line, ask the user to
@@ -1370,7 +1370,7 @@ do_cmdline(
)
{
need_wait_return = FALSE;
- msg_didany = FALSE; /* don't wait when restarting edit */
+ msg_didany = FALSE; // don't wait when restarting edit
}
else if (need_wait_return)
{
@@ -1385,7 +1385,7 @@ do_cmdline(
}
#ifdef FEAT_EVAL
- did_endif = FALSE; /* in case do_cmdline used recursively */
+ did_endif = FALSE; // in case do_cmdline used recursively
#else
/*
* Reset if_level, in case a sourced script file contains more ":if" than
@@ -1412,9 +1412,9 @@ get_loop_line(int c, void *cookie, int indent, int do_concat)
if (cp->current_line + 1 >= cp->lines_gap->ga_len)
{
if (cp->repeating)
- return NULL; /* trying to read past ":endwhile"/":endfor" */
+ return NULL; // trying to read past ":endwhile"/":endfor"
- /* First time inside the ":while"/":for": get line normally. */
+ // First time inside the ":while"/":for": get line normally.
if (cp->getline == NULL)
line = getcmdline(c, 0L, indent, do_concat);
else
@@ -1467,16 +1467,16 @@ free_cmdlines(garray_T *gap)
int
getline_equal(
char_u *(*fgetline)(int, void *, int, int),
- void *cookie UNUSED, /* argument for fgetline() */
+ void *cookie UNUSED, // argument for fgetline()
char_u *(*func)(int, void *, int, int))
{
#ifdef FEAT_EVAL
char_u *(*gp)(int, void *, int, int);
struct loop_cookie *cp;
- /* When "fgetline" is "get_loop_line()" use the "cookie" to find the
- * function that's originally used to obtain the lines. This may be
- * nested several levels. */
+ // When "fgetline" is "get_loop_line()" use the "cookie" to find the
+ // function that's originally used to obtain the lines. This may be
+ // nested several levels.
gp = fgetline;
cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line)
@@ -1497,15 +1497,15 @@ getline_equal(
void *
getline_cookie(
char_u *(*fgetline)(int, void *, int, int) UNUSED,
- void *cookie) /* argument for fgetline() */
+ void *cookie) // argument for fgetline()
{
#ifdef FEAT_EVAL
char_u *(*gp)(int, void *, int, int);
struct loop_cookie *cp;
- /* When "fgetline" is "get_loop_line()" use the "cookie" to find the
- * cookie that's originally used to obtain the lines. This may be nested
- * several levels. */
+ // When "fgetline" is "get_loop_line()" use the "cookie" to find the
+ // cookie that's originally used to obtain the lines. This may be nested
+ // several levels.
gp = fgetline;
cp = (struct loop_cookie *)cookie;
while (gp == get_loop_line)
@@ -1543,7 +1543,7 @@ compute_buffer_local_count(int addr_type, int lnum, int offset)
break;
buf = nextbuf;
if (addr_type == ADDR_LOADED_BUFFERS)
- /* skip over unloaded buffers */
+ // skip over unloaded buffers
while (buf->b_ml.ml_mfp == NULL)
{
nextbuf = (offset < 0) ? buf->b_prev : buf->b_next;
@@ -1552,7 +1552,7 @@ compute_buffer_local_count(int addr_type, int lnum, int offset)
buf = nextbuf;
}
}
- /* we might have gone too far, last buffer is not loadedd */
+ // we might have gone too far, last buffer is not loadedd
if (addr_type == ADDR_LOADED_BUFFERS)
while (buf->b_ml.ml_mfp == NULL)
{
@@ -1634,18 +1634,18 @@ do_one_cmd(
struct condstack *cstack,
#endif
char_u *(*fgetline)(int, void *, int, int),
- void *cookie) /* argument for fgetline() */
+ void *cookie) // argument for fgetline()
{
char_u *p;
linenr_T lnum;
long n;
- char *errormsg = NULL; /* error message */
+ char *errormsg = NULL; // error message
char_u *after_modifier = NULL;
- exarg_T ea; /* Ex command arguments */
+ exarg_T ea; // Ex command arguments
int save_msg_scroll = msg_scroll;
cmdmod_T save_cmdmod;
int save_reg_executing = reg_executing;
- int ni; /* set when Not Implemented */
+ int ni; // set when Not Implemented
char_u *cmd;
vim_memset(&ea, 0, sizeof(ea));
@@ -1655,13 +1655,13 @@ do_one_cmd(
++ex_nesting_level;
#endif
- /* When the last file has not been edited :q has to be typed twice. */
+ // When the last file has not been edited :q has to be typed twice.
if (quitmore
#ifdef FEAT_EVAL
- /* avoid that a function call in 'statusline' does this */
+ // avoid that a function call in 'statusline' does this
&& !getline_equal(fgetline, cookie, get_func_line)
#endif
- /* avoid that an autocommand, e.g. QuitPre, does this */
+ // avoid that an autocommand, e.g. QuitPre, does this
&& !getline_equal(fgetline, cookie, getnextac))
--quitmore;
@@ -1671,7 +1671,7 @@ do_one_cmd(
*/
save_cmdmod = cmdmod;
- /* "#!anything" is handled like a comment. */
+ // "#!anything" is handled like a comment.
if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!')
goto doend;
@@ -1748,8 +1748,8 @@ do_one_cmd(
}
# endif
- /* May go to debug mode. If this happens and the ">quit" debug command is
- * used, throw an interrupt exception and skip the next command. */
+ // May go to debug mode. If this happens and the ">quit" debug command is
+ // used, throw an interrupt exception and skip the next command.
dbg_check_breakpoint(&ea);
if (!ea.skip && got_int)
{
@@ -1821,7 +1821,7 @@ do_one_cmd(
* ":3|..." prints line 3
* ":|" prints current line
*/
- if (ea.skip) /* skip this if inside :if */
+ if (ea.skip) // skip this if inside :if
goto doend;
if (*ea.cmd == '|' || (exmode_active && ea.line1 != ea.line2))
{
@@ -1837,8 +1837,8 @@ do_one_cmd(
{
if (ea.line2 > curbuf->b_ml.ml_line_count)
{
- /* With '-' in 'cpoptions' a line number past the file is an
- * error, otherwise put it at the end of the file. */
+ // With '-' in 'cpoptions' a line number past the file is an
+ // error, otherwise put it at the end of the file.
if (vim_strchr(p_cpo, CPO_MINUS) != NULL)
ea.line2 = -1;
else
@@ -1859,8 +1859,8 @@ do_one_cmd(
goto doend;
}
- /* If this looks like an undefined user command and there are CmdUndefined
- * autocommands defined, trigger the matching autocommands. */
+ // If this looks like an undefined user command and there are CmdUndefined
+ // autocommands defined, trigger the matching autocommands.
if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip
&& ASCII_ISUPPER(*ea.cmd)
&& has_cmdundefined())
@@ -1873,8 +1873,8 @@ do_one_cmd(
p = vim_strnsave(ea.cmd, (int)(p - ea.cmd));
ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL);
vim_free(p);
- /* If the autocommands did something and didn't cause an error, try
- * finding the command again. */
+ // If the autocommands did something and didn't cause an error, try
+ // finding the command again.
p = (ret
#ifdef FEAT_EVAL
&& !aborting()
@@ -1903,8 +1903,8 @@ do_one_cmd(
STRCPY(IObuff, _("E492: Not an editor command"));
if (!sourcing)
{
- /* If the modifier was parsed OK the error must be in the
- * following command */
+ // If the modifier was parsed OK the error must be in the
+ // following command
if (after_modifier != NULL)
append_command(after_modifier);
else
@@ -1939,7 +1939,7 @@ do_one_cmd(
#endif
- /* forced commands */
+ // forced commands
if (*p == '!' && ea.cmdidx != CMD_substitute
&& ea.cmdidx != CMD_smagic && ea.cmdidx != CMD_snomagic)
{
@@ -1972,7 +1972,7 @@ do_one_cmd(
}
if (!curbuf->b_p_ma && (ea.argt & EX_MODIFY))
{
- /* Command not allowed in non-'modifiable' buffer */
+ // Command not allowed in non-'modifiable' buffer
errormsg = _(e_modifiable);
goto doend;
}
@@ -1980,15 +1980,15 @@ do_one_cmd(
if (text_locked() && !(ea.argt & EX_CMDWIN)
&& !IS_USER_CMDIDX(ea.cmdidx))
{
- /* Command not allowed when editing the command line. */
+ // Command not allowed when editing the command line.
errormsg = _(get_text_locked_msg());
goto doend;
}
- /* Disallow editing another buffer when "curbuf_lock" is set.
- * Do allow ":checktime" (it is postponed).
- * Do allow ":edit" (check for an argument later).
- * Do allow ":file" with no arguments (check for an argument later). */
+ // Disallow editing another buffer when "curbuf_lock" is set.
+ // Do allow ":checktime" (it is postponed).
+ // Do allow ":edit" (check for an argument later).
+ // Do allow ":file" with no arguments (check for an argument later).
if (!(ea.argt & EX_CMDWIN)
&& ea.cmdidx != CMD_checktime
&& ea.cmdidx != CMD_edit
@@ -1999,7 +1999,7 @@ do_one_cmd(
if (!ni && !(ea.argt & EX_RANGE) && ea.addr_count > 0)
{
- /* no range allowed */
+ // no range allowed
errormsg = _(e_norange);
goto doend;
}
@@ -2053,8 +2053,8 @@ do_one_cmd(
if (((ea.argt & EX_WHOLEFOLD) || ea.addr_count >= 2) && !global_busy
&& ea.addr_type == ADDR_LINES)
{
- /* Put the first line at the start of a closed fold, put the last line
- * at the end of a closed fold. */
+ // Put the first line at the start of a closed fold, put the last line
+ // at the end of a closed fold.
(void)hasFolding(ea.line1, &ea.line1, NULL);
(void)hasFolding(ea.line2, NULL, &ea.line2);
}
@@ -2097,9 +2097,9 @@ do_one_cmd(
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update)
{
- if (*ea.arg == '>') /* append */
+ if (*ea.arg == '>') // append
{
- if (*++ea.arg != '>') /* typed wrong */
+ if (*++ea.arg != '>') // typed wrong
{
errormsg = _("E494: Use w or w>>");
goto doend;
@@ -2107,7 +2107,7 @@ do_one_cmd(
ea.arg = skipwhite(ea.arg + 1);
ea.append = TRUE;
}
- else if (*ea.arg == '!' && ea.cmdidx == CMD_write) /* :w !filter */
+ else if (*ea.arg == '!' && ea.cmdidx == CMD_write) // :w !filter
{
++ea.arg;
ea.usefilter = TRUE;
@@ -2118,10 +2118,10 @@ do_one_cmd(
{
if (ea.forceit)
{
- ea.usefilter = TRUE; /* :r! filter if ea.forceit */
+ ea.usefilter = TRUE; // :r! filter if ea.forceit
ea.forceit = FALSE;
}
- else if (*ea.arg == '!') /* :r !filter */
+ else if (*ea.arg == '!') // :r !filter
{
++ea.arg;
ea.usefilter = TRUE;
@@ -2131,7 +2131,7 @@ do_one_cmd(
if (ea.cmdidx == CMD_lshift || ea.cmdidx == CMD_rshift)
{
ea.amount = 1;
- while (*ea.arg == *ea.cmd) /* count number of '>' or '<' */
+ while (*ea.arg == *ea.cmd) // count number of '>' or '<'
{
++ea.arg;
++ea.amount;
@@ -2166,12 +2166,12 @@ do_one_cmd(
{
for (p = ea.arg; *p; ++p)
{
- /* Remove one backslash before a newline, so that it's possible to
- * pass a newline to the shell and also a newline that is preceded
- * with a backslash. This makes it impossible to end a shell
- * command in a backslash, but that doesn't appear useful.
- * Halving the number of backslashes is incompatible with previous
- * versions. */
+ // Remove one backslash before a newline, so that it's possible to
+ // pass a newline to the shell and also a newline that is preceded
+ // with a backslash. This makes it impossible to end a shell
+ // command in a backslash, but that doesn't appear useful.
+ // Halving the number of backslashes is incompatible with previous
+ // versions.
if (*p == '\\' && p[1] == '\n')
STRMOVE(p, p + 1);
else if (*p == '\n')
@@ -2238,15 +2238,15 @@ do_one_cmd(
}
}
- /* accept numbered register only when no count allowed (:put) */
+ // accept numbered register only when no count allowed (:put)
if ( (ea.argt & EX_REGSTR)
&& *ea.arg != NUL
- /* Do not allow register = for user commands */
+ // Do not allow register = for user commands
&& (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
&& !((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg)))
{
#ifndef FEAT_CLIPBOARD
- /* check these explicitly for a more specific error message */
+ // check these explicitly for a more specific error message
if (*ea.arg == '*' || *ea.arg == '+')
{
errormsg = _(e_invalidreg);
@@ -2258,7 +2258,7 @@ do_one_cmd(
{
ea.regname = *ea.arg++;
#ifdef FEAT_EVAL
- /* for '=' register: accept the rest of the line as an expression */
+ // for '=' register: accept the rest of the line as an expression
if (ea.arg[-1] == '=' && ea.arg[0] != NUL)
{
set_expr_line(vim_strsave(ea.arg));
@@ -2333,7 +2333,7 @@ do_one_cmd(
{
switch (ea.cmdidx)
{
- /* commands that need evaluation */
+ // commands that need evaluation
case CMD_while:
case CMD_endwhile:
case CMD_for:
@@ -2349,9 +2349,9 @@ do_one_cmd(
case CMD_function:
break;
- /* Commands that handle '|' themselves. Check: A command should
- * either have the EX_TRLBAR flag, appear in this list or appear in
- * the list at ":help :bar". */
+ // Commands that handle '|' themselves. Check: A command should
+ // either have the EX_TRLBAR flag, appear in this list or appear in
+ // the list at ":help :bar".
case CMD_aboveleft:
case CMD_and:
case CMD_belowright:
@@ -2449,14 +2449,14 @@ do_one_cmd(
}
ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & EX_BUFUNL) != 0,
FALSE, FALSE);
- if (ea.line2 < 0) /* failed */
+ if (ea.line2 < 0) // failed
goto doend;
ea.addr_count = 1;
ea.arg = skipwhite(p);
}
- /* The :try command saves the emsg_silent flag, reset it here when
- * ":silent! try" was used, it should only apply to :try itself. */
+ // The :try command saves the emsg_silent flag, reset it here when
+ // ":silent! try" was used, it should only apply to :try itself.
if (ea.cmdidx == CMD_try && ea.did_esilent > 0)
{
emsg_silent -= ea.did_esilent;
@@ -2509,7 +2509,7 @@ do_one_cmd(
#endif
doend:
- if (curwin->w_cursor.lnum == 0) /* can happen with zero line number */
+ if (curwin->w_cursor.lnum == 0) // can happen with zero line number
{
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
@@ -2543,19 +2543,19 @@ doend:
if (ea.save_msg_silent != -1)
{
- /* messages could be enabled for a serious error, need to check if the
- * counters don't become negative */
+ // messages could be enabled for a serious error, need to check if the
+ // counters don't become negative
if (!did_emsg || msg_silent > ea.save_msg_silent)
msg_silent = ea.save_msg_silent;
emsg_silent -= ea.did_esilent;
if (emsg_silent < 0)
emsg_silent = 0;
- /* Restore msg_scroll, it's set by file I/O commands, even when no
- * message is actually displayed. */
+ // Restore msg_scroll, it's set by file I/O commands, even when no
+ // message is actually displayed.
msg_scroll = save_msg_scroll;
- /* "silent reg" or "silent echo x" inside "redir" leaves msg_col
- * somewhere in the line. Put it back in the first column. */
+ // "silent reg" or "silent echo x" inside "redir" leaves msg_col
+ // somewhere in the line. Put it back in the first column.
if (redirecting())
msg_col = 0;
}
@@ -2565,7 +2565,7 @@ doend:
--sandbox;
#endif
- if (ea.nextcmd && *ea.nextcmd == NUL) /* not really a next command */
+ if (ea.nextcmd && *ea.nextcmd == NUL) // not really a next command
ea.nextcmd = NULL;
#ifdef FEAT_EVAL
@@ -2607,7 +2607,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
while (*eap->cmd == ' ' || *eap->cmd == '\t' || *eap->cmd == ':')
++eap->cmd;
- /* in ex mode, an empty line works like :+ */
+ // in ex mode, an empty line works like :+
if (*eap->cmd == NUL && exmode_active
&& (getline_equal(eap->getline, eap->cookie, getexmodeline)
|| getline_equal(eap->getline, eap->cookie, getexline))
@@ -2618,7 +2618,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
ex_pressedreturn = TRUE;
}
- /* ignore comment and empty lines */
+ // ignore comment and empty lines
if (*eap->cmd == '"')
return FAIL;
if (*eap->cmd == NUL)
@@ -2631,7 +2631,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
p = skip_range(eap->cmd, NULL);
switch (*p)
{
- /* When adding an entry, also modify cmd_exists(). */
+ // When adding an entry, also modify cmd_exists().
case 'a': if (!checkforcmd(&eap->cmd, "aboveleft", 3))
break;
cmdmod.split |= WSP_ABOVE;
@@ -2681,7 +2681,7 @@ parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)