From 367d59e6ba65cf554d167933775fa17e40dcc6a7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 May 2020 17:06:14 +0200 Subject: patch 8.2.0847: typval related code is spread out Problem: Typval related code is spread out. Solution: Move code to new typval.c file. (Yegappan Lakshmanan, closes #6093) --- src/proto/eval.pro | 22 ---------------------- src/proto/evalfunc.pro | 3 --- src/proto/typval.pro | 30 ++++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 25 deletions(-) create mode 100644 src/proto/typval.pro (limited to 'src/proto') diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 14b5f261d..983309948 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -29,13 +29,8 @@ int eval0(char_u *arg, typval_T *rettv, char_u **nextcmd, int evaluate); int eval1(char_u **arg, typval_T *rettv, int evaluate); void eval_addblob(typval_T *tv1, typval_T *tv2); int eval_addlist(typval_T *tv1, typval_T *tv2); -int get_option_tv(char_u **arg, typval_T *rettv, int evaluate); -int get_number_tv(char_u **arg, typval_T *rettv, int evaluate, int want_string); -int get_string_tv(char_u **arg, typval_T *rettv, int evaluate); -int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate); char_u *partial_name(partial_T *pt); void partial_unref(partial_T *pt); -int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive); int get_copyID(void); int garbage_collect(int testing); int set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack); @@ -45,10 +40,8 @@ int set_ref_in_list_items(list_T *l, int copyID, ht_stack_T **ht_stack); int set_ref_in_item(typval_T *tv, int copyID, ht_stack_T **ht_stack, list_stack_T **list_stack); char_u *echo_string_core(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID, int echo_style, int restore_copyID, int composite_val); char_u *echo_string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID); -char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID); char_u *string_quote(char_u *str, int function); int string2float(char_u *text, float_T *value); -int get_env_tv(char_u **arg, typval_T *rettv, int evaluate); pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum); int list2fpos(typval_T *arg, pos_T *posp, int *fnump, colnr_T *curswantp); int get_env_len(char_u **arg); @@ -58,19 +51,6 @@ char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end, int f int eval_isnamec(int c); int eval_isnamec1(int c); int handle_subscript(char_u **arg, typval_T *rettv, int evaluate, int verbose, char_u *start_leader, char_u **end_leaderp); -typval_T *alloc_tv(void); -typval_T *alloc_string_tv(char_u *s); -void free_tv(typval_T *varp); -void clear_tv(typval_T *varp); -void init_tv(typval_T *varp); -varnumber_T tv_get_number(typval_T *varp); -varnumber_T tv_get_number_chk(typval_T *varp, int *denote); -float_T tv_get_float(typval_T *varp); -char_u *tv_get_string(typval_T *varp); -char_u *tv_get_string_buf(typval_T *varp, char_u *buf); -char_u *tv_get_string_chk(typval_T *varp); -char_u *tv_get_string_buf_chk(typval_T *varp, char_u *buf); -void copy_tv(typval_T *from, typval_T *to); int item_copy(typval_T *from, typval_T *to, int deep, int copyID); void echo_one(typval_T *rettv, int with_space, int *atstart, int *needclr); void ex_echo(exarg_T *eap); @@ -79,7 +59,5 @@ int get_echo_attr(void); void ex_execute(exarg_T *eap); char_u *find_option_end(char_u **arg, int *opt_flags); void last_set_msg(sctx_T script_ctx); -int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int ic); -char_u *typval_tostring(typval_T *arg); char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, typval_T *expr, char_u *flags); /* vim: set ft=c : */ diff --git a/src/proto/evalfunc.pro b/src/proto/evalfunc.pro index 33dea2c7f..f68527f9a 100644 --- a/src/proto/evalfunc.pro +++ b/src/proto/evalfunc.pro @@ -10,9 +10,6 @@ int call_internal_func(char_u *name, int argcount, typval_T *argvars, typval_T * void call_internal_func_by_idx(int idx, typval_T *argvars, typval_T *rettv); int call_internal_method(char_u *name, int argcount, typval_T *argvars, typval_T *rettv, typval_T *basetv); int non_zero_arg(typval_T *argvars); -linenr_T tv_get_lnum(typval_T *argvars); -linenr_T tv_get_lnum_buf(typval_T *argvars, buf_T *buf); -buf_T *tv_get_buf(typval_T *tv, int curtab_only); buf_T *get_buf_arg(typval_T *arg); win_T *get_optional_window(typval_T *argvars, int idx); void execute_redir_str(char_u *value, int value_len); diff --git a/src/proto/typval.pro b/src/proto/typval.pro new file mode 100644 index 000000000..6eebde26e --- /dev/null +++ b/src/proto/typval.pro @@ -0,0 +1,30 @@ +/* typval.c */ +typval_T *alloc_tv(void); +typval_T *alloc_string_tv(char_u *s); +void free_tv(typval_T *varp); +void clear_tv(typval_T *varp); +void init_tv(typval_T *varp); +int tv_check_lock(typval_T *tv, char_u *name, int use_gettext); +void copy_tv(typval_T *from, typval_T *to); +int typval_compare(typval_T *typ1, typval_T *typ2, exptype_T type, int ic); +char_u *typval_tostring(typval_T *arg); +int tv_islocked(typval_T *tv); +int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive); +int get_option_tv(char_u **arg, typval_T *rettv, int evaluate); +int get_number_tv(char_u **arg, typval_T *rettv, int evaluate, int want_string); +int get_string_tv(char_u **arg, typval_T *rettv, int evaluate); +int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate); +char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf, int copyID); +int get_env_tv(char_u **arg, typval_T *rettv, int evaluate); +varnumber_T tv_get_number(typval_T *varp); +varnumber_T tv_get_number_chk(typval_T *varp, int *denote); +float_T tv_get_float(typval_T *varp); +char_u *tv_get_string(typval_T *varp); +char_u *tv_get_string_buf(typval_T *varp, char_u *buf); +char_u *tv_get_string_chk(typval_T *varp); +char_u *tv_get_string_buf_chk(typval_T *varp, char_u *buf); +linenr_T tv_get_lnum(typval_T *argvars); +linenr_T tv_get_lnum_buf(typval_T *argvars, buf_T *buf); +buf_T *tv_get_buf(typval_T *tv, int curtab_only); +char_u *tv_stringify(typval_T *varp, char_u *buf); +/* vim: set ft=c : */ -- cgit v1.2.1