diff options
author | ZyX <kp-pav@ya.ru> | 2014-05-10 17:24:13 +0400 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-02 11:04:17 -0300 |
commit | 70929f7e1616bab2783cc5735c6061981cda8a0f (patch) | |
tree | 4a947af96fa0bac749f843a41e7b6593dd2659c0 /src/nvim/eval.c | |
parent | 880957ad4e3fc0ff681025f5e29c5eccf797c564 (diff) | |
download | rneovim-70929f7e1616bab2783cc5735c6061981cda8a0f.tar.gz rneovim-70929f7e1616bab2783cc5735c6061981cda8a0f.tar.bz2 rneovim-70929f7e1616bab2783cc5735c6061981cda8a0f.zip |
Add automatic generation of headers
- The 'stripdecls.py' script replaces declarations in all headers by includes to
generated headers.
`ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI
This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.
Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 523 |
1 files changed, 26 insertions, 497 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index db57f73a1f..7215052a9f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -305,6 +305,14 @@ typedef struct { dictitem_T *fd_di; /* Dictionary item used */ } funcdict_T; +/* + * enum used by var_flavour() + */ +typedef enum { + VAR_FLAVOUR_DEFAULT, /* doesn't start with uppercase */ + VAR_FLAVOUR_SESSION, /* starts with uppercase, some lower */ + VAR_FLAVOUR_VIMINFO /* all uppercase */ +} var_flavour_T; /* * Array to hold the value of v: variables. @@ -404,457 +412,16 @@ static struct vimvar { static dictitem_T vimvars_var; /* variable used for v: */ #define vimvarht vimvardict.dv_hashtab -static void on_job_stdout(RStream *rstream, void *data, bool eof); -static void on_job_stderr(RStream *rstream, void *data, bool eof); -static void on_job_exit(Job *job, void *data); -static void on_job_data(RStream *rstream, void *data, bool eof, char *type); -static void apply_job_autocmds(Job *job, char *name, char *type, char *str); -static void prepare_vimvar(int idx, typval_T *save_tv); -static void restore_vimvar(int idx, typval_T *save_tv); -static int ex_let_vars(char_u *arg, typval_T *tv, int copy, - int semicolon, int var_count, - char_u *nextchars); -static char_u *skip_var_list(char_u *arg, int *var_count, - int *semicolon); -static char_u *skip_var_one(char_u *arg); -static void list_hashtable_vars(hashtab_T *ht, char_u *prefix, - int empty, - int *first); -static void list_glob_vars(int *first); -static void list_buf_vars(int *first); -static void list_win_vars(int *first); -static void list_tab_vars(int *first); -static void list_vim_vars(int *first); -static void list_script_vars(int *first); -static void list_func_vars(int *first); -static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first); -static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, - char_u *endchars, char_u *op); -static int check_changedtick(char_u *arg); -static char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp, - int unlet, int skip, int flags, - int fne_flags); -static void clear_lval(lval_T *lp); -static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, - int copy, - char_u *op); -static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op); -static void list_fix_watch(list_T *l, listitem_T *item); -static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep); -static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit); -static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock); -static void item_lock(typval_T *tv, int deep, int lock); -static int tv_islocked(typval_T *tv); - -static int eval0(char_u *arg, typval_T *rettv, char_u **nextcmd, - int evaluate); -static int eval1(char_u **arg, typval_T *rettv, int evaluate); -static int eval2(char_u **arg, typval_T *rettv, int evaluate); -static int eval3(char_u **arg, typval_T *rettv, int evaluate); -static int eval4(char_u **arg, typval_T *rettv, int evaluate); -static int eval5(char_u **arg, typval_T *rettv, int evaluate); -static int eval6(char_u **arg, typval_T *rettv, int evaluate, - int want_string); -static int eval7(char_u **arg, typval_T *rettv, int evaluate, - int want_string); - -static int eval_index(char_u **arg, typval_T *rettv, int evaluate, - int verbose); -static int get_option_tv(char_u **arg, typval_T *rettv, int evaluate); -static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate); -static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate); -static int get_list_tv(char_u **arg, typval_T *rettv, int evaluate); -static void rettv_list_alloc(typval_T *rettv); -static long list_len(list_T *l); -static int list_equal(list_T *l1, list_T *l2, int ic, int recursive); -static int dict_equal(dict_T *d1, dict_T *d2, int ic, int recursive); -static int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive); -static long list_find_nr(list_T *l, long idx, int *errorp); -static long list_idx_of_item(list_T *l, listitem_T *item); -static void list_append_number(list_T *l, varnumber_T n); -static int list_extend(list_T *l1, list_T *l2, listitem_T *bef); -static int list_concat(list_T *l1, list_T *l2, typval_T *tv); -static list_T *list_copy(list_T *orig, int deep, int copyID); -static char_u *list2string(typval_T *tv, int copyID); -static int list_join_inner(garray_T *gap, list_T *l, char_u *sep, - int echo_style, int copyID, - garray_T *join_gap); -static int list_join(garray_T *gap, list_T *l, char_u *sep, int echo, - int copyID); -static int free_unref_items(int copyID); -static int rettv_dict_alloc(typval_T *rettv); -static dictitem_T *dictitem_copy(dictitem_T *org); -static void dictitem_remove(dict_T *dict, dictitem_T *item); -static dict_T *dict_copy(dict_T *orig, int deep, int copyID); -static long dict_len(dict_T *d); -static char_u *dict2string(typval_T *tv, int copyID); -static int get_dict_tv(char_u **arg, typval_T *rettv, int evaluate); -static char_u *echo_string(typval_T *tv, char_u **tofree, - char_u *numbuf, - int copyID); -static char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, - int copyID); -static char_u *string_quote(char_u *str, int function); -static int string2float(char_u *text, float_T *value); -static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate); -static int find_internal_func(char_u *name); -static char_u *deref_func_name(char_u *name, int *lenp, int no_autoload); -static int get_func_tv(char_u *name, int len, typval_T *rettv, - char_u **arg, linenr_T firstline, linenr_T lastline, - int *doesrange, int evaluate, - dict_T *selfdict); -static int call_func(char_u *funcname, int len, typval_T *rettv, - int argcount, typval_T *argvars, - linenr_T firstline, linenr_T lastline, - int *doesrange, int evaluate, - dict_T *selfdict); -static void emsg_funcname(char *ermsg, char_u *name); -static int non_zero_arg(typval_T *argvars); - -static void f_abs(typval_T *argvars, typval_T *rettv); -static void f_acos(typval_T *argvars, typval_T *rettv); -static void f_add(typval_T *argvars, typval_T *rettv); -static void f_and(typval_T *argvars, typval_T *rettv); -static void f_append(typval_T *argvars, typval_T *rettv); -static void f_argc(typval_T *argvars, typval_T *rettv); -static void f_argidx(typval_T *argvars, typval_T *rettv); -static void f_argv(typval_T *argvars, typval_T *rettv); -static void f_asin(typval_T *argvars, typval_T *rettv); -static void f_atan(typval_T *argvars, typval_T *rettv); -static void f_atan2(typval_T *argvars, typval_T *rettv); -static void f_browse(typval_T *argvars, typval_T *rettv); -static void f_browsedir(typval_T *argvars, typval_T *rettv); -static void f_bufexists(typval_T *argvars, typval_T *rettv); -static void f_buflisted(typval_T *argvars, typval_T *rettv); -static void f_bufloaded(typval_T *argvars, typval_T *rettv); -static void f_bufname(typval_T *argvars, typval_T *rettv); -static void f_bufnr(typval_T *argvars, typval_T *rettv); -static void f_bufwinnr(typval_T *argvars, typval_T *rettv); -static void f_byte2line(typval_T *argvars, typval_T *rettv); -static void byteidx(typval_T *argvars, typval_T *rettv, int comp); -static void f_byteidx(typval_T *argvars, typval_T *rettv); -static void f_byteidxcomp(typval_T *argvars, typval_T *rettv); -static void f_call(typval_T *argvars, typval_T *rettv); -static void f_ceil(typval_T *argvars, typval_T *rettv); -static void f_changenr(typval_T *argvars, typval_T *rettv); -static void f_char2nr(typval_T *argvars, typval_T *rettv); -static void f_cindent(typval_T *argvars, typval_T *rettv); -static void f_clearmatches(typval_T *argvars, typval_T *rettv); -static void f_col(typval_T *argvars, typval_T *rettv); -static void f_complete(typval_T *argvars, typval_T *rettv); -static void f_complete_add(typval_T *argvars, typval_T *rettv); -static void f_complete_check(typval_T *argvars, typval_T *rettv); -static void f_confirm(typval_T *argvars, typval_T *rettv); -static void f_copy(typval_T *argvars, typval_T *rettv); -static void f_cos(typval_T *argvars, typval_T *rettv); -static void f_cosh(typval_T *argvars, typval_T *rettv); -static void f_count(typval_T *argvars, typval_T *rettv); -static void f_cscope_connection(typval_T *argvars, typval_T *rettv); -static void f_cursor(typval_T *argsvars, typval_T *rettv); -static void f_deepcopy(typval_T *argvars, typval_T *rettv); -static void f_delete(typval_T *argvars, typval_T *rettv); -static void f_did_filetype(typval_T *argvars, typval_T *rettv); -static void f_diff_filler(typval_T *argvars, typval_T *rettv); -static void f_diff_hlID(typval_T *argvars, typval_T *rettv); -static void f_empty(typval_T *argvars, typval_T *rettv); -static void f_escape(typval_T *argvars, typval_T *rettv); -static void f_eval(typval_T *argvars, typval_T *rettv); -static void f_eventhandler(typval_T *argvars, typval_T *rettv); -static void f_executable(typval_T *argvars, typval_T *rettv); -static void f_exists(typval_T *argvars, typval_T *rettv); -static void f_exp(typval_T *argvars, typval_T *rettv); -static void f_expand(typval_T *argvars, typval_T *rettv); -static void f_extend(typval_T *argvars, typval_T *rettv); -static void f_feedkeys(typval_T *argvars, typval_T *rettv); -static void f_filereadable(typval_T *argvars, typval_T *rettv); -static void f_filewritable(typval_T *argvars, typval_T *rettv); -static void f_filter(typval_T *argvars, typval_T *rettv); -static void f_finddir(typval_T *argvars, typval_T *rettv); -static void f_findfile(typval_T *argvars, typval_T *rettv); -static void f_float2nr(typval_T *argvars, typval_T *rettv); -static void f_floor(typval_T *argvars, typval_T *rettv); -static void f_fmod(typval_T *argvars, typval_T *rettv); -static void f_fnameescape(typval_T *argvars, typval_T *rettv); -static void f_fnamemodify(typval_T *argvars, typval_T *rettv); -static void f_foldclosed(typval_T *argvars, typval_T *rettv); -static void f_foldclosedend(typval_T *argvars, typval_T *rettv); -static void f_foldlevel(typval_T *argvars, typval_T *rettv); -static void f_foldtext(typval_T *argvars, typval_T *rettv); -static void f_foldtextresult(typval_T *argvars, typval_T *rettv); -static void f_foreground(typval_T *argvars, typval_T *rettv); -static void f_function(typval_T *argvars, typval_T *rettv); -static void f_garbagecollect(typval_T *argvars, typval_T *rettv); -static void f_get(typval_T *argvars, typval_T *rettv); -static void f_getbufline(typval_T *argvars, typval_T *rettv); -static void f_getbufvar(typval_T *argvars, typval_T *rettv); -static void f_getchar(typval_T *argvars, typval_T *rettv); -static void f_getcharmod(typval_T *argvars, typval_T *rettv); -static void f_getcmdline(typval_T *argvars, typval_T *rettv); -static void f_getcmdpos(typval_T *argvars, typval_T *rettv); -static void f_getcmdtype(typval_T *argvars, typval_T *rettv); -static void f_getcwd(typval_T *argvars, typval_T *rettv); -static void f_getfontname(typval_T *argvars, typval_T *rettv); -static void f_getfperm(typval_T *argvars, typval_T *rettv); -static void f_getfsize(typval_T *argvars, typval_T *rettv); -static void f_getftime(typval_T *argvars, typval_T *rettv); -static void f_getftype(typval_T *argvars, typval_T *rettv); -static void f_getline(typval_T *argvars, typval_T *rettv); -static void f_getmatches(typval_T *argvars, typval_T *rettv); -static void f_getpid(typval_T *argvars, typval_T *rettv); -static void f_getpos(typval_T *argvars, typval_T *rettv); -static void f_getqflist(typval_T *argvars, typval_T *rettv); -static void f_getreg(typval_T *argvars, typval_T *rettv); -static void f_getregtype(typval_T *argvars, typval_T *rettv); -static void f_gettabvar(typval_T *argvars, typval_T *rettv); -static void f_gettabwinvar(typval_T *argvars, typval_T *rettv); -static void f_getwinposx(typval_T *argvars, typval_T *rettv); -static void f_getwinposy(typval_T *argvars, typval_T *rettv); -static void f_getwinvar(typval_T *argvars, typval_T *rettv); -static void f_glob(typval_T *argvars, typval_T *rettv); -static void f_globpath(typval_T *argvars, typval_T *rettv); -static void f_has(typval_T *argvars, typval_T *rettv); -static void f_has_key(typval_T *argvars, typval_T *rettv); -static void f_haslocaldir(typval_T *argvars, typval_T *rettv); -static void f_hasmapto(typval_T *argvars, typval_T *rettv); -static void f_histadd(typval_T *argvars, typval_T *rettv); -static void f_histdel(typval_T *argvars, typval_T *rettv); -static void f_histget(typval_T *argvars, typval_T *rettv); -static void f_histnr(typval_T *argvars, typval_T *rettv); -static void f_hlID(typval_T *argvars, typval_T *rettv); -static void f_hlexists(typval_T *argvars, typval_T *rettv); -static void f_hostname(typval_T *argvars, typval_T *rettv); -static void f_iconv(typval_T *argvars, typval_T *rettv); -static void f_indent(typval_T *argvars, typval_T *rettv); -static void f_index(typval_T *argvars, typval_T *rettv); -static void f_input(typval_T *argvars, typval_T *rettv); -static void f_inputdialog(typval_T *argvars, typval_T *rettv); -static void f_inputlist(typval_T *argvars, typval_T *rettv); -static void f_inputrestore(typval_T *argvars, typval_T *rettv); -static void f_inputsave(typval_T *argvars, typval_T *rettv); -static void f_inputsecret(typval_T *argvars, typval_T *rettv); -static void f_insert(typval_T *argvars, typval_T *rettv); -static void f_invert(typval_T *argvars, typval_T *rettv); -static void f_isdirectory(typval_T *argvars, typval_T *rettv); -static void f_islocked(typval_T *argvars, typval_T *rettv); -static void f_items(typval_T *argvars, typval_T *rettv); -static void f_job_start(typval_T *argvars, typval_T *rettv); -static void f_job_stop(typval_T *argvars, typval_T *rettv); -static void f_job_write(typval_T *argvars, typval_T *rettv); -static void f_join(typval_T *argvars, typval_T *rettv); -static void f_keys(typval_T *argvars, typval_T *rettv); -static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv); -static void f_len(typval_T *argvars, typval_T *rettv); -static void f_libcall(typval_T *argvars, typval_T *rettv); -static void f_libcallnr(typval_T *argvars, typval_T *rettv); -static void f_line(typval_T *argvars, typval_T *rettv); -static void f_line2byte(typval_T *argvars, typval_T *rettv); -static void f_lispindent(typval_T *argvars, typval_T *rettv); -static void f_localtime(typval_T *argvars, typval_T *rettv); -static void f_log(typval_T *argvars, typval_T *rettv); -static void f_log10(typval_T *argvars, typval_T *rettv); -static void f_map(typval_T *argvars, typval_T *rettv); -static void f_maparg(typval_T *argvars, typval_T *rettv); -static void f_mapcheck(typval_T *argvars, typval_T *rettv); -static void f_match(typval_T *argvars, typval_T *rettv); -static void f_matchadd(typval_T *argvars, typval_T *rettv); -static void f_matcharg(typval_T *argvars, typval_T *rettv); -static void f_matchdelete(typval_T *argvars, typval_T *rettv); -static void f_matchend(typval_T *argvars, typval_T *rettv); -static void f_matchlist(typval_T *argvars, typval_T *rettv); -static void f_matchstr(typval_T *argvars, typval_T *rettv); -static void f_max(typval_T *argvars, typval_T *rettv); -static void f_min(typval_T *argvars, typval_T *rettv); -static void f_mkdir(typval_T *argvars, typval_T *rettv); -static void f_mode(typval_T *argvars, typval_T *rettv); -static void f_nextnonblank(typval_T *argvars, typval_T *rettv); -static void f_nr2char(typval_T *argvars, typval_T *rettv); -static void f_or(typval_T *argvars, typval_T *rettv); -static void f_pathshorten(typval_T *argvars, typval_T *rettv); -static void f_pow(typval_T *argvars, typval_T *rettv); -static void f_prevnonblank(typval_T *argvars, typval_T *rettv); -static void f_printf(typval_T *argvars, typval_T *rettv); -static void f_pumvisible(typval_T *argvars, typval_T *rettv); -static void f_range(typval_T *argvars, typval_T *rettv); -static void f_readfile(typval_T *argvars, typval_T *rettv); -static void f_reltime(typval_T *argvars, typval_T *rettv); -static void f_reltimestr(typval_T *argvars, typval_T *rettv); -static void f_remove(typval_T *argvars, typval_T *rettv); -static void f_rename(typval_T *argvars, typval_T *rettv); -static void f_repeat(typval_T *argvars, typval_T *rettv); -static void f_resolve(typval_T *argvars, typval_T *rettv); -static void f_reverse(typval_T *argvars, typval_T *rettv); -static void f_round(typval_T *argvars, typval_T *rettv); -static void f_screenattr(typval_T *argvars, typval_T *rettv); -static void f_screenchar(typval_T *argvars, typval_T *rettv); -static void f_screencol(typval_T *argvars, typval_T *rettv); -static void f_screenrow(typval_T *argvars, typval_T *rettv); -static void f_search(typval_T *argvars, typval_T *rettv); -static void f_searchdecl(typval_T *argvars, typval_T *rettv); -static void f_searchpair(typval_T *argvars, typval_T *rettv); -static void f_searchpairpos(typval_T *argvars, typval_T *rettv); -static void f_searchpos(typval_T *argvars, typval_T *rettv); -static void f_send_event(typval_T *argvars, typval_T *rettv); -static void f_setbufvar(typval_T *argvars, typval_T *rettv); -static void f_setcmdpos(typval_T *argvars, typval_T *rettv); -static void f_setline(typval_T *argvars, typval_T *rettv); -static void f_setloclist(typval_T *argvars, typval_T *rettv); -static void f_setmatches(typval_T *argvars, typval_T *rettv); -static void f_setpos(typval_T *argvars, typval_T *rettv); -static void f_setqflist(typval_T *argvars, typval_T *rettv); -static void f_setreg(typval_T *argvars, typval_T *rettv); -static void f_settabvar(typval_T *argvars, typval_T *rettv); -static void f_settabwinvar(typval_T *argvars, typval_T *rettv); -static void f_setwinvar(typval_T *argvars, typval_T *rettv); -static void f_shellescape(typval_T *argvars, typval_T *rettv); -static void f_shiftwidth(typval_T *argvars, typval_T *rettv); -static void f_simplify(typval_T *argvars, typval_T *rettv); -static void f_sin(typval_T *argvars, typval_T *rettv); -static void f_sinh(typval_T *argvars, typval_T *rettv); -static void f_sort(typval_T *argvars, typval_T *rettv); -static void f_soundfold(typval_T *argvars, typval_T *rettv); -static void f_spellbadword(typval_T *argvars, typval_T *rettv); -static void f_spellsuggest(typval_T *argvars, typval_T *rettv); -static void f_split(typval_T *argvars, typval_T *rettv); -static void f_sqrt(typval_T *argvars, typval_T *rettv); -static void f_str2float(typval_T *argvars, typval_T *rettv); -static void f_str2nr(typval_T *argvars, typval_T *rettv); -static void f_strchars(typval_T *argvars, typval_T *rettv); -static void f_strftime(typval_T *argvars, typval_T *rettv); -static void f_stridx(typval_T *argvars, typval_T *rettv); -static void f_string(typval_T *argvars, typval_T *rettv); -static void f_strlen(typval_T *argvars, typval_T *rettv); -static void f_strpart(typval_T *argvars, typval_T *rettv); -static void f_strridx(typval_T *argvars, typval_T *rettv); -static void f_strtrans(typval_T *argvars, typval_T *rettv); -static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv); -static void f_strwidth(typval_T *argvars, typval_T *rettv); -static void f_submatch(typval_T *argvars, typval_T *rettv); -static void f_substitute(typval_T *argvars, typval_T *rettv); -static void f_synID(typval_T *argvars, typval_T *rettv); -static void f_synIDattr(typval_T *argvars, typval_T *rettv); -static void f_synIDtrans(typval_T *argvars, typval_T *rettv); -static void f_synstack(typval_T *argvars, typval_T *rettv); -static void f_synconcealed(typval_T *argvars, typval_T *rettv); -static void f_system(typval_T *argvars, typval_T *rettv); -static void f_tabpagebuflist(typval_T *argvars, typval_T *rettv); -static void f_tabpagenr(typval_T *argvars, typval_T *rettv); -static void f_tabpagewinnr(typval_T *argvars, typval_T *rettv); -static void f_taglist(typval_T *argvars, typval_T *rettv); -static void f_tagfiles(typval_T *argvars, typval_T *rettv); -static void f_tempname(typval_T *argvars, typval_T *rettv); -static void f_test(typval_T *argvars, typval_T *rettv); -static void f_tan(typval_T *argvars, typval_T *rettv); -static void f_tanh(typval_T *argvars, typval_T *rettv); -static void f_tolower(typval_T *argvars, typval_T *rettv); -static void f_toupper(typval_T *argvars, typval_T *rettv); -static void f_tr(typval_T *argvars, typval_T *rettv); -static void f_trunc(typval_T *argvars, typval_T *rettv); -static void f_type(typval_T *argvars, typval_T *rettv); -static void f_undofile(typval_T *argvars, typval_T *rettv); -static void f_undotree(typval_T *argvars, typval_T *rettv); -static void f_uniq(typval_T *argvars, typval_T *rettv); -static void f_values(typval_T *argvars, typval_T *rettv); -static void f_virtcol(typval_T *argvars, typval_T *rettv); -static void f_visualmode(typval_T *argvars, typval_T *rettv); -static void f_wildmenumode(typval_T *argvars, typval_T *rettv); -static void f_winbufnr(typval_T *argvars, typval_T *rettv); -static void f_wincol(typval_T *argvars, typval_T *rettv); -static void f_winheight(typval_T *argvars, typval_T *rettv); -static void f_winline(typval_T *argvars, typval_T *rettv); -static void f_winnr(typval_T *argvars, typval_T *rettv); -static void f_winrestcmd(typval_T *argvars, typval_T *rettv); -static void f_winrestview(typval_T *argvars, typval_T *rettv); -static void f_winsaveview(typval_T *argvars, typval_T *rettv); -static void f_winwidth(typval_T *argvars, typval_T *rettv); -static void f_writefile(typval_T *argvars, typval_T *rettv); -static void f_xor(typval_T *argvars, typval_T *rettv); - -static int list2fpos(typval_T *arg, pos_T *posp, int *fnump); -static pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum); -static int get_env_len(char_u **arg); -static int get_id_len(char_u **arg); -static int get_name_len(char_u **arg, char_u **alias, int evaluate, - int verbose); -static char_u *find_name_end(char_u *arg, char_u **expr_start, char_u * - *expr_end, - int flags); +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "eval.c.generated.h" +#endif + + + + #define FNE_INCL_BR 1 /* find_name_end(): include [] in name */ #define FNE_CHECK_START 2 /* find_name_end(): check name starts with valid character */ -static char_u * -make_expanded_name(char_u *in_start, char_u *expr_start, char_u * - expr_end, - char_u *in_end); -static int eval_isnamec(int c); -static int eval_isnamec1(int c); -static int get_var_tv(char_u *name, int len, typval_T *rettv, - int verbose, - int no_autoload); -static int handle_subscript(char_u **arg, typval_T *rettv, int evaluate, - int verbose); -static void init_tv(typval_T *varp); -static long get_tv_number(typval_T *varp); -static linenr_T get_tv_lnum(typval_T *argvars); -static linenr_T get_tv_lnum_buf(typval_T *argvars, buf_T *buf); -static char_u *get_tv_string(typval_T *varp); -static char_u *get_tv_string_buf(typval_T *varp, char_u *buf); -static char_u *get_tv_string_buf_chk(typval_T *varp, char_u *buf); -static dictitem_T *find_var(char_u *name, hashtab_T **htp, - int no_autoload); -static dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, - char_u *varname, - int no_autoload); -static hashtab_T *find_var_ht(char_u *name, char_u **varname); -static void vars_clear_ext(hashtab_T *ht, int free_val); -static void delete_var(hashtab_T *ht, hashitem_T *hi); -static void list_one_var(dictitem_T *v, char_u *prefix, int *first); -static void list_one_var_a(char_u *prefix, char_u *name, int type, - char_u *string, - int *first); -static void set_var(char_u *name, typval_T *varp, int copy); -static int var_check_ro(int flags, char_u *name); -static int var_check_fixed(int flags, char_u *name); -static int var_check_func_name(char_u *name, int new_var); -static int valid_varname(char_u *varname); -static int tv_check_lock(int lock, char_u *name); -static int item_copy(typval_T *from, typval_T *to, int deep, int copyID); -static char_u *find_option_end(char_u **arg, int *opt_flags); -static char_u *trans_function_name(char_u **pp, int skip, int flags, - funcdict_T *fd); -static int eval_fname_script(char_u *p); -static int eval_fname_sid(char_u *p); -static void list_func_head(ufunc_T *fp, int indent); -static ufunc_T *find_func(char_u *name); -static int function_exists(char_u *name); -static bool builtin_function(char_u *name, int len); -static void func_do_profile(ufunc_T *fp); -static void prof_sort_list(FILE *fd, ufunc_T **sorttab, int st_len, - char *title, - int prefer_self); -static void prof_func_line(FILE *fd, int count, proftime_T *total, - proftime_T *self, - int prefer_self); -static int -prof_total_cmp(const void *s1, const void *s2); -static int -prof_self_cmp(const void *s1, const void *s2); -static int script_autoload(char_u *name, int reload); -static char_u *autoload_name(char_u *name); -static void cat_func_name(char_u *buf, ufunc_T *fp); -static void func_free(ufunc_T *fp); -static void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, - typval_T *rettv, linenr_T firstline, - linenr_T lastline, - dict_T *selfdict); -static int can_free_funccal(funccall_T *fc, int copyID); -static void free_funccal(funccall_T *fc, int free_val); -static void add_nr_var(dict_T *dp, dictitem_T *v, char *name, - varnumber_T nr); -static win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp); -static void getwinvar(typval_T *argvars, typval_T *rettv, int off); -static int searchpair_cmn(typval_T *argvars, pos_T *match_pos); -static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp); -static void setwinvar(typval_T *argvars, typval_T *rettv, int off); @@ -1627,8 +1194,8 @@ void restore_funccal(void *vfc) * counted for the script/function itself. * Should always be called in pair with prof_child_exit(). */ -void prof_child_enter(tm) -proftime_T *tm; /* place to store waittime */ +void prof_child_enter(proftime_T *tm /* place to store waittime */ + ) { funccall_T *fc = current_funccal; @@ -1641,8 +1208,8 @@ proftime_T *tm; /* place to store waittime */ * Take care of time spent in a child. * Should always be called after prof_child_enter(). */ -void prof_child_exit(tm) -proftime_T *tm; /* where waittime was stored */ +void prof_child_exit(proftime_T *tm /* where waittime was stored */ + ) { funccall_T *fc = current_funccal; @@ -3406,7 +2973,6 @@ void del_menutrans_vars(void) * get_user_var_name(). */ -static char_u *cat_prefix_varname(int prefix, char_u *name); static char_u *varnamebuf = NULL; static size_t varnamebuflen = 0; @@ -7416,7 +6982,6 @@ static int non_zero_arg(typval_T *argvars) * Implementation of the built-in functions */ -static int get_float_arg(typval_T *argvars, float_T *f); /* * Get the float value of "argvars[0]" into "f". @@ -7653,7 +7218,6 @@ static void f_browsedir(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; } -static buf_T *find_buffer(typval_T *avar); /* * Find a buffer by number or exact name. @@ -7711,7 +7275,6 @@ static void f_bufloaded(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = (buf != NULL && buf->b_ml.ml_mfp != NULL); } -static buf_T *get_buf_tv(typval_T *tv, int curtab_only); /* * Get buffer by number or pattern. @@ -8814,8 +8377,6 @@ static void f_filewritable(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = os_file_is_writable(filename); } -static void findfilendir(typval_T *argvars, typval_T *rettv, - int find_what); static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what) { @@ -8873,8 +8434,6 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what) rettv->vval.v_string = fresult; } -static void filter_map(typval_T *argvars, typval_T *rettv, int map); -static int filter_map_one(typval_T *tv, char_u *expr, int map, int *remp); /* * Implementation of map() and filter(). @@ -9120,7 +8679,6 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv) free(fbuf); } -static void foldclosed_both(typval_T *argvars, typval_T *rettv, int end); /* * "foldclosed()" function @@ -9338,9 +8896,6 @@ static void f_get(typval_T *argvars, typval_T *rettv) copy_tv(tv, rettv); } -static void get_buffer_lines(buf_T *buf, linenr_T start, linenr_T end, - int retlist, - typval_T *rettv); /* * Get line or list of lines from buffer "buf" into "rettv". @@ -10542,8 +10097,6 @@ static void f_index(typval_T *argvars, typval_T *rettv) static int inputsecret_flag = 0; -static void get_user_input(typval_T *argvars, typval_T *rettv, - int inputdialog); /* * This function is used by f_input() and f_inputdialog() functions. The third @@ -10835,7 +10388,6 @@ static void f_islocked(typval_T *argvars, typval_T *rettv) clear_lval(&lv); } -static void dict_list(typval_T *argvars, typval_T *rettv, int what); /* * Turn a dict into a list: @@ -11124,7 +10676,6 @@ static void f_len(typval_T *argvars, typval_T *rettv) } } -static void libcall_common(typval_T *argvars, typval_T *rettv, int type); static void libcall_common(typval_T *argvars, typval_T *rettv, int type) { @@ -11236,7 +10787,6 @@ static void f_localtime(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = (varnumber_T)time(NULL); } -static void get_maparg(typval_T *argvars, typval_T *rettv, int exact); static void get_maparg(typval_T *argvars, typval_T *rettv, int exact) { @@ -11356,7 +10906,6 @@ static void f_mapcheck(typval_T *argvars, typval_T *rettv) get_maparg(argvars, rettv, FALSE); } -static void find_some_match(typval_T *argvars, typval_T *rettv, int start); static void find_some_match(typval_T *argvars, typval_T *rettv, int type) { @@ -11608,7 +11157,6 @@ static void f_matchstr(typval_T *argvars, typval_T *rettv) find_some_match(argvars, rettv, 2); } -static void max_min(typval_T *argvars, typval_T *rettv, int domax); static void max_min(typval_T *argvars, typval_T *rettv, int domax) { @@ -11677,7 +11225,6 @@ static void f_min(typval_T *argvars, typval_T *rettv) max_min(argvars, rettv, FALSE); } -static int mkdir_recurse(char_u *dir, int prot); /* * Create the directory in which "dir" is located, and higher levels when @@ -12142,7 +11689,6 @@ static void f_readfile(typval_T *argvars, typval_T *rettv) fclose(fd); } -static int list2proftime(typval_T *arg, proftime_T *tm); /* * Convert a List to proftime_T. @@ -12556,7 +12102,6 @@ static void f_reverse(typval_T *argvars, typval_T *rettv) #define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */ #define SP_END 0x40 /* leave cursor at end of match */ -static int get_search_arg(typval_T *varp, int *flagsp); /* * Get flags for a search function. @@ -13228,9 +12773,6 @@ static void f_setline(typval_T *argvars, typval_T *rettv) appended_lines_mark(lcount, added); } -static void set_qf_ll_list(win_T *wp, typval_T *list_arg, - typval_T *action_arg, - typval_T *rettv); /* * Used by "setqflist()" and "setloclist()" functions @@ -13589,16 +13131,11 @@ static void f_sinh(typval_T *argvars, typval_T *rettv) rettv->vval.v_float = 0.0; } -static int -item_compare(const void *s1, const void *s2); -static int -item_compare2(const void *s1, const void *s2); static int item_compare_ic; static char_u *item_compare_func; static dict_T *item_compare_selfdict; static int item_compare_func_err; -static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort); #define ITEM_COMPARE_FAIL 999 /* @@ -14637,7 +14174,6 @@ static void f_tabpagenr(typval_T *argvars, typval_T *rettv) } -static int get_winnr(tabpage_T *tp, typval_T *argvar); /* * Common code for tabpagewinnr() and winnr(). @@ -18088,12 +17624,13 @@ prof_sort_list ( /* * Print the count and times for one function or function line. */ -static void prof_func_line(fd, count, total, self, prefer_self) -FILE *fd; -int count; -proftime_T *total; -proftime_T *self; -int prefer_self; /* when equal print only self time */ +static void prof_func_line( + FILE *fd, + int count, + proftime_T *total, + proftime_T *self, + int prefer_self /* when equal print only self time */ + ) { if (count > 0) { fprintf(fd, "%5d ", count); @@ -19020,14 +18557,6 @@ int func_has_abort(void *cookie) return ((funccall_T *)cookie)->func->uf_flags & FC_ABORT; } -typedef enum { - VAR_FLAVOUR_DEFAULT, /* doesn't start with uppercase */ - VAR_FLAVOUR_SESSION, /* starts with uppercase, some lower */ - VAR_FLAVOUR_VIMINFO /* all uppercase */ -} var_flavour_T; - -static var_flavour_T var_flavour(char_u *varname); - static var_flavour_T var_flavour(char_u *varname) { char_u *p = varname; |