diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-05 21:10:38 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-05 21:10:38 +0100 |
commit | 63d9e730f726341bf41ee4f4b829253cb9879110 (patch) | |
tree | 02d6ed210385b78f06d7df1e30ede7d48f718600 /src | |
parent | 0f8737355d291679659579a48db1861b88970293 (diff) |
patch 8.1.2394: using old C style commentsv8.1.2394
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
Diffstat (limited to 'src')
-rw-r--r-- | src/popupmenu.c | 182 | ||||
-rw-r--r-- | src/pty.c | 66 | ||||
-rw-r--r-- | src/quickfix.c | 2 | ||||
-rw-r--r-- | src/regexp.c | 504 | ||||
-rw-r--r-- | src/regexp_nfa.c | 1443 | ||||
-rw-r--r-- | src/screen.c | 575 | ||||
-rw-r--r-- | src/search.c | 972 | ||||
-rw-r--r-- | src/sha256.c | 14 | ||||
-rw-r--r-- | src/sign.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
10 files changed, 1880 insertions, 1886 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c index 76255aa97f..14539adf23 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -12,22 +12,22 @@ */ #include "vim.h" -static pumitem_T *pum_array = NULL; /* items of displayed pum */ -static int pum_size; /* nr of items in "pum_array" */ -static int pum_selected; /* index of selected item or -1 */ -static int pum_first = 0; /* index of top item */ +static pumitem_T *pum_array = NULL; // items of displayed pum +static int pum_size; // nr of items in "pum_array" +static int pum_selected; // index of selected item or -1 +static int pum_first = 0; // index of top item static int call_update_screen = FALSE; -static int pum_height; /* nr of displayed pum items */ -static int pum_width; /* width of displayed pum items */ -static int pum_base_width; /* width of pum items base */ -static int pum_kind_width; /* width of pum items kind column */ -static int pum_extra_width; /* width of extra stuff */ -static int pum_scrollbar; /* TRUE when scrollbar present */ +static int pum_height; // nr of displayed pum items +static int pum_width; // width of displayed pum items +static int pum_base_width; // width of pum items base +static int pum_kind_width; // width of pum items kind column +static int pum_extra_width; // width of extra stuff +static int pum_scrollbar; // TRUE when scrollbar present -static int pum_row; /* top row of pum */ -static int pum_col; /* left column of pum */ +static int pum_row; // top row of pum +static int pum_col; // left column of pum static win_T *pum_window = NULL; static int pum_win_row; @@ -49,7 +49,7 @@ pum_compute_size(void) int i; int w; - /* Compute the width of the widest match and the widest extra. */ + // Compute the width of the widest match and the widest extra. pum_base_width = 0; pum_kind_width = 0; pum_extra_width = 0; @@ -83,8 +83,8 @@ pum_compute_size(void) pum_display( pumitem_T *array, int size, - int selected) /* index of initially selected item, none if - out of range */ + int selected) // index of initially selected item, none if + // out of range { int def_width; int max_width; @@ -103,8 +103,8 @@ pum_display( above_row = 0; below_row = cmdline_row; - /* Pretend the pum is already there to avoid that must_redraw is set - * when 'cuc' is on. */ + // Pretend the pum is already there to avoid that must_redraw is set + // when 'cuc' is on. pum_array = (pumitem_T *)1; validate_cursor_col(); pum_array = NULL; @@ -141,14 +141,14 @@ pum_display( if (p_ph > 0 && pum_height > p_ph) pum_height = p_ph; - /* Put the pum below "pum_win_row" if possible. If there are few lines - * decide on where there is more room. */ + // Put the pum below "pum_win_row" if possible. If there are few lines + // decide on where there is more room. if (pum_win_row + 2 >= below_row - pum_height && pum_win_row - above_row > (below_row - above_row) / 2) { - /* pum above "pum_win_row" */ + // pum above "pum_win_row" - /* Leave two lines of context if possible */ + // Leave two lines of context if possible if (curwin->w_wrow - curwin->w_cline_row >= 2) context_lines = 2; else @@ -172,9 +172,9 @@ pum_display( } else { - /* pum below "pum_win_row" */ + // pum below "pum_win_row" - /* Leave two lines of context if possible */ + // Leave two lines of context if possible if (curwin->w_cline_row + curwin->w_cline_height - curwin->w_wrow >= 3) context_lines = 3; @@ -191,7 +191,7 @@ pum_display( pum_height = p_ph; } - /* don't display when we only have room for one line */ + // don't display when we only have room for one line if (pum_height < 1 || (pum_height == 1 && size > 1)) return; @@ -209,7 +209,7 @@ pum_display( pum_compute_size(); max_width = pum_base_width; - /* Calculate column */ + // Calculate column #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) cursor_col = curwin->w_wincol + curwin->w_width @@ -218,7 +218,7 @@ pum_display( #endif cursor_col = curwin->w_wincol + curwin->w_wcol; - /* if there are more items than room we need a scrollbar */ + // if there are more items than room we need a scrollbar if (pum_height < size) { pum_scrollbar = 1; @@ -239,10 +239,10 @@ pum_display( #endif )) { - /* align pum with "cursor_col" */ + // align pum with "cursor_col" pum_col = cursor_col; - /* start with the maximum space available */ + // start with the maximum space available #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) pum_width = pum_col - pum_scrollbar + 1; @@ -253,8 +253,8 @@ pum_display( if (pum_width > max_width + pum_kind_width + pum_extra_width + 1 && pum_width > p_pw) { - /* the width is more than needed for the items, make it - * narrower */ + // the width is more than needed for the items, make it + // narrower pum_width = max_width + pum_kind_width + pum_extra_width + 1; if (pum_width < p_pw) pum_width = p_pw; @@ -267,7 +267,7 @@ pum_display( #endif )) { - /* align pum edge with "cursor_col" */ + // align pum edge with "cursor_col" #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) @@ -282,7 +282,7 @@ pum_display( if (curwin->w_wincol > Columns - max_width - pum_scrollbar && max_width <= p_pw) { - /* use full width to end of the screen */ + // use full width to end of the screen pum_col = Columns - max_width - pum_scrollbar; if (pum_col < 0) pum_col = 0; @@ -326,7 +326,7 @@ pum_display( } else if (Columns < def_width) { - /* not enough room, will use what we have */ + // not enough room, will use what we have #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) pum_col = Columns - 1; @@ -338,7 +338,7 @@ pum_display( else { if (max_width > p_pw) - max_width = p_pw; /* truncate */ + max_width = p_pw; // truncate #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) pum_col = max_width - 1; @@ -348,9 +348,9 @@ pum_display( pum_width = max_width - pum_scrollbar; } - /* Set selected item and redraw. If the window size changed need to - * redo the positioning. Limit this to two times, when there is not - * much room the window size will keep changing. */ + // Set selected item and redraw. If the window size changed need to + // redo the positioning. Limit this to two times, when there is not + // much room the window size will keep changing. } while (pum_set_selected(selected, redo_count) && ++redo_count <= 2); } @@ -440,7 +440,7 @@ pum_redraw(void) idx = i + pum_first; attr = (idx == pum_selected) ? attr_select : attr_norm; - /* prepend a space if there is room */ + // prepend a space if there is room #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { @@ -452,8 +452,8 @@ pum_redraw(void) if (pum_col > 0) screen_putchar(' ', row, pum_col - 1, attr); - /* Display each entry, use two spaces for a Tab. - * Do this 3 times: For the main text, kind and extra info */ + // Display each entry, use two spaces for a Tab. + // Do this 3 times: For the main text, kind and extra info col = pum_col; totwidth = 0; for (round = 1; round <= 3; ++round) @@ -474,8 +474,8 @@ pum_redraw(void) w = ptr2cells(p); if (*p == NUL || *p == TAB || totwidth + w > pum_width) { - /* Display the text that fits or comes before a Tab. - * First convert it to printable characters. */ + // Display the text that fits or comes before a Tab. + // First convert it to printable characters. char_u *st; int saved = *p; @@ -508,11 +508,11 @@ pum_redraw(void) if (size < pum_width) { - /* Most left character requires - * 2-cells but only 1 cell is - * available on screen. Put a - * '<' on the left of the pum - * item */ + // Most left character requires + // 2-cells but only 1 cell is + // available on screen. Put a + // '<' on the left of the pum + // item *(--rt) = '<'; size++; } @@ -540,7 +540,7 @@ pum_redraw(void) if (*p != TAB) break; - /* Display two spaces for a Tab. */ + // Display two spaces for a Tab. #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { @@ -555,7 +555,7 @@ pum_redraw(void) col += 2; } totwidth += 2; - s = NULL; /* start text at next char */ + s = NULL; // start text at next char width = 0; } else @@ -567,7 +567,7 @@ pum_redraw(void) else n = 1; - /* Stop when there is nothing more to display. */ + // Stop when there is nothing more to display. if (round == 3 || (round == 2 && pum_array[idx].pum_extra == NULL) || (round == 1 && pum_array[idx].pum_kind == NULL @@ -693,8 +693,8 @@ pum_set_selected(int n, int repeat UNUSED) { if (pum_first > pum_selected - 4) { - /* scroll down; when we did a jump it's probably a PageUp then - * scroll a whole page */ + // scroll down; when we did a jump it's probably a PageUp then + // scroll a whole page if (pum_first > pum_selected - 2) { pum_first -= pum_height - 2; @@ -708,8 +708,8 @@ pum_set_selected(int n, int repeat UNUSED) } else if (pum_first < pum_selected - pum_height + 5) { - /* scroll up; when we did a jump it's probably a PageDown then - * scroll a whole page */ + // scroll up; when we did a jump it's probably a PageDown then + // scroll a whole page if (pum_first < pum_selected - pum_height + 1 + 2) { pum_first += pum_height - 2; @@ -720,21 +720,21 @@ pum_set_selected(int n, int repeat UNUSED) pum_first = pum_selected - pum_height + 1; } - /* Give a few lines of context when possible. */ + // Give a few lines of context when possible. if (context > 3) context = 3; if (pum_height > 2) { if (pum_first > pum_selected - context) { - /* scroll down */ + // scroll down pum_first = pum_selected - context; if (pum_first < 0) pum_first = 0; } else if (pum_first < pum_selected + context - pum_height + 1) { - /* scroll up */ + // scroll up pum_first = pum_selected + context - pum_height + 1; } } @@ -845,8 +845,8 @@ pum_set_selected(int n, int repeat UNUSED) // delete the empty last line ml_delete(curbuf->b_ml.ml_line_count, FALSE); - /* Increase the height of the preview window to show the - * text, but no more than 'previewheight' lines. */ + // Increase the height of the preview window to show the + // text, but no more than 'previewheight' lines. if (repeat == 0 && use_popup == USEPOPUP_NONE) { if (lnum > p_pvh) @@ -886,20 +886,20 @@ pum_set_selected(int n, int repeat UNUSED) if (curtab != curtab_save && valid_tabpage(curtab_save)) goto_tabpage_tp(curtab_save, FALSE, FALSE); - /* When the first completion is done and the preview - * window is not resized, skip the preview window's - * status line redrawing. */ + // When the first completion is done and the preview + // window is not resized, skip the preview window's + // status line redrawing. if (ins_compl_active() && !resized) curwin->w_redr_status = FALSE; - /* Return cursor to where we were */ + // Return cursor to where we were validate_cursor(); redraw_later(SOME_VALID); - /* When the preview window was resized we need to - * update the view on the buffer. Only go back to - * the window when needed, otherwise it will always be - * redraw. */ + // When the preview window was resized we need to + // update the view on the buffer. Only go back to + // the window when needed, otherwise it will always be + // redraw. if (resized && win_valid(curwin_save)) { ++no_u_sync; @@ -908,8 +908,8 @@ pum_set_selected(int n, int repeat UNUSED) update_topline(); } - /* Update the screen before drawing the popup menu. - * Enable updating the status lines. */ + // Update the screen before drawing the popup menu. + // Enable updating the status lines. pum_do_redraw = TRUE; update_screen(0); pum_do_redraw = FALSE; @@ -928,8 +928,8 @@ pum_set_selected(int n, int repeat UNUSED) # endif } - /* May need to update the screen again when there are - * autocommands involved. */ + // May need to update the screen again when there are + // autocommands involved. pum_do_redraw = TRUE; update_screen(0); pum_do_redraw = FALSE; @@ -1064,14 +1064,14 @@ pum_position_at_mouse(int min_width) { if (Rows - mouse_row > pum_size) { - /* Enough space below the mouse row. */ + // Enough space below the mouse row. pum_row = mouse_row + 1; if (pum_height > Rows - pum_row) pum_height = Rows - pum_row; } else { - /* Show above the mouse row, reduce height if it does not fit. */ + // Show above the mouse row, reduce height if it does not fit. pum_row = mouse_row - pum_size; if (pum_row < 0) { @@ -1081,10 +1081,10 @@ pum_position_at_mouse(int min_width) } if (Columns - mouse_col >= pum_base_width || Columns - mouse_col > min_width) - /* Enough space to show at mouse column. */ + // Enough space to show at mouse column. pum_col = mouse_col; else - /* Not enough space, right align with window. */ + // Not enough space, right align with window. pum_col = Columns - (pum_base_width > min_width ? min_width : pum_base_width); @@ -1158,7 +1158,7 @@ split_message(char_u *mesg, pumitem_T **array) { if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}') { - /* Looks like a good point to break. */ + // Looks like a good point to break. if (*p == '{') ++indent; else if (*p == '}' && indent > 0) @@ -1181,22 +1181,22 @@ split_message(char_u *mesg, pumitem_T **array) height = 2 + ga.ga_len; - /* If there are long items and the height is below the limit: split lines */ + // If there are long items and the height is below the limit: split lines if (long_item_count > 0 && height + long_item_count <= max_height) { split_long_items = TRUE; height += long_item_count; } - /* Limit to half the window height, it has to fit above or below the mouse - * position. */ + // Limit to half the window height, it has to fit above or below the mouse + // position. if (height > max_height) height = max_height; *array = ALLOC_CLEAR_MULT(pumitem_T, height); if (*array == NULL) goto failed; - /* Add an empty line above and below, looks better. */ + // Add an empty line above and below, looks better. (*array)->pum_text = vim_strsave((char_u *)""); (*array + height - 1)->pum_text = vim_strsave((char_u *)""); @@ -1246,7 +1246,7 @@ split_message(char_u *mesg, pumitem_T **array) vim_strncpy(p + ind, item->start + skip, copylen); (*array)[line].pum_text = p; - item->indent = 0; /* wrapped line has no indent */ + item->indent = 0; // wrapped line has no indent ++line; } } @@ -1415,7 +1415,7 @@ pum_show_popupmenu(vimmenu_T *menu) pum_selected = -1; pum_first = 0; # ifdef FEAT_BEVAL_TERM - p_bevalterm = TRUE; /* track mouse movement */ + p_bevalterm = TRUE; // track mouse movement mch_setmouse(TRUE); # endif @@ -1435,13 +1435,13 @@ pum_show_popupmenu(vimmenu_T *menu) break; else if (c == CAR || c == NL) { - /* enter: select current item, if any, and close */ + // enter: select current item, if any, and close pum_execute_menu(menu, mode); break; } else if (c == 'k' || c == K_UP || c == K_MOUSEUP) { - /* cursor up: select previous item */ + // cursor up: select previous item while (pum_selected > 0) { --pum_selected; @@ -1451,7 +1451,7 @@ pum_show_popupmenu(vimmenu_T *menu) } else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN) { - /* cursor down: select next item */ + // cursor down: select next item while (pum_selected < pum_size - 1) { ++pum_selected; @@ -1461,19 +1461,19 @@ pum_show_popupmenu(vimmenu_T *menu) } else if (c == K_RIGHTMOUSE) { - /* Right mouse down: reposition the menu. */ + // Right mouse down: reposition the menu. vungetc(c); break; } else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE) { - /* mouse moved: select item in the mouse row */ + // mouse moved: select item in the mouse row pum_select_mouse_pos(); } else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE) { - /* left mouse click: select clicked item, if any, and close; - * right mouse release: select clicked item, close if any */ + // left mouse click: select clicked item, if any, and close; + // right mouse release: select clicked item, close if any pum_select_mouse_pos(); if (pum_selected >= 0) { @@ -1500,8 +1500,8 @@ pum_make_popup(char_u *path_name, int use_mouse_pos) if (!use_mouse_pos) { - /* Hack: set mouse position at the cursor so that the menu pops up - * around there. */ + // Hack: set mouse position at the cursor so that the menu pops up + // around there. mouse_row = curwin->w_winrow + curwin->w_wrow; mouse_col = curwin->w_wincol + curwin->w_wcol; } @@ -20,26 +20,25 @@ * copyright notice below. */ -/* Copyright (c) 1993 - * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) - * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) - * Copyright (c) 1987 Oliver Laumann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ +// Copyright (c) 1993 +// Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) +// Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) +// Copyright (c) 1987 Oliver Laumann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program (see the file COPYING); if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA #include "vim.h" @@ -124,7 +123,7 @@ # define PTYRANGE1 "0123456789abcdef" #endif -/* SVR4 pseudo ttys don't seem to work with SCO-5 */ +// SVR4 pseudo ttys don't seem to work with SCO-5 #ifdef M_UNIX # undef HAVE_SVR4_PTYS #endif @@ -240,7 +239,7 @@ mch_openpty(char **ttyn) { char *m, *s; int f; - /* used for opening a new pty-pair: */ + // used for opening a new pty-pair: static char PtyName[32]; static char TtyName[32]; @@ -289,7 +288,7 @@ mch_openpty(char **ttyn) { int f; stat_T buf; - /* used for opening a new pty-pair: */ + // used for opening a new pty-pair: static char TtyName[32]; if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_NONBLOCK | O_EXTRA, 0)) < 0) @@ -309,8 +308,8 @@ mch_openpty(char **ttyn) #if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \ && !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) -/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! - * Same for Mac OS X Leopard (10.5). */ +// NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! +// Same for Mac OS X Leopard (10.5). #define PTY_DONE int mch_openpty(char **ttyn) @@ -318,7 +317,7 @@ mch_openpty(char **ttyn) int f; char *m; RETSIGTYPE (*sigcld) SIGPROTOARG; - /* used for opening a new pty-pair: */ + // used for opening a new pty-pair: static char TtyName[32]; if ((f = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_EXTRA, 0)) == -1) @@ -354,10 +353,10 @@ static int aixhack = -1; mch_openpty(char **ttyn) { int f; - /* used for opening a new pty-pair: */ + // used for opening a new pty-pair: static char TtyName[32]; - /* a dumb looking loop replaced by mycrofts code: */ + // a dumb looking loop replaced by mycrofts code: if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0) return -1; vim_strncpy((char_u *)TtyName, (char_u *)ttyname(f), sizeof(TtyName) - 1); @@ -401,7 +400,7 @@ mch_openpty(char **ttyn) { char *p, *q, *l, *d; int f; - /* used for opening a new pty-pair: */ + // used for opening a new pty-pair: static char PtyName[32]; static char TtyName[32]; @@ -425,13 +424,12 @@ mch_openpty(char **ttyn) continue; } #if defined(SUN_SYSTEM) && defined(TIOCGPGRP) && !defined(SUNOS3) - /* Hack to ensure that the slave side of the pty is - * unused. May not work in anything other than SunOS4.1 - */ + // Hack to ensure that the slave side of the pty is + // unused. May not work in anything other than SunOS4.1 { int pgrp; - /* tcgetpgrp does not work (uses TIOCGETPGRP)! */ + // tcgetpgrp does not work (uses TIOCGETPGRP)! if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO) { close(f); @@ -474,4 +472,4 @@ mch_isatty(int fd) return isatty(fd); } -#endif /* FEAT_GUI || FEAT_JOB_CHANNEL */ +#endif // FEAT_GUI || FEAT_JOB_CHANNEL diff --git a/src/quickfix.c b/src/quickfix.c index 72cdc6ed6b..3d12374b41 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -7880,7 +7880,7 @@ ex_helpgrep(exarg_T *eap) curwin->w_llist = qi; } } -#endif /* FEAT_QUICKFIX */ +#endif // FEAT_QUICKFIX #if defined(FEAT_EVAL) || defined(PROTO) # ifdef FEAT_QUICKFIX diff --git a/src/regexp.c b/src/regexp.c index 7fe891d319..112f75369e 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -12,9 +12,9 @@ #include "vim.h" #ifdef DEBUG -/* show/save debugging data when BT engine is used */ +// show/save debugging data when BT engine is used # define BT_REGEXP_DUMP -/* save the debugging data to a file instead of displaying it */ +// save the debugging data to a file instead of displaying it # define BT_REGEXP_LOG # define BT_REGEXP_DEBUG_LOG # define BT_REGEXP_DEBUG_LOG_NAME "bt_regexp_debug.log" @@ -58,8 +58,8 @@ toggle_Magic(int x) */ #define UCHARAT(p) ((int)*(char_u *)(p)) -/* Used for an error (down from) vim_regcomp(): give the error message, set - * rc_did_emsg and return NULL */ +// Used for an error (down from) vim_regcomp(): give the error message, set +// rc_did_emsg and return NULL #define EMSG_RET_NULL(m) return (emsg((m)), rc_did_emsg = TRUE, (void *)NULL) #define IEMSG_RET_NULL(m) return (iemsg((m)), rc_did_emsg = TRUE, (void *)NULL) #define EMSG_RET_FAIL(m) return (emsg((m)), rc_did_emsg = TRUE, FAIL) @@ -90,11 +90,11 @@ static char_u e_recursive[] = N_("E956: Cannot use pattern recursively"); #define MULTI_MULT 2 // return values for regmatch() -#define RA_FAIL 1 /* something failed, abort */ -#define RA_CONT 2 /* continue in inner loop */ -#define RA_BREAK 3 /* break inner loop */ -#define RA_MATCH 4 /* successful match */ -#define RA_NOMATCH 5 /* didn't match */ +#define RA_FAIL 1 // something failed, abort +#define RA_CONT 2 // continue in inner loop +#define RA_BREAK 3 // break inner loop +#define RA_MATCH 4 // successful match +#define RA_NOMATCH 5 // didn't match /* * Return NOT_MULTI if c is not a "multi" operator. @@ -281,37 +281,37 @@ init_class_tab(void) #define ri_upper(c) (c < 0x100 && (class_tab[c] & RI_UPPER)) #define ri_white(c) (c < 0x100 && (class_tab[c] & RI_WHITE)) -/* flags for regflags */ -#define RF_ICASE 1 /* ignore case */ -#define RF_NOICASE 2 /* don't ignore case */ -#define RF_HASNL 4 /* can match a NL */ -#define RF_ICOMBINE 8 /* ignore combining characters */ -#define RF_LOOKBH 16 /* uses "\@<=" or "\@<!" */ +// flags for regflags +#define RF_ICASE 1 // ignore case +#define RF_NOICASE 2 // don't ignore case +#define RF_HASNL 4 // can match a NL +#define RF_ICOMBINE 8 // ignore combining characters +#define RF_LOOKBH 16 // uses "\@<=" or "\@<!" /* * Global work variables for vim_regcomp(). */ -static char_u *regparse; /* Input-scan pointer. */ -static int regnpar; /* () count. */ +static char_u *regparse; // Input-scan pointer. +static int regnpar; // () count. #ifdef FEAT_SYN_HL -static int regnzpar; /* \z() count. */ -static int re_has_z; /* \z item detected */ +static int regnzpar; // \z() count. +static int re_has_z; // \z item detected #endif -static unsigned regflags; /* RF_ flags for prog */ +static unsigned regflags; // RF_ flags for prog #if defined(FEAT_SYN_HL) || defined(PROTO) -static int had_eol; /* TRUE when EOL found by vim_regcomp() */ +static int had_eol; // TRUE when EOL found by vim_regcomp() #endif -static int reg_magic; /* magicness of the pattern: */ -#define MAGIC_NONE 1 /* "\V" very unmagic */ -#define MAGIC_OFF 2 /* "\M" or 'magic' off */ -#define MAGIC_ON 3 /* "\m" or 'magic' */ -#define MAGIC_ALL 4 /* "\v" very magic */ +static int reg_magic; // magicness of the pattern: +#define MAGIC_NONE 1 // "\V" very unmagic +#define MAGIC_OFF 2 // "\M" or 'magic' off +#define MAGIC_ON 3 // "\m" or 'magic' +#define MAGIC_ALL 4 // "\v" very magic -static int reg_string; /* matching with a string instead of a buffer - line */ -static int reg_strict; /* "[abc" is illegal */ +static int reg_string; // matching with a string instead of a buffer + // line +static int reg_strict; // "[abc" is illegal /* * META contains all characters that may be magic, except '^' and '$'. @@ -320,38 +320,38 @@ static int reg_strict; /* "[abc" is illegal */ #ifdef EBCDIC static char_u META[] = "%&()*+.123456789<=>?@ACDFHIKLMOPSUVWX[_acdfhiklmnopsuvwxz{|~"; #else -/* META[] is used often enough to justify turning it into a table. */ +// META[] is used often enough to justify turning it into a table. static char_u META_flags[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* % & ( ) * + . */ +// % & ( ) * + . 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, -/* 1 2 3 4 5 6 7 8 9 < = > ? */ +// 1 2 3 4 5 6 7 8 9 < = > ? 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, -/* @ A C D F H I K L M O */ +// @ A C D F H I K L M O 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, -/* P S U V W X Z [ _ */ +// P S U V W X Z [ _ 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, -/* a c d f h i k l m n o */ +// a c d f h i k l m n o 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, -/* p s u v w x z { | ~ */ +// p s u v w x z { | ~ 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1 }; #endif -static int curchr; /* currently parsed character */ -/* Previous character. Note: prevchr is sometimes -1 when we are not at the - * start, eg in /[ ^I]^ the pattern was never found even if it existed, - * because ^ was taken to be magic -- webb */ +static int curchr; // currently parsed character +// Previous character. Note: prevchr is sometimes -1 when we are not at the +// start, eg in /[ ^I]^ the pattern was never found even if it existed, +// because ^ was taken to be magic -- webb static int prevchr; -static int prevprevchr; /* previous-previous character */ -static int nextchr; /* used for ungetchr() */ +static int prevprevchr; // previous-previous character +static int nextchr; // used for ungetchr() -/* arguments for reg() */ -#define REG_NOPAREN 0 /* toplevel reg() */ -#define REG_PAREN 1 /* \(\) */ -#define REG_ZPAREN 2 /* \z(\) */ -#define REG_NPAREN 3 /* \%(\) */ +// arguments for reg() +#define REG_NOPAREN 0 // toplevel reg() +#define REG_PAREN 1 // \(\) +#define REG_ZPAREN 2 // \z(\) +#define REG_NPAREN 3 // \%(\) typedef struct { @@ -477,8 +477,8 @@ get_coll_element(char_u **pp) return 0; } -static int reg_cpo_lit; /* 'cpoptions' contains 'l' flag */ -static int reg_cpo_bsl; /* 'cpoptions' contains '\' flag */ +static int reg_cpo_lit; // 'cpoptions' contains 'l' flag +static int reg_cpo_bsl; // 'cpoptions' contains '\' flag static void get_cpo_flags(void) @@ -497,7 +497,7 @@ skip_anyof(char_u *p) { int l; - if (*p == '^') /* Complement of range. */ + if (*p == '^') // Complement of range. ++p; if (*p == ']' || *p == '-') ++p; @@ -523,7 +523,7 @@ skip_anyof(char_u *p) && get_equi_class(&p) == 0 && get_coll_element(&p) == 0 && *p != NUL) - ++p; /* it is not a class name and not NUL */ + ++p; // it is not a class name and not NUL } else ++p; @@ -559,7 +559,7 @@ skip_regexp( for (; p[0] != NUL; MB_PTR_ADV(p)) { - if (p[0] == dirc) /* found end of regexp */ + if (p[0] == dirc) // found end of regexp break; if ((p[0] == '[' && mymagic >= MAGIC_ON) || (p[0] == '\\' && p[1] == '[' && mymagic <= MAGIC_OFF)) @@ -572,7 +572,7 @@ skip_regexp( { if (dirc == '?' && newp != NULL && p[1] == '?') { - /* change "\?" to "?", make a copy first. */ + // change "\?" to "?", make a copy first. if (*newp == NULL) { *newp = vim_strsave(startp); @@ -585,7 +585,7 @@ skip_regexp( ++p; } else - ++p; /* skip next character */ + ++p; // skip next character if (*p == 'v') mymagic = MAGIC_ALL; else if (*p == 'V') @@ -598,7 +598,7 @@ skip_regexp( /* * Functions for getting characters from the regexp input. */ -static int prevchr_len; /* byte length of previous char */ +static int prevchr_len; // byte length of previous char static int at_start; // True when on the first character static int prev_at_start; // True when on the second character @@ -666,7 +666,7 @@ peekchr(void) case '.': case '[': case '~': - /* magic when 'magic' is on */ + // magic when 'magic' is on if (reg_magic >= MAGIC_ON) curchr = Magic(curchr); break; @@ -683,23 +683,23 @@ peekchr(void) case '|': case '<': case '>': - case '#': /* future ext. */ - case '"': /* future ext. */ - case '\'': /* future ext. */ - case ',': /* future ext. */ - case '-': /* future ext. */ - case ':': /* future ext. */ - case ';': /* future ext. */ - case '`': /* future ext. */ - case '/': /* Can't be used in / command */ - /* magic only after "\v" */ + case '#': // future ext. + case '"': // future ext. + case '\'': // future ext. + case ',': // future ext. + case '-': // future ext. + case ':': // future ext. + case ';': // future ext. + case '`': // future ext. + case '/': // Can't be used in / command + // magic only after "\v" if (reg_magic == MAGIC_ALL) curchr = Magic(curchr); break; case '*': - /* * is not magic as the very first character, eg "?*ptr", when - * after '^', eg "/^*ptr" and when after "\(", "\|", "\&". But - * "\(\*" is not magic, thus must be magic if "after_slash" */ + // * is not magic as the very first character, eg "?*ptr", when + // after '^', eg "/^*ptr" and when after "\(", "\|", "\&". But + // "\(\*" is not magic, thus must be magic if "after_slash" if (reg_magic >= MAGIC_ON && !at_start && !(prev_at_start && prevchr == Magic('^')) @@ -710,8 +710,8 @@ peekchr(void) curchr = Magic('*'); break; case '^': - /* '^' is only magic as the very first character and if it's after - * "\(", "\|", "\&' or "\n" */ + // '^' is only magic as the very first character and if it's after + // "\(", "\|", "\&' or "\n" if (reg_magic >= MAGIC_OFF && (at_start || reg_magic == MAGIC_ALL @@ -728,14 +728,14 @@ peekchr(void) |