typval_encode.c.h
Go to the documentation of this file.
1 
15 
26 
33 
43 
50 
61 
72 
85 
92 
98 
105 
113 
118 
123 
131 
138 
148 
153 
158 
171 
179 
185 
193 
201 
209 
215 
221 
224 
232 
237 
243 #include <assert.h>
244 #include <inttypes.h>
245 #include <stddef.h>
246 
247 #include "nvim/eval/encode.h"
248 #include "nvim/eval/typval.h"
249 #include "nvim/eval/typval_encode.h"
250 #include "nvim/func_attr.h"
251 #include "nvim/lib/kvec.h"
252 
258 
259 static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
261  void *const val, int *const val_copyID,
262  const MPConvStack *const mpstack, const int copyID,
263  const MPConvStackValType conv_type,
264  const char *const objname)
267 
282 static inline int _TYPVAL_ENCODE_CHECK_SELF_REFERENCE(
283  TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, void *const val, int *const val_copyID,
284  const MPConvStack *const mpstack, const int copyID, const MPConvStackValType conv_type,
285  const char *const objname)
286 {
287  if (*val_copyID == copyID) {
288  TYPVAL_ENCODE_CONV_RECURSE(val, conv_type);
289  return OK;
290  }
291  *val_copyID = copyID;
292  return NOTDONE;
293 }
294 
297  MPConvStack *const mpstack, MPConvStackVal *const cur_mpsv,
298  typval_T *const tv, const int copyID,
299  const char *const objname)
301 
321  MPConvStackVal *const cur_mpsv, typval_T *const tv, const int copyID, const char *const objname)
322 {
323  switch (tv->v_type) {
324  case VAR_STRING:
326  break;
327  case VAR_NUMBER:
329  break;
330  case VAR_FLOAT:
332  break;
333  case VAR_BLOB:
335  tv_blob_len(tv->vval.v_blob));
336  break;
337  case VAR_FUNC:
342  break;
343  case VAR_PARTIAL: {
344  partial_T *const pt = tv->vval.v_partial;
345  (void)pt;
347  tv, (pt == NULL ? NULL : partial_name(pt)));
348  _mp_push(*mpstack, ((MPConvStackVal) { // -V779
349  .type = kMPConvPartial,
350  .tv = tv,
351  .saved_copyID = copyID - 1,
352  .data = {
353  .p = {
354  .stage = kMPConvPartialArgs,
355  .pt = tv->vval.v_partial,
356  },
357  },
358  }));
359  break;
360  }
361  case VAR_LIST: {
362  if (tv->vval.v_list == NULL || tv_list_len(tv->vval.v_list) == 0) {
364  break;
365  }
366  const int saved_copyID = tv_list_copyid(tv->vval.v_list);
368  kMPConvList);
370  assert(saved_copyID != copyID);
371  _mp_push(*mpstack, ((MPConvStackVal) {
372  .type = kMPConvList,
373  .tv = tv,
374  .saved_copyID = saved_copyID,
375  .data = {
376  .l = {
377  .list = tv->vval.v_list,
378  .li = tv_list_first(tv->vval.v_list),
379  },
380  },
381  }));
383  break;
384  }
385  case VAR_BOOL:
386  switch (tv->vval.v_bool) {
387  case kBoolVarTrue:
388  case kBoolVarFalse:
390  break;
391  }
392  break;
393  case VAR_SPECIAL:
394  switch (tv->vval.v_special) {
395  case kSpecialVarNull:
396  TYPVAL_ENCODE_CONV_NIL(tv); // -V1037
397  break;
398  }
399  break;
400  case VAR_DICT: {
401  if (tv->vval.v_dict == NULL
402  || tv->vval.v_dict->dv_hashtab.ht_used == 0) {
404  break;
405  }
406  const dictitem_T *type_di;
407  const dictitem_T *val_di;
409  && tv->vval.v_dict->dv_hashtab.ht_used == 2
410  && (type_di = tv_dict_find((dict_T *)tv->vval.v_dict,
411  S_LEN("_TYPE"))) != NULL
412  && type_di->di_tv.v_type == VAR_LIST
413  && (val_di = tv_dict_find((dict_T *)tv->vval.v_dict,
414  S_LEN("_VAL"))) != NULL) {
415  size_t i;
416  for (i = 0; i < ARRAY_SIZE(eval_msgpack_type_lists); i++) {
417  if (type_di->di_tv.vval.v_list == eval_msgpack_type_lists[i]) {
418  break;
419  }
420  }
422  goto _convert_one_value_regular_dict;
423  }
424  switch ((MessagePackType)i) {
425  case kMPNil:
427  break;
428  case kMPBoolean:
429  if (val_di->di_tv.v_type != VAR_NUMBER) {
430  goto _convert_one_value_regular_dict;
431  }
432  TYPVAL_ENCODE_CONV_BOOL(tv, val_di->di_tv.vval.v_number);
433  break;
434  case kMPInteger: {
435  const list_T *val_list;
437  varnumber_T highest_bits;
438  varnumber_T high_bits;
439  varnumber_T low_bits;
440  // List of 4 integers; first is signed (should be 1 or -1, but
441  // this is not checked), second is unsigned and have at most
442  // one (sign is -1) or two (sign is 1) non-zero bits (number of
443  // bits is not checked), other unsigned and have at most 31
444  // non-zero bits (number of bits is not checked).
445  if (val_di->di_tv.v_type != VAR_LIST
446  || tv_list_len(val_list = val_di->di_tv.vval.v_list) != 4) {
447  goto _convert_one_value_regular_dict;
448  }
449 
450  const listitem_T *const sign_li = tv_list_first(val_list);
451  if (TV_LIST_ITEM_TV(sign_li)->v_type != VAR_NUMBER
452  || (sign = TV_LIST_ITEM_TV(sign_li)->vval.v_number) == 0) {
453  goto _convert_one_value_regular_dict;
454  }
455 
456  const listitem_T *const highest_bits_li = (
457  TV_LIST_ITEM_NEXT(val_list, sign_li));
458  if (TV_LIST_ITEM_TV(highest_bits_li)->v_type != VAR_NUMBER
459  || ((highest_bits
460  = TV_LIST_ITEM_TV(highest_bits_li)->vval.v_number)
461  < 0)) {
462  goto _convert_one_value_regular_dict;
463  }
464 
465  const listitem_T *const high_bits_li = (
466  TV_LIST_ITEM_NEXT(val_list, highest_bits_li));
467  if (TV_LIST_ITEM_TV(high_bits_li)->v_type != VAR_NUMBER
468  || ((high_bits = TV_LIST_ITEM_TV(high_bits_li)->vval.v_number)
469  < 0)) {
470  goto _convert_one_value_regular_dict;
471  }
472 
473  const listitem_T *const low_bits_li = tv_list_last(val_list);
474  if (TV_LIST_ITEM_TV(low_bits_li)->v_type != VAR_NUMBER
475  || ((low_bits = TV_LIST_ITEM_TV(low_bits_li)->vval.v_number)
476  < 0)) {
477  goto _convert_one_value_regular_dict;
478  }
479 
480  const uint64_t number = ((uint64_t)(((uint64_t)highest_bits) << 62)
481  | (uint64_t)(((uint64_t)high_bits) << 31)
482  | (uint64_t)low_bits);
483  if (sign > 0) {
485  } else {
486  TYPVAL_ENCODE_CONV_NUMBER(tv, -number);
487  }
488  break;
489  }
490  case kMPFloat:
491  if (val_di->di_tv.v_type != VAR_FLOAT) {
492  goto _convert_one_value_regular_dict;
493  }
494  TYPVAL_ENCODE_CONV_FLOAT(tv, val_di->di_tv.vval.v_float);
495  break;
496  case kMPString:
497  case kMPBinary: {
498  const bool is_string = ((MessagePackType)i == kMPString);
499  if (val_di->di_tv.v_type != VAR_LIST) {
500  goto _convert_one_value_regular_dict;
501  }
502  size_t len;
503  char *buf;
504  if (!encode_vim_list_to_buf(val_di->di_tv.vval.v_list, &len,
505  &buf)) {
506  goto _convert_one_value_regular_dict;
507  }
508  if (is_string) {
510  } else { // -V523
512  }
513  xfree(buf);
514  break;
515  }
516  case kMPArray: {
517  if (val_di->di_tv.v_type != VAR_LIST) {
518  goto _convert_one_value_regular_dict;
519  }
520  const int saved_copyID = tv_list_copyid(val_di->di_tv.vval.v_list);
521  _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val_di->di_tv.vval.v_list,
522  lv_copyID, copyID,
523  kMPConvList);
524  TYPVAL_ENCODE_CONV_LIST_START(tv, tv_list_len(val_di->di_tv.vval.v_list));
525  assert(saved_copyID != copyID && saved_copyID != copyID - 1);
526  _mp_push(*mpstack, ((MPConvStackVal) {
527  .tv = tv,
528  .type = kMPConvList,
529  .saved_copyID = saved_copyID,
530  .data = {
531  .l = {
532  .list = val_di->di_tv.vval.v_list,
533  .li = tv_list_first(val_di->di_tv.vval.v_list),
534  },
535  },
536  }));
537  break;
538  }
539  case kMPMap: {
540  if (val_di->di_tv.v_type != VAR_LIST) {
541  goto _convert_one_value_regular_dict;
542  }
543  list_T *const val_list = val_di->di_tv.vval.v_list;
544  if (val_list == NULL || tv_list_len(val_list) == 0) {
547  break;
548  }
549  TV_LIST_ITER_CONST(val_list, li, {
551  || tv_list_len(TV_LIST_ITEM_TV(li)->vval.v_list) != 2) {
552  goto _convert_one_value_regular_dict;
553  }
554  });
555  const int saved_copyID = tv_list_copyid(val_di->di_tv.vval.v_list);
556  _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val_list, lv_copyID, copyID,
557  kMPConvPairs);
559  tv_list_len(val_list));
560  assert(saved_copyID != copyID && saved_copyID != copyID - 1);
561  _mp_push(*mpstack, ((MPConvStackVal) {
562  .tv = tv,
563  .type = kMPConvPairs,
564  .saved_copyID = saved_copyID,
565  .data = {
566  .l = {
567  .list = val_list,
568  .li = tv_list_first(val_list),
569  },
570  },
571  }));
572  break;
573  }
574  case kMPExt: {
575  const list_T *val_list;
577  if (val_di->di_tv.v_type != VAR_LIST
578  || tv_list_len((val_list = val_di->di_tv.vval.v_list)) != 2
579  || (TV_LIST_ITEM_TV(tv_list_first(val_list))->v_type
580  != VAR_NUMBER)
581  || ((type
582  = TV_LIST_ITEM_TV(tv_list_first(val_list))->vval.v_number)
583  > INT8_MAX)
584  || type < INT8_MIN
585  || (TV_LIST_ITEM_TV(tv_list_last(val_list))->v_type
586  != VAR_LIST)) {
587  goto _convert_one_value_regular_dict;
588  }
589  size_t len;
590  char *buf;
591  if (!(
592  encode_vim_list_to_buf(TV_LIST_ITEM_TV(tv_list_last(val_list))->vval.v_list, &len,
593  &buf))) {
594  goto _convert_one_value_regular_dict;
595  }
597  xfree(buf);
598  break;
599  }
600  }
601  break;
602  }
603 _convert_one_value_regular_dict: {}
604  const int saved_copyID = tv->vval.v_dict->dv_copyID;
606  kMPConvDict);
608  tv->vval.v_dict->dv_hashtab.ht_used);
609  assert(saved_copyID != copyID);
610  _mp_push(*mpstack, ((MPConvStackVal) {
611  .tv = tv,
612  .type = kMPConvDict,
613  .saved_copyID = saved_copyID,
614  .data = {
615  .d = {
616  .dict = tv->vval.v_dict,
617  .dictp = &tv->vval.v_dict,
618  .hi = tv->vval.v_dict->dv_hashtab.ht_array,
619  .todo = tv->vval.v_dict->dv_hashtab.ht_used,
620  },
621  },
622  }));
624  _mp_last(*mpstack));
625  break;
626  }
627  case VAR_UNKNOWN:
629  return FAIL;
630  }
631 typval_encode_stop_converting_one_item:
632  return OK;
633  // Prevent “unused label” warnings.
634  goto typval_encode_stop_converting_one_item; // -V779
635 }
636 
639  typval_T *const tv, const char *const objname)
641 
653  const char *const objname)
654 {
655  const int copyID = get_copyID();
656  MPConvStack mpstack;
657  _mp_init(mpstack);
659  NULL,
660  top_tv, copyID, objname)
661  == FAIL) {
662  goto encode_vim_to__error_ret;
663  }
666 typval_encode_stop_converting_one_item:
667  while (_mp_size(mpstack)) {
668  MPConvStackVal *cur_mpsv = &_mp_last(mpstack);
669  typval_T *tv = NULL;
670  switch (cur_mpsv->type) {
671  case kMPConvDict: {
672  if (!cur_mpsv->data.d.todo) {
673  (void)_mp_pop(mpstack);
674  cur_mpsv->data.d.dict->dv_copyID = cur_mpsv->saved_copyID;
675  TYPVAL_ENCODE_CONV_DICT_END(cur_mpsv->tv, *cur_mpsv->data.d.dictp);
676  continue;
677  } else if (cur_mpsv->data.d.todo
678  != cur_mpsv->data.d.dict->dv_hashtab.ht_used) {
680  *cur_mpsv->data.d.dictp);
681  }
682  while (HASHITEM_EMPTY(cur_mpsv->data.d.hi)) {
683  cur_mpsv->data.d.hi++;
684  }
685  dictitem_T *const di = TV_DICT_HI2DI(cur_mpsv->data.d.hi);
686  cur_mpsv->data.d.todo--;
687  cur_mpsv->data.d.hi++;
689  strlen((char *)&di->di_key[0]));
691  *cur_mpsv->data.d.dictp);
692  tv = &di->di_tv;
693  break;
694  }
695  case kMPConvList:
696  if (cur_mpsv->data.l.li == NULL) {
697  (void)_mp_pop(mpstack);
698  tv_list_set_copyid(cur_mpsv->data.l.list, cur_mpsv->saved_copyID);
699  TYPVAL_ENCODE_CONV_LIST_END(cur_mpsv->tv);
700  continue;
701  } else if (cur_mpsv->data.l.li
702  != tv_list_first(cur_mpsv->data.l.list)) {
704  }
705  tv = TV_LIST_ITEM_TV(cur_mpsv->data.l.li);
706  cur_mpsv->data.l.li = TV_LIST_ITEM_NEXT(cur_mpsv->data.l.list,
707  cur_mpsv->data.l.li);
708  break;
709  case kMPConvPairs: {
710  if (cur_mpsv->data.l.li == NULL) {
711  (void)_mp_pop(mpstack);
712  tv_list_set_copyid(cur_mpsv->data.l.list, cur_mpsv->saved_copyID);
714  continue;
715  } else if (cur_mpsv->data.l.li
716  != tv_list_first(cur_mpsv->data.l.list)) {
718  }
719  const list_T *const kv_pair = (
720  TV_LIST_ITEM_TV(cur_mpsv->data.l.li)->vval.v_list);
721  TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(encode_vim_to__error_ret,
722  *TV_LIST_ITEM_TV(tv_list_first(kv_pair)));
723  if (
725  TV_LIST_ITEM_TV(tv_list_first(kv_pair)), copyID, objname)
726  == FAIL) {
727  goto encode_vim_to__error_ret;
728  }
731  tv = TV_LIST_ITEM_TV(tv_list_last(kv_pair));
732  cur_mpsv->data.l.li = TV_LIST_ITEM_NEXT(cur_mpsv->data.l.list,
733  cur_mpsv->data.l.li);
734  break;
735  }
736  case kMPConvPartial: {
737  partial_T *const pt = cur_mpsv->data.p.pt;
738  tv = cur_mpsv->tv;
739  (void)tv;
740  switch (cur_mpsv->data.p.stage) {
741  case kMPConvPartialArgs:
743  pt == NULL ? 0 : pt->pt_argc);
744  cur_mpsv->data.p.stage = kMPConvPartialSelf;
745  if (pt != NULL && pt->pt_argc > 0) {
747  _mp_push(mpstack, ((MPConvStackVal) {
748  .type = kMPConvPartialList,
749  .tv = NULL,
750  .saved_copyID = copyID - 1,
751  .data = {
752  .a = {
753  .arg = pt->pt_argv,
754  .argv = pt->pt_argv,
755  .todo = (size_t)pt->pt_argc,
756  },
757  },
758  }));
759  }
760  break;
761  case kMPConvPartialSelf: {
762  cur_mpsv->data.p.stage = kMPConvPartialEnd;
763  dict_T *const dict = pt == NULL ? NULL : pt->pt_dict;
764  if (dict != NULL) {
765  TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, dict->dv_hashtab.ht_used);
766  if (dict->dv_hashtab.ht_used == 0) {
768  continue;
769  }
770  const int saved_copyID = dict->dv_copyID;
772  dict, &dict->dv_copyID,
773  &mpstack, copyID, kMPConvDict,
774  objname);
775  if (te_csr_ret != NOTDONE) {
776  if (te_csr_ret == FAIL) {
777  goto encode_vim_to__error_ret;
778  } else {
779  continue;
780  }
781  }
783  dict->dv_hashtab.ht_used);
784  assert(saved_copyID != copyID && saved_copyID != copyID - 1);
785  _mp_push(mpstack, ((MPConvStackVal) {
786  .type = kMPConvDict,
787  .tv = NULL,
788  .saved_copyID = saved_copyID,
789  .data = {
790  .d = {
791  .dict = dict,
792  .dictp = &pt->pt_dict,
793  .hi = dict->dv_hashtab.ht_array,
794  .todo = dict->dv_hashtab.ht_used,
795  },
796  },
797  }));
799  _mp_last(mpstack));
800  } else {
802  }
803  break;
804  }
805  case kMPConvPartialEnd:
807  (void)_mp_pop(mpstack);
808  break;
809  }
810  continue;
811  }
812  case kMPConvPartialList:
813  if (!cur_mpsv->data.a.todo) {
814  (void)_mp_pop(mpstack);
816  continue;
817  } else if (cur_mpsv->data.a.argv != cur_mpsv->data.a.arg) {
819  }
820  tv = cur_mpsv->data.a.arg++;
821  cur_mpsv->data.a.todo--;
822  break;
823  }
824  assert(tv != NULL);
826  cur_mpsv, tv, copyID, objname)
827  == FAIL) {
828  goto encode_vim_to__error_ret;
829  }
830  }
831  _mp_destroy(mpstack);
832  return OK;
833 encode_vim_to__error_ret:
834  _mp_destroy(mpstack);
835  return FAIL;
836  // Prevent “unused label” warnings.
837  goto typval_encode_stop_converting_one_item; // -V779
838 }
kMPInteger
@ kMPInteger
Definition: eval.h:178
_mp_init
#define _mp_init
Definition: typval_encode.h:68
_TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE
#define _TYPVAL_ENCODE_DO_CHECK_SELF_REFERENCE(val, copyID_attr, copyID, conv_type)
Definition: typval_encode.h:101
VAR_FLOAT
@ VAR_FLOAT
Floating-point value, .v_float is used.
Definition: typval.h:122
TYPVAL_ENCODE_ALLOW_SPECIALS
#define TYPVAL_ENCODE_ALLOW_SPECIALS
Definition: converter.c:23
typval_T::typval_vval_union::v_special
SpecialVarValue v_special
Special value, for VAR_SPECIAL.
Definition: typval.h:137
partial_S::pt_dict
dict_T * pt_dict
Dict for "self".
Definition: typval.h:369
tv
typval_T tv
Definition: typval.c:1694
TV_LIST_ITER_CONST
TV_LIST_ITER_CONST(list, li, { if(TV_LIST_ITEM_TV(li) ->v_type !=VAR_STRING) { return false;} len++;if(TV_LIST_ITEM_TV(li) ->vval.v_string !=NULL) { len+=STRLEN(TV_LIST_ITEM_TV(li) ->vval.v_string);} })
typval_T::typval_vval_union::v_number
varnumber_T v_number
Number, for VAR_NUMBER.
Definition: typval.h:135
TYPVAL_ENCODE_CONV_BLOB
#define TYPVAL_ENCODE_CONV_BLOB(tv, blob, len)
Definition: converter.c:52
MPConvStackVal::saved_copyID
int saved_copyID
copyID item used to have.
Definition: typval_encode.h:37
typval_T
Structure that holds an internal variable value.
Definition: typval.h:131
kMPBinary
@ kMPBinary
Definition: eval.h:181
typval_T::typval_vval_union::v_partial
partial_T * v_partial
Closure: function with args.
Definition: typval.h:142
TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS
#define TYPVAL_ENCODE_CONV_LIST_BETWEEN_ITEMS(tv)
Definition: converter.c:104
TYPVAL_ENCODE_FIRST_ARG_TYPE
#define TYPVAL_ENCODE_FIRST_ARG_TYPE
Definition: converter.c:188
TYPVAL_ENCODE_SCOPE
#define TYPVAL_ENCODE_SCOPE
Definition: converter.c:186
encode.h
VAR_STRING
@ VAR_STRING
String, .v_string is used.
Definition: typval.h:118
i
static void int i
Definition: edit.c:2997
kMPConvPartialArgs
@ kMPConvPartialArgs
About to convert arguments.
Definition: typval_encode.h:28
typval_encode.h
listvar_S
Definition: typval.h:174
TV_LIST_ITEM_NEXT
#define TV_LIST_ITEM_NEXT(l, li)
Definition: typval.h:863
TYPVAL_ENCODE_CONV_EMPTY_DICT
#define TYPVAL_ENCODE_CONV_EMPTY_DICT(tv, dict)
Definition: converter.c:75
_mp_destroy
#define _mp_destroy
Definition: typval_encode.h:69
TYPVAL_ENCODE_CONV_FUNC_START
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun)
Definition: converter.c:62
internal_error
void internal_error(char *where)
Give an "Internal error" message.
Definition: message.c:818
TYPVAL_ENCODE_CONV_FUNC_END
#define TYPVAL_ENCODE_CONV_FUNC_END(tv)
Definition: converter.c:70
MPConvStackVal::data
union MPConvStackVal::@18 data
Data to convert.
VAR_UNKNOWN
@ VAR_UNKNOWN
Unknown (unspecified) value.
Definition: typval.h:116
type
err type
Definition: helpers.c:1043
kMPFloat
@ kMPFloat
Definition: eval.h:179
_mp_size
#define _mp_size
Definition: typval_encode.h:67
TYPVAL_ENCODE_CONV_STRING
#define TYPVAL_ENCODE_CONV_STRING(tv, str, len)
Definition: converter.c:39
TYPVAL_ENCODE_CONV_BOOL
#define TYPVAL_ENCODE_CONV_BOOL(tv, num)
Definition: converter.c:28
kMPConvPartialSelf
@ kMPConvPartialSelf
About to convert self dictionary.
Definition: typval_encode.h:29
TYPVAL_ENCODE_CONV_NIL
#define TYPVAL_ENCODE_CONV_NIL(tv)
Definition: converter.c:25
MPConvStackValType
MPConvStackValType
Type of the stack entry.
Definition: typval_encode.h:18
eval_msgpack_type_lists
const list_T * eval_msgpack_type_lists[]
Array mapping values from MessagePackType to corresponding list pointers.
Definition: eval.c:289
assert.h
MPConvStackVal::d
struct MPConvStackVal::@18::@19 d
State of dictionary conversion.
TYPVAL_ENCODE_CONV_EXT_STRING
#define TYPVAL_ENCODE_CONV_EXT_STRING(tv, str, len, type)
Definition: converter.c:49
MPConvStackVal
Structure representing current VimL to messagepack conversion state.
Definition: typval_encode.h:34
kMPConvPairs
@ kMPConvPairs
Convert mapping represented as a list_T* of pairs.
Definition: typval_encode.h:21
TYPVAL_ENCODE_CONV_FLOAT
#define TYPVAL_ENCODE_CONV_FLOAT(tv, flt)
Definition: converter.c:36
TYPVAL_ENCODE_CONV_DICT_START
#define TYPVAL_ENCODE_CONV_DICT_START(tv, dict, len)
Definition: converter.c:130
TYPVAL_ENCODE_CONV_RECURSE
#define TYPVAL_ENCODE_CONV_RECURSE(val, conv_type)
Definition: converter.c:183
kMPNil
@ kMPNil
Definition: eval.h:176
typval_T::typval_vval_union::v_list
list_T * v_list
List for VAR_LIST, can be NULL.
Definition: typval.h:140
kBoolVarFalse
@ kBoolVarFalse
v:false
Definition: typval.h:98
typval_T::typval_vval_union::v_float
float_T v_float
Floating-point number, for VAR_FLOAT.
Definition: typval.h:138
_mp_last
#define _mp_last
Definition: typval_encode.h:72
_TYPVAL_ENCODE_CHECK_SELF_REFERENCE
#define _TYPVAL_ENCODE_CHECK_SELF_REFERENCE
Self reference checker function name.
Definition: typval_encode.h:131
MPConvStackVal::l
struct MPConvStackVal::@18::@20 l
State of list or generic mapping conversion.
typval_T::typval_vval_union::v_bool
BoolVarValue v_bool
Bool value, for VAR_BOOL.
Definition: typval.h:136
partial_S::pt_argc
int pt_argc
Number of arguments.
Definition: typval.h:367
kMPString
@ kMPString
Definition: eval.h:180
void
void(WINAPI *pClosePseudoConsole)(HPCON)
TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
#define TYPVAL_ENCODE_CONV_UNSIGNED_NUMBER
Definition: converter.c:34
typval_T::v_type
VarType v_type
Variable type.
Definition: typval.h:132
TYPVAL_ENCODE_CONV_EMPTY_LIST
#define TYPVAL_ENCODE_CONV_EMPTY_LIST(tv)
Definition: converter.c:72
kMPConvPartialEnd
@ kMPConvPartialEnd
Already converted everything.
Definition: typval_encode.h:30
partial_name
char_u * partial_name(partial_T *pt)
Definition: eval.c:5045
MPConvStackVal::type
MPConvStackValType type
Type of the stack entry.
Definition: typval_encode.h:35
MPConvStackVal::p
struct MPConvStackVal::@18::@21 p
State of partial conversion.
partial_S::pt_argv
typval_T * pt_argv
Arguments in allocated array.
Definition: typval.h:368
MPConvStackVal::tv
typval_T * tv
Currently converted typval_T.
Definition: typval_encode.h:36
TV_LIST_ITEM_TV
#define TV_LIST_ITEM_TV(li)
Definition: typval.h:855
TYPVAL_ENCODE_CONV_LIST_END
#define TYPVAL_ENCODE_CONV_LIST_END(tv)
Definition: converter.c:117
TYPVAL_ENCODE_CONV_DICT_AFTER_KEY
#define TYPVAL_ENCODE_CONV_DICT_AFTER_KEY(tv, dict)
Definition: converter.c:154
tv_dict_find
dictitem_T * tv_dict_find(const dict_T *const d, const char *const key, const ptrdiff_t len) FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
Definition: typval.c:1527
_TYPVAL_ENCODE_CONVERT_ONE_VALUE
#define _TYPVAL_ENCODE_CONVERT_ONE_VALUE
Name of the …convert_one_value function.
Definition: typval_encode.h:139
encode_vim_list_to_buf
bool encode_vim_list_to_buf(const list_T *const list, size_t *const ret_len, char **const ret_buf) FUNC_ATTR_NONNULL_ARG(2
kMPMap
@ kMPMap
Definition: eval.h:183
MessagePackType
MessagePackType
All recognized msgpack types.
Definition: eval.h:175
VAR_PARTIAL
@ VAR_PARTIAL
Partial, .v_partial is used.
Definition: typval.h:126
TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START
#define TYPVAL_ENCODE_CONV_REAL_LIST_AFTER_START(tv, mpsv)
Definition: converter.c:92
VAR_BOOL
@ VAR_BOOL
true, false
Definition: typval.h:123
typval_T::typval_vval_union::v_blob
blob_T * v_blob
Blob for VAR_BLOB, can be NULL.
Definition: typval.h:143
typval_T::typval_vval_union::v_dict
dict_T * v_dict
Dictionary for VAR_DICT, can be NULL.
Definition: typval.h:141
VAR_BLOB
@ VAR_BLOB
Blob, .v_blob is used.
Definition: typval.h:127
VAR_LIST
@ VAR_LIST
List, .v_list is used.
Definition: typval.h:120
OK
#define OK
Definition: vim.h:90
kvec.h
VAR_SPECIAL
@ VAR_SPECIAL
Definition: typval.h:124
buf
char *const buf
Definition: encode.c:235
kMPConvPartial
@ kMPConvPartial
Convert partial_T* partial.
Definition: typval_encode.h:22
TYPVAL_ENCODE_CONV_DICT_END
#define TYPVAL_ENCODE_CONV_DICT_END(tv, dict)
Definition: converter.c:180
partial_S
Definition: typval.h:360
kMPArray
@ kMPArray
Definition: eval.h:182
kMPConvPartialList
@ kMPConvPartialList
Convert argc/argv pair coming from a partial.
Definition: typval_encode.h:23
VAR_NUMBER
@ VAR_NUMBER
Number, .v_number is used.
Definition: typval.h:117
TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS
#define TYPVAL_ENCODE_CONV_DICT_BETWEEN_ITEMS(tv, dict)
Definition: converter.c:167
assert
assert(len >=0)
varnumber_T
int64_t varnumber_T
Type used for VimL VAR_NUMBER values.
Definition: typval.h:26
kMPBoolean
@ kMPBoolean
Definition: eval.h:177
typval.h
li
listitem_T * li
Definition: eval.c:7346
typval_T::vval
union typval_T::typval_vval_union vval
Actual value.
FAIL
return FAIL
Definition: ex_docmd.c:5239
REAL_FATTR_NONNULL_ARG
#define REAL_FATTR_NONNULL_ARG(...)
Definition: func_attr.h:187
TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF
#define TYPVAL_ENCODE_CONV_FUNC_BEFORE_SELF(tv, len)
Definition: converter.c:69
kMPConvList
@ kMPConvList
Convert list_T *list.
Definition: typval_encode.h:20
v_type
void argv[0] v_type
Definition: typval.c:1273
TYPVAL_ENCODE_FIRST_ARG_NAME
#define TYPVAL_ENCODE_FIRST_ARG_NAME
Definition: converter.c:189
_mp_pop
#define _mp_pop
Definition: typval_encode.h:71
NOTDONE
#define NOTDONE
Definition: vim.h:93
VAR_FUNC
@ VAR_FUNC
Function reference, .v_string is used as function name.
Definition: typval.h:119
MPConvStackVal::a
struct MPConvStackVal::@18::@22 a
State of list or generic mapping conversion.
dictitem_T
Definition: coverity-model.c:39
S_LEN
#define S_LEN(s)
Definition: macros.h:32
listitem_S
Definition: typval.h:158
_mp_push
#define _mp_push
Definition: typval_encode.h:70
ARRAY_SIZE
#define ARRAY_SIZE(arr)
Definition: macros.h:122
kMPConvDict
@ kMPConvDict
Convert dict_T *dictionary.
Definition: typval_encode.h:19
TV_DICT_HI2DI
tv_copy & TV_DICT_HI2DI(hi) ->di_tv, rettv
dict_T
Definition: coverity-model.c:40
kBoolVarTrue
@ kBoolVarTrue
v:true
Definition: typval.h:99
kSpecialVarNull
@ kSpecialVarNull
v:null
Definition: typval.h:104
VAR_DICT
@ VAR_DICT
Dictionary, .v_dict is used.
Definition: typval.h:121
func_attr.h
REAL_FATTR_ALWAYS_INLINE
static int REAL_FATTR_WARN_UNUSED_RESULT REAL_FATTR_ALWAYS_INLINE
Definition: typval_encode.c.h:265
get_copyID
int get_copyID(void)
Definition: eval.c:5186
TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START
#define TYPVAL_ENCODE_CONV_REAL_DICT_AFTER_START(tv, dict, mpsv)
Definition: converter.c:133
TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS
#define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len)
Definition: converter.c:68
sign
Definition: sign.c:26
TYPVAL_ENCODE_CONV_LIST_START
#define TYPVAL_ENCODE_CONV_LIST_START(tv, len)
Definition: converter.c:89
typval_T::typval_vval_union::v_string
char_u * v_string
String, for VAR_STRING and VAR_FUNC, can be NULL.
Definition: typval.h:139
TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK
#define TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(label, kv_pair)
Definition: converter.c:135
NULL
return NULL
Definition: eval.c:10355
TYPVAL_ENCODE_CONV_STR_STRING
#define TYPVAL_ENCODE_CONV_STR_STRING
Definition: converter.c:47
REAL_FATTR_WARN_UNUSED_RESULT
static int REAL_FATTR_WARN_UNUSED_RESULT
Definition: typval_encode.c.h:300
xfree
xfree(pat2)
kMPExt
@ kMPExt
Definition: eval.h:184
_TYPVAL_ENCODE_ENCODE
TYPVAL_ENCODE_SCOPE int _TYPVAL_ENCODE_ENCODE(TYPVAL_ENCODE_FIRST_ARG_TYPE TYPVAL_ENCODE_FIRST_ARG_NAME, typval_T *const tv, const char *const objname) REAL_FATTR_NONNULL_ARG(2
Definition: typval_encode.c.h:651
len
int len
Definition: helpers.c:1034
di
dictitem_T *const di
Definition: typval.c:1683
STR
#define STR(x)
Definition: macros.h:136
HASHITEM_EMPTY
#define HASHITEM_EMPTY(hi)
Definition: hashtab.h:19
TYPVAL_ENCODE_CONV_NUMBER
#define TYPVAL_ENCODE_CONV_NUMBER(tv, num)
Definition: converter.c:31
TYPVAL_ENCODE_NODICT_VAR
const dict_T *const TYPVAL_ENCODE_NODICT_VAR
Definition: typval_encode.c.h:257