aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/msgpack_rpc.c
Commit message (Collapse)AuthorAge
* msgpack-rpc: Create subdirectory for msgpack-rpc modulesThiago de Arruda2014-10-21
| | | | | Create the msgpack_rpc subdirectory and move all modules that deal with msgpack-rpc to it. Also merge msgpack_rpc.c into msgpack_rpc/helpers.c
* api/msgpack-rpc: Improve error infrastructureThiago de Arruda2014-09-18
| | | | | | | | | | | | | | | | - Add error type information to `Error` - Rename `set_api_error` to `api_set_error` for consistency with other api_* functions/macros. - Refactor the api_set_error macro to accept formatted strings and error types - Improve error messages - Wrap error messages with gettext macro - Refactor msgpack-rpc serialization to transform Error instances into [type, message] arrays - Add error type information to API metadata - Normalize nvim->client and client->nvim error handling(change channel_send_call to accept an Error pointer instead of the `errored` boolean pointer) - Use macro to initialize Error structures
* api/msgpack-rpc: Refactor metadata object constructionThiago de Arruda2014-09-12
| | | | | | | | | Instead of building all metadata from msgpack-gen.lua, we now merge the generated part with manual information(such as types and features). The metadata is accessible through the api method `vim_get_api_info`. This was done to simplify the generator while also increasing flexibility(by being able to add more metadata)
* api/msgpack-rpc: Refactor msgpack_rpc_helpers.{c,h}Thiago de Arruda2014-09-12
| | | | | | - Move helpers that are specific to API types to api/private/helpers.{c,h} - Include headers with generated declarations - Delete unused macros
* msgpack-rpc: Remove the `msgpack_rpc_unpack` functionThiago de Arruda2014-09-12
| | | | | | | The `msgpack_rpc_unpack` function was created to work around a deficiency in the msgpack unpack API, which did not let the caller know if parsing failed due to needing more data or to invalid input. The deficiency does not exist in the latest version of `msgpack_unpacker_next`, so it can safely be removed.
* msgpack-rpc: Remove support for integer ids in methodsThiago de Arruda2014-09-12
| | | | | There's no need to have integer and string ids, and since we now fully support msgpack-RPC, support for integer ids was removed.
* msgpack-rpc: Refactor API metadata discovery methodThiago de Arruda2014-09-12
| | | | | | | | | | A new method is now exposed via msgpack-rpc: "get_api_metadata". This method has the same job as the old method '0', it returns an object with API metadata for use by generators. There's one difference in the return value though: instead of returning a string containing another serialized msgpack document, the metadata object is returned directly(a separate deserialization step by clients is not required).
* msgpack-rpc: Move handle_missing_method to msgpack_rpc.cThiago de Arruda2014-09-12
| | | | | Since that function is not automatically generated, it's best to place it in a normal C module
* msgpack-rpc: Refactor initializer and dispatcherThiago de Arruda2014-09-12
| | | | | | | | Use Map(String, rpc_method_handler_fn) for storing/retrieving rpc method handlers in msgpack_rpc_init and msgpack_rpc_dispatch. Also refactor serialization/validation functions in the msgpack_rpc.c/msgpack_rpc_helpers.c modules to accept the new STR and BIN types.
* deps: Update to the experimental msgpack v5 branchThiago de Arruda2014-09-12
| | | | | | | | Using msgpack v5 will let nvim be more compatible with msgpack libraries for other platforms. This also replaces "raw" references by "bin" which is the new name for msgpack binary data type
* msgpack-rpc: Always use arrays when sending events or callsThiago de Arruda2014-08-29
| | | | | | This is required by the msgpack-RPC specification. Also, the send_call/send_event functions were refactored to accept a variable number of arguments
* msgpack-rpc: Accept method names in requestsThiago de Arruda2014-08-29
|
* api/events/msgpack: Insert log statements to improve debuggingThiago de Arruda2014-07-17
| | | | | | Also changed the default log level to INFO so developers won't end up with big log files without asking explicitly(DLOG statements were placed in really "hot" code)
* wstream: Pass WBuffer refcount as a constructor parameterThiago de Arruda2014-07-17
| | | | | | This is required to handle broadcasting when the first write fails. Ref: https://github.com/tarruda/neovim/commit/11916b6b595421ce2ece10f7aa40757cc4937c0c#commitcomment-6792287
* channel/msgpack_rpc: Refactor API dispatchingThiago de Arruda2014-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is how API dispatching worked before this commit: - The generated `msgpack_rpc_dispatch` function receives a the `msgpack_packer` argument. - The response is incrementally built while validating/calling the API. - Return values/errors are also packed into the `msgpack_packer` while the final response is being calculated. Now the `msgpack_packer` argument is no longer provided, and the `msgpack_rpc_dispatch` function returns `Object`/`Error` values to `msgpack_rpc_call`, which will use those values to build the response in a single pass. This was done because the new `channel_send_call` function created the possibility of having recursive API invocations, and this wasn't possible when sharing a single `msgpack_sbuffer` across call frames(it was shared implicitly through the `msgpack_packer` instance). Since we only start to build the response when the necessary information has been computed, it's now safe to share a single `msgpack_sbuffer` instance across all channels and API invocations. Some other changes also had to be performed: - Handling of the metadata discover was moved to `msgpack_rpc_call` - Expose more types as subtypes of `Object`, this was required to forward the return value from `msgpack_rpc_dispatch` to `msgpack_rpc_call` - Added more helper macros for casting API types to `Object` any
* channel/msgpack_rpc: Refactor to better split functions across modulesThiago de Arruda2014-06-24
| | | | | Move validation/conversion functions and to msgpack_rpc_helpers to separate those from the functions that are used from the channel module
* channel/msgpack_rpc: Refactor msgpack_rpc_notification/serialize_eventThiago de Arruda2014-06-24
| | | | | | | | | | - Generalize some argument names(event type -> event name, event data -> event arg) - Rename serialize_event to serialize_message - Rename msgpack_rpc_notification to msgpack_rpc_message - Extract the message type out of msgpack_rpc_message - Add 'id' parameter to msgpack_rpc_message/serialize_message to create messages that are not notifications
* msgpack_rpc: Deal with deserialization failuresThiago de Arruda2014-06-17
| | | | | | | | | There seems to be no way to deal with failures when calling `msgpack_unpacker_next`, so this reimplements that function as `msgpack_rpc_unpack`, which has an additional result for detecting failures. On top of that, we make use of the new function to properly return msgpack-rpc errors when something bad happens.
* msgpack: NULL terminate incoming stringsNicolas Hillegeer2014-06-08
| | | | | | | It's a 1-byte loss of memory but it allows us to skip copying and NULL-terminating strings when interacting with vim functions that accept C strings. This lowers the pressure on the allocator and saves lines of code (no more dup/free pairs).
* API: Events: Implement channel_send_event and vimscript wrapperThiago de Arruda2014-05-26
| | | | | This function can be used to send arbitrary objects via the API channel back to connected clients, identified by channel id.
* API: Events: Return channel id from the API discover requestThiago de Arruda2014-05-26
| | | | | This refactors msgapck_rpc_{dipatch,call} to receive the channel id as argument. Now the discovery request returns the [id, metadata] array.
* API: Refactor: Duplicate/free string arguments coming from msgpackThiago de Arruda2014-05-26
| | | | | | | | | When receiving strings *from* msgpack, we don't need to duplicate/free since the data only lives in the msgpack parse buffer until the end of the call. But in order to reuse `msgpack_rpc_free_object` when sending event data(which is sent *to* msgpack), Strings must be freed, which means they must also be allocated separately.
* API: Refactor: Return handles instead of indexesThiago de Arruda2014-05-23
| | | | | | | - 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.
* API: Refactor: Change the integer type of remote objects to uint64_tThiago de Arruda2014-05-23
|
* API: Refactor: Add macro infrastructure for typed arraysThiago de Arruda2014-05-23
| | | | | - Add macros supporting typed arrays in the remote API - Refactor StringArray-related functions on top of the new macros
* API: Refactor: Generalize buffer, window and tabpage types/functionsThiago de Arruda2014-05-23
| | | | | - Extract remote types definitions into a macro - Extract msgpack_rpc helper functions for remote types into a macro
* Enable -Wconversion for API files and fix errorsThiago de Arruda2014-05-17
|
* Use more descriptive names for API primitive typesThiago de Arruda2014-05-17
| | | | | | | | | Instead of exposing native C types to a public API that can be consumed by other platforms, we are now using the following translation: int64_t -> Integer double -> Float bool -> Boolean
* Refactor API to use one integer type: int64_tThiago de Arruda2014-05-17
| | | | | | | | | This should make the API simpler, and int64_t is enough to represent any integer value we might need. Range checks should be done inside the API functions, that way we can modify the types of the actual fields/variables modified by the API without changes to the API prototypes.
* Introduce nvim namespace: Fix project-local includes.Eliseo Martínez2014-05-15
| | | | Prepend 'nvim/' in all project-local (non-system) includes.
* Introduce nvim namespace: Fix relative includes.Eliseo Martínez2014-05-15
| | | | | | | | | | Problem: Some newly introduced files used includes relative to the current file, both of the form `include "../XXX.h"` and `include "XXX.h"`. Preferred form is relative to include root (src/ in our case). Solution: Change includes to preferred form. Note: This is also done to ease next commit (prepend 'nvim/ to all project-local includes).
* Introduce nvim namespace: Move files.Eliseo Martínez2014-05-15
Move files from src/ to src/nvim/. - src/nvim/ becomes the new root dir for nvim executable sources. - src/libnvim/ is planned to become root dir of the neovim library.