diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-01 21:11:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-01 21:11:22 +0100 |
commit | 5d18efecfd6c45d69f55268948a22cd0465bb955 (patch) | |
tree | 409afa09cb7fb8f4684e0399f2597ba5d16edbfa /src/eval.c | |
parent | fa5612c7d836eb789e0f8ff4b10461b8640a14b2 (diff) | |
download | vim-git-5d18efecfd6c45d69f55268948a22cd0465bb955.tar.gz |
patch 8.1.2378: using old C style commentsv8.1.2378
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 597 |
1 files changed, 298 insertions, 299 deletions
diff --git a/src/eval.c b/src/eval.c index c37d6fdc2..178f47388 100644 --- a/src/eval.c +++ b/src/eval.c @@ -36,19 +36,19 @@ static char *e_nowhitespace = N_("E274: No white space allowed before parenthesi */ static int current_copyID = 0; -static int echo_attr = 0; /* attributes used for ":echo" */ +static int echo_attr = 0; // attributes used for ":echo" /* * Info used by a ":for" loop. */ typedef struct { - int fi_semicolon; /* TRUE if ending in '; var]' */ - int fi_varcount; /* nr of variables in the list */ - listwatch_T fi_lw; /* keep an eye on the item used. */ - list_T *fi_list; /* list being used */ - int fi_bi; /* index of blob */ - blob_T *fi_blob; /* blob being used */ + int fi_semicolon; // TRUE if ending in '; var]' + int fi_varcount; // nr of variables in the list + listwatch_T fi_lw; // keep an eye on the item used. + list_T *fi_list; // list being used + int fi_bi; // index of blob + blob_T *fi_blob; // blob being used } forinfo_T; static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op); @@ -174,7 +174,7 @@ eval_to_bool( char_u *arg, int *error, char_u **nextcmd, - int skip) /* only parse, don't execute */ + int skip) // only parse, don't execute { typval_T tv; varnumber_T retval = FALSE; @@ -261,7 +261,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) s = skipwhite(s); if (eval1_emsg(&s, rettv, TRUE) == FAIL) return FAIL; - if (*s != NUL) /* check for trailing chars after expr */ + if (*s != NUL) // check for trailing chars after expr { clear_tv(rettv); semsg(_(e_invexpr2), s); @@ -300,7 +300,7 @@ eval_expr_to_bool(typval_T *expr, int *error) eval_to_string_skip( char_u *arg, char_u **nextcmd, - int skip) /* only parse, don't execute */ + int skip) // only parse, don't execute { typval_T tv; char_u *retval; @@ -467,7 +467,7 @@ call_vim_function( int ret; funcexe_T funcexe; - rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */ + rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this vim_memset(&funcexe, 0, sizeof(funcexe)); funcexe.firstline = curwin->w_cursor.lnum; funcexe.lastline = curwin->w_cursor.lnum; @@ -574,15 +574,15 @@ eval_foldexpr(char_u *arg, int *cp) retval = 0; else { - /* If the result is a number, just return the number. */ + // If the result is a number, just return the number. if (tv.v_type == VAR_NUMBER) retval = tv.vval.v_number; else if (tv.v_type != VAR_STRING || tv.vval.v_string == NULL) retval = 0; else { - /* If the result is a string, check if there is a non-digit before - * the number. */ + // If the result is a string, check if there is a non-digit before + // the number. s = tv.vval.v_string; if (!VIM_ISDIGIT(*s) && *s != '-') *cp = *s++; @@ -625,8 +625,8 @@ get_lval( lval_T *lp, int unlet, int skip, - int flags, /* GLV_ values */ - int fne_flags) /* flags for find_name_end() */ + int flags, // GLV_ values + int fne_flags) // flags for find_name_end() { char_u *p; char_u *expr_start, *expr_end; @@ -641,21 +641,21 @@ get_lval( hashtab_T *ht; int quiet = flags & GLV_QUIET; - /* Clear everything in "lp". */ + // Clear everything in "lp". vim_memset(lp, 0, sizeof(lval_T)); if (skip) { - /* When skipping just find the end of the name. */ + // When skipping just find the end of the name. lp->ll_name = name; return find_name_end(name, NULL, NULL, FNE_INCL_BR | fne_flags); } - /* Find the end of the name. */ + // Find the end of the name. p = find_name_end(name, &expr_start, &expr_end, fne_flags); if (expr_start != NULL) { - /* Don't expand the name when we already know there is an error. */ + // Don't expand the name when we already know there is an error. if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) && *p != '[' && *p != '.') { @@ -666,9 +666,9 @@ get_lval( lp->ll_exp_name = make_expanded_name(name, expr_start, expr_end, p); if (lp->ll_exp_name == NULL) { - /* Report an invalid expression in braces, unless the - * expression evaluation has been cancelled due to an - * aborting error, an interrupt, or an exception. */ + // Report an invalid expression in braces, unless the + // expression evaluation has been cancelled due to an + // aborting error, an interrupt, or an exception. if (!aborting() && !quiet) { emsg_severe = TRUE; @@ -681,14 +681,14 @@ get_lval( else lp->ll_name = name; - /* Without [idx] or .key we are done. */ + // Without [idx] or .key we are done. if ((*p != '[' && *p != '.') || lp->ll_name == NULL) return p; cc = *p; *p = NUL; - /* Only pass &ht when we would write to the variable, it prevents autoload - * as well. */ + // Only pass &ht when we would write to the variable, it prevents autoload + // as well. v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht, flags & GLV_NO_AUTOLOAD); if (v == NULL && !quiet) @@ -738,24 +738,24 @@ get_lval( } else { - /* Get the index [expr] or the first index [expr: ]. */ + // Get the index [expr] or the first index [expr: ]. p = skipwhite(p + 1); if (*p == ':') empty1 = TRUE; else { empty1 = FALSE; - if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */ + if (eval1(&p, &var1, TRUE) == FAIL) // recursive! return NULL; if (tv_get_string_chk(&var1) == NULL) { - /* not a number or string */ + // not a number or string clear_tv(&var1); return NULL; } } - /* Optionally get the second index [ :expr]. */ + // Optionally get the second index [ :expr]. if (*p == ':') { if (lp->ll_tv->v_type == VAR_DICT) @@ -782,14 +782,14 @@ get_lval( else { lp->ll_empty2 = FALSE; - if (eval1(&p, &var2, TRUE) == FAIL) /* recursive! */ + if (eval1(&p, &var2, TRUE) == FAIL) // recursive! { clear_tv(&var1); return NULL; } if (tv_get_string_chk(&var2) == NULL) { - /* not a number or string */ + // not a number or string clear_tv(&var1); clear_tv(&var2); return NULL; @@ -809,7 +809,7 @@ get_lval( return NULL; } - /* Skip to past ']'. */ + // Skip to past ']'. ++p; } @@ -817,8 +817,8 @@ get_lval( { if (len == -1) { - /* "[key]": get key from "var1" */ - key = tv_get_string_chk(&var1); /* is number or string */ + // "[key]": get key from "var1" + key = tv_get_string_chk(&var1); // is number or string if (key == NULL) { clear_tv(&var1); @@ -829,9 +829,9 @@ get_lval( lp->ll_dict = lp->ll_tv->vval.v_dict; lp->ll_di = dict_find(lp->ll_dict, key, len); - /* When assigning to a scope dictionary check that a function and - * variable name is valid (only variable name unless it is l: or - * g: dictionary). Disallow overwriting a builtin function. */ + // When assigning to a scope dictionary check that a function and + // variable name is valid (only variable name unless it is l: or + // g: dictionary). Disallow overwriting a builtin function. if (rettv != NULL && lp->ll_dict->dv_scope != 0) { int prevval; @@ -843,7 +843,7 @@ get_lval( key[len] = NUL; } else - prevval = 0; /* avoid compiler warning */ + prevval = 0; // avoid compiler warning wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE && rettv->v_type == VAR_FUNC && var_check_func_name(key, lp->ll_di == NULL)) @@ -882,7 +882,7 @@ get_lval( p = NULL; break; } - /* existing variable, need to check if it can be changed */ + // existing variable, need to check if it can be changed else if ((flags & GLV_READ_ONLY) == 0 && var_check_ro(lp->ll_di->di_flags, name, FALSE)) { @@ -941,7 +941,7 @@ get_lval( if (empty1) lp->ll_n1 = 0; else - /* is number or string */ + // is number or string lp->ll_n1 = (long)tv_get_number(&var1); clear_tv(&var1); @@ -973,7 +973,7 @@ get_lval( if (lp->ll_range && !lp->ll_empty2) { lp->ll_n2 = (long)tv_get_number(&var2); - /* is number or string */ + // is number or string clear_tv(&var2); if (lp->ll_n2 < 0) { @@ -987,7 +987,7 @@ get_lval( lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); } - /* Check that lp->ll_n2 isn't before lp->ll_n1. */ + // Check that lp->ll_n2 isn't before lp->ll_n1. if (lp->ll_n1 < 0) lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li); if (lp->ll_n2 < lp->ll_n1) @@ -1164,7 +1164,7 @@ set_var_lval( break; if (lp->ll_li->li_next == NULL) { - /* Need to add an empty item. */ + // Need to add an empty item. if (list_append_number(lp->ll_list, 0) == FAIL) { ri = NULL; @@ -1199,7 +1199,7 @@ set_var_lval( return; } - /* Need to add an item to the Dictionary. */ + // Need to add an item to the Dictionary. di = dictitem_alloc(lp->ll_newkey); if (di == NULL) return; @@ -1244,7 +1244,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) char_u numbuf[NUMBUFLEN]; char_u *s; - /* Can't do anything with a Funcref, Dict, v:true on the right. */ + // Can't do anything with a Funcref, Dict, v:true on the right. if (tv2->v_type != VAR_FUNC && tv2->v_type != VAR_DICT && tv2->v_type != VAR_SPECIAL) { @@ -1386,7 +1386,7 @@ eval_for_line( typval_T tv; list_T *l; - *errp = TRUE; /* default: there is an error */ + *errp = TRUE; // default: there is an error fi = ALLOC_CLEAR_ONE(forinfo_T); if (fi == NULL) @@ -1526,7 +1526,7 @@ set_context_for_expression( xp->xp_context = EXPAND_USER_VARS; if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) { - /* ":let var1 var2 ...": find last space. */ + // ":let var1 var2 ...": find last space. for (p = arg + STRLEN(arg); p >= arg; ) { xp->xp_pattern = p; @@ -1563,7 +1563,7 @@ set_context_for_expression( } else if (c == '$') { - /* environment variable */ + // environment variable xp->xp_context = EXPAND_ENV_VARS; } else if (c == '=') @@ -1574,28 +1574,28 @@ set_context_for_expression( else if (c == '#' && xp->xp_context == EXPAND_EXPRESSION) { - /* Autoload function/variable contains '#'. */ + // Autoload function/variable contains '#'. break; } else if ((c == '<' || c == '#') && xp->xp_context == EXPAND_FUNCTIONS && vim_strchr(xp->xp_pattern, '(') == NULL) { - /* Function name can start with "<SNR>" and contain '#'. */ + // Function name can start with "<SNR>" and contain '#'. break; } else if (cmdidx != CMD_let || got_eq) { - if (c == '"') /* string */ + if (c == '"') // string { while ((c = *++xp->xp_pattern) != NUL && c != '"') if (c == '\\' && xp->xp_pattern[1] != NUL) ++xp->xp_pattern; xp->xp_context = EXPAND_NOTHING; } - else if (c == '\'') /* literal string */ + else if (c == '\'') // literal string { - /* Trick: '' is like stopping and starting a literal string. */ + // Trick: '' is like stopping and starting a literal string. while ((c = *++xp->xp_pattern) != NUL && c != '\'') /* skip */ ; xp->xp_context = EXPAND_NOTHING; @@ -1614,8 +1614,8 @@ set_context_for_expression( xp->xp_context = EXPAND_EXPRESSION; } else - /* Doesn't look like something valid, expand as an expression - * anyway. */ + // Doesn't look like something valid, expand as an expression + // anyway. xp->xp_context = EXPAND_EXPRESSION; arg = xp->xp_pattern; if (*arg != NUL) @@ -1636,7 +1636,7 @@ pattern_match(char_u *pat, char_u *text, int ic) char_u *save_cpo; regmatch_T regmatch; - /* avoid 'l' flag in 'cpoptions' */ + // avoid 'l' flag in 'cpoptions' save_cpo = p_cpo; p_cpo = (char_u *)""; regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); @@ -1672,12 +1672,12 @@ eval_func( if (!evaluate) check_vars(s, len); - /* If "s" is the name of a variable of type VAR_FUNC - * use its contents. */ + // If "s" is the name of a variable of type VAR_FUNC + // use its contents. s = deref_func_name(s, &len, &partial, !evaluate); - /* Need to make a copy, in case evaluating the arguments makes - * the name invalid. */ + // Need to make a copy, in case evaluating the arguments makes + // the name invalid. s = vim_strsave(s); if (s == NULL) ret = FAIL; @@ -1696,18 +1696,18 @@ eval_func( } vim_free(s); - /* If evaluate is FALSE rettv->v_type was not set in - * get_func_tv, but it's needed in handle_subscript() to parse - * what follows. So set it here. */ + // If evaluate is FALSE rettv->v_type was not set in + // get_func_tv, but it's needed in handle_subscript() to parse + // what follows. So set it here. if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') { rettv->vval.v_string = NULL; rettv->v_type = VAR_FUNC; } - /* Stop the expression evaluation when immediately - * aborting on error, or when an interrupt occurred or - * an exception was thrown but not caught. */ + // Stop the expression evaluation when immediately + // aborting on error, or when an interrupt occurred or + // an exception was thrown but not caught. if (evaluate && aborting()) { if (ret == OK) @@ -1806,7 +1806,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate) * Get the second variable. */ *arg = skipwhite(*arg + 1); - if (eval1(arg, rettv, evaluate && result) == FAIL) /* recursive! */ + if (eval1(arg, rettv, evaluate && result) == FAIL) // recursive! return FAIL; /* @@ -1824,7 +1824,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate) * Get the third variable. */ *arg = skipwhite(*arg + 1); - if (eval1(arg, &var2, evaluate && !result) == FAIL) /* recursive! */ + if (eval1(arg, &var2, evaluate && !result) == FAIL) // recursive! { if (evaluate && result) clear_tv(rettv); @@ -1998,7 +1998,7 @@ eval4(char_u **arg, typval_T *rettv, int evaluate) char_u *p; int i; exptype_T type = TYPE_UNKNOWN; - int type_is = FALSE; /* TRUE for "is" and "isnot" */ + int type_is = FALSE; // TRUE for "is" and "isnot" int len = 2; int ic; @@ -2056,19 +2056,19 @@ eval4(char_u **arg, typval_T *rettv, int evaluate) */ if (type != TYPE_UNKNOWN) { - /* extra question mark appended: ignore case */ + // extra question mark appended: ignore case if (p[len] == '?') { ic = TRUE; ++len; } - /* extra '#' appended: match case */ + // extra '#' appended: match case else if (p[len] == '#') { ic = FALSE; ++len; } - /* nothing appended: use 'ignorecase' */ + // nothing appended: use 'ignorecase' else ic = p_ic; @@ -2145,13 +2145,13 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) #endif ) { - /* For "list + ...", an illegal use of the first operand as - * a number cannot be determined before evaluating the 2nd - * operand: if this is also a list, all is ok. - * For "something . ...", "something - ..." or "non-list + ...", - * we know that the first operand needs to be a string or number - * without evaluating the 2nd operand. So check before to avoid - * side effects after an error. */ + // For "list + ...", an illegal use of the first operand as + // a number cannot be determined before evaluating the 2nd + // operand: if this is also a list, all is ok. + // For "something . ...", "something - ..." or "non-list + ...", + // we know that the first operand needs to be a string or number + // without evaluating the 2nd operand. So check before to avoid + // side effects after an error. if (evaluate && tv_get_string_chk(rettv) == NULL) { clear_tv(rettv); @@ -2178,9 +2178,9 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) */ if (op == '.') { - s1 = tv_get_string_buf(rettv, buf1); /* already checked */ + s1 = tv_get_string_buf(rettv, buf1); // already checked s2 = tv_get_string_buf_chk(&var2, buf2); - if (s2 == NULL) /* type error ? */ + if (s2 == NULL) // type error ? { clear_tv(rettv); clear_tv(&var2); @@ -2213,7 +2213,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) else if (op == '+' && rettv->v_type == VAR_LIST && var2.v_type == VAR_LIST) { - /* concatenate Lists */ + // concatenate Lists if (list_concat(rettv->vval.v_list, var2.vval.v_list, &var3) == FAIL) { @@ -2240,9 +2240,9 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) n1 = tv_get_number_chk(rettv, &error); if (error) { - /* This can only happen for "list + non-list". For - * "non-list + ..." or "something - ...", we returned - * before evaluating the 2nd operand. */ + // This can only happen for "list + non-list". For + // "non-list + ..." or "something - ...", we returned + // before evaluating the 2nd operand. clear_tv(rettv); return FAIL; } @@ -2275,7 +2275,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) clear_tv(rettv); #ifdef FEAT_FLOAT - /* If there is a float on either side the result is a float. */ + // If there is a float on either side the result is a float. if (rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT) { if (op == '+') @@ -2318,7 +2318,7 @@ eval6( char_u **arg, typval_T *rettv, int evaluate, - int want_string) /* after "." operator */ + int want_string) // after "." operator { typval_T var2; int op; @@ -2408,11 +2408,11 @@ eval6( else if (op == '/') { # ifdef VMS - /* VMS crashes on divide by zero, work around it */ + // VMS crashes on divide by zero, work around it if (f2 == 0.0) { if (f1 == 0) - f1 = -1 * __F_FLT_MAX - 1L; /* similar to NaN */ + f1 = -1 * __F_FLT_MAX - 1L; // similar to NaN else if (f1 < 0) f1 = -1 * __F_FLT_MAX; else @@ -2421,8 +2421,8 @@ eval6( else f1 = f1 / f2; # else - /* We rely on the floating point library to handle divide - * by zero to result in "inf" and not a crash. */ + // We rely on the floating point library to handle divide + // by zero to result in "inf" and not a crash. f1 = f1 / f2; # endif } @@ -2487,7 +2487,7 @@ eval7( char_u **arg, typval_T *rettv, int evaluate, - int want_string UNUSED) /* after "." operator */ + int want_string UNUSED) // after "." operator { varnumber_T n; int len; @@ -2542,13 +2542,13 @@ eval7( char_u *p; int get_float = FALSE; - /* We accept a float when the format matches - * "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very - * strict to avoid backwards compatibility problems. - * With script version 2 and later the leading digit can be - * omitted. - * Don't look for a float after the "." operator, so that - * ":let vers = 1.2.3" doesn't fail. */ + // We accept a float when the format matches + // "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very + // strict to avoid backwards compatibility problems. + // With script version 2 and later the leading digit can be + // omitted. + // Don't look for a float after the "." operator, so that + // ":let vers = 1.2.3" doesn't fail. if (**arg == '.') p = *arg; else @@ -2705,7 +2705,7 @@ eval7( * nested expression: (expression). */ case '(': *arg = skipwhite(*arg + 1); - ret = eval1(arg, rettv, evaluate); /* recursive! */ + ret = eval1(arg, rettv, evaluate); // recursive! if (**arg == ')') ++*arg; else if (ret == OK) @@ -2735,7 +2735,7 @@ eval7( ret = FAIL; else { - if (**arg == '(') /* recursive! */ + if (**arg == '(') // recursive! ret = eval_func(arg, s, len, rettv, evaluate, NULL); else if (evaluate) ret = get_var_tv(s, len, rettv, NULL, TRUE, FALSE); @@ -2750,8 +2750,8 @@ eval7( *arg = skipwhite(*arg); - /* Handle following '[', '(' and '.' for expr[expr], expr.name, - * expr(expr), expr->name(expr) */ + // Handle following '[', '(' and '.' for expr[expr], expr.name, + // expr(expr), expr->name(expr) if (ret == OK) ret = handle_subscript(arg, rettv, evaluate, TRUE, start_leader, &end_leader); @@ -2853,7 +2853,7 @@ call_func_rettv( functv = *rettv; rettv->v_type = VAR_UNKNOWN; - /* Invoke the function. Recursive! */ + // Invoke the function. Recursive! if (functv.v_type == VAR_PARTIAL) { pt = functv.vval.v_partial; @@ -2874,8 +2874,8 @@ call_func_rettv( funcexe.basetv = basetv; ret = get_func_tv(s, -1, rettv, arg, &funcexe); - /* Clear the funcref afterwards, so that deleting it while - * evaluating the arguments is possible (see test55). */ + // Clear the funcref afterwards, so that deleting it while + // evaluating the arguments is possible (see test55). if (evaluate) clear_tv(&functv); @@ -2892,7 +2892,7 @@ eval_lambda( char_u **arg, typval_T *rettv, int evaluate, - int verbose) /* give error messages */ + int verbose) // give error messages { typval_T base = *rettv; int ret; @@ -2937,7 +2937,7 @@ eval_method( char_u **arg, typval_T *rettv, int evaluate, - int verbose) /* give error messages */ + int verbose) // give error messages { char_u *name; long len; @@ -2996,7 +2996,7 @@ eval_index( char_u **arg, typval_T *rettv, int evaluate, - int verbose) /* give error messages */ + int verbose) // give error messages { int empty1 = FALSE, empty2 = FALSE; typval_T var1, var2; @@ -3029,7 +3029,7 @@ eval_index( case VAR_UNKNOWN: if (evaluate) return FAIL; - /* FALLTHROUGH */ + // FALLTHROUGH case VAR_STRING: case VAR_NUMBER: @@ -3063,11 +3063,11 @@ eval_index( *arg = skipwhite(*arg + 1); if (**arg == ':') empty1 = TRUE; - else if (eval1(arg, &var1, evaluate) == FAIL) /* recursive! */ + else if (eval1(arg, &var1, evaluate) == FAIL) // recursive! return FAIL; else if (evaluate && tv_get_string_chk(&var1) == NULL) { - /* not a number or string */ + // not a number or string clear_tv(&var1); return FAIL; } @@ -3081,7 +3081,7 @@ eval_index( *arg = skipwhite(*arg + 1); if (**arg == ']') empty2 = TRUE; - else if (eval1(arg, &var2, evaluate) == FAIL) /* recursive! */ + else if (eval1(arg, &var2, evaluate) == FAIL) // recursive! { if (!empty1) clear_tv(&var1); @@ -3089,7 +3089,7 @@ eval_index( } else if (evaluate && tv_get_string_chk(&var2) == NULL) { - /* not a number or string */ + // not a number or string if (!empty1) clear_tv(&var1); clear_tv(&var2); @@ -3097,7 +3097,7 @@ eval_index( } } - /* Check for the ']'. */ + // Check for the ']'. if (**arg != ']') { if (verbose) @@ -3107,7 +3107,7 @@ eval_index( clear_tv(&var2); return FAIL; } - *arg = skipwhite(*arg + 1); /* skip the ']' */ + *arg = skipwhite(*arg + 1); // skip the ']' } if (evaluate) @@ -3138,7 +3138,7 @@ eval_index( case VAR_SPECIAL: case VAR_JOB: case VAR_CHANNEL: - break; /* not evaluating, skipping over subscript */ + break; // not evaluating, skipping over subscript case VAR_NUMBER: case VAR_STRING: @@ -3146,8 +3146,8 @@ eval_index( len = (long)STRLEN(s); if (range) { - /* The resulting variable is a substring. If the indexes - * are out of range the result is empty. */ + // The resulting variable is a substring. If the indexes + // are out of range the result is empty. if (n1 < 0) { n1 = len + n1; @@ -3165,9 +3165,9 @@ eval_index( } else { - /* The resulting variable is a string of a single - * character. If the index is too big or negative the - * result is empty. */ + // The resulting variable is a string of a single + // character. If the index is too big or negative the + // result is empty. if (n1 >= len || n1 < 0) s = NULL; else @@ -3246,8 +3246,8 @@ eval_index( n1 = len + n1; if (!empty1 && (n1 < 0 || n1 >= len)) { - /* For a range we allow invalid values and return an empty - * list. A list index out of range is an error. */ + // For a range we allow invalid values and return an empty + // list. A list index out of range is an error. if (!range) { if (verbose) @@ -3342,7 +3342,7 @@ eval_index( int get_option_tv( char_u **arg, - typval_T *rettv, /* when NULL, only check if option exists */ + typval_T *rettv, // when NULL, only check if option exists int evaluate) { char_u *option_end; @@ -3350,7 +3350,7 @@ get_option_tv( char_u *stringval; int opt_type; int c; - int working = (**arg == '+'); /* has("+option") */ + int working = (**arg == '+'); // has("+option") int ret = OK; int opt_flags; @@ -3376,7 +3376,7 @@ get_option_tv( opt_type = get_option_value(*arg, &numval, rettv == NULL ? NULL : &stringval, opt_flags); - if (opt_type == -3) /* invalid name */ + if (opt_type == -3) // invalid name { if (rettv != NULL) semsg(_("E113: Unknown option: %s"), *arg); @@ -3384,22 +3384,22 @@ get_option_tv( } else if (rettv != NULL) { - if (opt_type == -2) /* hidden string option */ + if (opt_type == -2) // hidden string option { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; } - else if (opt_type == -1) /* hidden number option */ + else if (opt_type == -1) // hidden number option { rettv->v_type = VAR_NUMBER; rettv->vval.v_number = 0; } - else if (opt_type == 1) /* number option */ + else if (opt_type == 1) // number option { rettv->v_type = VAR_NUMBER; rettv->vval.v_number = numval; } - else /* string option */ + else // string option { rettv->v_type = VAR_STRING; rettv->vval.v_string = stringval; @@ -3408,7 +3408,7 @@ get_option_tv( else if (working && (opt_type == -2 || opt_type == -1)) ret = FAIL; - *option_end = c; /* put back for error messages */ + *option_end = c; // put back for error messages *arg = option_end; return ret; @@ -3433,8 +3433,8 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) if (*p == '\\' && p[1] != NUL) { ++p; - /* A "\<x>" form occupies at least 4 characters, and produces up - * to 6 characters: reserve space for 2 extra */ + // A "\<x>" form occupies at least 4 characters, and produces up + // to 6 characters: reserve space for 2 extra if (*p == '<') extra += 2; } @@ -3446,7 +3446,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) return FAIL; } - /* If only parsing, set *arg and return here */ + // If only parsing, set *arg and return here if (!evaluate) { *arg = p + 1; @@ -3476,9 +3476,9 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) case 'r': *name++ = CAR; ++p; break; case 't': *name++ = TAB; ++p; break; - case 'X': /* hex: "\x1", "\x12" */ + case 'X': // hex: "\x1", "\x12" case 'x': - case 'u': /* Unicode: "\u0023" */ + case 'u': // Unicode: "\u0023" case 'U': if (vim_isxdigit(p[1])) { @@ -3498,8 +3498,8 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) nr = (nr << 4) + hex2nr(*p); } ++p; - /* For "\u" store the number according to - * 'encoding'. */ + // For "\u" store the number according to + // 'encoding'. if (c != 'X') name += (*mb_char2bytes)(nr, name); else @@ -3507,7 +3507,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) } break; - /* octal: "\1", "\12", "\123" */ + // octal: "\1", "\12", "\123" case '0': case '1': case '2': @@ -3525,7 +3525,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) ++name; break; - /* Special key, e.g.: "\<C-W>" */ + // Special key, e.g.: "\<C-W>" case '<': extra = trans_special(&p, name, TRUE, TRUE, TRUE, NULL); if (extra != 0) @@ -3533,7 +3533,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) name += extra; break; } - /* FALLTHROUGH */ + // FALLTHROUGH default: MB_COPY_CHAR(p, name); break; @@ -3544,7 +3544,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate) } *name = NUL; - if (*p != NUL) /* just in case */ + if (*p != NUL) // just in case ++p; *arg = p; @@ -3582,7 +3582,7 @@ get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate) return FAIL; } - /* If only parsing return after setting "*arg" */ + // If only parsing return after setting "*arg" if (!evaluate) { *arg = p + 1; @@ -3661,14 +3661,14 @@ static int tv_equal_recurse_limit; func_equal( typval_T *tv1, typval_T *tv2, - int ic) /* ignore case */ + int ic) // ignore case { char_u *s1, *s2; dict_T *d1, *d2; int a1, a2; int i; - /* empty and NULL function name considered the same */ + // empty and NULL function name considered the same s1 = tv1->v_type == VAR_FUNC ? tv1->vval.v_string : partial_name(tv1->vval.v_partial); if (s1 != NULL && *s1 == NUL) @@ -3685,7 +3685,7 @@ func_equal( else if (STRCMP(s1, s2) != 0) return FALSE; - /* empty dict and NULL dict is different */ + // empty dict and NULL dict is different d1 = tv1->v_type == VAR_FUNC ? NULL : tv1->vval.v_partial->pt_dict; d2 = tv2->v_type == VAR_FUNC ? NULL : tv2->vval.v_partial->pt_dict; if (d1 == NULL || d2 == NULL) @@ -3696,7 +3696,7 @@ func_equal( else if (!dict_equal(d1, d2, ic, TRUE)) return FALSE; - /* empty list and no list considered the same */ + // empty list and no list considered the same a1 = tv1->v_type == VAR_FUNC ? 0 : tv1->vval.v_partial->pt_argc; a2 = tv2->v_type == VAR_FUNC ? 0 : tv2->vval.v_partial->pt_argc; if (a1 != a2) @@ -3718,20 +3718,20 @@ func_equal( tv_equal( typval_T *tv1, typval_T *tv2, - int ic, /* ignore case */ - int recursive) /* TRUE when used recursively */ + int ic, // ignore case + int recursive) // TRUE when used recursively { char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; char_u *s1, *s2; - static int recursive_cnt = 0; /* catch recursive loops */ + static int recursive_cnt = 0; // catch recursive loops int r; - /* Catch lists and dicts that have an endless loop by limiting - * recursiveness to a limit. We guess they are equal then. - * A fixed limit has the problem of still taking an awful long time. - * Reduce the limit every time running into it. That should work fine for - * deeply linked structures that are not recursively linked and catch - * recursiveness quickly. */ + // Catch lists and dicts that have an endless loop by limiting + // recursiveness to a limit. We guess they are equal then. + // A fixed limit has the problem of still taking an awful long time. + // Reduce the limit every time running into it. That should work fine for + // deeply linked structures that are not recursively linked and catch + // recursiveness quickly. if (!recursive) tv_equal_recurse_limit = 1000; if (recursive_cnt >= tv_equal_recurse_limit) @@ -3740,8 +3740,8 @@ tv_equal( return TRUE; } - /* For VAR_FUNC and VAR_PARTIAL compare the function name, bound dict and - * arguments. */ + // For VAR_FUNC and VAR_PARTIAL compare the function name, bound dict and + // arguments. if ((tv1->v_type == VAR_FUNC || (tv1->v_type == VAR_PARTIAL && tv1->vval.v_partial != NULL)) && (tv2->v_type == VAR_FUNC @@ -3802,8 +3802,8 @@ tv_equal( break; } - /* VAR_UNKNOWN can be the result of a invalid expression, let's say it - * does not equal anything, not even itself. */ + // VAR_UNKNOWN can be the result of a invalid expression, let's say it + // does not equal anything, not even itself. return FALSE; } @@ -3855,14 +3855,14 @@ garbage_collect(int testing) if (!testing) { - /* Only do this once. */ + // Only do this once. want_garbage_collect = FALSE; may_garbage_collect = FALSE; garbage_collect_at_exit = FALSE; } - /* We advance by two because we add one for items referenced through - * previous_funccal. */ + // We advance by two because we add one for items referenced through + // previous_funccal. copyID = get_copyID(); /* @@ -3870,20 +3870,20 @@ garbage_collect(int testing) * with copyID. */ - /* Don't free variables in the previous_funccal list unless they are only - * referenced through previous_funccal. This must be first, because if - * the item is referenced elsewhere the funccal must not be freed. */ + // Don't free variables in the previous_funccal list unless they are only + // referenced through previous_funccal. This must be first, because if + // the item is referenced elsewhere the funccal must not be freed. abort = abort || set_ref_in_previous_funccal(copyID); - /* script-local variables */ + // script-local variables abort = abort || garbage_collect_scriptvars(copyID); - /* buffer-local variables */ + // buffer-local variables FOR_ALL_BUFFERS(buf) abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID, NULL, NULL); - /* window-local variables */ + // window-local variables FOR_ALL_TAB_WINDOWS(tp, wp) abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID, NULL, NULL); @@ -3900,23 +3900,23 @@ garbage_collect(int testing) NULL, NULL); #endif - /* tabpage-local variables */ + // tabpage-local variables FOR_ALL_TABPAGES(tp) abort = abort || set_ref_in_item(&tp->tp_winvar.di_tv, copyID, NULL, NULL); - /* global variables */ + // global variables abort = abort || garbage_collect_globvars(copyID); - /* function-local variables */ + // function-local variables abort = abort || set_ref_in_call_stack(copyID); - /* named functions (matters for closures) */ + // named functions (matters for closures) abort = abort || set_ref_in_functions(copyID); - /* function call arguments, if v:testing is set. */ + // function call arguments, if v:testing is set. abort = abort || set_ref_in_func_args(copyID); - /* v: vars */ + // v: vars abort = abort || garbage_collect_vimvars(copyID); // callbacks in buffers @@ -3987,9 +3987,9 @@ free_unref_items(int copyID) { int did_free = FALSE; - /* Let all "free" functions know that we are here. This means no - * dictionaries, lists, channels or jobs are to be freed, because we will - * do that here. */ + // Let all "free" functions know that we are here. This means no + // dictionaries, lists, channels or jobs are to be freed, because we will + // do that here. in_free_unref_items = TRUE; /* @@ -3997,19 +3997,19 @@ free_unref_items(int copyID) * themselves yet, so that it is possible to decrement refcount counters */ - /* Go through the list of dicts and free items without the copyID. */ + // Go through the list of dicts and free items without the copyID. did_free |= dict_free_nonref(copyID); - /* Go through the list of lists and free items without the copyID. */ + // Go through the list of lists and free items without the copyID. did_free |= list_free_nonref(copyID); #ifdef FEAT_JOB_CHANNEL - /* Go through the list of jobs and free items without the copyID. This - * must happen before doing channels, because jobs refer to channels, but - * the reference from the channel to the job isn't tracked. */ + // Go through the list of jobs and free items without the copyID. This + // must happen before doing channels, because jobs refer to channels, but + // the reference from the channel to the job isn't tracked. did_free |= free_unused_jobs_contents(copyID, COPYID_MASK); - /* Go through the list of channels and free items without the copyID. */ + // Go through the list of channels and free items without the copyID. did_free |= free_unused_channels_contents(copyID, COPYID_MASK); #endif @@ -4020,12 +4020,12 @@ free_unref_items(int copyID) list_free_items(copyID); #ifdef FEAT_JOB_CHANNEL - /* Go through the list of jobs and free items without the copyID. This - * must happen before doing channels, because jobs refer to channels, but - * the reference from the channel to the job isn't tracked. */ + // Go through the list of jobs and free items without the copyID. This + // must happen before doing channels, because jobs refer to channels, but + // the reference from the channel to the job isn't tracked. free_unused_jobs(copyID, COPYID_MASK); - /* Go through the list of channels and free items without the copyID. */ + // Go through the list of channels and free items without the copyID. free_unused_channels(copyID, COPYID_MASK); #endif @@ -4055,9 +4055,9 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack) { if (!abort) { - /* Mark each item in the hashtab. If the item contains a hashtab - * it is added to ht_stack, if it contains a list it is added to - * list_stack. */ + // Mark each item in the hashtab. If the item contains a hashtab + // it is added to ht_stack, if it contains a list it is added to + // list_stack. todo = (int)cur_ht->ht_used; for (hi = cur_ht->ht_array; todo > 0; ++hi) if (!HASHITEM_EMPTY(hi)) @@ -4071,7 +4071,7 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack) if (ht_stack == NULL) break; - /* take an item from the stack */ + // take an item from the stack cur_ht = ht_stack->ht; tempitem = ht_stack; ht_stack = ht_stack->prev; @@ -4130,16 +4130,16 @@ set_ref_in_list_items(list_T *l, int copyID, ht_stack_T **ht_stack) for (;;) { if (!abort) - /* Mark each item in the list. If the item contains a hashtab - * it is added to ht_stack, if it contains a list it is added to - * list_stack. */ + // Mark each item in the list. If the item contains a hashtab + // it is added to ht_stack, if it contains a list it is added to + // list_stack. for (li = cur_l->lv_first; !abort && li != NULL; li = li->li_next) abort = abort || set_ref_in_item(&li->li_tv, copyID, ht_stack, &list_stack); if (list_stack == NULL) break; - /* take an item from the stack */ + // take an item from the stack cur_l = list_stack->list; tempitem = list_stack; list_stack = list_stack->prev; @@ -4171,7 +4171,7 @@ set_ref_in_item( if (dd != NULL && dd->dv_copyID != copyID) { - /* Didn't see this dict yet. */ + // Didn't see this dict yet. dd->dv_copyID = copyID; if (ht_stack == NULL) { @@ -4197,7 +4197,7 @@ set_ref_in_item( if (ll != NULL && ll->lv_copyID != copyID) { - /* Didn't see this list yet. */ + // Didn't see this list yet. ll->lv_copyID = copyID; if (list_stack == NULL) { @@ -4227,8 +4227,7 @@ set_ref_in_item( partial_T *pt = tv->vval.v_partial; int i; - /* A partial does not have a copyID, because it cannot contain itself. - */ + // A partial does not have a copyID, because it cannot contain itself. if (pt != NULL) { abort = set_ref_in_func(pt->pt_name, pt->pt_func, copyID); @@ -4349,9 +4348,9 @@ echo_string_core( { if (!did_echo_string_emsg) { - /* Only give this message once for a recursive call to avoid - * flooding the user with errors. And stop iterating over lists - * and dicts. */ + // Only give this message once for a recursive call to avoid + // flooding the user with errors. And stop iterating over lists + // and dicts. did_echo_string_emsg = TRUE; emsg(_("E724: variable nested too deep for displaying")); } @@ -4612,12 +4611,12 @@ string_quote(char_u *str, int function) int string2float( char_u *text, - float_T *value) /* result stored here */ + float_T *value) // result stored here { char *s = (char *)text; float_T f; - /* MS-Windows does not deal with "inf" and "nan" properly. */ + // MS-Windows does not deal with "inf" and "nan" properly. if (STRNICMP(text, "inf", 3) == 0) { *value = INFINITY; @@ -4660,11 +4659,11 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate) if (evaluate) { if (len == 0) - return FAIL; /* invalid empty name */ + return FAIL; // invalid empty name cc = name[len]; name[len] = NUL; - /* first try vim_getenv(), fast for normal environment vars */ + // first try vim_getenv(), fast for normal environment vars string = vim_getenv(name, &mustfree); if (string != NULL && *string != NUL) { @@ -4676,7 +4675,7 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate) if (mustfree) vim_free(string); - /* next try expanding things like $VIM and ${HOME} */ + // next try expanding things like $VIM and ${HOME} string = expand_env_save(name - 1); if (string != NULL && *string == '$') VIM_CLEAR(string); @@ -4697,14 +4696,14 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate) pos_T * var2fpos( typval_T *varp, - int dollar_lnum, /* TRUE when $ is last line */ - int *fnum) /* set to fnum for '0, 'A, etc. */ + int dollar_lnum, // TRUE when $ is last line + int *fnum) // set to fnum for '0, 'A, etc. { char_u *name; static pos_T pos; pos_T *pp; - /* Argument can be [lnum, col, coladd]. */ + // Argument can be [lnum, col, coladd]. if (varp->v_type == VAR_LIST) { list_T *l; @@ -4716,30 +4715,30 @@ var2fpos( if (l == NULL) return NULL; - /* Get the line number */ + // Get the line number pos.lnum = list_find_nr(l, 0L, &error); if (error || pos.lnum <= 0 || pos.lnum > curbuf->b_ml.ml_line_count) - return NULL; /* invalid line number */ + return NULL; // invalid line number - /* Get the column number */ + // Get the column number pos.col = list_find_nr(l, 1L, &error); if (error) return NULL; len = (long)STRLEN(ml_get(pos.lnum)); - /* We accept "$" for the column number: last column. */ + // We accept "$" for the column number: last column. li = list_find(l, 1L); if (li != NULL && li->li_tv.v_type == VAR_STRING && li->li_tv.vval.v_string != NULL && STRCMP(li->li_tv.vval.v_string, "$") == 0) pos.col = len + 1; - /* Accept a position up to the NUL after the line. */ + // Accept a position up to the NUL after the line. if (pos.col == 0 || (int)pos.col > len + 1) - return NULL; /* invalid column number */ + return NULL; // invalid column number --pos.col; - /* Get the virtual offset. Defaults to zero. */ + // Get the virtual offset. Defaults to zero. pos.coladd = list_find_nr(l, 2L, &error); if (error) pos.coladd = 0; @@ -4750,15 +4749,15 @@ var2fpos( name = tv_get_string_chk(varp); if (name == NULL) return NULL; - if (name[0] == '.') /* cursor */ + if (name[0] == '.') // cursor return &curwin->w_cursor; - if (name[0] == 'v' && name[1] == NUL) /* Visual start */ + if (name[0] == 'v' && name[1] == NUL) // Visual start { if (VIsual_active) return &VIsual; return &curwin->w_cursor; } - if (name[0] == '\'') /* mark */ + if (name[0] == '\'') // mark { pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum); if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) @@ -4771,23 +4770,23 @@ var2fpos( if (name[0] == 'w' && dollar_lnum) { pos.col = 0; - if (name[1] == '0') /* "w0": first visible line */ + if (name[1] == '0') // "w0": first visible line { update_topline(); - /* In silent Ex mode topline is zero, but that's not a valid line - * number; use one instead. */ + // In silent Ex mode topline is zero, but that's not a valid line + // number; use one instead. pos.lnum = curwin->w_topline > 0 ? curwin->w_topline : 1; return &pos; } - else if (name[1] == '$') /* "w$": last visible line */ + else if (name[1] == '$') // "w$": last visible line { validate_botline(); - /* In silent Ex mode botline is zero, return zero then. */ + // In silent Ex mode botline is zero, return zero then. pos.lnum = curwin->w_botline > 0 ? curwin->w_botline - 1 : 0; return &pos; } } - else if (name[0] == '$') /* last column or line */ + else if (name[0] == '$') // last column or line { if (dollar_lnum) { @@ -4823,8 +4822,8 @@ list2fpos( long i = 0; long n; - /* List must be: [fnum, lnum, col, coladd, curswant], where "fnum" is only - * there when "fnump" isn't NULL; "coladd" and "curswant" are optional. */ + // List must be: [fnum, lnum, col, coladd, curswant], where "fnum" is only + // there when "fnump" isn't NULL; "coladd" and "curswant" are optional. if (arg->v_type != VAR_LIST || l == NULL || l->lv_len < (fnump == NULL ? 2 : 3) @@ -4833,32 +4832,32 @@ list2fpos( if (fnump != NULL) { - n = list_find_nr(l, i++, NULL); /* fnum */ + n = list_find_nr(l, i++, NULL); // fnum if (n < 0) return FAIL; if (n == 0) - n = curbuf->b_fnum; /* current buffer */ + n = curbuf->b_fnum; // current buffer *fnump = n; } - n = list_find_nr(l, i++, NULL); /* lnum */ + n = list_find_nr(l, i++, NULL); // lnum if (n < 0) return FAIL; posp->lnum = n; - n = list_find_nr(l, i++, NULL); /* col */ + n = list_find_nr(l, i++, NULL); // col if (n < 0) return FAIL; posp->col = n; - n = list_find_nr(l, i, NULL); /* off */ + n = list_find_nr(l, i, NULL); // off if (n < 0) posp->coladd = 0; else posp->coladd = n; if (curswantp != NULL) - *curswantp = list_find_nr(l, i + 1, NULL); /* curswant */ + *curswantp = list_find_nr(l, i + 1, NULL); // curswant return OK; } @@ -4876,7 +4875,7 @@ get_env_len(char_u **arg) for (p = *arg; vim_isIDc(*p); ++p) ; - if (p == *arg) /* no name found */ + if (p == *arg) // no name found return 0; len = (int)(p - *arg); @@ -4895,20 +4894,20 @@ get_id_len(char_u **arg) char_u *p; int len; - /* Find the end of the name. */ + // Find the end of the name. for (p = *arg; eval_isnamec(*p); ++p) { if (*p == ':') { - /* "s:" is start of "s:var", but "n:" is not and can be used in - * slice "[n:]". Also "xx:" is not a namespace. */ + // "s:" is start of "s:var", but "n:" is not and can be used in + // slice "[n:]". Also "xx:" is not a namespace. len = (int)(p - *arg); if ((len == 1 && vim_strchr(NAMESPACE_CHAR, **arg) == NULL) || len > 1) break; } } - if (p == *arg) /* no name found */ + if (p == *arg) // no name found return 0; len = (int)(p - *arg); @@ -4938,19 +4937,19 @@ get_name_len( char_u *expr_start; char_u *expr_end; - *alias = NULL; /* default to no alias */ + *alias = NULL; // default to no alias if ((*arg)[0] == K_SPECIAL && (*arg)[1] == KS_EXTRA && (*arg)[2] == (int)KE_SNR) { - /* hard coded <SNR>, already translated */ + // hard coded <SNR>, already translated *arg += 3; return get_id_len(arg) + 3; } len = eval_fname_script(*arg); if (len > 0) { - /* literal "<SID>", "s:" or "<SNR>" */ + // literal "<SID>", "s:" or "<SNR>" *arg += len; } @@ -5017,7 +5016,7 @@ find_name_end( *expr_end = NULL; } - /* Quick check for valid starting character. */ + // Quick check for valid starting character. if ((flags & FNE_CHECK_START) && !eval_isnamec1(*arg) && *arg != '{') return arg; @@ -5030,7 +5029,7 @@ find_name_end( { if (*p == '\'') { - /* skip over 'string' to avoid counting [ and ] inside it. */ + // skip over 'string' to avoid counting [ and ] inside it. for (p = p + 1; *p != NUL && *p != '\''; MB_PTR_ADV(p)) ; if (*p == NUL) @@ -5038,7 +5037,7 @@ find_name_end( } else if (*p == '"') { - /* skip over "str\"ing" to avoid counting [ and ] inside it. */ + // skip over "str\"ing" to avoid counting [ and ] inside it. for (p = p + 1; *p != NUL && *p != '"'; MB_PTR_ADV(p)) if (*p == '\\' && p[1] != NUL) ++p; @@ -5047,8 +5046,8 @@ find_name_end( } else if (br_nest == 0 && mb_nest == 0 && *p == ':') { - /* "s:" is start of "s:var", but "n:" is not and can be used in - * slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */ + // "s:" is start of "s:var", but "n:" is not and can be used in + // slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. len = (int)(p - arg); if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) || (len > 1 && p[-1] != '}')) @@ -5129,7 +5128,7 @@ make_expanded_name( } vim_free(temp_result); - *in_end = c1; /* put char back for error messages */ + *in_end = c1; // put char back for error messages *expr_start = '{'; *expr_end = '}'; @@ -5138,7 +5137,7 @@ make_expanded_name( temp_result = find_name_end(retval, &expr_start, &expr_end, 0); if (expr_start != NULL) { - /* Further expansion! */ + // Further expansion! temp_result = make_expanded_name(retval, expr_start, expr_end, temp_result); vim_free(retval); @@ -5235,7 +5234,7 @@ handle_subscript( ret = eval_method(arg, rettv, evaluate, verbose); } } - else /* **arg == '[' || **arg == '.' */ + else // **arg == '[' || **arg == '.' { dict_unref(selfdict); if (rettv->v_type == VAR_DICT) @@ -5254,9 +5253,9 @@ handle_subscript( } } - /* Turn "dict.Func" into a partial for "Func" bound to "dict". - * Don't do this when "Func" is already a partial that was bound - * explicitly (pt_auto is FALSE). */ + // Turn "dict.Func" into a partial for "Func" bound to "dict". + // Don't do this when "Func" is already a partial that was bound + // explicitly (pt_auto is FALSE). if (selfdict != NULL && (rettv->v_type == VAR_FUNC || (rettv->v_type == VAR_PARTIAL @@ -5311,7 +5310,7 @@ free_tv(typval_T *varp) { case VAR_FUNC: func_unref(varp->vval.v_string); - /* FALLTHROUGH */ + // FALLTHROUGH case VAR_STRING: vim_free(varp->vval.v_string); break; @@ -5359,7 +5358,7 @@ clear_tv(typval_T *varp) { case VAR_FUNC: func_unref(varp->vval.v_string); - /* FALLTHROUGH */ + // FALLTHROUGH case VAR_STRING: VIM_CLEAR(varp->vval.v_string); break; @@ -5429,7 +5428,7 @@ tv_get_number(typval_T *varp) { int error = FALSE; - return tv_get_number_chk(varp, &error); /* return 0L on error */ + return tv_get_number_chk(varp, &error); // return 0L on error } varnumber_T @@ -5481,7 +5480,7 @@ tv_get_number_chk(typval_T *varp, int *denote) internal_error("tv_get_number(UNKNOWN)"); break; } - if (denote == NULL) /* useful for values that must be unsigned */ + if (denote == NULL) // useful for values that must be unsigned n = -1; else *denote = TRUE; @@ -5626,7 +5625,7 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf) (long)job->jv_proc_info.dwProcessId, status); # else - /* fall-back */ + // fall-back vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status); # endif return buf; @@ -5843,7 +5842,7 @@ item_copy( to->vval.v_list = NULL; else if (copyID != 0 && from->vval.v_list->lv_copyID == copyID) { - /* use the copy made earlier */ + // use the copy made earlier to->vval.v_list = from->vval.v_list->lv_copylist; ++to->vval.v_list->lv_refcount; } @@ -5862,7 +5861,7 @@ item_copy( to->vval.v_dict = NULL; else if (copyID != 0 && from->vval.v_dict->dv_copyID == copyID) { - /* use the copy made earlier */ + // use the copy made earlier to->vval.v_dict = from->vval.v_dict->dv_copydict; ++to->vval.v_dict->dv_refcount; } @@ -5901,8 +5900,8 @@ ex_echo(exarg_T *eap) ++emsg_skip; while (*arg != NUL && *arg != '|' && *arg != '\n' && !got_int) { - /* If eval1() causes an error message the text from the command may - * still need to be cleared. E.g., "echo 22,44". */ + // If eval1() causes an error message the text from the command may + // still need to be cleared. E.g., "echo 22,44". need_clr_eos = needclr; p = arg; @@ -5926,13 +5925,13 @@ ex_echo(exarg_T *eap) if (atstart) { atstart = FALSE; - /* Call msg_start() after eval1(), evaluating the expression - * may cause a message to appear. */ + // Call msg_start() after eval1(), evaluating the expression + // may cause a message to appear. if (eap->cmdidx == CMD_echo) { - /* Mark the saved text as finishing the line, so that what - * follows is displayed on a new line when scrolling back - * at the more prompt. */ + // Mark the saved text as finishing the line, so that what + // follows is displayed on a new line when scrolling back + // at the more prompt. msg_sb_eol(); msg_start(); } @@ -5947,7 +5946,7 @@ ex_echo(exarg_T *eap) { if (*p != TAB && needclr) { - /* remove any text still there from the command */ + // remove any text still there from the command msg_clr_eos(); needclr = FALSE; } @@ -5977,7 +5976,7 @@ ex_echo(exarg_T *eap) --emsg_skip; else { - /* remove text that may still be there from the command */ + // remove text that may still be there from the command if (needclr) msg_clr_eos(); if (eap->cmdidx == CMD_echo) @@ -6060,9 +6059,9 @@ ex_execute(exarg_T *eap) { if (eap->cmdidx == CMD_echomsg || eap->cmdidx == CMD_echoerr) { - /* Mark the already saved text as finishing the line, so that what - * follows is displayed on a new line when scrolling back at the - * more prompt. */ + // Mark the already saved text as finishing the line, so that what + // follows is displayed on a new line when scrolling back at the + // more prompt. msg_sb_eol(); } @@ -6073,7 +6072,7 @@ ex_execute(exarg_T *eap) } else if (eap->cmdidx == CMD_echoerr) { - /* We don't want to abort following commands, restore did_emsg. */ + // We don't want to abort following commands, restore did_emsg. save_did_emsg = did_emsg; emsg(ga.ga_data); if (!force_abort) @@ -6122,7 +6121,7 @@ find_option_end(char_u **arg, int *opt_flags) *arg = p; if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL) - p += 4; /* termcap option */ + p += 4; // termcap option else while (ASCII_ISALPHA(*p)) ++p; @@ -6162,11 +6161,11 @@ last_set_msg(sctx_T script_ctx) */ int typval_compare( - typval_T *typ1, /* first operand */ - typval_T *typ2, /* second operand */ - exptype_T type, /* operator */ - int type_is, /* TRUE for "is" and "isnot" */ - int ic) /* ignore case */ + typval_T *typ1, // first operand + typval_T *typ2, // second operand + exptype_T type, // operator + int type_is, // TRUE for "is" and "isnot" + int ic) // ignore case { int i; varnumber_T n1, n2; @@ -6175,8 +6174,8 @@ typval_compare( if (type_is && typ1->v_type != typ2->v_type) { - /* For "is" a different type always means FALSE, for "notis" - * it means TRUE. */ + // For "is" a different type always means FALSE, for "notis" + // it means TRUE. n1 = (type == TYPE_NEQUAL); } else if (typ1->v_type == VAR_BLOB || typ2->v_type == VAR_BLOB) @@ -6227,7 +6226,7 @@ typval_compare( } else { - /* Compare two Lists for being equal or unequal. */ + // Compare two Lists for being equal or unequal. n1 = list_equal(typ1->vval.v_list, typ2->vval.v_list, ic, FALSE); if (type == TYPE_NEQUAL) @@ -6256,7 +6255,7 @@ typval_compare( } else { - /* Compare two Dictionaries for being equal or unequal. */ + // Compare two Dictionaries for being equal or unequal. n1 = dict_equal(typ1->vval.v_dict, typ2->vval.v_dict, ic, FALSE); if (type == TYPE_NEQUAL) @@ -6277,13 +6276,13 @@ typval_compare( && typ1->vval.v_partial == NULL) || (typ2->v_type == VAR_PARTIAL && typ2->vval.v_partial == NULL)) - /* when a partial is NULL assume not equal */ + // when a partial is NULL assume not equal n1 = FALSE; else if (type_is) { if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC) - /* strings are considered the same if their value is - * the same */ + // strings are considered the same if their value is + // the same n1 = tv_equal(typ1, typ2, ic, FALSE); else if (typ1->v_type == VAR_PARTIAL && typ2->v_type == VAR_PARTIAL) @@ -6320,7 +6319,7 @@ typval_compare( case TYPE_SEQUAL: n1 = (f1 <= f2); break; case TYPE_UNKNOWN: case TYPE_MATCH: - case TYPE_NOMATCH: break; /* avoid gcc warning */ + case TYPE_NOMATCH: break; // avoid gcc warning } } #endif @@ -6344,7 +6343,7 @@ typval_compare( case TYPE_SEQUAL: n1 = (n1 <= n2); break; case TYPE_UNKNOWN: case TYPE_MATCH: - case TYPE_NOMATCH: break; /* avoid gcc warning */ + case TYPE_NOMATCH: break; // avoid gcc warning } } else @@ -6372,7 +6371,7 @@ typval_compare( n1 = !n1; break; - case TYPE_UNKNOWN: break; /* avoid gcc warning */ + case TYPE_UNKNOWN: break; // avoid gcc warning } } clear_tv(typ1); @@ -6392,7 +6391,7 @@ typval_tostring(typval_T *arg) if (arg == NULL) return vim_strsave((char_u *)"(does not exist)"); ret = tv2string(arg, &tofree, numbuf, 0); - /* Make a copy if we have a value but it's not in allocated memory. */ + // Make a copy if we have a value but it's not in allocated memory. if (ret != NULL && tofree == NULL) ret = vim_strsave(ret); return ret; @@ -6425,7 +6424,7 @@ do_string_sub( char_u *save_cpo; char_u *zero_width = NULL; - /* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */ + // Make 'cpoptions' empty, so that the 'l' flag doesn't work here save_cpo = p_cpo; p_cpo = empty_option; @@ -6441,12 +6440,12 @@ do_string_sub( end = str + STRLEN(str); while (vim_regexec_nl(®match, str, (colnr_T)(tail - str))) { - /* Skip empty match except for first match. */ + // Skip empty match except for first match. if (regmatch.startp[0] == regmatch.endp[0]) { if (zero_width == regmatch.startp[0]) { - /* avoid getting stuck on a match with an empty string */ + // avoid getting stuck on a match with an empty string i = mb_ptr2len(tail); mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i); @@ -6472,10 +6471,10 @@ do_string_sub( break; } - /* copy the text up to where the match is */ + // copy the text up to where the match is i = (int)(regmatch.startp[0] - tail); mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i); - /* add the substituted text */ + // add the substituted text (void)vim_regsub(®match, sub, expr, (char_u *)ga.ga_data + ga.ga_len + i, TRUE, TRUE, FALSE); ga.ga_len += i + sublen - 1; @@ -6497,7 +6496,7 @@ do_string_sub( if (p_cpo == empty_option) p_cpo = save_cpo; else - /* Darn, evaluating {sub} expression or {expr} changed the value. */ + // Darn, evaluating {sub} expression or {expr} changed the value. free_string_option(save_cpo); return ret; |