aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/defs.h
blob: d451667a6c78461e8d62aa69ddb4591bb8a8e252 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef NVIM_API_DEFS_H
#define NVIM_API_DEFS_H

#include <stdint.h>
#include <string.h>

// Basic types
typedef struct {
  char msg[256];
  bool set;
} Error;

typedef struct {
  char *data;
  size_t size;
} String;

typedef uint16_t Buffer;
typedef uint16_t Window;
typedef uint16_t Tabpage;

typedef struct object Object;

typedef struct {
  String *items;
  size_t size;
} StringArray;

typedef struct {
  uint16_t 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,
  kObjectTypeBool,
  kObjectTypeInt,
  kObjectTypeFloat,
  kObjectTypeString,
  kObjectTypeArray,
  kObjectTypeDictionary
} ObjectType;

struct object {
  ObjectType type;
  union {
    bool boolean;
    int64_t integer;
    double floating_point;
    String string;
    Array array;
    Dictionary dictionary;
  } data;
};

struct key_value_pair {
  String key;
  Object value;
};


#endif  // NVIM_API_DEFS_H