mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.1815: duplicating info for internal functions
Problem: Duplicating info for internal functions. Solution: Use one table to list internal functions.
This commit is contained in:
parent
5d458a7b3d
commit
7a4ea1df2f
167
src/evalfunc.c
167
src/evalfunc.c
@ -422,16 +422,21 @@ typedef struct
|
|||||||
// implementation of function
|
// implementation of function
|
||||||
} funcentry_T;
|
} funcentry_T;
|
||||||
|
|
||||||
|
// values for f_argtype; zero means it cannot be used as a method
|
||||||
|
#define FEARG_1 1 // base is the first argument
|
||||||
|
#define FEARG_2 2 // base is the second argument
|
||||||
|
#define FEARG_LAST 9 // base is the last argument
|
||||||
|
|
||||||
static funcentry_T global_functions[] =
|
static funcentry_T global_functions[] =
|
||||||
{
|
{
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"abs", 1, 1, 0, f_abs},
|
{"abs", 1, 1, 0, f_abs},
|
||||||
{"acos", 1, 1, 0, f_acos}, // WJMc
|
{"acos", 1, 1, 0, f_acos}, // WJMc
|
||||||
#endif
|
#endif
|
||||||
{"add", 2, 2, 0, f_add},
|
{"add", 2, 2, FEARG_1, f_add},
|
||||||
{"and", 2, 2, 0, f_and},
|
{"and", 2, 2, 0, f_and},
|
||||||
{"append", 2, 2, 0, f_append},
|
{"append", 2, 2, FEARG_LAST, f_append},
|
||||||
{"appendbufline", 3, 3, 0, f_appendbufline},
|
{"appendbufline", 3, 3, FEARG_LAST, f_appendbufline},
|
||||||
{"argc", 0, 1, 0, f_argc},
|
{"argc", 0, 1, 0, f_argc},
|
||||||
{"argidx", 0, 0, 0, f_argidx},
|
{"argidx", 0, 0, 0, f_argidx},
|
||||||
{"arglistid", 0, 2, 0, f_arglistid},
|
{"arglistid", 0, 2, 0, f_arglistid},
|
||||||
@ -440,14 +445,14 @@ static funcentry_T global_functions[] =
|
|||||||
{"asin", 1, 1, 0, f_asin}, // WJMc
|
{"asin", 1, 1, 0, f_asin}, // WJMc
|
||||||
#endif
|
#endif
|
||||||
{"assert_beeps", 1, 2, 0, f_assert_beeps},
|
{"assert_beeps", 1, 2, 0, f_assert_beeps},
|
||||||
{"assert_equal", 2, 3, 0, f_assert_equal},
|
{"assert_equal", 2, 3, FEARG_2, f_assert_equal},
|
||||||
{"assert_equalfile", 2, 2, 0, f_assert_equalfile},
|
{"assert_equalfile", 2, 2, 0, f_assert_equalfile},
|
||||||
{"assert_exception", 1, 2, 0, f_assert_exception},
|
{"assert_exception", 1, 2, 0, f_assert_exception},
|
||||||
{"assert_fails", 1, 3, 0, f_assert_fails},
|
{"assert_fails", 1, 3, 0, f_assert_fails},
|
||||||
{"assert_false", 1, 2, 0, f_assert_false},
|
{"assert_false", 1, 2, 0, f_assert_false},
|
||||||
{"assert_inrange", 3, 4, 0, f_assert_inrange},
|
{"assert_inrange", 3, 4, 0, f_assert_inrange},
|
||||||
{"assert_match", 2, 3, 0, f_assert_match},
|
{"assert_match", 2, 3, 0, f_assert_match},
|
||||||
{"assert_notequal", 2, 3, 0, f_assert_notequal},
|
{"assert_notequal", 2, 3, FEARG_2, f_assert_notequal},
|
||||||
{"assert_notmatch", 2, 3, 0, f_assert_notmatch},
|
{"assert_notmatch", 2, 3, 0, f_assert_notmatch},
|
||||||
{"assert_report", 1, 1, 0, f_assert_report},
|
{"assert_report", 1, 1, 0, f_assert_report},
|
||||||
{"assert_true", 1, 2, 0, f_assert_true},
|
{"assert_true", 1, 2, 0, f_assert_true},
|
||||||
@ -516,12 +521,12 @@ static funcentry_T global_functions[] =
|
|||||||
{"complete_info", 0, 1, 0, f_complete_info},
|
{"complete_info", 0, 1, 0, f_complete_info},
|
||||||
#endif
|
#endif
|
||||||
{"confirm", 1, 4, 0, f_confirm},
|
{"confirm", 1, 4, 0, f_confirm},
|
||||||
{"copy", 1, 1, 0, f_copy},
|
{"copy", 1, 1, FEARG_1, f_copy},
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"cos", 1, 1, 0, f_cos},
|
{"cos", 1, 1, 0, f_cos},
|
||||||
{"cosh", 1, 1, 0, f_cosh},
|
{"cosh", 1, 1, 0, f_cosh},
|
||||||
#endif
|
#endif
|
||||||
{"count", 2, 4, 0, f_count},
|
{"count", 2, 4, FEARG_1, f_count},
|
||||||
{"cscope_connection",0,3, 0, f_cscope_connection},
|
{"cscope_connection",0,3, 0, f_cscope_connection},
|
||||||
{"cursor", 1, 3, 0, f_cursor},
|
{"cursor", 1, 3, 0, f_cursor},
|
||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
@ -533,10 +538,10 @@ static funcentry_T global_functions[] =
|
|||||||
{"did_filetype", 0, 0, 0, f_did_filetype},
|
{"did_filetype", 0, 0, 0, f_did_filetype},
|
||||||
{"diff_filler", 1, 1, 0, f_diff_filler},
|
{"diff_filler", 1, 1, 0, f_diff_filler},
|
||||||
{"diff_hlID", 2, 2, 0, f_diff_hlID},
|
{"diff_hlID", 2, 2, 0, f_diff_hlID},
|
||||||
{"empty", 1, 1, 0, f_empty},
|
{"empty", 1, 1, FEARG_1, f_empty},
|
||||||
{"environ", 0, 0, 0, f_environ},
|
{"environ", 0, 0, 0, f_environ},
|
||||||
{"escape", 2, 2, 0, f_escape},
|
{"escape", 2, 2, 0, f_escape},
|
||||||
{"eval", 1, 1, 0, f_eval},
|
{"eval", 1, 1, FEARG_1, f_eval},
|
||||||
{"eventhandler", 0, 0, 0, f_eventhandler},
|
{"eventhandler", 0, 0, 0, f_eventhandler},
|
||||||
{"executable", 1, 1, 0, f_executable},
|
{"executable", 1, 1, 0, f_executable},
|
||||||
{"execute", 1, 2, 0, f_execute},
|
{"execute", 1, 2, 0, f_execute},
|
||||||
@ -547,12 +552,12 @@ static funcentry_T global_functions[] =
|
|||||||
#endif
|
#endif
|
||||||
{"expand", 1, 3, 0, f_expand},
|
{"expand", 1, 3, 0, f_expand},
|
||||||
{"expandcmd", 1, 1, 0, f_expandcmd},
|
{"expandcmd", 1, 1, 0, f_expandcmd},
|
||||||
{"extend", 2, 3, 0, f_extend},
|
{"extend", 2, 3, FEARG_1, f_extend},
|
||||||
{"feedkeys", 1, 2, 0, f_feedkeys},
|
{"feedkeys", 1, 2, 0, f_feedkeys},
|
||||||
{"file_readable", 1, 1, 0, f_filereadable}, // obsolete
|
{"file_readable", 1, 1, 0, f_filereadable}, // obsolete
|
||||||
{"filereadable", 1, 1, 0, f_filereadable},
|
{"filereadable", 1, 1, 0, f_filereadable},
|
||||||
{"filewritable", 1, 1, 0, f_filewritable},
|
{"filewritable", 1, 1, 0, f_filewritable},
|
||||||
{"filter", 2, 2, 0, f_filter},
|
{"filter", 2, 2, FEARG_1, f_filter},
|
||||||
{"finddir", 1, 3, 0, f_finddir},
|
{"finddir", 1, 3, 0, f_finddir},
|
||||||
{"findfile", 1, 3, 0, f_findfile},
|
{"findfile", 1, 3, 0, f_findfile},
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
@ -571,7 +576,7 @@ static funcentry_T global_functions[] =
|
|||||||
{"funcref", 1, 3, 0, f_funcref},
|
{"funcref", 1, 3, 0, f_funcref},
|
||||||
{"function", 1, 3, 0, f_function},
|
{"function", 1, 3, 0, f_function},
|
||||||
{"garbagecollect", 0, 1, 0, f_garbagecollect},
|
{"garbagecollect", 0, 1, 0, f_garbagecollect},
|
||||||
{"get", 2, 3, 0, f_get},
|
{"get", 2, 3, FEARG_1, f_get},
|
||||||
{"getbufinfo", 0, 1, 0, f_getbufinfo},
|
{"getbufinfo", 0, 1, 0, f_getbufinfo},
|
||||||
{"getbufline", 2, 3, 0, f_getbufline},
|
{"getbufline", 2, 3, 0, f_getbufline},
|
||||||
{"getbufvar", 2, 3, 0, f_getbufvar},
|
{"getbufvar", 2, 3, 0, f_getbufvar},
|
||||||
@ -616,7 +621,7 @@ static funcentry_T global_functions[] =
|
|||||||
{"glob2regpat", 1, 1, 0, f_glob2regpat},
|
{"glob2regpat", 1, 1, 0, f_glob2regpat},
|
||||||
{"globpath", 2, 5, 0, f_globpath},
|
{"globpath", 2, 5, 0, f_globpath},
|
||||||
{"has", 1, 1, 0, f_has},
|
{"has", 1, 1, 0, f_has},
|
||||||
{"has_key", 2, 2, 0, f_has_key},
|
{"has_key", 2, 2, FEARG_1, f_has_key},
|
||||||
{"haslocaldir", 0, 2, 0, f_haslocaldir},
|
{"haslocaldir", 0, 2, 0, f_haslocaldir},
|
||||||
{"hasmapto", 1, 3, 0, f_hasmapto},
|
{"hasmapto", 1, 3, 0, f_hasmapto},
|
||||||
{"highlightID", 1, 1, 0, f_hlID}, // obsolete
|
{"highlightID", 1, 1, 0, f_hlID}, // obsolete
|
||||||
@ -630,14 +635,14 @@ static funcentry_T global_functions[] =
|
|||||||
{"hostname", 0, 0, 0, f_hostname},
|
{"hostname", 0, 0, 0, f_hostname},
|
||||||
{"iconv", 3, 3, 0, f_iconv},
|
{"iconv", 3, 3, 0, f_iconv},
|
||||||
{"indent", 1, 1, 0, f_indent},
|
{"indent", 1, 1, 0, f_indent},
|
||||||
{"index", 2, 4, 0, f_index},
|
{"index", 2, 4, FEARG_1, f_index},
|
||||||
{"input", 1, 3, 0, f_input},
|
{"input", 1, 3, 0, f_input},
|
||||||
{"inputdialog", 1, 3, 0, f_inputdialog},
|
{"inputdialog", 1, 3, 0, f_inputdialog},
|
||||||
{"inputlist", 1, 1, 0, f_inputlist},
|
{"inputlist", 1, 1, 0, f_inputlist},
|
||||||
{"inputrestore", 0, 0, 0, f_inputrestore},
|
{"inputrestore", 0, 0, 0, f_inputrestore},
|
||||||
{"inputsave", 0, 0, 0, f_inputsave},
|
{"inputsave", 0, 0, 0, f_inputsave},
|
||||||
{"inputsecret", 1, 2, 0, f_inputsecret},
|
{"inputsecret", 1, 2, 0, f_inputsecret},
|
||||||
{"insert", 2, 3, 0, f_insert},
|
{"insert", 2, 3, FEARG_1, f_insert},
|
||||||
{"invert", 1, 1, 0, f_invert},
|
{"invert", 1, 1, 0, f_invert},
|
||||||
{"isdirectory", 1, 1, 0, f_isdirectory},
|
{"isdirectory", 1, 1, 0, f_isdirectory},
|
||||||
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
|
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
|
||||||
@ -647,7 +652,7 @@ static funcentry_T global_functions[] =
|
|||||||
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
|
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
|
||||||
{"isnan", 1, 1, 0, f_isnan},
|
{"isnan", 1, 1, 0, f_isnan},
|
||||||
#endif
|
#endif
|
||||||
{"items", 1, 1, 0, f_items},
|
{"items", 1, 1, FEARG_1, f_items},
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
{"job_getchannel", 1, 1, 0, f_job_getchannel},
|
{"job_getchannel", 1, 1, 0, f_job_getchannel},
|
||||||
{"job_info", 0, 1, 0, f_job_info},
|
{"job_info", 0, 1, 0, f_job_info},
|
||||||
@ -656,14 +661,14 @@ static funcentry_T global_functions[] =
|
|||||||
{"job_status", 1, 1, 0, f_job_status},
|
{"job_status", 1, 1, 0, f_job_status},
|
||||||
{"job_stop", 1, 2, 0, f_job_stop},
|
{"job_stop", 1, 2, 0, f_job_stop},
|
||||||
#endif
|
#endif
|
||||||
{"join", 1, 2, 0, f_join},
|
{"join", 1, 2, FEARG_1, f_join},
|
||||||
{"js_decode", 1, 1, 0, f_js_decode},
|
{"js_decode", 1, 1, 0, f_js_decode},
|
||||||
{"js_encode", 1, 1, 0, f_js_encode},
|
{"js_encode", 1, 1, 0, f_js_encode},
|
||||||
{"json_decode", 1, 1, 0, f_json_decode},
|
{"json_decode", 1, 1, 0, f_json_decode},
|
||||||
{"json_encode", 1, 1, 0, f_json_encode},
|
{"json_encode", 1, 1, 0, f_json_encode},
|
||||||
{"keys", 1, 1, 0, f_keys},
|
{"keys", 1, 1, FEARG_1, f_keys},
|
||||||
{"last_buffer_nr", 0, 0, 0, f_last_buffer_nr}, // obsolete
|
{"last_buffer_nr", 0, 0, 0, f_last_buffer_nr}, // obsolete
|
||||||
{"len", 1, 1, 0, f_len},
|
{"len", 1, 1, FEARG_1, f_len},
|
||||||
{"libcall", 3, 3, 0, f_libcall},
|
{"libcall", 3, 3, 0, f_libcall},
|
||||||
{"libcallnr", 3, 3, 0, f_libcallnr},
|
{"libcallnr", 3, 3, 0, f_libcallnr},
|
||||||
{"line", 1, 1, 0, f_line},
|
{"line", 1, 1, 0, f_line},
|
||||||
@ -681,7 +686,7 @@ static funcentry_T global_functions[] =
|
|||||||
#ifdef FEAT_LUA
|
#ifdef FEAT_LUA
|
||||||
{"luaeval", 1, 2, 0, f_luaeval},
|
{"luaeval", 1, 2, 0, f_luaeval},
|
||||||
#endif
|
#endif
|
||||||
{"map", 2, 2, 0, f_map},
|
{"map", 2, 2, FEARG_1, f_map},
|
||||||
{"maparg", 1, 4, 0, f_maparg},
|
{"maparg", 1, 4, 0, f_maparg},
|
||||||
{"mapcheck", 1, 3, 0, f_mapcheck},
|
{"mapcheck", 1, 3, 0, f_mapcheck},
|
||||||
{"match", 2, 4, 0, f_match},
|
{"match", 2, 4, 0, f_match},
|
||||||
@ -693,8 +698,8 @@ static funcentry_T global_functions[] =
|
|||||||
{"matchlist", 2, 4, 0, f_matchlist},
|
{"matchlist", 2, 4, 0, f_matchlist},
|
||||||
{"matchstr", 2, 4, 0, f_matchstr},
|
{"matchstr", 2, 4, 0, f_matchstr},
|
||||||
{"matchstrpos", 2, 4, 0, f_matchstrpos},
|
{"matchstrpos", 2, 4, 0, f_matchstrpos},
|
||||||
{"max", 1, 1, 0, f_max},
|
{"max", 1, 1, FEARG_1, f_max},
|
||||||
{"min", 1, 1, 0, f_min},
|
{"min", 1, 1, FEARG_1, f_min},
|
||||||
{"mkdir", 1, 3, 0, f_mkdir},
|
{"mkdir", 1, 3, 0, f_mkdir},
|
||||||
{"mode", 0, 1, 0, f_mode},
|
{"mode", 0, 1, 0, f_mode},
|
||||||
#ifdef FEAT_MZSCHEME
|
#ifdef FEAT_MZSCHEME
|
||||||
@ -775,11 +780,11 @@ static funcentry_T global_functions[] =
|
|||||||
{"remote_read", 1, 2, 0, f_remote_read},
|
{"remote_read", 1, 2, 0, f_remote_read},
|
||||||
{"remote_send", 2, 3, 0, f_remote_send},
|
{"remote_send", 2, 3, 0, f_remote_send},
|
||||||
{"remote_startserver", 1, 1, 0, f_remote_startserver},
|
{"remote_startserver", 1, 1, 0, f_remote_startserver},
|
||||||
{"remove", 2, 3, 0, f_remove},
|
{"remove", 2, 3, FEARG_1, f_remove},
|
||||||
{"rename", 2, 2, 0, f_rename},
|
{"rename", 2, 2, 0, f_rename},
|
||||||
{"repeat", 2, 2, 0, f_repeat},
|
{"repeat", 2, 2, FEARG_1, f_repeat},
|
||||||
{"resolve", 1, 1, 0, f_resolve},
|
{"resolve", 1, 1, 0, f_resolve},
|
||||||
{"reverse", 1, 1, 0, f_reverse},
|
{"reverse", 1, 1, FEARG_1, f_reverse},
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"round", 1, 1, 0, f_round},
|
{"round", 1, 1, 0, f_round},
|
||||||
#endif
|
#endif
|
||||||
@ -837,7 +842,7 @@ static funcentry_T global_functions[] =
|
|||||||
{"sin", 1, 1, 0, f_sin},
|
{"sin", 1, 1, 0, f_sin},
|
||||||
{"sinh", 1, 1, 0, f_sinh},
|
{"sinh", 1, 1, 0, f_sinh},
|
||||||
#endif
|
#endif
|
||||||
{"sort", 1, 3, 0, f_sort},
|
{"sort", 1, 3, FEARG_1, f_sort},
|
||||||
#ifdef FEAT_SOUND
|
#ifdef FEAT_SOUND
|
||||||
{"sound_clear", 0, 0, 0, f_sound_clear},
|
{"sound_clear", 0, 0, 0, f_sound_clear},
|
||||||
{"sound_playevent", 1, 2, 0, f_sound_playevent},
|
{"sound_playevent", 1, 2, 0, f_sound_playevent},
|
||||||
@ -847,12 +852,12 @@ static funcentry_T global_functions[] =
|
|||||||
{"soundfold", 1, 1, 0, f_soundfold},
|
{"soundfold", 1, 1, 0, f_soundfold},
|
||||||
{"spellbadword", 0, 1, 0, f_spellbadword},
|
{"spellbadword", 0, 1, 0, f_spellbadword},
|
||||||
{"spellsuggest", 1, 3, 0, f_spellsuggest},
|
{"spellsuggest", 1, 3, 0, f_spellsuggest},
|
||||||
{"split", 1, 3, 0, f_split},
|
{"split", 1, 3, FEARG_1, f_split},
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"sqrt", 1, 1, 0, f_sqrt},
|
{"sqrt", 1, 1, 0, f_sqrt},
|
||||||
{"str2float", 1, 1, 0, f_str2float},
|
{"str2float", 1, 1, 0, f_str2float},
|
||||||
#endif
|
#endif
|
||||||
{"str2list", 1, 2, 0, f_str2list},
|
{"str2list", 1, 2, FEARG_1, f_str2list},
|
||||||
{"str2nr", 1, 2, 0, f_str2nr},
|
{"str2nr", 1, 2, 0, f_str2nr},
|
||||||
{"strcharpart", 2, 3, 0, f_strcharpart},
|
{"strcharpart", 2, 3, 0, f_strcharpart},
|
||||||
{"strchars", 1, 2, 0, f_strchars},
|
{"strchars", 1, 2, 0, f_strchars},
|
||||||
@ -862,23 +867,23 @@ static funcentry_T global_functions[] =
|
|||||||
#endif
|
#endif
|
||||||
{"strgetchar", 2, 2, 0, f_strgetchar},
|
{"strgetchar", 2, 2, 0, f_strgetchar},
|
||||||
{"stridx", 2, 3, 0, f_stridx},
|
{"stridx", 2, 3, 0, f_stridx},
|
||||||
{"string", 1, 1, 0, f_string},
|
{"string", 1, 1, FEARG_1, f_string},
|
||||||
{"strlen", 1, 1, 0, f_strlen},
|
{"strlen", 1, 1, FEARG_1, f_strlen},
|
||||||
{"strpart", 2, 3, 0, f_strpart},
|
{"strpart", 2, 3, 0, f_strpart},
|
||||||
{"strridx", 2, 3, 0, f_strridx},
|
{"strridx", 2, 3, 0, f_strridx},
|
||||||
{"strtrans", 1, 1, 0, f_strtrans},
|
{"strtrans", 1, 1, FEARG_1, f_strtrans},
|
||||||
{"strwidth", 1, 1, 0, f_strwidth},
|
{"strwidth", 1, 1, FEARG_1, f_strwidth},
|
||||||
{"submatch", 1, 2, 0, f_submatch},
|
{"submatch", 1, 2, 0, f_submatch},
|
||||||
{"substitute", 4, 4, 0, f_substitute},
|
{"substitute", 4, 4, FEARG_1, f_substitute},
|
||||||
{"swapinfo", 1, 1, 0, f_swapinfo},
|
{"swapinfo", 1, 1, 0, f_swapinfo},
|
||||||
{"swapname", 1, 1, 0, f_swapname},
|
{"swapname", 1, 1, 0, f_swapname},
|
||||||
{"synID", 3, 3, 0, f_synID},
|
{"synID", 3, 3, 0, f_synID},
|
||||||
{"synIDattr", 2, 3, 0, f_synIDattr},
|
{"synIDattr", 2, 3, FEARG_1, f_synIDattr},
|
||||||
{"synIDtrans", 1, 1, 0, f_synIDtrans},
|
{"synIDtrans", 1, 1, FEARG_1, f_synIDtrans},
|
||||||
{"synconcealed", 2, 2, 0, f_synconcealed},
|
{"synconcealed", 2, 2, 0, f_synconcealed},
|
||||||
{"synstack", 2, 2, 0, f_synstack},
|
{"synstack", 2, 2, 0, f_synstack},
|
||||||
{"system", 1, 2, 0, f_system},
|
{"system", 1, 2, FEARG_1, f_system},
|
||||||
{"systemlist", 1, 2, 0, f_systemlist},
|
{"systemlist", 1, 2, FEARG_1, f_systemlist},
|
||||||
{"tabpagebuflist", 0, 1, 0, f_tabpagebuflist},
|
{"tabpagebuflist", 0, 1, 0, f_tabpagebuflist},
|
||||||
{"tabpagenr", 0, 1, 0, f_tabpagenr},
|
{"tabpagenr", 0, 1, 0, f_tabpagenr},
|
||||||
{"tabpagewinnr", 1, 2, 0, f_tabpagewinnr},
|
{"tabpagewinnr", 1, 2, 0, f_tabpagewinnr},
|
||||||
@ -960,11 +965,11 @@ static funcentry_T global_functions[] =
|
|||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"trunc", 1, 1, 0, f_trunc},
|
{"trunc", 1, 1, 0, f_trunc},
|
||||||
#endif
|
#endif
|
||||||
{"type", 1, 1, 0, f_type},
|
{"type", 1, 1, FEARG_1, f_type},
|
||||||
{"undofile", 1, 1, 0, f_undofile},
|
{"undofile", 1, 1, 0, f_undofile},
|
||||||
{"undotree", 0, 0, 0, f_undotree},
|
{"undotree", 0, 0, 0, f_undotree},
|
||||||
{"uniq", 1, 3, 0, f_uniq},
|
{"uniq", 1, 3, FEARG_1, f_uniq},
|
||||||
{"values", 1, 1, 0, f_values},
|
{"values", 1, 1, FEARG_1, f_values},
|
||||||
{"virtcol", 1, 1, 0, f_virtcol},
|
{"virtcol", 1, 1, 0, f_virtcol},
|
||||||
{"visualmode", 0, 1, 0, f_visualmode},
|
{"visualmode", 0, 1, 0, f_visualmode},
|
||||||
{"wildmenumode", 0, 0, 0, f_wildmenumode},
|
{"wildmenumode", 0, 0, 0, f_wildmenumode},
|
||||||
@ -990,58 +995,6 @@ static funcentry_T global_functions[] =
|
|||||||
{"xor", 2, 2, 0, f_xor},
|
{"xor", 2, 2, 0, f_xor},
|
||||||
};
|
};
|
||||||
|
|
||||||
// values for f_argtype
|
|
||||||
#define FEARG_LAST 1 // base is the last argument
|
|
||||||
#define FEARG_2 2 // base is the second argument
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Methods that call the internal function with the base as one of the
|
|
||||||
* arguments.
|
|
||||||
*/
|
|
||||||
static funcentry_T base_methods[] =
|
|
||||||
{
|
|
||||||
{"add", 1, 1, 0, f_add},
|
|
||||||
{"append", 1, 1, FEARG_LAST, f_append},
|
|
||||||
{"appendbufline", 2, 2, FEARG_LAST, f_appendbufline},
|
|
||||||
{"assert_equal", 1, 2, FEARG_2, f_assert_equal},
|
|
||||||
{"assert_notequal", 1, 2, FEARG_2, f_assert_notequal},
|
|
||||||
{"copy", 0, 0, 0, f_copy},
|
|
||||||
{"count", 1, 3, 0, f_count},
|
|
||||||
{"empty", 0, 0, 0, f_empty},
|
|
||||||
{"eval", 0, 0, 0, f_eval},
|
|
||||||
{"extend", 1, 2, 0, f_extend},
|
|
||||||
{"filter", 1, 1, 0, f_filter},
|
|
||||||
{"get", 1, 2, 0, f_get},
|
|
||||||
{"has_key", 1, 1, 0, f_has_key},
|
|
||||||
{"index", 1, 3, 0, f_index},
|
|
||||||
{"insert", 1, 2, 0, f_insert},
|
|
||||||
{"items", 0, 0, 0, f_items},
|
|
||||||
{"join", 0, 1, 0, f_join},
|
|
||||||
{"keys", 0, 0, 0, f_keys},
|
|
||||||
{"len", 0, 0, 0, f_len},
|
|
||||||
{"map", 1, 1, 0, f_map},
|
|
||||||
{"max", 0, 0, 0, f_max},
|
|
||||||
{"min", 0, 0, 0, f_min},
|
|
||||||
{"remove", 1, 2, 0, f_remove},
|
|
||||||
{"repeat", 1, 1, 0, f_repeat},
|
|
||||||
{"reverse", 0, 0, 0, f_reverse},
|
|
||||||
{"sort", 0, 2, 0, f_sort},
|
|
||||||
{"split", 0, 2, 0, f_split},
|
|
||||||
{"str2list", 0, 1, 0, f_str2list},
|
|
||||||
{"string", 0, 0, 0, f_string},
|
|
||||||
{"strlen", 0, 0, 0, f_strlen},
|
|
||||||
{"strtrans", 0, 0, 0, f_strtrans},
|
|
||||||
{"strwidth", 0, 0, 0, f_strwidth},
|
|
||||||
{"substitute", 3, 3, 0, f_substitute},
|
|
||||||
{"synIDattr", 1, 2, 0, f_synIDattr},
|
|
||||||
{"synIDtrans", 0, 0, 0, f_synIDtrans},
|
|
||||||
{"system", 0, 1, 0, f_system},
|
|
||||||
{"systemlist", 0, 2, 0, f_systemlist},
|
|
||||||
{"type", 0, 0, 0, f_type},
|
|
||||||
{"uniq", 0, 2, 0, f_uniq},
|
|
||||||
{"values", 0, 0, 0, f_values},
|
|
||||||
};
|
|
||||||
|
|
||||||
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1098,29 +1051,24 @@ get_expr_name(expand_T *xp, int idx)
|
|||||||
#endif /* FEAT_CMDL_COMPL */
|
#endif /* FEAT_CMDL_COMPL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find internal function in table "functions".
|
* Find internal function "name" in table "global_functions".
|
||||||
* Return index, or -1 if not found
|
* Return index, or -1 if not found
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
find_internal_func(
|
find_internal_func(char_u *name)
|
||||||
char_u *name, // name of the function
|
|
||||||
funcentry_T *functions) // functions table to use
|
|
||||||
{
|
{
|
||||||
int first = 0;
|
int first = 0;
|
||||||
int last;
|
int last;
|
||||||
int cmp;
|
int cmp;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
if (functions == global_functions)
|
|
||||||
last = (int)(sizeof(global_functions) / sizeof(funcentry_T)) - 1;
|
last = (int)(sizeof(global_functions) / sizeof(funcentry_T)) - 1;
|
||||||
else
|
|
||||||
last = (int)(sizeof(base_methods) / sizeof(funcentry_T)) - 1;
|
|
||||||
|
|
||||||
// Find the function name in the table. Binary search.
|
// Find the function name in the table. Binary search.
|
||||||
while (first <= last)
|
while (first <= last)
|
||||||
{
|
{
|
||||||
x = first + ((unsigned)(last - first) >> 1);
|
x = first + ((unsigned)(last - first) >> 1);
|
||||||
cmp = STRCMP(name, functions[x].f_name);
|
cmp = STRCMP(name, global_functions[x].f_name);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
last = x - 1;
|
last = x - 1;
|
||||||
else if (cmp > 0)
|
else if (cmp > 0)
|
||||||
@ -1134,7 +1082,7 @@ find_internal_func(
|
|||||||
int
|
int
|
||||||
has_internal_func(char_u *name)
|
has_internal_func(char_u *name)
|
||||||
{
|
{
|
||||||
return find_internal_func(name, global_functions) >= 0;
|
return find_internal_func(name) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1146,7 +1094,7 @@ call_internal_func(
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = find_internal_func(name, global_functions);
|
i = find_internal_func(name);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return ERROR_UNKNOWN;
|
return ERROR_UNKNOWN;
|
||||||
if (argcount < global_functions[i].f_min_argc)
|
if (argcount < global_functions[i].f_min_argc)
|
||||||
@ -1173,22 +1121,22 @@ call_internal_method(
|
|||||||
int fi;
|
int fi;
|
||||||
typval_T argv[MAX_FUNC_ARGS + 1];
|
typval_T argv[MAX_FUNC_ARGS + 1];
|
||||||
|
|
||||||
fi = find_internal_func(name, base_methods);
|
fi = find_internal_func(name);
|
||||||
if (fi < 0)
|
if (fi < 0 || global_functions[fi].f_argtype == 0)
|
||||||
return ERROR_UNKNOWN;
|
return ERROR_UNKNOWN;
|
||||||
if (argcount < base_methods[fi].f_min_argc)
|
if (argcount + 1 < global_functions[fi].f_min_argc)
|
||||||
return ERROR_TOOFEW;
|
return ERROR_TOOFEW;
|
||||||
if (argcount > base_methods[fi].f_max_argc)
|
if (argcount + 1 > global_functions[fi].f_max_argc)
|
||||||
return ERROR_TOOMANY;
|
return ERROR_TOOMANY;
|
||||||
|
|
||||||
if (base_methods[fi].f_argtype == FEARG_LAST)
|
if (global_functions[fi].f_argtype == FEARG_LAST)
|
||||||
{
|
{
|
||||||
// base value goes last
|
// base value goes last
|
||||||
for (i = 0; i < argcount; ++i)
|
for (i = 0; i < argcount; ++i)
|
||||||
argv[i] = argvars[i];
|
argv[i] = argvars[i];
|
||||||
argv[argcount] = *basetv;
|
argv[argcount] = *basetv;
|
||||||
}
|
}
|
||||||
else if (base_methods[fi].f_argtype == FEARG_2)
|
else if (global_functions[fi].f_argtype == FEARG_2)
|
||||||
{
|
{
|
||||||
// base value goes second
|
// base value goes second
|
||||||
argv[0] = argvars[0];
|
argv[0] = argvars[0];
|
||||||
@ -1198,13 +1146,14 @@ call_internal_method(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// FEARG_1: base value goes first
|
||||||
argv[0] = *basetv;
|
argv[0] = *basetv;
|
||||||
for (i = 0; i < argcount; ++i)
|
for (i = 0; i < argcount; ++i)
|
||||||
argv[i + 1] = argvars[i];
|
argv[i + 1] = argvars[i];
|
||||||
}
|
}
|
||||||
argv[argcount + 1].v_type = VAR_UNKNOWN;
|
argv[argcount + 1].v_type = VAR_UNKNOWN;
|
||||||
|
|
||||||
base_methods[fi].f_func(argv, rettv);
|
global_functions[fi].f_func(argv, rettv);
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,6 +773,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1815,
|
||||||
/**/
|
/**/
|
||||||
1814,
|
1814,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user