1
0
forked from aniani/vim

patch 8.2.3438: cannot manipulate blobs

Problem:    Cannot manipulate blobs.
Solution:   Add blob2list() and list2blob(). (Yegappan Lakshmanan,
            closes #8868)
This commit is contained in:
Yegappan Lakshmanan
2021-09-14 17:54:30 +02:00
committed by Bram Moolenaar
parent f5785cf059
commit 5dfe467432
11 changed files with 185 additions and 1 deletions

View File

@@ -288,6 +288,15 @@ arg_string(type_T *type, argcontext_T *context)
return check_arg_type(&t_string, type, context);
}
/*
* Check "type" is a blob
*/
static int
arg_blob(type_T *type, argcontext_T *context)
{
return check_arg_type(&t_blob, type, context);
}
/*
* Check "type" is a bool or number 0 or 1.
*/
@@ -680,6 +689,7 @@ arg_cursor1(type_T *type, argcontext_T *context)
/*
* Lists of functions that check the argument types of a builtin function.
*/
static argcheck_T arg1_blob[] = {arg_blob};
static argcheck_T arg1_bool[] = {arg_bool};
static argcheck_T arg1_buffer[] = {arg_buffer};
static argcheck_T arg1_buffer_or_dict_any[] = {arg_buffer_or_dict_any};
@@ -1169,6 +1179,8 @@ static funcentry_T global_functions[] =
NULL
#endif
},
{"blob2list", 1, 1, FEARG_1, arg1_blob,
ret_list_number, f_blob2list},
{"browse", 4, 4, 0, arg4_browse,
ret_string, f_browse},
{"browsedir", 2, 2, 0, arg2_string,
@@ -1589,6 +1601,8 @@ static funcentry_T global_functions[] =
ret_number, f_line2byte},
{"lispindent", 1, 1, FEARG_1, arg1_lnum,
ret_number, f_lispindent},
{"list2blob", 1, 1, FEARG_1, arg1_list_number,
ret_blob, f_list2blob},
{"list2str", 1, 2, FEARG_1, arg2_list_number_bool,
ret_string, f_list2str},
{"listener_add", 1, 2, FEARG_2, arg2_any_buffer,