diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-05-23 18:10:52 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-05-23 18:10:52 -0300 |
commit | 9e95c8aa331e3872253e7a06be32103b440bc97f (patch) | |
tree | d25a81cd37939466e5b9c8b33b3566f9aefbdf49 /src/nvim/api/private/defs.h | |
parent | f1e52c496ddb89f830cdbc4f23d756131106b97f (diff) | |
parent | 6c96e42e2c18bd6ae685b5a41c69b03954aa0375 (diff) | |
download | rneovim-9e95c8aa331e3872253e7a06be32103b440bc97f.tar.gz rneovim-9e95c8aa331e3872253e7a06be32103b440bc97f.tar.bz2 rneovim-9e95c8aa331e3872253e7a06be32103b440bc97f.zip |
Merge branch 'use-uids-for-api-remote-objects'
Diffstat (limited to 'src/nvim/api/private/defs.h')
-rw-r--r-- | src/nvim/api/private/defs.h | 88 |
1 files changed, 88 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..a91907f4f8 --- /dev/null +++ b/src/nvim/api/private/defs.h @@ -0,0 +1,88 @@ +#ifndef NVIM_API_DEFS_H +#define NVIM_API_DEFS_H + +#include <stdint.h> +#include <stdbool.h> +#include <string.h> + +#define ARRAY_DICT_INIT {.size = 0, .items = NULL} +#define REMOTE_TYPE(type) typedef uint64_t type + +#define TYPED_ARRAY_OF(type) \ + typedef struct { \ + type *items; \ + size_t size; \ + } type##Array + +// 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; + +REMOTE_TYPE(Buffer); +REMOTE_TYPE(Window); +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; +} 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 + |