Data Structures | Macros | Enumerations | Functions
typval_encode.h File Reference
#include <stddef.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include "nvim/lib/kvec.h"
#include "nvim/eval/typval.h"
#include "nvim/func_attr.h"

Go to the source code of this file.

Data Structures

struct  MPConvStackVal
 Structure representing current VimL to messagepack conversion state. More...
 

Macros

#define _mp_size   kv_size
 
#define _mp_init   kvi_init
 
#define _mp_destroy   kvi_destroy
 
#define _mp_push   kvi_push
 
#define _mp_pop   kv_pop
 
#define _mp_last   kv_last
 
#define _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val, copyID_attr, copyID, conv_type)
 
#define _TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf)   pref##name##suf
 
#define _TYPVAL_ENCODE_FUNC_NAME_INNER(pref, name, suf)   _TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf)
 
#define _TYPVAL_ENCODE_FUNC_NAME(pref, suf)   _TYPVAL_ENCODE_FUNC_NAME_INNER(pref, TYPVAL_ENCODE_NAME, suf)
 
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _check_self_reference)
 Self reference checker function name. More...
 
#define _TYPVAL_ENCODE_ENCODE   _TYPVAL_ENCODE_FUNC_NAME(encode_vim_to_, )
 Entry point function name. More...
 
#define _TYPVAL_ENCODE_CONVERT_ONE_VALUE   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _convert_one_value)
 Name of the …convert_one_value function. More...
 
#define TYPVAL_ENCODE_NODICT_VAR   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _nodict_var)
 Name of the dummy const dict_T *const variable. More...
 

Enumerations

enum  MPConvStackValType {
  kMPConvDict, kMPConvList, kMPConvPairs, kMPConvPartial,
  kMPConvPartialList
}
 Type of the stack entry. More...
 
enum  MPConvPartialStage { kMPConvPartialArgs, kMPConvPartialSelf, kMPConvPartialEnd }
 Stage at which partial is being converted. More...
 

Functions

typedef kvec_withinit_t (MPConvStackVal, 8) MPConvStack
 Stack used to convert VimL values to messagepack. More...
 

Detailed Description

Contains common definitions for eval/typval_encode.c.h. Most of time should not be included directly.

Macro Definition Documentation

#define _mp_destroy   kvi_destroy
#define _mp_init   kvi_init
#define _mp_last   kv_last
#define _mp_pop   kv_pop
#define _mp_push   kvi_push
#define _mp_size   kv_size
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _check_self_reference)

Self reference checker function name.

#define _TYPVAL_ENCODE_CONVERT_ONE_VALUE   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _convert_one_value)

Name of the …convert_one_value function.

#define _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE (   val,
  copyID_attr,
  copyID,
  conv_type 
)
Value:
do { \
const int te_csr_ret = _TYPVAL_ENCODE_CHECK_SELF_REFERENCE( \
(val), &(val)->copyID_attr, mpstack, copyID, conv_type, objname); \
if (te_csr_ret != NOTDONE) { \
return te_csr_ret; \
} \
} while (0)
if(len)
Definition: encode.c:222
#define TYPVAL_ENCODE_FIRST_ARG_NAME
Definition: helpers.c:566
return
Definition: eval.c:15259
#define NOTDONE
Definition: vim.h:94
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE
Self reference checker function name.
Definition: typval_encode.h:131

Code for checking whether container references itself

Parameters
[in,out]valContainer to check.
copyID_attrName of the container attribute that holds copyID. After checking whether value of this attribute is copyID (variable) it is set to copyID.
[in]copyIDCopyID used by the caller.
conv_typeType of the conversion,
See also
MPConvStackValType.
#define _TYPVAL_ENCODE_ENCODE   _TYPVAL_ENCODE_FUNC_NAME(encode_vim_to_, )

Entry point function name.

#define _TYPVAL_ENCODE_FUNC_NAME (   pref,
  suf 
)    _TYPVAL_ENCODE_FUNC_NAME_INNER(pref, TYPVAL_ENCODE_NAME, suf)

Construct function name, possibly using macros

Is used to expand macros that may appear in arguments.

Note
Expands all arguments, even if only one is needed.
Parameters
[in]prefPrefix.
[in]sufSuffix.
Returns
Concat: pref + TYPVAL_ENCODE_NAME + suf.
#define _TYPVAL_ENCODE_FUNC_NAME_INNER (   pref,
  name,
  suf 
)    _TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf)
#define _TYPVAL_ENCODE_FUNC_NAME_INNER_2 (   pref,
  name,
  suf 
)    pref##name##suf
#define TYPVAL_ENCODE_NODICT_VAR   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _nodict_var)

Name of the dummy const dict_T *const variable.

Enumeration Type Documentation

Stage at which partial is being converted.

Enumerator
kMPConvPartialArgs 

About to convert arguments.

kMPConvPartialSelf 

About to convert self dictionary.

kMPConvPartialEnd 

Already converted everything.

Type of the stack entry.

Enumerator
kMPConvDict 

Convert dict_T *dictionary.

kMPConvList 

Convert list_T *list.

kMPConvPairs 

Convert mapping represented as a list_T* of pairs.

kMPConvPartial 

Convert partial_T* partial.

kMPConvPartialList 

Convert argc/argv pair coming from a partial.

Function Documentation

typedef kvec_withinit_t ( MPConvStackVal  ,
 
)

Stack used to convert VimL values to messagepack.