diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-12 14:01:35 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-09-12 14:01:35 -0300 |
commit | 6a8932aa588b8631e66255fb24e2776acdd46c8e (patch) | |
tree | 2f8b63891e478fdc40fc37cf03b029ebbb7f51a5 /src/nvim/api/private/defs.h | |
parent | 042aca6eb4d0fe9e6ddf3bcfb96a39838b2633d1 (diff) | |
parent | 2a67b847aa2074f688fce9f96e060eeb5ba29435 (diff) | |
download | rneovim-6a8932aa588b8631e66255fb24e2776acdd46c8e.tar.gz rneovim-6a8932aa588b8631e66255fb24e2776acdd46c8e.tar.bz2 rneovim-6a8932aa588b8631e66255fb24e2776acdd46c8e.zip |
Merge PR #1130 'Update to the experimental msgpack v5 branch'
Diffstat (limited to 'src/nvim/api/private/defs.h')
-rw-r--r-- | src/nvim/api/private/defs.h | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h index b049412014..2dd229ec5f 100644 --- a/src/nvim/api/private/defs.h +++ b/src/nvim/api/private/defs.h @@ -5,17 +5,15 @@ #include <stdbool.h> #include <string.h> -#define ARRAY_DICT_INIT {.size = 0, .items = NULL} +#define ARRAY_DICT_INIT {.size = 0, .capacity = 0, .items = NULL} #define STRING_INIT {.data = NULL, .size = 0} #define OBJECT_INIT { .type = kObjectTypeNil } -#define POSITION_INIT { .row = 0, .col = 0 } #define REMOTE_TYPE(type) typedef uint64_t type -#define TYPED_ARRAY_OF(type) \ - typedef struct { \ - type *items; \ - size_t size; \ - } type##Array +#ifdef INCLUDE_GENERATED_DECLARATIONS + #define ArrayOf(...) Array + #define DictionaryOf(...) Dictionary +#endif // Basic types typedef struct { @@ -38,15 +36,6 @@ REMOTE_TYPE(Tabpage); typedef struct object Object; -TYPED_ARRAY_OF(Buffer); -TYPED_ARRAY_OF(Window); -TYPED_ARRAY_OF(Tabpage); -TYPED_ARRAY_OF(String); - -typedef struct { - Integer row, col; -} Position; - typedef struct { Object *items; size_t size, capacity; @@ -60,40 +49,30 @@ typedef struct { } Dictionary; typedef enum { + kObjectTypeBuffer, + kObjectTypeWindow, + kObjectTypeTabpage, kObjectTypeNil, kObjectTypeBoolean, kObjectTypeInteger, kObjectTypeFloat, kObjectTypeString, - kObjectTypeBuffer, - kObjectTypeWindow, - kObjectTypeTabpage, kObjectTypeArray, kObjectTypeDictionary, - kObjectTypePosition, - kObjectTypeStringArray, - kObjectTypeBufferArray, - kObjectTypeWindowArray, - kObjectTypeTabpageArray, } ObjectType; struct object { ObjectType type; union { + Buffer buffer; + Window window; + Tabpage tabpage; Boolean boolean; Integer integer; Float floating; String string; - Buffer buffer; - Window window; - Tabpage tabpage; Array array; Dictionary dictionary; - Position position; - StringArray stringarray; - BufferArray bufferarray; - WindowArray windowarray; - TabpageArray tabpagearray; } data; }; |