diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2021-10-12 16:56:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 07:56:52 -0700 |
commit | 40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf (patch) | |
tree | c46f06f4c40d85e308017e379a97fd1aebcebef1 /src | |
parent | ee342d3cef97aa2414c05261b448228ae3277862 (diff) | |
download | rneovim-40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf.tar.gz rneovim-40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf.tar.bz2 rneovim-40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf.zip |
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
Diffstat (limited to 'src')
111 files changed, 1331 insertions, 1332 deletions
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 <assert.h> #include <inttypes.h> #include <stdbool.h> +#include <stddef.h> #include <stdlib.h> #include <string.h> -#include <stddef.h> #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 <stdbool.h> -#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 <abuf>, 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 <stdio.h> -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 <msgpack.h> + #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 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. } lval_T; /// enum used by var_flavour() @@ -75,100 +75,100 @@ typedef enum { /// Defines for Vim variables typedef enum { - VV_COUNT, - VV_COUNT1, - VV_PREVCOUNT, - VV_ERRMSG, - VV_WARNINGMSG, - VV_STATUSMSG, - VV_SHELL_ERROR, - VV_THIS_SESSION, - VV_VERSION, - VV_LNUM, - VV_TERMRESPONSE, - VV_FNAME, - VV_LANG, - VV_LC_TIME, - VV_CTYPE, - VV_CC_FROM, - VV_CC_TO, - VV_FNAME_IN, - VV_FNAME_OUT, - VV_FNAME_NEW, - VV_FNAME_DIFF, - VV_CMDARG, - VV_FOLDSTART, - VV_FOLDEND, - VV_FOLDDASHES, - VV_FOLDLEVEL, - VV_PROGNAME, - VV_SEND_SERVER, - VV_DYING, - VV_EXCEPTION, - VV_THROWPOINT, - VV_REG, - VV_CMDBANG, - VV_INSERTMODE, - VV_VAL, - VV_KEY, - VV_PROFILING, - VV_FCS_REASON, - VV_FCS_CHOICE, - VV_BEVAL_BUFNR, - VV_BEVAL_WINNR, - VV_BEVAL_WINID, - VV_BEVAL_LNUM, - VV_BEVAL_COL, - VV_BEVAL_TEXT, - VV_SCROLLSTART, - VV_SWAPNAME, - VV_SWAPCHOICE, - VV_SWAPCOMMAND, - VV_CHAR, - VV_MOUSE_WIN, - VV_MOUSE_WINID, - VV_MOUSE_LNUM, - VV_MOUSE_COL, - VV_OP, - VV_SEARCHFORWARD, - VV_HLSEARCH, - VV_OLDFILES, - VV_WINDOWID, - VV_PROGPATH, - VV_COMPLETED_ITEM, - VV_OPTION_NEW, - VV_OPTION_OLD, - VV_OPTION_TYPE, - VV_ERRORS, - VV_FALSE, - VV_TRUE, - VV_NULL, - VV_NUMBERMAX, - VV_NUMBERMIN, - VV_NUMBERSIZE, - VV_VIM_DID_ENTER, - VV_TESTING, - VV_TYPE_NUMBER, - VV_TYPE_STRING, - VV_TYPE_FUNC, - VV_TYPE_LIST, - VV_TYPE_DICT, - VV_TYPE_FLOAT, - VV_TYPE_BOOL, - VV_TYPE_BLOB, - VV_EVENT, - VV_ECHOSPACE, - VV_ARGV, - VV_COLLATE, - VV_EXITING, - // Neovim - VV_STDERR, - VV_MSGPACK_TYPES, - VV__NULL_STRING, // String with NULL value. For test purposes only. - VV__NULL_LIST, // List with NULL value. For test purposes only. - VV__NULL_DICT, // Dictionary with NULL value. For test purposes only. - VV__NULL_BLOB, // Blob with NULL value. For test purposes only. - VV_LUA, + VV_COUNT, + VV_COUNT1, + VV_PREVCOUNT, + VV_ERRMSG, + VV_WARNINGMSG, + VV_STATUSMSG, + VV_SHELL_ERROR, + VV_THIS_SESSION, + VV_VERSION, + VV_LNUM, + VV_TERMRESPONSE, + VV_FNAME, + VV_LANG, + VV_LC_TIME, + VV_CTYPE, + VV_CC_FROM, + VV_CC_TO, + VV_FNAME_IN, + VV_FNAME_OUT, + VV_FNAME_NEW, + VV_FNAME_DIFF, + VV_CMDARG, + VV_FOLDSTART, + VV_FOLDEND, + VV_FOLDDASHES, + VV_FOLDLEVEL, + VV_PROGNAME, + VV_SEND_SERVER, + VV_DYING, + VV_EXCEPTION, + VV_THROWPOINT, + VV_REG, + VV_CMDBANG, + VV_INSERTMODE, + VV_VAL, + VV_KEY, + VV_PROFILING, + VV_FCS_REASON, + VV_FCS_CHOICE, + VV_BEVAL_BUFNR, + VV_BEVAL_WINNR, + VV_BEVAL_WINID, + VV_BEVAL_LNUM, + VV_BEVAL_COL, + VV_BEVAL_TEXT, + VV_SCROLLSTART, + VV_SWAPNAME, + VV_SWAPCHOICE, + VV_SWAPCOMMAND, + VV_CHAR, + VV_MOUSE_WIN, + VV_MOUSE_WINID, + VV_MOUSE_LNUM, + VV_MOUSE_COL, + VV_OP, + VV_SEARCHFORWARD, + VV_HLSEARCH, + VV_OLDFILES, + VV_WINDOWID, + VV_PROGPATH, + VV_COMPLETED_ITEM, + VV_OPTION_NEW, + VV_OPTION_OLD, + VV_OPTION_TYPE, + VV_ERRORS, + VV_FALSE, + VV_TRUE, + VV_NULL, + VV_NUMBERMAX, + VV_NUMBERMIN, + VV_NUMBERSIZE, + VV_VIM_DID_ENTER, + VV_TESTING, + VV_TYPE_NUMBER, + VV_TYPE_STRING, + VV_TYPE_FUNC, + VV_TYPE_LIST, + VV_TYPE_DICT, + VV_TYPE_FLOAT, + VV_TYPE_BOOL, + VV_TYPE_BLOB, + VV_EVENT, + VV_ECHOSPACE, + VV_ARGV, + VV_COLLATE, + VV_EXITING, + // Neovim + VV_STDERR, + VV_MSGPACK_TYPES, + VV__NULL_STRING, // String with NULL value. For test purposes only. + VV__NULL_LIST, // List with NULL value. For test purposes only. + VV__NULL_DICT, // Dictionary with NULL value. For test purposes only. + VV__NULL_BLOB, // Blob with NULL value. For test purposes only. + VV_LUA, } VimVarIndex; /// All recognized msgpack types @@ -208,7 +208,7 @@ typedef enum { } GetLvalFlags; /// flags for find_name_end() -#define FNE_INCL_BR 1 /* find_name_end(): include [] in name */ +#define FNE_INCL_BR 1 // find_name_end(): include [] in name #define FNE_CHECK_START 2 /* find_name_end(): check name starts with valid character */ diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h index 1b54b3a898..c34ffa1d3b 100644 --- a/src/nvim/ex_cmds.h +++ b/src/nvim/ex_cmds.h @@ -3,11 +3,11 @@ #include <stdbool.h> -#include "nvim/os/time.h" -#include "nvim/pos.h" -#include "nvim/eval/typval.h" #include "nvim/buffer_defs.h" +#include "nvim/eval/typval.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/os/time.h" +#include "nvim/pos.h" // flags for do_ecmd() #define ECMD_HIDE 0x01 // don't free the current buffer @@ -18,10 +18,10 @@ #define ECMD_ADDBUF 0x10 // don't edit, just add to buffer list #define ECMD_ALTBUF 0x20 // like ECMD_ADDBUF and set the alternate file -/* for lnum argument in do_ecmd() */ -#define ECMD_LASTL (linenr_T)0 /* use last position in loaded file */ -#define ECMD_LAST (linenr_T)-1 /* use last position in all files */ -#define ECMD_ONE (linenr_T)1 /* use first line */ +// for lnum argument in do_ecmd() +#define ECMD_LASTL (linenr_T)0 // use last position in loaded file +#define ECMD_LAST (linenr_T)-1 // use last position in all files +#define ECMD_ONE (linenr_T)1 // use first line /// Previous :substitute replacement string definition typedef struct { diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index d64b14c9c5..171f8ed5cd 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -4,8 +4,8 @@ #include <stdbool.h> #include <stdint.h> -#include "nvim/pos.h" // for linenr_T #include "nvim/normal.h" +#include "nvim/pos.h" // for linenr_T #include "nvim/regexp_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -83,10 +83,10 @@ typedef enum { typedef struct exarg exarg_T; -/* behavior for bad character, "++bad=" argument */ -#define BAD_REPLACE '?' /* replace it with '?' (default) */ -#define BAD_KEEP -1 /* leave it */ -#define BAD_DROP -2 /* erase it */ +// behavior for bad character, "++bad=" argument +#define BAD_REPLACE '?' // replace it with '?' (default) +#define BAD_KEEP -1 // leave it +#define BAD_DROP -2 // erase it typedef void (*ex_func_T)(exarg_T *eap); @@ -130,8 +130,8 @@ typedef struct { eslist_T *cs_emsg_silent_list; // saved values of "emsg_silent" int cs_lflags; // loop flags: CSL_ flags } cstack_T; -# define cs_rettv cs_pend.csp_rv -# define cs_exception cs_pend.csp_ex +#define cs_rettv cs_pend.csp_rv +#define cs_exception cs_pend.csp_ex // Flags for the cs_lflags item in cstack_T. enum { @@ -143,10 +143,10 @@ enum { /// Arguments used for Ex commands. struct exarg { - char_u *arg; ///< argument of the command - char_u *nextcmd; ///< next command (NULL if none) - char_u *cmd; ///< the name of the command (except for :make) - char_u **cmdlinep; ///< pointer to pointer of allocated cmdline + char_u *arg; ///< argument of the command + char_u *nextcmd; ///< next command (NULL if none) + char_u *cmd; ///< the name of the command (except for :make) + char_u **cmdlinep; ///< pointer to pointer of allocated cmdline cmdidx_T cmdidx; ///< the index for the command uint32_t argt; ///< flags for the command int skip; ///< don't execute the command, only parse it @@ -156,7 +156,7 @@ struct exarg { linenr_T line2; ///< the second line number or count cmd_addr_T addr_type; ///< type of the count/range int flags; ///< extra flags after count: EXFLAG_ - char_u *do_ecmd_cmd; ///< +command arg to be used in edited file + char_u *do_ecmd_cmd; ///< +command arg to be used in edited file linenr_T do_ecmd_lnum; ///< the line number in an edited file int append; ///< TRUE with ":w >>file" command int usefilter; ///< TRUE with ":w !command" and ":r!command" @@ -170,7 +170,7 @@ struct exarg { int useridx; ///< user command index char_u *errmsg; ///< returned error message LineGetter getline; ///< Function used to get the next line - void *cookie; ///< argument for getline() + void *cookie; ///< argument for getline() cstack_T *cstack; ///< condition stack for ":if" etc. long verbose_save; ///< saved value of p_verbose int save_msg_silent; ///< saved value of msg_silent diff --git a/src/nvim/ex_docmd.h b/src/nvim/ex_docmd.h index 8a78ca0337..7ec4fad277 100644 --- a/src/nvim/ex_docmd.h +++ b/src/nvim/ex_docmd.h @@ -13,7 +13,7 @@ #define DOCMD_KEEPLINE 0x20 // keep typed line for repeating with "." #define DOCMD_PREVIEW 0x40 // during 'inccommand' preview -/* defines for eval_vars() */ +// defines for eval_vars() #define VALID_PATH 1 #define VALID_HEAD 2 diff --git a/src/nvim/ex_eval.h b/src/nvim/ex_eval.h index d8388c9156..d3ba43a469 100644 --- a/src/nvim/ex_eval.h +++ b/src/nvim/ex_eval.h @@ -1,22 +1,22 @@ #ifndef NVIM_EX_EVAL_H #define NVIM_EX_EVAL_H -#include "nvim/pos.h" // for linenr_T #include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/pos.h" // for linenr_T /* There is no CSF_IF, the lack of CSF_WHILE, CSF_FOR and CSF_TRY means ":if" * was used. */ -# define CSF_TRUE 0x0001 /* condition was TRUE */ -# define CSF_ACTIVE 0x0002 /* current state is active */ -# define CSF_ELSE 0x0004 /* ":else" has been passed */ -# define CSF_WHILE 0x0008 /* is a ":while" */ -# define CSF_FOR 0x0010 /* is a ":for" */ +#define CSF_TRUE 0x0001 // condition was TRUE +#define CSF_ACTIVE 0x0002 // current state is active +#define CSF_ELSE 0x0004 // ":else" has been passed +#define CSF_WHILE 0x0008 // is a ":while" +#define CSF_FOR 0x0010 // is a ":for" -# define CSF_TRY 0x0100 /* is a ":try" */ -# define CSF_FINALLY 0x0200 /* ":finally" has been passed */ -# define CSF_THROWN 0x0400 /* exception thrown to this try conditional */ -# define CSF_CAUGHT 0x0800 /* exception caught by this try conditional */ -# define CSF_SILENT 0x1000 /* "emsg_silent" reset by ":try" */ +#define CSF_TRY 0x0100 // is a ":try" +#define CSF_FINALLY 0x0200 // ":finally" has been passed +#define CSF_THROWN 0x0400 // exception thrown to this try conditional +#define CSF_CAUGHT 0x0800 // exception caught by this try conditional +#define CSF_SILENT 0x1000 // "emsg_silent" reset by ":try" /* Note that CSF_ELSE is only used when CSF_TRY and CSF_WHILE are unset * (an ":if"), and CSF_SILENT is only used when CSF_TRY is set. */ @@ -24,14 +24,14 @@ * What's pending for being reactivated at the ":endtry" of this try * conditional: */ -# define CSTP_NONE 0 /* nothing pending in ":finally" clause */ -# define CSTP_ERROR 1 /* an error is pending */ -# define CSTP_INTERRUPT 2 /* an interrupt is pending */ -# define CSTP_THROW 4 /* a throw is pending */ -# define CSTP_BREAK 8 /* ":break" is pending */ -# define CSTP_CONTINUE 16 /* ":continue" is pending */ -# define CSTP_RETURN 24 /* ":return" is pending */ -# define CSTP_FINISH 32 /* ":finish" is pending */ +#define CSTP_NONE 0 // nothing pending in ":finally" clause +#define CSTP_ERROR 1 // an error is pending +#define CSTP_INTERRUPT 2 // an interrupt is pending +#define CSTP_THROW 4 // a throw is pending +#define CSTP_BREAK 8 // ":break" is pending +#define CSTP_CONTINUE 16 // ":continue" is pending +#define CSTP_RETURN 24 // ":return" is pending +#define CSTP_FINISH 32 // ":finish" is pending /* * A list of error messages that can be converted to an exception. "throw_msg" @@ -40,9 +40,9 @@ * message in the list. See cause_errthrow() below. */ struct msglist { - char_u *msg; /* original message */ - char_u *throw_msg; /* msg to throw: usually original one */ - struct msglist *next; /* next of several messages in a row */ + char_u *msg; // original message + char_u *throw_msg; // msg to throw: usually original one + struct msglist *next; // next of several messages in a row }; // The exception types. @@ -60,11 +60,11 @@ typedef enum typedef struct vim_exception except_T; struct vim_exception { except_type_T type; // exception type - char_u *value; // exception value - struct msglist *messages; // message(s) causing error exception - char_u *throw_name; // name of the throw point + char_u *value; // exception value + struct msglist *messages; // message(s) causing error exception + char_u *throw_name; // name of the throw point linenr_T throw_lnum; // line number of the throw point - except_T *caught; // next exception on the caught stack + except_T *caught; // next exception on the caught stack }; /* @@ -74,8 +74,8 @@ struct vim_exception { */ typedef struct cleanup_stuff cleanup_T; struct cleanup_stuff { - int pending; /* error/interrupt/exception state */ - except_T *exception; /* exception value */ + int pending; // error/interrupt/exception state + except_T *exception; // exception value }; #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h index 3727aa5e62..fe2bf958b5 100644 --- a/src/nvim/ex_getln.h +++ b/src/nvim/ex_getln.h @@ -7,7 +7,7 @@ #include "nvim/os/time.h" #include "nvim/regexp_defs.h" -/* Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. */ +// Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. #define WILD_FREE 1 #define WILD_EXPAND_FREE 2 #define WILD_EXPAND_KEEP 3 diff --git a/src/nvim/extmark.h b/src/nvim/extmark.h index 1bc42322a3..aee679a9c7 100644 --- a/src/nvim/extmark.h +++ b/src/nvim/extmark.h @@ -1,10 +1,10 @@ #ifndef NVIM_EXTMARK_H #define NVIM_EXTMARK_H -#include "nvim/pos.h" #include "nvim/buffer_defs.h" #include "nvim/extmark_defs.h" #include "nvim/marktree.h" +#include "nvim/pos.h" EXTERN int extmark_splice_pending INIT(= 0); diff --git a/src/nvim/extmark_defs.h b/src/nvim/extmark_defs.h index 2da4f3dc00..c0a4f4014f 100644 --- a/src/nvim/extmark_defs.h +++ b/src/nvim/extmark_defs.h @@ -1,8 +1,8 @@ #ifndef NVIM_EXTMARK_DEFS_H #define NVIM_EXTMARK_DEFS_H -#include "nvim/types.h" #include "nvim/lib/kvec.h" +#include "nvim/types.h" typedef struct Decoration Decoration; diff --git a/src/nvim/file_search.h b/src/nvim/file_search.h index b128029123..4d4e723922 100644 --- a/src/nvim/file_search.h +++ b/src/nvim/file_search.h @@ -1,15 +1,15 @@ #ifndef NVIM_FILE_SEARCH_H #define NVIM_FILE_SEARCH_H -#include <stdlib.h> // for size_t +#include <stdlib.h> // for size_t -#include "nvim/types.h" // for char_u -#include "nvim/globals.h" // for CdScope +#include "nvim/globals.h" // for CdScope +#include "nvim/types.h" // for char_u -/* Flags for find_file_*() functions. */ -#define FINDFILE_FILE 0 /* only files */ -#define FINDFILE_DIR 1 /* only directories */ -#define FINDFILE_BOTH 2 /* files and directories */ +// Flags for find_file_*() functions. +#define FINDFILE_FILE 0 // only files +#define FINDFILE_DIR 1 // only directories +#define FINDFILE_BOTH 2 // files and directories #ifdef INCLUDE_GENERATED_DECLARATIONS # include "file_search.h.generated.h" diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h index 71149bdcc1..9bfec44ef3 100644 --- a/src/nvim/fileio.h +++ b/src/nvim/fileio.h @@ -1,9 +1,9 @@ #ifndef NVIM_FILEIO_H #define NVIM_FILEIO_H +#include "nvim/autocmd.h" #include "nvim/buffer_defs.h" #include "nvim/os/os.h" -#include "nvim/autocmd.h" // Values for readfile() flags #define READ_NEW 0x01 // read a file into a new buffer diff --git a/src/nvim/fold.h b/src/nvim/fold.h index 37fab4da60..a96ea8a039 100644 --- a/src/nvim/fold.h +++ b/src/nvim/fold.h @@ -3,17 +3,17 @@ #include <stdio.h> -#include "nvim/pos.h" +#include "nvim/buffer_defs.h" #include "nvim/garray.h" +#include "nvim/pos.h" #include "nvim/types.h" -#include "nvim/buffer_defs.h" /* * Info used to pass info about a fold from the fold-detection code to the * code that displays the foldcolumn. */ typedef struct foldinfo { - linenr_T fi_lnum; /* line number where fold starts */ + linenr_T fi_lnum; // line number where fold starts int fi_level; /* level of the fold; when this is zero the other fields are invalid */ int fi_low_level; /* lowest fold level that starts in the same diff --git a/src/nvim/func_attr.h b/src/nvim/func_attr.h index e0b0610646..afbd87f2be 100644 --- a/src/nvim/func_attr.h +++ b/src/nvim/func_attr.h @@ -1,24 +1,24 @@ -// If DEFINE_FUNC_ATTRIBUTES macro is not defined then all function attributes +// If DEFINE_FUNC_ATTRIBUTES macro is not defined then all function attributes // are defined as empty values. // -// If DO_NOT_DEFINE_EMPTY_ATTRIBUTES then empty macros are not defined. Thus -// undefined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES -// leaves file with untouched FUNC_ATTR_* macros. This variant is used for +// If DO_NOT_DEFINE_EMPTY_ATTRIBUTES then empty macros are not defined. Thus +// undefined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES +// leaves file with untouched FUNC_ATTR_* macros. This variant is used for // scripts/gendeclarations.lua. // -// Empty macros are used for *.c files. (undefined DEFINE_FUNC_ATTRIBUTES and +// Empty macros are used for *.c files. (undefined DEFINE_FUNC_ATTRIBUTES and // undefined DO_NOT_DEFINE_EMPTY_ATTRIBUTES) // -// Macros defined as __attribute__((*)) are used by generated header files. -// (defined DEFINE_FUNC_ATTRIBUTES and undefined +// Macros defined as __attribute__((*)) are used by generated header files. +// (defined DEFINE_FUNC_ATTRIBUTES and undefined // DO_NOT_DEFINE_EMPTY_ATTRIBUTES) // -// Defined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES is +// Defined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES is // not used by anything. -// FUNC_ATTR_* macros should be in *.c files for declarations generator. If you -// define a function for which declaration is not generated by -// gendeclarations.lua (e.g. template hash implementation) then you should use +// FUNC_ATTR_* macros should be in *.c files for declarations generator. If you +// define a function for which declaration is not generated by +// gendeclarations.lua (e.g. template hash implementation) then you should use // REAL_FATTR_* macros. // gcc and clang expose their version as follows: @@ -134,10 +134,10 @@ # if NVIM_HAS_ATTRIBUTE(no_sanitize_undefined) # define REAL_FATTR_NO_SANITIZE_UNDEFINED \ - __attribute__((no_sanitize_undefined)) + __attribute__((no_sanitize_undefined)) # elif NVIM_HAS_ATTRIBUTE(no_sanitize) # define REAL_FATTR_NO_SANITIZE_UNDEFINED \ - __attribute__((no_sanitize("undefined"))) + __attribute__((no_sanitize("undefined"))) # endif # endif diff --git a/src/nvim/garray.h b/src/nvim/garray.h index e2cbdd4eab..56bd5c9130 100644 --- a/src/nvim/garray.h +++ b/src/nvim/garray.h @@ -3,8 +3,8 @@ #include <stddef.h> // for size_t -#include "nvim/types.h" // for char_u #include "nvim/log.h" +#include "nvim/types.h" // for char_u /// Structure used for growing arrays. /// This is used to store information that only grows, is deleted all at @@ -68,6 +68,6 @@ static inline void *ga_append_via_ptr(garray_T *gap, size_t item_size) /// garray. /// /// @param gap the garray to be freed -#define GA_DEEP_CLEAR_PTR(gap) GA_DEEP_CLEAR(gap, void*, FREE_PTR_PTR) +#define GA_DEEP_CLEAR_PTR(gap) GA_DEEP_CLEAR(gap, void *, FREE_PTR_PTR) #endif // NVIM_GARRAY_H diff --git a/src/nvim/getchar.h b/src/nvim/getchar.h index 83fa00977f..4e9dd2eab7 100644 --- a/src/nvim/getchar.h +++ b/src/nvim/getchar.h @@ -1,10 +1,10 @@ #ifndef NVIM_GETCHAR_H #define NVIM_GETCHAR_H -#include "nvim/os/fileio.h" -#include "nvim/types.h" #include "nvim/buffer_defs.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/os/fileio.h" +#include "nvim/types.h" #include "nvim/vim.h" /// Values for "noremap" argument of ins_typebuf() diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 4d54907a75..182e88083a 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -1,23 +1,23 @@ #ifndef NVIM_GLOBALS_H #define NVIM_GLOBALS_H -#include <stdbool.h> #include <inttypes.h> +#include <stdbool.h> -#include "nvim/macros.h" +#include "nvim/event/loop.h" #include "nvim/ex_eval.h" #include "nvim/iconv.h" +#include "nvim/macros.h" #include "nvim/mbyte.h" #include "nvim/menu.h" +#include "nvim/os/os_defs.h" #include "nvim/syntax_defs.h" #include "nvim/types.h" -#include "nvim/event/loop.h" -#include "nvim/os/os_defs.h" #define IOSIZE (1024+1) // file I/O and sprintf buffer size -# define MSG_BUF_LEN 480 // length of buffer for small messages -# define MSG_BUF_CLEN (MSG_BUF_LEN / 6) // cell length (worst case: utf-8 +#define MSG_BUF_LEN 480 // length of buffer for small messages +#define MSG_BUF_CLEN (MSG_BUF_LEN / 6) // cell length (worst case: utf-8 // takes 6 bytes for one cell) #ifdef WIN32 @@ -169,16 +169,16 @@ EXTERN bool compl_busy INIT(= false); // List of flags for method of completion. EXTERN int compl_cont_status INIT(= 0); -# define CONT_ADDING 1 // "normal" or "adding" expansion -# define CONT_INTRPT (2 + 4) // a ^X interrupted the current expansion - // it's set only iff N_ADDS is set -# define CONT_N_ADDS 4 // next ^X<> will add-new or expand-current -# define CONT_S_IPOS 8 // next ^X<> will set initial_pos? - // if so, word-wise-expansion will set SOL -# define CONT_SOL 16 // pattern includes start of line, just for - // word-wise expansion, not set for ^X^L -# define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local - // expansion, (eg use complete=.) +#define CONT_ADDING 1 // "normal" or "adding" expansion +#define CONT_INTRPT (2 + 4) // a ^X interrupted the current expansion + // it's set only iff N_ADDS is set +#define CONT_N_ADDS 4 // next ^X<> will add-new or expand-current +#define CONT_S_IPOS 8 // next ^X<> will set initial_pos? + // if so, word-wise-expansion will set SOL +#define CONT_SOL 16 // pattern includes start of line, just for + // word-wise expansion, not set for ^X^L +#define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local + // expansion, (eg use complete=.) EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode @@ -405,7 +405,7 @@ EXTERN int mouse_dragging INIT(= 0); // extending Visual area with // mouse dragging // The root of the menu hierarchy. -EXTERN vimmenu_T *root_menu INIT(= NULL); +EXTERN vimmenu_T *root_menu INIT(= NULL); // While defining the system menu, sys_menu is true. This avoids // overruling of menus that the user already defined. EXTERN int sys_menu INIT(= false); @@ -417,48 +417,48 @@ EXTERN int updating_screen INIT(= 0); // All windows are linked in a list. firstwin points to the first entry, // lastwin to the last entry (can be the same as firstwin) and curwin to the // currently active window. -EXTERN win_T *firstwin; // first window -EXTERN win_T *lastwin; // last window -EXTERN win_T *prevwin INIT(= NULL); // previous window -# define ONE_WINDOW (firstwin == lastwin) -# define FOR_ALL_FRAMES(frp, first_frame) \ +EXTERN win_T *firstwin; // first window +EXTERN win_T *lastwin; // last window +EXTERN win_T *prevwin INIT(= NULL); // previous window +#define ONE_WINDOW (firstwin == lastwin) +#define FOR_ALL_FRAMES(frp, first_frame) \ for (frp = first_frame; frp != NULL; frp = frp->fr_next) // NOLINT // When using this macro "break" only breaks out of the inner loop. Use "goto" // to break out of the tabpage loop. -# define FOR_ALL_TAB_WINDOWS(tp, wp) \ +#define FOR_ALL_TAB_WINDOWS(tp, wp) \ FOR_ALL_TABS(tp) \ - FOR_ALL_WINDOWS_IN_TAB(wp, tp) + FOR_ALL_WINDOWS_IN_TAB(wp, tp) // -V:FOR_ALL_WINDOWS_IN_TAB:501 -# define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \ +#define FOR_ALL_WINDOWS_IN_TAB(wp, tp) \ for (win_T *wp = ((tp) == curtab) \ ? firstwin : (tp)->tp_firstwin; wp != NULL; wp = wp->w_next) -EXTERN win_T *curwin; // currently active window +EXTERN win_T *curwin; // currently active window -EXTERN win_T *aucmd_win; // window used in aucmd_prepbuf() +EXTERN win_T *aucmd_win; // window used in aucmd_prepbuf() EXTERN int aucmd_win_used INIT(= false); // aucmd_win is being used // The window layout is kept in a tree of frames. topframe points to the top // of the tree. -EXTERN frame_T *topframe; // top of the window frame tree +EXTERN frame_T *topframe; // top of the window frame tree // Tab pages are alternative topframes. "first_tabpage" points to the first // one in the list, "curtab" is the current one. -EXTERN tabpage_T *first_tabpage; -EXTERN tabpage_T *lastused_tabpage; -EXTERN tabpage_T *curtab; +EXTERN tabpage_T *first_tabpage; +EXTERN tabpage_T *lastused_tabpage; +EXTERN tabpage_T *curtab; EXTERN bool redraw_tabline INIT(= false); // need to redraw tabline // Iterates over all tabs in the tab list -# define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) +#define FOR_ALL_TABS(tp) for (tabpage_T *tp = first_tabpage; tp != NULL; tp = tp->tp_next) // All buffers are linked in a list. 'firstbuf' points to the first entry, // 'lastbuf' to the last entry and 'curbuf' to the currently active buffer. EXTERN buf_T *firstbuf INIT(= NULL); // first buffer -EXTERN buf_T *lastbuf INIT(= NULL); // last buffer -EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer +EXTERN buf_T *lastbuf INIT(= NULL); // last buffer +EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer // Iterates over all buffers in the buffer list. #define FOR_ALL_BUFFERS(buf) \ @@ -593,16 +593,16 @@ EXTERN int inhibit_delete_count INIT(= 0); // These flags are set based upon 'fileencoding'. // The characters are internally stored as UTF-8 // to avoid trouble with NUL bytes. -# define DBCS_JPN 932 // japan -# define DBCS_JPNU 9932 // euc-jp -# define DBCS_KOR 949 // korea -# define DBCS_KORU 9949 // euc-kr -# define DBCS_CHS 936 // chinese -# define DBCS_CHSU 9936 // euc-cn -# define DBCS_CHT 950 // taiwan -# define DBCS_CHTU 9950 // euc-tw -# define DBCS_2BYTE 1 // 2byte- -# define DBCS_DEBUG -1 +#define DBCS_JPN 932 // japan +#define DBCS_JPNU 9932 // euc-jp +#define DBCS_KOR 949 // korea +#define DBCS_KORU 9949 // euc-kr +#define DBCS_CHS 936 // chinese +#define DBCS_CHSU 9936 // euc-cn +#define DBCS_CHT 950 // taiwan +#define DBCS_CHTU 9950 // euc-tw +#define DBCS_2BYTE 1 // 2byte- +#define DBCS_DEBUG -1 /// Encoding used when 'fencs' is set to "default" EXTERN char_u *fenc_default INIT(= NULL); @@ -672,9 +672,9 @@ EXTERN char_u NameBuff[MAXPATHL]; ///< Buffer for expanding file names EXTERN char_u msg_buf[MSG_BUF_LEN]; ///< Small buffer for messages EXTERN char os_buf[ ///< Buffer for the os/ layer #if MAXPATHL > IOSIZE -MAXPATHL + MAXPATHL #else -IOSIZE + IOSIZE #endif ]; @@ -746,7 +746,7 @@ EXTERN bool g_tag_at_cursor INIT(= false); // whether the tag command comes EXTERN int replace_offset INIT(= 0); // offset for replace_push() -EXTERN char_u *escape_chars INIT(= (char_u *)" \t\\\"|"); +EXTERN char_u *escape_chars INIT(= (char_u *)" \t\\\"|"); // need backslash in cmd line EXTERN int keep_help_flag INIT(= false); // doing :ta from help file @@ -754,7 +754,7 @@ EXTERN int keep_help_flag INIT(= false); // doing :ta from help file // When a string option is NULL (which only happens in out-of-memory // situations), it is set to empty_option, to avoid having to check for NULL // everywhere. -EXTERN char_u *empty_option INIT(= (char_u *)""); +EXTERN char_u *empty_option INIT(= (char_u *)""); EXTERN bool redir_off INIT(= false); // no redirection for a moment EXTERN FILE *redir_fd INIT(= NULL); // message redirection file @@ -787,7 +787,7 @@ extern char_u *compiled_sys; // When a window has a local directory, the absolute path of the global // current directory is stored here (in allocated memory). If the current // directory is not a local directory, globaldir is NULL. -EXTERN char_u *globaldir INIT(= NULL); +EXTERN char_u *globaldir INIT(= NULL); // Whether 'keymodel' contains "stopsel" and "startsel". EXTERN bool km_stopsel INIT(= false); @@ -810,8 +810,8 @@ EXTERN linenr_T sub_nlines; // total number of lines changed EXTERN char_u wim_flags[4]; // whether titlestring and iconstring contains statusline syntax -# define STL_IN_ICON 1 -# define STL_IN_TITLE 2 +#define STL_IN_ICON 1 +#define STL_IN_TITLE 2 EXTERN int stl_syntax INIT(= 0); // don't use 'hlsearch' temporarily @@ -846,15 +846,16 @@ EXTERN linenr_T spell_redraw_lnum INIT(= 0); // The error messages that can be shared are included here. // Excluded are errors that are only used once and debugging messages. EXTERN char_u e_abort[] INIT(= N_("E470: Command aborted")); -EXTERN char_u e_afterinit[] INIT(= N_( - "E905: Cannot set this option after startup")); +EXTERN char_u e_afterinit[] INIT(= N_("E905: Cannot set this option after startup")); EXTERN char_u e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job")); EXTERN char_u e_argreq[] INIT(= N_("E471: Argument required")); EXTERN char_u e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &")); -EXTERN char_u e_cmdwin[] INIT(= N_( - "E11: Invalid in command-line window; <CR> executes, CTRL-C quits")); -EXTERN char_u e_curdir[] INIT(= N_( - "E12: Command not allowed from exrc/vimrc in current dir or tag search")); +EXTERN char_u e_cmdwin[] INIT(= + N_( + "E11: Invalid in command-line window; <CR> executes, CTRL-C quits")); +EXTERN char_u e_curdir[] INIT(= + N_( + "E12: Command not allowed from exrc/vimrc in current dir or tag search")); EXTERN char_u e_endif[] INIT(= N_("E171: Missing :endif")); EXTERN char_u e_endtry[] INIT(= N_("E600: Missing :endtry")); EXTERN char_u e_endwhile[] INIT(= N_("E170: Missing :endwhile")); @@ -869,8 +870,7 @@ EXTERN char_u e_interr[] INIT(= N_("Interrupted")); EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument")); EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s")); EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s")); -EXTERN char_u e_invargNval[] INIT(= N_( - "E475: Invalid value for argument %s: %s")); +EXTERN char_u e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s")); EXTERN char_u e_duparg2[] INIT(= N_("E983: Duplicate argument: %s")); EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s")); EXTERN char_u e_invrange[] INIT(= N_("E16: Invalid range")); @@ -880,24 +880,21 @@ EXTERN char_u e_no_spell[] INIT(= N_("E756: Spell checking is not possible")); EXTERN char_u e_invchan[] INIT(= N_("E900: Invalid channel id")); EXTERN char_u e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job")); EXTERN char_u e_jobtblfull[] INIT(= N_("E901: Job table is full")); -EXTERN char_u e_jobspawn[] INIT(= N_( - "E903: Process failed to start: %s: \"%s\"")); +EXTERN char_u e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\"")); EXTERN char_u e_channotpty[] INIT(= N_("E904: channel is not a pty")); -EXTERN char_u e_stdiochan2[] INIT(= N_( - "E905: Couldn't open stdio channel: %s")); +EXTERN char_u e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s")); EXTERN char_u e_invstream[] INIT(= N_("E906: invalid stream for channel")); -EXTERN char_u e_invstreamrpc[] INIT(= N_( - "E906: invalid stream for rpc channel, use 'rpc'")); -EXTERN char_u e_streamkey[] INIT(= N_( - "E5210: dict key '%s' already set for buffered stream in channel %" - PRIu64)); +EXTERN char_u e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'")); +EXTERN char_u e_streamkey[] INIT(= + N_( + "E5210: dict key '%s' already set for buffered stream in channel %" + PRIu64)); EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"")); EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed: %s")); EXTERN char_u e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s")); EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number")); EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set")); -EXTERN char_u e_modifiable[] INIT(= N_( - "E21: Cannot make changes, 'modifiable' is off")); +EXTERN char_u e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off")); EXTERN char_u e_nesting[] INIT(= N_("E22: Scripts nested too deep")); EXTERN char_u e_noalt[] INIT(= N_("E23: No alternate file")); EXTERN char_u e_noabbr[] INIT(= N_("E24: No such abbreviation")); @@ -909,8 +906,7 @@ EXTERN char_u e_nomap[] INIT(= N_("E31: No such mapping")); EXTERN char_u e_nomatch[] INIT(= N_("E479: No match")); EXTERN char_u e_nomatch2[] INIT(= N_("E480: No match: %s")); EXTERN char_u e_noname[] INIT(= N_("E32: No file name")); -EXTERN char_u e_nopresub[] INIT(= N_( - "E33: No previous substitute regular expression")); +EXTERN char_u e_nopresub[] INIT(= N_("E33: No previous substitute regular expression")); EXTERN char_u e_noprev[] INIT(= N_("E34: No previous command")); EXTERN char_u e_noprevre[] INIT(= N_("E35: No previous regular expression")); EXTERN char_u e_norange[] INIT(= N_("E481: No range allowed")); @@ -926,36 +922,30 @@ EXTERN char_u e_outofmem[] INIT(= N_("E41: Out of memory!")); EXTERN char_u e_patnotf[] INIT(= N_("Pattern not found")); EXTERN char_u e_patnotf2[] INIT(= N_("E486: Pattern not found: %s")); EXTERN char_u e_positive[] INIT(= N_("E487: Argument must be positive")); -EXTERN char_u e_prev_dir[] INIT(= N_( - "E459: Cannot go back to previous directory")); +EXTERN char_u e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory")); EXTERN char_u e_quickfix[] INIT(= N_("E42: No Errors")); EXTERN char_u e_loclist[] INIT(= N_("E776: No location list")); EXTERN char_u e_re_damg[] INIT(= N_("E43: Damaged match string")); EXTERN char_u e_re_corr[] INIT(= N_("E44: Corrupted regexp program")); -EXTERN char_u e_readonly[] INIT(= N_( - "E45: 'readonly' option is set (add ! to override)")); -EXTERN char_u e_readonlyvar[] INIT(= N_( - "E46: Cannot change read-only variable \"%.*s\"")); +EXTERN char_u e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)")); +EXTERN char_u e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\"")); EXTERN char_u e_stringreq[] INIT(= N_("E928: String required")); EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required")); EXTERN char_u e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64)); EXTERN char_u e_invalblob[] INIT(= N_("E978: Invalid operation for Blob")); -EXTERN char_u e_toomanyarg[] INIT(= N_( - "E118: Too many arguments for function: %s")); -EXTERN char_u e_dictkey[] INIT(= N_( - "E716: Key not present in Dictionary: \"%s\"")); +EXTERN char_u e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); +EXTERN char_u e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\"")); EXTERN char_u e_listreq[] INIT(= N_("E714: List required")); EXTERN char_u e_listblobreq[] INIT(= N_("E897: List or Blob required")); -EXTERN char_u e_listdictarg[] INIT(= N_( - "E712: Argument of %s must be a List or Dictionary")); -EXTERN char_u e_listdictblobarg[] INIT(= N_( - "E896: Argument of %s must be a List, Dictionary or Blob")); +EXTERN char_u e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary")); +EXTERN char_u e_listdictblobarg[] INIT(= + N_( + "E896: Argument of %s must be a List, Dictionary or Blob")); EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox")); EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here")); -EXTERN char_u e_screenmode[] INIT(= N_( - "E359: Screen mode setting not supported")); +EXTERN char_u e_screenmode[] INIT(= N_("E359: Screen mode setting not supported")); EXTERN char_u e_scroll[] INIT(= N_("E49: Invalid scroll size")); EXTERN char_u e_shellempty[] INIT(= N_("E91: 'shell' option is empty")); EXTERN char_u e_signdata[] INIT(= N_("E255: Couldn't read in sign data!")); @@ -969,57 +959,45 @@ EXTERN char_u e_trailing[] INIT(= N_("E488: Trailing characters")); EXTERN char_u e_trailing2[] INIT(= N_("E488: Trailing characters: %s")); EXTERN char_u e_umark[] INIT(= N_("E78: Unknown mark")); EXTERN char_u e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards")); -EXTERN char_u e_winheight[] INIT(= N_( - "E591: 'winheight' cannot be smaller than 'winminheight'")); -EXTERN char_u e_winwidth[] INIT(= N_( - "E592: 'winwidth' cannot be smaller than 'winminwidth'")); +EXTERN char_u e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'")); +EXTERN char_u e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'")); EXTERN char_u e_write[] INIT(= N_("E80: Error while writing")); EXTERN char_u e_zerocount[] INIT(= N_("E939: Positive count required")); -EXTERN char_u e_usingsid[] INIT(= N_( - "E81: Using <SID> not in a script context")); +EXTERN char_u e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context")); EXTERN char_u e_missingparen[] INIT(= N_("E107: Missing parentheses: %s")); -EXTERN char_u e_maxmempat[] INIT(= N_( - "E363: pattern uses more memory than 'maxmempattern'")); +EXTERN char_u e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'")); EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer")); EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist")); -EXTERN char_u e_invalpat[] INIT(= N_( - "E682: Invalid search pattern or delimiter")); +EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter")); EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer")); EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set")); EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); -EXTERN char_u e_dirnotf[] INIT(= N_( - "E919: Directory not found in '%s': \"%s\"")); -EXTERN char_u e_au_recursive[] INIT(= N_( - "E952: Autocommand caused recursive behavior")); -EXTERN char_u e_autocmd_close[] INIT(= N_( - "E813: Cannot close autocmd window")); +EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); +EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); +EXTERN char_u e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window")); EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported")); EXTERN char_u e_fnametoolong[] INIT(= N_("E856: Filename too long")); EXTERN char_u e_float_as_string[] INIT(= N_("E806: using Float as a String")); -EXTERN char_u e_autocmd_err[] INIT(=N_( - "E5500: autocmd has thrown an exception: %s")); -EXTERN char_u e_cmdmap_err[] INIT(=N_( - "E5520: <Cmd> mapping must end with <CR>")); -EXTERN char_u e_cmdmap_repeated[] INIT(=N_( - "E5521: <Cmd> mapping must end with <CR> before second <Cmd>")); -EXTERN char_u e_cmdmap_key[] INIT(=N_( - "E5522: <Cmd> mapping must not include %s key")); +EXTERN char_u e_autocmd_err[] INIT(=N_("E5500: autocmd has thrown an exception: %s")); +EXTERN char_u e_cmdmap_err[] INIT(=N_("E5520: <Cmd> mapping must end with <CR>")); +EXTERN char_u e_cmdmap_repeated[] INIT(= + N_( + "E5521: <Cmd> mapping must end with <CR> before second <Cmd>")); +EXTERN char_u e_cmdmap_key[] INIT(=N_("E5522: <Cmd> mapping must not include %s key")); -EXTERN char_u e_api_error[] INIT(=N_( - "E5555: API call: %s")); +EXTERN char_u e_api_error[] INIT(=N_("E5555: API call: %s")); -EXTERN char e_luv_api_disabled[] INIT(=N_( - "E5560: %s must not be called in a lua loop callback")); +EXTERN char e_luv_api_disabled[] INIT(=N_("E5560: %s must not be called in a lua loop callback")); EXTERN char_u e_floatonly[] INIT(=N_( - "E5601: Cannot close window, only floating window would remain")); -EXTERN char_u e_floatexchange[] INIT(=N_( - "E5602: Cannot exchange or rotate float")); + "E5601: Cannot close window, only floating window would remain")); +EXTERN char_u e_floatexchange[] INIT(=N_("E5602: Cannot exchange or rotate float")); -EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= N_( - "E1155: Cannot define autocommands for ALL events")); +EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= + N_( + "E1155: Cannot define autocommands for ALL events")); EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM")); EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP")); diff --git a/src/nvim/grid_defs.h b/src/nvim/grid_defs.h index dee096214f..bf0a5d63a8 100644 --- a/src/nvim/grid_defs.h +++ b/src/nvim/grid_defs.h @@ -48,10 +48,10 @@ typedef struct ScreenGrid ScreenGrid; struct ScreenGrid { handle_T handle; - schar_T *chars; - sattr_T *attrs; + schar_T *chars; + sattr_T *attrs; unsigned *line_offset; - char_u *line_wraps; + char_u *line_wraps; // last column that was drawn (not cleared with the default background). // only used when "throttled" is set. Not allocated by grid_alloc! diff --git a/src/nvim/hardcopy.h b/src/nvim/hardcopy.h index c6a3321b08..eba769d342 100644 --- a/src/nvim/hardcopy.h +++ b/src/nvim/hardcopy.h @@ -4,9 +4,9 @@ #include <stdint.h> #include <stdlib.h> // for size_t +#include "nvim/ex_cmds_defs.h" // for exarg_T #include "nvim/globals.h" // for TriState #include "nvim/types.h" // for char_u -#include "nvim/ex_cmds_defs.h" // for exarg_T /* * Structure to hold printing color and font attributes. @@ -34,19 +34,19 @@ typedef struct { int modec; int do_syntax; int user_abort; - char_u *jobname; - char_u *outfile; - char_u *arguments; + char_u *jobname; + char_u *outfile; + char_u *arguments; } prt_settings_T; /* * Generic option table item, only used for printer at the moment. */ typedef struct { - const char *name; + const char *name; int hasnum; int number; - char_u *string; /* points into option string */ + char_u *string; // points into option string int strlen; int present; } option_table_T; @@ -67,13 +67,13 @@ typedef struct { #define OPT_PRINT_FORMFEED 13 #define OPT_PRINT_NUM_OPTIONS 14 -/* For prt_get_unit(). */ +// For prt_get_unit(). #define PRT_UNIT_NONE -1 #define PRT_UNIT_PERC 0 #define PRT_UNIT_INCH 1 #define PRT_UNIT_MM 2 #define PRT_UNIT_POINT 3 -#define PRT_UNIT_NAMES {"pc", "in", "mm", "pt"} +#define PRT_UNIT_NAMES { "pc", "in", "mm", "pt" } #define PRINT_NUMBER_WIDTH 8 diff --git a/src/nvim/hashtab.h b/src/nvim/hashtab.h index c82a6cc121..7740a3e431 100644 --- a/src/nvim/hashtab.h +++ b/src/nvim/hashtab.h @@ -77,18 +77,18 @@ typedef struct hashtable_S { /// @param hi Name of the variable with current hashtab entry. /// @param code Cycle body. #define HASHTAB_ITER(ht, hi, code) \ - do { \ - hashtab_T *const hi##ht_ = (ht); \ - size_t hi##todo_ = hi##ht_->ht_used; \ - for (hashitem_T *hi = hi##ht_->ht_array; hi##todo_; hi++) { \ - if (!HASHITEM_EMPTY(hi)) { \ - hi##todo_--; \ - { \ - code \ - } \ + do { \ + hashtab_T *const hi##ht_ = (ht); \ + size_t hi##todo_ = hi##ht_->ht_used; \ + for (hashitem_T *hi = hi##ht_->ht_array; hi##todo_; hi++) { \ + if (!HASHITEM_EMPTY(hi)) { \ + hi##todo_--; \ + { \ + code \ } \ } \ - } while (0) + } \ + } while (0) #ifdef INCLUDE_GENERATED_DECLARATIONS # include "hashtab.h.generated.h" diff --git a/src/nvim/highlight.h b/src/nvim/highlight.h index a237ddbc34..ae63f83d65 100644 --- a/src/nvim/highlight.h +++ b/src/nvim/highlight.h @@ -2,15 +2,16 @@ #define NVIM_HIGHLIGHT_H #include <stdbool.h> -#include "nvim/highlight_defs.h" + #include "nvim/api/private/defs.h" +#include "nvim/highlight_defs.h" #include "nvim/ui.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "highlight.h.generated.h" #endif -# define HL_SET_DEFAULT_COLORS(rgb_fg, rgb_bg, rgb_sp) \ +#define HL_SET_DEFAULT_COLORS(rgb_fg, rgb_bg, rgb_sp) \ do { \ bool dark_ = (*p_bg == 'd'); \ rgb_fg = rgb_fg != -1 ? rgb_fg : (dark_ ? 0xFFFFFF : 0x000000); \ diff --git a/src/nvim/iconv.h b/src/nvim/iconv.h index a7c9ad4040..509f83c415 100644 --- a/src/nvim/iconv.h +++ b/src/nvim/iconv.h @@ -4,17 +4,17 @@ #include "auto/config.h" #ifdef HAVE_ICONV -# include <errno.h> -# include <iconv.h> +# include <errno.h> +# include <iconv.h> // define some missing constants if necessary -# ifndef EILSEQ -# define EILSEQ 123 -# endif -# define ICONV_ERRNO errno -# define ICONV_E2BIG E2BIG -# define ICONV_EINVAL EINVAL -# define ICONV_EILSEQ EILSEQ +# ifndef EILSEQ +# define EILSEQ 123 +# endif +# define ICONV_ERRNO errno +# define ICONV_E2BIG E2BIG +# define ICONV_EINVAL EINVAL +# define ICONV_EILSEQ EILSEQ #endif #endif // NVIM_ICONV_H diff --git a/src/nvim/if_cscope.h b/src/nvim/if_cscope.h index e20462576a..8dbc78943f 100644 --- a/src/nvim/if_cscope.h +++ b/src/nvim/if_cscope.h @@ -1,8 +1,8 @@ #ifndef NVIM_IF_CSCOPE_H #define NVIM_IF_CSCOPE_H -#include "nvim/types.h" // for char_u and expand_T -#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/types.h" // for char_u and expand_T #ifdef INCLUDE_GENERATED_DECLARATIONS # include "if_cscope.h.generated.h" diff --git a/src/nvim/if_cscope_defs.h b/src/nvim/if_cscope_defs.h index d2d8b0fb62..39cfd807f9 100644 --- a/src/nvim/if_cscope_defs.h +++ b/src/nvim/if_cscope_defs.h @@ -13,9 +13,9 @@ # include <sys/types.h> // pid_t #endif -#include "nvim/os/os_defs.h" -#include "nvim/os/fs_defs.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/os/fs_defs.h" +#include "nvim/os/os_defs.h" #define CSCOPE_SUCCESS 0 #define CSCOPE_FAILURE -1 @@ -40,11 +40,11 @@ typedef struct csi { #if defined(UNIX) pid_t pid; // PID of the connected cscope process #else - DWORD pid; // PID of the connected cscope process - HANDLE hProc; // cscope process handle - DWORD nVolume; // Volume serial number, instead of st_dev - DWORD nIndexHigh; // st_ino has no meaning on Windows - DWORD nIndexLow; + DWORD pid; // PID of the connected cscope process + HANDLE hProc; // cscope process handle + DWORD nVolume; // Volume serial number, instead of st_dev + DWORD nIndexHigh; // st_ino has no meaning on Windows + DWORD nIndexLow; #endif FileID file_id; diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 25c27743f3..3e3e07e9d6 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1,6 +1,8 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com +// uncrustify:off + #include <assert.h> #include <inttypes.h> diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h index 9fc44f6f84..f2de341976 100644 --- a/src/nvim/keymap.h +++ b/src/nvim/keymap.h @@ -41,31 +41,31 @@ /* * NUL cannot be in the input string, therefore it is replaced by - * K_SPECIAL KS_ZERO KE_FILLER + * K_SPECIAL KS_ZERO KE_FILLER */ #define KS_ZERO 255 /* * K_SPECIAL cannot be in the input string, therefore it is replaced by - * K_SPECIAL KS_SPECIAL KE_FILLER + * K_SPECIAL KS_SPECIAL KE_FILLER */ #define KS_SPECIAL 254 /* * KS_EXTRA is used for keys that have no termcap name - * K_SPECIAL KS_EXTRA KE_xxx + * K_SPECIAL KS_EXTRA KE_xxx */ #define KS_EXTRA 253 /* * KS_MODIFIER is used when a modifier is given for a (special) key - * K_SPECIAL KS_MODIFIER bitmask + * K_SPECIAL KS_MODIFIER bitmask */ #define KS_MODIFIER 252 /* * These are used for the GUI - * K_SPECIAL KS_xxx KE_FILLER + * K_SPECIAL KS_xxx KE_FILLER */ #define KS_MOUSE 251 #define KS_MENU 250 @@ -170,8 +170,8 @@ enum key_extra { , KE_MOUSE = 43 // mouse event start - // Symbols for pseudo keys which are translated from the real key symbols - // above. + // Symbols for pseudo keys which are translated from the real key symbols + // above. , KE_LEFTMOUSE = 44 // Left mouse button click , KE_LEFTDRAG = 45 // Drag with left mouse button down , KE_LEFTRELEASE = 46 // Left mouse button release @@ -187,7 +187,7 @@ enum key_extra { , KE_TAB = 54 // unshifted TAB key , KE_S_TAB_OLD = 55 // shifted TAB key (no longer used) - // , KE_SNIFF_UNUSED = 56 // obsolete + // , KE_SNIFF_UNUSED = 56 // obsolete , KE_XF1 = 57 // extra vt100 function keys for xterm , KE_XF2 = 58 , KE_XF3 = 59 @@ -209,9 +209,9 @@ enum key_extra { , KE_S_XF3 = 73 , KE_S_XF4 = 74 - // NOTE: The scroll wheel events are inverted: i.e. UP is the same as - // moving the actual scroll wheel down, LEFT is the same as moving the - // scroll wheel right. + // NOTE: The scroll wheel events are inverted: i.e. UP is the same as + // moving the actual scroll wheel down, LEFT is the same as moving the + // scroll wheel right. , KE_MOUSEDOWN = 75 // scroll wheel pseudo-button Down , KE_MOUSEUP = 76 // scroll wheel pseudo-button Up , KE_MOUSELEFT = 77 // scroll wheel pseudo-button Left @@ -238,12 +238,12 @@ enum key_extra { , KE_X2RELEASE = 94 , KE_DROP = 95 // DnD data is available - // , KE_CURSORHOLD = 96 // CursorHold event + // , KE_CURSORHOLD = 96 // CursorHold event , KE_NOP = 97 // no-op: does nothing - // , KE_FOCUSGAINED = 98 // focus gained - // , KE_FOCUSLOST = 99 // focus lost + // , KE_FOCUSGAINED = 98 // focus gained + // , KE_FOCUSLOST = 99 // focus lost , KE_MOUSEMOVE = 100 // mouse moved with no button down - // , KE_CANCEL = 101 // return from vgetc + // , KE_CANCEL = 101 // return from vgetc , KE_EVENT = 102 // event , KE_COMMAND = 104 // <Cmd> special key }; diff --git a/src/nvim/lib/kbtree.h b/src/nvim/lib/kbtree.h index bef37f8ba9..6b10db0bbc 100644 --- a/src/nvim/lib/kbtree.h +++ b/src/nvim/lib/kbtree.h @@ -1,3 +1,5 @@ +// uncrustify:off + /*- * Copyright 1997-1999, 2001, John-Mark Gurney. * 2008-2009, Attractive Chaos <attractor@live.co.uk> diff --git a/src/nvim/lib/khash.h b/src/nvim/lib/khash.h index c999511543..381903c855 100644 --- a/src/nvim/lib/khash.h +++ b/src/nvim/lib/khash.h @@ -1,3 +1,5 @@ +// uncrustify:off + /* The MIT License Copyright (c) 2008, 2009, 2011 by Attractive Chaos <attractor@live.co.uk> diff --git a/src/nvim/lib/klist.h b/src/nvim/lib/klist.h index b80f4be3c2..a2d7e91af3 100644 --- a/src/nvim/lib/klist.h +++ b/src/nvim/lib/klist.h @@ -1,3 +1,5 @@ +// uncrustify:off + /* The MIT License Copyright (c) 2008-2009, by Attractive Chaos <attractor@live.co.uk> diff --git a/src/nvim/lib/kvec.h b/src/nvim/lib/kvec.h index 5bd09930a3..0a7260b2e5 100644 --- a/src/nvim/lib/kvec.h +++ b/src/nvim/lib/kvec.h @@ -1,3 +1,5 @@ +// uncrustify:off + // The MIT License // // Copyright (c) 2008, by Attractive Chaos <attractor@live.co.uk> diff --git a/src/nvim/lib/queue.h b/src/nvim/lib/queue.h index 452998a5a4..bc4e9c4a82 100644 --- a/src/nvim/lib/queue.h +++ b/src/nvim/lib/queue.h @@ -1,3 +1,5 @@ +// uncrustify:off + // Queue implemented by circularly-linked list. // // Adapted from libuv. Simpler and more efficient than klist.h for implementing diff --git a/src/nvim/lib/ringbuf.h b/src/nvim/lib/ringbuf.h index cb79eaf742..4eab44aa6a 100644 --- a/src/nvim/lib/ringbuf.h +++ b/src/nvim/lib/ringbuf.h @@ -1,3 +1,5 @@ +// uncrustify:off + /// Macros-based ring buffer implementation. /// /// Supported functions: diff --git a/src/nvim/log.h b/src/nvim/log.h index 654b682de8..81e39d1cdd 100644 --- a/src/nvim/log.h +++ b/src/nvim/log.h @@ -1,8 +1,8 @@ #ifndef NVIM_LOG_H #define NVIM_LOG_H -#include <stdio.h> #include <stdbool.h> +#include <stdio.h> #include "auto/config.h" #include "nvim/macros.h" @@ -10,10 +10,10 @@ // USDT probes. Example invocation: // NVIM_PROBE(nvim_foo_bar, 1, string.data); #if defined(HAVE_SYS_SDT_H) -#include <sys/sdt.h> // NOLINT -#define NVIM_PROBE(name, n, ...) STAP_PROBE##n(neovim, name, __VA_ARGS__) +# include <sys/sdt.h> // NOLINT +# define NVIM_PROBE(name, n, ...) STAP_PROBE##n(neovim, name, __VA_ARGS__) #else -#define NVIM_PROBE(name, n, ...) +# define NVIM_PROBE(name, n, ...) #endif @@ -33,7 +33,7 @@ #define ELOGN(...) #ifndef MIN_LOG_LEVEL -# define MIN_LOG_LEVEL INFO_LOG_LEVEL +# define MIN_LOG_LEVEL INFO_LOG_LEVEL #endif #define LOG(level, ...) logmsg((level), NULL, __func__, __LINE__, true, \ diff --git a/src/nvim/macros.h b/src/nvim/macros.h index e1aa1b7704..50ee91dc36 100644 --- a/src/nvim/macros.h +++ b/src/nvim/macros.h @@ -43,15 +43,15 @@ #define TOLOWER_LOC tolower // toupper() and tolower() for ASCII only and ignore the current locale. -# define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A')) -# define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A')) +#define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A')) +#define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A')) // Like isalpha() but reject non-ASCII characters. Can't be used with a // special key (negative value). -# define ASCII_ISLOWER(c) ((unsigned)(c) >= 'a' && (unsigned)(c) <= 'z') -# define ASCII_ISUPPER(c) ((unsigned)(c) >= 'A' && (unsigned)(c) <= 'Z') -# define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c)) -# define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || ascii_isdigit(c)) +#define ASCII_ISLOWER(c) ((unsigned)(c) >= 'a' && (unsigned)(c) <= 'z') +#define ASCII_ISUPPER(c) ((unsigned)(c) >= 'A' && (unsigned)(c) <= 'Z') +#define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c)) +#define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || ascii_isdigit(c)) // Returns empty string if it is NULL. #define EMPTY_IF_NULL(x) ((x) ? (x) : (char_u *)"") @@ -62,7 +62,7 @@ // 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) \ +#define LANGMAP_ADJUST(c, condition) \ do { \ if (*p_langmap \ && (condition) \ @@ -71,9 +71,9 @@ && (c) >= 0) \ { \ if ((c) < 256) \ - c = langmap_mapchar[c]; \ + c = langmap_mapchar[c]; \ else \ - c = langmap_adjust_mb(c); \ + c = langmap_adjust_mb(c); \ } \ } while (0) @@ -90,9 +90,9 @@ # define mch_open_rw(n, f) os_open((n), (f), 0) #endif -# define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG)) +#define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG)) -# define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2)) +#define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2)) // MB_PTR_ADV(): advance a pointer to the next character, taking care of // multi-byte characters if needed. @@ -102,22 +102,22 @@ // PTR2CHAR(): get character from pointer. // Advance multi-byte pointer, skip over composing chars. -# define MB_PTR_ADV(p) (p += mb_ptr2len((char_u *)p)) +#define MB_PTR_ADV(p) (p += mb_ptr2len((char_u *)p)) // Advance multi-byte pointer, do not skip over composing chars. -# define MB_CPTR_ADV(p) (p += utf_ptr2len(p)) +#define MB_CPTR_ADV(p) (p += utf_ptr2len(p)) // Backup multi-byte pointer. Only use with "p" > "s" ! -# define MB_PTR_BACK(s, p) \ - (p -= utf_head_off((char_u *)s, (char_u *)p - 1) + 1) +#define MB_PTR_BACK(s, p) \ + (p -= utf_head_off((char_u *)s, (char_u *)p - 1) + 1) // get length of multi-byte char, not including composing chars -# define MB_CPTR2LEN(p) utf_ptr2len(p) +#define MB_CPTR2LEN(p) utf_ptr2len(p) -# define MB_COPY_CHAR(f, t) mb_copy_char((const char_u **)(&f), &t); +#define MB_COPY_CHAR(f, t) mb_copy_char((const char_u **)(&f), &t); -# define MB_CHARLEN(p) mb_charlen(p) -# define MB_CHAR2LEN(c) mb_char2len(c) -# define PTR2CHAR(p) utf_ptr2char(p) +#define MB_CHARLEN(p) mb_charlen(p) +#define MB_CHAR2LEN(c) mb_char2len(c) +#define PTR2CHAR(p) utf_ptr2char(p) -# define RESET_BINDING(wp) \ +#define RESET_BINDING(wp) \ do { \ (wp)->w_p_scb = false; \ (wp)->w_p_crb = false; \ @@ -132,8 +132,8 @@ /// /// -V:ARRAY_SIZE:1063 #define ARRAY_SIZE(arr) \ - ((sizeof(arr)/sizeof((arr)[0])) \ - / ((size_t)(!(sizeof(arr) % sizeof((arr)[0]))))) + ((sizeof(arr)/sizeof((arr)[0])) \ + / ((size_t)(!(sizeof(arr) % sizeof((arr)[0]))))) /// Get last array entry /// @@ -156,7 +156,7 @@ #ifndef __has_attribute # define NVIM_HAS_ATTRIBUTE(x) 0 #elif defined(__clang__) && __clang__ == 1 \ - && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 5)) + && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 5)) // Starting in Clang 3.6, __has_attribute was fixed to only report true for // GNU-style attributes. Prior to that, it reported true if _any_ backend // supported the attribute. @@ -166,7 +166,7 @@ #endif #if NVIM_HAS_ATTRIBUTE(fallthrough) \ - && (!defined(__apple_build_version__) || __apple_build_version__ >= 7000000) + && (!defined(__apple_build_version__) || __apple_build_version__ >= 7000000) # define FALLTHROUGH {} __attribute__((fallthrough)) #else # define FALLTHROUGH @@ -204,29 +204,29 @@ /// #if defined(__clang__) && __clang__ == 1 # define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \ - _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic push")\ _Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"") # ifdef HAVE_WIMPLICIT_FALLTHROUGH_FLAG # define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"") + _Pragma("clang diagnostic push")\ + _Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"") # else # define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \ - _Pragma("clang diagnostic push") + _Pragma("clang diagnostic push") # endif # define PRAGMA_DIAG_POP \ - _Pragma("clang diagnostic pop") + _Pragma("clang diagnostic pop") #elif defined(__GNUC__) # define PRAGMA_DIAG_PUSH_IGNORE_MISSING_PROTOTYPES \ - _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic push")\ _Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"") # ifdef HAVE_WIMPLICIT_FALLTHROUGH_FLAG # define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") + _Pragma("GCC diagnostic push")\ + _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") # else # define PRAGMA_DIAG_PUSH_IGNORE_IMPLICIT_FALLTHROUGH \ - _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic push") # endif # define PRAGMA_DIAG_POP \ _Pragma("GCC diagnostic pop") diff --git a/src/nvim/main.h b/src/nvim/main.h index d387e6d668..f73af5c288 100644 --- a/src/nvim/main.h +++ b/src/nvim/main.h @@ -1,8 +1,8 @@ #ifndef NVIM_MAIN_H #define NVIM_MAIN_H -#include "nvim/normal.h" #include "nvim/event/loop.h" +#include "nvim/normal.h" // Maximum number of commands from + or -c arguments. #define MAX_ARG_CMDS 10 diff --git a/src/nvim/map.h b/src/nvim/map.h index d6515878a2..6ed341ac76 100644 --- a/src/nvim/map.h +++ b/src/nvim/map.h @@ -3,11 +3,11 @@ #include <stdbool.h> -#include "nvim/map_defs.h" -#include "nvim/extmark_defs.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/dispatch.h" +#include "nvim/extmark_defs.h" #include "nvim/highlight_defs.h" +#include "nvim/map_defs.h" #if defined(__NetBSD__) # undef uint64_t @@ -60,7 +60,7 @@ MAP_DECLS(String, handle_T) MAP_DECLS(ColorKey, ColorItem) #define MAP_INIT { { 0, 0, 0, 0, NULL, NULL, NULL } } -#define map_init(k, v, map) do { *(map) = (Map(k, v))MAP_INIT; } while (false) +#define map_init(k, v, map) do { *(map) = (Map(k, v)) MAP_INIT; } while (false) #define map_destroy(T, U) map_##T##_##U##_destroy #define map_get(T, U) map_##T##_##U##_get diff --git a/src/nvim/mark.h b/src/nvim/mark.h index b3d9b5d95a..a55f733d9a 100644 --- a/src/nvim/mark.h +++ b/src/nvim/mark.h @@ -1,55 +1,55 @@ #ifndef NVIM_MARK_H #define NVIM_MARK_H -#include "nvim/macros.h" #include "nvim/ascii.h" #include "nvim/buffer_defs.h" +#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/extmark_defs.h" #include "nvim/func_attr.h" +#include "nvim/macros.h" #include "nvim/mark_defs.h" -#include "nvim/extmark_defs.h" #include "nvim/memory.h" -#include "nvim/pos.h" #include "nvim/os/time.h" -#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/pos.h" /// Set fmark using given value #define SET_FMARK(fmarkp_, mark_, fnum_) \ - do { \ - fmark_T *const fmarkp__ = fmarkp_; \ - fmarkp__->mark = mark_; \ - fmarkp__->fnum = fnum_; \ - fmarkp__->timestamp = os_time(); \ - fmarkp__->additional_data = NULL; \ - } while (0) + do { \ + fmark_T *const fmarkp__ = fmarkp_; \ + fmarkp__->mark = mark_; \ + fmarkp__->fnum = fnum_; \ + fmarkp__->timestamp = os_time(); \ + fmarkp__->additional_data = NULL; \ + } while (0) /// Free and set fmark using given value #define RESET_FMARK(fmarkp_, mark_, fnum_) \ - do { \ - fmark_T *const fmarkp___ = fmarkp_; \ - free_fmark(*fmarkp___); \ - SET_FMARK(fmarkp___, mark_, fnum_); \ - } while (0) + do { \ + fmark_T *const fmarkp___ = fmarkp_; \ + free_fmark(*fmarkp___); \ + SET_FMARK(fmarkp___, mark_, fnum_); \ + } while (0) /// Clear given fmark #define CLEAR_FMARK(fmarkp_) \ - RESET_FMARK(fmarkp_, ((pos_T) { 0, 0, 0 }), 0) + RESET_FMARK(fmarkp_, ((pos_T) { 0, 0, 0 }), 0) /// Set given extended mark (regular mark + file name) #define SET_XFMARK(xfmarkp_, mark_, fnum_, fname_) \ - do { \ - xfmark_T *const xfmarkp__ = xfmarkp_; \ - xfmarkp__->fname = fname_; \ - SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_); \ - } while (0) + do { \ + xfmark_T *const xfmarkp__ = xfmarkp_; \ + xfmarkp__->fname = fname_; \ + SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_); \ + } while (0) /// Free and set given extended mark (regular mark + file name) #define RESET_XFMARK(xfmarkp_, mark_, fnum_, fname_) \ - do { \ - xfmark_T *const xfmarkp__ = xfmarkp_; \ - free_xfmark(*xfmarkp__); \ - xfmarkp__->fname = fname_; \ - SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_); \ - } while (0) + do { \ + xfmark_T *const xfmarkp__ = xfmarkp_; \ + free_xfmark(*xfmarkp__); \ + xfmarkp__->fname = fname_; \ + SET_FMARK(&(xfmarkp__->fmark), mark_, fnum_); \ + } while (0) /// Convert mark name to the offset static inline int mark_global_index(const char name) diff --git a/src/nvim/mark_defs.h b/src/nvim/mark_defs.h index 2cb489501e..51199a09e0 100644 --- a/src/nvim/mark_defs.h +++ b/src/nvim/mark_defs.h @@ -1,9 +1,9 @@ #ifndef NVIM_MARK_DEFS_H #define NVIM_MARK_DEFS_H -#include "nvim/pos.h" -#include "nvim/os/time.h" #include "nvim/eval/typval.h" +#include "nvim/os/time.h" +#include "nvim/pos.h" /* * marks: positions in a file @@ -42,7 +42,7 @@ typedef struct filemark { /// Structure defining extended mark (mark with file name attached) typedef struct xfilemark { fmark_T fmark; ///< Actual mark. - char_u *fname; ///< File name, used when fnum == 0. + char_u *fname; ///< File name, used when fnum == 0. } xfmark_T; #endif // NVIM_MARK_DEFS_H diff --git a/src/nvim/marktree.h b/src/nvim/marktree.h index 7af23765c3..02f73b8052 100644 --- a/src/nvim/marktree.h +++ b/src/nvim/marktree.h @@ -2,9 +2,10 @@ #define NVIM_MARKTREE_H #include <stdint.h> -#include "nvim/pos.h" -#include "nvim/map.h" + #include "nvim/garray.h" +#include "nvim/map.h" +#include "nvim/pos.h" #define MT_MAX_DEPTH 20 #define MT_BRANCH_FACTOR 10 diff --git a/src/nvim/math.c b/src/nvim/math.c index 791f1f9373..63a29509bd 100644 --- a/src/nvim/math.c +++ b/src/nvim/math.c @@ -2,7 +2,6 @@ // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com #include <math.h> - #include <stdint.h> #include <string.h> diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h index 536d58be1f..9926f27411 100644 --- a/src/nvim/mbyte.h +++ b/src/nvim/mbyte.h @@ -1,12 +1,12 @@ #ifndef NVIM_MBYTE_H #define NVIM_MBYTE_H -#include <stdint.h> #include <stdbool.h> +#include <stdint.h> #include <string.h> -#include "nvim/iconv.h" #include "nvim/func_attr.h" +#include "nvim/iconv.h" #include "nvim/os/os_defs.h" // For indirect #include "nvim/types.h" // for char_u @@ -22,21 +22,21 @@ // max length of an unicode char #define MB_MAXCHAR 6 -/* properties used in enc_canon_table[] (first three mutually exclusive) */ +// properties used in enc_canon_table[] (first three mutually exclusive) #define ENC_8BIT 0x01 #define ENC_DBCS 0x02 #define ENC_UNICODE 0x04 -#define ENC_ENDIAN_B 0x10 /* Unicode: Big endian */ -#define ENC_ENDIAN_L 0x20 /* Unicode: Little endian */ +#define ENC_ENDIAN_B 0x10 // Unicode: Big endian +#define ENC_ENDIAN_L 0x20 // Unicode: Little endian -#define ENC_2BYTE 0x40 /* Unicode: UCS-2 */ -#define ENC_4BYTE 0x80 /* Unicode: UCS-4 */ -#define ENC_2WORD 0x100 /* Unicode: UTF-16 */ +#define ENC_2BYTE 0x40 // Unicode: UCS-2 +#define ENC_4BYTE 0x80 // Unicode: UCS-4 +#define ENC_2WORD 0x100 // Unicode: UTF-16 -#define ENC_LATIN1 0x200 /* Latin1 */ -#define ENC_LATIN9 0x400 /* Latin9 */ -#define ENC_MACROMAN 0x800 /* Mac Roman (not Macro Man! :-) */ +#define ENC_LATIN1 0x200 // Latin1 +#define ENC_LATIN9 0x400 // Latin9 +#define ENC_MACROMAN 0x800 // Mac Roman (not Macro Man! :-) // TODO(bfredl): eventually we should keep only one of the namings #define mb_ptr2len utfc_ptr2len @@ -63,9 +63,9 @@ typedef enum { typedef struct { int vc_type; ///< Zero or more ConvFlags. int vc_factor; ///< Maximal expansion factor. -# ifdef HAVE_ICONV +#ifdef HAVE_ICONV iconv_t vc_fd; ///< Value for CONV_ICONV. -# endif +#endif bool vc_fail; ///< What to do with invalid characters: if true, fail, ///< otherwise use '?'. } vimconv_T; diff --git a/src/nvim/memfile_defs.h b/src/nvim/memfile_defs.h index 3eaa7d83e0..537d3e5f65 100644 --- a/src/nvim/memfile_defs.h +++ b/src/nvim/memfile_defs.h @@ -1,12 +1,12 @@ #ifndef NVIM_MEMFILE_DEFS_H #define NVIM_MEMFILE_DEFS_H -#include <stdint.h> #include <stdbool.h> +#include <stdint.h> #include <stdlib.h> -#include "nvim/types.h" #include "nvim/pos.h" +#include "nvim/types.h" /// A block number. /// diff --git a/src/nvim/memline.h b/src/nvim/memline.h index a239c6a031..441adf3e87 100644 --- a/src/nvim/memline.h +++ b/src/nvim/memline.h @@ -1,9 +1,9 @@ #ifndef NVIM_MEMLINE_H #define NVIM_MEMLINE_H +#include "nvim/buffer_defs.h" // for buf_T +#include "nvim/pos.h" // for pos_T, linenr_T, colnr_T #include "nvim/types.h" -#include "nvim/pos.h" // for pos_T, linenr_T, colnr_T -#include "nvim/buffer_defs.h" // for buf_T #ifdef INCLUDE_GENERATED_DECLARATIONS # include "memline.h.generated.h" diff --git a/src/nvim/memline_defs.h b/src/nvim/memline_defs.h index dc4755f83d..922a2c98d1 100644 --- a/src/nvim/memline_defs.h +++ b/src/nvim/memline_defs.h @@ -43,9 +43,9 @@ typedef struct ml_chunksize { typedef struct memline { linenr_T ml_line_count; // number of lines in the buffer - memfile_T *ml_mfp; // pointer to associated memfile + memfile_T *ml_mfp; // pointer to associated memfile - infoptr_T *ml_stack; // stack of pointer blocks (array of IPTRs) + infoptr_T *ml_stack; // stack of pointer blocks (array of IPTRs) int ml_stack_top; // current top of ml_stack int ml_stack_size; // total number of entries in ml_stack @@ -56,11 +56,11 @@ typedef struct memline { int ml_flags; linenr_T ml_line_lnum; // line number of cached line, 0 if not valid - char_u *ml_line_ptr; // pointer to cached line + char_u *ml_line_ptr; // pointer to cached line size_t ml_line_offset; // cached byte offset of ml_line_lnum int ml_line_offset_ff; // fileformat of cached line - bhdr_T *ml_locked; // block used by last ml_get + bhdr_T *ml_locked; // block used by last ml_get linenr_T ml_locked_low; // first line in ml_locked linenr_T ml_locked_high; // last line in ml_locked int ml_locked_lineadd; // number of lines inserted in ml_locked diff --git a/src/nvim/memory.h b/src/nvim/memory.h index 5b39d002c9..a4be2643d8 100644 --- a/src/nvim/memory.h +++ b/src/nvim/memory.h @@ -2,8 +2,8 @@ #define NVIM_MEMORY_H #include <stdbool.h> // for bool -#include <stdint.h> // for uint8_t #include <stddef.h> // for size_t +#include <stdint.h> // for uint8_t #include <time.h> // for time_t /// `malloc()` function signature diff --git a/src/nvim/menu.h b/src/nvim/menu.h index 642d9aafac..5c65918d79 100644 --- a/src/nvim/menu.h +++ b/src/nvim/menu.h @@ -1,10 +1,10 @@ #ifndef NVIM_MENU_H #define NVIM_MENU_H -#include <stdbool.h> // for bool +#include <stdbool.h> // for bool -#include "nvim/types.h" // for char_u and expand_T -#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/types.h" // for char_u and expand_T /// @} /// note MENU_INDEX_TIP is not a 'real' mode diff --git a/src/nvim/message.h b/src/nvim/message.h index 377c725fa1..6d4d030500 100644 --- a/src/nvim/message.h +++ b/src/nvim/message.h @@ -1,15 +1,15 @@ #ifndef NVIM_MESSAGE_H #define NVIM_MESSAGE_H -#include <stdbool.h> #include <stdarg.h> +#include <stdbool.h> #include <stddef.h> -#include "nvim/macros.h" -#include "nvim/types.h" -#include "nvim/grid_defs.h" #include "nvim/api/private/defs.h" +#include "nvim/grid_defs.h" #include "nvim/lib/kvec.h" +#include "nvim/macros.h" +#include "nvim/types.h" /* * Types of dialogs passed to do_dialog(). @@ -19,7 +19,7 @@ #define VIM_WARNING 2 #define VIM_INFO 3 #define VIM_QUESTION 4 -#define VIM_LAST_TYPE 4 /* sentinel value */ +#define VIM_LAST_TYPE 4 // sentinel value /* * Return values for functions like vim_dialogyesno() @@ -42,16 +42,16 @@ #define EMSG(s) emsg((char_u *)(s)) /// Like #EMSG, but for messages with one "%s" inside -#define EMSG2(s, p) emsgf((const char *) (s), (p)) +#define EMSG2(s, p) emsgf((const char *)(s), (p)) /// Like #EMSG, but for messages with two "%s" inside -#define EMSG3(s, p, q) emsgf((const char *) (s), (p), (q)) +#define EMSG3(s, p, q) emsgf((const char *)(s), (p), (q)) /// Like #EMSG, but for messages with one "%" PRId64 inside -#define EMSGN(s, n) emsgf((const char *) (s), (int64_t)(n)) +#define EMSGN(s, n) emsgf((const char *)(s), (int64_t)(n)) /// Like #EMSG, but for messages with one "%" PRIu64 inside -#define EMSGU(s, n) emsgf((const char *) (s), (uint64_t)(n)) +#define EMSGU(s, n) emsgf((const char *)(s), (uint64_t)(n)) /// Like #EMSG, but for internal messages #define IEMSG(s) iemsg((const char *)(s)) diff --git a/src/nvim/misc1.h b/src/nvim/misc1.h index f0f66854d8..4ce142c4c5 100644 --- a/src/nvim/misc1.h +++ b/src/nvim/misc1.h @@ -1,15 +1,15 @@ #ifndef NVIM_MISC1_H #define NVIM_MISC1_H -#include "nvim/vim.h" #include "nvim/os/shell.h" +#include "nvim/vim.h" -/* flags for open_line() */ -#define OPENLINE_DELSPACES 1 /* delete spaces after cursor */ -#define OPENLINE_DO_COM 2 /* format comments */ -#define OPENLINE_KEEPTRAIL 4 /* keep trailing spaces */ -#define OPENLINE_MARKFIX 8 /* fix mark positions */ -#define OPENLINE_COM_LIST 16 /* format comments with list/2nd line indent */ +// flags for open_line() +#define OPENLINE_DELSPACES 1 // delete spaces after cursor +#define OPENLINE_DO_COM 2 // format comments +#define OPENLINE_KEEPTRAIL 4 // keep trailing spaces +#define OPENLINE_MARKFIX 8 // fix mark positions +#define OPENLINE_COM_LIST 16 // format comments with list/2nd line indent #ifdef INCLUDE_GENERATED_DECLARATIONS # include "misc1.h.generated.h" diff --git a/src/nvim/mouse.h b/src/nvim/mouse.h index 6c5bc5dc0e..bf4f9c57e5 100644 --- a/src/nvim/mouse.h +++ b/src/nvim/mouse.h @@ -3,8 +3,8 @@ #include <stdbool.h> -#include "nvim/vim.h" #include "nvim/buffer_defs.h" +#include "nvim/vim.h" // jump_to_mouse() returns one of first four these values, possibly with // some of the other three added. diff --git a/src/nvim/move.h b/src/nvim/move.h index 3670dc9086..dd944e39ee 100644 --- a/src/nvim/move.h +++ b/src/nvim/move.h @@ -2,6 +2,7 @@ #define NVIM_MOVE_H #include <stdbool.h> + #include "nvim/vim.h" #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/normal.h b/src/nvim/normal.h index 8e15e909d4..fbcc6da75b 100644 --- a/src/nvim/normal.h +++ b/src/nvim/normal.h @@ -2,13 +2,14 @@ #define NVIM_NORMAL_H #include <stdbool.h> -#include "nvim/pos.h" + #include "nvim/buffer_defs.h" // for win_T +#include "nvim/pos.h" -/* Values for find_ident_under_cursor() */ -#define FIND_IDENT 1 /* find identifier (word) */ -#define FIND_STRING 2 /* find any string (WORD) */ -#define FIND_EVAL 4 /* include "->", "[]" and "." */ +// Values for find_ident_under_cursor() +#define FIND_IDENT 1 // find identifier (word) +#define FIND_STRING 2 // find any string (WORD) +#define FIND_EVAL 4 // include "->", "[]" and "." /// Motion types, used for operators and for yank/delete registers. /// @@ -56,24 +57,24 @@ typedef struct oparg_S { * Arguments for Normal mode commands. */ typedef struct cmdarg_S { - oparg_T *oap; /* Operator arguments */ - int prechar; /* prefix character (optional, always 'g') */ - int cmdchar; /* command character */ - int nchar; /* next command character (optional) */ - int ncharC1; /* first composing character (optional) */ - int ncharC2; /* second composing character (optional) */ - int extra_char; /* yet another character (optional) */ - long opcount; /* count before an operator */ - long count0; /* count before command, default 0 */ - long count1; /* count before command, default 1 */ - int arg; /* extra argument from nv_cmds[] */ - int retval; /* return: CA_* values */ - char_u *searchbuf; /* return: pointer to search pattern or NULL */ + oparg_T *oap; // Operator arguments + int prechar; // prefix character (optional, always 'g') + int cmdchar; // command character + int nchar; // next command character (optional) + int ncharC1; // first composing character (optional) + int ncharC2; // second composing character (optional) + int extra_char; // yet another character (optional) + long opcount; // count before an operator + long count0; // count before command, default 0 + long count1; // count before command, default 1 + int arg; // extra argument from nv_cmds[] + int retval; // return: CA_* values + char_u *searchbuf; // return: pointer to search pattern or NULL } cmdarg_T; -/* values for retval: */ -#define CA_COMMAND_BUSY 1 /* skip restarting edit() once */ -#define CA_NO_ADJ_OP_END 2 /* don't adjust operator end */ +// values for retval: +#define CA_COMMAND_BUSY 1 // skip restarting edit() once +#define CA_NO_ADJ_OP_END 2 // don't adjust operator end #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/ops.h b/src/nvim/ops.h index 5b87746921..11049b72c0 100644 --- a/src/nvim/ops.h +++ b/src/nvim/ops.h @@ -3,14 +3,14 @@ #include <stdbool.h> -#include "nvim/macros.h" #include "nvim/ascii.h" -#include "nvim/types.h" -#include "nvim/extmark.h" #include "nvim/eval/typval.h" +#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/extmark.h" +#include "nvim/macros.h" +#include "nvim/normal.h" // for MotionType and oparg_T #include "nvim/os/time.h" -#include "nvim/normal.h" // for MotionType and oparg_T -#include "nvim/ex_cmds_defs.h" // for exarg_T +#include "nvim/types.h" typedef int (*Indenter)(void); diff --git a/src/nvim/option.h b/src/nvim/option.h index c6ee03e052..452494172f 100644 --- a/src/nvim/option.h +++ b/src/nvim/option.h @@ -3,10 +3,10 @@ #include "nvim/ex_cmds_defs.h" // for exarg_T -/* flags for buf_copy_options() */ -#define BCO_ENTER 1 /* going to enter the buffer */ -#define BCO_ALWAYS 2 /* always copy the options */ -#define BCO_NOHELP 4 /* don't touch the help related options */ +// flags for buf_copy_options() +#define BCO_ENTER 1 // going to enter the buffer +#define BCO_ALWAYS 2 // always copy the options +#define BCO_NOHELP 4 // don't touch the help related options /// Flags for option-setting functions /// diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index e588d3f373..2f931fed04 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -1,9 +1,9 @@ #ifndef NVIM_OPTION_DEFS_H #define NVIM_OPTION_DEFS_H -#include "nvim/types.h" -#include "nvim/macros.h" // For EXTERN #include "eval/typval.h" // For scid_T +#include "nvim/macros.h" // For EXTERN +#include "nvim/types.h" // option_defs.h: definition of global variables for settable options @@ -25,9 +25,11 @@ // The "%f|%l| %m" one is used for when the contents of the quickfix window is // written to a file. #ifdef WIN32 -# define DFLT_EFM "%f(%l) \\=: %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) \\=: %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m" +# define DFLT_EFM \ + "%f(%l) \\=: %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) \\=: %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m" #else -# define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m" +# define DFLT_EFM \ + "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m" #endif #define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m" @@ -42,17 +44,17 @@ # define DFLT_FFS_VIM "dos,unix" # define DFLT_FFS_VI "dos,unix" // also autodetect in compatible mode #else -# define DFLT_FF "unix" -# define DFLT_FFS_VIM "unix,dos" -# define DFLT_FFS_VI "" +# define DFLT_FF "unix" +# define DFLT_FFS_VIM "unix,dos" +# define DFLT_FFS_VI "" #endif // Possible values for 'encoding' -# define ENC_UCSBOM "ucs-bom" // check for BOM at start of file +#define ENC_UCSBOM "ucs-bom" // check for BOM at start of file // default value for 'encoding' -# define ENC_DFLT "utf-8" +#define ENC_DFLT "utf-8" // end-of-line style #define EOL_UNKNOWN -1 // not defined yet @@ -179,9 +181,9 @@ enum { }; /// Represented by 'a' flag. #define SHM_ALL_ABBREVIATIONS ((char_u[]) { \ - SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \ - 0, \ -}) + SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \ + 0, \ + }) // characters for p_go: #define GO_ASEL 'a' // autoselect @@ -264,16 +266,16 @@ enum { }; /// C string containing all 'statusline' option flags #define STL_ALL ((char_u[]) { \ - STL_FILEPATH, STL_FULLPATH, STL_FILENAME, STL_COLUMN, STL_VIRTCOL, \ - STL_VIRTCOL_ALT, STL_LINE, STL_NUMLINES, STL_BUFNO, STL_KEYMAP, STL_OFFSET, \ - STL_OFFSET_X, STL_BYTEVAL, STL_BYTEVAL_X, STL_ROFLAG, STL_ROFLAG_ALT, \ - STL_HELPFLAG, STL_HELPFLAG_ALT, STL_FILETYPE, STL_FILETYPE_ALT, \ - STL_PREVIEWFLAG, STL_PREVIEWFLAG_ALT, STL_MODIFIED, STL_MODIFIED_ALT, \ - STL_QUICKFIX, STL_PERCENTAGE, STL_ALTPERCENT, STL_ARGLISTSTAT, STL_PAGENUM, \ - STL_VIM_EXPR, STL_SEPARATE, STL_TRUNCMARK, STL_USER_HL, STL_HIGHLIGHT, \ - STL_TABPAGENR, STL_TABCLOSENR, STL_CLICK_FUNC, \ - 0, \ -}) + STL_FILEPATH, STL_FULLPATH, STL_FILENAME, STL_COLUMN, STL_VIRTCOL, \ + STL_VIRTCOL_ALT, STL_LINE, STL_NUMLINES, STL_BUFNO, STL_KEYMAP, STL_OFFSET, \ + STL_OFFSET_X, STL_BYTEVAL, STL_BYTEVAL_X, STL_ROFLAG, STL_ROFLAG_ALT, \ + STL_HELPFLAG, STL_HELPFLAG_ALT, STL_FILETYPE, STL_FILETYPE_ALT, \ + STL_PREVIEWFLAG, STL_PREVIEWFLAG_ALT, STL_MODIFIED, STL_MODIFIED_ALT, \ + STL_QUICKFIX, STL_PERCENTAGE, STL_ALTPERCENT, STL_ARGLISTSTAT, STL_PAGENUM, \ + STL_VIM_EXPR, STL_SEPARATE, STL_TRUNCMARK, STL_USER_HL, STL_HIGHLIGHT, \ + STL_TABPAGENR, STL_TABCLOSENR, STL_CLICK_FUNC, \ + 0, \ + }) // flags used for parsed 'wildmode' #define WIM_FULL 0x01 @@ -305,36 +307,36 @@ enum { EXTERN long p_aleph; // 'aleph' EXTERN int p_acd; // 'autochdir' -EXTERN char_u *p_ambw; // 'ambiwidth' +EXTERN char_u *p_ambw; // 'ambiwidth' EXTERN int p_ar; // 'autoread' EXTERN int p_aw; // 'autowrite' EXTERN int p_awa; // 'autowriteall' -EXTERN char_u *p_bs; // 'backspace' -EXTERN char_u *p_bg; // 'background' +EXTERN char_u *p_bs; // 'backspace' +EXTERN char_u *p_bg; // 'background' EXTERN int p_bk; // 'backup' -EXTERN char_u *p_bkc; // 'backupcopy' +EXTERN char_u *p_bkc; // 'backupcopy' EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy' #ifdef IN_OPTION_C static char *(p_bkc_values[]) = -{"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL}; +{ "yes", "auto", "no", "breaksymlink", "breakhardlink", NULL }; #endif -# define BKC_YES 0x001 -# define BKC_AUTO 0x002 -# define BKC_NO 0x004 -# define BKC_BREAKSYMLINK 0x008 -# define BKC_BREAKHARDLINK 0x010 +#define BKC_YES 0x001 +#define BKC_AUTO 0x002 +#define BKC_NO 0x004 +#define BKC_BREAKSYMLINK 0x008 +#define BKC_BREAKHARDLINK 0x010 EXTERN char_u *p_bdir; // 'backupdir' EXTERN char_u *p_bex; // 'backupext' EXTERN char_u *p_bo; // 'belloff' EXTERN char breakat_flags[256]; // which characters are in 'breakat' EXTERN unsigned bo_flags; -# ifdef IN_OPTION_C -static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete", - "copy", "ctrlg", "error", "esc", "ex", - "hangul", "insertmode", "lang", "mess", - "showmatch", "operator", "register", "shell", - "spell", "wildmode", NULL}; -# endif +#ifdef IN_OPTION_C +static char *(p_bo_values[]) = { "all", "backspace", "cursor", "complete", + "copy", "ctrlg", "error", "esc", "ex", + "hangul", "insertmode", "lang", "mess", + "showmatch", "operator", "register", "shell", + "spell", "wildmode", NULL }; +#endif // values for the 'belloff' option #define BO_ALL 0x0001 @@ -357,61 +359,61 @@ static char *(p_bo_values[]) = {"all", "backspace", "cursor", "complete", #define BO_SPELL 0x20000 #define BO_WILD 0x40000 -EXTERN char_u *p_bsk; // 'backupskip' -EXTERN char_u *p_breakat; // 'breakat' -EXTERN char_u *p_cmp; // 'casemap' +EXTERN char_u *p_bsk; // 'backupskip' +EXTERN char_u *p_breakat; // 'breakat' +EXTERN char_u *p_cmp; // 'casemap' EXTERN unsigned cmp_flags; -# ifdef IN_OPTION_C -static char *(p_cmp_values[]) = {"internal", "keepascii", NULL}; -# endif -# define CMP_INTERNAL 0x001 -# define CMP_KEEPASCII 0x002 -EXTERN char_u *p_enc; // 'encoding' +#ifdef IN_OPTION_C +static char *(p_cmp_values[]) = { "internal", "keepascii", NULL }; +#endif +#define CMP_INTERNAL 0x001 +#define CMP_KEEPASCII 0x002 +EXTERN char_u *p_enc; // 'encoding' EXTERN int p_deco; // 'delcombine' -EXTERN char_u *p_ccv; // 'charconvert' -EXTERN char_u *p_cedit; // 'cedit' -EXTERN char_u *p_cb; // 'clipboard' +EXTERN char_u *p_ccv; // 'charconvert' +EXTERN char_u *p_cedit; // 'cedit' +EXTERN char_u *p_cb; // 'clipboard' EXTERN unsigned cb_flags; #ifdef IN_OPTION_C -static char *(p_cb_values[]) = {"unnamed", "unnamedplus", NULL}; +static char *(p_cb_values[]) = { "unnamed", "unnamedplus", NULL }; #endif -# define CB_UNNAMED 0x001 -# define CB_UNNAMEDPLUS 0x002 -# define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) +#define CB_UNNAMED 0x001 +#define CB_UNNAMEDPLUS 0x002 +#define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) EXTERN long p_cwh; // 'cmdwinheight' EXTERN long p_ch; // 'cmdheight' EXTERN long p_columns; // 'columns' EXTERN int p_confirm; // 'confirm' -EXTERN char_u *p_cot; // 'completeopt' -# ifdef BACKSLASH_IN_FILENAME -EXTERN char_u *p_csl; // 'completeslash' -# endif +EXTERN char_u *p_cot; // 'completeopt' +#ifdef BACKSLASH_IN_FILENAME +EXTERN char_u *p_csl; // 'completeslash' +#endif EXTERN long p_pb; // 'pumblend' EXTERN long p_ph; // 'pumheight' EXTERN long p_pw; // 'pumwidth' -EXTERN char_u *p_cpo; // 'cpoptions' -EXTERN char_u *p_csprg; // 'cscopeprg' +EXTERN char_u *p_cpo; // 'cpoptions' +EXTERN char_u *p_csprg; // 'cscopeprg' EXTERN int p_csre; // 'cscoperelative' -EXTERN char_u *p_csqf; // 'cscopequickfix' -# define CSQF_CMDS "sgdctefia" -# define CSQF_FLAGS "+-0" +EXTERN char_u *p_csqf; // 'cscopequickfix' +#define CSQF_CMDS "sgdctefia" +#define CSQF_FLAGS "+-0" EXTERN int p_cst; // 'cscopetag' EXTERN long p_csto; // 'cscopetagorder' EXTERN long p_cspc; // 'cscopepathcomp' EXTERN int p_csverbose; // 'cscopeverbose' -EXTERN char_u *p_debug; // 'debug' -EXTERN char_u *p_def; // 'define' -EXTERN char_u *p_inc; -EXTERN char_u *p_dip; // 'diffopt' -EXTERN char_u *p_dex; // 'diffexpr' -EXTERN char_u *p_dict; // 'dictionary' +EXTERN char_u *p_debug; // 'debug' +EXTERN char_u *p_def; // 'define' +EXTERN char_u *p_inc; +EXTERN char_u *p_dip; // 'diffopt' +EXTERN char_u *p_dex; // 'diffexpr' +EXTERN char_u *p_dict; // 'dictionary' EXTERN int p_dg; // 'digraph' -EXTERN char_u *p_dir; // 'directory' -EXTERN char_u *p_dy; // 'display' +EXTERN char_u *p_dir; // 'directory' +EXTERN char_u *p_dy; // 'display' EXTERN unsigned dy_flags; #ifdef IN_OPTION_C static char *(p_dy_values[]) = { "lastline", "truncate", "uhex", "msgsep", - NULL }; + NULL }; #endif #define DY_LASTLINE 0x001 #define DY_TRUNCATE 0x002 @@ -420,72 +422,72 @@ static char *(p_dy_values[]) = { "lastline", "truncate", "uhex", "msgsep", #define DY_MSGSEP 0x008 EXTERN int p_ed; // 'edcompatible' EXTERN int p_emoji; // 'emoji' -EXTERN char_u *p_ead; // 'eadirection' +EXTERN char_u *p_ead; // 'eadirection' EXTERN int p_ea; // 'equalalways' -EXTERN char_u *p_ep; // 'equalprg' +EXTERN char_u *p_ep; // 'equalprg' EXTERN int p_eb; // 'errorbells' -EXTERN char_u *p_ef; // 'errorfile' -EXTERN char_u *p_efm; // 'errorformat' -EXTERN char_u *p_gefm; // 'grepformat' -EXTERN char_u *p_gp; // 'grepprg' -EXTERN char_u *p_ei; // 'eventignore' +EXTERN char_u *p_ef; // 'errorfile' +EXTERN char_u *p_efm; // 'errorformat' +EXTERN char_u *p_gefm; // 'grepformat' +EXTERN char_u *p_gp; // 'grepprg' +EXTERN char_u *p_ei; // 'eventignore' EXTERN int p_exrc; // 'exrc' -EXTERN char_u *p_fencs; // 'fileencodings' -EXTERN char_u *p_ffs; // 'fileformats' +EXTERN char_u *p_fencs; // 'fileencodings' +EXTERN char_u *p_ffs; // 'fileformats' EXTERN int p_fic; // 'fileignorecase' -EXTERN char_u *p_fcl; // 'foldclose' +EXTERN char_u *p_fcl; // 'foldclose' EXTERN long p_fdls; // 'foldlevelstart' -EXTERN char_u *p_fdo; // 'foldopen' +EXTERN char_u *p_fdo; // 'foldopen' EXTERN unsigned fdo_flags; -# ifdef IN_OPTION_C -static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent", - "quickfix", "search", "tag", "insert", - "undo", "jump", NULL}; -# endif -# define FDO_ALL 0x001 -# define FDO_BLOCK 0x002 -# define FDO_HOR 0x004 -# define FDO_MARK 0x008 -# define FDO_PERCENT 0x010 -# define FDO_QUICKFIX 0x020 -# define FDO_SEARCH 0x040 -# define FDO_TAG 0x080 -# define FDO_INSERT 0x100 -# define FDO_UNDO 0x200 -# define FDO_JUMP 0x400 -EXTERN char_u *p_fp; // 'formatprg' +#ifdef IN_OPTION_C +static char *(p_fdo_values[]) = { "all", "block", "hor", "mark", "percent", + "quickfix", "search", "tag", "insert", + "undo", "jump", NULL }; +#endif +#define FDO_ALL 0x001 +#define FDO_BLOCK 0x002 +#define FDO_HOR 0x004 +#define FDO_MARK 0x008 +#define FDO_PERCENT 0x010 +#define FDO_QUICKFIX 0x020 +#define FDO_SEARCH 0x040 +#define FDO_TAG 0x080 +#define FDO_INSERT 0x100 +#define FDO_UNDO 0x200 +#define FDO_JUMP 0x400 +EXTERN char_u *p_fp; // 'formatprg' EXTERN int p_fs; // 'fsync' EXTERN int p_gd; // 'gdefault' -EXTERN char_u *p_pdev; // 'printdevice' -EXTERN char_u *p_penc; // 'printencoding' -EXTERN char_u *p_pexpr; // 'printexpr' -EXTERN char_u *p_pmfn; // 'printmbfont' -EXTERN char_u *p_pmcs; // 'printmbcharset' -EXTERN char_u *p_pfn; // 'printfont' -EXTERN char_u *p_popt; // 'printoptions' -EXTERN char_u *p_header; // 'printheader' -EXTERN char_u *p_guicursor; // 'guicursor' -EXTERN char_u *p_guifont; // 'guifont' -EXTERN char_u *p_guifontwide; // 'guifontwide' -EXTERN char_u *p_hf; // 'helpfile' +EXTERN char_u *p_pdev; // 'printdevice' +EXTERN char_u *p_penc; // 'printencoding' +EXTERN char_u *p_pexpr; // 'printexpr' +EXTERN char_u *p_pmfn; // 'printmbfont' +EXTERN char_u *p_pmcs; // 'printmbcharset' +EXTERN char_u *p_pfn; // 'printfont' +EXTERN char_u *p_popt; // 'printoptions' +EXTERN char_u *p_header; // 'printheader' +EXTERN char_u *p_guicursor; // 'guicursor' +EXTERN char_u *p_guifont; // 'guifont' +EXTERN char_u *p_guifontwide; // 'guifontwide' +EXTERN char_u *p_hf; // 'helpfile' EXTERN long p_hh; // 'helpheight' -EXTERN char_u *p_hlg; // 'helplang' +EXTERN char_u *p_hlg; // 'helplang' EXTERN int p_hid; // 'hidden' -EXTERN char_u *p_hl; // 'highlight' +EXTERN char_u *p_hl; // 'highlight' EXTERN int p_hls; // 'hlsearch' EXTERN long p_hi; // 'history' EXTERN int p_hkmap; // 'hkmap' EXTERN int p_hkmapp; // 'hkmapp' EXTERN int p_arshape; // 'arabicshape' EXTERN int p_icon; // 'icon' -EXTERN char_u *p_iconstring; // 'iconstring' +EXTERN char_u *p_iconstring; // 'iconstring' EXTERN int p_ic; // 'ignorecase' EXTERN int p_is; // 'incsearch' -EXTERN char_u *p_icm; // 'inccommand' +EXTERN char_u *p_icm; // 'inccommand' EXTERN int p_im; // 'insertmode' -EXTERN char_u *p_isf; // 'isfname' -EXTERN char_u *p_isi; // 'isident' -EXTERN char_u *p_isp; // 'isprint' +EXTERN char_u *p_isf; // 'isfname' +EXTERN char_u *p_isi; // 'isident' +EXTERN char_u *p_isp; // 'isprint' EXTERN int p_js; // 'joinspaces' EXTERN char_u *p_jop; // 'jumpooptions' EXTERN unsigned jop_flags; @@ -493,26 +495,26 @@ EXTERN unsigned jop_flags; static char *(p_jop_values[]) = { "stack", NULL }; #endif #define JOP_STACK 0x01 -EXTERN char_u *p_kp; // 'keywordprg' -EXTERN char_u *p_km; // 'keymodel' -EXTERN char_u *p_langmap; // 'langmap' +EXTERN char_u *p_kp; // 'keywordprg' +EXTERN char_u *p_km; // 'keymodel' +EXTERN char_u *p_langmap; // 'langmap' EXTERN int p_lnr; // 'langnoremap' EXTERN int p_lrm; // 'langremap' -EXTERN char_u *p_lm; // 'langmenu' -EXTERN long p_lines; // 'lines' -EXTERN long p_linespace; // 'linespace' -EXTERN char_u *p_lispwords; // 'lispwords' +EXTERN char_u *p_lm; // 'langmenu' +EXTERN long p_lines; // 'lines' +EXTERN long p_linespace; // 'linespace' +EXTERN char_u *p_lispwords; // 'lispwords' EXTERN long p_ls; // 'laststatus' EXTERN long p_stal; // 'showtabline' -EXTERN char_u *p_lcs; // 'listchars' +EXTERN char_u *p_lcs; // 'listchars' EXTERN int p_lz; // 'lazyredraw' EXTERN int p_lpl; // 'loadplugins' EXTERN int p_magic; // 'magic' -EXTERN char_u *p_menc; // 'makeencoding' -EXTERN char_u *p_mef; // 'makeef' -EXTERN char_u *p_mp; // 'makeprg' -EXTERN char_u *p_cc; // 'colorcolumn' +EXTERN char_u *p_menc; // 'makeencoding' +EXTERN char_u *p_mef; // 'makeef' +EXTERN char_u *p_mp; // 'makeprg' +EXTERN char_u *p_cc; // 'colorcolumn' EXTERN int p_cc_cols[256]; // array for 'colorcolumn' columns EXTERN long p_mat; // 'matchtime' EXTERN long p_mco; // 'maxcombine' @@ -520,26 +522,26 @@ EXTERN long p_mfd; // 'maxfuncdepth' EXTERN long p_mmd; // 'maxmapdepth' EXTERN long p_mmp; // 'maxmempattern' EXTERN long p_mis; // 'menuitems' -EXTERN char_u *p_msm; // 'mkspellmem' +EXTERN char_u *p_msm; // 'mkspellmem' EXTERN long p_mle; // 'modelineexpr' EXTERN long p_mls; // 'modelines' -EXTERN char_u *p_mouse; // 'mouse' -EXTERN char_u *p_mousem; // 'mousemodel' +EXTERN char_u *p_mouse; // 'mouse' +EXTERN char_u *p_mousem; // 'mousemodel' EXTERN long p_mousef; // 'mousefocus' EXTERN long p_mouset; // 'mousetime' EXTERN int p_more; // 'more' -EXTERN char_u *p_opfunc; // 'operatorfunc' -EXTERN char_u *p_para; // 'paragraphs' +EXTERN char_u *p_opfunc; // 'operatorfunc' +EXTERN char_u *p_para; // 'paragraphs' EXTERN int p_paste; // 'paste' -EXTERN char_u *p_pt; // 'pastetoggle' -EXTERN char_u *p_pex; // 'patchexpr' -EXTERN char_u *p_pm; // 'patchmode' -EXTERN char_u *p_path; // 'path' -EXTERN char_u *p_cdpath; // 'cdpath' +EXTERN char_u *p_pt; // 'pastetoggle' +EXTERN char_u *p_pex; // 'patchexpr' +EXTERN char_u *p_pm; // 'patchmode' +EXTERN char_u *p_path; // 'path' +EXTERN char_u *p_cdpath; // 'cdpath' EXTERN long p_pyx; // 'pyxversion' EXTERN char_u *p_rdb; // 'redrawdebug' EXTERN unsigned rdb_flags; -# ifdef IN_OPTION_C +#ifdef IN_OPTION_C static char *(p_rdb_values[]) = { "compositor", "nothrottle", @@ -547,11 +549,11 @@ static char *(p_rdb_values[]) = { "nodelta", NULL }; -# endif -# define RDB_COMPOSITOR 0x001 -# define RDB_NOTHROTTLE 0x002 -# define RDB_INVALID 0x004 -# define RDB_NODELTA 0x008 +#endif +#define RDB_COMPOSITOR 0x001 +#define RDB_NOTHROTTLE 0x002 +#define RDB_INVALID 0x004 +#define RDB_NODELTA 0x008 EXTERN long p_rdt; // 'redrawtime' EXTERN int p_remap; // 'remap' @@ -561,21 +563,21 @@ EXTERN long p_pvh; // 'previewheight' EXTERN int p_ari; // 'allowrevins' EXTERN int p_ri; // 'revins' EXTERN int p_ru; // 'ruler' -EXTERN char_u *p_ruf; // 'rulerformat' -EXTERN char_u *p_pp; // 'packpath' -EXTERN char_u *p_qftf; // 'quickfixtextfunc' -EXTERN char_u *p_rtp; // 'runtimepath' +EXTERN char_u *p_ruf; // 'rulerformat' +EXTERN char_u *p_pp; // 'packpath' +EXTERN char_u *p_qftf; // 'quickfixtextfunc' +EXTERN char_u *p_rtp; // 'runtimepath' EXTERN long p_scbk; // 'scrollback' EXTERN long p_sj; // 'scrolljump' EXTERN long p_so; // 'scrolloff' -EXTERN char_u *p_sbo; // 'scrollopt' -EXTERN char_u *p_sections; // 'sections' +EXTERN char_u *p_sbo; // 'scrollopt' +EXTERN char_u *p_sections; // 'sections' EXTERN int p_secure; // 'secure' -EXTERN char_u *p_sel; // 'selection' -EXTERN char_u *p_slm; // 'selectmode' -EXTERN char_u *p_ssop; // 'sessionoptions' +EXTERN char_u *p_sel; // 'selection' +EXTERN char_u *p_slm; // 'selectmode' +EXTERN char_u *p_ssop; // 'sessionoptions' EXTERN unsigned ssop_flags; -# ifdef IN_OPTION_C +#ifdef IN_OPTION_C // Also used for 'viewoptions'! Keep in sync with SSOP_ flags. static char *(p_ssop_values[]) = { "buffers", "winpos", "resize", "winsize", @@ -583,41 +585,41 @@ static char *(p_ssop_values[]) = { "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", "skiprtp", NULL }; -# endif -# define SSOP_BUFFERS 0x001 -# define SSOP_WINPOS 0x002 -# define SSOP_RESIZE 0x004 -# define SSOP_WINSIZE 0x008 -# define SSOP_LOCALOPTIONS 0x010 -# define SSOP_OPTIONS 0x020 -# define SSOP_HELP 0x040 -# define SSOP_BLANK 0x080 -# define SSOP_GLOBALS 0x100 -# define SSOP_SLASH 0x200 // Deprecated, always set. -# define SSOP_UNIX 0x400 // Deprecated, always set. -# define SSOP_SESDIR 0x800 -# define SSOP_CURDIR 0x1000 -# define SSOP_FOLDS 0x2000 -# define SSOP_CURSOR 0x4000 -# define SSOP_TABPAGES 0x8000 -# define SSOP_TERMINAL 0x10000 -# define SSOP_SKIP_RTP 0x20000 - -EXTERN char_u *p_sh; // 'shell' -EXTERN char_u *p_shcf; // 'shellcmdflag' -EXTERN char_u *p_sp; // 'shellpipe' -EXTERN char_u *p_shq; // 'shellquote' -EXTERN char_u *p_sxq; // 'shellxquote' -EXTERN char_u *p_sxe; // 'shellxescape' -EXTERN char_u *p_srr; // 'shellredir' +#endif +#define SSOP_BUFFERS 0x001 +#define SSOP_WINPOS 0x002 +#define SSOP_RESIZE 0x004 +#define SSOP_WINSIZE 0x008 +#define SSOP_LOCALOPTIONS 0x010 +#define SSOP_OPTIONS 0x020 +#define SSOP_HELP 0x040 +#define SSOP_BLANK 0x080 +#define SSOP_GLOBALS 0x100 +#define SSOP_SLASH 0x200 // Deprecated, always set. +#define SSOP_UNIX 0x400 // Deprecated, always set. +#define SSOP_SESDIR 0x800 +#define SSOP_CURDIR 0x1000 +#define SSOP_FOLDS 0x2000 +#define SSOP_CURSOR 0x4000 +#define SSOP_TABPAGES 0x8000 +#define SSOP_TERMINAL 0x10000 +#define SSOP_SKIP_RTP 0x20000 + +EXTERN char_u *p_sh; // 'shell' +EXTERN char_u *p_shcf; // 'shellcmdflag' +EXTERN char_u *p_sp; // 'shellpipe' +EXTERN char_u *p_shq; // 'shellquote' +EXTERN char_u *p_sxq; // 'shellxquote' +EXTERN char_u *p_sxe; // 'shellxescape' +EXTERN char_u *p_srr; // 'shellredir' EXTERN int p_stmp; // 'shelltemp' #ifdef BACKSLASH_IN_FILENAME EXTERN int p_ssl; // 'shellslash' #endif -EXTERN char_u *p_stl; // 'statusline' +EXTERN char_u *p_stl; // 'statusline' EXTERN int p_sr; // 'shiftround' -EXTERN char_u *p_shm; // 'shortmess' -EXTERN char_u *p_sbr; // 'showbreak' +EXTERN char_u *p_shm; // 'shortmess' +EXTERN char_u *p_sbr; // 'showbreak' EXTERN int p_sc; // 'showcmd' EXTERN int p_sft; // 'showfulltag' EXTERN int p_sm; // 'showmatch' @@ -628,29 +630,29 @@ EXTERN int p_scs; // 'smartcase' EXTERN int p_sta; // 'smarttab' EXTERN int p_sb; // 'splitbelow' EXTERN long p_tpm; // 'tabpagemax' -EXTERN char_u *p_tal; // 'tabline' -EXTERN char_u *p_tpf; // 'termpastefilter' +EXTERN char_u *p_tal; // 'tabline' +EXTERN char_u *p_tpf; // 'termpastefilter' EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter' #ifdef IN_OPTION_C static char *(p_tpf_values[]) = - { "BS", "HT", "FF", "ESC", "DEL", "C0", "C1", NULL }; +{ "BS", "HT", "FF", "ESC", "DEL", "C0", "C1", NULL }; #endif -# define TPF_BS 0x001 -# define TPF_HT 0x002 -# define TPF_FF 0x004 -# define TPF_ESC 0x008 -# define TPF_DEL 0x010 -# define TPF_C0 0x020 -# define TPF_C1 0x040 -EXTERN char_u *p_sps; // 'spellsuggest' +#define TPF_BS 0x001 +#define TPF_HT 0x002 +#define TPF_FF 0x004 +#define TPF_ESC 0x008 +#define TPF_DEL 0x010 +#define TPF_C0 0x020 +#define TPF_C1 0x040 +EXTERN char_u *p_sps; // 'spellsuggest' EXTERN int p_spr; // 'splitright' EXTERN int p_sol; // 'startofline' -EXTERN char_u *p_su; // 'suffixes' -EXTERN char_u *p_swb; // 'switchbuf' +EXTERN char_u *p_su; // 'suffixes' +EXTERN char_u *p_swb; // 'switchbuf' EXTERN unsigned swb_flags; #ifdef IN_OPTION_C static char *(p_swb_values[]) = - { "useopen", "usetab", "split", "newtab", "vsplit", "uselast", NULL }; +{ "useopen", "usetab", "split", "newtab", "vsplit", "uselast", NULL }; #endif #define SWB_USEOPEN 0x001 #define SWB_USETAB 0x002 @@ -663,7 +665,7 @@ EXTERN char_u *p_tc; ///< 'tagcase' EXTERN unsigned tc_flags; ///< flags from 'tagcase' #ifdef IN_OPTION_C static char *(p_tc_values[]) = - { "followic", "ignore", "match", "followscs", "smart", NULL }; +{ "followic", "ignore", "match", "followscs", "smart", NULL }; #endif #define TC_FOLLOWIC 0x01 #define TC_IGNORE 0x02 @@ -701,35 +703,35 @@ EXTERN unsigned vop_flags; ///< uses SSOP_ flags EXTERN int p_vb; ///< 'visualbell' EXTERN char_u *p_ve; ///< 'virtualedit' EXTERN unsigned ve_flags; -# ifdef IN_OPTION_C -static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", NULL}; -# endif -# define VE_BLOCK 5 // includes "all" -# define VE_INSERT 6 // includes "all" -# define VE_ALL 4 -# define VE_ONEMORE 8 +#ifdef IN_OPTION_C +static char *(p_ve_values[]) = { "block", "insert", "all", "onemore", NULL }; +#endif +#define VE_BLOCK 5 // includes "all" +#define VE_INSERT 6 // includes "all" +#define VE_ALL 4 +#define VE_ONEMORE 8 EXTERN long p_verbose; // 'verbose' #ifdef IN_OPTION_C char_u *p_vfile = (char_u *)""; // used before options are initialized #else -extern char_u *p_vfile; // 'verbosefile' +extern char_u *p_vfile; // 'verbosefile' #endif EXTERN int p_warn; // 'warn' -EXTERN char_u *p_wop; // 'wildoptions' +EXTERN char_u *p_wop; // 'wildoptions' EXTERN unsigned wop_flags; -# ifdef IN_OPTION_C +#ifdef IN_OPTION_C static char *(p_wop_values[]) = { "tagfile", "pum", NULL }; #endif #define WOP_TAGFILE 0x01 #define WOP_PUM 0x02 EXTERN long p_window; // 'window' -EXTERN char_u *p_wak; // 'winaltkeys' -EXTERN char_u *p_wig; // 'wildignore' -EXTERN char_u *p_ww; // 'whichwrap' +EXTERN char_u *p_wak; // 'winaltkeys' +EXTERN char_u *p_wig; // 'wildignore' +EXTERN char_u *p_ww; // 'whichwrap' EXTERN long p_wc; // 'wildchar' EXTERN long p_wcm; // 'wildcharm' EXTERN int p_wic; // 'wildignorecase' -EXTERN char_u *p_wim; // 'wildmode' +EXTERN char_u *p_wim; // 'wildmode' EXTERN int p_wmnu; // 'wildmenu' EXTERN long p_wh; // 'winheight' EXTERN long p_wmh; // 'winminheight' diff --git a/src/nvim/os_unix.h b/src/nvim/os_unix.h index d627b16ec0..aae05f7fcc 100644 --- a/src/nvim/os_unix.h +++ b/src/nvim/os_unix.h @@ -1,8 +1,8 @@ #ifndef NVIM_OS_UNIX_H #define NVIM_OS_UNIX_H -#include "nvim/types.h" // for vim_acl_T #include "nvim/os/shell.h" +#include "nvim/types.h" // for vim_acl_T #ifdef INCLUDE_GENERATED_DECLARATIONS # include "os_unix.h.generated.h" diff --git a/src/nvim/path.h b/src/nvim/path.h index 15abd19646..5d81e68caa 100644 --- a/src/nvim/path.h +++ b/src/nvim/path.h @@ -2,22 +2,22 @@ #define NVIM_PATH_H #include "nvim/func_attr.h" -#include "nvim/types.h" #include "nvim/garray.h" +#include "nvim/types.h" -/* Flags for expand_wildcards() */ -#define EW_DIR 0x01 /* include directory names */ -#define EW_FILE 0x02 /* include file names */ -#define EW_NOTFOUND 0x04 /* include not found names */ -#define EW_ADDSLASH 0x08 /* append slash to directory name */ -#define EW_KEEPALL 0x10 /* keep all matches */ -#define EW_SILENT 0x20 /* don't print "1 returned" from shell */ -#define EW_EXEC 0x40 /* executable files */ -#define EW_PATH 0x80 /* search in 'path' too */ -#define EW_ICASE 0x100 /* ignore case */ -#define EW_NOERROR 0x200 /* no error for bad regexp */ -#define EW_NOTWILD 0x400 /* add match with literal name if exists */ -#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */ +// Flags for expand_wildcards() +#define EW_DIR 0x01 // include directory names +#define EW_FILE 0x02 // include file names +#define EW_NOTFOUND 0x04 // include not found names +#define EW_ADDSLASH 0x08 // append slash to directory name +#define EW_KEEPALL 0x10 // keep all matches +#define EW_SILENT 0x20 // don't print "1 returned" from shell +#define EW_EXEC 0x40 // executable files +#define EW_PATH 0x80 // search in 'path' too +#define EW_ICASE 0x100 // ignore case +#define EW_NOERROR 0x200 // no error for bad regexp +#define EW_NOTWILD 0x400 // add match with literal name if exists +#define EW_KEEPDOLLAR 0x800 // do not escape $, $var is expanded /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND * is used when executing commands and EW_SILENT for interactive expanding. */ #define EW_ALLLINKS 0x1000 // also links not pointing to existing file diff --git a/src/nvim/popupmnu.h b/src/nvim/popupmnu.h index 7956e50a93..7d3f4c6f51 100644 --- a/src/nvim/popupmnu.h +++ b/src/nvim/popupmnu.h @@ -1,10 +1,10 @@ #ifndef NVIM_POPUPMNU_H #define NVIM_POPUPMNU_H -#include "nvim/vim.h" -#include "nvim/macros.h" #include "nvim/grid_defs.h" +#include "nvim/macros.h" #include "nvim/types.h" +#include "nvim/vim.h" /// Used for popup menu items. typedef struct { diff --git a/src/nvim/pos.h b/src/nvim/pos.h index b7c4b6ef92..2fbd049aa0 100644 --- a/src/nvim/pos.h +++ b/src/nvim/pos.h @@ -26,8 +26,8 @@ enum { MINCOL = 1 }; * position in file or buffer */ typedef struct { - linenr_T lnum; /* line number */ - colnr_T col; /* column number */ + linenr_T lnum; // line number + colnr_T col; // column number colnr_T coladd; } pos_T; @@ -36,8 +36,8 @@ typedef struct { * Same, but without coladd. */ typedef struct { - linenr_T lnum; /* line number */ - colnr_T col; /* column number */ + linenr_T lnum; // line number + colnr_T col; // column number } lpos_T; #endif // NVIM_POS_H diff --git a/src/nvim/profile.h b/src/nvim/profile.h index 7b378577ce..17c35c5eb7 100644 --- a/src/nvim/profile.h +++ b/src/nvim/profile.h @@ -7,8 +7,8 @@ typedef uint64_t proftime_T; #define TIME_MSG(s) do { \ - if (time_fd != NULL) time_msg(s, NULL); \ - } while (0) + if (time_fd != NULL) time_msg(s, NULL); \ +} while (0) #ifdef INCLUDE_GENERATED_DECLARATIONS # include "profile.h.generated.h" diff --git a/src/nvim/quickfix.h b/src/nvim/quickfix.h index fdeb8d1a2f..f5178e332a 100644 --- a/src/nvim/quickfix.h +++ b/src/nvim/quickfix.h @@ -1,10 +1,10 @@ #ifndef NVIM_QUICKFIX_H #define NVIM_QUICKFIX_H -#include "nvim/types.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/types.h" -/* flags for skip_vimgrep_pat() */ +// flags for skip_vimgrep_pat() #define VGR_GLOBAL 1 #define VGR_NOJUMP 2 diff --git a/src/nvim/rbuffer.h b/src/nvim/rbuffer.h index a8dfcac580..cc690050ab 100644 --- a/src/nvim/rbuffer.h +++ b/src/nvim/rbuffer.h @@ -38,17 +38,17 @@ // create infinite loops #define RBUFFER_UNTIL_EMPTY(buf, rptr, rcnt) \ for (size_t rcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \ - for ( /* NOLINT(readability/braces) */ \ - char *rptr = rbuffer_read_ptr(buf, &rcnt); \ - buf->size; \ - rptr = rbuffer_read_ptr(buf, &rcnt)) + for ( /* NOLINT(readability/braces) */ \ + char *rptr = rbuffer_read_ptr(buf, &rcnt); \ + buf->size; \ + rptr = rbuffer_read_ptr(buf, &rcnt)) #define RBUFFER_UNTIL_FULL(buf, wptr, wcnt) \ for (size_t wcnt = 0, _r = 1; _r; _r = 0) /* NOLINT(readability/braces) */ \ - for ( /* NOLINT(readability/braces) */ \ - char *wptr = rbuffer_write_ptr(buf, &wcnt); \ - rbuffer_space(buf); \ - wptr = rbuffer_write_ptr(buf, &wcnt)) + for ( /* NOLINT(readability/braces) */ \ + char *wptr = rbuffer_write_ptr(buf, &wcnt); \ + rbuffer_space(buf); \ + wptr = rbuffer_write_ptr(buf, &wcnt)) // Iteration @@ -56,23 +56,23 @@ for (size_t i = 0; /* NOLINT(readability/braces) */ \ i < buf->size; \ i = buf->size) \ - for (char c = 0; /* NOLINT(readability/braces) */ \ - i < buf->size ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \ - i++) + for (char c = 0; /* NOLINT(readability/braces) */ \ + i < buf->size ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \ + i++) #define RBUFFER_EACH_REVERSE(buf, c, i) \ for (size_t i = buf->size; /* NOLINT(readability/braces) */ \ i != SIZE_MAX; \ i = SIZE_MAX) \ - for (char c = 0; /* NOLINT(readability/braces) */ \ - i-- > 0 ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \ - ) + for (char c = 0; /* NOLINT(readability/braces) */ \ + i-- > 0 ? ((int)(c = *rbuffer_get(buf, i))) || 1 : 0; \ + ) typedef struct rbuffer RBuffer; /// Type of function invoked during certain events: /// - When the RBuffer switches to the full state /// - When the RBuffer switches to the non-full state -typedef void(*rbuffer_callback)(RBuffer *buf, void *data); +typedef void (*rbuffer_callback)(RBuffer *buf, void *data); struct rbuffer { rbuffer_callback full_cb, nonfull_cb; diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 98a46cf781..ea4f2ecaf1 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -1,6 +1,8 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com +// uncrustify:off + /* * Handling of regular expressions: vim_regcomp(), vim_regexec(), vim_regsub() * diff --git a/src/nvim/regexp.h b/src/nvim/regexp.h index 74ed34188c..9527afed58 100644 --- a/src/nvim/regexp.h +++ b/src/nvim/regexp.h @@ -1,9 +1,9 @@ #ifndef NVIM_REGEXP_H #define NVIM_REGEXP_H -#include "nvim/types.h" #include "nvim/buffer_defs.h" #include "nvim/regexp_defs.h" +#include "nvim/types.h" // Second argument for vim_regcomp(). #define RE_MAGIC 1 ///< 'magic' option diff --git a/src/nvim/regexp_defs.h b/src/nvim/regexp_defs.h index a729a91555..1d112bd64a 100644 --- a/src/nvim/regexp_defs.h +++ b/src/nvim/regexp_defs.h @@ -15,8 +15,8 @@ #include <stdbool.h> #include "nvim/pos.h" -#include "nvim/types.h" #include "nvim/profile.h" +#include "nvim/types.h" /* * The number of sub-matches is limited to 10. @@ -53,7 +53,7 @@ typedef struct reg_extmatch reg_extmatch_T; /// always 0. /// When there is no match, the line number is -1. typedef struct { - regprog_T *regprog; + regprog_T *regprog; lpos_T startpos[NSUBEXP]; lpos_T endpos[NSUBEXP]; int rmm_ic; @@ -90,7 +90,7 @@ typedef struct { int regstart; char_u reganch; - char_u *regmust; + char_u *regmust; int regmlen; char_u reghasz; char_u program[1]; // actually longer.. @@ -101,8 +101,8 @@ typedef struct { typedef struct nfa_state nfa_state_T; struct nfa_state { int c; - nfa_state_T *out; - nfa_state_T *out1; + nfa_state_T *out; + nfa_state_T *out1; int id; int lastlist[2]; // 0: normal, 1: recursive int val; @@ -119,16 +119,16 @@ typedef struct { unsigned re_flags; bool re_in_use; - nfa_state_T *start; // points into state[] + nfa_state_T *start; // points into state[] int reganch; // pattern starts with ^ int regstart; // char at start of pattern - char_u *match_text; // plain text to match with + char_u *match_text; // plain text to match with int has_zend; // pattern contains \ze int has_backref; // pattern contains \1 .. \9 int reghasz; - char_u *pattern; + char_u *pattern; int nsubexp; // number of () int nstate; nfa_state_T state[1]; // actually longer.. @@ -140,10 +140,10 @@ typedef struct { * When there is no match, the pointer is NULL. */ typedef struct { - regprog_T *regprog; - char_u *startp[NSUBEXP]; - char_u *endp[NSUBEXP]; - bool rm_ic; + regprog_T *regprog; + char_u *startp[NSUBEXP]; + char_u *endp[NSUBEXP]; + bool rm_ic; } regmatch_T; /* @@ -153,16 +153,16 @@ typedef struct { */ struct reg_extmatch { int16_t refcnt; - char_u *matches[NSUBEXP]; + char_u *matches[NSUBEXP]; }; struct regengine { - regprog_T *(*regcomp)(char_u *, int); + regprog_T *(*regcomp)(char_u *, int); void (*regfree)(regprog_T *); int (*regexec_nl)(regmatch_T *, char_u *, colnr_T, bool); long (*regexec_multi)(regmmatch_T *, win_T *, buf_T *, linenr_T, colnr_T, proftime_T *, int *); - char_u *expr; + char_u *expr; }; #endif // NVIM_REGEXP_DEFS_H diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 039f9b4675..ec213d0adf 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -1,6 +1,8 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com +// uncrustify:off + /* * NFA regular expression implementation. * diff --git a/src/nvim/screen.h b/src/nvim/screen.h index 5f339b9ae2..d704a6eb8a 100644 --- a/src/nvim/screen.h +++ b/src/nvim/screen.h @@ -3,10 +3,10 @@ #include <stdbool.h> -#include "nvim/types.h" #include "nvim/buffer_defs.h" #include "nvim/grid_defs.h" #include "nvim/pos.h" +#include "nvim/types.h" /* * flags for update_screen() @@ -14,12 +14,12 @@ */ #define VALID 10 /* buffer not changed, or changes marked with b_mod_* */ -#define INVERTED 20 /* redisplay inverted part that changed */ -#define INVERTED_ALL 25 /* redisplay whole inverted part */ -#define REDRAW_TOP 30 /* display first w_upd_rows screen lines */ -#define SOME_VALID 35 /* like NOT_VALID but may scroll */ -#define NOT_VALID 40 /* buffer needs complete redraw */ -#define CLEAR 50 /* screen messed up, clear it */ +#define INVERTED 20 // redisplay inverted part that changed +#define INVERTED_ALL 25 // redisplay whole inverted part +#define REDRAW_TOP 30 // display first w_upd_rows screen lines +#define SOME_VALID 35 // like NOT_VALID but may scroll +#define NOT_VALID 40 // buffer needs complete redraw +#define CLEAR 50 // screen messed up, clear it /// By default, all widows are draw on a single rectangular grid, represented by /// this ScreenGrid instance. In multigrid mode each window will have its own diff --git a/src/nvim/search.h b/src/nvim/search.h index 0dbaf79c37..85bcda84a4 100644 --- a/src/nvim/search.h +++ b/src/nvim/search.h @@ -4,14 +4,14 @@ #include <stdbool.h> #include <stdint.h> -#include "nvim/vim.h" #include "nvim/buffer_defs.h" #include "nvim/eval/funcs.h" #include "nvim/eval/typval.h" #include "nvim/normal.h" #include "nvim/os/time.h" +#include "nvim/vim.h" -/* Values for the find_pattern_in_path() function args 'type' and 'action': */ +// Values for the find_pattern_in_path() function args 'type' and 'action': #define FIND_ANY 1 #define FIND_DEFINE 2 #define CHECK_PATH 3 @@ -37,18 +37,18 @@ #define SEARCH_PEEK 0x800 ///< peek for typed char, cancel search #define SEARCH_COL 0x1000 ///< start at specified column instead of zero -/* Values for flags argument for findmatchlimit() */ -#define FM_BACKWARD 0x01 /* search backwards */ -#define FM_FORWARD 0x02 /* search forwards */ -#define FM_BLOCKSTOP 0x04 /* stop at start/end of block */ -#define FM_SKIPCOMM 0x08 /* skip comments */ +// Values for flags argument for findmatchlimit() +#define FM_BACKWARD 0x01 // search backwards +#define FM_FORWARD 0x02 // search forwards +#define FM_BLOCKSTOP 0x04 // stop at start/end of block +#define FM_SKIPCOMM 0x08 // skip comments -/* Values for sub_cmd and which_pat argument for search_regcomp() */ -/* Also used for which_pat argument for searchit() */ -#define RE_SEARCH 0 /* save/use pat in/from search_pattern */ -#define RE_SUBST 1 /* save/use pat in/from subst_pattern */ -#define RE_BOTH 2 /* save pat in both patterns */ -#define RE_LAST 2 /* use last used pattern if "pat" is NULL */ +// Values for sub_cmd and which_pat argument for search_regcomp() +// Also used for which_pat argument for searchit() +#define RE_SEARCH 0 // save/use pat in/from search_pattern +#define RE_SUBST 1 // save/use pat in/from subst_pattern +#define RE_BOTH 2 // save pat in both patterns +#define RE_LAST 2 // use last used pattern if "pat" is NULL // Values for searchcount() #define SEARCH_STAT_DEF_TIMEOUT 40L @@ -78,21 +78,21 @@ typedef struct spat { /// Optional extra arguments for searchit(). typedef struct { - linenr_T sa_stop_lnum; ///< stop after this line number when != 0 - proftime_T *sa_tm; ///< timeout limit or NULL - int sa_timed_out; ///< set when timed out - int sa_wrapped; ///< search wrapped around + linenr_T sa_stop_lnum; ///< stop after this line number when != 0 + proftime_T *sa_tm; ///< timeout limit or NULL + int sa_timed_out; ///< set when timed out + int sa_wrapped; ///< search wrapped around } searchit_arg_T; typedef struct searchstat { - int cur; // current position of found words - int cnt; // total count of found words - bool exact_match; // true if matched exactly on specified position - int incomplete; // 0: search was fully completed - // 1: recomputing was timed out - // 2: max count exceeded - int last_maxcount; // the max count of the last search + int cur; // current position of found words + int cnt; // total count of found words + bool exact_match; // true if matched exactly on specified position + int incomplete; // 0: search was fully completed + // 1: recomputing was timed out + // 2: max count exceeded + int last_maxcount; // the max count of the last search } searchstat_T; #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/sha256.h b/src/nvim/sha256.h index deb881a288..b52d300de6 100644 --- a/src/nvim/sha256.h +++ b/src/nvim/sha256.h @@ -1,8 +1,8 @@ #ifndef NVIM_SHA256_H #define NVIM_SHA256_H -#include <stdint.h> // for uint32_t #include <stddef.h> +#include <stdint.h> // for uint32_t #include "nvim/types.h" // for char_u diff --git a/src/nvim/sign.h b/src/nvim/sign.h index e3a5a27c74..9044c2d0bb 100644 --- a/src/nvim/sign.h +++ b/src/nvim/sign.h @@ -2,6 +2,7 @@ #define NVIM_SIGN_H #include <stdbool.h> + #include "nvim/buffer_defs.h" #include "nvim/ex_cmds_defs.h" #include "nvim/sign_defs.h" diff --git a/src/nvim/sign_defs.h b/src/nvim/sign_defs.h index 721b2db25b..f3ec2c45f6 100644 --- a/src/nvim/sign_defs.h +++ b/src/nvim/sign_defs.h @@ -2,6 +2,7 @@ #define NVIM_SIGN_DEFS_H #include <stdbool.h> + #include "nvim/pos.h" #include "nvim/types.h" @@ -10,9 +11,9 @@ // Sign group typedef struct signgroup_S { - uint16_t sg_refcount; // number of signs in this group - int sg_next_sign_id; // next sign id for this group - char_u sg_name[1]; // sign group name + uint16_t sg_refcount; // number of signs in this group + int sg_next_sign_id; // next sign id for this group + char_u sg_name[1]; // sign group name } signgroup_T; // Macros to get the sign group structure from the group name @@ -22,23 +23,23 @@ typedef struct signgroup_S typedef struct sign_entry sign_entry_T; struct sign_entry { - int se_id; // unique identifier for each placed sign - int se_typenr; // typenr of sign - int se_priority; // priority for highlighting - bool se_has_text_or_icon; // has text or icon - linenr_T se_lnum; // line number which has this sign - signgroup_T *se_group; // sign group - sign_entry_T *se_next; // next entry in a list of signs - sign_entry_T *se_prev; // previous entry -- for easy reordering + int se_id; // unique identifier for each placed sign + int se_typenr; // typenr of sign + int se_priority; // priority for highlighting + bool se_has_text_or_icon; // has text or icon + linenr_T se_lnum; // line number which has this sign + signgroup_T *se_group; // sign group + sign_entry_T *se_next; // next entry in a list of signs + sign_entry_T *se_prev; // previous entry -- for easy reordering }; /// Sign attributes. Used by the screen refresh routines. typedef struct sign_attrs_S { - int sat_typenr; - char_u *sat_text; - int sat_texthl; - int sat_linehl; - int sat_numhl; + int sat_typenr; + char_u *sat_text; + int sat_texthl; + int sat_linehl; + int sat_numhl; } sign_attrs_T; #define SIGN_SHOW_MAX 9 diff --git a/src/nvim/spell.h b/src/nvim/spell.h index e93c82b91d..f941f0e5e7 100644 --- a/src/nvim/spell.h +++ b/src/nvim/spell.h @@ -3,9 +3,9 @@ #include <stdbool.h> -#include "nvim/spell_defs.h" #include "nvim/ex_cmds_defs.h" #include "nvim/globals.h" +#include "nvim/spell_defs.h" #include "nvim/vim.h" #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h index f07f5673f9..78aa6bf199 100644 --- a/src/nvim/spell_defs.h +++ b/src/nvim/spell_defs.h @@ -20,9 +20,9 @@ // is 8 bytes we could use something smaller, but what? typedef int idx_T; -# define SPL_FNAME_TMPL "%s.%s.spl" -# define SPL_FNAME_ADD ".add." -# define SPL_FNAME_ASCII ".ascii." +#define SPL_FNAME_TMPL "%s.%s.spl" +#define SPL_FNAME_ADD ".add." +#define SPL_FNAME_ASCII ".ascii." // Flags used for a word. Only the lowest byte can be used, the region byte // comes above it. @@ -71,22 +71,22 @@ typedef int idx_T; // si_repsal, sl_rep, and si_sal. Not for sl_sal! // One replacement: from "ft_from" to "ft_to". typedef struct fromto_S { - char_u *ft_from; - char_u *ft_to; + char_u *ft_from; + char_u *ft_to; } fromto_T; // Info from "SAL" entries in ".aff" file used in sl_sal. // The info is split for quick processing by spell_soundfold(). // Note that "sm_oneof" and "sm_rules" point into sm_lead. typedef struct salitem_S { - char_u *sm_lead; // leading letters + char_u *sm_lead; // leading letters int sm_leadlen; // length of "sm_lead" - char_u *sm_oneof; // letters from () or NULL - char_u *sm_rules; // rules like ^, $, priority - char_u *sm_to; // replacement. - int *sm_lead_w; // wide character copy of "sm_lead" - int *sm_oneof_w; // wide character copy of "sm_oneof" - int *sm_to_w; // wide character copy of "sm_to" + char_u *sm_oneof; // letters from () or NULL + char_u *sm_rules; // rules like ^, $, priority + char_u *sm_to; // replacement. + int *sm_lead_w; // wide character copy of "sm_lead" + int *sm_oneof_w; // wide character copy of "sm_oneof" + int *sm_to_w; // wide character copy of "sm_to" } salitem_T; typedef int salfirst_T; @@ -113,25 +113,25 @@ typedef int salfirst_T; typedef struct slang_S slang_T; struct slang_S { - slang_T *sl_next; // next language - char_u *sl_name; // language name "en", "en.rare", "nl", etc. - char_u *sl_fname; // name of .spl file + slang_T *sl_next; // next language + char_u *sl_name; // language name "en", "en.rare", "nl", etc. + char_u *sl_fname; // name of .spl file bool sl_add; // true if it's a .add file. - char_u *sl_fbyts; // case-folded word bytes - long sl_fbyts_len; // length of sl_fbyts - idx_T *sl_fidxs; // case-folded word indexes - char_u *sl_kbyts; // keep-case word bytes - idx_T *sl_kidxs; // keep-case word indexes - char_u *sl_pbyts; // prefix tree word bytes - idx_T *sl_pidxs; // prefix tree word indexes + char_u *sl_fbyts; // case-folded word bytes + long sl_fbyts_len; // length of sl_fbyts + idx_T *sl_fidxs; // case-folded word indexes + char_u *sl_kbyts; // keep-case word bytes + idx_T *sl_kidxs; // keep-case word indexes + char_u *sl_pbyts; // prefix tree word bytes + idx_T *sl_pidxs; // prefix tree word indexes - char_u *sl_info; // infotext string or NULL + char_u *sl_info; // infotext string or NULL char_u sl_regions[MAXREGIONS * 2 + 1]; - // table with up to 8 region names plus NUL + // table with up to 8 region names plus NUL - char_u *sl_midword; // MIDWORD string or NULL + char_u *sl_midword; // MIDWORD string or NULL hashtab_T sl_wordcount; // hashtable with word count, wordcount_T @@ -140,17 +140,17 @@ struct slang_S { int sl_compsylmax; // COMPOUNDSYLMAX (default: MAXWLEN) int sl_compoptions; // COMP_* flags garray_T sl_comppat; // CHECKCOMPOUNDPATTERN items - regprog_T *sl_compprog; // COMPOUNDRULE turned into a regexp progrm - // (NULL when no compounding) - char_u *sl_comprules; // all COMPOUNDRULE concatenated (or NULL) - char_u *sl_compstartflags; // flags for first compound word - char_u *sl_compallflags; // all flags for compound words + regprog_T *sl_compprog; // COMPOUNDRULE turned into a regexp progrm + // (NULL when no compounding) + char_u *sl_comprules; // all COMPOUNDRULE concatenated (or NULL) + char_u *sl_compstartflags; // flags for first compound word + char_u *sl_compallflags; // all flags for compound words bool sl_nobreak; // When true: no spaces between words - char_u *sl_syllable; // SYLLABLE repeatable chars or NULL + char_u *sl_syllable; // SYLLABLE repeatable chars or NULL garray_T sl_syl_items; // syllable items int sl_prefixcnt; // number of items in "sl_prefprog" - regprog_T **sl_prefprog; // table with regprogs for prefixes + regprog_T **sl_prefprog; // table with regprogs for prefixes garray_T sl_rep; // list of fromto_T entries from REP lines int16_t sl_rep_first[256]; // indexes where byte first appears, -1 if @@ -171,9 +171,9 @@ struct slang_S { // Info from the .sug file. Loaded on demand. time_t sl_sugtime; // timestamp for .sug file - char_u *sl_sbyts; // soundfolded word bytes - idx_T *sl_sidxs; // soundfolded word indexes - buf_T *sl_sugbuf; // buffer with word number table + char_u *sl_sbyts; // soundfolded word bytes + idx_T *sl_sidxs; // soundfolded word indexes + buf_T *sl_sugbuf; // buffer with word number table bool sl_sugloaded; // true when .sug file was loaded or failed to // load @@ -186,9 +186,9 @@ struct slang_S { // Structure used in "b_langp", filled from 'spelllang'. typedef struct langp_S { - slang_T *lp_slang; // info for this language - slang_T *lp_sallang; // language used for sound folding or NULL - slang_T *lp_replang; // language used for REP items or NULL + slang_T *lp_slang; // info for this language + slang_T *lp_sallang; // language used for sound folding or NULL + slang_T *lp_replang; // language used for REP items or NULL int lp_region; // bitmask for region or REGION_ALL } langp_T; @@ -268,7 +268,7 @@ typedef struct trystate_S { #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]) + : (int)spelltab.st_upper[c]) #define SPELL_ISUPPER(c) ((c) >= 128 ? mb_isupper(c) : spelltab.st_isu[c]) diff --git a/src/nvim/spellfile.h b/src/nvim/spellfile.h index 633ee014a7..235bc07f61 100644 --- a/src/nvim/spellfile.h +++ b/src/nvim/spellfile.h @@ -3,9 +3,9 @@ #include <stdbool.h> +#include "nvim/ex_cmds_defs.h" #include "nvim/spell_defs.h" #include "nvim/types.h" -#include "nvim/ex_cmds_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "spellfile.h.generated.h" diff --git a/src/nvim/state.h b/src/nvim/state.h index 8027514148..b93d57d035 100644 --- a/src/nvim/state.h +++ b/src/nvim/state.h @@ -5,8 +5,8 @@ typedef struct vim_state VimState; -typedef int(*state_check_callback)(VimState *state); -typedef int(*state_execute_callback)(VimState *state, int key); +typedef int (*state_check_callback)(VimState *state); +typedef int (*state_execute_callback)(VimState *state, int key); struct vim_state { state_check_callback check; diff --git a/src/nvim/strings.h b/src/nvim/strings.h index f2876c6307..893b0ea269 100644 --- a/src/nvim/strings.h +++ b/src/nvim/strings.h @@ -1,12 +1,12 @@ #ifndef NVIM_STRINGS_H #define NVIM_STRINGS_H -#include <stdbool.h> #include <stdarg.h> +#include <stdbool.h> #include <string.h> -#include "nvim/types.h" #include "nvim/eval/typval.h" +#include "nvim/types.h" /// Append string to string and return pointer to the next byte /// diff --git a/src/nvim/syntax.h b/src/nvim/syntax.h index 38f848f178..e61c75c840 100644 --- a/src/nvim/syntax.h +++ b/src/nvim/syntax.h @@ -3,29 +3,29 @@ #include <stdbool.h> -#include "nvim/globals.h" #include "nvim/buffer_defs.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/globals.h" -#define HL_CONTAINED 0x01 /* not used on toplevel */ -#define HL_TRANSP 0x02 /* has no highlighting */ -#define HL_ONELINE 0x04 /* match within one line only */ -#define HL_HAS_EOL 0x08 /* end pattern that matches with $ */ -#define HL_SYNC_HERE 0x10 /* sync point after this item (syncing only) */ -#define HL_SYNC_THERE 0x20 /* sync point at current line (syncing only) */ -#define HL_MATCH 0x40 /* use match ID instead of item ID */ -#define HL_SKIPNL 0x80 /* nextgroup can skip newlines */ -#define HL_SKIPWHITE 0x100 /* nextgroup can skip white space */ -#define HL_SKIPEMPTY 0x200 /* nextgroup can skip empty lines */ -#define HL_KEEPEND 0x400 /* end match always kept */ -#define HL_EXCLUDENL 0x800 /* exclude NL from match */ -#define HL_DISPLAY 0x1000 /* only used for displaying, not syncing */ -#define HL_FOLD 0x2000 /* define fold */ -#define HL_EXTEND 0x4000 /* ignore a keepend */ -#define HL_MATCHCONT 0x8000 /* match continued from previous line */ -#define HL_TRANS_CONT 0x10000 /* transparent item without contains arg */ -#define HL_CONCEAL 0x20000 /* can be concealed */ -#define HL_CONCEALENDS 0x40000 /* can be concealed */ +#define HL_CONTAINED 0x01 // not used on toplevel +#define HL_TRANSP 0x02 // has no highlighting +#define HL_ONELINE 0x04 // match within one line only +#define HL_HAS_EOL 0x08 // end pattern that matches with $ +#define HL_SYNC_HERE 0x10 // sync point after this item (syncing only) +#define HL_SYNC_THERE 0x20 // sync point at current line (syncing only) +#define HL_MATCH 0x40 // use match ID instead of item ID +#define HL_SKIPNL 0x80 // nextgroup can skip newlines +#define HL_SKIPWHITE 0x100 // nextgroup can skip white space +#define HL_SKIPEMPTY 0x200 // nextgroup can skip empty lines +#define HL_KEEPEND 0x400 // end match always kept +#define HL_EXCLUDENL 0x800 // exclude NL from match +#define HL_DISPLAY 0x1000 // only used for displaying, not syncing +#define HL_FOLD 0x2000 // define fold +#define HL_EXTEND 0x4000 // ignore a keepend +#define HL_MATCHCONT 0x8000 // match continued from previous line +#define HL_TRANS_CONT 0x10000 // transparent item without contains arg +#define HL_CONCEAL 0x20000 // can be concealed +#define HL_CONCEALENDS 0x40000 // can be concealed #define SYN_GROUP_STATIC(s) syn_check_group((char_u *)S_LEN(s)) diff --git a/src/nvim/syntax_defs.h b/src/nvim/syntax_defs.h index 5ee0611d58..526be905e9 100644 --- a/src/nvim/syntax_defs.h +++ b/src/nvim/syntax_defs.h @@ -3,18 +3,18 @@ #include "nvim/highlight_defs.h" -# define SST_MIN_ENTRIES 150 /* minimal size for state stack array */ -# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */ -# define SST_FIX_STATES 7 /* size of sst_stack[]. */ -# define SST_DIST 16 /* normal distance between entries */ -# define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */ +#define SST_MIN_ENTRIES 150 // minimal size for state stack array +#define SST_MAX_ENTRIES 1000 // maximal size for state stack array +#define SST_FIX_STATES 7 // size of sst_stack[]. +#define SST_DIST 16 // normal distance between entries +#define SST_INVALID (synstate_T *)-1 // invalid syn_state pointer typedef struct syn_state synstate_T; #include "nvim/buffer_defs.h" #include "nvim/regexp_defs.h" -/* struct passed to in_id_list() */ +// struct passed to in_id_list() struct sp_syn { int inc_tag; // ":syn include" unique tag int16_t id; // highlight group ID of item @@ -27,7 +27,7 @@ struct sp_syn { typedef struct keyentry keyentry_T; struct keyentry { - keyentry_T *ke_next; // next entry with identical "keyword[]" + keyentry_T *ke_next; // next entry with identical "keyword[]" struct sp_syn k_syn; // struct passed to in_id_list() int16_t *next_list; // ID list for next match (if non-zero) int flags; @@ -39,11 +39,11 @@ struct keyentry { * Struct used to store one state of the state stack. */ typedef struct buf_state { - int bs_idx; /* index of pattern */ - int bs_flags; /* flags for pattern */ - int bs_seqnr; /* stores si_seqnr */ - int bs_cchar; /* stores si_cchar */ - reg_extmatch_T *bs_extmatch; /* external matches from start pattern */ + int bs_idx; // index of pattern + int bs_flags; // flags for pattern + int bs_seqnr; // stores si_seqnr + int bs_cchar; // stores si_cchar + reg_extmatch_T *bs_extmatch; // external matches from start pattern } bufstate_T; /* @@ -51,11 +51,11 @@ typedef struct buf_state { * Used by b_sst_array[]. */ struct syn_state { - synstate_T *sst_next; /* next entry in used or free list */ - linenr_T sst_lnum; /* line number for this state */ + synstate_T *sst_next; // next entry in used or free list + linenr_T sst_lnum; // line number for this state union { - bufstate_T sst_stack[SST_FIX_STATES]; /* short state stack */ - garray_T sst_ga; /* growarray for long state stack */ + bufstate_T sst_stack[SST_FIX_STATES]; // short state stack + garray_T sst_ga; // growarray for long state stack } sst_union; int sst_next_flags; // flags for sst_next_list int sst_stacksize; // number of states on the stack diff --git a/src/nvim/tag.h b/src/nvim/tag.h index 9f671043b3..64bacceb1b 100644 --- a/src/nvim/tag.h +++ b/src/nvim/tag.h @@ -1,24 +1,24 @@ #ifndef NVIM_TAG_H #define NVIM_TAG_H -#include "nvim/types.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/types.h" /* * Values for do_tag(). */ -#define DT_TAG 1 /* jump to newer position or same tag again */ -#define DT_POP 2 /* jump to older position */ -#define DT_NEXT 3 /* jump to next match of same tag */ -#define DT_PREV 4 /* jump to previous match of same tag */ -#define DT_FIRST 5 /* jump to first match of same tag */ -#define DT_LAST 6 /* jump to first match of same tag */ -#define DT_SELECT 7 /* jump to selection from list */ -#define DT_HELP 8 /* like DT_TAG, but no wildcards */ -#define DT_JUMP 9 /* jump to new tag or selection from list */ -#define DT_CSCOPE 10 /* cscope find command (like tjump) */ -#define DT_LTAG 11 /* tag using location list */ -#define DT_FREE 99 /* free cached matches */ +#define DT_TAG 1 // jump to newer position or same tag again +#define DT_POP 2 // jump to older position +#define DT_NEXT 3 // jump to next match of same tag +#define DT_PREV 4 // jump to previous match of same tag +#define DT_FIRST 5 // jump to first match of same tag +#define DT_LAST 6 // jump to first match of same tag +#define DT_SELECT 7 // jump to selection from list +#define DT_HELP 8 // like DT_TAG, but no wildcards +#define DT_JUMP 9 // jump to new tag or selection from list +#define DT_CSCOPE 10 // cscope find command (like tjump) +#define DT_LTAG 11 // tag using location list +#define DT_FREE 99 // free cached matches // // flags for find_tags(). @@ -40,11 +40,11 @@ * Structure used for get_tagfname(). */ typedef struct { - char_u *tn_tags; /* value of 'tags' when starting */ - char_u *tn_np; /* current position in tn_tags */ + char_u *tn_tags; // value of 'tags' when starting + char_u *tn_np; // current position in tn_tags int tn_did_filefind_init; int tn_hf_idx; - void *tn_search_ctx; + void *tn_search_ctx; } tagname_T; diff --git a/src/nvim/terminal.h b/src/nvim/terminal.h index f2b0e232c3..001adbadc3 100644 --- a/src/nvim/terminal.h +++ b/src/nvim/terminal.h @@ -1,8 +1,8 @@ #ifndef NVIM_TERMINAL_H #define NVIM_TERMINAL_H -#include <stddef.h> #include <stdbool.h> +#include <stddef.h> #include <stdint.h> typedef struct terminal Terminal; diff --git a/src/nvim/testdir/samples/memfile_test.c b/src/nvim/testdir/samples/memfile_test.c index 7023064637..73f67fb250 100644 --- a/src/nvim/testdir/samples/memfile_test.c +++ b/src/nvim/testdir/samples/memfile_test.c @@ -1,6 +1,8 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com +// uncrustify:off + /* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar diff --git a/src/nvim/tui/terminfo_defs.h b/src/nvim/tui/terminfo_defs.h index 8c328496c1..40261058dc 100644 --- a/src/nvim/tui/terminfo_defs.h +++ b/src/nvim/tui/terminfo_defs.h @@ -2276,6 +2276,3 @@ static const int8_t xterm_256colour_terminfo[] = { 30,2,37,0,38,0,15,0,-99,1,2,6,120,116,101,114,109,45,50,53,54,99,111,108,111,114,124,120,116,101,114,109,32,119,105,116,104,32,50,53,54,32,99,111,108,111,114,115,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1,0,80,0,0,0,8,0,0,0,24,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,0,0,0,0,1,0,0,0,4,0,6,0,8,0,25,0,30,0,38,0,42,0,46,0,-1,-1,57,0,74,0,76,0,80,0,87,0,-1,-1,89,0,102,0,-1,-1,106,0,110,0,120,0,124,0,-1,-1,-1,-1,-128,0,-124,0,-119,0,-114,0,-1,-1,-96,0,-91,0,-86,0,-1,-1,-81,0,-76,0,-71,0,-66,0,-57,0,-53,0,-46,0,-1,-1,-28,0,-23,0,-17,0,-11,0,-1,-1,-1,-1,-1,-1,7,1,-1,-1,-1,-1,-1,-1,25,1,-1,-1,29,1,-1,-1,-1,-1,-1,-1,31,1,-1,-1,36,1,-1,-1,-1,-1,-1,-1,-1,-1,40,1,44,1,50,1,54,1,58,1,62,1,68,1,74,1,80,1,86,1,92,1,96,1,-1,-1,101,1,-1,-1,105,1,110,1,115,1,119,1,126,1,-1,-1,-123,1,-119,1,-111,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-103,1,-94,1,-1,-1,-1,-1,-85,1,-76,1,-67,1,-58,1,-49,1,-40,1,-31,1,-22,1,-13,1,-4,1,-1,-1,-1,-1,-1,-1,5,2,9,2,14,2,19,2,39,2,48,2,-1,-1,-1,-1,66,2,69,2,80,2,83,2,85,2,88,2,-75,2,-1,-1,-72,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-70,2,-1,-1,-1,-1,-1,-1,-1,-1,-66,2,-1,-1,-13,2,-1,-1,-1,-1,-9,2,-3,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,3,7,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,3,-1,-1,-1,-1,18,3,-1,-1,-1,-1,-1,-1,-1,-1,25,3,32,3,39,3,-1,-1,-1,-1,46,3,-1,-1,53,3,-1,-1,-1,-1,-1,-1,60,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,67,3,73,3,79,3,86,3,93,3,100,3,107,3,115,3,123,3,-125,3,-117,3,-109,3,-101,3,-93,3,-85,3,-78,3,-71,3,-64,3,-57,3,-49,3,-41,3,-33,3,-25,3,-17,3,-9,3,-1,3,7,4,14,4,21,4,28,4,35,4,43,4,51,4,59,4,67,4,75,4,83,4,91,4,99,4,106,4,113,4,120,4,127,4,-121,4,-113,4,-105,4,-97,4,-89,4,-81,4,-73,4,-65,4,-58,4,-51,4,-44,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-39,4,-28,4,-23,4,-4,4,0,5,9,5,16,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,110,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,115,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,121,5,-1,-1,-1,-1,-1,-1,125,5,-68,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-4,5,-1,5,27,91,90,0,7,0,13,0,27,91,37,105,37,112,49,37,100,59,37,112,50,37,100,114,0,27,91,51,103,0,27,91,72,27,91,50,74,0,27,91,75,0,27,91,74,0,27,91,37,105,37,112,49,37,100,71,0,27,91,37,105,37,112,49,37,100,59,37,112,50,37,100,72,0,10,0,27,91,72,0,27,91,63,50,53,108,0,8,0,27,91,63,49,50,108,27,91,63,50,53,104,0,27,91,67,0,27,91,65,0,27,91,63,49,50,59,50,53,104,0,27,91,80,0,27,91,77,0,27,40,48,0,27,91,53,109,0,27,91,49,109,0,27,91,63,49,48,52,57,104,27,91,50,50,59,48,59,48,116,0,27,91,50,109,0,27,91,52,104,0,27,91,56,109,0,27,91,55,109,0,27,91,55,109,0,27,91,52,109,0,27,91,37,112,49,37,100,88,0,27,40,66,0,27,40,66,27,91,109,0,27,91,63,49,48,52,57,108,27,91,50,51,59,48,59,48,116,0,27,91,52,108,0,27,91,50,55,109,0,27,91,50,52,109,0,27,91,63,53,104,36,60,49,48,48,47,62,27,91,63,53,108,0,27,91,33,112,27,91,63,51,59,52,108,27,91,52,108,27,62,0,27,91,76,0,8,0,27,91,51,126,0,27,79,66,0,27,79,80,0,27,91,50,49,126,0,27,79,81,0,27,79,82,0,27,79,83,0,27,91,49,53,126,0,27,91,49,55,126,0,27,91,49,56,126,0,27,91,49,57,126,0,27,91,50,48,126,0,27,79,72,0,27,91,50,126,0,27,79,68,0,27,91,54,126,0,27,91,53,126,0,27,79,67,0,27,91,49,59,50,66,0,27,91,49,59,50,65,0,27,79,65,0,27,91,63,49,108,27,62,0,27,91,63,49,104,27,61,0,27,91,63,49,48,51,52,108,0,27,91,63,49,48,51,52,104,0,27,91,37,112,49,37,100,80,0,27,91,37,112,49,37,100,77,0,27,91,37,112,49,37,100,66,0,27,91,37,112,49,37,100,64,0,27,91,37,112,49,37,100,83,0,27,91,37,112,49,37,100,76,0,27,91,37,112,49,37,100,68,0,27,91,37,112,49,37,100,67,0,27,91,37,112,49,37,100,84,0,27,91,37,112,49,37,100,65,0,27,91,105,0,27,91,52,105,0,27,91,53,105,0,37,112,49,37,99,27,91,37,112,50,37,123,49,125,37,45,37,100,98,0,27,99,27,93,49,48,52,7,0,27,91,33,112,27,91,63,51,59,52,108,27,91,52,108,27,62,0,27,56,0,27,91,37,105,37,112,49,37,100,100,0,27,55,0,10,0,27,77,0,37,63,37,112,57,37,116,27,40,48,37,101,27,40,66,37,59,27,91,48,37,63,37,112,54,37,116,59,49,37,59,37,63,37,112,53,37,116,59,50,37,59,37,63,37,112,50,37,116,59,52,37,59,37,63,37,112,49,37,112,51,37,124,37,116,59,55,37,59,37,63,37,112,52,37,116,59,53,37,59,37,63,37,112,55,37,116,59,56,37,59,109,0,27,72,0,9,0,27,79,69,0,96,96,97,97,102,102,103,103,105,105,106,106,107,107,108,108,109,109,110,110,111,111,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,119,120,120,121,121,122,122,123,123,124,124,125,125,126,126,0,27,91,90,0,27,91,63,55,104,0,27,91,63,55,108,0,27,79,70,0,27,79,77,0,27,91,51,59,50,126,0,27,91,49,59,50,70,0,27,91,49,59,50,72,0,27,91,50,59,50,126,0,27,91,49,59,50,68,0,27,91,54,59,50,126,0,27,91,53,59,50,126,0,27,91,49,59,50,67,0,27,91,50,51,126,0,27,91,50,52,126,0,27,91,49,59,50,80,0,27,91,49,59,50,81,0,27,91,49,59,50,82,0,27,91,49,59,50,83,0,27,91,49,53,59,50,126,0,27,91,49,55,59,50,126,0,27,91,49,56,59,50,126,0,27,91,49,57,59,50,126,0,27,91,50,48,59,50,126,0,27,91,50,49,59,50,126,0,27,91,50,51,59,50,126,0,27,91,50,52,59,50,126,0,27,91,49,59,53,80,0,27,91,49,59,53,81,0,27,91,49,59,53,82,0,27,91,49,59,53,83,0,27,91,49,53,59,53,126,0,27,91,49,55,59,53,126,0,27,91,49,56,59,53,126,0,27,91,49,57,59,53,126,0,27,91,50,48,59,53,126,0,27,91,50,49,59,53,126,0,27,91,50,51,59,53,126,0,27,91,50,52,59,53,126,0,27,91,49,59,54,80,0,27,91,49,59,54,81,0,27,91,49,59,54,82,0,27,91,49,59,54,83,0,27,91,49,53,59,54,126,0,27,91,49,55,59,54,126,0,27,91,49,56,59,54,126,0,27,91,49,57,59,54,126,0,27,91,50,48,59,54,126,0,27,91,50,49,59,54,126,0,27,91,50,51,59,54,126,0,27,91,50,52,59,54,126,0,27,91,49,59,51,80,0,27,91,49,59,51,81,0,27,91,49,59,51,82,0,27,91,49,59,51,83,0,27,91,49,53,59,51,126,0,27,91,49,55,59,51,126,0,27,91,49,56,59,51,126,0,27,91,49,57,59,51,126,0,27,91,50,48,59,51,126,0,27,91,50,49,59,51,126,0,27,91,50,51,59,51,126,0,27,91,50,52,59,51,126,0,27,91,49,59,52,80,0,27,91,49,59,52,81,0,27,91,49,59,52,82,0,27,91,49,75,0,27,91,37,105,37,100,59,37,100,82,0,27,91,54,110,0,27,91,63,37,91,59,48,49,50,51,52,53,54,55,56,57,93,99,0,27,91,99,0,27,91,51,57,59,52,57,109,0,27,93,49,48,52,7,0,27,93,52,59,37,112,49,37,100,59,114,103,98,58,37,112,50,37,123,50,53,53,125,37,42,37,123,49,48,48,48,125,37,47,37,50,46,50,88,47,37,112,51,37,123,50,53,53,125,37,42,37,123,49,48,48,48,125,37,47,37,50,46,50,88,47,37,112,52,37,123,50,53,53,125,37,42,37,123,49,48,48,48,125,37,47,37,50,46,50,88,27,92,0,27,91,51,109,0,27,91,50,51,109,0,27,91,60,0,27,91,37,63,37,112,49,37,123,56,125,37,60,37,116,51,37,112,49,37,100,37,101,37,112,49,37,123,49,54,125,37,60,37,116,57,37,112,49,37,123,56,125,37,45,37,100,37,101,51,56,59,53,59,37,112,49,37,100,37,59,109,0,27,91,37,63,37,112,49,37,123,56,125,37,60,37,116,52,37,112,49,37,100,37,101,37,112,49,37,123,49,54,125,37,60,37,116,49,48,37,112,49,37,123,56,125,37,45,37,100,37,101,52,56,59,53,59,37,112,49,37,100,37,59,109,0,27,108,0,27,109,0,3,0,1,0,73,0,-106,0,115,3,1,0,1,0,-1,-1,-1,-1,0,0,7,0,-1,-1,19,0,24,0,-1,-1,42,0,48,0,-1,-1,58,0,-1,-1,-1,-1,90,0,97,0,104,0,111,0,118,0,125,0,-124,0,-117,0,-110,0,-103,0,-96,0,-89,0,-82,0,-75,0,-68,0,-61,0,-1,-1,-54,0,-47,0,-40,0,-33,0,-26,0,-1,-1,-19,0,-12,0,-5,0,2,1,9,1,16,1,23,1,30,1,37,1,44,1,51,1,58,1,65,1,72,1,79,1,86,1,93,1,100,1,107,1,114,1,121,1,-128,1,-121,1,-114,1,-107,1,-100,1,-93,1,-86,1,-79,1,-72,1,-65,1,-1,-1,-1,-1,-1,-1,-1,-1,-58,1,-52,1,-47,1,0,0,3,0,6,0,9,0,12,0,15,0,18,0,21,0,24,0,27,0,30,0,33,0,36,0,39,0,42,0,48,0,54,0,59,0,64,0,69,0,74,0,79,0,83,0,88,0,93,0,98,0,103,0,108,0,114,0,120,0,126,0,-124,0,-118,0,-112,0,-106,0,-100,0,-94,0,-88,0,-82,0,-76,0,-71,0,-66,0,-61,0,-56,0,-51,0,-45,0,-39,0,-33,0,-27,0,-21,0,-15,0,-9,0,-3,0,3,1,9,1,15,1,21,1,27,1,33,1,39,1,45,1,51,1,57,1,63,1,69,1,73,1,78,1,83,1,88,1,93,1,98,1,102,1,106,1,110,1,114,1,119,1,124,1,27,93,49,49,50,7,0,27,93,49,50,59,37,112,49,37,115,7,0,27,91,51,74,0,27,93,53,50,59,37,112,49,37,115,59,37,112,50,37,115,7,0,27,91,50,32,113,0,27,91,37,112,49,37,100,32,113,0,27,91,63,49,48,48,54,59,49,48,48,48,37,63,37,112,49,37,123,49,125,37,61,37,116,104,37,101,108,37,59,0,27,91,51,59,51,126,0,27,91,51,59,52,126,0,27,91,51,59,53,126,0,27,91,51,59,54,126,0,27,91,51,59,55,126,0,27,91,49,59,50,66,0,27,91,49,59,51,66,0,27,91,49,59,52,66,0,27,91,49,59,53,66,0,27,91,49,59,54,66,0,27,91,49,59,55,66,0,27,91,49,59,51,70,0,27,91,49,59,52,70,0,27,91,49,59,53,70,0,27,91,49,59,54,70,0,27,91,49,59,55,70,0,27,91,49,59,51,72,0,27,91,49,59,52,72,0,27,91,49,59,53,72,0,27,91,49,59,54,72,0,27,91,49,59,55,72,0,27,91,50,59,51,126,0,27,91,50,59,52,126,0,27,91,50,59,53,126,0,27,91,50,59,54,126,0,27,91,50,59,55,126,0,27,91,49,59,51,68,0,27,91,49,59,52,68,0,27,91,49,59,53,68,0,27,91,49,59,54,68,0,27,91,49,59,55,68,0,27,91,54,59,51,126,0,27,91,54,59,52,126,0,27,91,54,59,53,126,0,27,91,54,59,54,126,0,27,91,54,59,55,126,0,27,91,53,59,51,126,0,27,91,53,59,52,126,0,27,91,53,59,53,126,0,27,91,53,59,54,126,0,27,91,53,59,55,126,0,27,91,49,59,51,67,0,27,91,49,59,52,67,0,27,91,49,59,53,67,0,27,91,49,59,54,67,0,27,91,49,59,55,67,0,27,91,49,59,50,65,0,27,91,49,59,51,65,0,27,91,49,59,52,65,0,27,91,49,59,53,65,0,27,91,49,59,54,65,0,27,91,49,59,55,65,0,27,91,50,57,109,0,27,91,57,109,0,27,91,60,37,112,49,37,100,59,37,112,50,37,100,59,37,112,51,37,100,59,37,63,37,112,52,37,116,77,37,101,109,37,59,0,65,88,0,71,48,0,88,84,0,85,56,0,67,114,0,67,115,0,69,48,0,69,51,0,77,115,0,83,48,0,83,101,0,83,115,0,84,83,0,88,77,0,103,114,98,111,109,0,103,115,98,111,109,0,107,68,67,51,0,107,68,67,52,0,107,68,67,53,0,107,68,67,54,0,107,68,67,55,0,107,68,78,0,107,68,78,51,0,107,68,78,52,0,107,68,78,53,0,107,68,78,54,0,107,68,78,55,0,107,69,78,68,51,0,107,69,78,68,52,0,107,69,78,68,53,0,107,69,78,68,54,0,107,69,78,68,55,0,107,69,78,68,56,0,107,72,79,77,51,0,107,72,79,77,52,0,107,72,79,77,53,0,107,72,79,77,54,0,107,72,79,77,55,0,107,72,79,77,56,0,107,73,67,51,0,107,73,67,52,0,107,73,67,53,0,107,73,67,54,0,107,73,67,55,0,107,76,70,84,51,0,107,76,70,84,52,0,107,76,70,84,53,0,107,76,70,84,54,0,107,76,70,84,55,0,107,78,88,84,51,0,107,78,88,84,52,0,107,78,88,84,53,0,107,78,88,84,54,0,107,78,88,84,55,0,107,80,82,86,51,0,107,80,82,86,52,0,107,80,82,86,53,0,107,80,82,86,54,0,107,80,82,86,55,0,107,82,73,84,51,0,107,82,73,84,52,0,107,82,73,84,53,0,107,82,73,84,54,0,107,82,73,84,55,0,107,85,80,0,107,85,80,51,0,107,85,80,52,0,107,85,80,53,0,107,85,80,54,0,107,85,80,55,0,107,97,50,0,107,98,49,0,107,98,51,0,107,99,50,0,114,109,120,120,0,115,109,120,120,0,120,109,0 // NOLINT }; #endif // NVIM_TUI_TERMINFO_DEFS_H - -// uncrustify:on - diff --git a/src/nvim/types.h b/src/nvim/types.h index 2dbeecbf6d..604155c33e 100644 --- a/src/nvim/types.h +++ b/src/nvim/types.h @@ -1,8 +1,8 @@ #ifndef NVIM_TYPES_H #define NVIM_TYPES_H -#include <stdint.h> #include <stdbool.h> +#include <stdint.h> // dummy to pass an ACL to a function typedef void *vim_acl_T; diff --git a/src/nvim/ugrid.h b/src/nvim/ugrid.h index 19c2e99ebb..ae11153c61 100644 --- a/src/nvim/ugrid.h +++ b/src/nvim/ugrid.h @@ -1,8 +1,8 @@ #ifndef NVIM_UGRID_H #define NVIM_UGRID_H -#include "nvim/ui.h" #include "nvim/globals.h" +#include "nvim/ui.h" typedef struct ucell UCell; typedef struct ugrid UGrid; diff --git a/src/nvim/ui.h b/src/nvim/ui.h index d00243d35f..7cc0bd9eff 100644 --- a/src/nvim/ui.h +++ b/src/nvim/ui.h @@ -1,12 +1,12 @@ #ifndef NVIM_UI_H #define NVIM_UI_H -#include <stddef.h> #include <stdbool.h> +#include <stddef.h> #include <stdint.h> -#include "nvim/globals.h" #include "nvim/api/private/defs.h" +#include "nvim/globals.h" #include "nvim/highlight_defs.h" typedef enum { @@ -70,6 +70,7 @@ struct ui_t { #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui.h.generated.h" + # include "ui_events_call.h.generated.h" #endif diff --git a/src/nvim/ui_bridge.h b/src/nvim/ui_bridge.h index dba461550f..a62ed15621 100644 --- a/src/nvim/ui_bridge.h +++ b/src/nvim/ui_bridge.h @@ -5,11 +5,11 @@ #include <uv.h> -#include "nvim/ui.h" #include "nvim/event/defs.h" +#include "nvim/ui.h" typedef struct ui_bridge_data UIBridgeData; -typedef void(*ui_main_fn)(UIBridgeData *bridge, UI *ui); +typedef void (*ui_main_fn)(UIBridgeData *bridge, UI *ui); struct ui_bridge_data { UI bridge; // actual UI passed to ui_attach UI *ui; // UI pointer that will have its callback called in diff --git a/src/nvim/ui_compositor.h b/src/nvim/ui_compositor.h index 70e01c3a21..01538105cb 100644 --- a/src/nvim/ui_compositor.h +++ b/src/nvim/ui_compositor.h @@ -1,8 +1,8 @@ #ifndef NVIM_UI_COMPOSITOR_H #define NVIM_UI_COMPOSITOR_H -#include "nvim/ui.h" #include "nvim/event/defs.h" +#include "nvim/ui.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui_compositor.h.generated.h" diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 500845ec72..64d618c38f 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -3086,7 +3086,7 @@ void u_undoline(void) ml_replace(curbuf->b_u_line_lnum, curbuf->b_u_line_ptr, true); changed_bytes(curbuf->b_u_line_lnum, 0); extmark_splice_cols(curbuf, (int)curbuf->b_u_line_lnum-1, 0, (colnr_T)STRLEN(oldp), - (colnr_T)STRLEN(curbuf->b_u_line_ptr), kExtmarkUndo); + (colnr_T)STRLEN(curbuf->b_u_line_ptr), kExtmarkUndo); xfree(curbuf->b_u_line_ptr); curbuf->b_u_line_ptr = oldp; diff --git a/src/nvim/undo.h b/src/nvim/undo.h index 802cdc5583..f494d4de86 100644 --- a/src/nvim/undo.h +++ b/src/nvim/undo.h @@ -1,8 +1,8 @@ #ifndef NVIM_UNDO_H #define NVIM_UNDO_H -#include "nvim/undo_defs.h" #include "nvim/ex_cmds_defs.h" +#include "nvim/undo_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "undo.h.generated.h" diff --git a/src/nvim/undo_defs.h b/src/nvim/undo_defs.h index b46295a15d..3267b2f71e 100644 --- a/src/nvim/undo_defs.h +++ b/src/nvim/undo_defs.h @@ -3,32 +3,32 @@ #include <time.h> // for time_t -#include "nvim/pos.h" #include "nvim/extmark_defs.h" #include "nvim/mark_defs.h" +#include "nvim/pos.h" typedef struct u_header u_header_T; -/* Structure to store info about the Visual area. */ +// Structure to store info about the Visual area. typedef struct { - pos_T vi_start; /* start pos of last VIsual */ - pos_T vi_end; /* end position of last VIsual */ - int vi_mode; /* VIsual_mode of last VIsual */ - colnr_T vi_curswant; /* MAXCOL from w_curswant */ + pos_T vi_start; // start pos of last VIsual + pos_T vi_end; // end position of last VIsual + int vi_mode; // VIsual_mode of last VIsual + colnr_T vi_curswant; // MAXCOL from w_curswant } visualinfo_T; #include "nvim/buffer_defs.h" typedef struct u_entry u_entry_T; struct u_entry { - u_entry_T *ue_next; /* pointer to next entry in list */ - linenr_T ue_top; /* number of line above undo block */ - linenr_T ue_bot; /* number of line below undo block */ - linenr_T ue_lcount; /* linecount when u_save called */ - char_u **ue_array; /* array of lines in undo block */ - long ue_size; /* number of lines in ue_array */ + u_entry_T *ue_next; // pointer to next entry in list + linenr_T ue_top; // number of line above undo block + linenr_T ue_bot; // number of line below undo block + linenr_T ue_lcount; // linecount when u_save called + char_u **ue_array; // array of lines in undo block + long ue_size; // number of lines in ue_array #ifdef U_DEBUG - int ue_magic; /* magic number to check allocation */ + int ue_magic; // magic number to check allocation #endif }; @@ -36,26 +36,26 @@ struct u_header { /* The following have a pointer and a number. The number is used when * reading the undo file in u_read_undo() */ union { - u_header_T *ptr; /* pointer to next undo header in list */ + u_header_T *ptr; // pointer to next undo header in list long seq; } uh_next; union { - u_header_T *ptr; /* pointer to previous header in list */ + u_header_T *ptr; // pointer to previous header in list long seq; } uh_prev; union { - u_header_T *ptr; /* pointer to next header for alt. redo */ + u_header_T *ptr; // pointer to next header for alt. redo long seq; } uh_alt_next; union { - u_header_T *ptr; /* pointer to previous header for alt. redo */ + u_header_T *ptr; // pointer to previous header for alt. redo long seq; } uh_alt_prev; - long uh_seq; /* sequence number, higher == newer undo */ - int uh_walk; /* used by undo_time() */ - u_entry_T *uh_entry; /* pointer to first entry */ - u_entry_T *uh_getbot_entry; /* pointer to where ue_bot must be set */ - pos_T uh_cursor; /* cursor position before saving */ + long uh_seq; // sequence number, higher == newer undo + int uh_walk; // used by undo_time() + u_entry_T *uh_entry; // pointer to first entry + u_entry_T *uh_getbot_entry; // pointer to where ue_bot must be set + pos_T uh_cursor; // cursor position before saving long uh_cursor_vcol; int uh_flags; // see below fmark_T uh_namedm[NMARKS]; // marks before undo/after redo diff --git a/src/nvim/version.h b/src/nvim/version.h index 4af038dd6c..c3c884a078 100644 --- a/src/nvim/version.h +++ b/src/nvim/version.h @@ -5,8 +5,8 @@ #include "nvim/macros.h" // defined in version.c -extern char* Version; -extern char* longVersion; +extern char * Version; +extern char * longVersion; // // Vim version number, name, etc. Patchlevel is defined in version.c. diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 62536a0600..7d49ca6ff1 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -1,8 +1,8 @@ #ifndef NVIM_VIM_H #define NVIM_VIM_H -#include "nvim/types.h" #include "nvim/pos.h" // for linenr_T, MAXCOL, etc... +#include "nvim/types.h" // Some defines from the old feature.h #define SESSION_FILE "Session.vim" @@ -30,11 +30,10 @@ enum { NUMBUFLEN = 65 }; #define ROOT_UID 0 +#include "nvim/gettext.h" #include "nvim/keymap.h" #include "nvim/macros.h" -#include "nvim/gettext.h" - // special attribute addition: Put message in history #define MSG_HIST 0x1000 @@ -57,8 +56,8 @@ enum { NUMBUFLEN = 65 }; #define REPLACE_FLAG 0x40 // Replace mode flag #define REPLACE (REPLACE_FLAG + INSERT) -# define VREPLACE_FLAG 0x80 // Virtual-replace mode flag -# define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT) +#define VREPLACE_FLAG 0x80 // Virtual-replace mode flag +#define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT) #define LREPLACE (REPLACE_FLAG + LANGMAP) #define NORMAL_BUSY (0x100 + NORMAL) // Normal mode, busy with a command @@ -251,7 +250,7 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext() #define STRNCAT(d, s, n) strncat((char *)(d), (char *)(s), (size_t)(n)) #define STRLCAT(d, s, n) xstrlcat((char *)(d), (char *)(s), (size_t)(n)) -# define vim_strpbrk(s, cs) (char_u *)strpbrk((char *)(s), (char *)(cs)) +#define vim_strpbrk(s, cs) (char_u *)strpbrk((char *)(s), (char *)(cs)) // Character used as separated in autoload function/variable names. #define AUTOLOAD_CHAR '#' @@ -260,7 +259,7 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext() // Prefer using emsgf(), because perror() may send the output to the wrong // destination and mess up the screen. -#define PERROR(msg) (void) emsgf("%s: %s", msg, strerror(errno)) +#define PERROR(msg) (void)emsgf("%s: %s", msg, strerror(errno)) #define SHOWCMD_COLS 10 // columns needed by shown command @@ -301,16 +300,16 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext() # define mch_msg(str) printf("%s", (str)) #endif -#include "nvim/globals.h" // global variables and messages #include "nvim/buffer_defs.h" // buffer and windows #include "nvim/ex_cmds_defs.h" // Ex command defines +#include "nvim/globals.h" // global variables and messages // Lowest number used for window ID. Cannot have this many windows per tab. #define LOWEST_WIN_ID 1000 // BSD is supposed to cover FreeBSD and similar systems. #if (defined(BSD) || defined(__FreeBSD_kernel__)) \ - && (defined(S_ISCHR) || defined(S_IFCHR)) + && (defined(S_ISCHR) || defined(S_IFCHR)) # define OPEN_CHR_FILES #endif diff --git a/src/nvim/window.h b/src/nvim/window.h index 82b3fe5e88..7e465a9f08 100644 --- a/src/nvim/window.h +++ b/src/nvim/window.h @@ -5,11 +5,11 @@ #include "nvim/buffer_defs.h" -/* Values for file_name_in_line() */ -#define FNAME_MESS 1 /* give error message */ -#define FNAME_EXP 2 /* expand to path */ -#define FNAME_HYP 4 /* check for hypertext link */ -#define FNAME_INCL 8 /* apply 'includeexpr' */ +// Values for file_name_in_line() +#define FNAME_MESS 1 // give error message +#define FNAME_EXP 2 // expand to path +#define FNAME_HYP 4 // check for hypertext link +#define FNAME_INCL 8 // apply 'includeexpr' #define FNAME_REL 16 /* ".." and "./" are relative to the (current) file instead of the current directory */ #define FNAME_UNESC 32 // remove backslashes used for escaping @@ -17,20 +17,20 @@ /* * arguments for win_split() */ -#define WSP_ROOM 1 /* require enough room */ -#define WSP_VERT 2 /* split vertically */ -#define WSP_TOP 4 /* window at top-left of shell */ -#define WSP_BOT 8 /* window at bottom-right of shell */ -#define WSP_HELP 16 /* creating the help window */ -#define WSP_BELOW 32 /* put new window below/right */ -#define WSP_ABOVE 64 /* put new window above/left */ -#define WSP_NEWLOC 128 /* don't copy location list */ +#define WSP_ROOM 1 // require enough room +#define WSP_VERT 2 // split vertically +#define WSP_TOP 4 // window at top-left of shell +#define WSP_BOT 8 // window at bottom-right of shell +#define WSP_HELP 16 // creating the help window +#define WSP_BELOW 32 // put new window below/right +#define WSP_ABOVE 64 // put new window above/left +#define WSP_NEWLOC 128 // don't copy location list /* * Minimum screen size */ -#define MIN_COLUMNS 12 /* minimal columns for screen */ -#define MIN_LINES 2 /* minimal lines for screen */ +#define MIN_COLUMNS 12 // minimal columns for screen +#define MIN_LINES 2 // minimal lines for screen #ifdef INCLUDE_GENERATED_DECLARATIONS # include "window.h.generated.h" diff --git a/src/uncrustify.cfg b/src/uncrustify.cfg index 0e1e1de87f..7dbaec7d67 100644 --- a/src/uncrustify.cfg +++ b/src/uncrustify.cfg @@ -1,4 +1,4 @@ -# Uncrustify-0.73.0-199-0dfafb273 +# Uncrustify-0.73.0-199-0dfafb27 # # General options |