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

◆ _mp_destroy

#define _mp_destroy   kvi_destroy

◆ _mp_init

#define _mp_init   kvi_init

◆ _mp_last

#define _mp_last   kv_last

◆ _mp_pop

#define _mp_pop   kv_pop

◆ _mp_push

#define _mp_push   kvi_push

◆ _mp_size

#define _mp_size   kv_size

◆ _TYPVAL_ENCODE_CHECK_SELF_REFERENCE

#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _check_self_reference)

Self reference checker function name.

◆ _TYPVAL_ENCODE_CONVERT_ONE_VALUE

#define _TYPVAL_ENCODE_CONVERT_ONE_VALUE   _TYPVAL_ENCODE_FUNC_NAME(_typval_encode_, _convert_one_value)

Name of the …convert_one_value function.

◆ _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE

#define _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE (   val,
  copyID_attr,
  copyID,
  conv_type 
)
Value:
do { \
(val), &(val)->copyID_attr, mpstack, \
copyID, conv_type, objname); \
if (te_csr_ret != NOTDONE) { \
return te_csr_ret; \
} \
} while (0)

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.

◆ _TYPVAL_ENCODE_ENCODE

#define _TYPVAL_ENCODE_ENCODE   _TYPVAL_ENCODE_FUNC_NAME(encode_vim_to_, )

Entry point function name.

◆ _TYPVAL_ENCODE_FUNC_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.

◆ _TYPVAL_ENCODE_FUNC_NAME_INNER

#define _TYPVAL_ENCODE_FUNC_NAME_INNER (   pref,
  name,
  suf 
)    _TYPVAL_ENCODE_FUNC_NAME_INNER_2(pref, name, suf)

◆ _TYPVAL_ENCODE_FUNC_NAME_INNER_2

#define _TYPVAL_ENCODE_FUNC_NAME_INNER_2 (   pref,
  name,
  suf 
)    pref##name##suf

◆ TYPVAL_ENCODE_NODICT_VAR

#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

◆ MPConvPartialStage

Stage at which partial is being converted.

Enumerator
kMPConvPartialArgs 

About to convert arguments.

kMPConvPartialSelf 

About to convert self dictionary.

kMPConvPartialEnd 

Already converted everything.

◆ MPConvStackValType

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

◆ kvec_withinit_t()

typedef kvec_withinit_t ( MPConvStackVal  ,
 
)

Stack used to convert VimL values to messagepack.

_TYPVAL_ENCODE_CHECK_SELF_REFERENCE
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE
Self reference checker function name.
Definition: typval_encode.h:131
TYPVAL_ENCODE_FIRST_ARG_NAME
#define TYPVAL_ENCODE_FIRST_ARG_NAME
Definition: converter.c:189
NOTDONE
#define NOTDONE
Definition: vim.h:93