Mercurial > vim
comparison src/quickfix.c @ 625:81fe2ccc1207 v7.0179
updated for version 7.0179
author | vimboss |
---|---|
date | Thu, 12 Jan 2006 23:22:24 +0000 |
parents | ec04f19aed55 |
children | 732c7ae5743e |
comparison
equal
deleted
inserted
replaced
624:91e7d4a7b3b0 | 625:81fe2ccc1207 |
---|---|
84 /* 'P' push file (partial) message */ | 84 /* 'P' push file (partial) message */ |
85 /* 'Q' pop/quit file (partial) message */ | 85 /* 'Q' pop/quit file (partial) message */ |
86 /* 'O' overread (partial) message */ | 86 /* 'O' overread (partial) message */ |
87 char_u flags; /* additional flags given in prefix */ | 87 char_u flags; /* additional flags given in prefix */ |
88 /* '-' do not include this line */ | 88 /* '-' do not include this line */ |
89 /* '+' include whole line in message */ | |
89 }; | 90 }; |
90 | 91 |
91 static int qf_init_ext __ARGS((char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast)); | 92 static int qf_init_ext __ARGS((char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast)); |
92 static void qf_new_list __ARGS((void)); | 93 static void qf_new_list __ARGS((void)); |
93 static int qf_add_entry __ARGS((qfline_T **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid)); | 94 static int qf_add_entry __ARGS((qfline_T **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid)); |
576 lnum = atol((char *)regmatch.startp[i]); | 577 lnum = atol((char *)regmatch.startp[i]); |
577 if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */ | 578 if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */ |
578 col = (int)atol((char *)regmatch.startp[i]); | 579 col = (int)atol((char *)regmatch.startp[i]); |
579 if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */ | 580 if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */ |
580 type = *regmatch.startp[i]; | 581 type = *regmatch.startp[i]; |
581 if (fmt_ptr->flags == '+' && !multiscan) /* %+ */ | 582 if (fmt_ptr->flags == '+' && !multiscan) /* %+ */ |
582 STRCPY(errmsg, IObuff); | 583 STRCPY(errmsg, IObuff); |
583 else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */ | 584 else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */ |
584 { | 585 { |
585 len = (int)(regmatch.endp[i] - regmatch.startp[i]); | 586 len = (int)(regmatch.endp[i] - regmatch.startp[i]); |
586 vim_strncpy(errmsg, regmatch.startp[i], len); | 587 vim_strncpy(errmsg, regmatch.startp[i], len); |
611 } | 612 } |
612 break; | 613 break; |
613 } | 614 } |
614 } | 615 } |
615 multiscan = FALSE; | 616 multiscan = FALSE; |
616 if (!fmt_ptr || idx == 'D' || idx == 'X') | 617 if (fmt_ptr == NULL || idx == 'D' || idx == 'X') |
617 { | 618 { |
618 if (fmt_ptr) | 619 if (fmt_ptr != NULL) |
619 { | 620 { |
620 if (idx == 'D') /* enter directory */ | 621 if (idx == 'D') /* enter directory */ |
621 { | 622 { |
622 if (*namebuf == NUL) | 623 if (*namebuf == NUL) |
623 { | 624 { |
632 } | 633 } |
633 namebuf[0] = NUL; /* no match found, remove file name */ | 634 namebuf[0] = NUL; /* no match found, remove file name */ |
634 lnum = 0; /* don't jump to this line */ | 635 lnum = 0; /* don't jump to this line */ |
635 valid = FALSE; | 636 valid = FALSE; |
636 STRCPY(errmsg, IObuff); /* copy whole line to error message */ | 637 STRCPY(errmsg, IObuff); /* copy whole line to error message */ |
637 if (!fmt_ptr) | 638 if (fmt_ptr == NULL) |
638 multiline = multiignore = FALSE; | 639 multiline = multiignore = FALSE; |
639 } | 640 } |
640 else if (fmt_ptr) | 641 else if (fmt_ptr != NULL) |
641 { | 642 { |
642 if (vim_strchr((char_u *)"AEWI", idx) != NULL) | 643 if (vim_strchr((char_u *)"AEWI", idx) != NULL) |
643 multiline = TRUE; /* start of a multi-line message */ | 644 multiline = TRUE; /* start of a multi-line message */ |
644 else if (vim_strchr((char_u *)"CZ", idx) != NULL) | 645 else if (vim_strchr((char_u *)"CZ", idx) != NULL) |
645 { /* continuation of multi-line msg */ | 646 { /* continuation of multi-line msg */ |
2745 #endif | 2746 #endif |
2746 | 2747 |
2747 /* Need to set the filename for autocommands. */ | 2748 /* Need to set the filename for autocommands. */ |
2748 (void)setfname(curbuf, fname, NULL, FALSE); | 2749 (void)setfname(curbuf, fname, NULL, FALSE); |
2749 | 2750 |
2750 if (ml_open() == OK) | 2751 if (ml_open(curbuf) == OK) |
2751 { | 2752 { |
2752 /* Create swap file now to avoid the ATTENTION message. */ | 2753 /* Create swap file now to avoid the ATTENTION message. */ |
2753 check_need_swap(TRUE); | 2754 check_need_swap(TRUE); |
2754 | 2755 |
2755 /* Remove the "dummy" flag, otherwise autocommands may not | 2756 /* Remove the "dummy" flag, otherwise autocommands may not |
2976 } | 2977 } |
2977 } | 2978 } |
2978 | 2979 |
2979 #if defined(FEAT_EVAL) || defined(PROTO) | 2980 #if defined(FEAT_EVAL) || defined(PROTO) |
2980 /* | 2981 /* |
2981 * ":cexpr {expr}" command. | 2982 * ":cexpr {expr}" and ":caddexpr {expr}" command. |
2982 */ | 2983 */ |
2983 void | 2984 void |
2984 ex_cexpr(eap) | 2985 ex_cexpr(eap) |
2985 exarg_T *eap; | 2986 exarg_T *eap; |
2986 { | 2987 { |
2987 typval_T *tv; | 2988 typval_T *tv; |
2988 | 2989 |
2990 /* Evaluate the expression. When the result is a string or a list we can | |
2991 * use it to fill the errorlist. */ | |
2989 tv = eval_expr(eap->arg, NULL); | 2992 tv = eval_expr(eap->arg, NULL); |
2990 if (!tv || (tv->v_type != VAR_STRING && tv->v_type != VAR_LIST) || | 2993 if (tv != NULL) |
2991 (tv->v_type == VAR_STRING && !tv->vval.v_string) || | 2994 { |
2992 (tv->v_type == VAR_LIST && !tv->vval.v_list)) | 2995 if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL) |
2993 return; | 2996 || (tv->v_type == VAR_LIST && tv->vval.v_list != NULL)) |
2994 | 2997 { |
2995 if (qf_init_ext(NULL, NULL, tv, p_efm, TRUE, (linenr_T)0, (linenr_T)0) > 0) | 2998 if (qf_init_ext(NULL, NULL, tv, p_efm, eap->cmdidx == CMD_cexpr, |
2996 qf_jump(0, 0, eap->forceit); /* display first error */ | 2999 (linenr_T)0, (linenr_T)0) > 0 |
2997 | 3000 && eap->cmdidx == CMD_cexpr) |
2998 clear_tv(tv); | 3001 qf_jump(0, 0, eap->forceit); /* display first error */ |
3002 } | |
3003 else | |
3004 EMSG(_("E999: String or List expected")); | |
3005 free_tv(tv); | |
3006 } | |
2999 } | 3007 } |
3000 #endif | 3008 #endif |
3001 | 3009 |
3002 /* | 3010 /* |
3003 * ":helpgrep {pattern}" | 3011 * ":helpgrep {pattern}" |