From 40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 12 Oct 2021 16:56:52 +0200 Subject: refactor: format all C files under nvim/ #15977 * refactor: format all C files under nvim * refactor: disable formatting for Vim-owned files: * src/nvim/indent_c.c * src/nvim/regexp.c * src/nvim/regexp_nfa.c * src/nvim/testdir/samples/memfile_test.c --- src/nvim/api/buffer.c | 15 +- src/nvim/api/private/dispatch.c | 2 +- src/nvim/api/private/helpers.c | 10 +- src/nvim/api/private/helpers.h | 2 +- src/nvim/api/vim.c | 2 +- src/nvim/api/win_config.c | 2 +- src/nvim/arabic.h | 4 +- src/nvim/ascii.h | 2 +- src/nvim/assert.h | 40 +-- src/nvim/autocmd.h | 30 +-- src/nvim/buffer.h | 48 ++-- src/nvim/buffer_defs.h | 325 ++++++++++++------------ src/nvim/channel.h | 46 ++-- src/nvim/charset.h | 6 +- src/nvim/context.h | 1 + src/nvim/cursor_shape.h | 44 ++-- src/nvim/decoration.h | 8 +- src/nvim/diff.h | 2 +- src/nvim/digraph.h | 2 +- src/nvim/edit.h | 38 +-- src/nvim/eval.h | 260 +++++++++---------- src/nvim/ex_cmds.h | 14 +- src/nvim/ex_cmds_defs.h | 26 +- src/nvim/ex_docmd.h | 2 +- src/nvim/ex_eval.h | 56 ++-- src/nvim/ex_getln.h | 2 +- src/nvim/extmark.h | 2 +- src/nvim/extmark_defs.h | 2 +- src/nvim/file_search.h | 14 +- src/nvim/fileio.h | 2 +- src/nvim/fold.h | 6 +- src/nvim/func_attr.h | 26 +- src/nvim/garray.h | 4 +- src/nvim/getchar.h | 4 +- src/nvim/globals.h | 220 ++++++++-------- src/nvim/grid_defs.h | 6 +- src/nvim/hardcopy.h | 16 +- src/nvim/hashtab.h | 20 +- src/nvim/highlight.h | 5 +- src/nvim/iconv.h | 18 +- src/nvim/if_cscope.h | 4 +- src/nvim/if_cscope_defs.h | 14 +- src/nvim/indent_c.c | 2 + src/nvim/keymap.h | 30 +-- src/nvim/lib/kbtree.h | 2 + src/nvim/lib/khash.h | 2 + src/nvim/lib/klist.h | 2 + src/nvim/lib/kvec.h | 2 + src/nvim/lib/queue.h | 2 + src/nvim/lib/ringbuf.h | 2 + src/nvim/log.h | 10 +- src/nvim/macros.h | 68 ++--- src/nvim/main.h | 2 +- src/nvim/map.h | 6 +- src/nvim/mark.h | 56 ++-- src/nvim/mark_defs.h | 6 +- src/nvim/marktree.h | 5 +- src/nvim/math.c | 1 - src/nvim/mbyte.h | 26 +- src/nvim/memfile_defs.h | 4 +- src/nvim/memline.h | 4 +- src/nvim/memline_defs.h | 8 +- src/nvim/memory.h | 2 +- src/nvim/menu.h | 6 +- src/nvim/message.h | 18 +- src/nvim/misc1.h | 14 +- src/nvim/mouse.h | 2 +- src/nvim/move.h | 1 + src/nvim/normal.h | 43 ++-- src/nvim/ops.h | 10 +- src/nvim/option.h | 8 +- src/nvim/option_defs.h | 436 ++++++++++++++++---------------- src/nvim/os_unix.h | 2 +- src/nvim/path.h | 28 +- src/nvim/popupmnu.h | 4 +- src/nvim/pos.h | 8 +- src/nvim/profile.h | 4 +- src/nvim/quickfix.h | 4 +- src/nvim/rbuffer.h | 30 +-- src/nvim/regexp.c | 2 + src/nvim/regexp.h | 2 +- src/nvim/regexp_defs.h | 30 +-- src/nvim/regexp_nfa.c | 2 + src/nvim/screen.h | 14 +- src/nvim/search.h | 48 ++-- src/nvim/sha256.h | 2 +- src/nvim/sign.h | 1 + src/nvim/sign_defs.h | 33 +-- src/nvim/spell.h | 2 +- src/nvim/spell_defs.h | 78 +++--- src/nvim/spellfile.h | 2 +- src/nvim/state.h | 4 +- src/nvim/strings.h | 4 +- src/nvim/syntax.h | 40 +-- src/nvim/syntax_defs.h | 32 +-- src/nvim/tag.h | 32 +-- src/nvim/terminal.h | 2 +- src/nvim/testdir/samples/memfile_test.c | 2 + src/nvim/tui/terminfo_defs.h | 3 - src/nvim/types.h | 2 +- src/nvim/ugrid.h | 2 +- src/nvim/ui.h | 5 +- src/nvim/ui_bridge.h | 4 +- src/nvim/ui_compositor.h | 2 +- src/nvim/undo.c | 2 +- src/nvim/undo.h | 2 +- src/nvim/undo_defs.h | 44 ++-- src/nvim/version.h | 4 +- src/nvim/vim.h | 17 +- src/nvim/window.h | 30 +-- src/uncrustify.cfg | 2 +- 111 files changed, 1331 insertions(+), 1332 deletions(-) (limited to 'src') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 569c0c9771..3a38a14cdd 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -1166,8 +1166,7 @@ Boolean nvim_buf_del_mark(Buffer buffer, String name, Error *err) /// @return true if the mark was set, else false. /// @see |nvim_buf_del_mark()| /// @see |nvim_buf_get_mark()| -Boolean nvim_buf_set_mark(Buffer buffer, String name, - Integer line, Integer col, Error *err) +Boolean nvim_buf_set_mark(Buffer buffer, String name, Integer line, Integer col, Error *err) FUNC_API_SINCE(8) { bool res = false; @@ -1578,8 +1577,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer if (opts->id.type == kObjectTypeInteger && opts->id.data.integer > 0) { id = (uint64_t)opts->id.data.integer; } else if (HAS_KEY(opts->id)) { - api_set_error(err, kErrorTypeValidation, "id is not a positive integer"); - goto error; + api_set_error(err, kErrorTypeValidation, "id is not a positive integer"); + goto error; } int line2 = -1; @@ -1655,10 +1654,10 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer } #define OPTION_TO_BOOL(target, name, val) \ - target = api_object_to_bool(opts-> name, #name, val, err); \ - if (ERROR_SET(err)) { \ - goto error; \ - } + target = api_object_to_bool(opts-> name, #name, val, err); \ + if (ERROR_SET(err)) { \ + goto error; \ + } OPTION_TO_BOOL(decor.virt_text_hide, virt_text_hide, false); OPTION_TO_BOOL(decor.hl_eol, hl_eol, false); diff --git a/src/nvim/api/private/dispatch.c b/src/nvim/api/private/dispatch.c index ee0cdc4c07..519bf8ff14 100644 --- a/src/nvim/api/private/dispatch.c +++ b/src/nvim/api/private/dispatch.c @@ -14,8 +14,8 @@ #include "nvim/api/tabpage.h" #include "nvim/api/ui.h" #include "nvim/api/vim.h" -#include "nvim/api/window.h" #include "nvim/api/win_config.h" +#include "nvim/api/window.h" #include "nvim/log.h" #include "nvim/map.h" #include "nvim/msgpack_rpc/helpers.h" diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index d03a61d1cc..aed87048ce 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -4,9 +4,9 @@ #include #include #include +#include #include #include -#include #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" @@ -831,10 +831,10 @@ void modify_keymap(Buffer buffer, bool is_unmap, String mode, String lhs, String MapArguments parsed_args = MAP_ARGUMENTS_INIT; if (opts) { #define KEY_TO_BOOL(name) \ - parsed_args. name = api_object_to_bool(opts-> name, #name, false, err); \ - if (ERROR_SET(err)) { \ - goto fail_and_free; \ - } + parsed_args. name = api_object_to_bool(opts-> name, #name, false, err); \ + if (ERROR_SET(err)) { \ + goto fail_and_free; \ + } KEY_TO_BOOL(nowait); KEY_TO_BOOL(noremap); diff --git a/src/nvim/api/private/helpers.h b/src/nvim/api/private/helpers.h index dc9452e832..08d2c8d90c 100644 --- a/src/nvim/api/private/helpers.h +++ b/src/nvim/api/private/helpers.h @@ -141,8 +141,8 @@ typedef struct { } while (0) #ifdef INCLUDE_GENERATED_DECLARATIONS -# include "keysets.h.generated.h" # include "api/private/helpers.h.generated.h" +# include "keysets.h.generated.h" #endif diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 9b39b18c4e..0565f8cd77 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -2846,7 +2846,7 @@ Array nvim_get_mark(String name, Error *err) bufnr = mark.fmark.fnum; filename = (char *)buflist_nr2name(bufnr, true, true); allocated = true; - // Marks comes from shada + // Marks comes from shada } else { filename = (char *)mark.fname; bufnr = 0; diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c index d82e7e8a03..d8105810aa 100644 --- a/src/nvim/api/win_config.c +++ b/src/nvim/api/win_config.c @@ -616,7 +616,7 @@ static bool parse_float_config(Dict(float_config) *config, FloatConfig *fconfig, fconfig->style = kWinStyleUnused; } else if (striequal(config->style.data.string.data, "minimal")) { fconfig->style = kWinStyleMinimal; - } else { + } else { api_set_error(err, kErrorTypeValidation, "Invalid value of 'style' key"); } } else if (HAS_KEY(config->style)) { diff --git a/src/nvim/arabic.h b/src/nvim/arabic.h index 7ea728ed47..eaab463777 100644 --- a/src/nvim/arabic.h +++ b/src/nvim/arabic.h @@ -6,8 +6,8 @@ /// Whether c belongs to the range of Arabic characters that might be shaped. static inline bool arabic_char(int c) { - // return c >= a_HAMZA && c <= a_MINI_ALEF; - return c >= 0x0621 && c <= 0x0670; + // return c >= a_HAMZA && c <= a_MINI_ALEF; + return c >= 0x0621 && c <= 0x0670; } #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h index 7b5e82cd3f..44ed94d2fc 100644 --- a/src/nvim/ascii.h +++ b/src/nvim/ascii.h @@ -3,8 +3,8 @@ #include -#include "nvim/macros.h" #include "nvim/func_attr.h" +#include "nvim/macros.h" #include "nvim/os/os_defs.h" // Definitions of various common control characters. diff --git a/src/nvim/assert.h b/src/nvim/assert.h index 1361879876..fc1a4be164 100644 --- a/src/nvim/assert.h +++ b/src/nvim/assert.h @@ -49,11 +49,11 @@ #define STATIC_ASSERT_PRAGMA_START #define STATIC_ASSERT_PRAGMA_END #define STATIC_ASSERT(cond, msg) \ - do { \ - STATIC_ASSERT_PRAGMA_START \ - STATIC_ASSERT_STATEMENT(cond, msg); \ - STATIC_ASSERT_PRAGMA_END \ - } while (0) + do { \ + STATIC_ASSERT_PRAGMA_START \ + STATIC_ASSERT_STATEMENT(cond, msg); \ + STATIC_ASSERT_PRAGMA_END \ + } while (0) // the easiest case, when the mode is C11 (generic compiler) or Clang // advertises explicit support for c_static_assert, meaning it won't warn. @@ -68,19 +68,19 @@ # undef STATIC_ASSERT_PRAGMA_START -#if __GNUC__ >= 6 -# define STATIC_ASSERT_PRAGMA_START \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wpedantic\"") -#else -# define STATIC_ASSERT_PRAGMA_START \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-pedantic\"") -#endif +# if __GNUC__ >= 6 +# define STATIC_ASSERT_PRAGMA_START \ + _Pragma("GCC diagnostic push")\ + _Pragma("GCC diagnostic ignored \"-Wpedantic\"") +# else +# define STATIC_ASSERT_PRAGMA_START \ + _Pragma("GCC diagnostic push")\ + _Pragma("GCC diagnostic ignored \"-pedantic\"") +# endif # undef STATIC_ASSERT_PRAGMA_END # define STATIC_ASSERT_PRAGMA_END \ - _Pragma("GCC diagnostic pop") + _Pragma("GCC diagnostic pop") // the same goes for clang in C99 mode, but we suppress a different warning #elif defined(__clang__) && __has_extension(c_static_assert) @@ -89,12 +89,12 @@ # undef STATIC_ASSERT_PRAGMA_START # define STATIC_ASSERT_PRAGMA_START \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wc11-extensions\"") + _Pragma("clang diagnostic push")\ + _Pragma("clang diagnostic ignored \"-Wc11-extensions\"") # undef STATIC_ASSERT_PRAGMA_END # define STATIC_ASSERT_PRAGMA_END \ - _Pragma("clang diagnostic pop") + _Pragma("clang diagnostic pop") // TODO(aktau): verify that this works, don't have MSVC on hand. #elif _MSC_VER >= 1600 @@ -113,14 +113,14 @@ // These can't be used after statements in c89. #ifdef __COUNTER__ # define STATIC_ASSERT_EXPR(e, m) \ - ((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)) }) 0) + ((enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1/(!!(e)) }) 0) #else // This can't be used twice on the same line so ensure if using in headers // that the headers are not included twice (by wrapping in #ifndef...#endif) // Note it doesn't cause an issue when used on same line of separate modules // compiled with gcc -combine -fwhole-program. # define STATIC_ASSERT_EXPR(e, m) \ - ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }) 0) + ((enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }) 0) #endif /// @def STRICT_ADD diff --git a/src/nvim/autocmd.h b/src/nvim/autocmd.h index 1c0f88f08f..ac12e2acf3 100644 --- a/src/nvim/autocmd.h +++ b/src/nvim/autocmd.h @@ -17,22 +17,22 @@ typedef struct { } aco_save_T; typedef struct AutoCmd { - char_u *cmd; // Command to be executed (NULL when - // command has been removed) + char_u *cmd; // Command to be executed (NULL when + // command has been removed) bool once; // "One shot": removed after execution bool nested; // If autocommands nest here bool last; // last command in list sctx_T script_ctx; // script context where defined - struct AutoCmd *next; // Next AutoCmd in list + struct AutoCmd *next; // Next AutoCmd in list } AutoCmd; typedef struct AutoPat { - struct AutoPat *next; // next AutoPat in AutoPat list; MUST - // be the first entry - char_u *pat; // pattern as typed (NULL when pattern - // has been removed) - regprog_T *reg_prog; // compiled regprog for pattern - AutoCmd *cmds; // list of commands to do + struct AutoPat *next; // next AutoPat in AutoPat list; MUST + // be the first entry + char_u *pat; // pattern as typed (NULL when pattern + // has been removed) + regprog_T *reg_prog; // compiled regprog for pattern + AutoCmd *cmds; // list of commands to do int group; // group ID int patlen; // strlen() of pat int buflocal_nr; // !=0 for buffer-local AutoPat @@ -48,16 +48,16 @@ typedef struct AutoPat { /// Struct used to keep status while executing autocommands for an event. /// typedef struct AutoPatCmd { - AutoPat *curpat; // next AutoPat to examine - AutoCmd *nextcmd; // next AutoCmd to execute + AutoPat *curpat; // next AutoPat to examine + AutoCmd *nextcmd; // next AutoCmd to execute int group; // group being used - char_u *fname; // fname to match with - char_u *sfname; // sfname to match with - char_u *tail; // tail of fname + char_u *fname; // fname to match with + char_u *sfname; // sfname to match with + char_u *tail; // tail of fname event_T event; // current event int arg_bufnr; // initially equal to , set to zero when // buf is deleted - struct AutoPatCmd *next; // chain of active apc-s for auto-invalidation + struct AutoPatCmd *next; // chain of active apc-s for auto-invalidation } AutoPatCmd; diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 02a2ac36f7..0484c8550d 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -1,21 +1,21 @@ #ifndef NVIM_BUFFER_H #define NVIM_BUFFER_H -#include "nvim/vim.h" -#include "nvim/window.h" -#include "nvim/pos.h" // for linenr_T +#include "nvim/eval.h" #include "nvim/ex_cmds_defs.h" // for exarg_T -#include "nvim/screen.h" // for StlClickRecord #include "nvim/func_attr.h" -#include "nvim/eval.h" #include "nvim/macros.h" #include "nvim/memline.h" +#include "nvim/pos.h" // for linenr_T +#include "nvim/screen.h" // for StlClickRecord +#include "nvim/vim.h" +#include "nvim/window.h" // Values for buflist_getfile() enum getf_values { - GETF_SETMARK = 0x01, // set pcmark before jumping - GETF_ALT = 0x02, // jumping to alternate file (not buf num) - GETF_SWITCH = 0x04, // respect 'switchbuf' settings when jumping + GETF_SETMARK = 0x01, // set pcmark before jumping + GETF_ALT = 0x02, // jumping to alternate file (not buf num) + GETF_SWITCH = 0x04, // respect 'switchbuf' settings when jumping }; // Return values of getfile() @@ -41,26 +41,26 @@ enum bln_values { // Values for action argument for do_buffer() enum dobuf_action_values { - DOBUF_GOTO = 0, // go to specified buffer - DOBUF_SPLIT = 1, // split window and go to specified buffer - DOBUF_UNLOAD = 2, // unload specified buffer(s) - DOBUF_DEL = 3, // delete specified buffer(s) from buflist - DOBUF_WIPE = 4, // delete specified buffer(s) really + DOBUF_GOTO = 0, // go to specified buffer + DOBUF_SPLIT = 1, // split window and go to specified buffer + DOBUF_UNLOAD = 2, // unload specified buffer(s) + DOBUF_DEL = 3, // delete specified buffer(s) from buflist + DOBUF_WIPE = 4, // delete specified buffer(s) really }; // Values for start argument for do_buffer() enum dobuf_start_values { - DOBUF_CURRENT = 0, // "count" buffer from current buffer - DOBUF_FIRST = 1, // "count" buffer from first buffer - DOBUF_LAST = 2, // "count" buffer from last buffer - DOBUF_MOD = 3, // "count" mod. buffer from current buffer + DOBUF_CURRENT = 0, // "count" buffer from current buffer + DOBUF_FIRST = 1, // "count" buffer from first buffer + DOBUF_LAST = 2, // "count" buffer from last buffer + DOBUF_MOD = 3, // "count" mod. buffer from current buffer }; // flags for buf_freeall() enum bfa_values { - BFA_DEL = 1, // buffer is going to be deleted - BFA_WIPE = 2, // buffer is going to be wiped out - BFA_KEEP_UNDO = 4, // do not free undo information + BFA_DEL = 1, // buffer is going to be deleted + BFA_WIPE = 2, // buffer is going to be wiped out + BFA_KEEP_UNDO = 4, // do not free undo information }; #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -75,14 +75,12 @@ static inline void buf_set_changedtick(buf_T *const buf, /// /// @param[out] buf Buffer to set changedtick in. /// @param[in] changedtick New value. -static inline void buf_set_changedtick(buf_T *const buf, - const varnumber_T changedtick) +static inline void buf_set_changedtick(buf_T *const buf, const varnumber_T changedtick) { typval_T old_val = buf->changedtick_di.di_tv; #ifndef NDEBUG - dictitem_T *const changedtick_di = tv_dict_find( - buf->b_vars, S_LEN("changedtick")); + dictitem_T *const changedtick_di = tv_dict_find(buf->b_vars, S_LEN("changedtick")); assert(changedtick_di != NULL); assert(changedtick_di->di_tv.v_type == VAR_NUMBER); assert(changedtick_di->di_tv.v_lock == VAR_FIXED); @@ -132,7 +130,7 @@ static inline void buf_inc_changedtick(buf_T *const buf) static inline bool buf_is_empty(buf_T *buf) { return buf->b_ml.ml_line_count == 1 - && *ml_get_buf(buf, (linenr_T)1, false) == '\0'; + && *ml_get_buf(buf, (linenr_T)1, false) == '\0'; } #endif // NVIM_BUFFER_H diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 0264a60117..2c411553b8 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -6,14 +6,14 @@ // for FILE #include -typedef struct file_buffer buf_T; // Forward declaration +typedef struct file_buffer buf_T; // Forward declaration // Reference to a buffer that stores the value of buf_free_count. // bufref_valid() only needs to check "buf" when the count differs. typedef struct { buf_T *br_buf; - int br_fnum; - int br_buf_free_count; + int br_fnum; + int br_buf_free_count; } bufref_T; // for garray_T @@ -111,16 +111,15 @@ typedef uint16_t disptick_T; // display tick type // for synstate_T (needs reg_extmatch_T, win_T, buf_T) #include "nvim/syntax_defs.h" // for sign_entry_T -#include "nvim/sign_defs.h" - #include "nvim/os/fs_defs.h" // for FileID +#include "nvim/sign_defs.h" #include "nvim/terminal.h" // for Terminal /* * The taggy struct is used to store the information about a :tag command. */ typedef struct taggy { - char_u *tagname; // tag name + char_u *tagname; // tag name fmark_T fmark; // cursor position BEFORE ":tag" int cur_match; // match number int cur_fnum; // buffer number used for cur_match @@ -161,45 +160,45 @@ typedef struct */ typedef struct { int wo_arab; -# define w_p_arab w_onebuf_opt.wo_arab // 'arabic' +#define w_p_arab w_onebuf_opt.wo_arab // 'arabic' int wo_bri; -# define w_p_bri w_onebuf_opt.wo_bri // 'breakindent' +#define w_p_bri w_onebuf_opt.wo_bri // 'breakindent' char_u *wo_briopt; -# define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt' +#define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt' int wo_diff; -# define w_p_diff w_onebuf_opt.wo_diff // 'diff' +#define w_p_diff w_onebuf_opt.wo_diff // 'diff' char_u *wo_fdc; -# define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn' +#define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn' char_u *wo_fdc_save; -# define w_p_fdc_save w_onebuf_opt.wo_fdc_save // 'fdc' saved for diff mode +#define w_p_fdc_save w_onebuf_opt.wo_fdc_save // 'fdc' saved for diff mode int wo_fen; -# define w_p_fen w_onebuf_opt.wo_fen // 'foldenable' +#define w_p_fen w_onebuf_opt.wo_fen // 'foldenable' int wo_fen_save; // 'foldenable' saved for diff mode -# define w_p_fen_save w_onebuf_opt.wo_fen_save - char_u *wo_fdi; -# define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore' +#define w_p_fen_save w_onebuf_opt.wo_fen_save + char_u *wo_fdi; +#define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore' long wo_fdl; -# define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel' +#define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel' int wo_fdl_save; // 'foldlevel' state saved for diff mode -# define w_p_fdl_save w_onebuf_opt.wo_fdl_save - char_u *wo_fdm; -# define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod' - char_u *wo_fdm_save; -# define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode +#define w_p_fdl_save w_onebuf_opt.wo_fdl_save + char_u *wo_fdm; +#define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod' + char_u *wo_fdm_save; +#define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode long wo_fml; -# define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines' +#define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines' long wo_fdn; -# define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax' - char_u *wo_fde; -# define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' - char_u *wo_fdt; -# define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext' - char_u *wo_fmr; -# define w_p_fmr w_onebuf_opt.wo_fmr // 'foldmarker' +#define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax' + char_u *wo_fde; +#define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' + char_u *wo_fdt; +#define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext' + char_u *wo_fmr; +#define w_p_fmr w_onebuf_opt.wo_fmr // 'foldmarker' int wo_lbr; -# define w_p_lbr w_onebuf_opt.wo_lbr // 'linebreak' +#define w_p_lbr w_onebuf_opt.wo_lbr // 'linebreak' int wo_list; #define w_p_list w_onebuf_opt.wo_list // 'list' int wo_nu; @@ -207,64 +206,64 @@ typedef struct { int wo_rnu; #define w_p_rnu w_onebuf_opt.wo_rnu // 'relativenumber' long wo_nuw; -# define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth' +#define w_p_nuw w_onebuf_opt.wo_nuw // 'numberwidth' int wo_wfh; -# define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' +#define w_p_wfh w_onebuf_opt.wo_wfh // 'winfixheight' int wo_wfw; -# define w_p_wfw w_onebuf_opt.wo_wfw // 'winfixwidth' +#define w_p_wfw w_onebuf_opt.wo_wfw // 'winfixwidth' int wo_pvw; -# define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow' +#define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow' int wo_rl; -# define w_p_rl w_onebuf_opt.wo_rl // 'rightleft' - char_u *wo_rlc; -# define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd' +#define w_p_rl w_onebuf_opt.wo_rl // 'rightleft' + char_u *wo_rlc; +#define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd' long wo_scr; #define w_p_scr w_onebuf_opt.wo_scr // 'scroll' int wo_spell; -# define w_p_spell w_onebuf_opt.wo_spell // 'spell' +#define w_p_spell w_onebuf_opt.wo_spell // 'spell' int wo_cuc; -# define w_p_cuc w_onebuf_opt.wo_cuc // 'cursorcolumn' +#define w_p_cuc w_onebuf_opt.wo_cuc // 'cursorcolumn' int wo_cul; -# define w_p_cul w_onebuf_opt.wo_cul // 'cursorline' - char_u *wo_culopt; -# define w_p_culopt w_onebuf_opt.wo_culopt // 'cursorlineopt' - char_u *wo_cc; -# define w_p_cc w_onebuf_opt.wo_cc // 'colorcolumn' - char_u *wo_sbr; -# define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak' - char_u *wo_stl; +#define w_p_cul w_onebuf_opt.wo_cul // 'cursorline' + char_u *wo_culopt; +#define w_p_culopt w_onebuf_opt.wo_culopt // 'cursorlineopt' + char_u *wo_cc; +#define w_p_cc w_onebuf_opt.wo_cc // 'colorcolumn' + char_u *wo_sbr; +#define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak' + char_u *wo_stl; #define w_p_stl w_onebuf_opt.wo_stl // 'statusline' int wo_scb; -# define w_p_scb w_onebuf_opt.wo_scb // 'scrollbind' +#define w_p_scb w_onebuf_opt.wo_scb // 'scrollbind' int wo_diff_saved; // options were saved for starting diff mode -# define w_p_diff_saved w_onebuf_opt.wo_diff_saved +#define w_p_diff_saved w_onebuf_opt.wo_diff_saved int wo_scb_save; // 'scrollbind' saved for diff mode -# define w_p_scb_save w_onebuf_opt.wo_scb_save +#define w_p_scb_save w_onebuf_opt.wo_scb_save int wo_wrap; #define w_p_wrap w_onebuf_opt.wo_wrap // 'wrap' int wo_wrap_save; // 'wrap' state saved for diff mode -# define w_p_wrap_save w_onebuf_opt.wo_wrap_save - char_u *wo_cocu; // 'concealcursor' -# define w_p_cocu w_onebuf_opt.wo_cocu +#define w_p_wrap_save w_onebuf_opt.wo_wrap_save + char_u *wo_cocu; // 'concealcursor' +#define w_p_cocu w_onebuf_opt.wo_cocu long wo_cole; // 'conceallevel' -# define w_p_cole w_onebuf_opt.wo_cole +#define w_p_cole w_onebuf_opt.wo_cole int wo_crb; -# define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind' +#define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind' int wo_crb_save; // 'cursorbind' state saved for diff mode -# define w_p_crb_save w_onebuf_opt.wo_crb_save +#define w_p_crb_save w_onebuf_opt.wo_crb_save char_u *wo_scl; -# define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' +#define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' char_u *wo_winhl; -# define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' +#define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' char_u *wo_fcs; -# define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars' +#define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars' char_u *wo_lcs; -# define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars' +#define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars' long wo_winbl; -# define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend' +#define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend' LastSet wo_script_ctx[WV_COUNT]; // SCTXs for window-local options -# define w_p_script_ctx w_onebuf_opt.wo_script_ctx +#define w_p_script_ctx w_onebuf_opt.wo_script_ctx } winopt_T; /* @@ -278,9 +277,9 @@ typedef struct { * most-recently-used order. */ struct wininfo_S { - wininfo_T *wi_next; // next entry or NULL for last entry - wininfo_T *wi_prev; // previous entry or NULL for first entry - win_T *wi_win; // pointer to window that did set wi_fpos + wininfo_T *wi_next; // next entry or NULL for last entry + wininfo_T *wi_prev; // previous entry or NULL for first entry + win_T *wi_win; // pointer to window that did set wi_fpos pos_T wi_fpos; // last cursor position in the file bool wi_optset; // true when wi_opt has useful values winopt_T wi_opt; // local window options @@ -306,11 +305,11 @@ typedef struct arglist { // // TODO(Felipe): move aentry_T to another header typedef struct argentry { - char_u *ae_fname; // file name as specified + char_u *ae_fname; // file name as specified int ae_fnum; // buffer number with expanded file name } aentry_T; -# define ALIST(win) (win)->w_alist +#define ALIST(win) (win)->w_alist #define GARGLIST ((aentry_T *)global_alist.al_ga.ga_data) #define ARGLIST ((aentry_T *)ALIST(curwin)->al_ga.ga_data) #define WARGLIST(wp) ((aentry_T *)ALIST(wp)->al_ga.ga_data) @@ -323,8 +322,8 @@ typedef struct argentry { * Used for the typeahead buffer: typebuf. */ typedef struct { - char_u *tb_buf; // buffer for typed characters - char_u *tb_noremap; // mapping flags for characters in tb_buf[] + char_u *tb_buf; // buffer for typed characters + char_u *tb_noremap; // mapping flags for characters in tb_buf[] int tb_buflen; // size of tb_buf[] int tb_off; // current position in tb_buf[] int tb_len; // number of valid bytes in tb_buf[] @@ -350,10 +349,10 @@ typedef struct { */ typedef struct mapblock mapblock_T; struct mapblock { - mapblock_T *m_next; // next mapblock in list - char_u *m_keys; // mapped from, lhs - char_u *m_str; // mapped to, rhs - char_u *m_orig_str; // rhs as entered by the user + mapblock_T *m_next; // next mapblock in list + char_u *m_keys; // mapped from, lhs + char_u *m_str; // mapped to, rhs + char_u *m_orig_str; // rhs as entered by the user int m_keylen; // strlen(m_keys) int m_mode; // valid mode int m_noremap; // if non-zero no re-mapping for m_str @@ -366,7 +365,7 @@ struct mapblock { /// Used for highlighting in the status line. typedef struct stl_hlrec stl_hlrec_t; struct stl_hlrec { - char_u *start; + char_u *start; int userhl; // 0: no HL, 1-9: User HL, < 0 for syn ID }; @@ -403,7 +402,7 @@ struct stl_item { #define SYNFLD_MINIMUM 1 // use lowest local minimum level on line // avoid #ifdefs for when b_spell is not available -# define B_SPELL(buf) ((buf)->b_spell) +#define B_SPELL(buf) ((buf)->b_spell) typedef struct qf_info_S qf_info_T; @@ -440,8 +439,8 @@ typedef struct { long b_syn_sync_minlines; // minimal sync lines offset long b_syn_sync_maxlines; // maximal sync lines offset long b_syn_sync_linebreaks; // offset for multi-line pattern - char_u *b_syn_linecont_pat; // line continuation pattern - regprog_T *b_syn_linecont_prog; // line continuation program + char_u *b_syn_linecont_pat; // line continuation pattern + regprog_T *b_syn_linecont_prog; // line continuation program syn_time_T b_syn_linecont_time; int b_syn_linecont_ic; // ignore-case flag for above int b_syn_topgrp; // for ":syntax include" @@ -460,10 +459,10 @@ typedef struct { // b_sst_freecount number of free entries in b_sst_array[] // b_sst_check_lnum entries after this lnum need to be checked for // validity (MAXLNUM means no check needed) - synstate_T *b_sst_array; + synstate_T *b_sst_array; int b_sst_len; - synstate_T *b_sst_first; - synstate_T *b_sst_firstfree; + synstate_T *b_sst_first; + synstate_T *b_sst_firstfree; int b_sst_freecount; linenr_T b_sst_check_lnum; disptick_T b_sst_lasttick; // last display tick @@ -471,12 +470,12 @@ typedef struct { // for spell checking garray_T b_langp; // list of pointers to slang_T, see spell.c bool b_spell_ismw[256]; // flags: is midword char - char_u *b_spell_ismw_mb; // multi-byte midword chars - char_u *b_p_spc; // 'spellcapcheck' - regprog_T *b_cap_prog; // program for 'spellcapcheck' - char_u *b_p_spf; // 'spellfile' - char_u *b_p_spl; // 'spelllang' - char_u *b_p_spo; // 'spelloptions' + char_u *b_spell_ismw_mb; // multi-byte midword chars + char_u *b_p_spc; // 'spellcapcheck' + regprog_T *b_cap_prog; // program for 'spellcapcheck' + char_u *b_p_spf; // 'spellfile' + char_u *b_p_spl; // 'spelllang' + char_u *b_p_spo; // 'spelloptions' int b_cjk; // all CJK letters as OK char_u b_syn_chartab[32]; // syntax iskeyword option char_u *b_syn_isk; // iskeyword option @@ -521,8 +520,8 @@ struct file_buffer { memline_T b_ml; // associated memline (also contains line count - buf_T *b_next; // links in list of buffers - buf_T *b_prev; + buf_T *b_next; // links in list of buffers + buf_T *b_prev; int b_nwindows; // nr of windows open on this buffer @@ -538,11 +537,11 @@ struct file_buffer { // b_fname is the same as b_sfname, unless ":cd" has been done, // then it is the same as b_ffname (NULL for no name). // - char_u *b_ffname; // full path file name, allocated - char_u *b_sfname; // short file name, allocated, may be equal to - // b_ffname - char_u *b_fname; // current file name, points to b_ffname or - // b_sfname + char_u *b_ffname; // full path file name, allocated + char_u *b_sfname; // short file name, allocated, may be equal to + // b_ffname + char_u *b_fname; // current file name, points to b_ffname or + // b_sfname bool file_id_valid; FileID file_id; @@ -577,7 +576,7 @@ struct file_buffer { // change long b_mod_xlines; // number of extra buffer lines inserted; // negative when lines were deleted - wininfo_T *b_wininfo; // list of last used info for each window + wininfo_T *b_wininfo; // list of last used info for each window int b_mod_tick_syn; // last display tick syntax was updated int b_mod_tick_decor; // last display tick decoration providers // where invoked @@ -614,10 +613,10 @@ struct file_buffer { uint64_t b_chartab[4]; // Table used for mappings local to a buffer. - mapblock_T *(b_maphash[MAX_MAPHASH]); + mapblock_T *(b_maphash[MAX_MAPHASH]); // First abbreviation local to a buffer. - mapblock_T *b_first_abbr; + mapblock_T *b_first_abbr; // User commands local to the buffer. garray_T b_ucmds; /* @@ -632,10 +631,10 @@ struct file_buffer { /* * The following only used in undo.c. */ - u_header_T *b_u_oldhead; // pointer to oldest header - u_header_T *b_u_newhead; // pointer to newest header; may not be valid - // if b_u_curhead is not NULL - u_header_T *b_u_curhead; // pointer to current header + u_header_T *b_u_oldhead; // pointer to oldest header + u_header_T *b_u_newhead; // pointer to newest header; may not be valid + // if b_u_curhead is not NULL + u_header_T *b_u_curhead; // pointer to current header int b_u_numhead; // current number of headers bool b_u_synced; // entry lists are synced long b_u_seq_last; // last used undo sequence number @@ -647,7 +646,7 @@ struct file_buffer { /* * variables for "U" command in undo.c */ - char_u *b_u_line_ptr; // saved line for "U" command + char_u *b_u_line_ptr; // saved line for "U" command linenr_T b_u_line_lnum; // line number of line in u_line colnr_T b_u_line_colnr; // optional column number @@ -659,11 +658,11 @@ struct file_buffer { #define B_IMODE_USE_INSERT -1 // Use b_p_iminsert value for search #define B_IMODE_NONE 0 // Input via none #define B_IMODE_LMAP 1 // Input via langmap -# define B_IMODE_LAST 1 +#define B_IMODE_LAST 1 int16_t b_kmap_state; // using "lmap" mappings -# define KEYMAP_INIT 1 // 'keymap' was set, call keymap_init() -# define KEYMAP_LOADED 2 // 'keymap' mappings have been loaded +#define KEYMAP_INIT 1 // 'keymap' was set, call keymap_init() +#define KEYMAP_LOADED 2 // 'keymap' mappings have been loaded garray_T b_kmap_ga; // the keymap table /* @@ -818,7 +817,7 @@ struct file_buffer { int b_start_eol; // last line had eol when it was read int b_start_ffc; // first char of 'ff' when edit started - char_u *b_start_fenc; // 'fileencoding' when edit started or NULL + char_u *b_start_fenc; // 'fileencoding' when edit started or NULL int b_bad_char; // "++bad=" argument when edit started or 0 int b_start_bomb; // 'bomb' when it was read @@ -901,7 +900,7 @@ struct file_buffer { /* * Stuff for diff mode. */ -# define DB_COUNT 8 // up to four buffers can be diff'ed +#define DB_COUNT 8 // up to four buffers can be diff'ed /* * Each diffblock defines where a block of lines starts in each of the buffers @@ -919,14 +918,14 @@ struct file_buffer { */ typedef struct diffblock_S diff_T; struct diffblock_S { - diff_T *df_next; + diff_T *df_next; linenr_T df_lnum[DB_COUNT]; // line number in buffer linenr_T df_count[DB_COUNT]; // nr of inserted/changed lines }; #define SNAP_HELP_IDX 0 -# define SNAP_AUCMD_IDX 1 -# define SNAP_COUNT 2 +#define SNAP_AUCMD_IDX 1 +#define SNAP_COUNT 2 /// Tab pages point to the top frame of each tab page. /// Note: Most values are NOT valid for the current tab page! Use "curwin", @@ -935,25 +934,25 @@ struct diffblock_S { typedef struct tabpage_S tabpage_T; struct tabpage_S { handle_T handle; - tabpage_T *tp_next; ///< next tabpage or NULL - frame_T *tp_topframe; ///< topframe for the windows - win_T *tp_curwin; ///< current window in this Tab page - win_T *tp_prevwin; ///< previous window in this Tab page - win_T *tp_firstwin; ///< first window in this Tab page - win_T *tp_lastwin; ///< last window in this Tab page + tabpage_T *tp_next; ///< next tabpage or NULL + frame_T *tp_topframe; ///< topframe for the windows + win_T *tp_curwin; ///< current window in this Tab page + win_T *tp_prevwin; ///< previous window in this Tab page + win_T *tp_firstwin; ///< first window in this Tab page + win_T *tp_lastwin; ///< last window in this Tab page long tp_old_Rows; ///< Rows when Tab page was left long tp_old_Columns; ///< Columns when Tab page was left long tp_ch_used; ///< value of 'cmdheight' when frame size ///< was set - diff_T *tp_first_diff; - buf_T *(tp_diffbuf[DB_COUNT]); + diff_T *tp_first_diff; + buf_T *(tp_diffbuf[DB_COUNT]); int tp_diff_invalid; ///< list of diffs is outdated int tp_diff_update; ///< update diffs before redrawing - frame_T *(tp_snapshot[SNAP_COUNT]); ///< window layout snapshots + frame_T *(tp_snapshot[SNAP_COUNT]); ///< window layout snapshots ScopeDictDictItem tp_winvar; ///< Variable for "t:" Dictionary. - dict_T *tp_vars; ///< Internal variables, local to tab page. - char_u *tp_localdir; ///< Absolute path of local cwd or NULL. + dict_T *tp_vars; ///< Internal variables, local to tab page. + char_u *tp_localdir; ///< Absolute path of local cwd or NULL. }; /* @@ -986,14 +985,14 @@ struct frame_S { int fr_newwidth; // new width used in win_equal_rec() int fr_height; int fr_newheight; // new height used in win_equal_rec() - frame_T *fr_parent; // containing frame or NULL - frame_T *fr_next; // frame right or below in same parent, NULL - // for last - frame_T *fr_prev; // frame left or above in same parent, NULL - // for first + frame_T *fr_parent; // containing frame or NULL + frame_T *fr_next; // frame right or below in same parent, NULL + // for last + frame_T *fr_prev; // frame left or above in same parent, NULL + // for first // fr_child and fr_win are mutually exclusive - frame_T *fr_child; // first contained frame - win_T *fr_win; // window that fills this frame + frame_T *fr_child; // first contained frame + win_T *fr_win; // window that fills this frame }; #define FR_LEAF 0 // frame is a leaf @@ -1009,7 +1008,7 @@ struct frame_S { typedef struct { regmmatch_T rm; // points to the regexp program; contains last found // match (may continue in next line) - buf_T *buf; // the buffer to search for a match + buf_T *buf; // the buffer to search for a match linenr_T lnum; // the line to search for a match int attr; // attributes to be used for a match int attr_cur; // attributes currently active in win_line() @@ -1026,9 +1025,9 @@ typedef struct { /// Same as lpos_T, but with additional field len. typedef struct { - linenr_T lnum; ///< line number - colnr_T col; ///< column number - int len; ///< length: 0 - to the end of line + linenr_T lnum; ///< line number + colnr_T col; ///< column number + int len; ///< length: 0 - to the end of line } llpos_T; /// posmatch_T provides an array for storing match items for matchaddpos() @@ -1036,10 +1035,10 @@ typedef struct typedef struct posmatch posmatch_T; struct posmatch { - llpos_T pos[MAXPOSMATCH]; ///< array of positions - int cur; ///< internal position counter - linenr_T toplnum; ///< top buffer line - linenr_T botlnum; ///< bottom buffer line + llpos_T pos[MAXPOSMATCH]; ///< array of positions + int cur; ///< internal position counter + linenr_T toplnum; ///< top buffer line + linenr_T botlnum; ///< bottom buffer line }; /* @@ -1144,20 +1143,20 @@ typedef struct VimMenu vimmenu_T; struct VimMenu { int modes; ///< Which modes is this menu visible for int enabled; ///< for which modes the menu is enabled - char_u *name; ///< Name of menu, possibly translated - char_u *dname; ///< Displayed Name ("name" without '&') - char_u *en_name; ///< "name" untranslated, NULL when - ///< was not translated - char_u *en_dname; ///< NULL when "dname" untranslated + char_u *name; ///< Name of menu, possibly translated + char_u *dname; ///< Displayed Name ("name" without '&') + char_u *en_name; ///< "name" untranslated, NULL when + ///< was not translated + char_u *en_dname; ///< NULL when "dname" untranslated int mnemonic; ///< mnemonic key (after '&') - char_u *actext; ///< accelerator text (after TAB) + char_u *actext; ///< accelerator text (after TAB) long priority; ///< Menu order priority - char_u *strings[MENU_MODES]; ///< Mapped string for each mode + char_u *strings[MENU_MODES]; ///< Mapped string for each mode int noremap[MENU_MODES]; ///< A \ref REMAP_VALUES flag for each mode bool silent[MENU_MODES]; ///< A silent flag for each mode - vimmenu_T *children; ///< Children of sub-menu - vimmenu_T *parent; ///< Parent of menu - vimmenu_T *next; ///< Next item in menu + vimmenu_T *children; ///< Children of sub-menu + vimmenu_T *parent; ///< Parent of menu + vimmenu_T *next; ///< Next item in menu }; /// Structure which contains all information that belongs to a window. @@ -1166,10 +1165,10 @@ struct VimMenu { struct window_S { handle_T handle; ///< unique identifier for the window - buf_T *w_buffer; ///< buffer we are a window into (used - ///< often, keep it the first item!) + buf_T *w_buffer; ///< buffer we are a window into (used + ///< often, keep it the first item!) - synblock_T *w_s; ///< for :ownsyntax + synblock_T *w_s; ///< for :ownsyntax int w_hl_id_normal; ///< 'winhighlight' normal id int w_hl_attr_normal; ///< 'winhighlight' normal final attrs @@ -1179,12 +1178,12 @@ struct window_S { int w_hl_needs_update; ///< attrs need to be recalculated - win_T *w_prev; ///< link to previous window - win_T *w_next; ///< link to next window + win_T *w_prev; ///< link to previous window + win_T *w_next; ///< link to next window bool w_closing; ///< window is being closed, don't let /// autocommands close it too. - frame_T *w_frame; ///< frame containing this window + frame_T *w_frame; ///< frame containing this window pos_T w_cursor; ///< cursor position in buffer @@ -1345,7 +1344,7 @@ struct window_S { * This is used for efficient redrawing. */ int w_lines_valid; // number of valid entries - wline_T *w_lines; + wline_T *w_lines; garray_T w_folds; // array of nested folds bool w_fold_manual; // when true: some folds are opened/closed @@ -1377,13 +1376,13 @@ struct window_S { int w_alt_fnum; // alternate file (for # and CTRL-^) - alist_T *w_alist; // pointer to arglist for this window + alist_T *w_alist; // pointer to arglist for this window int w_arg_idx; // current index in argument list (can be // out of range!) int w_arg_idx_invalid; // editing another file than w_arg_idx - char_u *w_localdir; /* absolute path of local directory or - NULL */ + char_u *w_localdir; /* absolute path of local directory or + NULL */ // Options local to a window. // They are local because they influence the layout of the window or // depend on the window layout. @@ -1396,10 +1395,10 @@ struct window_S { uint32_t w_p_stl_flags; // flags for 'statusline' uint32_t w_p_fde_flags; // flags for 'foldexpr' uint32_t w_p_fdt_flags; // flags for 'foldtext' - int *w_p_cc_cols; // array of columns to highlight or NULL - char_u w_p_culopt_flags; // flags for cursorline highlighting - long w_p_siso; // 'sidescrolloff' local value - long w_p_so; // 'scrolloff' local value + int *w_p_cc_cols; // array of columns to highlight or NULL + char_u w_p_culopt_flags; // flags for cursorline highlighting + long w_p_siso; // 'sidescrolloff' local value + long w_p_so; // 'scrolloff' local value int w_briopt_min; // minimum width for breakindent int w_briopt_shift; // additional shift for breakindent @@ -1463,10 +1462,10 @@ struct window_S { * was computed. */ int w_nrwidth_width; // nr of chars to print line count. - qf_info_T *w_llist; // Location list for this window + qf_info_T *w_llist; // Location list for this window // Location list reference used in the location list window. // In a non-location list window, w_llist_ref is NULL. - qf_info_T *w_llist_ref; + qf_info_T *w_llist_ref; }; static inline int win_hl_attr(win_T *wp, int hlf) @@ -1476,6 +1475,6 @@ static inline int win_hl_attr(win_T *wp, int hlf) /// Macros defined in Vim, but not in Neovim #define CHANGEDTICK(buf) \ - (=== Include buffer.h & use buf_(get|set|inc)_changedtick ===) + (=== Include buffer.h & use buf_(get|set|inc) _changedtick ===) #endif // NVIM_BUFFER_DEFS_H diff --git a/src/nvim/channel.h b/src/nvim/channel.h index 9bc0df3615..4f51a7fc78 100644 --- a/src/nvim/channel.h +++ b/src/nvim/channel.h @@ -1,13 +1,13 @@ #ifndef NVIM_CHANNEL_H #define NVIM_CHANNEL_H -#include "nvim/main.h" -#include "nvim/event/socket.h" -#include "nvim/event/process.h" -#include "nvim/os/pty_process.h" -#include "nvim/event/libuv_process.h" #include "nvim/eval/typval.h" +#include "nvim/event/libuv_process.h" +#include "nvim/event/process.h" +#include "nvim/event/socket.h" +#include "nvim/main.h" #include "nvim/msgpack_rpc/channel_defs.h" +#include "nvim/os/pty_process.h" #define CHAN_STDIO 1 #define CHAN_STDERR 2 @@ -105,18 +105,18 @@ static inline Stream *channel_instream(Channel *chan) FUNC_ATTR_NONNULL_ALL { switch (chan->streamtype) { - case kChannelStreamProc: - return &chan->stream.proc.in; + case kChannelStreamProc: + return &chan->stream.proc.in; - case kChannelStreamSocket: - return &chan->stream.socket; + case kChannelStreamSocket: + return &chan->stream.socket; - case kChannelStreamStdio: - return &chan->stream.stdio.out; + case kChannelStreamStdio: + return &chan->stream.stdio.out; - case kChannelStreamInternal: - case kChannelStreamStderr: - abort(); + case kChannelStreamInternal: + case kChannelStreamStderr: + abort(); } abort(); } @@ -125,18 +125,18 @@ static inline Stream *channel_outstream(Channel *chan) FUNC_ATTR_NONNULL_ALL { switch (chan->streamtype) { - case kChannelStreamProc: - return &chan->stream.proc.out; + case kChannelStreamProc: + return &chan->stream.proc.out; - case kChannelStreamSocket: - return &chan->stream.socket; + case kChannelStreamSocket: + return &chan->stream.socket; - case kChannelStreamStdio: - return &chan->stream.stdio.in; + case kChannelStreamStdio: + return &chan->stream.stdio.in; - case kChannelStreamInternal: - case kChannelStreamStderr: - abort(); + case kChannelStreamInternal: + case kChannelStreamStderr: + abort(); } abort(); } diff --git a/src/nvim/charset.h b/src/nvim/charset.h index 2fef4d78a2..47d89717e8 100644 --- a/src/nvim/charset.h +++ b/src/nvim/charset.h @@ -1,11 +1,11 @@ #ifndef NVIM_CHARSET_H #define NVIM_CHARSET_H -#include "nvim/types.h" -#include "nvim/pos.h" #include "nvim/buffer_defs.h" #include "nvim/eval/typval.h" #include "nvim/option_defs.h" +#include "nvim/pos.h" +#include "nvim/types.h" /// Return the folded-case equivalent of the given character /// @@ -13,7 +13,7 @@ /// /// @return Folded variant. #define CH_FOLD(c) \ - utf_fold((sizeof(c) == sizeof(char)) \ + utf_fold((sizeof(c) == sizeof(char)) \ ?((int)(uint8_t)(c)) \ :((int)(c))) diff --git a/src/nvim/context.h b/src/nvim/context.h index 7edd63ced2..c2deca12c9 100644 --- a/src/nvim/context.h +++ b/src/nvim/context.h @@ -2,6 +2,7 @@ #define NVIM_CONTEXT_H #include + #include "nvim/api/private/defs.h" #include "nvim/lib/kvec.h" diff --git a/src/nvim/cursor_shape.h b/src/nvim/cursor_shape.h index a23fa6836d..06eaa431a0 100644 --- a/src/nvim/cursor_shape.h +++ b/src/nvim/cursor_shape.h @@ -1,36 +1,36 @@ #ifndef NVIM_CURSOR_SHAPE_H #define NVIM_CURSOR_SHAPE_H -#include "nvim/types.h" #include "nvim/api/private/defs.h" +#include "nvim/types.h" /// struct to store values from 'guicursor' and 'mouseshape' /// Indexes in shape_table[] typedef enum { -SHAPE_IDX_N = 0, ///< Normal mode -SHAPE_IDX_V = 1, ///< Visual mode -SHAPE_IDX_I = 2, ///< Insert mode -SHAPE_IDX_R = 3, ///< Replace mode -SHAPE_IDX_C = 4, ///< Command line Normal mode -SHAPE_IDX_CI = 5, ///< Command line Insert mode -SHAPE_IDX_CR = 6, ///< Command line Replace mode -SHAPE_IDX_O = 7, ///< Operator-pending mode -SHAPE_IDX_VE = 8, ///< Visual mode with 'selection' exclusive -SHAPE_IDX_CLINE = 9, ///< On command line -SHAPE_IDX_STATUS = 10, ///< On status line -SHAPE_IDX_SDRAG = 11, ///< dragging a status line -SHAPE_IDX_VSEP = 12, ///< On vertical separator line -SHAPE_IDX_VDRAG = 13, ///< dragging a vertical separator line -SHAPE_IDX_MORE = 14, ///< Hit-return or More -SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line -SHAPE_IDX_SM = 16, ///< showing matching paren -SHAPE_IDX_COUNT = 17 + SHAPE_IDX_N = 0, ///< Normal mode + SHAPE_IDX_V = 1, ///< Visual mode + SHAPE_IDX_I = 2, ///< Insert mode + SHAPE_IDX_R = 3, ///< Replace mode + SHAPE_IDX_C = 4, ///< Command line Normal mode + SHAPE_IDX_CI = 5, ///< Command line Insert mode + SHAPE_IDX_CR = 6, ///< Command line Replace mode + SHAPE_IDX_O = 7, ///< Operator-pending mode + SHAPE_IDX_VE = 8, ///< Visual mode with 'selection' exclusive + SHAPE_IDX_CLINE = 9, ///< On command line + SHAPE_IDX_STATUS = 10, ///< On status line + SHAPE_IDX_SDRAG = 11, ///< dragging a status line + SHAPE_IDX_VSEP = 12, ///< On vertical separator line + SHAPE_IDX_VDRAG = 13, ///< dragging a vertical separator line + SHAPE_IDX_MORE = 14, ///< Hit-return or More + SHAPE_IDX_MOREL = 15, ///< Hit-return or More in last line + SHAPE_IDX_SM = 16, ///< showing matching paren + SHAPE_IDX_COUNT = 17 } ModeShape; typedef enum { -SHAPE_BLOCK = 0, ///< block cursor -SHAPE_HOR = 1, ///< horizontal bar cursor -SHAPE_VER = 2 ///< vertical bar cursor + SHAPE_BLOCK = 0, ///< block cursor + SHAPE_HOR = 1, ///< horizontal bar cursor + SHAPE_VER = 2 ///< vertical bar cursor } CursorShape; #define MSHAPE_NUMBERED 1000 // offset for shapes identified by number diff --git a/src/nvim/decoration.h b/src/nvim/decoration.h index 35f5af87ed..e44fbab0a5 100644 --- a/src/nvim/decoration.h +++ b/src/nvim/decoration.h @@ -1,9 +1,9 @@ #ifndef NVIM_DECORATION_H #define NVIM_DECORATION_H -#include "nvim/pos.h" #include "nvim/buffer_defs.h" #include "nvim/extmark_defs.h" +#include "nvim/pos.h" // actual Decoration data is in extmark_defs.h @@ -82,9 +82,9 @@ EXTERN DecorState decor_state INIT(= { 0 }); EXTERN bool provider_active INIT(= false); #define DECORATION_PROVIDER_INIT(ns_id) (DecorProvider) \ - { ns_id, false, LUA_NOREF, LUA_NOREF, \ - LUA_NOREF, LUA_NOREF, LUA_NOREF, \ - LUA_NOREF, -1 } + { ns_id, false, LUA_NOREF, LUA_NOREF, \ + LUA_NOREF, LUA_NOREF, LUA_NOREF, \ + LUA_NOREF, -1 } #ifdef INCLUDE_GENERATED_DECLARATIONS # include "decoration.h.generated.h" diff --git a/src/nvim/diff.h b/src/nvim/diff.h index 99a60381bd..53fc5aa077 100644 --- a/src/nvim/diff.h +++ b/src/nvim/diff.h @@ -1,8 +1,8 @@ #ifndef NVIM_DIFF_H #define NVIM_DIFF_H -#include "nvim/pos.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/pos.h" // Value set from 'diffopt'. EXTERN int diff_context INIT(= 6); // context for folds diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h index 1b73ccaf3f..71330ae9b1 100644 --- a/src/nvim/digraph.h +++ b/src/nvim/digraph.h @@ -1,8 +1,8 @@ #ifndef NVIM_DIGRAPH_H #define NVIM_DIGRAPH_H -#include "nvim/types.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/types.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "digraph.h.generated.h" diff --git a/src/nvim/edit.h b/src/nvim/edit.h index ef5dce738a..894e23ee9f 100644 --- a/src/nvim/edit.h +++ b/src/nvim/edit.h @@ -24,27 +24,27 @@ typedef enum { typedef int (*IndentGetter)(void); -/* Values for in_cinkeys() */ +// Values for in_cinkeys() #define KEY_OPEN_FORW 0x101 #define KEY_OPEN_BACK 0x102 -#define 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 */ - -/* 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 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 */ +#define 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 + +// 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 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 #ifdef INCLUDE_GENERATED_DECLARATIONS # include "edit.h.generated.h" diff --git a/src/nvim/eval.h b/src/nvim/eval.h index 2452a0a8c8..3d656656de 100644 --- a/src/nvim/eval.h +++ b/src/nvim/eval.h @@ -3,7 +3,7 @@ #include "nvim/buffer_defs.h" #include "nvim/channel.h" -#include "nvim/eval/funcs.h" // For FunPtr +#include "nvim/eval/funcs.h" // For FunPtr #include "nvim/event/time.h" // For TimeWatcher #include "nvim/ex_cmds_defs.h" // For exarg_T #include "nvim/os/fileio.h" // For FileDescriptor @@ -24,46 +24,46 @@ EXTERN ufunc_T dumuf; /* * Structure returned by get_lval() and used by set_var_lval(). * For a plain name: - * "name" points to the variable name. - * "exp_name" is NULL. - * "tv" is NULL + * "name" points to the variable name. + * "exp_name" is NULL. + * "tv" is NULL * For a magic braces name: - * "name" points to the expanded variable name. - * "exp_name" is non-NULL, to be freed later. - * "tv" is NULL + * "name" points to the expanded variable name. + * "exp_name" is non-NULL, to be freed later. + * "tv" is NULL * For an index in a list: - * "name" points to the (expanded) variable name. - * "exp_name" NULL or non-NULL, to be freed later. - * "tv" points to the (first) list item value - * "li" points to the (first) list item - * "range", "n1", "n2" and "empty2" indicate what items are used. + * "name" points to the (expanded) variable name. + * "exp_name" NULL or non-NULL, to be freed later. + * "tv" points to the (first) list item value + * "li" points to the (first) list item + * "range", "n1", "n2" and "empty2" indicate what items are used. * For an existing Dict item: - * "name" points to the (expanded) variable name. - * "exp_name" NULL or non-NULL, to be freed later. - * "tv" points to the dict item value - * "newkey" is NULL + * "name" points to the (expanded) variable name. + * "exp_name" NULL or non-NULL, to be freed later. + * "tv" points to the dict item value + * "newkey" is NULL * For a non-existing Dict item: - * "name" points to the (expanded) variable name. - * "exp_name" NULL or non-NULL, to be freed later. - * "tv" points to the Dictionary typval_T - * "newkey" is the key for the new item. + * "name" points to the (expanded) variable name. + * "exp_name" NULL or non-NULL, to be freed later. + * "tv" points to the Dictionary typval_T + * "newkey" is the key for the new item. */ typedef struct lval_S { - const char *ll_name; ///< Start of variable name (can be NULL). - size_t ll_name_len; ///< Length of the .ll_name. - char *ll_exp_name; ///< NULL or expanded name in allocated memory. - typval_T *ll_tv; ///< Typeval of item being used. If "newkey" - ///< isn't NULL it's the Dict to which to add the item. - listitem_T *ll_li; ///< The list item or NULL. - list_T *ll_list; ///< The list or NULL. - bool ll_range; ///< true when a [i:j] range was used. - bool ll_empty2; ///< Second index is empty: [i:]. - long ll_n1; ///< First index for list. - long ll_n2; ///< Second index for list range. - dict_T *ll_dict; ///< The Dictionary or NULL. - dictitem_T *ll_di; ///< The dictitem or NULL. - char_u *ll_newkey; ///< New key for Dict in allocated memory or NULL. - blob_T *ll_blob; ///< The Blob or NULL. + const char *ll_name; ///< Start of variable name (can be NULL). + size_t ll_name_len; ///< Length of the .ll_name. + char *ll_exp_name; ///< NULL or expanded name in allocated memory. + typval_T *ll_tv; ///< Typeval of item being used. If "newkey" + ///< isn't NULL it's the Dict to which to add the item. + listitem_T *ll_li; ///< The list item or NULL. + list_T *ll_list; ///< The list or NULL. + bool ll_range; ///< true when a [i:j] range was used. + bool ll_empty2; ///< Second index is empty: [i:]. + long ll_n1; ///< First index for list. + long ll_n2; ///< Second index for list range. + dict_T *ll_dict; ///< The Di