refactor: run IWYU on entire repo

Reference: https://github.com/neovim/neovim/issues/6371.
This commit is contained in:
dundargoc 2023-12-18 10:55:23 +01:00 committed by dundargoc
parent ade42d531b
commit af93a74a0f
123 changed files with 314 additions and 462 deletions

View File

@ -136,52 +136,13 @@ generated-sources benchmark $(FORMAT) $(LINT) $(TEST) doc: | build/.ran-cmake
test: $(TEST)
# The ignored header files should be synced with the `check_includes_ignore`
# array in src/clint.py
iwyu: build/.ran-cmake
cmake --preset iwyu
cmake --build build > build/iwyu.log
iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c|src/nvim/auto/|src/nvim/os/lang.c|src/nvim/map.c\
|src/nvim/api/private/validate.h\
|src/nvim/assert_defs.h\
|src/nvim/buffer.h\
|src/nvim/buffer_defs.h\
|src/nvim/channel.h\
|src/nvim/charset.h\
|src/nvim/eval.h\
|src/nvim/eval/encode.h\
|src/nvim/eval/typval.h\
|src/nvim/eval/typval_defs.h\
|src/nvim/eval/userfunc.h\
|src/nvim/event/libuv_process.h\
|src/nvim/event/loop.h\
|src/nvim/event/process.h\
|src/nvim/event/rstream.h\
|src/nvim/event/signal.h\
|src/nvim/event/socket.h\
|src/nvim/event/stream.h\
|src/nvim/event/time.h\
|src/nvim/event/wstream.h\
|src/nvim/garray.h\
|src/nvim/globals.h\
|src/nvim/grid.h\
|src/nvim/highlight.h\
|src/nvim/input.h\
|src/nvim/keycodes.h\
|src/nvim/lua/executor.h\
|src/nvim/main.h\
|src/nvim/msgpack_rpc/channel_defs.h\
|src/nvim/msgpack_rpc/helpers.h\
|src/nvim/msgpack_rpc/unpacker.h\
|src/nvim/option.h\
|src/nvim/os/input.h\
|src/nvim/os/pty_conpty_win.h\
|src/nvim/os/pty_process_unix.h\
|src/nvim/os/pty_process_win.h\
|src/nvim/tui/input.h\
|src/nvim/ui.h\
|src/nvim/viml/parser/expressions.h\
|src/nvim/viml/parser/parser.h\
iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c\
|src/nvim/auto/\
|src/nvim/os/lang.c\
|src/nvim/map.c\
)" --nosafe_headers < build/iwyu.log
cmake -B build -U ENABLE_IWYU
cmake --build build

View File

@ -22,6 +22,7 @@
{ symbol: [ "MIN", private, '"nvim/macros_defs.h"', public ] },
{ symbol: [ "extern_proc", private, '<uv.h>', public ] },
{ symbol: [ "iovec", private, '<sys/uio.h>', public ] },
{ symbol: [ "ssize_t", private, '<uv.h>', public ] },
{ include: [ '<uv/unix.h>', private, '<uv.h>', public ] },
]

View File

@ -13,6 +13,7 @@
{ include: [ '<bits/termios-c_cflag.h>', private, '<termios.h>', public ] },
{ include: [ '<bits/termios-c_iflag.h>', private, '<termios.h>', public ] },
{ include: [ '<bits/termios-c_oflag.h>', private, '<termios.h>', public ] },
{ include: [ '<sys/ttycom.h>', private, '<sys/ioctl.h>', public ] },
{ include: [ '<sys/unistd.h>', private, '<unistd.h>', public ] },
{ symbol: ["SOCK_STREAM", private, "<sys/socket.h>", public ] },
@ -26,7 +27,6 @@
{ symbol: ["ntohs", private, "<arpa/inet.h>", public ] },
{ symbol: ["pthread_sigmask", private, "<signal.h>", public ] },
{ symbol: ["sigset_t", private, "<signal.h>", public ] },
{ symbol: ["ssize_t", private, "<sys/types.h>", public ] },
{ symbol: ["uid_t", private, "<sys/types.h>", public ] },
]

View File

@ -897,8 +897,6 @@ def CheckIncludes(filename, lines, error):
}):
return
# These should be synced with the ignored headers in the `iwyu` target in
# the Makefile.
check_includes_ignore = [
"src/nvim/api/private/validate.h",
"src/nvim/assert_defs.h",
@ -913,6 +911,7 @@ def CheckIncludes(filename, lines, error):
"src/nvim/eval/userfunc.h",
"src/nvim/event/libuv_process.h",
"src/nvim/event/loop.h",
"src/nvim/event/multiqueue.h",
"src/nvim/event/process.h",
"src/nvim/event/rstream.h",
"src/nvim/event/signal.h",
@ -928,6 +927,7 @@ def CheckIncludes(filename, lines, error):
"src/nvim/keycodes.h",
"src/nvim/lua/executor.h",
"src/nvim/main.h",
"src/nvim/mark.h",
"src/nvim/msgpack_rpc/channel_defs.h",
"src/nvim/msgpack_rpc/helpers.h",
"src/nvim/msgpack_rpc/unpacker.h",

View File

@ -1,6 +1,6 @@
#pragma once
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/api/private/defs.h" // IWYU pragma: export
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -3,7 +3,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/defs.h" // IWYU pragma: export
#include "nvim/memory_defs.h"
#include "nvim/types_defs.h"

View File

@ -4,7 +4,7 @@
#include <stddef.h>
#include "klib/kvec.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/defs.h" // IWYU pragma: export
#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/ex_eval_defs.h"

View File

@ -3,7 +3,7 @@
#include <stdbool.h>
#include <stddef.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/defs.h" // IWYU pragma: export
#include "nvim/api/private/helpers.h"
#include "nvim/assert_defs.h"
#include "nvim/macros_defs.h"

View File

@ -15,7 +15,8 @@
#include "nvim/autocmd.h"
#include "nvim/channel.h"
#include "nvim/eval.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/wstream.h"
#include "nvim/globals.h"
#include "nvim/grid.h"

View File

@ -64,6 +64,7 @@
#include "nvim/statusline.h"
#include "nvim/strings.h"
#include "nvim/terminal.h"
#include "nvim/types_defs.h"
#include "nvim/ui.h"
#include "nvim/vim_defs.h"
#include "nvim/window.h"

View File

@ -86,35 +86,6 @@
static inline bool ascii_iswhite(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_iswhite_or_nul(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_isdigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_isxdigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_isident(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_isbdigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_isodigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
static inline bool ascii_isspace(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is a space or tab character.
///
/// @see {ascii_isdigit}
@ -123,6 +94,9 @@ static inline bool ascii_iswhite(int c)
return c == ' ' || c == '\t';
}
static inline bool ascii_iswhite_or_nul(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is a space or tab character or NUL.
///
/// @see {ascii_isdigit}
@ -131,6 +105,9 @@ static inline bool ascii_iswhite_or_nul(int c)
return ascii_iswhite(c) || c == NUL;
}
static inline bool ascii_isdigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Check whether character is a decimal digit.
///
/// Library isdigit() function is officially locale-dependent and, for
@ -145,6 +122,9 @@ static inline bool ascii_isdigit(int c)
return c >= '0' && c <= '9';
}
static inline bool ascii_isxdigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is a hexadecimal digit, that is, one of 0-9, a-f, A-F.
///
/// @see {ascii_isdigit}
@ -155,6 +135,9 @@ static inline bool ascii_isxdigit(int c)
|| (c >= 'A' && c <= 'F');
}
static inline bool ascii_isident(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is an “identifier” character
///
/// That is, whether it is alphanumeric character or underscore.
@ -163,6 +146,9 @@ static inline bool ascii_isident(int c)
return ASCII_ISALNUM(c) || c == '_';
}
static inline bool ascii_isbdigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is a binary digit, that is, 0-1.
///
/// @see {ascii_isdigit}
@ -171,6 +157,9 @@ static inline bool ascii_isbdigit(int c)
return (c == '0' || c == '1');
}
static inline bool ascii_isodigit(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is an octal digit, that is, 0-7.
///
/// @see {ascii_isdigit}
@ -179,6 +168,9 @@ static inline bool ascii_isodigit(int c)
return (c >= '0' && c <= '7');
}
static inline bool ascii_isspace(int c)
REAL_FATTR_CONST
REAL_FATTR_ALWAYS_INLINE;
/// Checks if `c` is a white-space character, that is,
/// one of \f, \n, \r, \t, \v.
///

View File

@ -19,7 +19,8 @@
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/eval/vars.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/fileio.h"

View File

@ -12,7 +12,6 @@
#include "nvim/regexp_defs.h"
#include "nvim/types_defs.h"
// event_T definition
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "auevents_enum.generated.h"
#endif

View File

@ -3,7 +3,7 @@
#include <stdint.h>
#include <string.h>
#include "auto/config.h"
#include "auto/config.h" // IWYU pragma: keep
#include "nvim/base64.h"
#include "nvim/memory.h"

View File

@ -43,11 +43,9 @@
#include "nvim/digraph.h"
#include "nvim/drawscreen.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/eval/vars.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
@ -69,7 +67,6 @@
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memfile_defs.h"
#include "nvim/memline_defs.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"

View File

@ -6,13 +6,10 @@
#include "nvim/buffer_defs.h" // IWYU pragma: export
#include "nvim/eval/typval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/func_attr.h"
#include "nvim/macros_defs.h"
#include "nvim/memline.h"
#include "nvim/memline_defs.h"
#include "nvim/pos_defs.h"
#include "nvim/types_defs.h"
/// Values for buflist_getfile()
enum getf_values {

View File

@ -5,7 +5,6 @@
#include "klib/kvec.h"
#include "nvim/api/buffer.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/assert_defs.h"
#include "nvim/buffer.h"

View File

@ -17,6 +17,7 @@
#include "nvim/change.h"
#include "nvim/drawscreen.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_eval.h"

View File

@ -7,7 +7,6 @@
#include "klib/kvec.h"
#include "nvim/api/private/converter.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
@ -15,6 +14,7 @@
#include "nvim/eval.h"
#include "nvim/eval/encode.h"
#include "nvim/eval/typval.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/rstream.h"
#include "nvim/event/socket.h"

View File

@ -7,13 +7,9 @@
#include "nvim/channel_defs.h" // IWYU pragma: export
#include "nvim/eval/typval_defs.h"
#include "nvim/event/libuv_process.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/process.h"
#include "nvim/event/socket.h"
#include "nvim/event/stream.h"
#include "nvim/garray_defs.h"
#include "nvim/func_attr.h"
#include "nvim/macros_defs.h"
#include "nvim/main.h"
#include "nvim/map_defs.h"
#include "nvim/msgpack_rpc/channel_defs.h"
#include "nvim/os/pty_process.h"

View File

@ -8,7 +8,7 @@
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "auto/config.h"
#include "klib/kvec.h"

View File

@ -3,12 +3,9 @@
#include <stdbool.h>
#include <stdint.h>
#include "nvim/buffer_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/option_defs.h"
#include "nvim/func_attr.h"
#include "nvim/option_vars.h"
#include "nvim/pos_defs.h"
#include "nvim/strings.h"
#include "nvim/strings.h" // IWYU pragma: keep
/// Return the folded-case equivalent of the given character
///

View File

@ -6,9 +6,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/arglist.h"
#include "nvim/ascii_defs.h"

View File

@ -11,7 +11,6 @@
#include "nvim/drawscreen.h"
#include "nvim/fold.h"
#include "nvim/globals.h"
#include "nvim/macros_defs.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"

View File

@ -4,7 +4,6 @@
#include <stdlib.h>
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/buffer_defs.h"
#include "nvim/decoration.h"

View File

@ -5,7 +5,6 @@
#include "klib/kvec.h"
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/buffer_defs.h"
#include "nvim/decoration.h"

View File

@ -105,6 +105,7 @@
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/terminal.h"
#include "nvim/types_defs.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/version.h"

View File

@ -5,7 +5,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/ascii_defs.h"
#include "nvim/autocmd.h"
@ -18,6 +18,7 @@
#include "nvim/drawscreen.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/extmark.h"

View File

@ -7,11 +7,10 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <uv.h>
#include "auto/config.h"
#include "nvim/api/private/converter.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/autocmd.h"
@ -29,6 +28,7 @@
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/eval/vars.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/process.h"
#include "nvim/event/time.h"

View File

@ -4,7 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#include "nvim/channel.h"
#include "nvim/channel_defs.h" // IWYU pragma: keep
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
#include "nvim/event/time.h"
@ -13,6 +13,7 @@
#include "nvim/hashtab_defs.h"
#include "nvim/macros_defs.h"
#include "nvim/mbyte_defs.h" // IWYU pragma: keep
#include "nvim/msgpack_rpc/channel_defs.h" // IWYU pragma: keep
#include "nvim/option_defs.h" // IWYU pragma: keep
#include "nvim/os/fileio_defs.h" // IWYU pragma: keep
#include "nvim/os/stdpaths_defs.h" // IWYU pragma: keep

View File

@ -1,12 +1,10 @@
#pragma once
#include <msgpack.h>
#include <msgpack/pack.h>
#include <stddef.h>
#include <string.h>
#include "nvim/eval/typval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/func_attr.h"
#include "nvim/garray_defs.h"
/// Convert Vimscript value to msgpack string

View File

@ -14,13 +14,11 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <uv.h>
#include "auto/config.h"
#include "nvim/api/private/converter.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
@ -47,7 +45,6 @@
#include "nvim/eval/userfunc.h"
#include "nvim/eval/vars.h"
#include "nvim/eval/window.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/process.h"

View File

@ -5,7 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/ascii_defs.h"
#include "nvim/assert_defs.h"
@ -19,7 +19,6 @@
#include "nvim/eval/userfunc.h"
#include "nvim/eval/vars.h"
#include "nvim/garray.h"
#include "nvim/garray_defs.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/hashtab.h"

View File

@ -8,12 +8,11 @@
#include "nvim/eval/typval_defs.h" // IWYU pragma: export
#include "nvim/func_attr.h"
#include "nvim/garray_defs.h"
#include "nvim/gettext.h"
#include "nvim/hashtab.h"
#include "nvim/lib/queue.h"
#include "nvim/macros_defs.h"
#include "nvim/mbyte_defs.h"
#include "nvim/mbyte_defs.h" // IWYU pragma: keep
#include "nvim/message.h"
#include "nvim/types_defs.h"

View File

@ -4,7 +4,7 @@
#include <stddef.h>
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval.h"
#include "nvim/eval.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/hashtab_defs.h" // IWYU pragma: keep

View File

@ -7,7 +7,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/ascii_defs.h"
#include "nvim/autocmd.h"

View File

@ -20,52 +20,6 @@ typedef struct {
typedef struct multiqueue MultiQueue;
typedef void (*PutCallback)(MultiQueue *multiq, void *data);
#define multiqueue_put(q, h, ...) \
do { \
multiqueue_put_event(q, event_create(h, __VA_ARGS__)); \
} while (0)
#define CREATE_EVENT(multiqueue, handler, ...) \
do { \
if (multiqueue) { \
multiqueue_put((multiqueue), (handler), __VA_ARGS__); \
} else { \
void *argv[] = { __VA_ARGS__ }; \
(handler)(argv); \
} \
} while (0)
// Poll for events until a condition or timeout
#define LOOP_PROCESS_EVENTS_UNTIL(loop, multiqueue, timeout, condition) \
do { \
int64_t remaining = timeout; \
uint64_t before = (remaining > 0) ? os_hrtime() : 0; \
while (!(condition)) { \
LOOP_PROCESS_EVENTS(loop, multiqueue, remaining); \
if (remaining == 0) { \
break; \
} else if (remaining > 0) { \
uint64_t now = os_hrtime(); \
remaining -= (int64_t)((now - before) / 1000000); \
before = now; \
if (remaining <= 0) { \
break; \
} \
} \
} \
} while (0)
#define LOOP_PROCESS_EVENTS(loop, multiqueue, timeout) \
do { \
if (multiqueue && !multiqueue_empty(multiqueue)) { \
multiqueue_process_events(multiqueue); \
} else { \
loop_poll_events(loop, timeout); \
} \
} while (0)
struct signal_watcher;
typedef struct signal_watcher SignalWatcher;
typedef void (*signal_cb)(SignalWatcher *watcher, int signum, void *data);
typedef void (*signal_close_cb)(SignalWatcher *watcher, void *data);
@ -78,8 +32,6 @@ struct signal_watcher {
MultiQueue *events;
};
struct time_watcher;
typedef struct time_watcher TimeWatcher;
typedef void (*time_cb)(TimeWatcher *watcher, void *data);
@ -91,8 +43,6 @@ struct time_watcher {
bool blockable;
};
struct wbuffer;
typedef struct wbuffer WBuffer;
typedef void (*wbuffer_data_finalizer)(void *data);
@ -102,8 +52,6 @@ struct wbuffer {
wbuffer_data_finalizer cb;
};
struct stream;
typedef struct stream Stream;
/// Type of function called when the Stream buffer is filled with data
///
@ -151,8 +99,6 @@ struct stream {
MultiQueue *events;
};
struct socket_watcher;
#define ADDRESS_MAX_SIZE 256
typedef struct socket_watcher SocketWatcher;

View File

@ -4,8 +4,8 @@
#include <uv.h>
#include "nvim/eval/typval.h"
#include "nvim/event/defs.h"
#include "nvim/event/libuv_process.h"
#include "nvim/event/loop.h"
#include "nvim/event/process.h"
#include "nvim/log.h"
#include "nvim/os/os.h"

View File

@ -2,8 +2,8 @@
#include <uv.h>
#include "nvim/event/loop.h"
#include "nvim/event/process.h"
#include "nvim/types_defs.h"
typedef struct libuv_process {
Process process;

View File

@ -3,12 +3,12 @@
#include <stdlib.h>
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/os/time.h"
#include "nvim/types_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/loop.c.generated.h"

View File

@ -1,19 +1,18 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <uv.h>
#include "klib/klist.h"
#include "nvim/event/multiqueue.h"
#include "nvim/os/time.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
typedef void *WatcherPtr;
#define _NOOP(x)
KLIST_INIT(WatcherPtr, WatcherPtr, _NOOP)
typedef struct loop {
struct loop {
uv_loop_t uv;
MultiQueue *events;
MultiQueue *thread_events;
@ -42,7 +41,7 @@ typedef struct loop {
uv_mutex_t mutex;
int recursive;
bool closing; ///< Set to true if loop_close() has been called
} Loop;
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/loop.h.generated.h"

View File

@ -2,8 +2,53 @@
#include <stddef.h> // IWYU pragma: keep
#include "nvim/event/defs.h" // IWYU pragma: keep
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/os/time.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/multiqueue.h.generated.h"
#endif
#define multiqueue_put(q, h, ...) \
do { \
multiqueue_put_event(q, event_create(h, __VA_ARGS__)); \
} while (0)
#define CREATE_EVENT(multiqueue, handler, ...) \
do { \
if (multiqueue) { \
multiqueue_put((multiqueue), (handler), __VA_ARGS__); \
} else { \
void *argv[] = { __VA_ARGS__ }; \
(handler)(argv); \
} \
} while (0)
// Poll for events until a condition or timeout
#define LOOP_PROCESS_EVENTS_UNTIL(loop, multiqueue, timeout, condition) \
do { \
int64_t remaining = timeout; \
uint64_t before = (remaining > 0) ? os_hrtime() : 0; \
while (!(condition)) { \
LOOP_PROCESS_EVENTS(loop, multiqueue, remaining); \
if (remaining == 0) { \
break; \
} else if (remaining > 0) { \
uint64_t now = os_hrtime(); \
remaining -= (int64_t)((now - before) / 1000000); \
before = now; \
if (remaining <= 0) { \
break; \
} \
} \
} \
} while (0)
#define LOOP_PROCESS_EVENTS(loop, multiqueue, timeout) \
do { \
if (multiqueue && !multiqueue_empty(multiqueue)) { \
multiqueue_process_events(multiqueue); \
} else { \
loop_poll_events(loop, timeout); \
} \
} while (0)

View File

@ -5,13 +5,8 @@
#include <stdint.h>
#include "nvim/eval/typval_defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/rstream.h"
#include "nvim/event/stream.h"
#include "nvim/event/wstream.h"
struct process;
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h"
typedef enum {
kProcessTypeUv,

View File

@ -2,11 +2,9 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/rstream.h"
#include "nvim/event/stream.h"
#include "nvim/log.h"
@ -14,6 +12,7 @@
#include "nvim/main.h"
#include "nvim/os/os_defs.h"
#include "nvim/rbuffer.h"
#include "nvim/types_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/rstream.c.generated.h"

View File

@ -1,11 +1,7 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <uv.h>
#include "nvim/event/loop.h"
#include "nvim/event/stream.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/rstream.h.generated.h"

View File

@ -3,7 +3,9 @@
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/signal.h"
#include "nvim/types_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/signal.c.generated.h"

View File

@ -1,10 +1,7 @@
#pragma once
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/signal.h.generated.h"

View File

@ -9,6 +9,7 @@
#include "nvim/charset.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/socket.h"
#include "nvim/event/stream.h"
#include "nvim/gettext.h"
@ -18,6 +19,7 @@
#include "nvim/os/fs.h"
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/types_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/socket.c.generated.h"

View File

@ -1,12 +1,7 @@
#pragma once
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/rstream.h"
#include "nvim/event/wstream.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/socket.h.generated.h"

View File

@ -9,6 +9,7 @@
#include "nvim/event/stream.h"
#include "nvim/log.h"
#include "nvim/rbuffer.h"
#include "nvim/types_defs.h"
#ifdef MSWIN
# include "nvim/os/os_win_console.h"
#endif

View File

@ -1,13 +1,7 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/rbuffer_defs.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/stream.h.generated.h"

View File

@ -6,6 +6,7 @@
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/time.h"
#include "nvim/types_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/time.c.generated.h"

View File

@ -1,11 +1,7 @@
#pragma once
#include <stdbool.h>
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/time.h.generated.h"

View File

@ -4,11 +4,11 @@
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/stream.h"
#include "nvim/event/wstream.h"
#include "nvim/macros_defs.h"
#include "nvim/memory.h"
#include "nvim/types_defs.h"
#define DEFAULT_MAXMEM 1024 * 1024 * 2000

View File

@ -1,13 +1,7 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <uv.h>
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/stream.h"
#include "nvim/event/defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/wstream.h.generated.h"

View File

@ -9,7 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "auto/config.h"
#include "nvim/arglist.h"
@ -29,7 +29,8 @@
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_cmds_defs.h"

View File

@ -11,7 +11,6 @@
#include "klib/kvec.h"
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/arabic.h"

View File

@ -25,6 +25,7 @@
#include "nvim/globals.h"
#include "nvim/macros_defs.h"
#include "nvim/mapping.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/option.h"

View File

@ -11,7 +11,6 @@
#include "klib/kvec.h"
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/buffer_defs.h"

View File

@ -6,7 +6,6 @@
#include "nvim/garray_defs.h" // IWYU pragma: export
#include "nvim/log.h"
#include "nvim/memory.h"
#include "nvim/types_defs.h"
#define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0)

View File

@ -11,7 +11,6 @@
#include <stdlib.h>
#include <string.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/buffer_defs.h"
@ -22,6 +21,7 @@
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
@ -34,7 +34,6 @@
#include "nvim/insexpand.h"
#include "nvim/keycodes.h"
#include "nvim/lua/executor.h"
#include "nvim/macros_defs.h"
#include "nvim/main.h"
#include "nvim/mapping.h"
#include "nvim/mbyte.h"

View File

@ -2,13 +2,12 @@
#include <stdbool.h>
#include <stddef.h> // IWYU pragma: keep
#include <string.h>
#include "nvim/buffer_defs.h"
#include "nvim/grid_defs.h" // IWYU pragma: export
#include "nvim/macros_defs.h"
#include "nvim/mbyte.h"
#include "nvim/pos_defs.h"
#include "nvim/types_defs.h"
/// By default, all windows are drawn on a single rectangular grid, represented by
/// this ScreenGrid instance. In multigrid mode each window will have its own

View File

@ -2,7 +2,7 @@
#include <stdbool.h>
#include "nvim/api/keysets_defs.h"
#include "nvim/api/keysets_defs.h" // IWYU pragma: keep
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/highlight_defs.h" // IWYU pragma: export

View File

@ -7,7 +7,6 @@
#include <string.h>
#include "nvim/ascii_defs.h"
#include "nvim/event/defs.h"
#include "nvim/getchar.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"

View File

@ -4,7 +4,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/ascii_defs.h"
#include "nvim/charset.h"

View File

@ -3,9 +3,8 @@
#include <stddef.h>
#include "nvim/ascii_defs.h"
#include "nvim/option_defs.h"
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/option_vars.h"
#include "nvim/strings.h"
// Keycode definitions for special keys.
//

View File

@ -1,7 +1,9 @@
#pragma once
#include <stdbool.h>
#include <stdio.h>
#include "auto/config.h"
#include "nvim/log_defs.h" // IWYU pragma: export
#include "nvim/macros_defs.h"
// USDT probes. Example invocation:
@ -20,6 +22,35 @@
#endif
// uncrustify:on
#define LOGLVL_DBG 1
#define LOGLVL_INF 2
#define LOGLVL_WRN 3
#define LOGLVL_ERR 4
#define LOG(level, ...) logmsg((level), NULL, __func__, __LINE__, true, __VA_ARGS__)
#ifdef NVIM_LOG_DEBUG
# define DLOG(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, true, __VA_ARGS__)
# define DLOGN(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, false, __VA_ARGS__)
# define ILOG(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, true, __VA_ARGS__)
# define ILOGN(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, false, __VA_ARGS__)
#else
# define DLOG(...)
# define DLOGN(...)
# define ILOG(...)
# define ILOGN(...)
#endif
#define WLOG(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, true, __VA_ARGS__)
#define WLOGN(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, false, __VA_ARGS__)
#define ELOG(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, true, __VA_ARGS__)
#define ELOGN(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, false, __VA_ARGS__)
#ifdef HAVE_EXECINFO_BACKTRACE
# define LOG_CALLSTACK() log_callstack(__func__, __LINE__)
# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__)
#endif
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "log.h.generated.h"
#endif

View File

@ -1,36 +0,0 @@
#pragma once
#include <stdbool.h>
#include <stdio.h>
#include "auto/config.h"
#include "nvim/macros_defs.h"
#define LOGLVL_DBG 1
#define LOGLVL_INF 2
#define LOGLVL_WRN 3
#define LOGLVL_ERR 4
#define LOG(level, ...) logmsg((level), NULL, __func__, __LINE__, true, __VA_ARGS__)
#ifdef NVIM_LOG_DEBUG
# define DLOG(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, true, __VA_ARGS__)
# define DLOGN(...) logmsg(LOGLVL_DBG, NULL, __func__, __LINE__, false, __VA_ARGS__)
# define ILOG(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, true, __VA_ARGS__)
# define ILOGN(...) logmsg(LOGLVL_INF, NULL, __func__, __LINE__, false, __VA_ARGS__)
#else
# define DLOG(...)
# define DLOGN(...)
# define ILOG(...)
# define ILOGN(...)
#endif
#define WLOG(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, true, __VA_ARGS__)
#define WLOGN(...) logmsg(LOGLVL_WRN, NULL, __func__, __LINE__, false, __VA_ARGS__)
#define ELOG(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, true, __VA_ARGS__)
#define ELOGN(...) logmsg(LOGLVL_ERR, NULL, __func__, __LINE__, false, __VA_ARGS__)
#ifdef HAVE_EXECINFO_BACKTRACE
# define LOG_CALLSTACK() log_callstack(__func__, __LINE__)
# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__)
#endif

View File

@ -13,7 +13,6 @@
#include "klib/kvec.h"
#include "luv/luv.h"
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/buffer_defs.h"
@ -24,10 +23,9 @@
#include "nvim/eval.h"
#include "nvim/eval/funcs.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/time.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds_defs.h"

View File

@ -4,18 +4,13 @@
#include <lua.h>
#include <stdbool.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/assert_defs.h"
#include "nvim/cmdexpand_defs.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/func_attr.h"
#include "nvim/lua/converter.h"
#include "nvim/macros_defs.h"
#include "nvim/map_defs.h"
#include "nvim/types_defs.h"
#include "nvim/usercmd.h"
#include "nvim/usercmd.h" // IWYU pragma: keep
// Generated by msgpack-gen.lua
void nlua_add_api_functions(lua_State *lstate) REAL_FATTR_NONNULL_ALL;

View File

@ -6,7 +6,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#ifdef NVIM_VENDOR_BIT
# include "bit.h"
@ -14,7 +14,6 @@
#include "cjson/lua_cjson.h"
#include "mpack/lmpack.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/buffer_defs.h"

View File

@ -5,7 +5,6 @@
#include <string.h>
#include "luaconf.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/linematch.h"
#include "nvim/lua/converter.h"

View File

@ -29,9 +29,6 @@
/// @return `s, sizeof(s) - 1`
#define S_LEN(s) (s), (sizeof(s) - 1)
/// LINEEMPTY() - return true if the line is empty
#define LINEEMPTY(p) (*ml_get(p) == NUL)
// toupper() and tolower() that use the current locale.
// Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the
// range 0 - 255. toupper()/tolower() on some systems can't handle others.
@ -54,48 +51,12 @@
// Returns empty string if it is NULL.
#define EMPTY_IF_NULL(x) ((x) ? (x) : "")
/// Adjust chars in a language according to 'langmap' option.
/// NOTE that there is no noticeable overhead if 'langmap' is not set.
/// When set the overhead for characters < 256 is small.
/// Don't apply 'langmap' if the character comes from the Stuff buffer or from a
/// mapping and the langnoremap option was set.
/// The do-while is just to ignore a ';' after the macro.
#define LANGMAP_ADJUST(c, condition) \
do { \
if (*p_langmap \
&& (condition) \
&& (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \
&& !KeyStuffed \
&& (c) >= 0) \
{ \
if ((c) < 256) \
c = langmap_mapchar[c]; \
else \
c = langmap_adjust_mb(c); \
} \
} while (0)
#define WRITEBIN "wb" // no CR-LF translation
#define READBIN "rb"
#define APPENDBIN "ab"
#define REPLACE_NORMAL(s) (((s)& REPLACE_FLAG) && !((s)& VREPLACE_FLAG))
// MB_PTR_ADV(): advance a pointer to the next character, taking care of
// multi-byte characters if needed. Skip over composing chars.
#define MB_PTR_ADV(p) (p += utfc_ptr2len((char *)p))
// Advance multi-byte pointer, do not skip over composing chars.
#define MB_CPTR_ADV(p) (p += utf_ptr2len((char *)p))
// MB_PTR_BACK(): backup a pointer to the previous character, taking care of
// multi-byte characters if needed. Only use with "p" > "s" !
#define MB_PTR_BACK(s, p) \
(p -= utf_head_off((char *)(s), (char *)(p) - 1) + 1)
// MB_CHAR2BYTES(): convert character to bytes and advance pointer to bytes
#define MB_CHAR2BYTES(c, b) ((b) += utf_char2bytes((c), ((char *)b)))
#define RESET_BINDING(wp) \
do { \
(wp)->w_p_scb = false; \

View File

@ -19,7 +19,6 @@
#include "auto/config.h" // IWYU pragma: keep
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/arglist.h"

View File

@ -3,6 +3,7 @@
#include <stdbool.h>
#include "nvim/event/loop.h"
#include "nvim/types_defs.h"
// Maximum number of commands from + or -c arguments.
#define MAX_ARG_CMDS 10

View File

@ -11,7 +11,6 @@
#include <stdlib.h>
#include <string.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/macros_defs.h"

View File

@ -13,6 +13,10 @@
#include "nvim/regexp_defs.h" // IWYU pragma: keep
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mapping.h.generated.h"
#endif
/// Used for the first argument of do_map()
enum {
MAPTYPE_MAP = 0,
@ -20,6 +24,23 @@ enum {
MAPTYPE_NOREMAP = 2,
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mapping.h.generated.h"
#endif
/// Adjust chars in a language according to 'langmap' option.
/// NOTE that there is no noticeable overhead if 'langmap' is not set.
/// When set the overhead for characters < 256 is small.
/// Don't apply 'langmap' if the character comes from the Stuff buffer or from a
/// mapping and the langnoremap option was set.
/// The do-while is just to ignore a ';' after the macro.
#define LANGMAP_ADJUST(c, condition) \
do { \
if (*p_langmap \
&& (condition) \
&& (p_lrm || (vgetc_busy ? typebuf_maplen() == 0 : KeyTyped)) \
&& !KeyStuffed \
&& (c) >= 0) \
{ \
if ((c) < 256) \
c = langmap_mapchar[c]; \
else \
c = langmap_adjust_mb(c); \
} \
} while (0)

View File

@ -1,15 +1,21 @@
#pragma once
#include <locale.h>
#include "nvim/ascii_defs.h"
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/extmark_defs.h" // IWYU pragma: keep
#include "nvim/func_attr.h"
#include "nvim/macros_defs.h"
#include "nvim/mark_defs.h" // IWYU pragma: export
#include "nvim/os/time.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mark.h.generated.h"
#endif
static inline int mark_global_index(char name)
REAL_FATTR_CONST;
/// Convert mark name to the offset
static inline int mark_global_index(const char name)
{
@ -22,7 +28,6 @@ static inline int mark_global_index(const char name)
static inline int mark_local_index(char name)
REAL_FATTR_CONST;
/// Convert local mark name to the offset
static inline int mark_local_index(const char name)
{
@ -40,6 +45,37 @@ static inline int mark_local_index(const char name)
/// Global marks (marks with file number or name)
EXTERN xfmark_T namedfm[NGLOBALMARKS] INIT( = { 0 });
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mark.h.generated.h"
#endif
#define SET_FMARK(fmarkp_, mark_, fnum_, view_) \
do { \
fmark_T *const fmarkp__ = fmarkp_; \
fmarkp__->mark = mark_; \
fmarkp__->fnum = fnum_; \
fmarkp__->timestamp = os_time(); \
fmarkp__->view = view_; \
fmarkp__->additional_data = NULL; \
} while (0)
/// Free and set fmark using given value
#define RESET_FMARK(fmarkp_, mark_, fnum_, view_) \
do { \
fmark_T *const fmarkp___ = fmarkp_; \
free_fmark(*fmarkp___); \
SET_FMARK(fmarkp___, mark_, fnum_, view_); \
} while (0)
/// Set given extended mark (regular mark + file name)
#define SET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \
do { \
xfmark_T *const xfmarkp__ = xfmarkp_; \
xfmarkp__->fname = fname_; \
SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \
} while (0)
/// Free and set given extended mark (regular mark + file name)
#define RESET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \
do { \
xfmark_T *const xfmarkp__ = xfmarkp_; \
free_xfmark(*xfmarkp__); \
xfmarkp__->fname = fname_; \
SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \
} while (0)

View File

@ -86,41 +86,6 @@ typedef struct xfilemark {
#define INIT_XFMARK { INIT_FMARK, NULL }
/// Set fmark using given value
#define SET_FMARK(fmarkp_, mark_, fnum_, view_) \
do { \
fmark_T *const fmarkp__ = fmarkp_; \
fmarkp__->mark = mark_; \
fmarkp__->fnum = fnum_; \
fmarkp__->timestamp = os_time(); \
fmarkp__->view = view_; \
fmarkp__->additional_data = NULL; \
} while (0)
/// Free and set fmark using given value
#define RESET_FMARK(fmarkp_, mark_, fnum_, view_) \
do { \
fmark_T *const fmarkp___ = fmarkp_; \
free_fmark(*fmarkp___); \
SET_FMARK(fmarkp___, mark_, fnum_, view_); \
} while (0)
/// Set given extended mark (regular mark + file name)
#define SET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \
do { \
xfmark_T *const xfmarkp__ = xfmarkp_; \
xfmarkp__->fname = fname_; \
SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \
} while (0)
/// Free and set given extended mark (regular mark + file name)
#define RESET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \
do { \
xfmark_T *const xfmarkp__ = xfmarkp_; \
free_xfmark(*xfmarkp__); \
xfmarkp__->fname = fname_; \
SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_, view_); \
} while (0)
static inline bool lt(pos_T a, pos_T b)
REAL_FATTR_CONST REAL_FATTR_ALWAYS_INLINE;
/// Return true if position a is before (less than) position b.

View File

@ -47,7 +47,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "klib/kvec.h"
#include "nvim/macros_defs.h"

View File

@ -32,7 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include <wctype.h>
#include "auto/config.h"

View File

@ -4,6 +4,7 @@
#include <stdint.h>
#include <string.h>
#include <sys/types.h> // IWYU pragma: keep
#include <uv.h> // IWYU pragma: keep
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
@ -11,6 +12,10 @@
#include "nvim/mbyte_defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mbyte.h.generated.h"
#endif
// Return byte length of character that starts with byte "b".
// Returns 1 for a single-byte character.
// MB_BYTE2LEN_CHECK() can be used to count a special key as one byte.
@ -22,13 +27,8 @@ extern const uint8_t utf8len_tab_zero[256];
extern const uint8_t utf8len_tab[256];
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "mbyte.h.generated.h"
#endif
static inline int mb_strcmp_ic(bool ic, const char *s1, const char *s2)
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_WARN_UNUSED_RESULT;
/// Compare strings
///
/// @param[in] ic True if case is to be ignored.
@ -38,3 +38,24 @@ static inline int mb_strcmp_ic(bool ic, const char *s1, const char *s2)
{
return (ic ? mb_stricmp(s1, s2) : strcmp(s1, s2));
}
// Use our own character-case definitions, because the current locale may
// differ from what the .spl file uses.
// These must not be called with negative number!
// Multi-byte implementation. For Unicode we can call utf_*(), but don't do
// that for ASCII, because we don't want to use 'casemap' here. Otherwise use
// the "w" library function for characters above 255.
#define SPELL_TOFOLD(c) ((c) >= 128 ? utf_fold(c) : (int)spelltab.st_fold[c])
#define SPELL_TOUPPER(c) ((c) >= 128 ? mb_toupper(c) : (int)spelltab.st_upper[c])
#define SPELL_ISUPPER(c) ((c) >= 128 ? mb_isupper(c) : spelltab.st_isu[c])
// MB_PTR_ADV(): advance a pointer to the next character, taking care of
// multi-byte characters if needed. Skip over composing chars.
#define MB_PTR_ADV(p) (p += utfc_ptr2len((char *)p))
// MB_PTR_BACK(): backup a pointer to the previous character, taking care of
// multi-byte characters if needed. Only use with "p" > "s" !
#define MB_PTR_BACK(s, p) \
(p -= utf_head_off((char *)(s), (char *)(p) - 1) + 1)

View File

@ -39,7 +39,6 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <uv.h>

View File

@ -1,5 +1,6 @@
#pragma once
#include "nvim/ascii_defs.h"
#include "nvim/eval/typval_defs.h" // IWYU pragma: keep
#include "nvim/memline_defs.h" // IWYU pragma: export
#include "nvim/pos_defs.h" // IWYU pragma: keep
@ -8,3 +9,6 @@
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "memline.h.generated.h"
#endif
/// LINEEMPTY() - return true if the line is empty
#define LINEEMPTY(p) (*ml_get(p) == NUL)

View File

@ -8,10 +8,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "klib/kvec.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
#include "nvim/buffer_defs.h"
@ -20,7 +19,6 @@
#include "nvim/drawscreen.h"
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/ex_cmds_defs.h"

View File

@ -15,6 +15,7 @@
#include "nvim/api/ui.h"
#include "nvim/channel.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/process.h"
#include "nvim/event/rstream.h"

View File

@ -1,11 +1,8 @@
#pragma once
#include <msgpack.h>
#include <stdbool.h>
#include <stdint.h>
#include <msgpack.h> // IWYU pragma: keep
#include "nvim/api/private/defs.h"
#include "nvim/event/wstream.h"
/// Value by which objects represented as EXT type are shifted
///

View File

@ -6,7 +6,6 @@
#include "nvim/channel.h"
#include "nvim/eval.h"
#include "nvim/event/defs.h"
#include "nvim/event/socket.h"
#include "nvim/garray.h"
#include "nvim/log.h"

View File

@ -1,17 +1,14 @@
#pragma once
#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_defs.h"
#include "nvim/msgpack_rpc/channel_defs.h"
#include "nvim/msgpack_rpc/channel_defs.h" // IWYU pragma: keep
#include "nvim/types_defs.h"
#include "nvim/ui_client.h"

View File

@ -9,7 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/api/private/defs.h"
#include "nvim/ascii_defs.h"

View File

@ -1,14 +1,17 @@
#pragma once
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h> // IWYU pragma: keep
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/api/private/helpers.h"
#include "nvim/assert_defs.h"
#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
#include "nvim/macros_defs.h"
#include "nvim/math.h"
#include "nvim/option_defs.h" // IWYU pragma: export
#include "nvim/types_defs.h" // IWYU pragma: keep

View File

@ -9,7 +9,6 @@
#include "nvim/ascii_defs.h"
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/rstream.h"

View File

@ -4,7 +4,7 @@
#include <stdint.h> // IWYU pragma: keep
#include "nvim/api/private/defs.h" // IWYU pragma: keep
#include "nvim/event/multiqueue.h"
#include "nvim/event/defs.h" // IWYU pragma: keep
#include "nvim/macros_defs.h"
EXTERN bool used_stdin INIT( = false);

View File

@ -32,7 +32,6 @@
#include "auto/config.h"
#include "klib/klist.h"
#include "nvim/eval/typval.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/process.h"
#include "nvim/log.h"

View File

@ -4,8 +4,8 @@
#include <stdint.h>
#include <sys/ioctl.h>
#include "nvim/event/loop.h"
#include "nvim/event/process.h"
#include "nvim/types_defs.h"
typedef struct pty_process {
Process process;

View File

@ -4,6 +4,7 @@
#include "nvim/ascii_defs.h"
#include "nvim/eval/typval.h"
#include "nvim/event/loop.h"
#include "nvim/log.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"

View File

@ -12,7 +12,6 @@
#include "nvim/charset.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/event/defs.h"
#include "nvim/event/libuv_process.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"

View File

@ -9,7 +9,6 @@
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
#include "nvim/eval.h"
#include "nvim/event/defs.h"
#include "nvim/event/signal.h"
#include "nvim/globals.h"
#include "nvim/log.h"

View File

@ -7,7 +7,8 @@
#include <uv.h>
#include "auto/config.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/log.h"

View File

@ -6,7 +6,6 @@
#include <stdbool.h>
#include <string.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/ascii_defs.h"

Some files were not shown because too many files have changed in this diff Show More