Mercurial > vim
comparison src/eval.c @ 809:4f1b94b51e99 v7.0b02
updated for version 7.0b02
author | vimboss |
---|---|
date | Sun, 26 Mar 2006 21:06:50 +0000 |
parents | d8f905020502 |
children | 1f929f3ca806 |
comparison
equal
deleted
inserted
replaced
808:111e109dad13 | 809:4f1b94b51e99 |
---|---|
8962 char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; | 8962 char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; |
8963 char_u *p; | 8963 char_u *p; |
8964 char_u pathbuf[NUMBUFLEN]; | 8964 char_u pathbuf[NUMBUFLEN]; |
8965 int count = 1; | 8965 int count = 1; |
8966 int first = TRUE; | 8966 int first = TRUE; |
8967 | 8967 int error = FALSE; |
8968 #endif | |
8969 | |
8970 rettv->vval.v_string = NULL; | |
8971 rettv->v_type = VAR_STRING; | |
8972 | |
8973 #ifdef FEAT_SEARCHPATH | |
8968 fname = get_tv_string(&argvars[0]); | 8974 fname = get_tv_string(&argvars[0]); |
8969 | 8975 |
8970 if (argvars[1].v_type != VAR_UNKNOWN) | 8976 if (argvars[1].v_type != VAR_UNKNOWN) |
8971 { | 8977 { |
8972 p = get_tv_string_buf_chk(&argvars[1], pathbuf); | 8978 p = get_tv_string_buf_chk(&argvars[1], pathbuf); |
8973 if (p == NULL) | 8979 if (p == NULL) |
8974 count = -1; /* error */ | 8980 error = TRUE; |
8975 else | 8981 else |
8976 { | 8982 { |
8977 if (*p != NUL) | 8983 if (*p != NUL) |
8978 path = p; | 8984 path = p; |
8979 | 8985 |
8980 if (argvars[2].v_type != VAR_UNKNOWN) | 8986 if (argvars[2].v_type != VAR_UNKNOWN) |
8981 count = get_tv_number_chk(&argvars[2], NULL); /* -1: error */ | 8987 count = get_tv_number_chk(&argvars[2], &error); |
8982 } | 8988 } |
8983 } | 8989 } |
8984 | 8990 |
8985 if (*fname != NUL && count >= 0) | 8991 if (count < 0 && rettv_list_alloc(rettv) == FAIL) |
8992 error = TRUE; | |
8993 | |
8994 if (*fname != NUL && !error) | |
8986 { | 8995 { |
8987 do | 8996 do |
8988 { | 8997 { |
8989 vim_free(fresult); | 8998 if (rettv->v_type == VAR_STRING) |
8999 vim_free(fresult); | |
8990 fresult = find_file_in_path_option(first ? fname : NULL, | 9000 fresult = find_file_in_path_option(first ? fname : NULL, |
8991 first ? (int)STRLEN(fname) : 0, | 9001 first ? (int)STRLEN(fname) : 0, |
8992 0, first, path, dir, NULL, | 9002 0, first, path, dir, NULL, |
8993 dir ? (char_u *)"" : curbuf->b_p_sua); | 9003 dir ? (char_u *)"" : curbuf->b_p_sua); |
8994 first = FALSE; | 9004 first = FALSE; |
8995 } while (--count > 0 && fresult != NULL); | 9005 |
8996 } | 9006 if (fresult != NULL && rettv->v_type == VAR_LIST) |
8997 | 9007 list_append_string(rettv->vval.v_list, fresult, -1); |
8998 rettv->vval.v_string = fresult; | 9008 |
8999 #else | 9009 } while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL); |
9000 rettv->vval.v_string = NULL; | 9010 } |
9001 #endif | 9011 |
9002 rettv->v_type = VAR_STRING; | 9012 if (rettv->v_type == VAR_STRING) |
9013 rettv->vval.v_string = fresult; | |
9014 #endif | |
9003 } | 9015 } |
9004 | 9016 |
9005 static void filter_map __ARGS((typval_T *argvars, typval_T *rettv, int map)); | 9017 static void filter_map __ARGS((typval_T *argvars, typval_T *rettv, int map)); |
9006 static int filter_map_one __ARGS((typval_T *tv, char_u *expr, int map, int *remp)); | 9018 static int filter_map_one __ARGS((typval_T *tv, char_u *expr, int map, int *remp)); |
9007 | 9019 |
18671 if (skip) | 18683 if (skip) |
18672 lead = 0; /* do nothing */ | 18684 lead = 0; /* do nothing */ |
18673 else if (lead > 0) | 18685 else if (lead > 0) |
18674 { | 18686 { |
18675 lead = 3; | 18687 lead = 3; |
18676 if (eval_fname_sid(*pp)) /* If it's "<SID>" */ | 18688 if (eval_fname_sid(lv.ll_exp_name != NULL ? lv.ll_exp_name : *pp)) |
18677 { | 18689 { |
18690 /* It's "s:" or "<SID>" */ | |
18678 if (current_SID <= 0) | 18691 if (current_SID <= 0) |
18679 { | 18692 { |
18680 EMSG(_(e_usingsid)); | 18693 EMSG(_(e_usingsid)); |
18681 goto theend; | 18694 goto theend; |
18682 } | 18695 } |