aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api/private/defs.h')
-rw-r--r--src/nvim/api/private/defs.h43
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;
};