mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00

Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
#ifndef NVIM_MSGPACK_RPC_UNPACKER_H
|
|
#define NVIM_MSGPACK_RPC_UNPACKER_H
|
|
|
|
#include <inttypes.h>
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
|
|
#include "mpack/mpack_core.h"
|
|
#include "mpack/object.h"
|
|
#include "nvim/api/private/defs.h"
|
|
#include "nvim/api/private/dispatch.h"
|
|
#include "nvim/api/private/helpers.h"
|
|
#include "nvim/grid_defs.h"
|
|
#include "nvim/memory.h"
|
|
#include "nvim/msgpack_rpc/channel_defs.h"
|
|
#include "nvim/types.h"
|
|
#include "nvim/ui_client.h"
|
|
|
|
struct Unpacker {
|
|
mpack_parser_t parser;
|
|
mpack_tokbuf_t reader;
|
|
|
|
const char *read_ptr;
|
|
size_t read_size;
|
|
|
|
#define MAX_EXT_LEN 9 // byte + 8-byte integer
|
|
char ext_buf[MAX_EXT_LEN];
|
|
|
|
int state;
|
|
MessageType type;
|
|
uint32_t request_id;
|
|
size_t method_name_len;
|
|
MsgpackRpcRequestHandler handler;
|
|
Object error; // error return
|
|
Object result; // arg list or result
|
|
Error unpack_error;
|
|
|
|
Arena arena;
|
|
|
|
int nevents;
|
|
int ncalls;
|
|
UIClientHandler ui_handler;
|
|
GridLineEvent *grid_line_event;
|
|
};
|
|
|
|
// unrecovareble error. unpack_error should be set!
|
|
#define unpacker_closed(p) ((p)->state < 0)
|
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
|
# include "msgpack_rpc/unpacker.h.generated.h"
|
|
#endif
|
|
|
|
#endif // NVIM_MSGPACK_RPC_UNPACKER_H
|