To: vim_dev@googlegroups.com Subject: Patch 8.0.0081 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0081 Problem: Inconsistent function names. Solution: Rename do_cscope to ex_cscope. Clean up comments. Files: src/ex_cmds.h, src/if_cscope.c, src/ex_docmd.c, src/proto/if_cscope.pro *** ../vim-8.0.0080/src/ex_cmds.h 2016-09-20 21:39:11.354199194 +0200 --- src/ex_cmds.h 2016-11-12 19:05:58.313384777 +0100 *************** *** 391,400 **** EX(CMD_crewind, "crewind", ex_cc, RANGE|NOTADR|COUNT|TRLBAR|BANG, ADDR_LINES), ! EX(CMD_cscope, "cscope", do_cscope, EXTRA|NOTRLCOM|XFILE, ADDR_LINES), ! EX(CMD_cstag, "cstag", do_cstag, BANG|TRLBAR|WORD1, ADDR_LINES), EX(CMD_cunmap, "cunmap", ex_unmap, --- 391,400 ---- EX(CMD_crewind, "crewind", ex_cc, RANGE|NOTADR|COUNT|TRLBAR|BANG, ADDR_LINES), ! EX(CMD_cscope, "cscope", ex_cscope, EXTRA|NOTRLCOM|XFILE, ADDR_LINES), ! EX(CMD_cstag, "cstag", ex_cstag, BANG|TRLBAR|WORD1, ADDR_LINES), EX(CMD_cunmap, "cunmap", ex_unmap, *************** *** 745,751 **** EX(CMD_lclose, "lclose", ex_cclose, RANGE|NOTADR|COUNT|TRLBAR, ADDR_LINES), ! EX(CMD_lcscope, "lcscope", do_cscope, EXTRA|NOTRLCOM|XFILE, ADDR_LINES), EX(CMD_ldo, "ldo", ex_listdo, --- 745,751 ---- EX(CMD_lclose, "lclose", ex_cclose, RANGE|NOTADR|COUNT|TRLBAR, ADDR_LINES), ! EX(CMD_lcscope, "lcscope", ex_cscope, EXTRA|NOTRLCOM|XFILE, ADDR_LINES), EX(CMD_ldo, "ldo", ex_listdo, *************** *** 1249,1255 **** EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, WORD1|TRLBAR|CMDWIN, ADDR_LINES), ! EX(CMD_scscope, "scscope", do_scscope, EXTRA|NOTRLCOM, ADDR_LINES), EX(CMD_set, "set", ex_set, --- 1249,1255 ---- EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, WORD1|TRLBAR|CMDWIN, ADDR_LINES), ! EX(CMD_scscope, "scscope", ex_scscope, EXTRA|NOTRLCOM, ADDR_LINES), EX(CMD_set, "set", ex_set, *** ../vim-8.0.0080/src/if_cscope.c 2016-11-10 20:01:41.193582919 +0100 --- src/if_cscope.c 2016-11-12 19:13:14.386427848 +0100 *************** *** 201,208 **** #endif /* FEAT_CMDL_COMPL */ /* - * PRIVATE: do_cscope_general - * * Find the command, print help if invalid, and then call the corresponding * command function. */ --- 201,206 ---- *************** *** 242,272 **** } /* ! * PUBLIC: do_cscope */ void ! do_cscope(exarg_T *eap) { do_cscope_general(eap, FALSE); } /* ! * PUBLIC: do_scscope ! * ! * same as do_cscope, but splits window, too. */ void ! do_scscope(exarg_T *eap) { do_cscope_general(eap, TRUE); } /* ! * PUBLIC: do_cstag ! * */ void ! do_cstag(exarg_T *eap) { int ret = FALSE; --- 240,267 ---- } /* ! * Implementation of ":cscope" and ":lcscope" */ void ! ex_cscope(exarg_T *eap) { do_cscope_general(eap, FALSE); } /* ! * Implementation of ":scscope". Same as ex_cscope(), but splits window, too. */ void ! ex_scscope(exarg_T *eap) { do_cscope_general(eap, TRUE); } /* ! * Implementation of ":cstag" */ void ! ex_cstag(exarg_T *eap) { int ret = FALSE; *************** *** 336,348 **** #endif } ! } /* do_cscope */ /* ! * PUBLIC: cs_find ! * ! * this simulates a vim_fgets(), but for cscope, returns the next line * from the cscope output. should only be called from find_tags() * * returns TRUE if eof, FALSE otherwise --- 331,341 ---- #endif } ! } /* ! * This simulates a vim_fgets(), but for cscope, returns the next line * from the cscope output. should only be called from find_tags() * * returns TRUE if eof, FALSE otherwise *************** *** 361,369 **** /* ! * PUBLIC: cs_free_tags ! * ! * called only from do_tag(), when popping the tag stack */ void cs_free_tags(void) --- 354,360 ---- /* ! * Called only from do_tag(), when popping the tag stack. */ void cs_free_tags(void) *************** *** 373,381 **** /* ! * PUBLIC: cs_print_tags ! * ! * called from do_tag() */ void cs_print_tags(void) --- 364,370 ---- /* ! * Called from do_tag(). */ void cs_print_tags(void) *************** *** 467,478 **** ****************************************************************************/ /* ! * PRIVATE: cs_add ! * ! * add cscope database or a directory name (to look for cscope.out) ! * to the cscope connection list ! * ! * MAXPATHL 256 */ static int cs_add(exarg_T *eap UNUSED) --- 456,463 ---- ****************************************************************************/ /* ! * Add cscope database or a directory name (to look for cscope.out) ! * to the cscope connection list. */ static int cs_add(exarg_T *eap UNUSED) *************** *** 508,517 **** /* ! * PRIVATE: cs_add_common ! * ! * the common routine to add a new cscope connection. called by ! * cs_add() and cs_reset(). i really don't like to do this, but this * routine uses a number of goto statements. */ static int --- 493,500 ---- /* ! * The common routine to add a new cscope connection. Called by ! * cs_add() and cs_reset(). I really don't like to do this, but this * routine uses a number of goto statements. */ static int *************** *** 666,674 **** /* ! * PRIVATE: cs_cnt_connections ! * ! * count the number of cscope connections */ static int cs_cnt_connections(void) --- 649,655 ---- /* ! * Count the number of cscope connections. */ static int cs_cnt_connections(void) *************** *** 693,701 **** #define CSREAD_BUFSIZE 2048 /* ! * PRIVATE: cs_cnt_matches ! * ! * count the number of matches for a given cscope connection. */ static int cs_cnt_matches(int idx) --- 674,680 ---- #define CSREAD_BUFSIZE 2048 /* ! * Count the number of matches for a given cscope connection. */ static int cs_cnt_matches(int idx) *************** *** 754,761 **** /* - * PRIVATE: cs_create_cmd - * * Creates the actual cscope command query from what the user entered. */ static char * --- 733,738 ---- *************** *** 817,824 **** /* - * PRIVATE: cs_create_connection - * * This piece of code was taken/adapted from nvi. do we need to add * the BSD license notice? */ --- 794,799 ---- *************** *** 1056,1063 **** /* - * PRIVATE: cs_find - * * Query cscope using command line interface. Parse the output and use tselect * to allow choices. Like Nvi, creates a pipe to send to/from query/cscope. * --- 1031,1036 ---- *************** *** 1102,1110 **** /* ! * PRIVATE: cs_find_common ! * ! * common code for cscope find, shared by cs_find() and do_cstag() */ static int cs_find_common( --- 1075,1081 ---- /* ! * Common code for cscope find, shared by cs_find() and ex_cstag(). */ static int cs_find_common( *************** *** 1323,1331 **** } /* cs_find_common */ /* ! * PRIVATE: cs_help ! * ! * print help */ static int cs_help(exarg_T *eap UNUSED) --- 1294,1300 ---- } /* cs_find_common */ /* ! * Print help. */ static int cs_help(exarg_T *eap UNUSED) *************** *** 1408,1416 **** #endif /* ! * PRIVATE: cs_insert_filelist ! * ! * insert a new cscope database filename into the filelist */ static int cs_insert_filelist( --- 1377,1383 ---- #endif /* ! * Insert a new cscope database filename into the filelist. */ static int cs_insert_filelist( *************** *** 1551,1559 **** /* ! * PRIVATE: cs_lookup_cmd ! * ! * find cscope command in command table */ static cscmd_T * cs_lookup_cmd(exarg_T *eap) --- 1518,1524 ---- /* ! * Find cscope command in command table. */ static cscmd_T * cs_lookup_cmd(exarg_T *eap) *************** *** 1582,1590 **** /* ! * PRIVATE: cs_kill ! * ! * nuke em */ static int cs_kill(exarg_T *eap UNUSED) --- 1547,1553 ---- /* ! * Nuke em. */ static int cs_kill(exarg_T *eap UNUSED) *************** *** 1639,1646 **** /* - * PRIVATE: cs_kill_execute - * * Actually kills a specific cscope connection. */ static void --- 1602,1607 ---- *************** *** 1659,1680 **** /* ! * PRIVATE: cs_make_vim_style_matches ! * ! * convert the cscope output into a ctags style entry (as might be found * in a ctags tags file). there's one catch though: cscope doesn't tell you * the type of the tag you are looking for. for example, in Darren Hiebert's * ctags (the one that comes with vim), #define's use a line number to find the * tag in a file while function definitions use a regexp search pattern. * ! * i'm going to always use the line number because cscope does something * quirky (and probably other things i don't know about): * * if you have "# define" in your source file, which is * perfectly legal, cscope thinks you have "#define". this * will result in a failed regexp search. :( * ! * besides, even if this particular case didn't happen, the search pattern * would still have to be modified to escape all the special regular expression * characters to comply with ctags formatting. */ --- 1620,1639 ---- /* ! * Convert the cscope output into a ctags style entry (as might be found * in a ctags tags file). there's one catch though: cscope doesn't tell you * the type of the tag you are looking for. for example, in Darren Hiebert's * ctags (the one that comes with vim), #define's use a line number to find the * tag in a file while function definitions use a regexp search pattern. * ! * I'm going to always use the line number because cscope does something * quirky (and probably other things i don't know about): * * if you have "# define" in your source file, which is * perfectly legal, cscope thinks you have "#define". this * will result in a failed regexp search. :( * ! * Besides, even if this particular case didn't happen, the search pattern * would still have to be modified to escape all the special regular expression * characters to comply with ctags formatting. */ *************** *** 1721,1729 **** /* ! * PRIVATE: cs_manage_matches ! * ! * this is kind of hokey, but i don't see an easy way round this.. * * Store: keep a ptr to the (malloc'd) memory of matches originally * generated from cs_find(). the matches are originally lines directly --- 1680,1686 ---- /* ! * This is kind of hokey, but i don't see an easy way round this. * * Store: keep a ptr to the (malloc'd) memory of matches originally * generated from cs_find(). the matches are originally lines directly *************** *** 1801,1809 **** /* ! * PRIVATE: cs_parse_results ! * ! * parse cscope output */ static char * cs_parse_results( --- 1758,1764 ---- /* ! * Parse cscope output. */ static char * cs_parse_results( *************** *** 1864,1872 **** #ifdef FEAT_QUICKFIX /* ! * PRIVATE: cs_file_results ! * ! * write cscope find results to file */ static void cs_file_results(FILE *f, int *nummatches_a) --- 1819,1825 ---- #ifdef FEAT_QUICKFIX /* ! * Write cscope find results to file. */ static void cs_file_results(FILE *f, int *nummatches_a) *************** *** 1919,1928 **** #endif /* ! * PRIVATE: cs_fill_results ! * ! * get parsed cscope output and calls cs_make_vim_style_matches to convert ! * into ctags format * When there are no matches sets "*matches_p" to NULL. */ static void --- 1872,1879 ---- #endif /* ! * Get parsed cscope output and calls cs_make_vim_style_matches to convert ! * into ctags format. * When there are no matches sets "*matches_p" to NULL. */ static void *************** *** 2032,2040 **** } /* ! * PRIVATE: cs_print_tags_priv ! * ! * called from cs_manage_matches() */ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) --- 1983,1989 ---- } /* ! * Called from cs_manage_matches(). */ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) *************** *** 2182,2190 **** /* ! * PRIVATE: cs_read_prompt ! * ! * read a cscope prompt (basically, skip over the ">> ") */ static int cs_read_prompt(int i) --- 2131,2137 ---- /* ! * Read a cscope prompt (basically, skip over the ">> "). */ static int cs_read_prompt(int i) *************** *** 2280,2287 **** #endif /* - * PRIVATE: cs_release_csp - * * Does the actual free'ing for the cs ptr with an optional flag of whether * or not to free the filename. Called by cs_kill and cs_reset. */ --- 2227,2232 ---- *************** *** 2408,2416 **** /* ! * PRIVATE: cs_reset ! * ! * calls cs_kill on all cscope connections then reinits */ static int cs_reset(exarg_T *eap UNUSED) --- 2353,2359 ---- /* ! * Calls cs_kill on all cscope connections then reinits. */ static int cs_reset(exarg_T *eap UNUSED) *************** *** 2474,2481 **** /* - * PRIVATE: cs_resolve_file - * * Construct the full pathname to a file found in the cscope database. * (Prepends ppath, if there is one and if it's not already prepended, * otherwise just uses the name found.) --- 2417,2422 ---- *************** *** 2544,2552 **** /* ! * PRIVATE: cs_show ! * ! * show all cscope connections */ static int cs_show(exarg_T *eap UNUSED) --- 2485,2491 ---- /* ! * Show all cscope connections. */ static int cs_show(exarg_T *eap UNUSED) *************** *** 2579,2586 **** /* - * PUBLIC: cs_end - * * Only called when VIM exits to quit any cscope sessions. */ void --- 2518,2523 ---- *** ../vim-8.0.0080/src/ex_docmd.c 2016-11-10 20:20:01.874602675 +0100 --- src/ex_docmd.c 2016-11-12 19:05:37.725523650 +0100 *************** *** 243,251 **** # define ex_helpfind ex_ni #endif #ifndef FEAT_CSCOPE ! # define do_cscope ex_ni ! # define do_scscope ex_ni ! # define do_cstag ex_ni #endif #ifndef FEAT_SYN_HL # define ex_syntax ex_ni --- 243,251 ---- # define ex_helpfind ex_ni #endif #ifndef FEAT_CSCOPE ! # define ex_cscope ex_ni ! # define ex_scscope ex_ni ! # define ex_cstag ex_ni #endif #ifndef FEAT_SYN_HL # define ex_syntax ex_ni *************** *** 10427,10433 **** #ifdef FEAT_CSCOPE if (p_cst && *eap->arg != NUL) { ! do_cstag(eap); return; } #endif --- 10427,10433 ---- #ifdef FEAT_CSCOPE if (p_cst && *eap->arg != NUL) { ! ex_cstag(eap); return; } #endif *** ../vim-8.0.0080/src/proto/if_cscope.pro 2016-09-12 13:04:06.000000000 +0200 --- src/proto/if_cscope.pro 2016-11-12 19:06:02.421357070 +0100 *************** *** 1,9 **** /* if_cscope.c */ char_u *get_cscope_name(expand_T *xp, int idx); void set_context_in_cscope_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx); ! void do_cscope(exarg_T *eap); ! void do_scscope(exarg_T *eap); ! void do_cstag(exarg_T *eap); int cs_fgets(char_u *buf, int size); void cs_free_tags(void); void cs_print_tags(void); --- 1,9 ---- /* if_cscope.c */ char_u *get_cscope_name(expand_T *xp, int idx); void set_context_in_cscope_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx); ! void ex_cscope(exarg_T *eap); ! void ex_scscope(exarg_T *eap); ! void ex_cstag(exarg_T *eap); int cs_fgets(char_u *buf, int size); void cs_free_tags(void); void cs_print_tags(void); *** ../vim-8.0.0080/src/version.c 2016-11-12 18:30:35.115712865 +0100 --- src/version.c 2016-11-12 19:15:58.557299522 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 81, /**/ -- hundred-and-one symptoms of being an internet addict: 25. You believe nothing looks sexier than a man in boxer shorts illuminated only by a 17" inch svga monitor. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///