From 72e3125f452ae7224162da8e940e20b00680d41a Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 23 May 2014 15:49:25 -0300 Subject: API: Refactor: Move non-public files to private subdirectory --- src/nvim/os/msgpack_rpc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/os/msgpack_rpc.h') diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h index 0e9d474d8d..0f644273cd 100644 --- a/src/nvim/os/msgpack_rpc.h +++ b/src/nvim/os/msgpack_rpc.h @@ -6,7 +6,7 @@ #include -#include "nvim/api/defs.h" +#include "nvim/api/private/defs.h" /// Validates the basic structure of the msgpack-rpc call and fills `res` /// with the basic response structure. -- cgit From 1e67b13fdcb6ed7f2a951b9053f0a829b3a48906 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 23 May 2014 15:49:40 -0300 Subject: API: Refactor: Add macro infrastructure for typed arrays - Add macros supporting typed arrays in the remote API - Refactor StringArray-related functions on top of the new macros --- src/nvim/os/msgpack_rpc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/nvim/os/msgpack_rpc.h') diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h index 0f644273cd..45632c7389 100644 --- a/src/nvim/os/msgpack_rpc.h +++ b/src/nvim/os/msgpack_rpc.h @@ -8,6 +8,8 @@ #include "nvim/api/private/defs.h" +#define ARRAY_DICT_INIT {.size = 0, .items = NULL} + /// Validates the basic structure of the msgpack-rpc call and fills `res` /// with the basic response structure. /// @@ -80,9 +82,9 @@ void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res); #define msgpack_rpc_init_window #define msgpack_rpc_init_tabpage #define msgpack_rpc_init_object = {.type = kObjectTypeNil} -#define msgpack_rpc_init_stringarray = {.items = NULL, .size = 0} -#define msgpack_rpc_init_array = {.items = NULL, .size = 0} -#define msgpack_rpc_init_dictionary = {.items = NULL, .size = 0} +#define msgpack_rpc_init_stringarray = ARRAY_DICT_INIT +#define msgpack_rpc_init_array = ARRAY_DICT_INIT +#define msgpack_rpc_init_dictionary = ARRAY_DICT_INIT /// Helpers for freeing arguments/return value /// @@ -102,6 +104,5 @@ void msgpack_rpc_free_stringarray(StringArray value); void msgpack_rpc_free_array(Array value); void msgpack_rpc_free_dictionary(Dictionary value); - #endif // NVIM_OS_MSGPACK_RPC_H -- cgit From a842fe4dc1e0624a6332ee0fef40517e7925dfb4 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 23 May 2014 15:49:44 -0300 Subject: API: Refactor: Return handles instead of indexes - Define specialized arrays for each remote object type - Implement msgpack_rpc functions for dealing with the new types - Refactor all functions dealing with buffers, windows and tabpages to return/accept handles instead of list indexes. --- src/nvim/os/msgpack_rpc.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/os/msgpack_rpc.h') diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h index 45632c7389..80c5a6914f 100644 --- a/src/nvim/os/msgpack_rpc.h +++ b/src/nvim/os/msgpack_rpc.h @@ -50,6 +50,9 @@ bool msgpack_rpc_to_window(msgpack_object *obj, Window *arg); bool msgpack_rpc_to_tabpage(msgpack_object *obj, Tabpage *arg); bool msgpack_rpc_to_object(msgpack_object *obj, Object *arg); bool msgpack_rpc_to_stringarray(msgpack_object *obj, StringArray *arg); +bool msgpack_rpc_to_bufferarray(msgpack_object *obj, BufferArray *arg); +bool msgpack_rpc_to_windowarray(msgpack_object *obj, WindowArray *arg); +bool msgpack_rpc_to_tabpagearray(msgpack_object *obj, TabpageArray *arg); bool msgpack_rpc_to_array(msgpack_object *obj, Array *arg); bool msgpack_rpc_to_dictionary(msgpack_object *obj, Dictionary *arg); @@ -69,6 +72,9 @@ void msgpack_rpc_from_window(Window result, msgpack_packer *res); void msgpack_rpc_from_tabpage(Tabpage result, msgpack_packer *res); void msgpack_rpc_from_object(Object result, msgpack_packer *res); void msgpack_rpc_from_stringarray(StringArray result, msgpack_packer *res); +void msgpack_rpc_from_bufferarray(BufferArray result, msgpack_packer *res); +void msgpack_rpc_from_windowarray(WindowArray result, msgpack_packer *res); +void msgpack_rpc_from_tabpagearray(TabpageArray result, msgpack_packer *res); void msgpack_rpc_from_array(Array result, msgpack_packer *res); void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res); @@ -83,6 +89,9 @@ void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res); #define msgpack_rpc_init_tabpage #define msgpack_rpc_init_object = {.type = kObjectTypeNil} #define msgpack_rpc_init_stringarray = ARRAY_DICT_INIT +#define msgpack_rpc_init_bufferarray = ARRAY_DICT_INIT +#define msgpack_rpc_init_windowarray = ARRAY_DICT_INIT +#define msgpack_rpc_init_tabpagearray = ARRAY_DICT_INIT #define msgpack_rpc_init_array = ARRAY_DICT_INIT #define msgpack_rpc_init_dictionary = ARRAY_DICT_INIT @@ -101,6 +110,9 @@ void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res); #define msgpack_rpc_free_tabpage(value) void msgpack_rpc_free_object(Object value); void msgpack_rpc_free_stringarray(StringArray value); +void msgpack_rpc_free_bufferarray(BufferArray value); +void msgpack_rpc_free_windowarray(WindowArray value); +void msgpack_rpc_free_tabpagearray(TabpageArray value); void msgpack_rpc_free_array(Array value); void msgpack_rpc_free_dictionary(Dictionary value); -- cgit From 9815688fbdeb7bc1f1a28b9d827b31eea4fe8cfb Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Fri, 23 May 2014 15:49:48 -0300 Subject: API: Refactor: Use macro for initializing all arrays --- src/nvim/os/msgpack_rpc.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/nvim/os/msgpack_rpc.h') diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h index 80c5a6914f..a6a909ac1f 100644 --- a/src/nvim/os/msgpack_rpc.h +++ b/src/nvim/os/msgpack_rpc.h @@ -8,8 +8,6 @@ #include "nvim/api/private/defs.h" -#define ARRAY_DICT_INIT {.size = 0, .items = NULL} - /// Validates the basic structure of the msgpack-rpc call and fills `res` /// with the basic response structure. /// -- cgit