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.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/nvim/api/private/defs.h b/src/nvim/api/private/defs.h
new file mode 100644
index 0000000000..3ee50310fb
--- /dev/null
+++ b/src/nvim/api/private/defs.h
@@ -0,0 +1,79 @@
+#ifndef NVIM_API_DEFS_H
+#define NVIM_API_DEFS_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+
+// Basic types
+typedef struct {
+ char msg[256];
+ bool set;
+} Error;
+
+typedef bool Boolean;
+typedef int64_t Integer;
+typedef double Float;
+
+typedef struct {
+ char *data;
+ size_t size;
+} String;
+
+typedef Integer Buffer;
+typedef Integer Window;
+typedef Integer Tabpage;
+
+typedef struct object Object;
+
+typedef struct {
+ String *items;
+ size_t size;
+} StringArray;
+
+typedef struct {
+ Integer row, col;
+} Position;
+
+typedef struct {
+ Object *items;
+ size_t size;
+} Array;
+
+typedef struct key_value_pair KeyValuePair;
+
+typedef struct {
+ KeyValuePair *items;
+ size_t size;
+} Dictionary;
+
+typedef enum {
+ kObjectTypeNil,
+ kObjectTypeBoolean,
+ kObjectTypeInteger,
+ kObjectTypeFloat,
+ kObjectTypeString,
+ kObjectTypeArray,
+ kObjectTypeDictionary
+} ObjectType;
+
+struct object {
+ ObjectType type;
+ union {
+ Boolean boolean;
+ Integer integer;
+ Float floating;
+ String string;
+ Array array;
+ Dictionary dictionary;
+ } data;
+};
+
+struct key_value_pair {
+ String key;
+ Object value;
+};
+
+
+#endif // NVIM_API_DEFS_H
+