api/msgpack-rpc: Remove specialized array types

Specialized array types(BufferArray, WindowArray, etc) were added to the API for
two main reasons:

- msgpack used to lack a way of serializing appliaction-specific types and there
  was no obvious way of making an API function accept/return arrays of custom
  objects such as buffers(which are represented as integers, so clients didn't
  have a way to distinguish from normal numbers)
- Let clients in statically-typed languages that support generics have a better
  typed API

With msgpack 2.0 EXT type the first item is no longer a factor and this commit
starts by removing the specialized array types. The second item will be
addressed in the future by making the API metadata return extra useful
information for statically-typed languages.
This commit is contained in:
Thiago de Arruda
2014-09-07 18:48:10 -03:00
parent 505985b870
commit d5a60d17fb
6 changed files with 49 additions and 155 deletions

View File

@@ -11,12 +11,6 @@
#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
// Basic types
typedef struct {
char msg[256];
@@ -38,11 +32,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;
@@ -71,10 +60,6 @@ typedef enum {
kObjectTypeArray,
kObjectTypeDictionary,
kObjectTypePosition,
kObjectTypeStringArray,
kObjectTypeBufferArray,
kObjectTypeWindowArray,
kObjectTypeTabpageArray,
} ObjectType;
struct object {
@@ -90,10 +75,6 @@ struct object {
Array array;
Dictionary dictionary;
Position position;
StringArray stringarray;
BufferArray bufferarray;
WindowArray windowarray;
TabpageArray tabpagearray;
} data;
};