API: Refactor: Generalize buffer, window and tabpage types/functions

- Extract remote types definitions into a macro
- Extract msgpack_rpc helper functions for remote types into a macro
This commit is contained in:
Thiago de Arruda
2014-05-23 15:49:38 -03:00
parent 5fdf854f78
commit 92307201b5
2 changed files with 25 additions and 33 deletions

View File

@@ -5,6 +5,14 @@
#include <stdbool.h>
#include <string.h>
#define REMOTE_TYPE(type) typedef Integer type
#define TYPED_ARRAY_OF(type) \
typedef struct { \
type *items; \
size_t size; \
} type##Array
// Basic types
typedef struct {
char msg[256];
@@ -20,9 +28,9 @@ typedef struct {
size_t size;
} String;
typedef Integer Buffer;
typedef Integer Window;
typedef Integer Tabpage;
REMOTE_TYPE(Buffer);
REMOTE_TYPE(Window);
REMOTE_TYPE(Tabpage);
typedef struct object Object;