comparison src/evalfunc.c @ 25431:634aed775408 v8.2.3252

patch 8.2.3252: duplicated code for adding buffer lines Commit: https://github.com/vim/vim/commit/4a15504e911bc90a29d862862f0b7a46d8acd12a Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Jul 30 21:32:45 2021 +0200 patch 8.2.3252: duplicated code for adding buffer lines Problem: Duplicated code for adding buffer lines. Solution: Move code to a common function. Also move map functions to map.c. (Yegappan Lakshmanan, closes #8665)
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Jul 2021 21:45:02 +0200
parents e8e2c4d33b9b
children 5dce28f92d04
comparison
equal deleted inserted replaced
25430:e9d147592cfc 25431:634aed775408
96 static void f_line(typval_T *argvars, typval_T *rettv); 96 static void f_line(typval_T *argvars, typval_T *rettv);
97 static void f_line2byte(typval_T *argvars, typval_T *rettv); 97 static void f_line2byte(typval_T *argvars, typval_T *rettv);
98 #ifdef FEAT_LUA 98 #ifdef FEAT_LUA
99 static void f_luaeval(typval_T *argvars, typval_T *rettv); 99 static void f_luaeval(typval_T *argvars, typval_T *rettv);
100 #endif 100 #endif
101 static void f_maparg(typval_T *argvars, typval_T *rettv);
102 static void f_mapcheck(typval_T *argvars, typval_T *rettv);
103 static void f_match(typval_T *argvars, typval_T *rettv); 101 static void f_match(typval_T *argvars, typval_T *rettv);
104 static void f_matchend(typval_T *argvars, typval_T *rettv); 102 static void f_matchend(typval_T *argvars, typval_T *rettv);
105 static void f_matchlist(typval_T *argvars, typval_T *rettv); 103 static void f_matchlist(typval_T *argvars, typval_T *rettv);
106 static void f_matchstr(typval_T *argvars, typval_T *rettv); 104 static void f_matchstr(typval_T *argvars, typval_T *rettv);
107 static void f_matchstrpos(typval_T *argvars, typval_T *rettv); 105 static void f_matchstrpos(typval_T *argvars, typval_T *rettv);
6732 str = tv_get_string_buf(&argvars[0], buf); 6730 str = tv_get_string_buf(&argvars[0], buf);
6733 do_luaeval(str, argvars + 1, rettv); 6731 do_luaeval(str, argvars + 1, rettv);
6734 } 6732 }
6735 #endif 6733 #endif
6736 6734
6737 /*
6738 * "maparg()" function
6739 */
6740 static void
6741 f_maparg(typval_T *argvars, typval_T *rettv)
6742 {
6743 if (in_vim9script()
6744 && (check_for_string_arg(argvars, 0) == FAIL
6745 || check_for_opt_string_arg(argvars, 1) == FAIL
6746 || (argvars[1].v_type != VAR_UNKNOWN
6747 && (check_for_opt_bool_arg(argvars, 2) == FAIL
6748 || (argvars[2].v_type != VAR_UNKNOWN
6749 && check_for_opt_bool_arg(argvars, 3) == FAIL)))))
6750 return;
6751
6752 get_maparg(argvars, rettv, TRUE);
6753 }
6754
6755 /*
6756 * "mapcheck()" function
6757 */
6758 static void
6759 f_mapcheck(typval_T *argvars, typval_T *rettv)
6760 {
6761 if (in_vim9script()
6762 && (check_for_string_arg(argvars, 0) == FAIL
6763 || check_for_opt_string_arg(argvars, 1) == FAIL
6764 || (argvars[1].v_type != VAR_UNKNOWN
6765 && check_for_opt_bool_arg(argvars, 2) == FAIL)))
6766 return;
6767
6768 get_maparg(argvars, rettv, FALSE);
6769 }
6770
6771 typedef enum 6735 typedef enum
6772 { 6736 {
6773 MATCH_END, // matchend() 6737 MATCH_END, // matchend()
6774 MATCH_MATCH, // match() 6738 MATCH_MATCH, // match()
6775 MATCH_STR, // matchstr() 6739 MATCH_STR, // matchstr()