encode.h
Go to the documentation of this file.
1 #ifndef NVIM_EVAL_ENCODE_H
2 #define NVIM_EVAL_ENCODE_H
3 
4 #include <stddef.h>
5 
6 #include <msgpack.h>
7 
8 #include "nvim/eval.h"
9 #include "nvim/garray.h"
10 #include "nvim/vim.h" // For STRLEN
11 
19 int encode_vim_to_msgpack(msgpack_packer *const packer,
20  typval_T *const tv,
21  const char *const objname);
22 
30 int encode_vim_to_echo(garray_T *const packer,
31  typval_T *const tv,
32  const char *const objname);
33 
35 typedef struct {
36  const list_T *const list;
37  const listitem_T *li;
38  size_t offset;
39  size_t li_length;
41 
43 static inline ListReaderState encode_init_lrstate(const list_T *const list)
45 {
46  return (ListReaderState) {
47  .list = list,
48  .li = tv_list_first(list),
49  .offset = 0,
50  .li_length = (TV_LIST_ITEM_TV(tv_list_first(list))->vval.v_string == NULL
51  ? 0
53  tv_list_first(list))->vval.v_string)),
54  };
55 }
56 
58 extern const char *const encode_special_var_names[];
59 
61 #define SURROGATE_HI_START 0xD800
62 
64 #define SURROGATE_HI_END 0xDBFF
65 
67 #define SURROGATE_LO_START 0xDC00
68 
70 #define SURROGATE_LO_END 0xDFFF
71 
73 #define SURROGATE_FIRST_CHAR 0x10000
74 
75 #ifdef INCLUDE_GENERATED_DECLARATIONS
76 # include "eval/encode.h.generated.h"
77 #endif
78 #endif // NVIM_EVAL_ENCODE_H
typval_T tv
Definition: typval.c:1542
Definition: typval.h:164
Structure that holds an internal variable value.
Definition: typval.h:123
Definition: typval.h:148
#define TV_LIST_ITEM_TV(li)
Definition: typval.h:739
return NULL
Definition: eval.c:23643
const listitem_T * li
Item currently read.
Definition: encode.h:37
size_t li_length
Length of the string inside the read item.
Definition: encode.h:39
int encode_vim_to_msgpack(msgpack_packer *const packer, typval_T *const tv, const char *const objname)
Structure defining state for read_from_list()
Definition: encode.h:35
const list_T *const list
List being currently read.
Definition: encode.h:36
Definition: garray.h:12
size_t offset
Byte offset inside the read item.
Definition: encode.h:38
const char *const encode_special_var_names[]
Array mapping values from SpecialVarValue enum to names.
Definition: encode.c:37
#define STRLEN(s)
Definition: vim.h:214
int encode_vim_to_echo(garray_T *const packer, typval_T *const tv, const char *const objname)
#define FUNC_ATTR_NONNULL_ALL
Definition: func_attr.h:243