Mercurial > vim
diff src/evalfunc.c @ 25806:8d55e978f95b v8.2.3438
patch 8.2.3438: cannot manipulate blobs
Commit: https://github.com/vim/vim/commit/5dfe467432638fac2e0156a2f9cd0d9eb569fb39
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Sep 14 17:54:30 2021 +0200
patch 8.2.3438: cannot manipulate blobs
Problem: Cannot manipulate blobs.
Solution: Add blob2list() and list2blob(). (Yegappan Lakshmanan,
closes #8868)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 14 Sep 2021 18:00:08 +0200 |
parents | ea0820d05257 |
children | 29bbe650f2a1 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -289,6 +289,15 @@ arg_string(type_T *type, argcontext_T *c } /* + * 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. */ static int @@ -680,6 +689,7 @@ arg_cursor1(type_T *type, argcontext_T * /* * 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,