aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-09-11 21:56:52 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-09-12 13:50:07 -0300
commitcd2e46c0785d40b9ea15f6d722a3fad54c007b9b (patch)
tree57503e18a1a685545750748b7fc854cb6ec85062 /src/nvim/main.c
parent15ca58d79f8cc8565c1a2b2581029cf7901b5fbd (diff)
downloadrneovim-cd2e46c0785d40b9ea15f6d722a3fad54c007b9b.tar.gz
rneovim-cd2e46c0785d40b9ea15f6d722a3fad54c007b9b.tar.bz2
rneovim-cd2e46c0785d40b9ea15f6d722a3fad54c007b9b.zip
api/msgpack-rpc: Refactor metadata object construction
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)
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 4b440ba92a..fc1826975a 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -12,6 +12,8 @@
#include <string.h>
#include <stdbool.h>
+#include <msgpack.h>
+
#include "nvim/ascii.h"
#include "nvim/vim.h"
#include "nvim/main.h"
@@ -57,6 +59,9 @@
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/signal.h"
+#include "nvim/os/msgpack_rpc_helpers.h"
+#include "nvim/api/private/defs.h"
+#include "nvim/api/private/helpers.h"
/* Maximum number of commands from + or -c arguments. */
#define MAX_ARG_CMDS 10
@@ -116,9 +121,6 @@ static void init_locale(void);
# endif
#endif /* NO_VIM_MAIN */
-extern const uint8_t msgpack_metadata[];
-extern const unsigned int msgpack_metadata_size;
-
/*
* Different types of error messages.
*/
@@ -1027,9 +1029,15 @@ static void command_line_scan(mparm_T *parmp)
msg_didout = FALSE;
mch_exit(0);
} else if (STRICMP(argv[0] + argv_idx, "api-info") == 0) {
- for (unsigned int i = 0; i<msgpack_metadata_size; i++) {
- putchar(msgpack_metadata[i]);
+ msgpack_sbuffer* b = msgpack_sbuffer_new();
+ msgpack_packer* p = msgpack_packer_new(b, msgpack_sbuffer_write);
+ Object md = DICTIONARY_OBJ(api_metadata());
+ msgpack_rpc_from_object(md, p);
+
+ for (size_t i = 0; i < b->size; i++) {
+ putchar(b->data[i]);
}
+
mch_exit(0);
} else if (STRICMP(argv[0] + argv_idx, "embed") == 0) {
embedded_mode = true;