encode.h
Go to the documentation of this file.
1 #ifndef NVIM_EVAL_ENCODE_H
2 #define NVIM_EVAL_ENCODE_H
3 
4 #include <msgpack.h>
5 #include <stddef.h>
6 
7 #include "nvim/eval.h"
8 #include "nvim/garray.h"
9 #include "nvim/vim.h" // For STRLEN
10 
18 int encode_vim_to_msgpack(msgpack_packer *const packer,
19  typval_T *const tv,
20  const char *const objname);
21 
29 int encode_vim_to_echo(garray_T *const packer,
30  typval_T *const tv,
31  const char *const objname);
32 
34 typedef struct {
35  const list_T *const list;
36  const listitem_T *li;
37  size_t offset;
38  size_t li_length;
40 
42 static inline ListReaderState encode_init_lrstate(const list_T *const list)
44 {
45  return (ListReaderState) {
46  .list = list,
47  .li = tv_list_first(list),
48  .offset = 0,
49  .li_length = (TV_LIST_ITEM_TV(tv_list_first(list))->vval.v_string == NULL
50  ? 0
51  : STRLEN(TV_LIST_ITEM_TV(tv_list_first(list))->vval.v_string)),
52  };
53 }
54 
56 extern const char *const encode_bool_var_names[];
57 extern const char *const encode_special_var_names[];
58 
60 #define SURROGATE_HI_START 0xD800
61 
63 #define SURROGATE_HI_END 0xDBFF
64 
66 #define SURROGATE_LO_START 0xDC00
67 
69 #define SURROGATE_LO_END 0xDFFF
70 
72 #define SURROGATE_FIRST_CHAR 0x10000
73 
74 #ifdef INCLUDE_GENERATED_DECLARATIONS
75 # include "eval/encode.h.generated.h"
76 #endif
77 #endif // NVIM_EVAL_ENCODE_H
tv
typval_T tv
Definition: typval.c:1694
typval_T
Structure that holds an internal variable value.
Definition: typval.h:131
ListReaderState::offset
size_t offset
Byte offset inside the read item.
Definition: encode.h:37
listvar_S
Definition: typval.h:174
ListReaderState::li
const listitem_T * li
Item currently read.
Definition: encode.h:36
growarray
Definition: garray.h:12
TV_LIST_ITEM_TV
#define TV_LIST_ITEM_TV(li)
Definition: typval.h:855
ListReaderState
Structure defining state for read_from_list()
Definition: encode.h:34
eval.h
FUNC_ATTR_NONNULL_ALL
#define FUNC_ATTR_NONNULL_ALL
Definition: func_attr.h:247
encode_vim_to_msgpack
int encode_vim_to_msgpack(msgpack_packer *const packer, typval_T *const tv, const char *const objname)
ListReaderState::list
const list_T *const list
List being currently read.
Definition: encode.h:35
list
nfa_list_T list[2]
Definition: regexp_nfa.c:5070
listitem_S
Definition: typval.h:158
STRLEN
#define STRLEN(s)
Definition: vim.h:215
ListReaderState::li_length
size_t li_length
Length of the string inside the read item.
Definition: encode.h:38
garray.h
encode_bool_var_names
const char *const encode_bool_var_names[]
Array mapping values from SpecialVarValue enum to names.
Definition: encode.c:34
vim.h
encode_special_var_names
const char *const encode_special_var_names[]
Definition: encode.c:39
encode_vim_to_echo
int encode_vim_to_echo(garray_T *const packer, typval_T *const tv, const char *const objname)
NULL
return NULL
Definition: eval.c:10355