summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-09-14 17:54:30 +0200
committerBram Moolenaar <Bram@vim.org>2021-09-14 17:54:30 +0200
commit5dfe467432638fac2e0156a2f9cd0d9eb569fb39 (patch)
treef26436377c3b39cbbd4881d7c18450e61dc0d3ef /runtime
parentf5785cf0592626ec17676e814d3ba58f5123bcda (diff)
patch 8.2.3438: cannot manipulate blobsv8.2.3438
Problem: Cannot manipulate blobs. Solution: Add blob2list() and list2blob(). (Yegappan Lakshmanan, closes #8868)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt28
-rw-r--r--runtime/doc/usr_41.txt6
2 files changed, 33 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 562198e79c..a969104e94 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2469,6 +2469,7 @@ atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
balloon_gettext() String current text in the balloon
balloon_show({expr}) none show {expr} inside the balloon
balloon_split({msg}) List split {msg} as used for a balloon
+blob2list({blob}) List convert {blob} into a list of numbers
browse({save}, {title}, {initdir}, {default})
String put up a file requester
browsedir({title}, {initdir}) String put up a directory requester
@@ -2721,7 +2722,8 @@ libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
line({expr} [, {winid}]) Number line nr of cursor, last line or mark
line2byte({lnum}) Number byte count of line {lnum}
lispindent({lnum}) Number Lisp indent for line {lnum}
-list2str({list} [, {utf8}]) String turn numbers in {list} into a String
+list2blob({list}) Blob turn {list} of numbers into a Blob
+list2str({list} [, {utf8}]) String turn {list} of numbers into a String
listener_add({callback} [, {buf}])
Number add a callback to listen to changes
listener_flush([{buf}]) none invoke listener callbacks
@@ -3355,6 +3357,17 @@ balloon_split({msg}) *balloon_split()*
< {only available when compiled with the |+balloon_eval_term|
feature}
+blob2list({blob}) *blob2list()*
+ Return a List containing the number value of each byte in Blob
+ {blob}. Examples: >
+ blob2list(0z0102.0304) returns [1, 2, 3, 4]
+ blob2list(0z) returns []
+< Returns an empty List on error. |list2blob()| does the
+ opposite.
+
+ Can also be used as a |method|: >
+ GetBlob()->blob2list()
+
*browse()*
browse({save}, {title}, {initdir}, {default})
Put up a file requester. This only works when "has("browse")"
@@ -7208,6 +7221,19 @@ lispindent({lnum}) *lispindent()*
Can also be used as a |method|: >
GetLnum()->lispindent()
+list2blob({list}) *list2blob()*
+ Return a Blob concatenating all the number values in {list}.
+ Examples: >
+ list2blob([1, 2, 3, 4]) returns 0z01020304
+ list2blob([]) returns 0z
+< Returns an empty Blob on error. If one of the numbers is
+ negative or more than 255 error *E1239* is given.
+
+ |blob2list()| does the opposite.
+
+ Can also be used as a |method|: >
+ GetList()->list2blob()
+
list2str({list} [, {utf8}]) *list2str()*
Convert each number in {list} to a character string can
concatenate them all. Examples: >
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index a5dde18c38..1e1a23d673 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -723,6 +723,10 @@ Floating point computation: *float-functions*
isinf() check for infinity
isnan() check for not a number
+Blob manipulation: *blob-functions*
+ blob2list() get a list of numbers from a blob
+ list2blob() get a blob from a list of numbers
+
Other computation: *bitwise-function*
and() bitwise AND
invert() bitwise invert
@@ -1449,6 +1453,8 @@ is a List with arguments.
Function references are most useful in combination with a Dictionary, as is
explained in the next section.
+More information about defining your own functions here: |user-functions|.
+
==============================================================================
*41.8* Lists and Dictionaries