comparison src/if_cscope.c @ 665:21ab9abf0f08

updated for version 7.0196
author vimboss
date Fri, 10 Feb 2006 23:20:28 +0000
parents e4fa26ce8769
children 0f9f4761ad9c
comparison
equal deleted inserted replaced
664:ce5a759cc907 665:21ab9abf0f08
48 static void cs_file_results __ARGS((FILE *, int *)); 48 static void cs_file_results __ARGS((FILE *, int *));
49 #endif 49 #endif
50 static void cs_fill_results __ARGS((char *, int , int *, char ***, 50 static void cs_fill_results __ARGS((char *, int , int *, char ***,
51 char ***, int *)); 51 char ***, int *));
52 static int cs_find __ARGS((exarg_T *eap)); 52 static int cs_find __ARGS((exarg_T *eap));
53 static int cs_find_common __ARGS((char *opt, char *pat, int, int )); 53 static int cs_find_common __ARGS((char *opt, char *pat, int, int, int));
54 static int cs_help __ARGS((exarg_T *eap)); 54 static int cs_help __ARGS((exarg_T *eap));
55 static void cs_init __ARGS((void)); 55 static void cs_init __ARGS((void));
56 static void clear_csinfo __ARGS((int i)); 56 static void clear_csinfo __ARGS((int i));
57 static int cs_insert_filelist __ARGS((char *, char *, char *, 57 static int cs_insert_filelist __ARGS((char *, char *, char *,
58 struct stat *)); 58 struct stat *));
181 switch (p_csto) 181 switch (p_csto)
182 { 182 {
183 case 0 : 183 case 0 :
184 if (cs_check_for_connections()) 184 if (cs_check_for_connections())
185 { 185 {
186 ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE); 186 ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE,
187 FALSE);
187 if (ret == FALSE) 188 if (ret == FALSE)
188 { 189 {
189 cs_free_tags(); 190 cs_free_tags();
190 if (msg_col) 191 if (msg_col)
191 msg_putchar('\n'); 192 msg_putchar('\n');
209 msg_putchar('\n'); 210 msg_putchar('\n');
210 211
211 if (cs_check_for_connections()) 212 if (cs_check_for_connections())
212 { 213 {
213 ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, 214 ret = cs_find_common("g", (char *)(eap->arg), eap->forceit,
214 FALSE); 215 FALSE, FALSE);
215 if (ret == FALSE) 216 if (ret == FALSE)
216 cs_free_tags(); 217 cs_free_tags();
217 } 218 }
218 } 219 }
219 } 220 }
220 else if (cs_check_for_connections()) 221 else if (cs_check_for_connections())
221 { 222 {
222 ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE); 223 ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE,
224 FALSE);
223 if (ret == FALSE) 225 if (ret == FALSE)
224 cs_free_tags(); 226 cs_free_tags();
225 } 227 }
226 break; 228 break;
227 default : 229 default :
965 { 967 {
966 cs_usage_msg(Find); 968 cs_usage_msg(Find);
967 return FALSE; 969 return FALSE;
968 } 970 }
969 971
970 return cs_find_common(opt, pat, eap->forceit, TRUE); 972 return cs_find_common(opt, pat, eap->forceit, TRUE,
973 eap->cmdidx == CMD_lcscope);
971 } /* cs_find */ 974 } /* cs_find */
972 975
973 976
974 /* 977 /*
975 * PRIVATE: cs_find_common 978 * PRIVATE: cs_find_common
976 * 979 *
977 * common code for cscope find, shared by cs_find() and do_cstag() 980 * common code for cscope find, shared by cs_find() and do_cstag()
978 */ 981 */
979 static int 982 static int
980 cs_find_common(opt, pat, forceit, verbose) 983 cs_find_common(opt, pat, forceit, verbose, use_ll)
981 char *opt; 984 char *opt;
982 char *pat; 985 char *pat;
983 int forceit; 986 int forceit;
984 int verbose; 987 int verbose;
988 int use_ll;
985 { 989 {
986 int i; 990 int i;
987 char *cmd; 991 char *cmd;
988 char **matches, **contexts; 992 char **matches, **contexts;
989 int nummatches[CSCOPE_MAX_CONNECTIONS], totmatches, matched; 993 int nummatches[CSCOPE_MAX_CONNECTIONS], totmatches, matched;
1097 if (qfpos != NULL && *qfpos != '0' && totmatches > 0) 1101 if (qfpos != NULL && *qfpos != '0' && totmatches > 0)
1098 { 1102 {
1099 /* fill error list */ 1103 /* fill error list */
1100 FILE *f; 1104 FILE *f;
1101 char_u *tmp = vim_tempname('c'); 1105 char_u *tmp = vim_tempname('c');
1106 qf_info_T *qi = NULL;
1107 win_T *wp = NULL;
1102 1108
1103 f = mch_fopen((char *)tmp, "w"); 1109 f = mch_fopen((char *)tmp, "w");
1104 cs_file_results(f, nummatches); 1110 cs_file_results(f, nummatches);
1105 fclose(f); 1111 fclose(f);
1112 if (use_ll) /* Use location list */
1113 wp = curwin;
1106 /* '-' starts a new error list */ 1114 /* '-' starts a new error list */
1107 if (qf_init(NULL, tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0) 1115 if (qf_init(wp, tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0)
1108 { 1116 {
1109 # ifdef FEAT_WINDOWS 1117 # ifdef FEAT_WINDOWS
1110 if (postponed_split != 0) 1118 if (postponed_split != 0)
1111 { 1119 {
1112 win_split(postponed_split > 0 ? postponed_split : 0, 1120 win_split(postponed_split > 0 ? postponed_split : 0,
1115 curwin->w_p_scb = FALSE; 1123 curwin->w_p_scb = FALSE;
1116 # endif 1124 # endif
1117 postponed_split = 0; 1125 postponed_split = 0;
1118 } 1126 }
1119 # endif 1127 # endif
1120 qf_jump(NULL, 0, 0, forceit); 1128 if (use_ll)
1129 /*
1130 * In the location list window, use the displayed location
1131 * list. Otherwise, use the location list for the window.
1132 */
1133 qi = (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) ?
1134 wp->w_llist_ref : wp->w_llist;
1135 qf_jump(qi, 0, 0, forceit);
1121 } 1136 }
1122 mch_remove(tmp); 1137 mch_remove(tmp);
1123 vim_free(tmp); 1138 vim_free(tmp);
1124 return TRUE; 1139 return TRUE;
1125 } 1140 }