diff options
Diffstat (limited to 'src/tag.c')
-rw-r--r-- | src/tag.c | 651 |
1 files changed, 323 insertions, 328 deletions
@@ -45,20 +45,20 @@ typedef struct tag_pointers * At the end, all the matches from ga_match[] are concatenated, to make a list * sorted on priority. */ -#define MT_ST_CUR 0 /* static match in current file */ -#define MT_GL_CUR 1 /* global match in current file */ -#define MT_GL_OTH 2 /* global match in other file */ -#define MT_ST_OTH 3 /* static match in other file */ -#define MT_IC_OFF 4 /* add for icase match */ -#define MT_RE_OFF 8 /* add for regexp match */ -#define MT_MASK 7 /* mask for printing priority */ +#define MT_ST_CUR 0 // static match in current file +#define MT_GL_CUR 1 // global match in current file +#define MT_GL_OTH 2 // global match in other file +#define MT_ST_OTH 3 // static match in other file +#define MT_IC_OFF 4 // add for icase match +#define MT_RE_OFF 8 // add for regexp match +#define MT_MASK 7 // mask for printing priority #define MT_COUNT 16 static char *mt_names[MT_COUNT/2] = {"FSC", "F C", "F ", "FS ", " SC", " C", " ", " S "}; -#define NOTAGFILE 99 /* return value for jumpto_tag */ -static char_u *nofile_fname = NULL; /* fname for NOTAGFILE error */ +#define NOTAGFILE 99 // return value for jumpto_tag +static char_u *nofile_fname = NULL; // fname for NOTAGFILE error static void taglen_advance(int l); @@ -91,7 +91,7 @@ static char_u *recurmsg = (char_u *)N_("E986: cannot modify the tag stack within static char_u *tfu_inv_ret_msg = (char_u *)N_("E987: invalid return value from tagfunc"); #endif -static char_u *tagmatchname = NULL; /* name of last used tag */ +static char_u *tagmatchname = NULL; // name of last used tag #if defined(FEAT_QUICKFIX) /* @@ -130,11 +130,11 @@ static int tfu_in_use = FALSE; // disallow recursive call of tagfunc */ int do_tag( - char_u *tag, /* tag (pattern) to jump to */ + char_u *tag, // tag (pattern) to jump to int type, int count, - int forceit, /* :ta with ! */ - int verbose) /* print "tag not found" message */ + int forceit, // :ta with ! + int verbose) // print "tag not found" message { taggy_T *tagstack = curwin->w_tagstack; int tagstackidx = curwin->w_tagstackidx; @@ -158,13 +158,13 @@ do_tag( char_u **new_matches; int use_tagstack; int skip_msg = FALSE; - char_u *buf_ffname = curbuf->b_ffname; /* name to use for - priority computation */ + char_u *buf_ffname = curbuf->b_ffname; // name to use for + // priority computation int use_tfu = 1; - /* remember the matches for the last used tag */ + // remember the matches for the last used tag static int num_matches = 0; - static int max_num_matches = 0; /* limit used for match search */ + static int max_num_matches = 0; // limit used for match search static char_u **matches = NULL; static int flags; @@ -179,7 +179,7 @@ do_tag( #ifdef EXITFREE if (type == DT_FREE) { - /* remove the list of matches */ + // remove the list of matches FreeWild(num_matches, matches); # ifdef FEAT_CSCOPE cs_free_tags(); @@ -200,7 +200,7 @@ do_tag( free_string_option(nofile_fname); nofile_fname = NULL; - CLEAR_POS(&saved_fmark.mark); /* shutup gcc 4.0 */ + CLEAR_POS(&saved_fmark.mark); // shutup gcc 4.0 saved_fmark.fnum = 0; /* @@ -228,7 +228,7 @@ do_tag( #endif use_tagstack = TRUE; - /* new pattern, add to the tag stack */ + // new pattern, add to the tag stack if (*tag != NUL && (type == DT_TAG || type == DT_SELECT || type == DT_JUMP #ifdef FEAT_QUICKFIX @@ -245,8 +245,8 @@ do_tag( if (ptag_entry.tagname != NULL && STRCMP(ptag_entry.tagname, tag) == 0) { - /* Jumping to same tag: keep the current match, so that - * the CursorHold autocommand example works. */ + // Jumping to same tag: keep the current match, so that + // the CursorHold autocommand example works. cur_match = ptag_entry.cur_match; cur_fnum = ptag_entry.cur_fnum; } @@ -267,7 +267,7 @@ do_tag( while (tagstackidx < tagstacklen) tagstack_clear_entry(&tagstack[--tagstacklen]); - /* if the tagstack is full: remove oldest entry */ + // if the tagstack is full: remove oldest entry if (++tagstacklen > TAGSTACKSIZE) { tagstacklen = TAGSTACKSIZE; @@ -287,7 +287,7 @@ do_tag( } curwin->w_tagstacklen = tagstacklen; - save_pos = TRUE; /* save the cursor position below */ + save_pos = TRUE; // save the cursor position below } new_tag = TRUE; @@ -300,12 +300,12 @@ do_tag( #endif tagstacklen == 0) { - /* empty stack */ + // empty stack emsg(_(e_tagstack)); goto end_do_tag; } - if (type == DT_POP) /* go to older position */ + if (type == DT_POP) // go to older position { #ifdef FEAT_FOLDING int old_KeyTyped = KeyTyped; @@ -315,23 +315,22 @@ do_tag( emsg(_(bottommsg)); if (tagstackidx + count == 0) { - /* We did [num]^T from the bottom of the stack */ + // We did [num]^T from the bottom of the stack tagstackidx = 0; goto end_do_tag; } - /* We weren't at the bottom of the stack, so jump all the - * way to the bottom now. - */ + // We weren't at the bottom of the stack, so jump all the + // way to the bottom now. tagstackidx = 0; } - else if (tagstackidx >= tagstacklen) /* count == 0? */ + else if (tagstackidx >= tagstacklen) // count == 0? { emsg(_(topmsg)); goto end_do_tag; } - /* Make a copy of the fmark, autocommands may invalidate the - * tagstack before it's used. */ + // Make a copy of the fmark, autocommands may invalidate the + // tagstack before it's used. saved_fmark = tagstack[tagstackidx].fmark; if (saved_fmark.fnum != curbuf->b_fnum) { @@ -342,11 +341,11 @@ do_tag( if (buflist_getfile(saved_fmark.fnum, saved_fmark.mark.lnum, GETF_SETMARK, forceit) == FAIL) { - tagstackidx = oldtagstackidx; /* back to old posn */ + tagstackidx = oldtagstackidx; // back to old posn goto end_do_tag; } - /* An BufReadPost autocommand may jump to the '" mark, but - * we don't what that here. */ + // An BufReadPost autocommand may jump to the '" mark, but + // we don't what that here. curwin->w_cursor.lnum = saved_fmark.mark.lnum; } else @@ -362,7 +361,7 @@ do_tag( foldOpenCursor(); #endif - /* remove the old list of matches */ + // remove the old list of matches FreeWild(num_matches, matches); #ifdef FEAT_CSCOPE cs_free_tags(); @@ -387,8 +386,8 @@ do_tag( else #endif { - /* ":tag" (no argument): go to newer pattern */ - save_pos = TRUE; /* save the cursor position below */ + // ":tag" (no argument): go to newer pattern + save_pos = TRUE; // save the cursor position below if ((tagstackidx += count - 1) >= tagstacklen) { /* @@ -400,7 +399,7 @@ do_tag( emsg(_(topmsg)); save_pos = FALSE; } - else if (tagstackidx < 0) /* must have been count == 0 */ + else if (tagstackidx < 0) // must have been count == 0 { emsg(_(bottommsg)); tagstackidx = 0; @@ -411,9 +410,9 @@ do_tag( } new_tag = TRUE; } - else /* go to other matching tag */ + else // go to other matching tag { - /* Save index for when selection is cancelled. */ + // Save index for when selection is cancelled. prevtagstackidx = tagstackidx; #if defined(FEAT_QUICKFIX) @@ -476,9 +475,9 @@ do_tag( tagstack[tagstackidx].fmark.fnum = curbuf->b_fnum; } - /* Curwin will change in the call to jumpto_tag() if ":stag" was - * used or an autocommand jumps to another window; store value of - * tagstackidx now. */ + // Curwin will change in the call to jumpto_tag() if ":stag" was + // used or an autocommand jumps to another window; store value of + // tagstackidx now. curwin->w_tagstackidx = tagstackidx; if (type != DT_SELECT && type != DT_JUMP) { @@ -488,9 +487,9 @@ do_tag( } } - /* When not using the current buffer get the name of buffer "cur_fnum". - * Makes sure that the tag order doesn't change when using a remembered - * position for "cur_match". */ + // When not using the current buffer get the name of buffer "cur_fnum". + // Makes sure that the tag order doesn't change when using a remembered + // position for "cur_match". if (cur_fnum != curbuf->b_fnum) { buf_T *buf = buflist_findnr(cur_fnum); @@ -540,7 +539,7 @@ do_tag( else max_num_matches = cur_match + 1; - /* when the argument starts with '/', use it as a regexp */ + // when the argument starts with '/', use it as a regexp if (!no_regexp && *name == '/') { flags = TAG_REGEXP; @@ -562,20 +561,20 @@ do_tag( if (find_tags(name, &new_num_matches, &new_matches, flags, max_num_matches, buf_ffname) == OK && new_num_matches < max_num_matches) - max_num_matches = MAXCOL; /* If less than max_num_matches - found: all matches found. */ + max_num_matches = MAXCOL; // If less than max_num_matches + // found: all matches found. - /* If there already were some matches for the same name, move them - * to the start. Avoids that the order changes when using - * ":tnext" and jumping to another file. */ + // If there already were some matches for the same name, move them + // to the start. Avoids that the order changes when using + // ":tnext" and jumping to another file. if (!new_tag && !other_name) { int j, k; int idx = 0; tagptrs_T tagp, tagp2; - /* Find the position of each old match in the new list. Need - * to use parse_match() to find the tag line. */ + // Find the position of each old match in the new list. Need + // to use parse_match() to find the tag line. for (j = 0; j < num_matches; ++j) { parse_match(matches[j], &tagp); @@ -632,7 +631,7 @@ do_tag( { if (add_llist_tags(tag, num_matches, matches) == FAIL) goto end_do_tag; - cur_match = 0; /* Jump to the first tag */ + cur_match = 0; // Jump to the first tag } #endif @@ -644,7 +643,7 @@ do_tag( i = prompt_for_number(NULL); if (i <= 0 || i > num_matches || got_int) { - /* no valid choice: don't change anything */ + // no valid choice: don't change anything if (use_tagstack) { tagstack[tagstackidx].fmark = saved_fmark; @@ -661,9 +660,9 @@ do_tag( if (cur_match >= num_matches) { - /* Avoid giving this error when a file wasn't found and we're - * looking for a match in another file, which wasn't found. - * There will be an emsg("file doesn't exist") below then. */ + // Avoid giving this error when a file wasn't found and we're + // looking for a match in another file, which wasn't found. + // There will be an emsg("file doesn't exist") below then. if ((type == DT_NEXT || type == DT_FIRST) && nofile_fname == NULL) { @@ -717,7 +716,7 @@ do_tag( && (num_matches > 1 || ic) && !skip_msg) { - /* Give an indication of the number of matching tags */ + // Give an indication of the number of matching tags sprintf((char *)IObuff, _("tag %d of %d%s"), cur_match + 1, num_matches, @@ -731,7 +730,7 @@ do_tag( msg_attr((char *)IObuff, HL_ATTR(HLF_W)); else msg((char *)IObuff); - msg_scroll = TRUE; /* don't overwrite this message */ + msg_scroll = TRUE; // don't overwrite this message } else give_warning(IObuff, ic); @@ -743,7 +742,7 @@ do_tag( } #if defined(FEAT_EVAL) - /* Let the SwapExists event know what tag we are jumping to. */ + // Let the SwapExists event know what tag we are jumping to. vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name); set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1); #endif @@ -759,7 +758,7 @@ do_tag( if (i == NOTAGFILE) { - /* File not found: try again with another matching tag */ + // File not found: try again with another matching tag if ((type == DT_PREV && cur_match > 0) || ((type == DT_TAG || type == DT_NEXT || type == DT_FIRST) @@ -782,8 +781,8 @@ do_tag( } else { - /* We may have jumped to another window, check that - * tagstackidx is still valid. */ + // We may have jumped to another window, check that + // tagstackidx is still valid. if (use_tagstack && tagstackidx > curwin->w_tagstacklen) tagstackidx = curwin->w_tagstackidx; #ifdef FEAT_CSCOPE @@ -795,12 +794,12 @@ do_tag( } end_do_tag: - /* Only store the new index when using the tagstack and it's valid. */ + // Only store the new index when using the tagstack and it's valid. if (use_tagstack && tagstackidx <= curwin->w_tagstacklen) curwin->w_tagstackidx = tagstackidx; - postponed_split = 0; /* don't split next time */ + postponed_split = 0; // don't split next time # ifdef FEAT_QUICKFIX - g_do_tagpreview = 0; /* don't do tag preview next time */ + g_do_tagpreview = 0; // don't do tag preview next time # endif #ifdef FEAT_CSCOPE @@ -1041,7 +1040,7 @@ add_llist_tags( parse_match(matches[i], &tagp); - /* Save the tag name */ + // Save the tag name len = (int)(tagp.tagname_end - tagp.tagname); if (len > 128) len = 128; @@ -1185,14 +1184,14 @@ do_tags(exarg_T *eap UNUSED) int tagstackidx = curwin->w_tagstackidx; int tagstacklen = curwin->w_tagstacklen; - /* Highlight title */ + // Highlight title msg_puts_title(_("\n # TO tag FROM line in file/text")); for (i = 0; i < tagstacklen; ++i) { if (tagstack[i].tagname != NULL) { name = fm_getname(&(tagstack[i].fmark), 30); - if (name == NULL) /* file name not available */ + if (name == NULL) // file name not available continue; msg_putchar('\n'); @@ -1207,9 +1206,9 @@ do_tags(exarg_T *eap UNUSED) ? HL_ATTR(HLF_D) : 0); vim_free(name); } - out_flush(); /* show one line at a time */ + out_flush(); // show one line at a time } - if (tagstackidx == tagstacklen) /* idx at top of stack */ + if (tagstackidx == tagstacklen) // idx at top of stack msg_puts("\n>"); } @@ -1228,14 +1227,14 @@ tag_strnicmp(char_u *s1, char_u *s2, size_t len) { i = (int)TOUPPER_ASC(*s1) - (int)TOUPPER_ASC(*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 @@ -1244,11 +1243,11 @@ tag_strnicmp(char_u *s1, char_u *s2, size_t len) */ typedef struct { - char_u *pat; /* the pattern */ - int len; /* length of pat[] */ - char_u *head; /* start of pattern head */ - int headlen; /* length of head[] */ - regmatch_T regmatch; /* regexp program, may be NULL */ + char_u *pat; // the pattern + int len; // length of pat[] + char_u *head; // start of pattern head + int headlen; // length of head[] + regmatch_T regmatch; // regexp program, may be NULL } pat_T; /* @@ -1261,8 +1260,8 @@ prepare_pats(pat_T *pats, int has_re) pats->headlen = pats->len; if (has_re) { - /* When the pattern starts with '^' or "\\<", binary searching can be - * used (much faster). */ + // When the pattern starts with '^' or "\\<", binary searching can be + // used (much faster). if (pats->pat[0] == '^') pats->head = pats->pat + 1; else if (pats->pat[0] == '\\' && pats->pat[1] == '<') @@ -1275,7 +1274,7 @@ prepare_pats(pat_T *pats, int has_re) if (vim_strchr((char_u *)(p_magic ? ".[~*\\$" : "\\$"), pats->head[pats->headlen]) != NULL) break; - if (p_tl != 0 && pats->headlen > p_tl) /* adjust for 'taglength' */ + if (p_tl != 0 && pats->headlen > p_tl) // adjust for 'taglength' pats->headlen = p_tl; } @@ -1545,43 +1544,43 @@ find_tagfunc_tags( */ int find_tags( - char_u *pat, /* pattern to search for */ - int *num_matches, /* return: number of matches found */ - char_u ***matchesp, /* return: array of matches found */ + char_u *pat, // pattern to search for + int *num_matches, // return: number of matches found + char_u ***matchesp, // return: array of matches found int flags, - int mincount, /* MAXCOL: find all matches - other: minimal number of matches */ - char_u *buf_ffname) /* name of buffer for priority */ + int mincount, // MAXCOL: find all matches + // other: minimal number of matches + char_u *buf_ffname) // name of buffer for priority { FILE *fp; - char_u *lbuf; /* line buffer */ - int lbuf_size = LSIZE; /* length of lbuf */ - char_u *tag_fname; /* name of tag file */ - tagname_T tn; /* info for get_tagfname() */ - int first_file; /* trying first tag file */ + char_u *lbuf; // line buffer + int lbuf_size = LSIZE; // length of lbuf + char_u *tag_fname; // name of tag file + tagname_T tn; // info for get_tagfname() + int first_file; // trying first tag file tagptrs_T tagp; - int did_open = FALSE; /* did open a tag file */ - int stop_searching = FALSE; /* stop when match found or error */ - int retval = FAIL; /* return value */ - int is_static; /* current tag line is static */ - int is_current; /* file name matches */ - int eof = FALSE; /* found end-of-file */ + int did_open = FALSE; // did open a tag file + int stop_searching = FALSE; // stop when match found or error + int retval = FAIL; // return value + int is_static; // current tag line is static + int is_current; // file name matches + int eof = FALSE; // found end-of-file char_u *p; char_u *s; int i; #ifdef FEAT_TAG_BINS - int tag_file_sorted = NUL; /* !_TAG_FILE_SORTED value */ - struct tag_search_info /* Binary search file offsets */ + int tag_file_sorted = NUL; // !_TAG_FILE_SORTED value + struct tag_search_info // Binary search file offsets { - off_T low_offset; /* offset for first char of first line that - could match */ - off_T high_offset; /* offset of char after last line that could - match */ - off_T curr_offset; /* Current file offset in search range */ - off_T curr_offset_used; /* curr_offset used when skipping back */ - off_T match_offset; /* Where the binary search found a tag */ - int low_char; /* first char at low_offset */ - int high_char; /* first char at high_offset */ + off_T low_offset; // offset for first char of first line that + // could match + off_T high_offset; // offset of char after last line that could + // match + off_T curr_offset; // Current file offset in search range + off_T curr_offset_used; // curr_offset used when skipping back + off_T match_offset; // Where the binary search found a tag + int low_char; // first char at low_offset + int high_char; // first char at high_offset } search_info; off_T filesize; int tagcmp; @@ -1590,19 +1589,19 @@ find_tags( #endif enum { - TS_START, /* at start of file */ - TS_LINEAR /* linear searching forward, till EOF */ + TS_START, // at start of file + TS_LINEAR // linear searching forward, till EOF #ifdef FEAT_TAG_BINS - , TS_BINARY, /* binary searching */ - TS_SKIP_BACK, /* skipping backwards */ - TS_STEP_FORWARD /* stepping forwards */ + , TS_BINARY, // binary searching + TS_SKIP_BACK, // skipping backwards + TS_STEP_FORWARD // stepping forwards #endif - } state; /* Current search state */ + } state; // Current search state int cmplen; - int match; /* matches */ - int match_no_ic = 0;/* matches with rm_ic == FALSE */ - int match_re; /* match with regexp */ + int match; // matches + int match_no_ic = 0;// matches with rm_ic == FALSE + int match_re; // match with regexp int matchoff = 0; int save_emsg_off; @@ -1618,39 +1617,39 @@ find_tags( char_u *etag_fname; } incstack[INCSTACK_SIZE]; - int incstack_idx = 0; /* index in incstack */ - char_u *ebuf; /* additional buffer for etag fname */ - int is_etag; /* current file is emaces style */ + int incstack_idx = 0; // index in incstack + char_u *ebuf; // additional buffer for etag fname + int is_etag; // current file is emaces style #endif char_u *mfp; - garray_T ga_match[MT_COUNT]; /* stores matches in sequence */ - hashtab_T ht_match[MT_COUNT]; /* stores matches by key */ + garray_T ga_match[MT_COUNT]; // stores matches in sequence + hashtab_T ht_match[MT_COUNT]; // stores matches by key hash_T hash = 0; - int match_count = 0; /* number of matches found */ + int match_count = 0; // number of matches found char_u **matches; int mtt; int help_save; #ifdef FEAT_MULTI_LANG int help_pri = 0; - char_u *help_lang_find = NULL; /* lang to be found */ - char_u help_lang[3]; /* lang of current tags file */ - char_u *saved_pat = NULL; /* copy of pat[] */ - int is_txt = FALSE; /* flag of file extension */ + char_u *help_lang_find = NULL; // lang to be found + char_u help_lang[3]; // lang of current tags file + char_u *saved_pat = NULL; // copy of pat[] + int is_txt = FALSE; // flag of file extension #endif - pat_T orgpat; /* holds unconverted pattern info */ + pat_T orgpat; // holds unconverted pattern info vimconv_T vimconv; #ifdef FEAT_TAG_BINS int findall = (mincount == MAXCOL || mincount == TAG_MANY); - /* find all matching tags */ - int sort_error = FALSE; /* tags file not sorted */ - int linear; /* do a linear search */ - int sortic = FALSE; /* tag file sorted in nocase */ + // find all matching tags + int sort_error = FALSE; // tags file not sorted + int linear; // do a linear search + int sortic = FALSE; // tag file sorted in nocase #endif - int line_error = FALSE; /* syntax error */ - int has_re = (flags & TAG_REGEXP); /* regexp used */ + int line_error = FALSE; // syntax error + int has_re = (flags & TAG_REGEXP); // regexp used int help_only = (flags & TAG_HELP); int name_only = (flags & TAG_NAMES); int noic = (flags & TAG_NOIC); @@ -1695,7 +1694,7 @@ find_tags( hash_init(&ht_match[mtt]); } - /* check for out of memory situation */ + // check for out of memory situation if (lbuf == NULL || tag_fname == NULL #ifdef FEAT_EMACS_TAGS || ebuf == NULL @@ -1704,18 +1703,18 @@ find_tags( goto findtag_end; #ifdef FEAT_CSCOPE - STRCPY(tag_fname, "from cscope"); /* for error messages */ + STRCPY(tag_fname, "from cscope"); // for error messages #endif /* * Initialize a few variables */ - if (help_only) /* want tags from help file */ - curbuf->b_help = TRUE; /* will be restored later */ + if (help_only) // want tags from help file + curbuf->b_help = TRUE; // will be restored later #ifdef FEAT_CSCOPE else if (use_cscope) { - /* Make sure we don't mix help and cscope, confuses Coverity. */ + // Make sure we don't mix help and cscope, confuses Coverity. help_only = FALSE; curbuf->b_help = FALSE; } @@ -1725,8 +1724,8 @@ find_tags( #ifdef FEAT_MULTI_LANG if (curbuf->b_help) { - /* When "@ab" is specified use only the "ab" language, otherwise - * search all languages. */ + // When "@ab" is specified use only the "ab" language, otherwise + // search all languages. if (orgpat.len > 3 && pat[orgpat.len - 3] == '@' && ASCII_ISALPHA(pat[orgpat.len - 2]) && ASCII_ISALPHA(pat[orgpat.len - 1])) @@ -1741,19 +1740,19 @@ find_tags( } } #endif - if (p_tl != 0 && orgpat.len > p_tl) /* adjust for 'taglength' */ + if (p_tl != 0 && orgpat.len > p_tl) // adjust for 'taglength' orgpat.len = p_tl; save_emsg_off = emsg_off; - emsg_off = TRUE; /* don't want error for invalid RE here */ + emsg_off = TRUE; // don't want error for invalid RE here prepare_pats(&orgpat, has_re); emsg_off = save_emsg_off; if (has_re && orgpat.regmatch.regprog == NULL) goto findtag_end; #ifdef FEAT_TAG_BINS - /* This is only to avoid a compiler warning for using search_info - * uninitialised. */ + // This is only to avoid a compiler warning for using search_info + // uninitialised. vim_memset(&search_info, 0, (size_t)1); #endif @@ -1780,7 +1779,7 @@ find_tags( * Only ignore case when TAG_NOIC not used or 'ignorecase' set. */ #ifdef FEAT_MULTI_LANG - /* Set a flag if the file extension is .txt */ + // Set a flag if the file extension is .txt if ((flags & TAG_KEEP_LANG) && help_lang_find == NULL && curbuf->b_fname != NULL @@ -1814,34 +1813,34 @@ find_tags( */ #ifdef FEAT_CSCOPE if (use_cscope) - fp = NULL; /* avoid GCC warning */ + fp = NULL; // avoid GCC warning else #endif { #ifdef FEAT_MULTI_LANG if (curbuf->b_help) { - /* Keep en if the file extension is .txt*/ + // Keep en if the file extension is .txt if (is_txt) STRCPY(help_lang, "en"); else { - /* Prefer help tags according to 'helplang'. Put the - * two-letter language name in help_lang[]. */ + // Prefer help tags according to 'helplang'. Put the + // two-letter language name in help_lang[]. i = (int)STRLEN(tag_fname); if (i > 3 && tag_fname[i - 3] == '-') STRCPY(help_lang, tag_fname + i - 2); else STRCPY(help_lang, "en"); } - /* When searching for a specific language skip tags files - * for other languages. */ + // When searching for a specific language skip tags files + // for other languages. if (help_lang_find != NULL && STRICMP(help_lang, help_lang_find) != 0) continue; - /* For CTRL-] in a help file prefer a match with the same - * language. */ + // For CTRL-] in a help file prefer a match with the same + // language. if ((flags & TAG_KEEP_LANG) && help_lang_find == NULL && curbuf->b_fname != NULL @@ -1863,8 +1862,8 @@ find_tags( } if (s == NULL || *s == NUL) { - /* Language not in 'helplang': use last, prefer English, - * unless found already. */ + // Language not in 'helplang': use last, prefer English, + // unless found already. ++help_pri; if (STRICMP(help_lang, "en") != 0) ++help_pri; @@ -1883,11 +1882,11 @@ find_tags( verbose_leave(); } } - did_open = TRUE; /* remember that we found at least one file */ + did_open = TRUE; // remember that we found at least one file - state = TS_START; /* we're at the start of the file */ + state = TS_START; // we're at the start of the file #ifdef FEAT_EMACS_TAGS - is_etag = 0; /* default is: not emacs style */ + is_etag = 0; // default is: not emacs style #endif /* @@ -1896,21 +1895,21 @@ find_tags( for (;;) { #ifdef FEAT_TAG_BINS - /* check for CTRL-C typed, more often when jumping around */ + // check for CTRL-C typed, more often when jumping around if (state == TS_BINARY || state == TS_SKIP_BACK) line_breakcheck(); else #endif fast_breakcheck(); - if ((flags & TAG_INS_COMP)) /* Double brackets for gcc */ + if ((flags & TAG_INS_COMP)) // Double brackets for gcc ins_compl_check_keys(30, FALSE); if (got_int || ins_compl_interrupted()) { stop_searching = TRUE; break; } - /* When mincount is TAG_MANY, stop when enough matches have been - * found (for completion). */ + // When mincount is TAG_MANY, stop when enough matches have been + // found (for completion). if (mincount == TAG_MANY && match_count >= TAG_MANY) { stop_searching = TRUE; @@ -1928,7 +1927,7 @@ find_tags( offset = search_info.low_offset + ((search_info.high_offset - search_info.low_offset) / 2); if (offset == search_info.curr_offset) - break; /* End the binary search without a match. */ + break; // End the binary search without a match. else search_info.curr_offset = offset; } @@ -1953,24 +1952,24 @@ find_tags( */ if (state == TS_BINARY || state == TS_SKIP_BACK) { - /* Adjust the search file offset to the correct position */ + // Adjust the search file offset to the correct position search_info.curr_offset_used = search_info.curr_offset; vim_fseek(fp, search_info.curr_offset, SEEK_SET); eof = vim_fgets(lbuf, lbuf_size, fp); if (!eof && search_info.curr_offset != 0) { - /* The explicit cast is to work around a bug in gcc 3.4.2 - * (repeated below). */ + // The explicit cast is to work around a bug in gcc 3.4.2 + // (repeated below). search_info.curr_offset = vim_ftell(fp); if (search_info.curr_offset == search_info.high_offset) { - /* oops, gone a bit too far; try from low offset */ + // oops, gone a bit too far; try from low offset vim_fseek(fp, search_info.low_offset, SEEK_SET); search_info.curr_offset = search_info.low_offset; } eof = vim_fgets(lbuf, lbuf_size, fp); } - /* skip empty and blank lines */ + // skip empty and blank lines while (!eof && vim_isblankline(lbuf)) { search_info.curr_offset = vim_ftell(fp); @@ -1978,7 +1977,7 @@ find_tags( } if (eof) { - /* Hit end of file. Skip backwards. */ + // Hit end of file. Skip backwards. state = TS_SKIP_BACK; search_info.match_offset = vim_ftell(fp); search_info.curr_offset = search_info.curr_offset_used; @@ -1992,7 +1991,7 @@ find_tags( else #endif { - /* skip empty and blank lines */ + // skip empty and blank lines do { #ifdef FEAT_CSCOPE @@ -2006,19 +2005,19 @@ find_tags( if (eof) { #ifdef FEAT_EMACS_TAGS - if (incstack_idx) /* this was an included file */ + if (incstack_idx) // this was an included file { --incstack_idx; - fclose(fp); /* end of this file ... */ + fclose(fp); // end of this file ... fp = incstack[incstack_idx].fp; STRCPY(tag_fname, incstack[incstack_idx].etag_fname); vim_free(incstack[incstack_idx].etag_fname); - is_etag = 1; /* (only etags can include) */ - continue; /* ... continue with parent file */ + is_etag = 1; // (only etags can include) + continue; // ... continue with parent file } else #endif - break; /* end of file */ + break; // end of file } } line_read_in: @@ -2028,13 +2027,13 @@ line_read_in: char_u *conv_line; int len; - /* Convert every line. Converting the pattern from 'enc' to - * the tags file encoding doesn't work, because characters are - * not recognized. */ + // Convert every line. Converting the pattern from 'enc' to + // the tags file encoding doesn't work, because characters are + // not recognized. conv_line = string_convert(&vimconv, lbuf, NULL); if (conv_line != NULL) { - /* Copy or swap lbuf and conv_line. */ + // Copy or swap lbuf and conv_line. len = (int)STRLEN(conv_line) + 1; if (len > lbuf_size) { @@ -2063,7 +2062,7 @@ line_read_in: # endif ) { - is_etag = 1; /* in case at the start */ + is_etag = 1; // in case at the start state = TS_LINEAR; if (!vim_fgets(ebuf, LSIZE, fp)) { @@ -2078,7 +2077,7 @@ line_read_in: if (STRNCMP(p + 1, "include", 7) == 0 && incstack_idx < INCSTACK_SIZE) { - /* Save current "fp" and "tag_fname" in the stack. */ + // Save current "fp" and "tag_fname" in the stack. if ((incstack[incstack_idx].etag_fname = vim_strsave(tag_fname)) != NULL) { @@ -2087,8 +2086,8 @@ line_read_in: incstack[incstack_idx].fp = fp; fp = NULL; - /* Figure out "tag_fname" and "fp" to use for - * included file. */ + // Figure out "tag_fname" and "fp" to use for + // included file. fullpath_ebuf = expand_tag_fname(ebuf, tag_fname, FALSE); if (fullpath_ebuf != NULL) @@ -2101,14 +2100,14 @@ line_read_in: vim_strncpy(tag_fname, fullpath_ebuf, MAXPATHL); ++incstack_idx; - is_etag = 0; /* we can include anything */ + is_etag = 0; // we can include anything } vim_free(fullpath_ebuf); } if (fp == NULL) { - /* Can't open the included file, skip it and - * restore old value of "fp". */ + // Can't open the included file, skip it and + // restore old value of "fp". fp = incstack[incstack_idx].fp; vim_free(incstack[incstack_idx].etag_fname); } @@ -2125,14 +2124,13 @@ line_read_in: */ if (state == TS_START) { - /* The header ends when the line sorts below "!_TAG_". When - * case is folded lower case letters sort before "_". */ + // The header ends when the line sorts below "!_TAG_". When + // case is folded lower case letters sort before "_". if (STRNCMP(lbuf, "!_TAG_", 6) <= 0 || (lbuf[0] == '!' && ASCII_ISLOWER(lbuf[1]))) { if (STRNCMP(lbuf, "!_TAG_", 6) != 0) - /* Non-header item before the header, e.g. "!" itself. - */ + // Non-header item before the header, e.g. "!" itself. goto parse_line; /* @@ -2144,19 +2142,19 @@ line_read_in: #endif if (STRNCMP(lbuf, "!_TAG_FILE_ENCODING\t", 20) == 0) { - /* Prepare to convert every line from the specified - * encoding to 'encoding'. */ + // Prepare to convert every line from the specified + // encoding to 'encoding'. for (p = lbuf + 20; *p > ' ' && *p < 127; ++p) ; *p = NUL; convert_setup(&vimconv, lbuf + 20, p_enc); } - /* Read the next line. Unrecognized flags are ignored. */ + // Read the next line. Unrecognized flags are ignored. continue; } - /* Headers ends. */ + // Headers ends. #ifdef FEAT_TAG_BINS /* @@ -2189,8 +2187,8 @@ line_read_in: if (state == TS_BINARY && orgpat.regmatch.rm_ic && !sortic) { - /* Binary search won't work for ignoring case, use linear - * search. */ + // Binary search won't work for ignoring case, use linear + // search. linear = TRUE; state = TS_LINEAR; } @@ -2267,7 +2265,7 @@ parse_line: tagp.tagname_end = vim_strchr(lbuf, TAB); if (tagp.tagname_end == NULL) { - /* Corrupted tag line. */ + // Corrupted tag line. line_error = TRUE; break; } @@ -2277,7 +2275,7 @@ parse_line: * there is no regexp, or the tag is too short. */ cmplen = (int)(tagp.tagname_end - tagp.tagname); - if (p_tl != 0 && cmplen > p_tl) /* adjust for 'taglength' */ + if (p_tl != 0 && cmplen > p_tl) // adjust for 'taglength' cmplen = p_tl; if (has_re && orgpat.headlen < cmplen) cmplen = orgpat.headlen; @@ -2319,9 +2317,8 @@ parse_line: if (tagcmp == 0) { - /* We've located the tag, now skip back and search - * forward until the first matching tag is found. - */ + // We've located the tag, now skip back and search + // forward until the first matching tag is found. state = TS_SKIP_BACK; search_info.match_offset = search_info.curr_offset; continue; @@ -2352,7 +2349,7 @@ parse_line: continue; } - /* No match yet and are at the end of the binary search. */ + // No match yet and are at the end of the binary search. break; } else if (state == TS_SKIP_BACK) @@ -2360,8 +2357,8 @@ parse_line: if (MB_STRNICMP(tagp.tagname, orgpat.head, cmplen) != 0) state = TS_STEP_FORWARD; else - /* Have to skip back more. Restore the curr_offset - * used, otherwise we get stuck at a long line. */ + // Have to skip back more. Restore the curr_offset + // used, otherwise we get stuck at a long line. searc |