diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-09-05 22:14:46 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-09-05 22:14:46 +0000 |
commit | dd2436f352e51b5ee214b28cd61641c59239251a (patch) | |
tree | 268dedc3984037e37599e6446efb88753218bf38 /src | |
parent | 92d640fad1808085ca609aecac8b854a6945d7a6 (diff) | |
download | vim-git-dd2436f352e51b5ee214b28cd61641c59239251a.tar.gz |
updated for version 7.0141v7.0141
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 62 | ||||
-rw-r--r-- | src/proto/search.pro | 2 |
2 files changed, 63 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index f14a69b38..6547b46e7 100644 --- a/src/eval.c +++ b/src/eval.c @@ -580,6 +580,7 @@ static void f_repeat __ARGS((typval_T *argvars, typval_T *rettv)); static void f_resolve __ARGS((typval_T *argvars, typval_T *rettv)); static void f_reverse __ARGS((typval_T *argvars, typval_T *rettv)); static void f_search __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_searchdecl __ARGS((typval_T *argvars, typval_T *rettv)); static void f_searchpair __ARGS((typval_T *argvars, typval_T *rettv)); static void f_server2client __ARGS((typval_T *argvars, typval_T *rettv)); static void f_serverlist __ARGS((typval_T *argvars, typval_T *rettv)); @@ -6818,6 +6819,7 @@ static struct fst {"resolve", 1, 1, f_resolve}, {"reverse", 1, 1, f_reverse}, {"search", 1, 2, f_search}, + {"searchdecl", 1, 2, f_searchdecl}, {"searchpair", 3, 5, f_searchpair}, {"server2client", 2, 2, f_server2client}, {"serverlist", 0, 0, f_serverlist}, @@ -12976,6 +12978,28 @@ theend: } /* + * "searchdecl()" function + */ + static void +f_searchdecl(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + int locally = 1; + int error = FALSE; + char_u *name; + + rettv->vval.v_number = 1; /* default: FAIL */ + + name = get_tv_string_chk(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN) + locally = get_tv_number_chk(&argvars[1], &error) == 0; + if (!error && name != NULL) + rettv->vval.v_number = find_decl(name, (int)STRLEN(name), + locally, SEARCH_KEEP) == FAIL; +} + +/* * "searchpair()" function */ static void @@ -16801,6 +16825,44 @@ ex_function(eap) } /* + * ":function /pat": list functions matching pattern. + */ + if (*eap->arg == '/') + { + p = skip_regexp(eap->arg + 1, '/', TRUE, NULL); + if (!eap->skip) + { + regmatch_T regmatch; + + c = *p; + *p = NUL; + regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC); + *p = c; + if (regmatch.regprog != NULL) + { + regmatch.rm_ic = p_ic; + + todo = func_hashtab.ht_used; + for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + fp = HI2UF(hi); + if (!isdigit(*fp->uf_name) + && vim_regexec(®match, fp->uf_name, 0)) + list_func_head(fp, FALSE); + } + } + } + } + if (*p == '/') + ++p; + eap->nextcmd = check_nextcmd(p); + return; + } + + /* * Get the function name. There are these situations: * func normal function name * "name" == func, "fudi.fd_dict" == NULL diff --git a/src/proto/search.pro b/src/proto/search.pro index 8e222aa2a..62f043905 100644 --- a/src/proto/search.pro +++ b/src/proto/search.pro @@ -17,7 +17,7 @@ pos_T *findmatch __ARGS((oparg_T *oap, int initc)); pos_T *findmatchlimit __ARGS((oparg_T *oap, int initc, int flags, int maxtravel)); void showmatch __ARGS((int c)); int findsent __ARGS((int dir, long count)); -int findpar __ARGS((oparg_T *oap, int dir, long count, int what, int both)); +int findpar __ARGS((int *pincl, int dir, long count, int what, int both)); int startPS __ARGS((linenr_T lnum, int para, int both)); int fwd_word __ARGS((long count, int bigword, int eol)); int bck_word __ARGS((long count, int bigword, int stop)); |