diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-11-28 07:47:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 07:47:36 +0800 |
| commit | 718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad (patch) | |
| tree | b9dcecd6373c0f9a51c5dde37c2c7c7cf5f43c62 /src/nvim | |
| parent | 6c14ae6bfaf51415b555e9a6b85d1d280976358d (diff) | |
| download | rneovim-718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad.tar.gz rneovim-718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad.tar.bz2 rneovim-718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad.zip | |
refactor: fix runtime_defs.h (#26259)
Diffstat (limited to 'src/nvim')
57 files changed, 299 insertions, 255 deletions
diff --git a/src/nvim/api/buffer.h b/src/nvim/api/buffer.h index 557cf8db0c..f3971c1d30 100644 --- a/src/nvim/api/buffer.h +++ b/src/nvim/api/buffer.h @@ -3,9 +3,9 @@ #include <lua.h> // IWYU pragma: keep #include <stdint.h> // IWYU pragma: keep -#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" +#include "nvim/buffer_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/buffer.h.generated.h" diff --git a/src/nvim/api/command.h b/src/nvim/api/command.h index 95f0e05993..1cccbfb4c7 100644 --- a/src/nvim/api/command.h +++ b/src/nvim/api/command.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/extmark.h b/src/nvim/api/extmark.h index 2989dee53d..491e468d95 100644 --- a/src/nvim/api/extmark.h +++ b/src/nvim/api/extmark.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#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/decoration_defs.h" // IWYU pragma: keep #include "nvim/macros.h" diff --git a/src/nvim/api/options.h b/src/nvim/api/options.h index e44ed44c80..c16c6088b3 100644 --- a/src/nvim/api/options.h +++ b/src/nvim/api/options.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#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/option_defs.h" // IWYU pragma: keep diff --git a/src/nvim/api/private/dispatch.h b/src/nvim/api/private/dispatch.h index 3d12b941f4..6a2c9eaf54 100644 --- a/src/nvim/api/private/dispatch.h +++ b/src/nvim/api/private/dispatch.h @@ -4,7 +4,7 @@ #include <stdint.h> #include "nvim/api/private/defs.h" -#include "nvim/memory.h" +#include "nvim/memory_defs.h" #include "nvim/types_defs.h" typedef Object (*ApiDispatchWrapper)(uint64_t channel_id, Array args, Arena *arena, Error *error); diff --git a/src/nvim/api/vim.h b/src/nvim/api/vim.h index b2ebacb309..b620158751 100644 --- a/src/nvim/api/vim.h +++ b/src/nvim/api/vim.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/vimscript.h b/src/nvim/api/vimscript.h index c068542311..c315e932e9 100644 --- a/src/nvim/api/vimscript.h +++ b/src/nvim/api/vimscript.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/win_config.h b/src/nvim/api/win_config.h index 47e441a592..6df8ed13fa 100644 --- a/src/nvim/api/win_config.h +++ b/src/nvim/api/win_config.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/window.h b/src/nvim/api/window.h index 600d6956b5..a5c9f86225 100644 --- a/src/nvim/api/window.h +++ b/src/nvim/api/window.h @@ -1,6 +1,6 @@ #pragma once -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/arglist.h b/src/nvim/arglist.h index bcb5c8f565..97729f466c 100644 --- a/src/nvim/arglist.h +++ b/src/nvim/arglist.h @@ -4,7 +4,7 @@ #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "arglist.h.generated.h" diff --git a/src/nvim/bufwrite.h b/src/nvim/bufwrite.h index 38d4d7745e..9ed6216847 100644 --- a/src/nvim/bufwrite.h +++ b/src/nvim/bufwrite.h @@ -2,7 +2,7 @@ #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "bufwrite.h.generated.h" diff --git a/src/nvim/change.h b/src/nvim/change.h index 1c90b67fe3..06155b6da6 100644 --- a/src/nvim/change.h +++ b/src/nvim/change.h @@ -1,15 +1,17 @@ #pragma once #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep -// flags for open_line() -#define OPENLINE_DELSPACES 0x01 // delete spaces after cursor -#define OPENLINE_DO_COM 0x02 // format comments -#define OPENLINE_KEEPTRAIL 0x04 // keep trailing spaces -#define OPENLINE_MARKFIX 0x08 // fix mark positions -#define OPENLINE_COM_LIST 0x10 // format comments with list/2nd line indent -#define OPENLINE_FORMAT 0x20 // formatting long comment +/// flags for open_line() +enum { + OPENLINE_DELSPACES = 0x01, ///< delete spaces after cursor + OPENLINE_DO_COM = 0x02, ///< format comments + OPENLINE_KEEPTRAIL = 0x04, ///< keep trailing spaces + OPENLINE_MARKFIX = 0x08, ///< fix mark positions + OPENLINE_COM_LIST = 0x10, ///< format comments with list/2nd line indent + OPENLINE_FORMAT = 0x20, ///< formatting long comment +}; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "change.h.generated.h" diff --git a/src/nvim/cmdexpand.h b/src/nvim/cmdexpand.h index 4ae702f18d..b0772d26a3 100644 --- a/src/nvim/cmdexpand.h +++ b/src/nvim/cmdexpand.h @@ -4,7 +4,7 @@ #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_getln.h" #include "nvim/garray_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep // Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. diff --git a/src/nvim/cursor.h b/src/nvim/cursor.h index ea63f7c1e5..d50976b598 100644 --- a/src/nvim/cursor.h +++ b/src/nvim/cursor.h @@ -1,7 +1,7 @@ #pragma once #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "cursor.h.generated.h" diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h index 792e859991..267004124b 100644 --- a/src/nvim/digraph.h +++ b/src/nvim/digraph.h @@ -4,7 +4,7 @@ #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep #include "nvim/garray_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "digraph.h.generated.h" diff --git a/src/nvim/edit.h b/src/nvim/edit.h index 7cf4141045..434b653f7b 100644 --- a/src/nvim/edit.h +++ b/src/nvim/edit.h @@ -2,29 +2,37 @@ #include "nvim/autocmd_defs.h" // IWYU pragma: keep #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep -// Values for in_cinkeys() -#define KEY_OPEN_FORW 0x101 -#define KEY_OPEN_BACK 0x102 -#define KEY_COMPLETE 0x103 // end of completion +/// Values for in_cinkeys() +enum { + KEY_OPEN_FORW = 0x101, + KEY_OPEN_BACK = 0x102, + KEY_COMPLETE = 0x103, ///< end of completion +}; -// Values for change_indent() -#define INDENT_SET 1 // set indent -#define INDENT_INC 2 // increase indent -#define INDENT_DEC 3 // decrease indent +/// Values for change_indent() +enum { + INDENT_SET = 1, ///< set indent + INDENT_INC = 2, ///< increase indent + INDENT_DEC = 3, ///< decrease indent +}; -// flags for beginline() -#define BL_WHITE 1 // cursor on first non-white in the line -#define BL_SOL 2 // use 'sol' option -#define BL_FIX 4 // don't leave cursor on a NUL +/// flags for beginline() +enum { + BL_WHITE = 1, ///< cursor on first non-white in the line + BL_SOL = 2, ///< use 'sol' option + BL_FIX = 4, ///< don't leave cursor on a NUL +}; -// flags for insertchar() -#define INSCHAR_FORMAT 1 // force formatting -#define INSCHAR_DO_COM 2 // format comments -#define INSCHAR_CTRLV 4 // char typed just after CTRL-V -#define INSCHAR_NO_FEX 8 // don't use 'formatexpr' -#define INSCHAR_COM_LIST 16 // format comments with list/2nd line indent +/// flags for insertchar() +enum { + INSCHAR_FORMAT = 1, ///< force formatting + INSCHAR_DO_COM = 2, ///< format comments + INSCHAR_CTRLV = 4, ///< char typed just after CTRL-V + INSCHAR_NO_FEX = 8, ///< don't use 'formatexpr' + INSCHAR_COM_LIST = 16, ///< format comments with list/2nd line indent +}; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "edit.h.generated.h" diff --git a/src/nvim/eval/buffer.h b/src/nvim/eval/buffer.h index 106a499bad..1d346b99a5 100644 --- a/src/nvim/eval/buffer.h +++ b/src/nvim/eval/buffer.h @@ -2,7 +2,7 @@ #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/buffer.h.generated.h" diff --git a/src/nvim/eval/decode.h b/src/nvim/eval/decode.h index 1c0fd445f1..c0d10a469a 100644 --- a/src/nvim/eval/decode.h +++ b/src/nvim/eval/decode.h @@ -4,7 +4,7 @@ #include <stddef.h> // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/decode.h.generated.h" diff --git a/src/nvim/eval/funcs.h b/src/nvim/eval/funcs.h index 09f709be06..0c345dacb4 100644 --- a/src/nvim/eval/funcs.h +++ b/src/nvim/eval/funcs.h @@ -3,18 +3,20 @@ #include <stdbool.h> #include <stdint.h> -#include "nvim/api/private/dispatch.h" -#include "nvim/buffer_defs.h" -#include "nvim/cmdexpand_defs.h" +#include "nvim/buffer_defs.h" // IWYU pragma: keep +#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep #include "nvim/types_defs.h" /// Prototype of C function that implements Vimscript function typedef void (*VimLFunc)(typval_T *args, typval_T *rvar, EvalFuncData data); /// Special flags for base_arg @see EvalFuncDef -#define BASE_NONE 0 ///< Not a method (no base argument). -#define BASE_LAST UINT8_MAX ///< Use the last argument as the method base. +enum { + BASE_NONE = 0, ///< Not a method (no base argument). + BASE_LAST = UINT8_MAX, ///< Use the last argument as the method base. +}; /// Structure holding Vimscript function definition typedef struct { diff --git a/src/nvim/eval/vars.h b/src/nvim/eval/vars.h index 849d0c4229..3512152184 100644 --- a/src/nvim/eval/vars.h +++ b/src/nvim/eval/vars.h @@ -6,7 +6,7 @@ #include "nvim/garray_defs.h" // IWYU pragma: keep #include "nvim/hashtab.h" #include "nvim/option_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/vars.h.generated.h" diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h index 529009415b..de13f03197 100644 --- a/src/nvim/ex_cmds.h +++ b/src/nvim/ex_cmds.h @@ -6,7 +6,7 @@ #include "nvim/eval/typval_defs.h" #include "nvim/ex_cmds_defs.h" // IWYU pragma: export #include "nvim/os/time.h" -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep // flags for do_ecmd() #define ECMD_HIDE 0x01 // don't free the current buffer diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h index 1ccd112e2a..3781ba1a34 100644 --- a/src/nvim/ex_docmd.h +++ b/src/nvim/ex_docmd.h @@ -2,29 +2,34 @@ #include <stdbool.h> -#include "nvim/buffer_defs.h" -#include "nvim/cmdexpand_defs.h" -#include "nvim/ex_cmds_defs.h" +#include "nvim/buffer_defs.h" // IWYU pragma: keep +#include "nvim/cmdexpand_defs.h" // IWYU pragma: keep +#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep #include "nvim/getchar_defs.h" #include "nvim/globals.h" +#include "nvim/types_defs.h" // IWYU pragma: keep -// flags for do_cmdline() -#define DOCMD_VERBOSE 0x01 // included command in error message -#define DOCMD_NOWAIT 0x02 // don't call wait_return() and friends -#define DOCMD_REPEAT 0x04 // repeat exec. until getline() returns NULL -#define DOCMD_KEYTYPED 0x08 // don't reset KeyTyped -#define DOCMD_EXCRESET 0x10 // reset exception environment (for debugging -#define DOCMD_KEEPLINE 0x20 // keep typed line for repeating with "." +/// flags for do_cmdline() +enum { + DOCMD_VERBOSE = 0x01, ///< included command in error message + DOCMD_NOWAIT = 0x02, ///< don't call wait_return() and friends + DOCMD_REPEAT = 0x04, ///< repeat exec. until getline() returns NULL + DOCMD_KEYTYPED = 0x08, ///< don't reset KeyTyped + DOCMD_EXCRESET = 0x10, ///< reset exception environment (for debugging + DOCMD_KEEPLINE = 0x20, ///< keep typed line for repeating with "." +}; -// defines for eval_vars() -#define VALID_PATH 1 -#define VALID_HEAD 2 +/// defines for eval_vars() +enum { + VALID_PATH = 1, + VALID_HEAD = 2, +}; // Whether a command index indicates a user command. #define IS_USER_CMDIDX(idx) ((int)(idx) < 0) -// Structure used to save the current state. Used when executing Normal mode -// commands while in any other mode. +/// Structure used to save the current state. Used when executing Normal mode +/// commands while in any other mode. typedef struct { int save_msg_scroll; int save_restart_edit; diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 7e2a999b7d..967aab6138 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -5,9 +5,9 @@ #include "klib/kvec.h" #include "nvim/cmdexpand_defs.h" #include "nvim/eval/typval_defs.h" -#include "nvim/ex_cmds_defs.h" -#include "nvim/option_defs.h" -#include "nvim/types_defs.h" +#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep +#include "nvim/option_defs.h" // IWYU pragma: keep +#include "nvim/types_defs.h" // IWYU pragma: keep struct cmdline_info; diff --git a/src/nvim/file_search.h b/src/nvim/file_search.h index ab47445a79..d4b5c5d352 100644 --- a/src/nvim/file_search.h +++ b/src/nvim/file_search.h @@ -3,7 +3,7 @@ #include <stdlib.h> #include "nvim/globals.h" -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep // Flags for find_file_*() functions. #define FINDFILE_FILE 0 // only files diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h index 612a6d2a0c..177a021706 100644 --- a/src/nvim/getchar.h +++ b/src/nvim/getchar.h @@ -6,7 +6,7 @@ #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/getchar_defs.h" // IWYU pragma: export #include "nvim/os/fileio.h" -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep /// Argument for flush_buffers(). typedef enum { diff --git a/src/nvim/hashtab.h b/src/nvim/hashtab.h index c1981a9160..bf109ecae8 100644 --- a/src/nvim/hashtab.h +++ b/src/nvim/hashtab.h @@ -2,8 +2,6 @@ #include <stddef.h> -#include "nvim/types_defs.h" - /// Magic number used for hashitem "hi_key" value indicating a deleted item /// /// Only the address is used. diff --git a/src/nvim/highlight_group.h b/src/nvim/highlight_group.h index 03e1508539..ca7bd36271 100644 --- a/src/nvim/highlight_group.h +++ b/src/nvim/highlight_group.h @@ -5,7 +5,7 @@ #include "nvim/api/private/helpers.h" #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/highlight_defs.h" -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #define MAX_HL_ID 20000 // maximum value for a highlight ID. diff --git a/src/nvim/indent.h b/src/nvim/indent.h index 13288584d9..b64015958c 100644 --- a/src/nvim/indent.h +++ b/src/nvim/indent.h @@ -2,16 +2,18 @@ #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" -#include "nvim/types_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep +#include "nvim/types_defs.h" // IWYU pragma: keep typedef int (*IndentGetter)(void); -// flags for set_indent() -#define SIN_CHANGED 1 // call changed_bytes() when line changed -#define SIN_INSERT 2 // insert indent before existing text -#define SIN_UNDO 4 // save line for undo before changing it -#define SIN_NOMARK 8 // don't adjust extmarks +/// flags for set_indent() +enum { + SIN_CHANGED = 1, ///< call changed_bytes() when line changed + SIN_INSERT = 2, ///< insert indent before existing text + SIN_UNDO = 4, ///< save line for undo before changing it + SIN_NOMARK = 8, ///< don't adjust extmarks +}; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "indent.h.generated.h" diff --git a/src/nvim/indent_c.h b/src/nvim/indent_c.h index 82de7369b4..64ba67a42b 100644 --- a/src/nvim/indent_c.h +++ b/src/nvim/indent_c.h @@ -1,7 +1,7 @@ #pragma once #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "indent_c.h.generated.h" diff --git a/src/nvim/insexpand.h b/src/nvim/insexpand.h index 3ad0ac05de..39584321ef 100644 --- a/src/nvim/insexpand.h +++ b/src/nvim/insexpand.h @@ -2,8 +2,8 @@ #include "nvim/macros.h" #include "nvim/option_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" -#include "nvim/types_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep +#include "nvim/types_defs.h" // IWYU pragma: keep #include "nvim/vim.h" #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/linematch.h b/src/nvim/linematch.h index 3f3cdae171..eaf0d54bec 100644 --- a/src/nvim/linematch.h +++ b/src/nvim/linematch.h @@ -2,7 +2,7 @@ #include <stddef.h> // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs. |