Add --api-metadata command line option

- New command line option prints the binary API metadata object
  and exits
This commit is contained in:
Rui Abreu Ferreira 2014-05-29 15:42:08 +01:00 committed by Thiago de Arruda
parent a2e9580801
commit 1971cc30b5
2 changed files with 10 additions and 1 deletions

View File

@ -100,7 +100,7 @@ end
output:write([[
static const uint8_t msgpack_metadata[] = {
const uint8_t msgpack_metadata[] = {
]])
-- serialize the API metadata using msgpack and embed into the resulting
@ -116,6 +116,7 @@ end
-- usually it is the first function called by clients.
output:write([[
};
const unsigned int msgpack_metadata_size = sizeof(msgpack_metadata);
void msgpack_rpc_dispatch(uint64_t channel_id, msgpack_object *req, msgpack_packer *res)
{

View File

@ -135,6 +135,8 @@ static void check_swap_exists_action(void);
# endif
#endif /* NO_VIM_MAIN */
extern const uint8_t msgpack_metadata[];
extern const unsigned int msgpack_metadata_size;
/*
* Different types of error messages.
@ -1047,6 +1049,11 @@ static void command_line_scan(mparm_T *parmp)
msg_putchar('\n');
msg_didout = FALSE;
mch_exit(0);
} else if (STRICMP(argv[0] + argv_idx, "api-metadata") == 0) {
for (unsigned int i = 0; i<msgpack_metadata_size; i++) {
putchar(msgpack_metadata[i]);
}
mch_exit(0);
} else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) {
#if !defined(UNIX)
parmp->literal = TRUE;
@ -2240,6 +2247,7 @@ static void usage(void)
main_msg(_("--startuptime <file>\tWrite startup timing messages to <file>"));
#endif
main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));
main_msg(_("--api-metadata\tDump API metadata information and exit"));
main_msg(_("-h or --help\tPrint Help (this message) and exit"));
main_msg(_("--version\t\tPrint version information and exit"));