mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
doc: eval/typval_encode.h
Annotate TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS to aid code navigation.
This commit is contained in:
parent
ed198737fd
commit
b172f9904f
@ -472,6 +472,8 @@ static inline void typval_encode_dict_end(EncodedData *const edata)
|
|||||||
#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \
|
#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type) \
|
||||||
TYPVAL_ENCODE_CONV_NIL()
|
TYPVAL_ENCODE_CONV_NIL()
|
||||||
|
|
||||||
|
// object_convert_one_value()
|
||||||
|
// encode_vim_to_object()
|
||||||
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, object, EncodedData *const, edata)
|
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, object, EncodedData *const, edata)
|
||||||
|
|
||||||
#undef TYPVAL_ENCODE_CONV_STRING
|
#undef TYPVAL_ENCODE_CONV_STRING
|
||||||
|
@ -18096,6 +18096,8 @@ void free_tv(typval_T *varp)
|
|||||||
|
|
||||||
#define TYPVAL_ENCODE_CONV_RECURSE(ignored1, ignored2)
|
#define TYPVAL_ENCODE_CONV_RECURSE(ignored1, ignored2)
|
||||||
|
|
||||||
|
// nothing_convert_one_value()
|
||||||
|
// encode_vim_to_nothing()
|
||||||
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, nothing, void *, ignored)
|
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, nothing, void *, ignored)
|
||||||
|
|
||||||
#undef TYPVAL_ENCODE_ALLOW_SPECIALS
|
#undef TYPVAL_ENCODE_ALLOW_SPECIALS
|
||||||
|
@ -383,6 +383,8 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
|
|||||||
|
|
||||||
#define TYPVAL_ENCODE_ALLOW_SPECIALS false
|
#define TYPVAL_ENCODE_ALLOW_SPECIALS false
|
||||||
|
|
||||||
|
// string_convert_one_value()
|
||||||
|
// encode_vim_to_string()
|
||||||
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, string, garray_T *const, gap)
|
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, string, garray_T *const, gap)
|
||||||
|
|
||||||
#undef TYPVAL_ENCODE_CONV_RECURSE
|
#undef TYPVAL_ENCODE_CONV_RECURSE
|
||||||
@ -413,6 +415,8 @@ TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, string, garray_T *const, gap)
|
|||||||
return OK; \
|
return OK; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
// echo_convert_one_value()
|
||||||
|
// encode_vim_to_echo()
|
||||||
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(, echo, garray_T *const, gap)
|
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(, echo, garray_T *const, gap)
|
||||||
|
|
||||||
#undef TYPVAL_ENCODE_CONV_RECURSE
|
#undef TYPVAL_ENCODE_CONV_RECURSE
|
||||||
@ -704,6 +708,8 @@ bool encode_check_json_key(const typval_T *const tv)
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
// json_convert_one_value()
|
||||||
|
// encode_vim_to_json()
|
||||||
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, json, garray_T *const, gap)
|
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(static, json, garray_T *const, gap)
|
||||||
|
|
||||||
#undef TYPVAL_ENCODE_CONV_STRING
|
#undef TYPVAL_ENCODE_CONV_STRING
|
||||||
@ -886,6 +892,8 @@ char *encode_tv2json(typval_T *tv, size_t *len)
|
|||||||
|
|
||||||
#define TYPVAL_ENCODE_ALLOW_SPECIALS true
|
#define TYPVAL_ENCODE_ALLOW_SPECIALS true
|
||||||
|
|
||||||
|
// msgpack_convert_one_value()
|
||||||
|
// encode_vim_to_msgpack()
|
||||||
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(, msgpack, msgpack_packer *const, packer)
|
TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(, msgpack, msgpack_packer *const, packer)
|
||||||
|
|
||||||
#undef TYPVAL_ENCODE_CONV_STRING
|
#undef TYPVAL_ENCODE_CONV_STRING
|
||||||
|
@ -212,10 +212,9 @@ static inline size_t tv_strlen(const typval_T *const tv)
|
|||||||
: strlen((char *) tv->vval.v_string));
|
: strlen((char *) tv->vval.v_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Define functions which convert VimL value to something else
|
/// Define functions to convert a VimL value:
|
||||||
///
|
/// `{name}_convert_one_value(...)`
|
||||||
/// Creates function `vim_to_{name}(firstargtype firstargname, typval_T *const
|
/// `encode_vim_to_{name}(...)`
|
||||||
/// tv)` which returns OK or FAIL and helper functions.
|
|
||||||
///
|
///
|
||||||
/// @param scope Scope of the main function: either nothing or `static`.
|
/// @param scope Scope of the main function: either nothing or `static`.
|
||||||
/// @param name Name of the target converter.
|
/// @param name Name of the target converter.
|
||||||
@ -224,6 +223,7 @@ static inline size_t tv_strlen(const typval_T *const tv)
|
|||||||
/// @param firstargname Name of the first argument.
|
/// @param firstargname Name of the first argument.
|
||||||
#define TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(scope, name, firstargtype, \
|
#define TYPVAL_ENCODE_DEFINE_CONV_FUNCTIONS(scope, name, firstargtype, \
|
||||||
firstargname) \
|
firstargname) \
|
||||||
|
/* Returns OK or FAIL */ \
|
||||||
static int name##_convert_one_value(firstargtype firstargname, \
|
static int name##_convert_one_value(firstargtype firstargname, \
|
||||||
MPConvStack *const mpstack, \
|
MPConvStack *const mpstack, \
|
||||||
typval_T *const tv, \
|
typval_T *const tv, \
|
||||||
|
Loading…
Reference in New Issue
Block a user