robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

bfredlMerge pull request #39736 from bfredl/odod8275b7b491

master
1.7 KiB54 linesraw
1#pragma once
2
3#include <string.h>
4
5#include "nvim/eval/typval_defs.h"
6#include "nvim/garray_defs.h"
7#include "nvim/msgpack_rpc/packer_defs.h"
8
9/// Convert Vimscript value to msgpack string
10///
11/// @param[out]  packer  Packer to save results in.
12/// @param[in]  tv  Dumped value.
13/// @param[in]  objname  Object name, used for error message.
14///
15/// @return OK in case of success, FAIL otherwise.
16int encode_vim_to_msgpack(PackerBuffer *packer, typval_T *tv, const char *objname);
17
18/// Convert Vimscript value to :echo output
19///
20/// @param[out]  gap  garray_T to save results in.
21/// @param[in]  tv  Dumped value.
22/// @param[in]  objname  Object name, used for error message.
23///
24/// @return OK in case of success, FAIL otherwise.
25int encode_vim_to_echo(garray_T *gap, typval_T *tv, const char *objname);
26
27/// Structure defining state for read_from_list()
28typedef struct {
29  const list_T *const list;  ///< List being currently read.
30  const listitem_T *li;  ///< Item currently read.
31  size_t offset;  ///< Byte offset inside the read item.
32  size_t li_length;  ///< Length of the string inside the read item.
33} ListReaderState;
34
35/// Array mapping values from SpecialVarValue enum to names
36extern const char *const encode_bool_var_names[];
37extern const char *const encode_special_var_names[];
38
39/// First codepoint in high surrogates block
40#define SURROGATE_HI_START 0xD800
41
42/// Last codepoint in high surrogates block
43#define SURROGATE_HI_END   0xDBFF
44
45/// First codepoint in low surrogates block
46#define SURROGATE_LO_START 0xDC00
47
48/// Last codepoint in low surrogates block
49#define SURROGATE_LO_END   0xDFFF
50
51/// First character that needs to be encoded as surrogate pair
52#define SURROGATE_FIRST_CHAR 0x10000
53
54#include "eval/encode.h.generated.h"