diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-21 18:25:54 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-21 18:25:54 +0100 |
commit | 85a2002adb0eda9a9309c2fab4a79edaa91fb834 (patch) | |
tree | 99278733712406ab6f291d92f1645c0064c75037 /src/misc2.c | |
parent | fe72d08400d9064b3f959f1f62f279527e64835a (diff) | |
download | vim-git-85a2002adb0eda9a9309c2fab4a79edaa91fb834.tar.gz |
patch 8.2.0026: still some /* */ commentsv8.2.0026
Problem: Still some /* */ comments.
Solution: Convert to // comments.
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 547 |
1 files changed, 273 insertions, 274 deletions
diff --git a/src/misc2.c b/src/misc2.c index ce767984f..c0208de26 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -12,7 +12,7 @@ */ #include "vim.h" -static char_u *username = NULL; /* cached result of mch_get_user_name() */ +static char_u *username = NULL; // cached result of mch_get_user_name() static int coladvance2(pos_T *pos, int addspaces, int finetune, colnr_T wcol); @@ -22,9 +22,9 @@ static int coladvance2(pos_T *pos, int addspaces, int finetune, colnr_T wcol); int virtual_active(void) { - /* While an operator is being executed we return "virtual_op", because - * VIsual_active has already been reset, thus we can't check for "block" - * being used. */ + // While an operator is being executed we return "virtual_op", because + // VIsual_active has already been reset, thus we can't check for "block" + // being used. if (virtual_op != MAYBE) return virtual_op; return (ve_flags == VE_ALL @@ -58,7 +58,7 @@ coladvance_force(colnr_T wcol) curwin->w_valid &= ~VALID_VIRTCOL; else { - /* Virtcol is valid */ + // Virtcol is valid curwin->w_valid |= VALID_VIRTCOL; curwin->w_virtcol = wcol; } @@ -99,7 +99,7 @@ coladvance(colnr_T wcol) curwin->w_valid &= ~VALID_VIRTCOL; else if (*ml_get_cursor() != TAB) { - /* Virtcol is valid when not on a TAB */ + // Virtcol is valid when not on a TAB curwin->w_valid |= VALID_VIRTCOL; curwin->w_virtcol = wcol; } @@ -168,10 +168,10 @@ coladvance2( if (wcol / width > (colnr_T)csize / width && ((State & INSERT) == 0 || (int)wcol > csize + 1)) { - /* In case of line wrapping don't move the cursor beyond the - * right screen edge. In Insert mode allow going just beyond - * the last character (like what happens when typing and - * reaching the right window edge). */ + // In case of line wrapping don't move the cursor beyond the + // right screen edge. In Insert mode allow going just beyond + // the last character (like what happens when typing and + // reaching the right window edge). wcol = (csize / width + 1) * width - 1; } } @@ -179,7 +179,7 @@ coladvance2( ptr = line; while (col <= wcol && *ptr != NUL) { - /* Count a tab for what it's worth (if list mode not on) */ + // Count a tab for what it's worth (if list mode not on) #ifdef FEAT_LINEBREAK csize = win_lbr_chartabsize(curwin, line, ptr, col, &head); MB_PTR_ADV(ptr); @@ -199,7 +199,7 @@ coladvance2( { idx -= 1; # ifdef FEAT_LINEBREAK - /* Don't count the chars from 'showbreak'. */ + // Don't count the chars from 'showbreak'. csize -= head; # endif col -= csize; @@ -210,12 +210,12 @@ coladvance2( && wcol >= 0 && ((col != wcol && col != wcol + 1) || csize > 1)) { - /* 'virtualedit' is set: The difference between wcol and col is - * filled with spaces. */ + // 'virtualedit' is set: The difference between wcol and col is + // filled with spaces. if (line[idx] == NUL) { - /* Append spaces */ + // Append spaces int correct = wcol - col; char_u *newline = alloc(idx + correct + 1); int t; @@ -238,9 +238,9 @@ coladvance2( } else { - /* Break a tab */ + // Break a tab int linelen = (int)STRLEN(line); - int correct = wcol - col - csize + 1; /* negative!! */ + int correct = wcol - col - csize + 1; // negative!! char_u *newline; int t, s = 0; int v; @@ -282,7 +282,7 @@ coladvance2( { if (wcol == MAXCOL) { - /* The width of the last character is used to set coladd. */ + // The width of the last character is used to set coladd. if (!one_more) { colnr_T scol, ecol; @@ -295,7 +295,7 @@ coladvance2( { int b = (int)wcol - (int)col; - /* The difference between wcol and col is used to set coladd. */ + // The difference between wcol and col is used to set coladd. if (b > 0 && b < (MAXCOL - 2 * curwin->w_width)) pos->coladd = b; @@ -303,7 +303,7 @@ coladvance2( } } - /* prevent from moving onto a trail byte */ + // prevent from moving onto a trail byte if (has_mbyte) mb_adjustpos(curbuf, pos); @@ -333,11 +333,11 @@ inc(pos_T *lp) { char_u *p; - /* when searching position may be set to end of a line */ + // when searching position may be set to end of a line if (lp->col != MAXCOL) { p = ml_get_pos(lp); - if (*p != NUL) /* still within line, move to next char (may be NUL) */ + if (*p != NUL) // still within line, move to next char (may be NUL) { if (has_mbyte) { @@ -351,7 +351,7 @@ inc(pos_T *lp) return ((p[1] != NUL) ? 0 : 2); } } - if (lp->lnum != curbuf->b_ml.ml_line_count) /* there is a next line */ + if (lp->lnum != curbuf->b_ml.ml_line_count) // there is a next line { lp->col = 0; lp->lnum++; @@ -394,7 +394,7 @@ dec(pos_T *lp) lp->coladd = 0; if (lp->col == MAXCOL) { - /* past end of line */ + // past end of line p = ml_get(lp->lnum); lp->col = (colnr_T)STRLEN(p); if (has_mbyte) @@ -404,7 +404,7 @@ dec(pos_T *lp) if (lp->col > 0) { - /* still within line */ + // still within line lp->col--; if (has_mbyte) { @@ -416,7 +416,7 @@ dec(pos_T *lp) if (lp->lnum > 1) { - /* there is a prior line */ + // there is a prior line lp->lnum--; p = ml_get(lp->lnum); lp->col = (colnr_T)STRLEN(p); @@ -425,7 +425,7 @@ dec(pos_T *lp) return 1; } - /* at start of file */ + // at start of file return -1; } @@ -450,7 +450,7 @@ decl(pos_T *lp) linenr_T get_cursor_rel_lnum( win_T *wp, - linenr_T lnum) /* line number to get the result for */ + linenr_T lnum) // line number to get the result for { linenr_T cursor = wp->w_cursor.lnum; linenr_T retval = 0; @@ -463,8 +463,8 @@ get_cursor_rel_lnum( while (lnum > cursor) { (void)hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL); - /* if lnum and cursor are in the same fold, - * now lnum <= cursor */ + // if lnum and cursor are in the same fold, + // now lnum <= cursor if (lnum > cursor) retval++; lnum--; @@ -475,16 +475,15 @@ get_cursor_rel_lnum( while (lnum < cursor) { (void)hasFoldingWin(wp, lnum, NULL, &lnum, TRUE, NULL); - /* if lnum and cursor are in the same fold, - * now lnum >= cursor */ + // if lnum and cursor are in the same fold, + // now lnum >= cursor if (lnum < cursor) retval--; lnum++; } } - /* else if (lnum == cursor) - * retval = 0; - */ + // else if (lnum == cursor) + // retval = 0; } else #endif @@ -524,8 +523,8 @@ check_cursor_lnum(void) if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) { #ifdef FEAT_FOLDING - /* If there is a closed fold at the end of the file, put the cursor in - * its first line. Otherwise in the last line. */ + // If there is a closed fold at the end of the file, put the cursor in + // its first line. Otherwise in the last line. if (!hasFolding(curbuf->b_ml.ml_line_count, &curwin->w_cursor.lnum, NULL)) #endif @@ -559,10 +558,10 @@ check_cursor_col_win(win_T *win) win->w_cursor.col = 0; else if (win->w_cursor.col >= len) { - /* Allow cursor past end-of-line when: - * - in Insert mode or restarting Insert mode - * - in Visual mode and 'selection' isn't "old" - * - 'virtualedit' is set */ + // Allow cursor past end-of-line when: + // - in Insert mode or restarting Insert mode + // - in Visual mode and 'selection' isn't "old" + // - 'virtualedit' is set if ((State & INSERT) || restart_edit || (VIsual_active && *p_sel != 'o') || (ve_flags & VE_ONEMORE) @@ -571,7 +570,7 @@ check_cursor_col_win(win_T *win) else { win->w_cursor.col = len - 1; - /* Move the cursor to the head byte. */ + // Move the cursor to the head byte. if (has_mbyte) mb_adjustpos(win->w_buffer, &win->w_cursor); } @@ -579,9 +578,9 @@ check_cursor_col_win(win_T *win) else if (win->w_cursor.col < 0) win->w_cursor.col = 0; - /* If virtual editing is on, we can leave the cursor on the old position, - * only we must set it to virtual. But don't do it when at the end of the - * line. */ + // If virtual editing is on, we can leave the cursor on the old position, + // only we must set it to virtual. But don't do it when at the end of the + // line. if (oldcol == MAXCOL) win->w_cursor.coladd = 0; else if (ve_flags == VE_ALL) @@ -590,9 +589,9 @@ check_cursor_col_win(win_T *win) { win->w_cursor.coladd = oldcoladd - win->w_cursor.col; - /* Make sure that coladd is not more than the char width. - * Not for the last character, coladd is then used when the cursor - * is actually after the last character. */ + // Make sure that coladd is not more than the char width. + // Not for the last character, coladd is then used when the cursor + // is actually after the last character. if (win->w_cursor.col + 1 < len && win->w_cursor.coladd > 0) { int cs, ce; @@ -603,7 +602,7 @@ check_cursor_col_win(win_T *win) } } else - /* avoid weird number when there is a miscalculation or overflow */ + // avoid weird number when there is a miscalculation or overflow win->w_cursor.coladd = 0; } } @@ -678,9 +677,9 @@ leftcol_changed(void) else if (s < curwin->w_leftcol) { retval = TRUE; - if (coladvance(e + 1) == FAIL) /* there isn't another character */ + if (coladvance(e + 1) == FAIL) // there isn't another character { - curwin->w_leftcol = s; /* adjust w_leftcol instead */ + curwin->w_leftcol = s; // adjust w_leftcol instead changed_cline_bef_curs(); } } @@ -794,7 +793,7 @@ vim_mem_profile_dump(void) num_alloc, num_freed); } -#endif /* MEM_PROFILE */ +#endif // MEM_PROFILE #ifdef FEAT_EVAL int @@ -890,11 +889,11 @@ lalloc_clear(size_t size, int message) void * lalloc(size_t size, int message) { - void *p; /* pointer to new storage space */ - static int releasing = FALSE; /* don't do mf_release_all() recursive */ + void *p; // pointer to new storage space + static int releasing = FALSE; // don't do mf_release_all() recursive int try_again; #if defined(HAVE_AVAIL_MEM) - static size_t allocated = 0; /* allocated since last avail check */ + static size_t allocated = 0; // allocated since last avail check #endif // Safety check for allocating zero bytes @@ -926,20 +925,20 @@ lalloc(size_t size, int message) if ((p = malloc(size)) != NULL) { #ifndef HAVE_AVAIL_MEM - /* 1. No check for available memory: Just return. */ + // 1. No check for available memory: Just return. goto theend; #else - /* 2. Slow check for available memory: call mch_avail_mem() after - * allocating (KEEP_ROOM / 2) amount of memory. */ + // 2. Slow check for available memory: call mch_avail_mem() after + // allocating (KEEP_ROOM / 2) amount of memory. allocated += size; if (allocated < KEEP_ROOM / 2) goto theend; allocated = 0; - /* 3. check for available memory: call mch_avail_mem() */ + // 3. check for available memory: call mch_avail_mem() if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing) { - free(p); /* System is low... no go! */ + free(p); // System is low... no go! p = NULL; } else @@ -954,8 +953,8 @@ lalloc(size_t size, int message) break; releasing = TRUE; - clear_sb_text(TRUE); /* free any scrollback text */ - try_again = mf_release_all(); /* release as many blocks as possible */ + clear_sb_text(TRUE); // free any scrollback text + try_again = mf_release_all(); // release as many blocks as possible releasing = FALSE; if (!try_again) @@ -1046,16 +1045,16 @@ free_all_mem(void) { buf_T *buf, *nextbuf; - /* When we cause a crash here it is caught and Vim tries to exit cleanly. - * Don't try freeing everything again. */ + // When we cause a crash here it is caught and Vim tries to exit cleanly. + // Don't try freeing everything again. if (entered_free_all_mem) return; entered_free_all_mem = TRUE; - /* Don't want to trigger autocommands from here on. */ + // Don't want to trigger autocommands from here on. block_autocmds(); - /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ + // Close all tabs and windows. Reset 'equalalways' to avoid redraws. p_ea = FALSE; if (first_tabpage != NULL && first_tabpage->tp_next != NULL) do_cmdline_cmd((char_u *)"tabonly!"); @@ -1063,7 +1062,7 @@ free_all_mem(void) do_cmdline_cmd((char_u *)"only!"); # if defined(FEAT_SPELL) - /* Free all spell info. */ + // Free all spell info. spell_free_all(); # endif @@ -1109,7 +1108,7 @@ free_all_mem(void) free_findfile(); # endif - /* Obviously named calls. */ + // Obviously named calls. free_all_autocmds(); clear_termcodes(); free_all_marks(); @@ -1134,9 +1133,9 @@ free_all_mem(void) if (curtab != NULL) diff_clear(curtab); # endif - clear_sb_text(TRUE); /* free any scrollback text */ + clear_sb_text(TRUE); // free any scrollback text - /* Free some global vars. */ + // Free some global vars. vim_free(username); # ifdef FEAT_CLIPBOARD vim_regfree(clip_exclude_prog); @@ -1145,7 +1144,7 @@ free_all_mem(void) vim_free(new_last_cmdline); set_keep_msg(NULL, 0); - /* Clear cmdline history. */ + // Clear cmdline history. p_hi = 0; init_history(); # ifdef FEAT_PROP_POPUP @@ -1171,11 +1170,11 @@ free_all_mem(void) // Destroy all windows. Must come before freeing buffers. win_free_all(); - /* Free all option values. Must come after closing windows. */ + // Free all option values. Must come after closing windows. free_all_options(); - /* Free all buffers. Reset 'autochdir' to avoid accessing things that - * were freed already. */ + // Free all buffers. Reset 'autochdir' to avoid accessing things that + // were freed already. # ifdef FEAT_AUTOCHDIR p_acd = FALSE; # endif @@ -1187,7 +1186,7 @@ free_all_mem(void) nextbuf = buf->b_next; close_buffer(NULL, buf, DOBUF_WIPE, FALSE, FALSE); if (bufref_valid(&bufref)) - buf = nextbuf; /* didn't work, try next one */ + buf = nextbuf; // didn't work, try next one else buf = firstbuf; } @@ -1196,7 +1195,7 @@ free_all_mem(void) free_arshape_buf(); # endif - /* Clear registers. */ + // Clear registers. clear_registers(); ResetRedobuff(); ResetRedobuff(); @@ -1205,7 +1204,7 @@ free_all_mem(void) vim_free(serverDelayedStartName); # endif - /* highlight info */ + // highlight info free_highlight(); reset_last_sourcing(); @@ -1217,11 +1216,11 @@ free_all_mem(void) } # ifdef UNIX - /* Machine-specific free. */ + // Machine-specific free. mch_free_mem(); # endif - /* message history */ + // message history for (;;) if (delete_first_msg() == FAIL) break; @@ -1233,17 +1232,17 @@ free_all_mem(void) timer_free_all(); # endif # ifdef FEAT_EVAL - /* must be after channel_free_all() with unrefs partials */ + // must be after channel_free_all() with unrefs partials eval_clear(); # endif # ifdef FEAT_JOB_CHANNEL - /* must be after eval_clear() with unrefs jobs */ + // must be after eval_clear() with unrefs jobs job_free_all(); # endif free_termoptions(); - /* screenlines (can't display anything now!) */ + // screenlines (can't display anything now!) free_screenlines(); # if defined(FEAT_SOUND) @@ -1347,18 +1346,18 @@ vim_strsave_escaped_ext( * First count the number of backslashes required. * Then allocate the memory and insert them. */ - length = 1; /* count the trailing NUL */ + length = 1; // count the trailing NUL for (p = string; *p; p++) { if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - length += l; /* count a multibyte char */ + length += l; // count a multibyte char p += l - 1; continue; } if (vim_strchr(esc_chars, *p) != NULL || (bsl && rem_backslash(p))) - ++length; /* count a backslash */ - ++length; /* count an ordinary char */ + ++length; // count a backslash + ++length; // count an ordinary char } escaped_string = alloc(length); if (escaped_string != NULL) @@ -1370,7 +1369,7 @@ vim_strsave_escaped_ext( { mch_memmove(p2, p, (size_t)l); p2 += l; - p += l - 1; /* skip multibyte char */ + p += l - 1; // skip multibyte char continue; } if (vim_strchr(esc_chars, *p) != NULL || (bsl && rem_backslash(p))) @@ -1411,47 +1410,47 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) int l; int csh_like; - /* Only csh and similar shells expand '!' within single quotes. For sh and - * the like we must not put a backslash before it, it will be taken - * literally. If do_special is set the '!' will be escaped twice. - * Csh also needs to have "\n" escaped twice when do_special is set. */ + // Only csh and similar shells expand '!' within single quotes. For sh and + // the like we must not put a backslash before it, it will be taken + // literally. If do_special is set the '!' will be escaped twice. + // Csh also needs to have "\n" escaped twice when do_special is set. csh_like = csh_like_shell(); - /* First count the number of extra bytes required. */ - length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */ + // First count the number of extra bytes required. + length = (unsigned)STRLEN(string) + 3; // two quotes and a trailing NUL for (p = string; *p != NUL; MB_PTR_ADV(p)) { # ifdef MSWIN if (!p_ssl) { if (*p == '"') - ++length; /* " -> "" */ + ++length; // " -> "" } else # endif if (*p == '\'') - length += 3; /* ' => '\'' */ + length += 3; // ' => '\'' if ((*p == '\n' && (csh_like || do_newline)) || (*p == '!' && (csh_like || do_special))) { - ++length; /* insert backslash */ + ++length; // insert backslash if (csh_like && do_special) - ++length; /* insert backslash */ + ++length; // insert backslash } if (do_special && find_cmdline_var(p, &l) >= 0) { - ++length; /* insert backslash */ + ++length; // insert backslash p += l - 1; } } - /* Allocate memory for the result and fill it. */ + // Allocate memory for the result and fill it. escaped_string = alloc(length); if (escaped_string != NULL) { d = escaped_string; - /* add opening quote */ + // add opening quote # ifdef MSWIN if (!p_ssl) *d++ = '"'; @@ -1494,8 +1493,8 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) } if (do_special && find_cmdline_var(p, &l) >= 0) { - *d++ = '\\'; /* insert backslash */ - while (--l >= 0) /* copy the var */ + *d++ = '\\'; // insert backslash + while (--l >= 0) // copy the var *d++ = *p++; continue; } @@ -1503,7 +1502,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline) MB_COPY_CHAR(p, d); } - /* add terminating quote and finish with a NUL */ + // add terminating quote and finish with a NUL # ifdef MSWIN if (!p_ssl) *d++ = '"'; @@ -1595,14 +1594,14 @@ strup_save(char_u *orig) l = utf_ptr2len(p); if (c == 0) { - /* overlong sequence, use only the first byte */ + // overlong sequence, use only the first byte c = *p; l = 1; } uc = utf_toupper(c); - /* Reallocate string when byte count changes. This is rare, - * thus it's OK to do another malloc()/free(). */ + // Reallocate string when byte count changes. This is rare, + // thus it's OK to do another malloc()/free(). newl = utf_char2len(uc); if (newl != l) { @@ -1623,10 +1622,10 @@ strup_save(char_u *orig) p += newl; } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) - p += l; /* skip multi-byte character */ + p += l; // skip multi-byte character else { - *p = TOUPPER_LOC(*p); /* note that toupper() can be a macro */ + *p = TOUPPER_LOC(*p); // note that toupper() can be a macro p++; } } @@ -1662,14 +1661,14 @@ strlow_save(char_u *orig) l = utf_ptr2len(p); if (c == 0) { - /* overlong sequence, use only the first byte */ + // overlong sequence, use only the first byte c = *p; l = 1; } lc = utf_tolower(c); - /* Reallocate string when byte count changes. This is rare, - * thus it's OK to do another malloc()/free(). */ + // Reallocate string when byte count changes. This is rare, + // thus it's OK to do another malloc()/free(). newl = utf_char2len(lc); if (newl != l) { @@ -1690,10 +1689,10 @@ strlow_save(char_u *orig) p += newl; } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) - p += l; /* skip multi-byte character */ + p += l; // skip multi-byte character else { - *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */ + *p = TOLOWER_LOC(*p); // note that tolower() can be a macro p++; } } @@ -1762,7 +1761,7 @@ copy_option_part( int len = 0; char_u *p = *option; - /* skip '.' at start of option part, for 'suffixes' */ + // skip '.' at start of option part, for 'suffixes' if (*p == '.') buf[len++] = *p++; while (*p != NUL && vim_strchr((char_u *)sep_chars, *p) == NULL) @@ -1778,9 +1777,9 @@ copy_option_part( } buf[len] = NUL; - if (*p != NUL && *p != ',') /* skip non-standard separator */ + if (*p != NUL && *p != ',') // skip non-standard separator ++p; - p = skip_to_option_part(p); /* p points to next file name */ + p = skip_to_option_part(p); // p points to next file name *option = p; return len; @@ -1832,13 +1831,13 @@ vim_stricmp(char *s1, char *s2) { i = (int)TOLOWER_LOC(*s1) - (int)TOLOWER_LOC(*s2); if (i != 0) - return i; /* this character different */ + return i; // this character different if (*s1 == NUL) - break; /* strings match until NUL */ + break; // strings match until NUL ++s1; ++s2; } - return 0; /* strings match */ + return 0; // strings match } #endif @@ -1857,14 +1856,14 @@ vim_strnicmp(char *s1, char *s2, size_t len) { i = (int)TOLOWER_LOC(*s1) - (int)TOLOWER_LOC(*s2); if (i != 0) - return i; /* this character different */ + return i; // this character different if (*s1 == NUL) - break; /* strings match until NUL */ + break; // strings match until NUL ++s1; ++s2; --len; } - return 0; /* strings match */ + return 0; // strings match } #endif @@ -1886,7 +1885,7 @@ vim_strchr(char_u *string, int c) { int l = utfc_ptr2len(p); - /* Avoid matching an illegal byte here. */ + // Avoid matching an illegal byte here. if (utf_ptr2char(p) == c && l > 1) return p; p += l; @@ -2177,7 +2176,7 @@ ga_append(garray_T *gap, int c) void append_ga_line(garray_T *gap) { - /* Remove trailing CR. */ + // Remove trailing CR. if (gap->ga_len > 0 && !curbuf->b_p_bin && ((char_u *)gap->ga_data)[gap->ga_len - 1] == CAR) @@ -2199,9 +2198,9 @@ append_ga_line(garray_T *gap) static struct modmasktable { - short mod_mask; /* Bit-mask for particular key modifier */ - short mod_flag; /* Bit(s) for particular key modifier */ - char_u name; /* Single letter name of modifier */ + short mod_mask; // Bit-mask for particular key modifier + short mod_flag; // Bit(s) for particular key modifier + char_u name; // Single letter name of modifier } mod_mask_table[] = { {MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'M'}, @@ -2214,10 +2213,10 @@ static struct modmasktable #ifdef MACOS_X {MOD_MASK_CMD, MOD_MASK_CMD, (char_u)'D'}, #endif - /* 'A' must be the last one */ + // 'A' must be the last one {MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'A'}, {0, 0, NUL} - /* NOTE: when adding an entry, update MAX_KEY_NAME_LEN! */ + // NOTE: when adding an entry, update MAX_KEY_NAME_LEN! }; /* @@ -2228,48 +2227,48 @@ static struct modmasktable static char_u modifier_keys_table[] = { -/* mod mask with modifier without modifier */ - MOD_MASK_SHIFT, '&', '9', '@', '1', /* begin */ - MOD_MASK_SHIFT, '&', '0', '@', '2', /* cancel */ - MOD_MASK_SHIFT, '*', '1', '@', '4', /* command */ - MOD_MASK_SHIFT, '*', '2', '@', '5', /* copy */ - MOD_MASK_SHIFT, '*', '3', '@', '6', /* create */ - MOD_MASK_SHIFT, '*', '4', 'k', 'D', /* delete char */ - MOD_MASK_SHIFT, '*', '5', 'k', 'L', /* delete line */ - MOD_MASK_SHIFT, '*', '7', '@', '7', /* end */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_END, '@', '7', /* end */ - MOD_MASK_SHIFT, '*', '9', '@', '9', /* exit */ - MOD_MASK_SHIFT, '*', '0', '@', '0', /* find */ - MOD_MASK_SHIFT, '#', '1', '%', '1', /* help */ - MOD_MASK_SHIFT, '#', '2', 'k', 'h', /* home */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_HOME, 'k', 'h', /* home */ - MOD_MASK_SHIFT, '#', '3', 'k', 'I', /* insert */ - MOD_MASK_SHIFT, '#', '4', 'k', 'l', /* left arrow */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_LEFT, 'k', 'l', /* left arrow */ - MOD_MASK_SHIFT, '%', 'a', '%', '3', /* message */ - MOD_MASK_SHIFT, '%', 'b', '%', '4', /* move */ - MOD_MASK_SHIFT, '%', 'c', '%', '5', /* next */ - MOD_MASK_SHIFT, '%', 'd', '%', '7', /* options */ - MOD_MASK_SHIFT, '%', 'e', '%', '8', /* previous */ - MOD_MASK_SHIFT, '%', 'f', '%', '9', /* print */ - MOD_MASK_SHIFT, '%', 'g', '%', '0', /* redo */ - MOD_MASK_SHIFT, '%', 'h', '&', '3', /* replace */ - MOD_MASK_SHIFT, '%', 'i', 'k', 'r', /* right arr. */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_RIGHT, 'k', 'r', /* right arr. */ - MOD_MASK_SHIFT, '%', 'j', '&', '5', /* resume */ - MOD_MASK_SHIFT, '!', '1', '&', '6', /* save */ - MOD_MASK_SHIFT, '!', '2', '&', '7', /* suspend */ - MOD_MASK_SHIFT, '!', '3', '&', '8', /* undo */ - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_UP, 'k', 'u', /* up arrow */ - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_DOWN, 'k', 'd', /* down arrow */ - - /* vt100 F1 */ +// mod mask with modifier without modifier + MOD_MASK_SHIFT, '&', '9', '@', '1', // begin + MOD_MASK_SHIFT, '&', '0', '@', '2', // cancel + MOD_MASK_SHIFT, '*', '1', '@', '4', // command + MOD_MASK_SHIFT, '*', '2', '@', '5', // copy + MOD_MASK_SHIFT, '*', '3', '@', '6', // create + MOD_MASK_SHIFT, '*', '4', 'k', 'D', // delete char + MOD_MASK_SHIFT, '*', '5', 'k', 'L', // delete line + MOD_MASK_SHIFT, '*', '7', '@', '7', // end + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_END, '@', '7', // end + MOD_MASK_SHIFT, '*', '9', '@', '9', // exit + MOD_MASK_SHIFT, '*', '0', '@', '0', // find + MOD_MASK_SHIFT, '#', '1', '%', '1', // help + MOD_MASK_SHIFT, '#', '2', 'k', 'h', // home + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_HOME, 'k', 'h', // home + MOD_MASK_SHIFT, '#', '3', 'k', 'I', // insert + MOD_MASK_SHIFT, '#', '4', 'k', 'l', // left arrow + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_LEFT, 'k', 'l', // left arrow + MOD_MASK_SHIFT, '%', 'a', '%', '3', // message + MOD_MASK_SHIFT, '%', 'b', '%', '4', // move + MOD_MASK_SHIFT, '%', 'c', '%', '5', // next + MOD_MASK_SHIFT, '%', 'd', '%', '7', // options + MOD_MASK_SHIFT, '%', 'e', '%', '8', // previous + MOD_MASK_SHIFT, '%', 'f', '%', '9', // print + MOD_MASK_SHIFT, '%', 'g', '%', '0', // redo + MOD_MASK_SHIFT, '%', 'h', '&', '3', // replace + MOD_MASK_SHIFT, '%', 'i', 'k', 'r', // right arr. + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_RIGHT, 'k', 'r', // right arr. + MOD_MASK_SHIFT, '%', 'j', '&', '5', // resume + MOD_MASK_SHIFT, '!', '1', '&', '6', // save + MOD_MASK_SHIFT, '!', '2', '&', '7', // suspend + MOD_MASK_SHIFT, '!', '3', '&', '8', // undo + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_UP, 'k', 'u', // up arrow + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_DOWN, 'k', 'd', // down arrow + + // vt100 F1 MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF1, KS_EXTRA, (int)KE_XF1, MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF2, KS_EXTRA, (int)KE_XF2, MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF3, KS_EXTRA, (int)KE_XF3, MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF4, KS_EXTRA, (int)KE_XF4, - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F1, 'k', '1', /* F1 */ + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F1, 'k', '1', // F1 MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F2, 'k', '2', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F3, 'k', '3', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F4, 'k', '4', @@ -2278,7 +2277,7 @@ static char_u modifier_keys_table[] = MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F7, 'k', '7', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F8, 'k', '8', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F9, 'k', '9', - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F10, 'k', ';', /* F10 */ + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F10, 'k', ';', // F10 MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F11, 'F', '1', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F12, 'F', '2', @@ -2310,7 +2309,7 @@ static char_u modifier_keys_table[] = MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F36, 'F', 'Q', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F37, 'F', 'R', - /* TAB pseudo code*/ + // TAB pseudo code MOD_MASK_SHIFT, 'k', 'B', KS_EXTRA, (int)KE_TAB, NUL @@ -2318,29 +2317,29 @@ static char_u modifier_keys_table[] = static struct key_name_entry { - int key; /* Special key code or ascii value */ - char_u *name; /* Name of key */ + int key; // Special key code or ascii value + char_u *name; // Name of key } key_names_table[] = { {' ', (char_u *)"Space"}, {TAB, (char_u *)"Tab"}, {K_TAB, (char_u *)"Tab"}, {NL, (char_u *)"NL"}, - {NL, (char_u *)"NewLine"}, /* Alternative name */ - {NL, (char_u *)"LineFeed"}, /* Alternative name */ - {NL, (char_u *)"LF"}, /* Alternative name */ + {NL, (char_u *)"NewLine"}, // Alternative name + {NL, (char_u *)"LineFeed"}, // Alternative name + {NL, (char_u *)"LF"}, // Alternative name {CAR, (char_u *)"CR"}, - {CAR, (char_u *)"Return"}, /* Alternative name */ - {CAR, (char_u *)"Enter"}, /* Alternative name */ + {CAR, (char_u *)"Return"}, // Alternative name + {CAR, (char_u *)"Enter"}, // Alternative name {K_BS, (char_u *)"BS"}, - {K_BS, (char_u *)"BackSpace"}, /* Alternative name */ + {K_BS, (char_u *)"BackSpace"}, // Alternative name {ESC, (char_u *)"Esc"}, {CSI, (char_u *)"CSI"}, {K_CSI, (char_u *)"xCSI"}, {'|', (char_u *)"Bar"}, {'\\', (char_u *)"Bslash"}, {K_DEL, (char_u *)"Del"}, - {K_DEL, (char_u *)"Delete"}, /* Alternative name */ + {K_DEL, (char_u *)"Delete"}, // Alternative name {K_KDEL, (char_u *)"kDel"}, {K_UP, (char_u *)"Up"}, {K_DOWN, (char_u *)"Down"}, @@ -2402,7 +2401,7 @@ static struct key_name_entry {K_HELP, (char_u *)"Help"}, {K_UNDO, (char_u *)"Undo"}, {K_INS, (char_u *)"Insert"}, - {K_INS, (char_u *)"Ins"}, /* Alternative name */ + {K_INS, (char_u *)"Ins"}, // Alternative name {K_KINS, (char_u *)"kInsert"}, {K_HOME, (char_u *)"Home"}, {K_KHOME, (char_u *)"kHome"}, @@ -2471,8 +2470,8 @@ static struct key_name_entry {K_MOUSEUP, (char_u *)"ScrollWheelDown"}, {K_MOUSELEFT, (char_u *)"ScrollWheelRight"}, {K_MOUSERIGHT, (char_u *)"ScrollWheelLeft"}, - {K_MOUSEDOWN, (char_u *)"MouseDown"}, /* OBSOLETE: Use */ - {K_MOUSEUP, (char_u *)"MouseUp"}, /* ScrollWheelXXX instead */ + {K_MOUSEDOWN, (char_u *)"MouseDown"}, // OBSOLETE: Use + {K_MOUSEUP, (char_u *)"MouseUp"}, // ScrollWheelXXX instead {K_X1MOUSE, (char_u *)"X1Mouse"}, {K_X1DRAG, (char_u *)"X1Drag"}, {K_X1RELEASE, (char_u *)"X1Release"}, @@ -2488,7 +2487,7 @@ static struct key_name_entry {K_CURSORHOLD, (char_u *)"CursorHold"}, {K_IGNORE, (char_u *)"Ignore"}, {0, NULL} - /* NOTE: When adding a long name update MAX_KEY_NAME_LEN. */ + // NOTE: When adding a long name update MAX_KEY_NAME_LEN. }; #define KEY_NAMES_TABLE_LEN (sizeof(key_names_table) / sizeof(struct key_name_entry)) @@ -2522,7 +2521,7 @@ simplify_key(int key, int *modifiers) if (*modifiers & (MOD_MASK_SHIFT | MOD_MASK_CTRL | MOD_MASK_ALT)) { - /* TAB is a special case */ + // TAB is a special case if (key == TAB && (*modifiers & MOD_MASK_SHIFT)) { *modifiers &= ~MOD_MASK_SHIFT; @@ -2587,7 +2586,7 @@ get_special_key_name(int c, int modifiers) string[0] = '<'; idx = 1; - /* Key that stands for a normal character. */ + // Key that stands for a normal character. if (IS_SPECIAL(c) && KEY2TERMCAP0(c) == KS_KEY) c = KEY2TERMCAP1(c); @@ -2608,7 +2607,7 @@ get_special_key_name(int c, int modifiers) } } - /* try to find the key in the special key table */ + // try to find the key in the special key table table_idx = find_special_key_in_table(c); /* @@ -2623,7 +2622,7 @@ get_special_key_name(int c, int modifiers) { c &= 0x7f; modifiers |= MOD_MASK_ALT; - /* try again, to find the un-alted key in the special key table */ + // try again, to find the un-alted key in the special key table table_idx = find_special_key_in_table(c); } if (table_idx < 0 && !vim_isprintc(c) && c < ' ') @@ -2637,7 +2636,7 @@ get_special_key_name(int c, int modifiers) } } - /* translate the modifier into a string */ + // translate the modifier into a string for (i = 0; mod_mask_table[i].name != 'A'; i++) if ((modifiers & mod_mask_table[i].mod_mask) == mod_mask_table[i].mod_flag) @@ -2646,7 +2645,7 @@ get_special_key_name(int c, int modifiers) string[idx++] = (char_u)'-'; } - if (table_idx < 0) /* unknown special key, may output t_xx */ + if (table_idx < 0) // unknown special key, may output t_xx { if (IS_SPECIAL(c)) { @@ -2655,7 +2654,7 @@ get_special_key_name(int c, int modifiers) string[idx++] = KEY2TERMCAP0(c); string[idx++] = KEY2TERMCAP1(c); } - /* Not a special key, only modifiers, output directly */ + // Not a special key, only modifiers, output directly else { if (has_mbyte && (*mb_char2len)(c) > 1) @@ -2670,7 +2669,7 @@ get_special_key_name(int c, int modifiers) } } } - else /* use name of special key */ + else // use name of special key { size_t len = STRLEN(key_names_table[table_idx].name); @@ -2723,7 +2722,7 @@ special_to_buf(int key, int modifiers, int keycode, char_u *dst) { int dlen = 0; - /* Put the appropriate modifier in a string */ + // Put the appropriate modifier in a string if (modifiers != 0) { dst[dlen++] = K_SPECIAL; @@ -2776,7 +2775,7 @@ find_special_key( if (src[0] != '<') return 0; - /* Find end of modifier list */ + // Find end of modifier list last_dash = src; for (bp = src + 1; *bp == '-' || vim_isIDc(*bp); bp++) { @@ -2800,7 +2799,7 @@ find_special_key( } } if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3]) - bp += 3; /* skip t_xx, xx may be '-' or '>' */ + bp += 3; // skip t_xx, xx may be '-' or '>' else if (STRNICMP(bp, "char-", 5) == 0) { vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE); @@ -2814,11 +2813,11 @@ find_special_key( } } - if (*bp == '>') /* found matching '>' */ + if (*bp == '>') // found matching '>' { end_of_name = bp + 1; - /* Which modifiers are given? */ + // Which modifiers are given? modifiers = 0x0; for (bp = src + 1; bp < last_dash; bp++) { @@ -2826,7 +2825,7 @@ find_special_key( { bit = name_to_mod_mask(*bp); if (bit == 0x0) - break; /* Illegal modifier name */ + break; // Illegal modifier name modifiers |= bit; } } @@ -2839,7 +2838,7 @@ find_special_key( if (STRNICMP(last_dash + 1, "char-", 5) == 0 && VIM_ISDIGIT(last_dash[6])) { - /* <Char-123> or <Char-033> or <Char-0x33> */ + // <Char-123> or <Char-033> or <Char-0x33> vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, TRUE); if (l == 0) @@ -2853,7 +2852,7 @@ find_special_key( { int off = 1; - /* Modifier with single letter, or special key name. */ + // Modifier with single letter, or special key name. if (in_string && last_dash[1] == '\\' && last_dash[2] == '"') off = 2; if (has_mbyte) @@ -2884,7 +2883,7 @@ find_special_key( if (!keycode) { - /* don't want keycode, use single byte code */ + // don't want keycode, use single byte code if (key == K_BS) key = BS; else if (key == K_DEL || key == K_KDEL) @@ -2948,7 +2947,7 @@ extract_modifiers(int key, int *modp, int simplify, int *did_simplify) { key = Ctrl_chr(key); modifiers &= ~MOD_MASK_CTRL; - /* <C-@> is <Nul> */ + // <C-@> is <Nul> if (key == 0) key = K_ZERO; if (did_simplify != NULL) @@ -2956,14 +2955,14 @@ extract_modifiers(int key, int *modp, int simplify, int *did_simplify) } #ifdef MACOS_X - /* Command-key really special, no fancynest */ + // Command-key really special, no fancynest if (!(modifiers & MOD_MASK_CMD)) #endif if (simplify && (modifiers & MOD_MASK_ALT) && key < 0x80 && !enc_dbcs) // avoid creating a lead byte { key |= 0x80; - modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */ + modifiers &= ~MOD_MASK_ALT; // remove the META modifier if (did_simplify != NULL) *did_simplify = TRUE; } @@ -3057,7 +3056,7 @@ get_fileformat(buf_T *buf) int get_fileformat_force( buf_T *buf, - exarg_T *eap) /* can be NULL! */ + exarg_T *eap) // can be NULL! { int c; @@ -3085,7 +3084,7 @@ get_fileformat_force( void set_fileformat( int t, - int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ + int opt_flags) // OPT_LOCAL and/or OPT_GLOBAL { char *p = NULL; @@ -3108,11 +3107,11 @@ set_fileformat( set_string_option_direct((char_u *)"ff", -1, (char_u *)p, OPT_FREE | opt_flags, 0); - /* This may cause the buffer to become (un)modified. */ + // This may cause the buffer to become (un)modified. check_status(curbuf); redraw_tabline = TRUE; #ifdef FEAT_TITLE - need_maketitle = TRUE; /* set window title later */ + need_maketitle = TRUE; // set window title later #endif } @@ -3165,13 +3164,13 @@ call_shell(char_u *cmd, int opt) else { #ifdef FEAT_GUI_MSWIN - /* Don't hide the pointer while executing a shell command. */ + // Don't hide the pointer while executing a shell command. gui_mch_mousehide(FALSE); #endif #ifdef FEAT_GUI ++hold_gui_events; #endif - /* The external command may update a tags file, clear cached tags. */ + // The external command may update a tags file, clear cached tags. tag_freematch(); if (cmd == NULL || *p_sxq == NUL) @@ -3269,7 +3268,7 @@ same_directory(char_u *f1, char_u *f2) char_u *t1; char_u *t2; - /* safety check */ + // safety check if (f1 == NULL || f2 == NULL) return FALSE; @@ -3327,11 +3326,11 @@ vim_chdirfile(char_u *fname, char *trigger_autocmd) illegal_slash(const char *name) { if (name[0] == NUL) - return FALSE; /* no file name is not illegal */ + return FALSE; // no file name is not illegal if (name[strlen(name) - 1] != '/') - return FALSE; /* no trailing slash */ + return FALSE; // no trailing slash if (mch_isdir((char_u *)name)) - return FALSE; /* trailing slash for a directory */ + return FALSE; // trailing slash for a directory return TRUE; } @@ -3341,8 +3340,8 @@ illegal_slash(const char *name) int vim_stat(const char *name, stat_T *stp) { - /* On Solaris stat() accepts "file/" as if it was "file". Return -1 if - * the name ends in "/" and it's not a directory. */ + // On Solaris stat() accepts "file/" as if it was "file". Return -1 if + // the name ends in "/" and it's not a directory. return illegal_slash(name) ? -1 : stat(name, stp); } #endif @@ -3355,9 +3354,9 @@ vim_stat(const char *name, stat_T *stp) cursorentry_T shape_table[SHAPE_IDX_COUNT] = { - /* The values will be filled in from the 'guicursor' and 'mouseshape' - * defaults when Vim starts. - * Adjust the SHAPE_IDX_ defines when making changes! */ + // The values will be filled in from the 'guicursor' and 'mouseshape' + // defaults when Vim starts. + // Adjust the SHAPE_IDX_ defines when making changes! {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE}, {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE}, {0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE}, @@ -3384,8 +3383,8 @@ cursorentry_T shape_table[SHAPE_IDX_COUNT] = */ static char * mshape_names[] = { - "arrow", /* default, must be the first one */ - "blank", /* hidden */ + "arrow", // default, must be the first one + "blank", // hidden "beam", "updown", "udsizing", @@ -3417,12 +3416,12 @@ parse_shape_opt(int what) char_u *commap; char_u *slashp; char_u *p, *endp; - int idx = 0; /* init for GCC */ + int idx = 0; // init for GCC int all_idx; int len; int i; long n; - int found_ve = FALSE; /* found "ve" flag */ + int found_ve = FALSE; // found "ve" flag int round; /* @@ -3458,7 +3457,7 @@ parse_shape_opt(int what) { if (all_idx < 0) { - /* Find the mode. */ + // Find the mode. if (modep[1] == '-' || modep[1] == ':') len = 1; else @@ -3487,13 +3486,13 @@ parse_shape_opt(int what) #ifdef FEAT_MOUSESHAPE if (what == SHAPE_MOUSE) { - /* Set the default, for the missing parts */ + // Set the default, for the missing parts shape_table[idx].mshape = 0; } else #endif { - /* Set the defaults, for the missing parts */ + // Set the defaults, for the missing parts shape_table[idx].shape = SHAPE_BLOCK; shape_table[idx].blinkwait = 700L; shape_table[idx].blinkon = 400L; @@ -3501,7 +3500,7 @@ parse_shape_opt(int what) } } - /* Parse the part after the colon */ + // Parse the part after the colon for (p = colonp + 1; *p && *p != ','; ) { #ifdef FEAT_MOUSESHAPE @@ -3530,7 +3529,7 @@ parse_shape_opt(int what) } } } - else /* if (what == SHAPE_MOUSE) */ + else // if (what == SHAPE_MOUSE) #endif { /* @@ -3554,7 +3553,7 @@ parse_shape_opt(int what) if (!VIM_ISDIGIT(*p)) return N_("E548: digit expected"); n = getdigits(&p); - if (len == 3) /* "ver" or "hor" */ + if (len == 3) // "ver" or "hor" { if (n == 0) return N_("E549: Illegal percentage"); @@ -3583,20 +3582,20 @@ parse_shape_opt(int what) shape_table[idx].shape = SHAPE_BLOCK; p += 5; } - else /* must be a highlight group name then */ + else // must be a highlight group name then { endp = vim_strchr(p, '-'); - if (commap == NULL) /* last part */ + if (commap == NULL) // last part { if (endp == NULL) - endp = p + STRLEN(p); /* find end of part */ + endp = p + STRLEN(p); // find end of part } else if (endp > commap || endp == NULL) endp = commap; slashp = vim_strchr(p, '/'); if (slashp != NULL && slashp < endp) { - /* "group/langmap_group" */ + // "group/langmap_group" i = syn_check_group(p, (int)(slashp - p)); p = slashp + 1; } @@ -3610,7 +3609,7 @@ parse_shape_opt(int what) } p = endp; } - } /* if (what != SHAPE_MOUSE) */ + } // if (what != SHAPE_MOUSE) if (*p == '-') ++p; @@ -3622,7 +3621,7 @@ parse_shape_opt(int what) } } - /* If the 's' flag is not given, use the 'v' cursor for 's' */ + // If the 's' flag is not given, use the 'v' cursor for 's' if (!found_ve) { #ifdef FEAT_MOUSESHAPE @@ -3719,19 +3718,19 @@ update_mouseshape(int shape_idx) { int new_mouse_shape; - /* Only works in GUI mode. */ + // Only works in GUI mode. if (!gui.in_use || gui.starting) return; - /* Postpone the updating when more is to come. Speeds up executing of - * mappings. */ + // Postpone the updating when more is to come. Speeds up executing of + // mappings. if (shape_idx == -1 && char_avail()) { postponed_mouseshape = TRUE; return; } - /* When ignoring the mouse don't change shape on the statusline. */ + // When ignoring the mouse don't change shape on the statusline. if (*p_mouse == NUL && (shape_idx == SHAPE_IDX_CLINE || shape_idx == SHAPE_IDX_STATUS @@ -3756,7 +3755,7 @@ update_mouseshape(int shape_idx) } # endif -#endif /* CURSOR_SHAPE */ +#endif // CURSOR_SHAPE /* @@ -3829,12 +3828,12 @@ qsort( for (i = gap; i < elm_count; ++i) for (j = i - gap; j >= 0; j -= gap) { - /* Compare the elements. */ + // Compare the elements. p1 = (char_u *)base + j * elm_size; p2 = (char_u *)base + (j + gap) * elm_size; if ((*cmp)((void *)p1, (void *)p2) <= 0) break; - /* Exchange the elements. */ + // Exchange the elements. mch_memmove(buf, p1, elm_size); mch_memmove(p1, p2, elm_size); mch_memmove(p2, buf, elm_size); @@ -3891,14 +3890,14 @@ sort_strings( #if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) -#define EXTRASIZE 5 /* increment to add to env. size */ +#define EXTRASIZE 5 // increment to add to env. size -static int envsize = -1; /* current size of environment */ -extern char **environ; /* the global which is your env. */ +static int envsize = -1; // current size of environment +extern char **environ; // the global which is your env. -static int findenv(char *name); /* look for a name in the env. */ -static int newenv(void); /* copy env. from stack to heap */ -static int moreenv(void); /* incr. size of env. */ +static int findenv(char *name); // look for a name in the env. +static int newenv(void); // copy env. from stack to heap +static int moreenv(void); // incr. size of env. int putenv(const char *string) @@ -3907,33 +3906,33 @@ putenv(const char *string) char *p; if (envsize < 0) - { /* first time putenv called */ - if (newenv() < 0) /* copy env. to heap */ + { // first time putenv called + if (newenv() < 0) // copy env. to heap return -1; } - i = findenv((char *)string); /* look for name in environment */ + i = findenv((char *)string); // look for name in environment if (i < 0) - { /* name must be added */ + { // name must be added for (i = 0; environ[i]; i++); if (i >= (envsize - 1)) - { /* need new slot */ + { // need new slot if (moreenv() < 0) return -1; } p = alloc(strlen(string) + 1); - if (p == NULL) /* not enough core */ + if (p == NULL) // not enough core return -1; - environ[i + 1] = 0; /* new end of env. */ + environ[i + 1] = 0; // new end of env. } else - { /* name already in env. */ + { // name already in env. p = vim_realloc(environ[i], strlen(string) + 1); if (p == NULL) return -1; } - sprintf(p, "%s", string); /* copy into env. */ + sprintf(p, "%s", string); // copy into env. environ[i] = p; return 0; @@ -4027,7 +4026,7 @@ vimpty_getenv(const char_u *string) } # endif -#endif /* !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) */ +#endif // !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) #if defined(FEAT_EVAL) || defined(FEAT_SPELL) || defined(PROTO) /* @@ -4108,8 +4107,8 @@ get3c(FILE *fd) get4c(FILE *fd) { int c; - /* Use unsigned rather than int otherwise result is undefined - * when left-shift sets the MSB. */ + // Use unsigned rather than int otherwise result is undefined + // when left-shift sets the MSB. unsigned n; c = getc(fd); @@ -4158,11 +4157,11 @@ read_string(FILE *fd, int cnt) int i; int c; - /* allocate memory */ + // allocate memory str = alloc(cnt + 1); if (str != NULL) { - /* Read the string. Quit when running into the EOF. */ + // Read the string. Quit when running into the EOF. for (i = 0; i < cnt; ++i) { c = getc(fd); @@ -4194,8 +4193,8 @@ put_bytes(FILE *fd, long_u nr, int len) #ifdef _MSC_VER # if (_MSC_VER <= 1200) -/* This line is required for VC6 without the service pack. Also see the - * matching #pragma below. */ +// This line is required for VC6 without the service pack. Also see the +// matching #pragma below. # pragma optimize("", off) # endif #endif @@ -4224,17 +4223,17 @@ time_to_bytes(time_T the_time, char_u *buf) int bi = 0; time_T wtime = the_time; - /* time_T can be up to 8 bytes in size, more than long_u, thus we - * can't use put_bytes() here. - * Another problem is that ">>" may do an arithmetic shift that keeps the - * sign. This happens for large values of wtime. A cast to long_u may - * truncate if time_T is 8 bytes. So only use a cast when it is 4 bytes, - * it's safe to assume that long_u is 4 bytes or more and when using 8 - * bytes the top bit won't be set. */ + // time_T can be up to 8 bytes in size, more than long_u, thus we + // can't use put_bytes() here. + // Another problem is that ">>" may do an arithmetic shift that keeps the + // sign. This happens for large values of wtime. A cast to long_u may + // truncate if time_T is 8 bytes. So only use a cast when it is 4 bytes, + // it's safe to assume that long_u is 4 bytes or more and when using 8 + // bytes the top bit won't be set. for (i = 7; i >= 0; --i) { if (i + 1 > (int)sizeof(time_T)) - /* ">>" doesn't work well when shifting more bits than avail */ + // ">>" doesn't work well when shifting more bits than avail buf[bi++] = 0; else { @@ -4274,7 +4273,7 @@ has_non_ascii(char_u *s) } #endif -#ifndef PROTO /* proto is defined in vim.h */ +#ifndef PROTO // proto is defined in vim.h # ifdef ELAPSED_TIMEVAL /* * Return time in msec since "start_tv". @@ -4368,7 +4367,7 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) { if (use_shcf) { - /* Account for possible multiple args in p_shcf. */ + // Account for possible multiple args in p_shcf. p = p_shcf; for (;;) { @@ -4381,7 +4380,7 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc) } *argv = ALLOC_MULT(char *, *argc + 4); - if (*argv == NULL) /* out of memory */ + if (*argv == NULL) // out of memory return FAIL; } } @@ -4400,7 +4399,7 @@ build_argv_from_string(char_u *cmd, char ***argv, int *argc) char_u *cmd_copy; int i; - /* Make a copy, parsing will modify "cmd". */ + // Make a copy, parsing will modify "cmd". cmd_copy = vim_strsave(cmd); if (cmd_copy == NULL || mch_parse_cmd(cmd_copy, FALSE, argv, argc) == FAIL) @@ -4426,7 +4425,7 @@ build_argv_from_list(list_T *l, char ***argv, int *argc) listitem_T *li; char_u *s; - /* Pass argv[] to mch_call_shell(). */ + // Pass argv[] to mch_call_shell(). *argv = ALLOC_MULT(char *, l->lv_len + 1); if (*argv == NULL) return FAIL; |